-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCorduroy_DAQ_personal.ipf
executable file
·178 lines (135 loc) · 6.45 KB
/
Corduroy_DAQ_personal.ipf
1
#pragma rtGlobals=1 // Use modern global access method.///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CORDUROY_DAQ_personal// Please see READ-ME for relevant notes and information//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Window CORD_DAQPersonalPanel() : Panel/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// PauseUpdate; Silent 1 // building the window... NewPanel/W=(780,510,1000,740)/K=1 as "Personal DAQ Panel" SetDrawLayer UserBack SetDrawEnv fstyle=2 variable spacing = 20 Button PERS_1, pos={10,10}, size={200,20}, proc=CORD_RunDAQPersonal, title="Run Dynamic Clamp" Button PERS_2, pos={10,10+30*1}, size={200,20}, proc=CORD_RunDAQPersonal, title="Load Stimulus Waves" Button PERS_3, pos={10,10+30*2}, size={100,20}, proc=CORD_RunDAQPersonal, title="Rescale" SetVariable PERS_3A bodyWidth=60, frame=1, fsize=11, limits={0,inf,0}, pos={160,12+30*2}, noproc, value=root:DAQ:General:personal_scale, title="Max" Button PERS_4, pos={10,10+30*3}, size={200,20}, proc=CORD_RunDAQPersonal, title="Tune Spike Prob" Button PERS_5, pos={10,10+30*4}, size={200,20}, proc=CORD_RunDAQPersonal, title="Test Spike Prob" Button PERS_6, pos={10,10+30*5}, size={200,20}, proc=CORD_RunDAQPersonal, title="" Button PERS_7, pos={10,10+30*6}, size={200,20}, proc=CORD_RunDAQPersonal, title="Reset ITC-18"End///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////function CORD_RunDAQPersonal(ctrlName) : ButtonControl/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// string ctrlName string tmp1=StringFromList(1,ctrlName, "_") variable ButtonNumber = str2num(tmp1) switch(ButtonNumber) // numeric switch case 1: break case 2: break case 3: CORD_RescaleActiveProtocol() break case 4: break case 5: break case 6: break case 7: //CORD_InitializeITC18() break endswitchEnd///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////function CORD_RescaleActiveProtocol()/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// NVAR amplitude = root:DAQ:General:personal_scale SVAR active = root:DAQ:ProtocolPanel:activeProt if(stringmatch(active, "None")) Abort "No active protocol is selected." else SetDataFolder root:DAQ:Protocols:$active endif SVAR baseName = root:DAQ:General:baseName// string nbname = baseName+"NB"// string updatetxt = "Rescaled the active protocol"// Notebook $nbname, text=updatetxt+"\r" string ListOfOutWaves = WaveList("seg_*",";","") variable index=0 string CurrentWave = "" for(index=0;index<ItemsInList(ListOfOutWaves);index+=1) CurrentWave = StringFromList(index, ListOfOutWaves) WAVE local = $CurrentWave WaveStats local if(ItemsInList(ListOfOutWaves)==1) local = local / V_max endif local = local * amplitude endforEnd///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////function CORD_MakeDAQPersonalWindow()/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// variable/G root:DAQ:General:personal_scale=1 DoWindow/F CORD_DAQPersonalPanel if (V_Flag!=0) DoWindow/K CORD_DAQPersonalPanel endif Execute "CORD_DAQPersonalPanel()" Execute "ModifyPanel cbRGB = (32125,33410,39321)"End///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////function CORD_TuneSpikeProb()///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Look for the necessary protocol directory to run the tuning// User must make sure to load "tune_Ps" variable testDF = DataFolderExists("root:DAQ:Protocols:tune_Ps") if(testDF) SetDataFolder root:DAQ:Protocols:tune_Ps else Abort "You must load a tuning protocol with the name :: tune_Ps" endif // Make this the active data folder so that don't get messed up later SVAR active = root:DAQ:ProtocolPanel:activeProt active = "tune_Ps" // Use the standard run call to run this protocol NVAR SaveToggle = root:DAQ:ProtocolPanel:SaveToggle SaveToggle = 1 CORD_ACQ_background(1)// Get the name of the most recently recorded waves NVAR FileCnt = root:DAQ:General:FileCnt SVAR baseName = root:DAQ:General:baseName string LastFold = "root:"+baseName+num2str(FileCnt-1) SetDataFolder $LastFold// Plot the waves in the this data folder DisplayWaveListOneChannel(WaveList("RecordA*",";",""),1)// Analyze using the spike detector // load the correct analysis module SetDataFolder root:DAQ:Protocols:tune_Ps SVAR modName = associated_module CORD_LoadMod(modName) // run the analysis SetDataFolder $LastFold CORD_AnalysisPanelRun()// Use interpolation to determine the appropriate scaling WAVE numspikes = numspikes WAVE amplitude = amplitude NVAR repeats = repeats CORD_GetScaling(numspikes,amplitudes,repeats)End///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////function CORD_GetScaling(numspikes,amplitudes,repeats)/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// wave numspikes wave amplitudes variable repeats End