Gary Bamberger

Forum Replies Created

Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • in reply to: Time-out #16273
    Gary Bamberger
    Moderator

    It is a little hard to answer without seeing a copy of your program, but maybe this will help:

    S5,
      #R^Lever: ADD R; ON ^Reward ---> S6
    
    S6,
      0.05" OFF ^Reward, ^HouseLight, ^CueLight ---> S7
    
    S7,
      10": ON ^HouseLight, ^CueLight ---> S5  \ 10s Timeout
      #R^Lever: ADD R ---> SX                 \ Count all responses during Timeout

    That is a very rough answer. If you need more specific help, please email a copy of your program to support@med-associates.com.

    in reply to: Delay reward with nose-poking #15455
    Gary Bamberger
    Moderator

    Hello Lidia,

    When you respond please use the CODE option so that the formatting is preserved.

    The easiest way is to make a separate state for forced immediate (S15) and forced delayed (S16). Now the subject can only respond on the desired input.

    S4,  \ If Nose Poke is made within allotted time, turn off
         \ the Stim Light and extend only one lever if a
         \ forced trial or both levers if a free choice trial.
         \ Signal start of Lever Latency counter.
         \
         \ If Timeout, record Type 1 Omission.
      #Z^Z_NPBreak: OFF ^StimLight; SET D(J+5) = O;
                    Z^Z_LeverLat; Z^Z_LatEnd; Z^Z_CorrectResp;
                    IF M > A(^ForcedTrials) [@Free, @Forced]
                       @Free: ON ^LeftLeverOut, ^RightLeverOut ---> S5
                       @Forced: IF H = 1 [@Immediate, @Delayed]
                                   @Immediate: IF A(^ImmediateLever) = ^LeftLeverIn [@Left, @Right]
                                                  @Left: ON ^LeftLeverOut ---> S15
                                                  @Right: OFF ^RightLeverOut ---> S15
                                   @Delayed: IF A(^DelayedLever) = ^LeftLeverIn [@Left, @Right]
                                                @Left: OFF ^LeftLeverOut ---> S16
                                                @Right: ON ^RightLeverOut ---> S16
      A(^ResponseTicks)#T: OFF ^HouseLight, ^StimLight;
                           ADD B(5), E(K+5);
                           SET D(J+3) = 1, D(J+5) = O;
                           Z^Z_LatEnd; Z^Z_Type1 ---> S10
    
    S15, \ Forced Immediate Reward
         \ If Lever response is made within allotted time, turn off
         \ the House Light, retracts the levers.  Signal to issue
         \ immediate rewards.
         \
         \ If Timeout, record Type 2 Omission.
      #RA(^ImmediateLever): ADD B(2), E(K+2); ON ^StimLight;
                            OFF ^HouseLight, ^LeftLeverOut, ^RightLeverOut;
                            SET D(J+2) = 1, D(J+6) = P, Q = 1;
                            Z^Z_Pellet; Z^Z_NPLat;
                            Z^Z_LatEnd; Z^Z_CorrectResp ---> S6
      A(^ResponseTicks)#T: OFF ^HouseLight, ^LeftLeverOut, ^RightLeverOut;
                           ADD B(6), E(K+6);
                           SET D(J+3) = 2, D(J+6) = P;
                           Z^Z_LatEnd; Z^Z_Type2 ---> S10
    
    S16, \ Forced Delayed Reward
         \ If Lever response is made within allotted time, turn off
         \ the House Light, retracts the levers.  Go to Delayed Reward
         \ State.
         \
         \ If Timeout, record Type 2 Omission.
      #RA(^DelayedLever): ADD B(3), E(K+3);
                          ON ^HouseLight, ^RightLeverOut; OFF ^LeftLeverOut;
                          SET D(J+2) = 2, D(J+6) = P, Q = A(^LargeReward);
                          Z^Z_LatEnd; Z^Z_CorrectResp ---> S7
      A(^ResponseTicks)#T: OFF ^HouseLight, ^LeftLeverOut, ^RightLeverOut;
                           ADD B(6), E(K+6);
                           SET D(J+3) = 2, D(J+6) = P;
                           Z^Z_LatEnd; Z^Z_Type2 ---> S10

    I hope that this information helps.

    Gary

    in reply to: Fixed Ratio #15453
    Gary Bamberger
    Moderator

    Looking at the program it should work. The Z-pulse to dispense a pellet is issued when the FR is met.

    Your problem must be with the pellet dispenser. Please contact MED Associates support@med-associates.com for help with returning the pellet dispenser for repair.

    Gary

    in reply to: Cocaine Yoked #14820
    Gary Bamberger
    Moderator

    I just ran it and watched it step through the values in LIST K in order. Add this SHOW statement to the program so that you can see the values change:

    S3,
      #Z1: LIST X = K(F); SHOW 1,X=,X;
           SET X = X * 1" ---> S4

    Gary

    in reply to: Cocaine Yoked #14818
    Gary Bamberger
    Moderator

    Hello Idaira,

    In S.S.1, S7 you send the program back to S2. S2 is waiting for a START command. I think that you want the program to go to S3:

    S7,
      15": ON ^Houselight; Z1 ---> S3

    I hope that this information helps.

    Gary

    in reply to: Delay reward with nose-poking #14792
    Gary Bamberger
    Moderator

    The program was sent to the email that you provided when signing up. Please let me know if you didn’t receive it.

    Gary

    in reply to: Delay reward with nose-poking #14787
    Gary Bamberger
    Moderator

    The program has been sent to you.

    Please let me know if we can help in any other way.

    Best,
    Gary

    in reply to: Delay reward with nose-poking #14458
    Gary Bamberger
    Moderator

    Hi Nathalie,

    I don’t have enough information to be able to help. Probably the best thing would be for you to email support@med-associates.com with a copy of the changes that you have made and a description of how you want it to work. We can then help.

    Gary

    in reply to: Delay Reward Help #14435
    Gary Bamberger
    Moderator

    What you are going to need is to issue one Z-pulse for the immediate reward (Z^Z_Pellet1) and one for the delayed reward (Z^Z_Pellet2):

    S5,     \ If Lever response is made within allotted time, turn off
            \ the House Light, retracts the levers.  Signal to issue
            \ immediate rewards.
            \
            \ If Timeout, record Type 2 Omission.
      #RA(^ImmediateLever): ADD B(2), E(K+2); ON ^StimLight;
                            OFF ^HouseLight, ^LeftLever, ^RightLever;
                            SET D(J+2) = 1, D(J+6) = P, Q = 1;
                            Z^Z_Pellet1; Z^Z_NPLat;
                            Z^Z_LatEnd;  Z^Z_CorrectResp ---> S6
      #RA(^DelayedLever): ADD B(3), E(K+3);
                          OFF ^HouseLight, ^LeftLever, ^RightLever;
                          SET D(J+2) = 2, D(J+6) = P, Q = A(^LargeReward);
                          Z^Z_LatEnd; Z^Z_CorrectResp ---> S7
      A(^ResponseTicks)#T: OFF ^HouseLight, ^LeftLever, ^RightLever;
                           ADD B(6), E(K+6);
                           SET D(J+3) = 2, D(J+6) = P;
                           Z^Z_LatEnd; Z^Z_Type2 ---> S10
    
    S7,     \ Delayed Reward Lever chosen.  Wait until delay time
            \ has elapsed, signal for the large reward to be
            \ issued, and turn on the Stim Light.
      U#T: ON ^StimLight; SET D(J+8) = U;
           Z^Z_Pellet2; Z^Z_NPLat ---> S8

    You will then need to modify the reward control for each output:

    S.S.2,
    S1,
      #Z^Z_Pellet1: ON ^Pellet1; ADD B(1), D(J+1), E(K+1);
                    Z^Z_Reward ---> S2
      #Z^Z_Pellet2: ON ^Pellet2; ADD B(1), D(J+1), E(K+1);
                    Z^Z_Reward ---> S3
    
    S2,     \ Time Reward Device for 0.05 seconds
      0.05": OFF ^Pellet1; Z^Z_PelletEnd ---> S1
    
    S3,     \ Time Reward Device for 0.05 seconds
      0.05": OFF ^Pellet2; ADD R;
             IF R >= Q [@Done, @Cont]
                @Done: SET R = 0; Z^Z_PelletEnd ---> S1
                @Cont: ---> S4
    
    S4,
      0.45": ON ^Pellet2; ADD B(1), D(J+1), E(K+1);
             Z^Z_Reward ---> S3

    I hope that this helps.

    in reply to: Delay Reward Help #14422
    Gary Bamberger
    Moderator

    Hello,

    The first thing would be changing how the program starts:

    S3,     \ Time Initial ITI.  Signal start of Nose Poke Latency counter.
      #Z^Z_NewTrial: ON ^HouseLight, ^StimLight;
                     SET E(K) = L, D(J) = M;
                     Z^Z_NPLat ---> S4
    
    S4,     \ If Nose Poke is made within allotted time, turn off
            \ the Stim Light and extend only one lever if a
            \ forced trial or both levers if a free choice trial.
            \ Signal start of Lever Latency counter.
            \
            \ If Timeout, record Type 1 Omission.
      #Z^Z_NPBreak: OFF ^StimLight; SET D(J+5) = O;
                    Z^Z_LeverLat; Z^Z_LatEnd; Z^Z_CorrectResp;
                    IF M > A(^ForcedTrials) [@Free, @Forced]
                       @Free: ON ^LeftLever, ^RightLever ---> S5
                       @Forced: IF H = 1 [@Immediate, @Delayed]
                                   @Immediate: ON A(^ImmediateLever) ---> S5
                                   @Delayed:   ON A(^DelayedLever)   ---> S5
      A(^ResponseTicks)#T: OFF ^HouseLight, ^StimLight;
                           ADD B(5), E(K+5);
                           SET D(J+3) = 1, D(J+5) = O;
                           Z^Z_LatEnd; Z^Z_Type1 ---> S10

    becomes:

    S3,     \ Time Initial ITI
      #Z^Z_NewTrial: ON ^HouseLight, ^StimLight;
                     SET E(K) = L, D(J) = M ---> S4
    
    S4,     \ Wait Response Time, turn off
            \ the Stim Light and extend only one lever if a
            \ forced trial or both levers if a free choice trial.
            \ Signal start of Lever Latency counter.
            \
            \ If Timeout, record Type 1 Omission.
      A(^ResponseTicks)#T: OFF ^StimLight; SET D(J+5) = O;
                           Z^Z_LeverLat; Z^Z_LatEnd; Z^Z_CorrectResp;
                           IF M > A(^ForcedTrials) [@Free, @Forced]
                              @Free: ON ^LeftLever, ^RightLever ---> S5
                              @Forced: IF H = 1 [@Immediate, @Delayed]
                                          @Immediate: ON A(^ImmediateLever) ---> S5
                                          @Delayed:   ON A(^DelayedLever)   ---> S5

    I chose the response time as the Initial ITI, but you could hard code a different number if you so desired.

    Without a nose poke the program has no way of knowing if the animal got the reinforcement so again I just chose the response time and if the animal doesn’t get the reinforcement in that amount of time, too bad the next trial is going to start:

    S5,     \ If Lever response is made within allotted time, turn off
            \ the House Light, retracts the levers.  Signal to issue
            \ immediate rewards.
            \
            \ If Timeout, record Type 2 Omission.
      #RA(^ImmediateLever): ADD B(2), E(K+2); ON ^StimLight;
                            OFF ^HouseLight, ^LeftLever, ^RightLever;
                            SET D(J+2) = 1, D(J+6) = P, Q = 1;
                            Z^Z_Pellet; Z^Z_NPLat;
                            Z^Z_LatEnd; Z^Z_CorrectResp ---> S6
      #RA(^DelayedLever): ADD B(3), E(K+3);
                          OFF ^HouseLight, ^LeftLever, ^RightLever;
                          SET D(J+2) = 2, D(J+6) = P, Q = A(^LargeReward);
                          Z^Z_LatEnd; Z^Z_CorrectResp ---> S7
      A(^ResponseTicks)#T: OFF ^HouseLight, ^LeftLever, ^RightLever;
                           ADD B(6), E(K+6);
                           SET D(J+3) = 2, D(J+6) = P;
                           Z^Z_LatEnd; Z^Z_Type2 ---> S10
    
    S6,     \ Immediate Reward Lever chosen.  If Nose Poke detected
            \ record latency.
            \
            \ If timeout record Type 4 Omission.
      #Z^Z_NPBreak: OFF ^HouseLight, ^StimLight;
                    ADD B(4), D(J+4), E(K+4);
                    SET D(J+7) = O;
                    Z^Z_LatEnd; Z^Z_CorrectResp ---> S10
      A(^ResponseTicks)#T: OFF ^HouseLight, ^StimLight;
                           ADD B(8), E(K+8);
                           SET D(J+3) = 4, D(J+7) = O;
                           Z^Z_LatEnd; Z^Z_Type4 ---> S10
    
    S7,     \ Delayed Reward Lever chosen.  Wait until delay time
            \ has elapsed, signal for the large reward to be
            \ issued, and turn on the Stim Light.
      U#T: ON ^StimLight; SET D(J+8) = U;
           Z^Z_Pellet; Z^Z_NPLat ---> S8
    
    S8,     \ If Nose Poke detected record latency.  If Z^Z_PelletEnd
            \ pulse arrives, last pellet has been issued, begin timer.
      #Z^Z_NPBreak: OFF ^HouseLight, ^StimLight;
                    ADD B(4), D(J+4), E(K+4);
                    SET D(J+7) = O;
                    Z^Z_LatEnd; Z^Z_CorrectResp ---> S10
      #Z^Z_PelletEnd: ---> S9
    
    S9,     \ If Nose Poke detected record latency.
            \
            \ If timeout record Type 3 Omission.
      #Z^Z_NPBreak: OFF ^HouseLight, ^StimLight;
                    ADD B(4), D(J+4), E(K+4);
                    SET D(J+7) = O;
                    Z^Z_LatEnd; Z^Z_CorrectResp ---> S10
      A(^ResponseTicks)#T: OFF ^HouseLight, ^StimLight;
                           ADD B(7), E(K+7);
                           SET D(J+3) = 3, D(J+7) = O;
                           Z^Z_LatEnd; Z^Z_Type3 ---> S10
    
    S10,    \ Wait for New Trial Signal.  Increment trial number.
            \ Select next lever for forced trials.  If this is the
            \ 12th trial in this block, increment the block number,
            \ select new Delay value, and reset trial number to 1.
            \ Signal start of Nose Poke Latency counter.
      #Z^Z_NewTrial: ADD M; RANDD H = G;
                     IF M > A(^TrialsPerBlock) [@NewBlock, @Cont]
                        @New: LIST U = N(S); ADD L;
                              IF L > A(^NumBlocks) [@End, @Cont]
                                 @End: ---> S11
                                 @Cont: SET K = K + 9, E(K+9) = -987.987;
                                        SET M = 1, J = J + 9, D(J+9) = -987.987;
                                        ON ^HouseLight, ^StimLight;
                                        SET E(K) = L, D(J) = M ---> S4
                        @Cont: SET J = J + 9, D(J+9) = -987.987;
                               ON ^HouseLight, ^StimLight;
                               SET D(J) = M ---> S4

    becomes:

    S5,     \ If Lever response is made within allotted time, turn off
            \ the House Light, retracts the levers.  Signal to issue
            \ immediate rewards.
            \
            \ If Timeout, record Type 2 Omission.
      #RA(^ImmediateLever): ADD B(2), E(K+2); ON ^StimLight;
                            OFF ^HouseLight, ^LeftLever, ^RightLever;
                            SET D(J+2) = 1, D(J+6) = P, Q = 1;
                            Z^Z_Pellet;
                            Z^Z_LatEnd; Z^Z_CorrectResp ---> S6
      #RA(^DelayedLever): ADD B(3), E(K+3);
                          OFF ^HouseLight, ^LeftLever, ^RightLever;
                          SET D(J+2) = 2, D(J+6) = P, Q = A(^LargeReward);
                          Z^Z_LatEnd; Z^Z_CorrectResp ---> S7
      A(^ResponseTicks)#T: OFF ^HouseLight, ^LeftLever, ^RightLever;
                           ADD B(6), E(K+6);
                           SET D(J+3) = 2, D(J+6) = P;
                           Z^Z_LatEnd; Z^Z_Type2 ---> S10
    
    S6,     \ Immediate Reward Lever chosen.  Wait Response Time
      A(^ResponseTicks)#T: OFF ^HouseLight, ^StimLight;
                           ADD B(4), D(J+4), E(K+4);
                           SET D(J+7) = O;
                           Z^Z_LatEnd; Z^Z_CorrectResp ---> S10
    
    S7,     \ Delayed Reward Lever chosen.  Wait until delay time
            \ has elapsed, signal for the large reward to be
            \ issued, and turn on the Stim Light.
      U#T: ON ^StimLight; SET D(J+8) = U;
           Z^Z_Pellet ---> S8
    
    S8,     \ Wait for Z^Z_PelletEnd
            \ pulse to arrives, last pellet has been issued, begin timer.
      #Z^Z_PelletEnd: ---> S9
    
    S9,     \ Wait Response Time
      A(^ResponseTicks)#T: OFF ^HouseLight, ^StimLight;
                           ADD B(4), D(J+4), E(K+4);
                           SET D(J+7) = O;
                           Z^Z_LatEnd; Z^Z_CorrectResp ---> S10
    
    S10,    \ Wait for New Trial Signal.  Increment trial number.
            \ Select next lever for forced trials.  If this is the
            \ 12th trial in this block, increment the block number,
            \ select new Delay value, and reset trial number to 1.
      #Z^Z_NewTrial: ADD M; RANDD H = G;
                     IF M > A(^TrialsPerBlock) [@NewBlock, @Cont]
                        @New: LIST U = N(S); ADD L;
                              IF L > A(^NumBlocks) [@End, @Cont]
                                 @End: ---> S11
                                 @Cont: SET K = K + 9, E(K+9) = -987.987;
                                        SET M = 1, J = J + 9, D(J+9) = -987.987;
                                        ON ^HouseLight, ^StimLight;
                                        SET E(K) = L, D(J) = M ---> S4
                        @Cont: SET J = J + 9, D(J+9) = -987.987;
                               ON ^HouseLight, ^StimLight;
                               SET D(J) = M ---> S4

    You will also want to comment out S.S.10 and S.S.13.

    While that should compile you will be missing a lot of information that the original program collected with the nose poke.

    Also I have not tested these changes so it is possible that there might be a flow control issue that I have not accounted for, but I think it will work.

    I always recommend running a test trial before running a full experiment with your animals.

    Gary

    in reply to: Registering events #14286
    Gary Bamberger
    Moderator

    Hello Eleanor,

    It sounds like what you want to do is record SoftCR (SOF-721 or SOF-722) data. Basically you use an array to record various events (nose pokes, lever presses, reinforcements, stimuli, etc.). The SoftCR program can then display the data in a graphical format to make it easy to see what happened during the experiment.

    You should contact MED Associates Support <Support@med-associates.com> for some example code and if needed an in depth explanation on how to encode SoftCR data.

    Gary

    in reply to: Food magazine exit for ITI start #13902
    Gary Bamberger
    Moderator

    I don’t have all of the code to your program so it is a little hard to answer.

    The 5CSRT program normally uses input 6 for the head entry. It looks like you are using input 1.

    In other portions of the code head entries are just counted. (Ex: During timeouts, etc.) If you leave that code looking for the #R1, then the program will count an input for as long as the head entry is held.

    You will want to change those inputs over so that they are looking for the Z-pulse instead.

    Finally in this code:

    S2,
      #R1: ADD I; IF I >= 2 [@BeamBreak, @NoBeamBreak]
                     @Break: Z14; SET Y = 0 ---> S3
                     @NoBreak: ---> SX
      0.02": SET I = 0 ---> S2

    You will want to change the SET Y = 0 to be SET I = 0.

    I hope that this helps.

    Gary

    in reply to: Food magazine exit for ITI start #13900
    Gary Bamberger
    Moderator

    Hi Bas,

    That might work. Being in Toggle mode you would only get one input when the head entry is released.

    I would recommend clearly marking the card somehow indicating that the input polarity has been reversed. Even if you want to know when the head entry has been released now, there might be a time in the future when the delay to the head entry, or the time of the head entry is the desired piece of data.

    Gary

    in reply to: Food magazine exit for ITI start #13898
    Gary Bamberger
    Moderator

    You would need some additional hardware.

    If you split the signal from the head entry and send it to another input and then invert that input, you can receive a second input when the animal retracts his head.

    This would give you an input on 6 when the animal breaks the head entry beam and an input on 7 when the animal releases the head entry beam.

    I hope that this helps.

    Gary

    in reply to: Dual lickometer .mtp file #13889
    Gary Bamberger
    Moderator

    Hello Pasha,

    First lets start with what SoftCR code is.  SoftCR code consists of two pieces of data: a Time Component and a Data Component or Control Code.

    The number before the decimal point is the Time Component.  It is keeping track of how much time has passed since the previous data element was recorded (Relative Data Mode).  In your program the value is being incremented every 10ms:

    0.01": SET R = R + 0.01; SHOW 8, IRT Timer, R ---> SX

    So if for example the number before the decimal point was 223, then

    223 * 0.01 = 2.23s

    has passed since the previous data element was recorded.

    The number after the decimal point is the Data Component or the Control Code.  It is coded in a very special way.

    The first number after the decimal point is the Control Code that is to be marked.  For example a Control Code value of .1 is a Step/Response.

    The second number after the decimal point is the Trace Line that is to be used.  There are 10 Trace Lines (0 – 9).

    All SoftCR Control Codes work this way.

    .1 = Step
    .2 = Pip
    .3 = Reset Trace Pen
    .5 = Lower Event Pen
    .6 = Raise Event Pen

    Trace Pens are in the upper window and Event Pens are in the lower window of SoftCR and SoftCR Pro.  Control Codes 1, 2, and 3 affect Trace Pens only.  Control Codes 5 and 6 affect Event Pens only.

    A Step is commonly recorded when the Animal does a response and a Pip is commonly recorded when a reinforcement is issued.

    Now in your program you have the following:

    S.S.4,
    S1,
    #Z1: ---> S2

    S2, \Record right licks
    #R^rightLick: ADD F;
    SET D(F) = S;
    SET D(F+1) = -987.987;
    ADD B(E);
    SET I(J) = R;
    ADD J; SET I(J) = -987.987;
    SET R = 0 ---> S2

    \Record left licks
    #R^leftLick: ADD H;
    SET G(H) = S;
    SET G(H+1) = -987.987;
    ADD C(E);
    SET I(J) = R;
    ADD J; SET I(J) = -987.987;
    SET R = 0 ---> S2

    0.01": SET R = R + 0.01; SHOW 8, IRT Timer, R ---> SX

    You are setting I(J) = R so you have a Time Component, but have no Data Component/Control Code.

    You would need to modify the statement to include the Data Component:

    S.S.4,
    S1,
    #Z1: ---> S2

    S2, \Record right licks
    #R^rightLick: ADD F;
    SET D(F) = S;
    SET D(F+1) = -987.987;
    ADD B(E);
    SET I(J) = R + 0.10; \ Add a Step 0 for each RL
    ADD J; SET I(J) = -987.987;
    SET R = 0 ---> S2

    \Record left licks
    #R^leftLick: ADD H;
    SET G(H) = S;
    SET G(H+1) = -987.987;
    ADD C(E);
    SET I(J) = R + 0.11; \ Add a Step 1 for each LL
    ADD J; SET I(J) = -987.987;
    SET R = 0 ---> S2

    0.01": SET R = R + 0.01; SHOW 8, IRT Timer, R ---> SX

    With the changes above you now have valid SoftCR code in Array I for SoftCR or SoftCR Pro to read.

    I hope that this helps.
    Gary

    in reply to: Lickometer False Positives #13869
    Gary Bamberger
    Moderator

    You could try something like this:

    S.S.11,
    S1,
      #START: ---> S2
    
    S2,
      #R^Lick1: SET L = 0 ---> S3
    
    S3,
      #R^Lick1: SET L = L + 0.01 ---> SX
      0.01": IF L <= 1 [@Short, @Long]
                @Short: Z1 ---> S2
                @Long: ---> S2

    In your program you just look for the Z1 pulse instead of the #R^Lick1. Any lick that is 1s or less will count and the rest will be ignored. You can change the length to be anything that you wish.

    I hope that this helps.
    Gary

Viewing 16 posts - 1 through 16 (of 16 total)