Skip to content

Commit

Permalink
doc: remove sphinx gallery style thats now handled upstream (#964)
Browse files Browse the repository at this point in the history
* remove sphinx gallery style thats now handled upstream

* Reduce memory usage (untested)

* Cleaner

* Super ugly proof of concept

* Revert "Super ugly proof of concept"

This reverts commit fd34d55.

* Got it!

Co-authored-by: Richard Höchenberger <[email protected]>
  • Loading branch information
sappelhoff and hoechenberger authored Feb 23, 2022
1 parent 81bccd6 commit 87c7165
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
6 changes: 0 additions & 6 deletions doc/_static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ span.option {
white-space: nowrap;
}

/* gallery thumbnail size */
.sphx-glr-thumbcontainer {
min-width: 160px;
height: 250px;
}

/* ************************************************* Previous / Next buttons */
.prev-next-bottom a.left-prev:before {
content:"❮\00A0"
Expand Down
14 changes: 10 additions & 4 deletions mne_bids/tests/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from mne_bids.utils import (_write_json)
from mne_bids.sidecar_updates import _update_sidecar
from mne_bids.path import _find_matching_sidecar
import mne_bids.write
from mne_bids.write import write_anat, write_raw_bids, get_anat_landmarks

subject_id = '01'
Expand Down Expand Up @@ -949,7 +950,7 @@ def test_bads_reading(tmp_path):


@pytest.mark.filterwarnings(warning_str['channel_unit_changed'])
def test_write_read_fif_split_file(tmp_path):
def test_write_read_fif_split_file(tmp_path, monkeypatch):
"""Test split files are read correctly."""
# load raw test file, extend it to be larger than 2gb, and save it
bids_root = tmp_path / 'bids'
Expand All @@ -962,13 +963,18 @@ def test_write_read_fif_split_file(tmp_path):
write_raw_bids(raw, bids_path, verbose=False)
bids_path.update(acquisition='01')
n_channels = len(raw.ch_names)
n_times = int(2.2e9 / (n_channels * 4)) # enough to produce a split
n_times = int(2.5e6 / n_channels) # enough to produce a 10MB split
data = np.empty((n_channels, n_times), dtype=np.float32)
raw = mne.io.RawArray(data, raw.info)
big_fif_fname = pathlib.Path(tmp_dir) / 'test_raw.fif'
raw.save(big_fif_fname)

split_size = '10MB'
raw.save(big_fif_fname, split_size=split_size)
raw = _read_raw_fif(big_fif_fname, verbose=False)
write_raw_bids(raw, bids_path, verbose=False)

with monkeypatch.context() as m: # Force MNE-BIDS to split at 10MB
m.setattr(mne_bids.write, '_FIFF_SPLIT_SIZE', split_size)
write_raw_bids(raw, bids_path, verbose=False)

# test whether split raw files were read correctly
raw1 = read_raw_bids(bids_path=bids_path)
Expand Down
9 changes: 7 additions & 2 deletions mne_bids/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
ANONYMIZED_JSON_KEY_WHITELIST)


_FIFF_SPLIT_SIZE = '2GB' # MNE-Python default; can be altered during debugging


def _is_numeric(n):
return isinstance(n, (np.integer, np.floating, int, float))

Expand Down Expand Up @@ -890,8 +893,10 @@ def _write_raw_fif(raw, bids_fname):
should be saved.
"""
raw.save(bids_fname, fmt=raw.orig_format, split_naming='bids',
overwrite=True)
raw.save(
bids_fname, fmt=raw.orig_format, split_size=_FIFF_SPLIT_SIZE,
split_naming='bids', overwrite=True
)


def _write_raw_brainvision(raw, bids_fname, events, overwrite):
Expand Down

0 comments on commit 87c7165

Please sign in to comment.