VoltageProcessor.py
678 lines
| 21.9 KiB
| text/x-python
|
PythonLexer
|
r10 | ''' | |
Created on Feb 7, 2012 | |||
|
r16 | @author $Author$ | |
@version $Id$ | |||
|
r10 | ''' | |
|
r72 | import os, sys | |
import numpy | |||
path = os.path.split(os.getcwd())[0] | |||
sys.path.append(path) | |||
from Model.Voltage import Voltage | |||
from IO.VoltageIO import VoltageWriter | |||
from Graphics.VoltagePlot import Osciloscope | |||
|
r108 | from Graphics.VoltagePlot import RTI | |
|
r72 | ||
|
r10 | class VoltageProcessor: | |
''' | |||
classdocs | |||
''' | |||
|
r99 | ||
dataInObj = None | |||
dataOutObj = None | |||
|
r107 | ||
|
r99 | integratorObjIndex = None | |
decoderObjIndex = None | |||
profSelectorObjIndex = None | |||
writerObjIndex = None | |||
plotterObjIndex = None | |||
|
r100 | flipIndex = None | |
|
r99 | ||
integratorObjList = [] | |||
decoderObjList = [] | |||
profileSelectorObjList = [] | |||
writerObjList = [] | |||
plotterObjList = [] | |||
m_Voltage= Voltage() | |||
|
r101 | ||
|
r107 | def __init__(self): | |
|
r10 | ''' | |
Constructor | |||
''' | |||
|
r72 | ||
|
r99 | self.integratorObjIndex = None | |
self.decoderObjIndex = None | |||
self.profSelectorObjIndex = None | |||
self.writerObjIndex = None | |||
self.plotterObjIndex = None | |||
|
r100 | self.flipIndex = 1 | |
|
r99 | self.integratorObjList = [] | |
self.decoderObjList = [] | |||
self.profileSelectorObjList = [] | |||
self.writerObjList = [] | |||
self.plotterObjList = [] | |||
|
r103 | ||
|
r107 | def setup(self, dataInObj=None, dataOutObj=None): | |
|
r103 | ||
|
r107 | self.dataInObj = dataInObj | |
if dataOutObj == None: | |||
dataOutObj = Voltage() | |||
|
r103 | ||
|
r107 | dataOutObj.copy(dataInObj) | |
self.dataOutObj = dataOutObj | |||
return self.dataOutObj | |||
|
r103 | ||
|
r72 | def init(self): | |
|
r92 | ||
|
r99 | self.integratorObjIndex = 0 | |
self.decoderObjIndex = 0 | |||
self.profSelectorObjIndex = 0 | |||
self.writerObjIndex = 0 | |||
self.plotterObjIndex = 0 | |||
self.dataOutObj.copy(self.dataInObj) | |||
|
r100 | ||
if self.profSelectorObjIndex != None: | |||
for profSelObj in self.profileSelectorObjList: | |||
profSelObj.incIndex() | |||
|
r72 | ||
|
r92 | def addWriter(self, wrpath): | |
|
r99 | objWriter = VoltageWriter(self.dataOutObj) | |
|
r72 | objWriter.setup(wrpath) | |
|
r99 | self.writerObjList.append(objWriter) | |
|
r108 | ||
def addRti(self,index=None): | |||
if index==None: | |||
index = self.plotterObjIndex | |||
plotObj = RTI(self.dataOutObj, index) | |||
self.plotterObjList.append(plotObj) | |||
|
r103 | def addPlotter(self, index=None): | |
if index==None: | |||
index = self.plotterObjIndex | |||
|
r72 | ||
|
r103 | plotObj = Osciloscope(self.dataOutObj, index) | |
|
r99 | self.plotterObjList.append(plotObj) | |
|
r103 | ||
|
r104 | def addIntegrator(self, N,timeInterval): | |
|
r72 | ||
|
r104 | objCohInt = CoherentIntegrator(N,timeInterval) | |
|
r99 | self.integratorObjList.append(objCohInt) | |
|
r72 | ||
|
r92 | def addDecoder(self, code, ncode, nbaud): | |
|
r72 | ||
objDecoder = Decoder(code,ncode,nbaud) | |||
|
r99 | self.decoderObjList.append(objDecoder) | |
|
r72 | ||
|
r92 | def addProfileSelector(self, nProfiles): | |
objProfSelector = ProfileSelector(nProfiles) | |||
|
r99 | self.profileSelectorObjList.append(objProfSelector) | |
|
r92 | ||
|
r72 | def writeData(self,wrpath): | |
|
r92 | ||
|
r99 | if self.dataOutObj.flagNoData: | |
|
r92 | return 0 | |
|
r72 | ||
|
r99 | if len(self.writerObjList) <= self.writerObjIndex: | |
|
r72 | self.addWriter(wrpath) | |
|
r99 | self.writerObjList[self.writerObjIndex].putData() | |
|
r72 | ||
|
r99 | self.writerObjIndex += 1 | |
|
r108 | ||
def addScope(self,index=None): | |||
if index==None: | |||
index = self.plotterObjIndex | |||
plotObj = Osciloscope(self.dataOutObj, index) | |||
self.plotterObjList.append(plotObj) | |||
def plotScope(self, | |||
xmin=None, | |||
xmax=None, | |||
ymin=None, | |||
ymax=None, | |||
titleList=None, | |||
xlabelList=None, | |||
ylabelList=None, | |||
winTitle='', | |||
type="power", | |||
index=None): | |||
if self.dataOutObj.flagNoData: | |||
return 0 | |||
if len(self.plotterObjList) <= self.plotterObjIndex: | |||
self.addScope(index) | |||
self.plotterObjList[self.plotterObjIndex].plotData(xmin, | |||
xmax, | |||
ymin, | |||
ymax, | |||
titleList, | |||
xlabelList, | |||
ylabelList, | |||
winTitle, | |||
type) | |||
self.plotterObjIndex += 1 | |||
def plotRti(self, | |||
xmin=None, | |||
xmax=None, | |||
ymin=None, | |||
ymax=None, | |||
zmin=None, | |||
zmax=None, | |||
titleList=None, | |||
xlabelList=None, | |||
ylabelList=None, | |||
winTitle='', | |||
timezone='lt', | |||
npoints=1000.0, | |||
colormap="br_green", | |||
showColorbar=True, | |||
showPowerProfile=False, | |||
XAxisAsTime=True, | |||
|
r113 | save=False, | |
|
r108 | index=None): | |
if self.dataOutObj.flagNoData: | |||
return 0 | |||
if len(self.plotterObjList) <= self.plotterObjIndex: | |||
self.addRti(index) | |||
self.plotterObjList[self.plotterObjIndex].plotData(xmin, | |||
xmax, | |||
ymin, | |||
ymax, | |||
zmin, | |||
zmax, | |||
titleList, | |||
xlabelList, | |||
ylabelList, | |||
winTitle, | |||
timezone, | |||
npoints, | |||
colormap, | |||
showColorbar, | |||
showPowerProfile, | |||
|
r113 | XAxisAsTime, | |
save) | |||
|
r108 | ||
self.plotterObjIndex += 1 | |||
|
r72 | ||
|
r103 | def plotData(self,xmin=None, xmax=None, ymin=None, ymax=None, type='iq', winTitle='', index=None): | |
|
r99 | if self.dataOutObj.flagNoData: | |
|
r92 | return 0 | |
|
r103 | ||
|
r99 | if len(self.plotterObjList) <= self.plotterObjIndex: | |
|
r103 | self.addPlotter(index) | |
|
r72 | ||
|
r103 | self.plotterObjList[self.plotterObjIndex].plotData(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,type=type, winTitle=winTitle) | |
|
r72 | ||
|
r99 | self.plotterObjIndex += 1 | |
|
r72 | ||
|
r104 | def integrator(self, N=None, timeInterval=None): | |
|
r92 | ||
|
r99 | if self.dataOutObj.flagNoData: | |
|
r92 | return 0 | |
|
r72 | ||
|
r99 | if len(self.integratorObjList) <= self.integratorObjIndex: | |
|
r104 | self.addIntegrator(N,timeInterval) | |
|
r72 | ||
|
r99 | myCohIntObj = self.integratorObjList[self.integratorObjIndex] | |
|
r104 | myCohIntObj.exe(data=self.dataOutObj.data,timeOfData=self.dataOutObj.m_BasicHeader.utc) | |
|
r72 | ||
|
r104 | if myCohIntObj.isReady: | |
|
r99 | self.dataOutObj.data = myCohIntObj.data | |
|
r104 | self.dataOutObj.nAvg = myCohIntObj.navg | |
self.dataOutObj.m_ProcessingHeader.coherentInt *= myCohIntObj.navg | |||
#print "myCohIntObj.navg: ",myCohIntObj.navg | |||
|
r99 | self.dataOutObj.flagNoData = False | |
|
r72 | ||
else: | |||
|
r99 | self.dataOutObj.flagNoData = True | |
|
r72 | ||
|
r99 | self.integratorObjIndex += 1 | |
|
r72 | ||
|
r116 | def decoder(self,code=None, mode = 0): | |
|
r92 | ||
|
r99 | if self.dataOutObj.flagNoData: | |
|
r92 | return 0 | |
|
r72 | if code == None: | |
|
r169 | code = self.dataOutObj.radarControllerHeaderObj.code | |
|
r72 | ncode, nbaud = code.shape | |
|
r99 | if len(self.decoderObjList) <= self.decoderObjIndex: | |
|
r72 | self.addDecoder(code,ncode,nbaud) | |
|
r99 | myDecodObj = self.decoderObjList[self.decoderObjIndex] | |
|
r116 | data, ndata = myDecodObj.exe(data=self.dataOutObj.data,mode=mode) | |
|
r72 | ||
|
r116 | self.dataOutObj.data = data | |
self.dataOutObj.nHeights = ndata | |||
self.dataOutObj.heightList = self.dataInObj.heightList[:ndata] | |||
self.dataOutObj.flagNoData = False | |||
|
r72 | ||
|
r99 | self.decoderObjIndex += 1 | |
|
r84 | ||
|
r72 | ||
|
r84 | def filterByHei(self, window): | |
|
r100 | if window == None: | |
|
r169 | window = self.dataOutObj.radarControllerHeaderObj.txA / self.dataOutObj.m_ProcessingHeader.deltaHeight[0] | |
|
r100 | ||
newdelta = self.dataOutObj.m_ProcessingHeader.deltaHeight[0] * window | |||
dim1 = self.dataOutObj.data.shape[0] | |||
dim2 = self.dataOutObj.data.shape[1] | |||
r = dim2 % window | |||
buffer = self.dataOutObj.data[:,0:dim2-r] | |||
buffer = buffer.reshape(dim1,dim2/window,window) | |||
buffer = numpy.sum(buffer,2) | |||
self.dataOutObj.data = buffer | |||
self.dataOutObj.m_ProcessingHeader.deltaHeight = newdelta | |||
self.dataOutObj.m_ProcessingHeader.numHeights = buffer.shape[1] | |||
self.dataOutObj.nHeights = self.dataOutObj.m_ProcessingHeader.numHeights | |||
#self.dataOutObj.heightList es un numpy.array | |||
self.dataOutObj.heightList = numpy.arange(self.dataOutObj.m_ProcessingHeader.firstHeight[0],newdelta*self.dataOutObj.nHeights,newdelta) | |||
def deFlip(self): | |||
self.dataOutObj.data *= self.flipIndex | |||
self.flipIndex *= -1. | |||
|
r72 | ||
|
r84 | def selectChannels(self, channelList): | |
|
r107 | pass | |
def selectChannelsByIndex(self, channelIndexList): | |||
|
r84 | """ | |
|
r107 | Selecciona un bloque de datos en base a canales segun el channelIndexList | |
|
r84 | ||
Input: | |||
|
r107 | channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7] | |
|
r84 | ||
Affected: | |||
|
r97 | self.dataOutObj.data | |
|
r107 | self.dataOutObj.channelIndexList | |
|
r84 | self.dataOutObj.nChannels | |
|
r99 | self.dataOutObj.m_ProcessingHeader.totalSpectra | |
|
r169 | self.dataOutObj.systemHeaderObj.numChannels | |
|
r99 | self.dataOutObj.m_ProcessingHeader.blockSize | |
|
r84 | ||
Return: | |||
None | |||
""" | |||
|
r99 | if self.dataOutObj.flagNoData: | |
|
r97 | return 0 | |
|
r107 | for channel in channelIndexList: | |
if channel not in self.dataOutObj.channelIndexList: | |||
raise ValueError, "The value %d in channelIndexList is not valid" %channel | |||
|
r84 | ||
|
r107 | nChannels = len(channelIndexList) | |
|
r101 | ||
|
r107 | data = self.dataOutObj.data[channelIndexList,:] | |
|
r101 | ||
|
r99 | self.dataOutObj.data = data | |
|
r107 | self.dataOutObj.channelIndexList = channelIndexList | |
|
r101 | self.dataOutObj.nChannels = nChannels | |
|
r107 | self.dataOutObj.m_ProcessingHeader.totalSpectra = 0 | |
|
r169 | self.dataOutObj.systemHeaderObj.numChannels = nChannels | |
|
r99 | self.dataOutObj.m_ProcessingHeader.blockSize = data.size | |
|
r97 | return 1 | |
|
r72 | ||
|
r84 | def selectHeightsByValue(self, minHei, maxHei): | |
""" | |||
Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango | |||
minHei <= height <= maxHei | |||
Input: | |||
minHei : valor minimo de altura a considerar | |||
maxHei : valor maximo de altura a considerar | |||
Affected: | |||
Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex | |||
Return: | |||
|
r97 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 | |
|
r84 | """ | |
|
r99 | if self.dataOutObj.flagNoData: | |
|
r97 | return 0 | |
|
r99 | if (minHei < self.dataOutObj.heightList[0]) or (minHei > maxHei): | |
|
r97 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
|
r99 | if (maxHei > self.dataOutObj.heightList[-1]): | |
|
r97 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
|
r84 | minIndex = 0 | |
maxIndex = 0 | |||
|
r99 | data = self.dataOutObj.heightList | |
|
r84 | ||
for i,val in enumerate(data): | |||
if val < minHei: | |||
continue | |||
else: | |||
minIndex = i; | |||
break | |||
for i,val in enumerate(data): | |||
if val <= maxHei: | |||
maxIndex = i; | |||
else: | |||
break | |||
self.selectHeightsByIndex(minIndex, maxIndex) | |||
|
r97 | return 1 | |
|
r84 | ||
def selectHeightsByIndex(self, minIndex, maxIndex): | |||
""" | |||
Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango | |||
minIndex <= index <= maxIndex | |||
Input: | |||
|
r97 | minIndex : valor de indice minimo de altura a considerar | |
maxIndex : valor de indice maximo de altura a considerar | |||
|
r84 | ||
Affected: | |||
|
r99 | self.dataOutObj.data | |
self.dataOutObj.heightList | |||
self.dataOutObj.nHeights | |||
self.dataOutObj.m_ProcessingHeader.blockSize | |||
self.dataOutObj.m_ProcessingHeader.numHeights | |||
self.dataOutObj.m_ProcessingHeader.firstHeight | |||
|
r169 | self.dataOutObj.radarControllerHeaderObj | |
|
r84 | ||
Return: | |||
|
r97 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 | |
|
r84 | """ | |
|
r99 | if self.dataOutObj.flagNoData: | |
|
r97 | return 0 | |
if (minIndex < 0) or (minIndex > maxIndex): | |||
raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |||
|
r99 | if (maxIndex >= self.dataOutObj.nHeights): | |
|
r97 | raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |
nHeights = maxIndex - minIndex + 1 | |||
|
r84 | ||
#voltage | |||
|
r99 | data = self.dataOutObj.data[:,minIndex:maxIndex+1] | |
|
r84 | ||
|
r99 | firstHeight = self.dataOutObj.heightList[minIndex] | |
|
r84 | ||
|
r99 | self.dataOutObj.data = data | |
self.dataOutObj.heightList = self.dataOutObj.heightList[minIndex:maxIndex+1] | |||
self.dataOutObj.nHeights = nHeights | |||
self.dataOutObj.m_ProcessingHeader.blockSize = data.size | |||
self.dataOutObj.m_ProcessingHeader.numHeights = nHeights | |||
self.dataOutObj.m_ProcessingHeader.firstHeight = firstHeight | |||
|
r169 | self.dataOutObj.radarControllerHeaderObj.numHeights = nHeights | |
|
r97 | return 1 | |
|
r84 | ||
|
r100 | def selectProfilesByValue(self,indexList, nProfiles): | |
if self.dataOutObj.flagNoData: | |||
return 0 | |||
if self.profSelectorObjIndex >= len(self.profileSelectorObjList): | |||
self.addProfileSelector(nProfiles) | |||
profileSelectorObj = self.profileSelectorObjList[self.profSelectorObjIndex] | |||
if not(profileSelectorObj.isProfileInList(indexList)): | |||
self.dataOutObj.flagNoData = True | |||
self.profSelectorObjIndex += 1 | |||
return 0 | |||
self.dataOutObj.flagNoData = False | |||
self.profSelectorObjIndex += 1 | |||
return 1 | |||
|
r84 | ||
|
r100 | def selectProfilesByIndex(self, minIndex, maxIndex, nProfiles): | |
|
r84 | """ | |
|
r97 | Selecciona un bloque de datos en base a un grupo indices de perfiles segun el rango | |
|
r84 | minIndex <= index <= maxIndex | |
Input: | |||
|
r97 | minIndex : valor de indice minimo de perfil a considerar | |
maxIndex : valor de indice maximo de perfil a considerar | |||
nProfiles : numero de profiles | |||
|
r84 | ||
Affected: | |||
|
r99 | self.dataOutObj.flagNoData | |
self.profSelectorObjIndex | |||
|
r84 | ||
Return: | |||
|
r97 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 | |
|
r84 | """ | |
|
r92 | ||
|
r99 | if self.dataOutObj.flagNoData: | |
|
r92 | return 0 | |
|
r99 | if self.profSelectorObjIndex >= len(self.profileSelectorObjList): | |
|
r92 | self.addProfileSelector(nProfiles) | |
|
r99 | profileSelectorObj = self.profileSelectorObjList[self.profSelectorObjIndex] | |
|
r92 | ||
|
r100 | if not(profileSelectorObj.isProfileInRange(minIndex, maxIndex)): | |
self.dataOutObj.flagNoData = True | |||
|
r99 | self.profSelectorObjIndex += 1 | |
|
r100 | return 0 | |
|
r92 | ||
|
r100 | self.dataOutObj.flagNoData = False | |
|
r99 | self.profSelectorObjIndex += 1 | |
|
r92 | ||
|
r100 | return 1 | |
|
r72 | ||
|
r84 | def selectNtxs(self, ntx): | |
|
r72 | pass | |
class Decoder: | |||
|
r99 | ||
data = None | |||
profCounter = 1 | |||
|
r101 | nCode = None | |
nBaud = None | |||
|
r99 | codeIndex = 0 | |
|
r101 | code = None | |
|
r99 | flag = False | |
|
r92 | ||
|
r72 | def __init__(self,code, ncode, nbaud): | |
|
r92 | ||
|
r99 | self.data = None | |
|
r116 | self.ndata = None | |
|
r72 | self.profCounter = 1 | |
self.nCode = ncode | |||
self.nBaud = nbaud | |||
self.codeIndex = 0 | |||
self.code = code #this is a List | |||
self.flag = False | |||
|
r116 | def exe(self, data, ndata=None, mode = 0): | |
|
r92 | ||
|
r73 | if ndata == None: ndata = data.shape[1] | |
|
r72 | ||
|
r116 | if mode == 0: | |
|
r72 | self.convolutionInFreq(data,ndata) | |
|
r116 | if mode == 1: | |
|
r72 | self.convolutionInTime(data, ndata) | |
|
r116 | ||
self.ndata = ndata - self.nBaud + 1 | |||
return self.data, self.ndata | |||
|
r92 | def convolutionInFreq(self,data, ndata): | |
|
r72 | ||
newcode = numpy.zeros(ndata) | |||
newcode[0:self.nBaud] = self.code[self.codeIndex] | |||
self.codeIndex += 1 | |||
|
r73 | fft_data = numpy.fft.fft(data, axis=1) | |
|
r72 | fft_code = numpy.conj(numpy.fft.fft(newcode)) | |
|
r73 | fft_code = fft_code.reshape(1,len(fft_code)) | |
|
r72 | ||
conv = fft_data.copy() | |||
conv.fill(0) | |||
|
r101 | conv = fft_data*fft_code | |
|
r72 | ||
|
r116 | data = numpy.fft.ifft(conv,axis=1) | |
self.data = data[:,:-self.nBaud+1] | |||
|
r72 | self.flag = True | |
if self.profCounter == self.nCode: | |||
self.profCounter = 0 | |||
self.codeIndex = 0 | |||
self.profCounter += 1 | |||
def convolutionInTime(self, data, ndata): | |||
nchannel = data.shape[1] | |||
newcode = self.code[self.codeIndex] | |||
self.codeIndex += 1 | |||
conv = data.copy() | |||
for i in range(nchannel): | |||
|
r116 | conv[i,:] = numpy.correlate(data[i,:], newcode) | |
|
r72 | ||
self.data = conv | |||
self.flag = True | |||
if self.profCounter == self.nCode: | |||
self.profCounter = 0 | |||
self.codeIndex = 0 | |||
self.profCounter += 1 | |||
class CoherentIntegrator: | |||
|
r92 | ||
|
r104 | integ_counter = None | |
|
r99 | data = None | |
|
r104 | navg = None | |
|
r99 | buffer = None | |
|
r101 | nCohInt = None | |
|
r99 | ||
|
r104 | def __init__(self, N=None,timeInterval=None): | |
|
r92 | ||
|
r72 | self.data = None | |
|
r104 | self.navg = None | |
|
r72 | self.buffer = None | |
|
r104 | self.timeOut = None | |
self.exitCondition = False | |||
self.isReady = False | |||
|
r72 | self.nCohInt = N | |
|
r104 | self.integ_counter = 0 | |
if timeInterval!=None: | |||
self.timeIntervalInSeconds = timeInterval * 60. #if (type(timeInterval)!=integer) -> change this line | |||
if ((timeInterval==None) and (N==None)): | |||
|
r116 | raise ValueError, "N = None ; timeInterval = None" | |
if timeInterval == None: | |||
|
r104 | self.timeFlag = False | |
else: | |||
self.timeFlag = True | |||
|
r72 | ||
|
r104 | def exe(self, data, timeOfData): | |
|
r72 | ||
|
r104 | if self.timeFlag: | |
if self.timeOut == None: | |||
self.timeOut = timeOfData + self.timeIntervalInSeconds | |||
if timeOfData < self.timeOut: | |||
if self.buffer == None: | |||
self.buffer = data | |||
else: | |||
self.buffer = self.buffer + data | |||
self.integ_counter += 1 | |||
else: | |||
self.exitCondition = True | |||
|
r72 | else: | |
|
r104 | if self.integ_counter < self.nCohInt: | |
if self.buffer == None: | |||
self.buffer = data | |||
else: | |||
self.buffer = self.buffer + data | |||
self.integ_counter += 1 | |||
if self.integ_counter == self.nCohInt: | |||
self.exitCondition = True | |||
if self.exitCondition: | |||
|
r72 | self.data = self.buffer | |
|
r104 | self.navg = self.integ_counter | |
self.isReady = True | |||
|
r72 | self.buffer = None | |
|
r104 | self.timeOut = None | |
self.integ_counter = 0 | |||
self.exitCondition = False | |||
if self.timeFlag: | |||
self.buffer = data | |||
self.timeOut = timeOfData + self.timeIntervalInSeconds | |||
|
r72 | else: | |
|
r104 | self.isReady = False | |
|
r72 | ||
|
r104 | ||
|
r72 | ||
|
r99 | class ProfileSelector: | |
|
r92 | ||
|
r100 | profileIndex = None | |
|
r97 | # Tamanho total de los perfiles | |
|
r92 | nProfiles = None | |
def __init__(self, nProfiles): | |||
|
r100 | self.profileIndex = 0 | |
|
r92 | self.nProfiles = nProfiles | |
|
r100 | def incIndex(self): | |
self.profileIndex += 1 | |||
if self.profileIndex >= self.nProfiles: | |||
self.profileIndex = 0 | |||
|
r92 | def isProfileInRange(self, minIndex, maxIndex): | |
|
r100 | if self.profileIndex < minIndex: | |
|
r92 | return False | |
|
r100 | if self.profileIndex > maxIndex: | |
|
r92 | return False | |
return True | |||
def isProfileInList(self, profileList): | |||
|
r100 | if self.profileIndex not in profileList: | |
|
r92 | return False | |
return True | |||
|
r72 |