##// END OF EJS Templates
writing rf data, falta metadata
Jose Chavez -
r979:f421d9b2ac03
parent child
Show More
@@ -1000,7 +1000,6 class JRODataReader(JRODataIO):
1000 1000
1001 1001 # if self.online:
1002 1002 # self.__jumpToLastBlock()
1003 print 'xxxx'
1004 1003
1005 1004 if self.flagIsNewFile:
1006 1005 self.lastUTTime = self.basicHeaderObj.utc
@@ -1012,7 +1011,6 class JRODataReader(JRODataIO):
1012 1011 return 0
1013 1012 else:
1014 1013 return 1
1015 print 'xxxx'
1016 1014 #if self.server is None:
1017 1015 currentSize = self.fileSize - self.fp.tell()
1018 1016 neededSize = self.processingHeaderObj.blockSize + self.basicHeaderSize
@@ -1045,11 +1043,9 class JRODataReader(JRODataIO):
1045 1043
1046 1044 #Skip block out of startTime and endTime
1047 1045 while True:
1048 print 'cxxxx'
1049 1046 if not(self.__setNewBlock()):
1050 1047 print 'returning'
1051 1048 return 0
1052 print 'dxxx'
1053 1049 if not(self.readBlock()):
1054 1050 return 0
1055 1051
@@ -1,3 +1,4
1
1 2 '''
2 3 Created on Jul 3, 2014
3 4
@@ -6,6 +7,7 Created on Jul 3, 2014
6 7 import os
7 8 import datetime
8 9 import numpy
10 from fractions import Fraction
9 11
10 12 try:
11 13 from gevent import sleep
@@ -548,7 +550,7 class DigitalRFWriter(Operation):
548 550 Operation.__init__(self, **kwargs)
549 551 self.dataOut = None
550 552
551 def setup(self, dataIn, path, blocksPerFile, set=0, ext='.h5'):
553 def setup(self, dataIn, path, set=0, ext='.h5'):
552 554 '''
553 555 In this method we should set all initial parameters.
554 556
@@ -556,10 +558,36 class DigitalRFWriter(Operation):
556 558 dataIn : Input data will also be outputa data
557 559
558 560 '''
559 self.dataOut = dataIn
560
561
562
561
562 self.__ippSeconds = dataIn.ippSeconds
563 self.__deltaH = dataIn.getDeltaH()
564 self.__sample_rate = 1e6*0.15/self.__deltaH
565 self.__dtype = dataIn.dtype
566 if len(dataIn.dtype) == 2:
567 self.__dtype = dataIn.dtype[0]
568 self.__nSamples = dataIn.systemHeaderObj.nSamples
569 self.__nProfiles = dataIn.nProfiles
570 self.__blocks_per_file = dataIn.processingHeaderObj.dataBlocksPerFile
571
572 file_cadence_millisecs = 1.0 * self.__blocks_per_file * self.__nProfiles * self.__nSamples / self.__sample_rate * 1000
573 sub_cadence_secs = 10 * file_cadence_millisecs
574 sample_rate_fraction = Fraction(self.__sample_rate).limit_denominator()
575 sample_rate_numerator = long(sample_rate_fraction.numerator)
576 sample_rate_denominator = long(sample_rate_fraction.denominator)
577 start_global_index = dataIn.utctime * self.__sample_rate
578 self.arr_data = arr_data = numpy.ones((self.__nSamples, 1), dtype=[('r', self.__dtype), ('i', self.__dtype)])
579 uuid = 'prueba'
580 compression_level = 1
581 checksum = False
582 is_complex = True
583 num_subchannels = 1
584 is_continuous = True
585 marching_periods = False
586
587 self.digitalWriteObj = digital_rf.DigitalRFWriter("/home/jchavez/jicamarca/mocked_data/voltage", self.__dtype, sub_cadence_secs,
588 file_cadence_millisecs, start_global_index,
589 sample_rate_numerator, sample_rate_denominator, uuid, compression_level, checksum,
590 is_complex, num_subchannels, is_continuous, marching_periods)
563 591
564 592
565 593 self.isConfig = True
@@ -575,26 +603,24 class DigitalRFWriter(Operation):
575 603 dataIn : object with the data
576 604
577 605 '''
578 print dir(dataIn)
579 print 'blocksize', dataIn.blocksize
580 print 'channelIndexList', dataIn.channelIndexList
581 print 'ippSeconds', dataIn.ippSeconds
582 print 'frequency', dataIn.frequency
583 print 'nProfiles', dataIn.nProfiles
584 print 'deltaH', dataIn.getDeltaH()
585 print 'systemHeaderObj.nSamples', dataIn.systemHeaderObj.nSamples
586 nSamples = dataIn.systemHeaderObj.nSamples
587 ippSeconds = dataIn.ippSeconds
588
589 self.__samplerate = 1.0*nSamples/ippSeconds
590 # ippKm = 1e6*0.15*self.fixed_metadata_dict['ipp']
591 # nSamples = int(ippKm / (1e6*0.15/self.__sample_rate))
592 # ippSeconds = 1.0*self.__nSamples/self.__sample_rate
606
607 self.dataOut = dataIn
593 608
594 609 if not self.isConfig:
595 610 self.setup(dataIn, path, **kwargs)
596 611
612 samples = len(self.dataOut.data[0])
613
614 for i in range(samples):
615 self.arr_data[i]['r'] = dataIn.data[0][i].real
616 self.arr_data[i]['i'] = dataIn.data[0][i].imag
617
618 if dataIn.flagNoData:
619 self.digitalWriteObj.close()
597 620
621 self.digitalWriteObj.rf_write(self.arr_data)
622
623 #raise
598 624 if __name__ == '__main__':
599 625
600 626 readObj = DigitalRFReader()
@@ -217,7 +217,6 class VoltageReader(JRODataReader, ProcessingUnit):
217 217 Si un bloque leido no es un bloque valido
218 218 """
219 219
220 print 'READ BLOCK'
221 220 # if self.server is not None:
222 221 # self.zBlock = self.receiver.recv()
223 222 # self.zHeader = self.zBlock[:24]
@@ -232,7 +231,6 class VoltageReader(JRODataReader, ProcessingUnit):
232 231
233 232 try:
234 233 junk = junk.reshape( (self.processingHeaderObj.profilesPerBlock, self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels) )
235 print'junked'
236 234 except:
237 235 #print "The read block (%3d) has not enough data" %self.nReadBlocks
238 236
@@ -264,6 +262,8 class VoltageReader(JRODataReader, ProcessingUnit):
264 262
265 263 self.dataOut.radarControllerHeaderObj = self.radarControllerHeaderObj.copy()
266 264
265 self.dataOut.processingHeaderObj = self.processingHeaderObj.copy()
266
267 267 if self.nTxs > 1:
268 268 self.dataOut.radarControllerHeaderObj.ippSeconds = self.radarControllerHeaderObj.ippSeconds/self.nTxs
269 269
General Comments 0
You need to be logged in to leave comments. Login now