Example #1
0
    def _replot(self):
        
        self.TracePlot = Plot(self.plot_data, width=500, height=500, resizable='hv')
        self.TracePlot.legend.align = 'll'
        
        n=0
        if self.c_enable0:
            self.TracePlot.plot(('t','y0'), type='line', color='blue',  name='channel 0')
            n+=1
        if self.c_enable1:
            self.TracePlot.plot(('t','y1'), type='line', color='red',   name='channel 1')
            n+=1
        if self.c_enable2:
            self.TracePlot.plot(('t','y2'), type='line', color='green', name='channel 2')
            n+=1
        if self.c_enable3:
            self.TracePlot.plot(('t','y3'), type='line', color='black', name='channel 3')
            n+=1
        if self.c_enable4:
            self.TracePlot.plot(('t','y4'), type='line', color='blue',  name='channel 4')
            n+=1
        if self.c_enable5:
            self.TracePlot.plot(('t','y5'), type='line', color='red',   name='channel 5')
            n+=1
        if self.c_enable6:
            self.TracePlot.plot(('t','y6'), type='line', color='green', name='channel 6')
            n+=1
        if self.c_enable7:
            self.TracePlot.plot(('t','y7'), type='line', color='black', name='channel 7')

        if n > 1:
            self.TracePlot.legend.visible = True
        else:
            self.TracePlot.legend.visible = False
Example #2
0
    def _create_plot(self):
        plot_data = ArrayPlotData(image=self.image)
        plot = Plot(plot_data, width=500, height=500, resizable='hv', aspect_ratio=1.0, padding=8, padding_left=32, padding_bottom=32)
        plot.img_plot('image',  colormap=RdBu_r, xbounds=(self.X[0],self.X[-1]), ybounds=(self.Y[0],self.Y[-1]), name='image')
        image = plot.plots['image'][0]
        image.x_mapper.domain_limits = (self.imager.get_x_range()[0],self.imager.get_x_range()[1])
        image.y_mapper.domain_limits = (self.imager.get_y_range()[0],self.imager.get_y_range()[1])
        zoom = AspectZoomTool(image, enable_wheel=False)
        cursor = CursorTool2D(image, drag_button='left', color='yellow', marker_size=1.0, line_width=1.0 )
        image.overlays.append(cursor)
        image.overlays.append(zoom)
        colormap = image.color_mapper
        colorbar = ColorBar(index_mapper=LinearMapper(range=colormap.range),
                            color_mapper=colormap,
                            plot=plot,
                            orientation='v',
                            resizable='v',
                            width=16,
                            height=320,
                            padding=8,
                            padding_left=32)
        container = HPlotContainer()
        container.add(plot)
        container.add(colorbar)
        z_label = PlotLabel(text='z=0.0', color='red', hjustify='left', vjustify='bottom', position=[10,10])
        container.overlays.append(z_label)
        container.tools.append(SaveTool(container))

        self.plot_data = plot_data
        self.scan_plot = image
        self.cursor = cursor
        self.zoom = zoom
        self.figure = plot
        self.figure_container = container
        self.sync_trait('z_label_text', z_label, 'text')
Example #3
0
 def _create_line_plot(self):
     line_data = ArrayPlotData(current=np.array(()), frequency=np.array(()),)
     plot = Plot(line_data, padding=8, padding_left=64, padding_bottom=36)
     plot.plot(('current','frequency'), color='blue', name='zeeman')
     plot.index_axis.title = 'current [mA]'
     plot.value_axis.title = 'frequency [MHz]'
     plot.tools.append(SaveTool(plot))
     self.line_data = line_data
     self.line_plot = plot
Example #4
0
 def _figure_image_default(self):
     plot = Plot(self.plot_data_image,
                 width=100,
                 height=100,
                 padding=8,
                 padding_left=48,
                 padding_bottom=32)
     plot.img_plot('image', colormap=RdBu_r, name='image')
     plot.aspect_ratio = 1
     plot.index_mapper.domain_limits = (self.imager.get_x_range()[0],
                                        self.imager.get_x_range()[1])
     plot.value_mapper.domain_limits = (self.imager.get_y_range()[0],
                                        self.imager.get_y_range()[1])
     plot_fit = Plot(self.plot_data_image,
                     width=100,
                     height=100,
                     padding=8,
                     padding_left=48,
                     padding_bottom=32)
     plot_fit.img_plot('fit', colormap=RdBu_r, name='fit')
     plot_fit.aspect_ratio = 1
     plot_fit.index_mapper.domain_limits = (self.imager.get_x_range()[0],
                                            self.imager.get_x_range()[1])
     plot_fit.value_mapper.domain_limits = (self.imager.get_y_range()[0],
                                            self.imager.get_y_range()[1])
     container = HPlotContainer()
     image = plot.plots['image'][0]
     colormap = image.color_mapper
     colorbar = ColorBar(index_mapper=LinearMapper(range=colormap.range),
                         color_mapper=colormap,
                         plot=plot,
                         orientation='v',
                         resizable='v',
                         width=16,
                         height=320,
                         padding=8,
                         padding_left=32)
     container = HPlotContainer()
     container.add(plot)
     container.add(plot_fit)
     container.add(colorbar)
     container.overlays.append(self.image_label)
     container.tools.append(SaveTool(container))
     return container
Example #5
0
 def _create_line_plot(self):
     line_data = ArrayPlotData(
         index=np.array((0, 1)),
         spin_state=np.array((0, 0)),
     )
     plot = Plot(line_data, padding=8, padding_left=64, padding_bottom=36)
     plot.plot(('index', 'spin_state'), color='blue', name='spin_state')
     plot.index_axis.title = 'time [micro s]'
     plot.value_axis.title = 'spin state'
     plot.tools.append(SaveTool(plot))
     self.line_data = line_data
     self.line_plot = plot
Example #6
0
 def _figure_line_default(self):
     plot = Plot(self.plot_data_line,
                 width=100,
                 height=100,
                 padding=8,
                 padding_left=64,
                 padding_bottom=32)
     plot.plot(('x', 'y'), color='blue')
     plot.plot(('x', 'fit'), color='red')
     plot.index_axis.title = 'z [micron]'
     plot.value_axis.title = 'Fluorescence [ counts / s ]'
     plot.tools.append(SaveTool(plot))
     return plot
 def _create_matrix_plot(self):
     matrix_data = ArrayPlotData(image=np.zeros((2, 2)))
     matrix_plot = Plot(matrix_data,
                        padding=8,
                        padding_left=64,
                        padding_bottom=32)
     matrix_plot.index_axis.title = 'time bins'
     matrix_plot.value_axis.title = 'tau'
     matrix_plot.img_plot('image',
                          xbounds=(self.tau[0], self.tau[-1]),
                          ybounds=(0, self.n_lines),
                          colormap=Spectral)
     matrix_plot.tools.append(SaveTool(matrix_plot))
     self.matrix_data = matrix_data
     self.matrix_plot = matrix_plot
 def _create_pulse_plot(self):
     pulse_data = ArrayPlotData(x=np.array((0., 100)), y=np.array((0, 1)))
     plot = Plot(pulse_data, padding=8, padding_left=64, padding_bottom=36)
     line = plot.plot(('x', 'y'), style='line', color='blue',
                      name='data')[0]
     plot.index_axis.title = 'time bins'
     plot.value_axis.title = 'intensity'
     edge_marker = LinePlot(
         index=ArrayDataSource(np.array((0, 0))),
         value=ArrayDataSource(np.array((0, 1e9))),
         color='red',
         index_mapper=LinearMapper(range=plot.index_range),
         value_mapper=LinearMapper(range=plot.value_range),
         name='marker')
     plot.add(edge_marker)
     plot.tools.append(SaveTool(plot))
     self.pulse_data = pulse_data
     self.pulse_plot = plot
Example #9
0
 def _create_line_plot(self):
     line_data = ArrayPlotData(index=np.array((0, 1)),
                               spin_state=np.array((0, 0)),
                               fit=np.array((0, 0)))
     plot = Plot(line_data, padding=8, padding_left=64, padding_bottom=36)
     plot.plot(('index', 'spin_state'), color='blue', name='spin_state')
     plot.plot(('index', 'fit'), color='red', name='fit')
     plot.index_axis.title = 'time [micro s]'
     plot.value_axis.title = 'spin state'
     plot.overlays.insert(
         0,
         PlotLabel(text=self.label_text,
                   hjustify='left',
                   vjustify='bottom',
                   position=[64, 32]))
     plot.tools.append(SaveTool(plot))
     self.line_data = line_data
     self.line_plot = plot
Example #10
0
 def _create_matrix_plot(self):
     matrix_data = ArrayPlotData(image=np.zeros((2, 2)))
     plot = Plot(matrix_data,
                 width=500,
                 height=500,
                 resizable='hv',
                 padding=8,
                 padding_left=48,
                 padding_bottom=36)
     plot.index_axis.title = 'time [ns]'
     plot.value_axis.title = 'laser pulse #'
     plot.img_plot('image',
                   xbounds=(0, 1),
                   ybounds=(0, 1),
                   colormap=Spectral)[0]
     plot.tools.append(SaveTool(plot))
     self.matrix_data = matrix_data
     self.matrix_plot = plot
 def _create_line_plot(self):
     line_data = ArrayPlotData(index=np.array((0, 1)),
                               counts=np.array((0, 0)),
                               pulse_indices=np.array((0, 0)),
                               pulse_values=np.array((0, 0)))
     plot = Plot(line_data, padding=8, padding_left=64, padding_bottom=36)
     plot.plot(('index', 'counts'), color='blue', name='counts')
     plot.plot(('pulse_indices', 'pulse_values'),
               type='scatter',
               marker='circle',
               color='none',
               outline_color='red',
               line_width=1.0,
               name='pulses')
     plot.index_axis.title = 'time [ns]'
     plot.value_axis.title = 'spin state'
     #plot.overlays.insert(0, PlotLabel(text=self.label_text, hjustify='left', vjustify='bottom', position=[64,32]) )
     self.line_data = line_data
     self.line_plot = plot
Example #12
0
 def _figure_drift_default(self):
     plot = Plot(self.plot_data_drift,
                 width=100,
                 height=100,
                 padding=8,
                 padding_left=64,
                 padding_bottom=32)
     plot.plot(('t', 'x'), type='line', color='blue', name='x')
     plot.plot(('t', 'y'), type='line', color='red', name='y')
     plot.plot(('t', 'z'), type='line', color='green', name='z')
     bottom_axis = PlotAxis(
         plot,
         orientation="bottom",
         tick_generator=ScalesTickGenerator(scale=CalendarScaleSystem()))
     plot.index_axis = bottom_axis
     plot.index_axis.title = 'time'
     plot.value_axis.title = 'drift [micron]'
     plot.legend.visible = True
     plot.tools.append(SaveTool(plot))
     return plot
Example #13
0
    def _create_plot(self):
        plot_data = ArrayPlotData(image=self.image)
        plot = Plot(plot_data,
                    width=500,
                    height=500,
                    resizable='hv',
                    aspect_ratio=1.0,
                    padding=8,
                    padding_left=32,
                    padding_bottom=32)
        plot.img_plot('image',
                      colormap=jet,
                      xbounds=(self.X[0], self.X[-1]),
                      ybounds=(self.Y[0], self.Y[-1]),
                      name='image')
        image = plot.plots['image'][0]
        bwplot_data = ArrayPlotData(bwimage=self.bwimage)
        bwplot = Plot(bwplot_data,
                      width=500,
                      height=500,
                      resizable='hv',
                      aspect_ratio=1.0,
                      padding=8,
                      padding_left=32,
                      padding_bottom=32)
        bwplot.img_plot('bwimage',
                        colormap=jet,
                        xbounds=(self.X[0], self.X[-1]),
                        ybounds=(self.Y[0], self.Y[-1]),
                        name='bwimage')
        bwimage = bwplot.plots['bwimage'][0]

        image.x_mapper.domain_limits = (self.confocal.scanner.getXRange()[0],
                                        self.confocal.scanner.getXRange()[1])
        image.y_mapper.domain_limits = (self.confocal.scanner.getYRange()[0],
                                        self.confocal.scanner.getYRange()[1])
        bwimage.x_mapper.domain_limits = (self.confocal.scanner.getXRange()[0],
                                          self.confocal.scanner.getXRange()[1])
        bwimage.y_mapper.domain_limits = (self.confocal.scanner.getYRange()[0],
                                          self.confocal.scanner.getYRange()[1])
        colormap = image.color_mapper
        colorbar = ColorBar(index_mapper=LinearMapper(range=colormap.range),
                            color_mapper=colormap,
                            plot=plot,
                            orientation='v',
                            resizable='v',
                            width=16,
                            height=320,
                            padding=8,
                            padding_left=32)
        container = HPlotContainer()
        container.add(plot)
        container.add(colorbar)
        container.add(bwplot)

        container.tools.append(SaveTool(container))

        self.plot_data = plot_data
        self.scan_plot = image
        self.figure = plot
        self.bwplot_data = bwplot_data
        self.bwscan_plot = bwimage
        self.bwfigure = bwplot

        self.figure_container = container
Example #14
0
    def _create_plot(self):
        plot_data = ArrayPlotData(image=self.image)
        plot = Plot(plot_data,
                    width=500,
                    height=500,
                    resizable='hv',
                    aspect_ratio=1.0,
                    padding=8,
                    padding_left=32,
                    padding_bottom=32)
        plot.img_plot('image',
                      colormap=jet,
                      xbounds=(self.X[0], self.X[-1]),
                      ybounds=(self.Y[0], self.Y[-1]),
                      name='image')
        image = plot.plots['image'][0]
        fitplot_data = ArrayPlotData(fitimage=self.fitimage)
        fitplot = Plot(fitplot_data,
                       width=500,
                       height=500,
                       resizable='hv',
                       aspect_ratio=1.0,
                       padding=8,
                       padding_left=32,
                       padding_bottom=32)
        fitplot.img_plot('fitimage',
                         colormap=jet,
                         xbounds=(self.Xfit[0], self.Xfit[-1]),
                         ybounds=(self.Yfit[0], self.Yfit[-1]),
                         name='fitimage')
        fitplot.overlays.insert(
            0,
            PlotLabel(text=self.label_text,
                      hjustify='right',
                      vjustify='bottom',
                      position=[880, 590]))
        fitimage = fitplot.plots['fitimage'][0]

        image.x_mapper.domain_limits = (self.confocal.scanner.getXRange()[0],
                                        self.confocal.scanner.getXRange()[1])
        image.y_mapper.domain_limits = (self.confocal.scanner.getYRange()[0],
                                        self.confocal.scanner.getYRange()[1])
        fitimage.x_mapper.domain_limits = (
            self.confocal.scanner.getXRange()[0],
            self.confocal.scanner.getXRange()[1])
        fitimage.y_mapper.domain_limits = (
            self.confocal.scanner.getYRange()[0],
            self.confocal.scanner.getYRange()[1])
        colormap = image.color_mapper
        colorbar = ColorBar(index_mapper=LinearMapper(range=colormap.range),
                            color_mapper=colormap,
                            plot=plot,
                            orientation='v',
                            resizable='v',
                            width=16,
                            height=320,
                            padding=8,
                            padding_left=32)
        container = HPlotContainer()
        container.add(plot)
        container.add(colorbar)
        container.add(fitplot)

        container.tools.append(SaveTool(container))

        self.plot_data = plot_data
        self.scan_plot = image
        self.figure = plot
        self.fitplot_data = fitplot_data
        self.fitscan_plot = fitimage
        self.fitfigure = fitplot

        self.figure_container = container
Example #15
0
 def _TracePlot_default(self):
     plot = Plot(self.plot_data, width=500, height=500, resizable='hv')
     plot.plot(('t', 'y0'), type='line', color='black')
     plot.tools.append(SaveTool(plot))
     return plot