Pradeep Jayarajan

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Alternating level cyclic ratio #15928
    Pradeep Jayarajan
    Participant

    Dear Sir/Madam,

    Greetings.

    Can I request the following coding help for the program below.

    1) At present, the program runs for 60 minutes. Can you please help in modifying the program, such that the schedule stops after 6 cycles of the default ratio list or 60 min.

    2) Counting lever switching errors: If the animal
    switches the lever before completion of a specific ratio condition

    3) Lever perseveration errors: If an animal fails to switch to the opposite lever upon completion of a specific ratio condition

    Looking forward for your help

    Thanks

    Pradeep

    =======================================

    \ ProgressiveRatio_v2.mpc
    \
    \ When the program is started it will turn on the HouseLight and the lights over
    \ both Levers, and the current PR Value will be set to the first value drawn in
    \ order from List Z. The program will then wait for the Animal to respond on
    \ the Correct Lever enough times to meet the current PR Value.
    \
    \ When the current PR Value has been met the program will turn on the Reward
    \ Device for the Reward Time. At the end of the Reward Time the program will
    \ time the Time Out Following Reward.
    \
    \ When the Time Out Following Reward has been completed the program set the
    \ current PR Value to the next value drawn in order from List Z.
    \
    \ The program will then once again wait for the Animal to respond on the Correct
    \ Lever enough times to meet the current PR Value.
    \
    \ Responses on the Incorrect Lever will be recorded, but have no adverse affect.
    \
    \ The program will end when the Session Length has been reached.

    \ Inputs
    ^LeftLever = 1
    ^RightLever = 2

    \ Outputs
    ^Pellet = 5
    ^Dipper = 5 \ If both Pellet and Dipper are ordered
    \ It will be necessary to change one of these
    ^LeftLight = 3
    ^RightLight = 4
    ^HouseLight = 7
    ^Pump = 8
    ^Fan = 9

    \ A() = Control Variables with Assigned Aliases as Defined
    Var_Alias Session Length (min) = A(0) \ Default = 60 minutes
    Var_Alias Correct Lever (1=Left 2=Right) = A(1) \ Default = 1-Left
    Var_Alias Reward Device (1=Pellet 2=Dipper 3=Pump) = A(2) \ Default = 1-Pellet
    Var_Alias Reward Time (sec) = A(3) \ Default = 4 seconds
    Var_Alias Time Out Following Reward (sec) = A(4) \ Default = 0 seconds
    Var_Alias SoftCR Data Array (1=Yes 0=No) = A(5) \ Default = 1-Yes

    ^Session = 0
    ^CorrectLev = 1
    ^RewardDevice = 2
    ^RewardTime = 3
    ^TimeOut = 4
    ^SoftCR = 5
    ^RewardTicks = 6
    ^TimeOutTicks = 7

    \ List Data Variables Here
    \ B() = Response Counts
    \ B(0) = Total Responses
    \ B(1) = Total Correct Response Count
    \ B(2) = Total Incorrect Response Count
    \ B(3) = Total Rewards
    \ B(4) = % Correct
    \ B(5) = % Incorrect
    \ B(6) = Last PR Value that was Met

    \ List Working Variables Here
    \ I = Subscript for the IRT Array C
    \ P = Current PR Value
    \ R = Ratio Response Counter
    \ S = Elapsed Time in Session
    \ X = Subscript for Progressive Ratio List Z
    \ Z() = Ratio Default List

    DIM A = 7
    DIM B = 6

    LIST Z = 2, 6, 12, 6, 2

    \ Z-Pulses Used in this Program
    ^Z_Pellet = 1 \ Signal Pellet Reinforcement
    ^Z_Dipper = 2 \ Signal Dipper Reinforcement
    ^Z_Pump = 3 \ Signal Pump Reinforcement
    ^Z_EndReward = 4 \ Signal End of Reward
    ^Z_End = 32 \ Signal End of Session

    \***************************************************
    \ Progressive Ratio Schedule
    \ S1 – Set Default Values
    \ Session Length (60 minutes)
    \ Correct Lever (1-Left)
    \ Reward Device (1-Pellet)
    \ Reward Time (4 seconds)
    \ Time Out Following Reward (0 seconds)
    \ SoftCR Data Array (1-Yes)
    \***************************************************
    S.S.1,
    S1,
    0.01″: SET A(^Session) = 60, A(^CorrectLev) = 1, A(^RewardDevice) = 1;
    SET A(^RewardTime) = 4, A(^TimeOut) = 0, A(^SoftCR) = 1 —> S2

    S2, \ First Statement: Wait for START signal, turn HouseLight ON
    \ and turn associated stimulus ON.
    \
    \ Second Statement: Update screen display with default values
    \ for Control Variables. This will show any changes made via
    \ the “Configure | Change Variables” Window prior to START.
    #START: CLEAR 1,200;
    SET A(^RewardTicks) = A(^RewardTime) * 1″;
    SET A(^TimeOutTicks) = A(^TimeOut) * 1″;
    ON ^HouseLight, ^LeftLever, ^RightLever, ^Fan;
    SHOW 1,Session,S/60 —> S3
    1″: SHOW 1,Session Length,A(^Session), 2,Correct Lever,A(^CorrectLev), 3,Reward Device,A(^RewardDevice);
    SHOW 4,Reward Time,A(^RewardTime), 5,Time Out,A(^TimeOut), 6,SoftCR Code,A(^SoftCR) —> SX

    S3, \ Time Session Length
    0.01″: SET S = S + 0.01;
    SHOW 1,Session,S/60;
    IF S/60 >= A(^Session) [@EndSession, @ContinueTiming]
    @End: Z^Z_End —> S4
    @Cont: —> SX

    S4, \ Wait for Screen Update and end with
    \ STOPABORTFLUSH for Automatic Data Saving
    2″: —> STOPABORTFLUSH

    \***************************************************
    \ MAIN PROGRAM
    \***************************************************
    S.S.2,
    S1, \ Draw first Progressive Ratio from List Z
    #START: LIST P = Z(X); ON ^LeftLight—> S2

    S2, \ Test for Correct Lever
    #RA(^CorrectLev): ADD B(0), B(1), R;
    IF R >= P [@PR_Value_Met, @False]
    @PR_Met: ADD B(3);
    SET B(6) = P, R = 0;
    OFF ^LeftLight, ^RightLight;
    ZA(^RewardDevice) —> S3
    @False: —> SX
    #R^LeftLever: ADD B(0), B(2) —> SX
    #R^RightLever: ADD B(0), B(2) —> SX
    #Z^Z_End: —> S5

    S3, \ Wait for End of Reward Signal
    #Z^Z_End: —> S5
    #Z^Z_EndReward: —> S4

    S4, \ Time Out Interval Following Reward
    \ Update Progressive Ratio P from LIST Z
    A(^TimeOutTicks)#T: LIST P = Z(X);
    IF A(^CorrectLev) = 1 [@True, @False]
    @True: SET A(^CorrectLev) = 2; ON ^RightLight —> S2
    @True: SET A(^CorrectLev) = 1; ON ^LeftLight —> S2

    #Z^Z_End: —> S5

    S5, \ End of Session – Turn Lights Off
    \ Calculate % Correct and % Incorrect
    0.01″: OFF ^HouseLight, ^LeftLight, ^RightLight, ^LeftLever, ^RightLever, ^Fan;
    IF B(0) = 0 [@NoCalc, @Calculate]
    @NoCalc: —> S6
    @Calculate: SET B(4) = B(1) / B(0) * 100;
    SET B(5) = B(2) / B(0) * 100;
    SHOW 7,% Correct,B(4), 8,% Incorrect,B(5), 10,Last PR Met,B(6) —> S6

    S6, \ Holding State at End of Session
    1′: —> SX

    \***************************************************
    \ REWARD CONTROL TIMER
    \***************************************************
    S.S.3,
    S1,
    #Z^Z_Pellet: ON ^Pellet —> S2
    #Z^Z_Dipper: ON ^Dipper —> S2
    #Z^Z_Pump: ON ^Pump —> S2

    S2, \ Time Reward Device for A(^RewardTime) seconds
    \ Default value set in S.S.1, S1 & S2
    A(^RewardTicks)#T: OFF ^Pellet, ^Dipper, ^Pump;
    Z^Z_EndReward —> S1

    \***************************************************
    \ UPDATE DISPLAY
    \***************************************************
    S.S.4,
    S1,
    #START: SHOW 2,Correct Rsp,B(1), 3,Incorrect Rsp,B(2), 4,Rewards,B(3), 5,PR Value,P —> S2

    S2,
    1″: SHOW 2,Correct Rsp,B(1), 3,Incorrect Rsp,B(2), 4,Rewards,B(3), 5,PR Value,P —> S2

    in reply to: Alternating level cyclic ratio #15910
    Pradeep Jayarajan
    Participant

    Dear Sir/Madam,
    Thank you very much for the suggestion.
    I incorporated the suggestion, but still have few challenges

    1) After starting the schedule, the water reward is activated following the correct responses, but the water dispenser is not returning to the original state.
    2) There is also a lag of few seconds after which the water dispenser is getting activated (water dispenser needs to be activated immediately after the required numer of responses is achieved in the correct lever).
    3) The stimulus light on the left is continuously illuminated (it needs to be illuminated only when the left lever is the correct lever).
    4) The stimulus light on the right is illuminated only after required number of responses is made on the lever (it needs to be illuminated only when the left lever is the correct lever).

    Can you please help me to achieve the same?
    Looking forward for your help.

    Thanking you
    Pradeep

    ————————
    ProgressiveRatio_v2.mpc
    \
    \ When the program is started it will turn on the HouseLight and the lights over
    \ both Levers, and the current PR Value will be set to the first value drawn in
    \ order from List Z. The program will then wait for the Animal to respond on
    \ the Correct Lever enough times to meet the current PR Value.
    \
    \ When the current PR Value has been met the program will turn on the Reward
    \ Device for the Reward Time. At the end of the Reward Time the program will
    \ time the Time Out Following Reward.
    \
    \ When the Time Out Following Reward has been completed the program set the
    \ current PR Value to the next value drawn in order from List Z.
    \
    \ The program will then once again wait for the Animal to respond on the Correct
    \ Lever enough times to meet the current PR Value.
    \
    \ Responses on the Incorrect Lever will be recorded, but have no adverse affect.
    \
    \ The program will end when the Session Length has been reached.

    \ Inputs
    ^LeftLever = 1
    ^RightLever = 2

    \ Outputs
    ^Pellet = 3
    ^Dipper = 3 \ If both Pellet and Dipper are ordered
    \ It will be necessary to change one of these
    ^LeftLight = 4
    ^RightLight = 5
    ^HouseLight = 7
    ^Pump = 8
    ^Fan = 9

    \ A() = Control Variables with Assigned Aliases as Defined
    Var_Alias Session Length (min) = A(0) \ Default = 60 minutes
    Var_Alias Correct Lever (1=Left 2=Right) = A(1) \ Default = 1-Left
    Var_Alias Reward Device (1=Pellet 2=Dipper 3=Pump) = A(2) \ Default = 1-Pellet
    Var_Alias Reward Time (sec) = A(3) \ Default = 4 seconds
    Var_Alias Time Out Following Reward (sec) = A(4) \ Default = 0 seconds
    Var_Alias SoftCR Data Array (1=Yes 0=No) = A(5) \ Default = 1-Yes

    ^Session = 0
    ^CorrectLev = 1
    ^RewardDevice = 2
    ^RewardTime = 3
    ^TimeOut = 4
    ^SoftCR = 5
    ^RewardTicks = 6
    ^TimeOutTicks = 7

    \ List Data Variables Here
    \ B() = Response Counts
    \ B(0) = Total Responses
    \ B(1) = Total Correct Response Count
    \ B(2) = Total Incorrect Response Count
    \ B(3) = Total Rewards
    \ B(4) = % Correct
    \ B(5) = % Incorrect
    \ B(6) = Last PR Value that was Met

    \ List Working Variables Here
    \ I = Subscript for the IRT Array C
    \ P = Current PR Value
    \ R = Ratio Response Counter
    \ S = Elapsed Time in Session
    \ X = Subscript for Progressive Ratio List Z
    \ Z() = Progressive Ratio Default List

    DIM A = 7
    DIM B = 6

    LIST Z = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2

    \ Z-Pulses Used in this Program
    ^Z_Pellet = 1 \ Signal Pellet Reinforcement
    ^Z_Dipper = 2 \ Signal Dipper Reinforcement
    ^Z_Pump = 3 \ Signal Pump Reinforcement
    ^Z_EndReward = 4 \ Signal End of Reward
    ^Z_End = 32 \ Signal End of Session

    \***************************************************
    \ Progressive Ratio Schedule
    \ S1 – Set Default Values
    \ Session Length (60 minutes)
    \ Correct Lever (1-Left)
    \ Reward Device (1-Pellet)
    \ Reward Time (4 seconds)
    \ Time Out Following Reward (0 seconds)
    \ SoftCR Data Array (1-Yes)
    \***************************************************
    S.S.1,
    S1,
    0.01″: SET A(^Session) = 60, A(^CorrectLev) = 1, A(^RewardDevice) = 1;
    SET A(^RewardTime) = 4, A(^TimeOut) = 0, A(^SoftCR) = 1 —> S2

    S2, \ First Statement: Wait for START signal, turn HouseLight ON
    \ and turn associated stimulus ON.
    \
    \ Second Statement: Update screen display with default values
    \ for Control Variables. This will show any changes made via
    \ the “Configure | Change Variables” Window prior to START.
    #START: CLEAR 1,200;
    SET A(^RewardTicks) = A(^RewardTime) * 1″;
    SET A(^TimeOutTicks) = A(^TimeOut) * 1″;
    ON ^HouseLight, ^LeftLever, ^RightLever, ^Fan;
    SHOW 1,Session,S/60 —> S3
    1″: SHOW 1,Session Length,A(^Session), 2,Correct Lever,A(^CorrectLev), 3,Reward Device,A(^RewardDevice);
    SHOW 4,Reward Time,A(^RewardTime), 5,Time Out,A(^TimeOut), 6,SoftCR Code,A(^SoftCR) —> SX

    S3, \ Time Session Length
    0.01″: SET S = S + 0.01;
    SHOW 1,Session,S/60;
    IF S/60 >= A(^Session) [@EndSession, @ContinueTiming]
    @End: Z^Z_End —> S4
    @Cont: —> SX

    S4, \ Wait for Screen Update and end with
    \ STOPABORTFLUSH for Automatic Data Saving
    2″: —> STOPABORTFLUSH

    \***************************************************
    \ MAIN PROGRAM
    \***************************************************
    S.S.2,
    S1, \ Draw first Progressive Ratio from List Z
    #START: LIST P = Z(X) —> S2

    S2, \ Test for Correct Lever
    #RA(^CorrectLev): ADD B(0), B(1), R;
    IF R >= P [@PR_Value_Met, @False]
    @PR_Met: ADD B(3);
    SET B(6) = P, R = 0;
    ZA(^RewardDevice) —> S3
    @False: —> SX
    #R^LeftLever: ADD B(0), B(2) —> SX
    #R^RightLever: ADD B(0), B(2) —> SX
    #Z^Z_End: —> S5

    S3, \ Wait for End of Reward Signal
    #Z^Z_End: —> S5
    #Z^Z_EndReward: —> S4

    S4, \ Time Out Interval Following Reward
    \ Update Progressive Ratio P from LIST Z
    A(^TimeOutTicks)#T: LIST P = Z(X);
    IF A(^CorrectLev) = 1 [@True, @False]
    @True: SET A(^CorrectLev) = 2; ON ^RightLight —> S2
    @True: SET A(^CorrectLev) = 1; ON ^LeftLight —> S2

    #Z^Z_End: —> S5

    S5, \ End of Session – Turn Lights Off
    \ Calculate % Correct and % Incorrect
    0.01″: OFF ^HouseLight, ^LeftLight, ^RightLight, ^LeftLever, ^RightLever, ^Fan;
    IF B(0) = 0 [@NoCalc, @Calculate]
    @NoCalc: —> S6
    @Calculate: SET B(4) = B(1) / B(0) * 100;
    SET B(5) = B(2) / B(0) * 100;
    SHOW 7,% Correct,B(4), 8,% Incorrect,B(5), 10,Last PR Met,B(6) —> S6

    S6, \ Holding State at End of Session
    1′: —> SX

    \***************************************************
    \ REWARD CONTROL TIMER
    \***************************************************
    S.S.3,
    S1,
    #Z^Z_Pellet: ON ^Pellet —> S2
    #Z^Z_Dipper: ON ^Dipper —> S2
    #Z^Z_Pump: ON ^Pump —> S2

    S2, \ Time Reward Device for A(^RewardTime) seconds
    \ Default value set in S.S.1, S1 & S2
    A(^RewardTicks)#T: OFF ^Pellet, ^Dipper, ^Pump;
    Z^Z_EndReward —> S1

    \***************************************************
    \ UPDATE DISPLAY
    \***************************************************
    S.S.4,
    S1,
    #START: SHOW 2,Correct Rsp,B(1), 3,Incorrect Rsp,B(2), 4,Rewards,B(3), 5,PR Value,P —> S2

    S2,
    1″: SHOW 2,Correct Rsp,B(1), 3,Incorrect Rsp,B(2), 4,Rewards,B(3), 5,PR Value,P —> S2

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