ICA refers to a group of mathematical methods for separating sampled waveforms into statistically independent components. It is very useful for extracting the underlying signals from a group of recordings where each individual channel is an unknown mixture of signals from several underlying generators. For example, ICA offers a solution to the classical "Cocktail party problem": Can one disentangle individual voices from a conversational hubbub? ICA can do this provided that the sound was recorded from several different positions using multiple microphones.
ICA is also applicable in physiological recording situations where multiple electrodes are used to record underlying signals, for example, scalp EEG electrodes, intra-cranial multi-electrode EEG recordings, surface EMG recordings or electrode arrays in a tissue culture. Importantly, the method can also separate mains hum and sources of electrical interference from signals of physiological origin.
The price that you pay for excellent signal source separation is loss of amplitude information, - the results are normalised. However, if you can accept this limitation, ICA may be a very powerful form of analysis and well worth investigating.
The package includes:
ICA15a.s2s and ICAutils.s2s | The main script and library of script functions |
ICA15a guide.pdf | User guide to the script |
bssguide.pdf | An introduction to the the maths underlying ICA |
Sampled Sounds.smrx / .s2rx | Example data containing a number of entangled musical tracks |
icEEG example.smrx /s2rx | Example data from 3 intra cranial EEG electrode arrays heavily polluted with mains hum |
This script requires Spike2 version 9.
Extra-cellular multi-unit activity from peripheral nerves can be difficult to quantify. Individual units may not be identifiable because the signal to noise ratio is too low or too many units are activated simultaneously. In these circumstances, it can be helpful to rectify and integrate the signal over a short time range to convert the activity of an ensemble of units to a level that can indicate changing responses to stimuli. This script works on- or off-line on up to 4 source channels sampled at the same rate. You can increase the number of channels processed on-line by minor edits to the script.
This script has been tested with Spike2 v7.17 or higher.
This script calculates 'median' value of a selected waveform between two cursors and tabulates results in the log view. The median is the mid-point of the data range, that is, half of the data points are lower and half are higher values. This measurement is not currently available from the Cursor Regions dialog.
Note that calculating the median could take a noticeable amount of time when the number of data points in the chosen range is large.
There is a user guide on page 1 of the script file.
The script requires Spike2 v7.20 or higher.
Use this script to build average views from multiple result views, i.e. PSTH's, interval histograms, waveform averages, and power spectra. Both source and destination views may contain multiple channels. There are manual and batch processing options:
Each channel in a multi-channel grand average view has its own sweep count held in the channel comment.
The user guide is on pages 1 -3 of the script file.
The script requires Spike2 v 7.11 or higher
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 v7.20 or higher.
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.
This script automates the process of taking multiple Cursor Regions type measurements. You simply specify the source channel, the type of measurement to take and the time range over which to make it. For example one could specify the mean of a waveform to be measured in 30s bins. The results can be plotted as a RealMark or tabulated in the log. As a further refinement you can specify a State channel and marker codes to gate the analysis to time ranges of interest.
This script requires Spike2 v6.06 or higher.
The Gabor function is a sine wave damped by a Gaussian function.
This script allows you to fit a Gabor function to physiological data. An example application might be to detect oscillatory neural activity in auto-correlograms, e.g., Young et al (1992). The script also generates test data that you can use to familiarise yourself with the curve-fitting procedure.
You could also use this script as a template for fitting other functions by non-linear regression using the FitNLUser() script function.
This script requires Spike2 v6.06 or higher.
REFERENCE Young MP, Tanaka K, Yamane S (1992) On Oscillating Neuronal Responses in the Visual Cortex of the Monkey J NeuroPhysiol 67:1464 - 1474
This archive contains scripts that enable you to:
The respiration analysis script enables you to:
The archive also includes user guides, example data files and sampling configurations that should help you to get started. These scripts require Spike2 version 8.09 or higher.
They are beta versions. Send your bug reports and ideas for further development to geoff@ced.co.uk
In this Spike2 script, we use physiological left ventricle and tracheal pressure signals, obtained simultaneously by catheterization, to determine the interactions between cardiac hemodynamics and respiratory function. Metrics of systolic and diastolic function are calculated and separated into inspiratory, early expiratory, and late expiratory phases of respiration to characterize the effect of each respiratory phase on parameters of left ventricle function.
This script requires Spike2 v10.01 or higher.
This family of Spike2 v7 scripts and sampling configurations allows you to perform long-term recordings of blood pressure, heart rate and sympathetic activity and to analyse baroreceptor reflexes and heart rate variability. The scripts are suitable for use with a range of laboratory animals and can record data from up to 8 animals simultaneously when used together with telemetry systems.
HRBP8b.s2s derives systolic, diastolic and mean blood pressure, heart rate and respiratory rate from each blood pressure trace. Data from up to 8 animals can be analysed on- or off-line. Results are recorded continuously or according to a user-defined schedule, e.g. 10 minutes per hour. Data can be auto-saved to a new file at regular intervals (e.g. every 24 hr.) in order to achieve virtually continuous recording over days or weeks.
MergeFiles.s2s /SplitFiles.s2s These utility scripts allow you to splice auto-saved data files end to end before further analysis and to split data related to different animals into separate data files.
sBRG.s2s This offline script calculates baroreceptor reflex sensitivity based on spontaneous fluctuations in blood pressure.
SigFit.s2s Fits sigmoid curves (4 and 5 parameters) to heart rate and blood pressure data derived from steady-state experiments.
HRV1.s2s Performs frequency domain analysis of heart rate variability.
Poincaré s2s Performs non-linear analysis of heart rate variability.
HRBPtable.s2s Generates tables of results suitable for further analysis with spreadsheet software.
Baro5.s2s This is a library of script functions required by the SigFit script.
This family of Spike 2 scripts require v7.12 or higher.
This offline script generates a heart rate channel (bpm) and an RR interval channel (ms) based on an ECG channel in the current time view. There is also an option to create a table of heart rate and RR intervals beat by beat, along with keyboard markers and TextMarks (often used to indicate the timing and details of experimental treatments). The script includes a brief user guide that displays when you click on a toolbar button.
The script requires the latest Spike2 version 8, v.9 or v.10.
This script allows you to:
Create additional channels in your data file derived from a blood pressure trace. The extra channels available are: Heart rate, inter-beat interval, diastolic bp, systolic bp, and pulse bp.
Process a single bp trace online or multiple bp traces offline.
Simulate online recording by replaying an existing time view using the REPLAY button.
Display a table of "current" blood pressure statistics that updates every second online or during REPLAY.
Generate a table of beat times and amplitudes for each derived channel in a grid view. There is also an option to include experimenter's notes and stimulus timing information stored in the Keyboard marker and TextMark channels. This table can be saved or pasted into spreadsheet software for further analysis.
This script requires v8.20 or higher.
The HRV_10 script performs frequency domain analysis of pulse interval (PI) and also variability of systolic and diastolic blood pressure.
Long-term recordings are subdivided into user-defined epochs with separate power spectra for each time range. HRV waveforms can be edited to exclude artifacts prior to the generation of multi-channel power spectrum views.
Spectra are subdivided into user-defined VLF, LF and HF bands and the levels are plotted to the source data file and tabulated in a spreadsheet.
A second script HRV10 revu.s2s provides a convenient method for reviewing existing data files.
Both scripts require Spike2 v9.17 or higher.
This script generates an amplitude distribution histogram from a Waveform, RealWave or WaveMark channel. You can select the required channel, time range, amplitude range and bin size using a combination of cursor dragging and dialog entries. The results can be displayed in various forms including number of points, Time and percent time in each amplitude bin. A user guide is included in the comments at the head of the script.
This script requires Spike2 version 6,04 or higher. It also makes use of functions in the script file GHutils.s2s (included in the download). This file must be located in a folder called include located inside the directory holding your copy of Spike2.
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.
Create level channels in a data file that mark groups of Events, Markers or Wavemarks. Plot burst duration, inter-burst interval, burst period or events /burst vs time.
Create additional channels showing burst rate, burst onset times, and events within bursts and events not in bursts.
Generate a table of burst statistics that can be easily copied to a spreadsheet for further analysis.
For many applications it is important to know the timing and duration of periods when the level of a waveform channel exceeded a user-defined upper threshold, fell below a lower threshold or was between these levels. This script provides a convenient method of displaying and analyzing the number and duration of high, intermediate and low states.
The script allows you to do the following:
This script requires Spike2 version 5.09 or higher.
This script records trigger and response signals. It creates a PSTH result view and integrates it to produce a cumulative display. This is done on-line as the data is sampled. Two channels are defined: a trigger channel and a response event channel.
This script creates a histogram of the distribution of instantaneous frequencies of events, Markers, RealMarks or WaveMarks in a Spike2 time view. It may be useful for plotting the frequency distributions of nerve impulse trains in response under various experimental conditions.
This script requires Spike2 version 8.03 or higher.
This script assigns sleep scores (Wake, NREM, REM and Doubt) based on recordings from rate or mice of hippocampal EEG and nuchal EMG. It implements the method of Costa-Miserachs et al (2003). The script includes a user guide that should be read in conjunction with the original article: The zip file includes a data file that shows typical results and can be used to test the script.
Costa-Miserachs D, Portel-Cortez I, Torras-Garcia M, Morgado-Bernal I (2003) Automated sleep staging in rat with a standard spreadsheet. J.Neurosci Methods 130:93-101
This script requires Spike2 version 8.03 or higher.
This script is intended for on-line sleep staging in rats, mice or chicks. Sleep is divided into epochs of WAKE, NREM or REM sleep based on recordings of one EEG and one EMG channel per animal. The script can generate user-defined patterns of output pulses when a target sleep stage (e.g. REM) is detected. These pulses are suitable for controlling a laser in optogenetic studies.
The script is also suitable for simpler applications such as off-line sleep staging or plotting EEG spectral power in up to 4 frequency bands off-line.
Recording more than 2 animals simultaneously requires a breakout box (CED 2805 DIO-8) or a home-made custom cable in order to connect to digital inputs and outputs on the rear panel of a 1401 interface.
This script requires Spike2 version 8.08 or higher.
This script allows you to perform the following tasks:
This script requires Spike2 version 7.10 or higher.
This script works on data files that contain one or more EEG channels and a sleep stage marker channel (a state channel with vigilance states marked by differently coloured bars).
You can create multiple EEG spectral channels, showing EEG power-in- band, dominant frequency or spectral edge. The script then generates a table of results showing the spectral characteristics of each successive episode of a user-defined sleep state (e.g. NREM) during a long term recording. This allows you to quantify changes in spectral characteristic with time and effects of optogenetic or other stimulation. The table generates a summary every hour or time interval of your choice so that trends can be identified more easily.
There is an option to “gate” the results, that is, to include or exclude data that falls in a time range around markers in a nominated channel.This means that you can, for example, exclude all data during stimulation, or include data for a specified time range after stimulation.
This script requires Spike2 v8.12 or higher.
This script generates sleep scores for a rat or mouse based on one EEG channel and one channel of EMG from a neck muscle.
The script subdivides the data into short segments and allows you to score a subset of these epochs by visual inspection as WAKE, NREM, REM or UNCLEAR. These scores are marked in the data file in a colour-coded State channel. They serve as 'training data' for a machine learning algorithm that classifies the remaining epochs to best match the training criteria and returns the results in a second colour-coded state channel. The script has options to generate spectral power in bands, gated by sleep state and print results in spreadsheet format.
Requirements:
The script requires Spike2 v 10.04 or higher for full functionality.
In order to use the machine learning feature, a 64-bit version of Matlab with signal processing toolbox must be present and set up as an automation server.
The script has a detailed user guide that includes instructions on how to set up communication with Matlab. Further details on 'Troubleshooting the Matlab connection' are available via the Spike2 online help.
This script is based on software contributed by Henna-Kaisa Wigren and collaborators at the Institute of Biomedicine, Helsinki.
This is a multi-stage process.
You can export the waveform data as European data format (.edf) and then import the .edf file into Spike2 for further analysis. However, data on sleep states and the onset and duration of manually scored events, -eye movements, apnoeas etc. are stored in a resource file (.xml format) that cannot be read directly by Spike 2.
Convert the .xml file to .txt format by copying the Profusion™ resource file from a web browser window to a simple text editor such as Notepad™ via the Clipboard and save it. You can then import the sleep stage and event information from the text file into the corresponding Spike2 data file using this script.
This script imports data saved in the CMPPSGSCOREDATA format.
There is a user guide in the comments at the start of the script file.
This script requires Spike2 v7.17 or higher.
This script works in a similar way to the previous script. However, it is intended to import text files created from .xml files in the Compumedics CMPSTUDYCONFIG format.
There is a user guide in the comments at the start of the script file.
This script is based on one contributed by Dwayne Mann, Biomedical Engineering, University of Queensland. If it works for you then it is thanks to him; if it doesn’t, you can blame me (GH).
This script requires Spike2 v7.10 or higher.
This is a multi-stage process.
You can export the waveform data as European data format (.edf) and then import the .edf file into Spike2 for further analysis. However, data on sleep stages are stored in a resource file (.xml format) that cannot be read directly by Spike 2.
Convert the .xml file to .txt format by copying the Somnologica™ resource file from a web browser window to a simple text editor such as Notepad™ via the Clipboard and save it. You can then import the sleep stage information from the text file into the corresponding .Spike2 data file using this script.
There is a user guide in the comments at the start of the script file.
This script has been tested with Spike2 v7,17 and 8.08.
This script converts a list of sleep stages in a text file into a channel of colour coded sleep states in a time view.
It is intended to cope with the situation where waveform data but not sleep stages can be imported into Spike2 from a foreign data format. The text file to import may contain multiple columns of times, spectral powers etc. However, the script only reads 1 specified column that contains a list of sleep stage labels such as W, R, NREM etc.
You only need to specify the duration of a sleep stage and the start time of the first epoch. The script assumes that all epochs in the table are contiguous and of equal duration.
This script requires Spike2 version 7.17 or higher.
Most Spike2 sleep scoring scripts mark sleep states as a colour-coded 'state' channel. This offline script allows you to create a hypnogram channel based on a sleep state channel. Here, sleep states are represented by different levels of a skyline plot. The script creates a hotkey on the Script Bar for quick access and has a user guide that is displayed when you press the Help button in the Setup dialog. You can choose which levels correspond to each sleep state in the range -1 to 9.
The script requires Spike2 version 8.25 or higher.
This script is intended for detecting events such as seizures or sleep spindles in EEG recordings. These events can be small and variable and so detecting them is not a trivial task. This script attempts it using a multi-stage strategy.
Events are marked as coloured bars in the source data file and results can be tabulated in a spreadsheet and plotted as event count and event duration per epoch.
This script requires Spike2 version 8.24 or higher and the library ug.s2s. Copy this file to the include folder in Documents/SpikeN (where N is a version number) or keep it in the same folder as the main script.
The optokinetic response (OKR) of larval zebrafish constitutes a potentially useful model for the study of neurological diseases affecting vertebrate oculomotor function. OKR can be measured via a video system e.g. Scheetz et al 2018 (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5708171/ ) and the results can be imported into Spike2 for further analysis with this script. The script may also prove useful for measuring OKR of other species recorded using alternative methods and sampled directly using Spike2 and a 1401 interface.
The script measures 6 aspects of the response to a visual grating moving at a range of angular velocities. They are: amplitude and slope of the fast and slow phases of saccades, frequency of saccades and reflex gain. The measurements are plotted in the source data file and can be tabulated in spreadsheet format.
The script has a detailed user guide and we provide an example data file and example results so you can familiarise yourself with script operation.
The script requires Spike2 v 10.21 or higher.
The purpose of the script is to calculate the mean and the mean deviation of a set of angles (or other variables) given by a textfile. In addition, it performs the Rayleigh test of uniformity, which tests whether the distribution of angles differs significantly from uniformity. The down-load contains the script and two test files.
This script converts motion in a video recorded using the Spike2 multimedia facility into up to six "Activity" traces in the corresponding time view, logging movement in different user-defined areas of the frame. The script is intended for logging the activity of rats or mice or birds in adjacent cages videoed from above by a single webcam while other physiological signals (EEG, EMG etc.) are recorded. The activity traces can be used as part of the input to a semi-automated sleep staging process (e.g. OSD4.s2s, above).
The script does not attempt to track moving objects. It simply interprets changes in the grey-scale value of each pixel between frames as due to motion -rather than flickering lights, for example. This approach, though simplistic and qualitative, should provide an adequate indicator of movement in relatively homogenous environments.
The script works with avi and mp4 video files and requires Spike2 v10.02 for full functionality. It should work with some minor limitations in Spike2 version 9.10.
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.
Mains ‘hum’ is often complex and composed of odd harmonics of the mains frequency, making it very difficult to remove or suppress using simple high pass or notch filters. HumRemoveExpress.s2s is a Spike2 version 7 script that you can use offline to strip out much of this residual mains interference, making your data much more presentable and easier to analyse. This video tutorial shows how to use the script to remove mains hum.
Registered in England: 00972132
Registered office:
VAT: GB 214 2617 96
Producer registration number: WEE/BD0050TZ
For our US customers, we can provide tax form W-8BEN, that identifies us as a UK company.
(Int.+44) (0)1223 420186
1 800 345 7794