Recovering data from old applications

Top  Previous  Next

Data in ASCII format

 

Of course, you may not have the luxury of redesigning your task to store data in a machine-friendly format. If you're lucky enough to have electronic output in ASCII form, it may not be in neat comma-delimited files but look more like this:

 

d62-990519.txt

Box 6: 62 - ; Wed,19 May 1999.12:41:50, 200 min session

RIGHT Lever active: Overall FR 1, FR 1 for CS

Reinforcements per spell: 1

CS duration (csec): 100

Reinforcement delay (csec): 100

Lever retraction time (csec): 2000

Reinforcement duration (csec): 728

 

Active: 59     Inactive: 13     Stimuli: 44     Reinforcements: 44

 

...

 

This is part of an output file from an old second-order schedule of reinforcement written in Arachnid. All great for a human to read, but a pain for a computer. It can be handy to have a human-readable file like this, but this should only be in addition to a computer-readable format.

 

My usual solution to this problem is to write a mini-program in Perl, a language especially designed for searching for patterns in text files and extracting data from them (see Getting data into a database for a discussion of using Perl tools). For the example above, I have a Perl script that scans through, extracts the data and creates a set of comma-delimited files, which can be amalgamated and imported into a database. (Perl is free and quite easy to learn; see the bibliography at the end of this guide for details.) My new Whisker-based SecondOrder task stores data directly into a database (its computer-readable format), and keeps a human-readable summary file that looks like this:

 

m4-03Mar2000-1020-summary.txt

SECOND-ORDER I.V. SELF-ADMINISTRATION – SUMMARY FILE

...

Rat: m4

Session: 24

Date/time code: 03-Mar-2000(1019)

...

Session time limit (min): 120

Locomotor time bin size (min): 20

...

Reinforcement device: PUMP

Max #reinforcements: 10

Pump infusion duration (s): 5.83

...

Number of stimuli: 41

Number of reinforcements: 4

Finished at: Fri 03-Mar-2000, 12:39

Active lever responses: 454

Inactive lever responses: 87

 

which is one of the easiest formats to read into Perl if you needed to (each file follows exactly the same format; there's one piece of information per line; there are a few sections with comma-delimited output that can be copied directly into a file for database import).

 

Data not in ASCII format

 

If the numbers that make up your data set are stored in some obscure format, it's still possible to extract them, but you may end up having to write a program in a general-purpose language like C or C++ to extract them. This is beyond the scope of this guide.