WindowVisible(3); '********** 'This version of the crab analyzer features a phase plot diagram ' it is created when you select "phase analysis" and then continue to "summaries only" ' it also allows you to use existing memory channels, if you have already analyzed your spikes '*********** '****** revisions **** ' 04/2012: added toolbar and bulk save and delete memory channels ' 05/2012: changed "give spike event channel to use" input to drop down menue ("oldchan" variable) ' 06/2012: added toolbars and separated phase analysis from the rest 'TODO: search for ''' THIS IS THE PLACE TO CATCH it '********************* var fh%; var yesno$:="n"; 'keep this string "n" at all times when it is not used var item%; var number1%; var phasequery%; var savelogquery%; var summary%; var xlv%; 'short for "XL version"....variable used to prompt program to write XL-friendly version of printlog var appendfile%; var burstnum1; var burstnum2; var burstnum3; var burstnum4; var burstnum5; var burstnum6; var burstnum7; '*********************************** 'INPUT CHANNELS MADE (UP TO 10)... var inputCh1% :=8; var inputCh2% :=8; var inputCh3% :=8; var inputCh4% :=8; var inputCh5% :=8; var inputCh6% :=8; var inputCh7% :=8; 'NEW CODE WS 08/2006 '******************************************** 'channel variables in case user wants to use existing event channels for analysis. var oldchan1%; var oldchan2%; var oldchan3%; var oldchan4%; var oldchan5%; var oldchan6%; var oldchan7%; ' END NEW CODE WS 08/2006 '********************************************* 'EVENT VARIABLES FOR NEURONS (UP TO 9): 'NEURON 1 var eventCh1% := -1; 'event channel to write final output to var eventCh11% := -1; 'rising time of spike picked up by horizontal cursor "setCutOff1" var eventCh12% := -1; 'falling time of spike picked up by horizontal cursor "setCutOff1" var mindelay1 :=0.005; 'minimum delay between two events (spikes) 'NEURON 2 var eventCh2% := -1; 'event channel to write final output to var eventCh13% := -1; 'rising time of spike picked up by horizontal cursor "setCutOff2" var eventCh14% := -1; 'falling time of spike picked up by horizontal cursor "setCutOff2" var mindelay2 :=0.005; 'minimum delay between two events (spikes) 'NEURON 3 var eventCh3% := -1; 'event channel to write final output to var eventCh15% := -1; 'rising time of spike picked up by horizontal cursor "setCutOff3" var eventCh16% := -1; 'falling time of spike picked up by horizontal cursor "setCutOff3" var mindelay3 :=0.005; 'minimum delay between two events (spikes) 'NEURON 4 var eventCh4% := -1; 'event channel to write final output to var eventCh17% := -1; 'rising time of spike picked up by horizontal cursor "setCutOff4" var eventCh18% := -1; 'falling time of spike picked up by horizontal cursor "setCutOff4" var mindelay4 :=0.005; 'minimum delay between two events (spikes) 'NEURON 5 var eventCh5% := -1; 'event channel to write final output to var eventCh19% := -1; 'rising time of spike picked up by horizontal cursor "setCutOff5" var eventCh20% := -1; 'falling time of spike picked up by horizontal cursor "setCutOff5" var mindelay5 :=0.005; 'minimum delay between two events (spikes) 'NEURON 6 var eventCh6% := -1; 'event channel to write final output to var eventCh21% := -1; 'rising time of spike picked up by horizontal cursor "setCutOff5" var eventCh22% := -1; 'falling time of spike picked up by horizontal cursor "setCutOff5" var mindelay6 :=0.005; 'minimum delay between two events (spikes) 'NEURON 7 var eventCh7% := -1; 'event channel to write final output to var eventCh23% := -1; 'rising time of spike picked up by horizontal cursor "setCutOff5" var eventCh24% := -1; 'falling time of spike picked up by horizontal cursor "setCutOff5" var mindelay7 :=0.005; 'minimum delay between two events (spikes) '************************************************** 'BURST CHANNELS FOR THE NEURONS (UP TO 9) var BurstCh1% := -1; var BurstCh2% := -1; var BurstCh3% := -1; var BurstCh4% := -1; var BurstCh5% := -1; var BurstCh6% := -1; var BurstCh7% := -1; '*********************************************** 'VARIABLES DEFINING THE HORIZONTAL CURSOR VALUES FOR: 'NEURON 1 var setCutOff1 :=0 ; 'horizontal cursor that allows events only ABOVE it to be picked up (used regardless) var setCutOff11 :=0; 'horizontal cursor that allows events only BELOW it to be picked up (only used with window disriminator) 'NEURON 2 var setCutOff2 :=0; 'horizontal cursor that allows events only ABOVE it to be picked up (used regardless) var setCutOff12:=0; 'horizontal cursor that allows events only BELOW it to be picked up (only used with window disriminator) 'NEURON 3 var setCutOff3:=0; 'horizontal cursor that allows events only ABOVE it to be picked up (used regardless) var setCutOff13:=0; 'horizontal cursor that allows events only BELOW it to be picked up (only used with window disriminator) 'NEURON 4 var setCutOff4:=0; 'horizontal cursor that allows events only ABOVE it to be picked up (used regardless) var setCutOff14:=0; 'horizontal cursor that allows events only BELOW it to be picked up (only used with window disriminator) 'NEURON 5 var setCutOff5:=0; 'horizontal cursor that allows events only ABOVE it to be picked up (used regardless) var setCutOff15:=0; 'horizontal cursor that allows events only BELOW it to be picked up (only used with window disriminator) 'NEURON 6 var setCutOff6:=0; 'horizontal cursor that allows events only ABOVE it to be picked up (used regardless) var setCutOff16:=0; 'horizontal cursor that allows events only BELOW it to be picked up (only used with window disriminator) 'NEURON 7 var setCutOff7:=0; 'horizontal cursor that allows events only ABOVE it to be picked up (used regardless) var setCutOff17:=0; 'horizontal cursor that allows events only BELOW it to be picked up (only used with window disriminator) '********************************************** 'PARAMETERS FOR HOW TO DEFINE BURST (I.E. THE MINIMUM TIME BETWEEN SPIKES THAT SHOULD BE INCLUDED IN ONE BURST var setMinBurstSep1 := 1; var setMinBurstSep2 := 1; var setMinBurstSep3 := 1; var setMinBurstSep4 := 1; var setMinBurstSep5 := 1; var setMinBurstSep6 := 1; var setMinBurstSep7 := 1; '************************************ 'VARIABLES NEEDED TO MAKE NAME LABELS FOR NEUONS var neuronname1$; var neuronname2$; var neuronname3$; var neuronname4$; var neuronname5$; var neuronname6$; var neuronname7$; var percent$; percent$ := "%"; var na$; na$ := "N/A"; '*********************************** 'VARIABLES NEEDED TO DIRECT PROGRAM TO USE WINDOW DISCRIMINATOR var extra1%; var extra2%; var extra3%; var extra4%; var extra5%; var extra6%; var extra7%; '************************************************* 'VARIABLES NEEDED TO MAKE BURST/PHASE COMPUTATIONS var results0[2]; var results1[4]; var results2[4]; var results3[4]; var results4[6]; var results5[8]; var results6[10]; var results7[12]; var results8[14]; '************************************************* 'VARIABLES NEEDED TO MAKE PERIOD/FREQUENCY COMPUTATIONS var results12[4]; var results13[4]; var results14[4]; var results15[4]; var results16[4]; var results17[4]; var results18[4]; const resPeriod1% := 0; const resFrequency1% := 1; const resPeriod2% := 0; const resFrequency2% := 1; const resPeriod3% := 0; const resFrequency3% := 1; const resPeriod4% := 0; const resFrequency4% := 1; const resPeriod5% := 0; const resFrequency5% := 1; const resPeriod6% := 0; const resFrequency6% := 1; const resPeriod7% := 0; const resFrequency7% := 1; const resDuration1% := 0; const resSpikes1% := 1; const resSpikeFreq1% := 2; const resDuration2% := 0; const resSpikes2% := 1; const resSpikeFreq2% := 2; const resDuration3% := 0; const resSpikes3% := 1; const resSpikeFreq3% := 2; const resDuration4% := 0; const resSpikes4% := 1; const resSpikeFreq4% := 2; const resDuration5% := 0; const resSpikes5% := 1; const resSpikeFreq5% := 2; const resDuration6% := 0; const resSpikes6% := 1; const resSpikeFreq6% := 2; const resDuration7% := 0; const resSpikes7% := 1; const resSpikeFreq7% := 2; const resNormSNeuron1% := 0; const resNormENeuron1% := 1; const resNormSNeuron2% := 2; const resNormENeuron2% := 3; const resNormSNeuron3% := 4; const resNormENeuron3% := 5; const resNormSNeuron4% := 6; const resNormENeuron4% := 7; const resNormSNeuron5% := 8; const resNormENeuron5% := 9; const resNormSNeuron6% := 10; const resNormENeuron6% := 11; const resNormSNeuron7% := 12; const resNormENeuron7% := 13; '******************************************** 'Variables to find rising of falling waveform and min. time intervals between spikes var updown:=2; ' means rising waveform. 3 = falling var peakdiff:=0.008; 'in sec var upupandaway; 'temporary for determining rising or falling waveform '******************************************** 'VARIABLES TO CALCULATE BURST MEANS AND STDEVS var durationtotal1, spikenumtotal1, freqtotal1; 'the sum totals of burst duration, # of spikes, and spike frequencies for the neuron var durationmean1, spikenummean1, freqmean1; 'the means for the burst duration, # of spikes, and spike frequencies of the neuron var sqdurationtotal1, sqspikenumtotal1, sqfreqtotal1; 'the sum squared totals of the burst duration, # of spikes, and spike frequencies for the neuron (to calculate st dev) var durationsd1, spikenumsd1, freqsd1; 'the standard deviations of burst duration, # of spikes, and spike frequencies for the neuron var durationtotal2, spikenumtotal2, freqtotal2; var durationmean2, spikenummean2, freqmean2; var sqdurationtotal2, sqspikenumtotal2, sqfreqtotal2; var durationsd2, spikenumsd2, freqsd2; var durationtotal3, spikenumtotal3, freqtotal3; var durationmean3, spikenummean3, freqmean3; var sqdurationtotal3, sqspikenumtotal3, sqfreqtotal3; var durationsd3, spikenumsd3, freqsd3; var durationtotal4, spikenumtotal4, freqtotal4; var durationmean4, spikenummean4, freqmean4; var sqdurationtotal4, sqspikenumtotal4, sqfreqtotal4; var durationsd4, spikenumsd4, freqsd4; var durationtotal5, spikenumtotal5, freqtotal5; var durationmean5, spikenummean5, freqmean5; var sqdurationtotal5, sqspikenumtotal5, sqfreqtotal5; var durationsd5, spikenumsd5, freqsd5; var durationtotal6, spikenumtotal6, freqtotal6; var durationmean6, spikenummean6, freqmean6; var sqdurationtotal6, sqspikenumtotal6, sqfreqtotal6; var durationsd6, spikenumsd6, freqsd6; var durationtotal7, spikenumtotal7, freqtotal7; var durationmean7, spikenummean7, freqmean7; var sqdurationtotal7, sqspikenumtotal7, sqfreqtotal7; var durationsd7, spikenumsd7, freqsd7; var phaseontotal1, phaseofftotal1; var phaseonmean1, phaseoffmean1; var sqphaseontotal1, sqphaseofftotal1; var phaseonsd1, phaseoffsd1; var phaseontotal2, phaseofftotal2; var phaseonmean2, phaseoffmean2; var sqphaseontotal2, sqphaseofftotal2; var phaseonsd2, phaseoffsd2; var phaseontotal3, phaseofftotal3; var phaseonmean3, phaseoffmean3; var sqphaseontotal3, sqphaseofftotal3; var phaseonsd3, phaseoffsd3; var phaseontotal4, phaseofftotal4; var phaseonmean4, phaseoffmean4; var sqphaseontotal4, sqphaseofftotal4; var phaseonsd4, phaseoffsd4; var phaseontotal5, phaseofftotal5; var phaseonmean5, phaseoffmean5; var sqphaseontotal5, sqphaseofftotal5; var phaseonsd5, phaseoffsd5; var phaseontotal6, phaseofftotal6; var phaseonmean6, phaseoffmean6; var sqphaseontotal6, sqphaseofftotal6; var phaseonsd6, phaseoffsd6; var phaseontotal7, phaseofftotal7; var phaseonmean7, phaseoffmean7; var sqphaseontotal7, sqphaseofftotal7; var phaseonsd7, phaseoffsd7; var periodtotal1, frequencytotal1; var sqperiodtotal1, sqfrequencytotal1; var periodmean1, frequencymean1; var periodsd1, frequencysd1; var periodtotal2, frequencytotal2; var sqperiodtotal2, sqfrequencytotal2; var periodmean2, frequencymean2; var periodsd2, frequencysd2; var periodtotal3, frequencytotal3; var sqperiodtotal3, sqfrequencytotal3; var periodmean3, frequencymean3; var periodsd3, frequencysd3; var periodtotal4, frequencytotal4; var sqperiodtotal4, sqfrequencytotal4; var periodmean4, frequencymean4; var periodsd4, frequencysd4; var periodtotal5, frequencytotal5; var sqperiodtotal5, sqfrequencytotal5; var periodmean5, frequencymean5; var periodsd5, frequencysd5; var periodtotal6, frequencytotal6; var sqperiodtotal6, sqfrequencytotal6; var periodmean6, frequencymean6; var periodsd6, frequencysd6; var periodtotal7, frequencytotal7; var sqperiodtotal7, sqfrequencytotal7; var periodmean7, frequencymean7; var periodsd7, frequencysd7; '******************************************** 'VARIABLE TO MAKE A SPACE IN THE DIALOGUE BOXES (TO MAKE DIALOGUE PLEASING TO THE EYEBALLS) var dummylabel%; '********************************************* var ok%; var ret%; var again%; var another%; var windowdiscrim%; var setMinDomFreq% := 4000; var sTime; var eTime; var proceedphase%; var experimenter$; 'name of experimenter var dated$; 'date of experiment var comment$; 'comments on experiment/conditions var manipulation$; 'experiment manipulation var pattern$; 'experiment pattern var onset$; 'onset of pattern var duration$; 'duration of pattern var prep$; 'status of the Prep (i.e. upper end cut, etc) var logfilename$; 'name of log file var path$; 'path name for saving file var path2$; 'path name for opening file var list%[100]; ' channel list var i%; '***************** Variables for phaseplot var phaseon[10], phaseoff[10], stdOFF[10], stdON[10],name$[10],phaseplot,channelnumber,janein,janeinphase,spikesperburst[10],spikesperburstSD[10]; '***************** Variables for Memchan delete and save var x,liste%[100],neuerkanal; '***************** Other Variables var doescursonexist, doescurstwoexist; '************************************************************************************************************************** '************************************************************************************************************************** '************************************************************************************************************************** 'INTRODUCTION TO PROGRAM ToolbarVisible(1); 'Must be open data-file... fh% := View(); if fh% <= 0 then Halt; endif; if ViewKind() <> 0 then 'Note, no argument for compatibility with mac... Message("Current view must be a data-file..."); Halt; else 'Aks User for Deletion of Memory Channels , if they exist. WS 08/2006 ChanList(list%[] , 20480); ' all but memory channels if (list%[0] > 0) then yesno$:=input$("do you want to keep your memory channels? (y / n)","n",1); if yesno$="n" then for i% := 1 to list%[0] do ChanDelete(list%[i%]); ' delete all memory channels next; else yesno$:="n"; 'reset string to "n", but keep memory channels endif; endif; endif; ToolbarClear(); ToolbarSet(1, "Delete Memchans", delmemchan%); ToolbarSet(2, "Save Memchans", savememchan%); ToolbarSet(3, "save + delete Memchans", saveanddelmemchan%); ToolbarSet(4, "End Script", stop%); ToolbarSet(5, "Delete specific channels", loeschbestimmte%); ToolbarSet(6, "Create Phaseplot", phaseplt%); ToolbarSet(7, "Analyze data", doanalysis%); ToolbarSet(8, "show main window",showmain%); toolbarenable(6,0); repeat Toolbar("",1023); until 0; Halt; func doanalysis%() 'repeat 'command to enter the big loop that opens up the program....the program goes through this loop until 'the user no longer wants to analyze (ie at the end of the program, the user is asked if he/she 'wants to "Go Again". If the answer is "Yes", the program repeats itself (ie "repeat"). If the 'answer is "No", the program ends. '*************************************************************************************************************************** '*************************************************************************************************************************** '*************************************************************************************************************************** 'PART ONE: 'ASK USER INTRODUCTORY QUESTIONS & HOW MANY NEURONS TO COMPARE.... HCursorDelete(-1); view(fh%); DlgCreate("Hello"); DlgString(1, "Your name, please.", 50); DlgString(2, "The date of the experiment, please.", 50); DlgString(3, "Status of STNS?", 100); DlgString(4, "Manipulation (if any)?", 5000); DlgString(5, "Motor Pattern?", 100); DlgString(6, "Motor Pattern Onset after Manipulation?", 50); DlgString(7, "Duration of resulting motor pattern?", 50); DlgString(8, "Any other comments?", 5000); ok% := DlgShow(experimenter$, dated$, prep$, manipulation$, pattern$, onset$, duration$, comment$); if not ok% then Halt; endif; logfilename$:=dated$; view(fh%); DlgCreate("Hello"); DlgInteger(1, "How many neurons would you like to compare (0 to 7)?", 1, 7); ok% := DlgShow(number1%); if not ok% then Halt; endif; '*************************************************************************************************************************** '*************************************************************************************************************************** '*************************************************************************************************************************** 'PART TWO: 'SCRIPT THAT CALLS UP VARIOUS PROCEDURES/COMMANDS BASED ON THE NUMBER OF NEURONS USER WISHES TO ANALYZE... '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Proceed if there's only 1 neuron to analyze... if number1% = 1 then windowdiscrim% :=0; View(fh%); DlgCreate("Select a neuron to analyse... first neuron as reference for phase analysis"); DlgChan(1, "Channel:",529); DlgString(2, "Name of neuron:",5); ok% := DlgShow(inputCh1%, neuronname1$); if not ok% then Halt; endif; ChanHide(-1); ChanShow(inputCh1%); GetVerticalCursors(); HCursorDelete(-1); ' Message("Analyze %s?", neuronname1$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan1%); if not ok% then Halt; endif; eventCh1% := MemChan(2); Chanshow(eventCh1%); MemImport(eventCh1%, oldchan1%, sTime, eTime); CalculateBursts1(); ChangeSettings1(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel1(); CalculateBursts1(); ChangeSettings1(); else GetLevel1b(); CalculateBursts1b(); ChangeSettings1(); endif; endif; endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Proceed if there are 2 neurons to analyze... if number1% = 2 then windowdiscrim% :=0; View(fh%); DlgCreate("Select the neurons to analyse..."); DlgChan(1, "Channel #1:",529); DlgString(2, "Name of neuron #1:",5); DlgLabel(3, "______________________________________________________________________"); DlgChan(4, "Channel #2:",529); DlgString(5, "Name of neuron #2:",5); ok% := DlgShow(inputCh1%, neuronname1$, dummylabel%, inputCh2%, neuronname2$); if not ok% then Halt; endif; ChanHide(-1); ChanShow(inputCh1%); ChanShow(inputCh2%); GetVerticalCursors(); ChanHide(-1); ChanShow(inputCh1%); ChanSHow(inputCh2%); ChanHide(-1); ChanShow(inputCh1%); HCursorDelete(-1); 'Message("Analyze %s?", neuronname1$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan1%); if not ok% then Halt; endif; eventCh1% := MemChan(2); Chanshow(eventCh1%); MemImport(eventCh1%, oldchan1%, sTime, eTime); CalculateBursts1(); ChangeSettings1(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel1(); CalculateBursts1(); ChangeSettings1(); else GetLevel1b(); CalculateBursts1b(); ChangeSettings1(); endif; endif; ChanHide(-1); ChanShow(inputCh2%); HCursorDelete(-1); 'Message("Analyze %s?", neuronname2$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan2%); if not ok% then Halt; endif; eventCh2% := MemChan(2); Chanshow(eventCh2%); MemImport(eventCh2%, oldchan2%, sTime, eTime); CalculateBursts2(); ChangeSettings2(); yesno$:="n"; else windowdiscrim% :=0; windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel2(); CalculateBursts2(); ChangeSettings2(); else GetLevel2b(); CalculateBursts2b(); ChangeSettings2(); endif; endif; ChanHide(-1); ChanShow(inputCh1%, eventCh1%, burstCh1%); ChanShow(inputCh2%, eventCh2%, burstCh2%); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Proceed if there are 3 neurons to analyze... if number1% = 3 then windowdiscrim% :=0; View(fh%); DlgCreate("Select the neurons to analyse..."); DlgChan(1, "Channel #1:",529); DlgString(2, "Name of neuron #1:",5); DlgLabel(3, "_____________________________________________________________________"); DlgChan(4, "Channel #2:",529); DlgString(5, "Name of neuron #2:",5); DlgLabel(6, "______________________________________________________________________"); DlgChan(7, "Channel #3:",529); DlgString(8, "Name of neuron #3:",5); ok% := DlgShow(inputCh1%, neuronname1$, dummylabel%, inputCh2%, neuronname2$, dummylabel%, inputCh3%, neuronname3$); if not ok% then Halt; endif; ChanHide(-1); ChanShow(inputCh1%); ChanShow(inputCh2%); ChanShow(inputCh3%); GetVerticalCursors(); ChanHide(-1); ChanShow(inputCh1%); ChanShow(inputCh2%); ChanShow(inputCh3%); ChanHide(-1); ChanShow(inputCh1%); HCursorDelete(-1); 'message("Analyze %s?", neuronname1$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan1%); if not ok% then Halt; endif; eventCh1% := MemChan(2); Chanshow(eventCh1%); MemImport(eventCh1%, oldchan1%, sTime, eTime); CalculateBursts1(); ChangeSettings1(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel1(); CalculateBursts1(); ChangeSettings1(); else GetLevel1b(); CalculateBursts1b(); ChangeSettings1(); endif; endif; ChanHide(-1); ChanShow(inputCh2%); HCursorDelete(-1); 'message("Analyze %s?", neuronname2$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan2%); if not ok% then Halt; endif; eventCh2% := MemChan(2); Chanshow(eventCh2%); MemImport(eventCh2%, oldchan2%, sTime, eTime); CalculateBursts2(); ChangeSettings2(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel2(); CalculateBursts2(); ChangeSettings2(); else GetLevel2b(); CalculateBursts2b(); ChangeSettings2(); endif; endif; ChanHide(-1); ChanShow(inputCh3%); HCursorDelete(-1); 'message("Analyze %s?", neuronname3$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan3%); if not ok% then Halt; endif; eventCh3% := MemChan(2); Chanshow(eventCh3%); MemImport(eventCh3%, oldchan3%, sTime, eTime); CalculateBursts3(); ChangeSettings3(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel3(); CalculateBursts3(); ChangeSettings3(); else GetLevel3b(); CalculateBursts3b(); ChangeSettings3(); endif; endif; ChanHide(-1); ChanShow(inputCh1%, eventCh1%, burstCh1%); ChanShow(inputCh2%, eventCh2%, burstCh2%); ChanShow(inputCh3%, eventCh3%, burstCh3%); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Proceed if there are 4 neurons to analyze... if number1% = 4 then windowdiscrim% :=0; View(fh%); DlgCreate("Select the neurons to analyse..."); DlgChan(1, "Channel #1:",529); DlgString(2, "Name of neuron #1:",5); DlgLabel(3, "______________________________________________________________________"); DlgChan(4, "Channel #2:",529); DlgString(5, "Name of neuron #2:",5); DlgLabel(6, "_______________________________________________________________________"); DlgChan(7, "Channel #3:",529); DlgString(8, "Name of neuron #3:",5); DlgLabel(9, "______________________________________________________________________"); DlgChan(10, "Channel #4:",529); DlgString(11, "Name of neuron #4:",5); ok% := DlgShow(inputCh1%, neuronname1$, dummylabel%, inputCh2%, neuronname2$, dummylabel%, inputCh3%, neuronname3$, dummylabel%, inputCh4%, neuronname4$); if not ok% then Halt; endif; ChanHide(-1); ChanShow(inputCh1%); ChanShow(inputCh2%); ChanShow(inputCh3%); ChanShow(inputCh4%); GetVerticalCursors(); ChanHide(-1); ChanShow(inputCh1%); ChanShow(inputCh2%); ChanShow(inputCh3%); ChanShow(inputCh4%); ChanHide(-1); ChanShow(inputCh1%); HCursorDelete(-1); 'message("Analyze %s?", neuronname1$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan1%); if not ok% then Halt; endif; eventCh1% := MemChan(2); Chanshow(eventCh1%); MemImport(eventCh1%, oldchan1%, sTime, eTime); CalculateBursts1(); ChangeSettings1(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel1(); CalculateBursts1(); ChangeSettings1(); else GetLevel1b(); CalculateBursts1b(); ChangeSettings1(); endif; endif; ChanHide(-1); ChanShow(inputCh2%); HCursorDelete(-1); 'message("Analyze %s?", neuronname2$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan2%); if not ok% then Halt; endif; eventCh2% := MemChan(2); Chanshow(eventCh2%); MemImport(eventCh2%, oldchan2%, sTime, eTime); CalculateBursts2(); ChangeSettings2(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel2(); CalculateBursts2(); ChangeSettings2(); else GetLevel2b(); CalculateBursts2b(); ChangeSettings2(); endif; endif; ChanHide(-1); ChanShow(inputCh3%); HCursorDelete(-1); 'message("Analyze %s?", neuronname3$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan3%); if not ok% then Halt; endif; eventCh3% := MemChan(2); Chanshow(eventCh3%); MemImport(eventCh3%, oldchan3%, sTime, eTime); CalculateBursts3(); ChangeSettings3(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel3(); CalculateBursts3(); ChangeSettings3(); else GetLevel3b(); CalculateBursts3b(); ChangeSettings3(); endif; endif; ChanHide(-1); ChanShow(inputCh4%); HCursorDelete(-1); 'message("Analyze %s?", neuronname4$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan4%); if not ok% then Halt; endif; eventCh4% := MemChan(2); Chanshow(eventCh4%); MemImport(eventCh4%, oldchan4%, sTime, eTime); CalculateBursts4(); ChangeSettings4(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel4(); CalculateBursts4(); ChangeSettings4(); else GetLevel4b(); CalculateBursts4b(); ChangeSettings4(); endif; endif; ChanHide(-1); ChanShow(inputCh1%, eventCh1%, burstCh1%); ChanShow(inputCh2%, eventCh2%, burstCh2%); ChanShow(inputCh3%, eventCh3%, burstCh3%); ChanShow(inputCh4%, eventCh4%, burstCh4%); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Proceed if there are 5 neurons to analyze... if number1% = 5 then windowdiscrim% :=0; View(fh%); DlgCreate("Select the neurons to analyse..."); DlgChan(1, "Channel #1:",529); DlgString(2, "Name of neuron #1:",5); DlgLabel(3, "_____________________________________________________________________"); DlgChan(4, "Channel #2:",529); DlgString(5, "Name of neuron #2:",5); DlgLabel(6, "______________________________________________________________________"); DlgChan(7, "Channel #3:",529); DlgString(8, "Name of neuron #3:",5); DlgLabel(9, "_____________________________________________________________________"); DlgChan(10, "Channel #4:",529); DlgString(11, "Name of neuron #4:",5); DlgLabel(12, "_____________________________________________________________________"); DlgChan(13, "Channel #5:",529); DlgString(14, "Name of neuron #5:",5); ok% := DlgShow(inputCh1%, neuronname1$, dummylabel%, inputCh2%, neuronname2$, dummylabel%, inputCh3%, neuronname3$, dummylabel%, inputCh4%, neuronname4$, dummylabel%, inputCh5%, neuronname5$); if not ok% then Halt; endif; ChanHide(-1); ChanShow(inputCh1%); ChanShow(inputCh2%); ChanShow(inputCh3%); ChanShow(inputCh4%); ChanShow(inputCh5%); GetVerticalCursors(); ChanHide(-1); ChanShow(inputCh1%); ChanShow(inputCh2%); ChanShow(inputCh3%); ChanShow(inputCh4%); ChanShow(inputCh5%); ChanHide(-1); ChanShow(inputCh1%); HCursorDelete(-1); 'message("Analyze %s?", neuronname1$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan1%); if not ok% then Halt; endif; eventCh1% := MemChan(2); Chanshow(eventCh1%); MemImport(eventCh1%, oldchan1%, sTime, eTime); CalculateBursts1(); ChangeSettings1(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel1(); CalculateBursts1(); ChangeSettings1(); else GetLevel1b(); CalculateBursts1b(); ChangeSettings1(); endif; endif; ChanHide(-1); ChanShow(inputCh2%); HCursorDelete(-1); 'message("Analyze %s?", neuronname2$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan2%); if not ok% then Halt; endif; eventCh2% := MemChan(2); Chanshow(eventCh2%); MemImport(eventCh2%, oldchan2%, sTime, eTime); CalculateBursts2(); ChangeSettings2(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel2(); CalculateBursts2(); ChangeSettings2(); else GetLevel2b(); CalculateBursts2b(); ChangeSettings2(); endif; endif; ChanHide(-1); ChanShow(inputCh3%); HCursorDelete(-1); 'message("Analyze %s?", neuronname3$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan3%); if not ok% then Halt; endif; eventCh3% := MemChan(2); Chanshow(eventCh3%); MemImport(eventCh3%, oldchan3%, sTime, eTime); CalculateBursts3(); ChangeSettings3(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel3(); CalculateBursts3(); ChangeSettings3(); else GetLevel3b(); CalculateBursts3b(); ChangeSettings3(); endif; endif; ChanHide(-1); ChanShow(inputCh4%); HCursorDelete(-1); 'message("Analyze %s?", neuronname4$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan4%); if not ok% then Halt; endif; eventCh4% := MemChan(2); Chanshow(eventCh4%); MemImport(eventCh4%, oldchan4%, sTime, eTime); CalculateBursts4(); ChangeSettings4(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel4(); CalculateBursts4(); ChangeSettings4(); else GetLevel4b(); CalculateBursts4b(); ChangeSettings4(); endif; endif; ChanHide(-1); ChanShow(inputCh5%); HCursorDelete(-1); 'message("Analyze %s?", neuronname5$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan5%); if not ok% then Halt; endif; eventCh5% := MemChan(2); Chanshow(eventCh5%); MemImport(eventCh5%, oldchan5%, sTime, eTime); CalculateBursts5(); ChangeSettings5(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel5(); CalculateBursts5(); ChangeSettings5(); else GetLevel5b(); CalculateBursts5b(); ChangeSettings5(); endif; endif; ChanHide(-1); ChanShow(inputCh1%, eventCh1%, burstCh1%); ChanShow(inputCh2%, eventCh2%, burstCh2%); ChanShow(inputCh3%, eventCh3%, burstCh3%); ChanShow(inputCh4%, eventCh4%, burstCh4%); ChanShow(inputCh5%, eventCh5%, burstCh5%); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Proceed if there are 6 neurons to analyze... if number1% = 6 then windowdiscrim% :=0; 'Dialogue box for analyzing first 5 neurons... View(fh%); DlgCreate("Select the neurons to analyse..."); DlgChan(1, "Channel #1:",529); DlgString(2, "Name of neuron #1:",5); DlgLabel(3, "_____________________________________________________________________"); DlgChan(4, "Channel #2:",529); DlgString(5, "Name of neuron #2:",5); DlgLabel(6, "______________________________________________________________________"); DlgChan(7, "Channel #3:",529); DlgString(8, "Name of neuron #3:",5); DlgLabel(9, "_____________________________________________________________________"); DlgChan(10, "Channel #4:",529); DlgString(11, "Name of neuron #4:",5); DlgLabel(12, "_____________________________________________________________________"); DlgChan(13, "Channel #5:",529); DlgString(14, "Name of neuron #5:",5); ok% := DlgShow(inputCh1%, neuronname1$, dummylabel%, inputCh2%, neuronname2$, dummylabel%, inputCh3%, neuronname3$, dummylabel%, inputCh4%, neuronname4$, dummylabel%, inputCh5%, neuronname5$); if not ok% then Halt; endif; 'Dialogue box for analyzing 6th neuron... View(fh%); DlgCreate("Select the 6th neuron to analyse..."); DlgChan(1, "Channel #6:",529); DlgString(2, "Name of neuron #6:",5); ok% := DlgShow(inputCh6%, neuronname6$); ChanHide(-1); ChanShow(inputCh1%); ChanShow(inputCh2%); ChanShow(inputCh3%); ChanShow(inputCh4%); ChanShow(inputCh5%); ChanShow(inputCh6%); GetVerticalCursors(); ChanHide(-1); ChanShow(inputCh1%); ChanShow(inputCh2%); ChanShow(inputCh3%); ChanShow(inputCh4%); ChanShow(inputCh5%); ChanShow(inputCh6%); ChanHide(-1); ChanShow(inputCh1%); HCursorDelete(-1); 'message("Analyze %s?", neuronname1$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan1%); if not ok% then Halt; endif; eventCh1% := MemChan(2); Chanshow(eventCh1%); MemImport(eventCh1%, oldchan1%, sTime, eTime); CalculateBursts1(); ChangeSettings1(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel1(); CalculateBursts1(); ChangeSettings1(); else GetLevel1b(); CalculateBursts1b(); ChangeSettings1(); endif; endif; ChanHide(-1); ChanShow(inputCh2%); HCursorDelete(-1); 'message("Analyze %s?", neuronname2$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan2%); if not ok% then Halt; endif; eventCh2% := MemChan(2); Chanshow(eventCh2%); MemImport(eventCh2%, oldchan2%, sTime, eTime); CalculateBursts2(); ChangeSettings2(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel2(); CalculateBursts2(); ChangeSettings2(); else GetLevel2b(); CalculateBursts2b(); ChangeSettings2(); endif; endif; ChanHide(-1); ChanShow(inputCh3%); HCursorDelete(-1); 'message("Analyze %s?", neuronname3$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan3%); if not ok% then Halt; endif; eventCh3% := MemChan(2); Chanshow(eventCh3%); MemImport(eventCh3%, oldchan3%, sTime, eTime); CalculateBursts3(); ChangeSettings3(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel3(); CalculateBursts3(); ChangeSettings3(); else GetLevel3b(); CalculateBursts3b(); ChangeSettings3(); endif; endif; ChanHide(-1); ChanShow(inputCh4%); HCursorDelete(-1); 'message("Analyze %s?", neuronname4$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan4%); if not ok% then Halt; endif; eventCh4% := MemChan(2); Chanshow(eventCh4%); MemImport(eventCh4%, oldchan4%, sTime, eTime); CalculateBursts4(); ChangeSettings4(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel4(); CalculateBursts4(); ChangeSettings4(); else GetLevel4b(); CalculateBursts4b(); ChangeSettings4(); endif; endif; ChanHide(-1); ChanShow(inputCh5%); HCursorDelete(-1); 'message("Analyze %s?", neuronname5$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan5%); if not ok% then Halt; endif; eventCh5% := MemChan(2); Chanshow(eventCh5%); MemImport(eventCh5%, oldchan5%, sTime, eTime); CalculateBursts5(); ChangeSettings5(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel5(); CalculateBursts5(); ChangeSettings5(); else GetLevel5b(); CalculateBursts5b(); ChangeSettings5(); endif; endif; ChanHide(-1); ChanShow(inputCh6%); HCursorDelete(-1); 'message("Analyze %s?", neuronname6$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan6%); if not ok% then Halt; endif; eventCh6% := MemChan(2); Chanshow(eventCh6%); MemImport(eventCh6%, oldchan6%, sTime, eTime); CalculateBursts6(); ChangeSettings6(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel6(); CalculateBursts6(); ChangeSettings6(); else GetLevel6b(); CalculateBursts6b(); ChangeSettings6(); endif; endif; ChanHide(-1); ChanShow(inputCh1%, eventCh1%, burstCh1%); ChanShow(inputCh2%, eventCh2%, burstCh2%); ChanShow(inputCh3%, eventCh3%, burstCh3%); ChanShow(inputCh4%, eventCh4%, burstCh4%); ChanShow(inputCh5%, eventCh5%, burstCh5%); ChanShow(inputCh6%, eventCh6%, burstCh6%); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Proceed if there are 7 neurons to analyze... if number1% = 7 then windowdiscrim% :=0; 'Dialogue box for analyzing first 5 neurons... View(fh%); DlgCreate("Select the neurons to analyse..."); DlgChan(1, "Channel #1:",529); DlgString(2, "Name of neuron #1:",5); DlgLabel(3, "_____________________________________________________________________"); DlgChan(4, "Channel #2:",529); DlgString(5, "Name of neuron #2:",5); DlgLabel(6, "______________________________________________________________________"); DlgChan(7, "Channel #3:",529); DlgString(8, "Name of neuron #3:",5); DlgLabel(9, "_____________________________________________________________________"); DlgChan(10, "Channel #4:",529); DlgString(11, "Name of neuron #4:",5); DlgLabel(12, "_____________________________________________________________________"); DlgChan(13, "Channel #5:",529); DlgString(14, "Name of neuron #5:",5); ok% := DlgShow(inputCh1%, neuronname1$, dummylabel%, inputCh2%, neuronname2$, dummylabel%, inputCh3%, neuronname3$, dummylabel%, inputCh4%, neuronname4$, dummylabel%, inputCh5%, neuronname5$); if not ok% then Halt; endif; 'Dialogue box for analyzing 6th and 7th neuron... View(fh%); DlgCreate("Select the 6th neuron to analyse..."); DlgChan(1, "Channel #6:",529); DlgString(2, "Name of neuron #6:",5); DlgLabel(3, "_____________________________________________________________________"); DlgChan(4, "Channel #7:",529); DlgString(5, "Name of neuron #7:",5); ok% := DlgShow(inputCh6%, neuronname6$, dummylabel%, inputCh7%, neuronname7$); ChanHide(-1); ChanShow(inputCh1%); ChanShow(inputCh2%); ChanShow(inputCh3%); ChanShow(inputCh4%); ChanShow(inputCh5%); ChanShow(inputCh6%); ChanShow(inputCh7%); GetVerticalCursors(); ChanHide(-1); ChanShow(inputCh1%); ChanShow(inputCh2%); ChanShow(inputCh3%); ChanShow(inputCh4%); ChanShow(inputCh5%); ChanShow(inputCh6%); ChanShow(inputCh7%); ChanHide(-1); ChanShow(inputCh1%); HCursorDelete(-1); 'message("Analyze %s?", neuronname1$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan1%); if not ok% then Halt; endif; eventCh1% := MemChan(2); Chanshow(eventCh1%); MemImport(eventCh1%, oldchan1%, sTime, eTime); CalculateBursts1(); ChangeSettings1(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel1(); CalculateBursts1(); ChangeSettings1(); else GetLevel1b(); CalculateBursts1b(); ChangeSettings1(); endif; endif; ChanHide(-1); ChanShow(inputCh2%); HCursorDelete(-1); 'message("Analyze %s?", neuronname2$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan2%); if not ok% then Halt; endif; eventCh2% := MemChan(2); Chanshow(eventCh2%); MemImport(eventCh2%, oldchan2%, sTime, eTime); CalculateBursts2(); ChangeSettings2(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel2(); CalculateBursts2(); ChangeSettings2(); else GetLevel2b(); CalculateBursts2b(); ChangeSettings2(); endif; endif; ChanHide(-1); ChanShow(inputCh3%); HCursorDelete(-1); 'message("Analyze %s?", neuronname3$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan3%); if not ok% then Halt; endif; eventCh3% := MemChan(2); Chanshow(eventCh3%); MemImport(eventCh3%, oldchan3%, sTime, eTime); CalculateBursts3(); ChangeSettings3(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel3(); CalculateBursts3(); ChangeSettings3(); else GetLevel3b(); CalculateBursts3b(); ChangeSettings3(); endif; endif; ChanHide(-1); ChanShow(inputCh4%); HCursorDelete(-1); 'message("Analyze %s?", neuronname4$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan4%); if not ok% then Halt; endif; eventCh4% := MemChan(2); Chanshow(eventCh4%); MemImport(eventCh4%, oldchan4%, sTime, eTime); CalculateBursts4(); ChangeSettings4(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel4(); CalculateBursts4(); ChangeSettings4(); else GetLevel4b(); CalculateBursts4b(); ChangeSettings4(); endif; endif; ChanHide(-1); ChanShow(inputCh5%); HCursorDelete(-1); 'message("Analyze %s?", neuronname5$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan5%); if not ok% then Halt; endif; eventCh5% := MemChan(2); Chanshow(eventCh5%); MemImport(eventCh5%, oldchan5%, sTime, eTime); CalculateBursts5(); ChangeSettings5(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel5(); CalculateBursts5(); ChangeSettings5(); else GetLevel5b(); CalculateBursts5b(); ChangeSettings5(); endif; endif; ChanHide(-1); ChanShow(inputCh6%); HCursorDelete(-1); 'message("Analyze %s?", neuronname6$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan6%); if not ok% then Halt; endif; eventCh6% := MemChan(2); Chanshow(eventCh6%); MemImport(eventCh6%, oldchan6%, sTime, eTime); CalculateBursts6(); ChangeSettings6(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel6(); CalculateBursts6(); ChangeSettings6(); else GetLevel6b(); CalculateBursts6b(); ChangeSettings6(); endif; endif; ChanHide(-1); ChanShow(inputCh7%); HCursorDelete(-1); 'message("Analyze %s?", neuronname7$); yesno$:=input$("do you want to use an existing event channel for the analysis? (y / n)","n",1); if yesno$="y" then Chanshow(-1); DlgCreate("select the event channel to use"); DlgChan(1, "spike event channel",2); ok% := DlgShow(oldchan7%); if not ok% then Halt; endif; eventCh7% := MemChan(2); Chanshow(eventCh7%); MemImport(eventCh7%, oldchan7%, sTime, eTime); CalculateBursts7(); ChangeSettings7(); yesno$:="n"; else windowdiscrim% := Query("Does this neuron need a window discriminator?", "Yes", "No"); if not windowdiscrim% then GetLevel7(); CalculateBursts7(); ChangeSettings7(); else GetLevel7b(); CalculateBursts7b(); ChangeSettings7(); endif; endif; ChanHide(-1); ChanShow(inputCh1%, eventCh1%, burstCh1%); ChanShow(inputCh2%, eventCh2%, burstCh2%); ChanShow(inputCh3%, eventCh3%, burstCh3%); ChanShow(inputCh4%, eventCh4%, burstCh4%); ChanShow(inputCh5%, eventCh5%, burstCh5%); ChanShow(inputCh6%, eventCh6%, burstCh6%); ChanShow(inputCh7%, eventCh7%, burstCh7%); endif; '***********************************************************************************************************************8 '***********************************************************************************************************************8 '***********************************************************************************************************************8 'PART THREE: '*********************************************************** 'WRITE DATA: 'ok% := Query("Write results for this section?); 'This prompts the code to analyze/data for individual bursts of neurons 'if ok% then summary% := 0; xlv% :=0; View(LogHandle()); EditSelectAll(); EditClear(); 'Prompt to actually analyze/write: WriteResults(); 'Prompt to ask user if he/she wants to print log sheet: ok% := Query("Would you like to send this to the printer now?", "Yes", "No"); if ok% then FilePrint(); else endif; 'Prompt to ask user if he/she wants to save log sheet: ok% := Query("Would you like to save this log sheet?", "Yes", "No"); if ok% then savelogquery% := 1; else savelogquery% := 0; endif; if savelogquery% =1 then DlgCreate("Hello"); DlgString(1, "What would you like to call the file?", 80); ok% :=DlgShow(logfilename$); if not ok% then Halt; endif; FilePathSet(path$); FileSaveAs(logfilename$,1); endif; 'Prompt to ask user if he/she wants to convert log sheet into file that can be easily imported into XL: ok% :=Query("Would you like to save a tab-delimited, XL-friendly version of this file?", "Yes", "No"); if ok% then xlv% :=1; View(LogHandle()); EditSelectAll(); EditClear(); WriteResults(); 'Prompt to ask user if he/she wants to save XL-file: ok% := Query("Would you like to save this file?", "Yes", "No"); if ok% then savelogquery% := 1; else savelogquery% := 0; endif; if savelogquery% =1 then DlgCreate("Hello"); DlgString(1, "What would you like to call the file?", 80); ok% :=DlgShow(logfilename$); if not ok% then Halt; endif; FilePathSet(path$); FileSaveAs(logfilename$,1); endif; else endif; '*********************** 'JUST SUMMARIES: 'This prompts the code to analyze/data for individual bursts of neurons ok% := Query("Write just summaries?"); if ok% then summary% := 1; xlv% :=0; View(LogHandle()); EditSelectAll(); EditClear(); 'Prompt to actually analyze/write: WriteResults(); View(LogHandle()); windowvisible(3); 'Prompt to ask user if he/she wants to print log sheet: ok% := Query("Would you like to send this to the printer now?", "Yes", "No"); if ok% then FilePrint(); else endif; 'Prompt to ask user if he/she wants to save log sheet: ok% := Query("Would you like to save this log sheet?", "Yes", "No"); if ok% then savelogquery% := 1; else savelogquery% := 0; endif; if savelogquery% =1 then DlgCreate("Hello"); DlgString(1, "What would you like to call the file?", 80); ok% :=DlgShow(logfilename$); if not ok% then Halt; endif; FilePathSet(path$); FileSaveAs(logfilename$,1); endif; 'Prompt to ask user if he/she wants to convert log sheet into file that can be easily imported into XL: ok% :=Query("Would you like to save a tab-delimited, XL-friendly version of this file?", "Yes", "No"); if ok% then xlv% :=1; View(LogHandle()); EditSelectAll(); EditClear(); WriteResults(); View(LogHandle()); windowvisible(3); 'Prompt to ask user if he/she wants to save XL-file: ok% := Query("Would you like to save this file?", "Yes", "No"); if ok% then savelogquery% := 1; else savelogquery% := 0; endif; if savelogquery% =1 then DlgCreate("Hello"); DlgString(1, "What would you like to call the file?", 80); ok% :=DlgShow(logfilename$); if not ok% then Halt; endif; FilePathSet(path$); FileSaveAs(logfilename$,1); endif; else endif; endif; '****************************************************************************************** 'another% := Query("Go again?"); 'until not another%; return 0; end; '-------------- ' delete and save Memory channels func showmain%() windowvisible(0); View(fh%); windowvisible(3); windowvisible(0); View(fh%); windowvisible(3); return 0; end; func delmemchan%() ChanList(liste%[],639); for x:=1 to liste%[0] do if liste%[x] >400 then ChanDelete(liste%[x]) endif; next; return 1; end; func savememchan%() ChanList(liste%[],639); for x:=1 to liste%[0] do if liste%[x] >400 then neuerkanal:=ChanSave(liste%[x],0); Chanshow(neuerkanal); endif; next; return 1; end; func saveanddelmemchan%() ChanList(liste%[],639); for x:=1 to liste%[0] do if liste%[x] >400 then neuerkanal:=ChanSave(liste%[x],0); Chanshow(neuerkanal); ChanDelete(liste%[x]) endif; next; return 1; end; func phaseplt%() '****************************** FOR PHASEPLOT NEW NSB 2009 initializephaseplot(); phaseplotter(); view(fh%); 'return to frontview return 1; end; func stop%() halt; end; func loeschbestimmte%() interact("please select channels that you want to delete (CTRL + mouse click). For unselecting: CTRL+mouse click",1023); ChanList(liste%[],65536); for x:=1 to liste%[0] do ChanDelete(liste%[x]) next; return 1; end; '-------------- '*************************************************************************************************************************** '*************************************************************************************************************************** '*************************************************************************************************************************** 'PART FOUR: 'CODE FOR GETTING THE VERTICAL CURSORS (I.E. THE CHUNK OF DATA YOU WANT TO ANALYZE) 'Place vertical cursors around area of interest... Proc GetVerticalCursors() doescursonexist:=CursorExists(1); doescurstwoexist:=CursorExists(2); 'CursorDelete(-1); if doescursonexist=0 then CursorNew(xlow()+0.5,1); endif; if doescurstwoexist=0 then CursorNew(Cursor(1)+0.5,2); endif; 'CursorNew(); Interact("Place vertical cursors around the region to be analysed. Cursor 1 = Start time and Cursor 2 = End time...", 1023); CursorRenumber(); sTime := Cursor(1); eTime := Cursor(2); XRange(sTime - (eTime - sTime)/5, eTime + (eTime - sTime)/5); end; '*************************************************************************************************************************** '*************************************************************************************************************************** '*************************************************************************************************************************** 'PART FIVE: 'CODE FOR GETTING THE HORIZONTAL CURSORS (THE SPIKE DISCRIMINATING CURSORS) IF WINDOW DISCRIMINATOR IS NOT NEEDED '~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 1 if window disciminator IS NOT needed... proc GetLevel1() while HCursorDelete() do; wend; HCursorNew(inputCh1%); Interact("Place the horizontal cursor at desired spike detection threshold...", 1023 ); setCutOff1 := HCursor(1); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 2 if window disciminator IS NOT needed...... proc GetLevel2() while HCursorDelete() do; wend; HCursorNew(inputCh2%); Interact("Place the horizontal cursor at desired spike detection threshold...", 1023 ); setCutOff2 := HCursor(1); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 3 if window disciminator IS NOT needed... ... proc GetLevel3() while HCursorDelete() do; wend; HCursorNew(inputCh3%); Interact("Place the horizontal cursor at desired spike detection threshold...", 1023 ); setCutOff3 := HCursor(1); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 4 if window disciminator IS NOT needed... ... proc GetLevel4() while HCursorDelete() do; wend; HCursorNew(inputCh4%); Interact("Place the horizontal cursor at desired spike detection threshold...", 1023 ); setCutOff4 := HCursor(1); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 5 if window disciminator IS NOT needed... ... proc GetLevel5() while HCursorDelete() do; wend; HCursorNew(inputCh5%); Interact("Place the horizontal cursor at desired spike detection threshold...", 1023 ); setCutOff5 := HCursor(1); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 6 if window disciminator IS NOT needed... ... proc GetLevel6() while HCursorDelete() do; wend; HCursorNew(inputCh6%); Interact("Place the horizontal cursor at desired spike detection threshold...", 1023 ); setCutOff6 := HCursor(1); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 7 if window disciminator IS NOT needed... ... proc GetLevel7() while HCursorDelete() do; wend; HCursorNew(inputCh7%); Interact("Place the horizontal cursor at desired spike detection threshold...", 1023 ); setCutOff7 := HCursor(1); end; '*************************************************************************************************************************** '*************************************************************************************************************************** '*************************************************************************************************************************** 'PART SIX: 'CODE FOR GETTING THE HORIZONTAL CURSORS (THE SPIKE DISCRIMINATING CURSORS) IF WINDOW DISCRIMINATOR IS NEEDED '~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 1 if window disciminator IS needed... proc GetLevel1b() while HCursorDelete() do; wend; HCursorNew(inputCh1%); Interact("Place the first horizontal cursor so that spikes above it will be included...", 1023 ); setCutOff1 := HCursor(1); HCursorNew(inputCh1%); Interact("Place the second horizontal cursor so that spikes below it will be included...", 1023 ); setCutOff11 :=HCursor(2); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 2 if window disciminator IS needed... proc GetLevel2b() while HCursorDelete() do; wend; HCursorNew(inputCh2%); Interact("Place the first horizontal cursor so that spikes above it will be included...", 1023 ); setCutOff2 := HCursor(1); HCursorNew(inputCh2%); Interact("Place the second horizontal cursor so that spikes below it will be included...", 1023 ); setCutOff12 :=HCursor(2); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 3 if window disciminator IS needed... proc GetLevel3b() while HCursorDelete() do; wend; HCursorNew(inputCh3%); Interact("Place the first horizontal cursor so that spikes above it will be included...", 1023 ); setCutOff3 := HCursor(1); HCursorNew(inputCh3%); Interact("Place the second horizontal cursor so that spikes below it will be included...", 1023 ); setCutOff13 :=HCursor(2); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 4 if window disciminator IS needed... proc GetLevel4b() while HCursorDelete() do; wend; HCursorNew(inputCh4%); Interact("Place the first horizontal cursor so that spikes above it will be included...", 1023 ); setCutOff4 := HCursor(1); HCursorNew(inputCh4%); Interact("Place the second horizontal cursor so that spikes below it will be included...", 1023 ); setCutOff14 :=HCursor(2); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 5 if window disciminator IS needed... proc GetLevel5b() while HCursorDelete() do; wend; HCursorNew(inputCh5%); Interact("Place the first horizontal cursor so that spikes above it will be included...", 1023 ); setCutOff5 := HCursor(1); HCursorNew(inputCh5%); Interact("Place the second horizontal cursor so that spikes below it will be included...", 1023 ); setCutOff15 :=HCursor(2); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 6 if window disciminator IS needed... proc GetLevel6b() while HCursorDelete() do; wend; HCursorNew(inputCh6%); Interact("Place the first horizontal cursor so that spikes above it will be included...", 1023 ); setCutOff6 := HCursor(1); HCursorNew(inputCh6%); Interact("Place the second horizontal cursor so that spikes below it will be included...", 1023 ); setCutOff16 :=HCursor(2); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get cut-off level for peak extraction for neuron 7 if window disciminator IS needed... proc GetLevel7b() while HCursorDelete() do; wend; HCursorNew(inputCh7%); Interact("Place the first horizontal cursor so that spikes above it will be included...", 1023 ); setCutOff7 := HCursor(1); HCursorNew(inputCh7%); Interact("Place the second horizontal cursor so that spikes below it will be included...", 1023 ); setCutOff17 :=HCursor(2); end; '*************************************************************************************************************************** '*************************************************************************************************************************** '*************************************************************************************************************************** 'PART SEVEN: 'CODE FOR GETTING THE PARAMETERS FOR MAKING BURSTS '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get the parameters for forming the bursts on neuron 1... proc GetBurstSettings1() ret% := Interact("Are these spikes OK...if not, then you can delete unwanted events.", 1023); DlgCreate("Enter parameters..."); DlgReal(1, "Maximum interval (seconds) between spikes\nto be included in same burst:", 0.01, 1000); DlgShow(setMinBurstSep1); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get the parameters for forming the bursts on neuron 2... proc GetBurstSettings2() ret% := Interact("Are these spikes OK...if not, then you can delete unwanted events.", 1023); DlgCreate("Enter parameters..."); DlgReal(1, "Maximum interval (seconds) between spikes\nto be included in same burst:", 0.01, 1000); DlgShow(setMinBurstSep2); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get the parameters for forming the bursts on neuron 3... proc GetBurstSettings3() ret% := Interact("Are these spikes OK...if not, then you can delete unwanted events.", 1023); DlgCreate("Enter parameters..."); DlgReal(1, "Maximum interval (seconds) between spikes\nto be included in same burst:", 0.01, 1000); DlgShow(setMinBurstSep3); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get the parameters for forming the bursts on neuron 4... proc GetBurstSettings4() ret% := Interact("Are these spikes OK...if not, then you can delete unwanted events.", 1023); DlgCreate("Enter parameters..."); DlgReal(1, "Maximum interval (seconds) between spikes\nto be included in same burst:", 0.01, 1000); DlgShow(setMinBurstSep4); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get the parameters for forming the bursts on neuron 5... proc GetBurstSettings5() ret% := Interact("Are these spikes OK...if not, then you can delete unwanted events.", 1023); DlgCreate("Enter parameters..."); DlgReal(1, "Maximum interval (seconds) between spikes\nto be included in same burst:", 0.01, 1000); DlgShow(setMinBurstSep5); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get the parameters for forming the bursts on neuron 6... proc GetBurstSettings6() ret% := Interact("Are these spikes OK...if not, then you can delete unwanted events.", 1023); DlgCreate("Enter parameters..."); DlgReal(1, "Maximum interval (seconds) between spikes\nto be included in same burst:", 0.01, 1000); DlgShow(setMinBurstSep6); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get the parameters for forming the bursts on neuron 7... proc GetBurstSettings7() ret% := Interact("Are these spikes OK...if not, then you can delete unwanted events.", 1023); DlgCreate("Enter parameters..."); DlgReal(1, "Maximum interval (seconds) between spikes\nto be included in same burst:", 0.01, 1000); DlgShow(setMinBurstSep7); end; '*************************************************************************************************************************** '*************************************************************************************************************************** '*************************************************************************************************************************** 'PART EIGHT: 'CODE FOR CALCULATING BURSTS WHEN A WINDOW DISCIMINATOR IS NOT NEEDED (THESE PROCEDURES ARE CALLED ' "CalculateBursts" FOLLOWED BY THE NUMBER OF THE NEURON) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get events and Bursts for neuron 1 if a window discriminator IS NOT needed... proc CalculateBursts1() 'delete last set of data... if BurstCh1% > 0 then ChanDelete(BurstCh1%); endif; If yesno$="n" then if eventCh1% > 0 then ChanDelete(eventCh1%); endif; 'Get events for neuron 1 ... eventCh1% := MemChan(2); ' get rising or falling waveform and min. time interval DLGCreate("Rising or falling events?",0,0,0,2); 'use existing memchans DLGbutton(0,"Rising through threshold"); DLGbutton(1,"Falling through threshold"); upupandaway := DlgShow(); if not upupandaway then updown:=2; else updown:=3; endif; peakdiff:=input("minimum time interval between spikes in sec (to prevent double counts)",peakdiff); ' done MemImport(eventCh1%, inputCh1%, sTime, eTime, updown, peakdiff, setCutOff1); ChanShow(eventCh1%); ChanTitle$(eventCh1%, neuronname1$); endif; 'Get Bursts for neuron 1... GetBurstSettings1(); ok% := Query("Define Minumum Spikes Per Burst?", "Yes", "No"); if ok% then var minspikes1%; view(fh%); DlgCreate("OK"); DlgInteger(1, "Please Define the minimum number of spikes to make a burst", 0, 100); ok% := DlgShow(minspikes1%); if not ok% then Halt; endif; BurstCh1% := MemChan(4); BurstMake(BurstCh1%, eventCh1%, sTime, eTime, setMinBurstSep1, setMinBurstSep1,minspikes1%); else BurstCh1% := MemChan(4); BurstMake(BurstCh1%, eventCh1%, sTime, eTime, setMinBurstSep1); endif; ChanShow(BurstCh1%); ChanTitle$(BurstCh1%, neuronname1$); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get events and Bursts for neuron 2 if a window discriminator IS NOT needed... proc CalculateBursts2() 'Delete last set of data... if BurstCh2% > 0 then ChanDelete(BurstCh2%); endif; If yesno$="n" then 'only if we don't want to keep spike events, or we don't have any yet if eventCh2% > 0 then ChanDelete(eventCh2%); endif; 'Get events for neuron 2... eventCh2% := MemChan(2); ' get rising or falling waveform and min. time interval DLGCreate("Rising or falling events?",0,0,0,2); 'use existing memchans DLGbutton(0,"Rising through threshold"); DLGbutton(1,"Falling through threshold"); upupandaway := DlgShow(); if not upupandaway then updown:=2; else updown:=3; endif; peakdiff:=input("minimum time interval between spikes in sec (to prevent double counts)",peakdiff); ' done MemImport(eventCh2%, inputCh2%, sTime, eTime, updown, peakdiff, setCutOff2); ChanShow(eventCh2%); ChanTitle$(eventCh2%, neuronname2$); endif; 'Get Bursts for neuron 2... GetBurstSettings2(); ok% := Query("Define Minumum Spikes Per Burst?", "Yes", "No"); if ok% then var minspikes2%; view(fh%); DlgCreate("OK"); DlgInteger(1, "Please Define the minimum number of spikes to make a burst", 0, 100); ok% := DlgShow(minspikes2%); if not ok% then Halt; endif; BurstCh2% := MemChan(4); BurstMake(BurstCh2%, eventCh2%, sTime, eTime, setMinBurstSep2, setMinBurstSep2,minspikes2%); else BurstCh2% := MemChan(4); BurstMake(BurstCh2%, eventCh2%, sTime, eTime, setMinBurstSep2); endif; ChanShow(BurstCh2%); ChanTitle$(BurstCh2%, neuronname2$); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get events and Bursts for neuron 3 if a window discriminator IS NOT needed... proc CalculateBursts3() 'Delete last set of data... if BurstCh3% > 0 then ChanDelete(BurstCh3%); endif; If yesno$="n" then 'only if we don't want to keep spike events, or we don't have any yet if eventCh3% > 0 then ChanDelete(eventCh3%); endif; 'Get events for neuron 3... eventCh3% := MemChan(2); ' get rising or falling waveform and min. time interval DLGCreate("Rising or falling events?",0,0,0,2); 'use existing memchans DLGbutton(0,"Rising through threshold"); DLGbutton(1,"Falling through threshold"); upupandaway := DlgShow(); if not upupandaway then updown:=2; else updown:=3; endif; peakdiff:=input("minimum time interval between spikes in sec (to prevent double counts)",peakdiff); ' done MemImport(eventCh3%, inputCh3%, sTime, eTime, updown, peakdiff, setCutOff3); ChanShow(eventCh3%); ChanTitle$(eventCh3%, neuronname3$); endif; 'Get Bursts for neuron 3... GetBurstSettings3(); ok% := Query("Define Minumum Spikes Per Burst?", "Yes", "No"); if ok% then var minspikes3%; view(fh%); DlgCreate("OK"); DlgInteger(1, "Please Define the minimum number of spikes to make a burst", 0, 100); ok% := DlgShow(minspikes3%); if not ok% then Halt; endif; BurstCh3% := MemChan(4); BurstMake(BurstCh3%, eventCh3%, sTime, eTime, setMinBurstSep3, setMinBurstSep3,minspikes3%); else BurstCh3% := MemChan(4); BurstMake(BurstCh3%, eventCh3%, sTime, eTime, setMinBurstSep3); endif; ChanShow(BurstCh3%); ChanTitle$(BurstCh3%, neuronname3$); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get events and Bursts for neuron 4 if a window discriminator IS NOT needed... proc CalculateBursts4() 'Delete last set of data... if BurstCh4% > 0 then ChanDelete(BurstCh4%); endif; If yesno$="n" then 'only if we don't want to keep spike events, or we don't have any yet if eventCh4% > 0 then ChanDelete(eventCh4%); endif; 'Get events for neuron 4... eventCh4% := MemChan(2); ' get rising or falling waveform and min. time interval DLGCreate("Rising or falling events?",0,0,0,2); 'use existing memchans DLGbutton(0,"Rising through threshold"); DLGbutton(1,"Falling through threshold"); upupandaway := DlgShow(); if not upupandaway then updown:=2; else updown:=3; endif; peakdiff:=input("minimum time interval between spikes in sec (to prevent double counts)",peakdiff); ' done MemImport(eventCh4%, inputCh4%, sTime, eTime, updown, peakdiff, setCutOff4); ChanShow(eventCh4%); ChanTitle$(eventCh4%, neuronname4$); endif; 'Get Bursts for neuron 4... GetBurstSettings4(); ok% := Query("Define Minumum Spikes Per Burst?", "Yes", "No"); if ok% then var minspikes4%; view(fh%); DlgCreate("OK"); DlgInteger(1, "Please Define the minimum number of spikes to make a burst", 0, 100); ok% := DlgShow(minspikes4%); if not ok% then Halt; endif; BurstCh4% := MemChan(4); BurstMake(BurstCh4%, eventCh4%, sTime, eTime, setMinBurstSep4, setMinBurstSep4,minspikes4%); else BurstCh4% := MemChan(4); BurstMake(BurstCh4%, eventCh4%, sTime, eTime, setMinBurstSep4); endif; ChanShow(BurstCh4%); ChanTitle$(BurstCh4%, neuronname4$); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get events and Bursts for neuron 5 if a window discriminator IS NOT needed... proc CalculateBursts5() 'Delete last set of data... if BurstCh5% > 0 then ChanDelete(BurstCh5%); endif; If yesno$="n" then 'only if we don't want to keep spike events, or we don't have any yet if eventCh5% > 0 then ChanDelete(eventCh5%); endif; 'Get events for neuron 5... eventCh5% := MemChan(2); ' get rising or falling waveform and min. time interval DLGCreate("Rising or falling events?",0,0,0,2); 'use existing memchans DLGbutton(0,"Rising through threshold"); DLGbutton(1,"Falling through threshold"); upupandaway := DlgShow(); if not upupandaway then updown:=2; else updown:=3; endif; peakdiff:=input("minimum time interval between spikes in sec (to prevent double counts)",peakdiff); ' done MemImport(eventCh5%, inputCh5%, sTime, eTime, updown, peakdiff, setCutOff5); ChanShow(eventCh5%); ChanTitle$(eventCh5%, neuronname5$); endif; 'Get Bursts for neuron 5... GetBurstSettings5(); ok% := Query("Define Minumum Spikes Per Burst?", "Yes", "No"); if ok% then var minspikes5%; view(fh%); DlgCreate("OK"); DlgInteger(1, "Please Define the minimum number of spikes to make a burst", 0, 100); ok% := DlgShow(minspikes5%); if not ok% then Halt; endif; BurstCh5% := MemChan(4); BurstMake(BurstCh5%, eventCh5%, sTime, eTime, setMinBurstSep5, setMinBurstSep5,minspikes5%); else BurstCh5% := MemChan(4); BurstMake(BurstCh5%, eventCh5%, sTime, eTime, setMinBurstSep5); endif; ChanShow(BurstCh5%); ChanTitle$(BurstCh5%, neuronname5$); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get events and Bursts for neuron 6 if a window discriminator IS NOT needed... proc CalculateBursts6() 'Delete last set of data... if BurstCh6% > 0 then ChanDelete(BurstCh6%); endif; If yesno$="n" then 'only if we don't want to keep spike events, or we don't have any yet if eventCh6% > 0 then ChanDelete(eventCh6%); endif; 'Get events for neuron 6... eventCh6% := MemChan(2); ' get rising or falling waveform and min. time interval DLGCreate("Rising or falling events?",0,0,0,2); 'use existing memchans DLGbutton(0,"Rising through threshold"); DLGbutton(1,"Falling through threshold"); upupandaway := DlgShow(); if not upupandaway then updown:=2; else updown:=3; endif; peakdiff:=input("minimum time interval between spikes in sec (to prevent double counts)",peakdiff); ' done MemImport(eventCh6%, inputCh6%, sTime, eTime, updown, peakdiff, setCutOff6); ChanShow(eventCh6%); ChanTitle$(eventCh6%, neuronname6$); endif; 'Get Bursts for neuron 6... GetBurstSettings6(); ok% := Query("Define Minumum Spikes Per Burst?", "Yes", "No"); if ok% then var minspikes6%; view(fh%); DlgCreate("OK"); DlgInteger(1, "Please Define the minimum number of spikes to make a burst", 0, 100); ok% := DlgShow(minspikes6%); if not ok% then Halt; endif; BurstCh6% := MemChan(4); BurstMake(BurstCh6%, eventCh6%, sTime, eTime, setMinBurstSep6, setMinBurstSep6,minspikes6%); else BurstCh6% := MemChan(4); BurstMake(BurstCh6%, eventCh6%, sTime, eTime, setMinBurstSep6); endif; ChanShow(BurstCh6%); ChanTitle$(BurstCh6%, neuronname6$); end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get events and Bursts for neuron 7 if a window discriminator IS NOT needed... proc CalculateBursts7() 'Delete last set of data... if BurstCh7% > 0 then ChanDelete(BurstCh7%); endif; If yesno$="n" then 'only if we don't want to keep spike events, or we don't have any yet if eventCh7% > 0 then ChanDelete(eventCh7%); endif; 'Get events for neuron 7... eventCh7% := MemChan(2); ' get rising or falling waveform and min. time interval DLGCreate("Rising or falling events?",0,0,0,2); 'use existing memchans DLGbutton(0,"Rising through threshold"); DLGbutton(1,"Falling through threshold"); upupandaway := DlgShow(); if not upupandaway then updown:=2; else updown:=3; endif; peakdiff:=input("minimum time interval between spikes in sec (to prevent double counts)",peakdiff); ' done MemImport(eventCh7%, inputCh7%, sTime, eTime, updown, peakdiff, setCutOff7); ChanShow(eventCh7%); ChanTitle$(eventCh7%, neuronname7$); endif; 'Get Bursts for neuron 7... GetBurstSettings7(); ok% := Query("Define Minumum Spikes Per Burst?", "Yes", "No"); if ok% then var minspikes7%; view(fh%); DlgCreate("OK"); DlgInteger(1, "Please Define the minimum number of spikes to make a burst", 0, 100); ok% := DlgShow(minspikes7%); if not ok% then Halt; endif; BurstCh7% := MemChan(4); BurstMake(BurstCh7%, eventCh7%, sTime, eTime, setMinBurstSep7, setMinBurstSep7,minspikes7%); else BurstCh7% := MemChan(4); BurstMake(BurstCh7%, eventCh7%, sTime, eTime, setMinBurstSep7); endif; ChanShow(BurstCh7%); ChanTitle$(BurstCh7%, neuronname7$); end; '********************************************************************************************************** '********************************************************************************************************** '********************************************************************************************************** 'PART NINE: 'CODE FOR CALCULATING BURSTS WHEN A WINDOW DISCIMINATOR IS NEEDED (THESE PROCEDURES ARE CALLED ' "CalculateBursts" FOLLOWED BY THE NUMBER OF THE NEURON AND THE LETTER "b") '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Get events and Bursts for neuron 1 if a window discriminator IS neededds proc CalculateBursts1b() 'delete last set of data... if eventCh1% > 0 then ChanDelete(eventCh1%); endif; if BurstCh1% > 0 then ChanDelete(BurstCh1%); endif; 'Get events for neuron 1... 'get minimum delay from one spike to another mindelay1 := Input("minimum delay from one spike to another in sec?", 0.005, 0, 5000); 'mindelay1:=mindelay1/1000; eventCh11% := MemChan(2); MemImport(eventCh11%, inputCh1%, sTime, eTime, 2, mindelay1, setCutOff1); eventCh12% := MemChan(2); MemImport(eventCh12%, inputCh1%, sTime, eTime, 3, 0.0005, setCutOff1); 'minimum delay set to 0,5ms since all rising waveforms MUST be followed by a falling eventCh1% := MemChan(2); '########################## 'WOLFIE'S CHUNK OF CODE (I TRANSLATED THE CODE COMMENTS INTO ENGLISH) 'THIS NIFTY CHUNK OF CODE WORKS AS FOLLOWS: ' 1. IT RECORDS EVENTS THAT CROSS THE TWO HORIZONTAL CURSORS (FOR NEURON 1, THEY'RE "setCutOff1" and "setCutOff6") ' 2. IT RECORDS THE RISING TIME (from eventCh6% and called "punkt1a") AND FALLING TIME (from eventCh7% and called "punkt1b") FOR EVENTS THAT CROSS THE FIRST HORIZONTAL CURSOR ("setCutOff1") ' 3. IT MEASURES THE PEAK VOLTAGE BETWEEN THE RISING TIME AND THE FALLING TIME FOR THOSE RECORDED IN #2 AND RECORDS IT ' 4. IT THEN ASKS IF THE PEAK VOLTAGE FROM #3 IS LOWER THAN THE 2ND HORIZONTAL CURSOR ("setCutOff6")...IF SO, IT RECORDS IT AS AN EVENT (eventCh1%) var punkt1a; 'variable defining the rising time of the spike var punkt1b; 'variable defining the falling time of the spike var peakamp1; ' variable defining the peak voltage of the spike punkt1a:=sTime; while punkt1a>0 do punkt1a:=nexttime(eventCh11%,punkt1a); 'rising time of spike punkt1b:=nexttime(eventCh12%,punkt1a); 'falling time of spike if punkt1a>0 then peakamp1:=ChanMeasure(inputCh1%,8,punkt1a,punkt1b); 'amplitude of spike endif; if peakamp1 0 then ChanDelete(eventCh2%); endif; if BurstCh2% > 0 then ChanDelete(BurstCh2%); endif; 'Get events for neuron 2... 'get minimum delay from one spike to another mindelay2 := Input("minimum delay from one spike to another in sec?", 0.005, 0, 5000); 'mindelay2:=mindelay2/1000; eventCh13% := MemChan(2); MemImport(eventCh13%, inputCh2%, sTime, eTime, 2, mindelay2, setCutOff2); eventCh14% := MemChan(2); MemImport(eventCh14%, inputCh2%, sTime, eTime, 3, 0.0005, setCutOff2); eventCh2% := MemChan(2); var punkt2a; 'variable defining the rising time of the spike var punkt2b; 'variable defining the falling time of the spike var peakamp2; ' variable defining the peak voltage of the spike punkt2a:=sTime; while punkt2a>0 do punkt2a:=nexttime(eventCh13%,punkt2a); 'rising time of spike punkt2b:=nexttime(eventCh14%,punkt2a); 'falling time of spike if punkt2a>0 then peakamp2:=ChanMeasure(inputCh2%,8,punkt2a,punkt2b); 'amplitude of spike endif; if peakamp2 0 then ChanDelete(eventCh3%); endif; if BurstCh3% > 0 then ChanDelete(BurstCh3%); endif; 'Get events for neuron 3... 'get minimum delay from one spike to another mindelay3 := Input("minimum delay from one spike to another in sec?", 0.005, 0, 5000); 'mindelay3:=mindelay3/1000; eventCh15% := MemChan(2); MemImport(eventCh15%, inputCh3%, sTime, eTime, 2, mindelay3, setCutOff3); eventCh16% := MemChan(2); MemImport(eventCh16%, inputCh3%, sTime, eTime, 3, 0.0005, setCutOff3); eventCh3% := MemChan(2); var punkt3a; 'variable defining the rising time of the spike var punkt3b; 'variable defining the falling time of the spike var peakamp3; ' variable defining the peak voltage of the spike punkt3a:=sTime; while punkt3a>0 do punkt3a:=nexttime(eventCh15%,punkt3a); 'rising time of spike punkt3b:=nexttime(eventCh16%,punkt3a); 'falling time of spike if punkt3a>0 then peakamp3:=ChanMeasure(inputCh3%,8,punkt3a,punkt3b); 'amplitude of spike endif; if peakamp3 0 then ChanDelete(eventCh4%); endif; if BurstCh4% > 0 then ChanDelete(BurstCh4%); endif; 'Get events for neuron 4... 'get minimum delay from one spike to another mindelay4 := Input("minimum delay from one spike to another in sec?", 0.005, 0, 5000); 'mindelay4:=mindelay4/1000; eventCh17% := MemChan(2); MemImport(eventCh17%, inputCh4%, sTime, eTime, 2, mindelay4, setCutOff4); eventCh18% := MemChan(2); MemImport(eventCh18%, inputCh4%, sTime, eTime, 3, 0.0005, setCutOff4); eventCh4% := MemChan(2); var punkt4a; 'variable defining the rising time of the spike var punkt4b; 'variable defining the falling time of the spike var peakamp4; ' variable defining the peak voltage of the spike punkt4a:=sTime; while punkt4a>0 do punkt4a:=nexttime(eventCh17%,punkt4a); 'rising time of spike punkt4b:=nexttime(eventCh18%,punkt4a); 'falling time of spike if punkt4a>0 then peakamp4:=ChanMeasure(inputCh4%,8,punkt4a,punkt4b); 'amplitude of spike endif; if peakamp4 0 then ChanDelete(eventCh5%); endif; if BurstCh5% > 0 then ChanDelete(BurstCh5%); endif; 'Get events for neuron 5... 'get minimum delay from one spike to another mindelay5 := Input("minimum delay from one spike to another in sec?", 0.005, 0, 5000); 'mindelay5:=mindelay5/1000; eventCh19% := MemChan(2); MemImport(eventCh19%, inputCh5%, sTime, eTime, 2, mindelay5, setCutOff5); eventCh20% := MemChan(2); MemImport(eventCh20%, inputCh5%, sTime, eTime, 3, 0.0005, setCutOff5); eventCh5% := MemChan(2); var punkt5a; 'variable defining the rising time of the spike var punkt5b; 'variable defining the falling time of the spike var peakamp5; ' variable defining the peak voltage of the spike punkt5a:=sTime; while punkt5a>0 do punkt5a:=nexttime(eventCh19%,punkt5a); 'rising time of spike punkt5b:=nexttime(eventCh20%,punkt5a); 'falling time of spike if punkt5a>0 then peakamp5:=ChanMeasure(inputCh5%,8,punkt5a,punkt5b); 'amplitude of spike endif; if peakamp5 0 then ChanDelete(eventCh6%); endif; if BurstCh6% > 0 then ChanDelete(BurstCh6%); endif; 'Get events for neuron 6... 'get minimum delay from one spike to another mindelay6 := Input("minimum delay from one spike to another in sec?", 0.005, 0, 5000); 'mindelay6:=mindelay6/1000; eventCh21% := MemChan(2); MemImport(eventCh21%, inputCh6%, sTime, eTime, 2, mindelay6, setCutOff6); eventCh22% := MemChan(2); MemImport(eventCh22%, inputCh6%, sTime, eTime, 3, 0.0005, setCutOff6); eventCh6% := MemChan(2); var punkt6a; 'variable defining the rising time of the spike var punkt6b; 'variable defining the falling time of the spike var peakamp6; ' variable defining the peak voltage of the spike punkt6a:=sTime; while punkt6a>0 do punkt6a:=nexttime(eventCh21%,punkt6a); 'rising time of spike punkt6b:=nexttime(eventCh22%,punkt6a); 'falling time of spike if punkt6a>0 then peakamp6:=ChanMeasure(inputCh6%,8,punkt6a,punkt6b); 'amplitude of spike endif; if peakamp6 0 then ChanDelete(eventCh7%); endif; if BurstCh7% > 0 then ChanDelete(BurstCh7%); endif; 'Get events for neuron 7... 'get minimum delay from one spike to another mindelay7 := Input("minimum delay from one spike to another in sec?", 0.005, 0, 5000); 'mindelay7:=mindelay7/1000; eventCh23% := MemChan(2); MemImport(eventCh23%, inputCh7%, sTime, eTime, 2, mindelay7, setCutOff7); eventCh24% := MemChan(2); MemImport(eventCh24%, inputCh7%, sTime, eTime, 3, 0.0005, setCutOff7); eventCh7% := MemChan(2); var punkt7a; 'variable defining the rising time of the spike var punkt7b; 'variable defining the falling time of the spike var peakamp7; ' variable defining the peak voltage of the spike punkt7a:=sTime; while punkt7a>0 do punkt7a:=nexttime(eventCh23%,punkt7a); 'rising time of spike punkt7b:=nexttime(eventCh24%,punkt7a); 'falling time of spike if punkt7a>0 then peakamp7:=ChanMeasure(inputCh7%,8,punkt7a,punkt7b); 'amplitude of spike endif; if peakamp7= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalysePeriod1(sBurst1, eBurst1); AnalysePhase0(sBurst1, eBurst1); burstnum1 :=1+burstnum1; if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum1, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results0[resNormSNeuron1%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results0[resNormSNeuron1%], results0[resNormENeuron1%]); endif; endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 and results0[resNormSNeuron1%] > -777 AND burstnum1 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname1$, burstnum1, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results0[resNormSNeuron1%], results0[resNormENeuron1%]);endif; if results12[resPeriod1%] > -777 and results0[resNormSNeuron1%] > -777 AND burstnum1 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum1, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results0[resNormSNeuron1%], results0[resNormENeuron1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum1, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$, na$, na$);endif; endif; endif; durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); if results0[resNormSNeuron1%] > -777 then phaseontotal1 := phaseontotal1 + results0[resNormSNeuron1%]; phaseofftotal1 := phaseofftotal1 + results0[resNormENeuron1%]; sqphaseontotal1 :=sqphaseontotal1 + (results0[resNormSNeuron1%] * results0[resNormSNeuron1%]); sqphaseofftotal1 := sqphaseofftotal1 + (results0[resNormENeuron1%] * results0[resNormENeuron1%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum1; spikenummean1 := spikenumtotal1/burstnum1; freqmean1 := freqtotal1 /burstnum1; 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/(burstnum1)))/(burstnum1-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/(burstnum1)))/(burstnum1-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/(burstnum1)))/(burstnum1-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); phaseonmean1 := phaseontotal1/(burstnum1-1); phaseoffmean1 := phaseofftotal1/(burstnum1-1); phaseonsd1 :=((sqphaseontotal1) - ((phaseontotal1 * phaseontotal1)/(burstnum1-1)))/(burstnum1-2); phaseoffsd1 :=((sqphaseofftotal1) - ((phaseofftotal1 * phaseofftotal1)/(burstnum1-1)))/(burstnum1-2); phaseonsd1 := sqrt(phaseonsd1); phaseoffsd1 := sqrt(phaseoffsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum1-1); frequencymean1 := frequencytotal1/(burstnum1-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1 * periodtotal1)/(burstnum1-1)))/(burstnum1-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1 * frequencytotal1)/(burstnum1-1)))/(burstnum1-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum1, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean1, phaseoffmean1); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd1, phaseoffsd1); '******************** FOR PHASEPLOT phaseon[1]:=phaseonmean1; phaseoff[1]:=phaseoffmean1; stdOFF[1]:=phaseoffsd1; stdon[1]:=phaseonsd1; name$[1]:=neuronname1$; spikesperburst[1]:=spikenummean1; spikesperburstSD[1]:=spikenumsd1; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname1$, burstnum1, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1, phaseonmean1, phaseoffmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1, phaseonsd1, phaseoffsd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WRITING DATA IF 2 NEURONS ANALYZED if number1% = 2 then burstnum2 :=0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationtotal2 :=0; spikenumtotal2 :=0; freqtotal2 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; durationmean2 :=0; spikenummean2 :=0; freqmean2 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; sqdurationtotal2 :=0; sqspikenumtotal2 :=0; sqfreqtotal2 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; durationsd2 :=0; spikenumsd2 :=0; freqsd2 :=0; phaseontotal1 :=0; sqphaseontotal1 :=0; phaseofftotal1 :=0; sqphaseofftotal1 :=0; phaseontotal2 :=0; sqphaseontotal2 :=0; phaseofftotal2 :=0; sqphaseofftotal2 :=0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; periodtotal2 :=0; frequencytotal2 :=0; sqperiodtotal2 :=0; sqfrequencytotal2 :=0; periodmean2 :=0; frequencymean2 :=0; periodsd2 :=0; frequencysd2 :=0; '******************************************************************************** 'writing/analysing data for neuron 1 of 2 while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); '''' XXXXXXXXXXXXXXXXXXXXXXXXXXXXX IF ONE CYCLE MISSES SPIKES THEN AT THE END OF THE FILE THERE IS ONE CYCLE TOO MUCH ''' THIS IS THE PLACE TO CATCH it if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalysePeriod1(sBurst1, eBurst1); AnalysePhase1(sBurst1, eBurst1, sBurst2, eBurst2); burstnum2 :=1+burstnum2; '***************************************************************************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum2, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results3[resNormSNeuron1%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results3[resNormSNeuron1%], results3[resNormENeuron1%]); endif; endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 and results3[resNormSNeuron1%] > -777 AND burstnum2 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname1$, burstnum2, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results3[resNormSNeuron1%], results3[resNormENeuron1%]);endif; if results12[resPeriod1%] > -777 and results3[resNormSNeuron1%] > -777 AND burstnum2 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum2, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results3[resNormSNeuron1%], results3[resNormENeuron1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum2, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); if results3[resNormSNeuron1%] > -777 then phaseontotal1 := phaseontotal1 + results3[resNormSNeuron1%]; phaseofftotal1 := phaseofftotal1 + results3[resNormENeuron1%]; sqphaseontotal1 :=sqphaseontotal1 + (results3[resNormSNeuron1%] * results3[resNormSNeuron1%]); sqphaseofftotal1 := sqphaseofftotal1 + (results3[resNormENeuron1%] * results3[resNormENeuron1%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum2; spikenummean1 := spikenumtotal1/burstnum2; freqmean1 := freqtotal1 /burstnum2; phaseonmean1 := phaseontotal1/(burstnum2-1); phaseoffmean1 := phaseofftotal1/(burstnum2-1); 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/burstnum2))/(burstnum2-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/burstnum2))/(burstnum2-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/burstnum2))/(burstnum2-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); phaseonsd1 :=((sqphaseontotal1) - ((phaseontotal1 * phaseontotal1)/(burstnum2-1)))/(burstnum2-2); phaseoffsd1 :=((sqphaseofftotal1) - ((phaseofftotal1 * phaseofftotal1)/(burstnum2-1)))/(burstnum2-2); phaseonsd1 := sqrt(phaseonsd1); phaseoffsd1 := sqrt(phaseoffsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum2-1); frequencymean1 := frequencytotal1/(burstnum2-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1*periodtotal1)/(burstnum2-1)))/(burstnum2-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1*frequencytotal1)/(burstnum2-1)))/(burstnum2-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum2, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean1, phaseoffmean1); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd1, phaseoffsd1); '******************** FOR PHASEPLOT phaseon[1]:=phaseonmean1; phaseoff[1]:=phaseoffmean1; stdOFF[1]:=phaseoffsd1; stdon[1]:=phaseonsd1; name$[1]:=neuronname1$; spikesperburst[1]:=spikenummean1; spikesperburstSD[1]:=spikenumsd1; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname1$, burstnum2, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1, phaseonmean1, phaseoffmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1, phaseonsd1, phaseoffsd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '********************************************************************************************************************************** 'begin the analysis for neuron 2 burstnum2 :=0; sBurst1 :=0; sBurst2 :=0; eBurst1 :=0; eBurst2 :=0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); if sBurst2 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); if eBurst2 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalysePeriod2(sBurst2, eBurst2); AnalysePhase1(sBurst1, eBurst1, sBurst2, eBurst2); burstnum2 :=1+burstnum2; '***************************************************************************************************************************************************** 'single burst analyses for neuron 2 if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname2$, burstnum2, sBurst2, eBurst2); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%]); '************************************************************************************************* 'COMPUTE PERIOD if results13[resPeriod2%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results13[resPeriod2%], results13[resFrequency2%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results3[resNormSNeuron2%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results3[resNormSNeuron2%], results3[resNormENeuron2%]); endif; endif; if summary% =0 AND xlv% =1 then if results13[resPeriod2%] > -777 and results3[resNormSNeuron2%] > -777 AND burstnum2 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname2$, burstnum2, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%], results3[resNormSNeuron2%], results3[resNormENeuron2%]);endif; if results13[resPeriod2%] > -777 and results3[resNormSNeuron2%] > -777 AND burstnum2 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum2, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%], results3[resNormSNeuron2%], results3[resNormENeuron2%]);endif; if results13[resPeriod2%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum2, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal2 := durationtotal2 + results2[resDuration2%]; spikenumtotal2 := spikenumtotal2 + results2[resSpikes2%]; freqtotal2 := freqtotal2 + results2[resSpikeFreq2%]; sqdurationtotal2 := sqdurationtotal2 + (results2[resDuration2%] * results2[resDuration2%]); sqspikenumtotal2 := sqspikenumtotal2 + (results2[resSpikes2%] * results2[resSpikes2%]); sqfreqtotal2 := sqfreqtotal2 + (results2[resSpikeFreq2%] * results2[resSpikeFreq2%]); if results3[resNormSNeuron2%] > -777 then phaseontotal2 := phaseontotal2 + results3[resNormSNeuron2%]; phaseofftotal2 := phaseofftotal2 + results3[resNormENeuron2%]; sqphaseontotal2 :=sqphaseontotal2 + (results3[resNormSNeuron2%] * results3[resNormSNeuron2%]); sqphaseofftotal2 := sqphaseofftotal2 + (results3[resNormENeuron2%] * results3[resNormENeuron2%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results13[resPeriod2%] > -777 then periodtotal2 := periodtotal2 + results13[resPeriod2%]; frequencytotal2 := frequencytotal2 + results13[resFrequency2%]; sqperiodtotal2 := sqperiodtotal2 + (results13[resPeriod2%] * results13[resPeriod2%]); sqfrequencytotal2 := sqfrequencytotal2 + (results13[resFrequency2%] * results13[resFrequency2%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean2 := durationtotal2/burstnum2; spikenummean2 := spikenumtotal2/burstnum2; freqmean2 := freqtotal2 /burstnum2; phaseonmean2 := phaseontotal2/(burstnum2-1); phaseoffmean2 := phaseofftotal2/(burstnum2-1); 'calculating the standard devs for the bursts... durationsd2 := ((sqdurationtotal2) - ((durationtotal2*durationtotal2)/burstnum2))/(burstnum2-1); spikenumsd2 := ((sqspikenumtotal2) - ((spikenumtotal2*spikenumtotal2)/burstnum2))/(burstnum2-1); freqsd2 := ((sqfreqtotal2) - ((freqtotal2*freqtotal2)/burstnum2))/(burstnum2-1); durationsd2 := sqrt(durationsd2); spikenumsd2 := sqrt(spikenumsd2); freqsd2 := sqrt(freqsd2); phaseonsd2 :=((sqphaseontotal2) - ((phaseontotal2 * phaseontotal2)/(burstnum2-1)))/(burstnum2-2); phaseoffsd2 :=((sqphaseofftotal2) - ((phaseofftotal2 * phaseofftotal2)/(burstnum2-1)))/(burstnum2-2); phaseonsd2 := sqrt(phaseonsd2); phaseoffsd2 := sqrt(phaseoffsd2); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean2 := periodtotal2/(burstnum2-1); frequencymean2 := frequencytotal2/(burstnum2-1); periodsd2 := ((sqperiodtotal2) - ((periodtotal2 * periodtotal2)/(burstnum2-1)))/(burstnum2-2); frequencysd2 := ((sqfrequencytotal2) - ((frequencytotal2 * frequencytotal2)/(burstnum2-1)))/(burstnum2-2); periodsd2 := sqrt(periodsd2); frequencysd2 := sqrt(frequencysd2); '********************************************************************************************************************************** 'printing the neuron summary for neuron 2 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname2$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum2, durationmean2, spikenummean2, freqmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd2, spikenumsd2, freqsd2); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean2, frequencymean2); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd2, frequencysd2); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean2, phaseoffmean2); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd2, phaseoffsd2); '******************** FOR PHASEPLOT phaseon[2]:=phaseonmean2; phaseoff[2]:=phaseoffmean2; stdOFF[2]:=phaseoffsd2; stdon[2]:=phaseonsd2; name$[2]:=neuronname2$; spikesperburst[2]:=spikenummean2; spikesperburstSD[2]:=spikenumsd2; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname2$, burstnum2, durationmean2, spikenummean2, freqmean2, periodmean2, frequencymean2, phaseonmean2, phaseoffmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd2, spikenumsd2, freqsd2, periodsd2, frequencysd2, phaseonsd2, phaseoffsd2); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WRITING DATA IF 3 NEURONS ANALYZED if number1% = 3 then burstnum3 :=0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationtotal2 :=0; spikenumtotal2 :=0; freqtotal2 :=0; durationtotal3 :=0; spikenumtotal3 :=0; freqtotal3 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; durationmean2 :=0; spikenummean2 :=0; freqmean2 :=0; durationmean3 :=0; spikenummean3 :=0; freqmean3 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; sqdurationtotal2 :=0; sqspikenumtotal2 :=0; sqfreqtotal2 :=0; sqdurationtotal3 :=0; sqspikenumtotal3 :=0; sqfreqtotal3 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; durationsd2 :=0; spikenumsd2 :=0; freqsd2 :=0; durationsd3 :=0; spikenumsd3 :=0; freqsd3 :=0; phaseontotal1 :=0; sqphaseontotal1 :=0; phaseofftotal1 :=0; sqphaseofftotal1 :=0; phaseontotal2 :=0; sqphaseontotal2 :=0; phaseofftotal2 :=0; sqphaseofftotal2 :=0; phaseontotal3 :=0; sqphaseontotal3 :=0; phaseofftotal3 :=0; sqphaseofftotal3 :=0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; periodtotal2 :=0; frequencytotal2 :=0; sqperiodtotal2 :=0; sqfrequencytotal2 :=0; periodmean2 :=0; frequencymean2 :=0; periodsd2 :=0; frequencysd2 :=0; periodtotal3 :=0; frequencytotal3 :=0; sqperiodtotal3 :=0; sqfrequencytotal3 :=0; periodmean3 :=0; frequencymean3 :=0; periodsd3 :=0; frequencysd3 :=0; '********************************************************************************** 'writing/analysing data for neuron 1 of 3 while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalysePeriod1(sBurst1, eBurst1); AnalysePhase2(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3); burstnum3 :=1+burstnum3; '************************************************************************************* if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum3, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results4[resNormSNeuron1%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results4[resNormSNeuron1%], results4[resNormENeuron1%]); endif; endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 and results4[resNormSNeuron1%] > -777 AND burstnum3 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname1$, burstnum3, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results4[resNormSNeuron1%], results4[resNormENeuron1%]);endif; if results12[resPeriod1%] > -777 and results4[resNormSNeuron1%] > -777 AND burstnum3 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum3, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results4[resNormSNeuron1%], results4[resNormENeuron1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum3, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); if results4[resNormSNeuron1%] > -777 then phaseontotal1 := phaseontotal1 + results4[resNormSNeuron1%]; phaseofftotal1 := phaseofftotal1 + results4[resNormENeuron1%]; sqphaseontotal1 :=sqphaseontotal1 + (results4[resNormSNeuron1%] * results4[resNormSNeuron1%]); sqphaseofftotal1 := sqphaseofftotal1 + (results4[resNormENeuron1%] * results4[resNormENeuron1%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum3; spikenummean1 := spikenumtotal1/burstnum3; freqmean1 := freqtotal1 /burstnum3; phaseonmean1 := phaseontotal1/(burstnum3-1); phaseoffmean1 := phaseofftotal1/(burstnum3-1); 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/burstnum3))/(burstnum3-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/burstnum3))/(burstnum3-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/burstnum3))/(burstnum3-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); phaseonsd1 :=((sqphaseontotal1) - ((phaseontotal1 * phaseontotal1)/(burstnum3-1)))/(burstnum3-2); phaseoffsd1 :=((sqphaseofftotal1) - ((phaseofftotal1 * phaseofftotal1)/(burstnum3-1)))/(burstnum3-2); phaseonsd1 := sqrt(phaseonsd1); phaseoffsd1 := sqrt(phaseoffsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum3-1); frequencymean1 := frequencytotal1/(burstnum3-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1*periodtotal1)/(burstnum3-1)))/(burstnum3-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1*frequencytotal1)/(burstnum3-1)))/(burstnum3-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum3, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean1, phaseoffmean1); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd1, phaseoffsd1); '******************** FOR PHASEPLOT phaseon[1]:=phaseonmean1; phaseoff[1]:=phaseoffmean1; stdOFF[1]:=phaseoffsd1; stdon[1]:=phaseonsd1; name$[1]:=neuronname1$; spikesperburst[1]:=spikenummean1; spikesperburstSD[1]:=spikenumsd1; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname1$, burstnum3, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1, phaseonmean1, phaseoffmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1, phaseonsd1, phaseoffsd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '**************************************************************************** 'Begin writing/analysis for neuron 2 0f 3' burstnum3 :=0; sBurst1 :=0; sBurst2 :=0; sBurst3 :=0; eBurst1 :=0; eBurst2 :=0; eBurst3 :=0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalysePeriod2(sBurst2, eBurst2); AnalysePhase2(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3); burstnum3 :=1+burstnum3; '******************************************************************************* if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname2$, burstnum3, sBurst2, eBurst2); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%]); '************************************************************************************************* 'COMPUTE PERIOD if results13[resPeriod2%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results13[resPeriod2%], results13[resFrequency2%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results4[resNormSNeuron2%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results4[resNormSNeuron2%], results4[resNormENeuron2%]); endif; endif; if summary% =0 AND xlv% =1 then if results13[resPeriod2%] > -777 and results4[resNormSNeuron2%] > -777 AND burstnum3 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname2$, burstnum3, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%], results4[resNormSNeuron2%], results4[resNormENeuron2%]);endif; if results13[resPeriod2%] > -777 and results3[resNormSNeuron2%] > -777 AND burstnum3 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum3, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%], results4[resNormSNeuron2%], results4[resNormENeuron2%]);endif; if results13[resPeriod2%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum3, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal2 := durationtotal2 + results2[resDuration2%]; spikenumtotal2 := spikenumtotal2 + results2[resSpikes2%]; freqtotal2 := freqtotal2 + results2[resSpikeFreq2%]; sqdurationtotal2 := sqdurationtotal2 + (results2[resDuration2%] * results2[resDuration2%]); sqspikenumtotal2 := sqspikenumtotal2 + (results2[resSpikes2%] * results2[resSpikes2%]); sqfreqtotal2 := sqfreqtotal2 + (results2[resSpikeFreq2%] * results2[resSpikeFreq2%]); if results4[resNormSNeuron2%] > -777 then phaseontotal2 := phaseontotal2 + results4[resNormSNeuron2%]; phaseofftotal2 := phaseofftotal2 + results4[resNormENeuron2%]; sqphaseontotal2 :=sqphaseontotal2 + (results4[resNormSNeuron2%] * results4[resNormSNeuron2%]); sqphaseofftotal2 := sqphaseofftotal2 + (results4[resNormENeuron2%] * results4[resNormENeuron2%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results13[resPeriod2%] > -777 then periodtotal2 := periodtotal2 + results13[resPeriod2%]; frequencytotal2 := frequencytotal2 + results13[resFrequency2%]; sqperiodtotal2 := sqperiodtotal2 + (results13[resPeriod2%] * results13[resPeriod2%]); sqfrequencytotal2 := sqfrequencytotal2 + (results13[resFrequency2%] * results13[resFrequency2%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean2 := durationtotal2/burstnum3; spikenummean2 := spikenumtotal2/burstnum3; freqmean2 := freqtotal2 /burstnum3; phaseonmean2 := phaseontotal2/(burstnum3-1); phaseoffmean2 := phaseofftotal2/(burstnum3-1); 'calculating the standard devs for the bursts... durationsd2 := ((sqdurationtotal2) - ((durationtotal2*durationtotal2)/burstnum3))/(burstnum3-1); spikenumsd2 := ((sqspikenumtotal2) - ((spikenumtotal2*spikenumtotal2)/burstnum3))/(burstnum3-1); freqsd2 := ((sqfreqtotal2) - ((freqtotal2*freqtotal2)/burstnum3))/(burstnum3-1); durationsd2 := sqrt(durationsd2); spikenumsd2 := sqrt(spikenumsd2); freqsd2 := sqrt(freqsd2); phaseonsd2 :=((sqphaseontotal2) - ((phaseontotal2 * phaseontotal2)/(burstnum3-1)))/(burstnum3-2); phaseoffsd2 :=((sqphaseofftotal2) - ((phaseofftotal2 * phaseofftotal2)/(burstnum3-1)))/(burstnum3-2); phaseonsd2 := sqrt(phaseonsd2); phaseoffsd2 := sqrt(phaseoffsd2); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean2 := periodtotal2/(burstnum3-1); frequencymean2 := frequencytotal2/(burstnum3-1); periodsd2 := ((sqperiodtotal2) - ((periodtotal2*periodtotal2)/(burstnum3-1)))/(burstnum3-2); frequencysd2 := ((sqfrequencytotal2) - ((frequencytotal2*frequencytotal2)/(burstnum3-1)))/(burstnum3-2); periodsd2 := sqrt(periodsd2); frequencysd2 := sqrt(frequencysd2); '********************************************************************************************************************************** 'printing the neuron summary for neuron 2 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname2$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum3, durationmean2, spikenummean2, freqmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd2, spikenumsd2, freqsd2); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean2, frequencymean2); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd2, frequencysd2); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean2, phaseoffmean2); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd2, phaseoffsd2); '******************** FOR PHASEPLOT phaseon[2]:=phaseonmean2; phaseoff[2]:=phaseoffmean2; stdOFF[2]:=phaseoffsd2; stdon[2]:=phaseonsd2; name$[2]:=neuronname2$; spikesperburst[2]:=spikenummean2; spikesperburstSD[2]:=spikenumsd2; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname2$, burstnum3, durationmean2, spikenummean2, freqmean2, periodmean2, frequencymean2, phaseonmean2, phaseoffmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd2, spikenumsd2, freqsd2, periodsd2, frequencysd2, phaseonsd2, phaseoffsd2); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '******************************************************************************************** 'Begin writing/analysis for neuron 3 of 3 burstnum3 :=0; sBurst1 :=0; sBurst2 :=0; sBurst3 :=0; eBurst1 :=0; eBurst2 :=0; eBurst3 :=0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalysePeriod3(sBurst3, eBurst3); AnalysePhase2(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3); burstnum3 :=1+burstnum3; '******************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname3$, burstnum3, sBurst3, eBurst3); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%]); '************************************************************************************************* 'COMPUTE PERIOD if results14[resPeriod3%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results14[resPeriod3%], results14[resFrequency3%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results4[resNormSNeuron3%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results4[resNormSNeuron3%], results4[resNormENeuron3%]); endif; endif; if summary% =0 AND xlv% =1 then if results14[resPeriod3%] > -777 and results4[resNormSNeuron3%] > -777 AND burstnum3 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname3$, burstnum3, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%], results4[resNormSNeuron3%], results4[resNormENeuron3%]);endif; if results14[resPeriod3%] > -777 and results4[resNormSNeuron3%] > -777 AND burstnum3 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum3, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%], results4[resNormSNeuron3%], results4[resNormENeuron3%]);endif; if results14[resPeriod3%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum3, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal3 := durationtotal3 + results3[resDuration3%]; spikenumtotal3 := spikenumtotal3 + results3[resSpikes3%]; freqtotal3 := freqtotal3 + results3[resSpikeFreq3%]; sqdurationtotal3 := sqdurationtotal3 + (results3[resDuration3%] * results3[resDuration3%]); sqspikenumtotal3 := sqspikenumtotal3 + (results3[resSpikes3%] * results3[resSpikes3%]); sqfreqtotal3 := sqfreqtotal3 + (results3[resSpikeFreq3%] * results3[resSpikeFreq3%]); if results4[resNormSNeuron3%] > -777 then phaseontotal3 := phaseontotal3 + results4[resNormSNeuron3%]; phaseofftotal3 := phaseofftotal3 + results4[resNormENeuron3%]; sqphaseontotal3 :=sqphaseontotal3 + (results4[resNormSNeuron3%] * results4[resNormSNeuron3%]); sqphaseofftotal3 := sqphaseofftotal3 + (results4[resNormENeuron3%] * results4[resNormENeuron3%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results14[resPeriod3%] > -777 then periodtotal3 := periodtotal3 + results14[resPeriod3%]; frequencytotal3 := frequencytotal3 + results14[resFrequency3%]; sqperiodtotal3 := sqperiodtotal3 + (results14[resPeriod3%] * results14[resPeriod3%]); sqfrequencytotal3 := sqfrequencytotal3 + (results14[resFrequency3%] * results14[resFrequency3%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean3 := durationtotal3/burstnum3; spikenummean3 := spikenumtotal3/burstnum3; freqmean3 := freqtotal3 /burstnum3; phaseonmean3 := phaseontotal3/(burstnum3-1); phaseoffmean3 := phaseofftotal3/(burstnum3-1); 'calculating the standard devs for the bursts... durationsd3 := ((sqdurationtotal3) - ((durationtotal3*durationtotal3)/burstnum3))/(burstnum3-1); spikenumsd3 := ((sqspikenumtotal3) - ((spikenumtotal3*spikenumtotal3)/burstnum3))/(burstnum3-1); freqsd3 := ((sqfreqtotal3) - ((freqtotal3*freqtotal3)/burstnum3))/(burstnum3-1); durationsd3 := sqrt(durationsd3); spikenumsd3 := sqrt(spikenumsd3); freqsd3 := sqrt(freqsd3); phaseonsd3 :=((sqphaseontotal3) - ((phaseontotal3 * phaseontotal3)/(burstnum3-1)))/(burstnum3-2); phaseoffsd3 :=((sqphaseofftotal3) - ((phaseofftotal3 * phaseofftotal3)/(burstnum3-1)))/(burstnum3-2); phaseonsd3 := sqrt(phaseonsd3); phaseoffsd3 := sqrt(phaseoffsd3); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean3 := periodtotal3/(burstnum3-1); frequencymean3 := frequencytotal3/(burstnum3-1); periodsd3 := ((sqperiodtotal3) - ((periodtotal3*periodtotal3)/(burstnum3-1)))/(burstnum3-2); frequencysd3 := ((sqfrequencytotal3) - ((frequencytotal3*frequencytotal3)/(burstnum3-1)))/(burstnum3-2); periodsd3 := sqrt(periodsd3); frequencysd3 := sqrt(frequencysd3); '********************************************************************************************************************************** 'printing the neuron summary for neuron 3 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname3$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum3, durationmean3, spikenummean3, freqmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd3, spikenumsd3, freqsd3); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean3, frequencymean3); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd3, frequencysd3); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean3, phaseoffmean3); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd3, phaseoffsd3); '******************** FOR PHASEPLOT phaseon[3]:=phaseonmean3; phaseoff[3]:=phaseoffmean3; stdOFF[3]:=phaseoffsd3; stdon[3]:=phaseonsd3; name$[3]:=neuronname3$; spikesperburst[3]:=spikenummean3; spikesperburstSD[3]:=spikenumsd3; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname3$, burstnum3, durationmean3, spikenummean3, freqmean3, periodmean3, frequencymean3, phaseonmean3, phaseoffmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd3, spikenumsd3, freqsd3, periodsd3, frequencysd3, phaseonsd3, phaseoffsd3); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WRITING DATA IF 4 NEURONS ANALYZED if number1% = 4 then burstnum4 :=0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationtotal2 :=0; spikenumtotal2 :=0; freqtotal2 :=0; durationtotal3 :=0; spikenumtotal3 :=0; freqtotal3 :=0; durationtotal4 :=0; spikenumtotal4 :=0; freqtotal4 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; durationmean2 :=0; spikenummean2 :=0; freqmean2 :=0; durationmean3 :=0; spikenummean3 :=0; freqmean3 :=0; durationmean4 :=0; spikenummean4 :=0; freqmean4 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; sqdurationtotal2 :=0; sqspikenumtotal2 :=0; sqfreqtotal2 :=0; sqdurationtotal3 :=0; sqspikenumtotal3 :=0; sqfreqtotal3 :=0; sqdurationtotal4 :=0; sqspikenumtotal4 :=0; sqfreqtotal4 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; durationsd2 :=0; spikenumsd2 :=0; freqsd2 :=0; durationsd3 :=0; spikenumsd3 :=0; freqsd3 :=0; durationsd4 :=0; spikenumsd4 :=0; freqsd4 :=0; phaseontotal1 :=0; sqphaseontotal1 :=0; phaseofftotal1 :=0; sqphaseofftotal1 :=0; phaseontotal2 :=0; sqphaseontotal2 :=0; phaseofftotal2 :=0; sqphaseofftotal2 :=0; phaseontotal3 :=0; sqphaseontotal3 :=0; phaseofftotal3 :=0; sqphaseofftotal3 :=0; phaseontotal4 :=0; sqphaseontotal4 :=0; phaseofftotal4 :=0; sqphaseofftotal4 :=0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; periodtotal2 :=0; frequencytotal2 :=0; sqperiodtotal2 :=0; sqfrequencytotal2 :=0; periodmean2 :=0; frequencymean2 :=0; periodsd2 :=0; frequencysd2 :=0; periodtotal3 :=0; frequencytotal3 :=0; sqperiodtotal3 :=0; sqfrequencytotal3 :=0; periodmean3 :=0; frequencymean3 :=0; periodsd3 :=0; frequencysd3 :=0; periodtotal4 :=0; frequencytotal4 :=0; sqperiodtotal4 :=0; sqfrequencytotal4 :=0; periodmean4 :=0; frequencymean4 :=0; periodsd4 :=0; frequencysd4 :=0; '******************************************************************************* ''Begin analysis/writing for neuron 1 of 4 while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalysePeriod1(sBurst1, eBurst1); AnalysePhase3(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4); burstnum4 :=1+burstnum4; '************************************************************************************ if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum4, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results5[resNormSNeuron1%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results5[resNormSNeuron1%], results5[resNormENeuron1%]); endif; endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 and results5[resNormSNeuron1%] > -777 AND burstnum4 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname1$, burstnum4, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results5[resNormSNeuron1%], results5[resNormENeuron1%]);endif; if results12[resPeriod1%] > -777 and results3[resNormSNeuron1%] > -777 AND burstnum4 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum4, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results5[resNormSNeuron1%], results5[resNormENeuron1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum4, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); if results5[resNormSNeuron1%] > -777 then phaseontotal1 := phaseontotal1 + results5[resNormSNeuron1%]; phaseofftotal1 := phaseofftotal1 + results5[resNormENeuron1%]; sqphaseontotal1 :=sqphaseontotal1 + (results5[resNormSNeuron1%] * results5[resNormSNeuron1%]); sqphaseofftotal1 := sqphaseofftotal1 + (results5[resNormENeuron1%] * results5[resNormENeuron1%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum4; spikenummean1 := spikenumtotal1/burstnum4; freqmean1 := freqtotal1 /burstnum4; phaseonmean1 := phaseontotal1/(burstnum4-1); phaseoffmean1 := phaseofftotal1/(burstnum4-1); 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/burstnum4))/(burstnum4-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/burstnum4))/(burstnum4-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/burstnum4))/(burstnum4-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); phaseonsd1 :=((sqphaseontotal1) - ((phaseontotal1 * phaseontotal1)/(burstnum4-1)))/(burstnum4-2); phaseoffsd1 :=((sqphaseofftotal1) - ((phaseofftotal1 * phaseofftotal1)/(burstnum4-1)))/(burstnum4-2); phaseonsd1 := sqrt(phaseonsd1); phaseoffsd1 := sqrt(phaseoffsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum4-1); frequencymean1 := frequencytotal1/burstnum4; periodsd1 := ((sqperiodtotal1) - ((periodtotal1*periodtotal1)/(burstnum4-1)))/(burstnum4-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1*frequencytotal1)/(burstnum4-1)))/(burstnum4-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum4, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean1, phaseoffmean1); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd1, phaseoffsd1); '******************** FOR PHASEPLOT phaseon[1]:=phaseonmean1; phaseoff[1]:=phaseoffmean1; stdOFF[1]:=phaseoffsd1; stdon[1]:=phaseonsd1; name$[1]:=neuronname1$; spikesperburst[1]:=spikenummean1; spikesperburstSD[1]:=spikenumsd1; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname1$, burstnum4, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1, phaseonmean1, phaseoffmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1, phaseonsd1, phaseoffsd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '************************************************************************** 'Begin analysis/writing for neuron 2 of 4 burstnum4 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalysePeriod2(sBurst2, eBurst2); AnalysePhase3(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4); burstnum4 :=1+burstnum4; '************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname2$, burstnum4, sBurst2, eBurst2); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%]); '************************************************************************************************* 'COMPUTE PERIOD if results13[resPeriod2%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results13[resPeriod2%], results13[resFrequency2%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results5[resNormSNeuron2%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results5[resNormSNeuron2%], results5[resNormENeuron2%]); endif; endif; if summary% =0 AND xlv% =1 then if results13[resPeriod2%] > -777 and results5[resNormSNeuron2%] > -777 AND burstnum4 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname2$, burstnum4, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%], results5[resNormSNeuron2%], results5[resNormENeuron2%]);endif; if results13[resPeriod2%] > -777 and results5[resNormSNeuron2%] > -777 AND burstnum4 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum4, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%], results5[resNormSNeuron2%], results5[resNormENeuron2%]);endif; if results13[resPeriod2%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum4, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal2 := durationtotal2 + results2[resDuration2%]; spikenumtotal2 := spikenumtotal2 + results2[resSpikes2%]; freqtotal2 := freqtotal2 + results2[resSpikeFreq2%]; sqdurationtotal2 := sqdurationtotal2 + (results2[resDuration2%] * results2[resDuration2%]); sqspikenumtotal2 := sqspikenumtotal2 + (results2[resSpikes2%] * results2[resSpikes2%]); sqfreqtotal2 := sqfreqtotal2 + (results2[resSpikeFreq2%] * results2[resSpikeFreq2%]); if results5[resNormSNeuron2%] > -777 then phaseontotal2 := phaseontotal2 + results5[resNormSNeuron2%]; phaseofftotal2 := phaseofftotal2 + results5[resNormENeuron2%]; sqphaseontotal2 :=sqphaseontotal2 + (results5[resNormSNeuron2%] * results5[resNormSNeuron2%]); sqphaseofftotal2 := sqphaseofftotal2 + (results5[resNormENeuron2%] * results5[resNormENeuron2%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results13[resPeriod2%] > -777 then periodtotal2 := periodtotal2 + results13[resPeriod2%]; frequencytotal2 := frequencytotal2 + results13[resFrequency2%]; sqperiodtotal2 := sqperiodtotal2 + (results13[resPeriod2%] * results13[resPeriod2%]); sqfrequencytotal2 := sqfrequencytotal2 + (results13[resFrequency2%] * results13[resFrequency2%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean2 := durationtotal2/burstnum4; spikenummean2 := spikenumtotal2/burstnum4; freqmean2 := freqtotal2 /burstnum4; phaseonmean2 := phaseontotal2/(burstnum4-1); phaseoffmean2 := phaseofftotal2/(burstnum4-1); 'calculating the standard devs for the bursts... durationsd2 := ((sqdurationtotal2) - ((durationtotal2*durationtotal2)/burstnum4))/(burstnum4-1); spikenumsd2 := ((sqspikenumtotal2) - ((spikenumtotal2*spikenumtotal2)/burstnum4))/(burstnum4-1); freqsd2 := ((sqfreqtotal2) - ((freqtotal2*freqtotal2)/burstnum4))/(burstnum4-1); durationsd2 := sqrt(durationsd2); spikenumsd2 := sqrt(spikenumsd2); freqsd2 := sqrt(freqsd2); phaseonsd2 :=((sqphaseontotal2) - ((phaseontotal2 * phaseontotal2)/(burstnum4-1)))/(burstnum4-2); phaseoffsd2 :=((sqphaseofftotal2) - ((phaseofftotal2 * phaseofftotal2)/(burstnum4-1)))/(burstnum4-2); phaseonsd2 := sqrt(phaseonsd2); phaseoffsd2 := sqrt(phaseoffsd2); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean2 := periodtotal2/(burstnum4-1); frequencymean2 := frequencytotal2/burstnum4; periodsd2 := ((sqperiodtotal2) - ((periodtotal2*periodtotal2)/(burstnum4-1)))/(burstnum4-2); frequencysd2 := ((sqfrequencytotal2) - ((frequencytotal2*frequencytotal2)/(burstnum4-1)))/(burstnum4-2); periodsd2 := sqrt(periodsd2); frequencysd2 := sqrt(frequencysd2); '********************************************************************************************************************************** 'printing the neuron summary for neuron 2 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname2$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum4, durationmean2, spikenummean2, freqmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd2, spikenumsd2, freqsd2); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean2, frequencymean2); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd2, frequencysd2); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean2, phaseoffmean2); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd2, phaseoffsd2); '******************** FOR PHASEPLOT phaseon[2]:=phaseonmean2; phaseoff[2]:=phaseoffmean2; stdOFF[2]:=phaseoffsd2; stdon[2]:=phaseonsd2; name$[2]:=neuronname2$; spikesperburst[2]:=spikenummean2; spikesperburstSD[2]:=spikenumsd2; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname2$, burstnum4, durationmean2, spikenummean2, freqmean2, periodmean2, frequencymean2, phaseonmean2, phaseoffmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd2, spikenumsd2, freqsd2, periodsd2, frequencysd2, phaseonsd2, phaseoffsd2); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '*************************************************************************************** 'Begin analysis/writing for neuron 3 of 4 burstnum4 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalysePeriod3(sBurst3, eBurst3); AnalysePhase3(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4); burstnum4 :=1+burstnum4; '************************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname3$, burstnum4, sBurst3, eBurst3); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%]); '************************************************************************************************* 'COMPUTE PERIOD if results14[resPeriod3%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results14[resPeriod3%], results14[resFrequency3%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results5[resNormSNeuron3%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results5[resNormSNeuron3%], results5[resNormENeuron3%]); endif; endif; if summary% =0 AND xlv% =1 then if results14[resPeriod3%] > -777 and results5[resNormSNeuron3%] > -777 AND burstnum4 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname3$, burstnum4, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%], results5[resNormSNeuron3%], results5[resNormENeuron3%]);endif; if results14[resPeriod3%] > -777 and results5[resNormSNeuron3%] > -777 AND burstnum4 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum4, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%], results5[resNormSNeuron3%], results5[resNormENeuron3%]);endif; if results14[resPeriod3%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum4, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal3 := durationtotal3 + results3[resDuration3%]; spikenumtotal3 := spikenumtotal3 + results3[resSpikes3%]; freqtotal3 := freqtotal3 + results3[resSpikeFreq3%]; sqdurationtotal3 := sqdurationtotal3 + (results3[resDuration3%] * results3[resDuration3%]); sqspikenumtotal3 := sqspikenumtotal3 + (results3[resSpikes3%] * results3[resSpikes3%]); sqfreqtotal3 := sqfreqtotal3 + (results3[resSpikeFreq3%] * results3[resSpikeFreq3%]); if results5[resNormSNeuron3%] > -777 then phaseontotal3 := phaseontotal3 + results5[resNormSNeuron3%]; phaseofftotal3 := phaseofftotal3 + results5[resNormENeuron3%]; sqphaseontotal3 :=sqphaseontotal3 + (results5[resNormSNeuron3%] * results5[resNormSNeuron3%]); sqphaseofftotal3 := sqphaseofftotal3 + (results5[resNormENeuron3%] * results5[resNormENeuron3%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results14[resPeriod3%] > -777 then periodtotal3 := periodtotal3 + results14[resPeriod3%]; frequencytotal3 := frequencytotal3 + results14[resFrequency3%]; sqperiodtotal3 := sqperiodtotal3 + (results14[resPeriod3%] * results14[resPeriod3%]); sqfrequencytotal3 := sqfrequencytotal3 + (results14[resFrequency3%] * results14[resFrequency3%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean3 := durationtotal3/burstnum4; spikenummean3 := spikenumtotal3/burstnum4; freqmean3 := freqtotal3 /burstnum4; phaseonmean3 := phaseontotal3/(burstnum4-1); phaseoffmean3 := phaseofftotal3/(burstnum4-1); 'calculating the standard devs for the bursts... durationsd3 := ((sqdurationtotal3) - ((durationtotal3*durationtotal3)/burstnum4))/(burstnum4-1); spikenumsd3 := ((sqspikenumtotal3) - ((spikenumtotal3*spikenumtotal3)/burstnum4))/(burstnum4-1); freqsd3 := ((sqfreqtotal3) - ((freqtotal3*freqtotal3)/burstnum4))/(burstnum4-1); durationsd3 := sqrt(durationsd3); spikenumsd3 := sqrt(spikenumsd3); freqsd3 := sqrt(freqsd3); phaseonsd3 :=((sqphaseontotal3) - ((phaseontotal3 * phaseontotal3)/(burstnum4-1)))/(burstnum4-2); phaseoffsd3 :=((sqphaseofftotal3) - ((phaseofftotal3 * phaseofftotal3)/(burstnum4-1)))/(burstnum4-2); phaseonsd3 := sqrt(phaseonsd3); phaseoffsd3 := sqrt(phaseoffsd3); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean3 := periodtotal3/(burstnum4-1); frequencymean3 := frequencytotal3/(burstnum4-1); periodsd3 := ((sqperiodtotal3) - ((periodtotal3*periodtotal3)/(burstnum4-1)))/(burstnum4-2); frequencysd3 := ((sqfrequencytotal3) - ((frequencytotal3*frequencytotal3)/(burstnum4-1)))/(burstnum4-2); periodsd3 := sqrt(periodsd3); frequencysd3 := sqrt(frequencysd3); '********************************************************************************************************************************** 'printing the neuron summary for neuron 3 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname3$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum4, durationmean3, spikenummean3, freqmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd3, spikenumsd3, freqsd3); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean3, frequencymean3); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd3, frequencysd3); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean3, phaseoffmean3); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd3, phaseoffsd3); '******************** FOR PHASEPLOT phaseon[3]:=phaseonmean3; phaseoff[3]:=phaseoffmean3; stdOFF[3]:=phaseoffsd3; stdon[3]:=phaseonsd3; name$[3]:=neuronname3$; spikesperburst[3]:=spikenummean3; spikesperburstSD[3]:=spikenumsd3; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname3$, burstnum4, durationmean3, spikenummean3, freqmean3, periodmean3, frequencymean3, phaseonmean3, phaseoffmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd3, spikenumsd3, freqsd3, periodsd3, frequencysd3, phaseonsd3, phaseoffsd3); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '***************************************************************************** 'Begin analysis/writing for neuron 4 of 4 burstnum4 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalysePeriod4(sBurst4, eburst4); AnalysePhase3(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4); burstnum4 :=1+burstnum4; '************************************************************************************ if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname4$, burstnum4, sBurst4, eBurst4); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%]); '************************************************************************************************* 'COMPUTE PERIOD if results15[resPeriod4%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results15[resPeriod4%], results15[resFrequency4%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results5[resNormSNeuron4%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results5[resNormSNeuron4%], results5[resNormENeuron4%]); endif; endif; if summary% =0 AND xlv% =1 then if results15[resPeriod4%] > -777 and results5[resNormSNeuron4%] > -777 AND burstnum4 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname4$, burstnum4, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%], results5[resNormSNeuron4%], results5[resNormENeuron4%]);endif; if results15[resPeriod4%] > -777 and results5[resNormSNeuron4%] > -777 AND burstnum4 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum4, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%], results5[resNormSNeuron4%], results5[resNormENeuron4%]);endif; if results15[resPeriod4%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum4, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal4 := durationtotal4 + results4[resDuration4%]; spikenumtotal4 := spikenumtotal4 + results4[resSpikes4%]; freqtotal4 := freqtotal4 + results4[resSpikeFreq4%]; sqdurationtotal4 := sqdurationtotal4 + (results4[resDuration4%] * results4[resDuration4%]); sqspikenumtotal4 := sqspikenumtotal4 + (results4[resSpikes4%] * results4[resSpikes4%]); sqfreqtotal4 := sqfreqtotal4 + (results4[resSpikeFreq4%] * results4[resSpikeFreq4%]); if results5[resNormSNeuron4%] > -777 then phaseontotal4 := phaseontotal4 + results5[resNormSNeuron4%]; phaseofftotal4 := phaseofftotal4 + results5[resNormENeuron4%]; sqphaseontotal4 :=sqphaseontotal4 + (results5[resNormSNeuron4%] * results5[resNormSNeuron4%]); sqphaseofftotal4 := sqphaseofftotal4 + (results5[resNormENeuron4%] * results5[resNormENeuron4%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results15[resPeriod4%] > -777 then periodtotal4 := periodtotal4 + results15[resPeriod4%]; frequencytotal4 := frequencytotal4 + results15[resFrequency4%]; sqperiodtotal4 := sqperiodtotal4 + (results15[resPeriod4%] * results15[resPeriod4%]); sqfrequencytotal4 := sqfrequencytotal4 + (results15[resFrequency4%] * results15[resFrequency4%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean4 := durationtotal4/burstnum4; spikenummean4 := spikenumtotal4/burstnum4; freqmean4 := freqtotal4 /burstnum4; phaseonmean4 := phaseontotal4/(burstnum4-1); phaseoffmean4 := phaseofftotal4/(burstnum4-1); 'calculating the standard devs for the bursts... durationsd4 := ((sqdurationtotal4) - ((durationtotal4*durationtotal4)/burstnum4))/(burstnum4-1); spikenumsd4 := ((sqspikenumtotal4) - ((spikenumtotal4*spikenumtotal4)/burstnum4))/(burstnum4-1); freqsd4 := ((sqfreqtotal4) - ((freqtotal4*freqtotal4)/burstnum4))/(burstnum4-1); durationsd4 := sqrt(durationsd4); spikenumsd4 := sqrt(spikenumsd4); freqsd4 := sqrt(freqsd4); phaseonsd4 :=((sqphaseontotal4) - ((phaseontotal4 * phaseontotal4)/(burstnum4-1)))/(burstnum4-2); phaseoffsd4 :=((sqphaseofftotal4) - ((phaseofftotal4 * phaseofftotal4)/(burstnum4-1)))/(burstnum4-2); phaseonsd4 := sqrt(phaseonsd4); phaseoffsd4 := sqrt(phaseoffsd4); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean4 := periodtotal4/(burstnum4-1); frequencymean4 := frequencytotal4/(burstnum4-1); periodsd4 := ((sqperiodtotal4) - ((periodtotal4*periodtotal4)/(burstnum4-1)))/(burstnum4-2); frequencysd4 := ((sqfrequencytotal4) - ((frequencytotal4*frequencytotal4)/(burstnum4-1)))/(burstnum4-2); periodsd4 := sqrt(periodsd4); frequencysd4 := sqrt(frequencysd4); '********************************************************************************************************************************** 'printing the neuron summary for neuron 4 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname4$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum4, durationmean4, spikenummean4, freqmean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd4, spikenumsd4, freqsd4); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean4, frequencymean4); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd4, frequencysd4); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean4, phaseoffmean4); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd4, phaseoffsd4); '******************** FOR PHASEPLOT phaseon[4]:=phaseonmean4; phaseoff[4]:=phaseoffmean4; stdOFF[4]:=phaseoffsd4; stdon[4]:=phaseonsd4; name$[4]:=neuronname4$; spikesperburst[4]:=spikenummean4; spikesperburstSD[4]:=spikenumsd4; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname4$, burstnum4, durationmean4, spikenummean4, freqmean4, periodmean4, frequencymean4, phaseonmean4, phaseoffmean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd4, spikenumsd4, freqsd4, periodsd4, frequencysd4, phaseonsd4, phaseoffsd4); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WRITING DATA IF 5 NEURONS ANALYZED if number1% = 5 then burstnum5 :=0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationtotal2 :=0; spikenumtotal2 :=0; freqtotal2 :=0; durationtotal3 :=0; spikenumtotal3 :=0; freqtotal3 :=0; durationtotal4 :=0; spikenumtotal4 :=0; freqtotal4 :=0; durationtotal5 :=0; spikenumtotal5 :=0; freqtotal5 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; durationmean2 :=0; spikenummean2 :=0; freqmean2 :=0; durationmean3 :=0; spikenummean3 :=0; freqmean3 :=0; durationmean4 :=0; spikenummean4 :=0; freqmean4 :=0; durationmean5 :=0; spikenummean5 :=0; freqmean5 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; sqdurationtotal2 :=0; sqspikenumtotal2 :=0; sqfreqtotal2 :=0; sqdurationtotal3 :=0; sqspikenumtotal3 :=0; sqfreqtotal3 :=0; sqdurationtotal4 :=0; sqspikenumtotal4 :=0; sqfreqtotal4 :=0; sqdurationtotal5 :=0; sqspikenumtotal5 :=0; sqfreqtotal5 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; durationsd2 :=0; spikenumsd2 :=0; freqsd2 :=0; durationsd3 :=0; spikenumsd3 :=0; freqsd3 :=0; durationsd4 :=0; spikenumsd4 :=0; freqsd4 :=0; durationsd5 :=0; spikenumsd5 :=0; freqsd5 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; phaseontotal1 :=0; sqphaseontotal1 :=0; phaseofftotal1 :=0; sqphaseofftotal1 :=0; phaseontotal2 :=0; sqphaseontotal2 :=0; phaseofftotal2 :=0; sqphaseofftotal2 :=0; phaseontotal3 :=0; sqphaseontotal3 :=0; phaseofftotal3 :=0; sqphaseofftotal3 :=0; phaseontotal4 :=0; sqphaseontotal4 :=0; phaseofftotal4 :=0; sqphaseofftotal4 :=0; phaseontotal5 :=0; sqphaseontotal5 :=0; phaseofftotal5 :=0; sqphaseofftotal5 :=0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; periodtotal2 :=0; frequencytotal2 :=0; sqperiodtotal2 :=0; sqfrequencytotal2 :=0; periodmean2 :=0; frequencymean2 :=0; periodsd2 :=0; frequencysd2 :=0; periodtotal3 :=0; frequencytotal3 :=0; sqperiodtotal3 :=0; sqfrequencytotal3 :=0; periodmean3 :=0; frequencymean3 :=0; periodsd3 :=0; frequencysd3 :=0; periodtotal4 :=0; frequencytotal4 :=0; sqperiodtotal4 :=0; sqfrequencytotal4 :=0; periodmean4 :=0; frequencymean4 :=0; periodsd4 :=0; frequencysd4 :=0; periodtotal5 :=0; frequencytotal5 :=0; sqperiodtotal5 :=0; sqfrequencytotal5 :=0; periodmean5 :=0; frequencymean5 :=0; periodsd5 :=0; frequencysd5 :=0; '********************************************************************************* 'Begin analysis/writing for neuron 1 of 5 while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalysePeriod1(sBurst1, eBurst1); AnalysePhase4(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5); burstnum5 :=1+burstnum5; '******************************************************************************************* if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum5, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results6[resNormSNeuron1%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results6[resNormSNeuron1%], results6[resNormENeuron1%]); endif; endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 and results6[resNormSNeuron1%] > -777 AND burstnum5 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname1$, burstnum5, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results6[resNormSNeuron1%], results6[resNormENeuron1%]);endif; if results12[resPeriod1%] > -777 and results6[resNormSNeuron1%] > -777 AND burstnum5 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum5, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results6[resNormSNeuron1%], results6[resNormENeuron1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum5, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); if results6[resNormSNeuron1%] > -777 then phaseontotal1 := phaseontotal1 + results6[resNormSNeuron1%]; phaseofftotal1 := phaseofftotal1 + results6[resNormENeuron1%]; sqphaseontotal1 :=sqphaseontotal1 + (results6[resNormSNeuron1%] * results6[resNormSNeuron1%]); sqphaseofftotal1 := sqphaseofftotal1 + (results6[resNormENeuron1%] * results6[resNormENeuron1%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum5; spikenummean1 := spikenumtotal1/burstnum5; freqmean1 := freqtotal1 /burstnum5; phaseonmean1 := phaseontotal1/(burstnum5-1); phaseoffmean1 := phaseofftotal1/(burstnum5-1); 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/burstnum5))/(burstnum5-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/burstnum5))/(burstnum5-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/burstnum5))/(burstnum5-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); phaseonsd1 :=((sqphaseontotal1) - ((phaseontotal1 * phaseontotal1)/(burstnum5-1)))/(burstnum5-2); phaseoffsd1 :=((sqphaseofftotal1) - ((phaseofftotal1 * phaseofftotal1)/(burstnum5-1)))/(burstnum5-2); phaseonsd1 := sqrt(phaseonsd1); phaseoffsd1 := sqrt(phaseoffsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum5-1); frequencymean1 := frequencytotal1/(burstnum5-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1*periodtotal1)/(burstnum5-1)))/(burstnum5-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1*frequencytotal1)/(burstnum5-1)))/(burstnum5-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum5, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean1, phaseoffmean1); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd1, phaseoffsd1); '******************** FOR PHASEPLOT phaseon[1]:=phaseonmean1; phaseoff[1]:=phaseoffmean1; stdOFF[1]:=phaseoffsd1; stdon[1]:=phaseonsd1; name$[1]:=neuronname1$; spikesperburst[1]:=spikenummean1; spikesperburstSD[1]:=spikenumsd1; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname1$, burstnum5, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1, phaseonmean1, phaseoffmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1, phaseonsd1, phaseoffsd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '**************************************************************************************** 'Begin analysis/writing for neuron 2 of 5 burstnum5 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalysePeriod2(sBurst2, eBurst2); AnalysePhase4(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5); burstnum5 :=1+burstnum5; '************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname2$, burstnum5, sBurst2, eBurst2); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%]); '************************************************************************************************* 'COMPUTE PERIOD if results13[resPeriod2%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results13[resPeriod2%], results13[resFrequency2%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results6[resNormSNeuron2%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results6[resNormSNeuron2%], results6[resNormENeuron2%]); endif; endif; if summary% =0 AND xlv% =1 then if results13[resPeriod2%] > -777 and results6[resNormSNeuron2%] > -777 AND burstnum5 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname2$, burstnum5, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%], results6[resNormSNeuron2%], results6[resNormENeuron2%]);endif; if results13[resPeriod2%] > -777 and results6[resNormSNeuron2%] > -777 AND burstnum5 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum5, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%], results6[resNormSNeuron2%], results6[resNormENeuron2%]);endif; if results13[resPeriod2%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum5, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal2 := durationtotal2 + results2[resDuration2%]; spikenumtotal2 := spikenumtotal2 + results2[resSpikes2%]; freqtotal2 := freqtotal2 + results2[resSpikeFreq2%]; sqdurationtotal2 := sqdurationtotal2 + (results2[resDuration2%] * results2[resDuration2%]); sqspikenumtotal2 := sqspikenumtotal2 + (results2[resSpikes2%] * results2[resSpikes2%]); sqfreqtotal2 := sqfreqtotal2 + (results2[resSpikeFreq2%] * results2[resSpikeFreq2%]); if results6[resNormSNeuron2%] > -777 then phaseontotal2 := phaseontotal2 + results6[resNormSNeuron2%]; phaseofftotal2 := phaseofftotal2 + results6[resNormENeuron2%]; sqphaseontotal2 :=sqphaseontotal2 + (results6[resNormSNeuron2%] * results6[resNormSNeuron2%]); sqphaseofftotal2 := sqphaseofftotal2 + (results6[resNormENeuron2%] * results6[resNormENeuron2%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results13[resPeriod2%] > -777 then periodtotal2 := periodtotal2 + results13[resPeriod2%]; frequencytotal2 := frequencytotal2 + results13[resFrequency2%]; sqperiodtotal2 := sqperiodtotal2 + (results13[resPeriod2%] * results13[resPeriod2%]); sqfrequencytotal2 := sqfrequencytotal2 + (results13[resFrequency2%] * results13[resFrequency2%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean2 := durationtotal2/burstnum5; spikenummean2 := spikenumtotal2/burstnum5; freqmean2 := freqtotal2 /burstnum5; phaseonmean2 := phaseontotal2/(burstnum5-1); phaseoffmean2 := phaseofftotal2/(burstnum5-1); 'calculating the standard devs for the bursts... durationsd2 := ((sqdurationtotal2) - ((durationtotal2*durationtotal2)/burstnum5))/(burstnum5-1); spikenumsd2 := ((sqspikenumtotal2) - ((spikenumtotal2*spikenumtotal2)/burstnum5))/(burstnum5-1); freqsd2 := ((sqfreqtotal2) - ((freqtotal2*freqtotal2)/burstnum5))/(burstnum5-1); durationsd2 := sqrt(durationsd2); spikenumsd2 := sqrt(spikenumsd2); freqsd2 := sqrt(freqsd2); phaseonsd2 :=((sqphaseontotal2) - ((phaseontotal2 * phaseontotal2)/(burstnum5-1)))/(burstnum5-2); phaseoffsd2 :=((sqphaseofftotal2) - ((phaseofftotal2 * phaseofftotal2)/(burstnum5-1)))/(burstnum5-2); phaseonsd2 := sqrt(phaseonsd2); phaseoffsd2 := sqrt(phaseoffsd2); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean2 := periodtotal2/(burstnum5-1); frequencymean2 := frequencytotal2/(burstnum5-1); periodsd2 := ((sqperiodtotal2) - ((periodtotal2*periodtotal2)/(burstnum5-1)))/(burstnum5-2); frequencysd2 := ((sqfrequencytotal2) - ((frequencytotal2*frequencytotal2)/(burstnum5-1)))/(burstnum5-2); periodsd2 := sqrt(periodsd2); frequencysd2 := sqrt(frequencysd2); '********************************************************************************************************************************** 'printing the neuron summary for neuron 2 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname2$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum5, durationmean2, spikenummean2, freqmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd2, spikenumsd2, freqsd2); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean2, frequencymean2); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd2, frequencysd2); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean2, phaseoffmean2); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd2, phaseoffsd2); '******************** FOR PHASEPLOT phaseon[2]:=phaseonmean2; phaseoff[2]:=phaseoffmean2; stdOFF[2]:=phaseoffsd2; stdon[2]:=phaseonsd2; name$[2]:=neuronname2$; spikesperburst[2]:=spikenummean2; spikesperburstSD[2]:=spikenumsd2; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname2$, burstnum5, durationmean2, spikenummean2, freqmean2, periodmean2, frequencymean2, phaseonmean2, phaseoffmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd2, spikenumsd2, freqsd2, periodsd2, frequencysd2, phaseonsd2, phaseoffsd2); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '******************************************************************************************* 'Begin analysis/writing for neuron 3 of 5 burstnum5 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalysePeriod3(sBurst3, eBurst3); AnalysePhase4(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5); burstnum5 :=1+burstnum5; '***************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname3$, burstnum5, sBurst3, eBurst3); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%]); '************************************************************************************************* 'COMPUTE PERIOD if results14[resPeriod3%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results14[resPeriod3%], results14[resFrequency3%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results6[resNormSNeuron3%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results6[resNormSNeuron3%], results6[resNormENeuron3%]); endif; endif; if summary% =0 AND xlv% =1 then if results14[resPeriod3%] > -777 and results6[resNormSNeuron3%] > -777 AND burstnum5 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname3$, burstnum5, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%], results6[resNormSNeuron3%], results6[resNormENeuron3%]);endif; if results14[resPeriod3%] > -777 and results6[resNormSNeuron3%] > -777 AND burstnum5 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum5, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%], results6[resNormSNeuron3%], results6[resNormENeuron3%]);endif; if results14[resPeriod3%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum5, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal3 := durationtotal3 + results3[resDuration3%]; spikenumtotal3 := spikenumtotal3 + results3[resSpikes3%]; freqtotal3 := freqtotal3 + results3[resSpikeFreq3%]; sqdurationtotal3 := sqdurationtotal3 + (results3[resDuration3%] * results3[resDuration3%]); sqspikenumtotal3 := sqspikenumtotal3 + (results3[resSpikes3%] * results3[resSpikes3%]); sqfreqtotal3 := sqfreqtotal3 + (results3[resSpikeFreq3%] * results3[resSpikeFreq3%]); if results6[resNormSNeuron3%] > -777 then phaseontotal3 := phaseontotal3 + results6[resNormSNeuron3%]; phaseofftotal3 := phaseofftotal3 + results6[resNormENeuron3%]; sqphaseontotal3 :=sqphaseontotal3 + (results6[resNormSNeuron3%] * results6[resNormSNeuron3%]); sqphaseofftotal3 := sqphaseofftotal3 + (results6[resNormENeuron3%] * results6[resNormENeuron3%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results14[resPeriod3%] > -777 then periodtotal3 := periodtotal3 + results14[resPeriod3%]; frequencytotal3 := frequencytotal3 + results14[resFrequency3%]; sqperiodtotal3 := sqperiodtotal3 + (results14[resPeriod3%] * results14[resPeriod3%]); sqfrequencytotal3 := sqfrequencytotal3 + (results14[resFrequency3%] * results14[resFrequency3%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean3 := durationtotal3/burstnum5; spikenummean3 := spikenumtotal3/burstnum5; freqmean3 := freqtotal3 /burstnum5; phaseonmean3 := phaseontotal3/(burstnum5-1); phaseoffmean3 := phaseofftotal3/(burstnum5-1); 'calculating the standard devs for the bursts... durationsd3 := ((sqdurationtotal3) - ((durationtotal3*durationtotal3)/burstnum5))/(burstnum5-1); spikenumsd3 := ((sqspikenumtotal3) - ((spikenumtotal3*spikenumtotal3)/burstnum5))/(burstnum5-1); freqsd3 := ((sqfreqtotal3) - ((freqtotal3*freqtotal3)/burstnum5))/(burstnum5-1); durationsd3 := sqrt(durationsd3); spikenumsd3 := sqrt(spikenumsd3); freqsd3 := sqrt(freqsd3); phaseonsd3 :=((sqphaseontotal3) - ((phaseontotal3 * phaseontotal3)/(burstnum5-1)))/(burstnum5-2); phaseoffsd3 :=((sqphaseofftotal3) - ((phaseofftotal3 * phaseofftotal3)/(burstnum5-1)))/(burstnum5-2); phaseonsd3 := sqrt(phaseonsd3); phaseoffsd3 := sqrt(phaseoffsd3); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean3 := periodtotal3/(burstnum5-1); frequencymean3 := frequencytotal3/(burstnum5-1); periodsd3 := ((sqperiodtotal3) - ((periodtotal3*periodtotal3)/(burstnum5-1)))/(burstnum5-2); frequencysd3 := ((sqfrequencytotal3) - ((frequencytotal3*frequencytotal3)/(burstnum5-1)))/(burstnum5-2); periodsd3 := sqrt(periodsd3); frequencysd3 := sqrt(frequencysd3); '********************************************************************************************************************************** 'printing the neuron summary for neuron 3 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname3$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum5, durationmean3, spikenummean3, freqmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd3, spikenumsd3, freqsd3); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean3, frequencymean3); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd3, frequencysd3); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean3, phaseoffmean3); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd3, phaseoffsd3); '******************** FOR PHASEPLOT phaseon[3]:=phaseonmean3; phaseoff[3]:=phaseoffmean3; stdOFF[3]:=phaseoffsd3; stdon[3]:=phaseonsd3; name$[3]:=neuronname3$; spikesperburst[3]:=spikenummean3; spikesperburstSD[3]:=spikenumsd3; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname3$, burstnum5, durationmean3, spikenummean3, freqmean3, periodmean3, frequencymean3, phaseonmean3, phaseoffmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd3, spikenumsd3, freqsd3, periodsd3, frequencysd3, phaseonsd3, phaseoffsd3); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '************************************************************************************** 'Begin analysis/writing for neuron 4 of 5 burstnum5 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalysePeriod4(sBurst4, eBurst4); AnalysePhase4(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5); burstnum5 :=1+burstnum5; '*************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname4$, burstnum5, sBurst4, eBurst4); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%]); '************************************************************************************************* 'COMPUTE PERIOD if results15[resPeriod4%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results15[resPeriod4%], results15[resFrequency4%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results6[resNormSNeuron4%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results6[resNormSNeuron4%], results6[resNormENeuron4%]); endif; endif; if summary% =0 AND xlv% =1 then if results15[resPeriod4%] > -777 and results6[resNormSNeuron4%] > -777 AND burstnum5 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname4$, burstnum5, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%], results6[resNormSNeuron4%], results6[resNormENeuron4%]);endif; if results15[resPeriod4%] > -777 and results6[resNormSNeuron4%] > -777 AND burstnum5 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum5, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%], results6[resNormSNeuron4%], results6[resNormENeuron4%]);endif; if results15[resPeriod4%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum5, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal4 := durationtotal4 + results4[resDuration4%]; spikenumtotal4 := spikenumtotal4 + results4[resSpikes4%]; freqtotal4 := freqtotal4 + results4[resSpikeFreq4%]; sqdurationtotal4 := sqdurationtotal4 + (results4[resDuration4%] * results4[resDuration4%]); sqspikenumtotal4 := sqspikenumtotal4 + (results4[resSpikes4%] * results4[resSpikes4%]); sqfreqtotal4 := sqfreqtotal4 + (results4[resSpikeFreq4%] * results4[resSpikeFreq4%]); if results6[resNormSNeuron4%] > -777 then phaseontotal4 := phaseontotal4 + results6[resNormSNeuron4%]; phaseofftotal4 := phaseofftotal4 + results6[resNormENeuron4%]; sqphaseontotal4 :=sqphaseontotal4 + (results6[resNormSNeuron4%] * results6[resNormSNeuron4%]); sqphaseofftotal4 := sqphaseofftotal4 + (results6[resNormENeuron4%] * results6[resNormENeuron4%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results15[resPeriod4%] > -777 then periodtotal4 := periodtotal4 + results15[resPeriod4%]; frequencytotal4 := frequencytotal4 + results15[resFrequency4%]; sqperiodtotal4 := sqperiodtotal4 + (results15[resPeriod4%] * results15[resPeriod4%]); sqfrequencytotal4 := sqfrequencytotal4 + (results15[resFrequency4%] * results15[resFrequency4%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean4 := durationtotal4/burstnum5; spikenummean4 := spikenumtotal4/burstnum5; freqmean4 := freqtotal4 /burstnum5; phaseonmean4 := phaseontotal4/(burstnum5-1); phaseoffmean4 := phaseofftotal4/(burstnum5-1); 'calculating the standard devs for the bursts... durationsd4 := ((sqdurationtotal4) - ((durationtotal4*durationtotal4)/burstnum5))/(burstnum5-1); spikenumsd4 := ((sqspikenumtotal4) - ((spikenumtotal4*spikenumtotal4)/burstnum5))/(burstnum5-1); freqsd4 := ((sqfreqtotal4) - ((freqtotal4*freqtotal4)/burstnum5))/(burstnum5-1); durationsd4 := sqrt(durationsd4); spikenumsd4 := sqrt(spikenumsd4); freqsd4 := sqrt(freqsd4); phaseonsd4 :=((sqphaseontotal4) - ((phaseontotal4 * phaseontotal4)/(burstnum5-1)))/(burstnum5-2); phaseoffsd4 :=((sqphaseofftotal4) - ((phaseofftotal4 * phaseofftotal4)/(burstnum5-1)))/(burstnum5-2); phaseonsd4 := sqrt(phaseonsd4); phaseoffsd4 := sqrt(phaseoffsd4); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean4 := periodtotal4/(burstnum5-1); frequencymean4 := frequencytotal4/(burstnum5-1); periodsd4 := ((sqperiodtotal4) - ((periodtotal4*periodtotal4)/(burstnum5-1)))/(burstnum5-2); frequencysd4 := ((sqfrequencytotal4) - ((frequencytotal4*frequencytotal4)/(burstnum5-1)))/(burstnum5-2); periodsd4 := sqrt(periodsd4); frequencysd4 := sqrt(frequencysd4); '********************************************************************************************************************************** 'printing the neuron summary for neuron 4 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname4$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum5, durationmean4, spikenummean4, freqmean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd4, spikenumsd4, freqsd4); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean4, frequencymean4); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd4, frequencysd4); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean4, phaseoffmean4); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd4, phaseoffsd4); '******************** FOR PHASEPLOT phaseon[4]:=phaseonmean4; phaseoff[4]:=phaseoffmean4; stdOFF[4]:=phaseoffsd4; stdon[4]:=phaseonsd4; name$[4]:=neuronname4$; spikesperburst[4]:=spikenummean4; spikesperburstSD[4]:=spikenumsd4; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname4$, burstnum5, durationmean4, spikenummean4, freqmean4, periodmean4, frequencymean4, phaseonmean4, phaseoffmean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd4, spikenumsd4, freqsd4, periodsd4, frequencysd4, phaseonsd4, phaseoffsd4); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '*************************************************************************************** 'Begin analysis/writing for neuron 5 of 5 burstnum5 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalysePeriod5(sBurst5, eBurst5); AnalysePhase4(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5); burstnum5 :=1+burstnum5; '**************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname5$, burstnum5, sBurst5, eBurst5); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%]); '************************************************************************************************* 'COMPUTE PERIOD if results16[resPeriod5%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results16[resPeriod5%], results16[resFrequency5%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results6[resNormSNeuron5%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results6[resNormSNeuron5%], results6[resNormENeuron5%]); endif; endif; if summary% =0 AND xlv% =1 then if results16[resPeriod5%] > -777 and results6[resNormSNeuron5%] > -777 AND burstnum5 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname5$, burstnum5, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%],results16[resPeriod5%], results16[resFrequency5%], results6[resNormSNeuron5%], results6[resNormENeuron5%]);endif; if results16[resPeriod5%] > -777 and results6[resNormSNeuron5%] > -777 AND burstnum5 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum5, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%],results16[resPeriod5%], results16[resFrequency5%], results6[resNormSNeuron5%], results6[resNormENeuron5%]);endif; if results16[resPeriod5%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum5, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal5 := durationtotal5 + results5[resDuration5%]; spikenumtotal5 := spikenumtotal5 + results5[resSpikes5%]; freqtotal5 := freqtotal5 + results5[resSpikeFreq5%]; sqdurationtotal5 := sqdurationtotal5 + (results5[resDuration5%] * results5[resDuration5%]); sqspikenumtotal5 := sqspikenumtotal5 + (results5[resSpikes5%] * results5[resSpikes5%]); sqfreqtotal5 := sqfreqtotal5 + (results5[resSpikeFreq5%] * results5[resSpikeFreq5%]); if results6[resNormSNeuron5%] > -777 then phaseontotal5 := phaseontotal5 + results6[resNormSNeuron5%]; phaseofftotal5 := phaseofftotal5 + results6[resNormENeuron5%]; sqphaseontotal5 :=sqphaseontotal5 + (results6[resNormSNeuron5%] * results6[resNormSNeuron5%]); sqphaseofftotal5 := sqphaseofftotal5 + (results6[resNormENeuron5%] * results6[resNormENeuron5%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results16[resPeriod5%] > -777 then periodtotal5 := periodtotal5 + results16[resPeriod5%]; frequencytotal5 := frequencytotal5 + results16[resFrequency5%]; sqperiodtotal5 := sqperiodtotal5 + (results16[resPeriod5%] * results16[resPeriod5%]); sqfrequencytotal5 := sqfrequencytotal5 + (results16[resFrequency5%] * results16[resFrequency5%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean5 := durationtotal5/burstnum5; spikenummean5 := spikenumtotal5/burstnum5; freqmean5 := freqtotal5 /burstnum5; phaseonmean5 := phaseontotal5/(burstnum5-1); phaseoffmean5 := phaseofftotal5/(burstnum5-1); 'calculating the standard devs for the bursts... durationsd5 := ((sqdurationtotal5) - ((durationtotal5*durationtotal5)/burstnum5))/(burstnum5-1); spikenumsd5 := ((sqspikenumtotal5) - ((spikenumtotal5*spikenumtotal5)/burstnum5))/(burstnum5-1); freqsd5 := ((sqfreqtotal5) - ((freqtotal5*freqtotal5)/burstnum5))/(burstnum5-1); durationsd5 := sqrt(durationsd5); spikenumsd5 := sqrt(spikenumsd5); freqsd5 := sqrt(freqsd5); phaseonsd5 :=((sqphaseontotal5) - ((phaseontotal5 * phaseontotal5)/(burstnum5-1)))/(burstnum5-2); phaseoffsd5 :=((sqphaseofftotal5) - ((phaseofftotal5 * phaseofftotal5)/(burstnum5-1)))/(burstnum5-2); phaseonsd5 := sqrt(phaseonsd5); phaseoffsd5 := sqrt(phaseoffsd5); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean5 := periodtotal5/(burstnum5-1); frequencymean5 := frequencytotal5/(burstnum5-1); periodsd5 := ((sqperiodtotal5) - ((periodtotal5*periodtotal5)/(burstnum5-1)))/(burstnum5-2); frequencysd5 := ((sqfrequencytotal5) - ((frequencytotal5*frequencytotal5)/(burstnum5-1)))/(burstnum5-2); periodsd5 := sqrt(periodsd5); frequencysd5 := sqrt(frequencysd5); '********************************************************************************************************************************** 'printing the neuron summary for neuron 5 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname5$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum5, durationmean5, spikenummean5, freqmean5); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd5, spikenumsd5, freqsd5); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean5, frequencymean5); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd5, frequencysd5); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean5, phaseoffmean5); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd5, phaseoffsd5); '******************** FOR PHASEPLOT phaseon[5]:=phaseonmean5; phaseoff[5]:=phaseoffmean5; stdOFF[5]:=phaseoffsd5; stdon[5]:=phaseonsd5; name$[5]:=neuronname5$; spikesperburst[5]:=spikenummean5; spikesperburstSD[5]:=spikenumsd5; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname5$, burstnum5, durationmean5, spikenummean5, freqmean5, periodmean5, frequencymean5, phaseonmean5, phaseoffmean5); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd5, spikenumsd5, freqsd5, periodsd5, frequencysd5, phaseonsd5, phaseoffsd5); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WRITING DATA IF 6 NEURONS ANALYZED if number1% = 6 then burstnum6 :=0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationtotal2 :=0; spikenumtotal2 :=0; freqtotal2 :=0; durationtotal3 :=0; spikenumtotal3 :=0; freqtotal3 :=0; durationtotal4 :=0; spikenumtotal4 :=0; freqtotal4 :=0; durationtotal5 :=0; spikenumtotal5 :=0; freqtotal5 :=0; durationtotal6 :=0; spikenumtotal6 :=0; freqtotal6 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; durationmean2 :=0; spikenummean2 :=0; freqmean2 :=0; durationmean3 :=0; spikenummean3 :=0; freqmean3 :=0; durationmean4 :=0; spikenummean4 :=0; freqmean4 :=0; durationmean5 :=0; spikenummean5 :=0; freqmean5 :=0; durationmean6 :=0; spikenummean6 :=0; freqmean6 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; sqdurationtotal2 :=0; sqspikenumtotal2 :=0; sqfreqtotal2 :=0; sqdurationtotal3 :=0; sqspikenumtotal3 :=0; sqfreqtotal3 :=0; sqdurationtotal4 :=0; sqspikenumtotal4 :=0; sqfreqtotal4 :=0; sqdurationtotal5 :=0; sqspikenumtotal5 :=0; sqfreqtotal5 :=0; sqdurationtotal6 :=0; sqspikenumtotal6 :=0; sqfreqtotal6 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; durationsd2 :=0; spikenumsd2 :=0; freqsd2 :=0; durationsd3 :=0; spikenumsd3 :=0; freqsd3 :=0; durationsd4 :=0; spikenumsd4 :=0; freqsd4 :=0; durationsd5 :=0; spikenumsd5 :=0; freqsd5 :=0; durationsd6 :=0; spikenumsd6 :=0; freqsd6 :=0; phaseontotal1 :=0; sqphaseontotal1 :=0; phaseofftotal1 :=0; sqphaseofftotal1 :=0; phaseontotal2 :=0; sqphaseontotal2 :=0; phaseofftotal2 :=0; sqphaseofftotal2 :=0; phaseontotal3 :=0; sqphaseontotal3 :=0; phaseofftotal3 :=0; sqphaseofftotal3 :=0; phaseontotal4 :=0; sqphaseontotal4 :=0; phaseofftotal4 :=0; sqphaseofftotal4 :=0; phaseontotal5 :=0; sqphaseontotal5 :=0; phaseofftotal5 :=0; sqphaseofftotal5 :=0; phaseontotal6 :=0; sqphaseontotal6 :=0; phaseofftotal6 :=0; sqphaseofftotal6 :=0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; periodtotal2 :=0; frequencytotal2 :=0; sqperiodtotal2 :=0; sqfrequencytotal2 :=0; periodmean2 :=0; frequencymean2 :=0; periodsd2 :=0; frequencysd2 :=0; periodtotal3 :=0; frequencytotal3 :=0; sqperiodtotal3 :=0; sqfrequencytotal3 :=0; periodmean3 :=0; frequencymean3 :=0; periodsd3 :=0; frequencysd3 :=0; periodtotal4 :=0; frequencytotal4 :=0; sqperiodtotal4 :=0; sqfrequencytotal4 :=0; periodmean4 :=0; frequencymean4 :=0; periodsd4 :=0; frequencysd4 :=0; periodtotal5 :=0; frequencytotal5 :=0; sqperiodtotal5 :=0; sqfrequencytotal5 :=0; periodmean5 :=0; frequencymean5 :=0; periodsd5 :=0; frequencysd5 :=0; periodtotal6 :=0; frequencytotal6 :=0; sqperiodtotal6 :=0; sqfrequencytotal6 :=0; periodmean6 :=0; frequencymean6 :=0; periodsd6 :=0; frequencysd6 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; '*************************************************************************************** 'Begin analysis/writing for neuron 1 of 6 while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalysePeriod1(sBurst1, eBurst1); AnalysePhase5(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6); burstnum6 :=1+burstnum6; '*************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum6, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results7[resNormSNeuron1%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results7[resNormSNeuron1%], results7[resNormENeuron1%]); endif; endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 and results7[resNormSNeuron1%] > -777 AND burstnum6 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname1$, burstnum6, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results7[resNormSNeuron1%], results7[resNormENeuron1%]);endif; if results12[resPeriod1%] > -777 and results3[resNormSNeuron1%] > -777 AND burstnum6 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum6, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results7[resNormSNeuron1%], results7[resNormENeuron1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum6, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); if results7[resNormSNeuron1%] > -777 then phaseontotal1 := phaseontotal1 + results7[resNormSNeuron1%]; phaseofftotal1 := phaseofftotal1 + results7[resNormENeuron1%]; sqphaseontotal1 :=sqphaseontotal1 + (results7[resNormSNeuron1%] * results7[resNormSNeuron1%]); sqphaseofftotal1 := sqphaseofftotal1 + (results7[resNormENeuron1%] * results7[resNormENeuron1%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum6; spikenummean1 := spikenumtotal1/burstnum6; freqmean1 := freqtotal1 /burstnum6; phaseonmean1 := phaseontotal1/(burstnum6-1); phaseoffmean1 := phaseofftotal1/(burstnum6-1); 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/burstnum6))/(burstnum6-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/burstnum6))/(burstnum6-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/burstnum6))/(burstnum6-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); phaseonsd1 :=((sqphaseontotal1) - ((phaseontotal1 * phaseontotal1)/(burstnum6-1)))/(burstnum6-2); phaseoffsd1 :=((sqphaseofftotal1) - ((phaseofftotal1 * phaseofftotal1)/(burstnum6-1)))/(burstnum6-2); phaseonsd1 := sqrt(phaseonsd1); phaseoffsd1 := sqrt(phaseoffsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum6-1); frequencymean1 := frequencytotal1/(burstnum6-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1*periodtotal1)/(burstnum6-1)))/(burstnum6-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1*frequencytotal1)/(burstnum6-1)))/(burstnum6-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum6, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean1, phaseoffmean1); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd1, phaseoffsd1); '******************** FOR PHASEPLOT phaseon[1]:=phaseonmean1; phaseoff[1]:=phaseoffmean1; stdOFF[1]:=phaseoffsd1; stdon[1]:=phaseonsd1; name$[1]:=neuronname1$; spikesperburst[1]:=spikenummean1; spikesperburstSD[1]:=spikenumsd1; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname1$, burstnum6, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1, phaseonmean1, phaseoffmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1, phaseonsd1, phaseoffsd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '************************************************************************************ 'Begin analysis/writing for neuron 2 of 6 burstnum6 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalysePeriod2(sBurst2, eBurst2); AnalysePhase5(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6); burstnum6 :=1+burstnum6; '****************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname2$, burstnum6, sBurst2, eBurst2); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%]); '************************************************************************************************* 'COMPUTE PERIOD if results13[resPeriod2%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results13[resPeriod2%], results13[resFrequency2%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results7[resNormSNeuron2%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results7[resNormSNeuron2%], results7[resNormENeuron2%]); endif; endif; if summary% =0 AND xlv% =1 then if results13[resPeriod2%] > -777 and results7[resNormSNeuron2%] > -777 AND burstnum6 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname2$, burstnum6, sBurst2, eBurst2, results7[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%], results7[resNormSNeuron2%], results7[resNormENeuron2%]);endif; if results13[resPeriod2%] > -777 and results3[resNormSNeuron2%] > -777 AND burstnum6 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum6, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%], results7[resNormSNeuron2%], results7[resNormENeuron2%]);endif; if results13[resPeriod2%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum6, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal2 := durationtotal2 + results2[resDuration2%]; spikenumtotal2 := spikenumtotal2 + results2[resSpikes2%]; freqtotal2 := freqtotal2 + results2[resSpikeFreq2%]; sqdurationtotal2 := sqdurationtotal2 + (results2[resDuration2%] * results2[resDuration2%]); sqspikenumtotal2 := sqspikenumtotal2 + (results2[resSpikes2%] * results2[resSpikes2%]); sqfreqtotal2 := sqfreqtotal2 + (results2[resSpikeFreq2%] * results2[resSpikeFreq2%]); if results7[resNormSNeuron2%] > -777 then phaseontotal2 := phaseontotal2 + results7[resNormSNeuron2%]; phaseofftotal2 := phaseofftotal2 + results7[resNormENeuron2%]; sqphaseontotal2 :=sqphaseontotal2 + (results7[resNormSNeuron2%] * results7[resNormSNeuron2%]); sqphaseofftotal2 := sqphaseofftotal2 + (results7[resNormENeuron2%] * results7[resNormENeuron2%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results13[resPeriod2%] > -777 then periodtotal2 := periodtotal2 + results13[resPeriod2%]; frequencytotal2 := frequencytotal2 + results13[resFrequency2%]; sqperiodtotal2 := sqperiodtotal2 + (results13[resPeriod2%] * results13[resPeriod2%]); sqfrequencytotal2 := sqfrequencytotal2 + (results13[resFrequency2%] * results13[resFrequency2%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean2 := durationtotal2/burstnum6; spikenummean2 := spikenumtotal2/burstnum6; freqmean2 := freqtotal2 /burstnum6; phaseonmean2 := phaseontotal2/(burstnum6-1); phaseoffmean2 := phaseofftotal2/(burstnum6-1); 'calculating the standard devs for the bursts... durationsd2 := ((sqdurationtotal2) - ((durationtotal2*durationtotal2)/burstnum6))/(burstnum6-1); spikenumsd2 := ((sqspikenumtotal2) - ((spikenumtotal2*spikenumtotal2)/burstnum6))/(burstnum6-1); freqsd2 := ((sqfreqtotal2) - ((freqtotal2*freqtotal2)/burstnum6))/(burstnum6-1); durationsd2 := sqrt(durationsd2); spikenumsd2 := sqrt(spikenumsd2); freqsd2 := sqrt(freqsd2); phaseonsd2 :=((sqphaseontotal2) - ((phaseontotal2 * phaseontotal2)/(burstnum6-1)))/(burstnum6-2); phaseoffsd2 :=((sqphaseofftotal2) - ((phaseofftotal2 * phaseofftotal2)/(burstnum6-1)))/(burstnum6-2); phaseonsd2 := sqrt(phaseonsd2); phaseoffsd2 := sqrt(phaseoffsd2); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean2 := periodtotal2/(burstnum6-1); frequencymean2 := frequencytotal2/(burstnum6-1); periodsd2 := ((sqperiodtotal2) - ((periodtotal2*periodtotal2)/(burstnum6-1)))/(burstnum6-2); frequencysd2 := ((sqfrequencytotal2) - ((frequencytotal2*frequencytotal2)/(burstnum6-1)))/(burstnum6-2); periodsd2 := sqrt(periodsd2); frequencysd2 := sqrt(frequencysd2); '********************************************************************************************************************************** 'printing the neuron summary for neuron 2 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname2$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum6, durationmean2, spikenummean2, freqmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd2, spikenumsd2, freqsd2); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean2, frequencymean2); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd2, frequencysd2); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean2, phaseoffmean2); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd2, phaseoffsd2); '******************** FOR PHASEPLOT phaseon[2]:=phaseonmean2; phaseoff[2]:=phaseoffmean2; stdOFF[2]:=phaseoffsd2; stdon[2]:=phaseonsd2; name$[2]:=neuronname2$; spikesperburst[2]:=spikenummean2; spikesperburstSD[2]:=spikenumsd2; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname2$, burstnum6, durationmean2, spikenummean2, freqmean2, periodmean2, frequencymean2, phaseonmean2, phaseoffmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd2, spikenumsd2, freqsd2, periodsd2, frequencysd2, phaseonsd2, phaseoffsd2); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '******************************************************************************************** 'Begin analysis/writing for neuron 3 of 6 burstnum6 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalysePeriod3(sBurst3, eBurst3); AnalysePhase5(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6); burstnum6 :=1+burstnum6; '************************************************************************************ if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname3$, burstnum6, sBurst3, eBurst3); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%]); '************************************************************************************************* 'COMPUTE PERIOD if results14[resPeriod3%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results14[resPeriod3%], results14[resFrequency3%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results7[resNormSNeuron3%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results7[resNormSNeuron3%], results7[resNormENeuron3%]); endif; endif; if summary% =0 AND xlv% =1 then if results14[resPeriod3%] > -777 and results7[resNormSNeuron3%] > -777 AND burstnum6 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname3$, burstnum6, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%], results7[resNormSNeuron3%], results7[resNormENeuron3%]);endif; if results14[resPeriod3%] > -777 and results7[resNormSNeuron3%] > -777 AND burstnum6 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum6, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%], results7[resNormSNeuron3%], results7[resNormENeuron3%]);endif; if results14[resPeriod3%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum6, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal3 := durationtotal3 + results3[resDuration3%]; spikenumtotal3 := spikenumtotal3 + results3[resSpikes3%]; freqtotal3 := freqtotal3 + results3[resSpikeFreq3%]; sqdurationtotal3 := sqdurationtotal3 + (results3[resDuration3%] * results3[resDuration3%]); sqspikenumtotal3 := sqspikenumtotal3 + (results3[resSpikes3%] * results3[resSpikes3%]); sqfreqtotal3 := sqfreqtotal3 + (results3[resSpikeFreq3%] * results3[resSpikeFreq3%]); if results7[resNormSNeuron3%] > -777 then phaseontotal3 := phaseontotal3 + results7[resNormSNeuron3%]; phaseofftotal3 := phaseofftotal3 + results7[resNormENeuron3%]; sqphaseontotal3 :=sqphaseontotal3 + (results7[resNormSNeuron3%] * results7[resNormSNeuron3%]); sqphaseofftotal3 := sqphaseofftotal3 + (results7[resNormENeuron3%] * results7[resNormENeuron3%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results14[resPeriod3%] > -777 then periodtotal3 := periodtotal3 + results14[resPeriod3%]; frequencytotal3 := frequencytotal3 + results14[resFrequency3%]; sqperiodtotal3 := sqperiodtotal3 + (results14[resPeriod3%] * results14[resPeriod3%]); sqfrequencytotal3 := sqfrequencytotal3 + (results14[resFrequency3%] * results14[resFrequency3%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean3 := durationtotal3/burstnum6; spikenummean3 := spikenumtotal3/burstnum6; freqmean3 := freqtotal3 /burstnum6; phaseonmean3 := phaseontotal3/(burstnum6-1); phaseoffmean3 := phaseofftotal3/(burstnum6-1); 'calculating the standard devs for the bursts... durationsd3 := ((sqdurationtotal3) - ((durationtotal3*durationtotal3)/burstnum6))/(burstnum6-1); spikenumsd3 := ((sqspikenumtotal3) - ((spikenumtotal3*spikenumtotal3)/burstnum6))/(burstnum6-1); freqsd3 := ((sqfreqtotal3) - ((freqtotal3*freqtotal3)/burstnum6))/(burstnum6-1); durationsd3 := sqrt(durationsd3); spikenumsd3 := sqrt(spikenumsd3); freqsd3 := sqrt(freqsd3); phaseonsd3 :=((sqphaseontotal3) - ((phaseontotal3 * phaseontotal3)/(burstnum6-1)))/(burstnum6-2); phaseoffsd3 :=((sqphaseofftotal3) - ((phaseofftotal3 * phaseofftotal3)/(burstnum6-1)))/(burstnum6-2); phaseonsd3 := sqrt(phaseonsd3); phaseoffsd3 := sqrt(phaseoffsd3); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean3 := periodtotal3/(burstnum6-1); frequencymean3 := frequencytotal3/(burstnum6-1); periodsd3 := ((sqperiodtotal3) - ((periodtotal3*periodtotal3)/(burstnum6-1)))/(burstnum6-2); frequencysd3 := ((sqfrequencytotal3) - ((frequencytotal3*frequencytotal3)/(burstnum6-1)))/(burstnum6-2); periodsd3 := sqrt(periodsd3); frequencysd3 := sqrt(frequencysd3); '********************************************************************************************************************************** 'printing the neuron summary for neuron 3 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname3$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum6, durationmean3, spikenummean3, freqmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd3, spikenumsd3, freqsd3); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean3, frequencymean3); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd3, frequencysd3); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean3, phaseoffmean3); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd3, phaseoffsd3); '******************** FOR PHASEPLOT phaseon[3]:=phaseonmean3; phaseoff[3]:=phaseoffmean3; stdOFF[3]:=phaseoffsd3; stdon[3]:=phaseonsd3; name$[3]:=neuronname3$; spikesperburst[3]:=spikenummean3; spikesperburstSD[3]:=spikenumsd3; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname3$, burstnum6, durationmean3, spikenummean3, freqmean3, periodmean3, frequencymean3, phaseonmean3, phaseoffmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd3, spikenumsd3, freqsd3, periodsd3, frequencysd3, phaseonsd3, phaseoffsd3); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '********************************************************************************** 'Begin analysis/writing for neuron 4 of 6 burstnum6 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalysePeriod4(sBurst4, eBurst4); AnalysePhase5(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6); burstnum6 :=1+burstnum6; '********************************************************************************* if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname4$, burstnum6, sBurst4, eBurst4); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%]); '************************************************************************************************* 'COMPUTE PERIOD if results15[resPeriod4%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results15[resPeriod4%], results15[resFrequency4%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results7[resNormSNeuron4%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results7[resNormSNeuron4%], results7[resNormENeuron4%]); endif; endif; if summary% =0 AND xlv% =1 then if results15[resPeriod4%] > -777 and results7[resNormSNeuron4%] > -777 AND burstnum6 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname4$, burstnum6, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%], results7[resNormSNeuron4%], results7[resNormENeuron4%]);endif; if results15[resPeriod4%] > -777 and results7[resNormSNeuron4%] > -777 AND burstnum6 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum6, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%], results7[resNormSNeuron4%], results7[resNormENeuron4%]);endif; if results15[resPeriod4%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum6, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal4 := durationtotal4 + results4[resDuration4%]; spikenumtotal4 := spikenumtotal4 + results4[resSpikes4%]; freqtotal4 := freqtotal4 + results4[resSpikeFreq4%]; sqdurationtotal4 := sqdurationtotal4 + (results4[resDuration4%] * results4[resDuration4%]); sqspikenumtotal4 := sqspikenumtotal4 + (results4[resSpikes4%] * results4[resSpikes4%]); sqfreqtotal4 := sqfreqtotal4 + (results4[resSpikeFreq4%] * results4[resSpikeFreq4%]); if results7[resNormSNeuron4%] > -777 then phaseontotal4 := phaseontotal4 + results7[resNormSNeuron4%]; phaseofftotal4 := phaseofftotal4 + results7[resNormENeuron4%]; sqphaseontotal4 :=sqphaseontotal4 + (results7[resNormSNeuron4%] * results7[resNormSNeuron4%]); sqphaseofftotal4 := sqphaseofftotal4 + (results7[resNormENeuron4%] * results7[resNormENeuron4%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results15[resPeriod4%] > -777 then periodtotal4 := periodtotal4 + results15[resPeriod4%]; frequencytotal4 := frequencytotal4 + results15[resFrequency4%]; sqperiodtotal4 := sqperiodtotal4 + (results15[resPeriod4%] * results15[resPeriod4%]); sqfrequencytotal4 := sqfrequencytotal4 + (results15[resFrequency4%] * results15[resFrequency4%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean4 := durationtotal4/burstnum6; spikenummean4 := spikenumtotal4/burstnum6; freqmean4 := freqtotal4 /burstnum6; phaseonmean4 := phaseontotal4/(burstnum6-1); phaseoffmean4 := phaseofftotal4/(burstnum6-1); 'calculating the standard devs for the bursts... durationsd4 := ((sqdurationtotal4) - ((durationtotal4*durationtotal4)/burstnum6))/(burstnum6-1); spikenumsd4 := ((sqspikenumtotal4) - ((spikenumtotal4*spikenumtotal4)/burstnum6))/(burstnum6-1); freqsd4 := ((sqfreqtotal4) - ((freqtotal4*freqtotal4)/burstnum6))/(burstnum6-1); durationsd4 := sqrt(durationsd4); spikenumsd4 := sqrt(spikenumsd4); freqsd4 := sqrt(freqsd4); phaseonsd4 :=((sqphaseontotal4) - ((phaseontotal4 * phaseontotal4)/(burstnum6-1)))/(burstnum6-2); phaseoffsd4 :=((sqphaseofftotal4) - ((phaseofftotal4 * phaseofftotal4)/(burstnum6-1)))/(burstnum6-2); phaseonsd4 := sqrt(phaseonsd4); phaseoffsd4 := sqrt(phaseoffsd4); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean4 := periodtotal4/(burstnum6-1); frequencymean4 := frequencytotal4/(burstnum6-1); periodsd4 := ((sqperiodtotal4) - ((periodtotal4*periodtotal4)/(burstnum6-1)))/(burstnum6-2); frequencysd4 := ((sqfrequencytotal4) - ((frequencytotal4*frequencytotal4)/(burstnum6-1)))/(burstnum6-2); periodsd4 := sqrt(periodsd4); frequencysd4 := sqrt(frequencysd4); '********************************************************************************************************************************** 'printing the neuron summary for neuron 4 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname4$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum6, durationmean4, spikenummean4, freqmean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd4, spikenumsd4, freqsd4); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean4, frequencymean4); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd4, frequencysd4); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean4, phaseoffmean4); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd4, phaseoffsd4); '******************** FOR PHASEPLOT phaseon[4]:=phaseonmean4; phaseoff[4]:=phaseoffmean4; stdOFF[4]:=phaseoffsd4; stdon[4]:=phaseonsd4; name$[4]:=neuronname4$; spikesperburst[4]:=spikenummean4; spikesperburstSD[4]:=spikenumsd4; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname4$, burstnum6, durationmean4, spikenummean4, freqmean4, periodmean4, frequencymean4, phaseonmean4, phaseoffmean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd4, spikenumsd4, freqsd4, periodsd4, frequencysd4, phaseonsd4, phaseoffsd4); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '*************************************************************************************** 'Begin analysis/writing for neuron 5 of 6 burstnum6 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalysePeriod5(sBurst5, eBurst5); AnalysePhase5(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6); burstnum6 :=1+burstnum6; '**************************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname5$, burstnum6, sBurst5, eBurst5); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%]); '************************************************************************************************* 'COMPUTE PERIOD if results16[resPeriod5%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results16[resPeriod5%], results16[resFrequency5%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results7[resNormSNeuron5%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results7[resNormSNeuron5%], results7[resNormENeuron5%]); endif; endif; if summary% =0 AND xlv% =1 then if results16[resPeriod5%] > -777 and results7[resNormSNeuron5%] > -777 AND burstnum6 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname5$, burstnum6, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%],results16[resPeriod5%], results16[resFrequency5%], results7[resNormSNeuron5%], results7[resNormENeuron5%]);endif; if results16[resPeriod5%] > -777 and results7[resNormSNeuron5%] > -777 AND burstnum6 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum6, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%],results16[resPeriod5%], results16[resFrequency5%], results7[resNormSNeuron5%], results7[resNormENeuron5%]);endif; if results16[resPeriod5%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum6, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal5 := durationtotal5 + results5[resDuration5%]; spikenumtotal5 := spikenumtotal5 + results5[resSpikes5%]; freqtotal5 := freqtotal5 + results5[resSpikeFreq5%]; sqdurationtotal5 := sqdurationtotal5 + (results5[resDuration5%] * results5[resDuration5%]); sqspikenumtotal5 := sqspikenumtotal5 + (results5[resSpikes5%] * results5[resSpikes5%]); sqfreqtotal5 := sqfreqtotal5 + (results5[resSpikeFreq5%] * results5[resSpikeFreq5%]); if results7[resNormSNeuron5%] > -777 then phaseontotal5 := phaseontotal5 + results7[resNormSNeuron5%]; phaseofftotal5 := phaseofftotal5 + results7[resNormENeuron5%]; sqphaseontotal5 :=sqphaseontotal5 + (results7[resNormSNeuron5%] * results7[resNormSNeuron5%]); sqphaseofftotal5 := sqphaseofftotal5 + (results7[resNormENeuron5%] * results7[resNormENeuron5%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results16[resPeriod5%] > -777 then periodtotal5 := periodtotal5 + results16[resPeriod5%]; frequencytotal5 := frequencytotal5 + results16[resFrequency5%]; sqperiodtotal5 := sqperiodtotal5 + (results16[resPeriod5%] * results16[resPeriod5%]); sqfrequencytotal5 := sqfrequencytotal5 + (results16[resFrequency5%] * results16[resFrequency5%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean5 := durationtotal5/burstnum6; spikenummean5 := spikenumtotal5/burstnum6; freqmean5 := freqtotal5 /burstnum6; phaseonmean5 := phaseontotal5/(burstnum6-1); phaseoffmean5 := phaseofftotal5/(burstnum6-1); 'calculating the standard devs for the bursts... durationsd5 := ((sqdurationtotal5) - ((durationtotal5*durationtotal5)/burstnum6))/(burstnum6-1); spikenumsd5 := ((sqspikenumtotal5) - ((spikenumtotal5*spikenumtotal5)/burstnum6))/(burstnum6-1); freqsd5 := ((sqfreqtotal5) - ((freqtotal5*freqtotal5)/burstnum6))/(burstnum6-1); durationsd5 := sqrt(durationsd5); spikenumsd5 := sqrt(spikenumsd5); freqsd5 := sqrt(freqsd5); phaseonsd5 :=((sqphaseontotal5) - ((phaseontotal5 * phaseontotal5)/(burstnum6-1)))/(burstnum6-2); phaseoffsd5 :=((sqphaseofftotal5) - ((phaseofftotal5 * phaseofftotal5)/(burstnum6-1)))/(burstnum6-2); phaseonsd5 := sqrt(phaseonsd5); phaseoffsd5 := sqrt(phaseoffsd5); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean5 := periodtotal5/(burstnum6-1); frequencymean5 := frequencytotal5/(burstnum6-1); periodsd5 := ((sqperiodtotal5) - ((periodtotal5*periodtotal5)/(burstnum6-1)))/(burstnum6-2); frequencysd5 := ((sqfrequencytotal5) - ((frequencytotal5*frequencytotal5)/(burstnum6-1)))/(burstnum6-2); periodsd5 := sqrt(periodsd5); frequencysd5 := sqrt(frequencysd5); '********************************************************************************************************************************** 'printing the neuron summary for neuron 5 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname5$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum6, durationmean5, spikenummean5, freqmean5); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd5, spikenumsd5, freqsd5); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean5, frequencymean5); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd5, frequencysd5); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean5, phaseoffmean5); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd5, phaseoffsd5); '******************** FOR PHASEPLOT phaseon[5]:=phaseonmean5; phaseoff[5]:=phaseoffmean5; stdOFF[5]:=phaseoffsd5; stdon[5]:=phaseonsd5; name$[5]:=neuronname5$; spikesperburst[5]:=spikenummean5; spikesperburstSD[5]:=spikenumsd5; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname5$, burstnum6, durationmean5, spikenummean5, freqmean5, periodmean5, frequencymean5, phaseonmean5, phaseoffmean5); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd5, spikenumsd5, freqsd5, periodsd5, frequencysd5, phaseonsd5, phaseoffsd5); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '************************************************************************************************ 'Begin analysis/writing for neuron 6 of 6 burstnum6 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalysePeriod6(sBurst6, eBurst6); AnalysePhase5(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6); burstnum6 :=1+burstnum6; '***********************************************************************************************8 if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname6$, burstnum6, sBurst6, eBurst6); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%]); '************************************************************************************************* 'COMPUTE PERIOD if results17[resPeriod6%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results17[resPeriod6%], results17[resFrequency6%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results7[resNormSNeuron6%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results7[resNormSNeuron6%], results7[resNormENeuron6%]); endif; endif; if summary% =0 AND xlv% =1 then if results17[resPeriod6%] > -777 and results7[resNormSNeuron6%] > -777 AND burstnum6 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname6$, burstnum6, sBurst6, eBurst6, results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%],results17[resPeriod6%], results17[resFrequency6%], results7[resNormSNeuron6%], results7[resNormENeuron6%]);endif; if results17[resPeriod6%] > -777 and results7[resNormSNeuron6%] > -777 AND burstnum6 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum6, sBurst6, eBurst6, results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%],results17[resPeriod6%], results17[resFrequency6%], results7[resNormSNeuron6%], results7[resNormENeuron6%]);endif; if results17[resPeriod6%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum6, sBurst6, eBurst6, results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal6 := durationtotal6 + results6[resDuration6%]; spikenumtotal6 := spikenumtotal6 + results6[resSpikes6%]; freqtotal6 := freqtotal6 + results6[resSpikeFreq6%]; sqdurationtotal6 := sqdurationtotal6 + (results6[resDuration6%] * results6[resDuration6%]); sqspikenumtotal6 := sqspikenumtotal6 + (results6[resSpikes6%] * results6[resSpikes6%]); sqfreqtotal6 := sqfreqtotal6 + (results6[resSpikeFreq6%] * results6[resSpikeFreq6%]); if results7[resNormSNeuron6%] > -777 then phaseontotal6 := phaseontotal6 + results7[resNormSNeuron6%]; phaseofftotal6 := phaseofftotal6 + results7[resNormENeuron6%]; sqphaseontotal6 :=sqphaseontotal6 + (results7[resNormSNeuron6%] * results7[resNormSNeuron6%]); sqphaseofftotal6 := sqphaseofftotal6 + (results7[resNormENeuron6%] * results7[resNormENeuron6%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results17[resPeriod6%] > -777 then periodtotal6 := periodtotal6 + results17[resPeriod6%]; frequencytotal6 := frequencytotal6 + results17[resFrequency6%]; sqperiodtotal6 := sqperiodtotal6 + (results17[resPeriod6%] * results17[resPeriod6%]); sqfrequencytotal6 := sqfrequencytotal6 + (results17[resFrequency6%] * results17[resFrequency6%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean6 := durationtotal6/burstnum6; spikenummean6 := spikenumtotal6/burstnum6; freqmean6 := freqtotal6 /burstnum6; phaseonmean6 := phaseontotal6/(burstnum6-1); phaseoffmean6 := phaseofftotal6/(burstnum6-1); 'calculating the standard devs for the bursts... durationsd6 := ((sqdurationtotal6) - ((durationtotal6*durationtotal6)/burstnum6))/(burstnum6-1); spikenumsd6 := ((sqspikenumtotal6) - ((spikenumtotal6*spikenumtotal6)/burstnum6))/(burstnum6-1); freqsd6 := ((sqfreqtotal6) - ((freqtotal6*freqtotal6)/burstnum6))/(burstnum6-1); durationsd6 := sqrt(durationsd6); spikenumsd6 := sqrt(spikenumsd6); freqsd6 := sqrt(freqsd6); phaseonsd6 :=((sqphaseontotal6) - ((phaseontotal6 * phaseontotal6)/(burstnum6-1)))/(burstnum6-2); phaseoffsd6 :=((sqphaseofftotal6) - ((phaseofftotal6 * phaseofftotal6)/(burstnum6-1)))/(burstnum6-2); phaseonsd6 := sqrt(phaseonsd6); phaseoffsd6 := sqrt(phaseoffsd6); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean6 := periodtotal6/(burstnum6-1); frequencymean6 := frequencytotal6/(burstnum6-1); periodsd6 := ((sqperiodtotal6) - ((periodtotal6*periodtotal6)/(burstnum6-1)))/(burstnum6-2); frequencysd6 := ((sqfrequencytotal6) - ((frequencytotal6*frequencytotal6)/(burstnum6-1)))/(burstnum6-2); periodsd6 := sqrt(periodsd6); frequencysd6 := sqrt(frequencysd6); '********************************************************************************************************************************** 'printing the neuron summary for neuron 6 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname6$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum6, durationmean6, spikenummean6, freqmean6); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd6, spikenumsd6, freqsd6); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean6, frequencymean6); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd6, frequencysd6); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean6, phaseoffmean6); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd6, phaseoffsd6); '******************** FOR PHASEPLOT phaseon[6]:=phaseonmean6; phaseoff[6]:=phaseoffmean6; stdOFF[6]:=phaseoffsd6; stdon[6]:=phaseonsd6; name$[6]:=neuronname6$; spikesperburst[6]:=spikenummean6; spikesperburstSD[6]:=spikenumsd6; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname6$, burstnum6, durationmean6, spikenummean6, freqmean6, periodmean6, frequencymean6, phaseonmean6, phaseoffmean6); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd6, spikenumsd6, freqsd6, periodsd6, frequencysd6, phaseonsd6, phaseoffsd6); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WRITING DATA IF 7 NEURONS ANALYZED if number1% = 7 then burstnum7 :=0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationtotal2 :=0; spikenumtotal2 :=0; freqtotal2 :=0; durationtotal3 :=0; spikenumtotal3 :=0; freqtotal3 :=0; durationtotal4 :=0; spikenumtotal4 :=0; freqtotal4 :=0; durationtotal5 :=0; spikenumtotal5 :=0; freqtotal5 :=0; durationtotal6 :=0; spikenumtotal6 :=0; freqtotal6 :=0; durationtotal7 :=0; spikenumtotal7 :=0; freqtotal7 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; durationmean2 :=0; spikenummean2 :=0; freqmean2 :=0; durationmean3 :=0; spikenummean3 :=0; freqmean3 :=0; durationmean4 :=0; spikenummean4 :=0; freqmean4 :=0; durationmean5 :=0; spikenummean5 :=0; freqmean5 :=0; durationmean6 :=0; spikenummean6 :=0; freqmean6 :=0; durationmean7 :=0; spikenummean7 :=0; freqmean7 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; sqdurationtotal2 :=0; sqspikenumtotal2 :=0; sqfreqtotal2 :=0; sqdurationtotal3 :=0; sqspikenumtotal3 :=0; sqfreqtotal3 :=0; sqdurationtotal4 :=0; sqspikenumtotal4 :=0; sqfreqtotal4 :=0; sqdurationtotal5 :=0; sqspikenumtotal5 :=0; sqfreqtotal5 :=0; sqdurationtotal6 :=0; sqspikenumtotal6 :=0; sqfreqtotal6 :=0; sqdurationtotal7 :=0; sqspikenumtotal7 :=0; sqfreqtotal7 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; durationsd2 :=0; spikenumsd2 :=0; freqsd2 :=0; durationsd3 :=0; spikenumsd3 :=0; freqsd3 :=0; durationsd4 :=0; spikenumsd4 :=0; freqsd4 :=0; durationsd5 :=0; spikenumsd5 :=0; freqsd5 :=0; durationsd6 :=0; spikenumsd6 :=0; freqsd6 :=0; durationsd7 :=0; spikenumsd7 :=0; freqsd7 :=0; phaseontotal1 :=0; sqphaseontotal1 :=0; phaseofftotal1 :=0; sqphaseofftotal1 :=0; phaseontotal2 :=0; sqphaseontotal2 :=0; phaseofftotal2 :=0; sqphaseofftotal2 :=0; phaseontotal3 :=0; sqphaseontotal3 :=0; phaseofftotal3 :=0; sqphaseofftotal3 :=0; phaseontotal4 :=0; sqphaseontotal4 :=0; phaseofftotal4 :=0; sqphaseofftotal4 :=0; phaseontotal5 :=0; sqphaseontotal5 :=0; phaseofftotal5 :=0; sqphaseofftotal5 :=0; phaseontotal6 :=0; sqphaseontotal6 :=0; phaseofftotal6 :=0; sqphaseofftotal6 :=0; phaseontotal7 :=0; sqphaseontotal7 :=0; phaseofftotal7 :=0; sqphaseofftotal7 :=0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; periodtotal2 :=0; frequencytotal2 :=0; sqperiodtotal2 :=0; sqfrequencytotal2 :=0; periodmean2 :=0; frequencymean2 :=0; periodsd2 :=0; frequencysd2 :=0; periodtotal3 :=0; frequencytotal3 :=0; sqperiodtotal3 :=0; sqfrequencytotal3 :=0; periodmean3 :=0; frequencymean3 :=0; periodsd3 :=0; frequencysd3 :=0; periodtotal4 :=0; frequencytotal4 :=0; sqperiodtotal4 :=0; sqfrequencytotal4 :=0; periodmean4 :=0; frequencymean4 :=0; periodsd4 :=0; frequencysd4 :=0; periodtotal5 :=0; frequencytotal5 :=0; sqperiodtotal5 :=0; sqfrequencytotal5 :=0; periodmean5 :=0; frequencymean5 :=0; periodsd5 :=0; frequencysd5 :=0; periodtotal6 :=0; frequencytotal6 :=0; sqperiodtotal6 :=0; sqfrequencytotal6 :=0; periodmean6 :=0; frequencymean6 :=0; periodsd6 :=0; frequencysd6 :=0; periodtotal7 :=0; frequencytotal7 :=0; sqperiodtotal7 :=0; sqfrequencytotal7 :=0; periodmean7 :=0; frequencymean7 :=0; periodsd7 :=0; frequencysd7 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; sBurst7 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; eBurst7 := 0; '***************************************************************************************** 'Begin analysis/writing for neuron 1 of 7 while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); sBurst7 := NextTime(BurstCh7%, eBurst7); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); eBurst7 := NextTime(BurstCh7%, sBurst7); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalyseNeuron7(sBurst7, eBurst7); AnalysePeriod1(sBurst1, eBurst1); AnalysePhase6(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6, sBurst7, eBurst7); burstnum7 :=1+burstnum7; '************************************************************************************************* if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum7, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results8[resNormSNeuron1%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results8[resNormSNeuron1%], results8[resNormENeuron1%]); endif; endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 and results8[resNormSNeuron1%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname1$, burstnum7, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results8[resNormSNeuron1%], results8[resNormENeuron1%]);endif; if results12[resPeriod1%] > -777 and results8[resNormSNeuron1%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum7, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%], results8[resNormSNeuron1%], results8[resNormENeuron1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum7, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); if results8[resNormSNeuron1%] > -777 then phaseontotal1 := phaseontotal1 + results8[resNormSNeuron1%]; phaseofftotal1 := phaseofftotal1 + results8[resNormENeuron1%]; sqphaseontotal1 :=sqphaseontotal1 + (results8[resNormSNeuron1%] * results8[resNormSNeuron1%]); sqphaseofftotal1 := sqphaseofftotal1 + (results8[resNormENeuron1%] * results8[resNormENeuron1%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum7; spikenummean1 := spikenumtotal1/burstnum7; freqmean1 := freqtotal1 /burstnum7; phaseonmean1 := phaseontotal1/(burstnum7-1); phaseoffmean1 := phaseofftotal1/(burstnum7-1); 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/burstnum7))/(burstnum7-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/burstnum7))/(burstnum7-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/burstnum7))/(burstnum7-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); phaseonsd1 :=((sqphaseontotal1) - ((phaseontotal1 * phaseontotal1)/(burstnum7-1)))/(burstnum7-2); phaseoffsd1 :=((sqphaseofftotal1) - ((phaseofftotal1 * phaseofftotal1)/(burstnum7-1)))/(burstnum7-2); phaseonsd1 := sqrt(phaseonsd1); phaseoffsd1 := sqrt(phaseoffsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum7-1); frequencymean1 := frequencytotal1/(burstnum7-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1*periodtotal1)/(burstnum7-1)))/(burstnum7-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1*frequencytotal1)/(burstnum7-1)))/(burstnum7-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean1, phaseoffmean1); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd1, phaseoffsd1); '******************** FOR PHASEPLOT phaseon[1]:=phaseonmean1; phaseoff[1]:=phaseoffmean1; stdOFF[1]:=phaseoffsd1; stdon[1]:=phaseonsd1; name$[1]:=neuronname1$; spikesperburst[1]:=spikenummean1; spikesperburstSD[1]:=spikenumsd1; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname1$, burstnum7, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1, phaseonmean1, phaseoffmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1, phaseonsd1, phaseoffsd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '***************************************************************************************** 'Begin analysis/writing for neuron 2 of 7 burstnum7 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; sBurst7 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; eBurst7 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); sBurst7 := NextTime(BurstCh7%, eBurst7); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); eBurst7 := NextTime(BurstCh7%, sBurst7); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalyseNeuron7(sBurst7, eBurst7); AnalysePeriod2(sBurst2, eBurst2); AnalysePhase6(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6, sBurst7, eBurst7); burstnum7 :=1+burstnum7; '******************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname2$, burstnum7, sBurst2, eBurst2); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%]); '************************************************************************************************* 'COMPUTE PERIOD if results13[resPeriod2%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results13[resPeriod2%], results13[resFrequency2%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results8[resNormSNeuron2%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results8[resNormSNeuron2%], results8[resNormENeuron2%]); endif; endif; if summary% =0 AND xlv% =1 then if results13[resPeriod2%] > -777 and results8[resNormSNeuron2%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname2$, burstnum7, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%], results8[resNormSNeuron2%], results8[resNormENeuron2%]);endif; if results13[resPeriod2%] > -777 and results8[resNormSNeuron2%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum7, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%], results8[resNormSNeuron2%], results8[resNormENeuron2%]);endif; if results13[resPeriod2%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum7, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal2 := durationtotal2 + results2[resDuration2%]; spikenumtotal2 := spikenumtotal2 + results2[resSpikes2%]; freqtotal2 := freqtotal2 + results2[resSpikeFreq2%]; sqdurationtotal2 := sqdurationtotal2 + (results2[resDuration2%] * results2[resDuration2%]); sqspikenumtotal2 := sqspikenumtotal2 + (results2[resSpikes2%] * results2[resSpikes2%]); sqfreqtotal2 := sqfreqtotal2 + (results2[resSpikeFreq2%] * results2[resSpikeFreq2%]); if results8[resNormSNeuron2%] > -777 then phaseontotal2 := phaseontotal2 + results8[resNormSNeuron2%]; phaseofftotal2 := phaseofftotal2 + results8[resNormENeuron2%]; sqphaseontotal2 :=sqphaseontotal2 + (results8[resNormSNeuron2%] * results8[resNormSNeuron2%]); sqphaseofftotal2 := sqphaseofftotal2 + (results8[resNormENeuron2%] * results8[resNormENeuron2%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results13[resPeriod2%] > -777 then periodtotal2 := periodtotal2 + results13[resPeriod2%]; frequencytotal2 := frequencytotal2 + results13[resFrequency2%]; sqperiodtotal2 := sqperiodtotal2 + (results13[resPeriod2%] * results13[resPeriod2%]); sqfrequencytotal2 := sqfrequencytotal2 + (results13[resFrequency2%] * results13[resFrequency2%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean2 := durationtotal2/burstnum7; spikenummean2 := spikenumtotal2/burstnum7; freqmean2 := freqtotal2 /burstnum7; phaseonmean2 := phaseontotal2/(burstnum7-1); phaseoffmean2 := phaseofftotal2/(burstnum7-1); 'calculating the standard devs for the bursts... durationsd2 := ((sqdurationtotal2) - ((durationtotal2*durationtotal2)/burstnum7))/(burstnum7-1); spikenumsd2 := ((sqspikenumtotal2) - ((spikenumtotal2*spikenumtotal2)/burstnum7))/(burstnum7-1); freqsd2 := ((sqfreqtotal2) - ((freqtotal2*freqtotal2)/burstnum7))/(burstnum7-1); durationsd2 := sqrt(durationsd2); spikenumsd2 := sqrt(spikenumsd2); freqsd2 := sqrt(freqsd2); phaseonsd2 :=((sqphaseontotal2) - ((phaseontotal2 * phaseontotal2)/(burstnum7-1)))/(burstnum7-2); phaseoffsd2 :=((sqphaseofftotal2) - ((phaseofftotal2 * phaseofftotal2)/(burstnum7-1)))/(burstnum7-2); phaseonsd2 := sqrt(phaseonsd2); phaseoffsd2 := sqrt(phaseoffsd2); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean2 := periodtotal2/(burstnum7-1); frequencymean2 := frequencytotal2/(burstnum7-1); periodsd2 := ((sqperiodtotal2) - ((periodtotal2*periodtotal2)/(burstnum7-1)))/(burstnum7-2); frequencysd2 := ((sqfrequencytotal2) - ((frequencytotal2*frequencytotal2)/(burstnum7-1)))/(burstnum7-2); periodsd2 := sqrt(periodsd2); frequencysd2 := sqrt(frequencysd2); '********************************************************************************************************************************** 'printing the neuron summary for neuron 2 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname2$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean2, spikenummean2, freqmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd2, spikenumsd2, freqsd2); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean2, frequencymean2); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd2, frequencysd2); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean2, phaseoffmean2); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd2, phaseoffsd2); '******************** FOR PHASEPLOT phaseon[2]:=phaseonmean2; phaseoff[2]:=phaseoffmean2; stdOFF[2]:=phaseoffsd2; stdon[2]:=phaseonsd2; name$[2]:=neuronname2$; spikesperburst[2]:=spikenummean2; spikesperburstSD[2]:=spikenumsd2; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname2$, burstnum7, durationmean2, spikenummean2, freqmean2, periodmean2, frequencymean2, phaseonmean2, phaseoffmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd2, spikenumsd2, freqsd2, periodsd2, frequencysd2, phaseonsd2, phaseoffsd2); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '***************************************************************************************** 'Begin analysis/writing for neuron 3 of 7 burstnum7 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; sBurst7 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; eBurst7 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); sBurst7 := NextTime(BurstCh7%, eBurst7); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); eBurst7 := NextTime(BurstCh7%, sBurst7); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalyseNeuron7(sBurst7, eBurst7); AnalysePeriod3(sBurst3, eBurst3); AnalysePhase6(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6, sBurst7, eBurst7); burstnum7 :=1+burstnum7; '*********************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname3$, burstnum7, sBurst3, eBurst3); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%]); '************************************************************************************************* 'COMPUTE PERIOD if results14[resPeriod3%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results14[resPeriod3%], results14[resFrequency3%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results8[resNormSNeuron3%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results8[resNormSNeuron3%], results8[resNormENeuron3%]); endif; endif; if summary% =0 AND xlv% =1 then if results14[resPeriod3%] > -777 and results8[resNormSNeuron3%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname3$, burstnum7, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%], results8[resNormSNeuron3%], results8[resNormENeuron3%]);endif; if results14[resPeriod3%] > -777 and results8[resNormSNeuron3%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum7, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%], results8[resNormSNeuron3%], results8[resNormENeuron3%]);endif; if results14[resPeriod3%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum7, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal3 := durationtotal3 + results3[resDuration3%]; spikenumtotal3 := spikenumtotal3 + results3[resSpikes3%]; freqtotal3 := freqtotal3 + results3[resSpikeFreq3%]; sqdurationtotal3 := sqdurationtotal3 + (results3[resDuration3%] * results3[resDuration3%]); sqspikenumtotal3 := sqspikenumtotal3 + (results3[resSpikes3%] * results3[resSpikes3%]); sqfreqtotal3 := sqfreqtotal3 + (results3[resSpikeFreq3%] * results3[resSpikeFreq3%]); if results8[resNormSNeuron3%] > -777 then phaseontotal3 := phaseontotal3 + results8[resNormSNeuron3%]; phaseofftotal3 := phaseofftotal3 + results8[resNormENeuron3%]; sqphaseontotal3 :=sqphaseontotal3 + (results8[resNormSNeuron3%] * results8[resNormSNeuron3%]); sqphaseofftotal3 := sqphaseofftotal3 + (results8[resNormENeuron3%] * results8[resNormENeuron3%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results14[resPeriod3%] > -777 then periodtotal3 := periodtotal3 + results14[resPeriod3%]; frequencytotal3 := frequencytotal3 + results14[resFrequency3%]; sqperiodtotal3 := sqperiodtotal3 + (results14[resPeriod3%] * results14[resPeriod3%]); sqfrequencytotal3 := sqfrequencytotal3 + (results14[resFrequency3%] * results14[resFrequency3%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean3 := durationtotal3/burstnum7; spikenummean3 := spikenumtotal3/burstnum7; freqmean3 := freqtotal3 /burstnum7; phaseonmean3 := phaseontotal3/(burstnum7-1); phaseoffmean3 := phaseofftotal3/(burstnum7-1); 'calculating the standard devs for the bursts... durationsd3 := ((sqdurationtotal3) - ((durationtotal3*durationtotal3)/burstnum7))/(burstnum7-1); spikenumsd3 := ((sqspikenumtotal3) - ((spikenumtotal3*spikenumtotal3)/burstnum7))/(burstnum7-1); freqsd3 := ((sqfreqtotal3) - ((freqtotal3*freqtotal3)/burstnum7))/(burstnum7-1); durationsd3 := sqrt(durationsd3); spikenumsd3 := sqrt(spikenumsd3); freqsd3 := sqrt(freqsd3); phaseonsd3 :=((sqphaseontotal3) - ((phaseontotal3 * phaseontotal3)/(burstnum7-1)))/(burstnum7-2); phaseoffsd3 :=((sqphaseofftotal3) - ((phaseofftotal3 * phaseofftotal3)/(burstnum7-1)))/(burstnum7-2); phaseonsd3 := sqrt(phaseonsd3); phaseoffsd3 := sqrt(phaseoffsd3); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean3 := periodtotal3/(burstnum7-1); frequencymean3 := frequencytotal3/(burstnum7-1); periodsd3 := ((sqperiodtotal3) - ((periodtotal3*periodtotal3)/(burstnum7-1)))/(burstnum7-2); frequencysd3 := ((sqfrequencytotal3) - ((frequencytotal3*frequencytotal3)/(burstnum7-1)))/(burstnum7-2); periodsd3 := sqrt(periodsd3); frequencysd3 := sqrt(frequencysd3); '********************************************************************************************************************************** 'printing the neuron summary for neuron 3 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname3$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean3, spikenummean3, freqmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd3, spikenumsd3, freqsd3); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean3, frequencymean3); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd3, frequencysd3); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean3, phaseoffmean3); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd3, phaseoffsd3); '******************** FOR PHASEPLOT phaseon[3]:=phaseonmean3; phaseoff[3]:=phaseoffmean3; stdOFF[3]:=phaseoffsd3; stdon[3]:=phaseonsd3; name$[3]:=neuronname3$; spikesperburst[3]:=spikenummean3; spikesperburstSD[3]:=spikenumsd3; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname3$, burstnum7, durationmean3, spikenummean3, freqmean3, periodmean3, frequencymean3, phaseonmean3, phaseoffmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd3, spikenumsd3, freqsd3, periodsd3, frequencysd3, phaseonsd3, phaseoffsd3); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '***************************************************************************************** 'Begin analysis/writing for neuron 4 of 7 burstnum7 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; sBurst7 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; eBurst7 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); sBurst7 := NextTime(BurstCh7%, eBurst7); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); eBurst7 := NextTime(BurstCh7%, sBurst7); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalyseNeuron7(sBurst7, eBurst7); AnalysePeriod4(sBurst4, eBurst4); AnalysePhase6(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6, sBurst7, eBurst7); burstnum7 :=1+burstnum7; '*********************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname4$, burstnum7, sBurst4, eBurst4); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%]); '************************************************************************************************* 'COMPUTE PERIOD if results15[resPeriod4%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results15[resPeriod4%], results15[resFrequency4%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results8[resNormSNeuron4%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results8[resNormSNeuron4%], results8[resNormENeuron4%]); endif; endif; if summary% =0 AND xlv% =1 then if results15[resPeriod4%] > -777 and results8[resNormSNeuron4%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname4$, burstnum7, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%], results8[resNormSNeuron4%], results8[resNormENeuron4%]);endif; if results15[resPeriod4%] > -777 and results8[resNormSNeuron4%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum7, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%], results8[resNormSNeuron4%], results8[resNormENeuron4%]);endif; if results15[resPeriod4%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum7, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal4 := durationtotal4 + results4[resDuration4%]; spikenumtotal4 := spikenumtotal4 + results4[resSpikes4%]; freqtotal4 := freqtotal4 + results4[resSpikeFreq4%]; sqdurationtotal4 := sqdurationtotal4 + (results4[resDuration4%] * results4[resDuration4%]); sqspikenumtotal4 := sqspikenumtotal4 + (results4[resSpikes4%] * results4[resSpikes4%]); sqfreqtotal4 := sqfreqtotal4 + (results4[resSpikeFreq4%] * results4[resSpikeFreq4%]); if results8[resNormSNeuron4%] > -777 then phaseontotal4 := phaseontotal4 + results8[resNormSNeuron4%]; phaseofftotal4 := phaseofftotal4 + results8[resNormENeuron4%]; sqphaseontotal4 :=sqphaseontotal4 + (results8[resNormSNeuron4%] * results8[resNormSNeuron4%]); sqphaseofftotal4 := sqphaseofftotal4 + (results8[resNormENeuron4%] * results8[resNormENeuron4%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results15[resPeriod4%] > -777 then periodtotal4 := periodtotal4 + results15[resPeriod4%]; frequencytotal4 := frequencytotal4 + results15[resFrequency4%]; sqperiodtotal4 := sqperiodtotal4 + (results15[resPeriod4%] * results15[resPeriod4%]); sqfrequencytotal4 := sqfrequencytotal4 + (results15[resFrequency4%] * results15[resFrequency4%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean4 := durationtotal4/burstnum7; spikenummean4 := spikenumtotal4/burstnum7; freqmean4 := freqtotal4 /burstnum7; phaseonmean4 := phaseontotal4/(burstnum7-1); phaseoffmean4 := phaseofftotal4/(burstnum7-1); 'calculating the standard devs for the bursts... durationsd4 := ((sqdurationtotal4) - ((durationtotal4*durationtotal4)/burstnum7))/(burstnum7-1); spikenumsd4 := ((sqspikenumtotal4) - ((spikenumtotal4*spikenumtotal4)/burstnum7))/(burstnum7-1); freqsd4 := ((sqfreqtotal4) - ((freqtotal4*freqtotal4)/burstnum7))/(burstnum7-1); durationsd4 := sqrt(durationsd4); spikenumsd4 := sqrt(spikenumsd4); freqsd4 := sqrt(freqsd4); phaseonsd4 :=((sqphaseontotal4) - ((phaseontotal4 * phaseontotal4)/(burstnum7-1)))/(burstnum7-2); phaseoffsd4 :=((sqphaseofftotal4) - ((phaseofftotal4 * phaseofftotal4)/(burstnum7-1)))/(burstnum7-2); phaseonsd4 := sqrt(phaseonsd4); phaseoffsd4 := sqrt(phaseoffsd4); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean4 := periodtotal4/(burstnum7-1); frequencymean4 := frequencytotal4/(burstnum7-1); periodsd4 := ((sqperiodtotal4) - ((periodtotal4*periodtotal4)/(burstnum7-1)))/(burstnum7-2); frequencysd4 := ((sqfrequencytotal4) - ((frequencytotal4*frequencytotal4)/(burstnum7-1)))/(burstnum7-2); periodsd4 := sqrt(periodsd4); frequencysd4 := sqrt(frequencysd4); '********************************************************************************************************************************** 'printing the neuron summary for neuron 4 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname4$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean4, spikenummean4, freqmean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd4, spikenumsd4, freqsd4); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean4, frequencymean4); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd4, frequencysd4); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean4, phaseoffmean4); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd4, phaseoffsd4); '******************** FOR PHASEPLOT phaseon[4]:=phaseonmean4; phaseoff[4]:=phaseoffmean4; stdOFF[4]:=phaseoffsd4; stdon[4]:=phaseonsd4; name$[4]:=neuronname4$; spikesperburst[4]:=spikenummean4; spikesperburstSD[4]:=spikenumsd4; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname4$, burstnum7, durationmean4, spikenummean4, freqmean4, periodmean4, frequencymean4, phaseonmean4, phaseoffmean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd4, spikenumsd4, freqsd4, periodsd4, frequencysd4, phaseonsd4, phaseoffsd4); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); 'endif; '***************************************************************************************** 'Begin analysis/writing for neuron 5 of 7 burstnum7 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; sBurst7 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; eBurst7 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); sBurst7 := NextTime(BurstCh7%, eBurst7); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); eBurst7 := NextTime(BurstCh7%, sBurst7); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalyseNeuron7(sBurst7, eBurst7); AnalysePeriod5(sBurst5, eBurst5); AnalysePhase6(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6, sBurst7, eBurst7); burstnum7 :=1+burstnum7; '************************************************************************************************* if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname5$, burstnum7, sBurst5, eBurst5); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%]); '************************************************************************************************* 'COMPUTE PERIOD if results16[resPeriod5%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results16[resPeriod5%], results16[resFrequency5%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results8[resNormSNeuron5%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results8[resNormSNeuron5%], results8[resNormENeuron5%]); endif; endif; if summary% =0 AND xlv% =1 then if results16[resPeriod5%] > -777 and results8[resNormSNeuron5%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname5$, burstnum7, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%],results16[resPeriod5%], results16[resFrequency5%], results8[resNormSNeuron5%], results8[resNormENeuron5%]);endif; if results16[resPeriod5%] > -777 and results8[resNormSNeuron5%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum7, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%],results16[resPeriod5%], results16[resFrequency5%], results8[resNormSNeuron5%], results8[resNormENeuron5%]);endif; if results16[resPeriod5%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum7, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal5 := durationtotal5 + results5[resDuration5%]; spikenumtotal5 := spikenumtotal5 + results5[resSpikes5%]; freqtotal5 := freqtotal5 + results5[resSpikeFreq5%]; sqdurationtotal5 := sqdurationtotal5 + (results5[resDuration5%] * results5[resDuration5%]); sqspikenumtotal5 := sqspikenumtotal5 + (results5[resSpikes5%] * results5[resSpikes5%]); sqfreqtotal5 := sqfreqtotal5 + (results5[resSpikeFreq5%] * results5[resSpikeFreq5%]); if results8[resNormSNeuron5%] > -777 then phaseontotal5 := phaseontotal5 + results8[resNormSNeuron5%]; phaseofftotal5 := phaseofftotal5 + results8[resNormENeuron5%]; sqphaseontotal5 :=sqphaseontotal5 + (results8[resNormSNeuron5%] * results8[resNormSNeuron5%]); sqphaseofftotal5 := sqphaseofftotal5 + (results8[resNormENeuron5%] * results8[resNormENeuron5%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results16[resPeriod5%] > -777 then periodtotal5 := periodtotal5 + results16[resPeriod5%]; frequencytotal5 := frequencytotal5 + results16[resFrequency5%]; sqperiodtotal5 := sqperiodtotal5 + (results16[resPeriod5%] * results16[resPeriod5%]); sqfrequencytotal5 := sqfrequencytotal5 + (results16[resFrequency5%] * results16[resFrequency5%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean5 := durationtotal5/burstnum7; spikenummean5 := spikenumtotal5/burstnum7; freqmean5 := freqtotal5 /burstnum7; phaseonmean5 := phaseontotal5/(burstnum7-1); phaseoffmean5 := phaseofftotal5/(burstnum7-1); 'calculating the standard devs for the bursts... durationsd5 := ((sqdurationtotal5) - ((durationtotal5*durationtotal5)/burstnum7))/(burstnum7-1); spikenumsd5 := ((sqspikenumtotal5) - ((spikenumtotal5*spikenumtotal5)/burstnum7))/(burstnum7-1); freqsd5 := ((sqfreqtotal5) - ((freqtotal5*freqtotal5)/burstnum7))/(burstnum7-1); durationsd5 := sqrt(durationsd5); spikenumsd5 := sqrt(spikenumsd5); freqsd5 := sqrt(freqsd5); phaseonsd5 :=((sqphaseontotal5) - ((phaseontotal5 * phaseontotal5)/(burstnum7-1)))/(burstnum7-2); phaseoffsd5 :=((sqphaseofftotal5) - ((phaseofftotal5 * phaseofftotal5)/(burstnum7-1)))/(burstnum7-2); phaseonsd5 := sqrt(phaseonsd5); phaseoffsd5 := sqrt(phaseoffsd5); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean5 := periodtotal5/(burstnum7-1); frequencymean5 := frequencytotal5/(burstnum7-1); periodsd5 := ((sqperiodtotal5) - ((periodtotal5*periodtotal5)/(burstnum7-1)))/(burstnum7-2); frequencysd5 := ((sqfrequencytotal5) - ((frequencytotal5*frequencytotal5)/(burstnum7-1)))/(burstnum7-2); periodsd5 := sqrt(periodsd5); frequencysd5 := sqrt(frequencysd5); '********************************************************************************************************************************** 'printing the neuron summary for neuron 5 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname5$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean5, spikenummean5, freqmean5); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd5, spikenumsd5, freqsd5); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean5, frequencymean5); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd5, frequencysd5); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean5, phaseoffmean5); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd5, phaseoffsd5); '******************** FOR PHASEPLOT phaseon[5]:=phaseonmean5; phaseoff[5]:=phaseoffmean5; stdOFF[5]:=phaseoffsd5; stdon[5]:=phaseonsd5; name$[5]:=neuronname5$; spikesperburst[5]:=spikenummean5; spikesperburstSD[5]:=spikenumsd5; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname5$, burstnum7, durationmean5, spikenummean5, freqmean5, periodmean5, frequencymean5, phaseonmean5, phaseoffmean5); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd5, spikenumsd5, freqsd5, periodsd5, frequencysd5, phaseonsd5, phaseoffsd5); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); 'endif; '***************************************************************************************** 'Begin analysis/writing for neuron 6 of 7 burstnum7 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; sBurst7 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; eBurst7 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); sBurst7 := NextTime(BurstCh7%, eBurst7); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); eBurst7 := NextTime(BurstCh7%, sBurst7); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalyseNeuron7(sBurst7, eBurst7); AnalysePeriod6(sBurst6, eBurst6); AnalysePhase6(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6, sBurst7, eBurst7); burstnum7 :=1+burstnum7; '********************************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname6$, burstnum7, sBurst6, eBurst6); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%]); '************************************************************************************************* 'COMPUTE PERIOD if results17[resPeriod6%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results17[resPeriod6%], results17[resFrequency6%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results8[resNormSNeuron6%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results8[resNormSNeuron6%], results8[resNormENeuron6%]); endif; endif; if summary% =0 AND xlv% =1 then if results17[resPeriod6%] > -777 and results8[resNormSNeuron6%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname6$, burstnum7, sBurst6, eBurst6, results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%],results17[resPeriod6%], results17[resFrequency6%], results8[resNormSNeuron6%], results8[resNormENeuron6%]);endif; if results17[resPeriod6%] > -777 and results8[resNormSNeuron6%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum7, sBurst6, eBurst6, results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%],results17[resPeriod6%], results17[resFrequency6%], results8[resNormSNeuron6%], results8[resNormENeuron6%]);endif; if results17[resPeriod6%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum7, sBurst6, eBurst6, results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal6 := durationtotal6 + results6[resDuration6%]; spikenumtotal6 := spikenumtotal6 + results6[resSpikes6%]; freqtotal6 := freqtotal6 + results6[resSpikeFreq6%]; sqdurationtotal6 := sqdurationtotal6 + (results6[resDuration6%] * results6[resDuration6%]); sqspikenumtotal6 := sqspikenumtotal6 + (results6[resSpikes6%] * results6[resSpikes6%]); sqfreqtotal6 := sqfreqtotal6 + (results6[resSpikeFreq6%] * results6[resSpikeFreq6%]); if results8[resNormSNeuron6%] > -777 then phaseontotal6 := phaseontotal6 + results8[resNormSNeuron6%]; phaseofftotal6 := phaseofftotal6 + results8[resNormENeuron6%]; sqphaseontotal6 :=sqphaseontotal6 + (results8[resNormSNeuron6%] * results8[resNormSNeuron6%]); sqphaseofftotal6 := sqphaseofftotal6 + (results8[resNormENeuron6%] * results8[resNormENeuron6%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results17[resPeriod6%] > -777 then periodtotal6 := periodtotal6 + results17[resPeriod6%]; frequencytotal6 := frequencytotal6 + results17[resFrequency6%]; sqperiodtotal6 := sqperiodtotal6 + (results17[resPeriod6%] * results17[resPeriod6%]); sqfrequencytotal6 := sqfrequencytotal6 + (results17[resFrequency6%] * results17[resFrequency6%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean6 := durationtotal6/burstnum7; spikenummean6 := spikenumtotal6/burstnum7; freqmean6 := freqtotal6 /burstnum7; phaseonmean6 := phaseontotal6/(burstnum7-1); phaseoffmean6 := phaseofftotal6/(burstnum7-1); 'calculating the standard devs for the bursts... durationsd6 := ((sqdurationtotal6) - ((durationtotal6*durationtotal6)/burstnum7))/(burstnum7-1); spikenumsd6 := ((sqspikenumtotal6) - ((spikenumtotal6*spikenumtotal6)/burstnum7))/(burstnum7-1); freqsd6 := ((sqfreqtotal6) - ((freqtotal6*freqtotal6)/burstnum7))/(burstnum7-1); durationsd6 := sqrt(durationsd6); spikenumsd6 := sqrt(spikenumsd6); freqsd6 := sqrt(freqsd6); phaseonsd6 :=((sqphaseontotal6) - ((phaseontotal6 * phaseontotal6)/(burstnum7-1)))/(burstnum7-2); phaseoffsd6 :=((sqphaseofftotal6) - ((phaseofftotal6 * phaseofftotal6)/(burstnum7-1)))/(burstnum7-2); phaseonsd6 := sqrt(phaseonsd6); phaseoffsd6 := sqrt(phaseoffsd6); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean6 := periodtotal6/(burstnum7-1); frequencymean6 := frequencytotal6/(burstnum7-1); periodsd6 := ((sqperiodtotal6) - ((periodtotal6*periodtotal6)/(burstnum7-1)))/(burstnum7-2); frequencysd6 := ((sqfrequencytotal6) - ((frequencytotal6*frequencytotal6)/(burstnum7-1)))/(burstnum7-2); periodsd6 := sqrt(periodsd6); frequencysd6 := sqrt(frequencysd6); '********************************************************************************************************************************** 'printing the neuron summary for neuron 6 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname6$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean6, spikenummean6, freqmean6); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd6, spikenumsd6, freqsd6); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean6, frequencymean6); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd6, frequencysd6); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean6, phaseoffmean6); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd6, phaseoffsd6); '******************** FOR PHASEPLOT phaseon[6]:=phaseonmean6; phaseoff[6]:=phaseoffmean6; stdOFF[6]:=phaseoffsd6; stdon[6]:=phaseonsd6; name$[6]:=neuronname6$; spikesperburst[6]:=spikenummean6; spikesperburstSD[6]:=spikenumsd6; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname6$, burstnum7, durationmean6, spikenummean6, freqmean6, periodmean6, frequencymean6, phaseonmean6, phaseoffmean6); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd6, spikenumsd6, freqsd6, periodsd6, frequencysd6, phaseonsd6, phaseoffsd6); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); 'endif; '***************************************************************************************** 'Begin analysis/writing for neuron 7 of 7 burstnum7 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; sBurst6 := 0; sBurst7 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; eBurst6 := 0; eBurst7 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); sBurst2 := NextTime(BurstCh2%, eBurst2); sBurst3 := NextTime(BurstCh3%, eBurst3); sBurst4 := NextTime(BurstCh4%, eBurst4); sBurst5 := NextTime(BurstCh5%, eBurst5); sBurst6 := NextTime(BurstCh6%, eBurst6); sBurst7 := NextTime(BurstCh7%, eBurst7); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); eBurst2 := NextTime(BurstCh2%, sBurst2); eBurst3 := NextTime(BurstCh3%, sBurst3); eBurst4 := NextTime(BurstCh4%, sBurst4); eBurst5 := NextTime(BurstCh5%, sBurst5); eBurst6 := NextTime(BurstCh6%, sBurst6); eBurst7 := NextTime(BurstCh7%, sBurst7); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalyseNeuron2(sBurst2, eBurst2); AnalyseNeuron3(sBurst3, eBurst3); AnalyseNeuron4(sBurst4, eBurst4); AnalyseNeuron5(sBurst5, eBurst5); AnalyseNeuron6(sBurst6, eBurst6); AnalyseNeuron7(sBurst7, eBurst7); AnalysePeriod7(sBurst7, eBurst7); AnalysePhase6(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6, sBurst7, eBurst7); burstnum7 :=1+burstnum7; '************************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname7$, burstnum7, sBurst7, eBurst7); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results7[resDuration7%], results7[resSpikes7%], results7[resSpikeFreq7%]); '************************************************************************************************* 'COMPUTE PERIOD if results18[resPeriod7%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results18[resPeriod7%], results18[resFrequency7%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** if results8[resNormSNeuron7%] = -777 then PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Phase-On (%s of %s Cycle Period) Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ============================== ================================ \n"); PrintLog(" %f %f \n\n\n\n\n\n", results8[resNormSNeuron7%], results8[resNormENeuron7%]); endif; endif; if summary% =0 AND xlv% =1 then if results18[resPeriod7%] > -777 and results8[resNormSNeuron7%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) Phase On Phase Off \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", neuronname7$, burstnum7, sBurst7, eBurst7, results7[resDuration7%], results7[resSpikes7%], results7[resSpikeFreq7%],results18[resPeriod7%], results18[resFrequency7%], results8[resNormSNeuron7%], results8[resNormENeuron7%]);endif; if results18[resPeriod7%] > -777 and results8[resNormSNeuron7%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f %f %f\n", burstnum7, sBurst7, eBurst7, results7[resDuration7%], results7[resSpikes7%], results7[resSpikeFreq7%],results18[resPeriod7%], results18[resFrequency7%], results8[resNormSNeuron7%], results8[resNormENeuron7%]);endif; if results18[resPeriod7%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s %s %s\n\n", burstnum7, sBurst7, eBurst7, results7[resDuration7%], results7[resSpikes7%], results7[resSpikeFreq7%], na$, na$, na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal7 := durationtotal7 + results7[resDuration7%]; spikenumtotal7 := spikenumtotal7 + results7[resSpikes7%]; freqtotal7 := freqtotal7 + results7[resSpikeFreq7%]; sqdurationtotal7 := sqdurationtotal7 + (results7[resDuration7%] * results7[resDuration7%]); sqspikenumtotal7 := sqspikenumtotal7 + (results7[resSpikes7%] * results7[resSpikes7%]); sqfreqtotal7 := sqfreqtotal7 + (results7[resSpikeFreq7%] * results7[resSpikeFreq7%]); if results8[resNormSNeuron7%] > -777 then phaseontotal7 := phaseontotal7 + results8[resNormSNeuron7%]; phaseofftotal7 := phaseofftotal7 + results8[resNormENeuron7%]; sqphaseontotal7 :=sqphaseontotal7 + (results8[resNormSNeuron7%] * results8[resNormSNeuron7%]); sqphaseofftotal7 := sqphaseofftotal7 + (results8[resNormENeuron7%] * results8[resNormENeuron7%]); endif; '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results18[resPeriod7%] > -777 then periodtotal7 := periodtotal7 + results18[resPeriod7%]; frequencytotal7 := frequencytotal7 + results18[resFrequency7%]; sqperiodtotal7 := sqperiodtotal7 + (results18[resPeriod7%] * results18[resPeriod7%]); sqfrequencytotal7 := sqfrequencytotal7 + (results18[resFrequency7%] * results18[resFrequency7%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean7 := durationtotal7/burstnum7; spikenummean7 := spikenumtotal7/burstnum7; freqmean7 := freqtotal7 /burstnum7; phaseonmean7 := phaseontotal7/(burstnum7-1); phaseoffmean7 := phaseofftotal7/(burstnum7-1); 'calculating the standard devs for the bursts... durationsd7 := ((sqdurationtotal7) - ((durationtotal7*durationtotal7)/burstnum7))/(burstnum7-1); spikenumsd7 := ((sqspikenumtotal7) - ((spikenumtotal7*spikenumtotal7)/burstnum7))/(burstnum7-1); freqsd7 := ((sqfreqtotal7) - ((freqtotal7*freqtotal7)/burstnum7))/(burstnum7-1); durationsd7 := sqrt(durationsd7); spikenumsd7 := sqrt(spikenumsd7); freqsd7 := sqrt(freqsd7); phaseonsd7 :=((sqphaseontotal7) - ((phaseontotal7 * phaseontotal7)/(burstnum7-1)))/(burstnum7-2); phaseoffsd7 :=((sqphaseofftotal7) - ((phaseofftotal7 * phaseofftotal7)/(burstnum7-1)))/(burstnum7-2); phaseonsd7 := sqrt(phaseonsd7); phaseoffsd7 := sqrt(phaseoffsd7); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean7 := periodtotal7/(burstnum7-1); frequencymean7 := frequencytotal7/(burstnum7-1); periodsd7 := ((sqperiodtotal7) - ((periodtotal7*periodtotal7)/(burstnum7-1)))/(burstnum7-2); frequencysd7 := ((sqfrequencytotal7) - ((frequencytotal7*frequencytotal7)/(burstnum7-1)))/(burstnum7-2); periodsd7 := sqrt(periodsd7); frequencysd7 := sqrt(frequencysd7); '********************************************************************************************************************************** 'printing the neuron summary for neuron 7 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname7$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean7, spikenummean7, freqmean7); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd7, spikenumsd7, freqsd7); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean7, frequencymean7); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd7, frequencysd7); PrintLog(" Mean Phase-On (%s of %s Cycle Period) Mean Phase-Off (%s of %s Cycle Period) \n", percent$, neuronname1$, percent$, neuronname1$); PrintLog(" ===================================== =====================================\n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonmean7, phaseoffmean7); PrintLog(" Phase-On StDev Phase-Off StDev \n" ); PrintLog(" ============== =============== \n"); PrintLog(" %10.5f %10.5f \n\n\n", phaseonsd7, phaseoffsd7); '******************** FOR PHASEPLOT phaseon[7]:=phaseonmean7; phaseoff[7]:=phaseoffmean7; stdOFF[7]:=phaseoffsd7; stdon[7]:=phaseonsd7; name$[7]:=neuronname7$; spikesperburst[7]:=spikenummean7; spikesperburstSD[7]:=spikenumsd7; '********one could add all other types of info hier by creating new variables / array that carry for example firing frequencies '********************* END VALUES FOR PHASEPLOT endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency Mean Phase-On Mean Phase-Off \n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", neuronname7$, burstnum7, durationmean7, spikenummean7, freqmean7, periodmean7, frequencymean7, phaseonmean7, phaseoffmean7); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev Phase-On StDev Phase-Off StDev \n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n", durationsd7, spikenumsd7, freqsd7, periodsd7, frequencysd7, phaseonsd7, phaseoffsd7); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; endif; if phasequery% = 0 then 'enters into "non-phase" sub-part of PART TWELVE: '************************************************************************************************************** '************************************************************************************************************** '************************************************************************************************************** if number1% = 1 then burstnum1 := 0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; sBurst1 := 0; eBurst1 := 0; while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalysePeriod1(sBurst1, eBurst1); burstnum1 :=1+burstnum1; if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum1, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 AND burstnum1 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname1$, burstnum1, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]); endif; if results12[resPeriod1%] > -777 and burstnum1 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum1, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum1, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$);endif; endif; endif; durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum1; spikenummean1 := spikenumtotal1/burstnum1; freqmean1 := freqtotal1 /burstnum1; 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/(burstnum1)))/(burstnum1-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/(burstnum1)))/(burstnum1-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/(burstnum1)))/(burstnum1-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); 'periodsummary '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum1-1); frequencymean1 := frequencytotal1/(burstnum1-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1 * periodtotal1)/(burstnum1-1)))/(burstnum1-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1 * frequencytotal1)/(burstnum1-1)))/(burstnum1-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum1, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname1$, burstnum1, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WRITING DATA IF 2 NEURONS ANALYZED if number1% = 2 then burstnum2 :=0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationtotal2 :=0; spikenumtotal2 :=0; freqtotal2 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; durationmean2 :=0; spikenummean2 :=0; freqmean2 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; sqdurationtotal2 :=0; sqspikenumtotal2 :=0; sqfreqtotal2 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; durationsd2 :=0; spikenumsd2 :=0; freqsd2 :=0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; periodtotal2 :=0; frequencytotal2 :=0; sqperiodtotal2 :=0; sqfrequencytotal2 :=0; periodmean2 :=0; frequencymean2 :=0; periodsd2 :=0; frequencysd2 :=0; sBurst1 :=0; eBurst1 :=0; '******************************************************************************** 'writing/analysing data for neuron 1 of 2 while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalysePeriod1(sBurst1, eBurst1); burstnum2 :=1+burstnum2; '***************************************************************************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum2, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 AND burstnum2 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname1$, burstnum2, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]); endif; if results12[resPeriod1%] > -777 and burstnum2 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum2, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum2, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum2; spikenummean1 := spikenumtotal1/burstnum2; freqmean1 := freqtotal1 /burstnum2; 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/burstnum2))/(burstnum2-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/burstnum2))/(burstnum2-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/burstnum2))/(burstnum2-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum2-1); frequencymean1 := frequencytotal1/(burstnum2-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1*periodtotal1)/(burstnum2-1)))/(burstnum2-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1*frequencytotal1)/(burstnum2-1)))/(burstnum2-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum2, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname1$, burstnum2, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '********************************************************************************************************************************** 'begin the analysis for neuron 2 burstnum2 :=0; sBurst2 :=0; eBurst2 :=0; while sBurst2 >= 0 and eBurst1 >= 0 do sBurst2 := NextTime(BurstCh2%, eBurst2); if sBurst2 > 0 then eBurst2 := NextTime(BurstCh2%, sBurst2); if eBurst2 > 0 then AnalyseNeuron2(sBurst2, eBurst2); AnalysePeriod2(sBurst2, eBurst2); burstnum2 :=1+burstnum2; '***************************************************************************************************************************************************** 'single burst analyses for neuron 2 if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname2$, burstnum2, sBurst2, eBurst2); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%]); '************************************************************************************************* 'COMPUTE PERIOD if results13[resPeriod2%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results13[resPeriod2%], results13[resFrequency2%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results13[resPeriod2%] > -777 AND burstnum2 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname2$, burstnum2, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%]);endif; if results13[resPeriod2%] > -777 AND burstnum2 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum2, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%]);endif; if results13[resPeriod2%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum2, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal2 := durationtotal2 + results2[resDuration2%]; spikenumtotal2 := spikenumtotal2 + results2[resSpikes2%]; freqtotal2 := freqtotal2 + results2[resSpikeFreq2%]; sqdurationtotal2 := sqdurationtotal2 + (results2[resDuration2%] * results2[resDuration2%]); sqspikenumtotal2 := sqspikenumtotal2 + (results2[resSpikes2%] * results2[resSpikes2%]); sqfreqtotal2 := sqfreqtotal2 + (results2[resSpikeFreq2%] * results2[resSpikeFreq2%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results13[resPeriod2%] > -777 then periodtotal2 := periodtotal2 + results13[resPeriod2%]; frequencytotal2 := frequencytotal2 + results13[resFrequency2%]; sqperiodtotal2 := sqperiodtotal2 + (results13[resPeriod2%] * results13[resPeriod2%]); sqfrequencytotal2 := sqfrequencytotal2 + (results13[resFrequency2%] * results13[resFrequency2%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean2 := durationtotal2/burstnum2; spikenummean2 := spikenumtotal2/burstnum2; freqmean2 := freqtotal2 /burstnum2; 'calculating the standard devs for the bursts... durationsd2 := ((sqdurationtotal2) - ((durationtotal2*durationtotal2)/burstnum2))/(burstnum2-1); spikenumsd2 := ((sqspikenumtotal2) - ((spikenumtotal2*spikenumtotal2)/burstnum2))/(burstnum2-1); freqsd2 := ((sqfreqtotal2) - ((freqtotal2*freqtotal2)/burstnum2))/(burstnum2-1); durationsd2 := sqrt(durationsd2); spikenumsd2 := sqrt(spikenumsd2); freqsd2 := sqrt(freqsd2); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean2 := periodtotal2/(burstnum2-1); frequencymean2 := frequencytotal2/(burstnum2-1); periodsd2 := ((sqperiodtotal2) - ((periodtotal2 * periodtotal2)/(burstnum2-1)))/(burstnum2-2); frequencysd2 := ((sqfrequencytotal2) - ((frequencytotal2 * frequencytotal2)/(burstnum2-1)))/(burstnum2-2); periodsd2 := sqrt(periodsd2); frequencysd2 := sqrt(frequencysd2); '********************************************************************************************************************************** 'printing the neuron summary for neuron 2 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname2$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum2, durationmean2, spikenummean2, freqmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd2, spikenumsd2, freqsd2); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean2, frequencymean2); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd2, frequencysd2); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname2$, burstnum2, durationmean2, spikenummean2, freqmean2, periodmean2, frequencymean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd2, spikenumsd2, freqsd2, periodsd2, frequencysd2); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WRITING DATA IF 3 NEURONS ANALYZED if number1% = 3 then burstnum3 :=0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationtotal2 :=0; spikenumtotal2 :=0; freqtotal2 :=0; durationtotal3 :=0; spikenumtotal3 :=0; freqtotal3 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; durationmean2 :=0; spikenummean2 :=0; freqmean2 :=0; durationmean3 :=0; spikenummean3 :=0; freqmean3 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; sqdurationtotal2 :=0; sqspikenumtotal2 :=0; sqfreqtotal2 :=0; sqdurationtotal3 :=0; sqspikenumtotal3 :=0; sqfreqtotal3 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; durationsd2 :=0; spikenumsd2 :=0; freqsd2 :=0; durationsd3 :=0; spikenumsd3 :=0; freqsd3 :=0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; periodtotal2 :=0; frequencytotal2 :=0; sqperiodtotal2 :=0; sqfrequencytotal2 :=0; periodmean2 :=0; frequencymean2 :=0; periodsd2 :=0; frequencysd2 :=0; periodtotal3 :=0; frequencytotal3 :=0; sqperiodtotal3 :=0; sqfrequencytotal3 :=0; periodmean3 :=0; frequencymean3 :=0; periodsd3 :=0; frequencysd3 :=0; eBurst1 :=0; sBurst1 :=0; '********************************************************************************** 'writing/analysing data for neuron 1 of 3 while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalysePeriod1(sBurst1, eBurst1); burstnum3 :=1+burstnum3; '************************************************************************************* if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum3, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 AND burstnum3 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname1$, burstnum3, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]); endif; if results12[resPeriod1%] > -777 and burstnum3 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum3, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum3, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum3; spikenummean1 := spikenumtotal1/burstnum3; freqmean1 := freqtotal1 /burstnum3; 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/burstnum3))/(burstnum3-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/burstnum3))/(burstnum3-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/burstnum3))/(burstnum3-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum3-1); frequencymean1 := frequencytotal1/(burstnum3-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1*periodtotal1)/(burstnum3-1)))/(burstnum3-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1*frequencytotal1)/(burstnum3-1)))/(burstnum3-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum3, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname1$, burstnum3, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '**************************************************************************** 'Begin writing/analysis for neuron 2 0f 3' burstnum3 :=0; sBurst1 :=0; sBurst2 :=0; sBurst3 :=0; eBurst1 :=0; eBurst2 :=0; eBurst3 :=0; while sBurst2 >= 0 and eBurst2 >= 0 do sBurst2 := NextTime(BurstCh2%, eBurst2); if sBurst2 > 0 then eBurst2 := NextTime(BurstCh2%, sBurst2); if eBurst2 > 0 then AnalyseNeuron2(sBurst2, eBurst2); AnalysePeriod2(sBurst2, eBurst2); burstnum3 :=1+burstnum3; '******************************************************************************* if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname2$, burstnum3, sBurst2, eBurst2); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%]); '************************************************************************************************* 'COMPUTE PERIOD if results13[resPeriod2%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results13[resPeriod2%], results13[resFrequency2%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results13[resPeriod2%] > -777 AND burstnum3 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname2$, burstnum3, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%]);endif; if results13[resPeriod2%] > -777 AND burstnum3 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum3, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%]);endif; if results13[resPeriod2%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum3, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal2 := durationtotal2 + results2[resDuration2%]; spikenumtotal2 := spikenumtotal2 + results2[resSpikes2%]; freqtotal2 := freqtotal2 + results2[resSpikeFreq2%]; sqdurationtotal2 := sqdurationtotal2 + (results2[resDuration2%] * results2[resDuration2%]); sqspikenumtotal2 := sqspikenumtotal2 + (results2[resSpikes2%] * results2[resSpikes2%]); sqfreqtotal2 := sqfreqtotal2 + (results2[resSpikeFreq2%] * results2[resSpikeFreq2%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results13[resPeriod2%] > -777 then periodtotal2 := periodtotal2 + results13[resPeriod2%]; frequencytotal2 := frequencytotal2 + results13[resFrequency2%]; sqperiodtotal2 := sqperiodtotal2 + (results13[resPeriod2%] * results13[resPeriod2%]); sqfrequencytotal2 := sqfrequencytotal2 + (results13[resFrequency2%] * results13[resFrequency2%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean2 := durationtotal2/burstnum3; spikenummean2 := spikenumtotal2/burstnum3; freqmean2 := freqtotal2 /burstnum3; 'calculating the standard devs for the bursts... durationsd2 := ((sqdurationtotal2) - ((durationtotal2*durationtotal2)/burstnum3))/(burstnum3-1); spikenumsd2 := ((sqspikenumtotal2) - ((spikenumtotal2*spikenumtotal2)/burstnum3))/(burstnum3-1); freqsd2 := ((sqfreqtotal2) - ((freqtotal2*freqtotal2)/burstnum3))/(burstnum3-1); durationsd2 := sqrt(durationsd2); spikenumsd2 := sqrt(spikenumsd2); freqsd2 := sqrt(freqsd2); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean2 := periodtotal2/(burstnum3-1); frequencymean2 := frequencytotal2/(burstnum3-1); periodsd2 := ((sqperiodtotal2) - ((periodtotal2*periodtotal2)/(burstnum3-1)))/(burstnum3-2); frequencysd2 := ((sqfrequencytotal2) - ((frequencytotal2*frequencytotal2)/(burstnum3-1)))/(burstnum3-2); periodsd2 := sqrt(periodsd2); frequencysd2 := sqrt(frequencysd2); '********************************************************************************************************************************** 'printing the neuron summary for neuron 2 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname2$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum3, durationmean2, spikenummean2, freqmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd2, spikenumsd2, freqsd2); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean2, frequencymean2); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd2, frequencysd2); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname2$, burstnum3, durationmean2, spikenummean2, freqmean2, periodmean2, frequencymean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd2, spikenumsd2, freqsd2, periodsd2, frequencysd2); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '******************************************************************************************** 'Begin writing/analysis for neuron 3 of 3 burstnum3 :=0; sBurst3 :=0; eBurst3 :=0; while sBurst3 >= 0 and eBurst3 >= 0 do sBurst3 := NextTime(BurstCh3%, eBurst3); if sBurst3 > 0 then eBurst3 := NextTime(BurstCh3%, sBurst3); if eBurst3 > 0 then AnalyseNeuron3(sBurst3, eBurst3); AnalysePeriod3(sBurst3, eBurst3); burstnum3 :=1+burstnum3; '******************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname3$, burstnum3, sBurst3, eBurst3); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%]); '************************************************************************************************* 'COMPUTE PERIOD if results14[resPeriod3%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results14[resPeriod3%], results14[resFrequency3%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results14[resPeriod3%] > -777 AND burstnum3 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname3$, burstnum3, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%]);endif; if results14[resPeriod3%] > -777 AND burstnum3 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum3, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%]);endif; if results14[resPeriod3%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum3, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal3 := durationtotal3 + results3[resDuration3%]; spikenumtotal3 := spikenumtotal3 + results3[resSpikes3%]; freqtotal3 := freqtotal3 + results3[resSpikeFreq3%]; sqdurationtotal3 := sqdurationtotal3 + (results3[resDuration3%] * results3[resDuration3%]); sqspikenumtotal3 := sqspikenumtotal3 + (results3[resSpikes3%] * results3[resSpikes3%]); sqfreqtotal3 := sqfreqtotal3 + (results3[resSpikeFreq3%] * results3[resSpikeFreq3%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results14[resPeriod3%] > -777 then periodtotal3 := periodtotal3 + results14[resPeriod3%]; frequencytotal3 := frequencytotal3 + results14[resFrequency3%]; sqperiodtotal3 := sqperiodtotal3 + (results14[resPeriod3%] * results14[resPeriod3%]); sqfrequencytotal3 := sqfrequencytotal3 + (results14[resFrequency3%] * results14[resFrequency3%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean3 := durationtotal3/burstnum3; spikenummean3 := spikenumtotal3/burstnum3; freqmean3 := freqtotal3 /burstnum3; 'calculating the standard devs for the bursts... durationsd3 := ((sqdurationtotal3) - ((durationtotal3*durationtotal3)/burstnum3))/(burstnum3-1); spikenumsd3 := ((sqspikenumtotal3) - ((spikenumtotal3*spikenumtotal3)/burstnum3))/(burstnum3-1); freqsd3 := ((sqfreqtotal3) - ((freqtotal3*freqtotal3)/burstnum3))/(burstnum3-1); durationsd3 := sqrt(durationsd3); spikenumsd3 := sqrt(spikenumsd3); freqsd3 := sqrt(freqsd3); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean3 := periodtotal3/(burstnum3-1); frequencymean3 := frequencytotal3/(burstnum3-1); periodsd3 := ((sqperiodtotal3) - ((periodtotal3*periodtotal3)/(burstnum3-1)))/(burstnum3-2); frequencysd3 := ((sqfrequencytotal3) - ((frequencytotal3*frequencytotal3)/(burstnum3-1)))/(burstnum3-2); periodsd3 := sqrt(periodsd3); frequencysd3 := sqrt(frequencysd3); '********************************************************************************************************************************** 'printing the neuron summary for neuron 3 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname3$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum3, durationmean3, spikenummean3, freqmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd3, spikenumsd3, freqsd3); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean3, frequencymean3); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd3, frequencysd3); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname3$, burstnum3, durationmean3, spikenummean3, freqmean3, periodmean3, frequencymean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd3, spikenumsd3, freqsd3, periodsd3, frequencysd3); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WRITING DATA IF 4 NEURONS ANALYZED if number1% = 4 then burstnum4 :=0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationtotal2 :=0; spikenumtotal2 :=0; freqtotal2 :=0; durationtotal3 :=0; spikenumtotal3 :=0; freqtotal3 :=0; durationtotal4 :=0; spikenumtotal4 :=0; freqtotal4 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; durationmean2 :=0; spikenummean2 :=0; freqmean2 :=0; durationmean3 :=0; spikenummean3 :=0; freqmean3 :=0; durationmean4 :=0; spikenummean4 :=0; freqmean4 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; sqdurationtotal2 :=0; sqspikenumtotal2 :=0; sqfreqtotal2 :=0; sqdurationtotal3 :=0; sqspikenumtotal3 :=0; sqfreqtotal3 :=0; sqdurationtotal4 :=0; sqspikenumtotal4 :=0; sqfreqtotal4 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; durationsd2 :=0; spikenumsd2 :=0; freqsd2 :=0; durationsd3 :=0; spikenumsd3 :=0; freqsd3 :=0; durationsd4 :=0; spikenumsd4 :=0; freqsd4 :=0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; periodtotal2 :=0; frequencytotal2 :=0; sqperiodtotal2 :=0; sqfrequencytotal2 :=0; periodmean2 :=0; frequencymean2 :=0; periodsd2 :=0; frequencysd2 :=0; periodtotal3 :=0; frequencytotal3 :=0; sqperiodtotal3 :=0; sqfrequencytotal3 :=0; periodmean3 :=0; frequencymean3 :=0; periodsd3 :=0; frequencysd3 :=0; periodtotal4 :=0; frequencytotal4 :=0; sqperiodtotal4 :=0; sqfrequencytotal4 :=0; periodmean4 :=0; frequencymean4 :=0; periodsd4 :=0; frequencysd4 :=0; eBurst1 :=0; sBurst1 :=0; '******************************************************************************* ''Begin analysis/writing for neuron 1 of 4 while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalysePeriod1(sBurst1, eBurst1); burstnum4 :=1+burstnum4; '************************************************************************************ if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum4, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 AND burstnum4 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname1$, burstnum4, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]); endif; if results12[resPeriod1%] > -777 and burstnum4 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum4, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum4, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum4; spikenummean1 := spikenumtotal1/burstnum4; freqmean1 := freqtotal1 /burstnum4; 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/burstnum4))/(burstnum4-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/burstnum4))/(burstnum4-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/burstnum4))/(burstnum4-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum4-1); frequencymean1 := frequencytotal1/(burstnum4-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1*periodtotal1)/(burstnum4-1)))/(burstnum4-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1*frequencytotal1)/(burstnum4-1)))/(burstnum4-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum4, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname1$, burstnum4, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '************************************************************************** 'Begin analysis/writing for neuron 2 of 4 burstnum4 :=0; sBurst2 := 0; eBurst2 := 0; while sBurst2 >= 0 and eBurst2 >= 0 do sBurst2 := NextTime(BurstCh2%, eBurst2); if sBurst2 > 0 then eBurst2 := NextTime(BurstCh2%, sBurst2); if eBurst2 > 0 then AnalyseNeuron2(sBurst2, eBurst2); AnalysePeriod2(sBurst2, eBurst2); burstnum4 :=1+burstnum4; '************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname2$, burstnum4, sBurst2, eBurst2); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%]); '************************************************************************************************* 'COMPUTE PERIOD if results13[resPeriod2%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results13[resPeriod2%], results13[resFrequency2%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results13[resPeriod2%] > -777 AND burstnum4 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname2$, burstnum4, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%]);endif; if results13[resPeriod2%] > -777 AND burstnum4 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum4, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%]);endif; if results13[resPeriod2%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum4, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal2 := durationtotal2 + results2[resDuration2%]; spikenumtotal2 := spikenumtotal2 + results2[resSpikes2%]; freqtotal2 := freqtotal2 + results2[resSpikeFreq2%]; sqdurationtotal2 := sqdurationtotal2 + (results2[resDuration2%] * results2[resDuration2%]); sqspikenumtotal2 := sqspikenumtotal2 + (results2[resSpikes2%] * results2[resSpikes2%]); sqfreqtotal2 := sqfreqtotal2 + (results2[resSpikeFreq2%] * results2[resSpikeFreq2%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results13[resPeriod2%] > -777 then periodtotal2 := periodtotal2 + results13[resPeriod2%]; frequencytotal2 := frequencytotal2 + results13[resFrequency2%]; sqperiodtotal2 := sqperiodtotal2 + (results13[resPeriod2%] * results13[resPeriod2%]); sqfrequencytotal2 := sqfrequencytotal2 + (results13[resFrequency2%] * results13[resFrequency2%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean2 := durationtotal2/burstnum4; spikenummean2 := spikenumtotal2/burstnum4; freqmean2 := freqtotal2 /burstnum4; 'calculating the standard devs for the bursts... durationsd2 := ((sqdurationtotal2) - ((durationtotal2*durationtotal2)/burstnum4))/(burstnum4-1); spikenumsd2 := ((sqspikenumtotal2) - ((spikenumtotal2*spikenumtotal2)/burstnum4))/(burstnum4-1); freqsd2 := ((sqfreqtotal2) - ((freqtotal2*freqtotal2)/burstnum4))/(burstnum4-1); durationsd2 := sqrt(durationsd2); spikenumsd2 := sqrt(spikenumsd2); freqsd2 := sqrt(freqsd2); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean2 := periodtotal2/(burstnum4-1); frequencymean2 := frequencytotal2/(burstnum4-1); periodsd2 := ((sqperiodtotal2) - ((periodtotal2*periodtotal2)/(burstnum4-1)))/(burstnum4-2); frequencysd2 := ((sqfrequencytotal2) - ((frequencytotal2*frequencytotal2)/(burstnum4-1)))/(burstnum4-2); periodsd2 := sqrt(periodsd2); frequencysd2 := sqrt(frequencysd2); '********************************************************************************************************************************** 'printing the neuron summary for neuron 2 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname2$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum4, durationmean2, spikenummean2, freqmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd2, spikenumsd2, freqsd2); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean2, frequencymean2); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd2, frequencysd2); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname2$, burstnum4, durationmean2, spikenummean2, freqmean2, periodmean2, frequencymean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd2, spikenumsd2, freqsd2, periodsd2, frequencysd2); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '*************************************************************************************** 'Begin analysis/writing for neuron 3 of 4 burstnum4 :=0; sBurst3 := 0; eBurst3 := 0; while sBurst3 >= 0 and eBurst3 >= 0 do sBurst3 := NextTime(BurstCh3%, eBurst3); if sBurst3 > 0 then eBurst3 := NextTime(BurstCh3%, sBurst3); if eBurst3 > 0 then AnalyseNeuron3(sBurst3, eBurst3); AnalysePeriod3(sBurst3, eBurst3); burstnum4 :=1+burstnum4; '************************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname3$, burstnum4, sBurst3, eBurst3); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%]); '************************************************************************************************* 'COMPUTE PERIOD if results14[resPeriod3%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results14[resPeriod3%], results14[resFrequency3%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results14[resPeriod3%] > -777 AND burstnum4 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname3$, burstnum4, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%]);endif; if results14[resPeriod3%] > -777 AND burstnum4 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum4, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%]);endif; if results14[resPeriod3%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum4, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal3 := durationtotal3 + results3[resDuration3%]; spikenumtotal3 := spikenumtotal3 + results3[resSpikes3%]; freqtotal3 := freqtotal3 + results3[resSpikeFreq3%]; sqdurationtotal3 := sqdurationtotal3 + (results3[resDuration3%] * results3[resDuration3%]); sqspikenumtotal3 := sqspikenumtotal3 + (results3[resSpikes3%] * results3[resSpikes3%]); sqfreqtotal3 := sqfreqtotal3 + (results3[resSpikeFreq3%] * results3[resSpikeFreq3%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results14[resPeriod3%] > -777 then periodtotal3 := periodtotal3 + results14[resPeriod3%]; frequencytotal3 := frequencytotal3 + results14[resFrequency3%]; sqperiodtotal3 := sqperiodtotal3 + (results14[resPeriod3%] * results14[resPeriod3%]); sqfrequencytotal3 := sqfrequencytotal3 + (results14[resFrequency3%] * results14[resFrequency3%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean3 := durationtotal3/burstnum4; spikenummean3 := spikenumtotal3/burstnum4; freqmean3 := freqtotal3 /burstnum4; 'calculating the standard devs for the bursts... durationsd3 := ((sqdurationtotal3) - ((durationtotal3*durationtotal3)/burstnum4))/(burstnum4-1); spikenumsd3 := ((sqspikenumtotal3) - ((spikenumtotal3*spikenumtotal3)/burstnum4))/(burstnum4-1); freqsd3 := ((sqfreqtotal3) - ((freqtotal3*freqtotal3)/burstnum4))/(burstnum4-1); durationsd3 := sqrt(durationsd3); spikenumsd3 := sqrt(spikenumsd3); freqsd3 := sqrt(freqsd3); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean3 := periodtotal3/(burstnum4-1); frequencymean3 := frequencytotal3/(burstnum4-1); periodsd3 := ((sqperiodtotal3) - ((periodtotal3*periodtotal3)/(burstnum4-1)))/(burstnum4-2); frequencysd3 := ((sqfrequencytotal3) - ((frequencytotal3*frequencytotal3)/(burstnum4-1)))/(burstnum4-2); periodsd3 := sqrt(periodsd3); frequencysd3 := sqrt(frequencysd3); '********************************************************************************************************************************** 'printing the neuron summary for neuron 3 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname3$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum4, durationmean3, spikenummean3, freqmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd3, spikenumsd3, freqsd3); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean3, frequencymean3); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd3, frequencysd3); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname3$, burstnum4, durationmean3, spikenummean3, freqmean3, periodmean3, frequencymean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd3, spikenumsd3, freqsd3, periodsd3, frequencysd3); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '***************************************************************************** 'Begin analysis/writing for neuron 4 of 4 burstnum4 :=0; sBurst4 := 0; eBurst4 := 0; while sBurst4 >= 0 and eBurst4 >= 0 do sBurst4 := NextTime(BurstCh4%, eBurst4); if sBurst4 > 0 then eBurst4 := NextTime(BurstCh4%, sBurst4); if eBurst4 > 0 then AnalyseNeuron4(sBurst4, eBurst4); AnalysePeriod4(sBurst4, eburst4); burstnum4 :=1+burstnum4; '************************************************************************************ if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname4$, burstnum4, sBurst4, eBurst4); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%]); '************************************************************************************************* 'COMPUTE PERIOD if results15[resPeriod4%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results15[resPeriod4%], results15[resFrequency4%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results15[resPeriod4%] > -777 AND burstnum4 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname4$, burstnum4, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%]);endif; if results15[resPeriod4%] > -777 AND burstnum4 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum4, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%]);endif; if results15[resPeriod4%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum4, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal4 := durationtotal4 + results4[resDuration4%]; spikenumtotal4 := spikenumtotal4 + results4[resSpikes4%]; freqtotal4 := freqtotal4 + results4[resSpikeFreq4%]; sqdurationtotal4 := sqdurationtotal4 + (results4[resDuration4%] * results4[resDuration4%]); sqspikenumtotal4 := sqspikenumtotal4 + (results4[resSpikes4%] * results4[resSpikes4%]); sqfreqtotal4 := sqfreqtotal4 + (results4[resSpikeFreq4%] * results4[resSpikeFreq4%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results15[resPeriod4%] > -777 then periodtotal4 := periodtotal4 + results15[resPeriod4%]; frequencytotal4 := frequencytotal4 + results15[resFrequency4%]; sqperiodtotal4 := sqperiodtotal4 + (results15[resPeriod4%] * results15[resPeriod4%]); sqfrequencytotal4 := sqfrequencytotal4 + (results15[resFrequency4%] * results15[resFrequency4%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean4 := durationtotal4/burstnum4; spikenummean4 := spikenumtotal4/burstnum4; freqmean4 := freqtotal4 /burstnum4; 'calculating the standard devs for the bursts... durationsd4 := ((sqdurationtotal4) - ((durationtotal4*durationtotal4)/burstnum4))/(burstnum4-1); spikenumsd4 := ((sqspikenumtotal4) - ((spikenumtotal4*spikenumtotal4)/burstnum4))/(burstnum4-1); freqsd4 := ((sqfreqtotal4) - ((freqtotal4*freqtotal4)/burstnum4))/(burstnum4-1); durationsd4 := sqrt(durationsd4); spikenumsd4 := sqrt(spikenumsd4); freqsd4 := sqrt(freqsd4); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean4 := periodtotal4/(burstnum4-1); frequencymean4 := frequencytotal4/(burstnum4-1); periodsd4 := ((sqperiodtotal4) - ((periodtotal4*periodtotal4)/(burstnum4-1)))/(burstnum4-2); frequencysd4 := ((sqfrequencytotal4) - ((frequencytotal4*frequencytotal4)/(burstnum4-1)))/(burstnum4-2); periodsd4 := sqrt(periodsd4); frequencysd4 := sqrt(frequencysd4); '********************************************************************************************************************************** 'printing the neuron summary for neuron 4 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname4$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum4, durationmean4, spikenummean4, freqmean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd4, spikenumsd4, freqsd4); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean4, frequencymean4); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd4, frequencysd4); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname4$, burstnum4, durationmean4, spikenummean4, freqmean4, periodmean4, frequencymean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd4, spikenumsd4, freqsd4, periodsd4, frequencysd4); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WRITING DATA IF 5 NEURONS ANALYZED if number1% = 5 then burstnum5 :=0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationtotal2 :=0; spikenumtotal2 :=0; freqtotal2 :=0; durationtotal3 :=0; spikenumtotal3 :=0; freqtotal3 :=0; durationtotal4 :=0; spikenumtotal4 :=0; freqtotal4 :=0; durationtotal5 :=0; spikenumtotal5 :=0; freqtotal5 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; durationmean2 :=0; spikenummean2 :=0; freqmean2 :=0; durationmean3 :=0; spikenummean3 :=0; freqmean3 :=0; durationmean4 :=0; spikenummean4 :=0; freqmean4 :=0; durationmean5 :=0; spikenummean5 :=0; freqmean5 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; sqdurationtotal2 :=0; sqspikenumtotal2 :=0; sqfreqtotal2 :=0; sqdurationtotal3 :=0; sqspikenumtotal3 :=0; sqfreqtotal3 :=0; sqdurationtotal4 :=0; sqspikenumtotal4 :=0; sqfreqtotal4 :=0; sqdurationtotal5 :=0; sqspikenumtotal5 :=0; sqfreqtotal5 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; durationsd2 :=0; spikenumsd2 :=0; freqsd2 :=0; durationsd3 :=0; spikenumsd3 :=0; freqsd3 :=0; durationsd4 :=0; spikenumsd4 :=0; freqsd4 :=0; durationsd5 :=0; spikenumsd5 :=0; freqsd5 :=0; sBurst1 := 0; sBurst2 := 0; sBurst3 := 0; sBurst4 := 0; sBurst5 := 0; eBurst1 := 0; eBurst2 := 0; eBurst3 := 0; eBurst4 := 0; eBurst5 := 0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; periodtotal2 :=0; frequencytotal2 :=0; sqperiodtotal2 :=0; sqfrequencytotal2 :=0; periodmean2 :=0; frequencymean2 :=0; periodsd2 :=0; frequencysd2 :=0; periodtotal3 :=0; frequencytotal3 :=0; sqperiodtotal3 :=0; sqfrequencytotal3 :=0; periodmean3 :=0; frequencymean3 :=0; periodsd3 :=0; frequencysd3 :=0; periodtotal4 :=0; frequencytotal4 :=0; sqperiodtotal4 :=0; sqfrequencytotal4 :=0; periodmean4 :=0; frequencymean4 :=0; periodsd4 :=0; frequencysd4 :=0; periodtotal5 :=0; frequencytotal5 :=0; sqperiodtotal5 :=0; sqfrequencytotal5 :=0; periodmean5 :=0; frequencymean5 :=0; periodsd5 :=0; frequencysd5 :=0; '********************************************************************************* 'Begin analysis/writing for neuron 1 of 5 while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalysePeriod1(sBurst1, eBurst1); burstnum5 :=1+burstnum5; '******************************************************************************************* if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum5, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 AND burstnum5 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname1$, burstnum5, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]); endif; if results12[resPeriod1%] > -777 and burstnum5 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum5, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum5, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum5; spikenummean1 := spikenumtotal1/burstnum5; freqmean1 := freqtotal1 /burstnum5; 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/burstnum5))/(burstnum5-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/burstnum5))/(burstnum5-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/burstnum5))/(burstnum5-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum5-1); frequencymean1 := frequencytotal1/(burstnum5-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1*periodtotal1)/(burstnum5-1)))/(burstnum5-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1*frequencytotal1)/(burstnum5-1)))/(burstnum5-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum5, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname1$, burstnum5, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '**************************************************************************************** 'Begin analysis/writing for neuron 2 of 5 burstnum5 :=0; sBurst2 := 0; eBurst2 := 0; while sBurst2 >= 0 and eBurst2 >= 0 do sBurst2 := NextTime(BurstCh2%, eBurst2); if sBurst2 > 0 then eBurst2 := NextTime(BurstCh2%, sBurst2); if eBurst2 > 0 then AnalyseNeuron2(sBurst2, eBurst2); AnalysePeriod2(sBurst2, eBurst2); burstnum5 :=1+burstnum5; '************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname2$, burstnum5, sBurst2, eBurst2); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%]); '************************************************************************************************* 'COMPUTE PERIOD if results13[resPeriod2%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results13[resPeriod2%], results13[resFrequency2%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results13[resPeriod2%] > -777 AND burstnum5 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname2$, burstnum5, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%]);endif; if results13[resPeriod2%] > -777 AND burstnum5 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum5, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%]);endif; if results13[resPeriod2%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum5, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal2 := durationtotal2 + results2[resDuration2%]; spikenumtotal2 := spikenumtotal2 + results2[resSpikes2%]; freqtotal2 := freqtotal2 + results2[resSpikeFreq2%]; sqdurationtotal2 := sqdurationtotal2 + (results2[resDuration2%] * results2[resDuration2%]); sqspikenumtotal2 := sqspikenumtotal2 + (results2[resSpikes2%] * results2[resSpikes2%]); sqfreqtotal2 := sqfreqtotal2 + (results2[resSpikeFreq2%] * results2[resSpikeFreq2%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results13[resPeriod2%] > -777 then periodtotal2 := periodtotal2 + results13[resPeriod2%]; frequencytotal2 := frequencytotal2 + results13[resFrequency2%]; sqperiodtotal2 := sqperiodtotal2 + (results13[resPeriod2%] * results13[resPeriod2%]); sqfrequencytotal2 := sqfrequencytotal2 + (results13[resFrequency2%] * results13[resFrequency2%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean2 := durationtotal2/burstnum5; spikenummean2 := spikenumtotal2/burstnum5; freqmean2 := freqtotal2 /burstnum5; 'calculating the standard devs for the bursts... durationsd2 := ((sqdurationtotal2) - ((durationtotal2*durationtotal2)/burstnum5))/(burstnum5-1); spikenumsd2 := ((sqspikenumtotal2) - ((spikenumtotal2*spikenumtotal2)/burstnum5))/(burstnum5-1); freqsd2 := ((sqfreqtotal2) - ((freqtotal2*freqtotal2)/burstnum5))/(burstnum5-1); durationsd2 := sqrt(durationsd2); spikenumsd2 := sqrt(spikenumsd2); freqsd2 := sqrt(freqsd2); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean2 := periodtotal2/(burstnum5-1); frequencymean2 := frequencytotal2/(burstnum5-1); periodsd2 := ((sqperiodtotal2) - ((periodtotal2*periodtotal2)/(burstnum5-1)))/(burstnum5-2); frequencysd2 := ((sqfrequencytotal2) - ((frequencytotal2*frequencytotal2)/(burstnum5-1)))/(burstnum5-2); periodsd2 := sqrt(periodsd2); frequencysd2 := sqrt(frequencysd2); '********************************************************************************************************************************** 'printing the neuron summary for neuron 2 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname2$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum5, durationmean2, spikenummean2, freqmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd2, spikenumsd2, freqsd2); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean2, frequencymean2); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd2, frequencysd2); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname2$, burstnum5, durationmean2, spikenummean2, freqmean2, periodmean2, frequencymean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd2, spikenumsd2, freqsd2, periodsd2, frequencysd2); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '******************************************************************************************* 'Begin analysis/writing for neuron 3 of 5 burstnum5 :=0; sBurst3 := 0; eBurst3 := 0; while sBurst3 >= 0 and eBurst3 >= 0 do sBurst3 := NextTime(BurstCh3%, eBurst3); if sBurst3 > 0 then eBurst3 := NextTime(BurstCh3%, sBurst3); if eBurst3 > 0 then AnalyseNeuron3(sBurst3, eBurst3); AnalysePeriod3(sBurst3, eBurst3); burstnum5 :=1+burstnum5; '***************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname3$, burstnum5, sBurst3, eBurst3); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%]); '************************************************************************************************* 'COMPUTE PERIOD if results14[resPeriod3%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results14[resPeriod3%], results14[resFrequency3%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results14[resPeriod3%] > -777 AND burstnum5 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname3$, burstnum5, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%]);endif; if results14[resPeriod3%] > -777 AND burstnum5 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum5, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%]);endif; if results14[resPeriod3%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum5, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal3 := durationtotal3 + results3[resDuration3%]; spikenumtotal3 := spikenumtotal3 + results3[resSpikes3%]; freqtotal3 := freqtotal3 + results3[resSpikeFreq3%]; sqdurationtotal3 := sqdurationtotal3 + (results3[resDuration3%] * results3[resDuration3%]); sqspikenumtotal3 := sqspikenumtotal3 + (results3[resSpikes3%] * results3[resSpikes3%]); sqfreqtotal3 := sqfreqtotal3 + (results3[resSpikeFreq3%] * results3[resSpikeFreq3%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results14[resPeriod3%] > -777 then periodtotal3 := periodtotal3 + results14[resPeriod3%]; frequencytotal3 := frequencytotal3 + results14[resFrequency3%]; sqperiodtotal3 := sqperiodtotal3 + (results14[resPeriod3%] * results14[resPeriod3%]); sqfrequencytotal3 := sqfrequencytotal3 + (results14[resFrequency3%] * results14[resFrequency3%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean3 := durationtotal3/burstnum5; spikenummean3 := spikenumtotal3/burstnum5; freqmean3 := freqtotal3 /burstnum5; 'calculating the standard devs for the bursts... durationsd3 := ((sqdurationtotal3) - ((durationtotal3*durationtotal3)/burstnum5))/(burstnum5-1); spikenumsd3 := ((sqspikenumtotal3) - ((spikenumtotal3*spikenumtotal3)/burstnum5))/(burstnum5-1); freqsd3 := ((sqfreqtotal3) - ((freqtotal3*freqtotal3)/burstnum5))/(burstnum5-1); durationsd3 := sqrt(durationsd3); spikenumsd3 := sqrt(spikenumsd3); freqsd3 := sqrt(freqsd3); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean3 := periodtotal3/(burstnum5-1); frequencymean3 := frequencytotal3/(burstnum5-1); periodsd3 := ((sqperiodtotal3) - ((periodtotal3*periodtotal3)/(burstnum5-1)))/(burstnum5-2); frequencysd3 := ((sqfrequencytotal3) - ((frequencytotal3*frequencytotal3)/(burstnum5-1)))/(burstnum5-2); periodsd3 := sqrt(periodsd3); frequencysd3 := sqrt(frequencysd3); '********************************************************************************************************************************** 'printing the neuron summary for neuron 3 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname3$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum5, durationmean3, spikenummean3, freqmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd3, spikenumsd3, freqsd3); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean3, frequencymean3); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd3, frequencysd3); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname3$, burstnum5, durationmean3, spikenummean3, freqmean3, periodmean3, frequencymean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd3, spikenumsd3, freqsd3, periodsd3, frequencysd3); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '************************************************************************************** 'Begin analysis/writing for neuron 4 of 5 burstnum5 :=0; sBurst4 := 0; eBurst4 := 0; while sBurst4 >= 0 and eBurst4 >= 0 do sBurst4 := NextTime(BurstCh4%, eBurst4); if sBurst4 > 0 then eBurst4 := NextTime(BurstCh4%, sBurst4); if eBurst4 > 0 then AnalyseNeuron4(sBurst4, eBurst4); AnalysePeriod4(sBurst4, eBurst4); burstnum5 :=1+burstnum5; '*************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname4$, burstnum5, sBurst4, eBurst4); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%]); '************************************************************************************************* 'COMPUTE PERIOD if results15[resPeriod4%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results15[resPeriod4%], results15[resFrequency4%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results15[resPeriod4%] > -777 AND burstnum5 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname4$, burstnum5, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%]);endif; if results15[resPeriod4%] > -777 AND burstnum5 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum5, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%]);endif; if results15[resPeriod4%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum5, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal4 := durationtotal4 + results4[resDuration4%]; spikenumtotal4 := spikenumtotal4 + results4[resSpikes4%]; freqtotal4 := freqtotal4 + results4[resSpikeFreq4%]; sqdurationtotal4 := sqdurationtotal4 + (results4[resDuration4%] * results4[resDuration4%]); sqspikenumtotal4 := sqspikenumtotal4 + (results4[resSpikes4%] * results4[resSpikes4%]); sqfreqtotal4 := sqfreqtotal4 + (results4[resSpikeFreq4%] * results4[resSpikeFreq4%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results15[resPeriod4%] > -777 then periodtotal4 := periodtotal4 + results15[resPeriod4%]; frequencytotal4 := frequencytotal4 + results15[resFrequency4%]; sqperiodtotal4 := sqperiodtotal4 + (results15[resPeriod4%] * results15[resPeriod4%]); sqfrequencytotal4 := sqfrequencytotal4 + (results15[resFrequency4%] * results15[resFrequency4%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean4 := durationtotal4/burstnum5; spikenummean4 := spikenumtotal4/burstnum5; freqmean4 := freqtotal4 /burstnum5; 'calculating the standard devs for the bursts... durationsd4 := ((sqdurationtotal4) - ((durationtotal4*durationtotal4)/burstnum5))/(burstnum5-1); spikenumsd4 := ((sqspikenumtotal4) - ((spikenumtotal4*spikenumtotal4)/burstnum5))/(burstnum5-1); freqsd4 := ((sqfreqtotal4) - ((freqtotal4*freqtotal4)/burstnum5))/(burstnum5-1); durationsd4 := sqrt(durationsd4); spikenumsd4 := sqrt(spikenumsd4); freqsd4 := sqrt(freqsd4); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean4 := periodtotal4/(burstnum5-1); frequencymean4 := frequencytotal4/(burstnum5-1); periodsd4 := ((sqperiodtotal4) - ((periodtotal4*periodtotal4)/(burstnum5-1)))/(burstnum5-2); frequencysd4 := ((sqfrequencytotal4) - ((frequencytotal4*frequencytotal4)/(burstnum5-1)))/(burstnum5-2); periodsd4 := sqrt(periodsd4); frequencysd4 := sqrt(frequencysd4); '********************************************************************************************************************************** 'printing the neuron summary for neuron 4 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname4$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum5, durationmean4, spikenummean4, freqmean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd4, spikenumsd4, freqsd4); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean4, frequencymean4); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd4, frequencysd4); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname4$, burstnum5, durationmean4, spikenummean4, freqmean4, periodmean4, frequencymean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd4, spikenumsd4, freqsd4, periodsd4, frequencysd4); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '*************************************************************************************** 'Begin analysis/writing for neuron 5 of 5 burstnum5 :=0; sBurst5 := 0; eBurst5 := 0; while sBurst5 >= 0 and eBurst5 >= 0 do sBurst5 := NextTime(BurstCh5%, eBurst5); if sBurst5 > 0 then eBurst5 := NextTime(BurstCh5%, sBurst5); if eBurst5 > 0 then AnalyseNeuron5(sBurst5, eBurst5); AnalysePeriod5(sBurst5, eBurst5); burstnum5 :=1+burstnum5; '**************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname5$, burstnum5, sBurst5, eBurst5); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%]); '************************************************************************************************* 'COMPUTE PERIOD if results16[resPeriod5%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results16[resPeriod5%], results16[resFrequency5%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results16[resPeriod5%] > -777 AND burstnum5 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname5$, burstnum5, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%],results16[resPeriod5%], results16[resFrequency5%]);endif; if results16[resPeriod5%] > -777 AND burstnum5 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum5, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%],results16[resPeriod5%], results16[resFrequency5%]);endif; if results16[resPeriod5%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum5, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal5 := durationtotal5 + results5[resDuration5%]; spikenumtotal5 := spikenumtotal5 + results5[resSpikes5%]; freqtotal5 := freqtotal5 + results5[resSpikeFreq5%]; sqdurationtotal5 := sqdurationtotal5 + (results5[resDuration5%] * results5[resDuration5%]); sqspikenumtotal5 := sqspikenumtotal5 + (results5[resSpikes5%] * results5[resSpikes5%]); sqfreqtotal5 := sqfreqtotal5 + (results5[resSpikeFreq5%] * results5[resSpikeFreq5%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results16[resPeriod5%] > -777 then periodtotal5 := periodtotal5 + results16[resPeriod5%]; frequencytotal5 := frequencytotal5 + results16[resFrequency5%]; sqperiodtotal5 := sqperiodtotal5 + (results16[resPeriod5%] * results16[resPeriod5%]); sqfrequencytotal5 := sqfrequencytotal5 + (results16[resFrequency5%] * results16[resFrequency5%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean5 := durationtotal5/burstnum5; spikenummean5 := spikenumtotal5/burstnum5; freqmean5 := freqtotal5 /burstnum5; 'calculating the standard devs for the bursts... durationsd5 := ((sqdurationtotal5) - ((durationtotal5*durationtotal5)/burstnum5))/(burstnum5-1); spikenumsd5 := ((sqspikenumtotal5) - ((spikenumtotal5*spikenumtotal5)/burstnum5))/(burstnum5-1); freqsd5 := ((sqfreqtotal5) - ((freqtotal5*freqtotal5)/burstnum5))/(burstnum5-1); durationsd5 := sqrt(durationsd5); spikenumsd5 := sqrt(spikenumsd5); freqsd5 := sqrt(freqsd5); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean5 := periodtotal5/(burstnum5-1); frequencymean5 := frequencytotal5/(burstnum5-1); periodsd5 := ((sqperiodtotal5) - ((periodtotal5*periodtotal5)/(burstnum5-1)))/(burstnum5-2); frequencysd5 := ((sqfrequencytotal5) - ((frequencytotal5*frequencytotal5)/(burstnum5-1)))/(burstnum5-2); periodsd5 := sqrt(periodsd5); frequencysd5 := sqrt(frequencysd5); '********************************************************************************************************************************** 'printing the neuron summary for neuron 5 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname5$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum5, durationmean5, spikenummean5, freqmean5); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd5, spikenumsd5, freqsd5); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean5, frequencymean5); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd5, frequencysd5); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname5$, burstnum5, durationmean5, spikenummean5, freqmean5, periodmean5, frequencymean5); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd5, spikenumsd5, freqsd5, periodsd5, frequencysd5); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WRITING DATA IF 6 NEURONS ANALYZED if number1% = 6 then burstnum6 :=0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationtotal2 :=0; spikenumtotal2 :=0; freqtotal2 :=0; durationtotal3 :=0; spikenumtotal3 :=0; freqtotal3 :=0; durationtotal4 :=0; spikenumtotal4 :=0; freqtotal4 :=0; durationtotal5 :=0; spikenumtotal5 :=0; freqtotal5 :=0; durationtotal6 :=0; spikenumtotal6 :=0; freqtotal6 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; durationmean2 :=0; spikenummean2 :=0; freqmean2 :=0; durationmean3 :=0; spikenummean3 :=0; freqmean3 :=0; durationmean4 :=0; spikenummean4 :=0; freqmean4 :=0; durationmean5 :=0; spikenummean5 :=0; freqmean5 :=0; durationmean6 :=0; spikenummean6 :=0; freqmean6 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; sqdurationtotal2 :=0; sqspikenumtotal2 :=0; sqfreqtotal2 :=0; sqdurationtotal3 :=0; sqspikenumtotal3 :=0; sqfreqtotal3 :=0; sqdurationtotal4 :=0; sqspikenumtotal4 :=0; sqfreqtotal4 :=0; sqdurationtotal5 :=0; sqspikenumtotal5 :=0; sqfreqtotal5 :=0; sqdurationtotal6 :=0; sqspikenumtotal6 :=0; sqfreqtotal6 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; durationsd2 :=0; spikenumsd2 :=0; freqsd2 :=0; durationsd3 :=0; spikenumsd3 :=0; freqsd3 :=0; durationsd4 :=0; spikenumsd4 :=0; freqsd4 :=0; durationsd5 :=0; spikenumsd5 :=0; freqsd5 :=0; durationsd6 :=0; spikenumsd6 :=0; freqsd6 :=0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; periodtotal2 :=0; frequencytotal2 :=0; sqperiodtotal2 :=0; sqfrequencytotal2 :=0; periodmean2 :=0; frequencymean2 :=0; periodsd2 :=0; frequencysd2 :=0; periodtotal3 :=0; frequencytotal3 :=0; sqperiodtotal3 :=0; sqfrequencytotal3 :=0; periodmean3 :=0; frequencymean3 :=0; periodsd3 :=0; frequencysd3 :=0; periodtotal4 :=0; frequencytotal4 :=0; sqperiodtotal4 :=0; sqfrequencytotal4 :=0; periodmean4 :=0; frequencymean4 :=0; periodsd4 :=0; frequencysd4 :=0; periodtotal5 :=0; frequencytotal5 :=0; sqperiodtotal5 :=0; sqfrequencytotal5 :=0; periodmean5 :=0; frequencymean5 :=0; periodsd5 :=0; frequencysd5 :=0; periodtotal6 :=0; frequencytotal6 :=0; sqperiodtotal6 :=0; sqfrequencytotal6 :=0; periodmean6 :=0; frequencymean6 :=0; periodsd6 :=0; frequencysd6 :=0; sBurst1 := 0; eBurst1 := 0; '*************************************************************************************** 'Begin analysis/writing for neuron 1 of 6 while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalysePeriod1(sBurst1, eBurst1); burstnum6 :=1+burstnum6; '*************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum6, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 AND burstnum6 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname1$, burstnum6, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]); endif; if results12[resPeriod1%] > -777 and burstnum6 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum6, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum6, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum6; spikenummean1 := spikenumtotal1/burstnum6; freqmean1 := freqtotal1 /burstnum6; 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/burstnum6))/(burstnum6-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/burstnum6))/(burstnum6-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/burstnum6))/(burstnum6-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum6-1); frequencymean1 := frequencytotal1/(burstnum6-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1*periodtotal1)/(burstnum6-1)))/(burstnum6-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1*frequencytotal1)/(burstnum6-1)))/(burstnum6-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum6, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname1$, burstnum6, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '************************************************************************************ 'Begin analysis/writing for neuron 2 of 6 burstnum6 :=0; sBurst2 := 0; eBurst2 := 0; while sBurst2 >= 0 and eBurst2 >= 0 do sBurst2 := NextTime(BurstCh2%, eBurst2); if sBurst2 > 0 then eBurst2 := NextTime(BurstCh2%, sBurst2); if eBurst2 > 0 then AnalyseNeuron2(sBurst2, eBurst2); AnalysePeriod2(sBurst2, eBurst2); burstnum6 :=1+burstnum6; '****************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname2$, burstnum6, sBurst2, eBurst2); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%]); '************************************************************************************************* 'COMPUTE PERIOD if results13[resPeriod2%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results13[resPeriod2%], results13[resFrequency2%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results13[resPeriod2%] > -777 AND burstnum6 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname2$, burstnum6, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%]);endif; if results13[resPeriod2%] > -777 AND burstnum6 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum6, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%]);endif; if results13[resPeriod2%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum6, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal2 := durationtotal2 + results2[resDuration2%]; spikenumtotal2 := spikenumtotal2 + results2[resSpikes2%]; freqtotal2 := freqtotal2 + results2[resSpikeFreq2%]; sqdurationtotal2 := sqdurationtotal2 + (results2[resDuration2%] * results2[resDuration2%]); sqspikenumtotal2 := sqspikenumtotal2 + (results2[resSpikes2%] * results2[resSpikes2%]); sqfreqtotal2 := sqfreqtotal2 + (results2[resSpikeFreq2%] * results2[resSpikeFreq2%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results13[resPeriod2%] > -777 then periodtotal2 := periodtotal2 + results13[resPeriod2%]; frequencytotal2 := frequencytotal2 + results13[resFrequency2%]; sqperiodtotal2 := sqperiodtotal2 + (results13[resPeriod2%] * results13[resPeriod2%]); sqfrequencytotal2 := sqfrequencytotal2 + (results13[resFrequency2%] * results13[resFrequency2%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean2 := durationtotal2/burstnum6; spikenummean2 := spikenumtotal2/burstnum6; freqmean2 := freqtotal2 /burstnum6; 'calculating the standard devs for the bursts... durationsd2 := ((sqdurationtotal2) - ((durationtotal2*durationtotal2)/burstnum6))/(burstnum6-1); spikenumsd2 := ((sqspikenumtotal2) - ((spikenumtotal2*spikenumtotal2)/burstnum6))/(burstnum6-1); freqsd2 := ((sqfreqtotal2) - ((freqtotal2*freqtotal2)/burstnum6))/(burstnum6-1); durationsd2 := sqrt(durationsd2); spikenumsd2 := sqrt(spikenumsd2); freqsd2 := sqrt(freqsd2); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean2 := periodtotal2/(burstnum6-1); frequencymean2 := frequencytotal2/(burstnum6-1); periodsd2 := ((sqperiodtotal2) - ((periodtotal2*periodtotal2)/(burstnum6-1)))/(burstnum6-2); frequencysd2 := ((sqfrequencytotal2) - ((frequencytotal2*frequencytotal2)/(burstnum6-1)))/(burstnum6-2); periodsd2 := sqrt(periodsd2); frequencysd2 := sqrt(frequencysd2); '********************************************************************************************************************************** 'printing the neuron summary for neuron 2 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname2$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum6, durationmean2, spikenummean2, freqmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd2, spikenumsd2, freqsd2); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean2, frequencymean2); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd2, frequencysd2); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname2$, burstnum6, durationmean2, spikenummean2, freqmean2, periodmean2, frequencymean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd2, spikenumsd2, freqsd2, periodsd2, frequencysd2); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '******************************************************************************************** 'Begin analysis/writing for neuron 3 of 6 burstnum6 :=0; sBurst3 := 0; eBurst3 := 0; while sBurst3 >= 0 and eBurst3 >= 0 do sBurst3 := NextTime(BurstCh3%, eBurst3); if sBurst3 > 0 then eBurst3 := NextTime(BurstCh3%, sBurst3); if eBurst3 > 0 then AnalyseNeuron3(sBurst3, eBurst3); AnalysePeriod3(sBurst3, eBurst3); burstnum6 :=1+burstnum6; '************************************************************************************ if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname3$, burstnum6, sBurst3, eBurst3); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%]); '************************************************************************************************* 'COMPUTE PERIOD if results14[resPeriod3%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results14[resPeriod3%], results14[resFrequency3%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results14[resPeriod3%] > -777 AND burstnum6 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname5$, burstnum6, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%]);endif; if results14[resPeriod3%] > -777 AND burstnum6 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum6, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%]);endif; if results14[resPeriod3%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum6, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal3 := durationtotal3 + results3[resDuration3%]; spikenumtotal3 := spikenumtotal3 + results3[resSpikes3%]; freqtotal3 := freqtotal3 + results3[resSpikeFreq3%]; sqdurationtotal3 := sqdurationtotal3 + (results3[resDuration3%] * results3[resDuration3%]); sqspikenumtotal3 := sqspikenumtotal3 + (results3[resSpikes3%] * results3[resSpikes3%]); sqfreqtotal3 := sqfreqtotal3 + (results3[resSpikeFreq3%] * results3[resSpikeFreq3%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results14[resPeriod3%] > -777 then periodtotal3 := periodtotal3 + results14[resPeriod3%]; frequencytotal3 := frequencytotal3 + results14[resFrequency3%]; sqperiodtotal3 := sqperiodtotal3 + (results14[resPeriod3%] * results14[resPeriod3%]); sqfrequencytotal3 := sqfrequencytotal3 + (results14[resFrequency3%] * results14[resFrequency3%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean3 := durationtotal3/burstnum6; spikenummean3 := spikenumtotal3/burstnum6; freqmean3 := freqtotal3 /burstnum6; 'calculating the standard devs for the bursts... durationsd3 := ((sqdurationtotal3) - ((durationtotal3*durationtotal3)/burstnum6))/(burstnum6-1); spikenumsd3 := ((sqspikenumtotal3) - ((spikenumtotal3*spikenumtotal3)/burstnum6))/(burstnum6-1); freqsd3 := ((sqfreqtotal3) - ((freqtotal3*freqtotal3)/burstnum6))/(burstnum6-1); durationsd3 := sqrt(durationsd3); spikenumsd3 := sqrt(spikenumsd3); freqsd3 := sqrt(freqsd3); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean3 := periodtotal3/(burstnum6-1); frequencymean3 := frequencytotal3/(burstnum6-1); periodsd3 := ((sqperiodtotal3) - ((periodtotal3*periodtotal3)/(burstnum6-1)))/(burstnum6-2); frequencysd3 := ((sqfrequencytotal3) - ((frequencytotal3*frequencytotal3)/(burstnum6-1)))/(burstnum6-2); periodsd3 := sqrt(periodsd3); frequencysd3 := sqrt(frequencysd3); '********************************************************************************************************************************** 'printing the neuron summary for neuron 3 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname3$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum6, durationmean3, spikenummean3, freqmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd3, spikenumsd3, freqsd3); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean3, frequencymean3); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd3, frequencysd3); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname3$, burstnum6, durationmean3, spikenummean3, freqmean3, periodmean3, frequencymean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd3, spikenumsd3, freqsd3, periodsd3, frequencysd3); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '********************************************************************************** 'Begin analysis/writing for neuron 4 of 6 burstnum6 :=0; sBurst4 := 0; eBurst4 := 0; while sBurst4 >= 0 and eBurst4 >= 0 do sBurst4 := NextTime(BurstCh4%, eBurst4); if sBurst4 > 0 then eBurst4 := NextTime(BurstCh4%, sBurst4); if eBurst4 > 0 then AnalyseNeuron4(sBurst4, eBurst4); AnalysePeriod4(sBurst4, eBurst4); burstnum6 :=1+burstnum6; '********************************************************************************* if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname4$, burstnum6, sBurst4, eBurst4); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%]); '************************************************************************************************* 'COMPUTE PERIOD if results15[resPeriod4%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results15[resPeriod4%], results15[resFrequency4%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results15[resPeriod4%] > -777 AND burstnum6 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname4$, burstnum6, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%]);endif; if results15[resPeriod4%] > -777 AND burstnum6 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum6, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%]);endif; if results15[resPeriod4%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum6, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal4 := durationtotal4 + results4[resDuration4%]; spikenumtotal4 := spikenumtotal4 + results4[resSpikes4%]; freqtotal4 := freqtotal4 + results4[resSpikeFreq4%]; sqdurationtotal4 := sqdurationtotal4 + (results4[resDuration4%] * results4[resDuration4%]); sqspikenumtotal4 := sqspikenumtotal4 + (results4[resSpikes4%] * results4[resSpikes4%]); sqfreqtotal4 := sqfreqtotal4 + (results4[resSpikeFreq4%] * results4[resSpikeFreq4%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results15[resPeriod4%] > -777 then periodtotal4 := periodtotal4 + results15[resPeriod4%]; frequencytotal4 := frequencytotal4 + results15[resFrequency4%]; sqperiodtotal4 := sqperiodtotal4 + (results15[resPeriod4%] * results15[resPeriod4%]); sqfrequencytotal4 := sqfrequencytotal4 + (results15[resFrequency4%] * results15[resFrequency4%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean4 := durationtotal4/burstnum6; spikenummean4 := spikenumtotal4/burstnum6; freqmean4 := freqtotal4 /burstnum6; 'calculating the standard devs for the bursts... durationsd4 := ((sqdurationtotal4) - ((durationtotal4*durationtotal4)/burstnum6))/(burstnum6-1); spikenumsd4 := ((sqspikenumtotal4) - ((spikenumtotal4*spikenumtotal4)/burstnum6))/(burstnum6-1); freqsd4 := ((sqfreqtotal4) - ((freqtotal4*freqtotal4)/burstnum6))/(burstnum6-1); durationsd4 := sqrt(durationsd4); spikenumsd4 := sqrt(spikenumsd4); freqsd4 := sqrt(freqsd4); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean4 := periodtotal4/(burstnum6-1); frequencymean4 := frequencytotal4/(burstnum6-1); periodsd4 := ((sqperiodtotal4) - ((periodtotal4*periodtotal4)/(burstnum6-1)))/(burstnum6-2); frequencysd4 := ((sqfrequencytotal4) - ((frequencytotal4*frequencytotal4)/(burstnum6-1)))/(burstnum6-2); periodsd4 := sqrt(periodsd4); frequencysd4 := sqrt(frequencysd4); '********************************************************************************************************************************** 'printing the neuron summary for neuron 4 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname4$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum6, durationmean4, spikenummean4, freqmean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd4, spikenumsd4, freqsd4); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean4, frequencymean4); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd4, frequencysd4); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname4$, burstnum6, durationmean4, spikenummean4, freqmean4, periodmean4, frequencymean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd4, spikenumsd4, freqsd4, periodsd4, frequencysd4); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '*************************************************************************************** 'Begin analysis/writing for neuron 5 of 6 burstnum6 :=0; sBurst5 := 0; eBurst5 := 0; while sBurst5 >= 0 and eBurst5 >= 0 do sBurst5 := NextTime(BurstCh5%, eBurst5); if sBurst5 > 0 then eBurst5 := NextTime(BurstCh5%, sBurst5); if eBurst5 > 0 then AnalyseNeuron5(sBurst5, eBurst5); AnalysePeriod5(sBurst5, eBurst5); burstnum6 :=1+burstnum6; '**************************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname5$, burstnum6, sBurst5, eBurst5); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%]); '************************************************************************************************* 'COMPUTE PERIOD if results16[resPeriod5%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results16[resPeriod5%], results16[resFrequency5%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results16[resPeriod5%] > -777 AND burstnum6 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname5$, burstnum6, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%],results16[resPeriod5%], results16[resFrequency5%]);endif; if results16[resPeriod5%] > -777 AND burstnum6 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum6, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%],results16[resPeriod5%], results16[resFrequency5%]);endif; if results16[resPeriod5%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum6, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal5 := durationtotal5 + results5[resDuration5%]; spikenumtotal5 := spikenumtotal5 + results5[resSpikes5%]; freqtotal5 := freqtotal5 + results5[resSpikeFreq5%]; sqdurationtotal5 := sqdurationtotal5 + (results5[resDuration5%] * results5[resDuration5%]); sqspikenumtotal5 := sqspikenumtotal5 + (results5[resSpikes5%] * results5[resSpikes5%]); sqfreqtotal5 := sqfreqtotal5 + (results5[resSpikeFreq5%] * results5[resSpikeFreq5%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results16[resPeriod5%] > -777 then periodtotal5 := periodtotal5 + results16[resPeriod5%]; frequencytotal5 := frequencytotal5 + results16[resFrequency5%]; sqperiodtotal5 := sqperiodtotal5 + (results16[resPeriod5%] * results16[resPeriod5%]); sqfrequencytotal5 := sqfrequencytotal5 + (results16[resFrequency5%] * results16[resFrequency5%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean5 := durationtotal5/burstnum6; spikenummean5 := spikenumtotal5/burstnum6; freqmean5 := freqtotal5 /burstnum6; 'calculating the standard devs for the bursts... durationsd5 := ((sqdurationtotal5) - ((durationtotal5*durationtotal5)/burstnum6))/(burstnum6-1); spikenumsd5 := ((sqspikenumtotal5) - ((spikenumtotal5*spikenumtotal5)/burstnum6))/(burstnum6-1); freqsd5 := ((sqfreqtotal5) - ((freqtotal5*freqtotal5)/burstnum6))/(burstnum6-1); durationsd5 := sqrt(durationsd5); spikenumsd5 := sqrt(spikenumsd5); freqsd5 := sqrt(freqsd5); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean5 := periodtotal5/(burstnum6-1); frequencymean5 := frequencytotal5/(burstnum6-1); periodsd5 := ((sqperiodtotal5) - ((periodtotal5*periodtotal5)/(burstnum6-1)))/(burstnum6-2); frequencysd5 := ((sqfrequencytotal5) - ((frequencytotal5*frequencytotal5)/(burstnum6-1)))/(burstnum6-2); periodsd5 := sqrt(periodsd5); frequencysd5 := sqrt(frequencysd5); '********************************************************************************************************************************** 'printing the neuron summary for neuron 5 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname5$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum6, durationmean5, spikenummean5, freqmean5); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd5, spikenumsd5, freqsd5); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean5, frequencymean5); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd5, frequencysd5); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname5$, burstnum6, durationmean5, spikenummean5, freqmean5, periodmean5, frequencymean5); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd5, spikenumsd5, freqsd5, periodsd5, frequencysd5); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '************************************************************************************************ 'Begin analysis/writing for neuron 6 of 6 burstnum6 :=0; sBurst6 := 0; eBurst6 := 0; while sBurst6 >= 0 and eBurst6 >= 0 do sBurst6 := NextTime(BurstCh6%, eBurst6); if sBurst6 > 0 then eBurst6 := NextTime(BurstCh6%, sBurst6); if eBurst6 > 0 then AnalyseNeuron6(sBurst6, eBurst6); AnalysePeriod6(sBurst6, eBurst6); burstnum6 :=1+burstnum6; '***********************************************************************************************8 if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname6$, burstnum6, sBurst6, eBurst6); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%]); '************************************************************************************************* 'COMPUTE PERIOD if results17[resPeriod6%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results17[resPeriod6%], results17[resFrequency6%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results17[resPeriod6%] > -777 AND burstnum6 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname6$, burstnum6, sBurst6, eBurst6, results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%],results17[resPeriod6%], results17[resFrequency6%]);endif; if results17[resPeriod6%] > -777 AND burstnum6 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum6, sBurst6, eBurst6, results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%],results17[resPeriod6%], results17[resFrequency6%]);endif; if results17[resPeriod6%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum6, sBurst6, eBurst6, results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal6 := durationtotal6 + results6[resDuration6%]; spikenumtotal6 := spikenumtotal6 + results6[resSpikes6%]; freqtotal6 := freqtotal6 + results6[resSpikeFreq6%]; sqdurationtotal6 := sqdurationtotal6 + (results6[resDuration6%] * results6[resDuration6%]); sqspikenumtotal6 := sqspikenumtotal6 + (results6[resSpikes6%] * results6[resSpikes6%]); sqfreqtotal6 := sqfreqtotal6 + (results6[resSpikeFreq6%] * results6[resSpikeFreq6%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results17[resPeriod6%] > -777 then periodtotal6 := periodtotal6 + results17[resPeriod6%]; frequencytotal6 := frequencytotal6 + results17[resFrequency6%]; sqperiodtotal6 := sqperiodtotal6 + (results17[resPeriod6%] * results17[resPeriod6%]); sqfrequencytotal6 := sqfrequencytotal6 + (results17[resFrequency6%] * results17[resFrequency6%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean6 := durationtotal6/burstnum6; spikenummean6 := spikenumtotal6/burstnum6; freqmean6 := freqtotal6 /burstnum6; 'calculating the standard devs for the bursts... durationsd6 := ((sqdurationtotal6) - ((durationtotal6*durationtotal6)/burstnum6))/(burstnum6-1); spikenumsd6 := ((sqspikenumtotal6) - ((spikenumtotal6*spikenumtotal6)/burstnum6))/(burstnum6-1); freqsd6 := ((sqfreqtotal6) - ((freqtotal6*freqtotal6)/burstnum6))/(burstnum6-1); durationsd6 := sqrt(durationsd6); spikenumsd6 := sqrt(spikenumsd6); freqsd6 := sqrt(freqsd6); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean6 := periodtotal6/(burstnum6-1); frequencymean6 := frequencytotal6/(burstnum6-1); periodsd6 := ((sqperiodtotal6) - ((periodtotal6*periodtotal6)/(burstnum6-1)))/(burstnum6-2); frequencysd6 := ((sqfrequencytotal6) - ((frequencytotal6*frequencytotal6)/(burstnum6-1)))/(burstnum6-2); periodsd6 := sqrt(periodsd6); frequencysd6 := sqrt(frequencysd6); '********************************************************************************************************************************** 'printing the neuron summary for neuron 6 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname6$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum6, durationmean6, spikenummean6, freqmean6); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd6, spikenumsd6, freqsd6); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean6, frequencymean6); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd6, frequencysd6); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname6$, burstnum6, durationmean6, spikenummean6, freqmean6, periodmean6, frequencymean6); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd6, spikenumsd6, freqsd6, periodsd6, frequencysd6); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'WRITING DATA IF 7 NEURONS ANALYZED if number1% = 7 then burstnum7 :=0; durationtotal1 :=0; spikenumtotal1 :=0; freqtotal1 :=0; durationtotal2 :=0; spikenumtotal2 :=0; freqtotal2 :=0; durationtotal3 :=0; spikenumtotal3 :=0; freqtotal3 :=0; durationtotal4 :=0; spikenumtotal4 :=0; freqtotal4 :=0; durationtotal5 :=0; spikenumtotal5 :=0; freqtotal5 :=0; durationtotal6 :=0; spikenumtotal6 :=0; freqtotal6 :=0; durationtotal7 :=0; spikenumtotal7 :=0; freqtotal7 :=0; durationmean1 :=0; spikenummean1 :=0; freqmean1 :=0; durationmean2 :=0; spikenummean2 :=0; freqmean2 :=0; durationmean3 :=0; spikenummean3 :=0; freqmean3 :=0; durationmean4 :=0; spikenummean4 :=0; freqmean4 :=0; durationmean5 :=0; spikenummean5 :=0; freqmean5 :=0; durationmean6 :=0; spikenummean6 :=0; freqmean6 :=0; durationmean7 :=0; spikenummean7 :=0; freqmean7 :=0; sqdurationtotal1 :=0; sqspikenumtotal1 :=0; sqfreqtotal1 :=0; sqdurationtotal2 :=0; sqspikenumtotal2 :=0; sqfreqtotal2 :=0; sqdurationtotal3 :=0; sqspikenumtotal3 :=0; sqfreqtotal3 :=0; sqdurationtotal4 :=0; sqspikenumtotal4 :=0; sqfreqtotal4 :=0; sqdurationtotal5 :=0; sqspikenumtotal5 :=0; sqfreqtotal5 :=0; sqdurationtotal6 :=0; sqspikenumtotal6 :=0; sqfreqtotal6 :=0; sqdurationtotal7 :=0; sqspikenumtotal7 :=0; sqfreqtotal7 :=0; durationsd1 :=0; spikenumsd1 :=0; freqsd1 :=0; durationsd2 :=0; spikenumsd2 :=0; freqsd2 :=0; durationsd3 :=0; spikenumsd3 :=0; freqsd3 :=0; durationsd4 :=0; spikenumsd4 :=0; freqsd4 :=0; durationsd5 :=0; spikenumsd5 :=0; freqsd5 :=0; durationsd6 :=0; spikenumsd6 :=0; freqsd6 :=0; durationsd7 :=0; spikenumsd7 :=0; freqsd7 :=0; periodtotal1 :=0; frequencytotal1 :=0; sqperiodtotal1 :=0; sqfrequencytotal1 :=0; periodmean1 :=0; frequencymean1 :=0; periodsd1 :=0; frequencysd1 :=0; periodtotal2 :=0; frequencytotal2 :=0; sqperiodtotal2 :=0; sqfrequencytotal2 :=0; periodmean2 :=0; frequencymean2 :=0; periodsd2 :=0; frequencysd2 :=0; periodtotal3 :=0; frequencytotal3 :=0; sqperiodtotal3 :=0; sqfrequencytotal3 :=0; periodmean3 :=0; frequencymean3 :=0; periodsd3 :=0; frequencysd3 :=0; periodtotal4 :=0; frequencytotal4 :=0; sqperiodtotal4 :=0; sqfrequencytotal4 :=0; periodmean4 :=0; frequencymean4 :=0; periodsd4 :=0; frequencysd4 :=0; periodtotal5 :=0; frequencytotal5 :=0; sqperiodtotal5 :=0; sqfrequencytotal5 :=0; periodmean5 :=0; frequencymean5 :=0; periodsd5 :=0; frequencysd5 :=0; periodtotal6 :=0; frequencytotal6 :=0; sqperiodtotal6 :=0; sqfrequencytotal6 :=0; periodmean6 :=0; frequencymean6 :=0; periodsd6 :=0; frequencysd6 :=0; periodtotal7 :=0; frequencytotal7 :=0; sqperiodtotal7 :=0; sqfrequencytotal7 :=0; periodmean7 :=0; frequencymean7 :=0; periodsd7 :=0; frequencysd7 :=0; sBurst1 := 0; eBurst1 := 0; '***************************************************************************************** 'Begin analysis/writing for neuron 1 of 7 while sBurst1 >= 0 and eBurst1 >= 0 do sBurst1 := NextTime(BurstCh1%, eBurst1); if sBurst1 > 0 then eBurst1 := NextTime(BurstCh1%, sBurst1); if eBurst1 > 0 then AnalyseNeuron1(sBurst1, eBurst1); AnalysePeriod1(sBurst1, eBurst1); burstnum7 :=1+burstnum7; '************************************************************************************************* if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname1$, burstnum7, sBurst1, eBurst1); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%]); '************************************************************************************************* 'COMPUTE PERIOD if results12[resPeriod1%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results12[resPeriod1%], results12[resFrequency1%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results12[resPeriod1%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname1$, burstnum7, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]); endif; if results12[resPeriod1%] > -777 and burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum7, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%],results12[resPeriod1%], results12[resFrequency1%]);endif; if results12[resPeriod1%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum7, sBurst1, eBurst1, results1[resDuration1%], results1[resSpikes1%], results1[resSpikeFreq1%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal1 := durationtotal1 + results1[resDuration1%]; spikenumtotal1 := spikenumtotal1 + results1[resSpikes1%]; freqtotal1 := freqtotal1 + results1[resSpikeFreq1%]; sqdurationtotal1 := sqdurationtotal1 + (results1[resDuration1%] * results1[resDuration1%]); sqspikenumtotal1 := sqspikenumtotal1 + (results1[resSpikes1%] * results1[resSpikes1%]); sqfreqtotal1 := sqfreqtotal1 + (results1[resSpikeFreq1%] * results1[resSpikeFreq1%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results12[resPeriod1%] > -777 then periodtotal1 := periodtotal1 + results12[resPeriod1%]; frequencytotal1 := frequencytotal1 + results12[resFrequency1%]; sqperiodtotal1 := sqperiodtotal1 + (results12[resPeriod1%] * results12[resPeriod1%]); sqfrequencytotal1 := sqfrequencytotal1 + (results12[resFrequency1%] * results12[resFrequency1%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean1 := durationtotal1/burstnum7; spikenummean1 := spikenumtotal1/burstnum7; freqmean1 := freqtotal1 /burstnum7; 'calculating the standard devs for the bursts... durationsd1 := ((sqdurationtotal1) - ((durationtotal1*durationtotal1)/burstnum7))/(burstnum7-1); spikenumsd1 := ((sqspikenumtotal1) - ((spikenumtotal1*spikenumtotal1)/burstnum7))/(burstnum7-1); freqsd1 := ((sqfreqtotal1) - ((freqtotal1*freqtotal1)/burstnum7))/(burstnum7-1); durationsd1 := sqrt(durationsd1); spikenumsd1 := sqrt(spikenumsd1); freqsd1 := sqrt(freqsd1); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean1 := periodtotal1/(burstnum7-1); frequencymean1 := frequencytotal1/(burstnum7-1); periodsd1 := ((sqperiodtotal1) - ((periodtotal1*periodtotal1)/(burstnum7-1)))/(burstnum7-2); frequencysd1 := ((sqfrequencytotal1) - ((frequencytotal1*frequencytotal1)/(burstnum7-1)))/(burstnum7-2); periodsd1 := sqrt(periodsd1); frequencysd1 := sqrt(frequencysd1); '********************************************************************************************************************************** 'printing the neuron summary for neuron 1 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname1$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean1, spikenummean1, freqmean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd1, spikenumsd1, freqsd1); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean1, frequencymean1); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd1, frequencysd1); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname1$, burstnum7, durationmean1, spikenummean1, freqmean1, periodmean1, frequencymean1); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd1, spikenumsd1, freqsd1, periodsd1, frequencysd1); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '***************************************************************************************** 'Begin analysis/writing for neuron 2 of 7 burstnum7 :=0; sBurst2 := 0; eBurst2 := 0; while sBurst2 >= 0 and eBurst2 >= 0 do sBurst2 := NextTime(BurstCh2%, eBurst2); if sBurst2 > 0 then eBurst2 := NextTime(BurstCh2%, sBurst2); if eBurst2 > 0 then AnalyseNeuron2(sBurst2, eBurst2); AnalysePeriod2(sBurst2, eBurst2); burstnum7 :=1+burstnum7; '******************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname2$, burstnum7, sBurst2, eBurst2); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%]); '************************************************************************************************* 'COMPUTE PERIOD if results13[resPeriod2%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results13[resPeriod2%], results13[resFrequency2%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results13[resPeriod2%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname2$, burstnum7, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%]);endif; if results13[resPeriod2%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum7, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%],results13[resPeriod2%], results13[resFrequency2%]);endif; if results13[resPeriod2%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum7, sBurst2, eBurst2, results2[resDuration2%], results2[resSpikes2%], results2[resSpikeFreq2%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal2 := durationtotal2 + results2[resDuration2%]; spikenumtotal2 := spikenumtotal2 + results2[resSpikes2%]; freqtotal2 := freqtotal2 + results2[resSpikeFreq2%]; sqdurationtotal2 := sqdurationtotal2 + (results2[resDuration2%] * results2[resDuration2%]); sqspikenumtotal2 := sqspikenumtotal2 + (results2[resSpikes2%] * results2[resSpikes2%]); sqfreqtotal2 := sqfreqtotal2 + (results2[resSpikeFreq2%] * results2[resSpikeFreq2%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results13[resPeriod2%] > -777 then periodtotal2 := periodtotal2 + results13[resPeriod2%]; frequencytotal2 := frequencytotal2 + results13[resFrequency2%]; sqperiodtotal2 := sqperiodtotal2 + (results13[resPeriod2%] * results13[resPeriod2%]); sqfrequencytotal2 := sqfrequencytotal2 + (results13[resFrequency2%] * results13[resFrequency2%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean2 := durationtotal2/burstnum7; spikenummean2 := spikenumtotal2/burstnum7; freqmean2 := freqtotal2 /burstnum7; 'calculating the standard devs for the bursts... durationsd2 := ((sqdurationtotal2) - ((durationtotal2*durationtotal2)/burstnum7))/(burstnum7-1); spikenumsd2 := ((sqspikenumtotal2) - ((spikenumtotal2*spikenumtotal2)/burstnum7))/(burstnum7-1); freqsd2 := ((sqfreqtotal2) - ((freqtotal2*freqtotal2)/burstnum7))/(burstnum7-1); durationsd2 := sqrt(durationsd2); spikenumsd2 := sqrt(spikenumsd2); freqsd2 := sqrt(freqsd2); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean2 := periodtotal2/(burstnum7-1); frequencymean2 := frequencytotal2/(burstnum7-1); periodsd2 := ((sqperiodtotal2) - ((periodtotal2*periodtotal2)/(burstnum7-1)))/(burstnum7-2); frequencysd2 := ((sqfrequencytotal2) - ((frequencytotal2*frequencytotal2)/(burstnum7-1)))/(burstnum7-2); periodsd2 := sqrt(periodsd2); frequencysd2 := sqrt(frequencysd2); '********************************************************************************************************************************** 'printing the neuron summary for neuron 2 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname2$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean2, spikenummean2, freqmean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd2, spikenumsd2, freqsd2); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean2, frequencymean2); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd2, frequencysd2); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname2$, burstnum7, durationmean2, spikenummean2, freqmean2, periodmean2, frequencymean2); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd2, spikenumsd2, freqsd2, periodsd2, frequencysd2); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '***************************************************************************************** 'Begin analysis/writing for neuron 3 of 7 burstnum7 :=0; sBurst3 := 0; eBurst3 := 0; while sBurst3 >= 0 and eBurst3 >= 0 do sBurst3 := NextTime(BurstCh3%, eBurst3); if sBurst3 > 0 then eBurst3 := NextTime(BurstCh3%, sBurst3); if eBurst3 > 0 then AnalyseNeuron3(sBurst3, eBurst3); AnalysePeriod3(sBurst3, eBurst3); burstnum7 :=1+burstnum7; '*********************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname3$, burstnum7, sBurst3, eBurst3); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%]); '************************************************************************************************* 'COMPUTE PERIOD if results14[resPeriod3%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results14[resPeriod3%], results14[resFrequency3%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results14[resPeriod3%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname3$, burstnum7, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%]);endif; if results14[resPeriod3%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum7, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%],results14[resPeriod3%], results14[resFrequency3%]);endif; if results14[resPeriod3%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum7, sBurst3, eBurst3, results3[resDuration3%], results3[resSpikes3%], results3[resSpikeFreq3%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal3 := durationtotal3 + results3[resDuration3%]; spikenumtotal3 := spikenumtotal3 + results3[resSpikes3%]; freqtotal3 := freqtotal3 + results3[resSpikeFreq3%]; sqdurationtotal3 := sqdurationtotal3 + (results3[resDuration3%] * results3[resDuration3%]); sqspikenumtotal3 := sqspikenumtotal3 + (results3[resSpikes3%] * results3[resSpikes3%]); sqfreqtotal3 := sqfreqtotal3 + (results3[resSpikeFreq3%] * results3[resSpikeFreq3%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results14[resPeriod3%] > -777 then periodtotal3 := periodtotal3 + results14[resPeriod3%]; frequencytotal3 := frequencytotal3 + results14[resFrequency3%]; sqperiodtotal3 := sqperiodtotal3 + (results14[resPeriod3%] * results14[resPeriod3%]); sqfrequencytotal3 := sqfrequencytotal3 + (results14[resFrequency3%] * results14[resFrequency3%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean3 := durationtotal3/burstnum7; spikenummean3 := spikenumtotal3/burstnum7; freqmean3 := freqtotal3 /burstnum7; 'calculating the standard devs for the bursts... durationsd3 := ((sqdurationtotal3) - ((durationtotal3*durationtotal3)/burstnum7))/(burstnum7-1); spikenumsd3 := ((sqspikenumtotal3) - ((spikenumtotal3*spikenumtotal3)/burstnum7))/(burstnum7-1); freqsd3 := ((sqfreqtotal3) - ((freqtotal3*freqtotal3)/burstnum7))/(burstnum7-1); durationsd3 := sqrt(durationsd3); spikenumsd3 := sqrt(spikenumsd3); freqsd3 := sqrt(freqsd3); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean3 := periodtotal3/(burstnum7-1); frequencymean3 := frequencytotal3/(burstnum7-1); periodsd3 := ((sqperiodtotal3) - ((periodtotal3*periodtotal3)/(burstnum7-1)))/(burstnum7-2); frequencysd3 := ((sqfrequencytotal3) - ((frequencytotal3*frequencytotal3)/(burstnum7-1)))/(burstnum7-2); periodsd3 := sqrt(periodsd3); frequencysd3 := sqrt(frequencysd3); '********************************************************************************************************************************** 'printing the neuron summary for neuron 3 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname3$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean3, spikenummean3, freqmean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd3, spikenumsd3, freqsd3); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean3, frequencymean3); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd3, frequencysd3); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname3$, burstnum7, durationmean3, spikenummean3, freqmean3, periodmean3, frequencymean3); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd3, spikenumsd3, freqsd3, periodsd3, frequencysd3); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '***************************************************************************************** 'Begin analysis/writing for neuron 4 of 7 burstnum7 :=0; sBurst4 := 0; eBurst4 := 0; while sBurst4 >= 0 and eBurst4 >= 0 do sBurst4 := NextTime(BurstCh4%, eBurst4); if sBurst4 > 0 then eBurst4 := NextTime(BurstCh4%, sBurst4); if eBurst4 > 0 then AnalyseNeuron4(sBurst4, eBurst4); AnalysePeriod4(sBurst4, eBurst4); burstnum7 :=1+burstnum7; '*********************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname4$, burstnum7, sBurst4, eBurst4); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%]); '************************************************************************************************* 'COMPUTE PERIOD if results15[resPeriod4%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results15[resPeriod4%], results15[resFrequency4%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results15[resPeriod4%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname4$, burstnum7, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%]);endif; if results15[resPeriod4%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum7, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%],results15[resPeriod4%], results15[resFrequency4%]);endif; if results15[resPeriod4%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum7, sBurst4, eBurst4, results4[resDuration4%], results4[resSpikes4%], results4[resSpikeFreq4%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal4 := durationtotal4 + results4[resDuration4%]; spikenumtotal4 := spikenumtotal4 + results4[resSpikes4%]; freqtotal4 := freqtotal4 + results4[resSpikeFreq4%]; sqdurationtotal4 := sqdurationtotal4 + (results4[resDuration4%] * results4[resDuration4%]); sqspikenumtotal4 := sqspikenumtotal4 + (results4[resSpikes4%] * results4[resSpikes4%]); sqfreqtotal4 := sqfreqtotal4 + (results4[resSpikeFreq4%] * results4[resSpikeFreq4%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results15[resPeriod4%] > -777 then periodtotal4 := periodtotal4 + results15[resPeriod4%]; frequencytotal4 := frequencytotal4 + results15[resFrequency4%]; sqperiodtotal4 := sqperiodtotal4 + (results15[resPeriod4%] * results15[resPeriod4%]); sqfrequencytotal4 := sqfrequencytotal4 + (results15[resFrequency4%] * results15[resFrequency4%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean4 := durationtotal4/burstnum7; spikenummean4 := spikenumtotal4/burstnum7; freqmean4 := freqtotal4 /burstnum7; 'calculating the standard devs for the bursts... durationsd4 := ((sqdurationtotal4) - ((durationtotal4*durationtotal4)/burstnum7))/(burstnum7-1); spikenumsd4 := ((sqspikenumtotal4) - ((spikenumtotal4*spikenumtotal4)/burstnum7))/(burstnum7-1); freqsd4 := ((sqfreqtotal4) - ((freqtotal4*freqtotal4)/burstnum7))/(burstnum7-1); durationsd4 := sqrt(durationsd4); spikenumsd4 := sqrt(spikenumsd4); freqsd4 := sqrt(freqsd4); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean4 := periodtotal4/(burstnum7-1); frequencymean4 := frequencytotal4/(burstnum7-1); periodsd4 := ((sqperiodtotal4) - ((periodtotal4*periodtotal4)/(burstnum7-1)))/(burstnum7-2); frequencysd4 := ((sqfrequencytotal4) - ((frequencytotal4*frequencytotal4)/(burstnum7-1)))/(burstnum7-2); periodsd4 := sqrt(periodsd4); frequencysd4 := sqrt(frequencysd4); '********************************************************************************************************************************** 'printing the neuron summary for neuron 4 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname4$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean4, spikenummean4, freqmean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd4, spikenumsd4, freqsd4); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean4, frequencymean4); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd4, frequencysd4); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname4$, burstnum7, durationmean4, spikenummean4, freqmean4, periodmean4, frequencymean4); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd4, spikenumsd4, freqsd4, periodsd4, frequencysd4); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '***************************************************************************************** 'Begin analysis/writing for neuron 5 of 7 burstnum7 :=0; sBurst5 := 0; eBurst5 := 0; while sBurst5 >= 0 and eBurst5 >= 0 do sBurst5 := NextTime(BurstCh5%, eBurst5); if sBurst5 > 0 then eBurst5 := NextTime(BurstCh5%, sBurst5); if eBurst5 > 0 then AnalyseNeuron5(sBurst5, eBurst5); AnalysePeriod5(sBurst5, eBurst5); burstnum7 :=1+burstnum7; '************************************************************************************************* if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname5$, burstnum7, sBurst5, eBurst5); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%]); '************************************************************************************************* 'COMPUTE PERIOD if results16[resPeriod5%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results16[resPeriod5%], results16[resFrequency5%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results16[resPeriod5%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname5$, burstnum7, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%],results16[resPeriod5%], results16[resFrequency5%]);endif; if results16[resPeriod5%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum7, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%],results16[resPeriod5%], results16[resFrequency5%]);endif; if results16[resPeriod5%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum7, sBurst5, eBurst5, results5[resDuration5%], results5[resSpikes5%], results5[resSpikeFreq5%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal5 := durationtotal5 + results5[resDuration5%]; spikenumtotal5 := spikenumtotal5 + results5[resSpikes5%]; freqtotal5 := freqtotal5 + results5[resSpikeFreq5%]; sqdurationtotal5 := sqdurationtotal5 + (results5[resDuration5%] * results5[resDuration5%]); sqspikenumtotal5 := sqspikenumtotal5 + (results5[resSpikes5%] * results5[resSpikes5%]); sqfreqtotal5 := sqfreqtotal5 + (results5[resSpikeFreq5%] * results5[resSpikeFreq5%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results16[resPeriod5%] > -777 then periodtotal5 := periodtotal5 + results16[resPeriod5%]; frequencytotal5 := frequencytotal5 + results16[resFrequency5%]; sqperiodtotal5 := sqperiodtotal5 + (results16[resPeriod5%] * results16[resPeriod5%]); sqfrequencytotal5 := sqfrequencytotal5 + (results16[resFrequency5%] * results16[resFrequency5%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean5 := durationtotal5/burstnum7; spikenummean5 := spikenumtotal5/burstnum7; freqmean5 := freqtotal5 /burstnum7; 'calculating the standard devs for the bursts... durationsd5 := ((sqdurationtotal5) - ((durationtotal5*durationtotal5)/burstnum7))/(burstnum7-1); spikenumsd5 := ((sqspikenumtotal5) - ((spikenumtotal5*spikenumtotal5)/burstnum7))/(burstnum7-1); freqsd5 := ((sqfreqtotal5) - ((freqtotal5*freqtotal5)/burstnum7))/(burstnum7-1); durationsd5 := sqrt(durationsd5); spikenumsd5 := sqrt(spikenumsd5); freqsd5 := sqrt(freqsd5); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean5 := periodtotal5/(burstnum7-1); frequencymean5 := frequencytotal5/(burstnum7-1); periodsd5 := ((sqperiodtotal5) - ((periodtotal5*periodtotal5)/(burstnum7-1)))/(burstnum7-2); frequencysd5 := ((sqfrequencytotal5) - ((frequencytotal5*frequencytotal5)/(burstnum7-1)))/(burstnum7-2); periodsd5 := sqrt(periodsd5); frequencysd5 := sqrt(frequencysd5); '********************************************************************************************************************************** 'printing the neuron summary for neuron 5 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname5$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean5, spikenummean5, freqmean5); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd5, spikenumsd5, freqsd5); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean5, frequencymean5); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd5, frequencysd5); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname5$, burstnum7, durationmean5, spikenummean5, freqmean5, periodmean5, frequencymean5); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd5, spikenumsd5, freqsd5, periodsd5, frequencysd5); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '***************************************************************************************** 'Begin analysis/writing for neuron 6 of 7 burstnum7 :=0; sBurst6 := 0; eBurst6 := 0; while sBurst6 >= 0 and eBurst6 >= 0 do sBurst6 := NextTime(BurstCh6%, eBurst6); if sBurst6 > 0 then eBurst6 := NextTime(BurstCh6%, sBurst6); if eBurst6 > 0 then AnalyseNeuron6(sBurst6, eBurst6); AnalysePeriod6(sBurst6, eBurst6); burstnum7 :=1+burstnum7; '********************************************************************************************************** ' if summary% = 0 then if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname6$, burstnum7, sBurst6, eBurst6); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%]); '************************************************************************************************* 'COMPUTE PERIOD if results17[resPeriod6%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results17[resPeriod6%], results17[resFrequency6%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results17[resPeriod6%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname6$, burstnum7, sBurst6, eBurst6, results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%],results17[resPeriod6%], results17[resFrequency6%]);endif; if results17[resPeriod6%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum7, sBurst6, eBurst6, results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%],results17[resPeriod6%], results17[resFrequency6%]);endif; if results17[resPeriod6%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum7, sBurst6, eBurst6, results6[resDuration6%], results6[resSpikes6%], results6[resSpikeFreq6%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal6 := durationtotal6 + results6[resDuration6%]; spikenumtotal6 := spikenumtotal6 + results6[resSpikes6%]; freqtotal6 := freqtotal6 + results6[resSpikeFreq6%]; sqdurationtotal6 := sqdurationtotal6 + (results6[resDuration6%] * results6[resDuration6%]); sqspikenumtotal6 := sqspikenumtotal6 + (results6[resSpikes6%] * results6[resSpikes6%]); sqfreqtotal6 := sqfreqtotal6 + (results6[resSpikeFreq6%] * results6[resSpikeFreq6%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results17[resPeriod6%] > -777 then periodtotal6 := periodtotal6 + results17[resPeriod6%]; frequencytotal6 := frequencytotal6 + results17[resFrequency6%]; sqperiodtotal6 := sqperiodtotal6 + (results17[resPeriod6%] * results17[resPeriod6%]); sqfrequencytotal6 := sqfrequencytotal6 + (results17[resFrequency6%] * results17[resFrequency6%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean6 := durationtotal6/burstnum7; spikenummean6 := spikenumtotal6/burstnum7; freqmean6 := freqtotal6 /burstnum7; 'calculating the standard devs for the bursts... durationsd6 := ((sqdurationtotal6) - ((durationtotal6*durationtotal6)/burstnum7))/(burstnum7-1); spikenumsd6 := ((sqspikenumtotal6) - ((spikenumtotal6*spikenumtotal6)/burstnum7))/(burstnum7-1); freqsd6 := ((sqfreqtotal6) - ((freqtotal6*freqtotal6)/burstnum7))/(burstnum7-1); durationsd6 := sqrt(durationsd6); spikenumsd6 := sqrt(spikenumsd6); freqsd6 := sqrt(freqsd6); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean6 := periodtotal6/(burstnum7-1); frequencymean6 := frequencytotal6/(burstnum7-1); periodsd6 := ((sqperiodtotal6) - ((periodtotal6*periodtotal6)/(burstnum7-1)))/(burstnum7-2); frequencysd6 := ((sqfrequencytotal6) - ((frequencytotal6*frequencytotal6)/(burstnum7-1)))/(burstnum7-2); periodsd6 := sqrt(periodsd6); frequencysd6 := sqrt(frequencysd6); '********************************************************************************************************************************** 'printing the neuron summary for neuron 6 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname6$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean6, spikenummean6, freqmean6); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd6, spikenumsd6, freqsd6); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean6, frequencymean6); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd6, frequencysd6); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname6$, burstnum7, durationmean6, spikenummean6, freqmean6, periodmean6, frequencymean6); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd6, spikenumsd6, freqsd6, periodsd6, frequencysd6); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); '***************************************************************************************** 'Begin analysis/writing for neuron 7 of 7 burstnum7 :=0; sBurst7 := 0; eBurst7 := 0; while sBurst7 >= 0 and eBurst7 >= 0 do sBurst7 := NextTime(BurstCh7%, eBurst7); if sBurst7 > 0 then eBurst7 := NextTime(BurstCh7%, sBurst7); if eBurst7 > 0 then AnalyseNeuron7(sBurst7, eBurst7); AnalysePeriod7(sBurst7, eBurst7); burstnum7 :=1+burstnum7; '************************************************************************************************** if summary% =0 AND xlv% =0 then PrintLog("Neuron Burst # Real Time of Burst Onset (sec) Real Time of Burst Offset (sec)\n"); PrintLog("====== ======= ============================== ===============================\n"); PrintLog(" %s %d %f %f \n\n\n", neuronname7$, burstnum7, sBurst7, eBurst7); PrintLog(" Burst duration (sec) # of Spikes Spike Frequency (Hz) \n"); PrintLog(" =================== =========== ==================== \n"); PrintLog(" %10.5f %d %10.5f \n\n\n", results7[resDuration7%], results7[resSpikes7%], results7[resSpikeFreq7%]); '************************************************************************************************* 'COMPUTE PERIOD if results18[resPeriod7%] = -777 then PrintLog(" Instantaneous Period (sec) Instantaneous Frequency (Hz) \n"); PrintLog(" ========================== ============================ \n"); PrintLog(" N/A N/A \n\n\n"); else PrintLog(" Instantaneous Period (sec)* Instantaneous Frequency (Hz)* \n"); PrintLog(" =========================== ============================= \n"); PrintLog(" %10.5f %10.5f \n\n", results18[resPeriod7%], results18[resFrequency7%]); PrintLog(" *Calculated from onset of this burst to onset of the next burst. \n\n\n"); endif; '****************************************************************************** endif; if summary% =0 AND xlv% =1 then if results18[resPeriod7%] > -777 AND burstnum7 = 1 then PrintLog("Neuron Burst# Real Time of Burst Onset (sec) Real Time of Burst Offset (sec) Burst Duration (sec) # of Spikes Spike Frequency (Hz) Instantaneous Period (sec) Instantaneous Frequency (Hz)\n"); PrintLog("%s %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", neuronname7$, burstnum7, sBurst7, eBurst7, results7[resDuration7%], results7[resSpikes7%], results7[resSpikeFreq7%],results18[resPeriod7%], results18[resFrequency7%]);endif; if results18[resPeriod7%] > -777 AND burstnum7 > 1 then PrintLog(" %d %f %f %10.5f %d %10.5f %10.5f %10.5f\n", burstnum7, sBurst7, eBurst7, results7[resDuration7%], results7[resSpikes7%], results7[resSpikeFreq7%],results18[resPeriod7%], results18[resFrequency7%]);endif; if results18[resPeriod7%] = -777 then PrintLog(" %d %f %f %10.5f %d %10.5f %s %s\n\n", burstnum7, sBurst7, eBurst7, results7[resDuration7%], results7[resSpikes7%], results7[resSpikeFreq7%], na$, na$);endif; endif; endif; '************************************************************************************************************************ 'calculutions for the average AND stdevs for spike number, spike frequency, AND phase stuffs durationtotal7 := durationtotal7 + results7[resDuration7%]; spikenumtotal7 := spikenumtotal7 + results7[resSpikes7%]; freqtotal7 := freqtotal7 + results7[resSpikeFreq7%]; sqdurationtotal7 := sqdurationtotal7 + (results7[resDuration7%] * results7[resDuration7%]); sqspikenumtotal7 := sqspikenumtotal7 + (results7[resSpikes7%] * results7[resSpikes7%]); sqfreqtotal7 := sqfreqtotal7 + (results7[resSpikeFreq7%] * results7[resSpikeFreq7%]); '************************************************************ 'COMPUTING MEAN FOR BURST PERIOD/FREQUENCY if results18[resPeriod7%] > -777 then periodtotal7 := periodtotal7 + results18[resPeriod7%]; frequencytotal7 := frequencytotal7 + results18[resFrequency7%]; sqperiodtotal7 := sqperiodtotal7 + (results18[resPeriod7%] * results18[resPeriod7%]); sqfrequencytotal7 := sqfrequencytotal7 + (results18[resFrequency7%] * results18[resFrequency7%]); endif; '************************************************************** endif; wend; 'calculating the means for the bursts... durationmean7 := durationtotal7/burstnum7; spikenummean7 := spikenumtotal7/burstnum7; freqmean7 := freqtotal7 /burstnum7; 'calculating the standard devs for the bursts... durationsd7 := ((sqdurationtotal7) - ((durationtotal7*durationtotal7)/burstnum7))/(burstnum7-1); spikenumsd7 := ((sqspikenumtotal7) - ((spikenumtotal7*spikenumtotal7)/burstnum7))/(burstnum7-1); freqsd7 := ((sqfreqtotal7) - ((freqtotal7*freqtotal7)/burstnum7))/(burstnum7-1); durationsd7 := sqrt(durationsd7); spikenumsd7 := sqrt(spikenumsd7); freqsd7 := sqrt(freqsd7); '************************************************************************ 'calculating standard devs for the burst periods/frequencies periodmean7 := periodtotal7/(burstnum7-1); frequencymean7 := frequencytotal7/(burstnum7-1); periodsd7 := ((sqperiodtotal7) - ((periodtotal7*periodtotal7)/(burstnum7-1)))/(burstnum7-2); frequencysd7 := ((sqfrequencytotal7) - ((frequencytotal7*frequencytotal7)/(burstnum7-1)))/(burstnum7-2); periodsd7 := sqrt(periodsd7); frequencysd7 := sqrt(frequencysd7); '********************************************************************************************************************************** 'printing the neuron summary for neuron 7 if xlv% =0 then PrintLog("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); PrintLog(" %s Neuron Summary\n", neuronname7$); PrintLog(" _________________\n\n\n"); PrintLog("# of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency (Hz)\n"); PrintLog("=========== =================== ================ =========================\n"); PrintLog(" %d %10.5f %10.5f %10.5f\n\n\n", burstnum7, durationmean7, spikenummean7, freqmean7); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev(Hz)\n"); PrintLog(" ==================== ================= =========================\n"); PrintLog(" %10.5f %10.5f %10.5f\n\n\n", durationsd7, spikenumsd7, freqsd7); PrintLog(" Mean Burst Period (sec) Mean Burst Frequency (Hz) \n"); PrintLog(" ======================= ========================= \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodmean7, frequencymean7); PrintLog(" Burst Period StDev (sec) Burst Frequency StDev (Hz) \n"); PrintLog(" ======================== ========================== \n"); PrintLog(" %10.5f %10.5f\n\n\n", periodsd7, frequencysd7); endif; if xlv% = 1 then PrintLog("Neuron # of Bursts Mean Burst Duration Mean # of Spikes Mean Spike Frequency Mean Burst Period Mean Burst Frequency\n"); PrintLog("%s %d %10.5f %10.5f %10.5f %10.5f %10.5f\n", neuronname7$, burstnum7, durationmean7, spikenummean7, freqmean7, periodmean7, frequencymean7); PrintLog(" Burst Duration StDev # of Spikes StDev Spike Frequency StDev Burst Period StDev Burst Frequency StDev\n"); PrintLog(" %10.5f %10.5f %10.5f %10.5f %10.5f\n", durationsd7, spikenumsd7, freqsd7, periodsd7, frequencysd7); endif; PrintLog("____________________________________________________________________________________________________\n"); PrintLog("____________________________________________________________________________________________________\n\n\n"); endif; endif; View(LogHandle()); windowvisible(3); Interact("Inspect results and press OK to continue...", 1023); end; '************************************************************************************************************** '************************************************************************************************************** '************************************************************************************************************** 'PART THIRTEEN: 'first subpart of PART THIRTEEN: 'COMPUTE BASIC PARAMETERS FOR NEURONS (BURST DURATION, # OF SPIKES, SPIKE FREQUENCY) 'Collect data for Neuron #1... proc AnalyseNeuron1(sBurst1, eBurst1) var stats[1]; results1[resDuration1%] := eBurst1 - sBurst1; results1[resSpikes1%] := Count(eventCh1%, sBurst1, eBurst1); results1[resSpikeFreq1%] := (results1[resSpikes1%]-1)/results1[resDuration1%]; end; 'Collect data for Neuron #2... proc AnalyseNeuron2(sBurst2, eBurst2) var stats[1]; results2[resDuration2%] := eBurst2 - sBurst2; results2[resSpikes2%] := Count(eventCh2%, sBurst2, eBurst2); results2[resSpikeFreq2%] := (results2[resSpikes2%]-1)/results2[resDuration2%]; end; 'Collect data for Neuron #3... proc AnalyseNeuron3(sBurst3, eBurst3) var stats[1]; results3[resDuration3%] := eBurst3 - sBurst3; results3[resSpikes3%] := Count(eventCh3%, sBurst3, eBurst3); results3[resSpikeFreq3%] := (results3[resSpikes3%]-1)/results3[resDuration3%]; end; 'Collect data for Neuron #4... proc AnalyseNeuron4(sBurst4, eBurst4) var stats[1]; results4[resDuration4%] := eBurst4 - sBurst4; results4[resSpikes4%] := Count(eventCh4%, sBurst4, eBurst4); results4[resSpikeFreq4%] := (results4[resSpikes4%]-1)/results4[resDuration4%]; end; 'Collect data for Neuron #5... proc AnalyseNeuron5(sBurst5, eBurst5) var stats[1]; results5[resDuration5%] := eBurst5 - sBurst5; results5[resSpikes5%] := Count(eventCh5%, sBurst5, eBurst5); results5[resSpikeFreq5%] := (results5[resSpikes5%]-1)/results5[resDuration5%]; end; 'Collect data for Neuron #6... proc AnalyseNeuron6(sBurst6, eBurst6) var stats[1]; results6[resDuration6%] := eBurst6 - sBurst6; results6[resSpikes6%] := Count(eventCh6%, sBurst6, eBurst6); results6[resSpikeFreq6%] := (results6[resSpikes6%]-1)/results6[resDuration6%]; end; 'Collect data for Neuron #7... proc AnalyseNeuron7(sBurst7, eBurst7) var stats[1]; results7[resDuration7%] := eBurst7 - sBurst7; results7[resSpikes7%] := Count(eventCh7%, sBurst7, eBurst7); results7[resSpikeFreq7%] := (results7[resSpikes7%]-1)/results7[resDuration7%]; end; '************************************************************** 'second subpart of PART THIRTEEN: 'COMPUTES BURST PERIOD AND FREQUENCY OF BURSTS: proc AnalysePeriod1(sBurst1, eBurst1) var stats[1]; var periodon1, periodoff1, period1, frequency1; periodon1 := sBurst1; periodoff1 := Nexttime(BurstCh1%, eBurst1); if periodoff1 > 0 then period1 := periodoff1 - periodon1; frequency1 := 1/period1; else period1 := -777; frequency1 := -777; endif; results12[resPeriod1%] := period1; results12[resFrequency1%] := frequency1; end; proc AnalysePeriod2(sBurst2, eBurst2) var stats[1]; var periodon2, periodoff2, period2, frequency2; periodon2 := sBurst2; periodoff2 := Nexttime(BurstCh2%, eBurst2); if periodoff2 > 0 then period2 := periodoff2 - periodon2; frequency2 := 1/period2; else period2 := -777; frequency2 := -777; endif; results13[resPeriod2%] := period2; results13[resFrequency2%] := frequency2; end; proc AnalysePeriod3(sBurst3, eBurst3) var stats[1]; var periodon3, periodoff3, period3, frequency3; periodon3 := sBurst3; periodoff3 := Nexttime(BurstCh3%, eBurst3); if periodoff3 > 0 then period3 := periodoff3 - periodon3; frequency3 := 1/period3; else period3:= -777; frequency3 := -777; endif; results14[resPeriod3%] := period3; results14[resFrequency3%] := frequency3; end; proc AnalysePeriod4(sBurst4, eBurst4) var stats[1]; var periodon4, periodoff4, period4, frequency4; periodon4 := sBurst4; periodoff4 := Nexttime(BurstCh4%, eBurst4); if periodoff4 > 0 then period4 := periodoff4 - periodon4; frequency4 := 1/period4; else period4:= -777; frequency4 := -777; endif; results15[resPeriod4%] := period4; results15[resFrequency4%] := frequency4; end; proc AnalysePeriod5(sBurst5, eBurst5) var stats[1]; var periodon5, periodoff5, period5, frequency5; periodon5 := sBurst5; periodoff5 := Nexttime(BurstCh5%, eBurst5); if periodoff5 > 0 then period5 := periodoff5 - periodon5; frequency5 := 1/period5; else period5:= -777; frequency5 := -777; endif; results16[resPeriod5%] := period5; results16[resFrequency5%] := frequency5; end; proc AnalysePeriod6(sBurst6, eBurst6) var stats[1]; var periodon6, periodoff6, period6, frequency6; periodon6 := sBurst6; periodoff6 := Nexttime(BurstCh6%, eBurst6); if periodoff6 > 0 then period6 := periodoff6 - periodon6; frequency6 := 1/period6; else period6:= -777; frequency6 := -777; endif; results17[resPeriod6%] := period6; results17[resFrequency6%] := frequency6; end; proc AnalysePeriod7(sBurst7, eBurst7) var stats[1]; var periodon7, periodoff7, period7, frequency7; periodon7 := sBurst7; periodoff7 := Nexttime(BurstCh7%, eBurst7); if periodoff7 > 0 then period7 := periodoff7 - periodon7; frequency7 := 1/period7; else period7:= -777; frequency7 := -777; endif; results18[resPeriod7%] := period7; results18[resFrequency7%] := frequency7; end; '***************************************************************************************************************** 'third subpart of PART THIRTEEN: 'COMPUTING PHASE AMONG NEURONS '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Analyze Phase for neuron 1 proc AnalysePhase0(sBurst1, eBurst1) var nextSBurst1, NSN1, NEN1; var stats[2]; nextSBurst1 :=NextTime(BurstCh1%, eBurst1); NSN1 := (SBurst1-SBurst1)/(nextSBurst1-SBurst1); NEN1 := ((EBurst1-SBurst1)/(nextSBurst1-SBurst1))*100; if NEN1 < 0 then NEN1 := -777 endif if NEN1 < 0 then NSN1 := -777 endif results0[resNormSNeuron1%] := NSN1; results0[resNormENeuron1%] := NEN1; end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Analyze Phase between neurons 1 and 2... proc AnalysePhase1(sBurst1, eBurst1, sBurst2, eBurst2) var nextSBurst1, NSN1, NEN1, NSN2, NEN2; var stats[2]; nextSBurst1 :=NextTime(BurstCh1%, eBurst1); NSN1 := (SBurst1-SBurst1)/(nextSBurst1-SBurst1); NEN1 := ((EBurst1-SBurst1)/(nextSBurst1-SBurst1))*100; NSN2 := ((SBurst2-SBurst1)/(nextSBurst1-SBurst1))*100; NEN2 := ((EBurst2-SBurst1)/(nextSBurst1-SBurst1))*100; if NEN1 < 0 then NEN1 := -777 endif if NEN1 < 0 then NSN1 := -777 endif if NEN2 < 0 then NEN2 := -777 endif if NEN2 < 0 then NSN2 := -777 endif results3[resNormSNeuron1%] := NSN1; results3[resNormENeuron1%] := NEN1; results3[resNormSNeuron2%] := NSN2; results3[resNormENeuron2%] := NEN2; end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'Analyze phase among neurons 1, 2 and 3.... proc AnalysePhase2(sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3) var nextSBurst1, NSN1, NEN1, NSN2, NEN2, NSN3, NEN3; var stats[3]; nextSBurst1 :=NextTime(BurstCh1%, eBurst1); NSN1 := (SBurst1-SBurst1)/(nextSBurst1-SBurst1); NEN1 := ((EBurst1-SBurst1)/(nextSBurst1-SBurst1))*100; NSN2 := ((SBurst2-SBurst1)/(nextSBurst1-SBurst1))*100; NEN2 := ((EBurst2-SBurst1)/(nextSBurst1-SBurst1))*100; NSN3 := ((SBurst3-SBurst1)/(nextSBurst1-SBurst1))*100; NEN3 := ((EBurst3-SBurst1)/(nextSBurst1-SBurst1))*100; if NEN1 < 0 then NEN1 := -777 endif if NEN1 < 0 then NSN1 := -777 endif if NEN2 < 0 then NEN2 := -777 endif if NEN2 < 0 then NSN2 := -777 endif if NEN3 < 0 then NEN3 := -777 endif if NEN3 < 0 then NSN3 := -777 endif results4[resNormSNeuron1%] := NSN1; results4[resNormENeuron1%] := NEN1; results4[resNormSNeuron2%] := NSN2; results4[resNormENeuron2%] := NEN2; results4[resNormSNeuron3%] := NSN3; results4[resNormENeuron3%] := NEN3; end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'analyze phase among neurons 1, 2, 3 and 4... proc AnalysePhase3 (sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4) var nextSBurst1, NSN1, NEN1, NSN2, NEN2, NSN3, NEN3, NSN4, NEN4; var stats[4]; nextSBurst1 :=NextTime(BurstCh1%, eBurst1); NSN1 := (SBurst1-SBurst1)/(nextSBurst1-SBurst1); NEN1 := ((EBurst1-SBurst1)/(nextSBurst1-SBurst1))*100; NSN2 := ((SBurst2-SBurst1)/(nextSBurst1-SBurst1))*100; NEN2 := ((EBurst2-SBurst1)/(nextSBurst1-SBurst1))*100; NSN3 := ((SBurst3-SBurst1)/(nextSBurst1-SBurst1))*100; NEN3 := ((EBurst3-SBurst1)/(nextSBurst1-SBurst1))*100; NSN4 := ((SBurst4-SBurst1)/(nextSBurst1-SBurst1))*100; NEN4 := ((EBurst4-SBurst1)/(nextSBurst1-SBurst1))*100; if NEN1 < 0 then NEN1 := -777 endif if NEN1 < 0 then NSN1 := -777 endif if NEN2 < 0 then NEN2 := -777 endif if NEN2 < 0 then NSN2 := -777 endif if NEN3 < 0 then NEN3 := -777 endif if NEN3 < 0 then NSN3 := -777 endif if NEN4 < 0 then NEN4 := -777 endif if NEN4 < 0 then NSN4 := -777 endif results5[resNormSNeuron1%] := NSN1; results5[resNormENeuron1%] := NEN1; results5[resNormSNeuron2%] := NSN2; results5[resNormENeuron2%] := NEN2; results5[resNormSNeuron3%] := NSN3; results5[resNormENeuron3%] := NEN3; results5[resNormSNeuron4%] := NSN4; results5[resNormENeuron4%] := NEN4; end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~` 'analyze phase among neurons 1, 2, 3, 4 and 5... proc AnalysePhase4 (sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5) var nextSBurst1, NSN1, NEN1, NSN2, NEN2, NSN3, NEN3, NSN4, NEN4, NSN5, NEN5; var stats[5]; nextSBurst1 :=NextTime(BurstCh1%, eBurst1); NSN1 := (SBurst1-SBurst1)/(nextSBurst1-SBurst1); NEN1 := ((EBurst1-SBurst1)/(nextSBurst1-SBurst1))*100; NSN2 := ((SBurst2-SBurst1)/(nextSBurst1-SBurst1))*100; NEN2 := ((EBurst2-SBurst1)/(nextSBurst1-SBurst1))*100; NSN3 := ((SBurst3-SBurst1)/(nextSBurst1-SBurst1))*100; NEN3 := ((EBurst3-SBurst1)/(nextSBurst1-SBurst1))*100; NSN4 := ((SBurst4-SBurst1)/(nextSBurst1-SBurst1))*100; NEN4 := ((EBurst4-SBurst1)/(nextSBurst1-SBurst1))*100; NSN5 := ((SBurst5-SBurst1)/(nextSBurst1-SBurst1))*100; NEN5 := ((EBurst5-SBurst1)/(nextSBurst1-SBurst1))*100; if NEN1 < 0 then NSN1 := -777 endif if NEN1 < 0 then NEN1 := -777 endif if NEN2 < 0 then NEN2 := -777 endif if NEN2 < 0 then NSN2 := -777 endif if NEN3 < 0 then NEN3 := -777 endif if NEN3 < 0 then NSN3 := -777 endif if NEN4 < 0 then NEN4 := -777 endif if NEN4 < 0 then NSN4 := -777 endif if NEN5 < 0 then NEN5 := -777 endif if NEN5 < 0 then NSN5 := -777 endif results6[resNormSNeuron1%] := NSN1; results6[resNormENeuron1%] := NEN1; results6[resNormSNeuron2%] := NSN2; results6[resNormENeuron2%] := NEN2; results6[resNormSNeuron3%] := NSN3; results6[resNormENeuron3%] := NEN3; results6[resNormSNeuron4%] := NSN4; results6[resNormENeuron4%] := NEN4; results6[resNormSNeuron5%] := NSN5; results6[resNormENeuron5%] := NEN5; end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~` 'analyze phase among neurons 1, 2, 3, 4, 5 and 6... proc AnalysePhase5 (sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6) var nextSBurst1, NSN1, NEN1, NSN2, NEN2, NSN3, NEN3, NSN4, NEN4, NSN5, NEN5, NSN6, NEN6; var stats[6]; nextSBurst1 :=NextTime(BurstCh1%, eBurst1); NSN1 := (SBurst1-SBurst1)/(nextSBurst1-SBurst1); NEN1 := ((EBurst1-SBurst1)/(nextSBurst1-SBurst1))*100; NSN2 := ((SBurst2-SBurst1)/(nextSBurst1-SBurst1))*100; NEN2 := ((EBurst2-SBurst1)/(nextSBurst1-SBurst1))*100; NSN3 := ((SBurst3-SBurst1)/(nextSBurst1-SBurst1))*100; NEN3 := ((EBurst3-SBurst1)/(nextSBurst1-SBurst1))*100; NSN4 := ((SBurst4-SBurst1)/(nextSBurst1-SBurst1))*100; NEN4 := ((EBurst4-SBurst1)/(nextSBurst1-SBurst1))*100; NSN5 := ((SBurst5-SBurst1)/(nextSBurst1-SBurst1))*100; NEN5 := ((EBurst5-SBurst1)/(nextSBurst1-SBurst1))*100; NSN6 := ((SBurst6-SBurst1)/(nextSBurst1-SBurst1))*100; NEN6 := ((EBurst6-SBurst1)/(nextSBurst1-SBurst1))*100; if NEN1 < 0 then NSN1 := -777 endif if NEN1 < 0 then NEN1 := -777 endif if NEN2 < 0 then NEN2 := -777 endif if NEN2 < 0 then NSN2 := -777 endif if NEN3 < 0 then NEN3 := -777 endif if NEN3 < 0 then NSN3 := -777 endif if NEN4 < 0 then NEN4 := -777 endif if NEN4 < 0 then NSN4 := -777 endif if NEN5 < 0 then NEN5 := -777 endif if NEN5 < 0 then NSN5 := -777 endif if NEN6 < 0 then NEN6 := -777 endif if NEN6 < 0 then NSN6 := -777 endif results7[resNormSNeuron1%] := NSN1; results7[resNormENeuron1%] := NEN1; results7[resNormSNeuron2%] := NSN2; results7[resNormENeuron2%] := NEN2; results7[resNormSNeuron3%] := NSN3; results7[resNormENeuron3%] := NEN3; results7[resNormSNeuron4%] := NSN4; results7[resNormENeuron4%] := NEN4; results7[resNormSNeuron5%] := NSN5; results7[resNormENeuron5%] := NEN5; results7[resNormSNeuron6%] := NSN6; results7[resNormENeuron6%] := NEN6; end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~` 'analyze phase among neurons 1, 2, 3, 4, 5, 6 AND 7... proc AnalysePhase6 (sBurst1, eBurst1, sBurst2, eBurst2, sBurst3, eBurst3, sBurst4, eBurst4, sBurst5, eBurst5, sBurst6, eBurst6, sBurst7, eBurst7) var nextSBurst1, NSN1, NEN1, NSN2, NEN2, NSN3, NEN3, NSN4, NEN4, NSN5, NEN5, NSN6, NEN6, NSN7, NEN7; var stats[7]; nextSBurst1 :=NextTime(BurstCh1%, eBurst1); NSN1 := (SBurst1-SBurst1)/(nextSBurst1-SBurst1); NEN1 := ((EBurst1-SBurst1)/(nextSBurst1-SBurst1))*100; NSN2 := ((SBurst2-SBurst1)/(nextSBurst1-SBurst1))*100; NEN2 := ((EBurst2-SBurst1)/(nextSBurst1-SBurst1))*100; NSN3 := ((SBurst3-SBurst1)/(nextSBurst1-SBurst1))*100; NEN3 := ((EBurst3-SBurst1)/(nextSBurst1-SBurst1))*100; NSN4 := ((SBurst4-SBurst1)/(nextSBurst1-SBurst1))*100; NEN4 := ((EBurst4-SBurst1)/(nextSBurst1-SBurst1))*100; NSN5 := ((SBurst5-SBurst1)/(nextSBurst1-SBurst1))*100; NEN5 := ((EBurst5-SBurst1)/(nextSBurst1-SBurst1))*100; NSN6 := ((SBurst6-SBurst1)/(nextSBurst1-SBurst1))*100; NEN6 := ((EBurst6-SBurst1)/(nextSBurst1-SBurst1))*100; NSN7 := ((SBurst7-SBurst1)/(nextSBurst1-SBurst1))*100; NEN7 := ((EBurst7-SBurst1)/(nextSBurst1-SBurst1))*100; if NEN1 < 0 then NSN1 := -777 endif if NEN1 < 0 then NEN1 := -777 endif if NEN2 < 0 then NEN2 := -777 endif if NEN2 < 0 then NSN2 := -777 endif if NEN3 < 0 then NEN3 := -777 endif if NEN3 < 0 then NSN3 := -777 endif if NEN4 < 0 then NEN4 := -777 endif if NEN4 < 0 then NSN4 := -777 endif if NEN5 < 0 then NEN5 := -777 endif if NEN5 < 0 then NSN5 := -777 endif if NEN6 < 0 then NEN6 := -777 endif if NEN6 < 0 then NSN6 := -777 endif if NEN7 < 0 then NEN7 := -777 endif if NEN7 < 0 then NSN7 := -777 endif results8[resNormSNeuron1%] := NSN1; results8[resNormENeuron1%] := NEN1; results8[resNormSNeuron2%] := NSN2; results8[resNormENeuron2%] := NEN2; results8[resNormSNeuron3%] := NSN3; results8[resNormENeuron3%] := NEN3; results8[resNormSNeuron4%] := NSN4; results8[resNormENeuron4%] := NEN4; results8[resNormSNeuron5%] := NSN5; results8[resNormENeuron5%] := NEN5; results8[resNormSNeuron6%] := NSN6; results8[resNormENeuron6%] := NEN6; results8[resNormSNeuron7%] := NSN7; results8[resNormENeuron7%] := NEN7; end; proc initializephaseplot() phaseplot:=filenew(12,1); 'open XY plot '******** we will have three channels per neuron, one for box and one for each standard deviation '******** this is so that we can use coreldraw to fill colors into the box (the box has to be a distinct channel for that) XYSetChan(0); 'create channel 2 XYSetChan(0); 'create channel 3 for channelnumber:=2 to number1% do 'make channels XYSetChan(0); 'create new channel 1 XYSetChan(0); 'create new channel 2 XYSetChan(0); 'create new channel 3 ChanShow(-1); 'show them next; XYDrawMode(-1,1,0); 'set drawmode to joined without dots XYDrawMode(-1,2,0); XYDrawMode(-1,3,0); XYDrawMode(-1,4,2); return; end; proc phaseplotter() var channelcounter; for channelnumber:=1 to number1%*3 step 3 do 'iterate phase data , 3 channels per neuron channelcounter:=channelcounter+1; '******** ROUND NUMBERS -> 0.1% precision, and normalize to 1 (instead of percent) phaseon[channelcounter]:=round(phaseon[channelcounter]*10)/1000; stdon[channelcounter]:=round(stdon[channelcounter]*10)/1000; phaseoff[channelcounter]:=round(phaseoff[channelcounter]*10)/1000; stdOFF[channelcounter]:=round(stdOFF[channelcounter]*10)/1000; spikesperburst[channelcounter]:=round(spikesperburst[channelcounter]*100)/100; spikesperburstSD[channelcounter]:=round(spikesperburstSD[channelcounter]*100)/100; '************************* '***************** ' the following can savely be deleted - it is here for debug reasons (displays the values of the phase plot) DlgCreate("Phasediagram"); DlgString(1,"Name of Neuron",255); DlgReal(2,"phase on",0,5); DlgReal(3,"Std dev phase on",0,5); DlgReal(4,"phase off",0,5); DlgReal(5,"Std Dev phase off",0,5); DlgShow(name$[channelcounter],phaseon[channelcounter],stdon[channelcounter],phaseoff[channelcounter],stdOFF[channelcounter]); ' ******************* do not delete below!!! '*** set positions of edges for boxes and Std Dev. First neuron on top, last on bottom, range depends on number of neurons XYAddData(channelnumber+1,phaseon[channelcounter]-stdon[channelcounter],number1%-channelnumber/3+0.7); 'we have to devide channelnumber by 3 on the y-axis because we have 3 channels XYAddData(channelnumber+1,phaseon[channelcounter]-stdon[channelcounter],number1%-channelnumber/3+0.3); XYAddData(channelnumber+1,phaseon[channelcounter]-stdon[channelcounter],number1%-channelnumber/3+0.5); XYAddData(channelnumber+1,phaseon[channelcounter],number1%-channelnumber/3+0.5); XYAddData(channelnumber,phaseon[channelcounter],number1%-channelnumber/3+0.2); XYAddData(channelnumber,phaseoff[channelcounter],number1%-channelnumber/3+0.2); XYAddData(channelnumber,phaseoff[channelcounter],number1%-channelnumber/3+0.8); XYAddData(channelnumber,phaseon[channelcounter],number1%-channelnumber/3+0.8); XYAddData(channelnumber,phaseon[channelcounter],number1%-channelnumber/3+0.2); XYAddData(channelnumber,phaseoff[channelcounter],number1%-channelnumber/3+0.2); XYAddData(channelnumber+2,phaseoff[channelcounter],number1%-channelnumber/3+0.5); XYAddData(channelnumber+2,phaseoff[channelcounter]+stdoff[channelcounter],number1%-channelnumber/3+0.5); XYAddData(channelnumber+2,phaseoff[channelcounter]+stdoff[channelcounter],number1%-channelnumber/3+0.3); XYAddData(channelnumber+2,phaseoff[channelcounter]+stdoff[channelcounter],number1%-channelnumber/3+0.7); XYJoin(channelnumber,1); 'join edges by line XYJoin(channelnumber+1,1); 'join edges by line XYJoin(channelnumber+2,1); 'join edges by line ChanTitle$(channelnumber,name$[channelcounter]+" spks: "+STR$(spikesperburst[channelcounter])+"+/-"+STR$(spikesperburstSD[channelcounter])); 'give a name to channel ChanTitle$(channelnumber+1,"onset: "+STR$(phaseon[channelcounter])+"+/-"+STR$(stdon[channelcounter])); 'give a name to channel ChanTitle$(channelnumber+2,"off: "+STR$(phaseoff[channelcounter])+"+/-"+STR$(stdOFF[channelcounter])); 'give a name to channel next; YRange(-1,0,channelnumber/3+1); 'set y axis range YAxisMode(31); 'and remove y axis XAxisMode(7); 'remove small ticks on x axins and x axis name DlgCreate("box with names",0,0,0,2); 'ask if names of neuron should be given DlgButton(1,"create box with neuron names"); DlgButton(0,"skip"); janein:=DlgShow(); if janein=1 then XYKey(1,1); 'create box that contains names of the channels XYKey(3,0); XYKey(4,5); xykey(5,50); 'and place it in the middle XYKey(4,50); Message("you can move the box with the mouse"); endif; return; end; '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~` 'THE END.