예제 #1
0
    def __init__(self,
                 name,
                 com_port="",
                 baud_rate=19200,
                 phase_mode='default',
                 R_option=False,
                 ext_clk=False,
                 clk_freq=None,
                 clk_mult=None,
                 **kwargs):
        '''Labscript class for NovaTech 409B DDS.
        This device has four static DDS output channels.'''

        Device.__init__(self, name, None, com_port, **kwargs)
        self.BLACS_connection = '{:s},{:s}'.format(com_port, str(baud_rate))

        if not phase_mode in ['default', 'aligned', 'continuous']:
            raise LabscriptError(
                'phase_mode must be \'default\', \'aligned\' or \'continuous\''
            )

        self.phase_mode = phase_mode
        self.R_option = R_option
        self.ext_clk = ext_clk
        self.clk_mult = clk_mult
        self.clk_freq = clk_freq

        self.clk_scale = self.clock_check()
예제 #2
0
 def __init__(self, name, server,
              ats_system_id=1, ats_board_id=1,
              requested_acquisition_rate=0, # No default for this, must be calculated and set!
              acquisition_duration    = 1,  # In seconds. This should be set up by .acquire calls, but too bad for now.
              clock_source_id         = ats.INTERNAL_CLOCK,
              sample_rate_id          = ats.SAMPLE_RATE_180MSPS,
              clock_edge_id           = ats.CLOCK_EDGE_RISING,
              decimation              = 0, 
              trig_operation          = ats.TRIG_ENGINE_OP_J,
              trig_engine_id1         = ats.TRIG_ENGINE_J,
              trig_source_id1         = ats.TRIG_EXTERNAL,
              trig_slope_id1          = ats.TRIGGER_SLOPE_POSITIVE,
              trig_level_id1          = 150, # 860 mV
              trig_engine_id2         = ats.TRIG_ENGINE_K,
              trig_source_id2         = ats.TRIG_DISABLE,
              trig_slope_id2          = ats.TRIGGER_SLOPE_POSITIVE,
              trig_level_id2          = 150, # 860 mV
              exttrig_coupling_id     = ats.DC_COUPLING,
              exttrig_range_id        = ats.ETR_5V,
              trig_delay_samples      = 0,
              trig_timeout_10usecs    = 0,
              channels                = (ats.CHANNEL_A | ats.CHANNEL_B), 
              chA_coupling_id         = ats.AC_COUPLING,
              chA_input_range         = 4000,
              chA_impedance_id        = ats.IMPEDANCE_1M_OHM,
              chA_bw_limit            = 0,
              chB_coupling_id         = ats.AC_COUPLING,
              chB_input_range         = 4000,
              chB_impedance_id        = ats.IMPEDANCE_1M_OHM,
              chB_bw_limit            = 0):
     Device.__init__(self, name, None, None)
     self.name = name
     # This line makes BLACS think the device is connected to something
     self.BLACS_connection = server
    def __init__(self,
                 name,
                 parent_device,
                 connection,
                 voltage,
                 parentless=False,
                 **kwargs):

        if None in [parent_device, connection] and not parentless:
            raise LabscriptError(
                'No parent specified. If this device does not require a parent, set parentless=True'
            )
        if isinstance(parent_device, AnalogTrigger):
            if self.trigger_edge_type != parent_device.trigger_edge_type:
                raise LabscriptError(
                    'Trigger edge type for %s is \'%s\', ' %
                    (name, self.trigger_edge_type) +
                    'but existing Trigger object %s ' % parent_device.name +
                    'has edge type \'%s\'' % parent_device.trigger_edge_type)
            self.trigger_device = parent_device
        elif parent_device is not None:
            # Instantiate a trigger object to be our parent:
            self.trigger_device = AnalogTrigger(name + '_trigger',
                                                parent_device, connection,
                                                voltage,
                                                self.trigger_edge_type)
            parent_device = self.trigger_device
            connection = 'trigger'

        self.__triggers = []
        Device.__init__(self, name, parent_device, connection, **kwargs)
 def __init__(self, name, **kwargs):
     Device.__init__(self,
                     name=name,
                     parent_device=None,
                     connection=None,
                     **kwargs)
     self.functions = []
     self.BLACS_connection = name
예제 #5
0
	def __init__(self, name, gpib_address):

		Device.__init__(self, name=name, parent_device=None,connection=gpib_address)

		# The existence of this attribute is how BLACS knows it needs to make a tab for
		# this device:
		# STILL, HOW DOES BLACS KNOW WHERE TO FIND THE TAB CLASS????
		# It uses register_classes.py, which it's defined to scan for.
		self.BLACS_connection = gpib_address
예제 #6
0
 def __init__(self, name, com_port="COM1", baud_rate=115200, **kwargs):
     Device.__init__(self,
                     name=name,
                     parent_device=None,
                     connection=None,
                     **kwargs)
     self.start_commands = []
     self.stop_commands = []
     # The existence of this attribute is how BLACS knows it needs to make a tab for
     # this device:
     self.BLACS_connection = com_port
예제 #7
0
 def __init__(self, name, device_no=1, cycle_time=default_cycle_time):
     self.BLACS_connection = device_no
     # round cycle time to the nearest multiple of 3.3333ns
     quantised_cycle_time = round(cycle_time / 3.333333333333e-9)
     cycle_time = quantised_cycle_time * 3.333333333333e-9
     self.clock_limit = 1. / cycle_time
     self.clock_resolution = cycle_time
     Device.__init__(self, name, parent_device=None, connection=None)
     self.trigger_times = []
     self.wait_times = []
     self.initial_trigger_time = 0
예제 #8
0
 def __init__(self, name, device_no=1, cycle_time = default_cycle_time):
     self.BLACS_connection = device_no
     # round cycle time to the nearest multiple of 3.3333ns
     quantised_cycle_time = round(cycle_time/3.333333333333e-9)
     cycle_time = quantised_cycle_time*3.333333333333e-9
     self.clock_limit = 1./cycle_time
     self.clock_resolution = cycle_time
     Device.__init__(self, name, parent_device=None, connection=None)
     self.trigger_times = []
     self.wait_times = []
     self.initial_trigger_time = 0
예제 #9
0
 def __init__(self, name, parent_device, connection):
     """This instantiates a scope channel to acquire during a buffered shot.
     
     Args:
         name (str): Name to assign channel
         parent_device (obj): Handle to parent device
         connection (str): Which physical scope channel is acquiring.
                           Generally of the form \'Channel n\' where n is
                           the channel label.
     """
     Device.__init__(self, name, parent_device, connection)
     self.acquisitions = []
예제 #10
0
	def __init__(self, name, nDisplay=0, nSystem=0,nDevice=0): #redefine the class constructor
		#piggy back on working code for the class constructor
		Device.__init__(self, name=name, parent_device=None, connection=None)

		#add whatever else we need for the custom constructor i.e., class variables.
		self.custom_class_variable = []
		
		# The existence of this attribute is how BLACS knows it needs to make a tab for
		# this device:
		# STILL, HOW DOES BLACS KNOW WHERE TO FIND THE TAB CLASS????
		# It uses register_classes.py, which it's defined to scan for.
		self.BLACS_connection = nDisplay
예제 #11
0
 def __init__(self,
              name,
              parent_device,
              connection,
              freq_limits=None,
              freq_conv_class=None,
              freq_conv_params={}):
     Device.__init__(self, name, parent_device, connection)
     self.frequency = StaticAnalogQuantity(self.name + '_freq', self,
                                           'freq', freq_limits,
                                           freq_conv_class,
                                           freq_conv_params)
     self.frequency.default_value = 0.5e9
     self.gate = StaticDigitalOut(self.name + '_gate', self, 'gate')
예제 #12
0
 def __init__(self, name, parent_device, VISA_name, **kwargs):
     """Base VISA labscript_device class.
     
     Inheritors should call VISA.__init__() in their own __init__() method.
     Generate_code must be overridden.
     
     Args:
         name (str): name of device in connectiontable
         parent_device (obj): Handle to any parent device.
         VISA_name (str): Can be full VISA connection string or NI-MAX alias.
     """
     self.VISA_name = VISA_name
     self.BLACS_connection = VISA_name
     Device.__init__(self, name, parent_device, VISA_name)
예제 #13
0
 def __init__(self, name, parent_device, card_number):
     self.clock_limit = parent_device.clock_limit
     self.clock_resolution = parent_device.clock_resolution
     
     # Device must be accessed via the parent ADWin, so we must store
     # the parent's device_no as well as the card number:
     self.card_number = card_number
     self.BLACS_connection = parent_device.BLACS_connection, card_number
     # We won't call IntermediateDevice.__init__(), as we don't care
     # about the checks it does for clocking, we don't actually have
     # a clock:
     Device.__init__(self, name, parent_device, card_number)
     self.trigger_times = []
     self.wait_times = []
     self.initial_trigger_time = 0
예제 #14
0
    def __init__(self, name, parent_device, card_number):
        self.clock_limit = parent_device.clock_limit
        self.clock_resolution = parent_device.clock_resolution

        # Device must be accessed via the parent ADWin, so we must store
        # the parent's device_no as well as the card number:
        self.card_number = card_number
        self.BLACS_connection = parent_device.BLACS_connection, card_number
        # We won't call IntermediateDevice.__init__(), as we don't care
        # about the checks it does for clocking, we don't actually have
        # a clock:
        Device.__init__(self, name, parent_device, card_number)
        self.trigger_times = []
        self.wait_times = []
        self.initial_trigger_time = 0
예제 #15
0
 def __init__(self,
              name,
              parent_device,
              connection,
              freq_limits=None,
              freq_conv_class=None,
              freq_conv_params={},
              amp_limits=None,
              amp_conv_class=None,
              amp_conv_params={}):
     """This instatiates a static frequency output channel.
     
     Frequency and amplitude limits set here will supercede those dictated 
     by the device class, but only when compiling a shot with runmanager. 
     Static update limits are enforced by the BLACS Tab for the parent device.
     
     Args:
         name (str): Name to assign output channel
         parent_device (obj): Handle to parent device
         connection (str): Which physical channel to use on parent device.
                           Typically only 'Channel 0' is available.
         freq_limits (tuple): Set (min,max) output frequencies in BLACS front panel units.
         freq_conv_class (obj): Custom conversion class to use
         freq_conv_params (dict): Parameters to conversion class
         amp_limits (tuple): Set (min,max) output amplitude in BLACS front panel units.
         amp_conv_class (obj): Custom convsersion class to use
         amp_conv_params (dict): Parameters to conversion class
     """
     Device.__init__(self, name, parent_device, connection)
     self.frequency = StaticAnalogQuantity(self.name + '_freq', self,
                                           'freq', freq_limits,
                                           freq_conv_class,
                                           freq_conv_params)
     self.amplitude = StaticAnalogQuantity(self.name + '_amp', self, 'amp',
                                           amp_limits, amp_conv_class,
                                           amp_conv_params)
     # set default values within limits specified
     # if not specified, use limits from parent device
     if freq_limits is not None:
         self.frequency.default_value = freq_limits[0]
     else:
         self.frequency.default_value = parent_device.freq_limits[
             0] / parent_device.scale_factor
     if amp_limits is not None:
         self.amplitude.default_value = amp_limits[0]
     else:
         self.amplitude.default_value = parent_device.amp_limits[
             0] / parent_device.amp_scale_factor
예제 #16
0
 def __init__(self,
              name,
              addr,
              termination='\n',
              preamble_string='WFMP',
              timeout=5,
              int16=False,
              **kwargs):
     Device.__init__(self, name, None, addr, **kwargs)
     self.name = name
     self.BLACS_connection = addr
     self.termination = termination
     self.preamble_string = preamble_string
     assert preamble_string in [
         'WFMO', 'WFMP'
     ], "preamble_string must be one of 'WFMO' or 'WFMP'"
예제 #17
0
    def __init__(self,
                 name,
                 target="http://129.206.182.60/",
                 usern="root",
                 passw=None,
                 **kwargs):
        """ Initialize the device itself.

        Args:
            name:   Name presented in Blacs.
            target: The ip adress of the arduino including the port he listens on.
            usern:  The username for accessing the webapi of the arduino
            passw:  The password associated.
        """
        Device.__init__(self,
                        name=name,
                        parent_device=None,
                        connection=None,
                        **kwargs)
        self.value = 0
        self.timeout = 10
        self.target = target
        # do we still need this part here ?
        addr = self.target + "arduino/read/all/"
        try:
            proxies = {
                "http": None,
                "https": None,
            }
            req = requests.get(
                addr,
                auth=(usern, passw),
                timeout=self.timeout,
                proxies=proxies,
            )
        except ConnectionError:
            print("No connection")
        html_text = req.text
        lines = html_text.split("<br />")
        ard_str = lines[1]
        vals = ard_str.split(",")
        self.value = vals[1]
        self.BLACS_connection = {
            "target": target,
            "usern": usern,
            "passw": passw
        }
예제 #18
0
    def __init__(self,
                 name,
                 com_port="",
                 baud_rate=19200,
                 ext_clk=False,
                 clk_freq=None,
                 **kwargs):
        """Labscript class for Novatech 440A DDS. This is a high frequency
        DDS with single channel output that does not support amplitude control"""

        Device.__init__(self, name, None, com_port, **kwargs)
        self.BLACS_connection = '{:s},{:s}'.format(com_port, str(baud_rate))

        if ext_clk and (clk_freq >= 1 and clk_freq <= 25):
            msg = '''Must define clk_freq (in MHz) if using an external clock.
            Supplied frequency must be between 1 and 25 MHz. Device
            rounds down to nearest 8 kHz multiple.'''
            raise LabscriptError(dedent(msg))
        self.ext_clk = ext_clk
        self.clk_freq = clk_freq

        self.clk_scale = 1
 def __init__(self, name,com_port):
     Device.__init__(self, name, None, None)
     self.BLACS_connection = com_port
 def __init__(self, name, parent_device, connection, freq_limits = None, freq_conv_class = None,freq_conv_params = {}):
     Device.__init__(self,name,parent_device,connection)
     self.frequency = StaticAnalogQuantity(self.name+'_freq',self,'freq',freq_limits,freq_conv_class,freq_conv_params)
     self.frequency.default_value = 0.5e9
     self.gate = StaticDigitalOut(self.name+'_gate',self,'gate')
 def __init__(self, name, com_port):
     Device.__init__(self, name, None, None)
     self.clock_type = None
     self.BLACS_connection = com_port
예제 #22
0
 def __init__(self, name, parent_device):
     self.BLACS_connection = 5
     Device.__init__(self,
                     name,
                     parent_device,
                     connection=self.BLACS_connection)
 def __init__(self, name, 
              host = "", port=23, **kwargs):
         
     Device.__init__(self, name, None, None, None)
     self.BLACS_connection = '%s' %(host)
예제 #24
0
 def __init__(self, name, com_port=""):
     Device.__init__(self, name, None, None)
     self.BLACS_connection = com_port
예제 #25
0
    def __init__(self, name, host="", port=23, slave=1, **kwargs):
        # slave=1 is the master controller on the host ip

        Device.__init__(self, name, None, None, None)
        self.BLACS_connection = '%s,%d' % (host, slave)