##// END OF EJS Templates
cambio para xmin
José Chávez -
r1008:3346b2da492e merge
parent child
Show More
@@ -6,12 +6,13 Signal Chain (SCh) is a radar data processing library developed using [Python](w
6 6
7 7 ## Installation
8 8
9 Install system dependencies, download the latest stable release from [svn](http://jro-dev.igp.gob.pe/svn/jro_soft/schain/Releases/) e.g. schainpy-2.2.5.tar.gz. and install it as a normal python package.
9 Install system dependencies, clone the latest version from [git](http://jro-dev.igp.gob.pe/rhodecode/schain/) and install it as a normal python package.
10 10
11 11 ```
12 12 $ sudo apt-get install python-pip python-dev gfortran libpng-dev freetype* libblas-dev liblapack-dev libatlas-base-dev python-qt4 python-tk libssl-dev libhdf5-dev
13 $ tar xvzf schainpy-2.2.5.tar.gz
14 $ cd schainpy-2.2.5
13 $ sudo pip install numpy
14 $ git clone http://jro-dev.igp.gob.pe/rhodecode/schain/
15 $ cd schain
15 16 $ sudo pip install ./
16 17 ```
17 18
@@ -21,7 +22,7 $ sudo pip install ./
21 22 $ sudo pip install virtualenv
22 23 $ virtualenv /path/to/virtual --system-site-packages
23 24 $ source /path/to/virtual/bin/activate
24 (virtual) $ cd schainpy-2.2.5
25 (virtual) $ cd schain
25 26 (virtual) $ pip install ./
26 27 ```
27 28
@@ -50,6 +50,8 def multiSchain(child, nProcess=cpu_count(), startDate=None, endDate=None, by_da
50 50 if by_day:
51 51 continue
52 52 nFiles = q.get()
53 if nFiles==0:
54 continue
53 55 firstProcess.terminate()
54 56 skip = int(math.ceil(nFiles/nProcess))
55 57 while True:
@@ -70,8 +72,10 def multiSchain(child, nProcess=cpu_count(), startDate=None, endDate=None, by_da
70 72 for process in processes:
71 73 process.join()
72 74 process.terminate()
75
73 76 time.sleep(3)
74 77
78
75 79 class ParameterConf():
76 80
77 81 id = None
@@ -8,5 +8,5
8 8 from data import *
9 9 from io import *
10 10 from proc import *
11 #from graphics import *
11 from graphics import *
12 12 from utils import *
@@ -6,6 +6,7 import numpy
6 6 import datetime
7 7 import numpy as np
8 8 import matplotlib
9 import glob
9 10 matplotlib.use('TkAgg')
10 11 import matplotlib.pyplot as plt
11 12 from mpl_toolkits.axes_grid1 import make_axes_locatable
@@ -61,6 +62,15 class PlotData(Operation, Process):
61 62 self.times = []
62 63 #self.interactive = self.kwargs['parent']
63 64
65 '''
66 this new parameter is created to plot data from varius channels at different figures
67 1. crear una lista de figuras donde se puedan plotear las figuras,
68 2. dar las opciones de configuracion a cada figura, estas opciones son iguales para ambas figuras
69 3. probar?
70 '''
71 self.ind_plt_ch = kwargs.get('ind_plt_ch', False)
72 self.figurelist = None
73
64 74
65 75 def fill_gaps(self, x_buffer, y_buffer, z_buffer):
66 76
@@ -92,25 +102,98 class PlotData(Operation, Process):
92 102
93 103 return x, y, z
94 104
105 '''
106 JM:
107 elimana las otras imagenes generadas debido a que lso workers no llegan en orden y le pueden
108 poner otro tiempo a la figura q no necesariamente es el ultimo.
109 Solo se realiza cuando termina la imagen.
110 Problemas:
111
112 File "/home/ci-81/workspace/schainv2.3/schainpy/model/graphics/jroplot_data.py", line 145, in __plot
113 for n, eachfigure in enumerate(self.figurelist):
114 TypeError: 'NoneType' object is not iterable
115
116 '''
117 def deleteanotherfiles(self):
118 figurenames=[]
119 if self.figurelist != None:
120 for n, eachfigure in enumerate(self.figurelist):
121 #add specific name for each channel in channelList
122 ghostfigname = os.path.join(self.save, '{}_{}_{}'.format(self.titles[n].replace(' ',''),self.CODE,
123 datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d')))
124 figname = os.path.join(self.save, '{}_{}_{}.png'.format(self.titles[n].replace(' ',''),self.CODE,
125 datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
126
127 for ghostfigure in glob.glob(ghostfigname+'*'): #ghostfigure will adopt all posible names of figures
128 if ghostfigure != figname:
129 os.remove(ghostfigure)
130 print 'Removing GhostFigures:' , figname
131 else :
132 '''Erasing ghost images for just on******************'''
133 ghostfigname = os.path.join(self.save, '{}_{}'.format(self.CODE,datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d')))
134 figname = os.path.join(self.save, '{}_{}.png'.format(self.CODE,datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
135 for ghostfigure in glob.glob(ghostfigname+'*'): #ghostfigure will adopt all posible names of figures
136 if ghostfigure != figname:
137 os.remove(ghostfigure)
138 print 'Removing GhostFigures:' , figname
139
95 140 def __plot(self):
96 141
97 142 print 'plotting...{}'.format(self.CODE)
98
143 if self.ind_plt_ch is False : #standard
99 144 if self.show:
100 145 self.figure.show()
101
102 146 self.plot()
103 147 plt.tight_layout()
104 148 self.figure.canvas.manager.set_window_title('{} {} - {}'.format(self.title, self.CODE.upper(),
105 149 datetime.datetime.fromtimestamp(self.max_time).strftime('%Y/%m/%d')))
150 else :
151 print 'len(self.figurelist): ',len(self.figurelist)
152 for n, eachfigure in enumerate(self.figurelist):
153 if self.show:
154 eachfigure.show()
155
156 self.plot()
157 eachfigure.tight_layout() # ajuste de cada subplot
158 eachfigure.canvas.manager.set_window_title('{} {} - {}'.format(self.title[n], self.CODE.upper(),
159 datetime.datetime.fromtimestamp(self.max_time).strftime('%Y/%m/%d')))
160
161 # if self.save:
162 # if self.ind_plt_ch is False : #standard
163 # figname = os.path.join(self.save, '{}_{}.png'.format(self.CODE,
164 # datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
165 # print 'Saving figure: {}'.format(figname)
166 # self.figure.savefig(figname)
167 # else :
168 # for n, eachfigure in enumerate(self.figurelist):
169 # #add specific name for each channel in channelList
170 # figname = os.path.join(self.save, '{}_{}_{}.png'.format(self.titles[n],self.CODE,
171 # datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
172 #
173 # print 'Saving figure: {}'.format(figname)
174 # eachfigure.savefig(figname)
175
176 if self.ind_plt_ch is False :
177 self.figure.canvas.draw()
178 else :
179 for eachfigure in self.figurelist:
180 eachfigure.canvas.draw()
106 181
107 182 if self.save:
183 if self.ind_plt_ch is False : #standard
108 184 figname = os.path.join(self.save, '{}_{}.png'.format(self.CODE,
109 185 datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
110 186 print 'Saving figure: {}'.format(figname)
111 187 self.figure.savefig(figname)
188 else :
189 for n, eachfigure in enumerate(self.figurelist):
190 #add specific name for each channel in channelList
191 figname = os.path.join(self.save, '{}_{}_{}.png'.format(self.titles[n].replace(' ',''),self.CODE,
192 datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
193
194 print 'Saving figure: {}'.format(figname)
195 eachfigure.savefig(figname)
112 196
113 self.figure.canvas.draw()
114 197
115 198 def plot(self):
116 199
@@ -159,6 +242,7 class PlotData(Operation, Process):
159 242 self.ended = True
160 243 self.isConfig = False
161 244 self.__plot()
245 self.deleteanotherfiles() #CLPDG
162 246 elif seconds_passed >= self.data['throttle']:
163 247 print 'passed', seconds_passed
164 248 self.__plot()
@@ -232,7 +316,6 class PlotSpectraData(PlotData):
232 316 z = self.data[self.CODE]
233 317
234 318 for n, ax in enumerate(self.axes):
235
236 319 if ax.firsttime:
237 320 self.xmax = self.xmax if self.xmax else np.nanmax(x)
238 321 self.xmin = self.xmin if self.xmin else -self.xmax
@@ -464,13 +547,29 class PlotRTIData(PlotData):
464 547 self.ncols = 1
465 548 self.nrows = self.dataOut.nChannels
466 549 self.width = 10
550 #TODO : arreglar la altura de la figura, esta hardcodeada.
551 #Se arreglo, testear!
552 if self.ind_plt_ch:
553 self.height = 3.2#*self.nrows if self.nrows<6 else 12
554 else:
467 555 self.height = 2.2*self.nrows if self.nrows<6 else 12
556
557 '''
468 558 if self.nrows==1:
469 559 self.height += 1
560 '''
470 561 self.ylabel = 'Range [Km]'
471 562 self.titles = ['Channel {}'.format(x) for x in self.dataOut.channelList]
472 563
473 if self.figure is None:
564 '''
565 Logica:
566 1) Si la variable ind_plt_ch es True, va a crear mas de 1 figura
567 2) guardamos "Figures" en una lista y "axes" en otra, quizas se deberia guardar el
568 axis dentro de "Figures" como un diccionario.
569 '''
570 if self.ind_plt_ch is False: #standard mode
571
572 if self.figure is None: #solo para la priemra vez
474 573 self.figure = plt.figure(figsize=(self.width, self.height),
475 574 edgecolor='k',
476 575 facecolor='w')
@@ -478,13 +577,40 class PlotRTIData(PlotData):
478 577 self.figure.clf()
479 578 self.axes = []
480 579
580
481 581 for n in range(self.nrows):
482 582 ax = self.figure.add_subplot(self.nrows, self.ncols, n+1)
583 #ax = self.figure(n+1)
584 ax.firsttime = True
585 self.axes.append(ax)
586
587 else : #append one figure foreach channel in channelList
588 if self.figurelist == None:
589 self.figurelist = []
590 for n in range(self.nrows):
591 self.figure = plt.figure(figsize=(self.width, self.height),
592 edgecolor='k',
593 facecolor='w')
594 #add always one subplot
595 self.figurelist.append(self.figure)
596
597 else : # cada dia nuevo limpia el axes, pero mantiene el figure
598 for eachfigure in self.figurelist:
599 eachfigure.clf() # eliminaria todas las figuras de la lista?
600 self.axes = []
601
602 for eachfigure in self.figurelist:
603 ax = eachfigure.add_subplot(1,1,1) #solo 1 axis por figura
604 #ax = self.figure(n+1)
483 605 ax.firsttime = True
606 #Cada figura tiene un distinto puntero
484 607 self.axes.append(ax)
608 #plt.close(eachfigure)
609
485 610
486 611 def plot(self):
487 612
613 if self.ind_plt_ch is False: #standard mode
488 614 self.x = np.array(self.times)
489 615 self.y = self.dataOut.getHeiRange()
490 616 self.z = []
@@ -518,12 +644,9 class PlotRTIData(PlotData):
518 644 self.figure.add_axes(cax)
519 645 plt.colorbar(plot, cax)
520 646 ax.set_ylim(self.ymin, self.ymax)
521
522 647 ax.xaxis.set_major_formatter(FuncFormatter(func))
523 648 ax.xaxis.set_major_locator(LinearLocator(6))
524
525 649 ax.set_ylabel(self.ylabel)
526
527 650 # if self.xmin is None:
528 651 # xmin = self.min_time
529 652 # else:
@@ -545,6 +668,63 class PlotRTIData(PlotData):
545 668 size=8)
546 669
547 670 self.saveTime = self.min_time
671 else :
672 self.x = np.array(self.times)
673 self.y = self.dataOut.getHeiRange()
674 self.z = []
675
676 for ch in range(self.nrows):
677 self.z.append([self.data[self.CODE][t][ch] for t in self.times])
678
679 self.z = np.array(self.z)
680 for n, eachfigure in enumerate(self.figurelist): #estaba ax in axes
681
682 x, y, z = self.fill_gaps(*self.decimate())
683 xmin = self.min_time
684 xmax = xmin+self.xrange*60*60
685 self.zmin = self.zmin if self.zmin else np.min(self.z)
686 self.zmax = self.zmax if self.zmax else np.max(self.z)
687 if self.axes[n].firsttime:
688 self.ymin = self.ymin if self.ymin else np.nanmin(self.y)
689 self.ymax = self.ymax if self.ymax else np.nanmax(self.y)
690 plot = self.axes[n].pcolormesh(x, y, z[n].T,
691 vmin=self.zmin,
692 vmax=self.zmax,
693 cmap=plt.get_cmap(self.colormap)
694 )
695 divider = make_axes_locatable(self.axes[n])
696 cax = divider.new_horizontal(size='2%', pad=0.05)
697 eachfigure.add_axes(cax)
698 #self.figure2.add_axes(cax)
699 plt.colorbar(plot, cax)
700 self.axes[n].set_ylim(self.ymin, self.ymax)
701
702 self.axes[n].xaxis.set_major_formatter(FuncFormatter(func))
703 self.axes[n].xaxis.set_major_locator(LinearLocator(6))
704
705 self.axes[n].set_ylabel(self.ylabel)
706
707 if self.xmin is None:
708 xmin = self.min_time
709 else:
710 xmin = (datetime.datetime.combine(self.dataOut.datatime.date(),
711 datetime.time(self.xmin, 0, 0))-d1970).total_seconds()
712
713 self.axes[n].set_xlim(xmin, xmax)
714 self.axes[n].firsttime = False
715 else:
716 self.axes[n].collections.remove(self.axes[n].collections[0])
717 self.axes[n].set_xlim(xmin, xmax)
718 plot = self.axes[n].pcolormesh(x, y, z[n].T,
719 vmin=self.zmin,
720 vmax=self.zmax,
721 cmap=plt.get_cmap(self.colormap)
722 )
723 self.axes[n].set_title('{} {}'.format(self.titles[n],
724 datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')),
725 size=8)
726
727 self.saveTime = self.min_time
548 728
549 729
550 730 class PlotCOHData(PlotRTIData):
@@ -557,6 +737,7 class PlotCOHData(PlotRTIData):
557 737 self.nrows = self.dataOut.nPairs
558 738 self.width = 10
559 739 self.height = 2.2*self.nrows if self.nrows<6 else 12
740 self.ind_plt_ch = False #just for coherence and phase
560 741 if self.nrows==1:
561 742 self.height += 1
562 743 self.ylabel = 'Range [Km]'
@@ -1,1 +1,1
1 <Project description="JASMET Meteor Detection" id="002" name="script02"><ReadUnit datatype="VoltageReader" id="21" inputId="0" name="VoltageReader"><Operation id="211" name="run" priority="1" type="self"><Parameter format="str" id="2111" name="datatype" value="VoltageReader" /><Parameter format="str" id="2112" name="path" value="/home/nanosat/data/jasmet" /><Parameter format="date" id="2113" name="startDate" value="2010/08/29" /><Parameter format="date" id="2114" name="endDate" value="2017/09/11" /><Parameter format="time" id="2115" name="startTime" value="00:00:00" /><Parameter format="time" id="2116" name="endTime" value="23:59:59" /><Parameter format="int" id="2118" name="delay" value="30" /><Parameter format="int" id="2119" name="blocktime" value="100" /><Parameter format="int" id="2120" name="getblock" value="1" /><Parameter format="int" id="2121" name="walk" value="1" /><Parameter format="int" id="2122" name="online" value="0" /></Operation><Operation id="212" name="printNumberOfBlock" priority="2" type="self" /></ReadUnit><ProcUnit datatype="VoltageProc" id="22" inputId="21" name="VoltageProc"><Operation id="221" name="run" priority="1" type="self" /><Operation id="222" name="selectChannels" priority="2" type="self"><Parameter format="intlist" id="2221" name="channelList" value="0,1,2,3,4" /></Operation><Operation id="223" name="setRadarFrequency" priority="3" type="self"><Parameter format="float" id="2231" name="frequency" value="30.e6" /></Operation><Operation id="224" name="interpolateHeights" priority="4" type="self"><Parameter format="int" id="2241" name="topLim" value="73" /><Parameter format="int" id="2242" name="botLim" value="71" /></Operation><Operation id="225" name="Decoder" priority="5" type="other" /><Operation id="226" name="CohInt" priority="6" type="other"><Parameter format="int" id="2261" name="n" value="2" /></Operation></ProcUnit><ProcUnit datatype="ParametersProc" id="23" inputId="22" name="ParametersProc"><Operation id="231" name="run" priority="1" type="self" /><Operation id="232" name="SMDetection" priority="2" type="other"><Parameter format="float" id="2321" name="azimuth" value="45" /><Parameter format="float" id="2322" name="hmin" value="60" /><Parameter format="float" id="2323" name="hmax" value="120" /></Operation><Operation id="233" name="ParamWriter" priority="3" type="other"><Parameter format="str" id="2331" name="path" value="/home/nanosat/Pictures/JASMET30/201608/meteor" /><Parameter format="int" id="2332" name="blocksPerFile" value="1000" /><Parameter format="list" id="2333" name="metadataList" value="type,heightList,paramInterval,timeZone" /><Parameter format="list" id="2334" name="dataList" value="data_param,utctime" /><Parameter format="int" id="2335" name="mode" value="2" /></Operation></ProcUnit></Project> No newline at end of file
1 <Project description="Claire" id="002" name="script02"><ReadUnit datatype="VoltageReader" id="21" inputId="0" name="VoltageReader"><Operation id="211" name="run" priority="1" type="self"><Parameter format="str" id="2111" name="datatype" value="VoltageReader" /><Parameter format="str" id="2112" name="path" value="/media/nanosat/0BDE10E00BDE10E0/CLAIRE" /><Parameter format="date" id="2113" name="startDate" value="2017/07/26" /><Parameter format="date" id="2114" name="endDate" value="2017/07/26" /><Parameter format="time" id="2115" name="startTime" value="9:30:0" /><Parameter format="time" id="2116" name="endTime" value="23:59:59" /><Parameter format="int" id="2118" name="online" value="0" /><Parameter format="int" id="2119" name="walk" value="1" /></Operation><Operation id="212" name="printNumberOfBlock" priority="2" type="self" /></ReadUnit><ProcUnit datatype="VoltageProc" id="22" inputId="21" name="VoltageProc"><Operation id="221" name="run" priority="1" type="self" /></ProcUnit><ProcUnit datatype="SpectraProc" id="23" inputId="22" name="SpectraProc"><Operation id="231" name="run" priority="1" type="self"><Parameter format="int" id="2311" name="nFFTPoints" value="128" /><Parameter format="int" id="2312" name="nProfiles" value="128" /><Parameter format="pairslist" id="2313" name="pairsList" value="(0,1),(0,2),(1,2)" /></Operation><Operation id="232" name="setRadarFrequency" priority="2" type="self"><Parameter format="float" id="2321" name="frequency" value="445000000.0" /></Operation><Operation id="233" name="IncohInt" priority="3" type="other"><Parameter format="float" id="2331" name="timeInterval" value="2" /></Operation><Operation id="234" name="removeDC" priority="4" type="self"><Parameter format="int" id="2341" name="mode" value="2" /></Operation><Operation id="235" name="PublishData" priority="5" type="other"><Parameter format="int" id="2351" name="zeromq" value="1" /><Parameter format="bool" id="2352" name="verbose" value="0" /></Operation></ProcUnit></Project> No newline at end of file
@@ -5,7 +5,7 Created on Jul 16, 2014
5 5 @author: Miguel Urco
6 6 """
7 7
8 from schainpy import __version__
8 import numpy
9 9 from setuptools import setup, Extension
10 10 import numpy
11 11
@@ -52,7 +52,6 setup(name="schainpy",
52 52 "h5py >= 2.2.1",
53 53 "matplotlib >= 1.4.2",
54 54 "pyfits >= 3.4",
55 "numpy >= 1.11.2",
56 55 "paramiko >= 2.1.2",
57 56 "paho-mqtt >= 1.2",
58 57 "zmq",
General Comments 0
You need to be logged in to leave comments. Login now