##// END OF EJS Templates
decimation a 300
José Chávez -
r1093:6f37ceb2e70a
parent child
Show More
@@ -24,6 +24,7 matplotlib.pyplot.register_cmap(cmap=ncmap)
24
24
25 CMAPS = [plt.get_cmap(s) for s in ('jro', 'jet', 'RdBu_r', 'seismic')]
25 CMAPS = [plt.get_cmap(s) for s in ('jro', 'jet', 'RdBu_r', 'seismic')]
26
26
27
27 def figpause(interval):
28 def figpause(interval):
28 backend = plt.rcParams['backend']
29 backend = plt.rcParams['backend']
29 if backend in matplotlib.rcsetup.interactive_bk:
30 if backend in matplotlib.rcsetup.interactive_bk:
@@ -35,6 +36,7 def figpause(interval):
35 canvas.start_event_loop(interval)
36 canvas.start_event_loop(interval)
36 return
37 return
37
38
39
38 class PlotData(Operation, Process):
40 class PlotData(Operation, Process):
39 '''
41 '''
40 Base class for Schain plotting operations
42 Base class for Schain plotting operations
@@ -51,6 +53,7 class PlotData(Operation, Process):
51
53
52 Operation.__init__(self, plot=True, **kwargs)
54 Operation.__init__(self, plot=True, **kwargs)
53 Process.__init__(self)
55 Process.__init__(self)
56 self.contador = 0
54 self.kwargs['code'] = self.CODE
57 self.kwargs['code'] = self.CODE
55 self.mp = False
58 self.mp = False
56 self.data = None
59 self.data = None
@@ -80,7 +83,7 class PlotData(Operation, Process):
80 self.ymin = kwargs.get('ymin', None)
83 self.ymin = kwargs.get('ymin', None)
81 self.ymax = kwargs.get('ymax', None)
84 self.ymax = kwargs.get('ymax', None)
82 self.xlabel = kwargs.get('xlabel', None)
85 self.xlabel = kwargs.get('xlabel', None)
83 self.__MAXNUMY = kwargs.get('decimation', 100)
86 self.__MAXNUMY = kwargs.get('decimation', 300)
84 self.showSNR = kwargs.get('showSNR', False)
87 self.showSNR = kwargs.get('showSNR', False)
85 self.oneFigure = kwargs.get('oneFigure', True)
88 self.oneFigure = kwargs.get('oneFigure', True)
86 self.width = kwargs.get('width', None)
89 self.width = kwargs.get('width', None)
@@ -204,7 +207,8 class PlotData(Operation, Process):
204 ax = [ax for ax in self.axes if cb_ax == ax.cbar.ax][0]
207 ax = [ax for ax in self.axes if cb_ax == ax.cbar.ax][0]
205 pt = ax.cbar.ax.bbox.get_points()[:,1]
208 pt = ax.cbar.ax.bbox.get_points()[:, 1]
206 nrm = ax.cbar.norm
209 nrm = ax.cbar.norm
207 vmin, vmax, p0, p1, pS = (nrm.vmin, nrm.vmax, pt[0], pt[1], event.y)
210 vmin, vmax, p0, p1, pS = (
211 nrm.vmin, nrm.vmax, pt[0], pt[1], event.y)
208 scale = 2 if event.step == 1 else 0.5
212 scale = 2 if event.step == 1 else 0.5
209 point = vmin + (vmax - vmin) / (p1 - p0)*(pS - p0)
213 point = vmin + (vmax - vmin) / (p1 - p0) * (pS - p0)
210 ax.cbar.norm.vmin = point - scale*(point - vmin)
214 ax.cbar.norm.vmin = point - scale * (point - vmin)
@@ -332,7 +336,8 class PlotData(Operation, Process):
332 else:
336 else:
333 if self.xaxis is 'time':
337 if self.xaxis is 'time':
334 dt = self.getDateTime(self.min_time)
338 dt = self.getDateTime(self.min_time)
335 xmin = (dt.replace(hour=int(self.xmin), minute=0, second=0) - datetime.datetime(1970, 1, 1)).total_seconds()
339 xmin = (dt.replace(hour=int(self.xmin), minute=0, second=0) -
340 datetime.datetime(1970, 1, 1)).total_seconds()
336 if self.data.localtime:
341 if self.data.localtime:
337 xmin += time.timezone
342 xmin += time.timezone
338 else:
343 else:
@@ -343,7 +348,8 class PlotData(Operation, Process):
343 else:
348 else:
344 if self.xaxis is 'time':
349 if self.xaxis is 'time':
345 dt = self.getDateTime(self.max_time)
350 dt = self.getDateTime(self.max_time)
346 xmax = (dt.replace(hour=int(self.xmax), minute=0, second=0) - datetime.datetime(1970, 1, 1)).total_seconds()
351 xmax = (dt.replace(hour=int(self.xmax), minute=0, second=0) -
352 datetime.datetime(1970, 1, 1)).total_seconds()
347 if self.data.localtime:
353 if self.data.localtime:
348 xmax += time.timezone
354 xmax += time.timezone
349 else:
355 else:
@@ -353,7 +359,8 class PlotData(Operation, Process):
353 ymax = self.ymax if self.ymax else numpy.nanmax(self.y)
359 ymax = self.ymax if self.ymax else numpy.nanmax(self.y)
354
360
355 Y = numpy.array([10, 20, 50, 100, 200, 500, 1000, 2000])
361 Y = numpy.array([10, 20, 50, 100, 200, 500, 1000, 2000])
356 i = 1 if numpy.where(ymax < Y)[0][0] < 0 else numpy.where(ymax < Y)[0][0]
362 i = 1 if numpy.where(ymax < Y)[
363 0][0] < 0 else numpy.where(ymax < Y)[0][0]
357 ystep = Y[i-1]/5
364 ystep = Y[i - 1] / 5
358
365
359 ystep = 200 if ymax >= 800 else 100 if ymax >= 400 else 50 if ymax >= 200 else 20
366 ystep = 200 if ymax >= 800 else 100 if ymax >= 400 else 50 if ymax >= 200 else 20
@@ -413,7 +420,8 class PlotData(Operation, Process):
413 self.getDateTime(self.max_time).strftime('%Y/%m/%d')))
420 self.getDateTime(self.max_time).strftime('%Y/%m/%d')))
414 # fig.canvas.draw()
421 # fig.canvas.draw()
415
422
416 if self.save and self.data.ended:
423 if self.save: # and self.data.ended:
424 self.contador += 1
417 channels = range(self.nrows)
425 channels = range(self.nrows)
418 if self.oneFigure:
426 if self.oneFigure:
419 label = ''
427 label = ''
@@ -421,10 +429,12 class PlotData(Operation, Process):
421 label = '_{}'.format(channels[n])
429 label = '_{}'.format(channels[n])
422 figname = os.path.join(
430 figname = os.path.join(
423 self.save,
431 self.save,
424 '{}{}_{}.png'.format(
432 '{}{}_{}{}.png'.format(
425 self.CODE,
433 self.CODE,
426 label,
434 label,
427 self.getDateTime(self.saveTime).strftime('%y%m%d_%H%M%S')
435 self.getDateTime(self.saveTime).strftime(
436 '%y%m%d_%H%M%S'),
437 str(self.contador),
428 )
438 )
429 )
439 )
430 print 'Saving figure: {}'.format(figname)
440 print 'Saving figure: {}'.format(figname)
@@ -857,7 +867,6 class PlotSkyMapData(PlotData):
857 else:
867 else:
858 self.ax.plot.set_data(x, y)
868 self.ax.plot.set_data(x, y)
859
869
860
861 dt1 = self.getDateTime(self.min_time).strftime('%y/%m/%d %H:%M:%S')
870 dt1 = self.getDateTime(self.min_time).strftime('%y/%m/%d %H:%M:%S')
862 dt2 = self.getDateTime(self.max_time).strftime('%y/%m/%d %H:%M:%S')
871 dt2 = self.getDateTime(self.max_time).strftime('%y/%m/%d %H:%M:%S')
863 title = 'Meteor Detection Sky Map\n %s - %s \n Number of events: %5.0f\n' % (dt1,
872 title = 'Meteor Detection Sky Map\n %s - %s \n Number of events: %5.0f\n' % (dt1,
@@ -906,8 +915,10 class PlotParamData(PlotRTIData):
906 for n, ax in enumerate(self.axes):
915 for n, ax in enumerate(self.axes):
907
916
908 x, y, z = self.fill_gaps(*self.decimate())
917 x, y, z = self.fill_gaps(*self.decimate())
909 self.zmax = self.zmax if self.zmax is not None else numpy.max(self.z[n])
918 self.zmax = self.zmax if self.zmax is not None else numpy.max(
910 self.zmin = self.zmin if self.zmin is not None else numpy.min(self.z[n])
919 self.z[n])
920 self.zmin = self.zmin if self.zmin is not None else numpy.min(
921 self.z[n])
911
922
912 if ax.firsttime:
923 if ax.firsttime:
913 if self.zlimits is not None:
924 if self.zlimits is not None:
@@ -930,6 +941,7 class PlotParamData(PlotRTIData):
930
941
931 self.saveTime = self.min_time
942 self.saveTime = self.min_time
932
943
944
933 class PlotOutputData(PlotParamData):
945 class PlotOutputData(PlotParamData):
934 '''
946 '''
935 Plot data_output object
947 Plot data_output object
General Comments 0
You need to be logged in to leave comments. Login now