User Tools

Site Tools


ephys_pipeline:2_phys_gui

This is an old revision of the document!


Phys gui

All preprocessing is done by

function phys_gui_execute(handles)

Handles are desribed later on in this section Alternatively, you can use a GUI by using the command

phys_gui_working


A figure will pop up which looks something like this: Select your monkey from the dropdown menu
Select the session folders you want to process after hitting the “Add date from list” button
If you hit “Run”, phys_gui will do all the preprocessing that you checked (see below) on the selected folders. The box above will remind you of which steps you selected.

Rename folders

In later TDT software versions (synapse - setup 3), the folder naming is different. For converting folders recorded with synapse to the old (our standard) folder naming, check the box “RenameSynapseTankNameToOldTankFormat”.

Waveclus pre-clustering

If you want to use the waveclus pipeline, you first need to create waveclus sortcodes. You can do so by checking “WCFromBB”. Make sure, the electrode_depths file is update for the selected blocks, as this is a requirement for the current WC preprocessing pipeline (see …). Folders (WC_Block-N) will be created for each block N, and one additional folder (WC) will contain the clustered data, concatenating for each channel separately all blocks where the electrode was in certain range.

Waveclus pre-clustering settings

handlecheckboxInfo
handles.WC.threshold Threshold
handles.WC.StdThrSU Std thr SU
handles.WC.StdThrMU Std thr MU
handles.WC.hp filter
handles.WC.hpcutoff HP
handles.WC.lpcutoff LP
handles.WC.cell_tracking_distance_limit site dist
handles.WC.remove_ini INI remove

Additional Waveclus settings

For simplicity, some of the potential waveclus settings have been hardcoded inside phys_gui, calling get_WC_settings.
However, when you input the handles directly using phys_gui_execute, you can still define them as you like.

%% defaults
handles.RAM = 24;                           % SYSTEM MEMORY in GB
handles.dtyperead = 'single';               % Data TYPE             
handles.dtypewrite = handles.dtyperead;
handles.sys = 'TD';                         % RECORDING SYSTEM
handles.rawname = '*.tdtch';                % RAW DATAFILES NAME
handles.blockfile=0;                        % not used?
 
% FILTERING: LINE NOISE
handles.WC.linenoisecancelation = 0;         % 1 for yes; 0 for no
handles.WC.linenoisefrequ = 50;              % Line noise frequency
handles.WC.transform_factor = 0.25;          % microVolts per bit for higher accuracy when saved as int16 after filtering;
handles.WC.iniartremovel = 1;                % ignore first 40 samples
 
% DETECTION
handles.WC.w_pre = 10;                      % N samples for snippet before threshold crossing
handles.WC.w_post = 22;                     % N samples for snipept after threshold crossing
handles.WC.ref = 0.001;                     % 'Refractory period' in seconds
handles.WC.int_factor = 1;                  % for potential interpolation for more datapoints to classify
handles.WC.interpolation ='n';              % Interpolationused or not
handles.WC.stdmax = 100;                    % Artifact rejection threshold in std
 
% FEATURE SELECTION
handles.WC.features = 'wavpcarawtime';     % features to be considered (in any order: wav(elets),pca,raw (datapoints),time,deriv(ates)
handles.WC.wavelet='haar';                 % choice of wavelet family for wavelet features
handles.WC.exclusioncrit = 'thr';          % this part is weird to me as well,
handles.WC.exclusionthr = 0.9;             % features are excluded, until no feature pairs are correlated more than exclusionthr  %def R^2 = 0.80
handles.WC.maxinputs = 9;                  % number of feature inputs to the clustering 
handles.WC.scales = 4;                     % scales for wavelet decomposition
 
% CLUSTERING 
handles.WC.num_temp = 18;                   % number of temperatures 
handles.WC.mintemp = 0;                     % minimum temperature
handles.WC.maxtemp = 0.18;                  % maximum temperature  
handles.WC.tempstep = 0.01;                 % temperature step
handles.WC.SWCycles = 100;                  % number of montecarlo iterations
handles.WC.KNearNeighb = 11;                % number of nearest neighbors
handles.WC.max_spikes2cluster = 40000;      % maximum number of spikes to cluster
handles.WC.min_clus_abs = 100;              % Minimum cluster size number of spikes
handles.WC.min_clus_rel = 0.005;            % Minimum cluster size as fraction of all spikes
handles.WC.max_nrclasses = 11;              % Maximum number of clsuters
handles.WC.template_sdnum = 5;              % max radius of cluster in std devs. for classifying rest
handles.WC.classify_space='features';       % for classifying rest only
handles.WC.classify_method= 'linear';       % for classifying rest only
 
% PLOTTING
handles.WC.temp_plot = 'log';              % temperature plot in log scale
handles.WC.max_spikes2plot = 1000;         % maximum number of spikes to plot.
handles.WC.max_nrclasses2plot = 8;         % not quite sure where this is used

Create Plexon files from snippets

If you want (or have) to use the online detected snippets, check “PLXFromSnippets”. If you first want to Realign your snippets to the minima, check “PLXFromRealignedSnippets” instead. PLX Files will be called Date_blocks_N.plx or Date_Realigned_blocks_N respectively.

Create Plexon files from waveclus sortcodes

After you sorted with waveclus, you can create a plexon file from your saved sortcodes. Check “PLXFromWCFromBB”. PLX Files will be called Date_from_BB_blocks_N.

Combine ephys and behavioral data

After you are done with sorting, you can synchronize your recorded data with behavioral data, adding LFP and spike information in the trial structure format that monkeypsych uses. Check “CombineTDTandMP”.
In order to indicate which type of sorting you want to use, select one option in the “Choose spikes” section
“Snippets” uses the sortcodes based on the original snippets
“Realigned” uses the sortcodes based on realigned snippets
“FromBB” uses the sortcodes based on WC clustered PLX files
Choose “none” in case you are only interested in LFP. No spikes will be added to your combined data.

There is also an option for disregarding LFP. If you select this option, LFP data in the combined file will not be updated (in case it has been processed previously) or completely left out (if it hasn't been processed before). Use this option as long as you are resorting. You can also add LFP dat at a later point.

Create Excel entries

Check “CreateExcelEntries” for creating/updating the automatic sorting sheet of the respective Excel sorting table with the selected data (sessions). Only works after you did all the preceding steps.

ephys_pipeline/2_phys_gui.1641997325.txt.gz · Last modified: 2022/12/29 07:15 (external edit)