diff --git a/meggie/actions/evoked_create/tests/test_evoked_create.py b/meggie/actions/evoked_create/tests/test_evoked_create.py new file mode 100644 index 00000000..6a64fb60 --- /dev/null +++ b/meggie/actions/evoked_create/tests/test_evoked_create.py @@ -0,0 +1,18 @@ +from meggie.utilities.testing import BaseTestAction +from meggie.actions.evoked_create import CreateEvoked +from meggie.utilities.dialogs.simpleDialogMain import SimpleDialog + + +class TestEvokedCreate(BaseTestAction): + def test_evoked_create(self): + + data = {"inputs": {"epochs": ["Epochs"]}} + + self.run_action( + action_name="evoked_create", + handler=CreateEvoked, + data=data, + patch_paths=["meggie.utilities.dialogs.simpleDialogMain"], + ) + dialog = self.find_dialog(SimpleDialog) + dialog.accept() diff --git a/meggie/actions/evoked_delete/tests/test_evoked_delete.py b/meggie/actions/evoked_delete/tests/test_evoked_delete.py new file mode 100644 index 00000000..04021af0 --- /dev/null +++ b/meggie/actions/evoked_delete/tests/test_evoked_delete.py @@ -0,0 +1,15 @@ +from meggie.utilities.testing import BaseTestAction +from meggie.actions.evoked_delete import DeleteEvoked + + +class TestEvokedDelete(BaseTestAction): + def test_evoked_delete(self): + + data = {"outputs": {"evoked": ["Evoked"]}} + + self.run_action( + action_name="evoked_delete", + handler=DeleteEvoked, + data=data, + patch_paths=["meggie.actions.evoked_delete"], + ) diff --git a/meggie/actions/evoked_delete_from_all/tests/test_epochs_delete_from_all.py b/meggie/actions/evoked_delete_from_all/tests/test_epochs_delete_from_all.py new file mode 100644 index 00000000..b729acdc --- /dev/null +++ b/meggie/actions/evoked_delete_from_all/tests/test_epochs_delete_from_all.py @@ -0,0 +1,15 @@ +from meggie.utilities.testing import BaseTestAction +from meggie.actions.evoked_delete_from_all import DeleteEvokedFromAll + + +class TestEvokedDeleteFromAll(BaseTestAction): + def test_evoked_delete_from_all(self): + + data = {"outputs": {"evoked": ["Evoked"]}} + + self.run_action( + action_name="evoked_delete_from_all", + handler=DeleteEvokedFromAll, + data=data, + patch_paths=["meggie.actions.evoked_delete_from_all"], + ) diff --git a/meggie/utilities/generate_experiments.py b/meggie/utilities/generate_experiments.py index ec1d70a9..0eccfdb5 100644 --- a/meggie/utilities/generate_experiments.py +++ b/meggie/utilities/generate_experiments.py @@ -15,6 +15,7 @@ from meggie.utilities.events import find_events from meggie.utilities.events import find_stim_channel from meggie.datatypes.epochs.epochs import Epochs +from meggie.datatypes.evoked.evoked import Evoked def create_experiment( @@ -149,7 +150,7 @@ def create_test_experiment(experiment_folder, experiment_name, n_subjects=2): experiment_folder, experiment_name, n_subjects=n_subjects ) - # create trivial epochs + # create trivial content for subject in experiment.subjects.values(): raw = subject.get_raw() stim_channel = find_stim_channel(raw) @@ -163,6 +164,7 @@ def create_test_experiment(experiment_folder, experiment_name, n_subjects=2): } category = {"1": 1, "2": 2} + # create epochs mne_epochs = mne.Epochs( raw, events, @@ -171,12 +173,20 @@ def create_test_experiment(experiment_folder, experiment_name, n_subjects=2): tmax=params["tmax"], baseline=(params["bstart"], params["bend"]), ) - epochs_directory = subject.epochs_directory epochs = Epochs("Epochs", epochs_directory, params, content=mne_epochs) epochs.save_content() subject.add(epochs, "epochs") + # create evoked + mne_evoked = mne_epochs.average() + params = {"conditions": ["epochs"]} + content = {"epochs": mne_evoked} + evoked_directory = subject.evoked_directory + evoked = Evoked("Evoked", evoked_directory, params, content=content) + evoked.save_content() + subject.add(evoked, "evoked") + return experiment