REM >2-DiscAp REM Two-Stimulus Discriminated Approach REM ---------------------------------- REM by Rudolf Cardinal progname$="2-DiscAp" version_date$="01-Nov-99" debug% = 0 :REM debugging? REM Trains rats according to a classical contingency. REM The boxes run simultaneously and synchronously. REM Within a given session, VI durations and stimulus pair order are the same across all boxes, REM though they are randomly allocated at the start of the session. REM REM VI, CS+, US, VI, CS-, non-US REM Order of CS+/CS- are counterbalanced in pairs REM CS+/CS- are counterbalanced L/R REM REM Traylight always off (discussed with NJM) REM REM VI = houselight on, dipper down, 30-90 s REM REM CS+ = houselight off, e.g. left stimulus light on, (dipper still down), 5 s REM US = houselight on, traylight off, dipper up, 5 s REM REM CS- = houselight off, e.g. right stimulus light on, 5s REM non-US = houselight on, traylight off, dipper down, brief click on clicker, 5s REM (for notional equivalence with US, REM so we can assess responding after both stimuli have finished; will always be possible to count this REM period as part of the subsequent VI if we want to). REM Confusing though it may be, the code refers to this as a "US minus". REM REM Null state at start/end = houselight off REM REM For each phase, the number of magazine entries and the duration spent REM in the magazine is recorded. Duration is more important. REM ================================== REM Revision history REM ================================== REM 19 Oct 99 - written REM 1 Nov 99 - comma-delimited output occurs before printing (printer locked up on Hos & Andrew) REM ================================== REM Libraries REM ================================== PROCinit :REM Arachnid init PROCkill_all :REM Arachnid init LIBRARY ".ProgLibs.Filename" LIBRARY ".ProgLibs.DateTime" LIBRARY ".ProgLibs.Ascii" LIBRARY ".ProgLibs.Arachnid" LIBRARY ".ProgLibs.BoxConst" LIBRARY ".ProgLibs.Random" LIBRARY ".ProgLibs.UI" PROCcombined_boxes PROCdefine_colours REM ================================== REM Constants REM ================================== ntrials% = 15 :REM number of trials per rat. One trial includes two stimulus presentations, CS+/CS- vi_min% = 3000 :REM minimum VI (normally 30 sec = 3000 cs) vi_max% = 9000 :REM maximum VI (normally 90 sec = 9000 cs) cs_time% = 500 :REM 5 sec us_time% = 500 :REM 5 sec IF debug% = 1 THEN ntrials%=5 vi_min%=100:vi_max%=300:cs_time%=150:us_time%=100 ENDIF not_watching% = 0 :REM handy constants, must be different vi_state% = 1 cs_plus_state% = 2 us_plus_state% = 3 cs_minus_state% = 4 us_minus_state% = 5 null_state% = 6 left%=1:right%=2:DIM sidename$(2):sidename$(left%)="L":sidename$(right%)="R" yes%=1:no%=0:DIM yesno$(1):yesno$(yes%)="Y":yesno$(no%)="N" cs_plus_first% = 0: cs_minus_first% = 1 cs_plus% = 0: cs_minus% = 1 DIM stim_desc$(1):stim_desc$(cs_plus%) = "CS+": stim_desc$(cs_minus%) = "CS-" REM ================================== REM Variable assignments REM ================================== DIM state%(nboxes%) :REM what phase is the box in? DIM vi_time%(ntrials%,1) :REM how long is the VI for this trial and presentation? DIM trial%(nboxes%) :REM which trial is this box doing? DIM trial_order%(ntrials%) :REM is this a CS+/CS- or a CS-/CS+ trial? DIM presentation%(nboxes%) :REM is it the first or second stimulus presentation? DIM cs_pokedur%(nboxes%,ntrials%,1) :REM nose poke duration during CS DIM us_pokedur%(nboxes%,ntrials%,1) DIM vi_pokedur%(nboxes%,ntrials%,1) :REM nose poke duration during VI DIM cs_pokes%(nboxes%,ntrials%,1) :REM # pokes during CS DIM us_pokes%(nboxes%,ntrials%,1) DIM vi_pokes%(nboxes%,ntrials%,1) :REM # pokes during VI DIM counting%(nboxes%) :REM are we timing? DIM watching%(nboxes%) :REM what state are we timing for? DIM start_time%(nboxes%) :REM holds TIME of switch onset DIM finished%(nboxes%) :REM has the box been shut down? DIM rresp_trial(nboxes%,ntrials%,1) :REM ratio of responding per trial/presentation DIM vi_pokesum%(nboxes%), vi_dursum%(nboxes%) DIM cs_plus_pokesum%(nboxes%), cs_plus_dursum%(nboxes%) DIM us_plus_pokesum%(nboxes%), us_plus_dursum%(nboxes%) DIM cs_minus_pokesum%(nboxes%), cs_minus_dursum%(nboxes%) DIM us_minus_pokesum%(nboxes%), us_minus_dursum%(nboxes%) DIM final_rr_plus(nboxes%), final_rr_minus(nboxes%) DIM rat_name$(nboxes%) :REM what's the rat called? DIM session_number%(nboxes%) :REM what session is it? DIM cs_side%(nboxes%) :REM is CS+ on left or right? REM ================================= REM Initialize screen REM ================================= MODE 27 CLS dummy=RND(-TIME): REM randomise random number generator PRINT progname$;" by Rudolf Cardinal, ";version_date$;"."; IF debug%=1 THEN COLOUR3:PRINT" *** DEBUGGING! ***":COLOUR 7 ELSE PRINT PRINT INPUT LINE "What's today's experiment called? " exp_title$ PRINT OSCLI("CAT") PRINT datafile$ = FNget_filename("DATA FILE - enter filename (no spaces etc.)") logfile$ = FNget_filename("TEXT LOG - enter filename (no spaces etc.)") date_time$ = FNdate_time_code PRINT COLOUR yellow%: PRINT "And the rats... (NB no commas!)" FOR box% = 1 TO nboxes% COLOUR yellow% PRINT "_______________________________________________ BOX ";box% COLOUR white% rat_name$(box%) = FNget_str_param(" Rat name","xxx") session_number%(box%) = FNget_num_param(" Session number", 1, 1, 50) REM odd-numbered boxes have L=CS+, R=CS- REM even-numbered boxes have the reverse IF (box% MOD 2)=0 THEN defside%=left% ELSE defside%=right% PRINT" CS+ side [";sidename$(defside%);"]: "; INPUT""lever$ CASE lever$ OF WHEN "L","l": cs_side%(box%) = left% WHEN "R","r": cs_side%(box%) = right% OTHERWISE: REM leave it as it is, then! cs_side%(box%) = defside% ENDCASE PRINT NEXT REM ========================================== REM Init hardware, assign events and run REM ========================================== PROCstart PROCwait(E%): *AE END REM ============================================ REM ******************************************** REM ============================================ DEF PROCstart REM The "totaltime" bit is just for show. totaltime_cs% = 0 FOR t% = 1 TO ntrials% trial_order%(t%) = FNrandom_integer(cs_plus_first%, cs_minus_first%) FOR presentation% = 0 TO 1 vi_time%(t%,presentation%) = FNrandom_integer(vi_min%, vi_max%) totaltime_cs% += vi_time%(t%,presentation%) NEXT NEXT totaltime_cs% += ntrials% * cs_time% * 2 totaltime_cs% += ntrials% * us_time% * 2 totaltime_min% = totaltime_cs% / (100*60) totaltime_sec% = (totaltime_cs% - (totaltime_min% * 100 * 60)) / 100 PRINT "Estimated running time is ";totaltime_min%;" min ";totaltime_sec%;" sec." REM clear the boxes to the null state FOR box% = 1 TO nboxes% REM the following stay off throughout the program PROCswitch_off(leftlevercontrol%(box%),E%) PROCswitch_off(rightlevercontrol%(box%),E%) PROCswitch_off(leftlight%(box%),E%) PROCswitch_off(rightlight%(box%),E%) PROCswitch_off(traylight%(box%),E%) finished%(box%) = no% trial%(box%) = 1 presentation%(box%) = 0 counting%(box%) = no% watching%(box%) = not_watching% PROCset_null(box%) REM can't schedule an "On" and an "Off" event, so must use REM a single "Over" [=change] event. PROCpipe_switch(nosepoke%(box%),Over,1,"FNmagazine_changed(",box%,E%) NEXT REM when we're ready, initialise into VI state and go PRINT"Ready to run, press a key to start..." IF GET PROCdisplay_startup FOR box% = 1 TO nboxes% PROCset_vi(box%) PROCdisplay_box(box%) NEXT ENDPROC DEF FNentrypoint(box%,R%) IF R%=0 =0 CASE state%(box%) OF WHEN vi_state%: REM end of VI; might initiate either CS+ or CS- PROCstop_counting(box%) IF FNthis_stimulus(trial_order%(trial%(box%)), presentation%(box%)) = cs_plus% THEN PROCset_cs_plus(box%) ELSE PROCset_cs_minus(box%) ENDIF PROCdisplay_state(box%) WHEN cs_plus_state%: REM end of CS+ PROCstop_counting(box%) PROCset_us_plus(box%) PROCdisplay_state(box%) WHEN cs_minus_state%: REM end of CS- PROCstop_counting(box%) PROCset_us_minus(box%) PROCdisplay_state(box%) WHEN us_minus_state%, us_plus_state%: REM end of US; initiate next presentation or next trial PROCstop_counting(box%) vi_pokesum%(box%) += vi_pokes%(box%,trial%(box%), presentation%(box%)) vi_dursum%(box%) += vi_pokedur%(box%,trial%(box%), presentation%(box%)) IF FNthis_stimulus(trial_order%(trial%(box%)), presentation%(box%)) = cs_plus% THEN cs_plus_pokesum%(box%) += cs_pokes%(box%,trial%(box%), presentation%(box%)) cs_plus_dursum%(box%) += cs_pokedur%(box%,trial%(box%), presentation%(box%)) us_plus_pokesum%(box%) += us_pokes%(box%,trial%(box%), presentation%(box%)) us_plus_dursum%(box%) += us_pokedur%(box%,trial%(box%), presentation%(box%)) ELSE cs_minus_pokesum%(box%) += cs_pokes%(box%,trial%(box%), presentation%(box%)) cs_minus_dursum%(box%) += cs_pokedur%(box%,trial%(box%), presentation%(box%)) us_minus_pokesum%(box%) += us_pokes%(box%,trial%(box%), presentation%(box%)) us_minus_dursum%(box%) += us_pokedur%(box%,trial%(box%), presentation%(box%)) ENDIF IF presentation%(box%) = 1 THEN presentation%(box%) = 0 trial%(box%) += 1 ELSE presentation%(box%) = 1 ENDIF IF trial%(box%) <= ntrials% THEN PROCset_vi(box%) PROCdisplay_box(box%) ELSE PROCfinish(box%) ENDIF ENDCASE =0 DEF PROCset_null(box%) PROCswitch_off(houselight%(box%),E%) PROCswitch_off(leftlight%(box%),E%) PROCswitch_off(rightlight%(box%),E%) PROCswitch_off(dipper%(box%),E%) state%(box%) = null_state% ENDPROC DEF PROCset_vi(box%) PROCswitch_on(houselight%(box%),E%) PROCswitch_off(leftlight%(box%),E%) PROCswitch_off(rightlight%(box%),E%) PROCswitch_off(dipper%(box%),E%) state%(box%) = vi_state% REM set timer for the VI; when it expires, go to FNentrypoint PROCpipe_timer(box%,vi_time%(trial%(box%),presentation%(box%)),0,"FNentrypoint(",box%,E%) PROCstart_counting(box%) ENDPROC DEF PROCset_cs_plus(box%) LOCAL light% PROCswitch_off(houselight%(box%),E%) PROCswitch_off(leftlight%(box%),E%) :REM should be off anyway PROCswitch_off(rightlight%(box%),E%) :REM should be off anyway PROCswitch_off(dipper%(box%),E%) :REM dipper should be down anyway IF cs_side%(box%) = left% THEN light% = leftlight%(box%) ELSE light% = rightlight%(box%) PROCswitch_on(light%, E%) state%(box%) = cs_plus_state% REM After cs_time%, go to FNentrypoint PROCpipe_timer(box%,cs_time%,0,"FNentrypoint(",box%,E%) PROCstart_counting(box%) ENDPROC DEF PROCset_cs_minus(box%) LOCAL light% PROCswitch_off(houselight%(box%),E%) PROCswitch_off(leftlight%(box%),E%) :REM should be off anyway PROCswitch_off(rightlight%(box%),E%) :REM should be off anyway PROCswitch_off(dipper%(box%),E%) :REM dipper should be down anyway IF cs_side%(box%) = left% THEN light% = rightlight%(box%) ELSE light% = leftlight%(box%) PROCswitch_on(light%, E%) state%(box%) = cs_minus_state% REM After cs_time%, go to FNentrypoint PROCpipe_timer(box%,cs_time%,0,"FNentrypoint(",box%,E%) PROCstart_counting(box%) ENDPROC DEF PROCset_us_plus(box%) PROCswitch_on(houselight%(box%),E%) PROCswitch_on(dipper%(box%),E%) PROCswitch_off(leftlight%(box%),E%) PROCswitch_off(rightlight%(box%),E%) state%(box%) = us_plus_state% REM After us_time%, go to FNentrypoint PROCpipe_timer(box%,us_time%,0,"FNentrypoint(",box%,E%) PROCstart_counting(box%) ENDPROC DEF PROCset_us_minus(box%) PROCswitch_on(houselight%(box%),E%) PROCswitch_off(dipper%(box%),E%) PROCswitch_off(leftlight%(box%),E%) PROCswitch_off(rightlight%(box%),E%) PROCfast_pellet(clicker%(box%),1) state%(box%) = us_minus_state% REM After us_time%, go to FNentrypoint PROCpipe_timer(box%,us_time%,0,"FNentrypoint(",box%,E%) PROCstart_counting(box%) ENDPROC DEF PROCfinish(box%) PROCkill_switch(nosepoke%(box%),E%) PROCset_null(box%) REM don't call display_box as trial% now too big REM I'm scared that if I start reporting for a box before they've REM all finished, the other three will be inaccurately timed for REM the last session. Hence this check. finished%(box%) = yes% FOR i% = 1 TO nboxes% IF finished%(i%) <> yes% THEN ENDPROC NEXT REM Now create the file for importing into Access/Excel REM Times in seconds. REM Summary measures not bothered with, do it in a query later. datachan%=OPENOUT(datafile$) PROCprint_line(datachan%,"PROGNAME,DATE_TIME,RAT,SESSION,BOX,TRIAL,PRESENTATION,STIMULUS_TYPE,VI_POKES,CS_POKES,US_POKES,VI_POKEDUR,CS_POKEDUR,US_POKEDUR,VI_LENGTH,CS_LENGTH,US_LENGTH,CS_PLUS_SIDE") FOR b% = 1 TO nboxes% d$ = progname$+","+date_time$+","+rat_name$(b%)+","+STR$(session_number%(b%))+","+STR$(b%)+"," FOR t% = 1 TO ntrials% FOR p% = 0 TO 1 PROCprint_string(datachan%, d$ + STR$(t%) + "," + STR$(p%) + "," + stim_desc$(FNthis_stimulus(trial_order%(t%),p%)) ) PROCprint_string(datachan%, ","+STR$(vi_pokes%(b%,t%,p%))+","+STR$(cs_pokes%(b%,t%,p%))+","+STR$(us_pokes%(b%,t%,p%)) ) PROCprint_string(datachan%, ","+STR$(vi_pokedur%(b%,t%,p%))+","+STR$(cs_pokedur%(b%,t%,p%))+","+STR$(us_pokedur%(b%,t%,p%)) ) PROCprint_line(datachan%, ","+STR$(vi_time%(t%,p%))+","+STR$(cs_time%)+","+STR$(us_time%)+","+sidename$(cs_side%(b%)) ) NEXT NEXT NEXT CLOSE#datachan% VDU 2 :REM turn on printer CLS OSCLI("SPOOL "+logfile$) :REM output to disk PRINT"**********************************************************" PRINT"Results from !";progname$;" on ";TIME$ PRINT"Experiment: ";exp_title$ PRINT"Date/time code: ";date_time$ PRINT"Log filename: ";logfile$ PRINT"Data filename: ";datafile$ PRINT"**********************************************************"' FOR i% = 1 TO nboxes% VDU 2: PROCfinal_output(i%) :REM that procedure does VDU 3. NEXT OSCLI("SPOOL") OSCLI("SETTYPE "+logfile$+" TEXT") :REM set file type VDU 3 :REM printer off, close file PRINT'"Finished at ";TIME$ PRINT"If you want that again, use PROCfinal_output(box number)."' at_save% = @% @% = &020208 :REM page 58 of the BASIC ref. manual; 2=fixed width, 02=two dp, 08=field width FOR i%=1 TO nboxes% PRINT " Final RRs for box ";i%;" (";rat_name$(i%);"): "; PRINT "CS+ = ";final_rr_plus(i%); PRINT ", CS- = ";final_rr_minus(i%) NEXT PRINT @% = at_save% ENDPROC DEF PROCstart_counting(box%) counting%(box%) = yes% IF FNswitch(nosepoke%(box%),E%)=On THEN PROCenter_magazine(box%) REM as the event is scheduled on a transition, it'll get lost if REM the switch is active at startup, without this extra check. ENDPROC DEF PROCstop_counting(box%) IF watching%(box%) <> not_watching% THEN PROCleave_magazine(box%) counting%(box%) = no% ENDPROC DEF FNmagazine_changed(box%,R%) IF R%=0 =0 IF counting%(box%) = no% THEN =0 IF FNswitch(nosepoke%(box%),E%)=On THEN PROCenter_magazine(box%) ELSE PROCleave_magazine(box%) ENDIF =0 DEF PROCenter_magazine(box%) IF trial%(box%) > ntrials% THEN ENDPROC REM this is to prevent overrun at the end of the program, where REM trial%(box%) can be increased beyond ntrials% before the program REM terminates. There are probably more elegant ways, but this is safe. start_time%(box%) = TIME watching%(box%) = state%(box%) CASE state%(box%) OF WHEN vi_state%: vi_pokes%(box%,trial%(box%), presentation%(box%)) += 1 WHEN cs_plus_state%, cs_minus_state%: cs_pokes%(box%,trial%(box%), presentation%(box%)) += 1 WHEN us_plus_state%, us_minus_state%: us_pokes%(box%,trial%(box%), presentation%(box%)) += 1 ENDCASE PROCdisplay_switch(box%) ENDPROC DEF PROCleave_magazine(box%) REM when it starts counting, if the switch is off REM then Arachnid comes here (even if the switch REM hasn't undergone a transition. REM And *somehow* this is getting called with box%=0... CASE watching%(box%) OF WHEN vi_state%: vi_pokedur%(box%,trial%(box%), presentation%(box%)) += TIME-start_time%(box%) WHEN cs_plus_state%, cs_minus_state%: cs_pokedur%(box%,trial%(box%), presentation%(box%)) += TIME-start_time%(box%) WHEN us_plus_state%, us_minus_state%: us_pokedur%(box%,trial%(box%), presentation%(box%)) += TIME-start_time%(box%) WHEN not_watching%: ENDCASE watching%(box%) = not_watching% PROCdisplay_switch(box%) ENDPROC DEF PROCdisplay_startup CLS PRINT progname$;", by Rudolf Cardinal, ";version_date$;"."; IF debug%=1 THEN COLOUR3:PRINT" *** DEBUGGING! ***":COLOUR 7 ELSE PRINT PRINT"Two-stimulus version first written 19 Oct 99." PRINT"Experiment: ";:COLOUR1:PRINTexp_title$:COLOUR7 PRINT PRINT"Number of trials: ";ntrials%; " (each trial contains a CS+ and a CS- presentation)" PRINT"Timing parameters: VI=";vi_min%/100;"-";vi_max%/100;"s, CS=";cs_time%/100;"s, US=";us_time%/100;"s" PRINT"Started at: ";TIME$ PRINT"Total running time: ";totaltime_min%;" min ";totaltime_sec%;" sec" PRINT PRINT"- The first two rows show times for the previous trial (CS+,CS-)." PRINT"- The third row (VI-total etc.) shows cumulative time for the CS+." PRINT"- The fourth row shows cumulative time for the CS-." PRINT PRINT"Box Trial VI-time State In? VI-poketime CS-poketime US-poketime" PRINT" VI total CS+ total US total RR" PRINT" CS- total non-US RR" PRINT"----------------------------------------------------------------------------" REM 0 1 2 3 4 5 6 7 display_firstline%=VPOS ENDPROC DEF PROCdisplay_box(box%) LOCAL line%, prevplus%, prevminus% IF trial_order%(trial%(box%)-1) = cs_plus_first% THEN prevplus% = 0: prevminus% = 1 ELSE prevminus% = 0: prevplus% = 1 ENDIF line% = FNdisplay_line(box%) PRINTTAB(0,line%);box%; PRINTTAB(5,line%);trial%(box%); PRINTTAB(12,line%);vi_time%(trial%(box%),presentation%(box%))/100; REM Safety feature: since trials are numbered 1-ntrials, REM I can use trial%-1 even from the first trial. REM Messy, but it's only cosmetic code anyway. REM And at least you know now. PRINTTAB(33,line%);vi_pokedur%(box%,trial%(box%)-1,prevplus%)/100;" "; PRINTTAB(46,line%);cs_pokedur%(box%,trial%(box%)-1,prevplus%)/100;" "; PRINTTAB(59,line%);us_pokedur%(box%,trial%(box%)-1,prevplus%)/100;" "; PRINTTAB(33,line%+1);vi_pokedur%(box%,trial%(box%)-1,prevminus%)/100;" "; PRINTTAB(46,line%+1);cs_pokedur%(box%,trial%(box%)-1,prevminus%)/100;" "; PRINTTAB(59,line%+1);us_pokedur%(box%,trial%(box%)-1,prevminus%)/100;" "; PRINTTAB(33,line%+3);vi_dursum%(box%)/100;" "; PRINTTAB(46,line%+3);cs_plus_dursum%(box%)/100;" "; PRINTTAB(59,line%+3);us_plus_dursum%(box%)/100;" "; PRINTTAB(73,line%+3);INT(FNratio_resp(cs_plus_dursum%(box%),vi_dursum%(box%),cs_time% * (trial%(box%)-1),FNvi_time_until(trial%(box%)-1)));" "; REM The INT() function rounds down, so is wrong here. Oh well. PRINTTAB(46,line%+4);cs_minus_dursum%(box%)/100;" "; PRINTTAB(59,line%+4);us_minus_dursum%(box%)/100;" "; PRINTTAB(73,line%+4);INT(FNratio_resp(cs_minus_dursum%(box%),vi_dursum%(box%),cs_time% * (trial%(box%)-1),FNvi_time_until(trial%(box%)-1)));" "; PROCdisplay_state(box%) PROCdisplay_switch(box%) ENDPROC DEF PROCdisplay_state(box%) line% = FNdisplay_line(box%) PRINTTAB(21,line%); CASE state%(box%) OF WHEN null_state%: PRINT"Null "; WHEN vi_state%: PRINT"VI "; WHEN cs_plus_state%: PRINT"CS+ "; WHEN us_plus_state%: PRINT"US "; WHEN cs_minus_state%: PRINT"CS- "; WHEN us_minus_state%: PRINT"no US"; ENDCASE ENDPROC DEF PROCdisplay_switch(box%) IF box%=0 THEN VDU7:PRINT"some berk is calling for box 0" line% = FNdisplay_line(box%) PRINTTAB(28,line%); CASE FNswitch(nosepoke%(box%),E%) OF WHEN On: PRINT"*"; WHEN Off: PRINT" "; ENDCASE ENDPROC DEF FNdisplay_line(box%) = display_firstline% + (box%-1)*6 DEF FNratio_resp(cs_poketime%, vi_poketime%, cs_total%, vi_total%) REM should be undefined if rat doesn't move (return -1) REM 0 if approach all in VI REM 100% if approach all in CS IF (cs_poketime% + vi_poketime%) = 0 THEN =-1 IF cs_total%=0 OR vi_total%=0 THEN =-1 cs_proportion = cs_poketime% / cs_total% vi_proportion = vi_poketime% / vi_total% rr = cs_proportion / (cs_proportion + vi_proportion) = rr * 100 DEF FNvi_time_until(t%) LOCAL sum%, vtr%, pres% sum%=0 FOR vtr%=1 TO t% FOR pres%=0 TO 1 sum%+=vi_time%(vtr%,pres%) NEXT NEXT =sum% DEF PROCfinal_output(box%) vi_timesum% = FNvi_time_until(ntrials%) :REM same denominator for CS+ and CS- cs_timesum% = cs_time% * ntrials% :REM applies to CS+ and CS- separately us_timesum% = us_time% * ntrials% :REM applies to CS+ and CS- separately vi_percent = 100 * vi_dursum%(box%) / vi_timesum% cs_plus_percent = 100 * cs_plus_dursum%(box%) / cs_timesum% us_plus_percent = 100 * us_plus_dursum%(box%) / us_timesum% cs_minus_percent = 100 * cs_minus_dursum%(box%) / cs_timesum% us_minus_percent = 100 * us_minus_dursum%(box%) / us_timesum% final_rr_plus(box%)=FNratio_resp(cs_plus_dursum%(box%),vi_dursum%(box%),cs_timesum%,vi_timesum%) final_rr_minus(box%)=FNratio_resp(cs_minus_dursum%(box%),vi_dursum%(box%),cs_timesum%,vi_timesum%) PRINT PRINT"Box ";box%;" - ";rat_name$(box%);" (session ";session_number%(box%);")" PRINT"=====================================================================" PRINT" CS+ side: ";sidename$(cs_side%(box%)) PRINT" Trials = ";ntrials%;"; CS presented for ";cs_time%/100;"s; US presented for ";us_time%/100;"s" PRINT" VI pokes = ";vi_pokesum%(box%);", VI duration = ";vi_dursum%(box%)/100;"s, %time in during VI = ";vi_percent;"%" PRINT" CS+ pokes = ";cs_plus_pokesum%(box%);", CS+ duration = ";cs_plus_dursum%(box%)/100;"s, %time in during CS+ = ";cs_plus_percent;"%" PRINT" US pokes = ";us_plus_pokesum%(box%);", US duration = ";us_plus_dursum%(box%)/100;"s, %time in during US = ";us_plus_percent;"%" PRINT" CS- pokes = ";cs_minus_pokesum%(box%);", CS- duration = ";cs_minus_dursum%(box%)/100;"s, %time in during CS- = ";cs_minus_percent;"%" PRINT" 'non-US' pokes = ";us_minus_pokesum%(box%);", 'non-US' duration = ";us_minus_dursum%(box%)/100;"s, %time in during 'non-US' = ";us_minus_percent;"%" PRINT" Overall ratio of responding for CS+ = ";final_rr_plus(box%) PRINT" Overall ratio of responding for CS- = ";final_rr_minus(box%) PRINT VDU 3 ENDPROC DEF FNthis_stimulus(trialorder%, presentation%) IF trialorder% = cs_plus_first% THEN IF presentation% = 0 THEN =cs_plus% ELSE =cs_minus% ELSE IF presentation% = 0 THEN =cs_minus% ELSE =cs_plus% ENDIF VDU 7:PRINTTAB(0,0);"Nasty bug into FNthis_stimulus()." =0