-
Notifications
You must be signed in to change notification settings - Fork 29
Feature/key simplification #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5b1992d
f13847e
c0147fc
8d40ee0
0d31967
aae5529
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,32 @@ Verify SigMF Integrity & Compliance | |
| Save a Numpy array as a SigMF Recording | ||
| --------------------------------------- | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| import numpy as np | ||
| import sigmf | ||
|
|
||
| # suppose we have a complex timeseries signal | ||
| data = np.zeros(1024, dtype=np.complex64) | ||
|
|
||
| # write to disk — datatype is inferred from the numpy array | ||
| meta = sigmf.tofile("example", data, sample_rate=48000, frequency=915e6) | ||
|
|
||
| # or write to a SigMF archive (example.sigmf) | ||
| meta = sigmf.tofile("example.sigmf", data, sample_rate=48000, frequency=915e6) | ||
|
|
||
| # or write directly to a compressed archive (example.sigmf.xz) | ||
| meta = sigmf.tofile("example", data, sample_rate=48000, compression="xz") | ||
|
|
||
| The returned ``SigMFFile`` object can be used to add captures, annotations, | ||
| or archive the recording. | ||
|
|
||
| --------------------------------------------------- | ||
| Save a Numpy array with Full Metadata (Advanced) | ||
| --------------------------------------------------- | ||
|
|
||
| For full control over global fields, captures, and annotations: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| import numpy as np | ||
|
|
@@ -76,8 +102,8 @@ Save a Numpy array as a SigMF Recording | |
|
|
||
| # add an annotation at sample 100 with length 200 & 10 KHz width | ||
| meta.add_annotation(100, 200, metadata = { | ||
| SigMFFile.FLO_KEY: 914995000.0, | ||
| SigMFFile.FHI_KEY: 915005000.0, | ||
| SigMFFile.FREQ_LOWER_EDGE_KEY: 914995000.0, | ||
| SigMFFile.FREQ_UPPER_EDGE_KEY: 915005000.0, | ||
| SigMFFile.COMMENT_KEY: "example annotation", | ||
|
Comment on lines
+105
to
107
|
||
| }) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The examples use
SigMFFile.SAMPLE_START_KEY/SigMFFile.SAMPLE_COUNT_KEY. Since class-level key access now emitsDeprecationWarning, the docs should use module-level constants (e.g.,sigmf.SAMPLE_START_KEY,sigmf.SAMPLE_COUNT_KEY) so copied code doesn’t start warning immediately.