FR3 help
MEDState Notation Repository › Forums › Coding Help Archive › FR3 help
- This topic has 8 replies, 1 voice, and was last updated 9 years, 3 months ago by
Med_Support.
-
AuthorPosts
-
September 3, 2014 at 11:55 am #12945
Med_Support
Moderatorandersem
Hi there,
I am now trying to figure out an FR 3. It all works great except one issue. I want the rat to receive a pellet after 3 lever presses. Some rats are able to press the lever four times before the lever is retracted for the time out. In the next trial then, they only need to press the lever twice to get a pellet even though I want them to still have to press the lever 3 times. What do I need to change in the code? Thanks so much for the help!
Eden
\This is a Fixed Ratio-1 \Filename, FixedRatio.mpc \Written by Maartje Rijkens \Date March 7, 2005 \This section is for inputs ^LeftLever = 1 \This section is for outputs ^House = 7 ^Reward = 3 ^Fan = 9 ^Leftcue = 4 ^leftlever = 1 \DEFINED VARIABLES \A = NUMBER OF RESPONSES \B = NUMBER OF REWARDS \E = DATA ARRAY LEFTLEVER \F = DATA ARRAY RIGHTlEVER \G = DATA ARRAY REWARD \M = MINUTES \X = FIXED RATIO \N = SESSION TIMER \Q = MAXIMUM REWARD VAR_ALIAS Fixed ratio = X VAR_ALIAS Maximum reward = Q VAR_ALIAS duration session (min) = M DIM E = 30 DIM F = 30 DIM G = 30 DIM J = 150 S.S.1, \Main control logic for "FR" S1, 0.001": SET X = 3; SET Q = 25; SET M = 60 ---> S2 S2, 0.001": ON ^Fan ---> S3 S3, #START: ON ^House, ^LeftLever, ^LeftCue ---> S4 S4, 3#R^LeftLever: OFF ^House, ^LeftLever, ^Leftcue; ON ^Reward; Z1 ---> SX #Z2:--->S1 S.S.2, \This is the state set that contains the response count and display of the active lever S1, #Start: SHOW 2,ACTIVE,B ---> S2 S2, 1#R^LeftLever: ADD A; SET E(A) = n ;SHOW 2,ACTIVE,A ---> SX #Z2:--->S1 S.S.3, \Reward counter and Timer S1, #Z1: ADD B; SET G(B) = n ; SHOW 4,REWARD,B ---> S2 S2, 0.001": OFF ^REWARD ---> S3 #Z2:--->S1 S3, 20.0": ON ^House, ^LeftLever, ^LeftCue ---> S1 #Z2:--->S1 S.S.4, \Session Timer S1, #START: SHOW 1,Sess_n,N ---> S2 S2, 1.0": ADD N; SHOW 1, Sess_n,N; IF (N/60 >= M) OR (B >= Q) [@True, @False] \As long as session time < M we will continue @True: Z2 ---> S3 @False: ---> SX S3, 19.0": OFF ^House, ^LeftLever---> STOPABORTFLUSH
…
I realized my FR1 is doing this as well, so that if the rat presses the lever 2x before it retracts they actually receive two pellets.
\This is a Fixed Ratio-1 \Filename, FixedRatio.mpc \Written by Maartje Rijkens \Date March 7, 2005 \This section is for inputs ^LeftLever = 1 \This section is for outputs ^House = 7 ^Reward = 3 ^Fan = 9 ^Leftcue = 4 ^leftlever = 1 \DEFINED VARIABLES \A = NUMBER OF RESPONSES \B = NUMBER OF REWARDS \E = DATA ARRAY LEFTLEVER \F = DATA ARRAY RIGHTlEVER \G = DATA ARRAY REWARD \M = MINUTES \X = FIXED RATIO \N = SESSION TIMER \Q = MAXIMUM REWARD VAR_ALIAS Fixed ratio = X VAR_ALIAS Maximum reward = Q VAR_ALIAS duration session (min) = M DIM E = 30 DIM F = 30 DIM G = 30 DIM J = 150 S.S.1, \Main control logic for "FR" S1, 0.001": SET X = 1; SET Q = 25; SET M = 60 ---> S2 S2, 0.001": ON ^Fan ---> S3 S3, #START: ON ^House, ^LeftLever, ^LeftCue ---> S4 S4, 1#R^LeftLever: OFF ^House, ^LeftLever, ^Leftcue; ON ^Reward; Z1 ---> SX #Z2:--->S1 S.S.2, \This is the state set that contains the response count and display of the active lever S1, #Start: SHOW 2,ACTIVE,B ---> S2 S2, 1#R^LeftLever: ADD A; SET E(A) = n ;SHOW 2,ACTIVE,A ---> SX #Z2:--->S1 S.S.3, \Reward counter and Timer S1, #Z1: ADD B; SET G(B) = n ; SHOW 4,REWARD,B ---> S2 S2, 0.001": OFF ^REWARD ---> S3 #Z2:--->S1 S3, 20.0": ON ^House, ^LeftLever, ^LeftCue ---> S1 #Z2:--->S1 S.S.4, \Session Timer S1, #START: SHOW 1,Sess_n,N ---> S2 S2, 1.0": ADD N; SHOW 1, Sess_n,N; IF (N/60 >= M) OR (B >= Q) [@True, @False] \As long as session time < M we will continue @True: Z2 ---> S3 @False: ---> SX S3, 19.0": OFF ^House, ^LeftLever---> STOPABORTFLUSHSeptember 3, 2014 at 12:56 pm #12947Med_Support
ModeratorGary Bamberger
Hi Eden,
I think that the same fix can be used for both problems.
S4, 3#R^LeftLever: OFF ^House, ^LeftLever, ^Leftcue; ON ^Reward; Z1 ---> S5 #Z2:--->S1 S5, 20": ---> S4 #Z2: ---> S1
Gary
September 3, 2014 at 1:54 pm #12951Med_Support
Moderatorandersem
What does the #Z2 do?Thanks again for all your help, I really appreciate it.
September 3, 2014 at 2:11 pm #12954Med_Support
ModeratorGary Bamberger
It signals to the rest of the program that the experiment is ending.
S.S.4, \Session Timer S1, #START: SHOW 1,Sess_n,N ---> S2 S2, 1.0": ADD N; SHOW 1, Sess_n,N; IF (N/60 >= M) OR (B >= Q) [@True, @False] \As long as session time < M we will continue @True: Z2 ---> S3 @False: ---> SX S3, 19.0": OFF ^House, ^LeftLever---> STOPABORTFLUSHIt’s meant to stop the rest of the program.
September 15, 2014 at 3:36 pm #12957Med_Support
Moderatorandersem
Now I have a new issue. I now want the Right inactive lever out as well. I want responses to be recorded on the right lever with no consequence. I cant figure out what is wrong with my coding. I thought a separate state set would do the trick, but the inactive lever counts at each new trial rather than responses on lever. I am having the same issues with my edited PR program. Thanks!
\This is a Fixed Ratio-1 \Filename, FixedRatio.mpc \Written by Maartje Rijkens \Date March 7, 2005 \ Inputs ^LeftLever = 1 ^RightLever = 4 \ Outputs ^Pellet = 3 ^LeftLight = 4 ^LeftLeverOperate= 1 ^HouseLight = 7 ^Fan = 9 ^RightLight = 5 ^RightLeverOperate = 2 \DEFINED VARIABLES \A = NUMBER OF RESPONSES \B = NUMBER OF REWARDS \E = DATA ARRAY LEFTLEVER \F = DATA ARRAY RIGHTlEVER \G = DATA ARRAY REWARD \M = MINUTES \X = FIXED RATIO \N = SESSION TIMER \Q = MAXIMUM REWARD VAR_ALIAS Fixed ratio = X VAR_ALIAS Maximum reward = Q VAR_ALIAS duration session (min) = M DIM E = 30 DIM F = 30 DIM G = 30 DIM J = 150 S.S.1, \Main control logic for "FR" S1, 0.001": SET X = 3; SET Q = 25; SET M = 60 ---> S2 S2, 0.001": ON ^Fan ---> S3 S3, #START: ON ^HouseLight, ^LeftLeverOperate, ^LeftLight, ^RightLeverOperate, ^RightLight ---> S4 S4, 1#R^LeftLever: OFF ^HouseLight, ^LeftLeverOperate, ^LeftLight, ^RightLeverOperate, ^RightLight; ON ^Pellet; Z1 ---> S5 #Z2:--->S1 S5, 20": ---> S4 #Z2: ---> S1 S.S.2, \This is the state set that contains the response count and display of the active lever S1, #Start: SHOW 2,ACTIVE,B ---> S2 S2, 1#R^LeftLever: ADD A; SET E(A) = n ;SHOW 2,ACTIVE,A ---> SX #Z2:--->S1 S.S.3, \This is the state set that contains the response count and display of the inactive lever S1, #Start: SHOW 3,INACTIVE,B ---> S2 S2, #R^RightLever: ADD B; SET F(B) = n; SHOW 3,INACTIVE,B---> SX #Z2:--->S1 S.S.4, \Reward counter and Timer S1, #Z1: ADD B; SET G(B) = n ; SHOW 4,REWARD,B ---> S2 S2, 0.001": OFF ^Pellet ---> S3 #Z2:--->S1 S3, 20.0": ON ^HouseLight, ^LeftLeverOperate, ^LeftLight, ^RightLeverOperate, ^RightLight ---> S1 #Z2:--->S1 S.S.5, \Session Timer S1, #START: SHOW 1,Sess_n,N ---> S2 S2, 1.0": ADD N; SHOW 1, Sess_n,N; IF (N/60 >= M) OR (B >= Q) [@True, @False] \As long as session time < M we will continue @True: Z2 ---> S3 @False: ---> SX S3, 19.0": OFF ^HouseLight, ^LeftLeverOperate, ^LeftLight, ^RightLeverOperate, ^RightLight---> STOPABORTFLUSH
September 15, 2014 at 4:04 pm #12961Med_Support
ModeratorGary Bamberger
Hi Eden,
The problem is that the variable B is pulling double duty:
S.S.3, \ This is the state set that contains the response count and display of the inactive lever S1, #START: SHOW 3,INACTIVE,B ---> S2 S2, #R^RightLever: ADD B; SET F(B) = N; SHOW 3,INACTIVE,B ---> SX #Z2: ---> S1 S.S.4, \ Reward counter and Timer S1, #Z1: ADD B; SET G(B) = N; SHOW 4,REWARD,B ---> S2 S2, 0.001": OFF ^Pellet ---> S3 #Z2: ---> S1 S3, 20": ON ^HouseLight, ^LeftLeverOperate, ^LeftLight, ^RightLeverOperate, ^RightLight ---> S1 #Z2: ---> S1
You a different variable for one of the counters. It looks like C is not being used.
Gary
September 15, 2014 at 4:44 pm #12963Med_Support
Moderatorandersem
That makes sense. I altered that and it is still doing the same thing though. It increases the incorrect lever response by one right when you turn the session on but not when you press the lever.
\This is a Fixed Ratio-1 \Filename, FixedRatio.mpc \Written by Maartje Rijkens \Date March 7, 2005 \ Inputs ^LeftLever = 1 ^RightLever = 4 \ Outputs ^Pellet = 3 ^LeftLight = 4 ^LeftLeverOperate= 1 ^HouseLight = 7 ^Fan = 9 ^RightLight = 5 ^RightLeverOperate = 2 \DEFINED VARIABLES \A = NUMBER OF RESPONSES \B = NUMBER OF REWARDS \E = DATA ARRAY LEFTLEVER \F = DATA ARRAY RIGHTlEVER \G = DATA ARRAY REWARD \M = MINUTES \X = FIXED RATIO \N = SESSION TIMER \Q = MAXIMUM REWARD VAR_ALIAS Fixed ratio = X VAR_ALIAS Maximum reward = Q VAR_ALIAS duration session (min) = M DIM E = 30 DIM F = 30 DIM G = 30 DIM J = 150 S.S.1, \Main control logic for "FR" S1, 0.001": SET X = 3; SET Q = 25; SET M = 60 ---> S2 S2, 0.001": ON ^Fan ---> S3 S3, #START: ON ^HouseLight, ^LeftLeverOperate, ^LeftLight, ^RightLeverOperate, ^RightLight ---> S4 S4, 1#R^LeftLever: OFF ^HouseLight, ^LeftLeverOperate, ^LeftLight, ^RightLeverOperate, ^RightLight; ON ^Pellet; Z1 ---> S5 #Z2:--->S1 S5, 20": ---> S4 #Z2: ---> S1 S.S.2, \This is the state set that contains the response count and display of the active lever S1, #Start: SHOW 2,ACTIVE,A---> S2 S2, 1#R^LeftLever: ADD A; SET E(A) = n ;SHOW 2,ACTIVE,A ---> SX #Z2:--->S1 S.S.3, \ This is the state set that contains the response count and display of the inactive lever S1, #START: SHOW 3,INACTIVE,B ---> S2 S2, #R^RightLever: ADD B; SET F(B) = N; SHOW 3,INACTIVE,B ---> SX #Z2: ---> S1 S.S.4, \ Reward counter and Timer S1, #Z1: ADD C; SET G(C) = N; SHOW 4,REWARD,C ---> S2 S2, 0.001": OFF ^Pellet ---> S3 #Z2: ---> S1 S3, 20": ON ^HouseLight, ^LeftLeverOperate, ^LeftLight, ^RightLeverOperate, ^RightLight ---> S1 #Z2: ---> S1 S.S.5, \Session Timer S1, #START: SHOW 1,Sess_n,N ---> S2 S2, 1.0": ADD N; SHOW 1, Sess_n,N; IF (N/60 >= M) OR (B >= Q) [@True, @False] \As long as session time < M we will continue @True: Z2 ---> S3 @False: ---> SX S3, 19.0": OFF ^HouseLight, ^LeftLeverOperate, ^LeftLight, ^RightLeverOperate, ^RightLight---> STOPABORTFLUSH
September 16, 2014 at 8:28 am #12966Med_Support
ModeratorGary Bamberger
I just ran the program and it works perfectly on my computer. The only unusual thing that I notice is that you have the inputs defined as follows:
^LeftLever = 1 ^RightLever = 4
The RightLever is on input 4. So if you have nothing connected to input 4, then when the program starts you could possibly receive an input immediately and if the RightLever is **not** connected to input 4, then when that lever is pressed nothing will happen.
Gary
September 16, 2014 at 9:22 am #12970Med_Support
Moderatorandersem
oh goodness, that worked. I had the input value for the right lever position rather than the response, which is why it would add one each time the lever goes out. Thanks again!
-
AuthorPosts
- You must be logged in to reply to this topic.