FR1 program data collection

MEDState Notation Repository Forums Coding Help Archive FR1 program data collection

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #13016
    Med_Support
    Moderator
    gdillon

    Okay so as a continuation to my problems with programming, I have a program that is close to working but the data collection is off.
    Here is a summary of the program using a retractable lever, pellet dispenser, and receptacle with IR beams
    1) Subject presses lever and gets a reward
    2) If the subject visits the receptacle for the reward within 30sec after pressing the lever…counted as chain response…visiting receptacle >30sec after lever press is counted as unchained response
    Every lever press before going to receptacle counted as unchained response
    Visiting receptacle more than once counted as unchained response
    I cannot get this program to collect correct data and am getting lost in my coding
    Any help is appreciated

    \FR program
    
    \Inputs
    ^LL = 1
    ^RCPT = 2
    
    \Outputs
    ^HSLT = 1
    ^RWRD = 2
    ^RWRDLT = 3
    
    \Defined Variables
    \C = Criterion to Chained vs Unchained response
    \D Array (Data)
    \D(0) = Number of lever presses within trial
    \D(1) = Total number of reinforcers
    \D(2) = Chained responses
    \D(3) = Unchained responses
    \D(4) = Total number of lever presses
    \D(5) = Total number of receptacle visits post lever response
    \F = FR Value
    \T Array (Timers)
    \T(0) = Trial number
    \T(1) = Post Response Timer
    \T(2) = Session Timer
    \T(3) = No response
    \V = Total Visits to receptacle
    
    DIM D=6, T=4
    DISKVARS = C, D(1), D(2), D(3), D(4), D(5), F, V
    
    \Variable Set, Program Start, FR Program
    S.S.1,
    S1, \Starts Program and sets trial value
    #START: IF C = 0 [@Y,@N]
    @Y: SET C = 300--->S2
    @N: SET T(0) = 1--->S2
    
    S2, \Checks to see if experimenter has set the FR Value
    .01": If F = 0[@NOTSET,@SET]
    @NOTSET:--->SX
    @SET: Z5; ON^HSLT,^LLVROUT,^RLVROUT--->S3
    
    S3, \Checks to see if session is over based on no response
    .01": IF (T(3)=15) [@SOVRBYTO,@SNTOVR]
    @SOVERBYTO:Z4 --->SX
    @SNTOVR:--->S4
    
    S4, \FR program
    #R^LL:ADD D(0); IF D(0) = F [@METRECQ,@NTMETRECQ]
    @METRECQ: ON^RWRD,^RWRDLT; Z1; SET D(1) = D(1) + 1, D(4) = D(4) + D(0), T(3) = 0--->S5
    @NTMETRECQ:SET T(3) = 0--->SX
    
    #R^RCPT: SET V = V +1, T(3) = 0--->SX
    
    1': ADD T(3); IF T(3) = 15 [@OVER,@CONTINUE]
    @OVER:--->S3
    @CONITINUE:--->SX
    
    S5, \Lever inactive
    2":OFF^RWRD,^RWRDLT; SET D(0) = 0, T(0) = T(0) + 1--->S3
    
    \Post Response Timer
    S.S.2,
    S1, \Waits until response requirement is met
    #Z1:--->S2
    #Z4:--->S3
    S2, \Requirement met; Starts timer; Counts until response is made
    #R^LL:Z2--->S1 \Lever response stopped timer
    
    #R^RCPT:Z3--->S1 \Receptacle response stopped timer
    
    .1":ADD T(1)--->SX \Timer counts every 10th of second
    S3,
    #Z4:OFF^HSLT--->STOPABORTFLUSH
    
    \Counting Chained vs Unchained Responses
    S.S.3,
    S1, \Waits until response requirement is met
    #Z1:--->S2
    
    S2, \Response requirement met; Differentiates Chained vs Unchained based on how "post response timer" was stopped, then on value of timer
    #Z2: SET D(2) = D(2) + 1, D(5) = D(5) + 1, T(1) = 0--->S3 \Lever response stopped timer = Unchained
    #Z3: IF T(1) <= C [@CHAINED,@UNCHAINED] \Receptacle response stopped timer; checks timer value
    @CHAINED:SET D(3) = D(3) + 1, D(5) = D(5) + 1, T(1) = 0--->S3 \Response < or equal to 30 secs = Chained
    @UNCHAINED: SET D(2) = D(2) + 1, D(5) = D(5) + 1, T(1) = 0--->S3 \Response after 30 secs = Unchained
    S3,
    .01": SHOW 4, Visits, D(5); SHOW 7 , Unchained, D(2); SHOW 8, Chained, D(3); IF(D(1) = 60) OR (T(2) = 60) [@SOVR,@SNTOVR]
    @SOVR:OFF^HSLT--->STOPABORTFLUSH
    @SNTOVR:--->S2
    
    \Session Clock
    S.S.4,
    S1, \Waits for experiementer to set FR value
    #Z5:--->S2
    
    S2, \Adds Session timer every minute
    1': ADD T(2)--->SX
    
     
    
    \Shows
    S.S.5,
    S1, \On start, begins some "Show" commands
    #START:--->S2
    
    S2,
    .01":SHOW 1, Trial, T(0); SHOW 2, Duration, T(2); SHOW 3, Rewards, D(1) SHOW 6, Presses, D(4)--->SX
    
    #13017
    Med_Support
    Moderator
    Gary Bamberger

    Hi Greg,

    I looked at your program and decided to rewrite the program from scratch.  I haven’t tested it, but I think that it will be much closer to what you want.  The only thing that I am unsure of is how I handled the variable D(5).  I removed most of the Z-pulses that you used and also made it so that each State Set only does one thing.  This makes things easier.  When you look at a State Set you know what it does and in most cases don’t have to concern yourself over how it affects the rest of the code.  Hopefully you will be able to understand my code and make any further changes that you need.

    Best Regards,
    Gary

    \ Inputs
    ^LeftLever  = 1
    ^Receptacle = 2
    
    \ Outputs
    ^HouseLight    = 1
    ^Reward        = 2
    ^RewardLight   = 3
    ^LeftLeverOut  = 4
    ^RightLeverOut = 5
    
    \ Defined Variables
    \ C = Criterion to Chained vs Unchained response
    
    \ D Array (Data)
    \  D(0) = Number of lever presses within trial
    \  D(1) = Total number of reinforcers
    \  D(2) = Unchained responses
    \  D(3) = Chained responses
    \  D(4) = Total number of lever presses
    \  D(5) = Total number of receptacle visits post lever response
    
    \ F = FR Value
    
    \ T Array (Timers)
    \  T(0) = Trial number
    \  T(1) = Post Response Timer
    \  T(2) = Session Timer
    \  T(3) = No response
    
    \ V = Total Visits to receptacle
    
     
    
    \ Z-pulses Used in this Experiment
    \  Z1 = Signal First Left Lever Response
    \  Z2 = Signal That Trial has Ended
    
     
    
    DIM D = 5
    DIM T = 3
    
     
    
    DISKVARS = C, D(1), D(2), D(3) D(4), D(5), F, V
    
     
    
    S.S.1,
    S1,
    0.001": SET C = 30, F = 1 ---> S2
    
    S2,
    #START: ADD T(0); ON ^HouseLight, ^LeftLeverOut, ^RightLeverOut ---> S3
    
    S3,
    #R^LeftLever: SET T(3) = 0; ADD D(0), D(4);
    IF D(0) >= F [@FRMet, @Cont]
    @FRMet: ADD D(1); SET D(0) = 0; Z1 ---> S4
    @Cont: ---> S3
    #R^Receptacle: SET T(3) = 0; ADD V, D(2), D(5) ---> S3
    
    S4,
    #Z2: ADD T(0) ---> S3
    
     
    
    S.S.2,     \ Post Response Timer
    S1,
    #Z1: SET T(1) = 0 ---> S2
    
    S2,
    #R^LeftLever:  SET T(3) = 0; ADD D(2), D(4) ---> S2
    #R^Receptacle: SET T(3) = 0; ADD V, D(5);
    IF T(1) >= C [@Unchained, @Chained]
    @Unchained: ADD D(2); Z2 ---> S1
    @Chained:   ADD D(3); Z2 ---> S1
    0.01": SET T(1) = T(1) + 0.01 ---> SX
    
     
    
    S.S.3,     \ Reward Control
    S1,
    #Z1: ON ^Reward, ^RewardLight ---> S2
    
    S2,
    2": OFF ^Reward, ^RewardLight ---> S1
    
     
    
    S.S.4,     \ No Response Timer
    S1,
    #START: ---> S2
    
    S2,
    1': ADD T(3); IF T(3) = 15 [@End, @Cont]
    @End: OFF ^HouseLight ---> STOPABORTFLUSH
    @Cont: ---> S1
    
     
    
    S.S.5,     \ Update Display
    S1,
    #START: SHOW 2,Trial #,T(0), 3,Rewards,D(1),   4,Visits,D(5), 5,Tot Visits,V;
    SHOW 6,Presses,D(4), 7,Unchained,D(2), 8,Chained,D(3) ---> S2
    
    S2,
    1": SHOW 2,Trial #,T(0), 3,Rewards,D(1),   4,Visits,D(5), 5,Tot Visits,V;
    SHOW 6,Presses,D(4), 7,Unchained,D(2), 8,Chained,D(3) ---> S2
    
     
    
    S.S.6,     \ Session Timer
    S1,
    #START: SHOW 1,Session,T(2)/60 ---> S2
    
    S2,
    1": ADD T(2); SHOW 1,Session,T(2)/60;
    IF (T(2)/60 >= 60) OR (D(1) >= 60) [@End, @Cont]
    @End: OFF ^HouseLight ---> STOPABORTFLUSH
    @Cont: ---> S2
    

     

    #13020
    Med_Support
    Moderator
    gdillon

    Gary,
    Thanks for the assistence this program is working good. If you would like to post this program the only change I made was in:

    S.S.2, S2
      0.01": SET T(1) = T(1) + 0.01 ---> S4
    should be changed to
    --->SX
    

    Thanks again,
    Greg

    #13022
    Med_Support
    Moderator
    sdesai44

    Hi,
    Thanks for the post
    do retractable levers get extend/retract any time in this procedure?

    #13024
    Med_Support
    Moderator
    Gary Bamberger

    The program does extend the retractable levers when the START command is issued, but then they stay extended for the rest of the session.

    Gary

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