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 >
4
2
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
7
5
under the terms GNU Lesser GPL v3 License.
8
6
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.
13
9
14
10
# Installation
15
11
16
- To install the latest released version of the SigMF package , install it from pip:
12
+ To install the latest release , install from pip:
17
13
18
14
``` bash
19
15
pip install sigmf
20
16
```
21
17
22
- To install the latest development version, build the package from source:
18
+ To install the latest development version, build from source:
23
19
24
20
``` bash
25
21
git clone https://github.com/sigmf/sigmf-python.git
@@ -29,8 +25,10 @@ pip install .
29
25
30
26
To run the included QA tests:
31
27
``` 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
34
32
```
35
33
36
34
# Examples
@@ -180,45 +178,40 @@ cf32_sigmffile = collection.get_SigMFFile(stream_name='example_cf32')
180
178
181
179
Since an * archive* is merely a tarball (uncompressed), and since there any many
182
180
excellent 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
186
184
be impractical (due to available disk space, or slow network speeds if the
187
185
archive file resides on a network file share) or simply obnoxious to untar it
188
186
first.
189
187
190
188
``` 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 ]
203
196
array([- 20 .+ 11.j , - 21 . - 6.j , - 17 .- 20.j , - 13 .- 52.j , 0 .- 75.j , 22 .- 58.j ,
204
197
48 .- 44.j , 49 .- 60.j , 31 .- 56.j , 23 .- 47.j ], dtype = complex64)
205
198
```
206
199
207
200
The preceeding example exhibits another feature of this approach; the archive
208
201
` 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.
212
205
213
206
``` 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'
216
209
217
- In [ 7 ]: arc.sigmffile._memmap.dtype
218
- Out[ 7 ]: dtype(' int16' )
210
+ >> > arc.sigmffile._memmap.dtype
211
+ dtype(' int16' )
219
212
220
- In [ 8 ]: arc.sigmffile._return_type
221
- Out[ 8 ]: ' <c8'
213
+ >> > arc.sigmffile._return_type
214
+ ' <c8'
222
215
```
223
216
224
217
Another 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
227
220
read it, this can be done "in mid air" or "without touching the ground (disk)".
228
221
229
222
``` 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 ]
238
227
array([- 20 .+ 11.j , - 21 . - 6.j , - 17 .- 20.j , - 13 .- 52.j , 0 .- 75.j , 22 .- 58.j ,
239
228
48 .- 44.j , 49 .- 60.j , 31 .- 56.j , 23 .- 47.j ], dtype = complex64)
240
229
```
@@ -243,8 +232,8 @@ array([-20.+11.j, -21. -6.j, -17.-20.j, -13.-52.j, 0.-75.j, 22.-58.j,
243
232
244
233
### Is this a GNU Radio effort?
245
234
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
248
237
developers, but the goal of the project to provide a standard that will be
249
238
useful to anyone and everyone, regardless of tool or workflow.
250
239
0 commit comments