PCT datatypes¶
C M
pynasonde.vipir.riq.datatypes.pct — Ionogram, PctType dataclasses and to_mantissa_exponant helper.
Dataclasses modeling VIPIR PCT-format data blocks.
pynasonde.vipir.riq.datatypes.pct
¶
PCT (pulse capture table) datatypes and binary readers for VIPIR/RIQ.
This module defines small dataclasses used to hold per-PRI (PCT)
information as well as helper routines to decode packed IQ formats
found in VIPIR binary dumps. The reader method on :class:PctType
consumes binary data from a file-like object and populates the
structure according to the VIPIR configuration and the SCT (station)
type information.
Ionogram
dataclass
¶
Container for decoded ionogram arrays.
Attributes:
| Name | Type | Description |
|---|---|---|
pulse_i |
numpy.ndarray In-phase samples (shape: gates x receivers). |
|
pulse_q |
numpy.ndarray Quadrature samples (shape: gates x receivers). |
|
power |
numpy.ndarray Linear power values per gate/receiver. |
|
powerdB |
numpy.ndarray Power in dB / SNR per gate/receiver. |
|
phase |
numpy.ndarray Phase for each gate/receiver. |
|
frequency |
numpy.ndarray Frequencies for each pulse set. |
|
height |
numpy.ndarray Heights for each range gate. |
PctType
dataclass
¶
Representation of a single PCT (per-PRI) record.
Attributes:
| Name | Type | Description |
|---|---|---|
record_id |
numpy.int32 Sequence number of this PCT. |
|
pri_ut |
numpy.float64 Universal Time of this pulse. |
|
pri_time_offset |
numpy.float64 Local time offset read from the system clock (not precise). |
|
base_id |
numpy.int32 Base frequency counter value. |
|
pulse_id, |
ramp_id, repeat_id, loop_id
|
numpy.int32 Indices describing the pulse/ramp/repeat/loop position of this PRI. |
frequency |
numpy.float64 Observation frequency (kHz). |
|
nco_tune_word |
numpy.int32 Hardware tuning word. |
|
drive_attenuation |
numpy.float64 Drive attenuation in dB. |
|
proc_range_count |
numpy.int32 Number of range gates processed for this PRI. |
|
proc_noise_level |
numpy.float64 Estimated noise level for this PRI. |
|
user |
str Spare text field (user-defined, fixed-width in file). |
fix_PCT_strings()
¶
Normalize fixed-width string fields by trimming nulls.
The VIPIR binary stores ASCII fields in fixed-width slots which may include trailing null characters; this helper trims those trailing nulls into Python strings.
read_pct_from_file_pointer(fp, sct, vipir_config, unicode='latin-1')
¶
Read PCT data from a binary file pointer into this object.
The method reads header fields according to PCT_default_factory
using :func:read_dtype, then consumes the IQ payload for the
PRI and decodes it according to vipir_config.data_type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fp |
file-like Open binary file-like object positioned at the start of the PCT payload. |
required | |
sct |
SctType Station configuration describing receiver counts and gate counts. |
required | |
vipir_config |
types.SimpleNamespace
VIPIR configuration object with fields like |
required | |
unicode |
str, optional Encoding used when reading textual fields (default 'latin-1'). |
'latin-1'
|
Returns:
| Type | Description |
|---|---|
Returns |
dump_pct(t32=1.86264514923096e-05, to_file=None)
¶
Format the PCT record into a human-readable text block.
Parameters t32 : numpy.float64, optional Scale factor used for printing tuned words (present for diagnostic purposes). to_file : str or None, optional If provided, write the text to the given filename. Otherwise the formatted text is emitted to the logger at INFO level.
to_mantissa_exponant(iq, masks=(-16, 15))
¶
Convert a packed mantissa/exponent IQ value into a float.
VIPIR binary sometimes encodes floating values as a packed mantissa/exponent in a single integer. This helper extracts the mantissa and exponent bits using bitmasks and reconstructs the floating value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iq |
float Packed IQ integer value read from the binary stream. |
required | |
masks |
tuple, optional
Tuple of integer masks used to extract mantissa and exponent
bits (default |
(-16, 15)
|
Returns:
| Type | Description |
|---|---|
float
|
Decoded floating-point value. |