InstroSDR#

class InstroSDR(
name: str,
driver: SDRDriverBase,
**kwargs: Any,
)[source]#

Bases: Instrument

Software defined radio instrument that publishes IQ blocks and spectrum features.

Each IQ block publishes as one Measurement with paired .i and .q channels per signal path, timestamped from the sample period the device reports.

Initialize an InstroSDR.

Parameters:
  • name (str) – Channel-name prefix for published data.

  • driver (SDRDriverBase) – Concrete vendor driver.

  • **kwargs – Passed to Instrument: publishers and background_config, dataset_rid to attach a NominalCorePublisher, and any other keyword as a default tag.

Example

from instro.unstable.sdr import InstroSDR

sdr = InstroSDR(name="sdr", driver=MyVendorSDR(...))  # any concrete SDRDriverBase
sdr.open()
try:
    sdr.set_center_freq(100e6)
    sdr.set_sample_rate(2.4e6)
    iq = sdr.measure_iq(n_samples=4096)
    spectrum = sdr.measure_spectrum(n_samples=4096)
finally:
    sdr.close()

Attributes

background_interval

Background daemon loop period.

channel_names

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

driver

The underlying hardware driver.

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 background daemon and close the driver.

compute_psd

Acquire one block and return one channel's power spectral density.

define_background_daemon

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

fetch_iq

Return the next contiguous block from the running stream and publish it.

get_antenna

Query the selected antenna port and publish it as antenna.

get_backlog

Return how many samples are waiting on the receive stream.

get_bandwidth

Query the IF or filter bandwidth and publish it as bandwidth.

get_center_freq

Query the RF center frequency and publish it as center_freq.

get_channel

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

get_freq_correction

Query the reference oscillator correction and publish it as freq_correction.

get_gain

Query the gain and publish it as gain.

get_gain_mode

Query the gain mode and publish it as gain_mode.

get_sample_rate

Query the IQ sample rate and publish it as sample_rate.

get_single_channel_value

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

is_streaming

Report whether a stream is running.

measure_iq

Acquire one time-aligned IQ block and publish it as paired .i and .q channels.

measure_spectrum

Acquire one block and publish four scalar spectrum features per channel.

open

Open the underlying driver.

publish

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

set_antenna

Set the antenna port and publish it as antenna.cmd.

set_bandwidth

Set the IF or filter bandwidth and publish it as bandwidth.cmd.

set_center_freq

Set the RF center frequency and publish it as center_freq.cmd.

set_freq_correction

Set the reference oscillator correction and publish it as freq_correction.cmd.

set_gain

Set the gain and publish it as gain.cmd.

set_gain_mode

Hand gain to the AGC or take manual control, and publish it as gain_mode.cmd.

set_sample_rate

Set the IQ sample rate and publish it as sample_rate.cmd.

start

Begin continuous acquisition.

stop

Stop the background daemon and every running hardware stream.