mne-tools / mne-tools/mne-python

Adding an argument `include_tmax` for `.get_data()`

Open
#10,372 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

ENH
Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

We ran into a failure today in https://github.com/vferat/pycrostates/pull/14 because raw.get_data() was returning one less sample than expected, namely, the tmax sample.

from pathlib import Path

import mne
print (mne.__version__)

directory = Path(mne.datasets.sample.data_path()) / 'MEG' / 'sample'
fname = directory / 'sample_audvis_filt-0-40_raw.fif' 
raw = mne.io.read_raw_fif(fname, preload=True, verbose=False)

print (raw.get_data().shape)
print (raw.get_data(tmin=0, tmax=raw.times[-1]).shape)

OUT:

0.24.0
(376, 41700)
(376, 41699)

Do you consider this to be a bug in the handling of tmax, or should an additional argument be added, include_tmax, like for raw.crop()?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The relevant entry point is Raw.get_data(), with raw.crop() as the comparison named in the issue. Reproduce the two calls shown against the sample FIF data, then resolve whether the intended behavior is an include_tmax option or a correction to the existing handling; done means the selected behavior produces the expected sample shape.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.