- MNE version: 1.4.0
- operating system: Windows 10
I was wondering if there is a possibility to store different dtypes within a single raw object? It appears whenever I create a mne.io.RawArray, float64 dtype is created, even if I want ch_types to be “misc”, and input a bool data.
Here is a minimally produced code snippet:
import mne
import numpy as np
# generate a random 3 channel signal and store as raw object
random_signals = np.random.random((3,100))
info = mne.create_info(ch_names=["ch1", "ch2", "ch3"],
sfreq=10,
ch_types=(["eeg"]*3)
)
raw = mne.io.RawArray(data=random_signals,
info=info,
first_samp=0
)
>> Creating RawArray with float64 data, n_channels=3, n_times=100
Range : 0 ... 99 = 0.000 ... 9.900 secs
Ready.
# create a binary mask of same length to be stored as misc
random_mask = np.random.randint(0, 2, size=(1, random_signals.shape[1]), dtype=bool)
mask_info = mne.create_info(ch_names=["mask"],
sfreq=raw.info["sfreq"],
ch_types=["misc"]
)
raw_mask = mne.io.RawArray(data=random_mask,
info=mask_info,
first_samp=raw.first_samp
)
>> Creating RawArray with float64 data, n_channels=1, n_times=100
Range : 0 ... 99 = 0.000 ... 9.900 secs
Ready
# append to raw
raw.add_channels([raw_mask])
# check dtype
raw.get_data(picks="misc").dtype
>> dtype('float64')
I am hoping to store EEG data as float, but 1 misc channel as bool or int. Am I missing something or is storing different dtypes not supported?