zfp-oss tools #18

Merged
benchinnery merged 5 commits from zfp-oss into main 2026-04-01 13:52:10 -04:00
Owner

Fix: signal processing bugs, broken imports, and data handling errors

Fixes a set of correctness bugs found during code review across the transforms, datatypes, I/O, and SDR modules.

Signal/transform fixes

  • generate_awgn: corrected SNR math (/ snr_linear → / sqrt(snr_linear)) and replaced magnitude/phase noise generation with proper independent Gaussian I+Q components for true complex AWGN
  • time_shift(shift=0): was producing all-zeros due to data[:, :-0] evaluating to empty slice; now correctly returns data unchanged
  • resample: downsampled result was returned un-padded because empty_array was never assigned back to resampled_iqdata
  • quantize_tape, quantize_parts, cut_out, time_shift: replaced raise UserWarning(...) with warnings.warn(...) so invalid arguments warn-and-continue rather than crash; added fallback to default value in each case
  • Removed stray print(f"noise is {noise}") debug statement from add_awgn_to_signal

Broken imports

  • Recording.to_wav() and Recording.to_blue(): fixed from utils.io.recording import ... → from ria_toolkit_oss.io.recording import ... (both methods were crashing at call time)
  • FrequencyUpConversion: same utils. → ria_toolkit_oss. package rename fix

Recording / datatypes fixes

  • update_metadata: added missing return after add_to_metadata call, preventing a double-write and potential inconsistent state if _is_jsonable raised after the key was already inserted
  • trim: annotations entirely outside the trim window were kept with negative sample_count; now filtered out before adjusting and re-indexing survivors
  • normalize: silently returned all-NaN data on all-zero recordings; now raises ValueError
  • IQDataset.split_examples: raise Warning(...) → warnings.warn(...)

I/O fix

  • from_sigmf: SIGMF_KEY_CONVERSION lookup was done on the stripped base key (e.g. "hw") rather than the full SigMF key (e.g. "core:hw"), so mappings like hw→sdr, recorder→source_software, and meta_doi→metadata were silently skipped

SDR base class

  • tx_recording: tx_time * self.tx_sample_rate was stored as float; cast to int to match the RX path and prevent indexing issues
  • SDR.init: removed duplicate self._accumulated_buffer = None assignment
  • copy_file (h5helpers): wrapped original_file in a with statement to prevent handle leak on exception
  • overwrite_file (h5helpers): removed redundant f.close() inside with block
Fix: signal processing bugs, broken imports, and data handling errors Fixes a set of correctness bugs found during code review across the transforms, datatypes, I/O, and SDR modules. **Signal/transform fixes** - generate_awgn: corrected SNR math (/ snr_linear → / sqrt(snr_linear)) and replaced magnitude/phase noise generation with proper independent Gaussian I+Q components for true complex AWGN - time_shift(shift=0): was producing all-zeros due to data[:, :-0] evaluating to empty slice; now correctly returns data unchanged - resample: downsampled result was returned un-padded because empty_array was never assigned back to resampled_iqdata - quantize_tape, quantize_parts, cut_out, time_shift: replaced raise UserWarning(...) with warnings.warn(...) so invalid arguments warn-and-continue rather than crash; added fallback to default value in each case - Removed stray print(f"noise is {noise}") debug statement from add_awgn_to_signal **Broken imports** - Recording.to_wav() and Recording.to_blue(): fixed from utils.io.recording import ... → from ria_toolkit_oss.io.recording import ... (both methods were crashing at call time) - FrequencyUpConversion: same utils. → ria_toolkit_oss. package rename fix **Recording / datatypes fixes** - update_metadata: added missing return after add_to_metadata call, preventing a double-write and potential inconsistent state if _is_jsonable raised after the key was already inserted - trim: annotations entirely outside the trim window were kept with negative sample_count; now filtered out before adjusting and re-indexing survivors - normalize: silently returned all-NaN data on all-zero recordings; now raises ValueError - IQDataset.split_examples: raise Warning(...) → warnings.warn(...) **I/O fix** - from_sigmf: SIGMF_KEY_CONVERSION lookup was done on the stripped base key (e.g. "hw") rather than the full SigMF key (e.g. "core:hw"), so mappings like hw→sdr, recorder→source_software, and meta_doi→metadata were silently skipped **SDR base class** - tx_recording: tx_time * self.tx_sample_rate was stored as float; cast to int to match the RX path and prevent indexing issues - SDR.__init__: removed duplicate self._accumulated_buffer = None assignment - copy_file (h5helpers): wrapped original_file in a with statement to prevent handle leak on exception - overwrite_file (h5helpers): removed redundant f.close() inside with block
benchinnery added 3 commits 2026-03-31 13:58:03 -04:00
zfp functionality and servers
Some checks failed
Build Sphinx Docs Set / Build Docs (pull_request) Failing after 1s
Build Project / Build Project (3.10) (pull_request) Successful in 57s
Build Project / Build Project (3.11) (pull_request) Successful in 1m7s
Build Project / Build Project (3.12) (pull_request) Successful in 56s
Test with tox / Test with tox (3.12) (pull_request) Failing after 5m13s
Test with tox / Test with tox (3.11) (pull_request) Failing after 5m48s
Test with tox / Test with tox (3.10) (pull_request) Failing after 8m46s
9a960e2f29
benchinnery added 1 commit 2026-04-01 11:58:03 -04:00
optimiztions and fixes
Some checks failed
Build Sphinx Docs Set / Build Docs (pull_request) Successful in 16s
Test with tox / Test with tox (3.10) (pull_request) Failing after 17m6s
Build Project / Build Project (3.10) (pull_request) Successful in 17m26s
Build Project / Build Project (3.11) (pull_request) Successful in 17m25s
Build Project / Build Project (3.12) (pull_request) Successful in 17m27s
Test with tox / Test with tox (3.12) (pull_request) Successful in 17m21s
Test with tox / Test with tox (3.11) (pull_request) Failing after 21m50s
c36fdcf607
benchinnery added 1 commit 2026-04-01 12:28:45 -04:00
reformats
Some checks failed
Build Sphinx Docs Set / Build Docs (pull_request) Successful in 16s
Test with tox / Test with tox (3.11) (pull_request) Successful in 3m56s
Test with tox / Test with tox (3.12) (pull_request) Successful in 7m51s
Build Project / Build Project (3.12) (pull_request) Successful in 12m32s
Build Project / Build Project (3.11) (pull_request) Successful in 13m9s
Build Project / Build Project (3.10) (pull_request) Successful in 13m14s
Test with tox / Test with tox (3.10) (pull_request) Failing after 13m13s
f67c995846
benchinnery requested review from gillian 2026-04-01 12:46:21 -04:00
G gillian approved these changes 2026-04-01 13:45:12 -04:00
benchinnery merged commit 44df45160e into main 2026-04-01 13:52:10 -04:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: qoherent/ria-toolkit-oss#18
No description provided.