-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
DOC: show example code for custom reader functions (was: Subclassing BaseRaw is too difficult) #12854
Comments
@cbrnr I opened this to try to figure out if we could make the process easier, but this already works:
I don't see this as too onerous, and gives you the advantage of nice
So I would rather have this little subclass wrapper than add setters for the filenames (which would likely lead to other problems anyway). |
Perfect, that's really great indeed! I'll switch to this approach then for my readers. Thanks! |
Maybe it could be turned into an example? |
I'll see what it'll look like, I have readers for |
FWIW, what's really missing in the example is a function |
exactly what I was thinking; I'll re-open and re-title this issue as an issue about doc improvement.
Agreed. I think the new/edited example would be most useful if it were something like: # If no reader exists yet for the kind of file you're working with,
# here's a template function that should get you up and running:
def read_raw_npz(...):
# load the data (this part will usually be different for each file type)
# create fake info (details of how the channel names/types are stored in the file may vary)
# use RawArray to instantiate
# return RawArray
# (now show it in action)
foo = read_raw_npz(...)
# If you want to contribute your file reader to MNE-Python, it would need a few more pieces,
# like supporting `preload=False`. Here's an expanded reader for `.npz` to illustrate what a
# full-fledged reader function usually looks like:
def read_raw_npz(...):
...
# (now show it in action)
foo = read_raw_npz(..., preload=False) |
I'm working on this here: cbrnr/mnelab#434 I think the |
Also, in your example I think subclassing |
I think Aside: I think |
ah, right you are. |
I agree!
Right, |
Originally posted by @cbrnr in #12843 (comment)
The text was updated successfully, but these errors were encountered: