sigmf.sigmffile.SigMFCollection
- class sigmf.sigmffile.SigMFCollection(metafiles: list = None, metadata: dict = None, base_path=None, skip_checksums: bool = False)
Bases:
SigMFMetafileMethods
Write metadata to a file.
Get a string representation of the metadata.
Returns the SigMFFile instance of the specified stream if it exists
Return a field from the collection info, or default if the field is not set.
Returns a dictionary with all the collection info.
Returns a list of name object(s) from the collection level core:streams metadata.
Get a nicer representation of _metadata.
Inserts a value into the collection field.
Overwrite the collection info with a new dictionary.
Configures the collection core:streams field from the specified list of metafiles.
Write metadata file
Compares the stream hashes in the collection metadata to the metadata files.
Attributes
AUTHOR_KEYCOLLECTION_DOI_KEYCOLLECTION_KEYDESCRIPTION_KEYEXTENSIONS_KEYLICENSE_KEYSTREAMS_KEYVALID_COLLECTION_KEYSVALID_KEYSVERSION_KEY- dump(filep, pretty=True)
Write metadata to a file.
- dumps(pretty=True)
Get a string representation of the metadata.
- Parameters:
pretty (bool, default True) – When True will write more human-readable output, otherwise will be flat JSON.
- Returns:
String representation of the metadata using json formatter.
- Return type:
string
- get_SigMFFile(stream_name=None, stream_index=None)
Returns the SigMFFile instance of the specified stream if it exists
- get_collection_field(key: str, default=None)
Return a field from the collection info, or default if the field is not set.
- get_stream_names() list
Returns a list of name object(s) from the collection level core:streams metadata.
- ordered_metadata()
Get a nicer representation of _metadata. Will sort keys, but put the top-level fields ‘global’, ‘captures’, ‘annotations’ in front.
- Returns:
ordered_meta – Cleaner representation of _metadata with top-level keys correctly ordered and the rest of the keys sorted.
- Return type:
OrderedDict
- set_collection_info(new_collection: dict) None
Overwrite the collection info with a new dictionary.
- set_streams(metafiles) None
Configures the collection core:streams field from the specified list of metafiles.
- verify_stream_hashes() None
Compares the stream hashes in the collection metadata to the metadata files.
- Raises:
SigMFFileError – If any dataset checksums do not match saved metadata.