dirconn.TimeSeries#
- class dirconn.TimeSeries(data: ndarray, sfreq: float, channels: tuple[ChannelMeta, ...], segmentation: str, tmin: float = 0.0, valid: ndarray | None = None, predict: ndarray | None = None, history: tuple[dict[str, Any], ...] = ())#
Multichannel time series with explicit segmentation.
The data always have shape
(n_trials, n_channels, n_times). Whether the data are one continuous record or a set of epochs is stored explicitly insegmentationand is never inferred fromn_trials: a single epoch is still"epoched".- Parameters:
data (ndarray, shape (n_trials, n_channels, n_times)) – Real-valued, finite samples. Converted to
float64and exposed as a read-only view; afloat64input array is not copied.sfreq (float) – Sampling frequency in Hz.
channels (tuple of ChannelMeta) – One entry per channel, with unique names.
segmentation ({"continuous", "epoched"}) –
"continuous"requiresn_trials == 1.tmin (float) – Time of the first sample in seconds, relative to the epoch event (0 for continuous data).
valid (ndarray of bool, shape (n_trials, n_times), optional) – Which samples can be used at all, as a regressor or as a predicted value. Gaps and bad segments are
False. The samples themselves must still be finite: put any number there (from_array()withnan="mask"puts 0).None(default) means every sample is valid.predict (ndarray of bool, shape (n_trials, n_times), optional) –
Which samples contribute an equation (a regression row) to a model fit, for example the samples inside beta bursts.
None(default) means every sample.A VAR model of order
puses the row at timetonly whenpredict[t]andvalid[t - p .. t]are allTrue(seedirconn.methods.mvar.lagged_design()). Masks that are allTrueare stored asNone. Estimators that cannot use the masks refuse masked data (MethodInfo.supports_mask).history (tuple of dict) – Steps that produced these data from a recording, oldest first, for example
lock(). Every estimator copies them into the provenance of its result (preprocessing["data_history"]). Must be JSON serialisable.
- __init__(data: ndarray, sfreq: float, channels: tuple[ChannelMeta, ...], segmentation: str, tmin: float = 0.0, valid: ndarray | None = None, predict: ndarray | None = None, history: tuple[dict[str, Any], ...] = ()) None#
Methods
__init__(data, sfreq, channels, segmentation)control_locks(eligible, n, tmin, tmax, *, seed)Draw
ncontrol epochs from eligible time points of a continuous record.from_array(data, sfreq, *[, names, ...])Build a time series from a numpy array.
from_mne(inst[, picks, nan, bad_annotations])Build a time series from an MNE
RaworEpochsobject.lock(events, tmin, tmax)Cut epochs around events of a continuous record.
mask_summary()Return the number of samples, valid samples and samples to predict, for provenance.
pick(channels)Return a series with only the selected channels, in the given order.
Attributes
durationDuration of one trial in seconds.
has_maskWhether the series has a
validor apredictmask.historyn_channelsNumber of channels.
n_timesNumber of samples per trial.
n_trialsNumber of trials (1 for continuous data).
namesChannel names in data order.
predicttminvaliddatasfreqchannelssegmentation