Skip to content

Commit

Permalink
Provide descriptions for all actions
Browse files Browse the repository at this point in the history
  • Loading branch information
teekuningas committed Feb 22, 2024
1 parent 7efa777 commit 7d70c31
Show file tree
Hide file tree
Showing 50 changed files with 172 additions and 122 deletions.
50 changes: 0 additions & 50 deletions CONTRIBUTING.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ Compared to other tools like FieldTrip, MNE-Python, EEGLAB, Brainstorm, and mnel

Meggie can be changed and added to with plugins. If you know Python, you can create new features. This helps Meggie grow and helps everyone who uses it.

To learn more, see our [Developer Documentation](./developer-guide/development.md).
To learn more, see our [Developer Documentation](./developer-guide/architecture.md).
42 changes: 28 additions & 14 deletions docs/developer-guide/architecture.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
# Prerequisites
# Architecture Overview

This document provides a broad overview with some insights to how meggie is built and how that can be used for advantage.
This document outlines the core structure of Meggie, offering insights into its construction and how developers can leverage its architecture.

## Main classes
There are three basic structures in Meggie.
## Main Classes

Meggie is structured around three fundamental classes:

### MainWindow
MainWindow contains the user interface, and is implemented with PyQt5. The most important elements of the MainWindow are the left panel, holding experiment-specific information, the bottom console, which logs user actions, and the right panel, which contains the tabs that are used for data transformations.

MainWindow is the central hub of the user interface, built using PyQt5. Key components include:

- Left Panel: Displays experiment-specific details.
- Bottom Console: Logs user actions and system messages.
- Right Panel: Hosts tabs for data transformation actions.

### Experiment
Experiment contains the highest-level container for all the data. It implements logic for saving and loading experiments and stores subjects within it.

The Experiment class serves as the top-level container for all data, handling the saving and loading of experiments, and maintaining a collection of subjects.

### Subject
Subjects are added to experiments and store subject-specific data. Most importantly they are responsible for saving and loading the raw data, but they also store instances of datatypes.

## Actions, pipelines and datatypes
The analysis functionality is based on three key structures: actions, pipelines and datatypes.
Subject instances are nested within experiments and are tasked with managing subject-specific data. Their primary roles are to handle the saving and loading of raw data and to hold instances of various datatypes.

## Actions, Pipelines, and Datatypes

Meggie's analytical capabilities are structured into actions, pipelines, and datatypes.

### Datatypes
Often the raw data can be summarized in structures that capture the essential features for the purpose of analysis. For example, based on event information, the raw data can split into small segments of data that are averaged together to create event-related responses. These kind of structures, e.g. epochs, evokeds, spectrums, TFRs, that are instantiated from prespecified datatypes, can be stored within subjects. In meggie, these “blueprints” are all stored, declared and implemented in the datatypes folder.

Datatypes are templates for summarizing raw data into meaningful structures for analysis, such as epochs, evokeds, spectrums, and TFRs. These templates are defined within the datatypes folder and instantiated as needed to store within subjects.

### Actions
Actions are basic analysis steps such as “filter” or “create epochs”. In Meggie, each one of these is declared independently in its own folder within “actions” folder. Each action consists of metadata in “configuration.json” and python code. The entry point within the python code is assumed to inherit from the Action-class defined in mainwindow/dynamic.py. If done so, the actions can be embedded in pipelines, and are automatically logged in a backlog of actions.

Actions represent fundamental analysis steps, like "filter" or "create epochs." Each action, located in its respective folder within the actions directory, comprises metadata in configuration.json and Python code. Actions inherit from the Action class in mainwindow/dynamic.py and can be integrated into pipelines and are automatically logged.

### Pipelines
Pipelines are sets of actions arranged as buttons within tabs in the GUI and correspond to certain types of analyses from the beginning to the end such as “Sensor-level continuous data analysis” or “Source-level evoked response analysis”. These are declared in the main configuration.json and as they utilize the actions for implementations, they do not include any python code.

Pipelines organize actions into a sequence represented as buttons within the GUI tabs. They guide the user through a complete analysis workflow, such as "Sensor-level continuous data analysis." Pipelines are specified in the main configuration.json and rely on actions for implementation, thus containing no Python code themselves.

## Plugins
Creation of plugins is simple. Pipelines, datatypes and actions are dynamically located at the runtime and are loadable from other python packages from meggie namespace. Thus implementing a plugin corresponds to creating a python package (with name in the meggie namespace) which introduced pipelines, actions and/or datatypes.

Creating plugins for Meggie is designed to be straightforward. The system dynamically locates pipelines, datatypes, and actions at runtime, allowing them to be loaded from external Python packages within the Meggie namespace. To create a plugin, one simply needs to develop a Python package named within the Meggie namespace that introduces new pipelines, actions, and/or datatypes.

## API
We thrive to keep the core of Meggie, which covers everything but the actions, as stable and reusable as possible. Thus as a plugin developer, you are allowed to use the API of MainWindow, Subject and Experiment classes, the four datatypes provided in the datatypes folder, as well as the functions, dialogs and widgets stored in the utilities folder.

The core of Meggie, excluding the actions, is intended to be stable and reusable. Plugin developers are encouraged to utilize the API provided by the MainWindow, Subject, and Experiment classes. Additionally, developers have access to the four datatypes in the datatypes folder and various utilities, including functions, dialogs, and widgets, found in the utilities folder.
9 changes: 7 additions & 2 deletions docs/developer-guide/development.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# Plugin development
Contents be here.
# Development

## Setting up

For an example of a basic plugin template, please visit [Meggie Simple Plugin](https://github.com/cibr-jyu/meggie_simpleplugin) on GitHub.

Actions, pipelines, and datatypes function identically, regardless of whether they originate from a plugin or from the core of Meggie. Therefore, examining the implementations within the Meggie repository is advisable for understanding their integration and usage.
2 changes: 0 additions & 2 deletions docs/developer-guide/setting-up.md

This file was deleted.

10 changes: 5 additions & 5 deletions docs/user-guide/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

Actions serve as the primary analytical tools within Meggie. Upon establishing an experiment and incorporating the raw data files for each subject, these actions are systematically employed to progressively convert the raw magnetic or electric signals into meaningful behavioral outcomes. Below is a catalog of the available actions along with their respective descriptions.

## Actions for preprocessing raw data
## Preprocessing

{{ACTIONS_RAW}}

## Actions for spectral analysis of continuous data
## Continuous data

{{ACTIONS_SPECTRUM}}

## Actions for epoch collections
## Epochs

{{ACTIONS_EPOCHS}}

## Actions for evoked response analysis
## Evoked responses

{{ACTIONS_EVOKED}}

## Actions for induced response analysis
## Induced responses (TFR)

{{ACTIONS_TFR}}
40 changes: 38 additions & 2 deletions docs/user-guide/experiments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
# Experiments
# Experiments in Meggie

Contents be here.
This section provides a straightforward overview of Meggie's layout and the steps for starting and managing experiments with subjects.

## Layout Overview

Meggie's interface is organized into two main columns:

- Left Column: This area is your control panel for the experiment. Here, you add new subjects to your experiment and adjust settings like channel groups. It's the organizational hub for your data.

- Right Column: This column contains the analysis tools, referred to as actions, which you'll apply to your data. These tools are arranged in tabs and are used to process the data step by step.

## Starting an Experiment

Begin by creating an experiment where you'll enter basic information such as the experiment's name and the person conducting it. You'll also choose a pipeline that fits your research needs. This helps keep the interface focused and guides you through the necessary steps. A folder for the experiment will be created to store all related files.

## Adding Subjects

After setting up your experiment, you can add subjects, which are your individual recordings, using the "Add new..." option in the left column.

## Applying Actions

In the right column, you'll find the actions you can apply to your data. These actions are designed to be used on all your subjects at once, making it efficient to process multiple datasets.

## Preprocessing

Meggie includes basic preprocessing features to improve the quality of your data. You can remove unwanted noise and apply filters to clean up the signals before further analysis.

## Working with EEG and MEG Data

Meggie is equipped to handle both EEG and MEG data. For EEG, it offers tools to add sensor locations and adjust channel references when necessary.

## Managing Events

Events, which are significant points in your recordings, can be managed within Meggie. This ensures you have control over important data points for analysis.

## Progressing Through Analysis

The goal is to transform raw recordings into data that can inform your research. You'll use actions to move through analysis stages, each tailored to bring out specific features of your data.
10 changes: 5 additions & 5 deletions docs/user-guide/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Installation

Meggie does not have standalone installers, but it can be easily installed on Windows, macOS, or Linux systems with Python 3.9 or higher using either of the following methods:

## Using conda

Install meggie to a conda environment:
```bash
$ conda create -n meggie-env -c conda-forge meggie=={{VERSION}}
```

### Using pip:

Create a virtual environment:
Create a virtual environment folder:
```bash
$ python -m venv meggie-env
```
Activate the environment:
```bash
$ source .meggie-env/bin/activate
$ source meggie-env/bin/activate
```
Install dependencies:
```bash
Expand All @@ -32,7 +32,7 @@ Activate the environment in which Meggie was installed. For conda:
```bash
conda activate meggie-env
```
For pip:
Or, for pip:
```bash
source meggie-env/bin/activate
```
Expand Down
2 changes: 1 addition & 1 deletion meggie/actions/epochs_create/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"id": "epochs_create",
"name": "Create epochs",
"entry": "CreateEpochs",
"description": "This action is used to create new epoch collections for the selected subject."
"description": "Create a new epoch collection for the current subject."
}
2 changes: 1 addition & 1 deletion meggie/actions/epochs_delete/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"id": "epochs_delete",
"name": "Delete",
"entry": "DeleteEpochs",
"description": "This action is used to delete epoch collections from the selected subject."
"description": "Permanently remove the selected epoch collection from the current subject."
}
3 changes: 2 additions & 1 deletion meggie/actions/epochs_delete_from_all/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "epochs_delete_from_all",
"name": "Delete from all",
"entry": "DeleteEpochsFromAll"
"entry": "DeleteEpochsFromAll",
"description": "Permanently remove the selected epoch collection from all matching subjects."
}
3 changes: 2 additions & 1 deletion meggie/actions/epochs_info/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "epochs_info",
"name": "Epochs info",
"entry": "Info"
"entry": "Info",
"description": "Extract information about the selected epoch collection."
}
3 changes: 2 additions & 1 deletion meggie/actions/epochs_plot/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "epochs_plot",
"name": "Plot",
"entry": "PlotEpochs"
"entry": "PlotEpochs",
"description": "Generate a simple plot for the selected epoch collection."
}
3 changes: 2 additions & 1 deletion meggie/actions/epochs_plot_image/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "epochs_plot_image",
"name": "Plot image",
"entry": "PlotEpochsImage"
"entry": "PlotEpochsImage",
"description": "Generate an image plot for the selected epoch collection."
}
3 changes: 2 additions & 1 deletion meggie/actions/evoked_create/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "evoked_create",
"name": "Create evoked",
"entry": "CreateEvoked"
"entry": "CreateEvoked",
"description": "Compute the average of selected epoch collections independently. Each collection is averaged separately, resulting in a distinct average curve for each."
}
3 changes: 2 additions & 1 deletion meggie/actions/evoked_delete/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "evoked_delete",
"name": "Delete",
"entry": "DeleteEvoked"
"entry": "DeleteEvoked",
"description": "Permanently remove the selected evoked response object from the current subject."
}
3 changes: 2 additions & 1 deletion meggie/actions/evoked_delete_from_all/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "evoked_delete_from_all",
"name": "Delete from all",
"entry": "DeleteEvokedFromAll"
"entry": "DeleteEvokedFromAll",
"description": "Permanently remove the selected evoked response object from all matching subjects."
}
3 changes: 2 additions & 1 deletion meggie/actions/evoked_group_average/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "evoked_group_average",
"name": "Average over subjects",
"entry": "GroupAverage"
"entry": "GroupAverage",
"description": "Calculate the average of the selected evoked response object across subjects, with options to group subjects before averaging."
}
3 changes: 2 additions & 1 deletion meggie/actions/evoked_info/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "evoked_info",
"name": "Evoked info",
"entry": "Info"
"entry": "Info",
"description": "Extract information about the selected evoked response."
}
3 changes: 2 additions & 1 deletion meggie/actions/evoked_plot/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "evoked_plot",
"name": "Plot",
"entry": "PlotEvoked"
"entry": "PlotEvoked",
"description": "Generate a plot for the selected evoked response object. The response may be visualized for all channels individually or as an average across specified channel groups."
}
3 changes: 2 additions & 1 deletion meggie/actions/evoked_plot_topomap/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "evoked_plot_topomap",
"name": "Plot topomaps",
"entry": "PlotEvokedTopomap"
"entry": "PlotEvokedTopomap",
"description": "Produce a series of topographical maps at specified time intervals for the selected evoked response object."
}
3 changes: 2 additions & 1 deletion meggie/actions/evoked_save/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "evoked_save",
"name": "Save to csv",
"entry": "SaveEvoked"
"entry": "SaveEvoked",
"description": "Export the numerical data from the evoked response object for all matching subjects into a CSV file."
}
3 changes: 2 additions & 1 deletion meggie/actions/raw_event_info/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "raw_event_info",
"name": "Event info",
"entry": "Info"
"entry": "Info",
"description": "Extract event information from the raw data."
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "raw_events_from_annotations",
"name": "Events from annotations",
"entry": "EventsFromAnnotations"
"entry": "EventsFromAnnotations",
"description": "Create events from annotations for further analysis."
}
3 changes: 2 additions & 1 deletion meggie/actions/raw_filter/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "raw_filter",
"name": "Filter",
"entry": "Filter"
"entry": "Filter",
"description": "Apply low-pass, high-pass, band-pass, and band-stop filters to raw data to isolate specific frequency ranges or remove unwanted frequencies."
}
3 changes: 2 additions & 1 deletion meggie/actions/raw_ica/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "raw_ica",
"name": "Artifact removal",
"entry": "ICA"
"entry": "ICA",
"description": "Apply Independent Component Analysis (ICA) to raw data to identify and remove artifacts such as heartbeats and eye blinks."
}
3 changes: 2 additions & 1 deletion meggie/actions/raw_measurement_info/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "raw_measurement_info",
"name": "Measurement info",
"entry": "Info"
"entry": "Info",
"description": "Extract measurement information from the raw data."
}
1 change: 1 addition & 0 deletions meggie/actions/raw_montage/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"id": "raw_montage",
"name": "Montage",
"entry": "Montage",
"description": "Apply a montage to the EEG dataset, enabling the creation of topographical plots.",
"tags": ["eeg"]
}
Loading

0 comments on commit 7d70c31

Please sign in to comment.