InstroScope#

class InstroScope(
name: str | None = None,
driver: ScopeDriverBase | None = None,
num_channels: int | None = None,
publishers: list[Publisher] | None = None,
config: ScopeConfig | dict | Path | str | None = None,
autostart: bool = False,
**kwargs,
)[source]#

Bases: Instrument

Oscilloscope instrument. Tracks scope state locally; call sync_configuration() after open() to refresh.

Initialize an InstroScope.

Provide either config or driver/num_channels together, not both.

Parameters:
  • name – Channel-name prefix for published data. Falls back to config.device.name when config is given.

  • driver –

    Concrete scope driver; owns its own transport:

    scope = InstroScope(
        "scope",
        driver=Keysight1200X("<visa_resource>"),
        num_channels=4,
    )
    

  • num_channels – Analog-input channel count.

  • publishers – Publishers that receive emitted Measurement/Command data. Combined with any publishers declared in config.

  • config – A ScopeConfig, a dict, or a path to a JSON config file. Its channels, acquisition, and trigger blocks are applied through the public setters on open(); each channel’s measurements are registered as background daemon functions.

  • autostart – When True, open the connection and start background polling. Requires config with at least one measurements entry, since the daemon has nothing to poll otherwise.

  • **kwargs – Default tags applied to every emitted Measurement/Command. Pass dataset_rid="<rid>" to auto-create a NominalCorePublisher (uses the on-disk ‘default’ Nominal credential).

Attributes

background_interval

Seconds between background daemon iterations (0 = no wait).

channel_names

Return an insertion-ordered snapshot of all published channel names.

Methods

add_background_daemon_function

Append method to the daemon's call list.

add_publisher

Register a publisher to receive this instrument's Measurement/Command data.

close

Stop the daemon and publishers, then close the underlying driver.

define_background_daemon

Replace all daemon functions with a single method (called with the given args).

fetch_waveform

Fetch the acquired waveform from channel.

force_trigger

Force a trigger event immediately.

get_acquisition_mode

Query the current acquisition mode (published as a string).

get_acquisition_state

Query RUNNING/STOPPED.

get_average_count

Query the average count.

get_channel

Return the most recent length samples for channel_name from the in-memory buffer.

get_coupling

Query the input coupling mode on channel (published as a string).

get_horizontal_scale

Query the timebase (seconds/div).

get_probe_attenuation

Query the probe attenuation ratio on channel.

get_sample_rate

Query the current sample rate (Sa/s).

get_single_channel_value

Return the most recent sample for channel_name from the in-memory buffer.

get_trigger_status

Query the trigger status (published as a string).

get_vertical_offset

Query the vertical offset (volts) on channel.

get_vertical_scale

Query the vertical scale (V/div) on channel.

load_settings

Recall a scope setup.

measure

Take a built-in measurement on channel.

open

Open the underlying driver and apply any configured initial state.

publish

Fan data out to every configured publisher; kwargs pass through.

run

Start continuous acquisition.

save_screenshot

Capture a screenshot and save it.

save_settings

Save scope setup.

set_acquisition_mode

Set the acquisition mode (NORMAL/AVERAGE/HIRES/PEAK_DETECT/ENVELOPE).

set_average_count

Set the average count (waveforms averaged) used in AVERAGE acquisition mode.

set_coupling

Set AC/DC input coupling on channel.

set_horizontal_scale

Set the timebase (seconds/div).

set_probe_attenuation

Set the probe attenuation ratio (e.g. 1, 10, 100) on channel.

set_trigger_level

Set the trigger level (volts).

set_trigger_mode

Set the trigger mode (AUTO/NORMAL).

set_trigger_slope

Set the trigger edge slope (RISING/FALLING/EITHER).

set_trigger_source

Set the trigger source to channel.

set_trigger_type

Set the trigger type (EDGE, PULSE, …).

set_vertical_offset

Set the vertical offset (volts) on channel.

set_vertical_scale

Set the vertical scale (V/div) on channel.

single

Arm a single-shot acquisition.

start

Start the background daemon; warns when nothing is registered to poll.

stop

Signal the background daemon to stop and join it.

stop_acquisition

Stop acquisition; records the acquisition timestamp if one was armed.

sync_configuration

Bulk-query the instrument and overwrite the tracked ScopeState with live state.