def _initialize(self): if not self.source_name: raise ValueError("Please set LSL stream name.") stream_infos = lsl.resolve_byprop( "name", self.source_name, timeout=self.SECONDS_TO_WAIT_FOR_THE_STREAM, ) if len(stream_infos) == 0: raise ValueError("Cannot find LSL stream with name {}".format( self.source_name)) elif len(stream_infos) > 1: raise ValueError("Multiple LSL streams with name {}.".format( self.source_name)) else: info = stream_infos[0] self._inlet = _FixedStreamInlet(info) self._inlet.open_stream() frequency = info.nominal_srate() self.dtype = DTYPE channel_labels, channel_types = read_channel_labels_from_info( self._inlet.info()) self.mne_info = mne.create_info(channel_labels, frequency, ch_types=channel_types) capitalize_chnames(self.mne_info) self.timestamps = []
def _initialize(self): self._time_of_the_last_update = None self._n_samples_already_read = 0 if self.file_path is not None: basename = os.path.basename(self.file_path) _, ext = os.path.splitext(basename) if ext in self.SUPPORTED_EXTENSIONS["Brainvision"]: self.data, self.mne_info, self.times = read_brain_vision_data( file_path=self.file_path, time_axis=TIME_AXIS) elif ext in self.SUPPORTED_EXTENSIONS["MNE-python"]: self.data, self.mne_info, self.times = read_fif_data( file_path=self.file_path, time_axis=TIME_AXIS) elif ext in self.SUPPORTED_EXTENSIONS["European Data Format"]: self.data, self.mne_info, self.times = read_edf_data( file_path=self.file_path, time_axis=TIME_AXIS) else: raise ValueError("Cannot read {}.".format(basename) + "Extension must be one of the following: {}". format(self.SUPPORTED_EXTENSIONS.values())) self.dtype = DTYPE self.data = self.data.astype(self.dtype) self.timestamps = [] capitalize_chnames(self.mne_info) else: exc = ValueError("File path is not set.") self._logger.exception(exc) raise exc
def info(scope="session"): """Get info with applied average projection""" logging.basicConfig(filename=None, level=logging.INFO) dloader = DataDownloader() info_src_path = dloader.get_file("Koleno_raw.fif") raw = Raw(info_src_path, preload=True) raw.set_eeg_reference("average", projection=True) capitalize_chnames(raw.info) return raw.info
def _initialize(self): self.nchan = self._mne_info["nchan"] self.mne_info = self._mne_info capitalize_chnames(self.mne_info)
def create_dummy_info(nchan=32, sfreq=500): ch_names = [str(i).zfill(2) for i in range(nchan)] info = create_info(ch_names, sfreq, ch_types="eeg") capitalize_chnames(info) return info