本文整理汇总了Python中qtlab.source.instrument.Instrument类的典型用法代码示例。如果您正苦于以下问题:Python Instrument类的具体用法?Python Instrument怎么用?Python Instrument使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Instrument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, name, id=0):
Instrument.__init__(self, name, tags=['physical'])
self._h = 0
self._id = id
self.add_parameter('wavelength',
flags=Instrument.FLAG_SET|Instrument.FLAG_SOFTGET,
type=types.IntType,
units='nm')
self.add_parameter('power',
flags=Instrument.FLAG_SET|Instrument.FLAG_SOFTGET,
type=types.IntType,
units='%',
help='Set crystal power')
self.add_parameter('wlenopt',
flags=Instrument.FLAG_SET,
type=types.IntType,
units='nm',
help='Set wavelength and optimal power')
self.add_function('enable')
self._open()
self.enable()
# Close AOTF before exiting QTlab
qt.flow.register_exit_handler(self._close)
示例2: __init__
def __init__(self, name, address, number=1):
'''
Initializes the Oxford Instruments ILM 200 Helium Level Meter.
Input:
name (string) : name of the instrument
address (string) : instrument address
number (int) : ISOBUS instrument number
Output:
None
'''
logging.debug(__name__ + ' : Initializing instrument')
Instrument.__init__(self, name, tags=['physical'])
self._address = address
self._number = number
self._visainstrument = visa.SerialInstrument(self._address)
self._values = {}
self._visainstrument.stop_bits = 2
#Add parameters
self.add_parameter('level', type=types.FloatType,
flags=Instrument.FLAG_GET)
self.add_parameter('status', type=types.StringType,
flags=Instrument.FLAG_GET)
# Add functions
self.add_function('get_all')
self.get_all()
示例3: __init__
def __init__(self, name, address, reset=False):
'''
Initializes the Agilent_E8257D, and communicates with the wrapper.
Input:
name (string) : name of the instrument
address (string) : GPIB address
reset (bool) : resets to default values, default=False
'''
logging.info(__name__ + ' : Initializing instrument Agilent_E8257D')
Instrument.__init__(self, name, tags=['physical'])
# Add some global constants
self._address = address
self._visainstrument = visa.instrument(self._address)
self.add_parameter('power',
flags=Instrument.FLAG_GETSET, units='dBm', minval=-135, maxval=16, type=types.FloatType)
self.add_parameter('phase',
flags=Instrument.FLAG_GETSET, units='rad', minval=-numpy.pi, maxval=numpy.pi, type=types.FloatType)
self.add_parameter('frequency',
flags=Instrument.FLAG_GETSET, units='Hz', minval=1e5, maxval=20e9, type=types.FloatType)
self.add_parameter('status',
flags=Instrument.FLAG_GETSET, type=types.StringType)
self.add_function('reset')
self.add_function ('get_all')
if (reset):
self.reset()
else:
self.get_all()
示例4: __init__
def __init__(self, name, address, reset=False):
Instrument.__init__(self, name)
self._address = address
self._visa = visa.instrument(self._address)
self._channels = ('A', 'B', 'C', 'D')
self.add_parameter('identification',
flags=Instrument.FLAG_GET)
self.add_parameter('kelvin',
flags=Instrument.FLAG_GET,
type=types.FloatType,
channels=self._channels,
units='K')
self.add_parameter('sensor',
flags=Instrument.FLAG_GET,
type=types.FloatType,
channels=self._channels,
units='')
self.add_parameter('heater_range',
flags=Instrument.FLAG_GETSET,
type=types.IntType,
format_map={
1: '25 W',
2: '2.5 W',
3: '250 mW',
4: '25 mW',
5: '2.5 mW',
})
self.add_parameter('heater_output',
flags=Instrument.FLAG_GET,
type=types.FloatType,
units='%')
self.add_parameter('mode',
flags=Instrument.FLAG_GETSET,
type=types.IntType,
format_map={1: 'Local', 2: 'Remote', 3: 'Remote, local lock'})
self.add_parameter('pid',
flags=Instrument.FLAG_GETSET,
type=types.TupleType,
channels=(1,4))
self.add_parameter('setpoint',
flags=Instrument.FLAG_GETSET,
type=types.FloatType,
channels=(1,4))
self.add_function('local')
self.add_function('remote')
if reset:
self.reset()
else:
self.get_all()
示例5: __init__
def __init__(self, name, address, reset=False):
logging.info(__name__ + ' : Initializing instrument Newport ESP100')
Instrument.__init__(self, name, tags=['physical'])
self._address = address
self._visainstrument = visa.instrument(self._address)
# Add functions
self.add_function('init_default')
self.add_function('define_home')
self.add_function('move_1000mu_p')
self.add_function('move_0100mu_p')
self.add_function('move_0010mu_p')
self.add_function('move_0001mu_p')
self.add_function('move_1000mu_n')
self.add_function('move_0100mu_n')
self.add_function('move_0010mu_n')
self.add_function('move_0001mu_n')
# Add parameters
self.add_parameter('position',tags=['sweep'],
flags=Instrument.FLAG_GETSET, units='mm', minval=-300, maxval=300, type=types.FloatType)
self.add_parameter('ismoving',
flags=Instrument.FLAG_GET, type=types.StringType)
#self.init_default()
if reset:
self.init_default()
示例6: __init__
def __init__(self, name, address, reset=False):
Instrument.__init__(self, name)
self._address = address
self._visa = visa.instrument(self._address,
baud_rate=115200, data_bits=8, stop_bits=1,
parity=visa.no_parity, term_chars='\r\n')
self.add_parameter('identification',
flags=Instrument.FLAG_GET)
self.add_parameter('power',
flags=Instrument.FLAG_GET,
type=types.FloatType,
units='W')
self.add_parameter('head_info',
flags=Instrument.FLAG_GET,
type=types.StringType)
self.add_parameter('wavelength',
flags=Instrument.FLAG_GETSET,
type=types.FloatType,
units='m')
self.add_parameter('filter_freq',
flags=Instrument.FLAG_GETSET,
type=types.IntType,
units='Hz')
if reset:
self.reset()
else:
self.get_all()
示例7: __init__
def __init__(self, name, address):
'''
Initializes the LeCroy 44Xi.
Input:
name (string) : name of the instrument
address (string) : VICP address
Output:
None
'''
logging.debug(__name__ + ' : Initializing instrument')
Instrument.__init__(self, name, tags=['physical'])
self._address = address
self._visainstrument = visa.instrument(self._address)
self._values = {}
# Add parameters
self.add_parameter('timebase', type=types.FloatType,
flags=Instrument.FLAG_GETSET)
self.add_parameter('vertical', type=types.FloatType,
flags=Instrument.FLAG_GETSET, channels=(1, 4),
channel_prefix='ch%d_')
self.add_parameter('msize', type=types.FloatType,
flags=Instrument.FLAG_GETSET)
# Make Load/Delete Waveform functions for each channel
for ch in range(1, 5):
self._add_save_data_func(ch)
self.get_all()
示例8: __init__
def __init__(self, name, address, number=5):
'''
Initializes the Oxford Instruments Kelvinox IGH Dilution Refrigerator.
Input:
name (string) : name of the instrument
address (string) : instrument address
number (int) : ISOBUS instrument number
Output:
None
'''
logging.debug(__name__ + ' : Initializing instrument')
Instrument.__init__(self, name, tags=['physical'])
self._address = address
self._number = number
self._visainstrument = visa.SerialInstrument(self._address)
self._values = {}
self._visainstrument.stop_bits = 2
#Add parameters
self.add_parameter('1K_pot_temp', type=types.FloatType,
flags=Instrument.FLAG_GET)
self.add_parameter('mix_chamber_temp', type=types.FloatType,
flags=Instrument.FLAG_GET)
# Add functions
self.add_function('get_all')
self.get_all()
示例9: __init__
def __init__(self, name, address, reset=False):
Instrument.__init__(self, name)
self._address = address
self._visa = visa.instrument(self._address)
self.add_parameter('identification',
flags=Instrument.FLAG_GET)
self.add_parameter('power',
flags=Instrument.FLAG_GET,
type=types.FloatType,
units='W')
self.add_parameter('head_info',
flags=Instrument.FLAG_GET,
type=types.StringType)
self.add_parameter('wavelength',
flags=Instrument.FLAG_GETSET,
type=types.FloatType,
units='m')
if reset:
self.reset()
else:
self.get_all()
示例10: __init__
def __init__(self,name, HWSerialNumber='83828433', StageType='PRM1MZ8'):
logging.info(__name__ + ' : Initializing instrument Thorlabs driver')
Instrument.__init__(self, name, tags=['physical'])
# TODO: Fix when device is already initialized and driver is reloaded!!
# Obtain handle from driver itself
try:
L = f.listDevices()
except f.DeviceError:
print "No active devices!!"
L = ['None']
print L
if '83828433' in L:
self.g = f.openEx('83828433')
else:
# Alternative load
f.createDeviceInfoList()
t = f.getDeviceInfoDetail()
if '83828433' == t['serial']:
h = t['handle']
H = h.value
self.g = f.FTD2XX(H)
self.g.setBaudRate(115200)
self.g.setDataCharacteristics(f.defines.BITS_8, f.defines.STOP_BITS_1, f.defines.PARITY_NONE)
sleep(0.2)
self.g.purge(f.defines.PURGE_RX | f.defines.PURGE_TX)
sleep(0.2)
self.g.resetDevice()
self.g.setFlowControl(f.defines.FLOW_RTS_CTS,0,0)
self.g.setRts()
# Add functions
self.add_function('Identify')
self.add_function ('GoHome')
self.add_function ('Close')
self.add_function ('StopMoving')
self.add_function ('EnableChannel1')
self.add_function ('DisableChannel1')
self.add_function ('MoveJogPos')
self.add_function ('MoveJogNeg')
self.add_function ('MoveRelative')
self.add_function ('ReturnStatus')
# Add parameters
self.add_parameter('Position',
flags=Instrument.FLAG_GETSET, units='deg', minval=-720, maxval=720, type=types.FloatType)
self.add_parameter('IsMoving',
flags=Instrument.FLAG_GET, type=types.BooleanType)
self.status = {}
self.get_Position()
示例11: __init__
def __init__(self, name, address, reset=False):
Instrument.__init__(self, name, tags=['physical'])
# Set parameters
self._address = address
# Add functions
self.add_function('reset')
self.add_function('get_all')
# self.add_function('optimize_LBO')
# self.add_function('optimize_diodes')
self.add_parameter('tgt_power',
type=types.FloatType, units='W', format='%.04f',
flags=Instrument.FLAG_GETSET)
self.add_parameter('output_power',
type=types.FloatType, units='W', format='%.03f',
flags=Instrument.FLAG_GET)
self.add_parameter('shutter',
type=types.IntType, format_map={0: 'Closed', 1: 'Open'},
flags=Instrument.FLAG_GETSET)
self.add_parameter('mode',
type=types.IntType, format_map={1: 'Light', 0: 'Current'},
flags=Instrument.FLAG_GET)
self.add_parameter('current',
type=types.FloatType, units='A', format='%.01f',
flags=Instrument.FLAG_GET)
self.add_parameter('Tbaseplate',
type=types.FloatType, units='C', format='%.02f',
flags=Instrument.FLAG_GET)
self.add_parameter('Tetalon',
type=types.FloatType, units='C', format='%.02f',
flags=Instrument.FLAG_GET)
self.add_parameter('TLBO',
type=types.FloatType, units='C', format='%.02f',
flags=Instrument.FLAG_GET)
self.add_parameter('Tdiode',
type=types.FloatType, units='C', format='%.02f',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('THSdiode',
type=types.FloatType, units='C', format='%.02f',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('Idiode',
type=types.FloatType, units='A', format='%.01f',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('Tvanadate',
type=types.FloatType, units='C', format='%.02f',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('PCdiode',
type=types.FloatType, units='W', format='%.02f',
flags=Instrument.FLAG_GET, channels=(1,2))
self._visa = visa.SerialInstrument(address,
data_bits=8, stop_bits=1, parity=0,
baud_rate=19200, term_chars='\r\n')
if reset:
self.reset()
else:
self.get_all()
示例12: __init__
def __init__(self, name, address):
'''
Initializes the Cryocon62, and comunicates with the wrapper.
Input:
name (string) : name of the instrument
address (string) : GPIB address
Output:
None
'''
logging.info(__name__ + ' : Initializing instrument')
Instrument.__init__(self, name, tags=['physical'])
self._address = address
self._visainstrument = visa.instrument(self._address)
self.add_parameter('temperature', type=types.FloatType,
channel_prefix='ch%d_',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('units', type=types.StringType,
channel_prefix='ch%d_',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('sensor_index', type=types.IntType,
channel_prefix='ch%d_',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('vbias', type=types.StringType,
channel_prefix='ch%d_',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('channel_name', type=types.StringType,
channel_prefix='ch%d_',
flags=Instrument.FLAG_GET, channels=(1,2))
self.add_parameter('sensor_name', type=types.StringType,
channel_prefix='ch%d_',
flags=Instrument.FLAG_GET, channels=(1,2))
示例13: __init__
def __init__(self, name, address, ctr_addr=1, reset=False):
Instrument.__init__(self, name)
self._address = address
self._visa = visa.instrument(self._address,
baud_rate=57600, data_bits=8, stop_bits=1,
parity=visa.no_parity, term_chars='\r\n')
self._ctr_addr = ctr_addr
self.add_parameter('position',
flags=Instrument.FLAG_GETSET,
type=types.FloatType,
units='mm')
self.add_parameter('state',
flags=Instrument.FLAG_GET,
type=types.StringType)
self.add_parameter('velocity',
flags=Instrument.FLAG_GETSET,
type=types.FloatType,
units='mm/s')
# Functions
self.add_function('stop_motion')
self.add_function('set_state_ready')
self.add_function('get_error')
self.add_function('go_home')
self.add_function('go_left')
self.add_function('go_right')
if reset:
self.reset()
else:
self.get_all()
示例14: __init__
def __init__(self, name, address, reset=False):
'''
address = COM port
'''
logging.info(__name__ + ' : Initializing Spectra Physics Millenia')
Instrument.__init__(self, name, tags=['physical'])
# Set parameters
self._address = address
self.add_parameter('id',
flags=Instrument.FLAG_GET,
type=types.StringType)
self.add_parameter('power',
flags=Instrument.FLAG_GETSET,
format='%.02f',
type=types.FloatType)
# Add functions
self.add_function('reset')
self.add_function('on')
self.add_function('off')
self.add_function('get_all')
self._open_serial_connection()
if reset:
self.reset()
else:
self.get_all()
示例15: __init__
def __init__(self, name, id):
Instrument.__init__(self, name, tags=['physical'])
self._id = id
for ch_in in self._get_input_channels():
ch_in = _get_channel(ch_in)
self.add_parameter(ch_in,
flags=Instrument.FLAG_GET,
type=types.FloatType,
units='V',
tags=['measure'],
get_func=self.do_get_input,
channel=ch_in)
for ch_out in self._get_output_channels():
ch_out = _get_channel(ch_out)
self.add_parameter(ch_out,
flags=Instrument.FLAG_SET,
type=types.FloatType,
units='V',
tags=['sweep'],
set_func=self.do_set_output,
channel=ch_out)
for ch_ctr in self._get_counter_channels():
ch_ctr = _get_channel(ch_ctr)
self.add_parameter(ch_ctr,
flags=Instrument.FLAG_GET,
type=types.IntType,
units='#',
tags=['measure'],
get_func=self.do_get_counter,
channel=ch_ctr)
self.add_parameter(ch_ctr + "_src",
flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
type=types.StringType,
set_func=self.do_set_counter_src,
channel=ch_ctr)
self.add_parameter('chan_config',
flags=Instrument.FLAG_SET|Instrument.FLAG_SOFTGET,
type=types.StringType,
option_list=('Default', 'RSE', 'NRSE', 'Diff', 'PseudoDiff'))
self.add_parameter('count_time',
flags=Instrument.FLAG_SET|Instrument.FLAG_SOFTGET,
type=types.FloatType,
units='s')
self.add_function('reset')
self.add_function('digital_out')
self.reset()
self.set_chan_config('RSE')
self.set_count_time(0.1)
self.get_all()