function gephus %% STARTUP BOILERPLATE %Set up a wait bar to show the progress. wb = waitbarWithCancel(0, 'Starting ephus...', 'Name', 'Loading software...'); pos = get(wb, 'Position'); pos(2) = pos(2) - pos(4); set(wb, 'Position', pos); %% DEVICE/CHANNEL CONFIGURATION %Amplifier objects for ephys patch{1} = multi_clamp('text_file_location', 'C:\MATLAB6p1\work\Physiology\MClamp700BChannel1.txt', 'scaledOutputBoardID', 1, 'scaledOutputChannelID', 0, ... 'vComBoardID', 1, 'vComChannelID', 0, 'channel', 1, 'name', '700B-1'); patch{2} = multi_clamp('text_file_location', 'C:\MATLAB6p1\work\Physiology\MClamp700BChannel2.txt', 'scaledOutputBoardID', 1, 'scaledOutputChannelID', 4, ... 'vComBoardID', 1, 'vComChannelID', 1, 'channel', 2, 'name', '700B-2'); %Acquirer channels acqChannelNames = {'photodiode1'}; acqBoardIDs = [2]; acqChanIDs = [0]; %Stimulator channels stimChannelNames = {'pockelsCell' 'shutter0' 'xMirror' 'yMirror' 'shutter1' 'ao5' 'ao6' 'ao7'}; stimBoardIDs = [3 3 3 3 3 3 3 3]; stimChanIDs = [0 1 2 3 4 5 6 7]; %% CONFIGURATION VARIABLES triggerOrigin = '/dev1/port0/line0'; %Specifies the digital line terminal on which the trigger pulse is output at the start of each acquisition triggerDest = 'PFI0'; %Specifies the digital line terminal on which the trigger pulse is received. On /every/ board, this must be connected to the triggerOriginal terminal xsgStartDirectory = 'C:\Data\'; %Default directory in which to save data files pockelsOn=1; %Logical value specifying whether Pockels Cell is in fact attached/active on %Size, in microns, of the camera FOV (a camera application is required by the mapper program) xVideoScaleFactor = 2625; yVideoScaleFactor = 1980; %% *************************END OF CONFIGURATION*************************************** %% TIMING/CLOCK SETUP %Set up the triggering. acqJob = daqjob('acquisition'); scopeJob = daqjob('scope'); setTriggerOrigin(acqJob, triggerOrigin); setTriggerOrigin(scopeJob, triggerOrigin); setTriggerDestination(acqJob, triggerDest); setTriggerDestination(scopeJob, triggerDest); %% PROGRAM STARTUP if waitbarUpdate(0.0, wb, 'Starting experimentSavingGui...'); return; end xsg = openprogram(progmanager,{'xsg', 'experimentSavingGui'}); setLocal(progmanager, xsg, 'directory',xsgStartDirectory); if waitbarUpdate(0.1, wb, 'Starting ephys...'); return; end ep = openprogram(progmanager,'ephys',patch); if waitbarUpdate(0.16, wb, 'Starting ephysScopeAccessory...'); return; end openprogram(progmanager,'ephysScopeAccessory',patch); if waitbarUpdate(0.24, wb, 'Starting stimulator...'); return; end stim = openprogram(progmanager, 'stimulator'); stim_addChannels(stim,stimChannelNames,stimBoardIDs,stimChanIDs); if waitbarUpdate(0.32, wb, 'Starting acquirer...');return;end acq = openprogram(progmanager,'acquirer'); acq_addChannels(acq,acqChannelNames,acqBoardIDs,acqChanIDs); if waitbarUpdate(0.48, wb, 'Starting pulseJacker...');return;end openprogram(progmanager, 'pulseJacker',{ep,stim}); if waitbarUpdate(0.52, wb, 'Starting userFcns...');return;end openprogram(progmanager, 'userFcns'); if waitbarUpdate(0.56, wb, 'Starting autonotes...');return;end openprogram(progmanager, 'autonotes'); if waitbarUpdate(0.60, wb, 'Starting headerGui...');return;end openprogram(progmanager, 'headerGUI'); if waitbarUpdate(0.64, wb, 'Starting HotSwitch...');return;end openprogram(progmanager,{'hotswitch', 'hotswitch', 'hotswitch', 'hs_config', 'hs_config'}); if waitbarUpdate(.68, wb, 'Starting photodiode configuration...');return;end pdiodeConfig = openprogram(progmanager, {'photodiode' 'photodiodeConfiguration'},'photodiode1'); end if waitbarUpdate(0.76, wb, 'Starting mapper...');return;end if pockelsOn mapper = openprogram(progmanager, 'mapper','xMirror','yMirror','pockelsCell','shutter0',pdiodeConfig); else %Don't associate either Pockels or Photodiode channel with mapper, if Pockels is not used mapper = openprogram(progmanager, 'mapper','xMirror','yMirror','','shutter0'); end setLocalBatch(progmanager, mapper, 'xVideoScaleFactor', xVideoScaleFactor, 'yVideoScaleFactor', xVideoScaleFactor); %% USERFCN BINDINGS if waitbarUpdate(0.84, wb, 'Setting up default (built-in) userFcns...');return;end userFcnCBM = getUserFcnCBM; fprintf(1, 'Default UserFcn mappings:\n'); %userFcns for LSPS/mapping customization addCallback(userFcnCBM, 'xsg:NewCell', @mapper_newCell_userFcn, 'userFcns_mapper_newCell_userFcn','verbose'); if acqAvailable addCallback(userFcnCBM, 'ephys:SamplesAcquired', @mapper_userFcn_ephysSamplesAcquired_display, 'userFcns_mapper_userFcn_ephysSamplesAcquired_display','verbose'); addCallback(userFcnCBM, 'ephys:SamplesAcquired', @mapper_userFcn_ephysSamplesAcquired_updateMirrorPosition, 'userFcns_mapper_userFcn_ephysSamplesAcquired_updateMirrorPosition','verbose'); end addCallback(userFcnCBM, 'mapper:MapStart', @mapper_userFcn_mapStart_display, 'userFcns_mapper_userFcn_mapStart_display','verbose'); addCallback(userFcnCBM, 'mapper:MapStop', @mapper_userFcn_mapStop_display, 'userFcns_mapper_userFcn_mapStop_display','verbose'); addCallback(userFcnCBM, 'mapper:MouseStart', @mapper_userFcn_mouseStart_updateMirrorPosition, 'userFcns_mapper_userFcn_mouseStart_updateMirrorPosition','verbose'); addCallback(userFcnCBM, 'mapper:PreGrabVideo', @loadImage4Mapper, 'userFcns_loadImage4Mapper','verbose'); addCallback(userFcnCBM, 'mapper:PostGrabVideo', @unloadImage4Mapper, 'userFcns_unloadImage4Mapper','verbose'); fprintf(1, '----------------------------\n'); %% ENDING BOILERPLATE %Load a configuration (if requested). if waitbarUpdate(0.88, wb, 'Loading configuration...');return;end loadConfigurations(progmanager); fprintf(1, '\nLoading Completed.\n\n'); delete(wb); %Kill the waitbar. fprintf(1, '\n\n-----------------------------------\n-----------------------------------\n\n\n\n\n\n\n\n');