@@ -63,6 +63,10 class JROData: | |||||
63 | ippSeconds = None |
|
63 | ippSeconds = None | |
64 |
|
64 | |||
65 | timeInterval = None |
|
65 | timeInterval = None | |
|
66 | ||||
|
67 | set=None | |||
|
68 | ||||
|
69 | deltaHeight = None | |||
66 |
|
70 | |||
67 | def __init__(self): |
|
71 | def __init__(self): | |
68 |
|
72 |
@@ -209,7 +209,7 class LinearPlot(): | |||||
209 |
|
209 | |||
210 | def __init__(self, indexFig,nsubplot,winTitle): |
|
210 | def __init__(self, indexFig,nsubplot,winTitle): | |
211 | self.width = 700 |
|
211 | self.width = 700 | |
212 |
self.height = |
|
212 | self.height = 800 | |
213 | self.indexFig = indexFig |
|
213 | self.indexFig = indexFig | |
214 | self.ncol = 1 |
|
214 | self.ncol = 1 | |
215 | self.nrow = nsubplot |
|
215 | self.nrow = nsubplot | |
@@ -760,12 +760,12 if __name__ == '__main__': | |||||
760 | ylabel = "" |
|
760 | ylabel = "" | |
761 |
|
761 | |||
762 | indexFig = 1 |
|
762 | indexFig = 1 | |
763 |
nsubplot = |
|
763 | nsubplot = 6 | |
764 | winTitle = "figura" |
|
764 | winTitle = "figura" | |
765 |
|
765 | |||
766 | isPlotIni = False |
|
766 | isPlotIni = False | |
767 | isPlotConfig = False |
|
767 | isPlotConfig = False | |
768 | ntimes = 10 |
|
768 | ntimes = 100 | |
769 |
|
769 | |||
770 |
|
770 | |||
771 | # Instancia del objeto |
|
771 | # Instancia del objeto |
@@ -225,6 +225,8 class JRODataIO: | |||||
225 |
|
225 | |||
226 | blocksize = None |
|
226 | blocksize = None | |
227 |
|
227 | |||
|
228 | set = None | |||
|
229 | ||||
228 | def __init__(self): |
|
230 | def __init__(self): | |
229 | pass |
|
231 | pass | |
230 |
|
232 | |||
@@ -588,7 +590,7 class JRODataReader(JRODataIO): | |||||
588 | self.filename = file |
|
590 | self.filename = file | |
589 | self.flagIsNewFile = 1 |
|
591 | self.flagIsNewFile = 1 | |
590 | if self.fp != None: self.fp.close() |
|
592 | if self.fp != None: self.fp.close() | |
591 | self.fp = open(file) |
|
593 | self.fp = open(file, 'rb') | |
592 | self.flagNoMoreFiles = 0 |
|
594 | self.flagNoMoreFiles = 0 | |
593 | print 'Setting the file: %s' % file |
|
595 | print 'Setting the file: %s' % file | |
594 | else: |
|
596 | else: | |
@@ -613,11 +615,11 class JRODataReader(JRODataIO): | |||||
613 |
|
615 | |||
614 | if not(newFile): |
|
616 | if not(newFile): | |
615 | return 0 |
|
617 | return 0 | |
616 |
|
618 | |||
617 | self.__readFirstHeader() |
|
619 | self.__readFirstHeader() | |
618 | self.nReadBlocks = 0 |
|
620 | self.nReadBlocks = 0 | |
619 | return 1 |
|
621 | return 1 | |
620 |
|
622 | |||
621 | def __setNewBlock(self): |
|
623 | def __setNewBlock(self): | |
622 | if self.fp == None: |
|
624 | if self.fp == None: | |
623 | return 0 |
|
625 | return 0 |
@@ -603,8 +603,7 class SpectraWriter(JRODataWriter): | |||||
603 |
|
603 | |||
604 | if self.flagNoMoreFiles: |
|
604 | if self.flagNoMoreFiles: | |
605 | #print 'Process finished' |
|
605 | #print 'Process finished' | |
606 | return 0 |
|
606 | return 0 | |
607 |
|
||||
608 | return 1 |
|
607 | return 1 | |
609 |
|
608 | |||
610 |
|
609 | |||
@@ -786,6 +785,8 class FITS: | |||||
786 | array =None |
|
785 | array =None | |
787 | data =None |
|
786 | data =None | |
788 | thdulist=None |
|
787 | thdulist=None | |
|
788 | prihdr=None | |||
|
789 | hdu=None | |||
789 |
|
790 | |||
790 | def __init__(self): |
|
791 | def __init__(self): | |
791 |
|
792 | |||
@@ -807,9 +808,7 class FITS: | |||||
807 | # self.col2 = pyfits.Column(name=self.name, format=self.format, array=a2) |
|
808 | # self.col2 = pyfits.Column(name=self.name, format=self.format, array=a2) | |
808 | # return self.col2 |
|
809 | # return self.col2 | |
809 |
|
810 | |||
810 | def writeHeader(self,): |
|
811 | ||
811 | pass |
|
|||
812 |
|
||||
813 | def writeData(self,name,format,data): |
|
812 | def writeData(self,name,format,data): | |
814 | self.name=name |
|
813 | self.name=name | |
815 | self.format=format |
|
814 | self.format=format | |
@@ -818,26 +817,47 class FITS: | |||||
818 | self.col2 = pyfits.Column(name=self.name, format=self.format, array=a2) |
|
817 | self.col2 = pyfits.Column(name=self.name, format=self.format, array=a2) | |
819 | return self.col2 |
|
818 | return self.col2 | |
820 |
|
819 | |||
821 | def cFImage(self,n): |
|
820 | def cFImage(self,idblock,year,month,day,hour,minute,second): | |
822 |
self.hdu= pyfits.PrimaryHDU( |
|
821 | self.hdu= pyfits.PrimaryHDU(idblock) | |
823 | return self.hdu |
|
822 | self.hdu.header.set("Year",year) | |
824 |
|
823 | self.hdu.header.set("Month",month) | ||
825 | def Ctable(self,col1,col2,col3,col4,col5,col6,col7,col8,col9): |
|
824 | self.hdu.header.set("Day",day) | |
826 | self.cols=pyfits.ColDefs( [col1,col2,col3,col4,col5,col6,col7,col8,col9]) |
|
825 | self.hdu.header.set("Hour",hour) | |
|
826 | self.hdu.header.set("Minute",minute) | |||
|
827 | self.hdu.header.set("Second",second) | |||
|
828 | return self.hdu | |||
|
829 | ||||
|
830 | ||||
|
831 | def Ctable(self,colList): | |||
|
832 | self.cols=pyfits.ColDefs(colList) | |||
827 | self.tbhdu = pyfits.new_table(self.cols) |
|
833 | self.tbhdu = pyfits.new_table(self.cols) | |
828 | return self.tbhdu |
|
834 | return self.tbhdu | |
829 |
|
835 | |||
|
836 | ||||
830 | def CFile(self,hdu,tbhdu): |
|
837 | def CFile(self,hdu,tbhdu): | |
831 | self.thdulist=pyfits.HDUList([hdu,tbhdu]) |
|
838 | self.thdulist=pyfits.HDUList([hdu,tbhdu]) | |
832 |
|
839 | |||
833 | def wFile(self,filename): |
|
840 | def wFile(self,filename): | |
834 | self.thdulist.writeto(filename) |
|
841 | self.thdulist.writeto(filename) | |
835 |
|
842 | |||
836 | class SpectraHeisWriter(): |
|
843 | class SpectraHeisWriter(JRODataWriter): | |
837 | i=0 |
|
844 | set = None | |
|
845 | setFile = None | |||
|
846 | idblock = None | |||
|
847 | doypath = None | |||
|
848 | subfolder = None | |||
|
849 | ||||
838 | def __init__(self, dataOutObj): |
|
850 | def __init__(self, dataOutObj): | |
839 | self.wrObj = FITS() |
|
851 | self.wrObj = FITS() | |
840 | self.dataOutObj = dataOutObj |
|
852 | self.dataOutObj = dataOutObj | |
|
853 | self.nTotalBlocks=0 | |||
|
854 | self.set = None | |||
|
855 | self.setFile = 0 | |||
|
856 | self.idblock = 0 | |||
|
857 | self.wrpath = None | |||
|
858 | self.doypath = None | |||
|
859 | self.subfolder = None | |||
|
860 | ||||
841 |
|
861 | |||
842 | def isNumber(str): |
|
862 | def isNumber(str): | |
843 | """ |
|
863 | """ | |
@@ -858,7 +878,7 class SpectraHeisWriter(): | |||||
858 | except: |
|
878 | except: | |
859 | return False |
|
879 | return False | |
860 |
|
880 | |||
861 |
def setup(self, wrpath |
|
881 | def setup(self, wrpath): | |
862 |
|
882 | |||
863 | if not(os.path.exists(wrpath)): |
|
883 | if not(os.path.exists(wrpath)): | |
864 | os.mkdir(wrpath) |
|
884 | os.mkdir(wrpath) | |
@@ -867,39 +887,63 class SpectraHeisWriter(): | |||||
867 | self.setFile = 0 |
|
887 | self.setFile = 0 | |
868 |
|
888 | |||
869 | def putData(self): |
|
889 | def putData(self): | |
870 | # self.wrObj.writeHeader(nChannels=self.dataOutObj.nChannels, nFFTPoints=self.dataOutObj.nFFTPoints) |
|
|||
871 | #name = self.dataOutObj.utctime |
|
|||
872 | name= time.localtime( self.dataOutObj.utctime) |
|
890 | name= time.localtime( self.dataOutObj.utctime) | |
873 | ext=".fits" |
|
891 | ext=".fits" | |
874 | #folder='D%4.4d%3.3d'%(name.tm_year,name.tm_yday) |
|
892 | ||
875 | subfolder = 'D%4.4d%3.3d' % (name.tm_year,name.tm_yday) |
|
893 | if self.doypath == None: | |
|
894 | self.subfolder = 'F%4.4d%3.3d_%d' % (name.tm_year,name.tm_yday,time.mktime(datetime.datetime.now().timetuple())) | |||
|
895 | self.doypath = os.path.join( self.wrpath, self.subfolder ) | |||
|
896 | os.mkdir(self.doypath) | |||
|
897 | ||||
|
898 | if self.set == None: | |||
|
899 | self.set = self.dataOutObj.set | |||
|
900 | self.setFile = 0 | |||
|
901 | if self.set != self.dataOutObj.set: | |||
|
902 | self.set = self.dataOutObj.set | |||
|
903 | self.setFile = 0 | |||
|
904 | ||||
|
905 | #make the filename | |||
|
906 | file = 'D%4.4d%3.3d%3.3d_%3.3d%s' % (name.tm_year,name.tm_yday,self.set,self.setFile,ext) | |||
876 |
|
907 | |||
877 |
|
|
908 | filename = os.path.join(self.wrpath,self.subfolder, file) | |
878 | if not( os.path.exists(doypath) ): |
|
909 | ||
879 | os.mkdir(doypath) |
|
910 | idblock = numpy.array([self.idblock],dtype="int64") | |
|
911 | header=self.wrObj.cFImage(idblock=idblock, | |||
|
912 | year=time.gmtime(self.dataOutObj.utctime).tm_year, | |||
|
913 | month=time.gmtime(self.dataOutObj.utctime).tm_mon, | |||
|
914 | day=time.gmtime(self.dataOutObj.utctime).tm_mday, | |||
|
915 | hour=time.gmtime(self.dataOutObj.utctime).tm_hour, | |||
|
916 | minute=time.gmtime(self.dataOutObj.utctime).tm_min, | |||
|
917 | second=time.gmtime(self.dataOutObj.utctime).tm_sec) | |||
|
918 | ||||
|
919 | c=3E8 | |||
|
920 | freq=numpy.arange(-1*self.dataOutObj.nHeights/2.,self.dataOutObj.nHeights/2.)*(c/(2*self.dataOutObj.deltaHeight*1000)) | |||
|
921 | ||||
|
922 | colList = [] | |||
|
923 | ||||
|
924 | colFreq=self.wrObj.setColF(name="freq", format=str(self.dataOutObj.nFFTPoints)+'E', array=freq) | |||
|
925 | ||||
|
926 | colList.append(colFreq) | |||
|
927 | ||||
|
928 | nchannel=self.dataOutObj.nChannels | |||
|
929 | ||||
|
930 | for i in range(nchannel): | |||
|
931 | col = self.wrObj.writeData(name="PCh"+str(i+1), | |||
|
932 | format=str(self.dataOutObj.nFFTPoints)+'E', | |||
|
933 | data=10*numpy.log10(self.dataOutObj.data_spc[i,:])) | |||
|
934 | ||||
|
935 | colList.append(col) | |||
|
936 | ||||
|
937 | data=self.wrObj.Ctable(colList=colList) | |||
|
938 | ||||
|
939 | self.wrObj.CFile(header,data) | |||
|
940 | ||||
|
941 | self.wrObj.wFile(filename) | |||
|
942 | ||||
|
943 | #update the setFile | |||
880 | self.setFile += 1 |
|
944 | self.setFile += 1 | |
881 | file = 'D%4.4d%3.3d%3.3d%s' % (name.tm_year,name.tm_yday,self.setFile,ext) |
|
945 | self.idblock += 1 | |
882 |
|
946 | |||
883 | filename = os.path.join(self.wrpath,subfolder, file) |
|
|||
884 |
|
||||
885 | # print self.dataOutObj.ippSeconds |
|
|||
886 | freq=numpy.arange(-1*self.dataOutObj.nHeights/2.,self.dataOutObj.nHeights/2.)/(2*self.dataOutObj.ippSeconds) |
|
|||
887 |
|
||||
888 | col1=self.wrObj.setColF(name="freq", format=str(self.dataOutObj.nFFTPoints)+'E', array=freq) |
|
|||
889 | col2=self.wrObj.writeData(name="P_Ch1",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[0,:])) |
|
|||
890 | col3=self.wrObj.writeData(name="P_Ch2",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[1,:])) |
|
|||
891 | col4=self.wrObj.writeData(name="P_Ch3",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[2,:])) |
|
|||
892 | col5=self.wrObj.writeData(name="P_Ch4",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[3,:])) |
|
|||
893 | col6=self.wrObj.writeData(name="P_Ch5",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[4,:])) |
|
|||
894 | col7=self.wrObj.writeData(name="P_Ch6",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[5,:])) |
|
|||
895 | col8=self.wrObj.writeData(name="P_Ch7",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[6,:])) |
|
|||
896 | col9=self.wrObj.writeData(name="P_Ch8",format=str(self.dataOutObj.nFFTPoints)+'E',data=10*numpy.log10(self.dataOutObj.data_spc[7,:])) |
|
|||
897 | #n=numpy.arange((100)) |
|
|||
898 | n=self.dataOutObj.data_spc[6,:] |
|
|||
899 | a=self.wrObj.cFImage(n) |
|
|||
900 | b=self.wrObj.Ctable(col1,col2,col3,col4,col5,col6,col7,col8,col9) |
|
|||
901 | self.wrObj.CFile(a,b) |
|
|||
902 | self.wrObj.wFile(filename) |
|
|||
903 | return 1 |
|
947 | return 1 | |
904 |
|
948 | |||
905 | No newline at end of file |
|
949 |
@@ -228,6 +228,12 class VoltageReader(JRODataReader): | |||||
228 |
|
228 | |||
229 | return 1 |
|
229 | return 1 | |
230 |
|
230 | |||
|
231 | ||||
|
232 | def __getset(self,filename): | |||
|
233 | name = os.path.basename(filename) | |||
|
234 | basename,ext = os.path.splitext(name) | |||
|
235 | set = int(basename[8:]) | |||
|
236 | return set | |||
231 |
|
237 | |||
232 | def getData(self): |
|
238 | def getData(self): | |
233 | """ |
|
239 | """ | |
@@ -273,6 +279,8 class VoltageReader(JRODataReader): | |||||
273 | self.dataOutObj.flagNoData = True |
|
279 | self.dataOutObj.flagNoData = True | |
274 | return 0 |
|
280 | return 0 | |
275 |
|
281 | |||
|
282 | self.dataOutObj.set = self.__getset(self.filename) | |||
|
283 | ||||
276 | self.dataOutObj.data = self.datablock[:,self.profileIndex,:] |
|
284 | self.dataOutObj.data = self.datablock[:,self.profileIndex,:] | |
277 |
|
285 | |||
278 | self.dataOutObj.dtype = self.dtype |
|
286 | self.dataOutObj.dtype = self.dtype | |
@@ -297,6 +305,8 class VoltageReader(JRODataReader): | |||||
297 |
|
305 | |||
298 | self.dataOutObj.ippSeconds = self.ippSeconds |
|
306 | self.dataOutObj.ippSeconds = self.ippSeconds | |
299 |
|
307 | |||
|
308 | self.dataOutObj.deltaHeight = self.processingHeaderObj.deltaHeight | |||
|
309 | ||||
300 | self.dataOutObj.timeInterval = self.ippSeconds * self.processingHeaderObj.nCohInt |
|
310 | self.dataOutObj.timeInterval = self.ippSeconds * self.processingHeaderObj.nCohInt | |
301 |
|
311 | |||
302 | self.dataOutObj.nCohInt = self.processingHeaderObj.nCohInt |
|
312 | self.dataOutObj.nCohInt = self.processingHeaderObj.nCohInt |
@@ -12,8 +12,9 path = os.path.split(os.getcwd())[0] | |||||
12 | sys.path.append(path) |
|
12 | sys.path.append(path) | |
13 |
|
13 | |||
14 | from Data.JROData import Spectra, SpectraHeis |
|
14 | from Data.JROData import Spectra, SpectraHeis | |
15 | from IO.SpectraIO import SpectraWriter |
|
15 | from IO.SpectraIO import SpectraWriter,SpectraHeisWriter | |
16 | from Graphics.schainPlotTypes import ScopeFigure, SpcFigure, RTIFigure |
|
16 | from Graphics.schainPlotTypes import ScopeFigure, SpcFigure, RTIFigure | |
|
17 | from Graphics.BaseGraph_mpl import LinearPlot | |||
17 | #from JRONoise import Noise |
|
18 | #from JRONoise import Noise | |
18 |
|
19 | |||
19 | class SpectraProcessor: |
|
20 | class SpectraProcessor: | |
@@ -551,7 +552,9 class SpectraHeisProcessor: | |||||
551 | self.dataOutObj.flagShiftFFT = self.dataInObj.flagShiftFFT |
|
552 | self.dataOutObj.flagShiftFFT = self.dataInObj.flagShiftFFT | |
552 | self.dataOutObj.nIncohInt = 1 |
|
553 | self.dataOutObj.nIncohInt = 1 | |
553 | self.dataOutObj.ippSeconds= self.dataInObj.ippSeconds |
|
554 | self.dataOutObj.ippSeconds= self.dataInObj.ippSeconds | |
554 |
|
555 | self.dataOutObj.set=self.dataInObj.set | ||
|
556 | self.dataOutObj.deltaHeight=self.dataInObj.deltaHeight | |||
|
557 | ||||
555 | # def addWriter(self,wrpath,blocksPerfile): |
|
558 | # def addWriter(self,wrpath,blocksPerfile): | |
556 | def addWriter(self,wrpath): |
|
559 | def addWriter(self,wrpath): | |
557 | objWriter=SpectraHeisWriter(self.dataOutObj) |
|
560 | objWriter=SpectraHeisWriter(self.dataOutObj) | |
@@ -605,7 +608,7 class SpectraHeisProcessor: | |||||
605 | self.addIntegrator(N,timeInterval) |
|
608 | self.addIntegrator(N,timeInterval) | |
606 |
|
609 | |||
607 | myIncohIntObj = self.integratorObjList[self.integratorObjIndex] |
|
610 | myIncohIntObj = self.integratorObjList[self.integratorObjIndex] | |
608 |
myIncohIntObj.exe(data=self.dataOutObj.data_spc,time |
|
611 | myIncohIntObj.exe(data=self.dataOutObj.data_spc,datatime=self.dataOutObj.utctime) | |
609 |
|
612 | |||
610 | if myIncohIntObj.isReady: |
|
613 | if myIncohIntObj.isReady: | |
611 | self.dataOutObj.data_spc = myIncohIntObj.data |
|
614 | self.dataOutObj.data_spc = myIncohIntObj.data | |
@@ -677,6 +680,84 class SpectraHeisProcessor: | |||||
677 | gpath) |
|
680 | gpath) | |
678 |
|
681 | |||
679 | self.plotObjIndex += 1 |
|
682 | self.plotObjIndex += 1 | |
|
683 | ||||
|
684 | ||||
|
685 | def addPlotMatScope(self, indexPlot,nsubplot,winTitle): | |||
|
686 | linearObj = LinearPlot(indexPlot,nsubplot,winTitle) | |||
|
687 | self.plotObjList.append(linearObj) | |||
|
688 | ||||
|
689 | def plotMatScope(self, idfigure, | |||
|
690 | channelList=None, | |||
|
691 | wintitle="", | |||
|
692 | save=None, | |||
|
693 | gpath=None): | |||
|
694 | ||||
|
695 | if self.dataOutObj.flagNoData: | |||
|
696 | return 0 | |||
|
697 | ||||
|
698 | if channelList == None: | |||
|
699 | channelList = self.dataOutObj.channelList | |||
|
700 | ||||
|
701 | nchannels = len(channelList) | |||
|
702 | ||||
|
703 | thisDatetime = datetime.datetime.fromtimestamp(self.dataOutObj.utctime) | |||
|
704 | dateTime = "%s"%(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |||
|
705 | winTitle = "Spectra Profile" #+ dateTime | |||
|
706 | ||||
|
707 | if len(self.plotObjList) <= self.plotObjIndex: | |||
|
708 | self.addPlotMatScope(idfigure,nchannels,winTitle) | |||
|
709 | c = 3E8 | |||
|
710 | x=numpy.arange(-1*self.dataOutObj.nHeights/2.,self.dataOutObj.nHeights/2.)*(c/(2*self.dataOutObj.deltaHeight*self.dataOutObj.nHeights*1000)) | |||
|
711 | x= x/(10000.0) | |||
|
712 | ||||
|
713 | data = 10*numpy.log10(self.dataOutObj.data_spc) | |||
|
714 | ||||
|
715 | subplotTitle = "Channel No." | |||
|
716 | xlabel = "Frecuencias(hz)*10K" | |||
|
717 | ylabel = "Potencia(dB)" | |||
|
718 | ||||
|
719 | isPlotIni=False | |||
|
720 | isPlotConfig=False | |||
|
721 | ||||
|
722 | ntimes=2 | |||
|
723 | nsubplot= nchannels | |||
|
724 | ||||
|
725 | plotObj = self.plotObjList[self.plotObjIndex] | |||
|
726 | ||||
|
727 | # for i in range(ntimes): | |||
|
728 | #Creacion de Subplots | |||
|
729 | if not(plotObj.isPlotIni): | |||
|
730 | for index in range(nsubplot): | |||
|
731 | indexplot = index + 1 | |||
|
732 | title = subplotTitle + '%d'%indexplot | |||
|
733 | xmin = numpy.min(x) | |||
|
734 | xmax = numpy.max(x) | |||
|
735 | ymin = numpy.min(data[index,:]) | |||
|
736 | ymax = numpy.max(data[index,:]) | |||
|
737 | plotObj.createObjects(indexplot,xmin,xmax,ymin,ymax,title,xlabel,ylabel) | |||
|
738 | plotObj.isPlotIni =True | |||
|
739 | ||||
|
740 | # Inicializa el grafico en cada itearcion | |||
|
741 | plotObj.setFigure(idfigure) | |||
|
742 | plotObj.setFigure("") | |||
|
743 | ||||
|
744 | for index in range(nsubplot): | |||
|
745 | subplot = index | |||
|
746 | plotObj.iniPlot(subplot+1) | |||
|
747 | #Ploteo de datos | |||
|
748 | ||||
|
749 | for channel in range(nsubplot): | |||
|
750 | y=data[channel,:] | |||
|
751 | plotObj.plot(channel+1,x,y,type='simple') | |||
|
752 | ||||
|
753 | plotObj.refresh() | |||
|
754 | ||||
|
755 | #time.sleep(0.05) | |||
|
756 | ||||
|
757 | # plotObj.show() | |||
|
758 | ||||
|
759 | self.plotObjIndex += 1 | |||
|
760 | #print "Ploteo Finalizado" | |||
680 |
|
761 | |||
681 | def rti(self): |
|
762 | def rti(self): | |
682 | if self.dataOutObj.flagNoData: |
|
763 | if self.dataOutObj.flagNoData: |
@@ -21,30 +21,51 from Processing.SpectraProcessor import * | |||||
21 | #from Graphics.BaseGraph_mpl import LinearPlot |
|
21 | #from Graphics.BaseGraph_mpl import LinearPlot | |
22 |
|
22 | |||
23 | class TestHeis(): |
|
23 | class TestHeis(): | |
24 | i=None |
|
24 | ||
25 | def __init__(self): |
|
25 | def __init__(self): | |
26 | self.setValues() |
|
26 | self.setValues() | |
27 | self.createObjects() |
|
27 | self.createObjects() | |
28 | self.testSChain() |
|
28 | self.testSChain() | |
29 | self.i=0 |
|
29 | self.i=0 | |
|
30 | ||||
|
31 | ||||
|
32 | def VerifyArguments(self): | |||
|
33 | pass | |||
|
34 | ||||
|
35 | ||||
|
36 | ||||
|
37 | def setValues(self): | |||
|
38 | ||||
30 |
|
39 | |||
31 | def setValues( self ): |
|
|||
32 |
|
40 | |||
33 |
self.path=" |
|
41 | self.path="D:\\te" | |
34 |
|
42 | |||
35 | #self.path = "" |
|
43 | #self.path = "" | |
36 |
self.startDate = datetime.date(2012, |
|
44 | # self.startDate = datetime.date(2012,10,1) | |
37 |
self.endDate = datetime.date(2012, |
|
45 | # self.endDate = datetime.date(2012,12,30) | |
|
46 | # | |||
|
47 | # self.startTime = datetime.time(0,0,0) | |||
|
48 | # self.endTime = datetime.time(23,0,0) | |||
|
49 | # | |||
38 |
|
50 | |||
39 | self.startTime = datetime.time(0,0,0) |
|
51 | ||
40 | self.endTime = datetime.time(23,0,0) |
|
52 | ||
41 |
|
53 | self.N=1000 | ||
42 |
|
54 | |||
|
55 | self.wrpath = "D:\\te\\FITS" | |||
|
56 | ||||
|
57 | self.online | |||
|
58 | ||||
|
59 | self.startDate = None | |||
|
60 | self.endDate = None | |||
|
61 | self.startTime = None | |||
|
62 | self.endTime = None | |||
|
63 | ||||
|
64 | # self.blocksPerFile = 1 | |||
43 | def createObjects( self ): |
|
65 | def createObjects( self ): | |
44 |
|
66 | |||
45 | self.readerObj = VoltageReader() |
|
67 | self.readerObj = VoltageReader() | |
46 | self.specProcObj = SpectraHeisProcessor() |
|
68 | self.specProcObj = SpectraHeisProcessor() | |
47 |
|
||||
48 | self.voltObj1 = self.readerObj.setup( |
|
69 | self.voltObj1 = self.readerObj.setup( | |
49 | path = self.path, |
|
70 | path = self.path, | |
50 | startDate = self.startDate, |
|
71 | startDate = self.startDate, | |
@@ -52,41 +73,29 class TestHeis(): | |||||
52 | startTime = self.startTime, |
|
73 | startTime = self.startTime, | |
53 | endTime = self.endTime, |
|
74 | endTime = self.endTime, | |
54 | expLabel = '', |
|
75 | expLabel = '', | |
55 |
online = |
|
76 | online = self.online) | |
56 |
|
77 | |||
57 | if not(self.voltObj1): |
|
78 | if not(self.voltObj1): | |
58 | sys.exit(0) |
|
79 | sys.exit(0) | |
59 |
|
80 | |||
60 | self.specObj1 = self.specProcObj.setup(dataInObj = self.voltObj1,nFFTPoints=self.voltObj1.nHeights) |
|
81 | self.specObj1 = self.specProcObj.setup(dataInObj = self.voltObj1,nFFTPoints=self.voltObj1.nHeights) | |
61 |
|
82 | # | ||
62 |
|
||||
63 | # |
|
|||
64 |
|
||||
65 | # |
|
|||
66 |
|
||||
67 | def testSChain( self ): |
|
83 | def testSChain( self ): | |
68 |
|
84 | |||
69 | ini = time.time() |
|
85 | ini = time.time() | |
70 | counter = 0 |
|
86 | counter = 0 | |
71 | while(True): |
|
87 | while(True): | |
72 | self.readerObj.getData() |
|
88 | self.readerObj.getData() | |
|
89 | ||||
73 | self.specProcObj.init() |
|
90 | self.specProcObj.init() | |
74 |
|
91 | |||
75 |
self.specProcObj.integrator(N |
|
92 | self.specProcObj.integrator(self.N) ## return self.dataOutObj | |
76 |
|
93 | |||
77 |
|
94 | self.specProcObj.writedata(self.wrpath) | ||
78 |
|
||||
79 |
|
||||
80 | self.specProcObj.plotScope(idfigure=1, |
|
|||
81 | wintitle='test plot library', |
|
|||
82 | driver='plplot', |
|
|||
83 | minvalue = 30000.0, |
|
|||
84 | maxvalue = 5000000.0, |
|
|||
85 | save=True, |
|
|||
86 | gpath="/home/roj-idl71/PlotImage") |
|
|||
87 |
|
||||
88 |
|
95 | |||
89 | if self.readerObj.flagNoMoreFiles: |
|
96 | self.specProcObj.plotMatScope(idfigure=1) | |
|
97 | ||||
|
98 | if self.readerObj.flagNoMoreFiles: | |||
90 | break |
|
99 | break | |
91 |
|
100 | |||
92 |
|
101 | |||
@@ -94,7 +103,7 class TestHeis(): | |||||
94 | if self.readerObj.flagIsNewBlock: |
|
103 | if self.readerObj.flagIsNewBlock: | |
95 | print 'Block No %04d, Time: %s' %(self.readerObj.nTotalBlocks, |
|
104 | print 'Block No %04d, Time: %s' %(self.readerObj.nTotalBlocks, | |
96 | datetime.datetime.fromtimestamp(self.readerObj.basicHeaderObj.utc),) |
|
105 | datetime.datetime.fromtimestamp(self.readerObj.basicHeaderObj.utc),) | |
97 |
|
106 | |||
98 |
|
107 | |||
99 |
|
108 | |||
100 | if __name__ == '__main__': |
|
109 | if __name__ == '__main__': |
General Comments 0
You need to be logged in to leave comments.
Login now