striqt.analysis.specs¶
Spec structs for captures, measurement parameters, and analysis groups, which also define the YAML, JSON, and zarr schema.
Analysis
¶
Bases: SpecBase
the base of every measurement spec.
The fields of a subclass are the keyword arguments of one measurement.
AnalysisCapture
¶
AnalysisFilter
¶
Bases: SpecBase
the overlap-add filter and resampler design applied to the IQ of a capture.
nfft is the block size (in samples) of the filter and nfft_out the block size
of its output, so a nfft_out other than nfft resamples by nfft_out / nfft
and None selects nfft. window and nfft set the transition band of the
filter.
window
class-attribute
instance-attribute
¶
window function specification following scipy.signal.get_window
BuiltinAnalyses
¶
Bases: AnalysisGroup
the analysis: block of a sweep: one optional field per registered measurement.
A field set to a spec enables the measurement with those parameters, and
None leaves the measurement out. to_dict omits the None fields.
BuiltinTriggers
¶
Bases: AnalysisGroup
the struct form of the signal_trigger: field of a source.
One optional field per trigger, and exactly one is set. The set field names the
trigger, and the value is the spec of the trigger measurement. The analysis:
block need not enable that measurement.
Capture
¶
Bases: SpecBase
bare minimum information about an IQ acquisition
duration
class-attribute
instance-attribute
¶
Duration of the analysis waveform (Constraints: units: s)
sample_rate
class-attribute
instance-attribute
¶
Sample rate of the analyzed IQ waveform (Constraints: > 0, units: S/s)
analysis_bandwidth
class-attribute
instance-attribute
¶
Analysis bandwidth (Constraints: units: Hz)
Cellular5GNPSSSync
¶
Bases: _Cellular5GNRSSBSync
the keyword block of the cellular_5g_pss_sync measurement and signal trigger.
The correlator fields are those of Cellular5GNRPSSCorrelator without
max_block_count, and the correlation includes every block in the capture. The
peak search averages the correlation power over the first max_beams candidate
blocks of the burst set, or every candidate block when None, and over the ports
when per_port is False, and weights the lags of each symbol by a window that
spans window_fill of one symbol period.
Cellular5GNRPSSCorrelator
¶
Bases: _Cellular5GNRSSBCorrelator
the keyword block of cellular_5g_pss_correlation.
The band at frequency_offset is shifted to baseband and resampled to
sample_rate, and delay * sample_rate must be a whole number. With
symbol_indexes set to 'auto', the SSB case (3GPP TS 38.213 §4.1) is
determined by subcarrier_spacing, shared_spectrum, and the capture center
frequency, and a max_lag_symbols of None selects a lag span of 4 symbols, or 5
when the candidate blocks of the case are 5 or more symbols apart. The output
holds one block per discovery_periodicity in the capture up to
max_block_count, or every block when that count is None.
Cellular5GNRSSBSpectrogram
¶
Bases: Analysis
sample_rate (float): output sample rate for the resampled synchronization waveform (samples/s) discovery_periodicity (float): time period between synchronization blocks (s) frequency_offset (float or dict[float, float]): center frequency offset (see notes) max_block_count: number of synchronization blocks to evaluate
subcarrier_spacing
instance-attribute
¶
Subcarrier spacing (15e3, 30e3, 60e3, etc) (Constraints: units: Hz)
window
class-attribute
instance-attribute
¶
window function specification following scipy.signal.get_window
lo_bandstop
class-attribute
instance-attribute
¶
mask with float("nan") at this bandwidth centered at baseband DC (Constraints: units: Hz)
Cellular5GNRSSSCorrelator
¶
Bases: _Cellular5GNRSSBCorrelator
the keyword block of cellular_5g_sss_correlation.
The band at frequency_offset is shifted to baseband and resampled to
sample_rate, and delay * sample_rate must be a whole number. With
symbol_indexes set to 'auto', the SSS symbol of each block in the SSB case
(3GPP TS 38.213 §4.1) is determined by subcarrier_spacing, shared_spectrum,
and the capture center frequency, and a max_lag_symbols of None selects a lag
span of 4 symbols, or 5 when the candidate blocks of the case are 5 or more
symbols apart. The output holds one block per discovery_periodicity in the
capture up to max_block_count, or every block when that count is None.
Cellular5GNSSSSync
¶
Bases: _Cellular5GNRSSBSync
the keyword block of the cellular_5g_sss_sync measurement and signal trigger.
The correlator fields are those of Cellular5GNRSSSCorrelator without
max_block_count, and the correlation includes every block in the capture. The
peak search averages the correlation power over the first max_beams candidate
blocks of the burst set, or every candidate block when None, and over the ports
when per_port is False, and weights the lags of each symbol by a window that
spans window_fill of one symbol period.
CellularCyclicAutocorrelator
¶
Bases: Analysis
the keyword block of cellular_cyclic_autocorrelation.
frame_range and symbol_range are a count of indexes from 0 or a
(start, stop) pair as for the Python builtin range, and must select at least
one 10 ms frame inside the capture and at least one symbol in [-14, 13].
generation and subcarrier_spacings select the OFDM numerologies correlated,
one symbol lag per spacing, and frame_slots must hold a downlink slot at each
spacing, where None fills the frame with downlink.
subcarrier_spacings
class-attribute
instance-attribute
¶
One or more subcarrier spacings (15e3, 30e3, 60e3, etc) (Constraints: units: Hz)
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
CellularResourcePowerHistogram
¶
Bases: Analysis
the keyword block of cellular_resource_power_histogram.
subcarrier_spacing and cyclic_prefix set the resource grid of the STFT: one
bin per subcarrier, or per 6 or 12 subcarriers when average_rbs is 'half'
or True, and one hop of window per OFDM symbol. The symbols are split into
downlink and uplink by frame_slots, where None fills the frame with downlink
and an 's' slot requires special_symbols. With average_slots, the power
is averaged over each slot, which must span a whole number of hops, and
power_low, power_high, and power_resolution set the bin edges of the
histogram of the grid elements outside the guard_bandwidths.
window
instance-attribute
¶
window function specification following scipy.signal.get_window
subcarrier_spacing
instance-attribute
¶
Subcarrier spacing (15e3, 30e3, 60e3, etc) (Constraints: units: Hz)
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
guard_bandwidths
class-attribute
instance-attribute
¶
Bandwidths excluded at the (low, high) edges of the analysis band (Constraints: units: Hz)
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
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)
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)
ChannelPowerHistogram
¶
Bases: ChannelPowerTimeSeries
the keyword block of channel_power_histogram.
detector_period and power_detectors are those of channel_power_time_series,
and power_low, power_high, and power_resolution set the bin edges of the
histogram of those readings, with -inf and inf bins for the readings
outside that range.
power_resolution
instance-attribute
¶
Power bin resolution (Constraints: units: dB)
ChannelPowerTimeSeries
¶
Bases: Analysis
the keyword block of channel_power_time_series.
detector_period must be a whole number of samples at the capture sample_rate
and must divide the capture duration, and the output holds one trace of
readings on that period per entry of power_detectors.
CyclicChannelPower
¶
Bases: Analysis
the keyword block of cyclic_channel_power.
detector_period must be a whole number of samples at the capture sample_rate,
cyclic_period a whole number of detector periods, and the capture duration a
whole number of cycles. The output holds one trace of
cyclic_period / detector_period lags per entry of power_detectors and of
cyclic_statistics, and the trace length does not depend on the capture
duration.
cyclic_period
instance-attribute
¶
Cycle period of the channel power statistics, a whole multiple of detector_period and a common multiple of the expected signal periods (Constraints: units: s)
detector_period
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
cyclic_statistics
class-attribute
instance-attribute
¶
Statistics evaluated across cycles at each cycle lag: 'min', 'mean', 'max', 'median', or a quantile in (0, 1)
ErrorBound
¶
Bases: SpecBase
an error bound on the elements of one output.
rms bounds the error over all elements and peak the error at any one
element, both in the units of the Tolerance field.
FilteredCapture
¶
FrequencyAnalysisSpecBase
¶
Bases: Analysis
the STFT settings shared by the spectrum measurements.
The FFT size is the capture sample_rate divided by frequency_resolution,
and the quotient must be a whole number. fractional_overlap is the overlap of
consecutive windows and window_fill the nonzero part of each window, both as
fractions of that size. integration_bandwidth is the width of the adjacent
bins summed after the FFT, a multiple of frequency_resolution, or None for no
summing. trim_stopband True limits the frequency axis to the
analysis_bandwidth of the capture when that bandwidth is finite.
IQWaveform
¶
Bases: Analysis
the keyword block of iq_waveform.
The returned samples run from start_time_sec to stop_time_sec, in s from the
start of the capture and truncated to a whole sample at the capture
sample_rate; None selects the start or the end of the capture, and a bound
outside the capture is clamped to the capture.
PowerSpectralDensity
¶
Bases: FrequencyAnalysisSpecBase
the keyword block of power_spectral_density.
The STFT fields are those of FrequencyAnalysisSpecBase. power_spectral_density
reduces the spectrogram of those fields over time once per entry of
time_statistic, so the output holds one trace per entry. 'mean' is the
Welch estimate, and a float in [0, 1] a quantile.
SpecBase
¶
Bases: Struct
the base of every spec struct.
An instance is a frozen, keyword-only msgspec.Struct that rejects unknown
fields. Construction converts list and dict field values to tuple and
frozendict. An instance round-trips through to_dict and from_dict
unchanged.
replace
¶
returns a copy of self with changed attributes.
See also
Python standard library copy.replace
to_dict
¶
return the field values of self as a dict of builtin values.
Parameters:
-
unfreeze(bool, default:False) –True converts nested tuple and
frozendictvalues to list and dict -
allow_tuple_keys(bool, default:True) –False renders tuple dict keys as JSON array strings
Returns:
-
dict–a dict keyed by field name;
fractions.Fractionvalues are strings and -
dict–frozendictvalues are dicts
from_dict
classmethod
¶
return an instance of cls converted from the field values in d.
Parameters:
-
d(dict | frozendict) –field values keyed by name; a float for a
fractions.Fractionfield converts to the fraction of its decimal representation
Raises:
-
ValidationError–when a required field is missing, a key is not a field, or a value does not convert to the annotated type
validate
¶
return an equal instance rebuilt through to_dict and from_dict.
Raises:
-
ValidationError–when a field value does not satisfy the annotated type or constraints
Spectrogram
¶
Bases: FrequencyAnalysisSpecBase
time_aperture (float): if specified, binned RMS averaging is applied along time axis in the spectrogram to yield this coarser resolution (s)
SpectrogramHistogram
¶
Bases: Spectrogram
the keyword block of spectrogram_histogram.
The STFT fields are those of Spectrogram, including time_aperture.
power_low, power_high, and power_resolution set the bin edges of the
histogram over the spectrogram pixels, and the -inf and inf bins collect
the pixels outside that range.
power_resolution
instance-attribute
¶
Power bin resolution (Constraints: units: dB)
SpectrogramHistogramRatio
¶
Bases: SpectrogramHistogram
the keyword block of spectrogram_ratio_histogram.
The fields are those of SpectrogramHistogram, and power_low, power_high,
and power_resolution set the bin edges of the histogram of the pixel-by-pixel
ratio (in dB) of the spectrograms of the 2 ports, rather than of the pixel power.
Tolerance
¶
Bases: SpecBase
the roundoff error budget of one measurement output.
The budget depends on the capture and the spec alone, not on the output
values. Elements more than off_peak_dBc.peak below the peak are not bounded.
The peak is the matched-filter bin of the matched input, e.g., the FFT bin at
the frequency of a tone or the detector sample at the time of an impulse.
on_peak
instance-attribute
¶
absolute error bound, in units, on the elements at the peak of the output
off_peak_dBc
class-attribute
instance-attribute
¶
levels below the output peak, as negative values, at which the rms and the worst-case amplitude errors equal the amplitude of the element, or None to apply on_peak to every element (Constraints: units: dBc)
Meta
¶
Meta(
standard_name: str,
units: str | None = None,
*,
description: str | None = None,
**kws,
) -> Meta
return the field annotation that sets the standard_name and units attrs.
Parameters:
-
standard_name(str) –the
standard_nameattr of the field in xarray output -
units(str | None, default:None) –the
unitsattr; None writes no units attr -
description(str | None, default:None) –the text rendered in the schema reference; None selects
standard_name -
**kws–constraints forwarded to
msgspec.Meta(gt,ge, ...)