neurotic

Curate, visualize, annotate, and share your behavioral ephys data using Python

PyPI project Anaconda Cloud project GitHub source code conda-forge feedstock Documentation status Travis build status conda-forge build status Coverage status

Version: 1.2.1 (other versions)

neurotic is an app for Windows, macOS, and Linux that allows you to easily review and annotate your electrophysiology data and simultaneously captured video. It is an easy way to load your Neo-compatible data (see neo.io for file formats) into ephyviewer without doing any programming. Share a single metadata file with your colleagues and they too will quickly be looking at the same datasets!

Screenshot

Overview

To use neurotic, first organize your datasets in a metadata file like this (see Configuring Metadata):

my favorite dataset:
    description: This time it actually worked!

    data_dir:           C:\local_dir_containing_files
    remote_data_dir:    http://myserver/remote_dir_containing_downloadable_files  # optional
    data_file:          data.axgx
    video_file:         video.mp4
    # etc

    video_offset: -3.4  # seconds between start of video and data acq
    epoch_encoder_possible_labels:
        - label01
        - label02
    plots:
        - channel: I2
          ylim: [-30, 30]
        - channel: RN
          ylim: [-60, 60]
        # etc

    filters:  # used only if fast loading is off (lazy=False)
        - channel: Force
          lowpass: 50
        # etc
    amplitude_discriminators:  # used only if fast loading is off (lazy=False)
        - name: B3 neuron
          channel: BN2
          units: uV
          amplitude: [50, 100]
        # etc

another dataset:
    # etc

Open your metadata file in neurotic and choose a dataset. If the data and video files aren’t already on your local computer, the app can download them for you, even from a password-protected server. Finally, click launch and the app will use a standard viewer layout to display your data to you using ephyviewer.

Screenshot

(Pictured above is a voracious Aplysia californica in the act of making the researcher very happy.)

The viewers are easy and intuitive to navigate (see User Interface):

  • Pressing the play button will scroll through your data and video in real time, or at a higher or lower rate if the speed parameter is changed.
  • The arrow/WASD keys allow you to step through time in variable increments.
  • Jump to a time by clicking on an event in the event list or a table entry in the epoch encoder.
  • To show more or less time at once, right-click and drag right or left to contract or expand time.
  • Scroll the mouse wheel in the trace viewer or video viewer to zoom.
  • The epoch encoder can be used to block out periods of time during which something interesting is happening for later review or further analysis (saved to a CSV file).
  • All panels can be hidden, undocked, stacked, or repositioned on the fly.

Electrophysiologists will find this tool useful even if they don’t need the video synchronization feature!

Portability is easy with neurotic! Use relative paths in your metadata file along with a remotely accessible data store such as GIN to make your metadata file fully portable. The same metadata file can be copied to a different computer, and downloaded files will automatically be saved to the right place. Data stores can be password protected and neurotic will prompt you for a user name and password. This makes it easy to share the neurotic experience with your colleagues! 🤪

Installation

neurotic requires Python 3.6 or later.

Note that the latest release of one of neurotic’s dependencies, pyqtgraph 0.10.0, is incompatible with Python 3.8 or later on Windows unless that dependency is installed via conda-forge (recommended method) (details).

Alternate Method using pip

Installation of neurotic via pip will install nearly all of its dependencies automatically, with one exception. neurotic requires PyAV, which is not easily installed with pip on some systems, especially Windows. The easiest way to install PyAV is using conda:

conda install -c conda-forge av

Install the latest release version of neurotic from PyPI using

pip install -U neurotic

or install the latest development version from GitHub using

pip install -U git+https://github.com/jpgill86/neurotic.git

Note that if you install the development version, you may also need the latest development version of ephyviewer, which you can get using

pip install -U git+https://github.com/NeuralEnsemble/ephyviewer.git

Getting Started

If you installed neurotic into a conda environment, first activate it:

conda activate <environment name>

Launch the app from the command line:

neurotic

A simple example is provided. Select the “example dataset”, download the associated data (~7 MB), and then click “Launch”. See User Interface for help with navigation.

Disabling “Fast loading” before launch will enable additional features including amplitude-threshold spike detection and signal filtering.

To inspect the metadata file associated with the example or to make changes to it, click “Edit metadata”. See Configuring Metadata for details about the format.

If you prefer Jupyter notebooks, you can launch an example notebook instead for experimenting with neurotic’s API:

neurotic --launch-example-notebook

The command line interface accepts other arguments too:

usage: neurotic [-h] [-V] [--no-lazy] [--thick-traces] [--show-datetime]
                [--theme {light,dark,original,printer-friendly}]
                [--launch-example-notebook]
                [file] [dataset]

neurotic lets you curate, visualize, annotate, and share your behavioral ephys
data.

positional arguments:
  file                  the path to a metadata YAML file (default: an example
                        file)
  dataset               the name of a dataset in the metadata file to select
                        initially (default: the first entry in the metadata
                        file)

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  --no-lazy             do not use fast loading (default: use fast loading)
  --thick-traces        enable support for traces with thick lines, which has
                        a performance cost (default: disable thick line
                        support)
  --show-datetime       display the real-world date and time, which may be
                        inaccurate depending on file type and acquisition
                        software (default: do not display)
  --theme {light,dark,original,printer-friendly}
                        a color theme for the GUI (default: light)
  --launch-example-notebook
                        launch Jupyter with an example notebook instead of
                        starting the standalone app (other args will be
                        ignored)

Configuring Metadata

To load your data with neurotic, you must organize them in one or more YAML files, called metadata files.

YAML files are very sensitive to punctuation and indentation, so mind those details carefully! Importantly, the tab character cannot be used for indentation; use spaces instead. There are many free websites that can validate YAML for you.

You may include comments in your metadata file, which should begin with #.

Top-Level Organization

Datasets listed within the same metadata file must be given unique names, which may include spaces. The special name neurotic_config is reserved for neurotic configuration settings and cannot be used for datasets.

In addition to names, a long description can be provided for each dataset.

Details pertaining to each dataset, including the description, are nested beneath the dataset name using indentation. You may need to use double quotes around names, descriptions, or other text if they contain special characters (such as : or #) or are composed only of numbers (such as a date).

experiment 2020-01-01:
    description: Both the name and description will be visible when neurotic loads the metadata
    # other details about this dataset will go here

my favorite dataset:
    description: This time it actually worked!
    # other details about this dataset will go here

Specifying Data Locations

Within a dataset’s YAML block, paths to data and video files should be provided.

All files associated with a dataset should be collected into a single directory. A path to the local copy of this directory must be provided using the data_dir key. You may specify data_dir as an absolute path (e.g., C:\Users\me\folder) or as a path relative to the metadata file (e.g., folder).

Paths to individual files within the dataset are provided using keys listed below. These paths should be given relative to data_dir. If data_dir is flat (no subdirectories), these should be simply the file names. Only data_file is required.

Key Description
data_file A single Neo-compatible data file (see neo.io for file formats)
video_file A video file that can be synchronized with data_file
annotations_file A CSV file for read-only annotations
epoch_encoder_file A CSV file for annotations writable by the epoch encoder
tridesclous_file A CSV file output by tridesclous’s DataIO.export_spikes

Note that the annotations_file must contain exactly 4 columns with these headers: “Start (s)”, “End (s)”, “Type”, and “Label”.

The epoch_encoder_file must contain exactly 3 columns with these headers: “Start (s)”, “End (s)”, and “Type”. (The fourth column is missing because ephyviewer’s epoch encoder is currently unable to attach notes to individual epochs; this may be improved upon in the future.)

The tridesclous_file is described in more detail in tridesclous Spike Sorting Results.

Remote Data Available for Download

Data files must be stored on the local computer for neurotic to load them and display their contents. If the files are available for download from a remote server, neurotic can be configured to download them for you to the local directory specified by data_dir if the files aren’t there already.

Specify the URL to the directory containing the data on the remote server using remote_data_dir. neurotic expects the local data_dir and the remote_data_dir to have the same structure and will mirror the remote_data_dir in the local data_dir when you download data (not a complete mirror, just the specified files).

For an example, consider the following:

my favorite dataset:
    data_dir:           C:\Users\me\folder
    remote_data_dir:    http://myserver/remote_folder
    data_file:          data.axgx
    video_file:         video.mp4

With a metadata file like this, the file paths data_file and video_file are appended to remote_data_dir to obtain the complete URLs for downloading these files, and they will be saved to the local data_dir.

If you have many datasets hosted by the same server, you can specify the server URL just once using the special remote_data_root key, which should be nested under the reserved name neurotic_config outside of any dataset’s YAML block. This allows you to provide for each dataset a partial URL to a folder in remote_data_dir which is relative to remote_data_root. For example:

neurotic_config:  # reserved name for global settings
    remote_data_root:   http://myserver

my favorite dataset:
    data_dir:           C:\Users\me\folder1
    remote_data_dir:    remote_folder1
    data_file:          data.axgx
    video_file:         video.mp4

another dataset:
    data_dir:           C:\Users\me\folder2
    remote_data_dir:    remote_folder2
    data_file:          data.axgx
    video_file:         video.mp4

Here, URLs to video files are composed by joining remote_data_root + remote_data_dir + video_file.

Recall that if data_dir is a relative path, it is assumed to be relative to the metadata file. In the example above, if the metadata file is located in C:\Users\me, the paths could be abbreviated:

neurotic_config:
    remote_data_root:   http://myserver

my favorite dataset:
    data_dir:           folder1
    remote_data_dir:    remote_folder1
    data_file:          data.axgx
    video_file:         video.mp4

another dataset:
    data_dir:           folder2
    remote_data_dir:    remote_folder2
    data_file:          data.axgx
    video_file:         video.mp4

Note

Portability is easy with neurotic! Use relative paths in your metadata file along with a remotely accessible data store such as GIN to make your metadata file fully portable. The example above is a simple model of this style. A metadata file like this can be copied to a different computer, and downloaded files will automatically be saved to the right place. Data stores can be password protected and neurotic will prompt you for a user name and password. This makes it easy to share the neurotic experience with your colleagues! 🤪

URLs to Use with GIN

If you have data stored in a public repository on GIN, you can access it from a URL of this form:

https://gin.g-node.org/<username>/<reponame>/raw/master/<path>

For private repositories, you must use a different URL that takes advantage of the WebDAV protocol:

https://gin.g-node.org/<username>/<reponame>/_dav/<path>

The second form works with public repos too, but GIN login credentials are still required. Consequently, the first form is more convenient for public repos.

Global Configuration Settings

The top-level name neurotic_config is reserved for configuration settings that apply to all datasets or to the app itself. Presently, only one configuration setting is implemented, but future versions of neurotic may add more under this name.

Key Description
remote_data_root A URL prepended to each remote_data_dir that is not already a full URL (i.e., does not already begin with a protocol scheme like https://)

For example:

neurotic_config:
    remote_data_root:   http://myserver

my favorite dataset:
    # dataset details here

Data Reader (Neo) Settings

The electrophysiology file specified by data_file is read using Neo, which supports many file types. A complete list of the implemented formats can be found here: neo.io.

By default, neurotic will use the file extension of data_file to guess the file format and choose the appropriate Neo IO class for reading it. If the guess fails, you can force neurotic to use a different class by specifying the class name with the io_class parameter (all available classes are listed here: neo.io).

Some Neo IO classes accept additional arguments beyond just a filename (see the Neo docs for details: neo.io). You can specify these arguments in your metadata using the io_args parameter.

For example, suppose you have data stored in a plain text file that is missing a file extension. The neo.io.AsciiSignalIO class can read plain text files, but you must specify this manually using io_class because the extension is missing. You could do this and pass in supported arguments in the following way:

my favorite dataset:
    data_file: plain_text_file_without_file_extension

    io_class: AsciiSignalIO

    io_args:
        skiprows: 1 # skip header
        delimiter: ' ' # space-delimited
        t_start: 5 # sec
        sampling_rate: 1000 # Hz
        units: mV

Video Synchronization Parameters

Constant Offset

If data acquisition began with some delay after video capture began, provide a negative value for video_offset equal to the delay in seconds. If video capture began after the start of data acquisition, use a positive value. A value of zero will have no effect.

neurotic warns users about the risk of async if video_file is given but video_offset is not. To eliminate this warning for videos that have no delay, provide zero.

Frame Rate Correction

If the average frame rate reported by the video file is a little fast or slow, you may notice your video and data going out of sync late in a long experiment. You can provide the video_rate_correction parameter to fix this. The reported average frame rate of the video file will be multiplied by this factor to obtain a new frame rate used for playback. A value less than 1 will decrease the frame rate and shift video events to later times. A value greater than 1 will increase the frame rate and shift video events to earlier times. A value of 1 has no effect.

You can obtain a good estimate of what value to use by taking the amount of time between two events in the video and dividing by the amount of time between the same two events according to the data record (seen, for example, as synchronization pulses or as movement artifacts).

Discrete Desynchronization Events

If you paused data acquisition during your experiment while video capture was continuous, you can use the video_jumps parameter to correct for these discrete desynchronization events, assuming you have some means of reconstructing the timing. For each pause, provide an ordered pair of numbers in seconds: The first is the time according to data acquisition (not according to the video) when the pause occurred, and the second is the duration of the pause during which the video kept rolling.

For example:

my favorite dataset:
    video_file: video.mp4
    # etc

    video_jumps:
        # a list of ordered pairs containing:
        # (1) time in seconds when paused occurred according to DAQ
        # (2) duration of pause in seconds
        - [60, 10]
        - [120, 10]
        - [240, 10]

These values could correct for three 10-second pauses occurring at times 1:00, 2:00, 3:00 according to the DAQ, which would correspond to times 1:00, 2:10, 3:20 according to the video. The extra video frames captured during the pauses will be excised from playback so that the data and video remain synced.

neurotic will automatically suggest values for video_jumps if it reads an AxoGraph file that contains stops and restarts (only if video_jumps is not already specified).

Plot Parameters

Use the plots parameter to specify which signal channels from data_file you want plotted and how to scale them.

Consider the following example, and notice the use of hyphens and indentation for each channel.

my favorite dataset:
    data_file: data.axgx
    # etc

    plots:
        - channel: Extracellular
          ylabel: Buccal nerve 2 (BN2)
          units: uV
          ylim: [-150, 150]

        - channel: Intracellular
          ylabel: B3 neuron
          units: mV
          ylim: [-100, 50]

        - channel: Force
          units: mN
          ylim: [-10, 500]

This would plot the “Extracellular”, “Intracellular”, and “Force” channels from the data_file in the given order. ylabel is used to relabel a channel and is optional. The units and ylim parameters are used together to scale each signal such that the given range fits neatly between the traces above and below it. If units is not given, they are assumed to be microvolts for voltage signals and millinewtons for force signals. If ylim is not given, they default to [-120, 120] for voltages and [-10, 300] for forces.

If plots is not provided, all channels are plotted using the default ranges, except for channels that match these patterns: “Analog Input #*” and “Clock”. Channels with these names can be plotted if given explicitly by plots.

The amount of time initially visible can be specified in seconds with t_width.

Epoch Encoder Parameters

The labels available to the epoch encoder must be specified ahead of time using epoch_encoder_possible_labels (this is a current limitation of ephyviewer that may eventually be improved upon).

For example:

my favorite dataset:
    epoch_encoder_file: epoch-encoder.csv
    # etc

    epoch_encoder_possible_labels:
        - label1
        - label2
        - label3

Filters

Highpass, lowpass, and bandpass filtering can be applied to signals using the filters parameter. Note that filters are only applied if fast loading is off (lazy=False).

Consider the following example, and notice the use of hyphens and indentation for each filter.

my favorite dataset:
    data_file: data.axgx
    # etc

    filters:  # used only if fast loading is off (lazy=False)

        - channel: Extracellular
          highpass: 300 # Hz
          lowpass: 500 # Hz

        - channel: Intracellular
          highpass: 300 # Hz

        - channel: Force
          lowpass: 50 # Hz

Filter cutoffs are given in hertz. Combining highpass and lowpass provides bandpass filtering.

Amplitude Discriminators

Spikes with peaks that fall within amplitude windows given by amplitude_discriminators can be automatically detected by neurotic on the basis of amplitude alone. Note that amplitude discriminators are only applied if fast loading is off (lazy=False).

Detected spikes are indicated on the signals with markers, and spike trains are displayed in a raster plot.

In addition to restricting spike detection for a given unit to an amplitude window, detection can also be limited in time to overlap with epochs with a given label.

Consider the following example, and notice the use of hyphens and indentation for each amplitude discriminator.

my favorite dataset:
    data_file: data.axgx
    # etc

    amplitude_discriminators:  # used only if fast loading is off (lazy=False)

        - name: Unit 1
          channel: Extracellular
          units: uV
          amplitude: [50, 150]

        - name: Unit 2
          channel: Extracellular
          units: uV
          amplitude: [20, 50]
          epoch: Unit 2 activity

Here two units are detected on the same channel with different amplitude windows. Any peaks between 50 and 150 microvolts on the “Extracellular” channel will be tagged as a spike belonging to “Unit 1”. The discriminator for “Unit 2” provides the optional epoch parameter. This restricts detection of “Unit 2” to spikes within the amplitude window that occur at the same time as epochs labeled “Unit 2 activity”. These epochs can be created by the epoch encoder (reload required to rerun spike detection at launch-time), specified in the read-only annotations_file, or even be contained in the data_file if the format supports epochs.

Amplitude windows are permitted to be negative.

tridesclous Spike Sorting Results

tridesclous is a sophisticated spike sorting toolkit. The results of a sorting process can be exported to a CSV file using tridesclous’s DataIO.export_spikes function. This file contains two columns: the first is the sample index of a spike, and the second is the ID for a cluster of spikes. If this file is specified with tridesclous_file, then a mapping from the cluster IDs to channels must be provided with tridesclous_channels.

In the following example, notice the lack of hyphens:

my favorite dataset:
    data_file: data.axgx
    tridesclous_file: spikes.csv
    # etc

    tridesclous_channels:
        0: [Channel A, Channel B]
        1: [Channel A]
        2: [Channel B]
        3: [Channel B]
        # etc

Here numeric cluster IDs are paired with a list of channels found in data_file on which the spikes were detected.

To show only a subset of clusters or to merge clusters, add the tridesclous_merge parameter.

In this example, note again the punctuation:

my favorite dataset:
    data_file: data.axgx
    tridesclous_file: spikes.csv
    # etc

    tridesclous_channels:
        0: [Channel A, Channel B]
        1: [Channel A]
        2: [Channel B]
        3: [Channel B]
        # etc

    tridesclous_merge:
        - [0, 1]
        - [3]

Now clusters 0 and 1 are combined into a single unit, and only that unit and cluster 3 are plotted; cluster 2 has been discarded.

A Complete Example

These are the contents of the example metadata file that ships with neurotic, which can be loaded by running neurotic from the command line without arguments:

example dataset:
    description: This is an example data set

    # these data are a subset of Jeffrey Gill's dataset 2018-06-21_IN-VIVO_JG-08 002
    data_dir:           example-data
    remote_data_dir:    https://gin.g-node.org/jpgill86/neurotic-data/raw/master/examples/example-data
    data_file:          data.axgx
    video_file:         video.mp4
    annotations_file:   annotations.csv
    epoch_encoder_file: epoch-encoder.csv

    video_offset: 640.3 # seconds

    epoch_encoder_possible_labels:
        - force
        - B38 activity

    plots:
        - channel: I2
          units: uV
          ylim: [-30, 30]

        - channel: RN
          units: uV
          ylim: [-60, 60]

        - channel: BN2
          units: uV
          ylim: [-120, 120]

        - channel: BN3
          units: uV
          ylim: [-150, 150]

        - channel: Force
          units: mN
          ylim: [-10, 300]

    filters:  # used only if fast loading is off (lazy=False)

        - channel: I2
          lowpass: 100 # Hz

        - channel: Force
          lowpass: 50 # Hz

    amplitude_discriminators:  # used only if fast loading is off (lazy=False)

        - name: B3
          channel: BN2
          units: uV
          amplitude: [50, 150]

        - name: B38
          channel: BN2
          units: uV
          amplitude: [17, 26]
          epoch: B38 activity

        - name: B4/B5
          channel: BN3
          units: uV
          amplitude: [85, 200]

API Reference Guide

In addition to using neurotic as a standalone app, you can also leverage its API in your own code.

The core of the API consists of two classes and one function:

All public package contents are automatically imported directly into the neurotic namespace. This means that a class like neurotic.datasets.metadata.MetadataSelector can be accessed more compactly as neurotic.MetadataSelector.

neurotic.datasets.data

The neurotic.datasets.data module implements a function for loading a dataset from selected metadata.

neurotic.datasets.data.load_dataset(metadata, lazy=False, signal_group_mode='split-all', filter_events_from_epochs=False)[source]

Load a dataset.

metadata may be a MetadataSelector or a simple dictionary containing the appropriate data.

The data_file in metadata is read into a Neo Block using an automatically detected neo.io class if lazy=False or a neo.rawio class if lazy=True.

Epochs and events loaded from annotations_file and epoch_encoder_file and spike trains loaded from tridesclous_file are added to the Neo Block.

If lazy=False, filters given in metadata are applied to the signals and amplitude discriminators are run to detect spikes.

neurotic.datasets.download

The neurotic.datasets.download module implements a general purpose download function that handles connecting to remote servers, performing authentication, and downloading files with progress reporting. The function handles various errors and will automatically reprompt the user for login credentials if a bad user name or password is given.

The module installs an urllib.request.HTTPBasicAuthHandler and a neurotic.datasets.ftpauth.FTPBasicAuthHandler at import time.

neurotic.datasets.download.download(url, local_file, overwrite_existing=False, show_progress=True, bytes_per_chunk=8192)[source]

Download a file.

neurotic.datasets.ftpauth

The neurotic.datasets.ftpauth module implements a urllib.request-compatible FTP handler that prompts for and remembers passwords.

class neurotic.datasets.ftpauth.FTPBasicAuthHandler(password_mgr=None)[source]

This subclass of urllib.request.FTPHandler implements basic authentication management for FTP connections. Like urllib.request.HTTPBasicAuthHandler, this handler for FTP connections has a password manager that it checks for login credentials before connecting to a server.

This subclass also ensures that file size is included in the response header, which can fail for some FTP servers if the original FTPHandler is used.

This handler can be installed globally in a Python session so that calls to urllib.request.urlopen('ftp://...') will use it automatically:

>>> handler = FTPBasicAuthHandler()
>>> handler.add_password(None, uri, user, passwd)  # realm must be None
>>> opener = urllib.request.build_opener(handler)
>>> urllib.request.install_opener(opener)
neurotic.datasets.ftpauth.setup_ftpauth()[source]

Install neurotic.datasets.ftpauth.FTPBasicAuthHandler as the global default FTP handler.

Note that urllib.request.install_opener() used here will remove all other non-default handlers installed in a different opener, such as an urllib.request.HTTPBasicAuthHandler.

neurotic.datasets.metadata

The neurotic.datasets.metadata module implements a class for reading metadata files.

class neurotic.datasets.metadata.MetadataSelector(file=None, local_data_root=None, remote_data_root=None, initial_selection=None)[source]

A class for managing metadata.

A metadata file can be specified at initialization, in which case it is read immediately. The file contents are stored as a dictionary in all_metadata.

>>> metadata = MetadataSelector(file='metadata.yml')
>>> print(metadata.all_metadata)

File contents can be reloaded after they have been changed, or after changing file, using the load() method.

>>> metadata = MetadataSelector()
>>> metadata.file = 'metadata.yml'
>>> metadata.load()

A particular metadata set contained within the file can be selected at initialization with initial_selection or later using the select() method. After making a selection, the selected metadata set is accessible at metadata.selected_metadata, e.g.

>>> metadata = MetadataSelector(file='metadata.yml')
>>> metadata.select('Data Set 5')
>>> print(metadata.selected_metadata['data_file'])

A compact indexing method is implemented that allows the selected metadata set to be accessed directly, e.g.

>>> print(metadata['data_file'])

This allows the MetadataSelector to be passed to functions expecting a simple dictionary corresponding to a single metadata set, and the selected metadata set will be used automatically.

Files associated with the selected metadata set can be downloaded individually or all together, e.g.

>>> metadata.download('video_file')

or

>>> metadata.download_all_data_files()

The absolute path to a local file or the full URL to a remote file associated with the selected metadata set can be resolved with the abs_path() and abs_url() methods, e.g.

>>> print(metadata.abs_path('data_file'))
>>> print(metadata.abs_url('data_file'))
abs_path(file)[source]

Convert the relative path of file to an absolute path using data_dir.

abs_url(file)[source]

Convert the relative path of file to a full URL using remote_data_dir.

all_metadata = None

A dictionary containing the entire file contents, set by load().

download(file, **kwargs)[source]

Download a file associated with the selected metadata set.

See neurotic.datasets.download.download() for possible keyword arguments.

download_all_data_files(**kwargs)[source]

Download all files associated with the selected metadata set.

See neurotic.datasets.download.download() for possible keyword arguments.

load()[source]

Read the metadata file.

select(selection)[source]

Select a metadata set.

selected_metadata

The access point for the selected metadata set.

neurotic.gui.config

The neurotic.gui.config module implements a class for configuring and launching ephyviewer for a loaded dataset.

class neurotic.gui.config.EphyviewerConfigurator(metadata, blk, rauc_sigs=None, lazy=False)[source]

A class for launching ephyviewer for a dataset with configurable viewers.

At initialization, invalid viewers are automatically disabled (e.g., the video viewer is disabled if video_file is not given in metadata). Viewers can be hidden or shown before launch using the built-in methods. Valid viewer names are:

  • traces
  • traces_rauc
  • freqs
  • spike_trains
  • epochs
  • epoch_encoder
  • video
  • event_list
  • data_frame

launch_ephyviewer() is provided for starting a new Qt app and launching the ephyviewer main window all at once. create_ephyviewer_window() generates just the ephyviewer window and should be used if there is already a Qt app running.

create_ephyviewer_window(theme='light', support_increased_line_width=False, show_datetime=False, datetime_format='%Y-%m-%d %H:%M:%S')[source]

Load data into each ephyviewer viewer and return the main window.

disable(name)[source]

Disable the viewer name.

enable(name)[source]

Enable the viewer name.

hide(name)[source]

Hide the viewer name.

hide_all()[source]

Hide all viewers.

is_enabled(name)[source]

Return whether the viewer name is enabled.

is_shown(name)[source]

Return whether the viewer name is shown.

launch_ephyviewer(theme='light', support_increased_line_width=False, show_datetime=False, datetime_format='%Y-%m-%d %H:%M:%S')[source]

Start a Qt app and create an ephyviewer window.

show(name)[source]

Show the viewer name.

show_all()[source]

Show all viewers.

neurotic.gui.epochencoder

The neurotic.gui.epochencoder module implements a subclass of ephyviewer.datasource.epochs.WritableEpochSource.

class neurotic.gui.epochencoder.NeuroticWritableEpochSource(filename, possible_labels, color_labels=None, channel_name='', backup=True)[source]

A subclass of ephyviewer.datasource.epochs.WritableEpochSource for custom CSV column formatting and automatic file backup.

neurotic.gui.notebook

The neurotic.gui.notebook module implements Jupyter notebook widget counterparts for the MetadataSelector and the EphyviewerConfigurator.

class neurotic.gui.notebook.MetadataSelectorWidget(file=None, local_data_root=None, remote_data_root=None, initial_selection=None)[source]

Interactive list box for Jupyter notebooks that allows the user to select which metadata set they would like to work with.

>>> metadata = MetadataSelectorWidget(file='metadata.yml')
>>> display(metadata)

After clicking on an item in the list, the selected metadata set is accessible at metadata.selected_metadata, e.g.

>>> metadata.selected_metadata['data_file']

A compact indexing method is implemented that allows the selected metadata set to be accessed directly, e.g.

>>> metadata['data_file']

This allows the MetadataSelectorWidget to be passed to functions expecting a simple dictionary corresponding to a single metadata set, and the selected metadata set will be used automatically.

class neurotic.gui.notebook.EphyviewerConfiguratorWidget(metadata, blk, rauc_sigs=None, lazy=False)[source]

Interactive button grid for Jupyter notebooks that allows the user to select which ephyviewer viewers they would like to display and then launch ephyviewer.

disable(name)[source]

Disable the viewer name.

enable(name)[source]

Enable the viewer name.

hide(name)[source]

Hide the viewer name.

show(name)[source]

Show the viewer name.

neurotic.gui.standalone

The neurotic.gui.standalone module implements the main window of the app.

class neurotic.gui.standalone.MainWindow(file=None, initial_selection=None, lazy=True, theme='light', support_increased_line_width=False, show_datetime=False)[source]

The main window of the app.

Release Notes

neurotic 1.2.1

2019-12-09

Bug fixes

  • Fix loading using Neo IOs lacking signals_group_mode (TypeError: read_block() got an unexpected keyword argument 'signal_group_mode') (#143)

neurotic 1.2.0

2019-12-06

neurotic should now have broader compatibility with file types supported by Neo’s neo.io classes thanks to two new metadata parameters: io_class and io_args. See Data Reader (Neo) Settings for details.

neurotic is now available on conda-forge! See Recommended Method for details on how to install.

Improvements

  • Add metadata parameters io_class and io_args (#137)

Documentation

  • Add conda-forge installation instructions (#128)

neurotic 1.1.1

2019-10-17

Changes

  • Remove elephant as a dependency (#120)

neurotic 1.1.0

2019-10-09

Improvements

  • Add API parameters and CLI argument for displaying the real-world date and time (potentially inaccurate) (#110, #118)
  • Add printer-friendly theme (white background) (#114)

Documentation

  • Add documentation of GIN URLs for public and private repos (#113)

neurotic 1.0.0

2019-07-27

🎊 First stable release! 🎉

Improvements

  • Major API changes (#104, #100, #106)

    • In preparation for this stable release, many formerly public classes and functions were made private. This was done to minimize the number of public classes/functions, which beginning with this release will be treated as stable APIs that are ideally modified only in backwards compatible ways. Users should trust that public classes and functions will not be changed without good reason and a major version bump.
  • Many improvements to the documentation, including the addition of an API Reference Guide

  • Add example Jupyter notebook and command line argument for launching it (#108)

  • Add file overwrite option to download functions (#106)

  • Reserve the metadata keyword neurotic_config for global parameters (#93)

    • The remote_data_root key must now be nested under neurotic_config.

Bug fixes

  • Fix crash when epoch encoder file contains labels not listed in metadata (#97)
  • Allow amplitude discriminators to be specified with arbitrary units (#99)

neurotic 0.7.0

2019-07-21

Improvements

  • New documentation hosted at Read the Docs: https://neurotic.readthedocs.io
  • Add menu action for opening metadata in editor (#83)
  • Add menu action for opening the selected data directory (#84)
  • Add list of installed versions of dependencies and doc links to About window (#44, #65)

Bug fixes

  • Fix files remaining locked after closing a fast-loaded window (#69)
  • Fix launching from command line with bad metadata argument (#82)

neurotic 0.6.0

2019-07-10

Improvements

  • Add a basic “About neurotic” window with version and website information (#38)
  • Update logo (#39)
  • Add keywords and project URLs to package metadata (#40)

neurotic 0.5.1

2019-07-09

Compatibility updates

  • Compatibility update for RawIOs with non-zero offset (#37)

neurotic 0.5.0

2019-07-06

Improvements

  • Support fast (lazy) loading in Neo < 0.8.0 (#35)
  • Add “git.” and conditionally “.dirty” to dev local version identifier (#34)

neurotic 0.4.2

2019-07-06

Bug fixes

  • Fix for EstimateVideoJumpTimes regression introduced in 0.4.0 (#33)

neurotic 0.4.1

2019-07-02

Compatibility updates

  • Change sources of development versions of dependencies (#32)
  • Compatibility update for scaling of raw signals (#31)

neurotic 0.4.0

2019-07-01

Improvements

  • Show epochs imported from CSV files with zero duration in epoch viewer (#27)
  • Show epochs/events imported from data file in events list/epoch viewer (#28)
  • Alphabetize epoch and event channels by name (#29)

neurotic 0.3.0

2019-06-29

Improvements

  • Remove dependency on ipywidgets by making notebook widgets optional (#25)
    • Notebook widget classes renamed: MetadataSelectorMetadataSelectorWidget, EphyviewerConfiguratorEphyviewerConfiguratorWidget
  • Add app description and screenshot to README (#22)
  • Promote to beta status (#23)

neurotic 0.2.0

2019-06-28

Improvements

  • Add basic command line arguments (#14)
  • Add continuous integration with Travis CI for automated testing (#13)
  • Add some tests (#15, #16)
  • Migrate example data to GIN (#18)

Bug fixes

  • Fix crash when downloading from a server that does not report file size (#17)
  • Raise an exception if a Neo RawIO cannot be found for the data file (#12)

neurotic 0.1.1

2019-06-22

Bug fixes

  • Fix various downloader errors (#7)

neurotic 0.1.0

2019-06-22

  • First release