Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
trial.h
- Committer:
- gwappa
- Date:
- 2018-06-30
- Revision:
- 16:33c17c62840e
- Parent:
- 15:20f7f737c256
- Child:
- 17:0b241aa1f5b6
File content as of revision 16:33c17c62840e:
#ifndef TRIAL_H_ #define TRIAL_H_ #include "task.h" #include "arraylist.h" #include "random.h" typedef int trialtime_t; namespace TrialFlags { // nothing const char Clear = 0x00; // flags if the auditory cue is there during the trial const char Cues = 0x01; // flags if any "response" is detected during the response window const char Responded = 0x02; // flags if licking event is detected during the preparatory/pre-response window const char Licked = 0x04; } namespace Responses { const char Hit = 0x03; // cues && responded const char Miss = 0x01; // cues && ~responded const char Catch = 0x02; // ~cues && responded const char Reject = 0x00; // ~cues && ~responded const char Reset = 0x04; // invalid lick const char NA = 0x08; // default } struct Trial { /** * whether the animal whisked during the cue. * + whether the animal waited for the cue. */ char response; /** * the timestamp when the trial started. */ trialtime_t starting; /** * the timestamp when the cue started */ trialtime_t cuestarting; /** * the total waiting period for the animal during this trial before the cue. */ unsigned long waiting; // used for calculation of waiting period /** * the duration of the delay period for this trial. */ uint16_t delay_dur_ms; // (passive) visual cue-related params uint16_t vis_onset_us; uint16_t vis_dur_us; uint64_t aud_ticker_cycle; ArrayList<trialtime_t> licking_events; ArrayList<trialtime_t> whisking_events; void reset(const Task& task); /** * a helper function to assign onset & duration randomly for the (passive) visual cue. * * the `onset` will distribute exponentially from `0` to `auddur - respdur - mindur`. * the `duration` will distribute uniformly from `mindur` to `phasedur - onset`. */ void assignRandomStim(const Task& task); void markTrialStart(); void markEndOfWait(); void markTrialEnd(); void writeToSerial(); }; #endif