FR1 and Beam Break
MEDState Notation Repository › Forums › Coding Help Archive › FR1 and Beam Break
- This topic has 2 replies, 1 voice, and was last updated 8 years, 9 months ago by
Med_Support.
-
AuthorPosts
-
October 15, 2014 at 11:31 am #12870
Med_Support
ModeratorN S M
Hello there,
I am trying to write my first program but I have some issues, I’ve never written any computer code.I am trying to figure out an FR 1 for the lever which is associated to the pump. I want the rat
to turn on the pump after pressing the lever once and turn off after one second. I also have problems with the recollection of data.On the other hand, I would like to register the event time of the lickometer. I know I have to do it with the beambreak code, but I don’t know how write it
without programming an output associated.Finally, can I find a way to register the latency of both inputs?
Thanks so much for the help!
\ Inputs: ^Lever = 1 ^Lickometer = 2 \Outputs: ^Pump = 4 DISKVARS = A,B,C,D,E DISKFORMAT = 8.5 DISKOPTIONS = CONDENSEDHEADERS \ VARIABLES USED IN THIS PROCEDURE \ A = Response Counter \ B = Reward Counter \ C() = Array for inter-response times, etc. for \ Soft Cumulative Recorder or other analysis \ D = Free Lever Counter \ E = Lickometer response \ F = Array for lickometer response \ I = Subscript for array C \ T = Used to increment counts at 0.1 second intervals for irt's. \ X = Fixed Variable Ratio - Set to a \ default value of 5 in SS1, S1 \ Z-PULSES USED IN THIS PROCEDURE \ Z1 = Signal for pump Timer \ K-PULSES USED IN THIS PROCEDURE \ K1 = Signal for free FLUID. \ Define Array sizes here. The maximum total space available \ for all arrays is a single procedure is 10,000. The code \ value -987.987 is used to seal or terminate the array at \ the last valid element. DIM C = 3000 DIM E = 3000 \ ********************************************* \ Main Procedure \ ********************************************* S.S.1, S1, .01": SET X = 1 ---> S2 S2, #START: ON ^Lever ---> S3 1": SHOW 1,FR =,X ---> SX S3, X#R^Lever: ADD B; SHOW 2,REWARD,B; ON ^Pump; Z1 ---> SX \ ********************************************* \ Response Counter & Screen Update \ ********************************************* S.S.2, S1, #START: SHOW 1,RESPS,A, 2,REWARDS,B ---> S2 S2, #R^Lever: ADD A; SHOW 1,RESPS,A ---> SX \ ********************************************* \ FLUID CONTROL TIMER \ ********************************************* S.S.3, S1, #Z1: ---> S2 #K1: ADD D; SHOW 3,FreeRd,D; ON ^Pump ---> S2 S2, .05": OFF ^Pump ---> S1 \ *********************************************** \ The Following State Sets are added to \ collect irt and reinforcement time codes \ that can be read by the SoftCR cumulative \ recorder program. The irt's can also be \ converted to real time values in any spread- \ sheet by stripping the code value to the \ right of the decimal point (use an int \ function) and dividing by 10. \ *********************************************** S.S.5, \ Increment time "T" with resolution 0.1 seconds S1, #START: ---> S2 S2, .1": ADD T ---> SX S.S.6, \ Enter each response irt to array C. \ This code is for relative or incremental \ values. If absolute or cumulative values are \ desired, delete the code ", T = 0" in S2. S1, #START: SET C(I) = -987.987 ---> S2 S2, #R^Lever: SET C(I) = T + 0.1, T = 0, I = I + 1; IF I = 2999 [@TrueArrayFull, @FalseContinue] @ArrayFull: ---> S1 @Cont: SET C(I) = -987.987 ---> SX S.S.7, \ Set "Pip" code for reinforcement. \ Since reinforcement occurs at the same time \ as the response that delivered the reward, the \ incremental time value is zero. For absolute \ time values change the code "SET C(I) = 0.2" to \ "SET C(I) = T + 0.2". S1, #START: ---> S2 S2, #Z1: SET C(I) = 0.2; ADD I; IF I = 3000 [@TrueArrayFull, @FalseContinue] @ArrayFull: ---> S1 @Cont: SET C(I) = -987.987 ---> SX
October 15, 2014 at 2:14 pm #12871Med_Support
ModeratorGary Bamberger
In S.S.1, S1 you set X = 1 and in S3 you use X#R^Lever giving you an FR 1.
When the pump turns on you issue a Z1 which is responded to in S.S.3, S1. However the pump only stays on for 0.05″. If you want it to stay on for 1s you need to change the program as follows:
S2, 1": OFF ^Pump ---> S1
For your Lickometer the following might work for you:
S.S.4, S1, 0.01": SET F(E) = -987.987 ---> S2 S2, #START: ---> S3 S3, #R^Lickometer: SET F(E) = S; ADD E; SET F(E) = -987.987 ---> SX S.S.8, S1, #START: ---> S2 S2, 0.01": SET S = S + 0.01 ---> SX
You should be able to do something similar for timestamps of the lever.
Gary
October 27, 2014 at 11:15 am #12875Med_Support
ModeratorN S M
It worked! Thank you so much for your help!
-
AuthorPosts
- You must be logged in to reply to this topic.