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

Fix path handling for non-conforming datasets #81

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

GreenK173
Copy link

This PR replaces PR #79 because I accidentally created that one on the main branch of my fork.

Fixes #78. The matter was also recently dealt with in the SigMF specification repo in issue #321 and PR #322. In particular this PR addresses the issue raised by @lgoix in this comment.

The get_dataset_filename_from_metadata function returns the full file path for non-conforming datasets, not just the file name. Furthermore an unit test verifying this, plus a couple of typos described in the above issue fixed.

@Teque5
Copy link
Collaborator

Teque5 commented Dec 14, 2024

While rewriting your test I observed that to use a non-compliant data file we have to do something like this:

meta = SigMFFile(metadata=ncd_metadata, data_file=data_path)
# tell SigMF that the data is noncompliant
meta.set_global_field(SigMFFile.DATASET_KEY, data_path.name)

but really I think the SigMFFile should detect that data_path.suffix != '.sigmf-data' and set that key & value automatically.

We can either merge this and create another PR, or if you want you can add this improvement to this PR.

Copy link
Collaborator

@Teque5 Teque5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we never want temp files to exist after testing I used tempfile and also make some simplifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_dataset_filename_from_metadata should return full path for non-conforming datasets + couple of typos
2 participants