1- <p align =" center " >
2- <img src =" https://github.com/gnuradio/SigMF/blob/sigmf-v1.x/logo/sigmf_logo.png " width =" 30% " />
3- </p >
1+ <p align =" center " ><img src =" https://github.com/gnuradio/SigMF/blob/sigmf-v1.x/logo/sigmf_logo.png " width =" 30% " /></p >
42
5- This repository contains a python module for interacting with SigMF Objects.
6- This module works with Python 3.6 and higher. This module is distributed freely
3+ This python module makes it easy to interact with Signal Metadata Format
4+ (SigMF) objects. This module works with Python 3.6+ and is distributed freely
75under the terms GNU Lesser GPL v3 License.
86
9- # Signal Metadata Format (SigMF)
10-
11- The [ SigMF specification document] ( https://github.com/sigmf/SigMF/blob/HEAD/sigmf-spec.md ) , ` sigmf-spec.md ` is located in the
12- https://github.com/gnuradio/SigMF repository.
7+ The [ SigMF specification document] ( https://github.com/sigmf/SigMF/blob/HEAD/sigmf-spec.md )
8+ is located in the [ SigMF] ( https://github.com/gnuradio/SigMF ) repository.
139
1410# Installation
1511
16- To install the latest released version of the SigMF package , install it from pip:
12+ To install the latest release , install from pip:
1713
1814``` bash
1915pip install sigmf
2016```
2117
22- To install the latest development version, build the package from source:
18+ To install the latest development version, build from source:
2319
2420``` bash
2521git clone https://github.com/sigmf/sigmf-python.git
@@ -29,8 +25,10 @@ pip install .
2925
3026To run the included QA tests:
3127``` bash
32- cd test/
33- python3 -m pytest
28+ # basic
29+ python3 -m pytest tests/
30+ # fancy
31+ coverage run --a --source sigmf -m pytest --doctest-modules
3432```
3533
3634# Examples
@@ -180,45 +178,40 @@ cf32_sigmffile = collection.get_SigMFFile(stream_name='example_cf32')
180178
181179Since an * archive* is merely a tarball (uncompressed), and since there any many
182180excellent tools for manipulating tar files, it's fairly straightforward to
183- access the * data* part of a SigMF archive without untaring it.
184- This is a compelling feature because 1) archives make it harder for the ` -data `
185- and the ` -meta ` to get separated, and 2) some datasets are so large that it can
181+ access the * data* part of a SigMF archive without un-taring it. This is a
182+ compelling feature because __ 1 __ archives make it harder for the ` -data ` and
183+ the ` -meta ` to get separated, and __ 2 __ some datasets are so large that it can
186184be impractical (due to available disk space, or slow network speeds if the
187185archive file resides on a network file share) or simply obnoxious to untar it
188186first.
189187
190188``` python
191- In [1 ]: import sigmf
192-
193- In [2 ]: arc = sigmf.SigMFArchiveReader(' /src/LTE.sigmf' )
194-
195- In [3 ]: arc.shape
196- Out[3 ]: (15379532 ,)
197-
198- In [4 ]: arc.ndim
199- Out[4 ]: 1
200-
201- In [5 ]: arc[:10 ]
202- Out[5 ]:
189+ >> > import sigmf
190+ >> > arc = sigmf.SigMFArchiveReader(' /src/LTE.sigmf' )
191+ >> > arc.shape
192+ (15379532 ,)
193+ >> > arc.ndim
194+ 1
195+ >> > arc[:10 ]
203196array([- 20 .+ 11.j , - 21 . - 6.j , - 17 .- 20.j , - 13 .- 52.j , 0 .- 75.j , 22 .- 58.j ,
204197 48 .- 44.j , 49 .- 60.j , 31 .- 56.j , 23 .- 47.j ], dtype = complex64)
205198```
206199
207200The preceeding example exhibits another feature of this approach; the archive
208201` LTE.sigmf ` is actually ` complex-int16 ` 's on disk, for which there is no
209- corresponding type in ` numpy ` .
210- However, the ` .sigmffile ` member keeps track of this, and converts the data
211- to ` numpy.complex64 ` * after * slicing it, that is, after reading it from disk.
202+ corresponding type in ` numpy ` . However, the ` .sigmffile ` member keeps track of
203+ this, and converts the data to ` numpy.complex64 ` * after * slicing it, that is,
204+ after reading it from disk.
212205
213206``` python
214- In [ 6 ]: arc.sigmffile.get_global_field(sigmf.SigMFFile.DATATYPE_KEY )
215- Out[ 6 ]: ' ci16_le'
207+ >> > arc.sigmffile.get_global_field(sigmf.SigMFFile.DATATYPE_KEY )
208+ ' ci16_le'
216209
217- In [ 7 ]: arc.sigmffile._memmap.dtype
218- Out[ 7 ]: dtype(' int16' )
210+ >> > arc.sigmffile._memmap.dtype
211+ dtype(' int16' )
219212
220- In [ 8 ]: arc.sigmffile._return_type
221- Out[ 8 ]: ' <c8'
213+ >> > arc.sigmffile._return_type
214+ ' <c8'
222215```
223216
224217Another supported mode is the case where you might have an archive that * is not
@@ -227,14 +220,10 @@ Instead of needing to write this out to a temporary file before being able to
227220read it, this can be done "in mid air" or "without touching the ground (disk)".
228221
229222``` python
230- In [1 ]: import sigmf, io
231-
232- In [2 ]: sigmf_bytes = io.BytesIO(open (' /src/LTE.sigmf' , ' rb' ).read())
233-
234- In [3 ]: arc = sigmf.SigMFArchiveReader(archive_buffer = sigmf_bytes)
235-
236- In [4 ]: arc[:10 ]
237- Out[4 ]:
223+ >> > import sigmf, io
224+ >> > sigmf_bytes = io.BytesIO(open (' /src/LTE.sigmf' , ' rb' ).read())
225+ >> > arc = sigmf.SigMFArchiveReader(archive_buffer = sigmf_bytes)
226+ >> > arc[:10 ]
238227array([- 20 .+ 11.j , - 21 . - 6.j , - 17 .- 20.j , - 13 .- 52.j , 0 .- 75.j , 22 .- 58.j ,
239228 48 .- 44.j , 49 .- 60.j , 31 .- 56.j , 23 .- 47.j ], dtype = complex64)
240229```
@@ -243,8 +232,8 @@ array([-20.+11.j, -21. -6.j, -17.-20.j, -13.-52.j, 0.-75.j, 22.-58.j,
243232
244233### Is this a GNU Radio effort?
245234
246- * No* , this is not a GNU Radio-specific effort. It is hosted under the GNU Radio
247- Github account because this effort first emerged from a group of GNU Radio core
235+ * No* , this is not a GNU Radio-specific effort.
236+ This effort first emerged from a group of GNU Radio core
248237developers, but the goal of the project to provide a standard that will be
249238useful to anyone and everyone, regardless of tool or workflow.
250239
0 commit comments