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

Neuroscan Support #924

Merged
merged 6 commits into from
Jan 13, 2022
Merged

Neuroscan Support #924

merged 6 commits into from
Jan 13, 2022

Conversation

yjmantilla
Copy link
Contributor

PR Description

PR to add support of .cnt files.

Closes #922

Output of make pep just said:

"Running flake8"
0
"Running pydocstyle"
"Checking MANIFEST.in"
lists of files in version control and sdist match

I ran the tests locally and it said 237 passed (at the end).

Documentation build ended with:

Sphinx-Gallery successfully executed 13 out of 13 files subselected by:

    gallery_conf["filename_pattern"] = '^((?!sgskip).)*$'
    gallery_conf["ignore_pattern"]   = '__init__\\.py'

after excluding 0 files that had previously been run (based on MD5).

embedding documentation hyperlinks...
embedding documentation hyperlinks for auto_examples... [100%] update_bids_datasets.htmlhtml
make[1]: Leaving directory 'Y:/code/mne-bids/doc'
cd doc/ && make view
make[1]: Entering directory 'Y:/code/mne-bids/doc'
make[1]: Leaving directory 'Y:/code/mne-bids/doc'

Let me know if anything else is required, like an specific test for cnt files.

Merge checklist

Maintainer, please confirm the following before merging:

  • All comments resolved
  • This is not your own PR
  • All CIs are happy
  • PR title starts with [MRG]
  • whats_new.rst is updated
  • PR description includes phrase "closes <#issue-number>"

@welcome
Copy link

welcome bot commented Dec 5, 2021

Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴🏽‍♂️

@codecov
Copy link

codecov bot commented Dec 5, 2021

Codecov Report

Merging #924 (f97dd9c) into main (36b21b5) will increase coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #924      +/-   ##
==========================================
+ Coverage   94.71%   94.79%   +0.07%     
==========================================
  Files          23       23              
  Lines        3499     3495       -4     
==========================================
- Hits         3314     3313       -1     
+ Misses        185      182       -3     
Impacted Files Coverage Δ
mne_bids/config.py 97.46% <ø> (ø)
mne_bids/inspect.py 98.78% <ø> (+1.75%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 36b21b5...f97dd9c. Read the comment docs.

Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

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

looks good

@yjmantilla can you add your name in this file

https://github.com/mne-tools/mne-bids/blob/main/doc/whats_new.rst

with a description of the change?

Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

Aaaand could you add a small test please?

@yjmantilla
Copy link
Contributor Author

@agramfort Sure, im a bit busy but as soon as I can I will do that.

@sappelhoff Yeah I could. Here is a public cnt dataset which may suffice:

https://figshare.com/articles/dataset/The_original_EEG_data_for_driver_fatigue_detection/5202739

Should I add a single or a couple of this cnts file to mne.datasets.testing?

Should I be following an example test? Im guessing it somehow has to do with

test_converteeg_data = [
('Persyst', 'BrainVision', 'sub-pt1_ses-02_task-monitor_acq-ecog_run-01_clip2.lay', _read_raw_persyst), # noqa
('NihonKohden', 'BrainVision', 'MB0400FU.EEG', _read_raw_nihon),
('Persyst', 'EDF', 'sub-pt1_ses-02_task-monitor_acq-ecog_run-01_clip2.lay', _read_raw_persyst), # noqa
('NihonKohden', 'EDF', 'MB0400FU.EEG', _read_raw_nihon),
]

Would it suffice adding the cnt to the testing datasets and append the CNT case to this list?

@agramfort
Copy link
Member

agramfort commented Dec 9, 2021 via email

@sappelhoff
Copy link
Member

Would it suffice adding the cnt to the testing datasets and append the CNT case to this list?

In the MNE-testing-data there is a CNT file called scan41_short.cnt. That one will probably suffice for a short/tiny test.

Sure, im a bit busy but as soon as I can I will do that.

Cool, please add info about this PR under "enhancements" then. Note, that you also need to add your name to https://github.com/mne-tools/mne-bids/blob/main/doc/authors.rst in order for the link to your name to work.

maybe look at test functions like test_set or or test_bdf in test_write.py?

agreed, or maybe this one:

def test_eegieeg(dir_name, fname, reader, _bids_validate, tmp_path):

@yjmantilla
Copy link
Contributor Author

Hi @sappelhoff and @agramfort , sorry for the delay. I added the tests and updated what's new.

For the tests I mainly imitated what I saw already implemented and made use of the variables test_eegieeg_data and test_converteeg_data.

I had to add some warning filters for cnt files inspired on:

cnt_ignore_warns = [
    pytest.mark.filterwarnings(
        'ignore:.*Could not parse meas date from the header. Setting to None.'
    ),
    pytest.mark.filterwarnings((
        'ignore:.*Could not define the number of bytes automatically.'
        ' Defaulting to 2.')
    ),
]

found in this mne code

I also had the problem of handedness set to None for the cnt file example. So I had to add also this warning filter:
no_hand='ignore:.*Not setting subject handedness.:RuntimeWarning:mne'

Maybe there is a better way to deal with that.

make pep output:

Running flake8
0
Running pydocstyle
Checking MANIFEST.in
lists of files in version control and sdist match

make test output:

======================= 250 passed in 317.49s (0:05:17) =======================

ci for docs-buikd is failing but maybe this is due to #941 , in correspondence my local build of the docs is also failing with the same error of the ci:

Extension error:
Here is a summary of the problems encountered when running the examples

Unexpected failing examples:
Y:\code\mne-bids\examples\read_bids_datasets.py failed leaving traceback:
Traceback (most recent call last):
  File "Y:\code\mne-bids\examples\read_bids_datasets.py", line 67, in <module>
    openneuro.download(dataset=dataset, target_dir=bids_root,
  File "C:\software\anaconda3\envs\mnedev\lib\site-packages\openneuro\download.py", line 602, in download
    local_tag = _get_local_tag(dataset_id=dataset,
  File "C:\software\anaconda3\envs\mnedev\lib\site-packages\openneuro\download.py", line 495, in _get_local_tag
    raise RuntimeError(f'The existing dataset in the target directory '
RuntimeError: The existing dataset in the target directory appears to be different from the one you requested to download. "DatasetDOI" field in local "dataset_description.json": doi:10.18112/openneuro.ds002778.v1.0.5. Requested dataset: ds002778

@hoechenberger
Copy link
Member

I just merged main, hopefully CI will now go green!

@yjmantilla
Copy link
Contributor Author

Im failing code coverage for some reason because of mne_bids/inspect.py although I didnt touch it. Otherwise it seems good

mne_bids/config.py | 97.46% <ø> (ø) |  
mne_bids/inspect.py | 97.02% <66.66%> (-1.74%) | ⬇️
mne_bids/read.py | 95.84% <100.00%> (+0.02%) | ⬆️
mne_bids/write.py | 96.22% <100.00%> (ø)


Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

thanks @yjmantilla

Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

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

@hoechenberger merge if happy

@hoechenberger hoechenberger merged commit d618c46 into mne-tools:main Jan 13, 2022
@welcome
Copy link

welcome bot commented Jan 13, 2022

🎉 Congrats on merging your first pull request! 🥳 Looking forward to seeing more from you in the future! 💪

@hoechenberger
Copy link
Member

Thanks, @yjmantilla!

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.

Supporting CNTs (Neuroscan) files
4 participants