-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
BUG: Fix bug related to how Neuroscan .cnt n_samples is read #12393
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
Conversation
|
@larsoner Can I update the testing data to include a file that was not read properly before this change or even replace the one I already added. The documentation said that the header I am using was not reliable, but I think that may be because they read the I am not sure why this broke a bunch of tests. The cnt.py tests ran fine and I plotted all the testing data and it all looks fine. |
Yes feel free! The file is small, right? The smaller the testing dataset the better, so might as well replace the old one assuming we can still test all the same stuff. |
| annotations = _read_annotations_cnt(input_fname, data_format="int16") | ||
| if annotations.onset[-1] * sfreq > n_samples: | ||
| n_bytes = 4 | ||
| n_samples = n_samples_header | ||
| warn( | ||
| "Annotations are outside data range. " | ||
| "Changing data format to 'int32'." | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@larsoner I added a check to see if there were any annotations outside the actual amount of data. If there are, I switch the data_format. I could not figure out a way to detect the correct number of samples with certainty. It only triggers when using the 'auto' data_format which already doesn't work with the current testing data I uploaded. Is this fine with you?
| @testing.requires_testing_data | ||
| def verify_reading_bytes(): | ||
| raw_16 = read_raw_cnt(fname, preload=True) | ||
| raw_32 = read_raw_cnt(fname_bad_spans, preload=True) | ||
|
|
||
| # Verify that the number of bytes read is correct | ||
| assert len(raw_16) == 3070 | ||
| assert len(raw_32) == 90000 | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason I was unable to run my test locally using pytest
|
Test function names must start with "test_" yours starts with "verify_"
…-------- Original Message --------
On 1/29/24 16:09, Jacob Woessner wrote:
@withmywoessner commented on this pull request.
---------------------------------------------------------------
In [mne/io/cnt/tests/test_cnt.py](#12393 (comment)):
> ***@***.***_testing_data
+def verify_reading_bytes():
+ raw_16 = read_raw_cnt(fname, preload=True)
+ raw_32 = read_raw_cnt(fname_bad_spans, preload=True)
+
+ # Verify that the number of bytes read is correct
+ assert len(raw_16) == 3070
+ assert len(raw_32) == 90000
+
+
For some reason I was unable to run my test locally using pytest
—
Reply to this email directly, [view it on GitHub](#12393 (review)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AAN2AU44A5WG67QGJHTECQ3YRAMXZAVCNFSM6AAAAABCOVJKUCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNBZHA3DOOBZGM).
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
larsoner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And don't forget to change the hash and version number of the testing dataset in mne/datasets/config.py
|
Done! @larsoner New hash and version is in the config file: |
|
CIs are unhappy, can you look? |
I forgot a docustring. It should hopefully be good @larsoner. I think this is causing it to fail now: mne-python/mne/io/cnt/tests/test_cnt.py Line 23 in 1ffe426
|
|
Looking at the logs the error is: So I think you need to change the test now to catch a different warning string (or maybe multiple warning strings with multiple |
Oh, I thought it was the |
|
Are you sure tests are passing and not being skipped at your end? In your mne-testing-data PR you had an outdated version in your |
|
@withmywoessner ready to go from your end? I clicked the "ready for review" button in case but let me know either way (and no need to put |
This fixed it. Thank you! |
I am @larsoner. Thanks! |
larsoner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one minor tweak that I'll commit, thanks @withmywoessner !
…ls#12393) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Eric Larson <larson.eric.d@gmail.com>


Reference issue
#6537
#11802
What does this implement/fix?
Change how number of samples is read and verifies that they are correct.
Additional information
I need to upload new testing data that demonstrates this bug.