Skip to content

Commit

Permalink
Always set core:version to 1.0.0 (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
argilo authored Oct 6, 2023
1 parent c5aa8f3 commit 406eed7
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ meta = SigMFFile(
SigMFFile.SAMPLE_RATE_KEY: 48000,
SigMFFile.AUTHOR_KEY: '[email protected]',
SigMFFile.DESCRIPTION_KEY: 'All zero complex float32 example file.',
SigMFFile.VERSION_KEY: sigmf.__version__,
}
)

Expand Down Expand Up @@ -151,7 +150,6 @@ meta_ci16 = SigMFFile(
SigMFFile.DATATYPE_KEY: 'ci16_le', # get_data_type_str() is only valid for numpy types
SigMFFile.SAMPLE_RATE_KEY: 48000,
SigMFFile.DESCRIPTION_KEY: 'All zero complex int16 file.',
SigMFFile.VERSION_KEY: sigmf.__version__,
}
)
meta_ci16.add_capture(0, metadata=meta.get_capture_info(0))
Expand All @@ -161,7 +159,6 @@ collection = SigMFCollection(['example_cf32.sigmf-meta', 'example_ci16.sigmf-met
metadata = {'collection': {
SigMFCollection.AUTHOR_KEY: '[email protected]',
SigMFCollection.DESCRIPTION_KEY: 'Collection of two all zero files.',
SigMFCollection.VERSION_KEY: sigmf.__version__,
}
}
)
Expand Down
6 changes: 4 additions & 2 deletions sigmf/sigmffile.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def __init__(self, metadata=None, data_file=None, global_info=None, skip_checksu
if metadata is None:
self._metadata = {self.GLOBAL_KEY:{}, self.CAPTURE_KEY:[], self.ANNOTATION_KEY:[]}
self._metadata[self.GLOBAL_KEY][self.NUM_CHANNELS_KEY] = 1
self._metadata[self.GLOBAL_KEY][self.VERSION_KEY] = __version__
elif isinstance(metadata, dict):
self._metadata = metadata
else:
Expand All @@ -184,6 +183,8 @@ def __init__(self, metadata=None, data_file=None, global_info=None, skip_checksu
if data_file is not None:
self.set_data_file(data_file, skip_checksum=skip_checksum, map_readonly=map_readonly)

self._metadata[self.GLOBAL_KEY][self.VERSION_KEY] = '1.0.0'

def __len__(self):
return self._memmap.shape[0]

Expand Down Expand Up @@ -675,7 +676,6 @@ def __init__(self, metafiles=None, metadata=None, skip_checksums=False):

if metadata is None:
self._metadata = {self.COLLECTION_KEY:{}}
self._metadata[self.COLLECTION_KEY][self.VERSION_KEY] = __version__
self._metadata[self.COLLECTION_KEY][self.STREAMS_KEY] = []
else:
self._metadata = metadata
Expand All @@ -688,6 +688,8 @@ def __init__(self, metafiles=None, metadata=None, skip_checksums=False):
if not self.skip_checksums:
self.verify_stream_hashes()

self._metadata[self.COLLECTION_KEY][self.VERSION_KEY] = '1.0.0'

def __len__(self):
'''
the length of a collection is the number of streams
Expand Down
1 change: 0 additions & 1 deletion sigmf/tools/wav2sigmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def writeSigMFArchiveFromWave(input_wav_filename, archive_filename=None, start_d
SigMFFile.DATATYPE_KEY: get_data_type_str(wav_data),
SigMFFile.SAMPLE_RATE_KEY: samplerate,
SigMFFile.DESCRIPTION_KEY: 'Converted from ' + input_wav_filename + '.',
SigMFFile.VERSION_KEY: sigmf.__version__,
SigMFFile.NUM_CHANNELS_KEY: 1 if len(wav_data.shape) < 2 else wav_data.shape[1],
SigMFFile.RECORDER_KEY: os.path.basename(__file__),
}
Expand Down
1 change: 0 additions & 1 deletion tests/test_archivereader.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def test_access_data_without_untar(self):
global_info={
SigMFFile.DATATYPE_KEY: f"{complex_prefix}{key}_le",
SigMFFile.NUM_CHANNELS_KEY: num_channels,
SigMFFile.VERSION_KEY: sigmf.__version__,
},
)
temp_meta.tofile(temp_archive, toarchive=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/testdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
SigMFFile.DATATYPE_KEY: 'rf32_le',
SigMFFile.HASH_KEY: 'f4984219b318894fa7144519185d1ae81ea721c6113243a52b51e444512a39d74cf41a4cec3c5d000bd7277cc71232c04d7a946717497e18619bdbe94bfeadd6',
SigMFFile.NUM_CHANNELS_KEY: 1,
SigMFFile.VERSION_KEY: __version__
SigMFFile.VERSION_KEY: '1.0.0'
}
}

Expand Down

0 comments on commit 406eed7

Please sign in to comment.