##// END OF EJS Templates
Changes in Correlations Processing unit
Julio Valdez -
r854:23b4ca740232
parent child
Show More
@@ -1,10 +1,14
1 import numpy
1 import numpy
2
2
3 from jroproc_base import ProcessingUnit, Operation
3 from jroproc_base import ProcessingUnit, Operation
4 from schainpy.model.data.jrodata import Correlation
4 from schainpy.model.data.jrodata import Correlation, hildebrand_sekhon
5
5
6 class CorrelationProc(ProcessingUnit):
6 class CorrelationProc(ProcessingUnit):
7
7
8 pairsList = None
9
10 data_cf = None
11
8 def __init__(self):
12 def __init__(self):
9
13
10 ProcessingUnit.__init__(self)
14 ProcessingUnit.__init__(self)
@@ -40,6 +44,8 class CorrelationProc(ProcessingUnit):
40 self.dataOut.nCohInt = self.dataIn.nCohInt
44 self.dataOut.nCohInt = self.dataIn.nCohInt
41 # self.dataOut.nIncohInt = 1
45 # self.dataOut.nIncohInt = 1
42 self.dataOut.ippSeconds = self.dataIn.ippSeconds
46 self.dataOut.ippSeconds = self.dataIn.ippSeconds
47 self.dataOut.nProfiles = self.dataIn.nProfiles
48 self.dataOut.utctime = self.dataIn.utctime
43 # self.dataOut.windowOfFilter = self.dataIn.windowOfFilter
49 # self.dataOut.windowOfFilter = self.dataIn.windowOfFilter
44
50
45 # self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nPoints
51 # self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nPoints
@@ -80,48 +86,9 class CorrelationProc(ProcessingUnit):
80 self.dataOut.SNR = (SPot/NPot)[pairsAutoCorr]
86 self.dataOut.SNR = (SPot/NPot)[pairsAutoCorr]
81 self.dataOut.data_corr[:,:,indR,:] = jspectra
87 self.dataOut.data_corr[:,:,indR,:] = jspectra
82
88
83 return 1
89 return 1
84
90
85
91 def run(self, lags=None, mode = 'time', pairsList=None, fullBuffer=False, nAvg = 1, removeDC = False, splitCF=False):
86 def calculateNormFactor(self):
87
88 pairsList = self.dataOut.pairsList
89 pairsAutoCorr = self.dataOut.pairsAutoCorr
90 nHeights = self.dataOut.nHeights
91 nPairs = len(pairsList)
92 normFactor = numpy.zeros((nPairs,nHeights))
93
94 indR = numpy.where(self.dataOut.lagR == 0)[0][0]
95 indT = numpy.where(self.dataOut.lagT == 0)[0][0]
96
97 for l in range(len(pairsList)):
98 firstChannel = pairsList[l][0]
99 secondChannel = pairsList[l][1]
100
101 AC1 = pairsAutoCorr[firstChannel]
102 AC2 = pairsAutoCorr[secondChannel]
103
104 if (AC1 >= 0 and AC2 >= 0):
105
106 data1 = numpy.abs(self.dataOut.data_corr[AC1,:,indR,:])
107 data2 = numpy.abs(self.dataOut.data_corr[AC2,:,indR,:])
108 maxim1 = data1.max(axis = 0)
109 maxim2 = data1.max(axis = 0)
110 maxim = numpy.sqrt(maxim1*maxim2)
111 else:
112 #In case there is no autocorrelation for the pair
113 data = numpy.abs(self.dataOut.data_corr[l,:,indR,:])
114 maxim = numpy.max(data, axis = 0)
115
116 normFactor[l,:] = maxim
117
118 self.dataOut.normFactor = normFactor
119
120 return 1
121
122 def run(self, lagT=None, lagR=None, pairsList=None,
123 nPoints=None, nAvg=None, bufferSize=None,
124 fullT = False, fullR = False, removeDC = False):
125
92
126 self.dataOut.flagNoData = True
93 self.dataOut.flagNoData = True
127
94
@@ -133,114 +100,79 class CorrelationProc(ProcessingUnit):
133
100
134 if self.dataIn.type == "Voltage":
101 if self.dataIn.type == "Voltage":
135
102
136 if pairsList == None:
103 nChannels = self.dataIn.nChannels
137 pairsList = [numpy.array([0,0])]
104 nProfiles = self.dataIn.nProfiles
138
105 nHeights = self.dataIn.nHeights
139 if nPoints == None:
106 data_pre = self.dataIn.data
140 nPoints = 128
141 #------------------------------------------------------------
142 #Condicionales para calcular Correlaciones en Tiempo y Rango
143 if fullT:
144 lagT = numpy.arange(nPoints*2 - 1) - nPoints + 1
145 elif lagT == None:
146 lagT = numpy.array([0])
147 else:
148 lagT = numpy.array(lagT)
149
150 if fullR:
151 lagR = numpy.arange(self.dataOut.nHeights)
152 elif lagR == None:
153 lagR = numpy.array([0])
154 #-------------------------------------------------------------
155
156 if nAvg == None:
157 nAvg = 1
158
159 if bufferSize == None:
160 bufferSize = 0
161
162 deltaH = self.dataIn.heightList[1] - self.dataIn.heightList[0]
163 self.dataOut.lagR = numpy.round(numpy.array(lagR)/deltaH)
164 self.dataOut.pairsList = pairsList
165 self.dataOut.nPoints = nPoints
166 # channels = numpy.sort(list(set(list(itertools.chain.from_iterable(pairsList)))))
167
107
168 if self.buffer is None:
108 #--------------- Remover DC ------------
109 if removeDC:
110 data_pre = self.removeDC(data_pre)
169
111
170 self.buffer = numpy.zeros((self.dataIn.nChannels,self.dataIn.nProfiles,self.dataIn.nHeights),dtype='complex')
112 #---------------------------------------------
171
113 # pairsList = list(ccfList)
172
114 # for i in acfList:
173 self.buffer[:,self.profIndex,:] = self.dataIn.data.copy()[:,:]
115 # pairsList.append((i,i))
116 #
117 # ccf_pairs = numpy.arange(len(ccfList))
118 # acf_pairs = numpy.arange(len(ccfList),len(pairsList))
119 self.__updateObjFromVoltage()
120 #----------------------------------------------------------------------
121 #Creating temporal buffers
122 if fullBuffer:
123 tmp = numpy.zeros((len(pairsList), len(lags), nProfiles, nHeights), dtype = 'complex')*numpy.nan
124 elif mode == 'time':
125 if lags == None:
126 lags = numpy.arange(-nProfiles+1, nProfiles)
127 tmp = numpy.zeros((len(pairsList), len(lags), nHeights),dtype='complex')
128 elif mode == 'height':
129 if lags == None:
130 lags = numpy.arange(-nHeights+1, nHeights)
131 tmp = numpy.zeros(len(pairsList), (len(lags), nProfiles),dtype='complex')
174
132
175 self.profIndex += 1
133 #For loop
176
134 for l in range(len(pairsList)):
177 if self.firstdatatime == None:
178
135
179 self.firstdatatime = self.dataIn.utctime
136 ch0 = pairsList[l][0]
180
137 ch1 = pairsList[l][1]
181 if self.profIndex == nPoints:
138
182
139 for i in range(len(lags)):
183 tmp = self.buffer[:,0:nPoints,:]
140 idx = lags[i]
184 self.buffer = None
185 self.buffer = tmp
186
187 #--------------- Remover DC ------------
188 if removeDC:
189 self.buffer = self.removeDC(self.buffer)
190 #---------------------------------------------
191 self.dataOut.data_volts = self.buffer
192 self.__updateObjFromVoltage()
193 self.dataOut.data_corr = numpy.zeros((len(pairsList),
194 len(lagT),len(lagR),
195 self.dataIn.nHeights),
196 dtype='complex')
197
198 for l in range(len(pairsList)):
199
200 firstChannel = pairsList[l][0]
201 secondChannel = pairsList[l][1]
202
203 tmp = None
204 tmp = numpy.zeros((len(lagT),len(lagR),self.dataIn.nHeights),dtype='complex')
205
141
206 for t in range(len(lagT)):
142 if idx >= 0:
143 if mode == 'time':
144 ccf0 = data_pre[ch0,:nProfiles-idx,:]*numpy.conj(data_pre[ch1,idx:,:]) #time
145 else:
146 ccf0 = data_pre[ch0,:,nHeights-idx]*numpy.conj(data_pre[ch1,:,idx:]) #heights
147 else:
148 if mode == 'time':
149 ccf0 = data_pre[ch0,-idx:,:]*numpy.conj(data_pre[ch1,:nProfiles+idx,:]) #time
150 else:
151 ccf0 = data_pre[ch0,:,-idx:]*numpy.conj(data_pre[ch1,:,:nHeights+idx]) #heights
207
152
208 for r in range(len(lagR)):
153 if fullBuffer:
209
154 tmp[l,i,:ccf0.shape[0],:] = ccf0
210 idxT = lagT[t]
155 else:
211 idxR = lagR[r]
156 tmp[l,i,:] = numpy.sum(ccf0, axis=0)
212
157
213 if idxT >= 0:
158 #-----------------------------------------------------------------
214 vStacked = numpy.vstack((self.buffer[secondChannel,idxT:,:],
159 if fullBuffer:
215 numpy.zeros((idxT,self.dataIn.nHeights),dtype='complex')))
160 tmp = numpy.sum(numpy.reshape(tmp,(tmp.shape[0],tmp.shape[1],tmp.shape[2]/nAvg,nAvg,tmp.shape[3])),axis=3)
216 else:
161 self.dataOut.nAvg = nAvg
217 vStacked = numpy.vstack((numpy.zeros((-idxT,self.dataIn.nHeights),dtype='complex'),
162
218 self.buffer[secondChannel,:(nPoints + idxT),:]))
163 self.dataOut.data_cf = tmp
219
164 self.dataOut.mode = mode
220 if idxR >= 0:
165 self.dataOut.nLags = len(lags)
221 hStacked = numpy.hstack((vStacked[:,idxR:],numpy.zeros((nPoints,idxR),dtype='complex')))
166 self.dataOut.pairsList = pairsList
222 else:
167 self.dataOut.nPairs = len(pairsList)
223 hStacked = numpy.hstack((numpy.zeros((nPoints,-idxR),dtype='complex'),vStacked[:,(self.dataOut.nHeights + idxR)]))
168
224
169 #Se Calcula los factores de Normalizacion
225
170 if mode == 'time':
226 tmp[t,r,:] = numpy.sum((numpy.conjugate(self.buffer[firstChannel,:,:])*hStacked),axis=0)
171 delta = self.dataIn.ippSeconds*self.dataIn.nCohInt
227
172 else:
228
173 delta = self.dataIn.heightList[1] - self.dataIn.heightList[0]
229 hStacked = None
174 self.dataOut.lagRange = numpy.array(lags)*delta
230 vStacked = None
175 # self.dataOut.nCohInt = self.dataIn.nCohInt*nAvg
231
176 self.dataOut.flagNoData = False
232 self.dataOut.data_corr[l,:,:,:] = tmp[:,:,:]
177 a = self.dataOut.normFactor
233
178 return No newline at end of file
234 #Se Calcula los factores de Normalizacion
235 self.dataOut.pairsAutoCorr = self.dataOut.getPairsAutoCorr()
236 self.dataOut.lagT = lagT*self.dataIn.ippSeconds*self.dataIn.nCohInt
237 self.dataOut.lagR = lagR
238
239 self.calculateNormFactor()
240
241 self.dataOut.flagNoData = False
242 self.buffer = None
243 self.firstdatatime = None
244 self.profIndex = 0
245
246 return No newline at end of file
@@ -86,21 +86,19 class ParametersProc(ProcessingUnit):
86 #---------------------- Correlation Data ---------------------------
86 #---------------------- Correlation Data ---------------------------
87
87
88 if self.dataIn.type == "Correlation":
88 if self.dataIn.type == "Correlation":
89 acf_ind, ccf_ind, acf_pairs, ccf_pairs, data_acf, data_ccf = self.dataIn.splitFunctions()
89
90
90 if self.dataIn.data_ccf is not None:
91 self.dataOut.data_pre = (self.dataIn.data_cf[acf_ind,:], self.dataIn.data_cf[ccf_ind,:,:])
91 self.dataOut.data_pre = (self.dataIn.data_acf,self.dataIn.data_ccf)
92 self.dataOut.normFactor = (self.dataIn.normFactor[acf_ind,:], self.dataIn.normFactor[ccf_ind,:])
92 else:
93 self.dataOut.groupList = (acf_pairs, ccf_pairs)
93 self.dataOut.data_pre = self.dataIn.data_acf.copy()
94
94
95 self.dataOut.abscissaList = self.dataIn.lagRange
95 self.dataOut.abscissaList = self.dataIn.lagRange
96 self.dataOut.noise = self.dataIn.noise
96 self.dataOut.noise = self.dataIn.noise
97 self.dataOut.normFactor = self.dataIn.normFactor
98 self.dataOut.data_SNR = self.dataIn.SNR
97 self.dataOut.data_SNR = self.dataIn.SNR
99 self.dataOut.groupList = self.dataIn.pairsList
100 self.dataOut.flagNoData = False
98 self.dataOut.flagNoData = False
101 self.dataOut.nAvg = self.dataIn.nAvg
99 self.dataOut.nAvg = self.dataIn.nAvg
102
100
103 #---------------------- Parameters Data ---------------------------
101 #---------------------- Parameters Data ---------------------------
104
102
105 if self.dataIn.type == "Parameters":
103 if self.dataIn.type == "Parameters":
106 self.dataOut.copy(self.dataIn)
104 self.dataOut.copy(self.dataIn)
@@ -123,11 +121,19 class SpectralMoments(Operation):
123
121
124 Type of dataIn: Spectra
122 Type of dataIn: Spectra
125
123
124 Configuration Parameters:
125
126 dirCosx : Cosine director in X axis
127 dirCosy : Cosine director in Y axis
128
129 elevation :
130 azimuth :
131
126 Input:
132 Input:
127 channelList : simple channel list to select e.g. [2,3,7]
133 channelList : simple channel list to select e.g. [2,3,7]
128 self.dataOut.data_pre : Spectral data
134 self.dataOut.data_pre : Spectral data
129 self.dataOut.abscissaList : List of frequencies
135 self.dataOut.abscissaList : List of frequencies
130 self.dataOut.noise : Noise level per channel
136 self.dataOut.noise : Noise level per channel
131
137
132 Affected:
138 Affected:
133 self.dataOut.data_param : Parameters per channel
139 self.dataOut.data_param : Parameters per channel
@@ -135,20 +141,16 class SpectralMoments(Operation):
135
141
136 '''
142 '''
137
143
138 def run(self, dataOut, channelList=None):
144 def run(self, dataOut):
139
145
140 dataOut.data_pre = dataOut.data_pre[0]
146 dataOut.data_pre = dataOut.data_pre[0]
141 data = dataOut.data_pre
147 data = dataOut.data_pre
142 absc = dataOut.abscissaList[:-1]
148 absc = dataOut.abscissaList[:-1]
143 noise = dataOut.noise
149 noise = dataOut.noise
144
150 nChannel = data.shape[0]
145 data_param = numpy.zeros((data.shape[0], 4, data.shape[2]))
151 data_param = numpy.zeros((nChannel, 4, data.shape[2]))
146
152
147 if channelList== None:
153 for ind in range(nChannel):
148 channelList = dataOut.channelList
149 dataOut.channelList = channelList
150
151 for ind in channelList:
152 data_param[ind,:,:] = self.__calculateMoments(data[ind,:,:], absc, noise[ind])
154 data_param[ind,:,:] = self.__calculateMoments(data[ind,:,:], absc, noise[ind])
153
155
154 dataOut.data_param = data_param[:,1:,:]
156 dataOut.data_param = data_param[:,1:,:]
@@ -277,26 +279,30 class SALags(Operation):
277
279
278 '''
280 '''
279 def run(self, dataOut):
281 def run(self, dataOut):
280 data = dataOut.data_pre
281 data_acf = dataOut.data_pre[0]
282 data_acf = dataOut.data_pre[0]
282 data_ccf = dataOut.data_pre[1]
283 data_ccf = dataOut.data_pre[1]
284 normFactor_acf = dataOut.normFactor[0]
285 normFactor_ccf = dataOut.normFactor[1]
286 pairs_acf = dataOut.groupList[0]
287 pairs_ccf = dataOut.groupList[1]
283
288
284 normFactor = dataOut.normFactor
285 nHeights = dataOut.nHeights
289 nHeights = dataOut.nHeights
286 absc = dataOut.abscissaList[:-1]
290 absc = dataOut.abscissaList
287 noise = dataOut.noise
291 noise = dataOut.noise
288 SNR = dataOut.data_SNR
292 SNR = dataOut.data_SNR
289 # pairsList = dataOut.groupList
290 nChannels = dataOut.nChannels
293 nChannels = dataOut.nChannels
294 # pairsList = dataOut.groupList
291 # pairsAutoCorr, pairsCrossCorr = self.__getPairsAutoCorr(pairsList, nChannels)
295 # pairsAutoCorr, pairsCrossCorr = self.__getPairsAutoCorr(pairsList, nChannels)
292 dataOut.data_param = numpy.zeros((len(pairsCrossCorr)*2 + 1, nHeights))
296
293
297 for l in range(len(pairs_acf)):
294 dataNorm = numpy.abs(data)
298 data_acf[l,:,:] = data_acf[l,:,:]/normFactor_acf[l,:]
295 for l in range(len(pairsList)):
299
296 dataNorm[l,:,:] = dataNorm[l,:,:]/normFactor[l,:]
300 for l in range(len(pairs_ccf)):
301 data_ccf[l,:,:] = data_ccf[l,:,:]/normFactor_ccf[l,:]
297
302
298 self.dataOut.data_param[:-1,:] = self.__calculateTaus(dataNorm, pairsCrossCorr, pairsAutoCorr, absc)
303 dataOut.data_param = numpy.zeros((len(pairs_ccf)*2 + 1, nHeights))
299 self.dataOut.data_param[-1,:] = self.__calculateLag1Phase(data_acf, absc)
304 dataOut.data_param[:-1,:] = self.__calculateTaus(data_acf, data_ccf, absc)
305 dataOut.data_param[-1,:] = self.__calculateLag1Phase(data_acf, absc)
300 return
306 return
301
307
302 # def __getPairsAutoCorr(self, pairsList, nChannels):
308 # def __getPairsAutoCorr(self, pairsList, nChannels):
@@ -318,29 +324,30 class SALags(Operation):
318 #
324 #
319 # return pairsAutoCorr, pairsCrossCorr
325 # return pairsAutoCorr, pairsCrossCorr
320
326
321 def __calculateTaus(self, data, pairsCrossCorr, pairsAutoCorr, lagTRange):
327 def __calculateTaus(self, data_acf, data_ccf, lagRange):
322
328
323 Pt0 = data.shape[1]/2
329 lag0 = data_acf.shape[1]/2
324 #Funcion de Autocorrelacion
330 #Funcion de Autocorrelacion
325 dataAutoCorr = stats.nanmean(data[pairsAutoCorr,:,:], axis = 0)
331 mean_acf = stats.nanmean(data_acf, axis = 0)
326
332
327 #Obtencion Indice de TauCross
333 #Obtencion Indice de TauCross
328 indCross = data[pairsCrossCorr,:,:].argmax(axis = 1)
334 ind_ccf = data_ccf.argmax(axis = 1)
329 #Obtencion Indice de TauAuto
335 #Obtencion Indice de TauAuto
330 indAuto = numpy.zeros(indCross.shape,dtype = 'int')
336 ind_acf = numpy.zeros(ind_ccf.shape,dtype = 'int')
331 CCValue = data[pairsCrossCorr,Pt0,:]
337 ccf_lag0 = data_ccf[:,lag0,:]
332 for i in range(pairsCrossCorr.size):
338
333 indAuto[i,:] = numpy.abs(dataAutoCorr - CCValue[i,:]).argmin(axis = 0)
339 for i in range(ccf_lag0.shape[0]):
340 ind_acf[i,:] = numpy.abs(mean_acf - ccf_lag0[i,:]).argmin(axis = 0)
334
341
335 #Obtencion de TauCross y TauAuto
342 #Obtencion de TauCross y TauAuto
336 tauCross = lagTRange[indCross]
343 tau_ccf = lagRange[ind_ccf]
337 tauAuto = lagTRange[indAuto]
344 tau_acf = lagRange[ind_acf]
338
345
339 Nan1, Nan2 = numpy.where(tauCross == lagTRange[0])
346 Nan1, Nan2 = numpy.where(tau_ccf == lagRange[0])
340
347
341 tauCross[Nan1,Nan2] = numpy.nan
348 tau_ccf[Nan1,Nan2] = numpy.nan
342 tauAuto[Nan1,Nan2] = numpy.nan
349 tau_acf[Nan1,Nan2] = numpy.nan
343 tau = numpy.vstack((tauCross,tauAuto))
350 tau = numpy.vstack((tau_ccf,tau_acf))
344
351
345 return tau
352 return tau
346
353
@@ -595,7 +602,8 class WindProfiler(Operation):
595 return velUVW
602 return velUVW
596
603
597 # def techniqueDBS(self, velRadial0, dirCosx, disrCosy, azimuth, correct, horizontalOnly, heiRang, SNR0):
604 # def techniqueDBS(self, velRadial0, dirCosx, disrCosy, azimuth, correct, horizontalOnly, heiRang, SNR0):
598 def techniqueDBS(self, velRadial0, heiRang, SNR0, kwargs):
605
606 def techniqueDBS(self, kwargs):
599 """
607 """
600 Function that implements Doppler Beam Swinging (DBS) technique.
608 Function that implements Doppler Beam Swinging (DBS) technique.
601
609
@@ -606,6 +614,9 class WindProfiler(Operation):
606
614
607 Parameters affected: Winds, height range, SNR
615 Parameters affected: Winds, height range, SNR
608 """
616 """
617 velRadial0 = kwargs['velRadial']
618 heiRang = kwargs['heightList']
619 SNR0 = kwargs['SNR']
609
620
610 if kwargs.has_key('dirCosx') and kwargs.has_key('dirCosy'):
621 if kwargs.has_key('dirCosx') and kwargs.has_key('dirCosy'):
611 theta_x = numpy.array(kwargs['dirCosx'])
622 theta_x = numpy.array(kwargs['dirCosx'])
@@ -639,8 +650,9 class WindProfiler(Operation):
639
650
640 return winds, heiRang1, SNR1
651 return winds, heiRang1, SNR1
641
652
642 def __calculateDistance(self, posx, posy, pairsCrossCorr, pairsList, pairs, azimuth = None):
653 def __calculateDistance(self, posx, posy, pairs_ccf, azimuth = None):
643
654
655 nPairs = len(pairs_ccf)
644 posx = numpy.asarray(posx)
656 posx = numpy.asarray(posx)
645 posy = numpy.asarray(posy)
657 posy = numpy.asarray(posy)
646
658
@@ -654,28 +666,31 class WindProfiler(Operation):
654 posy1 = posy
666 posy1 = posy
655
667
656 #Calculo de Distancias
668 #Calculo de Distancias
657 distx = numpy.zeros(pairsCrossCorr.size)
669 distx = numpy.zeros(nPairs)
658 disty = numpy.zeros(pairsCrossCorr.size)
670 disty = numpy.zeros(nPairs)
659 dist = numpy.zeros(pairsCrossCorr.size)
671 dist = numpy.zeros(nPairs)
660 ang = numpy.zeros(pairsCrossCorr.size)
672 ang = numpy.zeros(nPairs)
661
673
662 for i in range(pairsCrossCorr.size):
674 for i in range(nPairs):
663 distx[i] = posx1[pairsList[pairsCrossCorr[i]][1]] - posx1[pairsList[pairsCrossCorr[i]][0]]
675 distx[i] = posx1[pairs_ccf[i][1]] - posx1[pairs_ccf[i][0]]
664 disty[i] = posy1[pairsList[pairsCrossCorr[i]][1]] - posy1[pairsList[pairsCrossCorr[i]][0]]
676 disty[i] = posy1[pairs_ccf[i][1]] - posy1[pairs_ccf[i][0]]
665 dist[i] = numpy.sqrt(distx[i]**2 + disty[i]**2)
677 dist[i] = numpy.sqrt(distx[i]**2 + disty[i]**2)
666 ang[i] = numpy.arctan2(disty[i],distx[i])
678 ang[i] = numpy.arctan2(disty[i],distx[i])
667 #Calculo de Matrices
668 nPairs = len(pairs)
669 ang1 = numpy.zeros((nPairs, 2, 1))
670 dist1 = numpy.zeros((nPairs, 2, 1))
671
679
672 for j in range(nPairs):
680 return distx, disty, dist, ang
673 dist1[j,0,0] = dist[pairs[j][0]]
681 #Calculo de Matrices
674 dist1[j,1,0] = dist[pairs[j][1]]
682 # nPairs = len(pairs)
675 ang1[j,0,0] = ang[pairs[j][0]]
683 # ang1 = numpy.zeros((nPairs, 2, 1))
676 ang1[j,1,0] = ang[pairs[j][1]]
684 # dist1 = numpy.zeros((nPairs, 2, 1))
677
685 #
678 return distx,disty, dist1,ang1
686 # for j in range(nPairs):
687 # dist1[j,0,0] = dist[pairs[j][0]]
688 # dist1[j,1,0] = dist[pairs[j][1]]
689 # ang1[j,0,0] = ang[pairs[j][0]]
690 # ang1[j,1,0] = ang[pairs[j][1]]
691 #
692 # return distx,disty, dist1,ang1
693
679
694
680 def __calculateVelVer(self, phase, lagTRange, _lambda):
695 def __calculateVelVer(self, phase, lagTRange, _lambda):
681
696
@@ -686,12 +701,14 class WindProfiler(Operation):
686
701
687 def __calculateVelHorDir(self, dist, tau1, tau2, ang):
702 def __calculateVelHorDir(self, dist, tau1, tau2, ang):
688 nPairs = tau1.shape[0]
703 nPairs = tau1.shape[0]
689 vel = numpy.zeros((nPairs,3,tau1.shape[2]))
704 nHeights = tau1.shape[1]
705 vel = numpy.zeros((nPairs,3,nHeights))
706 dist1 = numpy.reshape(dist, (dist.size,1))
690
707
691 angCos = numpy.cos(ang)
708 angCos = numpy.cos(ang)
692 angSin = numpy.sin(ang)
709 angSin = numpy.sin(ang)
693
710
694 vel0 = dist*tau1/(2*tau2**2)
711 vel0 = dist1*tau1/(2*tau2**2)
695 vel[:,0,:] = (vel0*angCos).sum(axis = 1)
712 vel[:,0,:] = (vel0*angCos).sum(axis = 1)
696 vel[:,1,:] = (vel0*angSin).sum(axis = 1)
713 vel[:,1,:] = (vel0*angSin).sum(axis = 1)
697
714
@@ -700,26 +717,28 class WindProfiler(Operation):
700
717
701 return vel
718 return vel
702
719
703 def __getPairsAutoCorr(self, pairsList, nChannels):
720 # def __getPairsAutoCorr(self, pairsList, nChannels):
704
721 #
705 pairsAutoCorr = numpy.zeros(nChannels, dtype = 'int')*numpy.nan
722 # pairsAutoCorr = numpy.zeros(nChannels, dtype = 'int')*numpy.nan
706
723 #
707 for l in range(len(pairsList)):
724 # for l in range(len(pairsList)):
708 firstChannel = pairsList[l][0]
725 # firstChannel = pairsList[l][0]
709 secondChannel = pairsList[l][1]
726 # secondChannel = pairsList[l][1]
710
727 #
711 #Obteniendo pares de Autocorrelacion
728 # #Obteniendo pares de Autocorrelacion
712 if firstChannel == secondChannel:
729 # if firstChannel == secondChannel:
713 pairsAutoCorr[firstChannel] = int(l)
730 # pairsAutoCorr[firstChannel] = int(l)
714
731 #
715 pairsAutoCorr = pairsAutoCorr.astype(int)
732 # pairsAutoCorr = pairsAutoCorr.astype(int)
716
733 #
717 pairsCrossCorr = range(len(pairsList))
734 # pairsCrossCorr = range(len(pairsList))
718 pairsCrossCorr = numpy.delete(pairsCrossCorr,pairsAutoCorr)
735 # pairsCrossCorr = numpy.delete(pairsCrossCorr,pairsAutoCorr)
719
736 #
720 return pairsAutoCorr, pairsCrossCorr
737 # return pairsAutoCorr, pairsCrossCorr
721
738
722 def techniqueSA(self, pairsSelected, pairsList, nChannels, tau, azimuth, _lambda, position_x, position_y, lagTRange, correctFactor):
739 # def techniqueSA(self, pairsSelected, pairsList, nChannels, tau, azimuth, _lambda, position_x, position_y, lagTRange, correctFactor):
740 def techniqueSA(self, kwargs):
741
723 """
742 """
724 Function that implements Spaced Antenna (SA) technique.
743 Function that implements Spaced Antenna (SA) technique.
725
744
@@ -730,28 +749,42 class WindProfiler(Operation):
730
749
731 Parameters affected: Winds
750 Parameters affected: Winds
732 """
751 """
733 #Cross Correlation pairs obtained
752 position_x = kwargs['positionX']
734 pairsAutoCorr, pairsCrossCorr = self.__getPairsAutoCorr(pairsList, nChannels)
753 position_y = kwargs['positionY']
735 pairsArray = numpy.array(pairsList)[pairsCrossCorr]
754 azimuth = kwargs['azimuth']
736 pairsSelArray = numpy.array(pairsSelected)
755
737 pairs = []
756 if kwargs.has_key('correctFactor'):
757 correctFactor = kwargs['correctFactor']
758 else:
759 correctFactor = 1
760
761 groupList = kwargs['groupList']
762 pairs_ccf = groupList[1]
763 tau = kwargs['tau']
764 _lambda = kwargs['_lambda']
738
765
739 #Wind estimation pairs obtained
766 #Cross Correlation pairs obtained
740 for i in range(pairsSelArray.shape[0]/2):
767 # pairsAutoCorr, pairsCrossCorr = self.__getPairsAutoCorr(pairssList, nChannels)
741 ind1 = numpy.where(numpy.all(pairsArray == pairsSelArray[2*i], axis = 1))[0][0]
768 # pairsArray = numpy.array(pairsList)[pairsCrossCorr]
742 ind2 = numpy.where(numpy.all(pairsArray == pairsSelArray[2*i + 1], axis = 1))[0][0]
769 # pairsSelArray = numpy.array(pairsSelected)
743 pairs.append((ind1,ind2))
770 # pairs = []
771 #
772 # #Wind estimation pairs obtained
773 # for i in range(pairsSelArray.shape[0]/2):
774 # ind1 = numpy.where(numpy.all(pairsArray == pairsSelArray[2*i], axis = 1))[0][0]
775 # ind2 = numpy.where(numpy.all(pairsArray == pairsSelArray[2*i + 1], axis = 1))[0][0]
776 # pairs.append((ind1,ind2))
744
777
745 indtau = tau.shape[0]/2
778 indtau = tau.shape[0]/2
746 tau1 = tau[:indtau,:]
779 tau1 = tau[:indtau,:]
747 tau2 = tau[indtau:-1,:]
780 tau2 = tau[indtau:-1,:]
748 tau1 = tau1[pairs,:]
781 # tau1 = tau1[pairs,:]
749 tau2 = tau2[pairs,:]
782 # tau2 = tau2[pairs,:]
750 phase1 = tau[-1,:]
783 phase1 = tau[-1,:]
751
784
752 #---------------------------------------------------------------------
785 #---------------------------------------------------------------------
753 #Metodo Directo
786 #Metodo Directo
754 distx, disty, dist, ang = self.__calculateDistance(position_x, position_y, pairsCrossCorr, pairsList, pairs,azimuth)
787 distx, disty, dist, ang = self.__calculateDistance(position_x, position_y, pairs_ccf,azimuth)
755 winds = self.__calculateVelHorDir(dist, tau1, tau2, ang)
788 winds = self.__calculateVelHorDir(dist, tau1, tau2, ang)
756 winds = stats.nanmean(winds, axis=0)
789 winds = stats.nanmean(winds, axis=0)
757 #---------------------------------------------------------------------
790 #---------------------------------------------------------------------
@@ -1008,58 +1041,42 class WindProfiler(Operation):
1008 SNR = dataOut.data_SNR
1041 SNR = dataOut.data_SNR
1009
1042
1010 if technique == 'DBS':
1043 if technique == 'DBS':
1011 # if kwargs.has_key('dirCosx') and kwargs.has_key('dirCosy'):
1044
1012 # theta_x = numpy.array(kwargs['dirCosx'])
1045 kwargs['velRadial'] = param[:,1,:] #Radial velocity
1013 # theta_y = numpy.array(kwargs['dirCosy'])
1046 kwargs['heightList'] = heightList
1014 # else:
1047 kwargs['SNR'] = SNR
1015 # elev = numpy.array(kwargs['elevation'])
1048
1016 # azim = numpy.array(kwargs['azimuth'])
1049 dataOut.data_output, dataOut.heightList, dataOut.data_SNR = self.techniqueDBS(kwargs) #DBS Function
1017 # theta_x, theta_y = self.__calculateCosDir(elev, azim)
1018 # azimuth = kwargs['correctAzimuth']
1019 # if kwargs.has_key('horizontalOnly'):
1020 # horizontalOnly = kwargs['horizontalOnly']
1021 # else: horizontalOnly = False
1022 # if kwargs.has_key('correctFactor'):
1023 # correctFactor = kwargs['correctFactor']
1024 # else: correctFactor = 1
1025 # if kwargs.has_key('channelList'):
1026 # channelList = kwargs['channelList']
1027 # if len(channelList) == 2:
1028 # horizontalOnly = True
1029 # arrayChannel = numpy.array(channelList)
1030 # param = param[arrayChannel,:,:]
1031 # theta_x = theta_x[arrayChannel]
1032 # theta_y = theta_y[arrayChannel]
1033
1034 velRadial0 = param[:,1,:] #Radial velocity
1035 # dataOut.data_output, dataOut.heightList, dataOut.data_SNR = self.techniqueDBS(velRadial0, theta_x, theta_y, azimuth, correctFactor, horizontalOnly, heightList, SNR) #DBS Function
1036 dataOut.data_output, dataOut.heightList, dataOut.data_SNR = self.techniqueDBS(velRadial0, heightList, SNR, kwargs) #DBS Function
1037 dataOut.utctimeInit = dataOut.utctime
1050 dataOut.utctimeInit = dataOut.utctime
1038 dataOut.outputInterval = dataOut.paramInterval
1051 dataOut.outputInterval = dataOut.paramInterval
1039
1052
1040 elif technique == 'SA':
1053 elif technique == 'SA':
1041
1054
1042 #Parameters
1055 #Parameters
1043 position_x = kwargs['positionX']
1056 # position_x = kwargs['positionX']
1044 position_y = kwargs['positionY']
1057 # position_y = kwargs['positionY']
1045 azimuth = kwargs['azimuth']
1058 # azimuth = kwargs['azimuth']
1046
1059 #
1047 if kwargs.has_key('crosspairsList'):
1060 # if kwargs.has_key('crosspairsList'):
1048 pairs = kwargs['crosspairsList']
1061 # pairs = kwargs['crosspairsList']
1049 else:
1062 # else:
1050 pairs = None
1063 # pairs = None
1051
1064 #
1052 if kwargs.has_key('correctFactor'):
1065 # if kwargs.has_key('correctFactor'):
1053 correctFactor = kwargs['correctFactor']
1066 # correctFactor = kwargs['correctFactor']
1054 else:
1067 # else:
1055 correctFactor = 1
1068 # correctFactor = 1
1056
1069
1057 tau = dataOut.data_param
1070 # tau = dataOut.data_param
1058 _lambda = dataOut.C/dataOut.frequency
1071 # _lambda = dataOut.C/dataOut.frequency
1059 pairsList = dataOut.groupList
1072 # pairsList = dataOut.groupList
1060 nChannels = dataOut.nChannels
1073 # nChannels = dataOut.nChannels
1061
1074
1062 dataOut.data_output = self.techniqueSA(pairs, pairsList, nChannels, tau, azimuth, _lambda, position_x, position_y, absc, correctFactor)
1075 kwargs['groupList'] = dataOut.groupList
1076 kwargs['tau'] = dataOut.data_param
1077 kwargs['_lambda'] = dataOut.C/dataOut.frequency
1078 # dataOut.data_output = self.techniqueSA(pairs, pairsList, nChannels, tau, azimuth, _lambda, position_x, position_y, absc, correctFactor)
1079 dataOut.data_output = self.techniqueSA(kwargs)
1063 dataOut.utctimeInit = dataOut.utctime
1080 dataOut.utctimeInit = dataOut.utctime
1064 dataOut.outputInterval = dataOut.timeInterval
1081 dataOut.outputInterval = dataOut.timeInterval
1065
1082
@@ -1435,7 +1452,7 class NonSpecularMeteorDetection(Operation):
1435
1452
1436 #--------------- Specular Meteor ----------------
1453 #--------------- Specular Meteor ----------------
1437
1454
1438 class MeteorDetection(Operation):
1455 class SMDetection(Operation):
1439 '''
1456 '''
1440 Function DetectMeteors()
1457 Function DetectMeteors()
1441 Project developed with paper:
1458 Project developed with paper:
@@ -1515,20 +1532,20 class MeteorDetection(Operation):
1515 if channelPositions == None:
1532 if channelPositions == None:
1516 # channelPositions = [(2.5,0), (0,2.5), (0,0), (0,4.5), (-2,0)] #T
1533 # channelPositions = [(2.5,0), (0,2.5), (0,0), (0,4.5), (-2,0)] #T
1517 channelPositions = [(4.5,2), (2,4.5), (2,2), (2,0), (0,2)] #Estrella
1534 channelPositions = [(4.5,2), (2,4.5), (2,2), (2,0), (0,2)] #Estrella
1518 meteorOps = MeteorOperations()
1535 meteorOps = SMOperations()
1519 pairslist0, distances = meteorOps.getPhasePairs(channelPositions)
1536 pairslist0, distances = meteorOps.getPhasePairs(channelPositions)
1520
1521 #Get Beacon signal
1522 newheis = numpy.where(self.dataOut.heightList>self.dataOut.radarControllerHeaderObj.Taus[tauindex])
1523
1524 if hei_ref != None:
1525 newheis = numpy.where(self.dataOut.heightList>hei_ref)
1526
1527 heiRang = dataOut.getHeiRange()
1537 heiRang = dataOut.getHeiRange()
1538 #Get Beacon signal - No Beacon signal anymore
1539 # newheis = numpy.where(self.dataOut.heightList>self.dataOut.radarControllerHeaderObj.Taus[tauindex])
1540 #
1541 # if hei_ref != None:
1542 # newheis = numpy.where(self.dataOut.heightList>hei_ref)
1543 #
1544
1528
1545
1529 #****************REMOVING HARDWARE PHASE DIFFERENCES***************
1546 #****************REMOVING HARDWARE PHASE DIFFERENCES***************
1530 # see if the user put in pre defined phase shifts
1547 # see if the user put in pre defined phase shifts
1531 voltsPShift = self.dataOut.data_pre.copy()
1548 voltsPShift = dataOut.data_pre.copy()
1532
1549
1533 # if predefinedPhaseShifts != None:
1550 # if predefinedPhaseShifts != None:
1534 # hardwarePhaseShifts = numpy.array(predefinedPhaseShifts)*numpy.pi/180
1551 # hardwarePhaseShifts = numpy.array(predefinedPhaseShifts)*numpy.pi/180
@@ -1554,14 +1571,14 class MeteorDetection(Operation):
1554 voltsPShift[i] = voltsPShift[i] - voltsDC[i]
1571 voltsPShift[i] = voltsPShift[i] - voltsDC[i]
1555
1572
1556 #Don't considerate last heights, theyre used to calculate Hardware Phase Shift
1573 #Don't considerate last heights, theyre used to calculate Hardware Phase Shift
1557 voltsPShift = voltsPShift[:,:,:newheis[0][0]]
1574 # voltsPShift = voltsPShift[:,:,:newheis[0][0]]
1558
1575
1559 #************ FIND POWER OF DATA W/COH OR NON COH DETECTION (3.4) **********
1576 #************ FIND POWER OF DATA W/COH OR NON COH DETECTION (3.4) **********
1560 #Coherent Detection
1577 #Coherent Detection
1561 if cohDetection:
1578 if cohDetection:
1562 #use coherent detection to get the net power
1579 #use coherent detection to get the net power
1563 cohDet_thresh = cohDet_thresh*numpy.pi/180
1580 cohDet_thresh = cohDet_thresh*numpy.pi/180
1564 voltsPShift = self.__coherentDetection(voltsPShift, cohDet_timeStep, self.dataOut.timeInterval, pairslist0, cohDet_thresh)
1581 voltsPShift = self.__coherentDetection(voltsPShift, cohDet_timeStep, dataOut.timeInterval, pairslist0, cohDet_thresh)
1565
1582
1566 #Non-coherent detection!
1583 #Non-coherent detection!
1567 powerNet = numpy.nansum(numpy.abs(voltsPShift[:,:,:])**2,0)
1584 powerNet = numpy.nansum(numpy.abs(voltsPShift[:,:,:])**2,0)
@@ -1569,7 +1586,7 class MeteorDetection(Operation):
1569
1586
1570 #********** FIND THE NOISE LEVEL AND POSSIBLE METEORS ****************
1587 #********** FIND THE NOISE LEVEL AND POSSIBLE METEORS ****************
1571 #Get noise
1588 #Get noise
1572 noise, noise1 = self.__getNoise(powerNet, noise_timeStep, self.dataOut.timeInterval)
1589 noise, noise1 = self.__getNoise(powerNet, noise_timeStep, dataOut.timeInterval)
1573 # noise = self.getNoise1(powerNet, noise_timeStep, self.dataOut.timeInterval)
1590 # noise = self.getNoise1(powerNet, noise_timeStep, self.dataOut.timeInterval)
1574 #Get signal threshold
1591 #Get signal threshold
1575 signalThresh = noise_multiple*noise
1592 signalThresh = noise_multiple*noise
@@ -1579,10 +1596,10 class MeteorDetection(Operation):
1579
1596
1580 #************** REMOVE MULTIPLE DETECTIONS (3.5) ***************************
1597 #************** REMOVE MULTIPLE DETECTIONS (3.5) ***************************
1581 #Parameters
1598 #Parameters
1582 heiRange = self.dataOut.getHeiRange()
1599 heiRange = dataOut.getHeiRange()
1583 rangeInterval = heiRange[1] - heiRange[0]
1600 rangeInterval = heiRange[1] - heiRange[0]
1584 rangeLimit = multDet_rangeLimit/rangeInterval
1601 rangeLimit = multDet_rangeLimit/rangeInterval
1585 timeLimit = multDet_timeLimit/self.dataOut.timeInterval
1602 timeLimit = multDet_timeLimit/dataOut.timeInterval
1586 #Multiple detection removals
1603 #Multiple detection removals
1587 listMeteors1 = self.__removeMultipleDetections(listMeteors, rangeLimit, timeLimit)
1604 listMeteors1 = self.__removeMultipleDetections(listMeteors, rangeLimit, timeLimit)
1588 #************ END OF REMOVE MULTIPLE DETECTIONS **********************
1605 #************ END OF REMOVE MULTIPLE DETECTIONS **********************
@@ -1592,20 +1609,20 class MeteorDetection(Operation):
1592 phaseThresh = phaseThresh*numpy.pi/180
1609 phaseThresh = phaseThresh*numpy.pi/180
1593 thresh = [phaseThresh, noise_multiple, SNRThresh]
1610 thresh = [phaseThresh, noise_multiple, SNRThresh]
1594 #Meteor reestimation (Errors N 1, 6, 12, 17)
1611 #Meteor reestimation (Errors N 1, 6, 12, 17)
1595 listMeteors2, listMeteorsPower, listMeteorsVolts = self.__meteorReestimation(listMeteors1, voltsPShift, pairslist0, thresh, noise, self.dataOut.timeInterval, self.dataOut.frequency)
1612 listMeteors2, listMeteorsPower, listMeteorsVolts = self.__meteorReestimation(listMeteors1, voltsPShift, pairslist0, thresh, noise, dataOut.timeInterval, dataOut.frequency)
1596 # listMeteors2, listMeteorsPower, listMeteorsVolts = self.meteorReestimation3(listMeteors2, listMeteorsPower, listMeteorsVolts, voltsPShift, pairslist, thresh, noise)
1613 # listMeteors2, listMeteorsPower, listMeteorsVolts = self.meteorReestimation3(listMeteors2, listMeteorsPower, listMeteorsVolts, voltsPShift, pairslist, thresh, noise)
1597 #Estimation of decay times (Errors N 7, 8, 11)
1614 #Estimation of decay times (Errors N 7, 8, 11)
1598 listMeteors3 = self.__estimateDecayTime(listMeteors2, listMeteorsPower, self.dataOut.timeInterval, self.dataOut.frequency)
1615 listMeteors3 = self.__estimateDecayTime(listMeteors2, listMeteorsPower, dataOut.timeInterval, dataOut.frequency)
1599 #******************* END OF METEOR REESTIMATION *******************
1616 #******************* END OF METEOR REESTIMATION *******************
1600
1617
1601 #********************* METEOR PARAMETERS CALCULATION (3.11, 3.12, 3.13) **************************
1618 #********************* METEOR PARAMETERS CALCULATION (3.11, 3.12, 3.13) **************************
1602 #Calculating Radial Velocity (Error N 15)
1619 #Calculating Radial Velocity (Error N 15)
1603 radialStdThresh = 10
1620 radialStdThresh = 10
1604 listMeteors4 = self.__getRadialVelocity(listMeteors3, listMeteorsVolts, radialStdThresh, pairslist0, self.dataOut.timeInterval)
1621 listMeteors4 = self.__getRadialVelocity(listMeteors3, listMeteorsVolts, radialStdThresh, pairslist0, dataOut.timeInterval)
1605
1622
1606 if len(listMeteors4) > 0:
1623 if len(listMeteors4) > 0:
1607 #Setting New Array
1624 #Setting New Array
1608 date = self.dataOut.utctime
1625 date = dataOut.utctime
1609 arrayParameters = self.__setNewArrays(listMeteors4, date, heiRang)
1626 arrayParameters = self.__setNewArrays(listMeteors4, date, heiRang)
1610
1627
1611 #Correcting phase offset
1628 #Correcting phase offset
@@ -1641,12 +1658,12 class MeteorDetection(Operation):
1641
1658
1642 #***************************+ PASS DATA TO NEXT STEP **********************
1659 #***************************+ PASS DATA TO NEXT STEP **********************
1643 # arrayFinal = arrayParameters.reshape((1,arrayParameters.shape[0],arrayParameters.shape[1]))
1660 # arrayFinal = arrayParameters.reshape((1,arrayParameters.shape[0],arrayParameters.shape[1]))
1644 self.dataOut.data_param = arrayParameters
1661 dataOut.data_param = arrayParameters
1645
1662
1646 if arrayParameters == None:
1663 if arrayParameters == None:
1647 self.dataOut.flagNoData = True
1664 dataOut.flagNoData = True
1648 else:
1665 else:
1649 self.dataOut.flagNoData = True
1666 dataOut.flagNoData = True
1650
1667
1651 return
1668 return
1652
1669
@@ -2162,7 +2179,7 class MeteorDetection(Operation):
2162
2179
2163 return arrayParameters
2180 return arrayParameters
2164
2181
2165 class CorrectMeteorPhases(Operation):
2182 class CorrectSMPhases(Operation):
2166
2183
2167 def run(self, dataOut, phaseOffsets, hmin = 50, hmax = 150, azimuth = 45, channelPositions = None):
2184 def run(self, dataOut, phaseOffsets, hmin = 50, hmax = 150, azimuth = 45, channelPositions = None):
2168
2185
@@ -2178,7 +2195,7 class CorrectMeteorPhases(Operation):
2178 # arrayParameters[:,8:12] = numpy.unwrap(arrayParameters[:,8:12] + phaseOffsets)
2195 # arrayParameters[:,8:12] = numpy.unwrap(arrayParameters[:,8:12] + phaseOffsets)
2179 arrayParameters[:,8:12] = numpy.angle(numpy.exp(1j*(arrayParameters[:,8:12] + phaseOffsets)))
2196 arrayParameters[:,8:12] = numpy.angle(numpy.exp(1j*(arrayParameters[:,8:12] + phaseOffsets)))
2180
2197
2181 meteorOps = MeteorOperations()
2198 meteorOps = SMOperations()
2182 if channelPositions == None:
2199 if channelPositions == None:
2183 # channelPositions = [(2.5,0), (0,2.5), (0,0), (0,4.5), (-2,0)] #T
2200 # channelPositions = [(2.5,0), (0,2.5), (0,0), (0,4.5), (-2,0)] #T
2184 channelPositions = [(4.5,2), (2,4.5), (2,2), (2,0), (0,2)] #Estrella
2201 channelPositions = [(4.5,2), (2,4.5), (2,2), (2,0), (0,2)] #Estrella
@@ -2191,7 +2208,7 class CorrectMeteorPhases(Operation):
2191 dataOut.data_param = arrayParameters
2208 dataOut.data_param = arrayParameters
2192 return
2209 return
2193
2210
2194 class PhaseCalibration(Operation):
2211 class SMPhaseCalibration(Operation):
2195
2212
2196 __buffer = None
2213 __buffer = None
2197
2214
@@ -2274,7 +2291,7 class PhaseCalibration(Operation):
2274 return coeffs[0]*numpy.exp(-0.5*((t - coeffs[1]) / coeffs[2])**2)
2291 return coeffs[0]*numpy.exp(-0.5*((t - coeffs[1]) / coeffs[2])**2)
2275
2292
2276 def __getPhases(self, azimuth, h, pairsList, d, gammas, meteorsArray):
2293 def __getPhases(self, azimuth, h, pairsList, d, gammas, meteorsArray):
2277 meteorOps = MeteorOperations()
2294 meteorOps = SMOperations()
2278 nchan = 4
2295 nchan = 4
2279 pairx = pairsList[0]
2296 pairx = pairsList[0]
2280 pairy = pairsList[1]
2297 pairy = pairsList[1]
@@ -2365,7 +2382,7 class PhaseCalibration(Operation):
2365 if channelPositions == None:
2382 if channelPositions == None:
2366 # channelPositions = [(2.5,0), (0,2.5), (0,0), (0,4.5), (-2,0)] #T
2383 # channelPositions = [(2.5,0), (0,2.5), (0,0), (0,4.5), (-2,0)] #T
2367 channelPositions = [(4.5,2), (2,4.5), (2,2), (2,0), (0,2)] #Estrella
2384 channelPositions = [(4.5,2), (2,4.5), (2,2), (2,0), (0,2)] #Estrella
2368 meteorOps = MeteorOperations()
2385 meteorOps = SMOperations()
2369 pairslist0, distances = meteorOps.getPhasePairs(channelPositions)
2386 pairslist0, distances = meteorOps.getPhasePairs(channelPositions)
2370
2387
2371 # distances1 = [-distances[0]*lamb, distances[1]*lamb, -distances[2]*lamb, distances[3]*lamb]
2388 # distances1 = [-distances[0]*lamb, distances[1]*lamb, -distances[2]*lamb, distances[3]*lamb]
@@ -2391,7 +2408,7 class PhaseCalibration(Operation):
2391
2408
2392 return
2409 return
2393
2410
2394 class MeteorOperations():
2411 class SMOperations():
2395
2412
2396 def __init__(self):
2413 def __init__(self):
2397
2414
General Comments 0
You need to be logged in to leave comments. Login now