##// END OF EJS Templates
Version 2.1.3: ...
Miguel Valdez -
r664:9aee9f7a8e3e
parent child
Show More
@@ -5,4 +5,11 VERSIONS:
5 Server thread opens and closes remote server each time file list is sent
5 Server thread opens and closes remote server each time file list is sent
6 -jroplot_spectra.py: Noise path was not being created saving noise data.
6 -jroplot_spectra.py: Noise path was not being created saving noise data.
7 -jroIO_base.py: startTime can be greater than endTime
7 -jroIO_base.py: startTime can be greater than endTime
8 -jroplot_heispectra.py: SpectraHeisScope was not showing the right channel
8
9 2.1.3:
10 -jroplot_heispectra.py: SpectraHeisScope was not showing the right channels
11 -jroproc_voltage.py: Bug fixed selecting profiles (self.nProfiles took a wrong value),
12 Bug fixed selecting heights by block (selecting profiles instead heights)
13 -jroproc_voltage.py: New feature added: decoding data by block using FFT.
14 -jroIO_heispectra.py: Bug fixed in FitsReader. Using local Fits object instead schainpy.mode.data.jrodata.Fits object.
15 -jroIO_heispectra.py: Channel index list does not exist. No newline at end of file
@@ -4,4 +4,4 Created on Feb 7, 2012
4 @author $Author$
4 @author $Author$
5 @version $Id$
5 @version $Id$
6 '''
6 '''
7 __version__ = "2.1.2" No newline at end of file
7 __version__ = "2.1.3" No newline at end of file
@@ -2,8 +2,7
2 Created on September , 2012
2 Created on September , 2012
3 @author:
3 @author:
4 '''
4 '''
5 from xml.etree.ElementTree import Element, SubElement
5 from xml.etree.ElementTree import ElementTree, Element, SubElement, tostring
6 from xml.etree import ElementTree as ET
7 from xml.dom import minidom
6 from xml.dom import minidom
8
7
9 from model import *
8 from model import *
@@ -18,7 +17,7 import ast
18 def prettify(elem):
17 def prettify(elem):
19 """Return a pretty-printed XML string for the Element.
18 """Return a pretty-printed XML string for the Element.
20 """
19 """
21 rough_string = ET.tostring(elem, 'utf-8')
20 rough_string = tostring(elem, 'utf-8')
22 reparsed = minidom.parseString(rough_string)
21 reparsed = minidom.parseString(rough_string)
23 return reparsed.toprettyxml(indent=" ")
22 return reparsed.toprettyxml(indent=" ")
24
23
@@ -2245,7 +2245,7 class BasicWindow(QMainWindow, Ui_BasicWindow):
2245 return 0
2245 return 0
2246
2246
2247 # if something happened
2247 # if something happened
2248 parms_ok, output_path, blocksperfile, metada = self.checkInputsPUSave(datatype='SpectraHeis')
2248 parms_ok, output_path, blocksperfile, metadata_file = self.checkInputsPUSave(datatype='SpectraHeis')
2249 if parms_ok:
2249 if parms_ok:
2250 name_operation = 'FitsWriter'
2250 name_operation = 'FitsWriter'
2251 optype = 'other'
2251 optype = 'other'
@@ -2254,13 +2254,18 class BasicWindow(QMainWindow, Ui_BasicWindow):
2254 name_parameter3 = 'metadatafile'
2254 name_parameter3 = 'metadatafile'
2255 value1 = output_path
2255 value1 = output_path
2256 value2 = blocksperfile
2256 value2 = blocksperfile
2257 value3 = metada
2257 value3 = metadata_file
2258 format2 = "int"
2258 format2 = "int"
2259 format3 = "str"
2259 format3 = "str"
2260 opObj = puObj.addOperation(name=name_operation, optype=optype)
2260 opObj = puObj.addOperation(name=name_operation, optype=optype)
2261
2261 opObj.addParameter(name=name_parameter1, value=value1)
2262 opObj.addParameter(name=name_parameter1, value=value1)
2262 opObj.addParameter(name=name_parameter2, value=value2, format=format2)
2263
2263 opObj.addParameter(name=name_parameter3, value=value3, format=format3)
2264 if blocksperfile:
2265 opObj.addParameter(name=name_parameter2, value=value2, format=format2)
2266
2267 if metadata_file:
2268 opObj.addParameter(name=name_parameter3, value=value3, format=format3)
2264
2269
2265 self.console.clear()
2270 self.console.clear()
2266 try:
2271 try:
@@ -3882,8 +3887,8 class BasicWindow(QMainWindow, Ui_BasicWindow):
3882 self.specHeisOutputMetada.clear()
3887 self.specHeisOutputMetada.clear()
3883 else:
3888 else:
3884 value = opObj.getParameterValue(parameterName='metadatafile')
3889 value = opObj.getParameterValue(parameterName='metadatafile')
3885 metada = str(value)
3890 metadata_file = str(value)
3886 self.specHeisOutputMetada.setText(metada)
3891 self.specHeisOutputMetada.setText(metadata_file)
3887
3892
3888 return
3893 return
3889
3894
@@ -5178,21 +5183,17 class BasicWindow(QMainWindow, Ui_BasicWindow):
5178 if datatype == "SpectraHeis":
5183 if datatype == "SpectraHeis":
5179 output_path = str(self.specHeisOutputPath.text())
5184 output_path = str(self.specHeisOutputPath.text())
5180 blocksperfile = str(self.specHeisOutputblocksperfile.text())
5185 blocksperfile = str(self.specHeisOutputblocksperfile.text())
5181 metada = str(self.specHeisOutputMetada.text())
5186 metadata_file = str(self.specHeisOutputMetada.text())
5182
5187
5183 if output_path == '':
5188 if output_path == '':
5184 outputstr = 'Outputpath is empty'
5189 outputstr = 'Outputpath is empty'
5185 self.console.append(outputstr)
5190 self.console.append(outputstr)
5186 parms_ok = False
5191 parms_ok = False
5187 data_path = None
5188
5189 if output_path != None:
5190 if not os.path.exists(output_path):
5191 outputstr = 'OutputPath:%s does not exists' % output_path
5192 self.console.append(outputstr)
5193 parms_ok = False
5194 output_path = None
5195
5192
5193 if not os.path.isdir(output_path):
5194 outputstr = 'OutputPath:%s does not exists' % output_path
5195 self.console.append(outputstr)
5196 parms_ok = False
5196
5197
5197 try:
5198 try:
5198 profilesperblock = int(profilesperblock)
5199 profilesperblock = int(profilesperblock)
@@ -5218,16 +5219,11 class BasicWindow(QMainWindow, Ui_BasicWindow):
5218 blocksperfile = None
5219 blocksperfile = None
5219
5220
5220 if datatype == "SpectraHeis":
5221 if datatype == "SpectraHeis":
5221 if metada == '':
5222 if metadata_file != '':
5222 outputstr = 'Choose metada file'
5223 if not os.path.isfile(metadata_file):
5223 self.console.append(outputstr)
5224 outputstr = 'Metadata file %s does not exist' % metadata_file
5224 parms_ok = False
5225 if metada != None:
5226 if not os.path.isfile(metada):
5227 outputstr = 'Metadata:%s does not exists' % metada
5228 self.console.append(outputstr)
5225 self.console.append(outputstr)
5229 parms_ok = False
5226 parms_ok = False
5230 output_path = None
5231
5227
5232 if datatype == "Voltage":
5228 if datatype == "Voltage":
5233 return parms_ok, output_path, blocksperfile, profilesperblock
5229 return parms_ok, output_path, blocksperfile, profilesperblock
@@ -5238,7 +5234,7 class BasicWindow(QMainWindow, Ui_BasicWindow):
5238
5234
5239
5235
5240 if datatype == "SpectraHeis":
5236 if datatype == "SpectraHeis":
5241 return parms_ok, output_path, blocksperfile, metada
5237 return parms_ok, output_path, blocksperfile, metadata_file
5242
5238
5243 def findDatafiles(self, data_path, ext, walk, expLabel=''):
5239 def findDatafiles(self, data_path, ext, walk, expLabel=''):
5244
5240
@@ -228,13 +228,13 class Ui_SpectraHeisTab(object):
228
228
229 self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.tabgraphSpectraHeis), _translate("MainWindow", "Graphics", None))
229 self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.tabgraphSpectraHeis), _translate("MainWindow", "Graphics", None))
230 self.label_67.setText(_translate("MainWindow", "Path:", None))
230 self.label_67.setText(_translate("MainWindow", "Path:", None))
231 self.label_68.setText(_translate("MainWindow", "Blocks per File:", None))
231 self.label_68.setText(_translate("MainWindow", "Blocks per file:", None))
232 self.label_66.setText(_translate("MainWindow", "Type:", None))
232 self.label_66.setText(_translate("MainWindow", "Type:", None))
233
233
234 self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.taboutputSpectraHeis), _translate("MainWindow", "Output", None))
234 self.tabWidgetSpectraHeis.setTabText(self.tabWidgetSpectraHeis.indexOf(self.taboutputSpectraHeis), _translate("MainWindow", "Output", None))
235 self.specHeisOutputToolPath.setText(_translate("MainWindow", "...", None))
235 self.specHeisOutputToolPath.setText(_translate("MainWindow", "...", None))
236 self.specHeisOutputComdata.setItemText(0, _translate("MainWindow", ".fits", None))
236 self.specHeisOutputComdata.setItemText(0, _translate("MainWindow", ".fits", None))
237 self.label_69.setText(_translate("MainWindow", "Metada", None))
237 self.label_69.setText(_translate("MainWindow", "Metadata file:", None))
238 self.specHeisOutputMetadaToolPath.setText(_translate("MainWindow", "...", None))
238 self.specHeisOutputMetadaToolPath.setText(_translate("MainWindow", "...", None))
239
239
240 self.tabWidgetProject.setTabText(self.tabWidgetProject.indexOf(self.tabSpectraHeis), _translate("MainWindow", "SpectraHeis", None))
240 self.tabWidgetProject.setTabText(self.tabWidgetProject.indexOf(self.tabSpectraHeis), _translate("MainWindow", "SpectraHeis", None))
@@ -833,10 +833,6 class Fits(JROData):
833
833
834 return heis
834 return heis
835
835
836 def isEmpty(self):
837
838 return self.flagNoData
839
840 def getNHeights(self):
836 def getNHeights(self):
841
837
842 return len(self.heightList)
838 return len(self.heightList)
@@ -8,11 +8,6 from jroIO_voltage import *
8 from jroIO_spectra import *
8 from jroIO_spectra import *
9 from jroIO_heispectra import *
9 from jroIO_heispectra import *
10 from jroIO_usrp import *
10 from jroIO_usrp import *
11
12 # try:
13 # from jroIO_usrp_api import *
14 # except:
15 # print "jroIO_usrp_api could not be imported"
16
11
17 from jroIO_amisr import *
12 from jroIO_amisr import *
18 from jroIO_HDF5 import *
13 from jroIO_HDF5 import *
@@ -9,24 +9,20 import time, datetime
9 import numpy
9 import numpy
10 import fnmatch
10 import fnmatch
11 import glob
11 import glob
12
12 from time import sleep
13 try:
14 from gevent import sleep
15 except:
16 from time import sleep
17
13
18 try:
14 try:
19 import pyfits
15 import pyfits
20 except:
16 except ImportError, e:
21 """
17 print "Fits data cannot be used. Install pyfits module"
22 """
23
18
24 from xml.etree.ElementTree import ElementTree
19 from xml.etree.ElementTree import ElementTree
25
20
26 from jroIO_base import isRadarFolder, isNumber
21 from jroIO_base import isRadarFolder, isNumber
22 from schainpy.model.data.jrodata import Fits
27 from schainpy.model.proc.jroproc_base import Operation, ProcessingUnit
23 from schainpy.model.proc.jroproc_base import Operation, ProcessingUnit
28
24
29 class Fits:
25 class PyFits(object):
30 name=None
26 name=None
31 format=None
27 format=None
32 array =None
28 array =None
@@ -103,7 +99,7 class ParameterConf:
103 def getElementName(self):
99 def getElementName(self):
104 return self.ELEMENTNAME
100 return self.ELEMENTNAME
105
101
106 class Metadata:
102 class Metadata(object):
107
103
108 def __init__(self, filename):
104 def __init__(self, filename):
109 self.parmConfObjList = []
105 self.parmConfObjList = []
@@ -134,28 +130,23 class FitsWriter(Operation):
134 self.ext = '.fits'
130 self.ext = '.fits'
135 self.setFile = 0
131 self.setFile = 0
136
132
137 def setFitsHeader(self, dataOut, metadatafile):
133 def setFitsHeader(self, dataOut, metadatafile=None):
138
134
139 header_data = pyfits.PrimaryHDU()
135 header_data = pyfits.PrimaryHDU()
140
136
141 metadata4fits = Metadata(metadatafile)
137 header_data.header['EXPNAME'] = "RADAR DATA"
142 for parameter in metadata4fits.parmConfObjList:
138 header_data.header['DATATYPE'] = "SPECTRA"
143 parm_name = parameter.name
139 header_data.header['COMMENT'] = ""
144 parm_value = parameter.value
140
141 if metadatafile:
145
142
146 # if parm_value == 'fromdatadatetime':
143 metadata4fits = Metadata(metadatafile)
147 # value = time.strftime("%b %d %Y %H:%M:%S", dataOut.datatime.timetuple())
148 # elif parm_value == 'fromdataheights':
149 # value = dataOut.nHeights
150 # elif parm_value == 'fromdatachannel':
151 # value = dataOut.nChannels
152 # elif parm_value == 'fromdatasamples':
153 # value = dataOut.nFFTPoints
154 # else:
155 # value = parm_value
156
157 header_data.header[parm_name] = parm_value
158
144
145 for parameter in metadata4fits.parmConfObjList:
146 parm_name = parameter.name
147 parm_value = parameter.value
148
149 header_data.header[parm_name] = parm_value
159
150
160 header_data.header['DATETIME'] = time.strftime("%b %d %Y %H:%M:%S", dataOut.datatime.timetuple())
151 header_data.header['DATETIME'] = time.strftime("%b %d %Y %H:%M:%S", dataOut.datatime.timetuple())
161 header_data.header['CHANNELLIST'] = str(dataOut.channelList)
152 header_data.header['CHANNELLIST'] = str(dataOut.channelList)
@@ -174,7 +165,7 class FitsWriter(Operation):
174 self.addExtension(dataOut.heightList,'HEIGHTLIST')
165 self.addExtension(dataOut.heightList,'HEIGHTLIST')
175
166
176
167
177 def setup(self, dataOut, path, dataBlocksPerFile, metadatafile):
168 def setup(self, dataOut, path, dataBlocksPerFile=100, metadatafile=None):
178
169
179 self.path = path
170 self.path = path
180 self.dataOut = dataOut
171 self.dataOut = dataOut
@@ -388,7 +379,7 class FitsReader(ProcessingUnit):
388
379
389 self.dataOut.header = self.header_dict
380 self.dataOut.header = self.header_dict
390 self.dataOut.expName = self.expName
381 self.dataOut.expName = self.expName
391 self.dataOut.nChannels = self.nChannels
382
392 self.dataOut.timeZone = self.timeZone
383 self.dataOut.timeZone = self.timeZone
393 self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile
384 self.dataOut.dataBlocksPerFile = self.dataBlocksPerFile
394 self.dataOut.comments = self.comments
385 self.dataOut.comments = self.comments
@@ -399,6 +390,8 class FitsReader(ProcessingUnit):
399 self.dataOut.nCohInt = self.nCohInt
390 self.dataOut.nCohInt = self.nCohInt
400 self.dataOut.nIncohInt = self.nIncohInt
391 self.dataOut.nIncohInt = self.nIncohInt
401
392
393 self.dataOut.ippSeconds = self.ippSeconds
394
402 def readHeader(self):
395 def readHeader(self):
403 headerObj = self.fitsObj[0]
396 headerObj = self.fitsObj[0]
404
397
@@ -688,6 +681,9 class FitsReader(ProcessingUnit):
688
681
689 return 1
682 return 1
690
683
684 def printInfo(self):
685
686 pass
691
687
692 def getData(self):
688 def getData(self):
693
689
@@ -702,7 +698,7 class FitsReader(ProcessingUnit):
702 if not(self.readNextBlock()):
698 if not(self.readNextBlock()):
703 return 0
699 return 0
704
700
705 if self.data == None:
701 if self.data is None:
706 self.dataOut.flagNoData = True
702 self.dataOut.flagNoData = True
707 return 0
703 return 0
708
704
@@ -739,7 +735,7 class SpectraHeisWriter(Operation):
739 subfolder = None
735 subfolder = None
740
736
741 def __init__(self):
737 def __init__(self):
742 self.wrObj = Fits()
738 self.wrObj = PyFits()
743 # self.dataOut = dataOut
739 # self.dataOut = dataOut
744 self.nTotalBlocks=0
740 self.nTotalBlocks=0
745 # self.set = None
741 # self.set = None
@@ -56,7 +56,7 class SpectraHeisProc(ProcessingUnit):
56 def __updateObjFromFits(self):
56 def __updateObjFromFits(self):
57
57
58 self.dataOut.utctime = self.dataIn.utctime
58 self.dataOut.utctime = self.dataIn.utctime
59 self.dataOut.channelIndexList = self.dataIn.channelIndexList
59 # self.dataOut.channelIndexList = self.dataIn.channelIndexList
60
60
61 self.dataOut.channelList = self.dataIn.channelList
61 self.dataOut.channelList = self.dataIn.channelList
62 self.dataOut.heightList = self.dataIn.heightList
62 self.dataOut.heightList = self.dataIn.heightList
General Comments 0
You need to be logged in to leave comments. Login now