problem with iti (among other things)
MEDState Notation Repository › Forums › Coding Help Archive › problem with iti (among other things)
- This topic has 2 replies, 1 voice, and was last updated 8 years, 9 months ago by
Med_Support.
-
AuthorPosts
-
May 3, 2010 at 8:47 pm #13149
Med_Support
ModeratorS.Temple12
Hi, Ive been working on this program lately, its supposed to be a training phase to prepare mice for a visual discrimination task, heres a brief overview of what the task is supposed to do:
The session will last 40 minutes or until the animal has received 120 rewards
The house light will remain on for the entire duration of the session
Initially one side (either the right or left) will be selected completely at random (note: the random selection will be in such a way that the sides will not alternate evenly, an example pattern might be something like this: right, left, left, right, left, right, right ,right ect)
Upon a side being selected, the corresponding nosepoke terminal light will activate
the animal will be given 10 seconds to respond, before the light turns off and a new trial begins
If the animal fails to respond, the trial will be scored as an omission. If the animal responds correctly the trial will be scored as a correct response for the appropriate side. An incorrect response will be scored as an error.(note: all incorrect responses are currently being stored under one lump sum, this could be modified to store left incorrect responses separately from right incorrect responses)
Time in between trials will be 15+-3 seconds
animals will be given a free reward every 10 minutes
animals will be given 6 seconds to consume any reward presented.
heres the actual code: right now the iti works for the first trial, but after the button is poked the first time it fails to re-cycle and start again. Also, the 10 second timer is not working, and subsequently the cue light stays on until pushed and omissions are not being recorded
\new autoshaping task phase 2 \defining constants ^house=7 ^sweet=3 ^rightstim=2 ^leftstim=1 \variables used \f=minute timer \l=left pokes \r=right pokes \w=number of rewards \b=omissions \v=total number of incorrect responses \z1= turns ondiper \z2=turns off dipper printvars=l,r,w,b,v diskvars=l,r,w,b,v list c=12",13",14",15",16",17",18" list k= 1,2 S.S.1, s1, #start: on^house--->s2 s2, 40': print--->stopabortflush S.S.2, \ iti 15 +-3" s1, .01": randi x=c--->s2 s2, x#T:z3--->sx s3, #z4:--->s1 S.S.3, \random side selection s1, #z3: randi y=k--->s2 s2, .01": if y=1[@left, @right] @left:z5--->sx @right:z6--->sx S.S.8,\left responses s1, #z5: on ^leftstim--->s2 s2, 1": add e--->s3 s3, .01":if e<= 10 [@true, @false] @true: --->s4 @false:--->s5 s4, #r1:add l; off ^leftstim;z1;z4;set e=0--->sx #r2: add v; off ^leftstim;z4;set e=0--->sx s5, .01": off^ leftstim;z4;set e=0; add b--->sx S.S.9,\right responses s1, #z6: on ^rightstim--->s2 s2, 1": add p--->s3 s3, .01":if p<=10[@true, @false] @true:--->s4 @false:--->s5 s4, #r2: add r; off ^rightstim; z1;z4;set p=0--->sx #r1: add v; off ^rightstim;z4;set p=0--->sx s5, .01":off ^rightstim;z4;set e=0;add b--->sx S.S.4, \pellet delivery, exit after 120 reinforcements s1, #z1:on ^sweet; add w;z2--->s3 s3, 0.80": if w=120 [@exit, @cont] @exit:print--->stopABORTflush @cont:--->s1 S.S.5, \timer, free reinforcement every 10 min s1, #start:--->s2 s2, 1':add f--->s3 s3, 0.025":if f=10 [@sweet,@cont] @sweet:z1;set f=0--->s1 @cont:--->s2 S.S.6, s1, 0.01": show1,trial,W;Show2,RightR,r;show 3,Leftr,l; show4, omissions,b;show 5, errors, v--->Sx s.s.7, s1, #z2:setj=0--->s2 s2, 1":add j--->s3 s3, .025":if j=6[@true, @false] @true: off^sweet--->s1 @false:--->s2
thanks, please let me know if you have any suggestions
May 4, 2010 at 10:22 am #13150Med_Support
ModeratorLooking at your code I think that your problem is in S.S.3, S.S.8, and S.S.9.
In S.S.3 you had:
Code: [Select] S.S.3, \ Random Side Selection S1, #Z3: RANDI Y = K ---> S2 S2, 0.01": IF Y = 1 [@Left, @Right] @Left: Z5 ---> SX @Right: Z6 ---> SX
Once S2 executes the program goes to SX (back to S2). You want it to go back to S1 so that the program waits for the next Z3-pulse:
S.S.3, \ Random Side Selection S1, #Z3: RANDI Y = K ---> S2 S2, 0.01": IF Y = 1 [@Left, @Right] @Left: Z5 ---> S1 @Right: Z6 ---> S1
S.S.8 and S.S.9 both suffer form the exact same problem so I will only discuss S.S.8. Your code for S.S.8 is:
S.S.8, \Left Responses S1, #Z5: ON ^LeftStim ---> S2 S2, 1": ADD E ---> S3 S3, 0.01": IF E <= 10 [@True, @False] @True: ---> S4 @False: ---> S5 S4, #R1: ADD L; OFF ^LeftStim; Z1; Z4; SET E = 0 ---> SX #R2: ADD V; OFF ^LeftStim; Z4; SET E = 0 ---> SX S5, 0.01": OFF ^LeftStim; Z4; SET E = 0; ADD B ---> SX
The first problem is that you don’t check if there was a response until after the 10 second timer has run out. The second problem is that after you turn off the Stim Light the program goes to SX (back to S4 or S5 respectively). I believe that you want the program to go back to S1 to wait for another Z5-pulse.
S.S.8, \ Left Responses S1, #Z5: ON ^LeftStim; SET E = 0 ---> S2 S2, #R1: ADD L; OFF ^LeftStim; Z1; Z4 ---> S1 #R2: ADD V; OFF ^LeftStim; Z4 ---> S1 1": ADD E; IF E <= 10 [@Cont, @Omission] @Cont: ---> S2 @Omission: ADD B; OFF ^LeftStim; Z4 ---> S1
With the above code the program will count any response within 10 seconds of the Stim Light. If no response happens, then it is counted as an omission.
Notice that the Response inputs were placed first. If the 1 second timer was placed first and a response happened at the exact same time as the 1 second timer times out, then the response would have been ignored and the 1 second timer code would have been executed.
May 4, 2010 at 1:22 pm #13153Med_Support
ModeratorS.Temple12
thanks, that fixed all the problems perfectly
-
AuthorPosts
- You must be logged in to reply to this topic.