Editing    Analysis    Display    Archive Scripts    Useful Script Functions    Control

On-Line    Experiments    Examples of Method    Spectrum    User RequestedNew

User Requested
Online monitoring and stimulus output ZAP function: Sine wave output with increasing frequency
Linear ramp of pulse frequency
Control a Telemetry Research interface
Control a Digitimer DS5 stimulator
Output pre-recorded spike times as a stimulus
Automatically adjust video rate in relation to spike activity
Apply IIR filters to a waveform channel on-line

Research applications Play tone for ECG R-wave detection
Force feedback display

Analysis requests Grand Average
Multiple cross-channel correlations
Interactive feature detection
Gated power spectrum analysis

Data manipulation Apply digital filters to multiple channels
Apply marker filter settings to multiple channels
Separate traces from stereotrode and tetrode channels
Artefact removal with overdrawn display
Interactive TextMark addition
Time shifting event data
Insert event trains off-line
Number events from 1 to n

Exporting data Print raster data as text
Save result files as images
Export as text based on a trigger channel

Data presentation Cursor control of displayed video frames
Rerun with sound output

Examples for script writers Draw your own arbitrary waveforms
Interactive control of pulse output amplitude
Test on-line scripts on existing data files
Alarm clock
ZAP function: Sine wave output with increasing frequency
ZAPexample.zip 4,377

This script and associated sequence can be used to generate a sine wave with a linear or quadratic increasing frequency from DAC 0 of a 1401 interface. To view the output, connect DAC 0 to ADC 0, load the included sampling configuration, ZAPexample.S2C, and select the text sequence file, ZAPexample.pls, from the Sequencer tab.

The script opens a new data file ready to sample based on the current sampling configuration. Sine wave settings are controlled from a script toobar button and can be updated during sampling

This script requires Spike2 v7.00 or higher and a Micro1401 or Power1401 interface.

Keywords: ZAP function, sine wave


Linear ramp of pulse frequency
LinRampFreq.zip 2,691

This script and associated sequence creates ramps of increasing or decreasing pulse frequency on-line and allows the user to enter settings for ramp time as well as start, turning point and end frequencies for the pulse output.

Before running the script you must ensure that the LinRampFreq.pls output sequence is selected in the Sequencer tab of your sampling configuration. The script sets up a new data file for recording based on the current sampling configuration.

For testing purposes, set channel 1 in your sampling configuration to be an Event channel in which pulses can be recorded to help visualise the results. The pulses are set to be 10us long and are output from digital output 0 of the 1401.

This script requires Spike2 v5.17 or higher and a Micro1401 or Power1401 interface.

Keywords: linear frequency, pulse output


Control a Telemetry Research interface
TR Control.zip 5,743

This script and associated sequence is an example of interacting with a Telemetry Research interface. The script creates a toolbar which allows the user to control sampling and set the duration of recording periods and gaps.

Digital output 0 of the 1401 should be connected to the trigger input of the Telemetry Research transmitter and DAC 0 connected to the external channel select input to select a channel between 1 and 12. The signal you want to sample should then be connected to ADC 0.

This script requires Spike2 v5.17 or higher.

Keywords: Telemetry


Control a Digitimer DS5 Stimulator
DS5Control.zip 2,112

This script and associated sequence is an example of using a DAC output from the 1401 to control a Digitimer DS5 Isolated Bipolar Constant Current stimulator and update the settings during sampling.

This script requires Spike2 v6.14 or higher.

Keywords: Digitimer DS5


Output pre-recorded spike times as a stimulus
PlaySpikeTimes.zip 1,292

This script and associated sequence is an example of using the sequencer table to output a series of pre-recorded events during sampling. Select the PlaySpikeTimes.pls sequence file in the Sequencer tab of your sampling configuration before running the script

When run, the script prompts the user to open a data file containing the spikes or events to use and select a time range of events to write to the sequencer table. During sampling, key 'a' will play the copied data out of digital output 0.

This script requires Spike2 v5.17 or higher and a Micro1401 or Power1401 interface.

Keywords: Pre-recorded event output


Automatically adjust video rate in relation to spike activity
VideoRate.zip 1,632

This script can be used to monitor an event or WaveMark channel and switch between slow frame rate and the normal frame rate depending on the level of activity in the nominated channel. You can specify the minimum interval between events that signals the start of a period of low activity.

This script requires Spike2 v5.17 or higher.

Keywords: Frame rate, spike activity


Apply IIR filters to a waveform channel on-line
OnlineFilter.zip 4,240

This script is an example of applying IIR filters to a nominated waveform channel during sampling. It opens a new data file based on the current sampling configuration and then generates a dialog from which the user can specify the type of filter to apply and the source waveform channel to use.

Once sampling is started the script uses an idle routine to apply the filter to the source data and produces a new memory channel displaying the result.

This script requires Spike2 v6.01 or higher.

Keywords: On-line filter


Play tone for ECG R-wave detection
ECGTone.zip 3,200

This script plays a tone 'pip' from DAC 0 of the 1401 when the R-wave of an ECG complex is detected during sampling.

Sampling is controlled via the script toolbar and the user is asked to set the ECG channel to monitor and a hysteresis value for the R-wave peak detection. A horizontal cursor is then used to set a threshold for the detection of the R-wave. Each time the threshold is crossed the script monitors the level of the incoming data and, when a peak is found, waits for the data to fall by at least the level set by the hysteresis value before playing the tone to flag the R-wave detection.

This script requires Spike2 v6.00 or higher.

Keywords: ECG, R-wave detection, tone output


Force feedback display
BarDisplay.zip 1,924

This script is an example of displaying an on-line channel value in a separate window for use in a force feedback experiment. The script contains an idle routine that updates the bar display in response to incoming waveform data in channel 1.

This script requires Spike2 v4.24 or higher.

Keywords: Force feedback display


Grand Average
GrandAverage.zip 1,054

This script can be used to 'build' an average of multiple result views including waveform averages, PSTH's and interval histograms. Select result views to add to the Grand Average by opening a saved result view or creating a new result view and making it the current or 'top' window. Then simply click the ADD button in the script toolbar.

This script requires Spike2 v4.24 or higher.

Keywords: Grand average


Multiple cross-channel correlations
CrossChanCorrelation.zip 3,591

This script generates multiple spike correlation histograms for all combinations of templated spikes in a channel. Currently it allows for up to 8 spike templates per channel (including code 0) for correlating between channels in the file.

The script is controlled from a toolbar where the user can open a data file for analysis and control the parameters for the correlation as well as the number of correlation results views to display at any one time. A suitable example data file, Extracellular spikes.smr, is included in the Data folder of your Spike2 directory.

This script requires Spike2 v4.24 or higher.

Keywords: Spike cross correlation


Interactive feature detection
FeatureDetect.zip 1,656

This script allows the user to interactively import peaks, troughs or threshold crossings based on an amplitude value defined with a pair of horizontal cursors, or a single horizontal cursor used as a threshold crossing.

The script utilises an idle routine that automatically updates the memory channel holding the event markers if the user adjusts the amplitudes or threshold levels. A suitable example data file, Blood pressure waveform.smr, is included in the Data folder of your Spike2 directory.

This script requires Spike2 v4.24 or higher.

Keywords: peak trough detection, threshold crossing


Gated power spectrum analysis
GatedPower.zip 4,923

This script allows the user to generate a 'gated' power spectrum where the sections of data to include in the result are defined by a TextMark channel. The script also gives the option of overlapping the FFT blocks within each time range. A suitable example data file, Demo.smr, is included in the Data folder of your Spike2 directory.

This script requires Spike2 v6.14 or higher.

Keywords: Gated, overlap, power spectrum, FFT


Apply digital filters to multiple channels
ApplyDfilter.zip 1,721

This script will apply an existing filter from the Digital Filter bank to a number of channels in a data file. You can select the channels to filter by holding down the Ctrl key and clicking on the channel numbers to the left of the Y-axis. Selected channels will have the number highlighted with a grey box. A suitable example data file, Flow and CO2 Waveform.smr, is included in the Data folder of your Spike2 directory

This script requires Spike2 v5.21 or higher.

Keywords: Digital filter


Apply marker filter settings to multiple channels
CopyMarkerFilter.zip 371,148

This script copies marker filter settings from a nominated channel to any selected WaveMark or marker channels in a data file. You can select the channels to apply the copied settings to by holding down theCtrl key and clicking on the channel numbers to the left of the Y-axis. Selected channels will have the number highlighted with a grey box. A suitable example data file, Spike channels.smr, is included in the .Zip file.

This script requires Spike2 v5.21 or higher.

Keywords: Marker filter


Separate traces from stereotrode and tetrode channels
SeparateTraces.zip 82,560

This script will take a selected channel of multiple trace WaveMark data and create additional memory channels in the data file, each holding a single trace from the source channel. The user selectes the channel and type (stereotrode or tetrode) from a dialog when the script is run. A suitable example data file, Tetrode data.smr, is included in the .Zip file.

This script requires Spike2 v5.21 or higher.

Keywords: Multiple trace, stereotrode, tetrode


Artefact removal with overdrawn display
ArtRemOverlay.zip 3,014

This is an updated version of the ArtRem script that now removes artefacts from both waveform and RealWave channels. This new version creates a duplicate of the original file with the sections of data around the selected trigger overdrawn, allowing the user to see all of the artefacts overlaid.

The main dialog is now interactive with cursors in the overdraw view that can be used to select the data area for removal.

This script requires Spike2 v6.14 or higher.

Keywords: Artefact removal


Interactive TextMark addition
MouseEvent.zip 1,333

This script is an example that allows the addition of TextMark items interactively to a region of data by holding down the Shift key and clicking and dragging the mouse pointer.

This script requires Spike2 v7.01 or higher.


Time shifting event data
TimeShiftEvents.zip 2,077

This script can be used to copy event or marker times from a currently selected data file to a new permanent channel in any open data file. The script creates two cursors to select the data range to copy and you can apply an optional time shift by setting the start time for the data in the new channel. A suitable example data file, Demo.smr is included in the Data folder of your Spike2 directory.

This script requires Spike2 v5.21 or higher.

Keywords: Time shift, copy events


Insert event trains off-line
AddEvents.zip 1,414

This script allows the user to set a time range and frequency of stimulation for adding events into a new channel in a data file at the specified interval and time range. The script also allows the addition of multiple event trains into the same channel.

This script could also be used to create pulse trains at a set frequency for output. Once the events have been created as an event channel in the data file, you could load them into the output sequencer using the PlaySpikeTimes script.

This script requires Spike2 v5.21 or higher.

Keywords: Pulse trains


Number events from 1 to n
StimNumber.zip 1,093

This script can be used to give an identifying number to stimulus events, spike shapes or markers. The script creates a new TextMark memory channel that holds text strings starting a 1 for the time of the first event in range. A suitable example data file, Demo.smr, is included in the Data folder of your Spike2 directory.

This script requires Spike2 v5.21 or higher.


Print raster data as text
RasterDump.zip 1,863

This script exports raster data from result files into a new text document. When the script is run, the user is prompted to open a result file that includes a raster type channel and select the raster channel to export.

This script requires Spike2 v4.24 or higher.

Keywords: Export raster data


Save result files as images
SaveAsImage.zip 1,308

This script is an example of exporting multiple result files in either bitmap or metafile format. The user selects a directory containing result files and the script then exports them one by one. You can set the window size of the first result file to be exported and this is then used to set the size of the image for all subsequent files. The image files are saved in the same directory and with the same file names as the result files.

This script requires Spike2 v5.21 or higher.

Keywords: Export images, bitmap, metafile


Export as text based on a trigger channel
TriggeredTextExport.zip 1,735

This script will export data in sections of spreadsheet-format text based on a nominated trigger channel, with each section separated by new column headers. All visible channels are exported based on user defined settings such as output sample rate and section length.

This script requires Spike2 v5.21 or higher.

Keywords: Export trigger, spreadsheet format


Cursor control of displayed video frames
VideoShow.zip 1,111

This script allows you to display the current frame in a multimedia video file in relation to a cursor position in the data file. Simply drag the cursor to show the associated frame for that section of data. By default the displayed multimedia frame is relative to the right-hand edge of the data view.

This script requires Spike2 v5.21 or higher.

Keywords: Video, frame position


Rerun with sound output
RerunWithSound.zip 1,190

This script can be used to rerun a data file and nominate a channel to be played out from the sound card during the replay. The script generates a toolbar from which the user can open data files, set the channel to play out and run/stop the data file.

This script requires Spike2 v5.21 or higher.

Keywords: Rerun, sound output


Draw your own arbitrary waveforms
DrawPlayWave.zip 2,169

This is an example script that allows the drawing of an arbitrary waveform for output from the 1401 DAC's using the mouse pointer. The user specifies the output rate, waveform duration and associated key for the waveform before drawing the shape required in a result view window by holding down the Shift key together with the left mouse button and dragging the mouse. The waveform can then be added to the play wave area of the sampling configuration by clicking the 'Add' button in the script toolbar.

This script requires Spike2 v7.01 or higher.

Keywords: Arbitrary waveform


Interactive control of pulse output amplitude
CursorPulseAmp.zip 5,909

This script and associated sequence file is an example of updating a running sequence file during sampling with an interactive script.

The included sampling configuration can be used to visualize the pulse outputs by connecting DAC 0 to ADC 0 on the 1401. Load the CursorPulseAmp.pls sequence file from the sequencer tab of the sampling configuration and click OK before running the script. The script opens a new data file ready to sample and creates a tollbar to start and stop sampling. During sampling the horizontal cursor can be dragged up and down to control the amplitude of the pulse train output.

This script requires Spike2 v6.14 or higher.


Test on-line scripts on existing data files
SimOnSkel.zip 1,955

This script uses the PlayOffLine() script command to replay an existing data file and give the script access to the current replay position to simulate sampling.

To use this for testing purposes, simply add the function code that you plan to use on-line at the position indicated in the Idle%() function.

This script requires Spike2 v5.21 or higher.


Alarm clock
Alarm.zip 1,133

This script is a simple example allowing the user to set an alarm time based on the system clock of the PC. This example emits a tone and displays a message box once the alarm time is reached, but could easily be modified to perform other functions in response to the alarm setting, such as starting a file sampling early in the morning before you arrive at work!

This script requires Spike2 v5.21 or higher.



Some of these scripts have come from users rather than the CED team. If you have a script that you would like to offer to fellow users via this page, please tell Simon Gray. We provide some scripts for Signal too.

These scripts are stored as WinZip files, myscript.zip, except where they are shown as spike\scripts\myscript.s2s. Those latter files were installed with Spike2 and spike stands for the directory in which you installed Spike2. See the summaries by clicking on the description line, below. Then you can down-load them by clicking on the filename; please check the size received.