• UK
  • US
  • Français
  • Deutsch
  • Español (precios €)
  • Portugal
  • Polski
  • 日本人
  • 中國傳統
  • 简化中国

Spike2 scripts


Play tone for ECG R-wave detection
ECGTone.s2s (01/17)


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.

Force feedback display
BarDisplay.s2s (09/08)


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.

Analyse cricket song with burst analysis
SongAn.s2s (01/17)


Analysis of cricket song into pulses and chirps, using the burst analysis feature of Spike2. A simple table of results is produced. Have your cricket song data-file open and visible before running this script.

Cardiac Action Potential Analysis System
Capas.s2s (03/09)


This extracts certain parameters from Cardiac Action Potential (CAP) data.

The user is first required select a suitable file for analysis, and to specify the CAP channel. They should then place a horizontal cursor on the data such that it crosses all the upstrokes of the data file.

This enables the script to place marks in a temporary event channel every time a CAP is located. The script then attempts to extract certain characteristics from the CAP; these values are written to the screen. The extracted characteristics include:

  • CAP start time
  • CAP end time
  • Baseline value
  • Peak value
  • Peak time
  • Upstroke gradient
  • Repolarisation gradient
  • 30, 50, 60, 90 % re-polarisation times.

The user may click the mouse on the text window and this will place a cursor on the data at the value indicated by the clicked position (easier done than said). All desired results are dumped to a text file.

Respiratory Sinus Arrythmia
RSA3.S2S (01/17)


This script is designed to show respiratory sinus arrhythmia in EMG data.

A data-file is loaded which contains one channel of EMG activity and another of pressure waves. A threshold level is set on the pressure channel to mark the start and end points of each pressure wave. For each pressure wave interval the instantaneous heart rate is sampled at a given frequency and the instantaneous frequencies are logged to a text file.

Eye movement monitor
EYEMOVE.S2S (02/03)


This script allows the user to plot eye movements in two dimensions and show positions of fixations and saccadic motions graphically.

Each experiment consists of a number of trials in which a subject is presented with a visual stimulus and the motion of the eye is tracked by suitable apparatus. This apparatus should output two voltages proportional to angular deflections in the X- and Y-directions respectively and these signals are the inputs to the CED 1401 connected to the PC running the script. When a trial is initiated the script displays an XY-plot of the motion of the subject's eye in real-time. Points of fixation are marked as the trace develops and saccadic motions are drawn at the end of the trial. A record of data concerning these features is kept in a log file.

A very simple sequencer file, eyemove.pls, is included which sends a digital output signal to the visual stimulus apparatus to trigger a trial of the required type.

A facility for scanning results and dumping data off-line is provided.

This script requires Spike2 v3.00 or higher along with a Power1401, a Micro1401 or a 1401plus; it cannot run with a standard 1401.

X-Y plot of eye movements
I_track.s2s (02/09)


This offline script displays eye movements relative to a target that is being tracked by replaying the data file and plotting the angular coordinates of each eye in an X-Y view.

The raw data is a time view of horizontal and vertical components of eye and (optionally) target movements, as recorded by a pupil-tracking camera system. This script then allows you to replay the data with a simultaneous display of the X-Y track followed by the eyes and the target. You can select the speed of the replay in the range 0.1x to 10x actual speed and select the duration of the tracks to display. Typically, you would choose to display the most recently replayed data, for example the last 0.5 seconds.

The .zip file contains an example data file that you can use to try out the script.

A full user guide is included in the comments section of the script file.

The script requires Spike2 version 6.09 or higher.

Skinner box


This script allows you to record of one or more channels of physiological data while a rat learns to press levers in a Skinner box. The times of each lever press are recorded as events (on ports 0 and 1) and the 1401 delivers TTL output pulses to trigger the release of a food pellet when the rat gives the required response. The timing of rewards is recorded on event port 2. You can set the duration of a refractory period after a reward during which no further rewards are given even if the correct lever is pressed.

Three experimental paradigms are available:

  1. Pressing either of two levers is rewarded (training).
  2. Pressing the left lever is rewarded.
  3. Reversal learning. Pressing the left lever is rewarded a set number of times and subsequently, only pressing the right lever is rewarded.

The .zip file contains an example data file that you can use to try out the script.

A full user guide is included in the comments section of the script file.

The script requires Spike2 version 3.00 or higher.

Create complex waveforms
Chirpetc.S2S (02/24) Improved!


This auditory stimulation and recording script allows you to:

  • Create complex waveforms such as chirps, ramps, chirp/ramp combinations, noise bursts, tone bursts and stimulus trains.
  • Add multiple waveforms to a sample configuration and then play them out via a 1401 DAC output during sampling as auditory stimuli.
  • Load up to 20 different stimuli in a sampling configuration (subject to 1401 memory constraints) for easy switching between multiple stimuli.
  • Play stimuli either as single shots triggered by pressing buttons on the Play wave bar or in sequences controlled by the script.
  • Play stimuli repetitively at fixed intervals, alternate strictly or randomly between two fixed intervals, or at random intervals within a defined range.
  • Control a CED3505 programmable attenuator.
  • Record physiological responses to these auditory stimuli and display them as triggered sweeps or in scrolling mode.
  • Use the example sampling configuration, Chirp eg.s2cx, for testing.
  • The ToneCal script (included) facilitates calibration of stimulus intensities.

Hardware requirements:

  • Power 1401, Micro1401 mkII, Micro3 or Micro4 with a ±5V range.
  • CED3505 programmable attenuator (if script control of stimulus intensity is required).
  • A suitable audio amplifier and loudspeaker or headphones.

The script requires Spike2 version 8.25 or higher.

Auditory Stimulation and Single Unit Recordings
AudioStimRecSU v705c.s2s (08/20)


This package of scripts allows you to generate acoustic and/or vibratory stimuli on one or two channels, record neural single-unit responses and perform online analysis of window discriminated spikes. These scripts were developed for research on the auditory system and lateral line organs of fish but should be suitable for a wide range of auditory studies on both vertebrates and insects.

This package enables you to generate acoustic or vibratory stimuli of known intensity and record intra- or extra-cellular single unit responses to these stimuli. Available stimuli include tone pips and symmetrical or asymmetrical tonebursts with frequencies ranging from 1Hz to 10kHz. It is also possible to stimulate with stored arbitrary waveforms (for example, pre-recorded sounds) or to trigger an external stimulator. The script can also generate pre-defined sequences of stimuli at a range of frequencies and intensities for rapid automated collection of the responses needed to generate threshold response curves.

The recording system includes a virtual window discriminator for spike detection. Online analysis of incoming data includes post-stimulus time, interval and phase histograms. Circular statistics are used to quantify the degree of phase -locking of spikes to the stimulus waveform. See the user guides for further details.

System Requirements:

Hardware: Micro1401 Mk2 or higher, CED3505 Programmable attenuator
Software: Spike2 v7.11 or higher
Scripts: AudioStimRecSU.s2s, SoundCalSU 703.s2s
Sampling configuration: SU.s2c
Sequencer: SU4.pls
Other files: MScaldataSU.txt, SpkcaldataSU.txt, SUSettings.txt
User guides: AudioStimRec SU.pdf, SoundCalSU.pdf, 3505_V2spec.pdf

Simple Auditory Brainstem Responses
fishabr v1.20.s2s (10/20)

fish abr release.zip

This Spike2 script package is suitable for recording auditory brainstem responses (ABR) to tone pip stimuli. It was developed for research on responses of fish to underwater sounds but may be equally useful for investigating the responses of other vertebrates to airborne sound.

The script generates symmetrical tone pips with a linear rise and fall phase and filled with carrier frequencies ranging from 5Hz to 10kHz via DAC0. The user can set up the shape of the tone pip, select its polarity (or choose alternating polarity), stimulus repetition rate and number of sweeps to include in the average. Stimulus intensity can be set in steps of 5dB over a range of 75dB using the CED program controlled attenuator. A calibration curve to correct for variations in intensity with stimulus frequency is applied automatically.

Pre-amplified neural responses recorded via ADC0 are processed by signal averaging. The averaged responses at each stimulus frequency are displayed in descending order of stimulus intensity for easy estimation of thresholds. The script builds up and displays threshold -response curve as the experiment proceeds.

System Requirements:

Hardware: Power1401 or Micro1401 Mk2, CED3505 attenuator
Software: Spike2 v8.00 or higher
Scripts: FishABR v1.20.s2s, SoundCalSU v703.s2s
Sampling configuration: Fishabr v1.15.s2cx, SU.s2cx
Sequencer: Fishabr v1.15a.pls, SU7.pls
Other files: MScaldataSU_0.txt, SpkcaldataSU_0.txt, abrsettings.txt
User guides: Fishabr v1.16.pdf, SoundCalSU7.pdf

Study motoneurone activity using PSF, PSTH and CUSUM
PSF 03e.s2s (04/18)


Peri-stimulus frequencygrams (PSF), peri-stimulus time histograms (PSTH) and cusum plots can be used to investigate the time course of synaptic input to motoneurones. The method involves recording the activity of a single motor unit via electrodes implanted in a muscle while repetitively stimulating a sensory nerve to generate synaptic input to motoneurones.

Given, an Event, Marker or WaveMark channel marking motor unit activity and an Event channel marking stimulation of the sensory input, this script allows you to generate PSTH, cusum and PSF plots on-line or off-line. You can also re-run an existing data file to simulate online recording for demonstration purposes.

The script includes a detailed user guide and a list of references to relevant articles.

The script requires Spike2 version 8.13a or higher.

Analyse visual responses to moving sinusoidal gratings
AR 05.s2s (08/20)

AR05 release.zip

Studies of motion sensitive neurons in the visual system often involve analysis of responses to sinusoidal gratings moving at different angles. In collaboration with the Ribic lab (Dept. of Psychology, University of Virginia), we have developed a combination of visual stimulation using PsychToolbox and recording and analysis using Spike2 to analyse motion sensitive units in multi-cellular recordings. The results take the form of PSTH plots and XY plots of Mean neuronal response vs. Stimulus angle.

The package:

  1. Specifies the hardware required
  2. Provides a Matlab script for stimulus generation
  3. Provides a Spike2 script for data analysis
  4. Provides an example data file so that you can familiarise yourself with the method

The script requires Spike2 v9.11 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 in the side menu. Then you can down-load them by clicking on the filename.

Cambridge Electronic Design Limited

Registered in England: 00972132

Registered office:

  • Cambridge Electronic Design Limited,
  • Technical Centre,
  • 139 Cambridge Road,
  • Milton,
  • Cambridge CB24 6AZ

VAT: GB 214 2617 96

Producer registration number: WEE/BD0050TZ

Terms and Conditions of Sale

For our US customers, we can provide tax form W-8BEN, that identifies us as a UK company.

DUNS: 219151016
NAICS: 423490
Commodity codes
Hardware: 84716070
Software: 85235190

By email:


By post:
  • Cambridge Electronic Design Limited,
  • Technical Centre,
  • 139 Cambridge Road,
  • Milton,
  • Cambridge CB24 6AZ
By telephone:

(Int.+44) (0)1223 420186

From North America (Toll Free):

1 800 345 7794