RIQ reader¶
C M
pynasonde.vipir.riq.parsers.read_riq — Pulset, RiqDataset classes plus filter/threshold functions.
pynasonde.vipir.riq.parsers.read_riq
¶
Helpers and data structures for reading VIPIR RIQ (raw IQ) files.
The routines in this module provide the core logic used to decode raw VIPIR records into the higher-level pulse and ionogram representations consumed by the rest of the pipeline. They also supply utility filters that can be reused when post-processing ionograms for visualization.
Pulset
dataclass
¶
Container grouping PCT records that share a pulse definition.
Attributes:
| Name | Type | Description |
|---|---|---|
pcts |
List[PctType]
|
Mutable list of |
Source code in pynasonde/vipir/riq/parsers/read_riq.py
RiqDataset
dataclass
¶
Aggregate view of an RIQ capture (SCT tables, pulses, ionograms).
Attributes:
| Name | Type | Description |
|---|---|---|
fname |
str
|
Source filename for the dataset. |
sct |
SctType
|
System configuration structure populated from the file. |
pcts |
List[PctType]
|
Flat list of all PCT entries parsed from the capture. |
pulset |
List[List]
|
Sequence of grouped pulse sets honoring tune conditions. |
swap_frequency |
float
|
Active swap frequency used when |
swap_pulset |
List
|
Collected pulses that match the swap frequency. |
unicode |
str
|
Encoding used for textual fields. |
Source code in pynasonde/vipir/riq/parsers/read_riq.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | |
create_from_file(fname, unicode='latin-1', vipir_config=VIPIR_VERSION_MAP.configs[0])
classmethod
¶
Create a dataset by parsing the given RIQ file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fname |
str
|
Path to the RIQ capture. |
required |
unicode |
Encoding used when reading text fields. |
'latin-1'
|
|
vipir_config |
SimpleNamespace
|
Version-specific mapping loaded from TOML metadata. |
VIPIR_VERSION_MAP.configs[0]
|
Returns:
| Name | Type | Description |
|---|---|---|
RiqDataset | Parsed dataset including SCT and pulse information. |
Source code in pynasonde/vipir/riq/parsers/read_riq.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
get_ionogram(threshold=None, remove_baseline_noise=False, bins=100, prominence=100, **kwargs)
¶
Convert decoded pulses into an averaged ionogram.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold |
float
|
Optional lower bound applied to the resulting power (dB). |
None
|
remove_baseline_noise |
bool
|
Whether to subtract the median baseline. |
False
|
bins |
int
|
Histogram bins for automatic thresholding. |
100
|
prominence |
float
|
Prominence value used by |
100
|
**kwargs |
Extra options forwarded to |
{}
|
Returns:
| Type | Description |
|---|---|
Ionogram
|
Ionogram constructed from the dataset's pulse data. |
Source code in pynasonde/vipir/riq/parsers/read_riq.py
find_thresholds(data, bins=100, prominence=100, **kwargs)
¶
Estimate power thresholds by locating valleys in the histogram.
The signal is sanitized (NaNs, infs removed), histogrammed, and the prominence of the negated counts is inspected. The first dip is returned as a reasonable power threshold for separating noise from echoes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data |
np.ndarray
|
Power (dB) samples to analyze. |
required |
bins |
int
|
Number of histogram bins. |
100
|
prominence |
float
|
|
100
|
**kwargs |
Forwarded to both |
{}
|
Returns:
| Type | Description |
|---|---|
Tuple of ( |
|
bin edges surrounding each detected dip and |
|
first element (often used as the working threshold). |
Source code in pynasonde/vipir/riq/parsers/read_riq.py
remove_morphological_noise(ion, threshold=0.0, morf_type=cv2.MORPH_RECT, iterations=1, kernel_size=(1, 3), parameter='powerdB')
¶
Morphologically clean low-amplitude noise from an ionogram slice.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ion |
Ionogram
|
Ionogram in-place modified. |
required |
threshold |
float
|
Minimum value retained in the output. |
0.0
|
morf_type |
Structuring element shape passed to OpenCV. |
cv2.MORPH_RECT
|
|
iterations |
int
|
Number of open/close passes. |
1
|
kernel_size |
tuple
|
Structuring element dimensions. |
(1, 3)
|
parameter |
str
|
Ionogram attribute to process (defaults to |
'powerdB'
|
Returns:
| Type | Description |
|---|---|
The provided ionogram instance with its |
Source code in pynasonde/vipir/riq/parsers/read_riq.py
adaptive_gain_filter(ion, snr_threshold=0.0, generic_filter_size=3, mode='constant', cval=0.0, apply_median_filter=False, median_filter_size=3, parameter='powerdB', **kwargs)
¶
Apply SNR-adaptive gain and optional median filtering to an ionogram.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ion |
Ionogram
|
Ionogram updated in-place. |
required |
snr_threshold |
float
|
Values at or below this level are suppressed. |
0.0
|
generic_filter_size |
int
|
Window size provided to |
3
|
mode |
str
|
Padding mode (see |
'constant'
|
cval |
float
|
Constant padding value when |
0.0
|
apply_median_filter |
bool
|
Whether to follow with a median filter. |
False
|
median_filter_size |
int
|
Median filter window size. |
3
|
parameter |
str
|
Ionogram attribute to process. |
'powerdB'
|
**kwargs |
Additional arguments forwarded to SciPy filters. |
{}
|
Returns:
| Type | Description |
|---|---|
The supplied ionogram with its |