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

Spike2 scripts


Editing

Batch import "foreign" file formats
uBatchImport.s2s (09/22)

uBatchImport.zip

You can import many foreign data formats into Spike2. Individual files can be imported interactively via Import on the Spike2 File menu. However, this becomes tedious if you have many files of the same type to import. This script allows you to import all files of a user-defined type in a specified folder. Certain restrictions apply. For example, some formats can only be imported using the 32-bit version of Spike2. See the on-line help under "import foreign data file" for further information.

The script requires Spike2 v8.04 or later.

Improvement:

  • DSI importer now works
  • ADI LabChart
  • Lab streaming layer (*.xdf)
  • The TDT importer has been updated.
  • Ponemah and Xltek -Neuroworks importers have been added. (users of Spike2 8.08 and higher).

Hum Remove Express
HumRemoveExpress.s2s (01/18)

HumRemExpress.zip

This script is a streamlined hum removal script for use when you have recorded a reliable hum marker event channel using the CED Mains pulser or similar device. See a video demonstration.

If you need to derive a hum marker from a waveform channel that contains hum then you should use the original HumRemove script

The script requires Spike2 v7.20 or later.

Hum Remove
HumRemove.s2s (02/18)

HumRemove.zip

This script is designed to improve the signal-to-noise ratio of physiological recordings by removing mains-related interference. This is done, not by filtering, but by subtracting an estimate of the mains interference from the raw data and storing the results in a new channel.

This upgraded version of the script requires Spike2 v7.20 or later.

Waveforms should be recorded with a sampling rate of at least 500Hz and preferably 5kHz or higher. The best results will be obtained if you record a dedicated waveform channel that clearly shows the ongoing mains frequency oscillation in addition to your data channels. This could be simply the mains pick-up from an unshielded cable. The script can use this signal to generate an event channel of timing marks at the onset of each mains cycle. These time marks are then used to calculate the mains interference signal to subtract from each waveform to clean it up.

See the data sheet Hum Remove.pdf, included in the HumRemove.zip file, for full details.

Convert .smr files to 400 channel big file format
Batch400.s2s (08/18)

batch400.zip

Normal Spike2 time views can have up to 400 channels and a size up to 2 GB. However, the default number of channels created by a sampling configuration is 32. This may not be enough if your data analysis involves creating many additional channels.

This script allows you to batch convert all the .smr files in a selected folder to 400 channel big file format so that you do not run out of free channels during analysis and can grow your file beyond the 2GB size limit. This script has been carefully tested. However, there are no guarantees. Back up your data before running it!

Annotate a data file
Add Tmk.s2s (01/17)

AddTmk.zip

This script allows you to add TextMarks to a time view, off-line. You can use it to add or delete TextMarks in an existing disk-based channel or create a new TextMark channel. The script creates a hotkey labelled Add Tmk on the Script Bar. Click on this button or its keyboard shortcut Alt+T to run the script. The main script dialog has a Help button. Click on it to display the script’s user guide.

The script requires Spike2 v6.18 or later.

Mark significant data with coloured bars
MarkStates.s2s (09/16)

MarkState.zip

This script allows you to create a ‘state’ channel in a time view and use it to mark significant time ranges in your data with coloured, labelled bars. These bars can be added automatically to mark episodes when a waveform channel exceeds (or falls below) a user-define threshold. Alternatively, you can mark time ranges manually by clicking and dragging with the mouse.

Up to 6 different colours and labels can be used per State channel to mark different types of event. The script can generate a simple report of the onset times and durations of states and the order in which they occurred.

Tested with Spike2 v 7.18 and 8.10

Time shifting event data
TimeshiftEvents.s2s (04/10)

TimeShiftEvents.zip

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.

The script requires Spike2 v5.21 or later.

Insert event trains off-line
AddEvents.s2s (04/10)

AddEvents.zip

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.

The script requires Spike2 v5.21 or later.

Number events from 1 to n
StimNumber.s2s (04/10)

StimNumber.zip

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 at 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.

The script requires Spike2 v5.21 or later.

Re-run a Spike2 data file and video, marking behavioural events and states
Ethogram.s2s (11/23) New!

Marking.zip

This script allows you to annotate physiological data that was recorded together with a video (usually of animal behaviour) created using s2video. You can replay the video and Spike2 data at the desired speed and mark significant behaviours in the data file via the keyboard. The script creates two channels for recording different categories of behaviour, "States" and "Events".

States are marked with colour-coded horizontal bars that start when you hit the relevant key and continue until you press space bar or start another state.

The Event channel simply records the occurrence of brief behaviours with colour-coded TextMarks. Both States and Events are also marked in 'skyline' plots,where each behaviour type is represented by a different level (analogous to the hypnograms often used in sleep studies). The 'level' channel for events has brief deflections of a standard duration (0.2s).

You can specify up to 26 behaviours (one per letter of the alphabet) along with a label for each one (up to 80 chars.). The labels display in State markers or when you point at an Event mark with the mouse.

The script has editing tools so that you can correct mistakes in the ethogram channels. and generates a table summarising the results.

You can view and print out a user guide by clicking a button on the script toolbar.

Requirements: Spike2 v 8.25 or higher, and the library ug.s2s.

Edit channel titles quickly and reversibly
ChanReName.s2s (08/23) Improved!

ChanReName.zip

Some Spike2 scripts, usually those which process multiple data sets stored in a single file, require that channel titles match a specific naming scheme in order for the script to recognise which channels to process. For example, scripts processing systolic blood pressure traces from multiple animals may require blood pressure channel titles SBP: 1 through to SBP: n.

This script provides a quick way to rename multiple channels to match the requirements of an analysis script and, to restore the original channel titles afterwards. Up to 20 channels can be re-titled in a single pass. You must run the script again to restore the original titles.

The script adds a hotkey labelled "ChRename" to the script bar for quick access.

This script requires Spike2 version 7.20 or higher.

Align comments in a script
Align Comments.s2s (08/15)

AlignComments.zip

This script is a utility for script writers. It improves the layout of a script by aligning the comments on lines containing code to a common, user-defined offset.

This script requires Spike2 version 6.04 or higher.

Tidy up the layout of a script
Script_Tidy.s2s (04/08)

ScriptTidy.zip

This script is a utility for script writers. It can improve the readability of scripts especially longer ones with many functions and procedures.

Available options include: removing constants and variables that were declared but not used and sorting functions and procedures into an alphabetical list after the main program. The most convenient way to run this script is via a button on the Script Bar.

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.

Merge Files
MergeFiles.s2s (08/24) Improved!

MergeFiles.zip

This utility script allows you to:

  • Merge all the time views in a selected folder into a single data file
  • Copy and paste data between open time views
  • Delete data from selected time ranges in a time view

The download includes a .pdf user guide and also a plain text version that displays when you click on the GUIDE button on the script toolbar.

This script requires Spike2 version 7.17 or higher.

Concatenate Files
Concatenate01.s2s (06/18)

ConcatFiles.zip

This script is intended for merging batches of data files that were recorded in a time sequence with the same sampling configuration. Files are joined end-to-end and gaps are inserted when there is a delay between the end of one recording and the start of the next. This means that a time axis accurate to the nearest second is maintained. This is especially important when concatenating long-term recordings where time of day and duration of gaps is important.

The script applies the resource file of the first source file in a batch in order to retain Virtual channels, channel processes, channel display order etc. in the destination file.

Further information is contained in the comments at the start of the script itself.

Tested with Spike2 v8.05. Compatible with Spik2 v7.07 or higher.

Delete Ranges
DeleteRanges04.s2s (11/17)

DeleteRanges.zip

This script requires Spike2 v7.07 or higher. It allows you to delete marked time ranges from a Spike2 time view. Mark the time ranges to cut out using the TimeRanges.s2s script in your Spike2 scripts folder. Then run this script to create a new edited data file.

The original data is untouched. You could use this script to generate ‘edited highlights’ of your data or to remove stimulus artefacts.

Copy RealMarks to RealWave channels
RmktoRWave.s2s (03/23)

RmktoRWave.zip

You can create a permanent RealWave copy of data stored in RealMarks interactively by creating a Virtual channel that uses the Rm() or Rmc() expression and then saving that channel to a disk channel. However, this becomes time-consuming if you have multiple channels to process. This script is intended to speed up the task.

The script operates on the current view via a Script bar button and can process a single channel or multiple selected RealMark channels. Click the Guide button in the main script dialog to display the user guide in the log view.

The script requires Spike2 v8.24 or higher.

Remove artefacts that extend above or below the level of physiological data
UnClip.s2s (02/20)

unclip.zip

Many types of analysis involve detecting events that cross a threshold level. This threshold is usually based on the mean level+ some multiple of the standard deviation.

Measuring the mean and stdev is tricky in cases where the data is affected by artefacts that cause the waveform repeatedly to hit the limits of the recording range, ie, 'clipping'. This is a problem that is often encountered when using telemetry systems to record EEG or ECG.

This "no frills" script provides a method to alleviate this problem by identifying artefacts that exceed or fall below a user-defined threshold and making a RealWave copy of the affected channel with the artefacts replaced by a user-defined baseline level. It should reduce the distortion of mean and sd measurements and make the data easier on the eye by removing glitches.

This script requires Spike2 v7.19 or higher.

Artifact Component Specific Rejection (ACSR)
ACSR.s2s (02/23)

ACSR.zip

These scripts are intended for reducing the impact of artifacts in physiological recordings. They may help significantly in situations where:

  • a constant level of unwanted signals persists throughout a recording.
  • The artifacts can be recorded in isolation.
  • They cannot be eliminated by the usual shielding methods.

In simple terms, the scripts use spectral analysis to characterise the artifact signal alone (training data) and to subtract it from the spectra of short overlapping data blocks containing artifacts plus physiological data. These modified spectra are then inverse transformed back from the frequency to the time domain and re-assembled into a filtered version of the original, artifact-affected waveforms.

The method is based on the paper:

"A Novel Technique to Reject Artifact Components for Surface EMG Signals Recorded during Walking with TranscutaneousSpinal Cord Stimulation: A Pilot Study" by Kim et al., from Frontiers in Human Neuroscience, June 2021, Vol 15, Article 660583

The package includes 4 principal scripts together with several libraries of script functions and examples.

Users of Spike2 v10.17 or higher can use the scripts ACSRoffline.s2s and ACSRonline.s2s to apply the method off- or on- line respectively. Users of the latest Spike2 v8 and v9 can use the slower versions ACSR9offline.s2s and ACSR9online.s2s

ACSRinclude.s2s, ACSR9include.s2s, ug.s2s and ghutils.s2s are libraries of script functions required by the main scripts. Save these files to the folder named include in your Documents/SpikeN folder (where N is a version number). Alternatively, keep them in the same folder as the principal scripts.

The .zip file includes a .pdf user guide and a data file ACSRexample data.smrx (and .s2rx) that you can use to try out the offline scripts. This file contains 2 channels of continuous artifact (mainly mains hum) plus episodes of EMG. Also provided is a sampling configuration, ACSRtst.s2cx that will allow testing of the online scripts.

Remove artefacts from an event channel
debounce.s2s (07/09)

debounce.zip

This simple script cleans-up an event channel by copying to another event channel, leaving out all events occurring too soon after the last event.

Remove ECG artefacts from EMG channels
ECGDelete 03.s2s (10/24) Improved!

ECGdelete.zip

This script is designed to reduce the size of ECG artefacts in one or more EMG recordings by reference noise subtraction. You will need to record a dedicated ECG channel alongside your data as a source for Events marking the position of the artefacts unless the artefacts on the EMG channels themselves are sufficiently large for reliable triggering. The script may also be suitable for other situations where data is distorted by repetitive trains of very similar artifacts, e.g. artifacts caused by repetitive electrical stimulation.

This script requires Spike 2 version 8.03 or higher

Remove stimulus artefacts
artrem.s2s & artrem6.s2s 03/16

artrem.zip

Removes stimulus artefacts from data channels, replacing the artefact with a straight line to preserve continuity. Artefacts can be identified by timing from a trigger channel, or by cursor positions.

The download now includes an updated version for users of Spike2 v6 and higher. The basic version is still available for users of earlier versions of Spike2.

Fix Glitches
FeatureDetect.s2s (10/11)

FixGlitch.zip

This version 7 script replaces glitches or artefacts on a Waveform or RealWave channel using linear prediction. Put simply, the script replaces segments of “bad” data with a wavefom of similar spectral content to the “good” data on either side of the glitch.

Convert a result file to a data file
RES2SMR.S2S (06/02)

res2smr.zip

Converts result file data back into a data file to allow data file specific use. This requires Spike2 version 4 or later.

Process event channels in a time view
ProcEvts.s2s (01/17)

ProcEvts.zip

This is a general purpose script that is useful for creating and editing Event, Level, Marker, TextMark, RealMark and WaveMark channels in a time view.

Using this script you can:

  • Create a new marker channel holding the times of peaks, troughs and level crossings in a waveform or RealWave channel
  • Set up a virtual window discriminator to detect peaks or troughs in a waveform channel that lie within a user-defined amplitude range
  • Create a new marker channel and add markers manually, using a cursor to set the time and dialogs to enter additional information, e.g. Marker codes, Text- or Real-Mark values
  • Create a new channel by combining groups of items copied from several other channels
  • Edit pre-existing marker channels, either by adding new markers, deleting them or by changing the Marker codes, Text- or Real-Mark values associated with existing markers
  • Easily eliminate spurious markers caused by switch bounce

This script requires Spike 2 version 5 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.

×

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.

  • ADInstruments Labchart
  • Alpha MED Sciences
  • Alpha Omega Engineering
  • Axon Instruments
  • Axona
  • Binary data
  • Bionic/Cyberkinetics
  • Biopac
  • CED CFS
  • CED SON (Macintosh)
  • COLD_Datein
  • CONSAM (D. Colquhuon)
  • DATAQ Instruments (Codas)
  • DataWave
  • DATAPAC
  • Data Sciences International
  • Delsys Files
  • elmiko medical
  • European Data Format(+)
  • Grass-Telefactor (PolyView)
  • HLR Data Format
  • Heka Data Format
  • INTAN
  • LabRecorder
  • LabStreamingLayer - LSL
  • Multi Channel System (Mc_Rack)
  • MindSet (16/24) data Files
  • MindWare data files
  • Motion Labs Systems Files .c3d
  • NeuroScan
  • Neuralynx
  • NewBehavior
  • Plexon
  • Ponemah 6
  • RC Electronics
  • Ripple Neuro
  • Text files
  • TMS International
  • Tucker-Davis Technologies
  • WAV (Microsoft)
  • WaveMetrics Igor Pro (PC/Mac)
  • Xltek Neuroworks
×
Cambridge Electronic Design Limited

Registered in England: 00972132

Registered office:

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

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
CAGE/NCAGE: KB797
NAICS: 423490
Commodity codes
Hardware: 84716070
Software: 85235190
×

By email:

info@ced.co.uk

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

(Int.+44) (0)1223 420186

From North America (Toll Free):

1 800 345 7794

×