Located in ViRMEn\experiments (Rigs) or tankmousevr\experiments (Personal computer) directory.
File that controls stimulus presentation and trial/block progression. Each frame this code is executed, it's general structure is a state machine that follow the trial schema.
Detailed guide on how to modify things on ViRMEn Manual.
Original file: C:\Experiments\ViRMEn\experiments\poisson_blocks.m
Most common use:
Copy the existing Experiment code file from the most similar task.
Rename file to descriptive name (e.g. "TaskName"_ExperimentCode.mat)
Change Experiment code logic.
Check "Tips and Tricks to modify Experiment Code" for detailed tips
Parameters for a stimulus inherited when running the experiment (so stimulus parameters that change between mazes but are not defined by the stimuli themselves)
Cell array (see below for more details)
vr.inheritedVariables
Parameters for a maze inherited when running the experiment (so maze parameters that change between mazes but are not defined by the stimuli themselves)
Cell array (see below for more details)
Global settings variables:
Parameter name
Definition
Values accepted
cueMinSeparation
Min distance between two towers on the same side
Real number (>0)
fracDuplicated
Proportion of trials that are duplicated
Real number ([0-1])
trialDuplication
Number of times each set of stimulus parameters are duplicated, for a given fracDuplicated (i.e., number of exact replications of each trial type for the duplicated fraction of trials)
Located in ViRMEn\experiments\protocols (Rigs) or tankmousevr\experiments\protocols (Personal computer) directory.
File that contains stimuli sets that will be drawn for during session. It contains trial data: towers positions, number of towers for each maze level depending on protocol variables.
Original file: C:\Experiments\ViRMEn\experiments\protocols\stimulus_trains_PoissonBlocksCondensed3m.mat
Most common use:
Create protocol and world files.
Run generatePoissonStimuli(('world_file'), @('protocol_file')). Substitute world_file & protocol_file with corresponding names.
The most common use for this file when working on a personal computer is to run ViRMEn simulations without interacting with the hardware, to do this set:
simulationMode: = true
hasDAQ: = false
This will allow you to run simulations on any Windows computer and use the keyboard to simulate mouse movement.
If the rig where training is happening has a motor positioning system (ask lab manager about it). It is needed to set up initial coordinates for each subject training in the rig.
Adjust subject positioning for the first time in the rig with the motor GUI (installed in the rig computer).
In MATLAB write the following (replace code in brackets with corresponding info for the subject):
new_record = struct
new_record.subject_fullname = ['efonseca_ef481_actpg004']; # Subject fullname
new_record.ml_position = [17.5] # ml position in mm (motor axis#1 position in GUI)
new_record.ap_position = [10] # ap position in mm (motor axis#2 position in GUI)
new_record.dv_position = [15.3] # dv position in mm (motor axis#3 position in GUI)
insert(subject.LickometerMotorPosition, new_record)
In this section all elements of the training GUI will be described:
From the main screen we have divided all elements in three categories (red = rarely used or not used at all; yellow = used in specific situations; green = widely used).
Branch information section: For git users, informs which branch is checked out right now and if the current version code has current changes on it. The vast majority of the times it should be written "master" & "synced". Go to section pulling/pushing code if not the case.
Schedule calendar: Day of the week & time when subjects should be trained. This information is not crucial for training at the moment.
Ball displacement plot: Figure that shows real time velocity in X & Y for the subject in the rig. This plot is used to detect ball movement sensor issues.
RigParameters info bar: This bar is in red color whenever simulation mode is activated or hasDaq parameter is set to false. If this is the case both parameters should be reset for training to start. If simulation mode is intended ignore this bar.
Test session checkbox: If next session goal will be to test code or behavior won't be analyzed check this box. Session will not be stored in our DB.
Open valve buttons: These buttons are used to give a little reward to subject in rig and/or to test valve function.
Connect to DB button: Use this button to connect to DB, it should be the first thing to do when training GUI is open. Check set up training seciton
From the add animal dialog we have divided all elements in three categories (red = rarely used or not used at all; yellow = used in specific situations; green = widely used). Sections not described are not used.
Subject selection: Dropdown list of all available for training subjects in BRAINCoGS.
Reward Factor: Multiplier to be used for reward for each one of the warm-up & main mazes. Regularly reward is 4ul for each correct trial on Towers Task. (e.g. if RewardFactor = 1.25 -> Reward = 4*1.25 = 5 ul).
Motion blur range: Parameter to set up cue elongation effect opposite to direction of subject motion in virtual reality. 2x1 vector where first element is distance (in cm) from subject to tower cue to start elongation and second element is distance (in cm) to stop elongation effect. No motion blur effect if empty. Common values: [28 5], []
Restart or append session: Action to perform if a session is restarted.
If APPEND SESSION is selected, every time session is restarted, the "new" session will be counted as new blocks of the same session.
If START NEW SESSION is selected, every time session is restarted a new session will be created (recommended when physiology recordings are performed to facilitare syncing process)
stimulus Set edit: If stimulus bank has more than one set it can be set from here. Only change this if you know deeply the stimulus bank file and you know what you are doing.
How warm up trials are drawn: Strategy to select left or right trials based on previous bias and performance. Default value eradeTrial described here
How main trials are drawn: Strategy to select left or right trials based on previous bias and performance. Default value eradeTrial described here
Subtask selector: If session is from a specific subtask you can select it here. Check subtask pipeline section for more information.
Pupillometry video: If pupillometry video is going to be captured, select video parameters here.
Behavior video: If behavior video is going to be captured, select video parameters here.
Manipulation selector: If session is from a specific manipulation you can select it here. Check manipulation pipeline section for more information.
Stimulation protocol: If session is from a specific manipulation Select stimulation protocol in this dropdown. Check manipulation pipeline section for more information.
Software parameters: If session is from a specific manipulation Select software parameters in this dropdown. Check manipulation pipeline section for more information.
Search all lines is experiment code that interact with hardware: (all lines starting with: nidaq.. and updateDAQSyncSignals function. (hardware code lines)
Add this line if RigParameters.hasDAQ before hardware code lines and close if after them.
Open failed: Port: COM7 is not available. Available ports: COM1.
Use INSTRFIND to determine if other instrument objects are connected to the requested device.
Serial communications have not been properly initiated.
Device Error: Unanticipated host error
Are the most common error during training. Check if Arduino COM Port is found in device manager and restart MATLAB and/or system to solve this.
[nidaqPulseRightReward:commit] Requested operation could not be performed, because the specified digital lines are either reserved or the device is not present in NI-DAQmx.
It is possible that these lines are reserved by another task or the device is being reset. If you are using these lines with another task, wait for the task to complete. If you want to force the other task to relinquish the device, reset the device. If you are resetting the device, wait for the reset to finish.
Device: Dev1
Task Name: RightReward
Status Code: -200587
Review RigParameters.m file and check that there is no overlap between input/output channel variables: (rewardChannel, laserChannel, rightPuffChannel, leftPuffChannel,rightRewardChannel, leftRewardChannel, newIterationChannel, newTrialChannel, etc.)