Skip to content

Converted assert of phys_min and phys_max into warnings#266

Merged
skjerns merged 5 commits intoholgern:masterfrom
TrianecT-Wouter:patch-1
Jan 22, 2025
Merged

Converted assert of phys_min and phys_max into warnings#266
skjerns merged 5 commits intoholgern:masterfrom
TrianecT-Wouter:patch-1

Conversation

@TrianecT-Wouter
Copy link
Copy Markdown
Contributor

Converted assert's into warnings.

Reason:
in many cases, storing an edf file fails because of roundoff errors: e.g. phys_min -3565.82 vs. signal_min 3565.8200000000000006 will fail in write_edf (but shouldn't)

Converted assert's into warnings. Reason:

in some cases, storing an edf file fails because of roundoff errors:
e.g. `phys_min -3565.82 vs. signal_min 3565.8200000000000006` will fail in write_edf (but shouldn't)
@skjerns
Copy link
Copy Markdown
Collaborator

skjerns commented Dec 16, 2024

nice! It seems like it was originally intended to be a warning, so good fix.

However, could you also adapt the test suite? It seems to expect an assertion error here when we no longer give this. Maybe check for the actualy values that are now being read? that would be great!

@TrianecT-Wouter
Copy link
Copy Markdown
Contributor Author

Didn't see that before. Will check.

@TrianecT-Wouter
Copy link
Copy Markdown
Contributor Author

Good tips @skjerns. I attempted to implement the tests as well and found some new edge cases which should still throw an error.

Workflow is now as follows:

  1. check if the difference is large (using accuracy based on the fact that edf uses 16 bits for the range from -physmin / +physmax)
  2. Yes: perform assertion
  3. No: throw warning

Also reflected in tests.

To enable building the python package, I had to remove to references to distools (which is deprecated; see #267)

This also fixes #267 in the sense that you can still build the pypi package using python 3.12.

@skjerns skjerns merged commit 9f8dde4 into holgern:master Jan 22, 2025
@skjerns
Copy link
Copy Markdown
Collaborator

skjerns commented Jan 22, 2025

thanks! looks good to me :)

@skjerns skjerns mentioned this pull request Jan 23, 2025
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.

2 participants