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); %% CONFIG EPHYS/ACQUIRER/STIM (DEVICES/CHANNELS) --> Please adjust! %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]; %% CONFIG VARS --> Please adjust! triggerOrigin = '/dev1/port0/line0'; %Corresponds to EXSTRB on a BNC2090 on connector 0 for a PCI-6259 board. triggerDest = 'PFI0'; xsgStartDirectory = 'C:\Data\'; xVideoScaleFactor = 2625; yVideoScaleFactor = 1980; %% TIMING/CLOCK CONFIG --> Adjust with care... %Set up the triggering. acqJob = daqjob('acquisition'); scopeJob = daqjob('scope'); setTriggerOrigin(acqJob, '/dev1/port0/line0'); setTriggerOrigin(scopeJob, '/dev1/port0/line0'); setTriggerDestination(acqJob, 'PFI0'); setTriggerDestination(scopeJob, 'PFI0'); %% START PROGRAMS --> Add/remove/configure with care... if waitbarUpdate(0.0, wb, 'Starting experimentSavingGui...'); return; end xsg = openprogram(progmanager,{'xsg', 'experimentSavingGui'}); setLocalBatch(progmanager, xsg, 'directory',xsgStartDirectory); setLocal(progmanager,xsg,'autosave',0); %turns off autosave 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'); if waitbarUpdate(0.76, wb, 'Starting mapper...');return;end mapper = openprogram(progmanager, 'mapper','xMirror','yMirror','pockelsCell','shutter0',pdiodeConfig); setLocalBatch(progmanager, mapper, 'xVideoScaleFactor', xVideoScaleFactor, 'yVideoScaleFactor', xVideoScaleFactor); %% DEVELOPER-CREATED USERFCNS --> Adjust with care... %These userFcns allow developers to customize Ephus to specific applications 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'); 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'); 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'); %% USER-CREATED USERFCNS --> Please add! %Add userFcns here to customize Ephus yourself %userFcns can also be added via userFcns GUI, and saved to configuration sets if waitbarUpdate(0.86, wb, 'Setting up user-made userFcns...');return;end fprintf(1, 'User-created UserFcn mappings:\n'); % add here! 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');