예제 #1
0
    def test_FilterBankMotorImagery_paradigm(self):
        # can work with filter bank
        paradigm = FilterBankMotorImagery()
        dataset = FakeDataset(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)
예제 #2
0
    def test_FilterBankMotorImagery_paradigm(self):
        # can work with filter bank
        paradigm = FilterBankMotorImagery()
        dataset = FakeDataset(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)
예제 #3
0
    def test_filter_bank_mi(self):
        # can work with filter bank
        paradigm = FilterBankMotorImagery()
        dataset = FakeDataset()
        X, labels, metadata = paradigm.get_data(dataset, subjects=[1])

        # X must be a 3D Array
        self.assertEquals(len(X.shape), 4)
        self.assertEquals(X.shape[-1], 6)

        # 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 3D Array
        self.assertEquals(len(X.shape), 4)
        self.assertEquals(X.shape[-1], 6)
예제 #4
0
###############################################################################
# Paradigm object can also return the list of all dataset compatible. here
# it will return the list all the imagery datasets from the moabb.

compatible_datasets = paradigm.datasets
print([dataset.code for dataset in compatible_datasets])

###############################################################################
# FilterBank MotorImagery
# -----------------------
#
# FilterBankMotorImagery is the same paradigm, but with a different
# preprocessing. In this case, it apply a bank of 6 bandpass filter on the data
# before concatenating the output.

paradigm = FilterBankMotorImagery()

print(paradigm.__doc__)

###############################################################################
# therefore, the output X is a 4D array, with trial x channel x time x filter

X, y, metadata = paradigm.get_data(dataset=dataset, subjects=subjects)

print(X.shape)

###############################################################################
# LeftRight MotorImagery
# ----------------------
#
# LeftRightImagery is a variation over the BaseMotorImagery paradigm,