Exemple #1
0
    def test_eeg_absolute(self, subject, events_filename, expected_basenames):
        path = resource_filename("cmlreaders.test.data", events_filename)
        events = EventReader.fromfile(path)
        reader = EEGReader("eeg", subject)
        new_events = reader._eegfile_absolute(events)

        for eegfile in new_events[
                new_events["eegfile"].notnull()]["eegfile"].unique():
            assert eegfile in expected_basenames
Exemple #2
0
    def test_load_with_empty_events(self):
        sources_file = resource_filename("cmlreaders.test.data",
                                         "sources.json")
        with patch.object(PathFinder, "find", return_value=sources_file):
            reader = EEGReader("eeg")

            with pytest.raises(ValueError):
                data = np.random.random((10, 10, 10))
                with patch.object(RamulatorHDF5Reader,
                                  "read",
                                  return_value=[data, None]):
                    reader.load()
Exemple #3
0
    def test_rereference(self, reader_class, rerefable):
        """Test rereferencing without rhino by using known, fake data."""
        if reader_class == SplitEEGReader:
            eeg_path = self.to_split_eeg()

        if reader_class == RamulatorHDF5Reader:
            eeg_path = self.to_ramulator_hdf5(rerefable)

        scheme = pd.DataFrame({
            "contact_1": [1 + a for a in self.anodes],
            "contact_2": [1 + c for c in self.cathodes],
            "label": self.pair_labels,
        })

        with patch.object(PathFinder, "find", return_value=self.sources_path):
            reader = EEGReader("eeg", subject="R1111M")
            eeg = reader.load(events=self.events(str(eeg_path)),
                              rel_start=0,
                              rel_stop=self.data.shape[-1],
                              scheme=scheme)
            assert_equal(eeg.data[0], self.reref_data)