def __init__(self, **params): for p in self.INPUT_PARAM_NAMES: setattr(self, p, params[p]) self.x_array = np.arange(self.x0, self.x1, self.dx, dtype=float) self.y_array = np.arange(self.y0, self.y1, self.dy, dtype=float) self.z_array = np.arange(self.z0, self.z1, self.dz, dtype=float) self.Nx = len(self.x_array) self.Ny = len(self.y_array) self.Nz = len(self.z_array) self.mcl_axis_translation = xyz_tuple(*self.mcl_axis_translation) self.HARDWARE_DEBUG = False #HARDWARE self.nanodrive = MCLNanoDrive(debug=self.HARDWARE_DEBUG) self.mono = ActonSpectrometer(port=SPEC_COMM_PORT, debug=self.HARDWARE_DEBUG, dummy=False) self.mono_grating = self.mono.read_grating() self.mono_wl = self.mono.read_wl() self.ccd = AndorCCD(debug=self.HARDWARE_DEBUG) print "Andor CCD" print "%g x %g" % (self.ccd.Nx, self.ccd.Ny) self.spectrum_length = self.ccd.Nx self.ccd.set_cooler_on() self.ccd.get_temperature() if SHOW_GRAPH: self.fig = pl.figure(1) self.ax = self.fig.add_subplot(111) self.spec_plotline, = self.ax.plot(np.ones(self.spectrum_length)) self.fig.show() #DATA ARRAYS self.integrated_count_map = np.zeros(( self.Nz, self.Ny, self.Nx, ), dtype=int) self.spec_map = np.zeros( (self.Nz, self.Ny, self.Nx, self.spectrum_length), dtype=np.int32)
def OnInit(self): print "OnInit" self.HARDWARE_DEBUG = HARDWARE_DEBUG self.frame = ScanningSpectrumControlFrame(None) # Logged Quantities self.x_position = LoggedQuantity( name='x_position', dtype=np.float, display_textctrl=self.frame.m_textCtrl_current_x, input_textctrl=self.frame.m_textCtrl_set_current_x) self.y_position = LoggedQuantity( name='y_position', dtype=np.float, display_textctrl=self.frame.m_textCtrl_current_y, input_textctrl=self.frame.m_textCtrl_set_current_y) # Figure ############################################################### self.wxfig = MPLFigureWithToolbarWX(self.frame.m_panel_plot) self.fig = self.wxfig.fig self.ax = self.fig.add_subplot(111) # Spectrum Fig self.fig2 = pl.figure(2) self.ax_speclive = self.fig2.add_subplot(111) #self.c0_hist_line, = self.ax2.plot(np.zeros(HIST_LEN,dtype=float)) #self.c1_hist_line, = self.ax2.plot(np.zeros(HIST_LEN,dtype=float)) #self.hist_vline = self.ax2.axvline(0) #self.c0_hist = np.zeros(HIST_LEN,dtype=float) #self.c1_hist = np.zeros(HIST_LEN,dtype=float) self.fig2.show() #self.history_i = 0 self.spec_plotline, = self.ax_speclive.plot(range(0, 512), range(0, 512)) ##################### hardware ######################################### self.scanning = False ######## MCL NanoDrive Stage ########################################### self.nanodrive = MCLNanoDrive(debug=self.HARDWARE_DEBUG) try: self.frame.m_staticText_maxdim.SetLabel( "max: %g x %g um" % (self.nanodrive.cal[XAXIS_ID], self.nanodrive.cal[YAXIS_ID])) except Exception as e: print e self.frame.m_staticText_maxdim.SetLabel("max: ? x ? um") self.read_from_hardware() self.x_position.hardware_set_func = lambda x: self.nanodrive.set_pos_ax( x, XAXIS_ID) self.y_position.hardware_set_func = lambda y: self.nanodrive.set_pos_ax( y, YAXIS_ID) #Spectrometer ########################################################## self.spec = ActonSpectrometer(port=SPEC_COMM_PORT, debug=self.HARDWARE_DEBUG, dummy=False) print self.spec.read_grating_info() self.frame.m_choice_spec_grating.Clear() for gnum, gname in self.spec.gratings: self.frame.m_choice_spec_grating.Append("%i %s" % (gnum, gname)) print self.spec.gratings_dict self.spec.read_grating() self.frame.m_choice_spec_grating.SetSelection(self.spec.grating - 1) self.spec.read_wl() self.frame.m_textCtrl_current_spec_wl.SetValue("%f" % self.spec.wl) self.frame.m_textCtrl_set_spec_wl.Bind(wx.EVT_TEXT_ENTER, self.on_change_spec_wl) self.frame.m_choice_spec_grating.Bind(wx.EVT_CHOICE, self.on_change_spec_grating) #self.frame.m_button_spec_stop.Bind(wx.EVT_BUTTON, self.on_spec_stop_motion) ######################################################################## #Andor CCD############################################################## self.ccd = AndorCCD(debug=self.HARDWARE_DEBUG) print "Andor CCD" print "%g x %g" % (self.ccd.Nx, self.ccd.Ny) self.spectrum_length = self.ccd.Nx self.ccd.set_ro_image_mode() self.ccd.set_trigger_mode('internal') self.ccd.set_image_flip(ANDOR_HFLIP, ANDOR_VFLIP) print "flip", self.ccd.get_image_flip() self.ccd.set_ad_channel(ANDOR_AD_CHAN) self.ccd.set_exposure_time(1.0) self.ccd.set_EMCCD_gain(1) self.ccd.set_cooler_on() self.ccd.get_temperature() self.ccd.set_shutter_open() self.spec_fig = pl.figure(3) self.specimg_ax = self.spec_fig.add_subplot(111) self.spec_ax = self.spec_fig.add_subplot(611) self.spec_ax.set_xlim(0, 512) self.spec_fig.show() self.ccd_img = self.specimg_ax.imshow(np.zeros( (self.ccd.Nx, self.ccd.Ny), dtype=np.int32), origin='lower', interpolation='nearest') self.specimg_ax.axhline(ROW0, color='w') self.specimg_ax.axhline(ROW1, color='w') self.specimg_ax.axvline(256, color='w') self.spec_line, = self.spec_ax.plot( np.zeros(self.ccd.Nx, dtype=np.int32), 'k-') self.spec_line2, = self.spec_ax.plot( np.zeros(self.ccd.Nx, dtype=np.int32), 'g-') self.video_mode = False self.frame.m_button_video_mode_start.Bind(wx.EVT_BUTTON, self.on_start_video_mode) self.frame.m_button_video_mode_stop.Bind(wx.EVT_BUTTON, self.on_stop_video_mode) self.frame.m_textCtrl_andor_exposure.SetValue( str(ANDOR_DEFAULT_EXPOSURE)) self.frame.m_textCtrl_andor_em.SetValue(str(ANDOR_DEFAULT_EMGAIN)) # A/D rate choice_adc = self.frame.m_choice_andor_adc choice_adc.Clear() for speed in self.ccd.HSSpeeds[ANDOR_AD_CHAN]: choice_adc.Append("%g MHz" % (speed)) choice_adc.SetSelection(0) self.ccd.set_hs_speed(0) choice_adc.Bind(wx.EVT_CHOICE, self.on_change_andor_adc) ######################################################################## # update figure self.ax.set_xlim(0, self.nanodrive.cal[XAXIS_ID]) self.ax.set_ylim(0, self.nanodrive.cal[YAXIS_ID]) # events self.frame.Bind(wx.EVT_BUTTON, self.on_start_scan, self.frame.m_button_start) self.frame.Bind(wx.EVT_BUTTON, self.on_stop_scan, self.frame.m_button_stop) self.timer = wx.Timer(id=2001) self.timer.Bind(wx.EVT_TIMER, self.on_timer) self.timer.Start(2000) #self.fast_timer = wx.Timer(id=2002) #self.fast_timer.Bind(wx.EVT_TIMER, self.on_fast_timer) #self.frame.m_checkBox_picoharp_fastreadout.Bind( # wx.EVT_CHECKBOX, self.on_fast_timer_checkbox) self.update_display() self.frame.Show() return True
class ConfocalSpectrum3DScan(object): INPUT_PARAM_NAMES = """x0 x1 dx y0 y1 dy z0 z1 dz t_exposure emgain ad_chan ad_hs_speed_index bin_row0 bin_row1 axis_scan_order mcl_axis_translation""".split() def __init__(self, **params): for p in self.INPUT_PARAM_NAMES: setattr(self, p, params[p]) self.x_array = np.arange(self.x0, self.x1, self.dx, dtype=float) self.y_array = np.arange(self.y0, self.y1, self.dy, dtype=float) self.z_array = np.arange(self.z0, self.z1, self.dz, dtype=float) self.Nx = len(self.x_array) self.Ny = len(self.y_array) self.Nz = len(self.z_array) self.mcl_axis_translation = xyz_tuple(*self.mcl_axis_translation) self.HARDWARE_DEBUG = False #HARDWARE self.nanodrive = MCLNanoDrive(debug=self.HARDWARE_DEBUG) self.mono = ActonSpectrometer(port=SPEC_COMM_PORT, debug=self.HARDWARE_DEBUG, dummy=False) self.mono_grating = self.mono.read_grating() self.mono_wl = self.mono.read_wl() self.ccd = AndorCCD(debug=self.HARDWARE_DEBUG) print "Andor CCD" print "%g x %g" % (self.ccd.Nx, self.ccd.Ny) self.spectrum_length = self.ccd.Nx self.ccd.set_cooler_on() self.ccd.get_temperature() if SHOW_GRAPH: self.fig = pl.figure(1) self.ax = self.fig.add_subplot(111) self.spec_plotline, = self.ax.plot(np.ones(self.spectrum_length)) self.fig.show() #DATA ARRAYS self.integrated_count_map = np.zeros(( self.Nz, self.Ny, self.Nx, ), dtype=int) self.spec_map = np.zeros( (self.Nz, self.Ny, self.Nx, self.spectrum_length), dtype=np.int32) def run_3d_scan(self): self.ccd.set_ro_image_mode() self.ccd.set_trigger_mode('internal') self.ccd.set_image_flip(ANDOR_HFLIP, ANDOR_VFLIP) print "flip", self.ccd.get_image_flip() self.ccd.set_ad_channel(self.ad_chan) self.ccd.set_exposure_time(self.t_exposure) self.ccd.set_EMCCD_gain(self.emgain) self.ccd.set_cooler_on() self.ccd.get_temperature() self.ccd.set_shutter_open() self.ccd.set_hs_speed(self.ad_hs_speed_index) self.set_ijk = (-1, -1, -1) self.scanning = True time0 = time.time() for iii, ijk in enumerate( ijk_generator((self.Nx, self.Ny, self.Nz), self.axis_scan_order)): #previous ijk ip, jp, kp = self.set_ijk # new ijk i, j, k = ijk # move stage if i != ip: x = self.x_array[i] self.nanodrive.set_pos_ax(x, self.mcl_axis_translation.x) if j != jp: y = self.y_array[j] self.nanodrive.set_pos_ax(y, self.mcl_axis_translation.y) if k != kp: z = self.z_array[k] self.nanodrive.set_pos_ax(z, self.mcl_axis_translation.z) self.set_ijk = ijk #t1 = time.time() self.read_from_hardware() #print "read_from_hardware (s)", time.time() - t1 #t1 = time.time() self.ccd.start_acquisition() stat = "ACQUIRING" while stat != "IDLE": time.sleep(self.ccd.exposure_time * 0.1) stati, stat = self.ccd.get_status() self.ccd.get_acquired_data() #print "ccd acquire (s)", time.time() - t1 spectrum = np.sum(self.ccd.buffer[self.bin_row0:self.bin_row1], axis=0) self.spec_map[k, j, i, :] = spectrum cts = self.integrated_count_map[k, j, i] = sum(spectrum) if ((i + j + k) % 10) == 0: print ijk, cts t_now = time.time() pixel_time = (t_now - time0) * 0.1 print "sec per pixel:", pixel_time, "| time remaining (s)", (( (self.Nx * self.Ny * self.Nz) - iii) * pixel_time) time0 = t_now #if ((i + j + k) % 2) == 0 : if True: if SHOW_GRAPH: self.spec_plotline.set_ydata(spectrum) self.ax.relim() self.ax.autoscale_view(tight=None, scalex=False, scaley=True) self.fig.canvas.draw() #Finish up after scan print "saving data..." save_params = self.INPUT_PARAM_NAMES + [ "spec_map", "Nx", "Ny", "Nz", "spectrum_length", "mono_grating", "mono_wl", "x_array", "y_array", "z_array", "integrated_count_map" ] save_dict = dict() for key in save_params: save_dict[key] = getattr(self, key) t0 = time.time() save_fname = "%i_spec_map3d.npz" % t0 np.savez_compressed(save_fname, **save_dict) print "data saved as %s" % save_fname def read_from_hardware(self): pos = self.nanodrive.get_pos() self.xpos = pos[self.mcl_axis_translation.x - 1] self.ypos = pos[self.mcl_axis_translation.y - 1] self.zpos = pos[self.mcl_axis_translation.z - 1]
class ScanningTRPLHistMapApp(wx.App): def OnInit(self): print "OnInit" self.HARDWARE_DEBUG = HARDWARE_DEBUG self.frame = ScanningSpectrumControlFrame(None) # Logged Quantities self.x_position = LoggedQuantity( name='x_position', dtype=np.float, display_textctrl=self.frame.m_textCtrl_current_x, input_textctrl=self.frame.m_textCtrl_set_current_x) self.y_position = LoggedQuantity( name='y_position', dtype=np.float, display_textctrl=self.frame.m_textCtrl_current_y, input_textctrl=self.frame.m_textCtrl_set_current_y) # Figure ############################################################### self.wxfig = MPLFigureWithToolbarWX(self.frame.m_panel_plot) self.fig = self.wxfig.fig self.ax = self.fig.add_subplot(111) # Spectrum Fig self.fig2 = pl.figure(2) self.ax_speclive = self.fig2.add_subplot(111) #self.c0_hist_line, = self.ax2.plot(np.zeros(HIST_LEN,dtype=float)) #self.c1_hist_line, = self.ax2.plot(np.zeros(HIST_LEN,dtype=float)) #self.hist_vline = self.ax2.axvline(0) #self.c0_hist = np.zeros(HIST_LEN,dtype=float) #self.c1_hist = np.zeros(HIST_LEN,dtype=float) self.fig2.show() #self.history_i = 0 self.spec_plotline, = self.ax_speclive.plot(range(0, 512), range(0, 512)) ##################### hardware ######################################### self.scanning = False ######## MCL NanoDrive Stage ########################################### self.nanodrive = MCLNanoDrive(debug=self.HARDWARE_DEBUG) try: self.frame.m_staticText_maxdim.SetLabel( "max: %g x %g um" % (self.nanodrive.cal[XAXIS_ID], self.nanodrive.cal[YAXIS_ID])) except Exception as e: print e self.frame.m_staticText_maxdim.SetLabel("max: ? x ? um") self.read_from_hardware() self.x_position.hardware_set_func = lambda x: self.nanodrive.set_pos_ax( x, XAXIS_ID) self.y_position.hardware_set_func = lambda y: self.nanodrive.set_pos_ax( y, YAXIS_ID) #Spectrometer ########################################################## self.spec = ActonSpectrometer(port=SPEC_COMM_PORT, debug=self.HARDWARE_DEBUG, dummy=False) print self.spec.read_grating_info() self.frame.m_choice_spec_grating.Clear() for gnum, gname in self.spec.gratings: self.frame.m_choice_spec_grating.Append("%i %s" % (gnum, gname)) print self.spec.gratings_dict self.spec.read_grating() self.frame.m_choice_spec_grating.SetSelection(self.spec.grating - 1) self.spec.read_wl() self.frame.m_textCtrl_current_spec_wl.SetValue("%f" % self.spec.wl) self.frame.m_textCtrl_set_spec_wl.Bind(wx.EVT_TEXT_ENTER, self.on_change_spec_wl) self.frame.m_choice_spec_grating.Bind(wx.EVT_CHOICE, self.on_change_spec_grating) #self.frame.m_button_spec_stop.Bind(wx.EVT_BUTTON, self.on_spec_stop_motion) ######################################################################## #Andor CCD############################################################## self.ccd = AndorCCD(debug=self.HARDWARE_DEBUG) print "Andor CCD" print "%g x %g" % (self.ccd.Nx, self.ccd.Ny) self.spectrum_length = self.ccd.Nx self.ccd.set_ro_image_mode() self.ccd.set_trigger_mode('internal') self.ccd.set_image_flip(ANDOR_HFLIP, ANDOR_VFLIP) print "flip", self.ccd.get_image_flip() self.ccd.set_ad_channel(ANDOR_AD_CHAN) self.ccd.set_exposure_time(1.0) self.ccd.set_EMCCD_gain(1) self.ccd.set_cooler_on() self.ccd.get_temperature() self.ccd.set_shutter_open() self.spec_fig = pl.figure(3) self.specimg_ax = self.spec_fig.add_subplot(111) self.spec_ax = self.spec_fig.add_subplot(611) self.spec_ax.set_xlim(0, 512) self.spec_fig.show() self.ccd_img = self.specimg_ax.imshow(np.zeros( (self.ccd.Nx, self.ccd.Ny), dtype=np.int32), origin='lower', interpolation='nearest') self.specimg_ax.axhline(ROW0, color='w') self.specimg_ax.axhline(ROW1, color='w') self.specimg_ax.axvline(256, color='w') self.spec_line, = self.spec_ax.plot( np.zeros(self.ccd.Nx, dtype=np.int32), 'k-') self.spec_line2, = self.spec_ax.plot( np.zeros(self.ccd.Nx, dtype=np.int32), 'g-') self.video_mode = False self.frame.m_button_video_mode_start.Bind(wx.EVT_BUTTON, self.on_start_video_mode) self.frame.m_button_video_mode_stop.Bind(wx.EVT_BUTTON, self.on_stop_video_mode) self.frame.m_textCtrl_andor_exposure.SetValue( str(ANDOR_DEFAULT_EXPOSURE)) self.frame.m_textCtrl_andor_em.SetValue(str(ANDOR_DEFAULT_EMGAIN)) # A/D rate choice_adc = self.frame.m_choice_andor_adc choice_adc.Clear() for speed in self.ccd.HSSpeeds[ANDOR_AD_CHAN]: choice_adc.Append("%g MHz" % (speed)) choice_adc.SetSelection(0) self.ccd.set_hs_speed(0) choice_adc.Bind(wx.EVT_CHOICE, self.on_change_andor_adc) ######################################################################## # update figure self.ax.set_xlim(0, self.nanodrive.cal[XAXIS_ID]) self.ax.set_ylim(0, self.nanodrive.cal[YAXIS_ID]) # events self.frame.Bind(wx.EVT_BUTTON, self.on_start_scan, self.frame.m_button_start) self.frame.Bind(wx.EVT_BUTTON, self.on_stop_scan, self.frame.m_button_stop) self.timer = wx.Timer(id=2001) self.timer.Bind(wx.EVT_TIMER, self.on_timer) self.timer.Start(2000) #self.fast_timer = wx.Timer(id=2002) #self.fast_timer.Bind(wx.EVT_TIMER, self.on_fast_timer) #self.frame.m_checkBox_picoharp_fastreadout.Bind( # wx.EVT_CHECKBOX, self.on_fast_timer_checkbox) self.update_display() self.frame.Show() return True def on_timer(self, e): self.read_from_hardware() self.update_display() # def on_fast_timer(self,e): # self.picoharp.read_count_rates() # self.frame.m_textCtrl_count0.SetValue(str(self.picoharp.Countrate0)) # self.frame.m_textCtrl_count1.SetValue(str(self.picoharp.Countrate1)) # self.c0_hist[self.hist_i] = self.picoharp.Countrate0 # self.c1_hist[self.hist_i] = self.picoharp.Countrate1 # # #self.c0_hist_line.set_ydata(self.c0_hist) # self.c1_hist_line.set_ydata(self.c1_hist) # self.hist_vline.set_xdata([self.hist_i]*2) # # self.history_i += 1 # self.history_i %= HISTORY_LEN # # if (self.hist_i % 10) == 0: # self.ax2.relim() # self.ax2.autoscale_view(scalex=False, scaley=True) # #self.ax2.autoscale() # # self.fig2.canvas.draw() def on_fast_timer_checkbox(self, e): fast_timer_enable = self.frame.m_checkBox_picoharp_fastreadout.GetValue( ) if fast_timer_enable: self.fast_timer.Start(100) else: self.fast_timer.Stop() def on_start_scan(self, e): print "start scan" self.scanning = True # get scan parameters: self.x0 = float(self.frame.m_textCtrl_x0.GetValue()) self.x1 = float(self.frame.m_textCtrl_x1.GetValue()) self.y0 = float(self.frame.m_textCtrl_y0.GetValue()) self.y1 = float(self.frame.m_textCtrl_y1.GetValue()) self.dx = float(self.frame.m_textCtrl_dx.GetValue()) / 1000. self.dy = float(self.frame.m_textCtrl_dy.GetValue()) / 1000. self.x_array = np.arange(self.x0, self.x1, self.dx, dtype=float) self.y_array = np.arange(self.y0, self.y1, self.dy, dtype=float) self.Nx = len(self.x_array) self.Ny = len(self.y_array) print "Nx, Ny", self.Nx, self.Ny self.andor_exposure = float( self.frame.m_textCtrl_andor_exposure.GetValue()) self.andor_em_gain = int(self.frame.m_textCtrl_andor_em.GetValue()) ### create data arrays self.integrated_count_map = np.zeros((self.Ny, self.Nx), dtype=int) self.spectrum_map = np.zeros((self.Ny, self.Nx, self.spectrum_length), dtype=int) print "shape:", self.integrated_count_map.shape, self.spectrum_map.shape ### update figure self.aximg = self.ax.imshow( self.integrated_count_map, origin='lower', vmin=1e4, vmax=1e5, interpolation='nearest', extent=[self.x0, self.x1, self.y0, self.y1]) self.wxfig.redraw() # set up experiment self.ccd.set_exposure_time(self.andor_exposure) self.ccd.set_EMCCD_gain(self.andor_em_gain) # Scan! line_time0 = time.time() for jj in range(self.Ny): if not self.scanning: break y = self.y_array[jj] self.nanodrive.set_pos_ax(y, YAXIS_ID) self.read_from_hardware() y = self.ypos print "line time:", time.time() - line_time0 print "pixel time:", float(time.time() - line_time0) / len( self.x_array) line_time0 = time.time() if jj % 2: #odd lines x_line_indicies = range(self.Nx) else: #even lines -- traverse in opposite direction x_line_indicies = range(self.Nx)[::-1] for ii in x_line_indicies: if not self.scanning: break x = self.xpos = self.x_array[ii] wx.Yield() self.nanodrive.set_pos_ax(x, XAXIS_ID) self.ccd.start_acquisition() stat = "ACQUIRING" while stat != "IDLE": wx_yielded_sleep(self.ccd.exposure_time * 0.25) stati, stat = self.ccd.get_status() self.ccd.get_acquired_data() spectrum = np.sum(self.ccd.buffer[ROW0:ROW1], axis=0) self.spectrum_map[jj, ii, :] = spectrum self.integrated_count_map[jj, ii] = sum(spectrum) # update display try: self.update_display() except Exception, err: print "Failed to update_display", err try: self.spec_plotline.set_ydata(spectrum) self.ax_speclive.relim() self.ax_speclive.autoscale_view(tight=None, scalex=False, scaley=True) self.fig2.canvas.draw() except Exception as err: print "Failed to update spectrum plot", err if not (ii % 5): #self.update_figure() try: #print "updating figure" #self.read_from_hardware() self.aximg.set_data(self.integrated_count_map) try: count_min = np.min( self.integrated_count_map[np.nonzero( self.integrated_count_map)]) except Exception as err: count_min = 0 count_max = np.max(self.integrated_count_map) self.aximg.set_clim(count_min, count_max + 1) self.wxfig.redraw() except Exception, err: print "Failed to update figure:", err
def OnInit(self): print "OnInit" self.HARDWARE_DEBUG = HARDWARE_DEBUG self.frame = SpectrumCameraControlFrame(None) #self.frame.m_panel_scanarea.Disable() # Figure self.wxfig = MPLFigureWithToolbarWX(self.frame.m_panel_plot) self.fig = self.wxfig.fig self.ax = self.fig.add_subplot(111) self.ax2 = self.fig.add_subplot(611) self.ax2.set_xlim(0, 512) #Spectrometer ########################################################## self.spec = ActonSpectrometer(port="COM4", debug=self.HARDWARE_DEBUG) print self.spec.read_grating_info() self.frame.m_choice_spec_grating.Clear() for gnum, gname in self.spec.gratings: self.frame.m_choice_spec_grating.Append("%i %s" % (gnum, gname)) print self.spec.gratings_dict self.spec.read_grating() self.frame.m_choice_spec_grating.SetSelection(self.spec.grating - 1) self.spec.read_wl() self.frame.m_textCtrl_current_spec_wl.SetValue("%f" % self.spec.wl) self.frame.m_textCtrl_set_spec_wl.Bind(wx.EVT_TEXT_ENTER, self.on_change_spec_wl) self.frame.m_choice_spec_grating.Bind(wx.EVT_CHOICE, self.on_change_spec_grating) self.frame.m_button_spec_stop.Bind(wx.EVT_BUTTON, self.on_spec_stop_motion) ######################################################################## #Andor CCD############################################################## self.ccd = AndorCCD(debug=self.HARDWARE_DEBUG) print "Andor CCD" print "%g x %g" % (self.ccd.Nx, self.ccd.Ny) self.ccd.set_ro_image_mode() self.ccd.set_trigger_mode('internal') self.ccd.set_exposure_time(1.0) self.ccd.set_EMCCD_gain(1) self.ccd.set_shutter_open() self.ccd_img = self.ax.imshow(np.zeros((self.ccd.Nx, self.ccd.Ny), dtype=np.int32), origin='lower', interpolation='nearest') self.spec_line, = self.ax2.plot(np.zeros(self.ccd.Nx, dtype=np.int32), 'k-') self.spec_line2, = self.ax2.plot(np.zeros(self.ccd.Nx, dtype=np.int32), 'g-') self.video_mode = False self.frame.m_button_video_mode_start.Bind(wx.EVT_BUTTON, self.on_start_video_mode) self.frame.m_button_video_mode_stop.Bind(wx.EVT_BUTTON, self.on_stop_video_mode) # A/D rate choice_adc = self.frame.m_choice_andor_adc choice_adc.Clear() for speed in self.ccd.HSSpeeds[AD_CHAN]: choice_adc.Append("%g MHz" % (speed)) choice_adc.SetSelection(0) self.ccd.set_hs_speed(0) choice_adc.Bind(wx.EVT_CHOICE, self.on_change_andor_adc) ######################################################################## self.timer = wx.Timer(id=2001) self.timer.Bind(wx.EVT_TIMER, self.on_timer) self.timer.Start(2000) self.fast_timer = wx.Timer(id=2002) self.fast_timer.Bind(wx.EVT_TIMER, self.on_fast_timer) #self.frame.m_checkBox_picoharp_fastreadout.Bind( # wx.EVT_CHECKBOX, self.on_fast_timer_checkbox) #self.update_display() self.frame.Show() return True
class AndorCameraTestApp(wx.App): def OnInit(self): print "OnInit" self.HARDWARE_DEBUG = HARDWARE_DEBUG self.frame = SpectrumCameraControlFrame(None) #self.frame.m_panel_scanarea.Disable() # Figure self.wxfig = MPLFigureWithToolbarWX(self.frame.m_panel_plot) self.fig = self.wxfig.fig self.ax = self.fig.add_subplot(111) self.ax2 = self.fig.add_subplot(611) self.ax2.set_xlim(0, 512) #Spectrometer ########################################################## self.spec = ActonSpectrometer(port="COM4", debug=self.HARDWARE_DEBUG) print self.spec.read_grating_info() self.frame.m_choice_spec_grating.Clear() for gnum, gname in self.spec.gratings: self.frame.m_choice_spec_grating.Append("%i %s" % (gnum, gname)) print self.spec.gratings_dict self.spec.read_grating() self.frame.m_choice_spec_grating.SetSelection(self.spec.grating - 1) self.spec.read_wl() self.frame.m_textCtrl_current_spec_wl.SetValue("%f" % self.spec.wl) self.frame.m_textCtrl_set_spec_wl.Bind(wx.EVT_TEXT_ENTER, self.on_change_spec_wl) self.frame.m_choice_spec_grating.Bind(wx.EVT_CHOICE, self.on_change_spec_grating) self.frame.m_button_spec_stop.Bind(wx.EVT_BUTTON, self.on_spec_stop_motion) ######################################################################## #Andor CCD############################################################## self.ccd = AndorCCD(debug=self.HARDWARE_DEBUG) print "Andor CCD" print "%g x %g" % (self.ccd.Nx, self.ccd.Ny) self.ccd.set_ro_image_mode() self.ccd.set_trigger_mode('internal') self.ccd.set_exposure_time(1.0) self.ccd.set_EMCCD_gain(1) self.ccd.set_shutter_open() self.ccd_img = self.ax.imshow(np.zeros((self.ccd.Nx, self.ccd.Ny), dtype=np.int32), origin='lower', interpolation='nearest') self.spec_line, = self.ax2.plot(np.zeros(self.ccd.Nx, dtype=np.int32), 'k-') self.spec_line2, = self.ax2.plot(np.zeros(self.ccd.Nx, dtype=np.int32), 'g-') self.video_mode = False self.frame.m_button_video_mode_start.Bind(wx.EVT_BUTTON, self.on_start_video_mode) self.frame.m_button_video_mode_stop.Bind(wx.EVT_BUTTON, self.on_stop_video_mode) # A/D rate choice_adc = self.frame.m_choice_andor_adc choice_adc.Clear() for speed in self.ccd.HSSpeeds[AD_CHAN]: choice_adc.Append("%g MHz" % (speed)) choice_adc.SetSelection(0) self.ccd.set_hs_speed(0) choice_adc.Bind(wx.EVT_CHOICE, self.on_change_andor_adc) ######################################################################## self.timer = wx.Timer(id=2001) self.timer.Bind(wx.EVT_TIMER, self.on_timer) self.timer.Start(2000) self.fast_timer = wx.Timer(id=2002) self.fast_timer.Bind(wx.EVT_TIMER, self.on_fast_timer) #self.frame.m_checkBox_picoharp_fastreadout.Bind( # wx.EVT_CHECKBOX, self.on_fast_timer_checkbox) #self.update_display() self.frame.Show() return True def on_timer(self, e): try: temp = self.ccd.get_temperature() self.frame.m_textCtrl_andor_temp.SetValue(str(temp)) except: print "failed to get temperature" #self.read_from_hardware() #self.update_display() def on_fast_timer(self, e): self.picoharp.read_count_rates() self.frame.m_textCtrl_count0.SetValue(str(self.picoharp.Countrate0)) self.frame.m_textCtrl_count1.SetValue(str(self.picoharp.Countrate1)) self.c0_hist[self.hist_i] = self.picoharp.Countrate0 self.c1_hist[self.hist_i] = self.picoharp.Countrate1 #self.c0_hist_line.set_ydata(self.c0_hist) self.c1_hist_line.set_ydata(self.c1_hist) self.hist_vline.set_xdata([self.hist_i] * 2) self.hist_i += 1 self.hist_i %= HIST_LEN if (self.hist_i % 10) == 0: self.ax2.relim() self.ax2.autoscale_view(scalex=False, scaley=True) #self.ax2.autoscale() self.fig2.canvas.draw() def on_fast_timer_checkbox(self, e): fast_timer_enable = self.frame.m_checkBox_picoharp_fastreadout.GetValue( ) if fast_timer_enable: self.fast_timer.Start(100) else: self.fast_timer.Stop() def read_from_hardware(self): self.picoharp.read_count_rates() self.ypos, self.xpos, z = self.nanodrive.get_pos() #self.xpos = self.lockinstage.getx() #self.ypos = self.lockinstage.gety() return self.xpos, self.ypos def update_display(self): #self.x_position.update_value(self.nanodrive.x_pos) #self.y_position.update_value(self.nanodrive.y_pos) self.x_position.update_value(self.xpos) self.y_position.update_value(self.ypos) self.frame.m_textCtrl_count0.SetValue(str(self.picoharp.Countrate0)) self.frame.m_textCtrl_count1.SetValue(str(self.picoharp.Countrate1)) def on_change_spec_wl(self, evt): self.spec_wl = float(self.frame.m_textCtrl_set_spec_wl.GetValue()) self.frame.m_statusBar.SetStatusText( "Setting spectrometer wavelength to %f nm ..." % self.spec_wl) self.spec.write_wl_nonblock(self.spec_wl) wx.Yield() wx.Sleep(1) self.spec_done = False while not self.spec_done: self.spec_done = self.spec.read_done_status() self.spec_wl_current = self.spec.read_wl() self.frame.m_textCtrl_current_spec_wl.SetValue( "%f" % self.spec_wl_current) wx.Yield() wx.Sleep(1) self.frame.m_textCtrl_set_spec_wl.SetValue("") self.frame.m_statusBar.SetStatusText("Done setting Spectrometer") def on_change_spec_grating(self, evt): new_grating_index = self.frame.m_choice_spec_grating.GetSelection() gnum, gname = self.spec.gratings[new_grating_index] if self.HARDWARE_DEBUG: print "Moving spectrometer grating to %i %s (please wait until the move is complete)" % ( gnum, gname) self.spec.write_grating(gnum) def on_spec_stop_motion(self, evt): pass def on_start_video_mode(self, evt): self.andor_exposure = float( self.frame.m_textCtrl_andor_exposure.GetValue()) self.andor_em_gain = int(self.frame.m_textCtrl_andor_em.GetValue()) self.ccd.set_exposure_time(self.andor_exposure) self.ccd.set_EMCCD_gain(self.andor_em_gain) self.frame.m_button_video_mode_start.Disable() self.frame.m_button_video_mode_stop.Enable(1) self.video_mode = True while self.video_mode: self.ccd.start_acquisition() stat = "ACQUIRING" while stat != "IDLE": wx_yielded_sleep(0.1) stati, stat = self.ccd.get_status() self.ccd.get_acquired_data() self.ccd_img.set_data(self.ccd.buffer) count_min = np.min(self.ccd.buffer) count_max = np.max(self.ccd.buffer) self.ccd_img.set_clim(count_min, count_max) self.spectra_data = np.average(self.ccd.buffer, axis=0) self.spectra_data2 = np.average(self.ccd.buffer[200:350], axis=0) self.spec_line.set_ydata(self.spectra_data) self.spec_line2.set_ydata(self.spectra_data2) self.ax2.relim() self.ax2.autoscale_view(scalex=False, scaley=True) self.wxfig.redraw() def on_stop_video_mode(self, evt): self.video_mode = False self.frame.m_button_video_mode_start.Enable(1) self.frame.m_button_video_mode_stop.Disable() # Andor CCD Events def on_change_andor_adc(self, evt): new_hs_speed_i = self.frame.m_choice_andor_adc.GetSelection() self.ccd.set_hs_speed(new_hs_speed_i)
def connect(self): if self.debug: print "Connecting to Andor EMCCD Counter" # Open connection to hardware self.andor_ccd = AndorCCD(debug=self.debug) # connect logged quantities self.status.hardware_read_func = self.andor_ccd.get_status self.temperature.hardware_read_func = self.andor_ccd.get_temperature self.exposure_time.hardware_set_func = self.andor_ccd.set_exposure_time self.exposure_time.hardware_read_func = self.andor_ccd.get_exposure_time self.em_gain.hardware_read_func = self.andor_ccd.get_EMCCD_gain self.em_gain.hardware_set_func = self.andor_ccd.set_EMCCD_gain self.output_amp.hardware_read_func = self.andor_ccd.get_output_amp self.output_amp.hardware_set_func = self.andor_ccd.set_output_amp self.ad_chan.hardware_set_func = self.andor_ccd.set_ad_channel self.hs_speed_em.hardware_set_func = self.andor_ccd.set_hs_speed_em self.hs_speed_conventional.hardware_set_func = self.andor_ccd.set_hs_speed_conventional self.shutter_open.hardware_set_func = self.andor_ccd.set_shutter_open self.trigger_mode.hardware_set_func = self.andor_ccd.set_trigger_mode self.hflip.hardware_read_func = self.andor_ccd.get_image_hflip self.hflip.hardware_set_func = self.andor_ccd.set_image_hflip self.vflip.hardware_read_func = self.andor_ccd.get_image_vflip self.vflip.hardware_set_func = self.andor_ccd.set_image_vflip # Update the ROI min and max values to the CCD dimensions width = self.andor_ccd.Nx height = self.andor_ccd.Ny self.roi_fvb_hbin.change_min_max(1, width) self.roi_img_hbin.change_min_max(1, width) self.roi_img_hend.change_min_max(1, width) self.roi_img_hstart.change_min_max(1, width) self.roi_img_vbin.change_min_max(1, height) self.roi_img_vend.change_min_max(1, height) self.roi_img_vstart.change_min_max(1, height) self.roi_st_center.change_min_max(1, height) self.roi_st_hbin.change_min_max(1, width) self.roi_st_width.change_min_max(1, height) #Choics for Readout mode choices = [("FullVerticalBinning", AndorReadMode.FullVerticalBinning.value), ("SingleTrack", AndorReadMode.SingleTrack.value), ("Image", AndorReadMode.Image.value)] self.readout_mode.change_choice_list(choices) # Choices for the horizontal shift speeds in EMCCD mode choices = [] for chan_i in range(self.andor_ccd.numADChan): for speed in enumerate(self.andor_ccd.HSSpeeds_EM[chan_i]): choices.append((str.format("Chan {} - {:.2f} MHz", chan_i, speed[1]), speed[0])) self.hs_speed_em.change_choice_list(choices) # Choices for the horizontal shift speeds in conventional mode choices = [] for chan_i in range(self.andor_ccd.numADChan): for speed in enumerate( self.andor_ccd.HSSpeeds_Conventional[chan_i]): choices.append((str.format("Chan {} - {:.2f} MHz", chan_i, speed[1]), speed[0])) self.hs_speed_conventional.change_choice_list(choices) # Choices for the AD channels choices = [] for chan_i in range(self.andor_ccd.numADChan): choices.append((str.format("Channel {}", chan_i), chan_i)) self.ad_chan.change_choice_list(choices) # For all of the logged quantities, call read from hardware to make sync # everything. for name, lq in self.logged_quantities.items(): lq.read_from_hardware() # Set some default values that are useful self.andor_ccd.set_temperature(DEFAULT_TEMPERATURE) if not self.has_been_connected_once: # initialize the readout parameters self.output_amp.update_value(0) #EMCCD mode self.ad_chan.update_value(0) #14-bit AD Chan self.hs_speed_em.update_value(0) #10 MHz readout speed self.hflip.update_value(True) #Default to true horizontal flip self.exposure_time.update_value(1) #Default to a 1 s integration self.shutter_open.update_value(False) #Close the shutter. self.em_gain.update_value(10) self.cooler_on.update_value(True) # Readout and ROI parameters self.readout_mode.update_value( AndorReadMode.Image.value) #Full image readout mode self.roi_img_hstart.update_value(1) self.roi_img_hend.update_value(width) self.roi_img_hbin.update_value(1) self.roi_img_vstart.update_value(1) self.roi_img_vend.update_value(height) self.roi_img_vbin.update_value(1) self.roi_st_center.update_value(height / 2) self.roi_st_width.update_value(height / 10) self.roi_st_hbin.update_value(1) self.roi_fvb_hbin.update_value(1) self.set_readout() self.is_connected = True
class AndorCCDHardwareComponent(HardwareComponent): def setup(self): self.name = "andor_ccd" self.debug = True self.background = None # Create logged quantities self.status = self.add_logged_quantity(name='ccd_satus', dtype=str, fmt="%s", ro=True) self.temperature = self.add_logged_quantity(name="temperature", dtype=int, ro=True, unit="C", vmin=-300, vmax=300) self.cooler_on = self.add_logged_quantity(name="cooler_on", dtype=bool, ro=False) self.exposure_time = self.add_logged_quantity(name="exposure_time", dtype=float, fmt="%e", ro=False, unit="sec", vmin=1e-3, vmax=1000) self.em_gain = self.add_logged_quantity("em_gain", dtype=int, ro=False, vmin=1, vmax=4096) # Ouput amplifer ( EMCCD or conventional) self.output_amp = self.add_logged_quantity("output_amp", dtype=int, ro=False, choices=[("EMCCD", 0), ("Conventional", 1) ]) #AD Channel and horizontal shift speeds for EM and Conventional modes. #There are empty until connected; then filled in with camera-specific values self.ad_chan = self.add_logged_quantity("ad_chan", dtype=int, choices=[('', 0)], initial=0) self.hs_speed_em = self.add_logged_quantity("hs_speed_em", dtype=int, choices=[('', 0)], initial=0) self.hs_speed_conventional = self.add_logged_quantity( "hs_chan_conventional", dtype=int, choices=[('', 0)], initial=0) self.shutter_open = self.add_logged_quantity("shutter_open", dtype=bool, ro=False, initial=False) self.trigger_mode = self.add_logged_quantity( "trigger_mode", dtype=str, choices=[("internal", "internal"), ("external", "external"), ("external_start", "external_start"), ("external_exposure", "external_exposure"), ("external_fvb_em", "external_fvb_em"), ("software", "software")]) # Readout mode self.readout_mode = self.add_logged_quantity( name="readout_mode", dtype=int, ro=False, initial=0, choices=[('', 0)], ) # ROI Parameters for image readout mode. self.roi_img_hstart = self.add_logged_quantity("roi_img_hstart", dtype=int, unit='px', ro=False, initial=1) self.roi_img_hend = self.add_logged_quantity("roi_img_hend", dtype=int, unit='px', ro=False, initial=512) self.roi_img_hbin = self.add_logged_quantity("roi_img_hbin", dtype=int, unit='px', ro=False, initial=1) self.roi_img_vstart = self.add_logged_quantity("roi_img_vstart", dtype=int, unit='px', initial=1, ro=False) self.roi_img_vend = self.add_logged_quantity("roi_img_vend", dtype=int, unit='px', initial=512, ro=False) self.roi_img_vbin = self.add_logged_quantity("roi_img_vbin", dtype=int, unit='px', initial=1, ro=False) #ROI Parameters for single track readout mode self.roi_st_center = self.add_logged_quantity("roi_st_center", dtype=int, unit='px', ro=False, initial=256) self.roi_st_width = self.add_logged_quantity("roi_st_width", dtype=int, unit='px', ro=False, initial=10) self.roi_st_hbin = self.add_logged_quantity("roi_st_hbin", dtype=int, unit='px', ro=False, initial=1) #ROI parameters for full vertical binning self.roi_fvb_hbin = self.add_logged_quantity("roi_fvb_hbin", dtype=int, unit='px', ro=False, initial=1) # Horizontal and vertical flipping self.hflip = self.add_logged_quantity("hflip", dtype=bool, initial=True) self.vflip = self.add_logged_quantity("vflip", dtype=bool, initial=False) # A single operation to update the ROI values in the camera self.add_operation("set_readout", self.set_readout) self.add_operation("read_temp", self.read_temp_op) #connect to custom gui - NOTE: these are not disconnected! self.exposure_time.connect_bidir_to_widget( self.gui.ui.andor_ccd_int_time_doubleSpinBox) #self.gui.ui.andor_ccd_int_time_doubleSpinBox.valueChanged[float].connect(self.exposure_time.update_value) self.exposure_time.updated_value[float].connect( self.gui.ui.andor_ccd_int_time_doubleSpinBox.setValue) self.temperature.updated_value[float].connect( self.gui.ui.andor_ccd_temp_doubleSpinBox.setValue) self.gui.ui.andor_ccd_emgain_doubleSpinBox.valueChanged[float].connect( self.em_gain.update_value) self.em_gain.updated_value[float].connect( self.gui.ui.andor_ccd_emgain_doubleSpinBox.setValue) self.gui.ui.andor_ccd_shutter_open_checkBox.stateChanged[int].connect( self.shutter_open.update_value) self.shutter_open.updated_value[bool].connect( self.gui.ui.andor_ccd_shutter_open_checkBox.setChecked) self.status.updated_text_value[str].connect( self.gui.ui.andor_ccd_status_label.setText) def connect(self): if self.debug: print "Connecting to Andor EMCCD Counter" # Open connection to hardware self.andor_ccd = AndorCCD(debug=self.debug) # connect logged quantities self.status.hardware_read_func = self.andor_ccd.get_status self.temperature.hardware_read_func = self.andor_ccd.get_temperature self.exposure_time.hardware_set_func = self.andor_ccd.set_exposure_time self.exposure_time.hardware_read_func = self.andor_ccd.get_exposure_time self.em_gain.hardware_read_func = self.andor_ccd.get_EMCCD_gain self.em_gain.hardware_set_func = self.andor_ccd.set_EMCCD_gain self.output_amp.hardware_read_func = self.andor_ccd.get_output_amp self.output_amp.hardware_set_func = self.andor_ccd.set_output_amp self.ad_chan.hardware_set_func = self.andor_ccd.set_ad_channel self.hs_speed_em.hardware_set_func = self.andor_ccd.set_hs_speed_em self.hs_speed_conventional.hardware_set_func = self.andor_ccd.set_hs_speed_conventional self.shutter_open.hardware_set_func = self.andor_ccd.set_shutter_open self.trigger_mode.hardware_set_func = self.andor_ccd.set_trigger_mode self.hflip.hardware_read_func = self.andor_ccd.get_image_hflip self.hflip.hardware_set_func = self.andor_ccd.set_image_hflip self.vflip.hardware_read_func = self.andor_ccd.get_image_vflip self.vflip.hardware_set_func = self.andor_ccd.set_image_vflip # Update the ROI min and max values to the CCD dimensions width = self.andor_ccd.Nx height = self.andor_ccd.Ny self.roi_fvb_hbin.change_min_max(1, width) self.roi_img_hbin.change_min_max(1, width) self.roi_img_hend.change_min_max(1, width) self.roi_img_hstart.change_min_max(1, width) self.roi_img_vbin.change_min_max(1, height) self.roi_img_vend.change_min_max(1, height) self.roi_img_vstart.change_min_max(1, height) self.roi_st_center.change_min_max(1, height) self.roi_st_hbin.change_min_max(1, width) self.roi_st_width.change_min_max(1, height) #Choics for Readout mode choices = [("FullVerticalBinning", AndorReadMode.FullVerticalBinning.value), ("SingleTrack", AndorReadMode.SingleTrack.value), ("Image", AndorReadMode.Image.value)] self.readout_mode.change_choice_list(choices) # Choices for the horizontal shift speeds in EMCCD mode choices = [] for chan_i in range(self.andor_ccd.numADChan): for speed in enumerate(self.andor_ccd.HSSpeeds_EM[chan_i]): choices.append((str.format("Chan {} - {:.2f} MHz", chan_i, speed[1]), speed[0])) self.hs_speed_em.change_choice_list(choices) # Choices for the horizontal shift speeds in conventional mode choices = [] for chan_i in range(self.andor_ccd.numADChan): for speed in enumerate( self.andor_ccd.HSSpeeds_Conventional[chan_i]): choices.append((str.format("Chan {} - {:.2f} MHz", chan_i, speed[1]), speed[0])) self.hs_speed_conventional.change_choice_list(choices) # Choices for the AD channels choices = [] for chan_i in range(self.andor_ccd.numADChan): choices.append((str.format("Channel {}", chan_i), chan_i)) self.ad_chan.change_choice_list(choices) # For all of the logged quantities, call read from hardware to make sync # everything. for name, lq in self.logged_quantities.items(): lq.read_from_hardware() # Set some default values that are useful self.andor_ccd.set_temperature(DEFAULT_TEMPERATURE) if not self.has_been_connected_once: # initialize the readout parameters self.output_amp.update_value(0) #EMCCD mode self.ad_chan.update_value(0) #14-bit AD Chan self.hs_speed_em.update_value(0) #10 MHz readout speed self.hflip.update_value(True) #Default to true horizontal flip self.exposure_time.update_value(1) #Default to a 1 s integration self.shutter_open.update_value(False) #Close the shutter. self.em_gain.update_value(10) self.cooler_on.update_value(True) # Readout and ROI parameters self.readout_mode.update_value( AndorReadMode.Image.value) #Full image readout mode self.roi_img_hstart.update_value(1) self.roi_img_hend.update_value(width) self.roi_img_hbin.update_value(1) self.roi_img_vstart.update_value(1) self.roi_img_vend.update_value(height) self.roi_img_vbin.update_value(1) self.roi_st_center.update_value(height / 2) self.roi_st_width.update_value(height / 10) self.roi_st_hbin.update_value(1) self.roi_fvb_hbin.update_value(1) self.set_readout() self.is_connected = True def disconnect(self): #disconnect hardware self.andor_ccd.close() #disconnect logged quantities from hardware for lq in self.logged_quantities.values(): lq.hardware_read_func = None lq.hardware_set_func = None # clean up hardware object del self.andor_ccd self.is_connected = False def is_background_valid(self): bg = self.background if bg is not None: if bg.shape == self.andor_ccd.buffer.shape: return True else: print "Background not the correct shape", self.andor_ccd.buffer.shape, bg.shape else: print "No Background available, raw data shown" return False def interrupt_acquisition(self): '''If the camera status is not IDLE, calls abort_acquisition() ''' stat = self.andor_ccd.get_status() if stat != 'IDLE': self.andor_ccd.abort_acquisition() @QtCore.Slot() def set_readout(self): """Sets ROI based on values in LoggedQuantities for the current readout mode Also sets the flip""" self.andor_ccd.set_image_flip(self.hflip.val, self.vflip.val) ro_mode = self.readout_mode.val #ro_mode = self.andor_ccd.get_ro_mode # FIXME if ro_mode == AndorReadMode.FullVerticalBinning.value: self.andor_ccd.set_ro_full_vertical_binning( self.roi_fvb_hbin.val) #FIXME elif ro_mode == AndorReadMode.Image.value: self.andor_ccd.set_ro_image_mode(self.roi_img_hbin.val, self.roi_img_vbin.val, self.roi_img_hstart.val, self.roi_img_hend.val, self.roi_img_vstart.val, self.roi_img_vend.val) elif ro_mode == AndorReadMode.SingleTrack.value: self.andor_ccd.set_ro_single_track(self.roi_st_center.val, self.roi_st_width.val, self.roi_st_hbin.val) else: raise NotImplementedError("ro mode not implemented %s", ro_mode) @QtCore.Slot() def read_temp_op(self): #print self.andor_ccd.get_status() print self.andor_ccd.get_temperature_range() print self.andor_ccd.get_temperature() print self.andor_ccd.get_cooler()