Skip to content

Take filenames with dots into account in get_sigmf_filenames() #107

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

Merged
merged 4 commits into from
Apr 10, 2025

Conversation

daniestevez
Copy link
Contributor

The function get_sigmf_filenames() does not work correctly if a file contains dots in the filename. These are interpretted as suffixes by pathlib, and a part of the filename can be removed when forming the different SigMF filenames. This fixes the problem by only considering as file extensions the canonical SigMF file extensions. Any other suffixes are treated as part of the filename and not removed.

This fixes #106.

The function get_sigmf_filenames() does not work correctly if a
file contains dots in the filename. These are interpretted as suffixes
by pathlib, and a part of the filename can be removed when forming
the different SigMF filenames. This fixes the problem by only
considering as file extensions the canonical SigMF file extensions.
Any other suffixes are treated as part of the filename and not removed.

This fixes sigmf#106.
@Teque5 Teque5 added the bug Something isn't working label Apr 9, 2025
@Teque5
Copy link
Collaborator

Teque5 commented Apr 9, 2025

Thanks for working on it @daniestevez.

The failing test in the PR I believe is caused by an erroneous .sigmf_meta instead of sigmf-meta in sigmffile.py.

Beside that, I think this PR is missing an additional test for this particular circumstance. At minimum it should ensure that a.sigmf-meta, b.c.sigmf-meta, d.e.f.sigmf-meta are all read correctly.

The get_SigMFFile() method was broken because it used ".sigmf_meta"
instead of ".sigmf-meta". This rewrites the method to use
get_sigmf_filenames().
This adds a unit test that shows that SigMF files like
a.sigmf-meta, b.c.sigmf-meta, and d.e.f.sigmf-meta are all loaded
correctly.
@daniestevez
Copy link
Contributor Author

@Teque5 I've pushed a commit that fixes the failing test and another commit that adds a test case like you described.

@Teque5 Teque5 merged commit d4031c0 into sigmf:main Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sigmffile.fromfile() removes periods from filename stem
2 participants