##// END OF EJS Templates
kwargs restantes. Templates y changelog actualizado
José Chávez -
r1080:af3edc5dd0e9
parent child
Show More
@@ -43,12 +43,14 desc = "{desc}"
43 43 plotter = Project()
44 44 plotter.setup(id='100', name='receiver', description=desc)
45 45
46 receiver_proc = plotter.addProcUnit(name='PlotterReceiver')
47 receiver_proc.addParameter(name='throttle', value=20, format='int')
46 receiver_plot = plotter.addProcUnit(name='PlotterReceiver')
47 receiver_plot.addParameter(name='throttle', value=20, format='int')
48 receiver_plot.addParameter(name='plottypes', value='rti', format='str')
48 49
49 rti = receiver_proc.addOperation(name='PlotRTIData', optype='other')
50 rti = receiver_plot.addOperation(name='PlotRTIData', optype='other')
50 51 rti.addParameter(name='zmin', value='-40.0', format='float')
51 52 rti.addParameter(name='zmax', value='100.0', format='float')
53 rti.addParameter(name='decimation', value='200', format='int')
52 54 rti.addParameter(name='xmin', value='0.0', format='int')
53 55 rti.addParameter(name='colormap', value='jet', format='str')
54 56
@@ -1,7 +1,7
1 1 ## CHANGELOG:
2 2
3 3 ### 2.3
4 * Added high order function `multiSchain` for multiprocessing scripts.
4 * Added high order function `MPProject` for multiprocessing scripts.
5 5 * Added two new Processing Units `PublishData` and `ReceiverData` for receiving and sending dataOut through multiple ways (tcp, ipc, inproc).
6 6 * Added a new graphics Processing Unit `PlotterReceiver`. It is decoupled from normal processing sequence with support for data generated by multiprocessing scripts.
7 7 * Added support for sending realtime graphic to web server.
@@ -16,16 +16,23 from schainpy.model.proc.jroproc_base import Operation
16 16 from schainpy.utils import log
17 17
18 18 jet_values = matplotlib.pyplot.get_cmap("jet", 100)(numpy.arange(100))[10:90]
19 blu_values = matplotlib.pyplot.get_cmap("seismic_r", 20)(numpy.arange(20))[10:15]
20 ncmap = matplotlib.colors.LinearSegmentedColormap.from_list("jro", numpy.vstack((blu_values, jet_values)))
19 blu_values = matplotlib.pyplot.get_cmap(
20 "seismic_r", 20)(numpy.arange(20))[10:15]
21 ncmap = matplotlib.colors.LinearSegmentedColormap.from_list(
22 "jro", numpy.vstack((blu_values, jet_values)))
21 23 matplotlib.pyplot.register_cmap(cmap=ncmap)
22 24
23 func = lambda x, pos: '{}'.format(datetime.datetime.fromtimestamp(x).strftime('%H:%M'))
24 25
25 UT1970 = datetime.datetime(1970, 1, 1) - datetime.timedelta(seconds=time.timezone)
26 def func(x, pos): return '{}'.format(
27 datetime.datetime.fromtimestamp(x).strftime('%H:%M'))
28
29
30 UT1970 = datetime.datetime(1970, 1, 1) - \
31 datetime.timedelta(seconds=time.timezone)
26 32
27 33 CMAPS = [plt.get_cmap(s) for s in ('jro', 'jet', 'RdBu_r', 'seismic')]
28 34
35
29 36 class PlotData(Operation, Process):
30 37 '''
31 38 Base class for Schain plotting operations
@@ -270,7 +277,8 class PlotData(Operation, Process):
270 277 self.pf_axes[n].set_xlim(self.zmin, self.zmax)
271 278 self.pf_axes[n].set_xlabel('dB')
272 279 self.pf_axes[n].grid(b=True, axis='x')
273 [tick.set_visible(False) for tick in self.pf_axes[n].get_yticklabels()]
280 [tick.set_visible(False)
281 for tick in self.pf_axes[n].get_yticklabels()]
274 282 if self.colorbar:
275 283 ax.cbar = plt.colorbar(ax.plt, ax=ax, pad=0.02, aspect=10)
276 284 ax.cbar.ax.tick_params(labelsize=8)
@@ -281,7 +289,8 class PlotData(Operation, Process):
281 289
282 290 ax.set_title('{} - {} {}'.format(
283 291 self.titles[n],
284 datetime.datetime.fromtimestamp(self.max_time).strftime('%H:%M:%S'),
292 datetime.datetime.fromtimestamp(
293 self.max_time).strftime('%H:%M:%S'),
285 294 self.time_label),
286 295 size=8)
287 296 ax.set_xlim(xmin, xmax)
@@ -318,7 +327,8 class PlotData(Operation, Process):
318 327 '{}{}_{}.png'.format(
319 328 self.CODE,
320 329 label,
321 datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')
330 datetime.datetime.fromtimestamp(
331 self.saveTime).strftime('%y%m%d_%H%M%S')
322 332 )
323 333 )
324 334 print 'Saving figure: {}'.format(figname)
@@ -339,7 +349,8 class PlotData(Operation, Process):
339 349 receiver.setsockopt(zmq.CONFLATE, self.CONFLATE)
340 350
341 351 if 'server' in self.kwargs['parent']:
342 receiver.connect('ipc:///tmp/{}.plots'.format(self.kwargs['parent']['server']))
352 receiver.connect(
353 'ipc:///tmp/{}.plots'.format(self.kwargs['parent']['server']))
343 354 else:
344 355 receiver.connect("ipc:///tmp/zmq.plots")
345 356
@@ -372,6 +383,7 class PlotData(Operation, Process):
372 383 if self.data:
373 384 self.__plot()
374 385
386
375 387 class PlotSpectraData(PlotData):
376 388 '''
377 389 Plot for Spectra data
@@ -429,7 +441,8 class PlotSpectraData(PlotData):
429 441 )
430 442
431 443 if self.showprofile:
432 ax.plt_profile= self.pf_axes[n].plot(self.data['rti'][n][-1], y)[0]
444 ax.plt_profile = self.pf_axes[n].plot(
445 self.data['rti'][n][-1], y)[0]
433 446 ax.plt_noise = self.pf_axes[n].plot(numpy.repeat(noise, len(y)), y,
434 447 color="k", linestyle="dashed", lw=1)[0]
435 448 if self.CODE == 'spc_mean':
@@ -526,7 +539,8 class PlotCrossSpectraData(PlotData):
526 539 )
527 540 else:
528 541 ax.plt.set_array(coh.T.ravel())
529 self.titles.append('Coherence Ch{} * Ch{}'.format(pair[0], pair[1]))
542 self.titles.append(
543 'Coherence Ch{} * Ch{}'.format(pair[0], pair[1]))
530 544
531 545 ax = self.axes[4*n+3]
532 546 if ax.firsttime:
@@ -565,7 +579,8 class PlotRTIData(PlotData):
565 579 self.nplots = len(self.data.channels)
566 580 self.ylabel = 'Range [Km]'
567 581 self.cb_label = 'dB'
568 self.titles = ['{} Channel {}'.format(self.CODE.upper(), x) for x in range(self.nrows)]
582 self.titles = ['{} Channel {}'.format(
583 self.CODE.upper(), x) for x in range(self.nrows)]
569 584
570 585 def plot(self):
571 586 self.x = self.times
@@ -584,7 +599,8 class PlotRTIData(PlotData):
584 599 cmap=plt.get_cmap(self.colormap)
585 600 )
586 601 if self.showprofile:
587 ax.plot_profile= self.pf_axes[n].plot(self.data['rti'][n][-1], self.y)[0]
602 ax.plot_profile = self.pf_axes[n].plot(
603 self.data['rti'][n][-1], self.y)[0]
588 604 ax.plot_noise = self.pf_axes[n].plot(numpy.repeat(self.data['noise'][n][-1], len(self.y)), self.y,
589 605 color="k", linestyle="dashed", lw=1)[0]
590 606 else:
@@ -596,7 +612,8 class PlotRTIData(PlotData):
596 612 )
597 613 if self.showprofile:
598 614 ax.plot_profile.set_data(self.data['rti'][n][-1], self.y)
599 ax.plot_noise.set_data(numpy.repeat(self.data['noise'][n][-1], len(self.y)), self.y)
615 ax.plot_noise.set_data(numpy.repeat(
616 self.data['noise'][n][-1], len(self.y)), self.y)
600 617
601 618 self.saveTime = self.min_time
602 619
@@ -616,10 +633,12 class PlotCOHData(PlotRTIData):
616 633 self.ylabel = 'Range [Km]'
617 634 if self.CODE == 'coh':
618 635 self.cb_label = ''
619 self.titles = ['Coherence Map Ch{} * Ch{}'.format(x[0], x[1]) for x in self.data.pairs]
636 self.titles = [
637 'Coherence Map Ch{} * Ch{}'.format(x[0], x[1]) for x in self.data.pairs]
620 638 else:
621 639 self.cb_label = 'Degrees'
622 self.titles = ['Phase Map Ch{} * Ch{}'.format(x[0], x[1]) for x in self.data.pairs]
640 self.titles = [
641 'Phase Map Ch{} * Ch{}'.format(x[0], x[1]) for x in self.data.pairs]
623 642
624 643
625 644 class PlotPHASEData(PlotCOHData):
@@ -711,13 +730,14 class PlotSkyMapData(PlotData):
711 730 else:
712 731 self.figure.clf()
713 732
714 self.ax = plt.subplot2grid((self.nrows, self.ncols), (0, 0), 1, 1, polar=True)
733 self.ax = plt.subplot2grid(
734 (self.nrows, self.ncols), (0, 0), 1, 1, polar=True)
715 735 self.ax.firsttime = True
716 736
717
718 737 def plot(self):
719 738
720 arrayParameters = numpy.concatenate([self.data['param'][t] for t in self.times])
739 arrayParameters = numpy.concatenate(
740 [self.data['param'][t] for t in self.times])
721 741 error = arrayParameters[:,-1]
722 742 indValid = numpy.where(error == 0)[0]
723 743 finalMeteor = arrayParameters[indValid,:]
@@ -738,9 +758,10 class PlotSkyMapData(PlotData):
738 758 else:
739 759 self.ax.plot.set_data(x, y)
740 760
741
742 dt1 = datetime.datetime.fromtimestamp(self.min_time).strftime('%y/%m/%d %H:%M:%S')
743 dt2 = datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')
761 dt1 = datetime.datetime.fromtimestamp(
762 self.min_time).strftime('%y/%m/%d %H:%M:%S')
763 dt2 = datetime.datetime.fromtimestamp(
764 self.max_time).strftime('%y/%m/%d %H:%M:%S')
744 765 title = 'Meteor Detection Sky Map\n %s - %s \n Number of events: %5.0f\n' % (dt1,
745 766 dt2,
746 767 len(x))
@@ -748,6 +769,7 class PlotSkyMapData(PlotData):
748 769
749 770 self.saveTime = self.max_time
750 771
772
751 773 class PlotParamData(PlotRTIData):
752 774 '''
753 775 Plot for data_param object
@@ -791,7 +813,8 class PlotParamData(PlotRTIData):
791 813 if ax.firsttime:
792 814 if self.zlimits is not None:
793 815 self.zmin, self.zmax = self.zlimits[n]
794 self.zmax = self.zmax if self.zmax is not None else numpy.nanmax(abs(self.z[:-1, :]))
816 self.zmax = self.zmax if self.zmax is not None else numpy.nanmax(
817 abs(self.z[:-1, :]))
795 818 self.zmin = self.zmin if self.zmin is not None else -self.zmax
796 819 ax.plt = ax.pcolormesh(x, y, z[n, :, :].T*self.factors[n],
797 820 vmin=self.zmin,
@@ -810,6 +833,7 class PlotParamData(PlotRTIData):
810 833
811 834 self.saveTime = self.min_time
812 835
836
813 837 class PlotOuputData(PlotParamData):
814 838 '''
815 839 Plot data_output object
@@ -6,8 +6,8 from jroproc_base import ProcessingUnit, Operation
6 6 from schainpy.model.data.jroamisr import AMISR
7 7
8 8 class AMISRProc(ProcessingUnit):
9 def __init__(self):
10 ProcessingUnit.__init__(self)
9 def __init__(self, **kwargs):
10 ProcessingUnit.__init__(self, **kwargs)
11 11 self.objectDict = {}
12 12 self.dataOut = AMISR()
13 13
@@ -17,7 +17,8 class AMISRProc(ProcessingUnit):
17 17
18 18
19 19 class PrintInfo(Operation):
20 def __init__(self):
20 def __init__(self, **kwargs):
21 Operation.__init__(self, **kwargs)
21 22 self.__isPrinted = False
22 23
23 24 def run(self, dataOut):
@@ -42,8 +43,8 class BeamSelector(Operation):
42 43 profileIndex = None
43 44 nProfiles = None
44 45
45 def __init__(self):
46
46 def __init__(self, **kwargs):
47 Operation.__init__(self, **kwargs)
47 48 self.profileIndex = 0
48 49 self.__isConfig = False
49 50
@@ -98,7 +99,8 class BeamSelector(Operation):
98 99
99 100 class ProfileToChannels(Operation):
100 101
101 def __init__(self):
102 def __init__(self, **kwargs):
103 Operation.__init__(self, **kwargs)
102 104 self.__isConfig = False
103 105 self.__counter_chan = 0
104 106 self.buffer = None
@@ -1765,8 +1765,8 class WindProfiler(Operation):
1765 1765
1766 1766 n = None
1767 1767
1768 def __init__(self):
1769 Operation.__init__(self)
1768 def __init__(self, **kwargs):
1769 Operation.__init__(self, **kwargs)
1770 1770
1771 1771 def __calculateCosDir(self, elev, azim):
1772 1772 zen = (90 - elev)*numpy.pi/180
@@ -2472,8 +2472,8 class WindProfiler(Operation):
2472 2472
2473 2473 class EWDriftsEstimation(Operation):
2474 2474
2475 def __init__(self):
2476 Operation.__init__(self)
2475 def __init__(self, **kwargs):
2476 Operation.__init__(self, **kwargs)
2477 2477
2478 2478 def __correctValues(self, heiRang, phi, velRadial, SNR):
2479 2479 listPhi = phi.tolist()
General Comments 0
You need to be logged in to leave comments. Login now