On this page:
5.1 Experiment Folder Structure
5.1.1 experiment.yaml
5.1.2 Group Directories
5.1.3 Subject Directories
5.1.4 Subject Files
5.1.4.1 Comment Lines
5.1.4.2 Header line
5.1.4.3 Data Rows
read-events-from-file
read-event-vectors-from-file-rows
read-event-vector-from-rows
8.0

5 Data Files

Import and Export of Event Data Files

    5.1 Experiment Folder Structure

      5.1.1 experiment.yaml

      5.1.2 Group Directories

      5.1.3 Subject Directories

      5.1.4 Subject Files

        5.1.4.1 Comment Lines

        5.1.4.2 Header line

        5.1.4.3 Data Rows

5.1 Experiment Folder Structure

Names in <> are set by user.

<Experiment>/

    experiment.yaml

    <Group1>/

        subjects/

            <subject1>/

                <subject1file1.csv>

                <subject1file2.csv>

            <subject2>/

                <subject2file1.csv>

                <subject2file2.csv>

      <Group2>/

        subjects/

            <subject3>/

                <subject3file1.csv>

                <subject3file2.csv>

            <subject4>/

                <subject4file1.csv>

                <subject4file2.csv>

 

5.1.1 experiment.yaml
5.1.2 Group Directories

Each group of subjects is placed within its own folder, with the same name as the group ( e.g. "Control"/, "Drug"/) as the group names in experiment.yaml.

5.1.3 Subject Directories

There is a "subjects" folder within each group folder, and with the "subjects" folder is one folder for each subject in the group (e.g. "Rat01"/, "Rat02"/, etc)

5.1.4 Subject Files

Each subject folder (e.g. "CA01"/) contains the individual data files recorded for that subject. Typically each data file represents a single day (or whatever the recording interval was).

Each subject file is a plain-text CSV file, with:

1. initial comment lines prefixed with a hash (#), 2. a single header line to define data columns (number of columns must be a multiple of 3) 3. rows of recorded data.

# expt: CA

# subject: CA01

# recording-start (y-m-d HH:MM): 2005-07-22 10 00

# recording-start (msec): 1122026400000

# recording-end (y-m-d HH:MM): 2005-07-23 09 00

# recording-end (msec): 1122109200000

leftlicks,mag,dur,rightlicks,mag,dur,food-cup,mag,dur

1122026400000,1,6000,1122026400000,1,6000,1122027090000,4.5,6000

1122027030000,1,6000,1122078696000,1,6000,1122027096000,0.2,6000

1122027138000,3,6000,1122080790000,1,6000,1122027126000,1.1,6000

5.1.4.1 Comment Lines

Comment lines at the start of each data file are prefixed with hashtag/octothorpe (|#|), and have format:

# <key>: value

The required lines by key, are:

Other comment lines could of course be included, but are currently ignored.

5.1.4.2 Header line

The header defines the columns of data. For each event-recorder (eg a lickometer, or a photobeam) there will be 3 columns, corresponding to the starting time-stamp, the magnitude of the event, and the duration of the event. So for a file with "lickometer" and "photobeam" events, the header line would be:

lickometer,mag,dur,photobeam,mag,dur

5.1.4.3 Data Rows

Each row of data gives the timestamped data for each event-recording, in triplets of cells for timestamp, magnitude, and duration.

These three triplet cells are repeated on each row for each event-recorder.

NB the number of rows can vary for each event-recorder. The total number of rows in the file will be equal to the maximum recorded events across all event-recorders. Any event recorders with fewer than the maximum number of events will have empty cells in their terminal rows.

<!– insert diagram of what we’re talking about –>

For example, a lickometer might record many thousands of licks, and so occupy thousands of data rows. A foodcup photobeam might only record a dozen food cup entries over the same time period, and so would only occupy a dozen data rows. The timestamps for each event for each event-recorder make the timing of different events on different recorders unambiguous.

 (require "../event-file.rkt") package: base

procedure

(read-events-from-file data-file-path    
  #:eventname type)  vector?
  data-file-path : string?
  type : string?
return a vector of events of the given type from from data file

procedure

(read-event-vectors-from-file-rows file-rows)

  (listof vector?)
  file-rows : table?

procedure

(read-event-vector-from-rows #:record record-index    
  #:rows data-rows    
  [#:starttime starttime])  vector?
  record-index : nonnegative-integer?
  data-rows : table?
  starttime : (or #f nonnegative-integer?) = #f