MCPcopy
hub / github.com/mne-tools/mne-python / RawArray

Class RawArray

mne/io/array/_array.py:14–96  ·  view source on GitHub ↗

Raw object from numpy array. Parameters ---------- data : array, shape (n_channels, n_times) The channels' time series. See notes for proper units of measure. %(info_not_none)s Consider using :func:`mne.create_info` to populate this structure. This may be modified in

Source from the content-addressed store, hash-verified

12
13@fill_doc
14class RawArray(BaseRaw):
15 """Raw object from numpy array.
16
17 Parameters
18 ----------
19 data : array, shape (n_channels, n_times)
20 The channels' time series. See notes for proper units of measure.
21 %(info_not_none)s Consider using :func:`mne.create_info` to populate
22 this structure. This may be modified in place by the class.
23 first_samp : int
24 First sample offset used during recording (default 0).
25
26 .. versionadded:: 0.12
27 copy : {'data', 'info', 'both', 'auto', None}
28 Determines what gets copied on instantiation. "auto" (default)
29 will copy info, and copy "data" only if necessary to get to
30 double floating point precision.
31
32 .. versionadded:: 0.18
33 %(verbose)s
34
35 See Also
36 --------
37 mne.EpochsArray
38 mne.EvokedArray
39 mne.create_info
40
41 Notes
42 -----
43 Proper units of measure:
44
45 * V: eeg, eog, seeg, dbs, emg, ecg, bio, ecog
46 * T: mag
47 * T/m: grad
48 * M: hbo, hbr
49 * Am: dipole
50 * AU: misc
51 """
52
53 @verbose
54 def __init__(self, data, info, first_samp=0, copy="auto", verbose=None):
55 _validate_type(info, "info", "info")
56 _check_option("copy", copy, ("data", "info", "both", "auto", None))
57 dtype = np.complex128 if np.any(np.iscomplex(data)) else np.float64
58 orig_data = data
59 data = np.asanyarray(orig_data, dtype=dtype)
60 if data.ndim != 2:
61 raise ValueError(
62 "Data must be a 2D array of shape (n_channels, n_samples), got shape "
63 f"{data.shape}"
64 )
65 if len(data) != len(info["ch_names"]):
66 raise ValueError(
67 'len(data) ({}) does not match len(info["ch_names"]) ({})'.format(
68 len(data), len(info["ch_names"])
69 )
70 )
71 assert len(info["ch_names"]) == info["nchan"]

Calls

no outgoing calls