-
Notifications
You must be signed in to change notification settings - Fork 85
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
[MRG] Simplify raw_to_bids #106
Conversation
4564c92
to
32b2cf8
Compare
@sappelhoff @teonbrooks @monkeyman192 thoughts? I stop for today. The diff is a bit largish but I think I got two examples to run. We should first agree that this is a more future-compatible / simpler API. Maybe it isn't ... I don't know |
and your turn to review :-) I take a break from reviewing ... |
mne_bids/utils.py
Outdated
@@ -60,6 +60,20 @@ def _mkdir_p(path, overwrite=False, verbose=False): | |||
raise | |||
|
|||
|
|||
def _parse_bids_filename(fname): |
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.
you need a test ;-)
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.
typically private functions are not tested explicitly. But these lines should be covered since they are being called by the write_raw_bids
function
mne_bids/mne_bids.py
Outdated
# BrainVision is multifile, copy over all of them and fix pointers | ||
elif ext == '.vhdr': | ||
copyfile_brainvision(raw_fname, raw_file_bids) | ||
copyfile_brainvision(raw_fname, fname) |
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.
this will not go well together with what you write in the docstring on line 497:
The file path of the BIDS compatible raw file. In the case of multifile
systems (e.g., vhdr, .ds etc.), this is the path to a folder containing
all the files.
See also my comment above. Both copyfile_brainvision
(a multifile system, always 3 files) and copyfile_eeglab
(a facultative multifile system ... can be 1 file or 2 files) expect the location of the header file, i.e., myfile.vhdr
or myfile.set
... passing a directory is currently not supported and would maybe also not be a good idea.
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.
I like the approach and the idea to make MNE-BIDS more modular! There is much to be done, but I find this approach promising and also like the idea of an analogous "read_raw_bids" in the future.
4146d43
to
4307cbe
Compare
@agramfort : updated PR to use |
@agramfort @teonbrooks CIs are happy |
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.
on the whole, everything looks good and things are cleaned up.
my one concern, which is also inline in the review: I don't think that make_bids_basename
should be exposed to the end user and that we should incorporate the arguments into write_raw_bids
and privatize to _make_bids_basename
. I think it would simplify the api, and since we greatly reduce arg overloading for each edge case with the system-specific implementation, these standard arguments (subject
, run
, task
, and session
) can live in the function happily and not overcrowded.
@@ -18,7 +18,8 @@ Next to `numpy`, `scipy`, and `matplotlib` that are included in the standard | |||
anaconda distribution, you will need to install the following dependencies | |||
to be able to use `mne_bids`: | |||
|
|||
$ pip install pandas mne | |||
$ pip install pandas | |||
$ pip install -U https://api.github.com/repos/mne-tools/mne-python/zipball/master |
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.
maybe we can note the mne-python current version as the minimal in the text above
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.
not sure what you mean?
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.
I guess we don't specify anywhere minimal version number. like, we should have a section that says mne >= 0.17.X
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.
That's probably because we don't know them. I know only for MNE
we need >=0.17.x. For the rest I would say the "latest" :-)
So, we have an example for this function here. Do you envision this example going away if it becomes private? I would just let the user create the BIDS filename using string formatting but if you think that's adding friction, we can also have it as function arguments. No strong opinion there. My only concern is that since BIDS is still evolving, it might make sense not to tie API decisions to the file naming structure. There are still key-value pairs being added and dropped ... |
grr... yeah, does this include all current applicable key-value pairs? if they are exposed within the function as optional, then I would actually be ok with having this as a separate function. and yes, i do realize i was the one who suggested the basename function and then critique it afterwards lol ;) |
yep exactly. You would need to give people a way to write filenames with all the key-value pairs in BIDS, not just a subset ... |
dacba65
to
d9ea3a7
Compare
d4d0ac7
to
a9674c3
Compare
a9674c3
to
6e5beea
Compare
in make_bids_folders you use root for what you call output_path elsewhere no? |
Good catch. Now I made the variable |
everything looks good here now and all tests passing. merging. |
closes #98
closes #105
closes #119
closes #123