inspy.instrument.oscilloscope
Oscilloscope interfaces.
- class inspy.instrument.oscilloscope.OscilloscopeAgilentDSO6012A(visa_address=None, transport=None)[source]
Bases:
OscilloscopeAgilent6000XSeriesBaseOscilloscope instrument class for the Agilent DSO6012A.
It inherits all the methods from base class and adds none.
Reference: https://www.keysight.com/gb/en/assets/9018-08107/programming-guides/9018-08107.pdf
- ChannelCoupling: list[str] = ['AC', 'DC']
- MeasurementAverageType = ['AC', 'DC']
- MeasurementInterval = ['CYCL', 'DISP', 'AUTO']
- MeasurementThresholdType = ['STANDARD', 'PERC', 'ABS']
- MeasurementWindow = ['MAIN', 'ZOOM', 'AUTO']
- TimebaseReference: list[str] = ['LEFT', 'CENT', 'RIGH']
- TriggerCoupling: list[str] = ['AC', 'DC', 'LFR']
- TriggerMode: list[str] = ['NONE', 'EDGE', 'GLIT', 'PATT', 'CAN', 'DUR', 'I2S', 'IIC', 'EBUR', 'LIN', 'M1553', 'SEQ', 'SPI', 'TV', 'UART', 'USB', 'FLEX']
- TriggerSlope: list[str] = ['POS', 'NEG', 'EITH', 'ALT']
- TriggerSweep: list[str] = ['NORM', 'AUTO']
- auto_log_level: int = 20
The log level used for automatic logging of method calls.
To disable logging set to logging.NOTSET.
- await_completion()
Wait for the instrument to complete the current operation.
- Return type:
None
- channel_error_message = 'Valid channel(s): '
- channels: list[int] = [1, 2]
- connect()
Connect to instrument using the transport layer.
- Return type:
None
- digitize()
Capture a single waveform using the trigger.
- Raises:
VisaIOError – If timeout (self.transport.resource.timeout) expired
whilst waiting for trigger –
- Return type:
None
- disconnect()
- Return type:
None
- get_channel_attenuation(channel)
Set the configured attenuation of the channel.
- Return type:
float
- get_channel_bw_limit(channel)
Get the state of the 25 MHz low-pass filter.
- Return type:
bool
- get_channel_coupling(channel)
Get coupling type.
- Return type:
str
- get_channel_offset(channel)
Get the voltage offset.
- Return type:
float
- get_channel_range(channel)
Get the total voltage range for the capture.
- Return type:
float
- get_channel_state(channel)
Get the state of the capture and display for the channel.
- Return type:
bool
- get_errors()
Get a list of errors and error numbers from the instrument.
- Return type:
list[tuple[int,str]]- Returns:
A list where each value is a tuple of the error number and error description
- get_id()
Identification Query.
- Return type:
str- Returns:
Instrument Identification String.
- get_measurement_amplitude(channel)
Measure the the amplitude of the selected waveform in volts.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
The amplitude of the selected waveform in volts.
- get_measurement_average(channel, interval)
Measure the calculated average voltage.
- Parameters:
channel (
int) – Channel numberinterval ('CYCL' | 'DISP' | 'AUTO') – The interval to measure the average over
- Return type:
float- Returns:
Calculated average voltage.
- get_measurement_base(channel)
Measure the value at the base of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Value at the base of the selected waveform.
- get_measurement_counter(channel)
Measure the counter frequency in Hertz.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Counter frequency in Hertz.
- get_measurement_delay(channel_a, channel_b)
Measure the delay time in seconds between two channels.
See also:
set_measurement_edge_spec- Parameters:
channel_a (
int) – Channel numberchannel_b (
int) – Channel number
- Return type:
float- Returns:
Delay time in seconds.
- get_measurement_duty_cycle(channel)
Measure the ratio of positive pulse width to period.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Ratio of positive pulse width to period.
- get_measurement_fall_time(channel)
Measure the time in seconds between the lower and upper thresholds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Time in seconds between the lower and upper thresholds.
- get_measurement_frequency(channel)
Measure the frequency in Hertz.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Frequency in Hertz.
- get_measurement_max(channel)
Measure the maximum voltage of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Maximum voltage of the selected waveform.
- get_measurement_min(channel)
Measure the minimum voltage of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Minimum voltage of the selected waveform.
- get_measurement_negative_pulse_width(channel)
Measure the negative pulse width in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Negative pulse width in seconds.
- get_measurement_overshoot(channel)
Measure the the ratio of the overshoot of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
The ratio of the overshoot of the selected waveform.
- get_measurement_peak_to_peak(channel)
Measure the voltage peak-to-peak of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Voltage peak-to-peak of the selected waveform.
- get_measurement_period(channel)
Measure the waveform period in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Waveform period in seconds.
- get_measurement_phase(channel_a, channel_b)
Measure the the phase angle value in degrees between two channels.
- Parameters:
channel_a (
int) – Channel numberchannel_b (
int) – Channel number
- Return type:
float- Returns:
The phase angle value in degrees.
- get_measurement_positive_pulse_width(channel)
Measure the width of positive pulse in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Width of positive pulse in seconds.
- get_measurement_pre_shoot(channel)
Measure the the percent of pre-shoot of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
The percent of pre-shoot of the selected waveform.
- get_measurement_rise_time(channel)
Measure the rise time in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Rise time in seconds.
- get_measurement_rms(channel, interval)
Measure the calculated RMS voltage.
- Parameters:
channel (
int) – Channel numberinterval ('CYCL' | 'DISP' | 'AUTO') – The interval to measure the RMS over
type – AC or DC RMS calculation
- Return type:
float- Returns:
Calculated RMS voltage.
- get_measurement_transition_time(channel, positive, occurrence)
Measure the time in seconds of the specified transition.
- Parameters:
channel (
int) – Channel numberpositive (
bool) – Positive (True) or negative (False) edgeoccurrence (
int) – Which edge to measure the time to
- Return type:
float- Returns:
Time in seconds of the specified transition.
- get_measurement_value_time(channel, positive, value, occurrence)
Measure the time in seconds of the specified value crossing.
- Parameters:
channel (
int) – Channel numberpositive (
bool) – Positive (True) or negative (False) edgevalue (
float) – Voltage level whose crossing is measuredoccurrence (
int) – Which edge to measure the time to
- Return type:
float- Returns:
Time in seconds of the specified value crossing.
- get_measurement_voltage_at_time(channel, time)
Measure the voltage at the specified time.
- Parameters:
channel (
int) – Channel numbertime (
float) – Time offset in seconds
- Return type:
float- Returns:
Voltage at the specified time.
- get_measurement_voltage_at_top(channel)
Measure the voltage at the top of the waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Voltage at the top of the waveform.
- get_screenshot()
Get screenshot from the scope as PNG format bytes.
- Return type:
bytes
- Example - Save to disk:
>>> from pathlib import Path >>> Path('screenshot.png').write_bytes(scope.get_screenshot())
- Example - Open with PIL and then save as a JPEG:
>>> import PIL.Image >>> from io import BytesIO >>> im = PIL.Image.open(BytesIO(scope.get_screenshot())) >>> im.save('screenshot.jpg')
- Example - View in Jupyter notebook
>>> from IPython.display import Image >>> Image(scope.get_screenshot())
- get_setup()
Get setup from the scope as bytes of a .scp file.
- Return type:
bytes
- Example - Save to disk:
>>> from pathlib import Path >>> Path('setup.scp').write_bytes(scope.get_setup())
- get_timebase_range()
Get the timebase range in seconds.
- Return type:
float
- get_timebase_reference()
Get the position of the trigger in the waveform.
- Return type:
str
- get_trigger_coupling()
Get trigger input coupling type.
- Return type:
str
- get_trigger_edge_level()
Get the voltage threshold of trigger.
- Return type:
float
- get_trigger_edge_source()
Get the channel monitored.
- Return type:
int
- get_trigger_hold_off()
Get configured minimum gap between triggers.
- Return type:
float
- get_trigger_mode()
Get the mode (e.g. edge, glitch, etc).
- Return type:
str
- get_trigger_noise_reject()
Get state of noise rejection filter.
- Return type:
bool
- get_trigger_slope()
Get edge sensitivity type.
Not valid in TV mode.
- Return type:
str
- get_trigger_sweep()
Get the sweep mode of the trigger.
NORMAL: only trigger when condition met AUTO: if trigger isn’t fired regularly then trigger anyway.
- Return type:
str
- get_waveform(channel)
Get the waveform data of a capture.
First scope.trigger_now() or scope.digitize().
- Parameters:
channel (
int) – Channel to get the waveform data from- Return type:
tuple[list[float],list[float]]- Returns:
A tuple with the first element being a list of the time values and the second being a list of the voltages
- is_connected: bool
- logger: logging.Logger
- reset()
Reset and clear the scope configuration.
- Return type:
None
- run()
Start continuous capture of waveforms.
- Return type:
None
- set_channel(channel, voltage_range, offset=0.0, coupling='DC', attenuation=10.0, bw_limit=False, state=True)
Configure input channel.
- Parameters:
channel (
int) – Number of the channel starting at 1voltage_range (
float) – Total voltage range for the captureoffset (
float) – Voltage range: {offset - range / 2, offset + range / 2}.coupling ('AC' | 'DC') – AC or DC coupling.
attenuation (
float) – Default of 10.0 for 10x scope probes, set to 1.0 otherwisebw_limit (
bool) – Enable the 25 MHz low-pass filter.state (
bool) – Enable or disable capture and display of the channel.
- Return type:
None
- set_channel_attenuation(channel, attenuation)
Set the attenuation of the channel / probe.
Note that this effectively changes the channel’s input voltage range so it’s recommended that this is set first.
The probe attenuation factor may be 0.1 to 1000.
- Return type:
None
- set_channel_bw_limit(channel, bw_limit=True)
Enable the 25 MHz low-pass filter.
- Return type:
None
- set_channel_coupling(channel, coupling)
Set the channel coupling.
- Parameters:
channel (
int) – Number of the channel starting at 1coupling ('AC' | 'DC') – AC or DC coupling
- Return type:
None
- set_channel_offset(channel, offset)
Set the voltage offset.
The voltage range will be: {offset - range / 2, offset + range / 2}
- Return type:
None
- set_channel_range(channel, voltage_range)
Set the total voltage range for the capture.
- Return type:
None
- set_channel_state(channel, state=True)
Enable capture and display of the channel.
- Return type:
None
- set_measurement_edge_spec(edge_1, edge_2)
Set specify the edge numbers used for measuring the delay between.
- See:
get_measurement_delay
- Parameters:
edge_1 (
int) – The edge number to start measuring the delay fromedge_2 (
int) – The edge number to stop measuring the delay at
- Return type:
None
- set_measurement_threshold_spec(threshold_type, upper=None, middle=None, lower=None)
Configure the thresholds used by many measurement functions.
Note that the standard and percentage thresholds are relative to the histogram derived range of the waveform.
Note: The standard type uses 90%, 50%, 10% as the upper, middle, lower thresholds The percentage type uses the percentage of the histogram derived range (0-100) The absolute type uses the absolute voltage value (can be floating point)
- Parameters:
threshold_type ('STANDARD' | 'PERC' | 'ABS') – The type of threshold to set
upper (
Optional[float]) – Lower threshold as percentage or absolute value depending on typemiddle (
Optional[float]) – Lower threshold as percentage or absolute value depending on typelower (
Optional[float]) – Lower threshold as percentage or absolute value depending on type
- Return type:
None
- set_measurement_window(window_type)
Use the zoomed window or the full time base for measurement functions.
- Parameters:
window_type ('MAIN' | 'ZOOM' | 'AUTO') – The window type, auto will use the zoomed if available
- Return type:
None
- set_setup(data)
Configure the scope using bytes of a .scp file.
- Return type:
None
- Example - Load from disk:
>>> from pathlib import Path >>> scope.set_setup(Path('setup.scp').read_bytes())
- set_timebase(timebase_range, reference='CENT')
Configure the timebase.
- Parameters:
timebase_range (
float) – The duration of the captured waveform in seconds (not the time per division).reference ('LEFT' | 'CENT' | 'RIGH') – The position of the trigger in the waveform.
- Return type:
None
- set_timebase_range(timebase_range)
Configure the timebase range in seconds.
- Return type:
None
- set_timebase_reference(reference='CENT')
Configure the position of the trigger in the waveform.
- Parameters:
reference ('LEFT' | 'CENT' | 'RIGH') – The position of the trigger in the waveform.
- Return type:
None
- set_trigger(sweep, channel, level, slope, coupling='DC', mode='EDGE', noise_reject=False, hold_off=None)
Configure trigger.
- Parameters:
sweep ('NORM' | 'AUTO') – NORMAL: only trigger when condition met, or AUTO: if trigger isn’t fired regularly then trigger anyway
channel (
int) – Channel to monitorlevel (
float) – Voltage threshold of triggerslope ('POS' | 'NEG' | 'EITH' | 'ALT') – Positive, negative, etc edge sensitive
coupling ('AC' | 'DC' | 'LFR') – Trigger input coupling type
noise_reject (
bool) – Enable the noise reject filter.hold_off (
Optional[float]) – Time in seconds after a trigger before another trigger may fire.mode ('NONE' | 'EDGE' | 'GLIT' | 'PATT' | 'CAN' | 'DUR' | 'I2S' | 'IIC' | 'EBUR' | 'LIN' | 'M1553' | 'SEQ' | 'SPI' | 'TV' | 'UART' | 'USB' | 'FLEX') – Current only edge mode is supported.
- Raises:
NotImplementedError – If mode is not ‘EDGE’
- Return type:
None
- set_trigger_edge_coupling(coupling)
Set trigger input coupling type.
- Parameters:
coupling ('AC' | 'DC' | 'LFR') – Trigger input coupling type
- Return type:
None
- set_trigger_edge_level(level)
Set the voltage threshold of trigger.
- Return type:
None
- set_trigger_edge_slope(slope)
Set positive, negative, etc edge sensitive.
NOTE: Not valid in TV mode.
- Parameters:
slope ('POS' | 'NEG' | 'EITH' | 'ALT') – Positive, negative, etc edge sensitive
- Return type:
None
- set_trigger_edge_source(channel)
Set the channel monitored.
- Return type:
None
- set_trigger_hold_off(hold_off)
Set minimum gap between triggers.
Range is 6e-8 s to 10 s.
- Return type:
None
- set_trigger_mode(mode)
Set the trigger mode.
- Parameters:
mode ('NONE' | 'EDGE' | 'GLIT' | 'PATT' | 'CAN' | 'DUR' | 'I2S' | 'IIC' | 'EBUR' | 'LIN' | 'M1553' | 'SEQ' | 'SPI' | 'TV' | 'UART' | 'USB' | 'FLEX') – Mode to be set.
- Return type:
None
- set_trigger_noise_reject(noise_reject=True)
Enable noise rejection filter.
- Return type:
None
- set_trigger_sweep(sweep)
Set the sweep mode of the trigger.
- Parameters:
sweep ('NORM' | 'AUTO') – NORMAL: only trigger when condition met, or AUTO: if trigger isn’t fired regularly then trigger anyway
- Return type:
None
- single()
Capture a single waveform using the trigger.
- Return type:
None
- stop()
Stop continuous capture of waveforms.
- Return type:
None
- transport: PyVisaTransport
- trigger_now()
Force an immediate capture of data irrespective of the trigger.
- Return type:
None
- exception inspy.instrument.oscilloscope.OscilloscopeError(errors)[source]
Bases:
InstrumentErrorBase class for errors raised by the oscilloscopes.
- args
-
errors:
list[tuple[int,str]]
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class inspy.instrument.oscilloscope.OscilloscopeKeysightDSOX1102G(visa_address=None, transport=None)[source]
Bases:
OscilloscopeKeysight1000XSeriesBaseOscilloscope instrument class for the Keysight DSO-X 1102G.
It inherits all the methods from base class and adds one, (get_measurement_bit_rate).
Reference: https://www.keysight.com/zz/en/assets/9018-07554/programming-guides/9018-07554.pdf
- ChannelCoupling: list[str] = ['AC', 'DC']
- MeasurementAverageType = ['AC', 'DC']
- MeasurementInterval = ['CYCL', 'DISP']
- MeasurementThresholdType = ['STANDARD', 'PERC', 'ABS']
- MeasurementWindow = ['MAIN', 'ZOOM', 'AUTO']
- TimebaseReference: list[str] = ['LEFT', 'CENT', 'RIGH']
- TriggerCoupling: list[str] = ['AC', 'DC', 'LFR']
- TriggerMode: list[str] = ['EDGE', 'GLIT', 'PATT', 'SHOL', 'TRAN', 'TV', 'SBUS1']
- TriggerSlope: list[str] = ['POS', 'NEG', 'EITH', 'ALT']
- TriggerSweep: list[str] = ['NORM', 'AUTO']
- WavegenFunction = ['SIN', 'SQU', 'RAMP', 'PULS', 'NOIS', 'DC']
- WavegenImpedance = ['ONEM', 'FIFT']
- auto_log_level: int = 20
The log level used for automatic logging of method calls.
To disable logging set to logging.NOTSET.
- await_completion()
Wait for the instrument to complete the current operation.
- Return type:
None
- channel_error_message = 'Valid channel(s): '
- channels: list[int] = [1, 2]
- connect()
Connect to instrument using the transport layer.
- Return type:
None
- digitize()
Capture a single waveform using the trigger.
- Raises:
VisaIOError – If timeout (self.transport.resource.timeout) expired
whilst waiting for trigger –
- Return type:
None
- disconnect()
- Return type:
None
- get_channel_attenuation(channel)
Set the configured attenuation of the channel.
- Return type:
float
- get_channel_bw_limit(channel)
Get the state of the 25 MHz low-pass filter.
- Return type:
bool
- get_channel_coupling(channel)
Get coupling type.
- Return type:
str
- get_channel_offset(channel)
Get the voltage offset.
- Return type:
float
- get_channel_range(channel)
Get the total voltage range for the capture.
- Return type:
float
- get_channel_state(channel)
Get the state of the capture and display for the channel.
- Return type:
bool
- get_errors()
Get a list of errors and error numbers from the instrument.
- Return type:
list[tuple[int,str]]- Returns:
A list where each value is a tuple of the error number and error description
- get_id()
Identification Query.
- Return type:
str- Returns:
Instrument Identification String.
- get_measurement_amplitude(channel)
Measure the the amplitude of the selected waveform in volts.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
The amplitude of the selected waveform in volts.
- get_measurement_average(channel, interval)
Measure the calculated average voltage.
- Parameters:
channel (
int) – Channel numberinterval (
str) – The interval / window to measure the average over
- Return type:
float- Returns:
Calculated average voltage.
- get_measurement_base(channel)
Measure the value at the base of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Value at the base of the selected waveform.
- get_measurement_counter(channel)
Measure the counter frequency in Hertz.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Counter frequency in Hertz.
- get_measurement_delay(channel_a, channel_b)
Measure the delay time in seconds between two channels.
See also:
set_measurement_edge_spec- Parameters:
channel_a (
int) – Channel numberchannel_b (
int) – Channel number
- Return type:
float- Returns:
Delay time in seconds.
- get_measurement_duty_cycle(channel)
Measure the ratio of positive pulse width to period.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Ratio of positive pulse width to period.
- get_measurement_fall_time(channel)
Measure the time in seconds between the lower and upper thresholds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Time in seconds between the lower and upper thresholds.
- get_measurement_frequency(channel)
Measure the frequency in Hertz.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Frequency in Hertz.
- get_measurement_max(channel)
Measure the maximum voltage of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Maximum voltage of the selected waveform.
- get_measurement_min(channel)
Measure the minimum voltage of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Minimum voltage of the selected waveform.
- get_measurement_negative_duty_cycle(channel)
Measure the ratio of negative pulse width to period.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Ratio of negative pulse width to period.
- get_measurement_negative_pulse_width(channel)
Measure the negative pulse width in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Negative pulse width in seconds.
- get_measurement_overshoot(channel)
Measure the the ratio of the overshoot of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
The ratio of the overshoot of the selected waveform.
- get_measurement_peak_to_peak(channel)
Measure the voltage peak-to-peak of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Voltage peak-to-peak of the selected waveform.
- get_measurement_period(channel)
Measure the waveform period in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Waveform period in seconds.
- get_measurement_phase(channel_a, channel_b)
Measure the the phase angle value in degrees between two channels.
- Parameters:
channel_a (
int) – Channel numberchannel_b (
int) – Channel number
- Return type:
float- Returns:
The phase angle value in degrees.
- get_measurement_positive_pulse_width(channel)
Measure the width of positive pulse in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Width of positive pulse in seconds.
- get_measurement_pre_shoot(channel)
Measure the the percent of pre-shoot of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
The percent of pre-shoot of the selected waveform.
- get_measurement_rise_time(channel)
Measure the rise time in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Rise time in seconds.
- get_measurement_rms(channel, interval, avg_type)
Measure the calculated RMS voltage.
- Parameters:
channel (
int) – Channel numberinterval ('CYCL' | 'DISP') – The interval / window to measure the average over
avg_type ('AC' | 'DC') – The type of average to calculate
- Return type:
float- Returns:
Calculated RMS voltage.
- get_measurement_transition_time(channel, positive, occurrence)
Measure the time in seconds of the specified transition.
- Parameters:
channel (
int) – Channel numberpositive (
bool) – Positive (True) or negative (False) edgeoccurrence (
int) – Which edge to measure the time to
- Return type:
float- Returns:
Time in seconds of the specified transition.
- get_measurement_value_time(channel, positive, value, occurrence)
Measure the time in seconds of the specified value crossing.
- Parameters:
channel (
int) – Channel numberpositive (
bool) – Positive (True) or negative (False) edgevalue (
float) – Voltage level whose crossing is measuredoccurrence (
int) – Which edge to measure the time to
- Return type:
float- Returns:
Time in seconds of the specified value crossing.
- get_measurement_voltage_at_time(channel, time)
Measure the voltage at the specified time.
- Parameters:
channel (
int) – Channel numbertime (
float) – Time offset in seconds
- Return type:
float- Returns:
Voltage at the specified time.
- get_measurement_voltage_at_top(channel)
Measure the voltage at the top of the waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Voltage at the top of the waveform.
- get_screenshot()
Get screenshot from the scope as PNG format bytes.
- Return type:
bytes
- Example - Save to disk:
>>> from pathlib import Path >>> Path('screenshot.png').write_bytes(scope.get_screenshot())
- Example - Open with PIL and then save as a JPEG:
>>> import PIL.Image >>> from io import BytesIO >>> im = PIL.Image.open(BytesIO(scope.get_screenshot())) >>> im.save('screenshot.jpg')
- Example - View in Jupyter notebook
>>> from IPython.display import Image >>> Image(scope.get_screenshot())
- get_setup()
Get setup from the scope as bytes of a .scp file.
- Return type:
bytes
- Example - Save to disk:
>>> from pathlib import Path >>> Path('setup.scp').write_bytes(scope.get_setup())
- get_timebase_range()
Get the timebase range in seconds.
- Return type:
float
- get_timebase_reference()
Get the position of the trigger in the waveform.
- Return type:
str
- get_trigger_coupling()
Get trigger input coupling type.
- Return type:
str
- get_trigger_edge_level()
Get the voltage threshold of trigger.
- Return type:
float
- get_trigger_edge_source()
Get the channel monitored.
- Return type:
int
- get_trigger_hold_off()
Get configured minimum gap between triggers.
- Return type:
float
- get_trigger_mode()
Get the mode (e.g. edge, glitch, etc).
- Return type:
str
- get_trigger_noise_reject()
Get state of noise rejection filter.
- Return type:
bool
- get_trigger_slope()
Get edge sensitivity type.
Not valid in TV mode.
- Return type:
str
- get_trigger_sweep()
Get the sweep mode of the trigger.
NORMAL: only trigger when condition met AUTO: if trigger isn’t fired regularly then trigger anyway.
- Return type:
str
- get_waveform(channel)
Get the waveform data of a capture.
First scope.trigger_now() or scope.digitize().
- Parameters:
channel (
int) – Channel to get the waveform data from- Return type:
tuple[list[float],list[float]]- Returns:
A tuple with the first element being a list of the time values and the second being a list of the voltages
- is_connected: bool
- logger: logging.Logger
- reset()
Reset and clear the scope configuration.
- Return type:
None
- run()
Start continuous capture of waveforms.
- Return type:
None
- set_channel(channel, voltage_range, offset=0.0, coupling='DC', attenuation=10.0, bw_limit=False, state=True)
Configure input channel.
- Parameters:
channel (
int) – Number of the channel starting at 1voltage_range (
float) – Total voltage range for the captureoffset (
float) – Voltage range: {offset - range / 2, offset + range / 2}.coupling ('AC' | 'DC') – Coupling type.
attenuation (
float) – Default of 10.0 for 10x scope probes, set to 1.0 otherwisebw_limit (
bool) – Enable the 25 MHz low-pass filter.state (
bool) – Enable or disable capture and display of the channel.
- Return type:
None
- set_channel_attenuation(channel, attenuation)
Set the attenuation of the channel / probe.
Note that this effectively changes the channel’s input voltage range so it’s recommended that this is set first.
The probe attenuation factor may be 0.1 to 1000.
- Return type:
None
- set_channel_bw_limit(channel, bw_limit=True)
Enable the 25 MHz low-pass filter.
- Return type:
None
- set_channel_coupling(channel, coupling)
Set the channel coupling.
- Parameters:
channel (
int) – Channel numbercoupling ('AC' | 'DC') – Coupling type.
- Return type:
None
- set_channel_offset(channel, offset)
Set the voltage offset.
The voltage range will be: {offset - range / 2, offset + range / 2}
- Return type:
None
- set_channel_range(channel, voltage_range)
Set the total voltage range for the capture.
- Return type:
None
- set_channel_state(channel, state=True)
Enable capture and display of the channel.
- Return type:
None
- set_measurement_delay(channel_a, channel_b)
Display the measurement the delay time in seconds between two channels.
See also:
set_measurement_edge_spec- Parameters:
channel_a (
int) – Channel numberchannel_b (
int) – Channel number
- Return type:
None- Returns:
Delay time in seconds.
- set_measurement_edge_spec(edge_1, edge_2)
Set specify the edge numbers used for measuring the delay between.
- See:
get_measurement_delay
- Parameters:
edge_1 (
int) – The edge number to start measuring the delay fromedge_2 (
int) – The edge number to stop measuring the delay at
- Return type:
None
- set_measurement_threshold_spec(threshold_type, upper=None, middle=None, lower=None)
Configure the thresholds used by many measurement functions.
Note that the standard and percentage thresholds are relative to the histogram derived range of the waveform.
Note: The standard type uses 90%, 50%, 10% as the upper, middle, lower thresholds The percentage type uses the percentage of the histogram derived range (0-100) The absolute type uses the absolute voltage value (can be floating point)
- Parameters:
threshold_type ('STANDARD' | 'PERC' | 'ABS') – The type of threshold to set
upper (
Optional[float]) – Lower threshold as percentage or absolute value depending on typemiddle (
Optional[float]) – Lower threshold as percentage or absolute value depending on typelower (
Optional[float]) – Lower threshold as percentage or absolute value depending on type
- Return type:
None
- set_measurement_window(window_type)
Use the zoomed window or the full time base for measurement functions.
- Parameters:
window_type ('MAIN' | 'ZOOM' | 'AUTO') – The window type.
- Return type:
None
- set_setup(data)
Configure the scope using bytes of a .scp file.
- Return type:
None
- Example - Load from disk:
>>> from pathlib import Path >>> scope.set_setup(Path('setup.scp').read_bytes())
- set_timebase(timebase_range, reference='CENT')
Configure the timebase.
- Parameters:
timebase_range (
float) – The duration of the captured waveform in seconds (not the time per division).reference ('LEFT' | 'CENT' | 'RIGH') – The position of the trigger in the waveform.
- Return type:
None
- set_timebase_range(timebase_range)
Configure the timebase range in seconds.
- Return type:
None
- set_timebase_reference(reference='CENT')
Configure the position of the trigger in the waveform.
- Parameters:
reference ('LEFT' | 'CENT' | 'RIGH') – The position of the trigger in the waveform.
- Return type:
None
- set_trigger(sweep, channel, level, slope, coupling='DC', mode='EDGE', noise_reject=False, hold_off=None)
Configure trigger.
- Parameters:
sweep ('NORM' | 'AUTO') – NORM: only trigger when condition met, or AUTO: if trigger isn’t fired regularly then trigger anyway
channel (
int) – Channel to monitorlevel (
float) – Voltage threshold of triggerslope ('POS' | 'NEG' | 'EITH' | 'ALT') – Positive, negative, etc edge
coupling ('AC' | 'DC' | 'LFR') – Coupling type.
noise_reject (
bool) – Enable the noise reject filter.hold_off (
Optional[float]) – Time in seconds after a trigger before another trigger may fire.mode ('EDGE' | 'GLIT' | 'PATT' | 'SHOL' | 'TRAN' | 'TV' | 'SBUS1') – Currently only ‘EDGE’ is supported.
- Raises:
NotImplementedError – If mode is not ‘EDGE’
- Return type:
None
- set_trigger_edge_coupling(coupling)
Set trigger input coupling type.
- Parameters:
coupling ('AC' | 'DC' | 'LFR') – Coupling type.
- Return type:
None
- set_trigger_edge_level(level)
Set the voltage threshold of trigger.
- Return type:
None
- set_trigger_edge_slope(slope)
Set positive, negative, etc edge sensitive.
NOTE: Not valid in TV mode.
- Parameters:
slope ('POS' | 'NEG' | 'EITH' | 'ALT') – Positive, negative, etc edge.
- Return type:
None
- set_trigger_edge_source(channel)
Set the channel monitored.
- Return type:
None
- set_trigger_hold_off(hold_off)
Set minimum gap between triggers.
Range is 6e-8 s to 10 s.
- Return type:
None
- set_trigger_mode(mode)
Set the trigger mode.
- Parameters:
mode ('EDGE' | 'GLIT' | 'PATT' | 'SHOL' | 'TRAN' | 'TV' | 'SBUS1') – Mode.
- Return type:
None
- set_trigger_noise_reject(noise_reject=True)
Enable noise rejection filter.
- Return type:
None
- set_trigger_sweep(sweep)
Set the sweep mode of the trigger.
NORM: only trigger when condition met AUTO: if trigger isn’t fired regularly then trigger anyway.
- Parameters:
sweep ('NORM' | 'AUTO') – Sweep mode.
- Return type:
None
- set_wavegen(function, frequency, voltage_high, voltage_low, output_impedance, output_inverted=False, pulse_width=None, ramp_symmetry=None, duty_cycle=None)
Configure the waveform generator.
This function aims to configure all of the required settings for the waveform generator, with the exception of the output_enable. It first resets the waveform generator so that the configuration is always consistent and then applies all of the settings. Afterwards set_wavegen_output_enable should be called to actually enable the output.
- Example simple sine wave output:
>>> scope.set_wavegen( ... function='SIN', ... frequency=1e3, ... voltage_high=0.1, ... voltage_low=-0.1, ... output_impedance='ONEM', ... ) >>> scope.set_wavegen_output_enable(True)
- Parameters:
function ('SIN' | 'SQU' | 'RAMP' | 'PULS' | 'NOIS' | 'DC') – Shape of the wave
frequency (
float) – Frequency in Hzvoltage_high (
float) – Maximum voltage of the waveformvoltage_low (
float) – Minimum voltage of the waveformoutput_impedance ('ONEM' | 'FIFT') – High-impedance or 50R mode
output_inverted (
bool) – True or False.pulse_width (
Optional[float]) – Width of the pulse for PULSE functions in seconds.ramp_symmetry (
Optional[float]) – Time ratio (0.0-1.0) of negative slope to positive slope.duty_cycle (
Optional[float]) – Time ratio (0.0-1.0) of high verse total period.
- Raises:
TypeError – If pulse_width is not set when function is PULSE
TypeError – If pulse_width is set when function is not PULSE
TypeError – If ramp_symmetry is not set when function is RAMP
TypeError – If ramp_symmetry is set when function is not RAMP
TypeError – If duty_cycle is not set when function is SQUARE
TypeError – If duty_cycle is set when function is not SQUARE
- Return type:
None
- set_wavegen_duty_cycle(duty_cycle)
Set the duty cycle.
Time ratio (0.0-1.0) of high verse total period
- Return type:
None
- set_wavegen_frequency(frequency)
Set the wavegen frequency.
- Return type:
None
- set_wavegen_function(function)
Set the wavegen function.
- Parameters:
function ('SIN' | 'SQU' | 'RAMP' | 'PULS' | 'NOIS' | 'DC') – Shape of the wave
- Return type:
None
- set_wavegen_output_enable(enable)
Enable the wavegen output.
- Return type:
None
- set_wavegen_output_impedance(output_impedance)
Set high-impedance or 50R mode.
- Parameters:
output_impedance ('ONEM' | 'FIFT') – High-impedance or 50R mode
- Return type:
None
- set_wavegen_output_inverted(output_inverted)
Invert the voltage waveform.
- Return type:
None
- set_wavegen_pulse_width(pulse_width)
Set the pulse width where applicable.
- Return type:
None
- set_wavegen_ramp_symmetry(ramp_symmetry)
Set the ramp symmetry.
Time ratio (0.0-1.0) of negative slope to positive slope.
- Example values:
>>> 0.0: Sawtooth with negative gradient ramps >>> 0.5: Triangle wave >>> 1.0: Sawtooth with positive gradient ramps
- Parameters:
ramp_symmetry (
float) – Symmetry of the ramp waveform- Return type:
None
- set_wavegen_voltage(voltage_low, voltage_high)
Set the wavegen voltage range. :rtype:
NoneWarning
Output may glitch through a 0 V offset.
Sets amplitude and offset rather than :VOLTage:HIGH / :VOLTage:LOW. :HIGH and :LOW must stay at least the minimum amplitude apart and each command is validated against the current value of the other, so stepping between two valid ranges one endpoint at a time can transiently cross over and be rejected with -222 Data out of range (e.g. raising :LOW above the present :HIGH, or lowering :HIGH below the present :LOW). Amplitude and offset have no such mutual constraint.
Setting :VOLTage or :VOLTage:OFFSet individually is still validated against the other’s current value (the output must stay within the generator’s window), so going directly from one valid state to another can pass through an out-of-range intermediate. Zeroing the offset first avoids this from any starting state: offset 0 is in range for any valid amplitude, the new amplitude is in range at offset 0, and the target offset is in range for the new amplitude.
- single()
Capture a single waveform using the trigger.
- Return type:
None
- stop()
Stop continuous capture of waveforms.
- Return type:
None
- transport: PyVisaTransport
- trigger_now()
Force an immediate capture of data irrespective of the trigger.
- Return type:
None
- class inspy.instrument.oscilloscope.OscilloscopeKeysightDSOX1202G(visa_address=None, transport=None)[source]
Bases:
OscilloscopeKeysight1200XSeriesBaseOscilloscope instrument class for the Keysight DSOX1202G.
It inherits all the methods from base class and adds none.
Reference: https://www.keysight.com/gb/en/assets/9018-07747/programming-guides/9018-07747.pdf
- ChannelCoupling: list[str] = ['AC', 'DC']
- MeasurementAverageType = ['AC', 'DC']
- MeasurementInterval = ['CYCL', 'DISP']
- MeasurementThresholdType = ['STANDARD', 'PERC', 'ABS']
- MeasurementWindow = ['MAIN', 'ZOOM', 'AUTO']
- TimebaseReference: list[str] = ['LEFT', 'CENT', 'RIGH']
- TriggerCoupling: list[str] = ['AC', 'DC', 'LFR']
- TriggerMode: list[str] = ['EDGE', 'GLIT', 'PATT', 'SHOL', 'TRAN', 'TV', 'SBUS1']
- TriggerSlope: list[str] = ['POS', 'NEG', 'EITH', 'ALT']
- TriggerSweep: list[str] = ['NORM', 'AUTO']
- WavegenFunction = ['SIN', 'SQU', 'RAMP', 'PULS', 'NOIS', 'DC']
- WavegenImpedance = ['ONEM', 'FIFT']
- auto_log_level: int = 20
The log level used for automatic logging of method calls.
To disable logging set to logging.NOTSET.
- await_completion()
Wait for the instrument to complete the current operation.
- Return type:
None
- channel_error_message = 'Valid channel(s): '
- channels: list[int] = [1, 2]
- connect()
Connect to instrument using the transport layer.
- Return type:
None
- digitize()
Capture a single waveform using the trigger.
- Raises:
VisaIOError – If timeout (self.transport.resource.timeout) expired
whilst waiting for trigger –
- Return type:
None
- disconnect()
- Return type:
None
- get_channel_attenuation(channel)
Set the configured attenuation of the channel.
- Return type:
float
- get_channel_bw_limit(channel)
Get the state of the 25 MHz low-pass filter.
- Return type:
bool
- get_channel_coupling(channel)
Get coupling type.
- Return type:
str
- get_channel_offset(channel)
Get the voltage offset.
- Return type:
float
- get_channel_range(channel)
Get the total voltage range for the capture.
- Return type:
float
- get_channel_state(channel)
Get the state of the capture and display for the channel.
- Return type:
bool
- get_errors()
Get a list of errors and error numbers from the instrument.
- Return type:
list[tuple[int,str]]- Returns:
A list where each value is a tuple of the error number and error description
- get_id()
Identification Query.
- Return type:
str- Returns:
Instrument Identification String.
- get_measurement_amplitude(channel)
Measure the the amplitude of the selected waveform in volts.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
The amplitude of the selected waveform in volts.
- get_measurement_average(channel, interval)
Measure the calculated average voltage.
- Parameters:
channel (
int) – Channel numberinterval (
str) – The interval / window to measure the average over
- Return type:
float- Returns:
Calculated average voltage.
- get_measurement_base(channel)
Measure the value at the base of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Value at the base of the selected waveform.
- get_measurement_counter(channel)
Measure the counter frequency in Hertz.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Counter frequency in Hertz.
- get_measurement_delay(channel_a, channel_b)
Measure the delay time in seconds between two channels.
See also:
set_measurement_edge_spec- Parameters:
channel_a (
int) – Channel numberchannel_b (
int) – Channel number
- Return type:
float- Returns:
Delay time in seconds.
- get_measurement_duty_cycle(channel)
Measure the ratio of positive pulse width to period.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Ratio of positive pulse width to period.
- get_measurement_fall_time(channel)
Measure the time in seconds between the lower and upper thresholds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Time in seconds between the lower and upper thresholds.
- get_measurement_frequency(channel)
Measure the frequency in Hertz.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Frequency in Hertz.
- get_measurement_max(channel)
Measure the maximum voltage of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Maximum voltage of the selected waveform.
- get_measurement_min(channel)
Measure the minimum voltage of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Minimum voltage of the selected waveform.
- get_measurement_negative_duty_cycle(channel)
Measure the ratio of negative pulse width to period.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Ratio of negative pulse width to period.
- get_measurement_negative_pulse_width(channel)
Measure the negative pulse width in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Negative pulse width in seconds.
- get_measurement_overshoot(channel)
Measure the the ratio of the overshoot of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
The ratio of the overshoot of the selected waveform.
- get_measurement_peak_to_peak(channel)
Measure the voltage peak-to-peak of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Voltage peak-to-peak of the selected waveform.
- get_measurement_period(channel)
Measure the waveform period in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Waveform period in seconds.
- get_measurement_phase(channel_a, channel_b)
Measure the the phase angle value in degrees between two channels.
- Parameters:
channel_a (
int) – Channel numberchannel_b (
int) – Channel number
- Return type:
float- Returns:
The phase angle value in degrees.
- get_measurement_positive_pulse_width(channel)
Measure the width of positive pulse in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Width of positive pulse in seconds.
- get_measurement_pre_shoot(channel)
Measure the the percent of pre-shoot of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
The percent of pre-shoot of the selected waveform.
- get_measurement_rise_time(channel)
Measure the rise time in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Rise time in seconds.
- get_measurement_rms(channel, interval, avg_type)
Measure the calculated RMS voltage.
- Parameters:
channel (
int) – Channel numberinterval ('CYCL' | 'DISP') – The interval / window to measure the average over
avg_type ('AC' | 'DC') – The type of average to calculate
- Return type:
float- Returns:
Calculated RMS voltage.
- get_measurement_transition_time(channel, positive, occurrence)
Measure the time in seconds of the specified transition.
- Parameters:
channel (
int) – Channel numberpositive (
bool) – Positive (True) or negative (False) edgeoccurrence (
int) – Which edge to measure the time to
- Return type:
float- Returns:
Time in seconds of the specified transition.
- get_measurement_value_time(channel, positive, value, occurrence)
Measure the time in seconds of the specified value crossing.
- Parameters:
channel (
int) – Channel numberpositive (
bool) – Positive (True) or negative (False) edgevalue (
float) – Voltage level whose crossing is measuredoccurrence (
int) – Which edge to measure the time to
- Return type:
float- Returns:
Time in seconds of the specified value crossing.
- get_measurement_voltage_at_time(channel, time)
Measure the voltage at the specified time.
- Parameters:
channel (
int) – Channel numbertime (
float) – Time offset in seconds
- Return type:
float- Returns:
Voltage at the specified time.
- get_measurement_voltage_at_top(channel)
Measure the voltage at the top of the waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Voltage at the top of the waveform.
- get_screenshot()
Get screenshot from the scope as PNG format bytes.
- Return type:
bytes
- Example - Save to disk:
>>> from pathlib import Path >>> Path('screenshot.png').write_bytes(scope.get_screenshot())
- Example - Open with PIL and then save as a JPEG:
>>> import PIL.Image >>> from io import BytesIO >>> im = PIL.Image.open(BytesIO(scope.get_screenshot())) >>> im.save('screenshot.jpg')
- Example - View in Jupyter notebook
>>> from IPython.display import Image >>> Image(scope.get_screenshot())
- get_setup()
Get setup from the scope as bytes of a .scp file.
- Return type:
bytes
- Example - Save to disk:
>>> from pathlib import Path >>> Path('setup.scp').write_bytes(scope.get_setup())
- get_timebase_range()
Get the timebase range in seconds.
- Return type:
float
- get_timebase_reference()
Get the position of the trigger in the waveform.
- Return type:
str
- get_trigger_coupling()
Get trigger input coupling type.
- Return type:
str
- get_trigger_edge_level()
Get the voltage threshold of trigger.
- Return type:
float
- get_trigger_edge_source()
Get the channel monitored.
- Return type:
int
- get_trigger_hold_off()
Get configured minimum gap between triggers.
- Return type:
float
- get_trigger_mode()
Get the mode (e.g. edge, glitch, etc).
- Return type:
str
- get_trigger_noise_reject()
Get state of noise rejection filter.
- Return type:
bool
- get_trigger_slope()
Get edge sensitivity type.
Not valid in TV mode.
- Return type:
str
- get_trigger_sweep()
Get the sweep mode of the trigger.
NORMAL: only trigger when condition met AUTO: if trigger isn’t fired regularly then trigger anyway.
- Return type:
str
- get_waveform(channel)
Get the waveform data of a capture.
First scope.trigger_now() or scope.digitize().
- Parameters:
channel (
int) – Channel to get the waveform data from- Return type:
tuple[list[float],list[float]]- Returns:
A tuple with the first element being a list of the time values and the second being a list of the voltages
- is_connected: bool
- logger: logging.Logger
- reset()
Reset and clear the scope configuration.
- Return type:
None
- run()
Start continuous capture of waveforms.
- Return type:
None
- set_channel(channel, voltage_range, offset=0.0, coupling='DC', attenuation=10.0, bw_limit=False, state=True)
Configure input channel.
- Parameters:
channel (
int) – Number of the channel starting at 1voltage_range (
float) – Total voltage range for the captureoffset (
float) – Voltage range: {offset - range / 2, offset + range / 2}.coupling ('AC' | 'DC') – Coupling type.
attenuation (
float) – Default of 10.0 for 10x scope probes, set to 1.0 otherwisebw_limit (
bool) – Enable the 25 MHz low-pass filter.state (
bool) – Enable or disable capture and display of the channel.
- Return type:
None
- set_channel_attenuation(channel, attenuation)
Set the attenuation of the channel / probe.
Note that this effectively changes the channel’s input voltage range so it’s recommended that this is set first.
The probe attenuation factor may be 0.1 to 1000.
- Return type:
None
- set_channel_bw_limit(channel, bw_limit=True)
Enable the 25 MHz low-pass filter.
- Return type:
None
- set_channel_coupling(channel, coupling)
Set the channel coupling.
- Parameters:
channel (
int) – Channel numbercoupling ('AC' | 'DC') – Coupling type.
- Return type:
None
- set_channel_offset(channel, offset)
Set the voltage offset.
The voltage range will be: {offset - range / 2, offset + range / 2}
- Return type:
None
- set_channel_range(channel, voltage_range)
Set the total voltage range for the capture.
- Return type:
None
- set_channel_state(channel, state=True)
Enable capture and display of the channel.
- Return type:
None
- set_measurement_delay(channel_a, channel_b)
Display the measurement the delay time in seconds between two channels.
See also:
set_measurement_edge_spec- Parameters:
channel_a (
int) – Channel numberchannel_b (
int) – Channel number
- Return type:
None- Returns:
Delay time in seconds.
- set_measurement_edge_spec(edge_1, edge_2)
Set specify the edge numbers used for measuring the delay between.
- See:
get_measurement_delay
- Parameters:
edge_1 (
int) – The edge number to start measuring the delay fromedge_2 (
int) – The edge number to stop measuring the delay at
- Return type:
None
- set_measurement_threshold_spec(threshold_type, upper=None, middle=None, lower=None)
Configure the thresholds used by many measurement functions.
Note that the standard and percentage thresholds are relative to the histogram derived range of the waveform.
Note: The standard type uses 90%, 50%, 10% as the upper, middle, lower thresholds The percentage type uses the percentage of the histogram derived range (0-100) The absolute type uses the absolute voltage value (can be floating point)
- Parameters:
threshold_type ('STANDARD' | 'PERC' | 'ABS') – The type of threshold to set
upper (
Optional[float]) – Lower threshold as percentage or absolute value depending on typemiddle (
Optional[float]) – Lower threshold as percentage or absolute value depending on typelower (
Optional[float]) – Lower threshold as percentage or absolute value depending on type
- Return type:
None
- set_measurement_window(window_type)
Use the zoomed window or the full time base for measurement functions.
- Parameters:
window_type ('MAIN' | 'ZOOM' | 'AUTO') – The window type.
- Return type:
None
- set_setup(data)
Configure the scope using bytes of a .scp file.
- Return type:
None
- Example - Load from disk:
>>> from pathlib import Path >>> scope.set_setup(Path('setup.scp').read_bytes())
- set_timebase(timebase_range, reference='CENT')
Configure the timebase.
- Parameters:
timebase_range (
float) – The duration of the captured waveform in seconds (not the time per division).reference ('LEFT' | 'CENT' | 'RIGH') – The position of the trigger in the waveform.
- Return type:
None
- set_timebase_range(timebase_range)
Configure the timebase range in seconds.
- Return type:
None
- set_timebase_reference(reference='CENT')
Configure the position of the trigger in the waveform.
- Parameters:
reference ('LEFT' | 'CENT' | 'RIGH') – The position of the trigger in the waveform.
- Return type:
None
- set_trigger(sweep, channel, level, slope, coupling='DC', mode='EDGE', noise_reject=False, hold_off=None)
Configure trigger.
- Parameters:
sweep ('NORM' | 'AUTO') – NORM: only trigger when condition met, or AUTO: if trigger isn’t fired regularly then trigger anyway
channel (
int) – Channel to monitorlevel (
float) – Voltage threshold of triggerslope ('POS' | 'NEG' | 'EITH' | 'ALT') – Positive, negative, etc edge
coupling ('AC' | 'DC' | 'LFR') – Coupling type.
noise_reject (
bool) – Enable the noise reject filter.hold_off (
Optional[float]) – Time in seconds after a trigger before another trigger may fire.mode ('EDGE' | 'GLIT' | 'PATT' | 'SHOL' | 'TRAN' | 'TV' | 'SBUS1') – Currently only ‘EDGE’ is supported.
- Raises:
NotImplementedError – If mode is not ‘EDGE’
- Return type:
None
- set_trigger_edge_coupling(coupling)
Set trigger input coupling type.
- Parameters:
coupling ('AC' | 'DC' | 'LFR') – Coupling type.
- Return type:
None
- set_trigger_edge_level(level)
Set the voltage threshold of trigger.
- Return type:
None
- set_trigger_edge_slope(slope)
Set positive, negative, etc edge sensitive.
NOTE: Not valid in TV mode.
- Parameters:
slope ('POS' | 'NEG' | 'EITH' | 'ALT') – Positive, negative, etc edge.
- Return type:
None
- set_trigger_edge_source(channel)
Set the channel monitored.
- Return type:
None
- set_trigger_hold_off(hold_off)
Set minimum gap between triggers.
Range is 6e-8 s to 10 s.
- Return type:
None
- set_trigger_mode(mode)
Set the trigger mode.
- Parameters:
mode ('EDGE' | 'GLIT' | 'PATT' | 'SHOL' | 'TRAN' | 'TV' | 'SBUS1') – Mode.
- Return type:
None
- set_trigger_noise_reject(noise_reject=True)
Enable noise rejection filter.
- Return type:
None
- set_trigger_sweep(sweep)
Set the sweep mode of the trigger.
NORM: only trigger when condition met AUTO: if trigger isn’t fired regularly then trigger anyway.
- Parameters:
sweep ('NORM' | 'AUTO') – Sweep mode.
- Return type:
None
- set_wavegen(function, frequency, voltage_high, voltage_low, output_impedance, output_inverted=False, pulse_width=None, ramp_symmetry=None, duty_cycle=None)
Configure the waveform generator.
This function aims to configure all of the required settings for the waveform generator, with the exception of the output_enable. It first resets the waveform generator so that the configuration is always consistent and then applies all of the settings. Afterwards set_wavegen_output_enable should be called to actually enable the output.
- Example simple sine wave output:
>>> scope.set_wavegen( ... function='SIN', ... frequency=1e3, ... voltage_high=0.1, ... voltage_low=-0.1, ... output_impedance='ONEM', ... ) >>> scope.set_wavegen_output_enable(True)
- Parameters:
function ('SIN' | 'SQU' | 'RAMP' | 'PULS' | 'NOIS' | 'DC') – Shape of the wave
frequency (
float) – Frequency in Hzvoltage_high (
float) – Maximum voltage of the waveformvoltage_low (
float) – Minimum voltage of the waveformoutput_impedance ('ONEM' | 'FIFT') – High-impedance or 50R mode
output_inverted (
bool) – True or False.pulse_width (
Optional[float]) – Width of the pulse for PULSE functions in seconds.ramp_symmetry (
Optional[float]) – Time ratio (0.0-1.0) of negative slope to positive slope.duty_cycle (
Optional[float]) – Time ratio (0.0-1.0) of high verse total period.
- Raises:
TypeError – If pulse_width is not set when function is PULSE
TypeError – If pulse_width is set when function is not PULSE
TypeError – If ramp_symmetry is not set when function is RAMP
TypeError – If ramp_symmetry is set when function is not RAMP
TypeError – If duty_cycle is not set when function is SQUARE
TypeError – If duty_cycle is set when function is not SQUARE
- Return type:
None
- set_wavegen_duty_cycle(duty_cycle)
Set the duty cycle.
Time ratio (0.0-1.0) of high verse total period
- Return type:
None
- set_wavegen_frequency(frequency)
Set the wavegen frequency.
- Return type:
None
- set_wavegen_function(function)
Set the wavegen function.
- Parameters:
function ('SIN' | 'SQU' | 'RAMP' | 'PULS' | 'NOIS' | 'DC') – Shape of the wave
- Return type:
None
- set_wavegen_output_enable(enable)
Enable the wavegen output.
- Return type:
None
- set_wavegen_output_impedance(output_impedance)
Set high-impedance or 50R mode.
- Parameters:
output_impedance ('ONEM' | 'FIFT') – High-impedance or 50R mode
- Return type:
None
- set_wavegen_output_inverted(output_inverted)
Invert the voltage waveform.
- Return type:
None
- set_wavegen_pulse_width(pulse_width)
Set the pulse width where applicable.
- Return type:
None
- set_wavegen_ramp_symmetry(ramp_symmetry)
Set the ramp symmetry.
Time ratio (0.0-1.0) of negative slope to positive slope.
- Example values:
>>> 0.0: Sawtooth with negative gradient ramps >>> 0.5: Triangle wave >>> 1.0: Sawtooth with positive gradient ramps
- Parameters:
ramp_symmetry (
float) – Symmetry of the ramp waveform- Return type:
None
- set_wavegen_voltage(voltage_low, voltage_high)
Set the wavegen voltage range. :rtype:
NoneWarning
Output may glitch through a 0 V offset.
Sets amplitude and offset rather than :VOLTage:HIGH / :VOLTage:LOW. :HIGH and :LOW must stay at least the minimum amplitude apart and each command is validated against the current value of the other, so stepping between two valid ranges one endpoint at a time can transiently cross over and be rejected with -222 Data out of range (e.g. raising :LOW above the present :HIGH, or lowering :HIGH below the present :LOW). Amplitude and offset have no such mutual constraint.
Setting :VOLTage or :VOLTage:OFFSet individually is still validated against the other’s current value (the output must stay within the generator’s window), so going directly from one valid state to another can pass through an out-of-range intermediate. Zeroing the offset first avoids this from any starting state: offset 0 is in range for any valid amplitude, the new amplitude is in range at offset 0, and the target offset is in range for the new amplitude.
- single()
Capture a single waveform using the trigger.
- Return type:
None
- stop()
Stop continuous capture of waveforms.
- Return type:
None
- transport: PyVisaTransport
- trigger_now()
Force an immediate capture of data irrespective of the trigger.
- Return type:
None
- class inspy.instrument.oscilloscope.OscilloscopeKeysightDSOX2024A(visa_address=None, transport=None)[source]
Bases:
OscilloscopeKeysight2000XSeriesBaseOscilloscope instrument class for the Keysight DSOX2024A.
It inherits all the methods from base class and adds none.
Reference: https://www.keysight.com/gb/en/assets/9018-06893/programming-guides/9018-06893.pdf
- ChannelCoupling: list[str] = ['AC', 'DC']
- MeasurementAverageType = ['AC', 'DC']
- MeasurementInterval = ['CYCL', 'DISP']
- MeasurementThresholdType = ['STANDARD', 'PERC', 'ABS']
- MeasurementWindow = ['MAIN', 'ZOOM', 'AUTO']
- TimebaseReference: list[str] = ['LEFT', 'CENT', 'RIGH']
- TriggerCoupling: list[str] = ['AC', 'DC', 'LFR']
- TriggerMode: list[str] = ['EDGE', 'GLIT', 'PATT', 'TV', 'DEL', 'EBUR', 'OR', 'RUNT', 'SHOL', 'TRAN', 'SBUS1', 'USB']
- TriggerSlope: list[str] = ['POS', 'NEG', 'EITH', 'ALT']
- TriggerSweep: list[str] = ['NORM', 'AUTO']
- WavegenFunction = ['SIN', 'SQU', 'RAMP', 'PULS', 'NOIS', 'DC']
- WavegenImpedance = ['ONEM', 'FIFT']
- auto_log_level: int = 20
The log level used for automatic logging of method calls.
To disable logging set to logging.NOTSET.
- await_completion()
Wait for the instrument to complete the current operation.
- Return type:
None
- channel_error_message = 'Valid channel(s): '
- channels: list[int] = [1, 2, 3, 4]
- connect()
Connect to instrument using the transport layer.
- Return type:
None
- digitize()
Capture a single waveform using the trigger.
- Raises:
VisaIOError – If timeout (self.transport.resource.timeout) expired
whilst waiting for trigger –
- Return type:
None
- disconnect()
- Return type:
None
- get_channel_attenuation(channel)
Set the configured attenuation of the channel.
- Return type:
float
- get_channel_bw_limit(channel)
Get the state of the 25 MHz low-pass filter.
- Return type:
bool
- get_channel_coupling(channel)
Get coupling type.
- Return type:
str
- get_channel_offset(channel)
Get the voltage offset.
- Return type:
float
- get_channel_range(channel)
Get the total voltage range for the capture.
- Return type:
float
- get_channel_state(channel)
Get the state of the capture and display for the channel.
- Return type:
bool
- get_errors()
Get a list of errors and error numbers from the instrument.
- Return type:
list[tuple[int,str]]- Returns:
A list where each value is a tuple of the error number and error description
- get_id()
Identification Query.
- Return type:
str- Returns:
Instrument Identification String.
- get_measurement_amplitude(channel)
Measure the the amplitude of the selected waveform in volts.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
The amplitude of the selected waveform in volts.
- get_measurement_average(channel, interval)
Measure the calculated average voltage.
- Parameters:
channel (
int) – Channel numberinterval (
str) – The interval / window to measure the average over
- Return type:
float- Returns:
Calculated average voltage.
- get_measurement_base(channel)
Measure the value at the base of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Value at the base of the selected waveform.
- get_measurement_counter(channel)
Not applicable for this instrument.
- get_measurement_delay(channel_a, channel_b)
Measure the delay time in seconds between two channels.
See also:
set_measurement_edge_spec- Parameters:
channel_a (
int) – Channel numberchannel_b (
int) – Channel number
- Return type:
float- Returns:
Delay time in seconds.
- get_measurement_duty_cycle(channel)
Measure the ratio of positive pulse width to period.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Ratio of positive pulse width to period.
- get_measurement_fall_time(channel)
Measure the time in seconds between the lower and upper thresholds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Time in seconds between the lower and upper thresholds.
- get_measurement_frequency(channel)
Measure the frequency in Hertz.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Frequency in Hertz.
- get_measurement_max(channel)
Measure the maximum voltage of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Maximum voltage of the selected waveform.
- get_measurement_min(channel)
Measure the minimum voltage of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Minimum voltage of the selected waveform.
- get_measurement_negative_duty_cycle(channel)
Measure the ratio of negative pulse width to period.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Ratio of negative pulse width to period.
- get_measurement_negative_pulse_width(channel)
Measure the negative pulse width in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Negative pulse width in seconds.
- get_measurement_overshoot(channel)
Measure the the ratio of the overshoot of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
The ratio of the overshoot of the selected waveform.
- get_measurement_peak_to_peak(channel)
Measure the voltage peak-to-peak of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Voltage peak-to-peak of the selected waveform.
- get_measurement_period(channel)
Measure the waveform period in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Waveform period in seconds.
- get_measurement_phase(channel_a, channel_b)
Measure the the phase angle value in degrees between two channels.
- Parameters:
channel_a (
int) – Channel numberchannel_b (
int) – Channel number
- Return type:
float- Returns:
The phase angle value in degrees.
- get_measurement_positive_pulse_width(channel)
Measure the width of positive pulse in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Width of positive pulse in seconds.
- get_measurement_pre_shoot(channel)
Measure the the percent of pre-shoot of the selected waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
The percent of pre-shoot of the selected waveform.
- get_measurement_rise_time(channel)
Measure the rise time in seconds.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Rise time in seconds.
- get_measurement_rms(channel, interval, avg_type)
Measure the calculated RMS voltage.
- Parameters:
channel (
int) – Channel numberinterval ('CYCL' | 'DISP') – The interval / window to measure the average over
avg_type ('AC' | 'DC') – The type of average to calculate
- Return type:
float- Returns:
Calculated RMS voltage.
- get_measurement_transition_time(channel, positive, occurrence)
Measure the time in seconds of the specified transition.
- Parameters:
channel (
int) – Channel numberpositive (
bool) – Positive (True) or negative (False) edgeoccurrence (
int) – Which edge to measure the time to
- Return type:
float- Returns:
Time in seconds of the specified transition.
- get_measurement_value_time(channel, positive, value, occurrence)
Measure the time in seconds of the specified value crossing.
- Parameters:
channel (
int) – Channel numberpositive (
bool) – Positive (True) or negative (False) edgevalue (
float) – Voltage level whose crossing is measuredoccurrence (
int) – Which edge to measure the time to
- Return type:
float- Returns:
Time in seconds of the specified value crossing.
- get_measurement_voltage_at_time(channel, time)
Measure the voltage at the specified time.
- Parameters:
channel (
int) – Channel numbertime (
float) – Time offset in seconds
- Return type:
float- Returns:
Voltage at the specified time.
- get_measurement_voltage_at_top(channel)
Measure the voltage at the top of the waveform.
- Parameters:
channel (
int) – Channel number- Return type:
float- Returns:
Voltage at the top of the waveform.
- get_screenshot()
Get screenshot from the scope as PNG format bytes.
- Return type:
bytes
- Example - Save to disk:
>>> from pathlib import Path >>> Path('screenshot.png').write_bytes(scope.get_screenshot())
- Example - Open with PIL and then save as a JPEG:
>>> import PIL.Image >>> from io import BytesIO >>> im = PIL.Image.open(BytesIO(scope.get_screenshot())) >>> im.save('screenshot.jpg')
- Example - View in Jupyter notebook
>>> from IPython.display import Image >>> Image(scope.get_screenshot())
- get_setup()
Get setup from the scope as bytes of a .scp file.
- Return type:
bytes
- Example - Save to disk:
>>> from pathlib import Path >>> Path('setup.scp').write_bytes(scope.get_setup())
- get_timebase_range()
Get the timebase range in seconds.
- Return type:
float
- get_timebase_reference()
Get the position of the trigger in the waveform.
- Return type:
str
- get_trigger_coupling()
Get trigger input coupling type.
- Return type:
str
- get_trigger_edge_level()
Get the voltage threshold of trigger.
- Return type:
float
- get_trigger_edge_source()
Get the channel monitored.
- Return type:
int
- get_trigger_hold_off()
Get configured minimum gap between triggers.
- Return type:
float
- get_trigger_mode()
Get the mode (e.g. edge, glitch, etc).
- Return type:
str
- get_trigger_noise_reject()
Get state of noise rejection filter.
- Return type:
bool
- get_trigger_slope()
Get edge sensitivity type.
Not valid in TV mode.
- Return type:
str
- get_trigger_sweep()
Get the sweep mode of the trigger.
NORMAL: only trigger when condition met AUTO: if trigger isn’t fired regularly then trigger anyway.
- Return type:
str
- get_waveform(channel)
Get the waveform data of a capture.
First scope.trigger_now() or scope.digitize().
- Parameters:
channel (
int) – Channel to get the waveform data from- Return type:
tuple[list[float],list[float]]- Returns:
A tuple with the first element being a list of the time values and the second being a list of the voltages
- is_connected: bool
- logger: logging.Logger
- reset()
Reset and clear the scope configuration.
- Return type:
None
- run()
Start continuous capture of waveforms.
- Return type:
None
- set_channel(channel, voltage_range, offset=0.0, coupling='DC', attenuation=10.0, bw_limit=False, state=True)
Configure input channel.
- Parameters:
channel (
int) – Number of the channel starting at 1voltage_range (
float) – Total voltage range for the captureoffset (
float) – Voltage range: {offset - range / 2, offset + range / 2}.coupling ('AC' | 'DC') – Coupling type.
attenuation (
float) – Default of 10.0 for 10x scope probes, set to 1.0 otherwisebw_limit (
bool) – Enable the 25 MHz low-pass filter.state (
bool) – Enable or disable capture and display of the channel.
- Return type:
None
- set_channel_attenuation(channel, attenuation)
Set the attenuation of the channel / probe.
Note that this effectively changes the channel’s input voltage range so it’s recommended that this is set first.
The probe attenuation factor may be 0.001 to 1000.
- Return type:
None
- set_channel_bw_limit(channel, bw_limit=True)
Enable the 25 MHz low-pass filter.
- Return type:
None
- set_channel_coupling(channel, coupling)
Set the channel coupling.
- Parameters:
channel (
int) – Channel numbercoupling ('AC' | 'DC') – Coupling type.
- Return type:
None
- set_channel_offset(channel, offset)
Set the voltage offset.
The voltage range will be: {offset - range / 2, offset + range / 2}
- Return type:
None
- set_channel_range(channel, voltage_range)
Set the total voltage range for the capture.
- Return type:
None
- set_channel_state(channel, state=True)
Enable capture and display of the channel.
- Return type:
None
- set_measurement_delay(channel_a, channel_b)
Display the measurement the delay time in seconds between two channels.
See also:
set_measurement_edge_spec- Parameters:
channel_a (
int) – Channel numberchannel_b (
int) – Channel number
- Return type:
None- Returns:
Delay time in seconds.
- set_measurement_edge_spec(edge_1, edge_2)
Set specify the edge numbers used for measuring the delay between.
- See:
get_measurement_delay
- Parameters:
edge_1 (
int) – The edge number to start measuring the delay fromedge_2 (
int) – The edge number to stop measuring the delay at
- Return type:
None
- set_measurement_threshold_spec(threshold_type, upper=None, middle=None, lower=None)
Configure the thresholds used by many measurement functions.
Note that the standard and percentage thresholds are relative to the histogram derived range of the waveform.
Note: The standard type uses 90%, 50%, 10% as the upper, middle, lower thresholds The percentage type uses the percentage of the histogram derived range (0-100) The absolute type uses the absolute voltage value (can be floating point)
- Parameters:
threshold_type ('STANDARD' | 'PERC' | 'ABS') – The type of threshold to set
upper (
Optional[float]) – Lower threshold as percentage or absolute value depending on typemiddle (
Optional[float]) – Lower threshold as percentage or absolute value depending on typelower (
Optional[float]) – Lower threshold as percentage or absolute value depending on type
- Return type:
None
- set_measurement_window(window_type)
Use the zoomed window or the full time base for measurement functions.
- Parameters:
window_type ('MAIN' | 'ZOOM' | 'AUTO') – The window type.
- Return type:
None
- set_setup(data)
Configure the scope using bytes of a .scp file.
- Return type:
None
- Example - Load from disk:
>>> from pathlib import Path >>> scope.set_setup(Path('setup.scp').read_bytes())
- set_timebase(timebase_range, reference='CENT')
Configure the timebase.
- Parameters:
timebase_range (
float) – The duration of the captured waveform in seconds (not the time per division).reference ('LEFT' | 'CENT' | 'RIGH') – The position of the trigger in the waveform.
- Return type:
None
- set_timebase_range(timebase_range)
Configure the timebase range in seconds.
- Return type:
None
- set_timebase_reference(reference='CENT')
Configure the position of the trigger in the waveform.
- Parameters:
reference ('LEFT' | 'CENT' | 'RIGH') – The position of the trigger in the waveform.
- Return type:
None
- set_trigger(sweep, channel, level, slope, coupling='DC', mode='EDGE', noise_reject=False, hold_off=None)
Configure trigger.
- Parameters:
sweep ('NORM' | 'AUTO') – NORM: only trigger when condition met, or AUTO: if trigger isn’t fired regularly then trigger anyway
channel (
int) – Channel to monitorlevel (
float) – Voltage threshold of triggerslope ('POS' | 'NEG' | 'EITH' | 'ALT') – Positive, negative, etc edge
coupling ('AC' | 'DC' | 'LFR') – Coupling type.
noise_reject (
bool) – Enable the noise reject filter.hold_off (
Optional[float]) – Time in seconds after a trigger before another trigger may fire.mode ('EDGE' | 'GLIT' | 'PATT' | 'SHOL' | 'TRAN' | 'TV' | 'SBUS1') – Currently only ‘EDGE’ is supported.
- Raises:
NotImplementedError – If mode is not ‘EDGE’
- Return type:
None
- set_trigger_edge_coupling(coupling)
Set trigger input coupling type.
- Parameters:
coupling ('AC' | 'DC' | 'LFR') – Coupling type.
- Return type:
None
- set_trigger_edge_level(level)
Set the voltage threshold of trigger.
- Return type:
None
- set_trigger_edge_slope(slope)
Set positive, negative, etc edge sensitive.
NOTE: Not valid in TV mode.
- Parameters:
slope ('POS' | 'NEG' | 'EITH' | 'ALT') – Positive, negative, etc edge.
- Return type:
None
- set_trigger_edge_source(channel)
Set the channel monitored.
- Return type:
None
- set_trigger_hold_off(hold_off)
Set minimum gap between triggers.
Range is 4e-8 ns to 10 s.
- Return type:
None
- set_trigger_mode(mode)
Set the trigger mode.
- Parameters:
mode ('EDGE' | 'GLIT' | 'PATT' | 'TV' | 'DEL' | 'EBUR' | 'OR' | 'RUNT' | 'SHOL' | 'TRAN' | 'SBUS1' | 'USB') – The trigger mode
- Return type:
None
- set_trigger_noise_reject(noise_reject=True)
Enable noise rejection filter.
- Return type:
None
- set_trigger_sweep(sweep)
Set the sweep mode of the trigger.
NORM: only trigger when condition met AUTO: if trigger isn’t fired regularly then trigger anyway.
- Parameters:
sweep ('NORM' | 'AUTO') – Sweep mode.
- Return type:
None
- set_wavegen(function, frequency, voltage_high, voltage_low, output_impedance, output_inverted=False, pulse_width=None, ramp_symmetry=None, duty_cycle=None)
Configure the waveform generator.
This function aims to configure all of the required settings for the waveform generator, with the exception of the output_enable. It first resets the waveform generator so that the configuration is always consistent and then applies all of the settings. Afterwards set_wavegen_output_enable should be called to actually enable the output.
- Example simple sine wave output:
>>> scope.set_wavegen( ... function='SIN', ... frequency=1e3, ... voltage_high=0.1, ... voltage_low=-0.1, ... output_impedance='ONEM', ... ) >>> scope.set_wavegen_output_enable(True)
- Parameters:
function ('SIN' | 'SQU' | 'RAMP' | 'PULS' | 'NOIS' | 'DC') – Shape of the wave
frequency (
float) – Frequency in Hzvoltage_high (
float) – Maximum voltage of the waveformvoltage_low (
float) – Minimum voltage of the waveformoutput_impedance ('ONEM' | 'FIFT') – High-impedance or 50R mode
output_inverted (
bool) – True or False.pulse_width (
Optional[float]) – Width of the pulse for PULSE functions in seconds.ramp_symmetry (
Optional[float]) – Time ratio (0.0-1.0) of negative slope to positive slope.duty_cycle (
Optional[float]) – Time ratio (0.0-1.0) of high verse total period.
- Raises:
TypeError – If pulse_width is not set when function is PULSE
TypeError – If pulse_width is set when function is not PULSE
TypeError – If ramp_symmetry is not set when function is RAMP
TypeError – If ramp_symmetry is set when function is not RAMP
TypeError – If duty_cycle is not set when function is SQUARE
TypeError – If duty_cycle is set when function is not SQUARE
- Return type:
None
- set_wavegen_duty_cycle(duty_cycle)
Set the duty cycle.
Time ratio (0.0-1.0) of high verse total period
- Return type:
None
- set_wavegen_frequency(frequency)
Set the wavegen frequency.
- Return type:
None
- set_wavegen_function(function)
Set the wavegen function.
- Parameters:
function ('SIN' | 'SQU' | 'RAMP' | 'PULS' | 'NOIS' | 'DC') – Shape of the wave
- Return type:
None
- set_wavegen_output_enable(enable)
Enable the wavegen output.
- Return type:
None
- set_wavegen_output_impedance(output_impedance)
Set high-impedance or 50R mode.
- Parameters:
output_impedance ('ONEM' | 'FIFT') – High-impedance or 50R mode
- Return type:
None
- set_wavegen_output_inverted(output_inverted)
Not applicable for this instrument.
- Return type:
None
- set_wavegen_pulse_width(pulse_width)
Set the pulse width where applicable.
- Return type:
None
- set_wavegen_ramp_symmetry(ramp_symmetry)
Set the ramp symmetry.
Time ratio (0.0-1.0) of negative slope to positive slope.
- Example values:
>>> 0.0: Sawtooth with negative gradient ramps >>> 0.5: Triangle wave >>> 1.0: Sawtooth with positive gradient ramps
- Parameters:
ramp_symmetry (
float) – Symmetry of the ramp waveform- Return type:
None
- set_wavegen_voltage(voltage_low, voltage_high)
Set the wavegen voltage range. :rtype:
NoneWarning
Output may glitch through a 0 V offset.
Sets amplitude and offset rather than :VOLTage:HIGH / :VOLTage:LOW. :HIGH and :LOW must stay at least the minimum amplitude apart and each command is validated against the current value of the other, so stepping between two valid ranges one endpoint at a time can transiently cross over and be rejected with -222 Data out of range (e.g. raising :LOW above the present :HIGH, or lowering :HIGH below the present :LOW). Amplitude and offset have no such mutual constraint.
Setting :VOLTage or :VOLTage:OFFSet individually is still validated against the other’s current value (the output must stay within the generator’s window), so going directly from one valid state to another can pass through an out-of-range intermediate. Zeroing the offset first avoids this from any starting state: offset 0 is in range for any valid amplitude, the new amplitude is in range at offset 0, and the target offset is in range for the new amplitude.
- single()
Capture a single waveform using the trigger.
- Return type:
None
- stop()
Stop continuous capture of waveforms.
- Return type:
None
- transport: PyVisaTransport
- trigger_now()
Force an immediate capture of data irrespective of the trigger.
- Return type:
None