pyscpi.keysight.osc#

Module Contents#

Functions#

readChannels(inst, channels[, points, runAfter, debug])

Reads multiple channels from the oscilloscope.

readSingleChannel(inst, channel[, points, runAfter, debug])

Reads a single channel from the oscilloscope.

autoScale(inst)

Autoscales the oscilloscope.

setTimeAxis(inst, scale, position)

Sets the time axis of the oscilloscope.

setChannelAxis(inst, channel, scale, offset)

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

setWGenOutput(inst, state)

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

setWGenSin(inst, amp, offset, freq)

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

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

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

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

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

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

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

setWGenDC(inst, offset)

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

setWGenNoise(inst, v0, v1, offset)

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

pyscpi.keysight.osc.readChannels(inst, channels, points=0, runAfter=True, debug=False)[source]#

Reads multiple channels from the oscilloscope.

Parameters:
  • inst – The instrument object from pyscpi or pyvisa

  • channels (list[int]) – A list of channels to read eg. [1, 2]

  • points (int) – The number of points to read. If 0, read all points

  • runAfter (bool) – Run the oscilloscope after reading

  • debug (bool) – Print debug messages

Returns:

A NumPy tuple of time and voltage arrays

Return type:

tuple[numpy.ndarray, numpy.ndarray]

pyscpi.keysight.osc.readSingleChannel(inst, channel, points=0, runAfter=True, debug=False)[source]#

Reads a single channel from the oscilloscope.

Parameters:
  • inst – The instrument object from pyscpi or pyvisa

  • channel (int) – The channel to read

  • points (int) – The number of points to read. If 0, read all points

  • runAfter (bool) – Run the oscilloscope after reading

  • debug (bool) – Print debug messages

Returns:

A NumPy tuple of time and voltage arrays

Return type:

tuple[numpy.ndarray, numpy.ndarray]

pyscpi.keysight.osc.autoScale(inst)[source]#

Autoscales the oscilloscope.

Parameters:

inst – The instrument object from pyscpi or pyvisa

Return type:

None

pyscpi.keysight.osc.setTimeAxis(inst, scale, position)[source]#

Sets the time axis of the oscilloscope.

Parameters:
  • inst – The instrument object from pyscpi or pyvisa

  • scale (float) – The scale of the time axis in seconds

  • position (float) – The position of the time axis from the trigger in seconds

Return type:

None

pyscpi.keysight.osc.setChannelAxis(inst, channel, scale, offset)[source]#

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

Parameters:
  • inst – The instrument object from pyscpi or pyvisa

  • channel (int) – The channel to set

  • scale (float) – The scale of the channel axis in volts

  • offset (float) – The offset of the channel axis in volts

Return type:

None

pyscpi.keysight.osc.setWGenOutput(inst, state)[source]#

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

Parameters:
  • inst – The instrument object from pyscpi or pyvisa

  • state (int | str) – The state to set the output to (0 or 1) or (‘OFF’ or ‘ON’)

Return type:

None

pyscpi.keysight.osc.setWGenSin(inst, amp, offset, freq)[source]#

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

Parameters:
  • inst – The instrument object from pyscpi or pyvisa

  • amp (float) – The amplitude of the sine wave in volts

  • offset (float) – The offset of the sine wave in volts

  • freq (float) – The frequency of the sine wave in Hz. The frequency can be adjusted from 100 mHz to 20 MHz.

Return type:

None

pyscpi.keysight.osc.setWGenSquare(inst, v0, v1, offset, freq, dutyCycle)[source]#

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

Parameters:
  • inst – The instrument object from pyscpi or pyvisa

  • v0 (float) – The voltage of the low state in volts

  • v1 (float) – The voltage of the high state in volts

  • offset (float) – The offset of the square wave in volts

  • freq (float) – The frequency of the square wave in Hz. The frequency can be adjusted from 100 mHz to 20 MHz.

  • 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.

Return type:

None

pyscpi.keysight.osc.setWGenRamp(inst, v0, v1, offset, freq, symmetry)[source]#

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

Parameters:
  • inst – The instrument object from pyscpi or pyvisa

  • v0 (float) – The voltage of the low state in volts

  • v1 (float) – The voltage of the high state in volts

  • offset (float) – The offset of the ramp wave in volts

  • freq (float) – The frequency of the ramp wave in Hz. The frequency can be adjusted from 100 mHz to 100 kHz.

  • symmetry (float) – Symmetry represents the amount of time per cycle that the ramp waveform is rising and can be adjusted from 0% to 100%.

Return type:

None

pyscpi.keysight.osc.setWGenPulse(inst, v0, v1, offset, period, pulseWidth)[source]#

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

Parameters:
  • inst – The instrument object from pyscpi or pyvisa

  • v0 (float) – The voltage of the low state in volts

  • v1 (float) – The voltage of the high state in volts

  • offset (float) – The offset of the pulse wave in volts

  • period (float) – The period of the pulse wave in seconds. The period can be adjusted from 10 ns to 100 ns.

  • pulseWidth (float) – The pulse width can be adjusted from 20 ns to the period minus 20 ns.

Return type:

None

pyscpi.keysight.osc.setWGenDC(inst, offset)[source]#

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

Parameters:
  • inst – The instrument object from pyscpi or pyvisa

  • offset (float) – The offset of the DC wave in volts

Return type:

None

pyscpi.keysight.osc.setWGenNoise(inst, v0, v1, offset)[source]#

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

Parameters:
  • inst – The instrument object from pyscpi or pyvisa

  • v0 (float) – The voltage of the low state in volts

  • v1 (float) – The voltage of the high state in volts

  • offset (float) – The offset of the noise wave in volts

Return type:

None