Drug Discrimination

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #15414
    Agata Kuziak
    Participant

    Hello, 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 minutes

    I 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 —> S2

    S2,
    #START: ON ^HouseLight, ^Stimulus —> S3
    1″: SHOW 1,FR =,X —> SX

    S3,
    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—> S2

    S2,
    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 —> S2

    S2,
    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 —> S2

    S2,
    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 —> SX

    #15416
    Med_Support
    Moderator

    Agata,

    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, —> STOPABORTFLUSH

    There 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 —> S2

    S2,
    0.05″: OFF ^Pellet;
    IF R >= 50 [@End, @Cont]
    @End: —> STOPABORTFLUSH
    @Cont: —> S1

    #15417
    Agata Kuziak
    Participant

    Thank you very much for the answer , but unfortunately it doesn’t work.
    There are errors that I couldn’t correct

    https://www.fotosik.pl/zdjecie/pelne/6eddccf7bc82534f

    #15418
    Med_Support
    Moderator

    The errors you are having are becaue you copied it in from a word processor or outlook. “” replace the directional quotes for normal quotes.

    #15419
    Agata Kuziak
    Participant

    Thank you very much for your help, everything is clear!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.