Intervals

Intervals are usually used in NeuroExplorer to select the data from a specified time periods (see Data Selection Options for details).

Each interval variable can contain multiple time intervals. For example, the Trials variable in the following figure has two intervals:

../../../_images/intervals.png

Creating Interval Variables

You can create intervals in NeuroExplorer using Edit | Add Interval Variable menu command.

You can also create intervals based on existing Event or Interval variables. Use Edit | Operations on Data Variables menu command and then select one of the following operations:

  • MakeIntervals

  • MakeIntFromStart

  • MakeIntFromEnd

  • IntOpposite

  • IntAnd

  • IntOr

  • IntSize

  • IntFind

Interval Variables in NexScript and Python

IntVar[i,1] gives you the access to the start of the i-th interval,

IntVar[i,2] gives you the access to the end of the i-th interval.

For example, the following script creates a new interval variable that has two intervals: from 0 to 100 seconds and from 200 to 300 seconds:

doc = GetActiveDocument()
doc["MyInterval"] = NewIntEvent(doc)
AddInterval(doc["MyInterval"], 0., 100.)
AddInterval(doc["MyInterval"], 200., 300.)

In Python, it is faster to use Intervals() function. For example, the following script:

import nex
doc = nex.GetActiveDocument()
intervals = doc['Trials'].Intervals()
print(intervals)

will produce output:

[[0.0, 25.0], [20.0, 40.0]]

Limitations

Internally, NeuroExplorer stores the beginning and the end of each interval as a timestamp (see Spike Trains for more information about timestamps in NeuroExplorer).

If an interval variable contains multiple time intervals, these time intervals cannot overlap.

Viewers

You can view the intervals of the selected variables in graphical display (View | 1D Data Viewer menu command, see figure above).

The intervals (in seconds) are shown in the Intervals sheet of the Data view.