sigmf.archive.SigMFArchive
- class sigmf.archive.SigMFArchive(sigmffile, name=None, fileobj=None, compression=None, overwrite=False)
Bases:
objectArchive a SigMFFile into a tar or zip file, optionally with compression.
- Parameters:
sigmffile (SigMFFile) – A SigMFFile object with valid metadata and data_file.
name (PathLike | str | bytes) –
Path to archive file to create. If name doesn’t end in a recognized sigmf archive extension, .sigmf will be appended. Recognized extensions: .sigmf, .sigmf.gz, .sigmf.xz, .sigmf.zip For example: if name == “/tmp/archive1”, then the following archive will be created:
/tmp/archive1.sigmf - archive1/
archive1.sigmf-meta
archive1.sigmf-data
fileobj (BufferedWriter) –
If fileobj is specified, it is used as an alternative to a file object opened in binary mode for name. It is supposed to be at position 0. name is not required, but if specified will be used to determine the directory and file names within the archive. fileobj won’t be closed. For example: if name == “archive1” and fileobj is given, a tar archive will be written to fileobj with the following structure:
- archive1/
archive1.sigmf-meta
archive1.sigmf-data
compression (str, optional) – Compression type: “gz”, “xz”, “zip”, or None (default). If None and name has a recognized compressed extension, compression is auto-detected from the extension.
overwrite (bool, default False) – If False, raise exception if archive file already exists.
- Raises:
SigMFFileError – If sigmffile has no data_file set, or if name is not writable, or if an invalid compression type is given.
Methods
permission filter for writing tar files
Attributes
VALID_COMPRESSIONS