Skip to content

Commit 96af32e

Browse files
authored
Merge pull request #84 from open-ephys/update-python-processor-docs
Update Python Processor documentation and images
2 parents 945fb2d + f3e78f8 commit 96af32e

File tree

4 files changed

+43
-60
lines changed

4 files changed

+43
-60
lines changed

source/User-Manual/Plugins/CNN-Ripple.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ More information
5454

5555
A more detailed characterization of this plugin's performance can be found in the following publication:
5656

57-
Andrea Navas-Olive, Rodrigo Amaducci, Maria-Teresa Juardo-Parras, Enrique R Sebastian, and Liset M de la Prida (2022) `"Deep learning based feature extraction for prediction and interpretation of sharp-wave ripples in the rodent hippocampus" <https://elifesciences.org/articles/77772v1>`__ *eLife* **11**: e77772
57+
Andrea Navas-Olive, Rodrigo Amaducci, Maria-Teresa Juardo-Parras, Enrique R Sebastian, and Liset M de la Prida (2022) `"Deep learning based feature extraction for prediction and interpretation of sharp-wave ripples in the rodent hippocampus" <https://elifesciences.org/articles/77772>`__ *eLife* **11**: e77772
5858

5959
If you use this plugin in your work, be sure to cite this article!

source/User-Manual/Plugins/Python-Processor.rst

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@ Python Processor
2222
Installing and upgrading
2323
###########################
2424

25-
The Python Processor is not yet released for version 1.0 of the Open Ephys GUI. An announcement will be made via Discord/Slack when it's available for download via Plugin Installer.
25+
The Python Processor plugin is not included by default in the Open Ephys GUI. To install, use ctrl-P or ⌘P to open the Plugin Installer, browse to the "Python Processor" plugin, and click the "Install" button.
26+
27+
The Plugin Installer also allows you to upgrade to the latest version of this plugin, if it's already installed.
28+
2629

2730
Setting up a Python environment
2831
####################################
2932

3033
This plugin must be able to find a local installation of Python version **3.10** with :code:`numpy` installed correctly.
3134

32-
To avoid conflicts with other Python installations, we recommend using `Conda <https://docs.conda.io/projects/conda/en/stable/index.html>`__ to manage your Python environments. You can install Conda either using Miniconda or Anaconda by following the instructions `here <https://docs.conda.io/projects/conda/en/stable/user-guide/install/download.html>`__. More information on how to use Conda can be found `here <https://docs.conda.io/projects/conda/en/stable/user-guide/getting-started.html>`__.
33-
34-
.. important:: On macOS, conda needs to be installed using the x86_64 Miniconda / Anaconda installer.
35+
To avoid conflicts with other Python installations, we recommend using `Conda <https://docs.conda.io/projects/conda/en/stable/index.html>`__ to manage your Python environments. You can install Conda either using Miniconda or Anaconda by following the instructions `here <https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html>`__. More information on how to use Conda can be found `here <https://docs.conda.io/projects/conda/en/stable/user-guide/getting-started.html>`__.
3536

3637
To create a new Conda environment that uses Python 3.10, enter the following :code:`conda` command in your Anaconda prompt (Windows) or Terminal (Linux and macOS):
3738

@@ -51,32 +52,26 @@ After this, :code:`numpy` needs to be installed in the same environment as follo
5152
5253
conda install numpy
5354
54-
.. important:: On Windows, if you use :code:`pip` to install Python packages, the plugin will fail to load your Python module. We are still investigating the cause of this issue.
55-
5655
5756
Setting the Python Interpreter Path
5857
-------------------------------------
5958

60-
Once a dedicated Python 3.10 Conda environment has been created, the plugin is ready to be loaded into any desired signal chain. As soon as the plugin is dropped into the signal chain, it asks for the path to Python Home directory, which is where the Python Interpreter is located. This allows the plugin to be flexible in terms of which Python libraries to use during runtime, and not rely on the system PATH to figure out the Python Home location.
61-
62-
When using Conda, this path is usually where the Conda environment got created. Some examples of where it may be located:
63-
64-
* Windows: :code:`C:\\Users\\<username>\\miniconda3` or :code:`C:\\miniconda3`
65-
66-
* macOS - :code:`~/miniconda3` or :code:`/Users/<username>/miniconda3`
59+
After creating a dedicated Python 3.10 Conda environment, you can add the plugin to any signal chain. When inserted, the plugin prompts you to select the Python Home directory—the location of the Python interpreter. Providing this path lets the plugin use libraries from a specific environment at runtime, without relying on the system PATH.
6760

68-
* Linux - :code:`~/miniconda3` or :code:`/home/<username>/miniconda3`
61+
With Conda, this is typically the path to the environment's Python interpreter inside Conda's installation directory. For example, if you created an environment named :code:`oe-python-plugin`, the path would be:
6962

70-
The Python image in a Conda environment called “oe-python-plugin” might be in a location such as :code:`${USERHOME}\\miniconda3\\envs\\oe-python-plugin`
63+
* Windows: :code:`C:\\Users\\<username>\\miniconda3\\envs\\oe-python-plugin`
64+
* macOS - :code:`~/miniconda3/envs/oe-python-plugin`
65+
* Linux - :code:`~/miniconda3/envs/oe-python-plugin`
7166

72-
If you have installed Anaconda instead of Miniconda, the folder might be named :code:`Anaconda` or :code:`Anaconda3`.
67+
If you installed Anaconda instead of Miniconda, the folder may be named :code:`Anaconda` or :code:`Anaconda3`.
7368

74-
Once the path is selected, the plugin should load into the signal chain successfully. If it fails to load the Python Interpreter, then it will ask for the PATH to Python Home again. This means that either the provided PATH was incorrect, or an incompatible version of Python was installed (i.e., not 3.10). If this happens, it is recommended to close and relaunch the GUI to reset the PATH variables.
69+
After you select the path, the plugin should load into the signal chain. If it cannot load the interpreter, it will prompt for the Python Home path again—this usually indicates an incorrect path or an incompatible Python version (not 3.10). If the problem persists, close and relaunch the GUI to reset the PATH variables.
7570

7671
Creating & loading a Python Module
7772
####################################
7873

79-
Once the plugin is loaded into the signal chain, a Python module (script) needs to be loaded into the GUI. This module should take the same form as the `processor template <https://github.com/open-ephys-plugins/python-processor/blob/main/Modules/template/processor_template.py>`__ provided in the plugin's GitHub repository. The :code:`PyProcessor` class is designed to expose the following functions to the Python module to allow interaction with the incoming data:
74+
After the plugin is added to the signal chain, you must load a Python module (script) into the GUI. This script should follow the structure of the `processor template <https://github.com/open-ephys-plugins/python-processor/blob/main/Modules/template/processor_template.py>`__ available in the plugin's GitHub repository. The :code:`PyProcessor` class provides the following functions to the Python module, enabling interaction with incoming data:
8075

8176
.. py:method:: __init__(processor, num_channels, sample_rate)
8277
@@ -136,25 +131,30 @@ Using this template, any type of data processing can be done in Python in real-t
136131

137132
.. Note:: Pay careful attention to the latency introduced by processing data in Python, especially with high-channel-count data.
138133

134+
----------------------
139135

140-
There is also a way to send TTL events back from Python to C++. These events will be added to the event buffer for the downstream processors to handle. It is possible using a C++ function exposed to the Python module via an embedded module called :code:`oe_pyprocessor`.
136+
You can also send TTL events from Python back to C++. These events are added to the event buffer and can be processed by downstream plugins. This is accomplished using a C++ function exposed to Python through the embedded :code:`oe_pyprocessor` module.
141137

142138
.. py:method:: add_python_event(line, state)
143-
144-
Send TTL event from Python to C++
145-
139+
140+
Sends a TTL event from Python to C++.
141+
146142
:param int line: event line number [0-255]
147143
:param bool state: event state True (ON) or False (OFF)
148144

149-
To use this function, the :code:`oe_pyprocessor` module needs to be imported inside the script and then the C++ function can be invoked by using the processor object provided in the :py:meth:`__init__` method, like this: :code:`self.processor.add_python_event(line, state)`
145+
To use this function, import the :code:`oe_pyprocessor` module in your script. Then, call the C++ function using the processor object provided in the :py:meth:`__init__` method, for example: :code:`self.processor.add_python_event(line, state)`
146+
147+
----------------------
150148

151-
An example script is provided in the plugin's GitHub repository in the form of a `Butterworth Bandpass filter <https://github.com/open-ephys-plugins/python-processor/blob/main/Modules/examples/bandpass_filter.py>`__. This filter is the same as the one used in the GUI's built-in Filter Node plugin.
149+
An example script is provided in the plugin's GitHub repository in the form of a `Butterworth Bandpass filter <https://github.com/open-ephys-plugins/python-processor/blob/main/Modules/examples/bandpass_filter.py>`__. This filter is the same as the one used in the GUI's built-in :ref:`bandpassfilter` plugin.
152150

153151
Limitations
154152
######################
155153

156154
* Unlike continuous data and events, sending spikes back from Python is not currently possible.
157155

156+
* With increasing channel counts, the processing latency may also increase, potentially affecting real-time performance.
157+
158158
* Only one instance of the plugin is allowed at a time in a signal chain. Having multiple instances of the plugin in the same signal chain will result in random crashes.
159159

160160
* Creating visualizations in real-time using Python libraries such as :code:`matplotlib` is not possible.
-10.9 KB
Loading

source/_static/images/plugins/pythonprocessor/pythonprocessor.svg

Lines changed: 18 additions & 35 deletions
Loading

0 commit comments

Comments
 (0)