gwexpy.interop.mne_#
Functions
|
Convert an MNE object to a gwexpy object. |
|
Create a TimeSeriesDict from mne.io.Raw. |
|
Convert a gwexpy object to an MNE object. |
|
Convert a TimeSeries-like object to an |
- gwexpy.interop.mne_.to_mne_rawarray(tsd, info=None, picks=None)#
Convert a TimeSeries-like object to an
mne.io.RawArray.- パラメータ:
tsd --
TimeSeriesDict-like mapping (multi-channel) or a singleTimeSeries.info -- Optional MNE
Info. If omitted, a minimalInfois created.picks -- Optional channel selection (names or indices). Only supported for mapping inputs.
- 戻り値:
The converted MNE Raw object.
- 戻り値の型:
mne.io.RawArray
- 例外:
TypeError -- If
picksis given for a single-channel input.ValueError -- If
info's channel count does not match the input; if mapping channels have mismatched sampling frequency, length, or (for same-length channels) epoch; or ift0conflicts with an existinginfo["meas_date"].LeapSecondConversionError -- If
t0falls on a leap second.
メモ
The input epoch (
t0) is reconciled withinfo["meas_date"]: ifinfohas nomeas_dateyet, it is set fromt0(unlesst0 == 0, which leaves it unset); ifinfoalready has ameas_date,t0-- including0-- is always compared against it, and a mismatch beyond ~1us raisesValueErrorinstead of silently overwriting or ignoring it. At0that falls on a leap second raisesLeapSecondConversionError.For a mapping input, all channels must share the same sampling frequency; a mismatch always raises
ValueError(previously stacked silently), even when channel lengths differ. Same-length channels are then stacked without resampling/alignment and must also share an exactly matching epoch; a mismatch raisesValueError(previously stacked silently). Only channels of differing length (with matching sampling frequency) are automatically aligned, viato_matrix()on aTimeSeriesDictinput -- sampling-frequency or epoch mismatches are never auto-aligned and must be resolved by the caller beforehand.A mixed exact/legacy mapping uses MNE's one shared official time axis for the legacy channels, while GWexpy retains exact epochs as private per-channel in-memory metadata. Exact channels must still agree exactly on epoch and sample interval; exact/exact conflicts are rejected.
- gwexpy.interop.mne_.from_mne_raw(cls, raw, unit_map=None)#
Create a TimeSeriesDict from mne.io.Raw.
- パラメータ:
cls -- The TimeSeriesDict-like class to construct and populate.
raw (mne.io.Raw) -- The MNE Raw object to convert.
unit_map (dict, optional) -- Optional mapping from channel name to unit, applied to the resulting TimeSeries entries. Channels absent from the mapping (or when
unit_mapis omitted) getunit=None.
- 戻り値:
A cls instance populated with one TimeSeries per channel.
- 戻り値の型:
TimeSeriesDict
メモ
The GPS epoch is reconstructed as
datetime_utc_to_gps(raw.info["meas_date"]) + raw.first_samp / sfreq(or just thefirst_sampoffset ifmeas_dateis unset), so cropped or resumed Raw objects (first_samp > 0) get the correct absolute epoch instead of always starting atmeas_date(or0).
- gwexpy.interop.mne_.to_mne(data, info=None, **kwargs)#
Convert a gwexpy object to an MNE object.
- パラメータ:
data (FrequencySeries, Spectrogram, or TimeSeries (or dicts)) -- The data object to convert.
info (mne.Info, optional) -- Measurement info to use. If None, one is created.
**kwargs -- Additional arguments passed to MNE constructors.
- 戻り値:
The converted MNE object (e.g. RawArray, SpectrumArray, EpochsTFRArray).
- 戻り値の型:
mne_object
- gwexpy.interop.mne_.from_mne(cls, data, **kwargs)#
Convert an MNE object to a gwexpy object.
- パラメータ:
cls (type) -- The target class (e.g. FrequencySeries, Spectrogram, TimeSeries).
data (mne object) -- The MNE object to convert.
**kwargs -- Additional arguments passed to from_mne_* helpers.
- 戻り値の型:
gwexpy object