On this page:
6.1 Overview
6.2 Experiment Functions
expt?
expt-code
expt-name
expt-groups
expt-group-names
expt-subject-names
expt-subjects
expt-group-of-subject
expt-phase-names
expt-phase-name-and-ordinals
expt-schedules
expt-schedule-by-name
expt-recorders
expt-recorder-names
expt-recorder-at-key
expt-has-recorder-at-key?
expt-eventtypes
expt-eventtype-names
expt-eventtype-with-name
expt-file-path
expt-file-table
expt-filepaths->table
make-expt-from-directory
6.3 Subjects and Groups
subject-name
subject-file-names
group-name
group-subjects
group-subject-names
6.4 Schedules
schedule-name
schedule-descr
schedule-start
schedule-end
schedule-duration
schedule-color
schedule-period
6.5 Phases and Cohorts
phase-name
phase-length
cohort-phase-name
cohort-phase-start
cohort-phase-end
cohort-phase-ordinal-day
cohort-phase-ordinal-day-from-datestring
cohort-expt-ordinal-day
cohort-expt-ordinal-day-from-datestring
cohort-subjects
cohort-phases
cohort-phase-of-timestamp
cohort-phase-of-date
6.6 Recorders
recorder-name
recorder-type
recorder-color
6.7 Event Types
eventtype-name
eventtype-type
eventtype-units
eventtype-options
eventtype-visible
eventtype-color
eventtype-min-ibi
eventtype-min-bout-size
6.8 Expt Files table
expt-files-editor%
new
set-param
8.0

6 Experiments

Collecting event data files for analysis across subjects and groups during phases of an experiment, and defining events recorded during the experiment.

    6.1 Overview

    6.2 Experiment Functions

    6.3 Subjects and Groups

    6.4 Schedules

    6.5 Phases and Cohorts

    6.6 Recorders

    6.7 Event Types

    6.8 Expt Files table

6.1 Overview

Experiments collect groups of subjects; each subjects likely has multiple data files.

Ancillary information on schedules, cohorts of subjects, phases of the experiment, and event recorders used and event types collected.

6.2 Experiment Functions

 (require "../experiment.rkt") package: base

procedure

(expt? expt)  boolean?

  expt : any/c
test if element conforms to structure of an experiment.

procedure

(expt-code expt)  string?

  expt : expt?

procedure

(expt-name expt)  string?

  expt : expt?

procedure

(expt-groups expt)  (listof list?)

  expt : expt?

procedure

(expt-group-names expt)  (listof string?)

  expt : expt?

procedure

(expt-subject-names expt)  (listof string?)

  expt : expt?

procedure

(expt-subjects expt)  (listof list?)

  expt : expt?

procedure

(expt-group-of-subject expt    
  #:subject subject-id)  list?
  expt : expt?
  subject-id : string?

procedure

(expt-phase-names expt)  (listof string?)

  expt : expt?

procedure

(expt-phase-name-and-ordinals expt    
  #:subject subject-id    
  #:timestamp timestamp)  list?
  expt : expt?
  subject-id : string?
  timestamp : nonnegative-integer?
return a list of phase-name (string?), phase-ordinal day (nonnegative-integer?) , and expt-ordinal day (nonnegative-integer?

procedure

(expt-schedules expt)  (listof hash?)

  expt : expt?

procedure

(expt-schedule-by-name expt name)  hash?

  expt : expt?
  name : string?

procedure

(expt-recorders expt)  (listof hash?)

  expt : expt?

procedure

(expt-recorder-names expt)  (listof string)

  expt : expt?

procedure

(expt-recorder-at-key expt recorder-key)  any/c

  expt : expt?
  recorder-key : string?

procedure

(expt-has-recorder-at-key? expt    
  recorder-key)  boolean?
  expt : expt?
  recorder-key : string?

procedure

(expt-eventtypes expt)  (listof hash?)

  expt : expt?

procedure

(expt-eventtype-names expt)  (listof string?)

  expt : expt?

procedure

(expt-eventtype-with-name expt    
  event-type-name)  hash?
  expt : expt?
  event-type-name : string?

procedure

(expt-file-path expt    
  #:group group-id    
  #:subject subject-id    
  #:filename file-name)  path?
  expt : expt?
  group-id : string?
  subject-id : string?
  file-name : string?
construct a file path based on experiment directory structure: <experiment>/<group>/subjects/<subject>/<filename>

procedure

(expt-file-table expt)  query-table?

  expt : expt?
iterate over groups, and subjects within groups, and files for each subject, accmulating one row for every subject file ;; then return a table, of the form (list (headers-list) (file-rows-list)). Internal note: the table gets cached in the expt list structure, so it is only instnatiated once when the experiment is loaded. query.rkt module allows for filtering on the table to selected files.

procedure

(expt-filepaths->table expt filepaths)  query-table?

  expt : list?
  filepaths : (listof path?)
filter the expt file table by the given list of filepaths, and return a subtable containing just those file-rows corresponging to the list of filespaths

procedure

(make-expt-from-directory #:path path)  expt?

  path : path?

6.3 Subjects and Groups

 (require "../subjects-groups.rkt") package: base

procedure

(subject-name subject)  string?

  subject : list?
return the name of the subject from within the given subject data structure (based on experiment directory structure)

procedure

(subject-file-names subject)  (listof string?)

  subject : list?
return the list of filenames from within the given subject data structure (based on experiment directory structure)

procedure

(group-name subject)  string?

  subject : list?
return the name of the group from within the given group data structure (based on experiment directory structure)

procedure

(group-subjects subject)  list?

  subject : list?
return the list of subject data structures from within the given group (based on experiment directory structure)

procedure

(group-subject-names subject)  (listof string?)

  subject : list?
return the list of names of subjects from within the given group (based on experiment directory structure)

6.4 Schedules

 (require "../schedules.rkt") package: base

procedure

(schedule-name sched)  string?

  sched : hash?

procedure

(schedule-descr sched)  string?

  sched : hash?

procedure

(schedule-start sched)  nonnegative-integer?

  sched : hash?

procedure

(schedule-end sched)  nonnegative-integer?

  sched : hash?

procedure

(schedule-duration sched)  nonnegative-integer?

  sched : hash?

procedure

(schedule-color sched)  string?

  sched : hash?

procedure

(schedule-period sched)  nonnegative-integer?

  sched : hash?

6.5 Phases and Cohorts

 (require "../cohorts-phases.rkt") package: base

procedure

(phase-name phase)  string?

  phase : hash?

procedure

(phase-length phase)  string?

  phase : hash?

procedure

(cohort-phase-name cohort-phase)  (or/c #f string?)

  cohort-phase : (or/c #f hash?)

procedure

(cohort-phase-start cohort-phase)

  (or/c #f nonnegative-integer?)
  cohort-phase : (or/c #f hash?)

procedure

(cohort-phase-end cohort-phase)

  (or/c #f nonnegative-integer?)
  cohort-phase : (or/c #f hash?)

procedure

(cohort-phase-ordinal-day cohort-phase 
  #:timestamp timestamp) 
  (or/c #f nonnegative-integer?)
  cohort-phase : (or/c #f hash?)
  timestamp : nonnegative-integer?

procedure

(cohort-phase-ordinal-day-from-datestring cohort-phase 
  #:date date-string) 
  (or/c #f nonnegative-integer?)
  cohort-phase : (or/c #f hash?)
  date-string : string?

procedure

(cohort-expt-ordinal-day cohort 
  #:timestamp timestamp) 
  (or/c #f nonnegative-integer?)
  cohort : hash?
  timestamp : nonnegative-integer?

procedure

(cohort-expt-ordinal-day-from-datestring cohort 
  #:date date-string) 
  (or/c #f nonnegative-integer?)
  cohort : hash?
  date-string : string?

procedure

(cohort-subjects cohort)  (listof string?)

  cohort : hash?

procedure

(cohort-phases cohort)  (listof hash?)

  cohort : hash?

procedure

(cohort-phase-of-timestamp cohort 
  #:timestamp timestamp) 
  (or/c #f hash?)
  cohort : hash?
  timestamp : nonnegative-integer?

procedure

(cohort-phase-of-date cohort    
  #:date date-string)  (or/c #f hash?)
  cohort : hash?
  date-string : string?

6.6 Recorders

 (require "../recorders.rkt") package: base

procedure

(recorder-name recorder)  string?

  recorder : hash?

procedure

(recorder-type recorder)  string?

  recorder : hash?

procedure

(recorder-color recorder)  string?

  recorder : hash?

6.7 Event Types

 (require "../eventtypes.rkt") package: base

procedure

(eventtype-name eventtype)  string?

  eventtype : hash?
name of eventtype

procedure

(eventtype-type eventtype)  string?

  eventtype : hash?
type of eventtype

procedure

(eventtype-units eventtype)  string?

  eventtype : hash?
units of eventtype

procedure

(eventtype-options eventtype)  (listof string?)

  eventtype : hash?
list of options of eventtype

procedure

(eventtype-visible eventtype)  boolean?

  eventtype : hash?
visibility of eventtype

procedure

(eventtype-color eventtype)  string?

  eventtype : hash?
color name of eventtype

procedure

(eventtype-min-ibi eventtype)  nonnegative-integer?

  eventtype : hash?
units of eventtype

procedure

(eventtype-min-bout-size eventtype)  number?

  eventtype : hash?
min bout size

6.8 Expt Files table

 (require "../expt-files-table.rkt") package: base

class

expt-files-editor% : class?

  superclass: object%

contains
1) a query-controls% pane for specifying filters of the experiment (my-document) file table
Controls in the query-controls% pane call
(send expt-files-editor% recalc-analysis)
which applies the query-string and produces the filtered-files-table, then calls
(send expt-files-editor% files-selected filtered-files-table query-string)
which in turn calls
(send my-document set-files-table files-table query-string)
so that the experiment document window handles recalculating of eg bout analysis and event transitions.
2) a expt-table-header-pane% with header button aligned with each column. header buttons not only label the columns of the file table, but handle sorting sort direction toggles with each click expt-table is sorted in place, so original expt-table is replaced by the sorted table
3) a files-table% readonly text editor which dislays tab-separated table

constructor

(new expt-files-editor% 
    [document document] 
    [panel panel] 
    [params params]) 
  (is-a?/c expt-files-editor%)
  document : (list?)
  panel : (is-a/c panel%)
  params : (hashmap?)

method

(send an-expt-files-editor set-param key    
  value)  void?
  key : (string?)
  value : (string?)
set a parmeter at the given keya