Keysight Realtime Oscilloscope UXR0702A module

Created on Mon Dec 1 20:17:32 2024

@author: Maxim Weizel

class UXR.UXR(resource_str='TCPIP0::KEYSIGH-Q75EBO9.local::hislip0::INSTR', num_channel=2)[source]

Bases: object

This class is using pyvisa to connect to Instruments. Please install PyVisa before using it.

Close()[source]
IDN() str[source]

The *IDN? query returns the company name, oscilloscope model number, serial number, and software version by returning this string: Keysight Technologies,<Model #>,<USXXXXXXXX>,<Rev #>[,<Options>]

str

Keysight Technologies,DSO9404A,USXXXXXXXX,XX.XX.XXXX

OPC() int[source]

Places a “1” into the output queue when all device operations have been completed :returns: 1 or 0 :rtype: TYPE str

aquisition_done() int[source]

The :ADER? query reads the Acquisition Done Event Register and returns 1 or 0. After the Acquisition Done Event Register is read, the register is cleared. The returned value 1 indicates an acquisition completed event has occurred and 0 indicates an acquisition completed event has not occurred.

Returns:

{1 | 0}

Return type:

int

aquisition_state() str[source]

The :ASTate? query returns the acquisition state.

Returns:

{ARM | TRIG | ATRIG | ADONE}

Return type:

str

autoscale() None[source]

The :AUToscale command causes the oscilloscope to evaluate all input waveforms and find the optimum conditions for displaying the waveform.

autoscale_channels(value: str | None = None) str[source]

The :AUToscale:CHANnels command selects whether to apply autoscale to all of the input channels or just the input channels that are currently displayed.

valuestr, optional

{ALL | DISPlayed}, if None then query

str

{ALL | DISP}

ValueError

Expected one of: {ALL | DISP | DISPlayed }

channel_display(channel: int, write: bool = False, value: int | str | None = None) int[source]

The :CHANnel<N>:DISPlay command turns the display of the specified channel on or off.

channelint

An integer, analog input channel 1 or 2

writebool, optional

write the channel display state, else query

valueint, str, optional

ON, 1, OFF, 0

int

The :CHANnel<N>:DISPlay? query returns the current display condition for the specified channel

ValueError

For Channel expected one of: num_channels

ValueError

For values expected one of: ON, 1, OFF, 0

channel_range(channel: int, write: bool = False, range_value: float | None = None) float[source]

The :CHANnel<N>:RANGe command defines the full-scale vertical axis of the selected channel. The values represent the full-scale deflection factor of the vertical axis in volts. These values change as the probe attenuation factor is changed.

channelint

An integer, analog input channel 1 or 2

writebool, optional

write else query, by default False

range_valuefloat, optional

A real number for the full-scale voltage of the specified channel number, by default None

float

full-scale vertical axis of the selected channel

ValueError

For Channel expected one of: num_channels

ValueError

For range_value expected to be < 2V

channel_scale(channel: int, write: bool = False, scale_value: float | None = None) float[source]

The :CHANnel<N>:SCALe command sets the vertical scale, or units per division, of the selected channel. This command is the same as the front-panel channel scale.

channelint

An integer, analog input channel 1 or 2

writebool, optional

write else query, by default False

scale_valuefloat, optional

A real number for the vertical scale of the channel in units per division, by default None

float

A real number for the vertical scale of the channel in units per division

ValueError

For Channel expected one of: num_channels

ValueError

For range_value expected to be < 500mV/div

clear_status() None[source]

The *CLS command clears all status and error registers.

digitize(channel_num: int | None = None) None[source]

This command initializes the selected channels or functions, then acquires them according to the current oscilloscope settings. When all waveforms are completely acquired, the oscilloscope is stopped. To Do: input can be: [CHANnel<N> | DIFF<D> | COMMonmode<C>]

channel_numint

Number of the Channel

channel_numError

Expected one of: channel number

query(message)[source]
query_binary_values(message, datatype='h', container=<built-in function array>, data_points=0, **kwargs)[source]
reset() None[source]

The *RST command performs a default setup which is the same as pressing the oscilloscope front panel [Default Setup] key.

run() None[source]

Set the scope in run mode.

run_state() str[source]

The :RSTate? query returns the run state:

Returns:

{RUN | STOP | SING}

Return type:

str

single() None[source]

Take a single acquisition

status(key: str | None = None, value: int | None = None) int[source]

The :STATus? query shows whether the specified channel, function, wmemory, histogram, measurement trend, measurement spectrum, or equalized waveform is on or off. To Do: Each type has a different range of values that is excepted. No Checking is implemented.

keystr, optional

if None return status of Channel1

valueint, optional

For Channel [1,2], for Function <=16

int

A return value of 1 means on and a return value of 0 means off

ValueError

Expected one of: CHANNEL, FUNCTION, HIST, … etc.

stop() None[source]

Set the scope in stop mode.

system_header(value: int | str | None = None) int[source]

!!!! SHOULD BE OFF !!!! The :SYSTem:HEADer command specifies whether the instrument will output a header for query responses. When :SYSTem:HEADer is set to ON, the query responses include the command header.

valueint | str | None, optional

{{ON | 1} | {OFF | 0}}, by default None

int

{1 | 0}

ValueError

Expected one of: {{ON | 1} | {OFF | 0}}

waveform_byteorder(value: str | None = None) str[source]

The :WAVeform:BYTeorder command selects the order in which bytes are transferred from (or to) the oscilloscope using WORD and LONG formats

valuestr, optional

byteorder {MSBF, LSBF}, by default None

str

byteorder {MSBF, LSBF}

ValueError

Expected one of: MSBFIRST, LSBFIRST

waveform_data(start: int | None = None, size: int | None = None, datatype: str = 'h', container: type = <built-in function array>, data_points: int = 0, **kwargs) ndarray[source]

The :WAVeform:DATA? query outputs waveform data to the computer over the remote interface. The data is copied from a waveform memory, function, or channel previously specified with the :WAVeform:SOURce command.

Parameters:
  • start (int, optional) – Starting point in the source memory for the first waveform point to transfer, by default None.

  • size (int, optional) – Number of points in the source memory to transfer. If larger than available data, size is adjusted to the maximum available, by default None.

  • datatype (str, optional) – Data type for binary values as defined in Python struct, by default “h” (short).

  • container (type, optional) – Type of container to hold the data, by default np.array.

  • data_points (int, optional) – Expected number of data points, by default 0.

  • kwargs (dict, optional) – Additional arguments passed to the query_binary_values method.

Returns:

Acquired data.

Return type:

np.ndarray

Raises:
  • ValueError – If start or size are invalid (non-integers or negative).

  • NotImplementedError – If the waveform format is not “WORD”.

waveform_format(value: str | None = None) str[source]

The :WAVeform:FORMat command sets the data transmission mode for waveform data output. This command controls how the data is formatted when it is sent from the oscilloscope, and pertains to all waveforms. To Do: Only WORD is tested. There is a FLOAT type?

valuestr, optional

One of {ASCii | BINary | BYTE | WORD }, by default None

str

{ASC | BIN | BYTE | WORD }

ValueError

Expected one of: {ASCii | BINary | BYTE | WORD}

waveform_points() int[source]

The :WAVeform:POINts? query returns the points value in the current waveform preamble.

int

Number of points in the current waveform

waveform_source(key: str | None = None, value: int | None = None) str[source]

The :WAVeform:SOURce command selects a channel, function, waveform memory, or histogram as the waveform source To Do: No checkes implemented

keystr | None, optional

One of: {CHANnel<N> | DIFF<D> | COMMonmode<C> | FUNCtion<F> | HISTogram | WMEMory<R> | CLOCk | MTRend | MSPectrum | EQUalized | XT<X> | PNOise | INPut | CORRected | ERRor | LFPR | NREDuced}, by default None

valueint | None, optional

Number e.g. 1 for Channel1, by default None

str

The :WAVeform:SOURce? query returns the currently selected waveform source.

waveform_streaming(value: int | str | None = None) int[source]

When enabled, :WAVeform:STReaming allows more than 999,999,999 bytes of data to be transferred from the Infiniium oscilloscope to a PC when using the :WAVeform:DATA? query.

valueint | str | None, optional

{{ON | 1} | {OFF | 0}}, by default None

int

{1 | 0}

ValueError

Expected one of: {{ON | 1} | {OFF | 0}}

waveform_x_increment() float[source]

The :WAVeform:XINCrement? query returns the duration between consecutive data points for the currently specified waveform source.

Returns:

A real number representing the duration between data points on the X axis.

Return type:

float

waveform_x_origin() float[source]

The :WAVeform:XORigin? query returns the X-axis value of the first data point in the data record.

Returns:

A real number representing the X-axis value of the first data point in the data record.

Return type:

float

waveform_y_increment() float[source]

The :WAVeform:YINCrement? query returns the y-increment voltage value for the currently specified source.

Returns:

A real number in exponential format.

Return type:

float

waveform_y_origin() float[source]

The :WAVeform:YORigin? query returns the y-origin voltage value for the currently specified source. The voltage value returned is the voltage value represented by the waveform data digital code 00000.

Returns:

A real number in exponential format.

Return type:

float

write(message)[source]