IQCapture#
- class IQCapture(
- samples: ndarray,
- sample_period_ns: float,
- channels: tuple[str, ...],
- center_freq_hz: tuple[float, ...],
- t0_ns: int | None = None,
- dropped_samples: int = 0,
Bases:
objectOne time-aligned block of IQ samples across one or more channels of a signal path.
Every row shares one timebase, so a multi-channel capture is aligned by construction.
- Variables:
samples (numpy.ndarray) – Complex IQ samples shaped
(n_channels, n_samples). Always two-dimensional, even for a single channel.sample_period_ns (float) – Time between samples, in nanoseconds, shared by every row.
channels (tuple[str, ...]) – Channel each row of
samplescame from.center_freq_hz (tuple[float, ...]) – Frequency each channel was tuned to, in Hz.
t0_ns (int | None) – Hardware timestamp of the first sample, in nanoseconds since the Unix epoch.
Nonewhen the device has no clock of its own, in which caseInstroSDRanchors the block to the host clock.dropped_samples (int) – Samples lost before this block because the stream could not keep up.
- Raises:
ValueError – If
samplesis not two-dimensional, or its row count does not matchchannelsandcenter_freq_hz.
Example
capture = IQCapture( samples=np.zeros((1, 4096), dtype=np.complex128), sample_period_ns=1e9 / 2.4e6, channels=("0",), center_freq_hz=(100e6,), ) row = capture.samples_for("0")
- samples: ndarray#
- property overflow: bool#
Whether any samples were dropped before this block.
- Returns:
bool –
Truewhendropped_samplesis greater than zero.
- samples_for(channel: str) ndarray[source]#
Return the row of samples belonging to one channel.
- Parameters:
channel (str) – Channel to read.
- Returns:
numpy.ndarray – The channel’s complex IQ samples, one-dimensional.
- Raises:
ValueError – If the capture holds no such channel.
- center_freq_for(channel: str) float[source]#
Return the frequency a channel was tuned to when these samples were taken.
- Parameters:
channel (str) – Channel to read.
- Returns:
float – Center frequency in Hz.
- Raises:
ValueError – If the capture holds no such channel.
- select( ) IQCapture[source]#
Narrow this capture to a subset of its channels, keeping the shared timebase.
- Parameters:
channels (Sequence[str]) – Channels to keep, in the order the rows should appear.
- Returns:
IQCapture – A capture holding only
channels, or this capture unchanged if they already match.- Raises:
ValueError – If any of
channelsis not in the capture.