Skip to content
Johannes Niediek edited this page Dec 8, 2016 · 2 revisions

Guide to the (partial) analysis of (partially) recorded data

Sometimes you would like to analyze only a part of the recorded data. In other situations, you would like to analyze several recording sessions at once. This short guide explains how to deal with such situations.

Extracting only some spikes

css-extract has the options --start and --stop. These options take record indices as arguments and work only with .ncs-files at the moment. For example, to extract spikes from the first 512000 datapoints of CSC1.ncs, use

css-extract --start 0 --stop 999 --files CSC1.ncs

Background

In .ncs-files, data are organized in consecutive records. Each such record consists of a timestamp, some metainformation, and 512 datapoints. Timestamps and record indices are a linear function of each other if and only if the recording was not interrupted. See neuralynx.com for details.

Use cases

  • Multi-part experiments of which only some have to be analyzed
  • Epileptic seizures at known times
  • Analysis of data from defined sleep stages only

Excluding spikes from sorting

If you would like to exclude spikes from further processing, you can use css-mask-artifacts with its argument --exclude-ranges FNAME. Here, FNAME is the name of an auxiliary file with the following format:

start_exclude_1  stop_exclude_1
start_exclude_2	 stop_exclude_2
    ...

Each start_exclude_i and stop_exclude_i is a timestamp. All spikes in any of the intervals (start_exclude_i, stop_exclude_i) are masked as artifacts by css-mask-artifacts --exclude-ranges.

Note that spike timestamps are given in milliseconds, whereas .ncs-files use microseconds.

Use cases

  • Known periods of excessive noise
  • Phases within an experiment that you would like to ignore

Sorting only certain spikes

If you do not want to mask spikes as artifacts, but instead just sort some of the recorded spikes, use css-prepare-sorting with either the options --start and --stop, or with the option --times.

In case of --start and --stop, the arguments are spike indices. For example, to sort only the 20000th to 40000th spike, use css-prepare-sorting --start 20000 --stop 39999.

In case of --times, the argument is a file with the following format

start_include_1  stop_include_1
start_include_2	 stop_include_2
    ...

For each interval (start_include_i, stop_include_i), a sorting job is generated.

Note that for some reason, start_include_i and stop_include_i have to be supplied in microseconds.

Use case

  • Part-by-part analysis of different parts of an experiment
  • “Preview” analysis of parts of a long recording

Concatenating .h5-files

Use the tool tools/concatenate_h5.py to concatenate several .h5-files with extracted spikes.

Use case

  • Split recording sessions, e.g. due to amplifier reboot