NATIONAL INSTITUTES OF HEALTH  
MatOFF LOGO NIMH BANNER PHOTO 4MatOFF BANNER PHOTO 2MatOFF BANNER PHOTO 1
 Link to MatOFF Home Link to MatOFF Download Page Link to MatOFF Commands Link to MatOFF Support
Link to FAQs
Link to Getting Started
Link to Importing Data
Link to MakDAT for Cortex
Link to Creating Plots
Link to Graphical Layouts
Link to Exporting Results
Link to Global Settings
Link to Scripting Language
Link to History Scripts
Link to Revision History
Link to History of MatOFF





 

Plexon to Cortex file conversion program: plx2ctx

Overview

New users should use mgplx2ctx rather than plx2ctx.

plx2ctx is a stand-alone Windows program that converts Plexon .plx files to Cortex file format.  This program is most useful when Cortex is used to control an experiment and passes event codes from a PIO port to the Plexon MAP DIN (data input) port.  The .plx file is created by the on-line spike sorter client and can be read and written by Offline Sorter and by NEX.  Files created by plx2ctx have the standard Cortex file format. A newer program for doing the conversion is mgplx2ctx. Check it out first.

Installation

There are now two version of plx2ctx. The original version requires the cygwin1.dll file.  The newer version, developed for use on Windows 2000 and Windows XP (but  may work on other Windows systems), does not require a separate dll file. The new version is sometimes called wplx2ctx when necessary to distinguish it from the original version.

Original version (very old): plx2ctx
Place cygwin1.dll in the same directory as plx2ctx. Place this directory in the path or make it the current directory.
Current Windows version: plx2ctx, also called wplx2ctx
Can be used in any directory without a special dll file.
More advanced MATLAB version: mgplx2ctx
If you are using MATLAB version R13 (v6.5) or later, GO HERE

The mapping file

Differences between the .plx file structure and Cortex file structure dictate the use of a mapping file when running plx2ctx. Plexon files contain a continuous data stream with specialized data headers for each type of data encountered. The plx2ctx mapping file provides instruction for breaking this continuous stream in to Cortex files and trials, and supplies a correspondence between Plexon spike and analog channels with Cortex data channels. 

An example plx2ctx mapping file is provided with this distribution.  It is called plx2ctx.map.  The entries in this file are described here.

Comments in the mapping file

Cortex files that are related to each other have the same file name and sequential file extension numbers (e.g., data.1, data.2, data.3, etc.).  Within an one of these Cortex files, the data are divided into trials.  Plexon files are continuous files that may include many trials and experimental conditions.  Thus, a single Plexon file might be mapped to multiple Cortex files, and each of these Cortex files will generally have many trials.  plx2ctx uses event codes to signal the start and end of Cortex files and Cortex trials.  This scheme requires that experimenter has included event codes in the data stream that can be used to demark the start and end of each file and the start and end of each trial.  It is not necessary to have codes to mark the beginning or end of files if you are satisfied with mapping one Plexon file to one Cortex file.  It is also not necessary to have codes for both the beginning and end of each trial.  One code at the beginning or end of a trial is sufficient to break the data into trials.

To break a Plexon file into multiple Cortex files, specify PLEXONSTART and PLEXONSTOP values in the mapping file.  PLEXONSTART specifies the event used to indicate the beginning of a new Cortex file.  PLEXONSTOP specifies the event used to indicate the end of a Cortex file.  Any data between a PLEXONSTOP event code and the following PLEXONSTART event code will be ignored.  Either PLEXONSTART or PLEXONSTOP can be set to zero.  If PLEXONSTART is zero plx2ctx will act as if a start event code was the first event in the file.  plx2ctx will put data into a single Cortex file until the first PLEXONSTOP event code is reached.  If PLEXONSTOP is set to zero, the first stop event will be the end of the file. 

Example:

PLEXONSTART: 258
PLEXONSTOP: 259

In this example, any data before event code 258 will be ignored.  Data will be placed into a Cortex file until event code 259 is encountered.  After that, a new event code 258 will make plx2ctx open a new Cortex file (adding +1 to the file extension number) and repeat the process.

Start and stop events for each Cortex trial mapping is similar to start and stop events for each file.  plx2ctx will start a new trial in the Cortex file whenever it encounters the CORTEXSTART event code specified in the mapping file.  The trial is ended when a CORTEXSTOP event is reached.  As with the PLEXONSTART and PLEXONSTOP events, you can set either one to zero.  If CORTEXSTART is zero, plx2ctx acts as if the file starts with a single CORTEXSTART event.  All data will be placed in one trial that ends with either a CORTEXSTOP event, a PLEXONSTOP event, or the end of the file.  If CORTEXSTOP is zero, there will also be only one trial.  It will end with a PLEXONSTOP event or the end of the file.

Example:

CORTEXSTART: 400
CORTEXSTOP: 401

This mapping file entry will start a new Cortex trial each time event code 400 occurs.  Events between code 401 and 400 will not be stored.

Spike and "slow analog" mapping

Plexon spike channels are hard-coded in terms of the electrode number (1 to 16, etc.) and the template number.  Cortex treats each spike as an event code.  The plx2ctx mapping file assigns an event code to each electrode and template:

S 1,0: 1
S 1,1: 2
S 1,2: 3
S 16,0: 201
S 16,1: 202
S 16,2: 203

In this example, the three templates of electrode #1 are assigned Cortex event codes 1 through 3, and the templates from electrode #16 are assigned to Cortex event codes 201 through 203.  

Analog channel mapping and number of bits

Plexon "slow analog" channels are mapped in a way similar to spike channels:

A 0: 1
A 1: 2
A 8: 3
A 9: 4

In this example the Plexon channels 0, 1, 8, and 9 are mapped to Cortex analog channels 1, 2, 3, and 4, respectively.  The EOG channels are Cortex analog channels 1 and 2.  (Not channels 3 and 4.)  Cortex analog channels 3, 4, 5, 6, ...17 are mapped to EPP channels.

The number of bits used for the analog data is controlled by the ANALOGBITS parameter.

ANALOGBITS: 12

With this command, the analog data is converted from the 16 bits used by Plexon to 12 bit Cortex values.

Time mapping

Plexon uses a different clock precision than Cortex for its file storage.  The TIMEDIVISOR entry divides the Plexon clock to the normal Cortex precision.

TIMEDIVISOR: 40

This value reflects the 40 KHz sample rate of the spike input DSPs.

Command line and options

The plx2ctx command is:

    plx2ctx  <options>  <plexon file name>  <cortex file name>

Here is a typical use of plx2ctx for a Plexon file called "monk.plx" and saved as a Cortex file using "monk" as the file prefix:

plx2ctx -mplx2ctx.map monk.plx monk

Note these  important things about the -m option:

  • plx2ctx will try a default mapping without it. Usually this is not helpful.
  • There are no spaces between the -m and the mapping file name.
  • The -m option is quite different from the -M option. 

Most of the other options are for debugging.  The -M option (capital M) will produce an example mapping file for you to edit.  Here are all the options:

-a Show array sizes for timestamps, events, eog values, and epp values
-c Show Cortex headers that are being created
-d Show debug
-E Show Plexon Event headers
-e Show events codes seen
-h Show Plexon header
-m<map file> Use the given file containing the Plexon to Cortex mapping
-M[<output map file>] Output the mapping used to the standard out or the given file. The output file is optional. If no file is given the output goes to the screen. The format is the same as the input mapping file (-m).
-s Show the settings used
-v Show version and exit



Copyright 2000-2009, NIMH Laboratory of Systems Neuroscience

This page was last updated May 21, 2009
webmaster



 The Division of Intramural Research Programs is within the National Institute of Mental Health (NIMH) is a part the National Institutes of Health (NIH), is a component of the U.S. Department of Health and Human Services.
  NIMH LOGO NIH LOGO DHHS LOGO USA GOV LOGO