Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move keys from sigmf.SigMFFile to top-level sigmf #92

Open
Teque5 opened this issue Dec 19, 2024 · 1 comment
Open

move keys from sigmf.SigMFFile to top-level sigmf #92

Teque5 opened this issue Dec 19, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Teque5
Copy link
Collaborator

Teque5 commented Dec 19, 2024

It's bothered me ever since the beginning that if you want to set or get some key within sigmf you needed to do sigmf.SigMFFile.VERSION_KEY instead of just doing sigmf.VERSION_KEY. Now we appear to also have keys within archive.py for file extensions, which is strange.

Other modules (logging, pygame, numpy) have global vars like this in the top level.

I would like to:

  1. Consolidate all keys into keys.py or similar name.
  2. In the __init__.py do from .keys import * so that we can access a key using sigmf.VERSION_KEY.
  3. In SigMFFile attach keys as properties for now and insert a comment saying that functionality will be deprecated in a future version. This keeps backwards compatibility.

This change should increment the minor version (major.minor.patch).

@Teque5 Teque5 added the enhancement New feature or request label Dec 19, 2024
@Teque5 Teque5 self-assigned this Dec 19, 2024
@GreenK173
Copy link
Contributor

Agree on all points, especially the file extension keys being in archive.py makes little sense. Also noticed that some of the code doesn't actually use these keys and uses the hard-coded extensions instead.

In archivereader.py:

raise SigMFFileError("No .sigmf-data file found in archive!")

In sigmffile.py:

if metafile.endswith(".sigmf-meta") and path.isfile(metafile_path):
metafile = stream_name + ".sigmf_meta"
metafile = self.get_stream_names()[stream_index] + ".sigmf_meta"

The last two are actually incorrect (.sigmf_meta instead of .sigmf-meta) ! However this bug doesn't manifest itself since fromfile treats every extension other that .sigmf and .sigmf-collection as if it were .sigmf-meta (perhaps that's also not ideal).

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

No branches or pull requests

2 participants