Skip to content

undead vampire meas date #4949

@jasmainak

Description

@jasmainak

I'm just borrowing terminology from chat with @dengemann for title :-)

I seem to have hit a bug when writing tests for mne-bids. Essentially, if you set meas_date to None, when writing the file, MNE is using the current date/time to set it. Therefore, when you read it back, it's not None anymore. I would consider it a bug but feel free to disagree :) To reproduce, run this:

import os.path as op

import mne
from mne.datasets import sample
from mne.utils import _TempDir

data_path = sample.data_path()

raw_fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(raw_fname)

# Let's make meas_date None
raw.info['meas_date'] = None
# raw.info['meas_id'] = None  # even uncommenting this does not change anything

# write it to a temp file
data_path2 = _TempDir()
raw_fname2 = op.join(data_path2, 'sample_audvis_raw.fif')
raw.save(raw_fname2, overwrite=True)

# and read it back
raw2 = mne.io.read_raw_fif(raw_fname2)
assert(raw.info['meas_date'] == raw2.info['meas_date'])

cc @teonbrooks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions