-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Feature: Support for file-like objects for EDF/BDF/GDF files #13156
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
Open
szz-dvl
wants to merge
78
commits into
mne-tools:main
Choose a base branch
from
szz-dvl:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 41 commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
b89c5b4
Added support for file-like objects for EDF and BDF files
szz-dvl 0a0ff52
Merge branch 'mne-tools:main' into main
szz-dvl a0a1e76
test: Added test descriptions
szz-dvl 9e0991d
FEAT: Added support for GDF file-like objects
szz-dvl d16fc48
Merge branch 'mne-tools:main' into main
szz-dvl 8d9d4f1
DOC: Documentation for EDF/GDF file-like objects
szz-dvl a9dfb58
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 5816f59
CHORE: Fix pre-commit
szz-dvl 1097569
CHORE: Fix pre-commit
szz-dvl 3c6a053
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b64a768
CHORE: Fix pre-commit
szz-dvl 90e03fc
FIX: Got rid of file_type extra parameter. RawEDF class duplicated ->…
szz-dvl a462488
FIX: Moved edf/gdf logic to a new _edf folder
szz-dvl f80722f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] a5c9640
Merge branch 'main' into main
szz-dvl 5b1dd29
FIX: Fixed log for GDF files when not file-like
szz-dvl 08c81ec
DOC: Added documentation for file-like objects
szz-dvl 95b5550
FEATURE: Added support for numpy.frombuffer for in memory file objects
szz-dvl 89423c8
FIX: Removed unnecessary preloading from _edf/open.py
szz-dvl 0372f3b
FIX: Support for in memory file-like objects
szz-dvl 2df5210
TEST: Support for in memory file-like objects
szz-dvl ca2f3ba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 930c802
CHORE: pre-commit script
szz-dvl f4b866c
CHORE: pre-commit script
szz-dvl 29aa9c5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] d7f8fc4
FIX: Fix GDF logs
szz-dvl 9806bd0
TEST: Removed warnings from tests
szz-dvl ed3a8d0
TEST: Removed empty GDF file
szz-dvl 381bf2f
Merge branch 'main' into main
szz-dvl f952695
[autofix.ci] apply automated fixes
autofix-ci[bot] 9581dba
Merge branch 'main' into main
szz-dvl ccb897d
FIX: Moved numpy_fromfile to read_from_file_or_buffer.
szz-dvl b11b5b8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2698f53
TEST: Added @testing.requires_testing_data annotation.
szz-dvl 87107da
TEST: Shortened tests for file-like objects for EDF/BDF files
szz-dvl 1bbedd1
Merge branch 'main' of github.com:szz-dvl/mne-python
szz-dvl 60a73a6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 579a7d2
Merge branch 'main' into main
szz-dvl 3cf32d5
DOC: Added rst for PR 13156
szz-dvl 154f117
FIX: Added import numpy.typing in fixes.py
szz-dvl 86c0e7d
FIX: Fixed .rst for PR 13156
szz-dvl 29edf89
Added Santi Martínez to names.inc
szz-dvl 9b47224
FIX: Removed extra underscore
szz-dvl 84801a0
FIX: Removed extra declaration of _path_from_fname
szz-dvl 82e83e1
FIX: Dedent test_degenerate
szz-dvl 6ac9b01
Removed unnecessary ignore warning
szz-dvl 63f79e5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 5700760
FIX: pre-comit.sh
szz-dvl 27d98c9
FIX: pre-comit.sh
szz-dvl 6a766cb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 42accea
Merge branch 'main' into main
szz-dvl 25138c9
Merge branch 'main' into main
szz-dvl 3655e1c
Merge branch 'main' into main
szz-dvl fdb2d60
Merge branch 'main' into main
szz-dvl 12a88a4
Merge branch 'main' into main
szz-dvl d128c89
Merge branch 'main' into main
szz-dvl 3488bc6
Merge branch 'main' into main
szz-dvl 9d273d7
Merge branch 'main' into main
szz-dvl 019ee0e
Merge branch 'main' into main
szz-dvl 1cb64d0
DOC: Added version for file-like object support
szz-dvl 48e6434
FIX: _check_fname to check input file names
szz-dvl bd64749
FIX: Changed return type annotation for read_raw_bdf
szz-dvl 25d1c49
FIX: Added _check_args function to encapsulate initial argument check…
szz-dvl bee80e4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 29ffbe3
Merge branch 'main' into main
szz-dvl 4d37a5c
Merge branch 'main' into main
szz-dvl 0d9bfa8
Merge branch 'main' into main
szz-dvl c282349
Merge branch 'main' into main
szz-dvl 40b9c4e
Merge branch 'main' into main
szz-dvl b3ae7ec
Merge branch 'main' into main
szz-dvl 35c4365
Merge branch 'main' into main
szz-dvl fe76e78
Merge branch 'main' into main
szz-dvl 8f5aac4
Merge branch 'main' into main
szz-dvl d6ffa2f
Merge branch 'main' into main
szz-dvl 75ba5ae
Merge branch 'main' into main
szz-dvl 102c16f
Merge branch 'main' into main
szz-dvl 18ba2f4
Merge branch 'main' into main
szz-dvl ea849e8
Merge branch 'main' into main
szz-dvl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added support for file like objects in :func:`read_raw_bdf <mne.io.read_raw_bdf>`, :func:`read_raw_edf <mne.io.read_raw_edf>` and :func:`read_raw_gdf <mne.io.read_raw_gdf>`, by `Santi Martínez`_. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Authors: The MNE-Python contributors. | ||
# License: BSD-3-Clause | ||
# Copyright the MNE-Python contributors. | ||
|
||
# Maybe we can move this one to utils or something like that. | ||
from pathlib import Path | ||
|
||
from mne._fiff.open import _NoCloseRead | ||
|
||
from ..utils import _file_like, _validate_type, logger | ||
|
||
|
||
def __gdf_edf_get_fid(fname, **kwargs): | ||
szz-dvl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"""Open a EDF/BDF/GDF file with no additional parsing.""" | ||
if _file_like(fname): | ||
logger.debug("Using file-like I/O") | ||
fid = _NoCloseRead(fname) | ||
fid.seek(0) | ||
else: | ||
_validate_type(fname, [Path, str], "fname", extra="or file-like") | ||
logger.debug("Using normal I/O") | ||
fid = open(fname, "rb", **kwargs) # Open in binary mode | ||
return fid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.