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