pylablib.devices.AWG package
Submodules
pylablib.devices.AWG.generic module
- exception pylablib.devices.AWG.generic.GenericAWGError[source]
Bases:
DeviceErrorGeneric AWG error
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception pylablib.devices.AWG.generic.GenericAWGBackendError(exc)[source]
Bases:
GenericAWGError,DeviceBackendErrorAWG backend communication error
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class pylablib.devices.AWG.generic.GenericAWG(addr)[source]
Bases:
SCPIDeviceGeneric arbitrary wave generator, based on Agilent 33500.
With slight modifications works for many other AWGs using largely the same syntax.
- Error
alias of
GenericAWGError
- ReraiseError
alias of
GenericAWGBackendError
- set_output_polarity(polarity='norm', channel=None)[source]
Set output polarity.
Can be either
"norm"or"inv".
- get_function(channel=None)[source]
Get output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- set_function(func, channel=None)[source]
Set output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- get_output_range(channel=None)[source]
Get output voltage range.
Return tuple
(vmin, vmax)with the low and high voltage values (i.e.,offset-amplitudeandoffset+amplitude).
- set_output_range(rng, channel=None)[source]
Set output voltage range.
If span is less than
1E-4, automatically switch to DC mode.
- get_duty_cycle(channel=None)[source]
Get output duty cycle (in percent).
Only applies to
"square"output function.
- set_duty_cycle(dcycle, channel=None)[source]
Set output duty cycle (in percent).
Only applies to
"square"output function.
- get_ramp_symmetry(channel=None)[source]
Get output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- set_ramp_symmetry(rsymm, channel=None)[source]
Set output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- get_pulse_width(channel=None)[source]
Get output pulse width (in seconds).
Only applies to
"pulse"output function.
- set_pulse_width(width, channel=None)[source]
Set output pulse width (in seconds).
Only applies to
"pulse"output function.
- get_burst_ncycles(channel=None)[source]
Get burst mode ncycles.
Infinite corresponds to a large value (>1E37).
- set_burst_ncycles(ncycles=1, channel=None)[source]
Set burst mode ncycles.
Infinite corresponds to
None
- set_gate_polarity(polarity='norm', channel=None)[source]
Set burst gate polarity.
Can be either
"norm"or"inv".
- set_trigger_source(src, channel=None)[source]
Set trigger source.
Can be either
"imm","ext", or"bus".
- get_output_trigger_slope(channel=None)[source]
Get output trigger slope.
Can be either
"pos", or"neg".
- BackendError
alias of
DeviceBackendError
- apply_settings(settings)
Apply the settings.
settings is a dict
{name: value}of the available device settings. Non-applicable settings are ignored.
- ask(msg, data_type='string', delay=0.0, timeout=None, read_echo=False)
Write a message and read a reply.
msg is the query message, delay is the delay between write and read. Other parameters are the same as in
read(). Ifread_echo==True, assume that the device first echoes the input and skip it.
- close()
Close the backend
- flush(one_line=False)
Flush the read buffer (read all the available data and return the number of bytes read).
If
one_line==True, read only a single line.
- static get_arg_type(arg)
Autodetect argument type
- get_device_variable(key)
Get the value of a settings, status, or full info parameter
- get_esr(timeout=None)
Get the device status register (by default,
"*ESR?"command)
- get_full_info(include=0)
Get dict
{name: value}containing full device information (including status and settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_full_status(include=0)
Get dict
{name: value}containing the device status (including settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_id(timeout=None)
Get the device IDN. (query SCPI
'*IDN?'command)
- get_settings(include=0)
Get dict
{name: value}containing all the device settings.include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- is_opened()
Check if the device is connected
- lock(timeout=None)
Lock the access to the device from other threads/processes (isn’t necessarily implemented)
- locking(timeout=None)
Context manager for lock & unlock
- open()
Open the backend
- static parse_array_data(data, fmt, include_header=False)
Parse the data returned by the device. fmt is
DataFormatdescription in numpy format (e.g.,"<u2").If
include_header==True, the data is assumed to be in a (somewhat) standard SCPI format:b'#', then a single digitsdenoting length of the size block, thensdigits denoting length of the data (in bytes) followed by the actual data. Otherwise (include_header==False), assume that the header is already removed.
- read(data_type='string', timeout=None)
Read data from the device.
data_type determines the type of the data. Can be
'raw'(just raw data),'string'(with trailing and leading spaces stripped),'int','float','bool'(interprets0or'off'asFalse, anything else asTrue),'value'(returns tuple(value, unit), where value is float), a callable (return the result of this callable applied to the string value), a dictionary (return the stored value corresponding to the string value, or to the value converted into integer if the string value is not present), or a list of data types (the result is treated as a list of values with the given types separated by commas). timeout overrides the default value.
- read_binary_array_data(include_header=False, timeout=None, flush_term=True)
Read a binary data in the from the device.
The data assumes the standard binary transfer header consisting of
"#"symbol, then a single digit with the size of the length string, then the length string containing the length of the binary data (in bytes). Ifinclude_header==True, return the data with the header; otherwise, return only the content. Ifflush_term==True, flush the following line to skip terminator characters after the binary data, which are added by some devices. timeout overrides the default value.
- reconnect(new_instrument=True, ignore_error=True)
Remake the connection.
If
new_instrument==True, create a new backend instance. Ifignore_error==True, ignore errors on closing.
- reset()
Reset the device (by default,
"*RST"command)
- set_device_variable(key, value)
Set the value of a settings parameter
- set_output_trigger_slope(slope, channel=None)[source]
Set output trigger slope.
Can be either
"pos", or"neg".
- sleep(delay)
Wait for delay seconds
- unlock()
Unlock the access to the device from other threads/processes (isn’t necessarily implemented)
- using_write_buffer()
Context manager for using a write buffer.
While it’s active, all the consecutive
write()operations are bundled together with;delimiter. The actual write is performed at theread()/ask()operation or at the end of the block.
- wait(wait_type='sync', timeout=None, wait_callback=None)
Pause execution until device overlapped commands are complete.
wait_type is either
'sync'(performwait_sync()),'dev'(performwait_dev()) or'none'(do nothing).
- wait_dev()
Pause execution of the device commands until device overlapped commands (e.g., taking sweeps) are complete.
Note that the code execution is not paused.
- wait_sync(timeout=None, wait_callback=None)
Pause execution of the script until device overlapped commands (e.g., taking sweeps) are complete.
timeout and wait_callback override default constructor parameters.
- write(msg, arg=None, arg_type=None, unit=None, bool_selector=None, wait_sync=None, read_echo=False, read_echo_delay=0.0)
Send a command.
- Parameters:
msg (str) – Text message.
arg – Optional argument to append in the end. If a list of arguments is supplied, the result is joined with
",".arg_type (str) – Argument type. Can be
'raw'(in which case data is sent raw),'string','int','float','bool', a format string (such as'{:.3f}') or a list of argument types (for an iterable argument); if format string is used and the argument is a list or a tuple, then it is expanded as a list of arguments (e.g.,arg_type='{0};{1}'witharg=[1,2]will produce a string'1;2'); if a list of types is used, each element of arg is converted using the corresponding type, and the result is joined with",".unit (str) – If not
None, use it as a unit to append after the value.bool_selector (tuple) – A tuple
(false_value, true_value)of two strings to represent bool argument; by default, use._bool_selectorattribute.wait_sync – if
True, append the sync command (specified as._wait_sync_commattribute,"*OPC?"by default) after the message and pause the execution command is complete; useful in long set operations, where the device might ignore later inputs until the current command is complete; ifNone, use the class default._default_write_syncattribute (Falseby default).read_echo (bool) – If
True, read a single line after write.read_echo_delay (float) – The delay between write and read if
read_echo==True.
pylablib.devices.AWG.specific module
- class pylablib.devices.AWG.specific.Agilent33500(addr, channels_number='auto')[source]
Bases:
GenericAWGAgilent 33500 AWG.
- Parameters:
channels_number – number of channels; if
"auto", try to determine automatically (by certain commands causing errors)
- BackendError
alias of
DeviceBackendError
- Error
alias of
GenericAWGError
- ReraiseError
alias of
GenericAWGBackendError
- apply_settings(settings)
Apply the settings.
settings is a dict
{name: value}of the available device settings. Non-applicable settings are ignored.
- ask(msg, data_type='string', delay=0.0, timeout=None, read_echo=False)
Write a message and read a reply.
msg is the query message, delay is the delay between write and read. Other parameters are the same as in
read(). Ifread_echo==True, assume that the device first echoes the input and skip it.
- close()
Close the backend
- enable_burst(enabled=True, channel=None)
Enable burst mode
- enable_output(enabled=True, channel=None)
Turn the output on or off
- enable_sync_output(enabled=True, channel=None)
Enable or disable SYNC output
- enable_trigger_output(enabled=True, channel=None)
Enable trigger output
- flush(one_line=False)
Flush the read buffer (read all the available data and return the number of bytes read).
If
one_line==True, read only a single line.
- get_amplitude(channel=None)
Get output amplitude (i.e., half of the span)
- static get_arg_type(arg)
Autodetect argument type
- get_burst_mode(channel=None)
Get burst mode.
Can be either
"trig"or"gate".
- get_burst_ncycles(channel=None)
Get burst mode ncycles.
Infinite corresponds to a large value (>1E37).
- get_channels_number()
Get the number of channels
- get_current_channel()
Get current channel
- get_device_variable(key)
Get the value of a settings, status, or full info parameter
- get_duty_cycle(channel=None)
Get output duty cycle (in percent).
Only applies to
"square"output function.
- get_esr(timeout=None)
Get the device status register (by default,
"*ESR?"command)
- get_frequency(channel=None)
Get output frequency
- get_full_info(include=0)
Get dict
{name: value}containing full device information (including status and settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_full_status(include=0)
Get dict
{name: value}containing the device status (including settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_function(channel=None)
Get output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- get_gate_polarity(channel=None)
Get burst gate polarity.
Can be either
"norm"or"inv".
- get_id(timeout=None)
Get the device IDN. (query SCPI
'*IDN?'command)
- get_load(channel=None)
Get the output load
- get_offset(channel=None)
Get output offset
- get_output_polarity(channel=None)
Get output polarity.
Can be either
"norm"or"inv".
- get_output_range(channel=None)
Get output voltage range.
Return tuple
(vmin, vmax)with the low and high voltage values (i.e.,offset-amplitudeandoffset+amplitude).
- get_output_trigger_slope(channel=None)
Get output trigger slope.
Can be either
"pos", or"neg".
- get_phase(channel=None)
Get output phase (in degrees)
- get_pulse_width(channel=None)
Get output pulse width (in seconds).
Only applies to
"pulse"output function.
- get_ramp_symmetry(channel=None)
Get output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- get_settings(include=0)
Get dict
{name: value}containing all the device settings.include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_trigger_slope(channel=None)
Get trigger slope.
Can be either
"pos", or"neg".
- get_trigger_source(channel=None)
Get trigger source.
Can be either
"imm","ext", or"bus".
- is_burst_enabled(channel=None)
Check if the burst mode is enabled
- is_opened()
Check if the device is connected
- is_output_enabled(channel=None)
Check if the output is enabled
- is_sync_output_enabled(channel=None)
Check if SYNC output is enabled
- is_trigger_output_enabled(channel=None)
Check if the trigger output is enabled
- lock(timeout=None)
Lock the access to the device from other threads/processes (isn’t necessarily implemented)
- locking(timeout=None)
Context manager for lock & unlock
- open()
Open the backend
- static parse_array_data(data, fmt, include_header=False)
Parse the data returned by the device. fmt is
DataFormatdescription in numpy format (e.g.,"<u2").If
include_header==True, the data is assumed to be in a (somewhat) standard SCPI format:b'#', then a single digitsdenoting length of the size block, thensdigits denoting length of the data (in bytes) followed by the actual data. Otherwise (include_header==False), assume that the header is already removed.
- read(data_type='string', timeout=None)
Read data from the device.
data_type determines the type of the data. Can be
'raw'(just raw data),'string'(with trailing and leading spaces stripped),'int','float','bool'(interprets0or'off'asFalse, anything else asTrue),'value'(returns tuple(value, unit), where value is float), a callable (return the result of this callable applied to the string value), a dictionary (return the stored value corresponding to the string value, or to the value converted into integer if the string value is not present), or a list of data types (the result is treated as a list of values with the given types separated by commas). timeout overrides the default value.
- read_binary_array_data(include_header=False, timeout=None, flush_term=True)
Read a binary data in the from the device.
The data assumes the standard binary transfer header consisting of
"#"symbol, then a single digit with the size of the length string, then the length string containing the length of the binary data (in bytes). Ifinclude_header==True, return the data with the header; otherwise, return only the content. Ifflush_term==True, flush the following line to skip terminator characters after the binary data, which are added by some devices. timeout overrides the default value.
- reconnect(new_instrument=True, ignore_error=True)
Remake the connection.
If
new_instrument==True, create a new backend instance. Ifignore_error==True, ignore errors on closing.
- reset()
Reset the device (by default,
"*RST"command)
- select_current_channel(channel)
Select current default channel
- set_amplitude(amplitude, channel=None)
Set output amplitude (i.e., half of the span)
- set_burst_mode(mode, channel=None)
Set burst mode.
Can be either
"trig"or"gate".
- set_burst_ncycles(ncycles=1, channel=None)
Set burst mode ncycles.
Infinite corresponds to
None
- set_device_variable(key, value)
Set the value of a settings parameter
- set_duty_cycle(dcycle, channel=None)
Set output duty cycle (in percent).
Only applies to
"square"output function.
- set_frequency(frequency, channel=None)
Set output frequency
- set_function(func, channel=None)
Set output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- set_gate_polarity(polarity='norm', channel=None)
Set burst gate polarity.
Can be either
"norm"or"inv".
- set_load(load=None, channel=None)
Set the output load (
Nonemeans High-Z)
- set_offset(offset, channel=None)
Set output offset
- set_output_polarity(polarity='norm', channel=None)
Set output polarity.
Can be either
"norm"or"inv".
- set_output_range(rng, channel=None)
Set output voltage range.
If span is less than
1E-4, automatically switch to DC mode.
- set_output_trigger_slope(slope, channel=None)
Set output trigger slope.
Can be either
"pos", or"neg".
- set_phase(phase, channel=None)
Set output phase (in degrees)
- set_pulse_width(width, channel=None)
Set output pulse width (in seconds).
Only applies to
"pulse"output function.
- set_ramp_symmetry(rsymm, channel=None)
Set output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- set_trigger_slope(slope, channel=None)
Set trigger slope.
Can be either
"pos", or"neg".
- set_trigger_source(src, channel=None)
Set trigger source.
Can be either
"imm","ext", or"bus".
- sleep(delay)
Wait for delay seconds
- sync_phase()
Synchronize phase between two channels
- unlock()
Unlock the access to the device from other threads/processes (isn’t necessarily implemented)
- using_write_buffer()
Context manager for using a write buffer.
While it’s active, all the consecutive
write()operations are bundled together with;delimiter. The actual write is performed at theread()/ask()operation or at the end of the block.
- wait(wait_type='sync', timeout=None, wait_callback=None)
Pause execution until device overlapped commands are complete.
wait_type is either
'sync'(performwait_sync()),'dev'(performwait_dev()) or'none'(do nothing).
- wait_dev()
Pause execution of the device commands until device overlapped commands (e.g., taking sweeps) are complete.
Note that the code execution is not paused.
- wait_sync(timeout=None, wait_callback=None)
Pause execution of the script until device overlapped commands (e.g., taking sweeps) are complete.
timeout and wait_callback override default constructor parameters.
- write(msg, arg=None, arg_type=None, unit=None, bool_selector=None, wait_sync=None, read_echo=False, read_echo_delay=0.0)
Send a command.
- Parameters:
msg (str) – Text message.
arg – Optional argument to append in the end. If a list of arguments is supplied, the result is joined with
",".arg_type (str) – Argument type. Can be
'raw'(in which case data is sent raw),'string','int','float','bool', a format string (such as'{:.3f}') or a list of argument types (for an iterable argument); if format string is used and the argument is a list or a tuple, then it is expanded as a list of arguments (e.g.,arg_type='{0};{1}'witharg=[1,2]will produce a string'1;2'); if a list of types is used, each element of arg is converted using the corresponding type, and the result is joined with",".unit (str) – If not
None, use it as a unit to append after the value.bool_selector (tuple) – A tuple
(false_value, true_value)of two strings to represent bool argument; by default, use._bool_selectorattribute.wait_sync – if
True, append the sync command (specified as._wait_sync_commattribute,"*OPC?"by default) after the message and pause the execution command is complete; useful in long set operations, where the device might ignore later inputs until the current command is complete; ifNone, use the class default._default_write_syncattribute (Falseby default).read_echo (bool) – If
True, read a single line after write.read_echo_delay (float) – The delay between write and read if
read_echo==True.
- class pylablib.devices.AWG.specific.Agilent33220A(addr)[source]
Bases:
GenericAWGAgilent 33220A AWG.
- BackendError
alias of
DeviceBackendError
- Error
alias of
GenericAWGError
- ReraiseError
alias of
GenericAWGBackendError
- apply_settings(settings)
Apply the settings.
settings is a dict
{name: value}of the available device settings. Non-applicable settings are ignored.
- ask(msg, data_type='string', delay=0.0, timeout=None, read_echo=False)
Write a message and read a reply.
msg is the query message, delay is the delay between write and read. Other parameters are the same as in
read(). Ifread_echo==True, assume that the device first echoes the input and skip it.
- close()
Close the backend
- enable_burst(enabled=True, channel=None)
Enable burst mode
- enable_output(enabled=True, channel=None)
Turn the output on or off
- enable_sync_output(enabled=True, channel=None)
Enable or disable SYNC output
- enable_trigger_output(enabled=True, channel=None)
Enable trigger output
- flush(one_line=False)
Flush the read buffer (read all the available data and return the number of bytes read).
If
one_line==True, read only a single line.
- get_amplitude(channel=None)
Get output amplitude (i.e., half of the span)
- static get_arg_type(arg)
Autodetect argument type
- get_burst_mode(channel=None)
Get burst mode.
Can be either
"trig"or"gate".
- get_burst_ncycles(channel=None)
Get burst mode ncycles.
Infinite corresponds to a large value (>1E37).
- get_channels_number()
Get the number of channels
- get_current_channel()
Get current channel
- get_device_variable(key)
Get the value of a settings, status, or full info parameter
- get_duty_cycle(channel=None)
Get output duty cycle (in percent).
Only applies to
"square"output function.
- get_esr(timeout=None)
Get the device status register (by default,
"*ESR?"command)
- get_frequency(channel=None)
Get output frequency
- get_full_info(include=0)
Get dict
{name: value}containing full device information (including status and settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_full_status(include=0)
Get dict
{name: value}containing the device status (including settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_function(channel=None)
Get output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- get_gate_polarity(channel=None)
Get burst gate polarity.
Can be either
"norm"or"inv".
- get_id(timeout=None)
Get the device IDN. (query SCPI
'*IDN?'command)
- get_load(channel=None)
Get the output load
- get_offset(channel=None)
Get output offset
- get_output_polarity(channel=None)
Get output polarity.
Can be either
"norm"or"inv".
- get_output_range(channel=None)
Get output voltage range.
Return tuple
(vmin, vmax)with the low and high voltage values (i.e.,offset-amplitudeandoffset+amplitude).
- get_output_trigger_slope(channel=None)
Get output trigger slope.
Can be either
"pos", or"neg".
- get_phase(channel=None)
Get output phase (in degrees)
- get_pulse_width(channel=None)
Get output pulse width (in seconds).
Only applies to
"pulse"output function.
- get_ramp_symmetry(channel=None)
Get output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- get_settings(include=0)
Get dict
{name: value}containing all the device settings.include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_trigger_slope(channel=None)
Get trigger slope.
Can be either
"pos", or"neg".
- get_trigger_source(channel=None)
Get trigger source.
Can be either
"imm","ext", or"bus".
- is_burst_enabled(channel=None)
Check if the burst mode is enabled
- is_opened()
Check if the device is connected
- is_output_enabled(channel=None)
Check if the output is enabled
- is_sync_output_enabled(channel=None)
Check if SYNC output is enabled
- is_trigger_output_enabled(channel=None)
Check if the trigger output is enabled
- lock(timeout=None)
Lock the access to the device from other threads/processes (isn’t necessarily implemented)
- locking(timeout=None)
Context manager for lock & unlock
- open()
Open the backend
- static parse_array_data(data, fmt, include_header=False)
Parse the data returned by the device. fmt is
DataFormatdescription in numpy format (e.g.,"<u2").If
include_header==True, the data is assumed to be in a (somewhat) standard SCPI format:b'#', then a single digitsdenoting length of the size block, thensdigits denoting length of the data (in bytes) followed by the actual data. Otherwise (include_header==False), assume that the header is already removed.
- read(data_type='string', timeout=None)
Read data from the device.
data_type determines the type of the data. Can be
'raw'(just raw data),'string'(with trailing and leading spaces stripped),'int','float','bool'(interprets0or'off'asFalse, anything else asTrue),'value'(returns tuple(value, unit), where value is float), a callable (return the result of this callable applied to the string value), a dictionary (return the stored value corresponding to the string value, or to the value converted into integer if the string value is not present), or a list of data types (the result is treated as a list of values with the given types separated by commas). timeout overrides the default value.
- read_binary_array_data(include_header=False, timeout=None, flush_term=True)
Read a binary data in the from the device.
The data assumes the standard binary transfer header consisting of
"#"symbol, then a single digit with the size of the length string, then the length string containing the length of the binary data (in bytes). Ifinclude_header==True, return the data with the header; otherwise, return only the content. Ifflush_term==True, flush the following line to skip terminator characters after the binary data, which are added by some devices. timeout overrides the default value.
- reconnect(new_instrument=True, ignore_error=True)
Remake the connection.
If
new_instrument==True, create a new backend instance. Ifignore_error==True, ignore errors on closing.
- reset()
Reset the device (by default,
"*RST"command)
- select_current_channel(channel)
Select current default channel
- set_amplitude(amplitude, channel=None)
Set output amplitude (i.e., half of the span)
- set_burst_mode(mode, channel=None)
Set burst mode.
Can be either
"trig"or"gate".
- set_burst_ncycles(ncycles=1, channel=None)
Set burst mode ncycles.
Infinite corresponds to
None
- set_device_variable(key, value)
Set the value of a settings parameter
- set_duty_cycle(dcycle, channel=None)
Set output duty cycle (in percent).
Only applies to
"square"output function.
- set_frequency(frequency, channel=None)
Set output frequency
- set_function(func, channel=None)
Set output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- set_gate_polarity(polarity='norm', channel=None)
Set burst gate polarity.
Can be either
"norm"or"inv".
- set_load(load=None, channel=None)
Set the output load (
Nonemeans High-Z)
- set_offset(offset, channel=None)
Set output offset
- set_output_polarity(polarity='norm', channel=None)
Set output polarity.
Can be either
"norm"or"inv".
- set_output_range(rng, channel=None)
Set output voltage range.
If span is less than
1E-4, automatically switch to DC mode.
- set_output_trigger_slope(slope, channel=None)
Set output trigger slope.
Can be either
"pos", or"neg".
- set_phase(phase, channel=None)
Set output phase (in degrees)
- set_pulse_width(width, channel=None)
Set output pulse width (in seconds).
Only applies to
"pulse"output function.
- set_ramp_symmetry(rsymm, channel=None)
Set output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- set_trigger_slope(slope, channel=None)
Set trigger slope.
Can be either
"pos", or"neg".
- set_trigger_source(src, channel=None)
Set trigger source.
Can be either
"imm","ext", or"bus".
- sleep(delay)
Wait for delay seconds
- sync_phase()
Synchronize phase between two channels
- unlock()
Unlock the access to the device from other threads/processes (isn’t necessarily implemented)
- using_write_buffer()
Context manager for using a write buffer.
While it’s active, all the consecutive
write()operations are bundled together with;delimiter. The actual write is performed at theread()/ask()operation or at the end of the block.
- wait(wait_type='sync', timeout=None, wait_callback=None)
Pause execution until device overlapped commands are complete.
wait_type is either
'sync'(performwait_sync()),'dev'(performwait_dev()) or'none'(do nothing).
- wait_dev()
Pause execution of the device commands until device overlapped commands (e.g., taking sweeps) are complete.
Note that the code execution is not paused.
- wait_sync(timeout=None, wait_callback=None)
Pause execution of the script until device overlapped commands (e.g., taking sweeps) are complete.
timeout and wait_callback override default constructor parameters.
- write(msg, arg=None, arg_type=None, unit=None, bool_selector=None, wait_sync=None, read_echo=False, read_echo_delay=0.0)
Send a command.
- Parameters:
msg (str) – Text message.
arg – Optional argument to append in the end. If a list of arguments is supplied, the result is joined with
",".arg_type (str) – Argument type. Can be
'raw'(in which case data is sent raw),'string','int','float','bool', a format string (such as'{:.3f}') or a list of argument types (for an iterable argument); if format string is used and the argument is a list or a tuple, then it is expanded as a list of arguments (e.g.,arg_type='{0};{1}'witharg=[1,2]will produce a string'1;2'); if a list of types is used, each element of arg is converted using the corresponding type, and the result is joined with",".unit (str) – If not
None, use it as a unit to append after the value.bool_selector (tuple) – A tuple
(false_value, true_value)of two strings to represent bool argument; by default, use._bool_selectorattribute.wait_sync – if
True, append the sync command (specified as._wait_sync_commattribute,"*OPC?"by default) after the message and pause the execution command is complete; useful in long set operations, where the device might ignore later inputs until the current command is complete; ifNone, use the class default._default_write_syncattribute (Falseby default).read_echo (bool) – If
True, read a single line after write.read_echo_delay (float) – The delay between write and read if
read_echo==True.
- class pylablib.devices.AWG.specific.InstekAFG2225(addr)[source]
Bases:
GenericAWGInstek AFG2225 AWG.
Compared to 2000/2100 series, has one extra channel and a bit more capabilities (burst trigger, pulse function)
- BackendError
alias of
DeviceBackendError
- Error
alias of
GenericAWGError
- ReraiseError
alias of
GenericAWGBackendError
- apply_settings(settings)
Apply the settings.
settings is a dict
{name: value}of the available device settings. Non-applicable settings are ignored.
- ask(msg, data_type='string', delay=0.0, timeout=None, read_echo=False)
Write a message and read a reply.
msg is the query message, delay is the delay between write and read. Other parameters are the same as in
read(). Ifread_echo==True, assume that the device first echoes the input and skip it.
- close()
Close the backend
- enable_burst(enabled=True, channel=None)
Enable burst mode
- enable_output(enabled=True, channel=None)
Turn the output on or off
- enable_sync_output(enabled=True, channel=None)
Enable or disable SYNC output
- enable_trigger_output(enabled=True, channel=None)
Enable trigger output
- flush(one_line=False)
Flush the read buffer (read all the available data and return the number of bytes read).
If
one_line==True, read only a single line.
- static get_arg_type(arg)
Autodetect argument type
- get_burst_mode(channel=None)
Get burst mode.
Can be either
"trig"or"gate".
- get_burst_ncycles(channel=None)
Get burst mode ncycles.
Infinite corresponds to a large value (>1E37).
- get_channels_number()
Get the number of channels
- get_current_channel()
Get current channel
- get_device_variable(key)
Get the value of a settings, status, or full info parameter
- get_duty_cycle(channel=None)
Get output duty cycle (in percent).
Only applies to
"square"output function.
- get_esr(timeout=None)
Get the device status register (by default,
"*ESR?"command)
- get_frequency(channel=None)
Get output frequency
- get_full_info(include=0)
Get dict
{name: value}containing full device information (including status and settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_full_status(include=0)
Get dict
{name: value}containing the device status (including settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_function(channel=None)
Get output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- get_gate_polarity(channel=None)
Get burst gate polarity.
Can be either
"norm"or"inv".
- get_id(timeout=None)
Get the device IDN. (query SCPI
'*IDN?'command)
- get_load(channel=None)
Get the output load
- get_output_polarity(channel=None)
Get output polarity.
Can be either
"norm"or"inv".
- get_output_range(channel=None)
Get output voltage range.
Return tuple
(vmin, vmax)with the low and high voltage values (i.e.,offset-amplitudeandoffset+amplitude).
- get_output_trigger_slope(channel=None)
Get output trigger slope.
Can be either
"pos", or"neg".
- get_phase(channel=None)
Get output phase (in degrees)
- get_pulse_width(channel=None)
Get output pulse width (in seconds).
Only applies to
"pulse"output function.
- get_ramp_symmetry(channel=None)
Get output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- get_settings(include=0)
Get dict
{name: value}containing all the device settings.include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_trigger_slope(channel=None)
Get trigger slope.
Can be either
"pos", or"neg".
- get_trigger_source(channel=None)
Get trigger source.
Can be either
"imm","ext", or"bus".
- is_burst_enabled(channel=None)
Check if the burst mode is enabled
- is_opened()
Check if the device is connected
- is_output_enabled(channel=None)
Check if the output is enabled
- is_sync_output_enabled(channel=None)
Check if SYNC output is enabled
- is_trigger_output_enabled(channel=None)
Check if the trigger output is enabled
- lock(timeout=None)
Lock the access to the device from other threads/processes (isn’t necessarily implemented)
- locking(timeout=None)
Context manager for lock & unlock
- open()
Open the backend
- static parse_array_data(data, fmt, include_header=False)
Parse the data returned by the device. fmt is
DataFormatdescription in numpy format (e.g.,"<u2").If
include_header==True, the data is assumed to be in a (somewhat) standard SCPI format:b'#', then a single digitsdenoting length of the size block, thensdigits denoting length of the data (in bytes) followed by the actual data. Otherwise (include_header==False), assume that the header is already removed.
- read(data_type='string', timeout=None)
Read data from the device.
data_type determines the type of the data. Can be
'raw'(just raw data),'string'(with trailing and leading spaces stripped),'int','float','bool'(interprets0or'off'asFalse, anything else asTrue),'value'(returns tuple(value, unit), where value is float), a callable (return the result of this callable applied to the string value), a dictionary (return the stored value corresponding to the string value, or to the value converted into integer if the string value is not present), or a list of data types (the result is treated as a list of values with the given types separated by commas). timeout overrides the default value.
- read_binary_array_data(include_header=False, timeout=None, flush_term=True)
Read a binary data in the from the device.
The data assumes the standard binary transfer header consisting of
"#"symbol, then a single digit with the size of the length string, then the length string containing the length of the binary data (in bytes). Ifinclude_header==True, return the data with the header; otherwise, return only the content. Ifflush_term==True, flush the following line to skip terminator characters after the binary data, which are added by some devices. timeout overrides the default value.
- reconnect(new_instrument=True, ignore_error=True)
Remake the connection.
If
new_instrument==True, create a new backend instance. Ifignore_error==True, ignore errors on closing.
- reset()
Reset the device (by default,
"*RST"command)
- select_current_channel(channel)
Select current default channel
- set_burst_mode(mode, channel=None)
Set burst mode.
Can be either
"trig"or"gate".
- set_burst_ncycles(ncycles=1, channel=None)
Set burst mode ncycles.
Infinite corresponds to
None
- set_device_variable(key, value)
Set the value of a settings parameter
- set_duty_cycle(dcycle, channel=None)
Set output duty cycle (in percent).
Only applies to
"square"output function.
- set_frequency(frequency, channel=None)
Set output frequency
- set_function(func, channel=None)
Set output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- set_gate_polarity(polarity='norm', channel=None)
Set burst gate polarity.
Can be either
"norm"or"inv".
- set_load(load=None, channel=None)
Set the output load (
Nonemeans High-Z)
- set_output_polarity(polarity='norm', channel=None)
Set output polarity.
Can be either
"norm"or"inv".
- set_output_range(rng, channel=None)
Set output voltage range.
If span is less than
1E-4, automatically switch to DC mode.
- set_output_trigger_slope(slope, channel=None)
Set output trigger slope.
Can be either
"pos", or"neg".
- set_phase(phase, channel=None)
Set output phase (in degrees)
- set_pulse_width(width, channel=None)
Set output pulse width (in seconds).
Only applies to
"pulse"output function.
- set_ramp_symmetry(rsymm, channel=None)
Set output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- set_trigger_slope(slope, channel=None)
Set trigger slope.
Can be either
"pos", or"neg".
- set_trigger_source(src, channel=None)
Set trigger source.
Can be either
"imm","ext", or"bus".
- sleep(delay)
Wait for delay seconds
- sync_phase()
Synchronize phase between two channels
- unlock()
Unlock the access to the device from other threads/processes (isn’t necessarily implemented)
- using_write_buffer()
Context manager for using a write buffer.
While it’s active, all the consecutive
write()operations are bundled together with;delimiter. The actual write is performed at theread()/ask()operation or at the end of the block.
- wait(wait_type='sync', timeout=None, wait_callback=None)
Pause execution until device overlapped commands are complete.
wait_type is either
'sync'(performwait_sync()),'dev'(performwait_dev()) or'none'(do nothing).
- wait_dev()
Pause execution of the device commands until device overlapped commands (e.g., taking sweeps) are complete.
Note that the code execution is not paused.
- wait_sync(timeout=None, wait_callback=None)
Pause execution of the script until device overlapped commands (e.g., taking sweeps) are complete.
timeout and wait_callback override default constructor parameters.
- write(msg, arg=None, arg_type=None, unit=None, bool_selector=None, wait_sync=None, read_echo=False, read_echo_delay=0.0)
Send a command.
- Parameters:
msg (str) – Text message.
arg – Optional argument to append in the end. If a list of arguments is supplied, the result is joined with
",".arg_type (str) – Argument type. Can be
'raw'(in which case data is sent raw),'string','int','float','bool', a format string (such as'{:.3f}') or a list of argument types (for an iterable argument); if format string is used and the argument is a list or a tuple, then it is expanded as a list of arguments (e.g.,arg_type='{0};{1}'witharg=[1,2]will produce a string'1;2'); if a list of types is used, each element of arg is converted using the corresponding type, and the result is joined with",".unit (str) – If not
None, use it as a unit to append after the value.bool_selector (tuple) – A tuple
(false_value, true_value)of two strings to represent bool argument; by default, use._bool_selectorattribute.wait_sync – if
True, append the sync command (specified as._wait_sync_commattribute,"*OPC?"by default) after the message and pause the execution command is complete; useful in long set operations, where the device might ignore later inputs until the current command is complete; ifNone, use the class default._default_write_syncattribute (Falseby default).read_echo (bool) – If
True, read a single line after write.read_echo_delay (float) – The delay between write and read if
read_echo==True.
- class pylablib.devices.AWG.specific.InstekAFG2000(addr)[source]
Bases:
InstekAFG2225Instek AFG2000/2100 series AWG.
Compared to AFG2225, has only one channel and fewer capabilities.
- BackendError
alias of
DeviceBackendError
- Error
alias of
GenericAWGError
- ReraiseError
alias of
GenericAWGBackendError
- apply_settings(settings)
Apply the settings.
settings is a dict
{name: value}of the available device settings. Non-applicable settings are ignored.
- ask(msg, data_type='string', delay=0.0, timeout=None, read_echo=False)
Write a message and read a reply.
msg is the query message, delay is the delay between write and read. Other parameters are the same as in
read(). Ifread_echo==True, assume that the device first echoes the input and skip it.
- close()
Close the backend
- enable_burst(enabled=True, channel=None)
Enable burst mode
- enable_output(enabled=True, channel=None)
Turn the output on or off
- enable_sync_output(enabled=True, channel=None)
Enable or disable SYNC output
- enable_trigger_output(enabled=True, channel=None)
Enable trigger output
- flush(one_line=False)
Flush the read buffer (read all the available data and return the number of bytes read).
If
one_line==True, read only a single line.
- get_amplitude(channel=None)
Get output amplitude (i.e., half of the span)
- static get_arg_type(arg)
Autodetect argument type
- get_burst_mode(channel=None)
Get burst mode.
Can be either
"trig"or"gate".
- get_burst_ncycles(channel=None)
Get burst mode ncycles.
Infinite corresponds to a large value (>1E37).
- get_channels_number()
Get the number of channels
- get_current_channel()
Get current channel
- get_device_variable(key)
Get the value of a settings, status, or full info parameter
- get_duty_cycle(channel=None)
Get output duty cycle (in percent).
Only applies to
"square"output function.
- get_esr(timeout=None)
Get the device status register (by default,
"*ESR?"command)
- get_frequency(channel=None)
Get output frequency
- get_full_info(include=0)
Get dict
{name: value}containing full device information (including status and settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_full_status(include=0)
Get dict
{name: value}containing the device status (including settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_function(channel=None)
Get output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- get_gate_polarity(channel=None)
Get burst gate polarity.
Can be either
"norm"or"inv".
- get_id(timeout=None)
Get the device IDN. (query SCPI
'*IDN?'command)
- get_load(channel=None)
Get the output load
- get_offset(channel=None)
Get output offset
- get_output_polarity(channel=None)
Get output polarity.
Can be either
"norm"or"inv".
- get_output_range(channel=None)
Get output voltage range.
Return tuple
(vmin, vmax)with the low and high voltage values (i.e.,offset-amplitudeandoffset+amplitude).
- get_output_trigger_slope(channel=None)
Get output trigger slope.
Can be either
"pos", or"neg".
- get_phase(channel=None)
Get output phase (in degrees)
- get_pulse_width(channel=None)
Get output pulse width (in seconds).
Only applies to
"pulse"output function.
- get_ramp_symmetry(channel=None)
Get output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- get_settings(include=0)
Get dict
{name: value}containing all the device settings.include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_trigger_slope(channel=None)
Get trigger slope.
Can be either
"pos", or"neg".
- get_trigger_source(channel=None)
Get trigger source.
Can be either
"imm","ext", or"bus".
- is_burst_enabled(channel=None)
Check if the burst mode is enabled
- is_opened()
Check if the device is connected
- is_output_enabled(channel=None)
Check if the output is enabled
- is_sync_output_enabled(channel=None)
Check if SYNC output is enabled
- is_trigger_output_enabled(channel=None)
Check if the trigger output is enabled
- lock(timeout=None)
Lock the access to the device from other threads/processes (isn’t necessarily implemented)
- locking(timeout=None)
Context manager for lock & unlock
- open()
Open the backend
- static parse_array_data(data, fmt, include_header=False)
Parse the data returned by the device. fmt is
DataFormatdescription in numpy format (e.g.,"<u2").If
include_header==True, the data is assumed to be in a (somewhat) standard SCPI format:b'#', then a single digitsdenoting length of the size block, thensdigits denoting length of the data (in bytes) followed by the actual data. Otherwise (include_header==False), assume that the header is already removed.
- read(data_type='string', timeout=None)
Read data from the device.
data_type determines the type of the data. Can be
'raw'(just raw data),'string'(with trailing and leading spaces stripped),'int','float','bool'(interprets0or'off'asFalse, anything else asTrue),'value'(returns tuple(value, unit), where value is float), a callable (return the result of this callable applied to the string value), a dictionary (return the stored value corresponding to the string value, or to the value converted into integer if the string value is not present), or a list of data types (the result is treated as a list of values with the given types separated by commas). timeout overrides the default value.
- read_binary_array_data(include_header=False, timeout=None, flush_term=True)
Read a binary data in the from the device.
The data assumes the standard binary transfer header consisting of
"#"symbol, then a single digit with the size of the length string, then the length string containing the length of the binary data (in bytes). Ifinclude_header==True, return the data with the header; otherwise, return only the content. Ifflush_term==True, flush the following line to skip terminator characters after the binary data, which are added by some devices. timeout overrides the default value.
- reconnect(new_instrument=True, ignore_error=True)
Remake the connection.
If
new_instrument==True, create a new backend instance. Ifignore_error==True, ignore errors on closing.
- reset()
Reset the device (by default,
"*RST"command)
- select_current_channel(channel)
Select current default channel
- set_amplitude(amplitude, channel=None)
Set output amplitude (i.e., half of the span)
- set_burst_mode(mode, channel=None)
Set burst mode.
Can be either
"trig"or"gate".
- set_burst_ncycles(ncycles=1, channel=None)
Set burst mode ncycles.
Infinite corresponds to
None
- set_device_variable(key, value)
Set the value of a settings parameter
- set_duty_cycle(dcycle, channel=None)
Set output duty cycle (in percent).
Only applies to
"square"output function.
- set_frequency(frequency, channel=None)
Set output frequency
- set_function(func, channel=None)
Set output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- set_gate_polarity(polarity='norm', channel=None)
Set burst gate polarity.
Can be either
"norm"or"inv".
- set_load(load=None, channel=None)
Set the output load (
Nonemeans High-Z)
- set_offset(offset, channel=None)
Set output offset
- set_output_polarity(polarity='norm', channel=None)
Set output polarity.
Can be either
"norm"or"inv".
- set_output_range(rng, channel=None)
Set output voltage range.
If span is less than
1E-4, automatically switch to DC mode.
- set_output_trigger_slope(slope, channel=None)
Set output trigger slope.
Can be either
"pos", or"neg".
- set_phase(phase, channel=None)
Set output phase (in degrees)
- set_pulse_width(width, channel=None)
Set output pulse width (in seconds).
Only applies to
"pulse"output function.
- set_ramp_symmetry(rsymm, channel=None)
Set output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- set_trigger_slope(slope, channel=None)
Set trigger slope.
Can be either
"pos", or"neg".
- set_trigger_source(src, channel=None)
Set trigger source.
Can be either
"imm","ext", or"bus".
- sleep(delay)
Wait for delay seconds
- sync_phase()
Synchronize phase between two channels
- unlock()
Unlock the access to the device from other threads/processes (isn’t necessarily implemented)
- using_write_buffer()
Context manager for using a write buffer.
While it’s active, all the consecutive
write()operations are bundled together with;delimiter. The actual write is performed at theread()/ask()operation or at the end of the block.
- wait(wait_type='sync', timeout=None, wait_callback=None)
Pause execution until device overlapped commands are complete.
wait_type is either
'sync'(performwait_sync()),'dev'(performwait_dev()) or'none'(do nothing).
- wait_dev()
Pause execution of the device commands until device overlapped commands (e.g., taking sweeps) are complete.
Note that the code execution is not paused.
- wait_sync(timeout=None, wait_callback=None)
Pause execution of the script until device overlapped commands (e.g., taking sweeps) are complete.
timeout and wait_callback override default constructor parameters.
- write(msg, arg=None, arg_type=None, unit=None, bool_selector=None, wait_sync=None, read_echo=False, read_echo_delay=0.0)
Send a command.
- Parameters:
msg (str) – Text message.
arg – Optional argument to append in the end. If a list of arguments is supplied, the result is joined with
",".arg_type (str) – Argument type. Can be
'raw'(in which case data is sent raw),'string','int','float','bool', a format string (such as'{:.3f}') or a list of argument types (for an iterable argument); if format string is used and the argument is a list or a tuple, then it is expanded as a list of arguments (e.g.,arg_type='{0};{1}'witharg=[1,2]will produce a string'1;2'); if a list of types is used, each element of arg is converted using the corresponding type, and the result is joined with",".unit (str) – If not
None, use it as a unit to append after the value.bool_selector (tuple) – A tuple
(false_value, true_value)of two strings to represent bool argument; by default, use._bool_selectorattribute.wait_sync – if
True, append the sync command (specified as._wait_sync_commattribute,"*OPC?"by default) after the message and pause the execution command is complete; useful in long set operations, where the device might ignore later inputs until the current command is complete; ifNone, use the class default._default_write_syncattribute (Falseby default).read_echo (bool) – If
True, read a single line after write.read_echo_delay (float) – The delay between write and read if
read_echo==True.
- class pylablib.devices.AWG.specific.RSInstekAFG21000(addr)[source]
Bases:
InstekAFG2000RS Instek AFG21000 series AWG.
Compared to Instek AFG2000, it takes care of the amplitude output bug.
- BackendError
alias of
DeviceBackendError
- Error
alias of
GenericAWGError
- ReraiseError
alias of
GenericAWGBackendError
- apply_settings(settings)
Apply the settings.
settings is a dict
{name: value}of the available device settings. Non-applicable settings are ignored.
- ask(msg, data_type='string', delay=0.0, timeout=None, read_echo=False)
Write a message and read a reply.
msg is the query message, delay is the delay between write and read. Other parameters are the same as in
read(). Ifread_echo==True, assume that the device first echoes the input and skip it.
- close()
Close the backend
- enable_burst(enabled=True, channel=None)
Enable burst mode
- enable_output(enabled=True, channel=None)
Turn the output on or off
- enable_sync_output(enabled=True, channel=None)
Enable or disable SYNC output
- enable_trigger_output(enabled=True, channel=None)
Enable trigger output
- flush(one_line=False)
Flush the read buffer (read all the available data and return the number of bytes read).
If
one_line==True, read only a single line.
- static get_arg_type(arg)
Autodetect argument type
- get_burst_mode(channel=None)
Get burst mode.
Can be either
"trig"or"gate".
- get_burst_ncycles(channel=None)
Get burst mode ncycles.
Infinite corresponds to a large value (>1E37).
- get_channels_number()
Get the number of channels
- get_current_channel()
Get current channel
- get_device_variable(key)
Get the value of a settings, status, or full info parameter
- get_duty_cycle(channel=None)
Get output duty cycle (in percent).
Only applies to
"square"output function.
- get_esr(timeout=None)
Get the device status register (by default,
"*ESR?"command)
- get_frequency(channel=None)
Get output frequency
- get_full_info(include=0)
Get dict
{name: value}containing full device information (including status and settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_full_status(include=0)
Get dict
{name: value}containing the device status (including settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_function(channel=None)
Get output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- get_gate_polarity(channel=None)
Get burst gate polarity.
Can be either
"norm"or"inv".
- get_id(timeout=None)
Get the device IDN. (query SCPI
'*IDN?'command)
- get_load(channel=None)
Get the output load
- get_output_polarity(channel=None)
Get output polarity.
Can be either
"norm"or"inv".
- get_output_range(channel=None)
Get output voltage range.
Return tuple
(vmin, vmax)with the low and high voltage values (i.e.,offset-amplitudeandoffset+amplitude).
- get_output_trigger_slope(channel=None)
Get output trigger slope.
Can be either
"pos", or"neg".
- get_phase(channel=None)
Get output phase (in degrees)
- get_pulse_width(channel=None)
Get output pulse width (in seconds).
Only applies to
"pulse"output function.
- get_ramp_symmetry(channel=None)
Get output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- get_settings(include=0)
Get dict
{name: value}containing all the device settings.include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_trigger_slope(channel=None)
Get trigger slope.
Can be either
"pos", or"neg".
- get_trigger_source(channel=None)
Get trigger source.
Can be either
"imm","ext", or"bus".
- is_burst_enabled(channel=None)
Check if the burst mode is enabled
- is_opened()
Check if the device is connected
- is_output_enabled(channel=None)
Check if the output is enabled
- is_sync_output_enabled(channel=None)
Check if SYNC output is enabled
- is_trigger_output_enabled(channel=None)
Check if the trigger output is enabled
- lock(timeout=None)
Lock the access to the device from other threads/processes (isn’t necessarily implemented)
- locking(timeout=None)
Context manager for lock & unlock
- open()
Open the backend
- static parse_array_data(data, fmt, include_header=False)
Parse the data returned by the device. fmt is
DataFormatdescription in numpy format (e.g.,"<u2").If
include_header==True, the data is assumed to be in a (somewhat) standard SCPI format:b'#', then a single digitsdenoting length of the size block, thensdigits denoting length of the data (in bytes) followed by the actual data. Otherwise (include_header==False), assume that the header is already removed.
- read(data_type='string', timeout=None)
Read data from the device.
data_type determines the type of the data. Can be
'raw'(just raw data),'string'(with trailing and leading spaces stripped),'int','float','bool'(interprets0or'off'asFalse, anything else asTrue),'value'(returns tuple(value, unit), where value is float), a callable (return the result of this callable applied to the string value), a dictionary (return the stored value corresponding to the string value, or to the value converted into integer if the string value is not present), or a list of data types (the result is treated as a list of values with the given types separated by commas). timeout overrides the default value.
- read_binary_array_data(include_header=False, timeout=None, flush_term=True)
Read a binary data in the from the device.
The data assumes the standard binary transfer header consisting of
"#"symbol, then a single digit with the size of the length string, then the length string containing the length of the binary data (in bytes). Ifinclude_header==True, return the data with the header; otherwise, return only the content. Ifflush_term==True, flush the following line to skip terminator characters after the binary data, which are added by some devices. timeout overrides the default value.
- reconnect(new_instrument=True, ignore_error=True)
Remake the connection.
If
new_instrument==True, create a new backend instance. Ifignore_error==True, ignore errors on closing.
- reset()
Reset the device (by default,
"*RST"command)
- select_current_channel(channel)
Select current default channel
- set_amplitude(amplitude, channel=None)
Set output amplitude (i.e., half of the span)
- set_burst_mode(mode, channel=None)
Set burst mode.
Can be either
"trig"or"gate".
- set_burst_ncycles(ncycles=1, channel=None)
Set burst mode ncycles.
Infinite corresponds to
None
- set_device_variable(key, value)
Set the value of a settings parameter
- set_duty_cycle(dcycle, channel=None)
Set output duty cycle (in percent).
Only applies to
"square"output function.
- set_frequency(frequency, channel=None)
Set output frequency
- set_function(func, channel=None)
Set output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- set_gate_polarity(polarity='norm', channel=None)
Set burst gate polarity.
Can be either
"norm"or"inv".
- set_load(load=None, channel=None)
Set the output load (
Nonemeans High-Z)
- set_offset(offset, channel=None)
Set output offset
- set_output_polarity(polarity='norm', channel=None)
Set output polarity.
Can be either
"norm"or"inv".
- set_output_range(rng, channel=None)
Set output voltage range.
If span is less than
1E-4, automatically switch to DC mode.
- set_output_trigger_slope(slope, channel=None)
Set output trigger slope.
Can be either
"pos", or"neg".
- set_phase(phase, channel=None)
Set output phase (in degrees)
- set_pulse_width(width, channel=None)
Set output pulse width (in seconds).
Only applies to
"pulse"output function.
- set_ramp_symmetry(rsymm, channel=None)
Set output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- set_trigger_slope(slope, channel=None)
Set trigger slope.
Can be either
"pos", or"neg".
- set_trigger_source(src, channel=None)
Set trigger source.
Can be either
"imm","ext", or"bus".
- sleep(delay)
Wait for delay seconds
- sync_phase()
Synchronize phase between two channels
- unlock()
Unlock the access to the device from other threads/processes (isn’t necessarily implemented)
- using_write_buffer()
Context manager for using a write buffer.
While it’s active, all the consecutive
write()operations are bundled together with;delimiter. The actual write is performed at theread()/ask()operation or at the end of the block.
- wait(wait_type='sync', timeout=None, wait_callback=None)
Pause execution until device overlapped commands are complete.
wait_type is either
'sync'(performwait_sync()),'dev'(performwait_dev()) or'none'(do nothing).
- wait_dev()
Pause execution of the device commands until device overlapped commands (e.g., taking sweeps) are complete.
Note that the code execution is not paused.
- wait_sync(timeout=None, wait_callback=None)
Pause execution of the script until device overlapped commands (e.g., taking sweeps) are complete.
timeout and wait_callback override default constructor parameters.
- write(msg, arg=None, arg_type=None, unit=None, bool_selector=None, wait_sync=None, read_echo=False, read_echo_delay=0.0)
Send a command.
- Parameters:
msg (str) – Text message.
arg – Optional argument to append in the end. If a list of arguments is supplied, the result is joined with
",".arg_type (str) – Argument type. Can be
'raw'(in which case data is sent raw),'string','int','float','bool', a format string (such as'{:.3f}') or a list of argument types (for an iterable argument); if format string is used and the argument is a list or a tuple, then it is expanded as a list of arguments (e.g.,arg_type='{0};{1}'witharg=[1,2]will produce a string'1;2'); if a list of types is used, each element of arg is converted using the corresponding type, and the result is joined with",".unit (str) – If not
None, use it as a unit to append after the value.bool_selector (tuple) – A tuple
(false_value, true_value)of two strings to represent bool argument; by default, use._bool_selectorattribute.wait_sync – if
True, append the sync command (specified as._wait_sync_commattribute,"*OPC?"by default) after the message and pause the execution command is complete; useful in long set operations, where the device might ignore later inputs until the current command is complete; ifNone, use the class default._default_write_syncattribute (Falseby default).read_echo (bool) – If
True, read a single line after write.read_echo_delay (float) – The delay between write and read if
read_echo==True.
- class pylablib.devices.AWG.specific.TektronixAFG1000(addr, channels_number='auto')[source]
Bases:
GenericAWG- get_pulse_width(channel=None)[source]
Get output pulse width (in seconds).
Only applies to
"pulse"output function.
- set_pulse_width(width, channel=None)[source]
Set output pulse width (in seconds).
Only applies to
"pulse"output function.
- BackendError
alias of
DeviceBackendError
- Error
alias of
GenericAWGError
- ReraiseError
alias of
GenericAWGBackendError
- apply_settings(settings)
Apply the settings.
settings is a dict
{name: value}of the available device settings. Non-applicable settings are ignored.
- ask(msg, data_type='string', delay=0.0, timeout=None, read_echo=False)
Write a message and read a reply.
msg is the query message, delay is the delay between write and read. Other parameters are the same as in
read(). Ifread_echo==True, assume that the device first echoes the input and skip it.
- close()
Close the backend
- enable_burst(enabled=True, channel=None)
Enable burst mode
- enable_output(enabled=True, channel=None)
Turn the output on or off
- enable_sync_output(enabled=True, channel=None)
Enable or disable SYNC output
- enable_trigger_output(enabled=True, channel=None)
Enable trigger output
- flush(one_line=False)
Flush the read buffer (read all the available data and return the number of bytes read).
If
one_line==True, read only a single line.
- get_amplitude(channel=None)
Get output amplitude (i.e., half of the span)
- static get_arg_type(arg)
Autodetect argument type
- get_burst_mode(channel=None)
Get burst mode.
Can be either
"trig"or"gate".
- get_burst_ncycles(channel=None)
Get burst mode ncycles.
Infinite corresponds to a large value (>1E37).
- get_channels_number()
Get the number of channels
- get_current_channel()
Get current channel
- get_device_variable(key)
Get the value of a settings, status, or full info parameter
- get_duty_cycle(channel=None)
Get output duty cycle (in percent).
Only applies to
"square"output function.
- get_esr(timeout=None)
Get the device status register (by default,
"*ESR?"command)
- get_frequency(channel=None)
Get output frequency
- get_full_info(include=0)
Get dict
{name: value}containing full device information (including status and settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_full_status(include=0)
Get dict
{name: value}containing the device status (including settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_function(channel=None)
Get output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- get_gate_polarity(channel=None)
Get burst gate polarity.
Can be either
"norm"or"inv".
- get_id(timeout=None)
Get the device IDN. (query SCPI
'*IDN?'command)
- get_load(channel=None)
Get the output load
- get_offset(channel=None)
Get output offset
- get_output_polarity(channel=None)
Get output polarity.
Can be either
"norm"or"inv".
- get_output_range(channel=None)
Get output voltage range.
Return tuple
(vmin, vmax)with the low and high voltage values (i.e.,offset-amplitudeandoffset+amplitude).
- get_output_trigger_slope(channel=None)
Get output trigger slope.
Can be either
"pos", or"neg".
- get_phase(channel=None)
Get output phase (in degrees)
- get_ramp_symmetry(channel=None)
Get output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- get_settings(include=0)
Get dict
{name: value}containing all the device settings.include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_trigger_slope(channel=None)
Get trigger slope.
Can be either
"pos", or"neg".
- get_trigger_source(channel=None)
Get trigger source.
Can be either
"imm","ext", or"bus".
- is_burst_enabled(channel=None)
Check if the burst mode is enabled
- is_opened()
Check if the device is connected
- is_output_enabled(channel=None)
Check if the output is enabled
- is_sync_output_enabled(channel=None)
Check if SYNC output is enabled
- is_trigger_output_enabled(channel=None)
Check if the trigger output is enabled
- lock(timeout=None)
Lock the access to the device from other threads/processes (isn’t necessarily implemented)
- locking(timeout=None)
Context manager for lock & unlock
- open()
Open the backend
- static parse_array_data(data, fmt, include_header=False)
Parse the data returned by the device. fmt is
DataFormatdescription in numpy format (e.g.,"<u2").If
include_header==True, the data is assumed to be in a (somewhat) standard SCPI format:b'#', then a single digitsdenoting length of the size block, thensdigits denoting length of the data (in bytes) followed by the actual data. Otherwise (include_header==False), assume that the header is already removed.
- read(data_type='string', timeout=None)
Read data from the device.
data_type determines the type of the data. Can be
'raw'(just raw data),'string'(with trailing and leading spaces stripped),'int','float','bool'(interprets0or'off'asFalse, anything else asTrue),'value'(returns tuple(value, unit), where value is float), a callable (return the result of this callable applied to the string value), a dictionary (return the stored value corresponding to the string value, or to the value converted into integer if the string value is not present), or a list of data types (the result is treated as a list of values with the given types separated by commas). timeout overrides the default value.
- read_binary_array_data(include_header=False, timeout=None, flush_term=True)
Read a binary data in the from the device.
The data assumes the standard binary transfer header consisting of
"#"symbol, then a single digit with the size of the length string, then the length string containing the length of the binary data (in bytes). Ifinclude_header==True, return the data with the header; otherwise, return only the content. Ifflush_term==True, flush the following line to skip terminator characters after the binary data, which are added by some devices. timeout overrides the default value.
- reconnect(new_instrument=True, ignore_error=True)
Remake the connection.
If
new_instrument==True, create a new backend instance. Ifignore_error==True, ignore errors on closing.
- reset()
Reset the device (by default,
"*RST"command)
- select_current_channel(channel)
Select current default channel
- set_amplitude(amplitude, channel=None)
Set output amplitude (i.e., half of the span)
- set_burst_mode(mode, channel=None)
Set burst mode.
Can be either
"trig"or"gate".
- set_burst_ncycles(ncycles=1, channel=None)
Set burst mode ncycles.
Infinite corresponds to
None
- set_device_variable(key, value)
Set the value of a settings parameter
- set_duty_cycle(dcycle, channel=None)
Set output duty cycle (in percent).
Only applies to
"square"output function.
- set_frequency(frequency, channel=None)
Set output frequency
- set_function(func, channel=None)
Set output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- set_gate_polarity(polarity='norm', channel=None)
Set burst gate polarity.
Can be either
"norm"or"inv".
- set_load(load=None, channel=None)
Set the output load (
Nonemeans High-Z)
- set_offset(offset, channel=None)
Set output offset
- set_output_polarity(polarity='norm', channel=None)
Set output polarity.
Can be either
"norm"or"inv".
- set_output_range(rng, channel=None)
Set output voltage range.
If span is less than
1E-4, automatically switch to DC mode.
- set_output_trigger_slope(slope, channel=None)
Set output trigger slope.
Can be either
"pos", or"neg".
- set_phase(phase, channel=None)
Set output phase (in degrees)
- set_ramp_symmetry(rsymm, channel=None)
Set output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- set_trigger_slope(slope, channel=None)
Set trigger slope.
Can be either
"pos", or"neg".
- set_trigger_source(src, channel=None)
Set trigger source.
Can be either
"imm","ext", or"bus".
- sleep(delay)
Wait for delay seconds
- sync_phase()
Synchronize phase between two channels
- unlock()
Unlock the access to the device from other threads/processes (isn’t necessarily implemented)
- using_write_buffer()
Context manager for using a write buffer.
While it’s active, all the consecutive
write()operations are bundled together with;delimiter. The actual write is performed at theread()/ask()operation or at the end of the block.
- wait(wait_type='sync', timeout=None, wait_callback=None)
Pause execution until device overlapped commands are complete.
wait_type is either
'sync'(performwait_sync()),'dev'(performwait_dev()) or'none'(do nothing).
- wait_dev()
Pause execution of the device commands until device overlapped commands (e.g., taking sweeps) are complete.
Note that the code execution is not paused.
- wait_sync(timeout=None, wait_callback=None)
Pause execution of the script until device overlapped commands (e.g., taking sweeps) are complete.
timeout and wait_callback override default constructor parameters.
- write(msg, arg=None, arg_type=None, unit=None, bool_selector=None, wait_sync=None, read_echo=False, read_echo_delay=0.0)
Send a command.
- Parameters:
msg (str) – Text message.
arg – Optional argument to append in the end. If a list of arguments is supplied, the result is joined with
",".arg_type (str) – Argument type. Can be
'raw'(in which case data is sent raw),'string','int','float','bool', a format string (such as'{:.3f}') or a list of argument types (for an iterable argument); if format string is used and the argument is a list or a tuple, then it is expanded as a list of arguments (e.g.,arg_type='{0};{1}'witharg=[1,2]will produce a string'1;2'); if a list of types is used, each element of arg is converted using the corresponding type, and the result is joined with",".unit (str) – If not
None, use it as a unit to append after the value.bool_selector (tuple) – A tuple
(false_value, true_value)of two strings to represent bool argument; by default, use._bool_selectorattribute.wait_sync – if
True, append the sync command (specified as._wait_sync_commattribute,"*OPC?"by default) after the message and pause the execution command is complete; useful in long set operations, where the device might ignore later inputs until the current command is complete; ifNone, use the class default._default_write_syncattribute (Falseby default).read_echo (bool) – If
True, read a single line after write.read_echo_delay (float) – The delay between write and read if
read_echo==True.
- class pylablib.devices.AWG.specific.RigolDG1000(addr)[source]
Bases:
GenericAWGRigol DG1000 AWG.
- BackendError
alias of
DeviceBackendError
- Error
alias of
GenericAWGError
- ReraiseError
alias of
GenericAWGBackendError
- apply_settings(settings)
Apply the settings.
settings is a dict
{name: value}of the available device settings. Non-applicable settings are ignored.
- ask(msg, data_type='string', delay=0.0, timeout=None, read_echo=False)
Write a message and read a reply.
msg is the query message, delay is the delay between write and read. Other parameters are the same as in
read(). Ifread_echo==True, assume that the device first echoes the input and skip it.
- close()
Close the backend
- enable_burst(enabled=True, channel=None)
Enable burst mode
- enable_output(enabled=True, channel=None)
Turn the output on or off
- enable_sync_output(enabled=True, channel=None)
Enable or disable SYNC output
- enable_trigger_output(enabled=True, channel=None)
Enable trigger output
- flush(one_line=False)
Flush the read buffer (read all the available data and return the number of bytes read).
If
one_line==True, read only a single line.
- get_amplitude(channel=None)
Get output amplitude (i.e., half of the span)
- static get_arg_type(arg)
Autodetect argument type
- get_burst_mode(channel=None)
Get burst mode.
Can be either
"trig"or"gate".
- get_burst_ncycles(channel=None)
Get burst mode ncycles.
Infinite corresponds to a large value (>1E37).
- get_channels_number()
Get the number of channels
- get_current_channel()
Get current channel
- get_device_variable(key)
Get the value of a settings, status, or full info parameter
- get_duty_cycle(channel=None)
Get output duty cycle (in percent).
Only applies to
"square"output function.
- get_esr(timeout=None)
Get the device status register (by default,
"*ESR?"command)
- get_frequency(channel=None)
Get output frequency
- get_full_info(include=0)
Get dict
{name: value}containing full device information (including status and settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_full_status(include=0)
Get dict
{name: value}containing the device status (including settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_function(channel=None)
Get output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- get_gate_polarity(channel=None)
Get burst gate polarity.
Can be either
"norm"or"inv".
- get_id(timeout=None)
Get the device IDN. (query SCPI
'*IDN?'command)
- get_load(channel=None)
Get the output load
- get_offset(channel=None)
Get output offset
- get_output_polarity(channel=None)
Get output polarity.
Can be either
"norm"or"inv".
- get_output_range(channel=None)
Get output voltage range.
Return tuple
(vmin, vmax)with the low and high voltage values (i.e.,offset-amplitudeandoffset+amplitude).
- get_output_trigger_slope(channel=None)
Get output trigger slope.
Can be either
"pos", or"neg".
- get_phase(channel=None)
Get output phase (in degrees)
- get_pulse_width(channel=None)
Get output pulse width (in seconds).
Only applies to
"pulse"output function.
- get_ramp_symmetry(channel=None)
Get output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- get_settings(include=0)
Get dict
{name: value}containing all the device settings.include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_trigger_slope(channel=None)
Get trigger slope.
Can be either
"pos", or"neg".
- get_trigger_source(channel=None)
Get trigger source.
Can be either
"imm","ext", or"bus".
- is_burst_enabled(channel=None)
Check if the burst mode is enabled
- is_opened()
Check if the device is connected
- is_output_enabled(channel=None)
Check if the output is enabled
- is_sync_output_enabled(channel=None)
Check if SYNC output is enabled
- is_trigger_output_enabled(channel=None)
Check if the trigger output is enabled
- lock(timeout=None)
Lock the access to the device from other threads/processes (isn’t necessarily implemented)
- locking(timeout=None)
Context manager for lock & unlock
- open()
Open the backend
- static parse_array_data(data, fmt, include_header=False)
Parse the data returned by the device. fmt is
DataFormatdescription in numpy format (e.g.,"<u2").If
include_header==True, the data is assumed to be in a (somewhat) standard SCPI format:b'#', then a single digitsdenoting length of the size block, thensdigits denoting length of the data (in bytes) followed by the actual data. Otherwise (include_header==False), assume that the header is already removed.
- read(data_type='string', timeout=None)
Read data from the device.
data_type determines the type of the data. Can be
'raw'(just raw data),'string'(with trailing and leading spaces stripped),'int','float','bool'(interprets0or'off'asFalse, anything else asTrue),'value'(returns tuple(value, unit), where value is float), a callable (return the result of this callable applied to the string value), a dictionary (return the stored value corresponding to the string value, or to the value converted into integer if the string value is not present), or a list of data types (the result is treated as a list of values with the given types separated by commas). timeout overrides the default value.
- read_binary_array_data(include_header=False, timeout=None, flush_term=True)
Read a binary data in the from the device.
The data assumes the standard binary transfer header consisting of
"#"symbol, then a single digit with the size of the length string, then the length string containing the length of the binary data (in bytes). Ifinclude_header==True, return the data with the header; otherwise, return only the content. Ifflush_term==True, flush the following line to skip terminator characters after the binary data, which are added by some devices. timeout overrides the default value.
- reconnect(new_instrument=True, ignore_error=True)
Remake the connection.
If
new_instrument==True, create a new backend instance. Ifignore_error==True, ignore errors on closing.
- reset()
Reset the device (by default,
"*RST"command)
- select_current_channel(channel)
Select current default channel
- set_amplitude(amplitude, channel=None)
Set output amplitude (i.e., half of the span)
- set_burst_mode(mode, channel=None)
Set burst mode.
Can be either
"trig"or"gate".
- set_burst_ncycles(ncycles=1, channel=None)
Set burst mode ncycles.
Infinite corresponds to
None
- set_device_variable(key, value)
Set the value of a settings parameter
- set_duty_cycle(dcycle, channel=None)
Set output duty cycle (in percent).
Only applies to
"square"output function.
- set_frequency(frequency, channel=None)
Set output frequency
- set_function(func, channel=None)
Set output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- set_gate_polarity(polarity='norm', channel=None)
Set burst gate polarity.
Can be either
"norm"or"inv".
- set_load(load=None, channel=None)
Set the output load (
Nonemeans High-Z)
- set_offset(offset, channel=None)
Set output offset
- set_output_polarity(polarity='norm', channel=None)
Set output polarity.
Can be either
"norm"or"inv".
- set_output_range(rng, channel=None)
Set output voltage range.
If span is less than
1E-4, automatically switch to DC mode.
- set_output_trigger_slope(slope, channel=None)
Set output trigger slope.
Can be either
"pos", or"neg".
- set_phase(phase, channel=None)
Set output phase (in degrees)
- set_pulse_width(width, channel=None)
Set output pulse width (in seconds).
Only applies to
"pulse"output function.
- set_ramp_symmetry(rsymm, channel=None)
Set output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- set_trigger_slope(slope, channel=None)
Set trigger slope.
Can be either
"pos", or"neg".
- set_trigger_source(src, channel=None)
Set trigger source.
Can be either
"imm","ext", or"bus".
- sleep(delay)
Wait for delay seconds
- unlock()
Unlock the access to the device from other threads/processes (isn’t necessarily implemented)
- using_write_buffer()
Context manager for using a write buffer.
While it’s active, all the consecutive
write()operations are bundled together with;delimiter. The actual write is performed at theread()/ask()operation or at the end of the block.
- wait(wait_type='sync', timeout=None, wait_callback=None)
Pause execution until device overlapped commands are complete.
wait_type is either
'sync'(performwait_sync()),'dev'(performwait_dev()) or'none'(do nothing).
- wait_dev()
Pause execution of the device commands until device overlapped commands (e.g., taking sweeps) are complete.
Note that the code execution is not paused.
- wait_sync(timeout=None, wait_callback=None)
Pause execution of the script until device overlapped commands (e.g., taking sweeps) are complete.
timeout and wait_callback override default constructor parameters.
- write(msg, arg=None, arg_type=None, unit=None, bool_selector=None, wait_sync=None, read_echo=False, read_echo_delay=0.0)
Send a command.
- Parameters:
msg (str) – Text message.
arg – Optional argument to append in the end. If a list of arguments is supplied, the result is joined with
",".arg_type (str) – Argument type. Can be
'raw'(in which case data is sent raw),'string','int','float','bool', a format string (such as'{:.3f}') or a list of argument types (for an iterable argument); if format string is used and the argument is a list or a tuple, then it is expanded as a list of arguments (e.g.,arg_type='{0};{1}'witharg=[1,2]will produce a string'1;2'); if a list of types is used, each element of arg is converted using the corresponding type, and the result is joined with",".unit (str) – If not
None, use it as a unit to append after the value.bool_selector (tuple) – A tuple
(false_value, true_value)of two strings to represent bool argument; by default, use._bool_selectorattribute.wait_sync – if
True, append the sync command (specified as._wait_sync_commattribute,"*OPC?"by default) after the message and pause the execution command is complete; useful in long set operations, where the device might ignore later inputs until the current command is complete; ifNone, use the class default._default_write_syncattribute (Falseby default).read_echo (bool) – If
True, read a single line after write.read_echo_delay (float) – The delay between write and read if
read_echo==True.
- class pylablib.devices.AWG.specific.RigolDG1020Z(addr)[source]
Bases:
GenericAWGRigol DG1020Z AWG.
- BackendError
alias of
DeviceBackendError
- Error
alias of
GenericAWGError
- ReraiseError
alias of
GenericAWGBackendError
- apply_settings(settings)
Apply the settings.
settings is a dict
{name: value}of the available device settings. Non-applicable settings are ignored.
- ask(msg, data_type='string', delay=0.0, timeout=None, read_echo=False)
Write a message and read a reply.
msg is the query message, delay is the delay between write and read. Other parameters are the same as in
read(). Ifread_echo==True, assume that the device first echoes the input and skip it.
- close()
Close the backend
- enable_burst(enabled=True, channel=None)
Enable burst mode
- enable_output(enabled=True, channel=None)
Turn the output on or off
- enable_sync_output(enabled=True, channel=None)
Enable or disable SYNC output
- enable_trigger_output(enabled=True, channel=None)
Enable trigger output
- flush(one_line=False)
Flush the read buffer (read all the available data and return the number of bytes read).
If
one_line==True, read only a single line.
- get_amplitude(channel=None)
Get output amplitude (i.e., half of the span)
- static get_arg_type(arg)
Autodetect argument type
- get_burst_mode(channel=None)
Get burst mode.
Can be either
"trig"or"gate".
- get_burst_ncycles(channel=None)
Get burst mode ncycles.
Infinite corresponds to a large value (>1E37).
- get_channels_number()
Get the number of channels
- get_current_channel()
Get current channel
- get_device_variable(key)
Get the value of a settings, status, or full info parameter
- get_duty_cycle(channel=None)
Get output duty cycle (in percent).
Only applies to
"square"output function.
- get_esr(timeout=None)
Get the device status register (by default,
"*ESR?"command)
- get_frequency(channel=None)
Get output frequency
- get_full_info(include=0)
Get dict
{name: value}containing full device information (including status and settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_full_status(include=0)
Get dict
{name: value}containing the device status (including settings).include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_function(channel=None)
Get output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- get_gate_polarity(channel=None)
Get burst gate polarity.
Can be either
"norm"or"inv".
- get_id(timeout=None)
Get the device IDN. (query SCPI
'*IDN?'command)
- get_load(channel=None)
Get the output load
- get_offset(channel=None)
Get output offset
- get_output_polarity(channel=None)
Get output polarity.
Can be either
"norm"or"inv".
- get_output_range(channel=None)
Get output voltage range.
Return tuple
(vmin, vmax)with the low and high voltage values (i.e.,offset-amplitudeandoffset+amplitude).
- get_output_trigger_slope(channel=None)
Get output trigger slope.
Can be either
"pos", or"neg".
- get_phase(channel=None)
Get output phase (in degrees)
- get_pulse_width(channel=None)
Get output pulse width (in seconds).
Only applies to
"pulse"output function.
- get_ramp_symmetry(channel=None)
Get output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- get_settings(include=0)
Get dict
{name: value}containing all the device settings.include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or
"all"(all available variables). Since the lowest priority is -10, settinginclude=-10queries all available variables, which is equivalent toinclude="all".
- get_trigger_slope(channel=None)
Get trigger slope.
Can be either
"pos", or"neg".
- get_trigger_source(channel=None)
Get trigger source.
Can be either
"imm","ext", or"bus".
- is_burst_enabled(channel=None)
Check if the burst mode is enabled
- is_opened()
Check if the device is connected
- is_output_enabled(channel=None)
Check if the output is enabled
- is_sync_output_enabled(channel=None)
Check if SYNC output is enabled
- is_trigger_output_enabled(channel=None)
Check if the trigger output is enabled
- lock(timeout=None)
Lock the access to the device from other threads/processes (isn’t necessarily implemented)
- locking(timeout=None)
Context manager for lock & unlock
- open()
Open the backend
- static parse_array_data(data, fmt, include_header=False)
Parse the data returned by the device. fmt is
DataFormatdescription in numpy format (e.g.,"<u2").If
include_header==True, the data is assumed to be in a (somewhat) standard SCPI format:b'#', then a single digitsdenoting length of the size block, thensdigits denoting length of the data (in bytes) followed by the actual data. Otherwise (include_header==False), assume that the header is already removed.
- read(data_type='string', timeout=None)
Read data from the device.
data_type determines the type of the data. Can be
'raw'(just raw data),'string'(with trailing and leading spaces stripped),'int','float','bool'(interprets0or'off'asFalse, anything else asTrue),'value'(returns tuple(value, unit), where value is float), a callable (return the result of this callable applied to the string value), a dictionary (return the stored value corresponding to the string value, or to the value converted into integer if the string value is not present), or a list of data types (the result is treated as a list of values with the given types separated by commas). timeout overrides the default value.
- read_binary_array_data(include_header=False, timeout=None, flush_term=True)
Read a binary data in the from the device.
The data assumes the standard binary transfer header consisting of
"#"symbol, then a single digit with the size of the length string, then the length string containing the length of the binary data (in bytes). Ifinclude_header==True, return the data with the header; otherwise, return only the content. Ifflush_term==True, flush the following line to skip terminator characters after the binary data, which are added by some devices. timeout overrides the default value.
- reconnect(new_instrument=True, ignore_error=True)
Remake the connection.
If
new_instrument==True, create a new backend instance. Ifignore_error==True, ignore errors on closing.
- reset()
Reset the device (by default,
"*RST"command)
- select_current_channel(channel)
Select current default channel
- set_amplitude(amplitude, channel=None)
Set output amplitude (i.e., half of the span)
- set_burst_mode(mode, channel=None)
Set burst mode.
Can be either
"trig"or"gate".
- set_burst_ncycles(ncycles=1, channel=None)
Set burst mode ncycles.
Infinite corresponds to
None
- set_device_variable(key, value)
Set the value of a settings parameter
- set_duty_cycle(dcycle, channel=None)
Set output duty cycle (in percent).
Only applies to
"square"output function.
- set_frequency(frequency, channel=None)
Set output frequency
- set_function(func, channel=None)
Set output function.
Can be one of the following:
"sine","square","ramp","pulse","noise","prbs","DC","user","arb". Not all functions can be available, depending on the particular model of the generator.
- set_gate_polarity(polarity='norm', channel=None)
Set burst gate polarity.
Can be either
"norm"or"inv".
- set_load(load=None, channel=None)
Set the output load (
Nonemeans High-Z)
- set_offset(offset, channel=None)
Set output offset
- set_output_polarity(polarity='norm', channel=None)
Set output polarity.
Can be either
"norm"or"inv".
- set_output_range(rng, channel=None)
Set output voltage range.
If span is less than
1E-4, automatically switch to DC mode.
- set_output_trigger_slope(slope, channel=None)
Set output trigger slope.
Can be either
"pos", or"neg".
- set_phase(phase, channel=None)
Set output phase (in degrees)
- set_pulse_width(width, channel=None)
Set output pulse width (in seconds).
Only applies to
"pulse"output function.
- set_ramp_symmetry(rsymm, channel=None)
Set output ramp symmetry (in percent).
Only applies to
"ramp"output function.
- set_trigger_slope(slope, channel=None)
Set trigger slope.
Can be either
"pos", or"neg".
- set_trigger_source(src, channel=None)
Set trigger source.
Can be either
"imm","ext", or"bus".
- sleep(delay)
Wait for delay seconds
- unlock()
Unlock the access to the device from other threads/processes (isn’t necessarily implemented)
- using_write_buffer()
Context manager for using a write buffer.
While it’s active, all the consecutive
write()operations are bundled together with;delimiter. The actual write is performed at theread()/ask()operation or at the end of the block.
- wait(wait_type='sync', timeout=None, wait_callback=None)
Pause execution until device overlapped commands are complete.
wait_type is either
'sync'(performwait_sync()),'dev'(performwait_dev()) or'none'(do nothing).
- wait_dev()
Pause execution of the device commands until device overlapped commands (e.g., taking sweeps) are complete.
Note that the code execution is not paused.
- wait_sync(timeout=None, wait_callback=None)
Pause execution of the script until device overlapped commands (e.g., taking sweeps) are complete.
timeout and wait_callback override default constructor parameters.
- write(msg, arg=None, arg_type=None, unit=None, bool_selector=None, wait_sync=None, read_echo=False, read_echo_delay=0.0)
Send a command.
- Parameters:
msg (str) – Text message.
arg – Optional argument to append in the end. If a list of arguments is supplied, the result is joined with
",".arg_type (str) – Argument type. Can be
'raw'(in which case data is sent raw),'string','int','float','bool', a format string (such as'{:.3f}') or a list of argument types (for an iterable argument); if format string is used and the argument is a list or a tuple, then it is expanded as a list of arguments (e.g.,arg_type='{0};{1}'witharg=[1,2]will produce a string'1;2'); if a list of types is used, each element of arg is converted using the corresponding type, and the result is joined with",".unit (str) – If not
None, use it as a unit to append after the value.bool_selector (tuple) – A tuple
(false_value, true_value)of two strings to represent bool argument; by default, use._bool_selectorattribute.wait_sync – if
True, append the sync command (specified as._wait_sync_commattribute,"*OPC?"by default) after the message and pause the execution command is complete; useful in long set operations, where the device might ignore later inputs until the current command is complete; ifNone, use the class default._default_write_syncattribute (Falseby default).read_echo (bool) – If
True, read a single line after write.read_echo_delay (float) – The delay between write and read if
read_echo==True.