Skip to content

pyscpi.keysight.osc

Preamble dataclass

A class to store the preamble data from the oscilloscope channel.

Parameters:

Name Type Description Default
format str

The format of the data

required
type str

The type of the data

required
points int

The number of points

required
xinc float

The x increment

required
xorg float

The x origin

required
xref float

The x reference

required
yinc float

The y increment

required
yorg float

The y origin

required
yref float

The y reference

required

autoScale(inst)

Autoscales the oscilloscope.

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required

getPreamble(inst, debug=False)

Reads the preamble from the oscilloscope.

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required
debug bool

Print debug messages

False

Returns:

Type Description
Preamble

A Preamble object

readChannels(inst, channels, points=0, runAfter=True, debug=False)

Reads multiple channels from the oscilloscope.

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required
channels list[int]

A list of channels to read eg. [1, 2]

required
points int

The number of points to read. If 0, read all points

0
runAfter bool

Run the oscilloscope after reading

True
debug bool

Print debug messages

False

Returns:

Type Description
tuple[np.ndarray, np.ndarray]

A NumPy tuple of time and voltage arrays

readSingleChannel(inst, channel, points=0, runAfter=True, debug=False)

Reads a single channel from the oscilloscope.

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required
channel int

The channel to read

required
points int

The number of points to read. If 0, read all points

0
runAfter bool

Run the oscilloscope after reading

True
debug bool

Print debug messages

False

Returns:

Type Description
tuple[np.ndarray, np.ndarray]

A NumPy tuple of time and voltage arrays

setChannelAxis(inst, channel, scale, offset)

Sets the channel axis (y-axis) of the oscilloscope.

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required
channel int

The channel to set

required
scale float

The scale of the channel axis in volts

required
offset float

The offset of the channel axis in volts

required

setTimeAxis(inst, scale, position)

Sets the time axis of the oscilloscope.

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required
scale float

The scale of the time axis in seconds

required
position float

The position of the time axis from the trigger in seconds

required

setWGenDC(inst, offset)

Sets the waveform generator to a DC wave. (Only available on specific models)

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required
offset float

The offset of the DC wave in volts

required

setWGenNoise(inst, v0, v1, offset)

Sets the waveform generator to a noise wave. (Only available on specific models)

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required
v0 float

The voltage of the low state in volts

required
v1 float

The voltage of the high state in volts

required
offset float

The offset of the noise wave in volts

required

setWGenOutput(inst, state)

Sets the output state of the waveform generator. (Only available on specific models)

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required
state int | str

The state to set the output to (0 or 1) or ('OFF' or 'ON')

required

setWGenPulse(inst, v0, v1, period, pulseWidth)

Sets the waveform generator to a pulse wave. (Only available on specific models)

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required
v0 float

The voltage of the low state in volts

required
v1 float

The voltage of the high state in volts

required
period float

The period of the pulse wave in seconds. The period can be adjusted from 10 ns to 10 s.

required
pulseWidth float

The pulse width can be adjusted from 20 ns to the period minus 20 ns.

required

setWGenRamp(inst, v0, v1, freq, symmetry)

Sets the waveform generator to a ramp wave. (Only available on specific models)

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required
v0 float

The voltage of the low state in volts

required
v1 float

The voltage of the high state in volts

required
freq float

The frequency of the ramp wave in Hz. The frequency can be adjusted from 100 mHz to 100 kHz.

required
symmetry int

Symmetry represents the amount of time per cycle that the ramp waveform is rising and can be adjusted from 0% to 100%.

required

setWGenSin(inst, amp, offset, freq)

Sets the waveform generator to a sine wave. (Only available on specific models)

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required
amp float

The amplitude of the sine wave in volts

required
offset float

The offset of the sine wave in volts

required
freq float

The frequency of the sine wave in Hz. The frequency can be adjusted from 100 mHz to 20 MHz.

required

setWGenSquare(inst, v0, v1, freq, dutyCycle)

Sets the waveform generator to a square wave. (Only available on specific models)

Parameters:

Name Type Description Default
inst

The instrument object from pyscpi or pyvisa

required
v0 float

The voltage of the low state in volts

required
v1 float

The voltage of the high state in volts

required
freq float

The frequency of the square wave in Hz. The frequency can be adjusted from 100 mHz to 10 MHz.

required
dutyCycle int

The duty cycle can be adjusted from 1% to 99% up to 500 kHz. At higher frequencies, the adjustment range narrows so as not to allow pulse widths less than 20 ns.

required