##// END OF EJS Templates
Fix ScpecraWriter and CohInt attribute
Juan C. Espinoza -
r1310:ce24778ee4ae
parent child
Show More
@@ -1,6 +1,6
1 ## CHANGELOG:
1 # CHANGELOG:
2
2
3 ### 3.0
3 ## 3.0
4 * Python 3.x & 2.X compatible
4 * Python 3.x & 2.X compatible
5 * New architecture with multiprocessing support
5 * New architecture with multiprocessing support
6 * Add @MPDecorator for multiprocessing Operations (Plots, Writers and Publishers)
6 * Add @MPDecorator for multiprocessing Operations (Plots, Writers and Publishers)
@@ -9,7 +9,7
9 * Clean controller to optimize scripts (format & optype are no longer required)
9 * Clean controller to optimize scripts (format & optype are no longer required)
10 * New GUI with dinamic load of Units and operations (use Kivy framework)
10 * New GUI with dinamic load of Units and operations (use Kivy framework)
11
11
12 ### 2.3
12 ## 2.3
13 * Added support for Madrigal formats (reading/writing).
13 * Added support for Madrigal formats (reading/writing).
14 * Added support for reading BLTR parameters (*.sswma).
14 * Added support for reading BLTR parameters (*.sswma).
15 * Added support for reading Julia format (*.dat).
15 * Added support for reading Julia format (*.dat).
@@ -30,83 +30,83
30 * Updated README for MAC OS GUI installation.
30 * Updated README for MAC OS GUI installation.
31 * Setup now installs numpy.
31 * Setup now installs numpy.
32
32
33 ### 2.2.6
33 ## 2.2.6
34 * Graphics generated by the GUI are now the same as generated by scripts. Issue #1074.
34 * Graphics generated by the GUI are now the same as generated by scripts. Issue #1074.
35 * Added support for C extensions.
35 * Added support for C extensions.
36 * Function `hildebrand_sehkon` optimized with a C wrapper.
36 * Function `hildebrand_sehkon` optimized with a C wrapper.
37 * Numpy version updated.
37 * Numpy version updated.
38 * Migration to GIT.
38 * Migration to GIT.
39
39
40 ### 2.2.5:
40 ## 2.2.5:
41 * splitProfiles and combineProfiles modules were added to VoltageProc and Signal Chain GUI.
41 * splitProfiles and combineProfiles modules were added to VoltageProc and Signal Chain GUI.
42 * nProfiles of USRP data (hdf5) is the number of profiles thera are in one second.
42 * nProfiles of USRP data (hdf5) is the number of profiles thera are in one second.
43 * jroPlotter works directly with data objects instead of dictionaries
43 * jroPlotter works directly with data objects instead of dictionaries
44 * script "schain" was added to Signal Chain installer
44 * script "schain" was added to Signal Chain installer
45
45
46 ### 2.2.4.1:
46 ## 2.2.4.1:
47 * jroIO_usrp.py is update to read Sandra's data
47 * jroIO_usrp.py is update to read Sandra's data
48 * decimation in Spectra and RTI plots is always enabled.
48 * decimation in Spectra and RTI plots is always enabled.
49 * time* window option added to GUI
49 * time* window option added to GUI
50
50
51 ### 2.2.4:
51 ## 2.2.4:
52 * jroproc_spectra_lags.py added to schainpy
52 * jroproc_spectra_lags.py added to schainpy
53 * Bug fixed in schainGUI: ProcUnit was created with the same id in some cases.
53 * Bug fixed in schainGUI: ProcUnit was created with the same id in some cases.
54 * Bug fixed in jroHeaderIO: Header size validation.
54 * Bug fixed in jroHeaderIO: Header size validation.
55
55
56 ### 2.2.3.1:
56 ## 2.2.3.1:
57 * Filtering block by time has been added.
57 * Filtering block by time has been added.
58 * Bug fixed plotting RTI, CoherenceMap and others using xmin and xmax parameters. The first day worked
58 * Bug fixed plotting RTI, CoherenceMap and others using xmin and xmax parameters. The first day worked
59 properly but the next days did not.
59 properly but the next days did not.
60
60
61 ### 2.2.3:
61 ## 2.2.3:
62 * Bug fixed in GUI: Error getting(reading) Code value
62 * Bug fixed in GUI: Error getting(reading) Code value
63 * Bug fixed in GUI: Flip option always needs channelList field
63 * Bug fixed in GUI: Flip option always needs channelList field
64 * Bug fixed in jrodata: when one branch modified a value in "dataOut" (example: dataOut.code) this value
64 * Bug fixed in jrodata: when one branch modified a value in "dataOut" (example: dataOut.code) this value
65 was modified for every branch (because this was a reference). It was modified in data.copy()
65 was modified for every branch (because this was a reference). It was modified in data.copy()
66 * Bug fixed in jroproc_voltage.profileSelector(): rangeList replaces to profileRangeList.
66 * Bug fixed in jroproc_voltage.profileSelector(): rangeList replaces to profileRangeList.
67
67
68 ### 2.2.2:
68 ## 2.2.2:
69 * VoltageProc: ProfileSelector, Reshape, Decoder with nTxs!=1 and getblock=True was tested
69 * VoltageProc: ProfileSelector, Reshape, Decoder with nTxs!=1 and getblock=True was tested
70 * Rawdata and testRawdata.py added to Signal Chain project
70 * Rawdata and testRawdata.py added to Signal Chain project
71
71
72 ### 2.2.1:
72 ## 2.2.1:
73 * Bugs fixed in GUI
73 * Bugs fixed in GUI
74 * Views were improved in GUI
74 * Views were improved in GUI
75 * Support to MST* ISR experiments
75 * Support to MST* ISR experiments
76 * Bug fixed getting noise using hyldebrant. (minimum number of points > 20%)
76 * Bug fixed getting noise using hyldebrant. (minimum number of points > 20%)
77 * handleError added to jroplotter.py
77 * handleError added to jroplotter.py
78
78
79 ### 2.2.0:
79 ## 2.2.0:
80 * GUI: use of external plotter
80 * GUI: use of external plotter
81 * Compatible with matplotlib 1.5.0
81 * Compatible with matplotlib 1.5.0
82
82
83 ### 2.1.5:
83 ## 2.1.5:
84 * serializer module added to Signal Chain
84 * serializer module added to Signal Chain
85 * jroplotter.py added to Signal Chain
85 * jroplotter.py added to Signal Chain
86
86
87 ### 2.1.4.2:
87 ## 2.1.4.2:
88 * A new Plotter Class was added
88 * A new Plotter Class was added
89 * Project.start() does not accept filename as a parameter anymore
89 * Project.start() does not accept filename as a parameter anymore
90
90
91 ### 2.1.4.1:
91 ## 2.1.4.1:
92 * Send notifications when an error different to ValueError is detected
92 * Send notifications when an error different to ValueError is detected
93
93
94 ### 2.1.4:
94 ## 2.1.4:
95 * Sending error notifications to signal chain administrator
95 * Sending error notifications to signal chain administrator
96 * Login to email server added
96 * Login to email server added
97
97
98 ### 2.1.3.3:
98 ## 2.1.3.3:
99 * Colored Button Icons were added to GUI
99 * Colored Button Icons were added to GUI
100
100
101 ### 2.1.3.2:
101 ## 2.1.3.2:
102 * GUI: user interaction enhanced
102 * GUI: user interaction enhanced
103 * controller_api.py: Safe access to ControllerThead
103 * controller_api.py: Safe access to ControllerThead
104
104
105 ### 2.1.3.1:
105 ## 2.1.3.1:
106 * GUI: every icon were resized
106 * GUI: every icon were resized
107 * jroproc_voltage.py: Print a message when "Read from code" option is selected and the code is not defined inside data file
107 * jroproc_voltage.py: Print a message when "Read from code" option is selected and the code is not defined inside data file
108
108
109 ### 2.1.3:
109 ## 2.1.3:
110 * jroplot_heispectra.py: SpectraHeisScope was not showing the right channels
110 * jroplot_heispectra.py: SpectraHeisScope was not showing the right channels
111 * jroproc_voltage.py: Bug fixed selecting profiles (self.nProfiles took a wrong value),
111 * jroproc_voltage.py: Bug fixed selecting profiles (self.nProfiles took a wrong value),
112 Bug fixed selecting heights by block (selecting profiles instead heights)
112 Bug fixed selecting heights by block (selecting profiles instead heights)
@@ -114,7 +114,7 was modified for every branch (because this was a reference). It was modified in
114 * jroIO_heispectra.py: Bug fixed in FitsReader. Using local Fits instance instead schainpy.mode.data.jrodata.Fits.
114 * jroIO_heispectra.py: Bug fixed in FitsReader. Using local Fits instance instead schainpy.mode.data.jrodata.Fits.
115 * jroIO_heispectra.py: Channel index list does not exist.
115 * jroIO_heispectra.py: Channel index list does not exist.
116
116
117 ### 2.1.2:
117 ## 2.1.2:
118 * jroutils_ftp.py: Bug fixed, Any error sending file stopped the Server Thread
118 * jroutils_ftp.py: Bug fixed, Any error sending file stopped the Server Thread
119 Server thread opens and closes remote server each time file list is sent
119 Server thread opens and closes remote server each time file list is sent
120 * jroplot_spectra.py: Noise path was not being created when noise data is saved.
120 * jroplot_spectra.py: Noise path was not being created when noise data is saved.
@@ -388,6 +388,7 class Voltage(JROData):
388 self.errorCount = None
388 self.errorCount = None
389 self.nCohInt = None
389 self.nCohInt = None
390 self.blocksize = None
390 self.blocksize = None
391 self.flagCohInt = False
391 self.flagDecodeData = False # asumo q la data no esta decodificada
392 self.flagDecodeData = False # asumo q la data no esta decodificada
392 self.flagDeflipData = False # asumo q la data no esta sin flip
393 self.flagDeflipData = False # asumo q la data no esta sin flip
393 self.flagShiftFFT = False
394 self.flagShiftFFT = False
@@ -899,7 +899,8 class JRODataReader(Reader):
899 def readNextBlock(self):
899 def readNextBlock(self):
900
900
901 while True:
901 while True:
902 self.__setNewBlock()
902 if not(self.__setNewBlock()):
903 continue
903
904
904 if not(self.readBlock()):
905 if not(self.readBlock()):
905 return 0
906 return 0
@@ -954,55 +955,49 class JRODataReader(Reader):
954 # self.dataOut.channelIndexList = numpy.arange(self.systemHeaderObj.numChannels)
955 # self.dataOut.channelIndexList = numpy.arange(self.systemHeaderObj.numChannels)
955 self.getBlockDimension()
956 self.getBlockDimension()
956
957
957 def verifyFile(self, filename, msgFlag=True):
958 def verifyFile(self, filename):
958
959
959 msg = None
960 flag = True
960
961
961 try:
962 try:
962 fp = open(filename, 'rb')
963 fp = open(filename, 'rb')
963 except IOError:
964 except IOError:
964
965 log.error("File {} can't be opened".format(filename), self.name)
965 if msgFlag:
966 print("[Reading] File %s can't be opened" % (filename))
967
968 return False
966 return False
969
967
970 if self.waitDataBlock(0):
968 if self.online and self.waitDataBlock(0):
971 basicHeaderObj = BasicHeader(LOCALTIME)
969 pass
972 systemHeaderObj = SystemHeader()
970
973 radarControllerHeaderObj = RadarControllerHeader()
971 basicHeaderObj = BasicHeader(LOCALTIME)
974 processingHeaderObj = ProcessingHeader()
972 systemHeaderObj = SystemHeader()
975
973 radarControllerHeaderObj = RadarControllerHeader()
976 if not(basicHeaderObj.read(fp)):
974 processingHeaderObj = ProcessingHeader()
977 fp.close()
975
978 return False
976 if not(basicHeaderObj.read(fp)):
979
977 flag = False
980 if not(systemHeaderObj.read(fp)):
978 if not(systemHeaderObj.read(fp)):
981 fp.close()
979 flag = False
982 return False
980 if not(radarControllerHeaderObj.read(fp)):
983
981 flag = False
984 if not(radarControllerHeaderObj.read(fp)):
982 if not(processingHeaderObj.read(fp)):
985 fp.close()
983 flag = False
986 return False
984 if not self.online:
987
985 dt1 = basicHeaderObj.datatime
988 if not(processingHeaderObj.read(fp)):
986 pos = self.fileSize-processingHeaderObj.blockSize-24
989 fp.close()
987 if pos<0:
990 return False
988 flag = False
991
989 log.error('Invalid size for file: {}'.format(self.filename), self.name)
992 if not self.online:
990 else:
993 dt1 = basicHeaderObj.datatime
991 fp.seek(pos)
994 fp.seek(self.fileSize-processingHeaderObj.blockSize-24)
995 if not(basicHeaderObj.read(fp)):
992 if not(basicHeaderObj.read(fp)):
996 fp.close()
993 flag = False
997 return False
994 dt2 = basicHeaderObj.datatime
998 dt2 = basicHeaderObj.datatime
995 if not self.isDateTimeInRange(dt1, self.startDate, self.endDate, self.startTime, self.endTime) and not \
999 if not self.isDateTimeInRange(dt1, self.startDate, self.endDate, self.startTime, self.endTime) and not \
996 self.isDateTimeInRange(dt2, self.startDate, self.endDate, self.startTime, self.endTime):
1000 self.isDateTimeInRange(dt2, self.startDate, self.endDate, self.startTime, self.endTime):
997 flag = False
1001 return False
1002
998
1003 fp.close()
999 fp.close()
1004
1000 return flag
1005 return True
1006
1001
1007 def findDatafiles(self, path, startDate=None, endDate=None, expLabel='', ext='.r', walk=True, include_path=False):
1002 def findDatafiles(self, path, startDate=None, endDate=None, expLabel='', ext='.r', walk=True, include_path=False):
1008
1003
@@ -358,7 +358,7 class SpectraWriter(JRODataWriter, Operation):
358
358
359 spc = numpy.transpose( self.data_spc, (0,2,1) )
359 spc = numpy.transpose( self.data_spc, (0,2,1) )
360 if not self.processingHeaderObj.shif_fft:
360 if not self.processingHeaderObj.shif_fft:
361 spc = numpy.roll( spc, self.processingHeaderObj.profilesPerBlock/2, axis=2 ) #desplaza a la derecha en el eje 2 determinadas posiciones
361 spc = numpy.roll( spc, int(self.processingHeaderObj.profilesPerBlock/2), axis=2 ) #desplaza a la derecha en el eje 2 determinadas posiciones
362 data = spc.reshape((-1))
362 data = spc.reshape((-1))
363 data = data.astype(self.dtype[0])
363 data = data.astype(self.dtype[0])
364 data.tofile(self.fp)
364 data.tofile(self.fp)
@@ -369,7 +369,7 class SpectraWriter(JRODataWriter, Operation):
369 data = numpy.zeros( numpy.shape(cspc), self.dtype )
369 data = numpy.zeros( numpy.shape(cspc), self.dtype )
370 #print 'data.shape', self.shape_cspc_Buffer
370 #print 'data.shape', self.shape_cspc_Buffer
371 if not self.processingHeaderObj.shif_fft:
371 if not self.processingHeaderObj.shif_fft:
372 cspc = numpy.roll( cspc, self.processingHeaderObj.profilesPerBlock/2, axis=2 ) #desplaza a la derecha en el eje 2 determinadas posiciones
372 cspc = numpy.roll( cspc, int(self.processingHeaderObj.profilesPerBlock/2), axis=2 ) #desplaza a la derecha en el eje 2 determinadas posiciones
373 data['real'] = cspc.real
373 data['real'] = cspc.real
374 data['imag'] = cspc.imag
374 data['imag'] = cspc.imag
375 data = data.reshape((-1))
375 data = data.reshape((-1))
@@ -74,7 +74,7 class ProcessingUnit(object):
74 elif 'SchainError' in err:
74 elif 'SchainError' in err:
75 log.error(err.split('SchainError:')[-1].split('\n')[0].strip(), self.name)
75 log.error(err.split('SchainError:')[-1].split('\n')[0].strip(), self.name)
76 else:
76 else:
77 log.error(err.split('\n')[-2], self.name)
77 log.error(err, self.name)
78 self.dataOut.error = True
78 self.dataOut.error = True
79
79
80 for op, optype, opkwargs in self.operations:
80 for op, optype, opkwargs in self.operations:
@@ -193,7 +193,7 def MPDecorator(BaseClass):
193 BaseClass.run(self, dataOut, **self.kwargs)
193 BaseClass.run(self, dataOut, **self.kwargs)
194 except:
194 except:
195 err = traceback.format_exc()
195 err = traceback.format_exc()
196 log.error(err.split('\n')[-2], self.name)
196 log.error(err, self.name)
197 else:
197 else:
198 break
198 break
199
199
@@ -435,8 +435,6 class CohInt(Operation):
435
435
436 Operation.__init__(self, **kwargs)
436 Operation.__init__(self, **kwargs)
437
437
438 # self.isConfig = False
439
440 def setup(self, n=None, timeInterval=None, stride=None, overlapping=False, byblock=False):
438 def setup(self, n=None, timeInterval=None, stride=None, overlapping=False, byblock=False):
441 """
439 """
442 Set the parameters of the integration class.
440 Set the parameters of the integration class.
@@ -670,7 +668,9 class CohInt(Operation):
670
668
671 if self.__dataReady:
669 if self.__dataReady:
672 dataOut.data = avgdata
670 dataOut.data = avgdata
673 dataOut.nCohInt *= self.n
671 if not dataOut.flagCohInt:
672 dataOut.nCohInt *= self.n
673 dataOut.flagCohInt = True
674 dataOut.utctime = avgdatatime
674 dataOut.utctime = avgdatatime
675 # print avgdata, avgdatatime
675 # print avgdata, avgdatatime
676 # raise
676 # raise
General Comments 0
You need to be logged in to leave comments. Login now