Skip to content

Compression Support & New sigmf.tofile method#146

Open
Teque5 wants to merge 3 commits intomainfrom
feature/compressed-support
Open

Compression Support & New sigmf.tofile method#146
Teque5 wants to merge 3 commits intomainfrom
feature/compressed-support

Conversation

@Teque5
Copy link
Copy Markdown
Collaborator

@Teque5 Teque5 commented Apr 25, 2026

Closes #26. Adds read/write support for compressed SigMF archives (.sigmf.gz, .sigmf.xz, .sigmf.zip) using only stdlib so no new dependencies are needed. Compression uses tarfile for gzip/xz and zipfile for zip.

Also fixed performance issue where reading uncompressed .sigmf archives was extracting data to RAM — these are now numpy memmapped directly into the tar.

Also added a sigmf.tofile() convenience function to mirror sigmf.fromfile(). It infers the SigMF datatype from the numpy dtype and handles compression and archive creation via kwargs:

data = np.array([<SOME_STUFF>], dtype=<SOME_DTYPE>)
sigmf.tofile("recording", data, sample_rate=48000)                       # loose .sigmf-data + .sigmf-meta
sigmf.tofile("recording", data, sample_rate=48000, toarchive=True)       # .sigmf archive
sigmf.tofile("recording.sigmf.xz", data, sample_rate=48000)              # compressed archive

@Teque5 Teque5 self-assigned this Apr 25, 2026
@Teque5 Teque5 added the enhancement New feature or request label Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compressed Archive Support

1 participant