Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sigmf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# SPDX-License-Identifier: LGPL-3.0-or-later

# version of this python module
__version__ = "1.9.0"
__version__ = "1.9.1"
# matching version of the SigMF specification
__specification__ = "1.2.6"

Expand Down
3 changes: 3 additions & 0 deletions sigmf/siggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,9 @@ def create_full_signal_annotation(label: str) -> dict:
phase_annotation = create_full_signal_annotation(f"phase offset {phase_deg:+.1f}°")
annotations.append(phase_annotation)

# sort annotations by sample_start to satisfy sigmf ordering requirement
annotations.sort(key=lambda a: a[SigMFFile.START_INDEX_KEY])

return annotations

def _build_metadata(self, samples: np.ndarray) -> dict:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_siggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ def test_phase_offset(self):
signal_0 = SigMFGenerator(seed=42).tone().generate()
signal_1 = SigMFGenerator(seed=42).tone().phase_offset(phase_offset).generate()

# find where the actual signal starts by looking at annotations
start_idx_0 = signal_0.get_annotations()[0][SigMFFile.START_INDEX_KEY]
start_idx_1 = signal_1.get_annotations()[0][SigMFFile.START_INDEX_KEY]
# tone annotations are last after sorting (full-signal annotations start at 0)
start_idx_0 = signal_0.get_annotations()[-1][SigMFFile.START_INDEX_KEY]
start_idx_1 = signal_1.get_annotations()[-1][SigMFFile.START_INDEX_KEY]

# both should start at the same sample index (same seed)
self.assertEqual(start_idx_0, start_idx_1)
Expand Down
Loading