InstroAWG#
- class InstroAWG(
- name: str | None = None,
- driver: AWGDriverBase | None = None,
- num_channels: int | None = None,
- publishers: list[Publisher] | None = None,
- config: AWGConfig | dict | Path | str | None = None,
- autostart: bool = False,
- **kwargs,
Bases:
InstrumentAWG instrument. Methods return Measurement/Command for publishing.
Initialize an InstroAWG. Provide either
configordriver/num_channelstogether, not both.Attributes
Seconds between background daemon iterations (0 = no wait).
Return an insertion-ordered snapshot of all published channel names.
Methods
Append
methodto the daemon's call list.Register a publisher to receive this instrument's Measurement/Command data.
Sync the phase of all channels.
Enable or disable burst mode on the given channel.
Close the underlying driver.
Convert an amplitude value between units using channel's configured waveform.
Replace all daemon functions with a single
method(called with the given args).Fire a burst trigger on channel now; the trigger source must already be MANUAL.
Fire a sweep trigger on channel now; the trigger source must already be MANUAL.
Read back the current amplitude and its measurement unit on channel.
Read back the burst trigger delay (seconds) on channel.
Read back the gate polarity for GATED bursts on channel.
Read back the number of cycles per trigger for NCYCLE bursts on channel.
Read back the internal burst period (seconds) on channel.
Read back whether burst mode is enabled on channel.
Read back the burst trigger source on channel.
Read back the burst type currently active on channel.
Return the most recent
lengthsamples forchannel_namefrom the in-memory buffer.Read back whether modulation is enabled on channel.
Read back the modulation type currently active on channel.
Read back the DC offset (volts) on channel.
Read back the output load impedance on channel.
Read back whether the output is enabled on channel.
Return the most recent sample for
channel_namefrom the in-memory buffer.Read back the sweep end frequency (Hz) on channel.
Read back the sweep return time (seconds) on channel.
Read back the sweep start frequency (Hz) on channel.
Read back the sweep start hold time (seconds) on channel.
Read back whether sweep mode is enabled on channel.
Read back the sweep stop hold time (seconds) on channel.
Read back the sweep time (seconds) on channel.
Read back the sweep trigger source on channel.
Read back the sweep type currently configured on channel.
Read back the current waveform definition on channel.
Enable or disable modulation on the given channel.
Open the underlying driver and apply any configured channel state.
Enable or disable the output on channel.
Fan
dataout to every configured publisher;kwargspass through.Set the output amplitude on channel.
Configure channel's burst type.
Set the burst trigger delay (seconds) on channel.
Set the gate polarity for GATED bursts on channel.
Set the number of cycles per trigger for NCYCLE bursts on channel.
Set the internal burst period (seconds) on channel.
Set the burst trigger source on channel.
Configure channel's carrier modulation with modulator shape.
Set the DC offset (volts) on channel.
Set the output load impedance; None means high-Z.
Configure the sweep type on channel.
Set the sweep end frequency (Hz) on channel.
Set the sweep return time (seconds) on channel.
Set the sweep start frequency (Hz) on channel.
Set the sweep start hold time (seconds) on channel.
Set the sweep stop hold time (seconds) on channel.
Set the sweep time (seconds) on channel.
Set the sweep trigger source on channel.
Program channel with a waveform.
Start the background daemon.
Signal the background daemon to stop and join it.
Enable or disable sweep mode on channel.
- property background_interval#
Seconds between background daemon iterations (0 = no wait).
- set_waveform(
- channel: int,
- waveform: Sine | Square | Sawtooth | Triangle | Pulse | Arbitrary | StaticValue,
- **kwargs,
Program channel with a waveform.
- get_waveform(
- channel: int,
Read back the current waveform definition on channel.
- set_amplitude(
- channel: int,
- amplitude: float,
- unit: AmplitudeMeasurementUnit,
- **kwargs,
Set the output amplitude on channel.
- get_amplitude(
- channel: int,
Read back the current amplitude and its measurement unit on channel.
- convert_amplitude(
- channel: int,
- amplitude: float,
- from_unit: AmplitudeMeasurementUnit,
- to_unit: AmplitudeMeasurementUnit,
- impedance_ohms: float | None = None,
Convert an amplitude value between units using channel’s configured waveform.
DBM conversions need a load impedance; if
impedance_ohmsisn’t given, channel’s output load is used instead. Raises ValueError if neither is available.
- get_offset(
- channel: int,
- **kwargs,
Read back the DC offset (volts) on channel.
- get_output_state(
- channel: int,
- **kwargs,
Read back whether the output is enabled on channel.
- get_output_load(
- channel: int,
- **kwargs,
Read back the output load impedance on channel.
- set_modulation(
- channel: int,
- mod_type: ModulationType,
- shape: Sine | Square | Sawtooth | Triangle | Pulse | Arbitrary | StaticValue,
- magnitude: float,
- **kwargs,
Configure channel’s carrier modulation with modulator shape.
NOTE: magnitude varies by mod_type: AM: depth, FM: frequency deviation, PM: phase deviation, ASK: 2nd amplitude, FSK: hop frequency.
- get_modulation_type(
- channel: int,
- **kwargs,
Read back the modulation type currently active on channel.
- get_modulation_state(
- channel: int,
- **kwargs,
Read back whether modulation is enabled on channel.
- get_burst_type(
- channel: int,
- **kwargs,
Read back the burst type currently active on channel.
- get_burst_state(
- channel: int,
- **kwargs,
Read back whether burst mode is enabled on channel.
- set_burst_trigger(
- channel: int,
- source: BurstTriggerSource,
- **kwargs,
Set the burst trigger source on channel.
- get_burst_trigger(
- channel: int,
- **kwargs,
Read back the burst trigger source on channel.
- fire_burst_trigger(
- channel: int,
- **kwargs,
Fire a burst trigger on channel now; the trigger source must already be MANUAL.
- get_burst_delay(
- channel: int,
- **kwargs,
Read back the burst trigger delay (seconds) on channel.
- set_burst_gate_polarity(
- channel: int,
- gate_polarity: GatePolarity,
- **kwargs,
Set the gate polarity for GATED bursts on channel.
- get_burst_gate_polarity(
- channel: int,
- **kwargs,
Read back the gate polarity for GATED bursts on channel.
- set_burst_ncycles( ) Command[source]#
Set the number of cycles per trigger for NCYCLE bursts on channel.
- get_burst_ncycles(
- channel: int,
- **kwargs,
Read back the number of cycles per trigger for NCYCLE bursts on channel.
- get_burst_period(
- channel: int,
- **kwargs,
Read back the internal burst period (seconds) on channel.
- get_sweep_type(
- channel: int,
- **kwargs,
Read back the sweep type currently configured on channel.
- get_sweep_state(
- channel: int,
- **kwargs,
Read back whether sweep mode is enabled on channel.
- set_sweep_trigger(
- channel: int,
- source: SweepTriggerSource,
- **kwargs,
Set the sweep trigger source on channel.
- get_sweep_trigger(
- channel: int,
- **kwargs,
Read back the sweep trigger source on channel.
- get_sweep_start_freq(
- channel: int,
- **kwargs,
Read back the sweep start frequency (Hz) on channel.
- get_sweep_end_freq(
- channel: int,
- **kwargs,
Read back the sweep end frequency (Hz) on channel.
- get_sweep_time(
- channel: int,
- **kwargs,
Read back the sweep time (seconds) on channel.
- get_sweep_start_hold_time(
- channel: int,
- **kwargs,
Read back the sweep start hold time (seconds) on channel.
- get_sweep_stop_hold_time(
- channel: int,
- **kwargs,
Read back the sweep stop hold time (seconds) on channel.
- get_sweep_return_time(
- channel: int,
- **kwargs,
Read back the sweep return time (seconds) on channel.
- fire_sweep_trigger(
- channel: int,
- **kwargs,
Fire a sweep trigger on channel now; the trigger source must already be MANUAL.
- add_background_daemon_function(
- method: Callable,
- *args,
- **kwargs,
Append
methodto the daemon’s call list. Usedefine_background_daemonto replace instead.
- add_publisher(
- publisher: Publisher,
Register a publisher to receive this instrument’s Measurement/Command data.
- property channel_names: tuple[str, ...]#
Return an insertion-ordered snapshot of all published channel names.
Names are complete after one full daemon iteration: {name}.loop_time publishes every iteration, so call get_channel(“loop_time”, wait_for_new_samples=True) then read channel_names to ensure the complete set has arrived.
- Raises:
RuntimeError – No background buffer;
start()was not called.
- define_background_daemon(
- method: Callable,
- *args,
- **kwargs,
Replace all daemon functions with a single
method(called with the given args).
- get_channel( ) Measurement#
Return the most recent
lengthsamples forchannel_namefrom the in-memory buffer.If the channel does not exist yet, or no sample is available, the code will always block until
timeoutexpires.- Parameters:
channel_name
Name of the channel to retrieve.
length
Number of trailing samples to return.
wait_for_new_samples
Block until at least
lengthnew values arrive.timeout
Seconds to wait when insufficient data exists or
wait_for_new_samples=True.
- Raises:
RuntimeError – No background buffer;
start()was not called.ChannelNotFoundError – channel had no values and no data appeared before
timeout.wait_for_new_samples=Trueand channel did not appear withintimeout.ChannelValueTimeoutError –
wait_for_new_samples=Trueand values did not arrive withintimeout.
- get_single_channel_value(
- channel_name: str,
Return the most recent sample for
channel_namefrom the in-memory buffer.This will not wait, if data is not available then
Noneis returned.- Parameters:
channel_name
Name of the channel to retrieve.
- Raises:
RuntimeError – No background buffer;
start()was not called.
- publish(
- data: Measurement | Command,
- **kwargs,
Fan
dataout to every configured publisher;kwargspass through.
- stop()#
Signal the background daemon to stop and join it. No-op if not running.