Drug Discrimination
MEDState Notation Repository › Forums › Coding Help Archive › Drug Discrimination
- This topic has 4 replies, 2 voices, and was last updated 7 years ago by
Agata Kuziak.
-
AuthorPosts
-
April 10, 2019 at 2:37 am #15414
Agata Kuziak
ParticipantHello, I have started using the box in my new labaratory and do not have any experience with the coding yet. I am trying to figure out a code that will allow to end the session under two conditions:
The first condition is: receiving a specified number of reward e.g., x = 50
The second condition that will end the session is to end the program after 15 minutesI am still very new to this type of coding, so any help would be greatly appreciated
Agata
Here is the FR10 code that works but I would like to modify it for these conditions
\Drug Discrimination FR10 by Agata Kuziak
\Inputs
^1NosePoke = 1
^2NosePoke = 2
^3NosePoke = 3
^4NosePoke = 4
^5NosePoke = 5
^MagazineHeadEntry = 6\ Outputs
^Pellet = 12
^Stimulus = 10
^HouseLight = 11\ List Data Variables Here
\ E – 1Poke Counter
\ F – 2Poke Counter
\ G – 3Poke Counter
\ H – 4Poke Counter
\ I – 4Poke Counter
\ J – MagazineHeadEntry\VARIABLES
\T(0) – Session Time
\T(1) – Consumption Time
LIST T = 15′, 5″\B – Timer
DIM C = 10000
\ Z-Pulses Used in this Program
\ Z1 = Signal for Pellet Timer
\Z9 = MagazineHeadEntry\ K-Pulses Used in this Program
\ K1 = Signal for Free Pellet.\*********************************************
\ Main Proceedure
\*********************************************
S.S.1,
S1,
#START: ON ^HouseLight, —> S2
S2,
T(0)#T: —> S3
S3,
0.01″: OFF ^HouseLight, —> STOPABORTFLUSH\*********************************************
\ FR10 SCHEDULE
\ S1 – Set Default Values
\ Fixed Ratio (10)
\*********************************************
S.S.2,
S1,
0.01″: SET X = 1 —> S2S2,
#START: ON ^HouseLight, ^Stimulus —> S3
1″: SHOW 1,FR =,X —> SXS3,
10*X#R^1NosePoke: SHOW 1,LeftPoke Counter,E;—> SX\*********************************************
\ Response Counter & Screen Update
\*********************************************
S.S.3,
S1,
#START: SHOW 1,1Poke Counter,E, 2,2Poke Counter,F, 3,3Poke Counter,G, 4,4Poke Counter,H, 5,5Poke Counter,I—> S2S2,
10* X#R^1NosePoke: ADD E; SHOW 1,1Poke Counter,E;
ON ^PELLET,^Stimulus; Z1 —> SX
X#R^2NosePoke: ADD F; SHOW 2,2Poke Counter,F;
ON ^PELLET,^Stimulus; Z1 —> SX
X#R^3NosePoke: ADD G; SHOW 3,3Poke Counter,G; —> S2
X#R^4NosePoke: ADD H; SHOW 4,4Poke Counter,H;—> S2
X#R^5NosePoke: ADD I; SHOW 5,5Poke Counter,I;—> S2
X#R^MagazineHeadEntry: ADD J; Z9 —> SX\**************************************************
\ PELLET CONTROL TIMER
\ (Includes K1-pulse for delivering a free pellet)
\**************************************************
S.S.4,
S1,
#Z1: —> S2
#K1: ADD D; SHOW 4,Free Pellets,D; ON ^Pellet —> S2S2,
0.05″: OFF ^Pellet —> S1\**************************************************
S.S.5,
S1,
#START: SHOW 1,1Poke Counter,E, 2,2Poke Counter,F, 3,3Poke Counter,G, 4,4Poke Counter,H, 5,5Poke Counter,I, 6,MagazineEntry,J —> S2S2,
0.01″: SHOW 1,1Poke Counter,E, 2,2Poke Counter,F, 3,3Poke Counter,G, 4,4Poke Counter,H, 5,5Poke Counter,I, 6,MagazineEntry,J —> SXApril 10, 2019 at 10:51 am #15416Med_Support
ModeratorAgata,
Looks like you already have a code that will end the protocol when 15 minutes elapses. T(0)#T = 15′ in your code.
You could also hard code 15′: instead of T(0)#T:.LIST T = 15′, 5″
S.S.1,
S1,
#START: ON ^HouseLight, —> S2
S2,
T(0)#T: —> S3
S3,
0.01″: OFF ^HouseLight, —> STOPABORTFLUSHThere is a more elegant way to code the above which is what you will use to stop when a # max rewards has been made with an IF statement.
\\\SESSION TIMER\\\
S.S.1,
S1, \ Time Session Length
0.01″: SET S = S + 0.01;
SHOW 7,Session,S;
IF S/60 >= 15 [@End, @Cont]
@End: —> STOPABORTFLUSH
@Cont: —> SX\\\MAX REWARDS\\\
\**************************************************
\ PELLET CONTROL TIMER
\ (Includes K1-pulse for delivering a free pellet)
\**************************************************
S.S.4,
S1,
#Z1: ADD R; SHOW 8,Rewards,R; ON ^Pellet —> S2
#K1: ADD D; SHOW 4,Free Pellets,D; ON ^Pellet —> S2S2,
0.05″: OFF ^Pellet;
IF R >= 50 [@End, @Cont]
@End: —> STOPABORTFLUSH
@Cont: —> S1April 12, 2019 at 7:13 am #15417Agata Kuziak
ParticipantThank you very much for the answer , but unfortunately it doesn’t work.
There are errors that I couldn’t correctApril 12, 2019 at 8:49 am #15418Med_Support
ModeratorThe errors you are having are becaue you copied it in from a word processor or outlook. “” replace the directional quotes for normal quotes.
April 13, 2019 at 7:37 am #15419Agata Kuziak
ParticipantThank you very much for your help, everything is clear!
-
AuthorPosts
- You must be logged in to reply to this topic.