def test_FilterBankLeftRightImagery_paradigm(self): # can work with filter bank paradigm = FilterBankLeftRightImagery() dataset = FakeDataset(event_list=['left_hand', 'right_hand']) X, labels, metadata = paradigm.get_data(dataset, subjects=[1]) # X must be a 4D Array self.assertEqual(len(X.shape), 4) self.assertEqual(X.shape[-1], 6)
def test_FilterBankLeftRightImagery_paradigm(self): # can work with filter bank paradigm = FilterBankLeftRightImagery() dataset = FakeDataset(event_list=["left_hand", "right_hand"], paradigm="imagery") X, labels, metadata = paradigm.get_data(dataset, subjects=[1]) # X must be a 4D Array self.assertEqual(len(X.shape), 4) self.assertEqual(X.shape[-1], 6) # should return epochs epochs, _, _ = paradigm.get_data(dataset, subjects=[1], return_epochs=True) self.assertIsInstance(epochs, BaseEpochs)
# broadband filters filters = [[8, 35]] paradigm = LeftRightImagery(filters=filters) evaluation = CrossSessionEvaluation(paradigm=paradigm, datasets=datasets, suffix='examples', overwrite=overwrite) results = evaluation.process(pipelines) # cashed results might return other pipelines results = results[results.pipeline == 'CSP + LDA'] # bank of 6 filter, by 4 Hz increment filters = [[8, 12], [12, 16], [16, 20], [20, 24], [24, 28], [28, 35]] paradigm = FilterBankLeftRightImagery() evaluation = CrossSessionEvaluation(paradigm=paradigm, datasets=datasets, suffix='examples', overwrite=overwrite) results_fb = evaluation.process(pipelines_fb) ############################################################################### # After processing the two, we simply concatenate the results. results = pd.concat([results, results_fb]) ############################################################################## # Plot Results # ---------------- #
datasets = [BNCI2014001()] overwrite = False # set to True if we want to overwrite cached results # broadband filters fmin = 8 fmax = 35 paradigm = LeftRightImagery(fmin=fmin, fmax=fmax) evaluation = CrossSessionEvaluation(paradigm=paradigm, datasets=datasets, suffix='examples', overwrite=overwrite) results = evaluation.process(pipelines) # bank of 6 filter, by 4 Hz increment filters = [[8, 12], [12, 16], [16, 20], [20, 24], [24, 28], [28, 35]] paradigm = FilterBankLeftRightImagery(filters=filters) evaluation = CrossSessionEvaluation(paradigm=paradigm, datasets=datasets, suffix='examples', overwrite=overwrite) results_fb = evaluation.process(pipelines_fb) ############################################################################### # After processing the two, we simply concatenate the results. results = pd.concat([results, results_fb]) ############################################################################## # Plot Results # ---------------- #