Skip to content

include_tmax not considered in mne.io.Raw.crop to check tmax in bounds #11196

@gemeinl

Description

@gemeinl

Description of the problem

When cropping a Raw to its exact duration without including tmax, the code crashes.
This is clearly an edge case, but I would expect this to work.
Am I wrong on this?

Steps to reproduce

import numpy as np
import mne

n_seconds = 1
sfreq = 100
ch_names = ['1']
data = np.ones((len(ch_names), sfreq*n_seconds))
info = mne.create_info(ch_names=ch_names, sfreq=sfreq)
raw = mne.io.RawArray(data, info)
raw.crop(tmax=n_seconds, include_tmax=False)

Link to data

No response

Expected results

The code should run and the raw should not change, since it is cropped for the entire data.

Actual results

Code crashes.

Additional information

Platform: Linux-5.15.63-flatcar-x86_64-with-glibc2.31
Python: 3.9.7 | packaged by conda-forge | (default, Sep 2 2021, 17:58:34) [GCC 9.4.0]
Executable: /opt/conda/bin/python3
CPU: x86_64: 64 cores
Memory: 251.8 GB

mne: 1.1.dev0
numpy: 1.23.3 {}
scipy: 1.9.1
matplotlib: 3.6.0 {backend=module://matplotlib_inline.backend_inline}

sklearn: 1.1.2
numba: Not found
nibabel: Not found
nilearn: Not found
dipy: Not found
cupy: Not found
pandas: 1.5.0
pyvista: Not found
pyvistaqt: Not found
ipyvtklink: Not found
vtk: Not found
qtpy: Not found
ipympl: Not found
pyqtgraph: Not found
pooch: Not found

mne_bids: Not found
mne_nirs: Not found
mne_features: Not found
mne_qt_browser: Not found
mne_connectivity: Not found
mne_icalabel: Not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions