striqt.analysis¶
implementations of channel analysis measurements packaged into xarray.DataArray and xarray.Dataset
Evaluation and storage¶
Evaluation of measurement specs against IQ captures into xarray objects, the measurement registry, and zarr stores.
AcquiredIQ
dataclass
¶
AcquiredIQ(
x: Array,
capture: Capture | None,
power_units: PowerUnits,
)
an acquired IQ waveform with the parameters and power unit of the acquisition.
capture
instance-attribute
¶
capture: Capture | None
the acquisition parameters of x, or None when not known
power_units
instance-attribute
¶
the unit of the squared magnitude of x: 'mW' when calibrated, 'FS'
for full scale, 'a.u.' for arbitrary units
preprocess
¶
preprocess() -> Preprocessor
return the Preprocessor of this acquisition.
The Preprocessor is created on the first access and kept on the instance.
A copy from dataclasses.replace is a separate instance with a
Preprocessor of its own.
AnalysisRegistry
¶
Bases: dict[type[Analysis], AnalysisInfo]
a registry of keyword-only arguments for decorated functions
measurement
¶
measurement(
spec_type: type[Analysis],
*,
dtype: str,
standard_name: str,
long_name: str,
units: str | None = None,
dims: tuple[str, ...] | str | None = None,
coord_factories: Iterable[CoordFunc]
| CoordFunc
| None = None,
depends: Iterable[Callable] | Callable = (),
caches: Iterable[KwArgCache] | KwArgCache | None = None,
store_compressed: bool = True,
prefer_filtered: bool = True,
prefer_aligned: bool = True,
validate: AnalysisValidator | None = None,
tolerance: AnalysisTolerance | None = None,
) -> AnalysisFuncWrapper[P]
register the decorated function as the measurement configured by spec_type.
The returned decorator adds an entry to this registry. The decorated function
is called as func(x, capture, **spec.to_dict()) with x an array of
shape (port, sample). The function returns an array with a leading port axis
followed by dims, or an (array, attrs) tuple. The returned wrapper is
called as wrapper(iq, capture, as_xarray=True, **kwargs) with the fields
of spec_type as keywords. The __signature__ of the wrapper is filled from
spec_type. The docstring placeholders are filled at registration:
{args} from the fields of spec_type, {dtype} from dtype,
{dims} with the dimension names of the output (port first),
{coords} with one bullet per coord_factories entry, and {attrs}
with one bullet per registered attr other than standard_name and
long_name.
An array iq is passed to the function as x. From an AcquiredIQ, x is
the waveform that AcquiredIQ.preprocess selects for prefer_filtered and
prefer_aligned. validate runs before the IQ is read and raises
specs.helpers.SpecValidationError on a rejected combination. A units in
a power form (striqt.waveform.units.DB_POWER, POWER, or AMPLITUDE) is
resolved into the power_units of the acquisition when the output is built.
A literal unit such as the ratio 'dB' is stored as written. The fields of
the spec and the attrs returned by the function are added to the registered
attrs, and a key set in both takes the value from the function.
The wrapper returns, by as_xarray:
True: anxarray.DataArraywith a leadingportdimension'delayed': aDelayedDataArrayFalse: the(array, attrs)pair
Parameters:
-
spec_type(type[Analysis]) –the
specs.Analysissubclass with the keyword arguments of the measurement as fields, registered once -
dtype(str) –numpy dtype name of the output array
-
standard_name(str) –the short noun phrase that names the output on an axis, stored as the
standard_nameattr -
long_name(str) –the sentence-case title of the measurement for a plot or a menu, stored as the
long_nameattr -
units(str | None, default:None) –the units of the output values, stored as the
unitsattr, or None for a dimensionless output -
dims(tuple[str, ...] | str | None, default:None) –the dimension names of the output axes after
port, or None for the dimensions thatcoord_factoriesdeclare, in order -
coord_factories(Iterable[CoordFunc] | CoordFunc | None, default:None) –functions registered with
coordinatesthat produce the coordinate values alongdimsfrom(capture, spec) -
depends(Iterable[Callable] | Callable, default:()) –measurements with an intermediate that this measurement reuses, recorded on the
AnalysisInfoentry and not otherwise read -
caches(Iterable[KwArgCache] | KwArgCache | None, default:None) –the
KwArgCacheinstances thatcache_contextenables for one capture, shared with the other measurements that list the same cache -
store_compressed(bool, default:True) –False to store the output uncompressed in zarr
-
prefer_filtered(bool, default:True) –False to measure the waveform before the
analysis_bandwidthlow-pass, where one is applied -
prefer_aligned(bool, default:True) –False to measure the waveform before the signal-trigger shift, where one is applied. A
signal_triggermeasurement must set False -
validate(AnalysisValidator | None, default:None) –a function of
(capture, spec)that raises on a rejected combination without reading IQ, called with thespecs.AnalysisCaptureprojection of the capture -
tolerance(AnalysisTolerance | None, default:None) –a function of
(capture, spec, *, array_backend, input_error)that returns thespecs.Toleranceof the output without reading IQ
Returns:
-
AnalysisFuncWrapper[P]–a decorator that registers the decorated function and returns the wrapper
Raises:
-
ValueError–when
spec_typeis already registered -
TypeError–when a
coord_factoriesentry is not callable; from the returned decorator, when the function name is already registered or whencachescontains something other thanKwArgCacheinstances
validate
¶
validate(capture: Capture, analysis: AnalysisGroup) -> None
check each measurement in analysis against capture without IQ.
Measurements left unset in analysis, those with a spec type that has no
fields, and those registered without a validate= function are skipped.
Results are cached on the specs.AnalysisCapture projection of capture.
Captures equal in that projection share one entry.
Raises:
-
SpecValidationError–on the first invalid combination, with a field path rooted at
$.analysis
tolerances
¶
tolerances(
capture: Capture,
analysis: AnalysisGroup,
*,
array_backend: ArrayBackend = 'numpy',
input_error: float = 0.0,
) -> dict[str, Tolerance]
return the roundoff error budget of each measurement in analysis.
Results are cached on the specs.AnalysisCapture projection of capture.
Parameters:
-
array_backend(ArrayBackend, default:'numpy') –the array namespace of the measurement evaluation, which selects the roundoff model
-
input_error(float, default:0.0) –relative rms amplitude error already present in the IQ handed to the measurements, as a ratio
Returns:
EvaluationOptions
¶
Bases: Struct, Generic[TAR]
the result type and registry for one evaluation of an analysis group.
Raises:
-
TypeError–when
as_xarrayis notTrue,False, or'delayed'
as_xarray
instance-attribute
¶
the result type of analyze_by_spec: True for an xarray.Dataset,
'delayed' for DelayedDataArray results, or False for the bare arrays
in the array namespace of the input
registry
instance-attribute
¶
the registry that supplies the measurement function of each spec type
block_each
class-attribute
instance-attribute
¶
True copies each result to numpy as the measurement returns, False after
the last measurement. The field is read when as_xarray is True or
'delayed'.
expand_dims
class-attribute
instance-attribute
¶
the name of the leading dimension of each xarray.DataArray when
as_xarray is True. That dimension indexes the port axis of the input.
Preprocessor
¶
Preprocessor(iq: AcquiredIQ)
the conditioned-waveform selector of one acquisition.
A subclass that conditions the waveform overrides __call__.
iq
property
¶
iq: AcquiredIQ
the acquisition for which the preprocessor selects a waveform.
Raises:
-
RuntimeError–when the acquisition has been garbage collected
__call__
¶
return the waveform selected by prefer_filtered and prefer_aligned.
The base implementation returns x of the acquisition for every preference.
Parameters:
-
prefer_filtered(bool, default:True) –True prefers the waveform low-passed to the
analysis_bandwidthof the capture over the unfiltered waveform -
prefer_aligned(bool, default:True) –True prefers the waveform shifted by the signal trigger over the unaligned waveform
Returns:
-
Array–the shape (port, sample) array in the namespace of
x
Raises:
-
RuntimeError–when the acquisition has been garbage collected
Trigger
¶
Trigger(
name_or_func: str | Callable,
spec: Analysis,
registry: AnalysisRegistry,
)
a signal trigger bound to the measurement spec that locates the trigger event.
Construction requires the name or function of a trigger registered in registry
and an instance of the measurement spec type registered with it; from_spec
takes the spec from the matching field of an AnalysisGroup. An instance
evaluates the measurement and returns the sample index of the trigger event.
analyze_by_spec
¶
analyze_by_spec(
iq: Array | AcquiredIQ,
spec: AnalysisGroup,
capture: Capture,
options: EvaluationOptions[Literal[True]] | None = None,
) -> Dataset
analyze_by_spec(
iq: Array | AcquiredIQ,
spec: AnalysisGroup,
capture: Capture,
options: EvaluationOptions[Literal['delayed']],
) -> dict[str, DelayedDataArray]
analyze_by_spec(
iq: Array | AcquiredIQ,
spec: AnalysisGroup,
capture: Capture,
options: EvaluationOptions[Literal[False]],
) -> dict[str, Array]
analyze_by_spec(
iq: Array | AcquiredIQ,
spec: AnalysisGroup,
capture: Capture,
options: EvaluationOptions | None = None,
) -> (
Array
| dict[str, Array]
| Dataset
| dict[str, DelayedDataArray]
)
evaluate the enabled measurements of spec on the IQ waveform.
A measurement with a spec type that has no fields is skipped.
Parameters:
-
iq(Array | AcquiredIQ) –the waveform with shape (port, sample), or an
AcquiredIQfrom which each measurement selects the conditioned waveform -
spec(AnalysisGroup) –an
AnalysisGroupsuch asspecs.BuiltinAnalyses, with theNonefields skipped -
capture(Capture) –the acquisition parameters of
iq -
options(EvaluationOptions | None, default:None) –the result type and the registry, or
Nonefor the default registry withas_xarrayTrue
Returns:
-
Array | dict[str, Array] | Dataset | dict[str, DelayedDataArray]–by
options.as_xarray: -
Array | dict[str, Array] | Dataset | dict[str, DelayedDataArray]–True: anxarray.Datasetof the measurements, with thecapturefields as attrs andoptions.expand_dimsas the leading dimension
-
Array | dict[str, Array] | Dataset | dict[str, DelayedDataArray]–'delayed': a dict ofDelayedDataArraykeyed by measurement name
-
Array | dict[str, Array] | Dataset | dict[str, DelayedDataArray]–False: a dict of bare arrays keyed by measurement name, in the array namespace ofiq
Raises:
-
TypeError–when
specis not anAnalysisGroup -
KeyError–when the spec type of an enabled field is not in
options.registry -
SpecValidationError–when a measurement validator rejects the
(capture, spec)combination
dump
¶
dump(
store: ZarrStore,
data: DataArray | Dataset,
*,
append_dim: str = 'capture',
compression: bool = True,
zarr_format: ZarrFormat = 'auto',
compute: bool = True,
chunk_bytes: ChunksSize = 50000000,
max_threads: int | None = None,
**kwargs,
) -> ZarrStore
serialize a dataset into a zarr directory or zipfile
load
¶
load and return a dataset or data array.
Parameters:
-
path(str | Path) –location of the data store, potentially an fsspec string
-
chunks(ChunksSize, default:None) –None to load the file without dask, or 'auto' to return a dask array with automatically selected chunk sizes
-
kwargs–Additional arguments passed into
xr.open_dataset
Returns: The opened dataset object.
open_store
¶
return the zarr store at target.
mode applies to a .zip path: 'r' opens the archive read-only, 'w'
replaces the archive, and 'a' creates or extends the archive. A directory
path is opened read-write in every mode. A store passed as target is returned
unchanged. With a URL that contains simplecache, the fetched data is cached
under ~/.cache/fsspec, and the directory is created when absent.
Parameters:
-
target(str | Path) –a directory path, a path ending in
.zip, an fsspec URL, or an open store -
mode(Literal['r', 'w', 'a']) –the access mode of a
.zippath
Returns:
-
ZarrStore–a
ZipStorefor a.zippath, an fsspec mapper for a URL,targetfor -
ZarrStore–a store, and otherwise a directory store (
DirectoryStoreon zarr 2, -
ZarrStore–LocalStoreon zarr 3)
Raises:
-
ValueError–when
targetis not a string,Path, or store
Measurements¶
The registered measurements, each evaluated from an IQ capture into one xarray.DataArray.
cellular_5g_pss_correlation
¶
cellular_5g_pss_correlation(iq: Array | AcquiredIQ, capture: Capture, *, subcarrier_spacing: float, sample_rate: float = 7680000.0, discovery_periodicity: float = 0.02, frequency_offset: float = 0, shared_spectrum: bool = False, delay: float = 0, symbol_indexes: one of ['auto', 'a', 'b', 'c', 'd', 'e', 'f', 'g'] | tuple[int, ...] = 'auto', max_lag_symbols: int | None = None, max_block_count: int | None = 1, as_xarray: bool | Literal['delayed'] = True) -> Measurement
correlate each port of the IQ against the 5G NR primary synchronization signal.
The input is the IQ before the analysis_bandwidth filter and before trigger
alignment. The band at frequency_offset is shifted to baseband and resampled
to sample_rate. The result is cross-correlated with the PSS sequence of each
cell sector ID (3GPP TS 38.211 §7.4.2.2). The PSS template has unit energy over
the 127 PSS subcarriers. The squared magnitude of a peak on a lag sample equals
the received PSS symbol power. White noise with power spectral density N0 has a
mean squared magnitude of N0 * subcarrier_spacing in each lag.
Output
- Array dtype: complex64
- Dimensions:
port,cellular_cell_id2,cellular_ssb_start_time,cellular_ssb_beam_index,cellular_ssb_lag -
Coordinates:
-
cellular_cell_id2(uint16): sector part of the physical cell ID of each sync template, 0 through 2 cellular_ssb_start_time(float32, s): start time of each sync block in the capture, in steps ofdiscovery_periodicity, up tomax_block_countblockscellular_ssb_beam_index(uint16): index of each candidate sync block in the burst set, in the order ofsymbol_indexescellular_ssb_lag(float32, s): lag of each correlation sample from the start of the IQ, fromdelayin steps of one sample atsample_rate, spanningmax_lag_symbolsOFDM symbols or the SSB when None-
Attributes:
-
units: power units based on acquisition (√mW when calibrated) noise_bandwidth:subcarrier_spacing(in Hz)
References
3GPP TS 38.211, "NR; Physical channels and modulation," Table 7.4.3.1-1 and §7.4.2.2. https://www.3gpp.org/DynaReport/38211.htm
3GPP TS 38.213, "NR; Physical layer procedures for control," §4.1. https://www.3gpp.org/DynaReport/38213.htm
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
subcarrier_spacing(float) –Subcarrier spacing (15e3, 30e3, 60e3, etc) (Constraints: units: Hz)
-
sample_rate(float, default:7680000.0) – -
discovery_periodicity(float, default:0.02) – -
frequency_offset(float, default:0) – -
shared_spectrum(bool, default:False) – -
delay(float, default:0) – -
symbol_indexes(one of ['auto', 'a', 'b', 'c', 'd', 'e', 'f', 'g'] | tuple[int, ...], default:'auto') –index locations in the SSB, or a cell search case from 3GPP TS 38.213 Sec. 4.1)
-
max_lag_symbols(int | None, default:None) –limit the number of symbols of lag in the 5G sync correlator (Constraints: >= 1, <= 6)
-
max_block_count(int | None, default:1) –
cellular_5g_pss_sync
¶
cellular_5g_pss_sync(iq: Array | AcquiredIQ, capture: Capture, *, subcarrier_spacing: float, sample_rate: float = 7680000.0, discovery_periodicity: float = 0.02, frequency_offset: float = 0, shared_spectrum: bool = False, delay: float = 0, symbol_indexes: one of ['auto', 'a', 'b', 'c', 'd', 'e', 'f', 'g'] | tuple[int, ...] = 'auto', max_lag_symbols: int | None = None, window_fill: float = 1, per_port: bool = False, max_beams: int | None = None, as_xarray: bool | Literal['delayed'] = True) -> Measurement
return the start-of-waveform delay (in s) detected from the PSS correlation.
The input is the IQ before the analysis_bandwidth filter and before trigger
alignment. The value is the lag of the cellular_5g_pss_correlation peak plus
delay, rounded to a sample at sample_rate. One value is shared across the
ports when per_port is False. A source with signal_trigger set to this
measurement aligns the capture by the output.
Output
- Array dtype: float32
- Dimensions:
port -
Attributes:
-
units: s
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
subcarrier_spacing(float) –Subcarrier spacing (15e3, 30e3, 60e3, etc) (Constraints: units: Hz)
-
sample_rate(float, default:7680000.0) – -
discovery_periodicity(float, default:0.02) – -
frequency_offset(float, default:0) – -
shared_spectrum(bool, default:False) – -
delay(float, default:0) – -
symbol_indexes(one of ['auto', 'a', 'b', 'c', 'd', 'e', 'f', 'g'] | tuple[int, ...], default:'auto') –index locations in the SSB, or a cell search case from 3GPP TS 38.213 Sec. 4.1)
-
max_lag_symbols(int | None, default:None) –limit the number of symbols of lag in the 5G sync correlator (Constraints: >= 1, <= 6)
-
window_fill(float, default:1) –Fraction of a symbol to fill with weighting function (Constraints: > 0, <= 1)
-
per_port(bool, default:False) –whether to evaluate signal synchronization separately on each port
-
max_beams(int | None, default:None) –limit the beam count in 5G sync evaluation (Constraints: > 0)
cellular_5g_ssb_spectrogram
¶
cellular_5g_ssb_spectrogram(
iq: Array | AcquiredIQ,
capture: Capture,
*,
subcarrier_spacing: float,
sample_rate: float = 7680000.0,
discovery_periodicity: float = 0.02,
frequency_offset: float = 0,
max_block_count: int | None = None,
window: str | tuple[str, float] = 'blackmanharris',
lo_bandstop: float | None = None,
as_xarray: bool | Literal['delayed'] = True,
) -> Measurement
evaluate a spectrogram of each 5G NR SSB burst set by OFDM symbol and subcarrier.
The input is the IQ before the analysis_bandwidth filter and after trigger
alignment. The STFT hops once per OFDM symbol. Half-subcarrier bins are summed
pairwise to one bin per subcarrier of subcarrier_spacing. Only the symbols of
the burst set in the first 2 ms of each discovery_periodicity are kept (3GPP
TS 38.213 §4.1).
Output
- Array dtype: float16
- Dimensions:
port,cellular_ssb_index,cellular_ssb_symbol_index,cellular_ssb_baseband_frequency -
Coordinates:
-
cellular_ssb_index(uint16): index of each burst set in the capture, one perdiscovery_periodicity, up tomax_block_countburst sets cellular_ssb_symbol_index(uint16): index of each OFDM symbol in the first 2 ms of the burst set, atsubcarrier_spacingcellular_ssb_baseband_frequency(float64, Hz): baseband frequency of each subcarrier relative tofrequency_offset, in steps ofsubcarrier_spacingacross thesample_rateband-
Attributes:
-
units: power units based on acquisition (dBm when calibrated) noise_bandwidth:subcarrier_spacing(in Hz)resolution_bandwidth: equivalent noise bandwidth (in Hz) of the nonzero samples ofwindowlimit_digits: 3, the decimal places of the rounding
References
3GPP TS 38.213, "NR; Physical layer procedures for control," §4.1. https://www.3gpp.org/DynaReport/38213.htm
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
subcarrier_spacing(float) –Subcarrier spacing (15e3, 30e3, 60e3, etc) (Constraints: units: Hz)
-
sample_rate(float, default:7680000.0) – -
discovery_periodicity(float, default:0.02) – -
frequency_offset(float, default:0) – -
max_block_count(int | None, default:None) – -
window(str | tuple[str, float], default:'blackmanharris') –window function specification following
scipy.signal.get_window -
lo_bandstop(float | None, default:None) –mask with float("nan") at this bandwidth centered at baseband DC (Constraints: units: Hz)
cellular_5g_sss_correlation
¶
cellular_5g_sss_correlation(iq: Array | AcquiredIQ, capture: Capture, *, subcarrier_spacing: float, sample_rate: float = 7680000.0, discovery_periodicity: float = 0.02, frequency_offset: float = 0, shared_spectrum: bool = False, delay: float = 0, symbol_indexes: one of ['auto', 'a', 'b', 'c', 'd', 'e', 'f', 'g'] | tuple[int, ...] = 'auto', max_lag_symbols: int | None = None, max_block_count: int | None = 1, as_xarray: bool | Literal['delayed'] = True) -> Measurement
correlate each port of the IQ against the 5G NR secondary synchronization signal.
The input is the IQ before the analysis_bandwidth filter and before trigger
alignment. The band at frequency_offset is shifted to baseband and resampled
to sample_rate. The result is cross-correlated with the SSS sequences (3GPP TS
38.211 §7.4.2.3). The SSS template has unit energy over the 127 SSS subcarriers.
The squared magnitude of a peak on a lag sample equals the received SSS symbol
power. White noise with power spectral density N0 has a mean squared magnitude
of N0 * subcarrier_spacing in each lag.
Output
- Array dtype: complex64
- Dimensions:
port,cellular_cell_id2,cellular_ssb_start_time,cellular_ssb_beam_index,cellular_ssb_lag -
Coordinates:
-
cellular_cell_id2(uint16): sector part of the physical cell ID of each sync template, 0 through 2 cellular_ssb_start_time(float32, s): start time of each sync block in the capture, in steps ofdiscovery_periodicity, up tomax_block_countblockscellular_ssb_beam_index(uint16): index of each candidate sync block in the burst set, in the order ofsymbol_indexescellular_ssb_lag(float32, s): lag of each correlation sample from the start of the IQ, fromdelayin steps of one sample atsample_rate, spanningmax_lag_symbolsOFDM symbols or the SSB when None-
Attributes:
-
units: power units based on acquisition (√mW when calibrated) noise_bandwidth:subcarrier_spacing(in Hz)
References
3GPP TS 38.211, "NR; Physical channels and modulation," Table 7.4.3.1-1 and §7.4.2.3. https://www.3gpp.org/DynaReport/38211.htm
3GPP TS 38.213, "NR; Physical layer procedures for control," §4.1. https://www.3gpp.org/DynaReport/38213.htm
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
subcarrier_spacing(float) –Subcarrier spacing (15e3, 30e3, 60e3, etc) (Constraints: units: Hz)
-
sample_rate(float, default:7680000.0) – -
discovery_periodicity(float, default:0.02) – -
frequency_offset(float, default:0) – -
shared_spectrum(bool, default:False) – -
delay(float, default:0) – -
symbol_indexes(one of ['auto', 'a', 'b', 'c', 'd', 'e', 'f', 'g'] | tuple[int, ...], default:'auto') –index locations in the SSB, or a cell search case from 3GPP TS 38.213 Sec. 4.1)
-
max_lag_symbols(int | None, default:None) –limit the number of symbols of lag in the 5G sync correlator (Constraints: >= 1, <= 6)
-
max_block_count(int | None, default:1) –
cellular_cyclic_autocorrelation
¶
cellular_cyclic_autocorrelation(iq: Array | AcquiredIQ, capture: Capture, *, subcarrier_spacings: float | tuple[float, ...] = (15000.0, 30000.0, 60000.0), frame_range: int | tuple[int, int] = (0, 1), frame_slots: str | None = None, symbol_range: int | tuple[int, int | None] = (0, None), generation: one of ['4G', '5G'] = '5G', as_xarray: bool | Literal['delayed'] = True) -> Measurement
evaluate the cyclic-prefix autocorrelation of the IQ at each 4G or 5G symbol lag.
The input is the IQ after the analysis_bandwidth filter and before trigger
alignment. For each spacing in subcarrier_spacings, the IQ is correlated with
a copy of the IQ delayed by one OFDM symbol. The products are summed over the
cyclic-prefix samples of the symbols selected by frame_range and
symbol_range. The downlink slots and the uplink slots of frame_slots are
summed separately. The output is the correlation magnitude. Entries past the
symbol length of a spacing are nan. The 'uplink' row is nan when
frame_slots has no uplink slot. frame_range and symbol_range are a count
of indexes from 0, or a (start, stop) pair as for the Python builtin
range.
Output
- Array dtype: float32
- Dimensions:
port,link_direction,subcarrier_spacing,cyclic_sample_lag -
Coordinates:
-
link_direction(str): TDD link direction of the summed slots,'downlink'then'uplink' subcarrier_spacing(float32, Hz): subcarrier spacing of each numerology, in the order ofsubcarrier_spacingscyclic_sample_lag(float32, s): lag of each autocorrelation sample, in steps of one sample at the capturesample_rate, spanning one OFDM symbol with cyclic prefix at the smallest ofsubcarrier_spacings-
Attributes:
-
units: power units based on acquisition (mW when calibrated) frames: the value offrame_rangesymbols: the value ofsymbol_range
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
subcarrier_spacings(float | tuple[float, ...], default:(15000.0, 30000.0, 60000.0)) –One or more subcarrier spacings (15e3, 30e3, 60e3, etc) (Constraints: units: Hz)
-
frame_range(int | tuple[int, int], default:(0, 1)) – -
frame_slots(str | None, default:None) –string composed of ('d', 'u', 's') specifying the sequence of slots in 1 TDD cellular frame, or None to fill with downlink
-
symbol_range(int | tuple[int, int | None], default:(0, None)) – -
generation(one of ['4G', '5G'], default:'5G') –
cellular_resource_power_histogram
¶
cellular_resource_power_histogram(iq: Array | AcquiredIQ, capture: Capture, *, window: str | tuple[str, float], subcarrier_spacing: float, power_low: float, power_high: float, power_resolution: float, average_rbs: bool | one of ['half'] = False, average_slots: bool = False, guard_bandwidths: tuple[float, float] = (0, 0), frame_slots: str | None = None, special_symbols: str | None = None, cyclic_prefix: one of ['normal', 'extended'] = 'normal', lo_bandstop: float | None = None, as_xarray: bool | Literal['delayed'] = True) -> Measurement
evaluate the fraction of resource grid elements in each power bin per link.
The input is the IQ before the analysis_bandwidth filter and after trigger
alignment. The spectrogram has one bin per subcarrier, or per resource block
with average_rbs, and one hop per OFDM symbol. frame_slots and
special_symbols split the symbols into downlink and uplink. With
average_slots, the power is averaged over each slot. The fractions of both
link directions together sum to 1 on each port. Subcarriers inside the
guard_bandwidths and flexible symbols are excluded from the count.
Output
- Array dtype: float32
- Dimensions:
port,link_direction,cellular_resource_power_bin -
Coordinates:
-
link_direction(str): TDD link direction of the summed slots,'downlink'then'uplink' cellular_resource_power_bin(float32, dBm when calibrated): center of each power bin, frompower_lowtopower_highin steps ofpower_resolution, with-infandinfcatch-all bins at each end-
Attributes:
-
noise_bandwidth:subcarrier_spacing(in Hz), times 6 whenaverage_rbsis'half'and times 12 when True resolution_bandwidth: equivalent noise bandwidth (in Hz) of the nonzero samples ofwindowlimit_digits: None; the fractions are not rounded
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
window(str | tuple[str, float]) –window function specification following
scipy.signal.get_window -
subcarrier_spacing(float) –Subcarrier spacing (15e3, 30e3, 60e3, etc) (Constraints: units: Hz)
-
power_low(float) –Minimum power bin (Constraints: units: dB power)
-
power_high(float) –Maximum power bin (Constraints: units: dB power)
-
power_resolution(float) –Power bin resolution (Constraints: units: dB)
-
average_rbs(bool | one of ['half'], default:False) –frequency resolution of the spectrogram: False for 1 subcarrier, True for 1 resource block (12 subcarriers), or 'half' for 6 subcarriers
-
average_slots(bool, default:False) –True to coarsen spectrogram bins by averaging 1-symbol time resolution
-
guard_bandwidths(tuple[float, float], default:(0, 0)) –Bandwidths excluded at the (low, high) edges of the analysis band (Constraints: units: Hz)
-
frame_slots(str | None, default:None) –string composed of ('d', 'u', 's') specifying the sequence of slots in 1 TDD cellular frame, or None to fill with downlink
-
special_symbols(str | None, default:None) –string composed of the characters ('d', 'u', 'f') indicating the sequence of symbol types (when 's' is in frame_slots)
-
cyclic_prefix(one of ['normal', 'extended'], default:'normal') –cyclic prefix length of the 3GPP numerology (TS 38.211 Table 4.2-1)
-
lo_bandstop(float | None, default:None) –mask with float("nan") at this bandwidth centered at baseband DC (Constraints: units: Hz)
channel_power_histogram
¶
channel_power_histogram(
iq: Array | AcquiredIQ,
capture: Capture,
*,
detector_period: Fraction,
power_detectors: tuple[str, ...] = ('rms', 'peak'),
power_low: float,
power_high: float,
power_resolution: float,
as_xarray: bool | Literal['delayed'] = True,
) -> Measurement
evaluate the fraction of channel power readings that fall in each power bin.
The input is the IQ after the analysis_bandwidth filter and trigger alignment.
The readings are those of channel_power_time_series with the same detector
fields. The values sum to 1 over the bins of each detector. The -inf and
inf bins collect the readings more than half a bin below power_low or
above power_high. The noise bandwidth of the readings is the
analysis_bandwidth of the capture, or sample_rate where analysis_bandwidth
is infinite.
Output
- Array dtype: float32
- Dimensions:
port,power_detector,channel_power_bin -
Coordinates:
-
power_detector(object): power detector of each trace, in the order ofpower_detectors channel_power_bin(float32, dBm when calibrated): center of each power bin, frompower_lowtopower_highin steps ofpower_resolution, with-infandinfcatch-all bins at each end
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
detector_period(Fraction) –Power detector bin duration, a whole multiple of the sample period (Constraints: units: s)
-
power_detectors(tuple[str, ...], default:('rms', 'peak')) –Power detectors evaluated in each bin: 'rms', 'peak', or both
-
power_low(float) –Minimum power bin (Constraints: units: dB power)
-
power_high(float) –Maximum power bin (Constraints: units: dB power)
-
power_resolution(float) –Power bin resolution (Constraints: units: dB)
channel_power_time_series
¶
channel_power_time_series(
iq: Array | AcquiredIQ,
capture: Capture,
*,
detector_period: Fraction,
power_detectors: tuple[str, ...] = ('rms', 'peak'),
as_xarray: bool | Literal['delayed'] = True,
) -> Measurement
evaluate a time series of binned channel power for each power detector.
The input is the IQ after the analysis_bandwidth filter and trigger alignment.
Each detector reduces the instantaneous power |iq|**2 over consecutive blocks
of detector_period: 'rms' is the mean and 'peak' the maximum. The
capture duration must be a whole number of detector periods. detector_period
must be a whole number of samples at sample_rate. The noise bandwidth of the
values is the analysis_bandwidth of the capture, or sample_rate where
analysis_bandwidth is infinite.
Output
- Array dtype: float32
- Dimensions:
port,power_detector,time_elapsed -
Coordinates:
-
power_detector(object): power detector of each trace, in the order ofpower_detectors time_elapsed(float32, s): time from the start of the capture, in steps ofdetector_period-
Attributes:
-
units: power units based on acquisition (dBm when calibrated)
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
detector_period(Fraction) –Power detector bin duration, a whole multiple of the sample period (Constraints: units: s)
-
power_detectors(tuple[str, ...], default:('rms', 'peak')) –Power detectors evaluated in each bin: 'rms', 'peak', or both
cyclic_channel_power
¶
cyclic_channel_power(
iq: Array | AcquiredIQ,
capture: Capture,
*,
cyclic_period: float,
detector_period: Fraction,
power_detectors: tuple[str, ...] = ('rms', 'peak'),
cyclic_statistics: tuple[str | float, ...] = (
'min',
'mean',
'max',
),
as_xarray: bool | Literal['delayed'] = True,
) -> Measurement
evaluate cyclic statistics of channel power across the cycles in a capture.
The input is the IQ after the analysis_bandwidth filter and trigger alignment.
Each power detector bins the capture on detector_period. The binned series is
folded into cycles of cyclic_period. Each cyclic statistic reduces across the
cycles (Kuester et al.). cyclic_period and detector_period alone set the
trace length, independent of the capture duration.
A signal with a period that divides cyclic_period resolves at fixed lags with
little spread between the 'min' and 'max' statistics. A cyclic_period
of 10 ms covers TDD cellular frames, 5 ms covers WiMAX frames, and 1 ms covers
the CBRS test bin 1 pulse repetition interval. The uplink and downlink
levels of a TDD network then occupy disjoint lag windows. Occupancy with an
incommensurate period smears across all lags.
Statistics are evaluated in linear power and converted to dB afterward. The
capture duration must be a whole number of cycles. cyclic_period must be a
whole number of detector periods. detector_period must be a whole number of
samples at sample_rate. A detector_period written as a fraction stays
exact, e.g., 1/28000 s for one OFDM symbol at 30 kHz subcarrier spacing.
The noise bandwidth of the values is the analysis_bandwidth of the capture, or
sample_rate where analysis_bandwidth is infinite.
Output
- Array dtype: float32
- Dimensions:
port,power_detector,cyclic_statistic,cyclic_lag -
Coordinates:
-
power_detector(object): power detector of each trace, in the order ofpower_detectors cyclic_statistic(object): statistic of each trace, in the order ofcyclic_statisticscyclic_lag(float32, s): time from the start of each cycle, in steps ofdetector_periodover onecyclic_period-
Attributes:
-
units: power units based on acquisition (dBm when calibrated)
References
D. G. Kuester et al., "Cyclic Analysis of Power in Radio Channels."
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
cyclic_period(float) –Cycle period of the channel power statistics, a whole multiple of
detector_periodand a common multiple of the expected signal periods (Constraints: units: s) -
detector_period(Fraction) –Power detector bin duration, a whole multiple of the sample period (Constraints: units: s)
-
power_detectors(tuple[str, ...], default:('rms', 'peak')) –Power detectors evaluated in each bin: 'rms', 'peak', or both
-
cyclic_statistics(tuple[str | float, ...], default:('min', 'mean', 'max')) –Statistics evaluated across cycles at each cycle lag: 'min', 'mean', 'max', 'median', or a quantile in (0, 1)
iq_waveform
¶
iq_waveform(
iq: Array | AcquiredIQ,
capture: Capture,
*,
start_time_sec: float | None = None,
stop_time_sec: float | None = None,
as_xarray: bool | Literal['delayed'] = True,
) -> Measurement
return the IQ samples between start_time_sec and stop_time_sec.
The input is the IQ after the analysis_bandwidth filter and trigger alignment.
The squared magnitude |iq|**2 is power in the power unit of the acquisition.
A None time bound selects the start or the end of the capture. A bound outside
the capture is clamped to the capture. The noise bandwidth of the values is the
analysis_bandwidth of the capture, or sample_rate where analysis_bandwidth
is infinite.
Output
- Array dtype: complex64
- Dimensions:
port,iq_index -
Coordinates:
-
iq_index(uint64): index of each sample in the capture, fromstart_time_sectostop_time_secatsample_rate -
Attributes:
-
units: power units based on acquisition (√mW when calibrated)
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
start_time_sec(float | None, default:None) – -
stop_time_sec(float | None, default:None) –
power_spectral_density
¶
power_spectral_density(
iq: Array | AcquiredIQ,
capture: Capture,
*,
window: str | tuple[str, float],
frequency_resolution: float,
fractional_overlap: Fraction = 0,
window_fill: Fraction = 1,
integration_bandwidth: float | None = None,
trim_stopband: bool = True,
lo_bandstop: float | None = None,
time_statistic: tuple[str | float, ...] = ('mean',),
as_xarray: bool | Literal['delayed'] = True,
) -> Measurement
estimate the power spectral density from time statistics of the spectrogram.
The input is the IQ before the analysis_bandwidth filter and after trigger
alignment. Each time_statistic reduces the unrounded linear-power
spectrogram output over the STFT windows at each frequency bin. 'mean' is
the Welch estimate (Welch, 1967). A float in [0, 1] is a quantile.
Output
- Array dtype: float32
- Dimensions:
port,time_statistic,baseband_frequency -
Coordinates:
-
time_statistic(str): name of each statistic, in the order oftime_statistic baseband_frequency(float64, Hz): baseband frequency of each bin, in steps offrequency_resolutionabout DC or ofintegration_bandwidthwhen set, truncated to a finiteanalysis_bandwidthwhentrim_stopbandis set-
Attributes:
-
units: power units based on acquisition (dBm when calibrated) noise_bandwidth: the bandwidth (in Hz) that the values are referred to:frequency_resolution, orintegration_bandwidthwhen set; the output minus10 * log10(noise_bandwidth)is the density per Hzresolution_bandwidth: the equivalent noise bandwidth (in Hz) of the nonzero samples ofwindow
References
P. D. Welch, "The use of fast Fourier transform for the estimation of power spectra: A method based on time averaging over short, modified periodograms," IEEE Trans. Audio Electroacoust., vol. 15, no. 2, pp. 70-73, 1967. doi:10.1109/TAU.1967.1161901
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
window(str | tuple[str, float]) –window function specification following
scipy.signal.get_window -
frequency_resolution(float) – -
fractional_overlap(Fraction, default:0) – -
window_fill(Fraction, default:1) – -
integration_bandwidth(float | None, default:None) – -
trim_stopband(bool, default:True) – -
lo_bandstop(float | None, default:None) –mask with float("nan") at this bandwidth centered at baseband DC (Constraints: units: Hz)
-
time_statistic(tuple[str | float, ...], default:('mean',)) –
spectrogram
¶
spectrogram(
iq: Array | AcquiredIQ,
capture: Capture,
*,
window: str | tuple[str, float],
frequency_resolution: float,
fractional_overlap: Fraction = 0,
window_fill: Fraction = 1,
integration_bandwidth: float | None = None,
trim_stopband: bool = True,
lo_bandstop: float | None = None,
time_aperture: float | None = None,
as_xarray: bool | Literal['delayed'] = True,
) -> Measurement
evaluate a power spectrogram of the IQ by STFT.
The input is the IQ before the analysis_bandwidth filter and after trigger
alignment. Each value is the power in one frequency bin of one STFT window.
White noise with power spectral density N0 has a mean of N0 times the noise
bandwidth in every bin for every window.
Output
- Array dtype: float16
- Dimensions:
port,spectrogram_time,spectrogram_baseband_frequency -
Coordinates:
-
spectrogram_time(float32, s): start time of each STFT window from the start of the capture, in steps of the hop set byfrequency_resolutionandfractional_overlap, or oftime_aperturewhen set spectrogram_baseband_frequency(float64, Hz): baseband frequency of each bin, in steps offrequency_resolutionabout DC or ofintegration_bandwidthwhen set, truncated to a finiteanalysis_bandwidthwhentrim_stopbandis set-
Attributes:
-
units: power units based on acquisition (dBm when calibrated) noise_bandwidth: the bandwidth (in Hz) that the values are referred to:frequency_resolution, orintegration_bandwidthwhen setresolution_bandwidth: the equivalent noise bandwidth (in Hz) of the nonzero samples ofwindow; a CW tone hasfrequency_resolution / resolution_bandwidthof the tone power in one binlimit_digits: 2, the decimal places of the rounding
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
window(str | tuple[str, float]) –window function specification following
scipy.signal.get_window -
frequency_resolution(float) – -
fractional_overlap(Fraction, default:0) – -
window_fill(Fraction, default:1) – -
integration_bandwidth(float | None, default:None) – -
trim_stopband(bool, default:True) – -
lo_bandstop(float | None, default:None) –mask with float("nan") at this bandwidth centered at baseband DC (Constraints: units: Hz)
-
time_aperture(float | None, default:None) –
spectrogram_histogram
¶
spectrogram_histogram(
iq: Array | AcquiredIQ,
capture: Capture,
*,
window: str | tuple[str, float],
frequency_resolution: float,
fractional_overlap: Fraction = 0,
window_fill: Fraction = 1,
integration_bandwidth: float | None = None,
trim_stopband: bool = True,
lo_bandstop: float | None = None,
time_aperture: float | None = None,
power_low: float,
power_high: float,
power_resolution: float,
as_xarray: bool | Literal['delayed'] = True,
) -> Measurement
evaluate the fraction of spectrogram pixels that fall in each power bin.
The input is the IQ before the analysis_bandwidth filter and after trigger
alignment. The pixels are the unrounded dB spectrogram of the same STFT fields
as spectrogram, flattened over time and frequency. Values sum to 1 per port.
The -inf and inf entries collect the pixels more than half a bin below
power_low or above power_high.
Output
- Array dtype: float32
- Dimensions:
port,spectrogram_power_bin -
Coordinates:
-
spectrogram_power_bin(float32, dBm when calibrated): center of each power bin, frompower_lowtopower_highin steps ofpower_resolution, with-infandinfcatch-all bins at each end -
Attributes:
-
noise_bandwidth: the noise bandwidth (in Hz) of the spectrogram pixels,frequency_resolutionorintegration_bandwidthwhen set resolution_bandwidth: the equivalent noise bandwidth (in Hz) of the nonzero samples ofwindowlimit_digits: None; the pixels are not rounded
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
window(str | tuple[str, float]) –window function specification following
scipy.signal.get_window -
frequency_resolution(float) – -
fractional_overlap(Fraction, default:0) – -
window_fill(Fraction, default:1) – -
integration_bandwidth(float | None, default:None) – -
trim_stopband(bool, default:True) – -
lo_bandstop(float | None, default:None) –mask with float("nan") at this bandwidth centered at baseband DC (Constraints: units: Hz)
-
time_aperture(float | None, default:None) – -
power_low(float) –Minimum power bin (Constraints: units: dB power)
-
power_high(float) –Maximum power bin (Constraints: units: dB power)
-
power_resolution(float) –Power bin resolution (Constraints: units: dB)
spectrogram_ratio_histogram
¶
spectrogram_ratio_histogram(
iq: Array | AcquiredIQ,
capture: Capture,
*,
window: str | tuple[str, float],
frequency_resolution: float,
fractional_overlap: Fraction = 0,
window_fill: Fraction = 1,
integration_bandwidth: float | None = None,
trim_stopband: bool = True,
lo_bandstop: float | None = None,
time_aperture: float | None = None,
power_low: float,
power_high: float,
power_resolution: float,
as_xarray: bool | Literal['delayed'] = True,
) -> Measurement
evaluate a histogram of the spectrogram power ratio between 2 ports.
The input is the IQ before the analysis_bandwidth filter and after trigger
alignment. The spectrograms are the unrounded dB spectrograms of the same STFT
fields as spectrogram. The ratio is the pixel-by-pixel difference of the 2
spectrograms in dB. The first output port is the ratio of the first input port
to the second. The second output port is the negative of the first. Values sum
to 1 per port. The -inf and inf entries collect the ratios more than half
a bin below power_low or above power_high.
Output
- Array dtype: float32
- Dimensions:
port,spectrogram_ratio_power_bin -
Coordinates:
-
spectrogram_ratio_power_bin(float32, dB): center of each power-ratio bin, frompower_lowtopower_highin steps ofpower_resolution, with-infandinfcatch-all bins at each end -
Attributes:
-
limit_digits: None; the pixels are not rounded
Raises:
-
ValueError–if the capture has a port count other than 2
Parameters:
-
iq(Array or AcquiredIQ) –the IQ waveform with shape (port, sample), or an
AcquiredIQfrom which the conditioned waveform is selected -
capture(Capture) –the acquisition parameters of
iq -
as_xarray(bool or delayed, default:True) –True for an
xarray.DataArray, False for an(array, attrs)tuple, or'delayed'for aDelayedDataArray -
window(str | tuple[str, float]) –window function specification following
scipy.signal.get_window -
frequency_resolution(float) – -
fractional_overlap(Fraction, default:0) – -
window_fill(Fraction, default:1) – -
integration_bandwidth(float | None, default:None) – -
trim_stopband(bool, default:True) – -
lo_bandstop(float | None, default:None) –mask with float("nan") at this bandwidth centered at baseband DC (Constraints: units: Hz)
-
time_aperture(float | None, default:None) – -
power_low(float) –Minimum power bin (Constraints: units: dB power)
-
power_high(float) –Maximum power bin (Constraints: units: dB power)
-
power_resolution(float) –Power bin resolution (Constraints: units: dB)