##// END OF EJS Templates
modified for reading channels with the same pointing
joabAM -
r1557:a1cf32393853
parent child
Show More
@@ -522,7 +522,7 class Plot(Operation):
522 522 figname = os.path.join(
523 523 self.save,
524 524 self.save_code,
525 '{}_{}.png'.format(
525 '{}_{}.jpeg'.format(
526 526 self.save_code,
527 527 self.getDateTime(self.data.max_time).strftime(
528 528 '%Y%m%d_%H%M%S'
@@ -536,7 +536,7 class Plot(Operation):
536 536
537 537 figname = os.path.join(
538 538 self.save,
539 '{}_{}.png'.format(
539 '{}_{}.jpeg'.format(
540 540 self.save_code,
541 541 self.getDateTime(self.data.min_time).strftime(
542 542 '%Y%m%d'
@@ -54,7 +54,7 class AMISRReader(ProcessingUnit):
54 54 self.flagIsNewFile = 0
55 55 self.filename = ''
56 56 self.amisrFilePointer = None
57 self.realBeamCode = []
57
58 58 self.beamCodeMap = None
59 59 self.azimuthList = []
60 60 self.elevationList = []
@@ -96,7 +96,10 class AMISRReader(ProcessingUnit):
96 96 nBaud = 0,
97 97 online=False,
98 98 old_beams=False,
99 margin_days=1):
99 margin_days=1,
100 nFFT = 1,
101 nChannels = None,
102 ):
100 103
101 104
102 105
@@ -110,6 +113,9 class AMISRReader(ProcessingUnit):
110 113 self.margin_days = margin_days
111 114 self.__sampleRate = None
112 115
116 self.nFFT = nFFT
117 self.nChannels = nChannels
118
113 119 #self.findFiles()
114 120 if not(online):
115 121 #Busqueda de archivos offline
@@ -147,13 +153,21 class AMISRReader(ProcessingUnit):
147 153
148 154
149 155 header = 'Raw11/Data/RadacHeader'
156 if self.nChannels == None:
157 expFile = fp['Setup/ExperimentFile'][()].decode()
158 linesExp = expFile.split("\n")
159 a = [line for line in linesExp if "nbeamcodes" in line]
160 self.nChannels = int(a[0][11:])
161
150 162 self.beamCodeByPulse = fp.get(header+'/BeamCode') # LIST OF BEAMS PER PROFILE, TO BE USED ON REARRANGE
151 if (self.startDate> datetime.date(2021, 7, 15)) or self.flag_old_beams: #Se cambiΓ³ la forma de extracciΓ³n de Apuntes el 17 o forzar con flag de reorganizaciΓ³n
163 if (self.startDate > datetime.date(2021, 7, 15)) or self.flag_old_beams: #Se cambiΓ³ la forma de extracciΓ³n de Apuntes el 17 o forzar con flag de reorganizaciΓ³n
152 164 self.beamcodeFile = fp['Setup/Beamcodefile'][()].decode()
153 165 self.trueBeams = self.beamcodeFile.split("\n")
154 166 self.trueBeams.pop()#remove last
155 [self.realBeamCode.append(x) for x in self.trueBeams if x not in self.realBeamCode]
156 self.beamCode = [int(x, 16) for x in self.realBeamCode]
167 beams_idx = [k*self.nFFT for k in range(self.nChannels)]
168 beams = [self.trueBeams[b] for b in beams_idx]
169 self.beamCode = [int(x, 16) for x in beams]
170
157 171 else:
158 172 _beamCode= fp.get('Raw11/Data/Beamcodes') #se usa la manera previa al cambio de apuntes
159 173 self.beamCode = _beamCode[0,:]
@@ -182,7 +196,7 class AMISRReader(ProcessingUnit):
182 196 sampleRate = fp.get('Rx/SampleRate')
183 197 self.__sampleRate = sampleRate[()]
184 198 self.nblocks = self.pulseCount.shape[0] #nblocks
185
199 self.profPerBlockRAW = self.pulseCount.shape[1] #profiles per block in raw data
186 200 self.nprofiles = self.pulseCount.shape[1] #nprofile
187 201 self.nsa = self.nsamplesPulse[0,0] #ngates
188 202 self.nchannels = len(self.beamCode)
@@ -468,20 +482,26 class AMISRReader(ProcessingUnit):
468 482 return dataset,timeset
469 483
470 484 def reshapeData(self):
471 #self.beamCodeByPulse, self.beamCode, self.nblocks, self.nprofiles, self.nsa,
485 #print(self.beamCodeByPulse, self.beamCode, self.nblocks, self.nprofiles, self.nsa)
472 486 channels = self.beamCodeByPulse[0,:]
473 487 nchan = self.nchannels
474 488 #self.newProfiles = self.nprofiles/nchan #must be defined on filljroheader
475 489 nblocks = self.nblocks
476 490 nsamples = self.nsa
477
491 #print("Channels: ",self.nChannels)
478 492 #Dimensions : nChannels, nProfiles, nSamples
479 493 new_block = numpy.empty((nblocks, nchan, numpy.int_(self.newProfiles), nsamples), dtype="complex64")
480 494 ############################################
495 profPerCH = int(self.profPerBlockRAW / (self.nFFT * self.nChannels))
481 496
482 497 for thisChannel in range(nchan):
483 new_block[:,thisChannel,:,:] = self.dataset[:,numpy.where(channels==self.beamCode[thisChannel])[0],:]
484 498
499 idx_ch = [thisChannel+k*nchan for k in range(profPerCH)]
500 idx_ch = numpy.array(idx_ch, dtype=int)
501 #print(thisChannel,idx_ch)
502 #print(numpy.where(channels==self.beamCode[thisChannel])[0])
503 #new_block[:,thisChannel,:,:] = self.dataset[:,numpy.where(channels==self.beamCode[thisChannel])[0],:]
504 new_block[:,thisChannel,:,:] = self.dataset[:,idx_ch,:]
485 505
486 506 new_block = numpy.transpose(new_block, (1,0,2,3))
487 507 new_block = numpy.reshape(new_block, (nchan,-1, nsamples))
General Comments 0
You need to be logged in to leave comments. Login now