Noncontigent VI
MEDState Notation Repository › Forums › Coding Help Archive › Noncontigent VI
- This topic has 4 replies, 1 voice, and was last updated 8 years, 9 months ago by
Med_Support.
-
AuthorPosts
-
May 20, 2007 at 5:54 pm #13212
Med_Support
Moderatornoamygdala
Hi I’m new to the medstate notation game and am trying to write my first program. In fact I’ve never written any computer code other than for an HTML website. I’m tring to setup a pretty general magazine training protocol where the the reinforcer appears on average every 60s (varaible interval 60). the reinforcer is a dipper cup that has fluid in it so it needs to stay up until they stick their head into the magazine as measured by a beam break. The dipper cup then needs to retract about 10s after they first put their head in. After this it needs to come back up on the VI60 schedule for the duration of the session. I would like to record the number of magazine entries during the reinforcement period as well as a separate measurement during the nonreinforcement period.
One of the major problems I’m having is trying to figure out what the most efficient way to program the VI60 schedule is as well as tring to record the entries when I want them to be recorded. Any thoughts or suggestions on this would be much appreciated.thanks
May 23, 2007 at 11:37 am #13213Med_Support
ModeratorGary Bamberger
Try something like this:
LIST Z = 50", 55", 60", 65", 70" S.S.1, S1, \ Draw VI from List 0.01": RANDD A = Z ---> S2 S2, \ Wait VI value then turn on Dipper A#T: ON 1; Z1 ---> S3 S3, \ Wait for head entry into the Dipper #R1: ---> S4 S4, \ Turn off Dipper 10 seconds after head entry 10": OFF 1; Z2 ---> S1 S.S.2, S1, \ Count head entries when Dipper is off #R1: ADD B ---> S1 #Z1: ---> S2 S2, \ Count head entries when Dipper is on #R1: ADD C ---> S2 #Z2: ---> S1
May 23, 2007 at 6:57 pm #13216Med_Support
Moderatornoamygdala
Thanks for your reply Gary I appreciate the input. After getting the actual VI nailed down I realized that I wanted to if their magazine entries increased throughout the session. I decided to record magazine entries in 10 second blocks for a 90 second session in this case. I also needed to time stamp the magazine entries (headpokes) and dippers as the computer is randomly dippers to come up at different times. I can’t seem to get the time stamping array for my dipper to work. Recording the entries per 10 s blocks isn’t working either. I think I am missing something or maybe making things more complicated that they need to be. I have posted my code below. Any tips or maybe a more efficient way to record the things I need would be much appreciated. Note: Although it sounds redundant I want to both time stamp and record mag entries in 10 s blocks for ease of data analysis down the road.
\ Mag train VI 10 \ reward VI60s reward present for 5s after first head poke ^headpoke= 3 ^House = 7 ^Dipper = 3 \ Defined Variables \ A = Number of headpokes \ B = number of rewards \ C = Array for headpokes \ E(1) = headpokes in first 10s \ E(2) = headpokes in 10-20s \ E(3) = headpokes in 20-30s \ E(4) = headpokes in 30-40s \ E(5) = headpokes in 40-50s \ E(6) = headpokes in 50-60s \ E(7) = headpokes in 50-70s \ E(8) = headpokes in 70-90s \ R = reinforcer timer array \ D = Output Array \ M = max time \ N = Session Timer \ Q = max reinforcer Dim C = 1000 Dim E = 1000 Dim L = 1000 List D = 5, 15, 1, 11, 14, 6 S.S.1, \ ************************************VI 60s logic S1, #START: ON ^House; set Q = 15; set M = 90 ---> S2 S2, 0": Randd X = D; Show 2, VI, X; Set X = X" ---> S3 S3, X#T: On^dipper; add B; z2 ---> S4 S4, #R^headpoke: ---> s5 s5, 5": off^dipper --->S2 S.S.2 \**************************************count total headpokes S1, #start: show 4, tpoke, A ---> S2 S2, #R^headpoke: Add A; Show 4, tpoke, A; z1---> SX S.S.3 \*************************************timer S1, #Start: ---> S2 S2, 1": Add G ---> SX S.S.4 \*************************************count headpokes in time blocks where G = # seconds S1, #z1: If G<11 [@true, @false]   @ true: add E(1); ---> SX   @ false: --->S3 S3, 0": If G>10 [@true1, @false1]      @ true1: If G <= 20 [@true3, @false3]        @true3: add E(2); ---> SX        @false3: --->S4      @ false1: --->SX S4, 0": If G>20 [@true1, @false1]   @ true1: If G<=30 [@true2, @false2]     @true2: add E (3); ---> SX     @false2: --->S5   @ false1: --->SX S5, 0": If G>30 [@true1, @false1]   @ true1: If G<=40 [@true2, @false2]     @true2: add E (4); ---> SX     @false2: --->S6   @ false1: --->SX S6, 0": If G>40 [@true1, @false1]   @ true1: If G<=50 [@true2, @false2]     @true2: add E (5); ---> SX     @false2: --->S7   @ false1: --->SX S7, 0": If G>50 [@true1, @false1]   @ true1: If G<=60 [@true2, @false2]     @true2: add E (6); ---> SX     @false2: --->S8   @ false1: --->SX S8, 0": If G>60 [@true1, @false1]   @ true1: If G<=70 [@true2, @false2]     @true2: add E (7); ---> SX     @false2: --->S9   @ false1: --->SX S9, 0": If G>70 [@true1, @false1]   @ true1: add E (8); ---> SX   @ false1: --->SX S.S.6 \*************************************Time incrementsfor time stamping S1, #Start: ---> S2 S2,  1": Set T = T + 1" ---> SX S.S.7 \*************************************time stamp headpokes S1, #Start: ---> S2 S2, #R^headpoke: Set C(I) = T, T = 0; add I;        Set C(I) = -987.987 ---> SX S.S.8\**************************************timestamp dippers S1, #z2: Set L(O) = T, T = 0; add O;    Set L(O) = -987.987 ---> SX S.S.9, \ ************************************Session timer shut off S1, #START: SHOW 1,Session,N ---> S2 S2, 1": ADD N; SHOW 1,Session, N;   If N < M [@true, @false]    @true: If Q < B [@2true, @2false]     @2true: ---> S3     @2false: ---> SX   @false: ---> S3 S3, 0": ---> stopabort
May 24, 2007 at 9:05 am #13218Med_Support
ModeratorGary Bamberger
Your code was a little too complex. I have tried to simplify it for you. I think the code below should do what you need:
\ Mag Train VI 10 \ Reward VI-60s Reward Present for 5s After First Head Poke \ Inputs ^HeadPoke = 3 ^House = 7 \ Outputs ^Dipper = 3 \ Defined Variables \ A = Number of HeadPokes \ B = Number of Rewards \ C() = Array for HeadPokes \ D = Reinforcer Timer Array \ E(1) = HeadPokes in First 10s \ E(2) = HeadPokes in 10-20s \ E(3) = HeadPokes in 20-30s \ E(4) = HeadPokes in 30-40s \ E(5) = HeadPokes in 40-50s \ E(6) = HeadPokes in 50-60s \ E(7) = HeadPokes in 50-70s \ E(8) = HeadPokes in 70-90s \ I = Index into Array C \ J = Index into Array L \ K = Index into Array E \ L() = Array for Dipper Presentations \ M = Max Time \ N = Session Timer \ Q = Max Reinforcer DIM C = 1000 DIM E = 1000 DIM L = 1000 LIST D = 5, 15, 1, 11, 14, 6 S.S.1, \************************************VI 60s Logic S1, #START: ON ^House; SET Q = 15, M = 90 ---> S2 S2, 0": RANDD X = D; SHOW 2,VI,X; SET X = X * 1" ---> S3 S3, X#T: ON ^Dipper; ADD B; Z2 ---> S4 S4, #R^HeadPoke: ---> S5 S5, 5": OFF ^Dipper ---> S2 S.S.2, \************************************Count Total HeadPokes S1, #START: SHOW 4,tpoke,A ---> S2 S2, #R^HeadPoke: ADD A; SHOW 4,tpoke,A; Z1 ---> SX S.S.4, \************************************Count HeadPokes in Time Blocks Where G = # seconds S1, #START: SET E(K+1) = -987.987 ---> S2 S2, 10": ADD K; SET E(K) = 0, E(K+1) = -987.987 ---> S2 #Z1: SET C(I) = N; ADD I; SET C(I) = -987.987; ADD E(K) ---> SX S.S.8, \************************************Time Stamp Dippers S1, #Z2: SET L(J) = N; ADD J; SET L(J) = -987.987 ---> SX S.S.9, \************************************Session Timer Shut Off S1, #START: SHOW 1,Session,N ---> S2 S2, 0.01": SET N = N + 0.01; SHOW 1,Session,N; IF N <= M [@True, @False] @True: IF Q <= B [@True, @False] @True: ---> S3 @False: ---> SX @False: ---> S3 S3, 0": ---> STOPABORTFLUSH
May 29, 2007 at 6:05 pm #13220Med_Support
Moderatornoamygdala
I really appreciate the help. Those adjustments to my code made my life a lot easier.
Ihanks,
James -
AuthorPosts
- You must be logged in to reply to this topic.