Custom Post-processing and Custom Graphics

I often get requests from NeuroExplorer users asking to add something to numerical results (for example, add location of the second peak in the spectrum to summary of numerical results). Another long-standing request is to be able to add custom graphics commands NeuroExplorer graphs.

Let’s consider a spectrum example. Here is a result of Power Spectral Densities analysis:


It would be nice to be able to find the peaks in the spectra, draw ‘x’ marks at peak locations and add text labels showing peak frequencies:



All this can now be done using new post-processing options in NeuroExplorer. Double-click in the graph to invoke Analysis Properties dialog, then go to Post-processing tab and click ‘Post-Processing Script Options’ button:


Specify your script in the Post-Processing Script Options dialog:


// file contains script that was used to find peaks and add custom graphics commands shown above. Download file and extract the scripts to

C:\Users\<your_user_name>\Documents\NeuroExplorer 5\Scripts folder.

See also Analysis Functions/Set Property topic in NeuroExplorer help:


Showing Analog Signals in Spectrograms

sleep1_edf Spectrograms 001

NeuroExplorer 5.023 (released on December 16, 2015) adds a new option in Spectrogram Analysis – ability to draw analog signal above each spectrogram. The signal is drawn for the time values specified in the spectrogram X axis. It is recommended that the Spectrogram analysis option ‘X Axis corresponds to the Center of Sliding Window’ is used.

HDF5 Files in NeuroExplorer

Several open source projects (KlustaSuite, Neo, NIX, LBNL Brain, Orca, Neurodata Without Borders) utilize open source Hierarchical Data Format (HDF5) to store neurophysiological data. NeuroExplorer 5.023 (released on December 16, 2015) can import KlustaSuite .kwik files with data stored in HDF5 format.

If you are using any other HDF5-based file format and would like to import this file format directly in NeuroExplorer, send an e-mail to [email protected] With all the basic code to read data from HDF5 files in place, I can add import of another HDF5 file format to NeuroExplorer in a few days.

Python Scripting in NeuroExplorer

For many years, NeuroExplorer has had the capability to automate repetitive tasks:

  • Repeat analysis on all the data files in a folder,
  • Edit data or post-process analysis results without sending data or results to an external program

To support scripting, a custom NexScript language was developed. NexScript supports simple variables and has basic flow control capabilities. However, there are many limitations of NexScript that make writing scripts difficult. Adding new capabilities to NexScript (for example, adding support for arrays) would require a considerable effort. An alternative approach is to integrate existing programming language into NeuroExplorer.

We are pleased to announce that starting with version 5.022, NeuroExplorer scripts can also be written in Python.

NexScript - RepeatAnalysis2

Here are some of the benefits of using Python:

  • Python is very well documented
  • Shorter scripts
    • Access to NeuroExplorer data via Python lists eliminate many loops
    • User-defined functions replace repetitive code
  • Scripts can use thousands of Python functions

Old NexScript scripts can be automatically converted to Python using Tools | Convert to Python menu command in NexScript editor.

NeuroExplorer uses Python 2.7.10. There is no need to install Python. All the Python files needed for scripting are installed by NeuroExplorer setup program.

How to Store Analog Data

NeuroExplorer up to version 5.020 always stored analog data internally as 16-bit integers. The reason? Most data acquisition systems use analog to digital converters that have 12-bit or 16-bit resolution and store A/D data as 16-bit integers.

To display real signal values, we use scaling. For example, if analog to digital converter has input range from -1000mV to +1000mV and 10X amplification was used, then maximum 16-bit value 32767 corresponds to 1000mV/10 (non-amplified signal value). This means that 32767*ScalingFactor = 100, and ScalingFactor is 100.0/32767.

16-bit storage model seems perfect — we do not loose any signal resolution and we save on storage space. However, if we import data from Matlab (where the data values are stored as floating point numbers), we have to calculate ScalingFactor to fit floating point values into 16-bit range. As a result, we loose signal resolution (especially when the signal has a few large peaks and lots of small values).

There are also clipping issues when we try to modify signal values in NexScript. If we try to assign the value that is outside the original  non-amplified  range, we would have to clip the value since we have hard limits for 16-bit internal representation of signals.

Things, however, are changing with NeuroExplorer 5.021. Now NeuroExplorer can store analog data both as 16-bit integers and as 32-bit floating point numbers.

Analog signals imported from data files created by data acquisition system are still stored as 16-bit integers.

Continuous channels imported from Matlab or generated in NeuroExplorer (using frequency filtering, etc.) are now stored as 32-bit floating point values. Both data representations can be saved and loaded using .nex5 data files.

Matlab scripts for reading and writing .nex5 files ( have been updated and can be used to read and write .nex5 files with analog data stored as 32-bit floats.