def save(self, meta=""):
        CyclopeanInstrument.save(self, meta)
	

        from wp_toolbox.qtlab_data import save
        save(self.get_name(), meta, x__x__um=self._x, y__y__um=self._y, 
        z__counts__Hz=self._data['countrates'])
Beispiel #2
0
 def _start_running(self):
     CyclopeanInstrument._start_running(self)
     self._counter = self._ins_count.get_is_running()
     self._ins_count.set_is_running(False)
     self.setup_data()
     self._current_line = 0
     self._last_line = 0
 def _start_running(self):
     CyclopeanInstrument._start_running(self)
     self._counter = self._ins_count.get_is_running()
     self._ins_count.set_is_running(False)
     self.setup_data()
     self._current_line = 0
     self._last_line = 0
 def _start_running(self):
     CyclopeanInstrument._start_running(self)
     self._ins_ADwin.Stop_Process(4)
     self._ins_ADwin.Load('D:\\Lucio\\AdWin codes\\ADwin_Gold_II\\simple_counting.tb4')
     self._ins_ADwin.Set_Par(24,self._integration_time)
     time.sleep(0.001)
     self._ins_ADwin.Start_Process(4)
Beispiel #5
0
    def __init__(self, name, channel='1'):
        CyclopeanInstrument.__init__(self, name, tags=['measure'])
        
        # relevant parameters
        self.add_parameter('countrate',
                           flags=Instrument.FLAG_GET,
                           units='Hz',
                           tags=['measure'],
                           channels=('cntr1', 'cntr2'),
                           channel_prefix='%s_',
                           doc="""
                           Returns the count rates for all counters.
                           """)

        # public functions
        self.add_function("monitor_countrates")

        # init parameters
        self._countrate = {'cntr1': 0.0, 'cntr2': 0.0, }
        
        # instruments we need to access
        # import qt
        # self._ins_adwin = qt.instruments['adwin']

        # cyclopean features
        self._supported = {
            'get_running': True,
            'get_recording': True,
            'set_running': True,
            'set_recording': False,
            'save': False,
            }

        self._busy = False
    def __init__(self, name, adwin, **kw):
        print 'init cyclopean_instrument'
        CyclopeanInstrument.__init__(self, name, tags=[])
        print 'initialising masterofchar'
        self._adwin = qt.instruments[adwin]
        self._fine_piezos = 'PI_fine_tuning'
        #self.set_fine_piezo_voltages(0,0,0)

        # #design properties in mm (see JPE datasheet).
        # self.cfg_pars = moc_cfg.config['moc_cav1']
        # self.fiber_z_offset = self.cfg_pars['fiber_z_offset'] #fiber offset with respect to fiber interface
        # self.h = self.cfg_pars['h_mm']+self.fiber_z_offset#33.85+self.fiber_z_offset
        # self.R = self.cfg_pars['R_mm']#14.5
        # self.max_spindle_steps = self.cfg_pars['max_spindle_steps']

        # #Cartesian coordinates in the lab-frame (mm)
        self.track_v_piezo_1 = None

        # Do I need this?
        # reinit_spindles = kw.pop('reinit_spindles', False)
        # if reinit_spindles:
        #     self.reset_spindle_tracker()
        # else:
        #     print 'Tracker initialized from file...'
        #     self.tracker_file_readout()

        self.add_function('set_fine_piezo_voltages')
 def _start_running(self):
     #print 'counters started running'
     CyclopeanInstrument._start_running(self)
     self._ins_adwin.start_counter(
             set_integration_time=self._integration_time,
             set_avg_periods=self._avg_periods,
             set_single_run=0)
Beispiel #8
0
    def save(self, meta=""):
        CyclopeanInstrument.save(self, meta)
	

        from wp_toolbox.qtlab_data import save
        save(self.get_name(), meta, x__x__um=self._x, y__y__um=self._y, 
        z__counts__Hz=self._data['countrates'], do_plot=False)
Beispiel #9
0
 def _start_running(self):
     #print 'counters started running'
     CyclopeanInstrument._start_running(self)
     self._ins_adwin.start_counter(
         set_integration_time=self._integration_time,
         set_avg_periods=self._avg_periods,
         set_single_run=0)
Beispiel #10
0
    def __init__(self, name, address=None):
        CyclopeanInstrument.__init__(self, name, tags=['measure', 'generate', 'virtual'])

        # relevant parameters
        self.add_parameter('integration_time',
                           type=types.IntType,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           units='ms',
                           minval=1, maxval=10000,
                           doc="""
                           How long to count to determine the rate.
                           """)

        self.add_parameter('channel',
                           type=types.IntType,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           units='',
                           minval=1, maxval=5,
                           doc="""
                           ADwin counter channel (1 - 4) or ADwiun counter 1 + counter 2 (channel 5)
                           """)

        self.add_parameter('counts',
                           type=types.IntType,
                           flags=Instrument.FLAG_GET,
                           units='counts',
                           tags=['measure'],
                           doc="""
                           Returns the counts acquired during the last counting period.
                           """)

        self.add_parameter('countrate',
                           type=types.IntType,
                           flags=Instrument.FLAG_GET,
                           units='Hz',
                           tags=['measure'],
                           doc="""
                           Returns the count rate based on the current count value.
                           """)

        # init parameters
        self.set_channel(5)
        self._counts = 0
        self._countrate = 0

        # instruments we need to access
        import qt
#        self._ins_pos = qt.instruments['dummy_pos']
        self._ins_ADwin = qt.instruments['ADwin']

        self.set_integration_time(20.0)

        self._supported = {
            'get_running': True,
            'get_recording': True,
            'set_running': True,
            'set_recording': False,
            'save': False,
            }
 def _start_running(self):
     CyclopeanInstrument._start_running(self)
     self._prepare()
     self._linescan.set_is_running(True)
     qt.msleep(0.1)
     while self._linescan.get_is_running():
         qt.msleep(0.1)
     return self._process_fit()
 def _start_running(self):
     CyclopeanInstrument._start_running(self)
     self._prepare()
     self._linescan.set_is_running(True)
     qt.msleep(0.1)
     while self._linescan.get_is_running():
         qt.msleep(0.1)
     return self._process_fit()
Beispiel #13
0
 def _start_running(self):
     CyclopeanInstrument._start_running(self)
     self._ins_ADwin.Stop_Process(4)
     self._ins_ADwin.Load(
         'D:\\Lucio\\AdWin codes\\ADwin_Gold_II\\simple_counting.tb4')
     self._ins_ADwin.Set_Par(24, self._integration_time)
     time.sleep(0.001)
     self._ins_ADwin.Start_Process(4)
Beispiel #14
0
 def save(self, meta=""):
     CyclopeanInstrument.save(self, meta)
     
     # NOTE a test of hdf5 data
     dat = h5.HDF5Data(name=self.get_name())
     dat.create_dataset('x', data=self._x)
     dat.create_dataset('y', data=self._y)
     dat.create_dataset('countrate', data=self._data['countrates'])
     dat.close()
    def save(self, meta=""):
        CyclopeanInstrument.save(self, meta)

        from wp_toolbox import qtlab_data
        qtlab_data.save(self.get_name(),
                        meta,
                        x__x__um=self._x,
                        y__y__um=self._y,
                        z__counts__Hz=self._data)
Beispiel #16
0
    def _start_running(self):
        CyclopeanInstrument._start_running(self)

        # make sure the counter is off.
        if self._counters.get_is_running():
            self._counter_was_running = True
            self._counters.set_is_running(False)
        
        self.setup_data()
        self._current_line = 0
        self._last_line = 0
        self._next_line()
    def _start_running(self):
        CyclopeanInstrument._start_running(self)

        # make sure the counter is off.
        if self._counters.get_is_running():
            self._counter_was_running = True
            self._counters.set_is_running(False)

        self.setup_data()
        self._current_line = 0
        self._last_line = 0
        self._next_line()
Beispiel #18
0
    def __init__(self, name, adwin):
        """
        Parameters:
            adwin : string
                qtlab-name of the adwin instrument to be used
        """
        CyclopeanInstrument.__init__(self, name, tags=['measure'])

        # relevant parameters
        self.add_parameter('countrate',
                           flags=Instrument.FLAG_GET,
                           units='Hz',
                           type=types.FloatType,
                           tags=['measure'],
                           channels=('cntr1', 'cntr2', 'cntr3'),
                           channel_prefix='%s_',
                           doc="""
                           Returns the count rates for all counters.
                           """)
        self.add_parameter('integration_time',
                           flags=Instrument.FLAG_GETSET,
                           units='ms',
                           minval=1,
                           maxval=1e6,
                           type=types.IntType)
        self.add_parameter('avg_periods',
                           flags=Instrument.FLAG_GETSET,
                           minval=1,
                           maxval=1e6,
                           type=types.IntType)

        # init parameters
        self._countrate = {'cntr1': 0.0, 'cntr2': 0.0, 'cntr3': 0.0}
        self._integration_time = 1
        self._avg_periods = 100

        # instruments we need to access
        self._ins_adwin = qt.instruments[adwin]

        # cyclopean features
        self._supported = {
            'get_running': True,
            'get_recording': True,
            'set_running': True,
            'set_recording': False,
            'save': False,
        }

        self._busy = False
    def save(self, meta=""):
        CyclopeanInstrument.save(self, meta)

        import qt
        qt.mstart()
        data = qt.Data(name='dummy 2D scan')
        data.add_coordinate('x [um]')
        data.add_coordinate('y [um]')
        data.add_value('counts [Hz]')
        data.create_file()
        for i in range(self._xsteps):
            for j in range(self._ysteps):
                data.add_data_point(self._x[i], self._y[j], self._data[j, i])
            data.new_block()
        data.close_file()
        qt.mend()
Beispiel #20
0
    def _start_running(self):
        CyclopeanInstrument._start_running(self)

        # determine points of the line
        self._points = zeros((len(self._dimensions), self._steps))

        for i,d in enumerate(self._dimensions):

	    self._points[i,:] = linspace(self._starts[i], self._stops[i],self._steps)


        # start the linescan
        if not self._mos.linescan_start(self._dimensions, self._starts, 
                self._stops, self._steps, self._px_time, 
                value=self._scan_value):
            self.set_is_running(False)
Beispiel #21
0
    def save(self, meta=""):
        CyclopeanInstrument.save(self, meta)

        import qt
        qt.mstart()
        data = qt.Data(name='dummy 2D scan')
        data.add_coordinate('x [um]')
        data.add_coordinate('y [um]')
        data.add_value('counts [Hz]')
        data.create_file()
        for i in range(self._xsteps):
            for j in range(self._ysteps):
                data.add_data_point(self._x[i], self._y[j], self._data[j,i])
            data.new_block()
        data.close_file()
        qt.mend()
Beispiel #22
0
    def _start_running(self):
        CyclopeanInstrument._start_running(self)

        # initalize data field and set current status (i.e, empty)
        # general feature for scan: data for points
        #
        # create a field of correct shape; each line, in whatever form
        # specified via starts and stops gets their own points
        pts_shape = list(self._linescan_starts.shape)
        pts_shape.append(self._linescan_steps)
        pts = zeros(tuple(pts_shape))

        dim_lines = zeros(self._linescan_starts.shape)
        dim_lines_flat = dim_lines.flat

        # index gets incremented after the item is being read out, so we
        # start populating before the first readout and stop before the
        # last one
        ndx = dim_lines_flat.coords
        pts[ndx] = linspace(self._linescan_starts[ndx],
                            self._linescan_stops[ndx], self._linescan_steps)

        # line index of course without the dimensions in which we scan
        self._current_line = ndx[:-1]

        # print self._current_line

        for i in dim_lines_flat:
            i = linspace(self._linescan_starts[ndx], self._linescan_stops[ndx],
                         self._linescan_steps)

            if dim_lines_flat.index < dim_lines.size:
                ndx = dim_lines_flat.coords
                pts[ndx] = linspace(self._linescan_starts[ndx],
                                    self._linescan_stops[ndx],
                                    self._linescan_steps)

        self._data['points'] = pts

        # set up correct data field, to be implemented by user
        self._setup_data()

        # hook up linescanner changes
        self._linescan.connect('changed', self._linescan_update)

        # now start the actual scanning
        self._next_line()
Beispiel #23
0
    def _start_running(self):
        CyclopeanInstrument._start_running(self)

        # initalize data field and set current status (i.e, empty)
        # general feature for scan: data for points
        #
        # create a field of correct shape; each line, in whatever form
        # specified via starts and stops gets their own points
        pts_shape = list(self._linescan_starts.shape)
        pts_shape.append(self._linescan_steps)
        pts = zeros(tuple(pts_shape))

        dim_lines = zeros(self._linescan_starts.shape)
        dim_lines_flat = dim_lines.flat
        
        # index gets incremented after the item is being read out, so we
        # start populating before the first readout and stop before the
        # last one
        ndx = dim_lines_flat.coords
        pts[ndx] = linspace(self._linescan_starts[ndx],
               self._linescan_stops[ndx], self._linescan_steps)

        # line index of course without the dimensions in which we scan
        self._current_line = ndx[:-1]

        # print self._current_line
        
        for i in dim_lines_flat:
            i = linspace(self._linescan_starts[ndx],
                self._linescan_stops[ndx], self._linescan_steps)
             
            if dim_lines_flat.index < dim_lines.size:
                ndx = dim_lines_flat.coords
                pts[ndx] = linspace(self._linescan_starts[ndx],
                       self._linescan_stops[ndx], self._linescan_steps)
        
        self._data['points'] = pts

        # set up correct data field, to be implemented by user
        self._setup_data()

        # hook up linescanner changes
        self._linescan.connect('changed', self._linescan_update)

        # now start the actual scanning
        self._next_line()
    def __init__(self, name, adwin):
        """
        Parameters:
            adwin : string
                qtlab-name of the adwin instrument to be used
        """
        CyclopeanInstrument.__init__(self, name, tags=['measure'])
        
        # relevant parameters
        self.add_parameter('countrate',
                           flags=Instrument.FLAG_GET,
                           units='Hz',
                           tags=['measure'],
                           channels=('cntr1', 'cntr2'),
                           channel_prefix='%s_',
                           doc="""
                           Returns the count rates for all counters.
                           """)
        self.add_parameter('integration_time',
                flags=Instrument.FLAG_GETSET,
                units='ms',
                minval=1,
                maxval=1e6)
        self.add_parameter('avg_periods',
                flags=Instrument.FLAG_GETSET,
                minval=1,
                maxval=1e6)

        # init parameters
        self._countrate = {'cntr1': 0.0, 'cntr2': 0.0, }
        self._integration_time = 1
        self._avg_periods = 100
        
        # instruments we need to access
        self._ins_adwin = qt.instruments[adwin]

        # cyclopean features
        self._supported = {
            'get_running': True,
            'get_recording': True,
            'set_running': True,
            'set_recording': False,
            'save': False,
            }

        self._busy = False
    def __init__(self, name, use={}):
        CyclopeanInstrument.__init__(self, name, tags=[], use=use)
        
        self._supported = {
            'get_running': False,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': False,
            }

        self.add_parameter('keyword',
                           type = types.StringType,
                           flags=Instrument.FLAG_GETSET,
                           units='' )

        self.add_function('set_control_variable')
        self.add_function('get_control_variable')
Beispiel #26
0
    def __init__(self, name, use={}):
        CyclopeanInstrument.__init__(self, name, tags=[], use=use)

        self._supported = {
            'get_running': False,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': False,
        }

        self.add_parameter('keyword',
                           type=types.StringType,
                           flags=Instrument.FLAG_GETSET,
                           units='')

        self.add_function('set_control_variable')
        self.add_function('get_control_variable')
Beispiel #27
0
    def __init__(self, name, linescan, mos):
        CyclopeanInstrument.__init__(self, name, tags=['measure'])

        self._mos = qt.instruments[mos]
        self._linescan = qt.instruments[linescan]


        # add the relevant parameters for a scanner based on line scans
        self.add_parameter('linescan_dimensions',
                type=types.TupleType,
                flags=Instrument.FLAG_GETSET)

        self.add_parameter('linescan_px_time', 
                type=types.FloatType,
                flags=Instrument.FLAG_GETSET,
                units='ms')

        self.add_parameter('linescan_steps',
                type=types.IntType,
                flags=Instrument.FLAG_GETSET)

        self.add_parameter('linescan_starts',
                type=types.ListType,
                flags=Instrument.FLAG_GETSET)

        self.add_parameter('linescan_stops',
                type=types.ListType,
                flags=Instrument.FLAG_GETSET)
         
        self.add_parameter('current_line',
                type=types.TupleType,
                flags=Instrument.FLAG_GET)
 

        self._supported = {
            'get_running': True,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': True,
            }

        # initialize vars
        self._current_line = ()
Beispiel #28
0
    def __init__(self, name, linescan, mos):
        CyclopeanInstrument.__init__(self, name, tags=['measure'])
     
        self._mos = qt.instruments[mos]
        self._linescan = qt.instruments[linescan]


        # add the relevant parameters for a scanner based on line scans
        self.add_parameter('linescan_dimensions',
                type=types.TupleType,
                flags=Instrument.FLAG_GETSET)

        self.add_parameter('linescan_px_time', 
                type=types.FloatType,
                flags=Instrument.FLAG_GETSET,
                units='ms')

        self.add_parameter('linescan_steps',
                type=types.IntType,
                flags=Instrument.FLAG_GETSET)

        self.add_parameter('linescan_starts',
                type=types.ListType,
                flags=Instrument.FLAG_GETSET)

        self.add_parameter('linescan_stops',
                type=types.ListType,
                flags=Instrument.FLAG_GETSET)
         
        self.add_parameter('current_line',
                type=types.TupleType,
                flags=Instrument.FLAG_GET)
 

        self._supported = {
            'get_running': True,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': True,
            }

        # initialize vars
        self._current_line = ()
Beispiel #29
0
    def _start_running(self):
        CyclopeanInstrument._start_running(self)

        # determine points of the line
        self._points = zeros((len(self._dimensions), self._steps))

        for i, d in enumerate(self._dimensions):

            self._points[i, :] = linspace(self._starts[i], self._stops[i],
                                          self._steps)

        # start the linescan
        if not self._mos.linescan_start(self._dimensions,
                                        self._starts,
                                        self._stops,
                                        self._steps,
                                        self._px_time,
                                        value=self._scan_value):
            self.set_is_running(False)
    def __init__(self, name, address=None):
        CyclopeanInstrument.__init__(self, name, tags=[])

        self._supported = {
            'get_running': False,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': False,
            }

        self.add_parameter('doubleSpinBox_start_F',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0.0,
                           maxval=99.0,
                           doc='')
        self._doubleSpinBox_start_F = 0.0

        self.add_parameter('doubleSpinBox_stop_f',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0.0,
                           maxval=99.0,
                           doc='')
        self._doubleSpinBox_stop_f = 0.0

        self.add_parameter('doubleSpinBox_step_f',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0.0,
                           maxval=99.0,
                           doc='')
        self._doubleSpinBox_step_f = 0.0

        self.add_function('start_scan_button')

        self.add_function('stop_scan_button')

        self.add_function('save_scan_button')
    def _start_running(self):
        CyclopeanInstrument._start_running(self)
        # determine points of the line in x/y space
        self._ins_ADwin.Start_Process(2)
        while self._ins_ADwin.Process_Status(2) > 0:
            #            qt.msleep(0.1)
            time.sleep(0.01)

        channel = self._ins_ADwin_count.get_channel()

        if channel < 5:
            self._values = self._ins_ADwin.Get_Data_Long(
                channel, 1, self._nr_of_points)
        elif channel == 5:
            self._values = numpy.add(
                self._ins_ADwin.Get_Data_Long(1, 1, self._nr_of_points),
                self._ins_ADwin.Get_Data_Long(2, 1, self._nr_of_points))

        self.get_values()

        self.do_set_is_running(False)
    def __init__(self, name, address=None):
        CyclopeanInstrument.__init__(self, name, tags=[])

        self._supported = {
            'get_running': False,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': False,
        }

        self.add_parameter('t_range',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0,
                           maxval=99,
                           doc='')
        self._t_range = 0

        self.add_parameter('integration_time',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0,
                           maxval=99,
                           doc='')
        self._integration_time = 0

        self.add_parameter('countrate',
                           type=types.IntType,
                           flags=Instrument.FLAG_GET,
                           units='',
                           doc='')
        self._countrate = 0

        self.set_is_running(True)
    def __init__(self, name, address=None):
        CyclopeanInstrument.__init__(self, name, tags=[])

        self._supported = {
            'get_running': False,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': False,
            }

        self.add_parameter('t_range',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0,
                           maxval=99,
                           doc='')
        self._t_range = 0

        self.add_parameter('integration_time',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0,
                           maxval=99,
                           doc='')
        self._integration_time = 0

        self.add_parameter('countrate',
                           type=types.IntType,
                           flags=Instrument.FLAG_GET,
                           units='',
                           doc='')
        self._countrate = 0

        self.set_is_running(True)
    def __init__(self, name, jpe, adwin, laser, use_cfg=False, **kw):
        CyclopeanInstrument.__init__(self, name, tags=[])

        self._laser = qt.instruments[laser]
        self._adwin = qt.instruments[adwin]
        self._jpe_cadm = qt.instruments[jpe]

        self._laser_updated = False

        print 'Initializing master_of_cavity... '

        self.add_parameter('address',
                           flags=Instrument.FLAG_GETSET,
                           type=types.IntType)
        self.address = 1

        self.add_parameter('temperature',
                           flags=Instrument.FLAG_GETSET,
                           units='K',
                           type=types.IntType,
                           minval=0,
                           maxval=300)
        self.temperature = 300

        self.add_parameter('JPE_freq',
                           flags=Instrument.FLAG_GETSET,
                           units='Hz',
                           type=types.IntType,
                           minval=0,
                           maxval=600)
        self.JPE_freq = 100

        self.add_parameter('rel_step_size',
                           flags=Instrument.FLAG_GETSET,
                           units='%',
                           type=types.IntType,
                           minval=0,
                           maxval=100)
        self.rel_step_size = 30

        self.add_parameter('track_curr_x',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GET,
                           units='nm')
        self.add_parameter('track_curr_y',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GET,
                           units='nm')
        self.add_parameter('track_curr_z',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GET,
                           units='nm')

        self.addr = 1
        self.ch_x = 1
        self.ch_y = 2
        self.ch_z = 3
        # self._jpe_tracker = JPE_pos_tracker(reinit_spindles=False)
        self._step_size = None
        self._fine_piezos = [
            'jpe_fine_tuning_1', 'jpe_fine_tuning_2', 'jpe_fine_tuning_3'
        ]
        #self.set_fine_piezo_voltages(0,0,0)

        # Init that was originally in the JPE_pos_tracker.
        # all coordinates are in mm, angles in radians
        # the number of spindle rotations for z1,z2,z3
        self.track_z1 = 0
        self.track_z2 = 0
        self.track_z3 = 0

        #design properties in mm (see JPE Interface drawings).
        self.cfg_pars = moc_cfg.config['moc_cav1']
        self.fiber_z_offset = self.cfg_pars[
            'fiber_z_offset']  #fiber offset with respect to fiber interface
        self.h = self.cfg_pars[
            'h_mm'] + self.fiber_z_offset  #33.85+self.fiber_z_offset
        self.R = self.cfg_pars['R_mm']  #14.5
        self.max_spindle_steps = self.cfg_pars['max_spindle_steps']

        #Cartesian coordinates in the lab-frame (mm)
        self.track_curr_x = 0
        self.track_curr_y = 0
        self.track_curr_z = 0
        self.track_v_piezo_1 = None
        self.track_v_piezo_2 = None
        self.track_v_piezo_3 = None
        self.tracker_file_name = 'D:\measuring\measurement\config\jpe_tracker.npz'

        reinit_spindles = kw.pop('reinit_spindles', False)
        if reinit_spindles:
            self.reset_spindle_tracker()
        else:
            print 'Tracker initialized from file...'
            self.tracker_file_readout()

        #variable properties are saved in the cfg file
        if use_cfg:
            cfg_fn = os.path.join(qt.config['ins_cfg_path'], name + '.cfg')
            if not os.path.exists(cfg_fn):
                _f = open(cfg_fn, 'w')
                _f.write('')
                _f.close()
            self.ins_cfg = config.Config(cfg_fn)
            self.load_cfg()
            self.save_cfg()

        # remote access functions:
        self.add_function('get_params')
        self.add_function('get_track_z')
        self.add_function('status')
        #position control function
        self.add_function('step')
        self.add_function('set_as_origin')
        self.add_function('move_to_xyz')
        self.add_function('set_fine_piezo_voltages')
        self.add_function('move_spindle_steps')
    def __init__(self, name, address=None):
        CyclopeanInstrument.__init__(self, name, tags=[])

        self._supported = {
            'get_running': False,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': False,
            }

        self.add_parameter('test_value',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=1,
                           maxval=100,
                           doc='')
        self._test_value = 10

        self.add_parameter('float_test_value',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GET,
                           units='',
                           minval=0.0,
                           maxval=99.0,
                           doc='')
        self._float_test_value = 0.0

        self.add_parameter('string_test_value',
                           type=types.StringType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           doc='')
        self._string_test_value = 'Test'

        self.add_parameter('slider_value',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0,
                           maxval=99,
                           doc='')
        self._slider_value = 0

        self.add_parameter('check_value',
                           type=types.BooleanType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           doc='')
        self._check_value = False

        self.add_parameter('radio1',
                           type=types.BooleanType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           doc='')
        self._radio1 = True

        self.add_parameter('radio2',
                           type=types.BooleanType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           doc='')
        self._radio2 = False

        self.add_parameter('radio3',
                           type=types.BooleanType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           doc='')
        self._radio3 = False

        self.add_function('do_something')

        self.add_function('do_something_else')
    def __init__(self, name, address=None):
        CyclopeanInstrument.__init__(self, name, tags=[])

        self._supported = {
            'get_running': False,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': False,
        }

        self.add_parameter('keyword',
                           type=types.StringType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           doc='')
        self._keyword = ''

        self.add_parameter('x',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=-100.000000000000000,
                           maxval=100.000000000000000,
                           doc='')
        self._x = 0.0

        self.add_parameter('y',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=-100.000000000000000,
                           maxval=100.000000000000000,
                           doc='')
        self._y = 0.0

        self.add_parameter('z',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0.0,
                           maxval=100.000000000000000,
                           doc='')
        self._z = 0.0

        self.add_parameter('z_slider',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0,
                           maxval=400,
                           doc='')
        self._z_slider = 500

        self.add_parameter('step',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0.0,
                           maxval=99.0,
                           doc='')
        self._step = 1.000000000000000

        self.add_function('step_up')

        self.add_function('step_left')

        self.add_function('step_right')

        self.add_function('step_down')
Beispiel #37
0
    def __init__(self, name):
        CyclopeanInstrument.__init__(self, name, tags=['measure'])

        # also get the counter, need to disable when linescanning
        self._counters = qt.instruments['counters_demo']
        self._counter_was_running = False

        # add the relevant parameters for a 2D PL scanner
        self.add_parameter('pixel_time', type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='ms',
                           minval=1.0, maxval=99.0,
                           doc="""
                           Integration time per image pixel.
                           """)

        self.add_parameter('xstart',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='um')
        
        self.add_parameter('xstop',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='um')
        
        self.add_parameter('ystart',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='um')
        
        self.add_parameter('ystop',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='um')
        
        self.add_parameter('xsteps',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='')
        
        self.add_parameter('ysteps',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='')
        
        self.add_parameter('last_line_index',
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='',
                           doc="""
                           Returns the index of the last line of which data 
                           is available.
                           """)
        
        self.add_parameter('last_line',
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='cps',
                           doc="""
                           Returns the last line of the measured data.
                           """)
        
        self.add_parameter('counter',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET)


        # relevant functions to be visible outside
        self.add_function('get_line')
        self.add_function('get_lines')
        self.add_function('get_x')
        self.add_function('get_y')
        self.add_function('get_data')
        self.add_function('setup_data')
        # self.add_function('move_abs_xy')

        # default params
        self.set_pixel_time(1.0)
        self.set_xstart(-2.0)
        self.set_xstop(2.0)
        self.set_ystart(-2.0)
        self.set_ystop(2.0)
        self.set_xsteps(11)
        self.set_ysteps(11)
        self.set_counter(1)  
          
        # more set up
        self.setup_data()        
        self._current_line = 0
        self._last_line = 0
        self._busy = False

        self._supported = {
            'get_running': True,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': True,
            }
    def __init__(self, name):
        CyclopeanInstrument.__init__(self, name, tags=['measure'])

        # also get the counter, need to disable when linescanning
        self._counters = qt.instruments['counters_demo']
        self._counter_was_running = False

        # add the relevant parameters for a 2D PL scanner
        self.add_parameter('pixel_time',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='ms',
                           minval=1.0,
                           maxval=99.0,
                           doc="""
                           Integration time per image pixel.
                           """)

        self.add_parameter('xstart',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='um')

        self.add_parameter('xstop',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='um')

        self.add_parameter('ystart',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='um')

        self.add_parameter('ystop',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='um')

        self.add_parameter('xsteps',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='')

        self.add_parameter('ysteps',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='')

        self.add_parameter('last_line_index',
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='',
                           doc="""
                           Returns the index of the last line of which data 
                           is available.
                           """)

        self.add_parameter('last_line',
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='cps',
                           doc="""
                           Returns the last line of the measured data.
                           """)

        self.add_parameter('counter',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET)

        # relevant functions to be visible outside
        self.add_function('get_line')
        self.add_function('get_lines')
        self.add_function('get_x')
        self.add_function('get_y')
        self.add_function('get_data')
        self.add_function('setup_data')
        # self.add_function('move_abs_xy')

        # default params
        self.set_pixel_time(1.0)
        self.set_xstart(-2.0)
        self.set_xstop(2.0)
        self.set_ystart(-2.0)
        self.set_ystop(2.0)
        self.set_xsteps(11)
        self.set_ysteps(11)
        self.set_counter(1)

        # more set up
        self.setup_data()
        self._current_line = 0
        self._last_line = 0
        self._busy = False

        self._supported = {
            'get_running': True,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': True,
        }
    def __init__(self, name, address=None):
        CyclopeanInstrument.__init__(self, name, tags=["positioner", "virtual"])

        self.add_parameter(
            "X_position", type=types.FloatType, flags=Instrument.FLAG_GETSET, units="um", format="%.03f, %.03f"
        )

        self.add_parameter(
            "Y_position", type=types.FloatType, flags=Instrument.FLAG_GETSET, units="um", format="%.03f, %.03f"
        )

        self.add_parameter(
            "Z_position", type=types.FloatType, flags=Instrument.FLAG_GETSET, units="um", format="%.03f, %.03f"
        )

        self.add_parameter(
            "speed",
            type=types.FloatType,
            flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
            format="%.01f, %.01f",
            units="V/s",
        )

        self.add_parameter("LT", type=types.IntType, flags=Instrument.FLAG_GETSET, minval=0, maxval=1)

        #        self.add_function('move_abs_xy')

        self._X_position = 0.0
        self._Y_position = 0.0
        self._Z_position = 0.0
        self._speed = 1.0
        self._LT = 0  # set to 1 for low temperature operation

        self._max_x_RT = 40.0  # micrometer
        self._max_y_RT = self._max_x_RT  # micrometer
        self._max_z_RT = 24.0  # micrometer
        self._cal_x_RT = 107.0  # mV/micrometer
        self._cal_y_RT = self._cal_x_RT  # mV/micrometer
        self._cal_z_RT = 171.4  # mV/micrometer
        self._max_V_RT = 4.29  # Volt
        self._max_x_LT = 30.0  # micrometer
        self._max_y_LT = self._max_x_LT  # micrometer
        self._max_z_LT = 15.0  # micrometer
        self._cal_x_LT = 357.0  # mV/micrometer
        self._cal_y_LT = self._cal_x_LT  # mV/micrometer
        self._cal_z_LT = 714.3  # mV/micrometer
        self._max_V_LT = 10.0  # Volt

        self._max_speed = 1.0  # V/s

        self._supported = {
            "get_running": False,
            "get_recording": False,
            "set_running": False,
            "set_recording": False,
            "save": False,
        }

        import qt

        self._ins_ADwin = qt.instruments["ADwin"]
        self._ins_ADwin.Load("D:\\Lucio\\AdWin codes\\ADwin_Gold_II\\cursor_move.tb0")
        if self._speed <= self._max_speed:
            self._ins_ADwin.Set_FPar(29, self._speed * 1000.0)
        else:
            self._ins_ADwin.Set_FPar(29, self._max_speed * 1000.0)

        self.set_speed(1.0)
Beispiel #40
0
    def __init__(self, name, adwin, dimension_set):
        """
        Parameters:
            adwin : string
                qtlab-name of the adwin instrument to be used
        """
        CyclopeanInstrument.__init__(self, name, tags=['positioner'])
        self._adwin = qt.instruments[adwin]
	
       # should not change often, hardcode is fine for now
        self.rt_dimensions = moscfg.config[dimension_set]['rt_dimensions']

         
        self.lt_dimensions = moscfg.config[dimension_set]['lt_dimensions']
        
        self.dimensions = self.rt_dimensions


        # auto generate parameters incl set and get for all dimensions
        self._make_get_set()

        # scan control
        self._linescan_running = False
        self._linescan_px_clock = 0

        self.add_parameter('linescan_running',
                type=types.BooleanType,
                flags=Instrument.FLAG_GET)
        self.add_parameter('linescan_px_clock',
                type=types.IntType,
                flags=Instrument.FLAG_GET)

        self.add_function('linescan_start')

        # for positioning with attocubes
        self.add_parameter('lt_settings',
                type=types.BooleanType,
                flags=Instrument.FLAG_GETSET)
        self._lt_settings = False
        
        # managing the coordinate system
        self.add_function('set_origin')
        self.add_function('get_origin')
        self.add_function('from_relative')
        self.add_function('to_relative')
        self.add_function('set_relative_position')
        self.add_function('get_relative_position')
        self.add_function('move_to_xyz_pos')

        # markers
        self._markers = {}
        self.add_function('set_marker')
        self.add_function('get_marker')
        self.add_function('get_markers')
        self.add_function('goto_marker')
        self.add_function('push_position')
        self.add_function('pop_position')
        self.add_function('init_positions_from_adwin_dacs')
        
        # set up config file
        cfg_fn = os.path.join(qt.config['ins_cfg_path'], name+'.cfg')
        if not os.path.exists(cfg_fn):
            _f = open(cfg_fn, 'w')
            _f.write('')
            _f.close()

        self.ins_cfg = config.Config(cfg_fn)     
        self.load_cfg()
        self.save_cfg()

        self.init_positions_from_adwin_dacs()
    def __init__(self, name, adwin):
        """
        Parameters:
            adwin : string
                qtlab-name of the adwin instrument to be used
        """
        CyclopeanInstrument.__init__(self, name, tags=['positioner'])
        self._adwin = qt.instruments[adwin]

        # should not change often, hardcode is fine for now
        self.rt_dimensions = {
            'x': {
                'dac': 'atto_x',
                'micron_per_volt': 9.324,
                'max_v': 4.29,
                'min_v': 0.,
                'default': 0.,
                'origin': 0.,
            },
            'z': {
                'dac': 'atto_z',
                'micron_per_volt': 5.59,
                'min_v': 0.,
                'max_v': 4.29,
                'default': 0.,
                'origin': 0.,
            },
            'y': {
                'dac': 'atto_y',
                'micron_per_volt': 9.324,
                'max_v': 4.29,
                'min_v': 0.,
                'default': 0.,
                'origin': 0.,
            },
        }

        self.lt_dimensions = {
            'x': {
                'dac': 'atto_x',
                'micron_per_volt': 2.8,
                'max_v': 10,
                'min_v': 0.,
                'default': 0.,
                'origin': 0.,
            },
            'z': {
                'dac': 'atto_z',
                'micron_per_volt': 1.40,
                'min_v': 0.,
                'max_v': 10,
                'default': 0.,
                'origin': 0.,
            },
            'y': {
                'dac': 'atto_y',
                'micron_per_volt': 2.8,
                'max_v': 10,
                'min_v': 0.,
                'default': 0.,
                'origin': 0.,
            },
        }

        self.dimensions = self.rt_dimensions

        # auto generate parameters incl set and get for all dimensions
        for d in self.dimensions:
            dim = self.dimensions[d]

            # make set and get
            self._make_get(d)
            self._make_set(d)

            # make stepping function
            self._make_stepfunc(d)

            # register parameter (set and get need to exist already)
            self.add_parameter(
                d,
                type=types.FloatType,
                flags=Instrument.FLAG_GETSET,
                units='um',
                minval=dim['min_v'] * dim['micron_per_volt'],
                maxval=dim['max_v'] * dim['micron_per_volt'],
            )

            # register the step function
            self.add_function('step_' + d)

        # scan control
        self._linescan_running = False
        self._linescan_px_clock = 0

        self.add_parameter('linescan_running',
                           type=types.BooleanType,
                           flags=Instrument.FLAG_GET)
        self.add_parameter('linescan_px_clock',
                           type=types.IntType,
                           flags=Instrument.FLAG_GET)

        self.add_function('linescan_start')

        # for positioning with attocubes
        self.add_parameter('lt_settings',
                           type=types.BooleanType,
                           flags=Instrument.FLAG_GETSET)
        self._lt_settings = False

        # managing the coordinate system
        self.add_function('set_origin')
        self.add_function('get_origin')
        self.add_function('from_relative')
        self.add_function('to_relative')
        self.add_function('set_relative_position')
        self.add_function('get_relative_position')
        self.add_function('move_to_xyz_pos')

        # markers
        self._markers = {}
        self.add_function('set_marker')
        self.add_function('get_marker')
        self.add_function('get_markers')
        self.add_function('goto_marker')
        self.add_function('push_position')
        self.add_function('pop_position')

        # set up config file
        cfg_fn = os.path.join(qt.config['ins_cfg_path'], name + '.cfg')
        if not os.path.exists(cfg_fn):
            _f = open(cfg_fn, 'w')
            _f.write('')
            _f.close()

        self.ins_cfg = config.Config(cfg_fn)
        self.load_cfg()
        self.save_cfg()

        # set initial position values (need to know whether LT or RT settings)
        for d in self.dimensions:
            dim = self.dimensions[d]
            voltage = self._adwin.get_dac_voltage(dim['dac'])
            position = voltage * dim['micron_per_volt']
            setattr(self, '_' + d, position)
    def __init__(self, name, address=None):
        CyclopeanInstrument.__init__(self, name, tags=[])

        self._supported = {
            'get_running': False,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': False,
            }

        self.add_parameter('keyword',
                           type=types.StringType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           doc='')
        self._keyword = '' 

        self.add_parameter('x',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=-100.000000000000000,
                           maxval=100.000000000000000,
                           doc='')
        self._x = 0.0

        self.add_parameter('y',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=-100.000000000000000,
                           maxval=100.000000000000000,
                           doc='')
        self._y = 0.0

        self.add_parameter('z',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0.0,
                           maxval=100.000000000000000,
                           doc='')
        self._z = 0.0

        self.add_parameter('z_slider',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0,
                           maxval=400,
                           doc='')
        self._z_slider = 500

        self.add_parameter('step',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0.0,
                           maxval=99.0,
                           doc='')
        self._step = 1.000000000000000

        self.add_function('step_up')

        self.add_function('step_left')

        self.add_function('step_right')

        self.add_function('step_down')
Beispiel #43
0
    def __init__(self, name, adwin, powermeter, parent=None):
        CyclopeanInstrument.__init__(self, name, tags=[])

        self._adwin = qt.instruments[adwin]
        self._pmeter = qt.instruments[powermeter]

        self.dac_no = 8
        self.adc_no = 2

        self.i = 0

        self.sampling_interval = 100

        self.add_parameter('plot_DFG_values',
                           flags=Instrument.FLAG_GET,
                           units='uW',
                           tags=['measure'],
                           channels=('temperature_channel', 'dfg_channel'),
                           channel_prefix='%s_',
                           doc="""
                           Returns the measured temperature and dfg power
                           """)
        self._plot_DFG_values = {
            'temperature_channel': 0.0,
            'dfg_channel': 0.0,
        }

        self.add_parameter('curr_temperature',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='deg',
                           minval=-20,
                           maxval=120)
        self.curr_temperature = 0

        self.add_parameter('knob_temperature',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='deg',
                           minval=-20,
                           maxval=120)
        self.knob_temperature = 0

        self.add_parameter('DFG_power',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='muW',
                           minval=0,
                           maxval=2000)
        self.DFG_power = 0

        self.add_parameter('target_temperature',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='deg',
                           minval=-50,
                           maxval=120)
        self.target_temperature = 0.00

        self.add_parameter('set_temperature',
                           type=types.FloatType,
                           flags=Instrument.FLAG_SET,
                           units='deg',
                           minval=-50,
                           maxval=120)
        self.set_temperature = 0.00

        self.add_parameter('plot_temperature',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='deg',
                           minval=-50,
                           maxval=120)
        self.plot_temperature = 0.00

        self.add_parameter('plot_dfg',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='uW',
                           minval=-50,
                           maxval=120)
        self.plot_dfg = 0.00

        self.add_parameter('Tmin',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='deg',
                           minval=-50,
                           maxval=120)
        self.Tmin = 0.00

        self.add_parameter('Tmax',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='deg',
                           minval=-50,
                           maxval=120)
        self.Tmax = 0.00

        self.add_parameter('nsteps',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           minval=0,
                           maxval=1000)
        self.nsteps = 0

        self.add_parameter('dwell_time',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='us',
                           minval=0,
                           maxval=1000)
        self.dwell_time = 0

        # self.add_function('apply_voltage')

        self.add_function('read_temperature')

        self.add_function('read_DFG_power')

        # self.add_function('readNset_target')

        self.add_function('start_running')

        # self.add_function('display_values')

        self.add_function('check_knob_temperature')
    def __init__(self, name, adwin, dimension_set):
        """
        Parameters:
            adwin : string
                qtlab-name of the adwin instrument to be used
        """
        CyclopeanInstrument.__init__(self, name, tags=['positioner'])
        self._adwin = qt.instruments[adwin]
	
       # should not change often, hardcode is fine for now
        self.rt_dimensions = moscfg.config[dimension_set]['rt_dimensions']
         
        self.lt_dimensions = moscfg.config[dimension_set]['lt_dimensions']
        
        self.dimensions = self.rt_dimensions


        # auto generate parameters incl set and get for all dimensions
        self._make_get_set()

        # scan control
        self._linescan_running = False
        self._linescan_px_clock = 0

        self.add_parameter('linescan_running',
                type=types.BooleanType,
                flags=Instrument.FLAG_GET)
        self.add_parameter('linescan_px_clock',
                type=types.IntType,
                flags=Instrument.FLAG_GET)

        self.add_function('linescan_start')

        # for positioning with attocubes
        self.add_parameter('lt_settings',
                type=types.BooleanType,
                flags=Instrument.FLAG_GETSET)
        self._lt_settings = False
        
        # managing the coordinate system
        self.add_function('set_origin')
        self.add_function('get_origin')
        self.add_function('from_relative')
        self.add_function('to_relative')
        self.add_function('set_relative_position')
        self.add_function('get_relative_position')
        self.add_function('move_to_xyz_pos')

        # markers
        self._markers = {}
        self.add_function('set_marker')
        self.add_function('get_marker')
        self.add_function('get_markers')
        self.add_function('goto_marker')
        self.add_function('push_position')
        self.add_function('pop_position')
        self.add_function('init_positions_from_adwin_dacs')
        
        # set up config file
        cfg_fn = os.path.join(qt.config['ins_cfg_path'], name+'.cfg')
        if not os.path.exists(cfg_fn):
            _f = open(cfg_fn, 'w')
            _f.write('')
            _f.close()

        self.ins_cfg = config.Config(cfg_fn)     
        self.load_cfg()
        self.save_cfg()

        self.init_positions_from_adwin_dacs()
    def save(self, meta=""):  # inherited doesn't do any saving. Implement.
        CyclopeanInstrument.save(self, meta)

        return
    def save(self, meta=""): # inherited doesn't do any saving. Implement.
        CyclopeanInstrument.save(self, meta)

        return
    def __init__(self, name, address=None):
        CyclopeanInstrument.__init__(self,
                                     name,
                                     tags=['measure', 'generate', 'virtual'])

        # add the relevant parameters for a 2D PL scanner
        self.add_parameter('pixel_time',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='ms',
                           minval=1,
                           maxval=1000,
                           doc="""
                           Integration time per image pixel.
                           """)

        self.add_parameter('xstart',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           minval=0.0,
                           maxval=50.0,
                           units='um')

        self.add_parameter('xstop',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           minval=0.0,
                           maxval=50.0,
                           units='um')

        self.add_parameter('ystart',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           minval=0.0,
                           maxval=50.0,
                           units='um')

        self.add_parameter('ystop',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           minval=0.0,
                           maxval=50.0,
                           units='um')

        self.add_parameter('xsteps',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           minval=2,
                           maxval=1000,
                           units='')

        self.add_parameter('ysteps',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           minval=2,
                           maxval=1000,
                           units='')

        self.add_parameter('data',
                           tags=['measure'],
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='cps',
                           doc="""
                           Returns the full data array, not a single value.
                           The dimensions are given by the scan settings.
                           """)

        self.add_parameter('x',
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='um',
                           doc="""
                           Returns the x coordinates of the data pixels.
                           """)

        self.add_parameter('y',
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='um',
                           doc="""
                           Returns the y coordinates of the data pixels.
                           """)

        self.add_parameter('last_line_index',
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='',
                           doc="""
                           Returns the index of the last line of which data is
                           available.
                           """)

        self.add_parameter('last_line',
                           tags=['measure'],
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='cps',
                           doc="""
                           Returns the last line of the measured data.
                           """)

        # relevant functions to be visible outside
        # a method that gives only a specified range of lines back
        # (minimize data exchange)
        self.add_function('get_line')
        self.add_function('get_lines')

        # method to set up the data field: after setting the scan area, use this
        # to create a data field of appropriate size
        self.add_function('setup_data')

        # default params
        self.set_pixel_time(10)
        self.set_xstart(0.0)
        self.set_xstop(10.0)
        self.set_ystart(0.0)
        self.set_ystop(10.0)
        self.set_xsteps(101)
        self.set_ysteps(101)
        self.set_sampling_interval(500)

        # more set up
        self.setup_data()
        self._current_line = 0
        self._last_line = 0

        # instruments and access functions for the panels
        import qt
        self._ins_linescan = qt.instruments['ADwin_linescan']
        self._ins_pos = qt.instruments['ADwin_pos']
        self._ins_count = qt.instruments['ADwin_count']

        self.add_function('move_abs_xy')

        self._supported = {
            'get_running': True,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': True,
        }

        self._busy = False
        self._counter = False
    def _stop_running(self):
        CyclopeanInstrument._start_running(self)

        return
Beispiel #49
0
 def _start_running(self):
     CyclopeanInstrument._start_running(self)
Beispiel #50
0
    def __init__(self, name, adwin, mos, *arg, **kw):
        """
        Parameters:
            adwin : string
                qtlab-name of the adwin instrument to be used
            mos : string
                qtlab-name of the master of space to be used
        """
        CyclopeanInstrument.__init__(self, name, tags=['measure'])

        # adwin and positioner
        self._adwin = qt.instruments[adwin]
        self._mos = qt.instruments[mos]
        self._scan_value = 'counts'

        # connect the mos to monitor methods
        self._mos.connect('changed', self._mos_changed)

        # params that define the linescan
        self.add_parameter(
            'dimensions',
            type=types.TupleType,
            flags=Instrument.FLAG_GETSET,
            doc="""Sets the names of the dimensions involved, as specified
                in the master of space""")

        self.add_parameter('starts',
                           type=types.TupleType,
                           flags=Instrument.FLAG_GETSET)

        self.add_parameter('stops',
                           type=types.TupleType,
                           flags=Instrument.FLAG_GETSET)

        self.add_parameter('steps',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET)

        self.add_parameter('px_time',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='ms')

        self.add_parameter('scan_value',
                           type=types.StringType,
                           flags=Instrument.FLAG_GETSET)

        self.add_function('get_points')

        self._points = ()
        # self._values = {1: [], 2: []}
        self.set_steps(1)
        self.set_px_time(1)
        self.set_dimensions(())
        self.set_starts(())
        self.set_stops(())
        self.set_scan_value('counts')

        # other vars
        self._px_clock = 0

        self._supported = {
            'get_running': True,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': False,
        }
Beispiel #51
0
    def __init__(self, name, adwin, powermeter, parent=None):
        CyclopeanInstrument.__init__(self, name, tags=[])

        self._adwin = adwin
        self._pmeter = powermeter
    def __init__(self, name, linescan, mos, counters):
        CyclopeanInstrument.__init__(self, name, tags=[])
        self._linescan = qt.instruments[linescan]
        self._mos = qt.instruments[mos]
        self._counters = qt.instruments[counters]
        self._counter_was_running = False

        self.add_parameter('dimension',
                           type=types.StringType,
                           flags=Instrument.FLAG_GETSET)

        self.add_parameter(
            'scan_length',
            type=types.FloatType,
            flags=Instrument.FLAG_GETSET,
            units='um',
        )

        self.add_parameter(
            'pixel_time',
            type=types.FloatType,
            flags=Instrument.FLAG_GETSET,
            units='ms',
        )

        self.add_parameter(
            'nr_of_points',
            type=types.IntType,
            flags=Instrument.FLAG_GETSET,
        )

        self.add_parameter(
            'gaussian_fit',
            type=types.BooleanType,
            flags=Instrument.FLAG_GETSET,
        )

        self.add_parameter(
            'fit_error',
            type=types.ListType,
            flags=Instrument.FLAG_GET,
        )

        self.add_parameter(
            'fit_result',
            type=types.ListType,
            flags=Instrument.FLAG_GET,
        )

        self.add_parameter(
            'opt_pos',
            type=types.FloatType,
            flags=Instrument.FLAG_GET,
        )

        self.add_parameter(
            'counter',
            type=types.IntType,
            flags=Instrument.FLAG_GETSET,
        )

        self.add_parameter(
            'points',
            type=types.ListType,
            flags=Instrument.FLAG_GET,
        )

        ### public functions
        self.add_function('run')

        # set defaults
        self._scan_length = 1.
        self._nr_of_points = 21
        self._pixel_time = 10
        self._gaussian_fit = True
        self._fit_error = []
        self._fit_result = []
        self._opt_pos = 0.
        self._counter = 1
        self._fitdata = []
        self._points = []
        self._busy = False
        self._dimension = 'x'
Beispiel #53
0
    def __init__(self, name, adwin, mos, *arg, **kw):
        """
        Parameters:
            adwin : string
                qtlab-name of the adwin instrument to be used
            mos : string
                qtlab-name of the master of space to be used
        """
        CyclopeanInstrument.__init__(self, name, tags=['measure'])

        # adwin and positioner
        self._adwin = qt.instruments[adwin]
        self._mos = qt.instruments[mos]
        self._scan_value = 'counts'

        # connect the mos to monitor methods
        self._mos.connect('changed', self._mos_changed)

        # params that define the linescan
        self.add_parameter('dimensions', 
                type=types.TupleType,
                flags=Instrument.FLAG_GETSET,
                doc="""Sets the names of the dimensions involved, as specified
                in the master of space""")

        self.add_parameter('starts',
                type=types.TupleType,
                flags=Instrument.FLAG_GETSET)

        self.add_parameter('stops',
                type=types.TupleType,
                flags=Instrument.FLAG_GETSET)
 
        self.add_parameter('steps',
                type=types.IntType,
                flags=Instrument.FLAG_GETSET)

        self.add_parameter('px_time',
                type=types.IntType,
                flags=Instrument.FLAG_GETSET,
                units='ms')

        self.add_parameter('scan_value',
                type=types.StringType,
                flags=Instrument.FLAG_GETSET)

        self.add_function('get_points')

        self._points = ()
        # self._values = {1: [], 2: []}
        self.set_steps(1)
        self.set_px_time(1)
        self.set_dimensions(())
        self.set_starts(())
        self.set_stops(())
        self.set_scan_value('counts')

        # other vars
        self._px_clock = 0

        self._supported = {
            'get_running': True,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': False,
            }
 def save(self, meta=""):
     CyclopeanInstrument.save(self, meta)
    def __init__(self, name, linescan, mos, counters):
        CyclopeanInstrument.__init__(self, name, tags=[])

        self._linescan = qt.instruments[linescan]
        self._mos = qt.instruments[mos]
        self._counters = qt.instruments[counters]
        self._counter_was_running = False
        
        self.add_parameter('dimension',
                type=types.StringType,
                flags=Instrument.FLAG_GETSET)
        
        self.add_parameter('scan_length',
                           type = types.FloatType,
                           flags = Instrument.FLAG_GETSET,
                           units = 'um',)

        self.add_parameter('pixel_time',
                           type = types.FloatType,
                           flags = Instrument.FLAG_GETSET,
                           units = 'ms',) 

        self.add_parameter('nr_of_points',
                           type = types.IntType,
                           flags = Instrument.FLAG_GETSET, )

        self.add_parameter('gaussian_fit',
                           type = types.BooleanType,
                           flags = Instrument.FLAG_GETSET, )

        self.add_parameter('fit_error',
                           type = types.ListType,
                           flags = Instrument.FLAG_GET,)

        self.add_parameter('fit_result',
                           type = types.ListType,
                           flags = Instrument.FLAG_GET,)

        self.add_parameter('opt_pos',
                           type = types.FloatType,
                           flags = Instrument.FLAG_GET,)

        self.add_parameter('counter',
                           type = types.IntType,
                           flags = Instrument.FLAG_GETSET, )

        self.add_parameter('points',
                           type = types.ListType,
                           flags = Instrument.FLAG_GET, )


        ### public functions
        self.add_function('run')

        # set defaults
        self._scan_length = 1.
        self._nr_of_points = 21 
        self._pixel_time = 10
        self._gaussian_fit = True
        self._fit_error = []
        self._fit_result = []
        self._opt_pos = 0.
        self._counter = 1
        self._fitdata = []
        self._points = []
        self._busy = False
        self._dimension = 'x'
Beispiel #56
0
    def __init__(self, name, address=None):
        CyclopeanInstrument.__init__(self, name,
                                     tags=['measure', 'generate', 'virtual'])

        # add the relevant parameters for a 2D PL scanner
        self.add_parameter('pixel_time', type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           units='ms',
                           minval=1, maxval=1000,
                           doc="""
                           Integration time per image pixel.
                           """)

        self.add_parameter('xstart',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           minval=0.0, maxval=50.0,
                           units='um')

        self.add_parameter('xstop',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           minval=0.0, maxval=50.0,
                           units='um')

        self.add_parameter('ystart',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           minval=0.0, maxval=50.0,
                           units='um')

        self.add_parameter('ystop',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           minval=0.0, maxval=50.0,
                           units='um')

        self.add_parameter('xsteps',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           minval=2, maxval=1000,
                           units='')

        self.add_parameter('ysteps',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           minval=2, maxval=1000,
                           units='')

        self.add_parameter('data',
                           tags=['measure'],
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='cps',
                           doc="""
                           Returns the full data array, not a single value.
                           The dimensions are given by the scan settings.
                           """)

        self.add_parameter('x',
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='um',
                           doc="""
                           Returns the x coordinates of the data pixels.
                           """)
        
        self.add_parameter('y',
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='um',
                           doc="""
                           Returns the y coordinates of the data pixels.
                           """)

        self.add_parameter('last_line_index',
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='',
                           doc="""
                           Returns the index of the last line of which data is
                           available.
                           """)

        self.add_parameter('last_line',
                           tags=['measure'],
                           type=types.ObjectType,
                           flags=Instrument.FLAG_GET,
                           units='cps',
                           doc="""
                           Returns the last line of the measured data.
                           """)
        
        # relevant functions to be visible outside
        # a method that gives only a specified range of lines back
        # (minimize data exchange)
        self.add_function('get_line')
        self.add_function('get_lines')

        # method to set up the data field: after setting the scan area, use this
        # to create a data field of appropriate size
        self.add_function('setup_data')

        # default params
        self.set_pixel_time(10)
        self.set_xstart(0.0)
        self.set_xstop(10.0)
        self.set_ystart(0.0)
        self.set_ystop(10.0)
        self.set_xsteps(101)
        self.set_ysteps(101)
        self.set_sampling_interval(500)
  
        # more set up
        self.setup_data()
        self._current_line = 0
        self._last_line = 0

        # instruments and access functions for the panels
        import qt
        self._ins_linescan = qt.instruments['ADwin_linescan']
        self._ins_pos = qt.instruments['ADwin_pos']
        self._ins_count = qt.instruments['ADwin_count']

        self.add_function('move_abs_xy')

        self._supported = {
            'get_running': True,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': True,
            }

        self._busy = False
        self._counter = False
    def __init__(self, name, adwin):
        """
        Parameters:
            adwin : string
                qtlab-name of the adwin instrument to be used
        """
        CyclopeanInstrument.__init__(self, name, tags=['positioner'])
        self._adwin = qt.instruments[adwin]
	
        # should not change often, hardcode is fine for now
        self.rt_dimensions = {
                'x' : {
                    'dac' : 'atto_x',
                    'micron_per_volt' : 9.324,
                    'max_v' : 4.29,
                    'min_v' : 0.,
                    'default' : 0.,
                    'origin' : 0.,
                    }, 
                'z' : {
                    'dac' : 'atto_z',
                    'micron_per_volt' : 5.59,
                    'min_v' : 0.,
                    'max_v' : 4.29,
                    'default' : 0.,
                    'origin' : 0.,
                    },
                'y' : {
                    'dac' : 'atto_y',
                    'micron_per_volt' : 9.324,
                    'max_v' : 4.29,
                    'min_v' : 0.,
                    'default' : 0.,
                    'origin' : 0.,
                    },
                }
         
        self.lt_dimensions = {
                'x' : {
                    'dac' : 'atto_x',
                    'micron_per_volt' : 2.8,
                    'max_v' : 10,
                    'min_v' : 0.,
                    'default' : 0.,
                    'origin' : 0.,
                    }, 
                'z' : {
                    'dac' : 'atto_z',
                    'micron_per_volt' : 1.40,
                    'min_v' : 0.,
                    'max_v' : 10,
                    'default' : 0.,
                    'origin' : 0.,
                    },
                'y' : {
                    'dac' : 'atto_y',
                    'micron_per_volt' : 2.8,
                    'max_v' : 10,
                    'min_v' : 0.,
                    'default' : 0.,
                    'origin' : 0.,
                    },
                }
        
        self.dimensions = self.rt_dimensions


        # auto generate parameters incl set and get for all dimensions
        for d in self.dimensions:
            dim = self.dimensions[d]
            
            # make set and get
            self._make_get(d)
            self._make_set(d)
            
            # make stepping function
            self._make_stepfunc(d)

            # register parameter (set and get need to exist already)
            self.add_parameter(d, 
                    type=types.FloatType,
                    flags=Instrument.FLAG_GETSET, 
                    units='um',
                    minval=dim['min_v']*dim['micron_per_volt'],
                    maxval=dim['max_v']*dim['micron_per_volt'], )

            # register the step function
            self.add_function('step_'+d)

        # scan control
        self._linescan_running = False
        self._linescan_px_clock = 0

        self.add_parameter('linescan_running',
                type=types.BooleanType,
                flags=Instrument.FLAG_GET)
        self.add_parameter('linescan_px_clock',
                type=types.IntType,
                flags=Instrument.FLAG_GET)

        self.add_function('linescan_start')

        # for positioning with attocubes
        self.add_parameter('lt_settings',
                type=types.BooleanType,
                flags=Instrument.FLAG_GETSET)
        self._lt_settings = False
        
        # managing the coordinate system
        self.add_function('set_origin')
        self.add_function('get_origin')
        self.add_function('from_relative')
        self.add_function('to_relative')
        self.add_function('set_relative_position')
        self.add_function('get_relative_position')
        self.add_function('move_to_xyz_pos')

        # markers
        self._markers = {}
        self.add_function('set_marker')
        self.add_function('get_marker')
        self.add_function('get_markers')
        self.add_function('goto_marker')
        self.add_function('push_position')
        self.add_function('pop_position')

        # set up config file
        cfg_fn = os.path.join(qt.config['ins_cfg_path'], name+'.cfg')
        if not os.path.exists(cfg_fn):
            _f = open(cfg_fn, 'w')
            _f.write('')
            _f.close()

        self.ins_cfg = config.Config(cfg_fn)     
        self.load_cfg()
        self.save_cfg()
        
        # set initial position values (need to know whether LT or RT settings)
        for d in self.dimensions:
            dim = self.dimensions[d]
            voltage = self._adwin.get_dac_voltage(dim['dac'])
            position = voltage * dim['micron_per_volt']
            setattr(self, '_'+d, position)
Beispiel #58
0
 def _stop_running(self):
     CyclopeanInstrument._stop_running(self)
     self._counts = 0
     self._countrate = 0
     self._ins_ADwin.Stop_Process(4)
    def __init__(self, name, address=None):
        CyclopeanInstrument.__init__(self,
                                     name,
                                     tags=['positioner', 'virtual'])

        self.add_parameter('X_position',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='um',
                           format='%.03f, %.03f')

        self.add_parameter('Y_position',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='um',
                           format='%.03f, %.03f')

        self.add_parameter('Z_position',
                           type=types.FloatType,
                           flags=Instrument.FLAG_GETSET,
                           units='um',
                           format='%.03f, %.03f')

        self.add_parameter('speed',
                           type=types.FloatType,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           format='%.01f, %.01f',
                           units='V/s')

        self.add_parameter('LT',
                           type=types.IntType,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=1)

        #        self.add_function('move_abs_xy')

        self._X_position = 0.0
        self._Y_position = 0.0
        self._Z_position = 0.0
        self._speed = 1.0
        self._LT = 0  # set to 1 for low temperature operation

        self._max_x_RT = 40.0  # micrometer
        self._max_y_RT = self._max_x_RT  # micrometer
        self._max_z_RT = 24.0  # micrometer
        self._cal_x_RT = 107.0  # mV/micrometer
        self._cal_y_RT = self._cal_x_RT  # mV/micrometer
        self._cal_z_RT = 171.4  # mV/micrometer
        self._max_V_RT = 4.29  # Volt
        self._max_x_LT = 30.0  # micrometer
        self._max_y_LT = self._max_x_LT  # micrometer
        self._max_z_LT = 15.0  # micrometer
        self._cal_x_LT = 357.0  # mV/micrometer
        self._cal_y_LT = self._cal_x_LT  # mV/micrometer
        self._cal_z_LT = 714.3  # mV/micrometer
        self._max_V_LT = 10.0  # Volt

        self._max_speed = 1.0  # V/s

        self._supported = {
            'get_running': False,
            'get_recording': False,
            'set_running': False,
            'set_recording': False,
            'save': False,
        }

        import qt
        self._ins_ADwin = qt.instruments['ADwin']
        self._ins_ADwin.Load(
            'D:\\Lucio\\AdWin codes\\ADwin_Gold_II\\cursor_move.tb0')
        if self._speed <= self._max_speed:
            self._ins_ADwin.Set_FPar(29, self._speed * 1000.0)
        else:
            self._ins_ADwin.Set_FPar(29, self._max_speed * 1000.0)

        self.set_speed(1.0)