striqt.sensor.specs¶
schema for the specification of calibration and sweeps
Sweeps and captures¶
Spec structs for sweeps, actions, capture settings, and the loops that expand one capture into several.
ActionSpec
¶
Bases: SpecBase, Generic[SS, SP, SA]
the top-level spec that an action runs.
An instance is decoded from a file against the tagged class of a sensor binding
or constructed in code. The source, peripherals, and sink blocks name
the resources that every action opens. source and peripherals are the spec
types of the binding named by the sensor_binding tag.
check_schema
classmethod
¶
raise if the spec types of schema cannot configure this action.
The base implementation accepts every schema.
Parameters:
-
schema(Any) –the
Schemaof the binding
Raises:
-
TypeError–if a spec type of
schemalacks a field the action requires
BurstOptions
¶
Bases: SpecBase
the bursts block of a Source: the policy for the segments of a capture burst.
A capture with burst above 1 is acquired as that many back-to-back segments
with the stream left enabled, and the segments are sample-contiguous. The
hardware clock syncs once per burst. Acquisition of a capture with burst 1
blocks until a buffer slot is free and is never dropped.
on_gap
class-attribute
instance-attribute
¶
the response to a timing gap in a burst: 'skip' drops a segment when the queue is full and resumes after a stream overflow; 'except' raises on a full queue and restarts the burst after a stream overflow
buffers
class-attribute
instance-attribute
¶
maximum number of acquisitions queued ahead of analysis (Constraints: >= 1)
trigger_on
class-attribute
instance-attribute
¶
'first' runs the signal trigger on the first delivered segment of a burst and applies that lag to the rest; 'all' runs the trigger on every segment
CapturePlan
¶
Bases: ActionSpec[SS, SP, SA], Generic[SS, SP, SC, SA]
an ActionSpec with the captures, loops, and adjust_captures blocks.
The loops are expanded over captures into the sequence of captures that the
action runs, and the adjust_captures remaps for the open source are applied to
each expanded capture. Construction rejects a repeat loop that is not the
outermost entry, two loops over one field, and a loop over a field that the
listed captures set to different values.
adjust_captures
class-attribute
instance-attribute
¶
adjust_captures: dict[str | one of ['defaults'], dict[str, CaptureRemap | float | int | str | bool | None]] = msgspec.field(default_factory=dict)
Remaps of capture fields by source id (or 'defaults'), keyed by the value of another capture field; lookup keys are converted to the type of the keyed field
CaptureRemap
¶
Bases: SpecBase
an entry of the adjust_captures block: a capture field set by lookup from the value of other capture fields.
The key names one or more fields of the capture after the loop point is applied, and the lookup maps each key value (a tuple, or its JSON array string in YAML, for several key fields) to the value of the adjusted field. A key value absent from the lookup takes the default when one is set; otherwise the field is left unset for an optional remap, and the spec is rejected for a required one.
CellChannel
¶
Bases: SpecBase
one 5G NR channel of the cell_channels table of a Cellular5GNRSweep.
A capture with the center_frequency of the channel is acquired at the sample
rate that striqt.waveform.comms_5gnr.nr_sample_rate derives from
channel_bandwidth and subcarrier_spacing, at or above min_sample_rate,
with analysis_bandwidth equal to channel_bandwidth. The cellular measurement
parameters are set from the remaining fields through the adjust_analysis of
the capture, with ssb_case None selecting the TS 38.213 §4.1 case for the
spacing ('c' at 30 kHz). Only a subcarrier_spacing of 30 kHz is accepted, and
tdd_frame_slots is 1 character per slot of the 10 ms frame or 1 character for
every slot.
center_frequency
instance-attribute
¶
RF center frequency (Constraints: > 0, units: Hz)
channel_bandwidth
instance-attribute
¶
nominal 5G NR channel bandwidth (3GPP TS 38.104 §5.3) (Constraints: > 0, units: Hz)
subcarrier_spacing
class-attribute
instance-attribute
¶
Subcarrier spacing (15e3, 30e3, 60e3, etc) (Constraints: units: Hz)
ssb_frequency_offset
class-attribute
instance-attribute
¶
offset of the SSB center from the channel center frequency (Constraints: units: Hz)
ssb_case
class-attribute
instance-attribute
¶
index locations in the SSB, or a cell search case from 3GPP TS 38.213 Sec. 4.1)
channel_guard_bandwidths
class-attribute
instance-attribute
¶
guard bandwidths excluded at the (low, high) edges of the channel (Constraints: units: Hz)
tdd_frame_slots
class-attribute
instance-attribute
¶
string composed of ('d', 'u', 's') specifying the sequence of slots in 1 TDD cellular frame, or None to fill with downlink
tdd_special_symbols
class-attribute
instance-attribute
¶
string composed of the characters ('d', 'u', 'f') indicating the sequence of symbol types (when 's' is in frame_slots)
min_sample_rate
class-attribute
instance-attribute
¶
lower bound on the sample rate derived for the channel, or None for no bound (Constraints: > 0, units: S/s)
Cellular5GNRAnalysis
¶
Bases: SpecBase
the per-measurement settings of a Cellular5GNRSweep.
Each field is named for a measurement, and None disables the measurement. A
block enables the measurement and holds only the parameters that the channel
does not fix. The remaining parameters are set from the cell_channels entry at
the center frequency of the capture and from the subcarrier spacing, or stay at
the measurement default.
Cellular5GNRSweep
¶
Bases: CapturePlan[SS, SP, SC, SA]
the spec of a sweep over 5G NR channels.
Each entry of captures names a channel by center_frequency, and
cell_channels maps a label to the CellChannel at that frequency. The
sample_rate and analysis_bandwidth of a capture are left at the class
defaults and set from the matched channel. A loop over center_frequency is
rejected, two cell_channels entries must not share a center_frequency, and
every channel in use must share one subcarrier spacing.
check_schema
classmethod
¶
raise unless schema can configure a sweep over cell channels.
The capture type must have a center_frequency field, and schema.analysis
must declare every field of Cellular5GNRAnalysis with the spec type of the
BuiltinAnalyses field of that name.
Raises:
-
TypeError–if the capture type lacks
center_frequency, or ifschema.analysislacks a field or declares a different spec type
CellularChannelPowerHistogramSpec
¶
Bases: SpecBase
the settings of the ChannelPowerHistogram measurement in a Cellular5GNRSweep.
power_resolution
instance-attribute
¶
Power bin resolution (Constraints: units: dB)
detector_period
class-attribute
instance-attribute
¶
Power detector bin duration, a whole multiple of the sample period (Constraints: units: s)
power_detectors
class-attribute
instance-attribute
¶
Power detectors evaluated in each bin: 'rms', 'peak', or both
CellularChannelPowerTimeSeriesSpec
¶
Bases: SpecBase
the settings of the ChannelPowerTimeSeries measurement in a Cellular5GNRSweep.
CellularCyclicAutocorrelationSpec
¶
Bases: SpecBase
the settings of the CellularCyclicAutocorrelator measurement in a Cellular5GNRSweep.
The fields of CellularCyclicAutocorrelator absent here are set by the sweep from the cell channel.
CellularCyclicChannelPowerSpec
¶
Bases: SpecBase
the settings of the CyclicChannelPower measurement in a Cellular5GNRSweep.
The fields of CyclicChannelPower absent here are set by the sweep from the cell channel.
CellularIQWaveformSpec
¶
Bases: SpecBase
the IQWaveform settings that a Cellular5GNRSweep sets directly.
The remaining fields of IQWaveform are derived from the cell channel of the
sweep.
CellularPowerSpectralDensitySpec
¶
Bases: SpecBase
the settings of the PowerSpectralDensity measurement in a Cellular5GNRSweep.
The fields of PowerSpectralDensity absent here are set by the sweep from the cell channel.
CellularPSSCorrelationSpec
¶
Bases: SpecBase
the settings of the Cellular5GNRPSSCorrelator measurement in a Cellular5GNRSweep.
The fields of Cellular5GNRPSSCorrelator absent here are set by the sweep from the cell channel.
CellularPSSSyncSpec
¶
Bases: SpecBase
the settings of the Cellular5GNPSSSync measurement in a Cellular5GNRSweep.
The fields of Cellular5GNPSSSync absent here are set by the sweep from the cell channel.
CellularResourcePowerHistogramSpec
¶
Bases: SpecBase
the settings of the CellularResourcePowerHistogram measurement in a Cellular5GNRSweep.
The fields of CellularResourcePowerHistogram absent here are set by the sweep from the cell channel.
window
instance-attribute
¶
window function specification following scipy.signal.get_window
power_resolution
instance-attribute
¶
Power bin resolution (Constraints: units: dB)
average_rbs
class-attribute
instance-attribute
¶
frequency resolution of the spectrogram: False for 1 subcarrier, True for 1 resource block (12 subcarriers), or 'half' for 6 subcarriers
average_slots
class-attribute
instance-attribute
¶
True to coarsen spectrogram bins by averaging 1-symbol time resolution
cyclic_prefix
class-attribute
instance-attribute
¶
cyclic prefix length of the 3GPP numerology (TS 38.211 Table 4.2-1)
lo_bandstop
class-attribute
instance-attribute
¶
mask with float("nan") at this bandwidth centered at baseband DC (Constraints: units: Hz)
CellularSpectrogramSpec
¶
Bases: SpecBase
the settings of the Spectrogram measurement in a Cellular5GNRSweep.
The fields of Spectrogram absent here are set by the sweep from the cell channel.
CellularSSBSpectrogramSpec
¶
Bases: SpecBase
the settings of the Cellular5GNRSSBSpectrogram measurement in a Cellular5GNRSweep.
The fields of Cellular5GNRSSBSpectrogram absent here are set by the sweep from the cell channel.
Description
¶
DiracDeltaCapture
¶
Bases: SensorCapture
the capture of a FunctionSource that generates one impulse in a field of zeros.
The impulse is at the sample nearest the time offset from the start of the capture, with an amplitude in dB relative to 1.
Extension
¶
Bases: SpecBase
the extensions: block of an action spec.
import_path is inserted into sys.path and import_name is imported before
the rest of the spec is decoded. The module may call bind_sensor for the
sensor_binding that the spec names.
FileCapture
¶
FrequencyBinRange
¶
Bases: LoopBase
a loop over a field on a grid of equal steps symmetric about 0.
The points are spaced by step on a grid centered on 0 that spans
ceil((stop - start) / step) steps, and a point outside start to stop at
either end of the grid is dropped. Each point is a multiple of the step or of
half the step.
List
¶
LoopBase
¶
Bases: SpecBase
the base of the entries in the loops block of a CapturePlan.
A loop names a field of either the capture or the analysis, and get_points
returns the values that the field takes, one expanded capture per point. Loops
are nested in declaration order, outermost first.
isin
class-attribute
instance-attribute
¶
selects whether to loop a capture or analysis parameters
ManualYFactorCalibration
¶
Bases: CapturePlan[SS, SP, SC, SA]
the spec of a Y-factor calibration with a hand-switched noise diode.
An analysis block is accepted, discarded, and reported with a
DeprecationWarning. More than one capture is accepted only when
calibration.implied_loops names the fields in which the captures differ.
source.calibration must be None, and every capture must have burst equal to
1. A bound spec is rejected when the runner cannot derive the calibration sweep.
check_schema
classmethod
¶
raise unless schema.analysis declares channel_power_time_series.
NoiseCapture
¶
Bases: SensorCapture
the capture of a FunctionSource that generates circular white Gaussian noise.
The noise is drawn independently on each port, with a total power (mW) equal to the power spectral density times the source sample rate.
noise_psd
class-attribute
instance-attribute
¶
noise total channel power (Constraints: >= 0, units: mW/Hz)
PlotOptions
¶
Bases: SpecBase
the plot_hint block of a Sweep: the data subset, the facet layout, and the plot function arguments of each variable.
One figure is drawn per group of the data block for each variable entry.
Range
¶
Bases: LoopBase
a loop over the values of a field from a start to a stop in equal steps.
The stop is included when the span is a whole number of steps, and the loop has one point when the start equals the stop.
Repeat
¶
Bases: LoopBase
a loop that repeats the whole expanded capture sequence a number of times.
A Repeat is accepted only as the first (outermost) loop, and names no field.
SawtoothCapture
¶
Bases: SensorCapture
the capture of a FunctionSource that generates a real sawtooth ramp.
Each ramp rises from 0 toward the peak amplitude over one period, and the ramps reset at the start of the capture.
Schema
dataclass
¶
Schema(
source: type[SS],
capture: type[SC],
peripherals: type[SP],
init_like: Callable[PS, Any],
arm_like: Callable[PC, Any],
action: type[ActionSpec[SS, SP, SA]] = Sweep,
analysis: type[SA] = cast('type[SA]', BuiltinAnalyses),
)
Bases: Generic[SS, SP, SC, SA, PS, PC]
the spec types of a sensor binding.
init_like
instance-attribute
¶
a callable with the keyword signature of source, read by the type checker
alone
arm_like
instance-attribute
¶
a callable with the keyword signature of capture, read by the type checker
alone
action
class-attribute
instance-attribute
¶
action: type[ActionSpec[SS, SP, SA]] = structs.Sweep
the action spec type of the binding
analysis
class-attribute
instance-attribute
¶
analysis: type[SA] = dataclasses.field(
default=cast('type[SA]', sa.specs.BuiltinAnalyses)
)
the AnalysisGroup subclass of the analysis: block of a bound Sweep
SensorCapture
¶
Bases: Capture
Capture specification for a generic waveform with resampling support
lo_shift
class-attribute
instance-attribute
¶
LO shift direction
backend_sample_rate
class-attribute
instance-attribute
¶
Source sample rate (Constraints: > 0, units: S/s)
adjust_analysis
class-attribute
instance-attribute
¶
changes to apply across each analysis for any matching parameter
external_lo_frequency
class-attribute
instance-attribute
¶
LO frequency of external frequency converter
burst
class-attribute
instance-attribute
¶
number of back-to-back acquisitions of the capture with the stream left enabled (Constraints: >= 1)
SingleToneCapture
¶
Bases: SensorCapture
the capture of a FunctionSource that generates one unit-amplitude tone.
The tone is offset from the center frequency by a baseband frequency. White noise is added at the SNR below the tone power, and an SNR of None adds no noise.
SoapyCapture
¶
Bases: SensorCapture
the capture of a SoapySDR source: a SensorCapture with a tuned frequency and gain.
Construction rejects a gain tuple when the port is a scalar, and a gain tuple with a length other than the port count.
SpecValidationError
¶
Bases: ValidationError
a spec validation failure with a msgspec-style field path.
path is the chain of field accesses from the document root, rendered as
msgspec renders a path ($.analysis.spectrogram) ahead of message.
locations are further roots at which the same failure is located, rendered
as an at ... on ... trailer in the order given.
at
¶
at(*locations: str) -> SpecValidationError
return a copy with locations prepended to the at ... on ... trailer
Sweep
¶
Bases: CapturePlan[SS, SP, SC, SA]
the spec of a sweep.
analysis is an instance of the group that Schema.analysis names for the
binding, and is evaluated on each expanded capture with the adjust_analysis
of the capture applied on top. options selects the warmup, IQ reuse, and the
loop_only_nyquist filter of the expansion. Construction validates each unique
capture against the registered measurements and the conditioning signal path.
SweepOptions
¶
Bases: SpecBase
the options block of a Sweep: IQ reuse, the Nyquist filter of the expansion, and the GPU warmup.
With IQ reuse, the IQ of the previous acquisition serves a capture with the same radio settings, and the Nyquist filter drops each expanded capture with a finite analysis bandwidth above the sample rate of the capture. The warmup runs the sweep once over empty buffers before the first acquisition when a GPU backend is in use.
skip_warmup
class-attribute
instance-attribute
¶
if True, suppress empty buffer runs for GPU backends
Sources, sinks, and peripherals¶
Spec structs for IQ sources, data sinks, peripherals, and the acquisition metadata recorded with each capture.
AcquiredIQ
dataclass
¶
AcquiredIQ(
x: Array,
capture: Capture | None,
power_units: PowerUnits,
info: AcquisitionInfo,
extra_data: dict[str, Any],
source_spec: Source,
resampler: ResamplerDesign,
format_path: PathFormatter | None = None,
voltage_scale: Array | float = 1,
conjugate: tuple[bool, ...] | Literal[False] = False,
signal_trigger: Trigger | None = None,
overwrite_x: bool = False,
trigger_shifts: Array | None = None,
pending_extra_data: PendingExtraData | None = None,
)
Bases: AcquiredIQ
an acquisition from a sensor source with the metadata and conditioning of the capture.
x must not change after the first access of preprocess, except that the
resampling stage replaces x with a ConsumedBuffer when overwrite_x is True.
conjugate
class-attribute
instance-attribute
¶
one flag per port, True to conjugate the IQ of that port, or the scalar False for no conjugation
signal_trigger
class-attribute
instance-attribute
¶
signal_trigger: Trigger | None = None
the trigger run for alignment, or None to select info.signal_trigger
overwrite_x
class-attribute
instance-attribute
¶
True permits the resampling stage to consume x, leaving a ConsumedBuffer in
x when the stage returns another array
trigger_shifts
class-attribute
instance-attribute
¶
one shift per port, in samples at capture.sample_rate, applied in place of
running the trigger, or None to run the trigger
pending_extra_data
class-attribute
instance-attribute
¶
pending_extra_data: PendingExtraData | None = None
the peripheral read still running for the capture, or None when extra_data
is complete
preprocess
¶
return the Preprocessor that conditions x through the sensor signal path.
One Preprocessor is created per instance. A dataclasses.replace copy
starts with a Preprocessor of its own and every stage empty.
AcquisitionInfo
¶
Bases: Struct
the metadata of one acquisition
DataOptions
¶
Bases: SpecBase
the data block of a plot hint: the subset of a dataset that one figure plots.
The dataset is narrowed by the sweep index, the query, and the selection, and is split by the grouping dimensions into one figure per group.
FileAcquisitionInfo
¶
Bases: AcquisitionInfo
the AcquisitionInfo of a file source: the radio settings read from the file.
The center frequency, gain, port, and backend sample rate are read from the file header or coordinates, in place of the settings that a hardware source tunes.
center_frequency
class-attribute
instance-attribute
¶
Center frequency for each port (Constraints: units: Hz, > 0)
backend_sample_rate
instance-attribute
¶
Source sample rate (Constraints: > 0, units: S/s)
port
class-attribute
instance-attribute
¶
Input port indices (Constraints: >= 0)
gain
class-attribute
instance-attribute
¶
Gain setting for each channel (Constraints: units: dB)
FunctionSource
¶
Bases: Source
the source block of a sweep for a synthetic waveform generator.
The source generates the waveform of each capture at the declared port count, in
complex64, and a squared magnitude of 1 is 1 mW.
ManualYFactorSpec
¶
Bases: Peripherals
the calibration: block of a ManualYFactorCalibration.
detector_period None selects the one duration shared by the captures and
loops as the bin of the generated channel_power_time_series analysis, and a
bound spec with more than one duration is rejected.
enr
instance-attribute
¶
Excess noise ratio, referred to a diode-off source temperature of 290 K (Constraints: units: dB)
ambient_temperature
instance-attribute
¶
Ambient temperature (Constraints: units: K)
implied_loops
class-attribute
instance-attribute
¶
List of looped fields embedded in the capture list
detector_period
class-attribute
instance-attribute
¶
Power detector bin duration, a whole multiple of the sample period (Constraints: units: s)
MATSource
¶
Bases: Source
the source block of a sweep that reads IQ from a MATLAB .mat file.
The file is opened when the source opens and each capture is read from the
array at the declared key, in complex64, with the squared magnitude in the
declared power units. The backend sample rate is read from the file, so a
capture that sets one is rejected.
file_format
class-attribute
instance-attribute
¶
data format or auto to guess by extension
file_metadata
class-attribute
instance-attribute
¶
any capture fields not included in the file
loop
class-attribute
instance-attribute
¶
whether to loop the file to create longer IQ waveforms
power_units
class-attribute
instance-attribute
¶
unit of the squared magnitude of the stored IQ: calibrated milliwatts, full scale, or arbitrary units
NoPeripherals
¶
Bases: Peripherals
the peripherals block of a sensor binding without peripheral hardware, with no fields
NoSource
¶
Bases: Source
the source block of a sweep that acquires empty buffers.
The number of buffer rows is the declared port count, so the buffers of a warmup sweep match those of the hardware sweep that follows.
PendingExtraData
dataclass
¶
a peripheral read of a capture that is still running when the acquisition is handed to analysis.
Peripherals
¶
SharedPlotOptions
¶
Bases: SpecBase
the plotter block of a plot hint: the facet layout and the title and filename templates.
The column and row facets are distinct dataset dimensions, and the title, label, and filename templates are formatted from the coordinates of the plotted dataset.
Sink
¶
Bases: SpecBase
the output block of every action spec.
path is the output location, with the {field} templates of
paths.get_path_fields expanded, and None selects no output. log_path and
log_level configure the log file independently of path.
SoapyAcquisitionInfo
¶
Bases: AcquisitionInfo
extra coordinate information returned from an acquisition
SoapySource
¶
Bases: Source
the source block of a sweep for a SoapySDR device.
The time and clock sources, the time sync point, and the overload limits are set on the device when the source opens, and the IQ is in full-scale units unless a calibration path is set. Construction rejects a signal trigger that names no registered trigger or that enables more than one.
time_source
class-attribute
instance-attribute
¶
Hardware source for timestamps
time_sync_at
class-attribute
instance-attribute
¶
when to sync the hardware clock: on connection, or before each capture
clock_source
class-attribute
instance-attribute
¶
Hardware source for the frequency reference
receive_retries
class-attribute
instance-attribute
¶
number of acquisition retry attempts on stream error (Constraints: >= 0)
adc_overload_limit
class-attribute
instance-attribute
¶
dataset adc_overload=True when the peak ADC level exceeds this threshold (Constraints: <= 0, units: dBFS)
if_overload_limit
class-attribute
instance-attribute
¶
the maximum level at maximum gain before IF/baseband overload (Constraints: units: dBFS)
Source
¶
Bases: SpecBase
run-time characteristics of the radio that are left invariant during a sweep
SourceInfo
¶
Bases: SpecBase
the capabilities of an open source, as returned by get_info.
With a port count of None, a port tuple of any length is accepted. The retry count is the receive retry setting in force during the probe.
TDMSSource
¶
Bases: Source
a source of IQ from a TDMS file with int16 I and Q channels.
Full-scale int16 is scaled to the reference_level_dBm header of the file. The
squared magnitude of the scaled IQ is in mW.
ZarrIQSource
¶
Bases: Source
the source block of a sweep that reads IQ from the iq_waveform variable of a zarr store.
The selection narrows the variable to a 2-D array of (port, iq_sample), and
the center frequency, gain, port, and sample rate coordinates of the store are
the radio settings of each acquisition. A selection that leaves another number of dimensions is
rejected when the source opens.
ZarrSink
¶
Bases: Sink
the output block of a Sweep: a zarr store with one row per port of each capture.
The store is allocated when the sink opens, and each capture is written as the chunks of the store fill.
store
class-attribute
instance-attribute
¶
serialization output format of the sink
max_threads
class-attribute
instance-attribute
¶
Blosc compression thread count, or null for the numcodecs default
batched_write_count
class-attribute
instance-attribute
¶
ignored, with no effect on the sink
max_chunk_bytes
class-attribute
instance-attribute
¶
Upper bound on the uncompressed size of one chunk of each variable (Constraints: > 0, units: B)