question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add generic reader function?

See original GitHub issue

At some point we’ve already discussed if adding a generic reader function (mne.io.read_raw) would be useful. I can’t find the relevant discussion, but I think that we decided that users should stick to the separate readers.

I’ve written such a wrapper function for MNELAB (https://github.com/cbrnr/mnelab/pull/148), and I think this might still be a good idea to include in MNE. It makes things easier for users - the file extension already determines the file type, so why do they have to explicitly pick the right function if this could be done automatically?

Of course this is not meant to replace the individual readers - it’s just a convenience wrapper that should work for the most common file types.

mne.io.read_raw("test.vhdr")
mne.io.read_raw("test.edf")
mne.io.read_raw("test.bdf")
mne.io.read_raw("test.set")
# ... you get the point

I’m fine if people decide (again) not to include this (“There should be one-- and preferably only one --obvious way to do it”). But in that case, I’d like to ask if anyone has a good idea how to include the true MNE reader function calls in MNELAB’s history without creating too big of a mess. Currently, I stick to just using mnelab.io.read_raw for history entries because it keeps the code so much simpler. Suggestions are very much appreciated (either here or at https://github.com/cbrnr/mnelab/pull/148)!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:35 (35 by maintainers)

github_iconTop GitHub Comments

2reactions
agramfortcommented, May 19, 2020

would you expose at least the verbose and preload option to read_raw without kwargs? these are supported by all readers.

1reaction
larsonercommented, May 21, 2020

Probably a new mne/io/_read_raw.py – it will need to import all other readers at the top, so a separate module will help avoid circular imports

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generic Reader and Writer · FME Desktop Advanced Training ...
A Generic Reader is used in the same way as any other reader; by specifying the format in the Add Reader (or Generate...
Read more >
Generic (Any Format) Reader/Writer - Documentation
The Generic reader acts as a wrapper for the true reader which will be used when the translation is done. At run-time, once...
Read more >
Build a Generic CSV Writer/Reader Using Reflection
In this guide, I will explain how to write a generic CSV Writer/Reader that will automatically pick data from the public properties of...
Read more >
Reading multiple generic files with tf.data - Stack Overflow
The features are in a matrix exported from matlab while the labels are in other files that require particular functions in order to...
Read more >
Generics — The Swift Programming Language (Swift 5.7)
Generic code enables you to write flexible, reusable functions and types that ... reader about the relationship between the type parameter and the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found