sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b571bcdcf180abf7adc3b71fc68a98a6e3e8b826e49b500b4386f926a0d63093
MATLAB
432
17
function chans = LK_GetChans(chanDir) % % LK_GetChans gets all channels within a specific directory, sorted in % ascending order. % % Use as: chans = LK_GetChans(chanDir); % % See also dir, replace, lettersPattern % % Lukas Kunz, 2021 % all channels in the directory chans = dir(chanDir); % sort all channels in asce...
f68394ac4b7c61ac68ad5542e34a0a3c8d1db6fc750b9adf812c1ae58f2f72a1
MATLAB
432
18
%% check_gi_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 100 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; tree.Ri = 100; tree.Gm = 1 / 2500; tree.Cm = 1; gi_tree (tree, 'none'); end end %% test 2 gi_tree ...
b3e802377e1b1529efd981385a8e2490eea3f30bbe86de75ec8327c390f4792e
MATLAB
435
12
%% curve fitting for neural and behavioral activity % example fake_data = [1 2 3 4 5 6 7 8 9]; raw_data = fake_data; x = 1:1:length(fake_data); y = raw_data; [param,stat]=sigm_fit(x,y,[],[],[]); corrIndv95 = (max(stat.ypred)-min(stat.ypred))*0.95+min(stat.ypred); % find the closesd day func = @(xval)param(1)...
eb9149269a321b649d0c15c8949c1641d08486288d478b49aadce2cb5cd320cd
MATLAB
437
16
%% check_vtext_tree %% test 1 tree = sample2_tree; clf; axis off; plot_tree (tree, [0 0 0], [], [], [], '-b'); ht = vtext_tree (tree, ... ('hello!!!!')', eucl_tree (tree), [0 0 10], [], 1 : 9); set (ht, ... 'fontsize', 36, ... 'fontname', ...
effab5a92986397d3f298999ce62d245ee3d3ea1f5a038f87e5ab0a6c350b732
MATLAB
442
11
headstage_source='eCube'; %options: 'UCLA' or 'Intan' or 'eCube'. Value must be entered as a string. if strcmp(headstage_source, 'UCLA') disp('Using the UCLA 64 ch amplifier board') elseif strcmp(headstage_source, 'Intan') disp('Using the Intan 128 ch amplifier board') elseif strcmp(headstage_source, 'eCube'...
b8f44b187c4d692f1b0d85981dd56e64d23f3513dccf172e1e4322ceecc9aaf1
MATLAB
444
18
%% check_lambda_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 100 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; tree.Ri = 100; tree.Gm = 1 / 2500; tree.Cm = 1; lambda_tree (tree, 'none'); end end %% test 2 ...
4f377b08a508fbd3096b8f998fef45720d48a60b0ba4c15604d437e096993ae3
MATLAB
446
13
function live2pAcqDone(src, evt, varargin) global ws hSI = src.hSI; % try to get the saved tiff name at the end of each acquistion % not sure if this will work % can send w/o fname and live2p will look for the most recent tiff out.EVENTTYPE = 'ACQDONE'; out.filename = [hSI.hScan2D.logFilePath '\' hSI.hScan2D.logFileS...
b0dc8e1865c8ea821f3e8e475817ecc48acd2a29bd18522de948447b7d2a5ad0
MATLAB
449
16
function str = getCurrentPopupString(hh) %# getCurrentPopupString returns the currently selected string in the popupmenu with handle hh %# could test input here if ~ishandle(hh) || strcmp(get(hh,'Type'),'popupmenu') error('getCurrentPopupString needs a handle to a popupmenu as input') end %# get the string - do it th...
54799bd34d121e738aca24138ac18ff44ea459bc107c814ee8730ee3fe22890a
MATLAB
451
24
function tree = strip_axon(tree) %Strips the axon away from the rest of the cell morphology. axon_nodes = []; for i = 1:length(tree.R) if tree.R(i) == 2 axon_nodes = [axon_nodes, i]; end end tree = delete_tree(tree, axon_nodes); for i = 1:length(tree.R) if(tree.R(i) == 3) tree.R(i) = 4; ...
345610f80f336bc2c4f628fd67930cff86b0e78091d989ecaddbdc40a7b535f9
MATLAB
452
13
function newPrevPermute = addDimPrevPermute(prevPermute, dimLabel, dimNumber) newPrevPermute = prevPermute; for iDim = 1:size(prevPermute, 2) dimensionNumber = prevPermute{1, iDim}; if(dimensionNumber >= dimNumber) newPrevPermute{1, iDim} = dimensionNumber + 1; end end ...
108a7f01fc627369a042c2b2bd7a01f3d9bad72bd2ab3c234c58e66fd196906a
MATLAB
454
22
function oinf = goi_oinfo(X,biascorrect) % Compute the O-information for the matrix X (nobs x nvartot) % if nargin < 2; biascorrect = 'true'; end X = goi_copnorm(X); % Copula normalization % matrix size [~, nvartot] = size(X); H = goi_ent_g(X, biascorrect); oinf = (nvartot - 2)*H; for i = 1:nvarto...
b74553a3a7497de7f684ae7b6e14cda1279572b6814a6a0f711916f4dd5a858a
MATLAB
454
18
%% check_gene_tree %% test 1 clf; dLPTCs = load_tree ('dLPTCs.mtr'); gene_tree (dLPTCs, '-s'); axis off tight; tprint ('./panels/gene_tree1', ... '-jpg -HR', [10 30]); %% test 2 clf; hold on; gene = gene_tree ({{sample2_tree}}, '-s'); d...
69253d8fd850ae19f465b767a115cd621a5f71769698cc8fa306b1d9badbe085
MATLAB
455
13
%% Create a figure big enough to fill almost whole (secondary) monitor. function hFig = createFullScreenFig graphicsRoot = groot; if size(graphicsRoot.MonitorPositions, 1) == 2 monitorPos = graphicsRoot.MonitorPositions(2, :); elseif size(graphicsRoot.MonitorPositions, 1) == 1 monitorPos = graphicsRoot....
9a52ecbdd5d6fbce6623c3789665cf4e2e6cd5ae6064d17375d2d0d6791c161d
MATLAB
455
17
function dispFrame(obj,~,~) % This callback is run every time a frame has been acquired % % function zapit.gui.main.controller.dispFrame() % % Purpose % This callback listens to the lastAcuireFrame property on the model % and runs whenever it is modified. if isempty(obj.hImLive) || ~is...
f78079b448384a0bd246270f4323cd64de11d47bbebaa810a0a4de3e00ac2462
MATLAB
455
19
function names = defaultNames(nHarmonic, nSvd) %DEFAULTNAMES Return stable, package-safe regressor column names. arguments nHarmonic (1,1) double {mustBeInteger, mustBeNonnegative} nSvd (1,1) double {mustBeInteger, mustBeNonnegative} end names = strings(1, nHarmonic + nSvd); for idx = 1:nHarmonic names(i...
a8c2d3c4c7e57c46897c93b83069ff081992e1165cfb9af6d5d8c213366fa624
MATLAB
457
16
%% check_clone_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); tree = clone_tree (dLPTCs{1}, 1, 0.1, '-s -2d'); tprint ('./panels/clone_tree1', ... '-jpg -HR', [10 10]); %% test 2 L5 = load_tree ([ ... './data/Markram - rat - ' ... 'cerebral cortex pyramidal cell L5 - GR...
6482ad4a6f39dedd0ed8684f67e639ab92320ff0a7726484a84bd998c85d9308
MATLAB
459
16
function iIncrementWaitbar(wb) if isempty(wb.UserData) wb.UserData = [0, 100]; % Default values, 0 progress out of 100 total end ud = wb.UserData; ud(1) = ud(1) + 1; % Increment progress % Check if the current progress does not exceed total progress if ud(1) > ud(2) ...
78c6c75c0e282fe83b18b3a86fc1e5d9c5d6bb643b3a91f1811d95cfd9f137fa
MATLAB
459
19
function makeTTLpulse(DAQ) % Flip digital transiently line on and off, generating a TTL pulse % % makeTTLpulse(DAQ) % % Purpose % Generate a rapid TTL pulse from a DAQ. % % Inputs % DAQ - the output of connectAuxDaq % % Rob Campbell - SWC 2023 DAQ.dWriter.WriteSingleS...
f6abef1a88daa03045b94465e792861536b082e9c36bb1c15e5dbbcc2ff0e4b2
MATLAB
459
16
function createNewStimConfig_Callback(obj,~,~) % Load the stim config editor GUI % % zapit.gui.main.controller.createNewStimConfig_Callback % % Purpose % Launches the stimulus config editor GUI and also attaches to it references % for the main GUI and the model (zapit.pointer). % % ...
d525aa76f7927a6891226e4490518cb2f1a5e9053ae9cbdc124017ae2c762761
MATLAB
460
13
function dicomHeaders = MRSI_read_dicom_headers(folderName) arguments folderName (1, :) char {mustBeFolder} end dicomFolder = dir(folderName); % remove . and .. files from dicomFolder dicomFolder = dicomFolder(~ismember({dicomFolder.name}, {'.', '..'})); dicomPath = arrayfun(@(listing) ...
25b9e7831a2c3f59193e085f43365df55f365edbccca786e11f8af593b32aba4
MATLAB
461
23
%% check_xplore_tree tree = sample2_tree; %% test 1 clf; xplore_tree (tree); axis off; tprint ('./panels/xplore_tree1', ... '-jpg -HR', [10 10]); %% test 2 clf; xplore_tree (tree,'-2'); axis off; tprint ('./panels/xplore_tree2', ... '-jpg -HR', [10 1...
fd8c51921a5072051669ba4ec888d5c30eef14229e18609fe388f2c2aafad7d1
MATLAB
461
16
function hSubplotAxArray = createSquarishSubplotGrid(nSubplots, varargin) if nargin > 1 spacing = varargin{1}; else spacing = [0 0]; end % Closest integer to square root of number of needed subplots. nRows = ceil(sqrt(nSubplots)); % Now just add the needed colums, here maybe we end up with an extra ...
916112884091874a662eb76bc1da8dc8af31327976eed7538718450f4903f110
MATLAB
462
27
function Y = FuncWoNGaussian1D(P,X) %% function Y = FuncWoNGaussian1D(P,X) % % 1-D Gausian function WithOut Normalization % % P = [Amp,X0,Base,Sigma] --- parameters % Y = Amp*exp(-(X-X0)^2/2/Sigma^2)+Base; % % % YC at ES lab % Created on Dec. 1, 2008 % Last modified on Dec. 1, 2008 %% Parameters Amp ...
5799d75bdfa5d19726902dce436e39cd7d78cca5f949eaa50d72534ea0da154f
MATLAB
465
11
function curve = makeTuningCurve180(tuning_curve) % send the tuning curve WITHOUT the blank condition % must come in format of: condition x cell assert(size(tuning_curve,1)==8, ['Number of conditions must be 8, not ' ... num2str(size(tuning_curve,1)) '. Remove any catch conditions and ensure '... 'tuning curve...
7ab0d707373323bfed2f7f3183b787a4c20c06d2d97bc00313fb20a53438a3ca
MATLAB
465
14
%% check_pointer_tree %% test 1 clf; hold on; axis off; tree = sample_tree; plot_tree (tree); pointer_tree (tree, 1, [], [], [0 0 10]); pointer_tree (tree, 2, [], [0 1 0], [0 0 10], '-o'); pointer_tree (tree, 30, [], [], [0 0 10], '-l'); pointer_tree (tree, 50, [], [], [0 0 10], '-v'...
a43de3528196e3582a826d7b74119a397a13afa0c18baad512f5b94a2087d0a1
MATLAB
466
10
function loopFlag = containLoop(neuronBW2,loopPeriThresh) % This function checks if the neurons contain loops % Input binary neuron image and return the flag 0 if no loop, 1 if there is % a loop (minimum detectable loop perimeter is specified by loopPeriThresh) loopRegion = imclearborder(~neuronBW2); loopPerimete...
fe691a451508df47065e2f81aaaa9307cb91c9d819011ddf33cd8045c1e8429e
MATLAB
470
18
%% check_M_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 100 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; tree.Ri = 100; tree.Gm = 1 / 2500; tree.Cm = 1; M_tree (tree, 'none'); ...
d31861a1926b6906105d8de50d3996147d23f9bb737dc4f14ae3194d37d8b3b9
MATLAB
472
20
% Load data file = 'data.csv'; T = readtable(file); ED = log10(T.ED); MRR = T.MRR; EncodingScore = T.EncodingScore; % Variance partitioning X = table(ED, MRR, 'VariableNames', {'ED', 'MRR'}); explained = regCommonality_lsqminnorm(EncodingScore, X) file = 'variance_partitions.csv'; writetable(explained, file, 'WriteRo...
38dc999b6aa29532b00832a6543f843592834058301a21bcc4b2421617c1e4d0
MATLAB
475
20
function mkdirquiet(x) % This file was taken from: % http://white.stanford.edu/~knk/doc/kendrick/mkdirquiet.html % % function mkdirquiet(x) % % <x> refers to a directory location % % make the directory, suppressing warnings % (e.g. that the directory already exists). % assert that the result was successful. % % examp...
c3a99dc615116e7d2c2bc16262f275e6da0e0efd0c9527a96233cf63d4302e5a
MATLAB
476
14
function unwrappedCell = LK_unwrapNestedCell(nestedCell) % % LK_unwrapNestedCell unwraps a nested cell array into an unnested cell. % % Lukas Kunz, 2021 unwrappedCell = cell(sum(cellfun(@(x) numel(x), nestedCell)), 1); idx = 1; for i = 1:size(nestedCell, 1) % loop through cells for j = 1:numel(nested...
e480b042848b915388935f448c5cd259645abb986503462656a933795b85e2db
MATLAB
477
18
%% check_elen_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 100 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; tree.Ri = 100; tree.Gm = 1 / 2500; tree.Cm = 1; elen_tree (tree, 'none'...
aa9b51d8425f577fda56925cc0979883bc7e44ef1168d88299958bf23dd7943d
MATLAB
479
31
%% % p = pVals{1}*length(pVals{1}); % [~,p] = bonferroni_holm(pVals{1}); % [~,p] = bonferroni_holm(mean(pGlobal,1)); p = pVals{1}; sts = {'NS','*','**','***'}; cts = [0.05,0.01,0.001]; T = cell(size(p)); for ii = 1:length(p) for jj = length(cts):-1:1 if p(ii)<cts(jj) T...
eae92e7747ad3e16072ee0da72845db1fb1ad99e2a55ed5bda6d9d617a2e348d
MATLAB
480
24
function C = CalculateCrossCorr2D(A,B) %% function C = CalculateCrossCorr2D(A,B) % Calculate 2D cross-correlation of A and B % % A and B must be 2D % C has same size as A % % Note (Aus. 24, 2012): remove mean before calculating cross-correlation % % % YC at ES lab % Created on Sep. 29, 2009 % Last modified on Aus. 24,...
a47d9d1586a61453c2cf36cfb50b16aa0e0e1956c2a6ff2ed3009253deee76f3
MATLAB
481
17
function mycsvwrite(filename,var,header) % writes a CSV file with headers % mycsvwrite(filename,var,header) % header is a comma separeted list of names % for example, if you have a 25x4 matrix M you can do: % mycsvwrite('datafile.csv',M,'id,wage,age,educ') outid = fopen(filename, 'w+'); fprintf(outid, '%s\n', heade...
63ba567eaf400330e1ed5fe83422ee2a7edeae022de6e2d4bf94726c1f6ef5aa
MATLAB
483
18
function updateTestSiteDropdown(obj) % Updates drop-down menu showing stim locations so we can test-zap % % if isempty(obj.model.stimConfig) obj.TestSiteDropDown.Items = {}; return end for ii = 1:obj.model.stimConfig.numConditions stimSite{ii} = sprintf('Site %d', ii); ...
e1773324cb90e0e4fd7a37c136fcbf416aea4b4005b091618b2523c24de0e33b
MATLAB
483
18
function S = trca_S(X) % Task-related component analysis (TRCA) % X : eeg data (Num of channels * num of sample points * number of trials) nChans = size(X,1); nTrials = size(X,3); S = zeros(nChans, nChans); % Computation of correlation matrices for trial_i = 1:1:nTrials for trial_j = 1:1:nTrials %if...
66315e5adf42e1b75aa4aeb4cdd633a0541a09bf32e4aaeba4b783d9ec22c6b9
MATLAB
485
22
function filter_ts = bandpass_final_SPM_ts(TR,fl,fh, ts) % Sampling Frequency Fs = 1/TR; % Set bandpass filter parameters % Center Frequency Fc = 0.5*(fh + fl); % Filter Order No = floor(Fs * 2/Fc); disp('Filtering ........................................................'); % ts is in the dimension of T*N T = size(ts...
bd0f0c7d4c11ec7aabdccdb6d4b8fa1ed0d19fb4068316ef64610eaed32e8101
MATLAB
485
12
%in the "GridPlot.m", the field was actually number of in field bins, here %let's calculate the real fields cd ..\ load('nFieldReal.mat'); cd('gridCellsNewCueThresh'); load('E:\learningAnalysis\summaryManyMice_includingOldEnvBadMoreMice\indicesAllNewCueThresh.mat'); i=indicesAllNewCueThresh.GridIdx; nFieldRealGr...
5ecc99aa81050886514c5cefd0b6ac6d5bb9424418131cc4cb0237c700484e31
MATLAB
486
17
function newDT = tableRemove(DT,params) for jj=1:width(DT) paramName = DT.Properties.VariableNames{jj}; if isfield(params,paramName) %%|| isempty(params.(paramName)) removerows{jj} = (DT.(paramName) == params.(paramName) ); % DT(rows,:)=[]; end ...
705e87115ed23474e4b803e31414ba3c686870bd87ec0fe5ab66137b68925af5
MATLAB
491
15
function figure2(dataFolder) if(nargin<1) error('Path to data required as input argument. Data can be downloaded from link in README file.'); end % Add paths for function execution myPath = mfilename('fullpath'); basePath = fileparts(fileparts(myPath)); addpath(fullfile(basePath,'auxiliary')); addpath(fullfile(ba...
b0d5d6e4b0ef4ea5eb1dd589083d4ae84f0aabfa38e8150b5fe48a13787a3270
MATLAB
491
19
function [p, Rsq, pVal] = simplifiedLinearRegression(A,B) %Ian was annoyed at how many lines of code were neded to say that something %was linearly related so functionalized it. [p s] = polyfit(A,B,1); [f delta] = polyval(p,A,s); Bbar = mean(B); SStot = sum((B - Bbar).^2); SSreg = sum((f - Bbar).^2); SSres = sum((B -...
ee5c4a9c329646b1e99545342c707daac4ac10ab23915add234dd5166a05b5ad
MATLAB
491
13
function [Tscan, infoStruct] = GetTime(infoStruct) % Get trans-movie time vectors Nruns = numel(infoStruct); Tscan = cell(1,Nruns); dTtrans = zeros(1,Nruns); for r = 1:Nruns % infoStruct(r).Nscan = floor([infoStruct(r).nframes]/infoStruct(r).otlevels); dT = infoStruct(r).Nplane/infoStruct(r).framerate; ...
ced52dd6e6a43fdcf1ca43233e54758bfe03f56600db71f3a1aff809833822cf
MATLAB
492
19
%% check_gscale_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); spanning = gscale_tree (dLPTCs{1}, '-s'); display (spanning); tprint ('./panels/gscale_tree1', ... '-jpg -HR', [10 10]); %% test 2 L5 = load_tree ([ ... './data/Markram - rat - ' ... 'cerebral cortex pyrami...
24e652bf1437674b9a3db0dd05c16b813275917f4f06ae3fb515aea28c5c9dae
MATLAB
493
20
function xl = LK_xline(x, myLineStyle, myColor, myStackLevel) % % LK_xline creates a constant line at a specified x value. % % LK_xline is similar to MATLAB's xline, but allows to stack the line to % the bottom. % % Use as: xl = LK_xline(x, myLineStyle, myColor, myStackLevel) % % Lukas Kunz, 2021 % information about c...
5a0c11022382c4eb0982e7661de074fd8271e11a4e3368a10b6631f135c8f2ed
MATLAB
494
22
%% check_len_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; len_tree (tree); end end %% test 2 len_tree (sample_tree, '-s'); tprint ('./panels/len_tree1', ... '-j...
04d8e84ff9e991bbd19bbdc1a6c1df99791993568a8f9a32ff1b9f0ee049ea09
MATLAB
495
19
%% check_BCT_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counter = 1 : length (dLPTCs{1}) BCT_tree (sum (dLPTCs{1}{counter}.dA, 1)); end %% test 2 BCT_tree ([1 2 1 0 2 0 0], '-s'); tprint ('./panels/BCT_tree1', ... '-jpg -HR', [10 10]); %% test 3 hsn ...
d8e8abe69aa605eb2a28900b1c7baf5ec68c7afe8f0e85161f51432f3c738485
MATLAB
497
13
function [fitParams, gof] = getFitParamsStructArrayFromTable(StimTable) nChannels = size(StimTable.responseIndex{1}, 1); % (Dirty?) wa to get nChannels. fitCellArray = StimTable.paramTuning; fitStructArray = [fitCellArray{:}]; fieldNames = fieldnames(fitStructArray(1).fit); gof = FlattenStruct(reshape([fitStructAr...
6e501d4bc2864ce2849ad9f206ca74ff8b2476d382bc0ad3782c5c48a5316aeb
MATLAB
499
14
function dist = get_distance(points, refpoints) % this function calculates the distance of every point to a given set of % reference_points % Alexander Opitz, 2018 % modified by Ivan Alekseichuk, 2018 % % points = list of points, refpoints = reference points dist = zeros(size(points,1),1); for i = 1: size(points,1) ...
f72587368cd74b005212d62dbf2f4637213ebba394a51e8bc19791f417b0ad19
MATLAB
500
22
function [ trialCov ] = estimateRiemannianCovaraince( data ) % Extraction of covariance matrices in barachant format ( To adjust accordingly with that of covariance toolbox) nbChannels = size(data,2); nbTrials = size(data,3); trialCov = zeros(nbChannels,nbChannels,nbTrials); for t=1:nbTrials % tic E = data...
e1729d3eebc08846eea4d043a53137d0af834833cacfec1c4b46949f839a4d70
MATLAB
501
16
function f = LK_PlotVennDiagramTwoSamples_20231012(dt) % % LK_PlotVennDiagramTwoSamples_20231012 plots a Venn diagram with two % samples. % % Input is a structure, dt, with fields A (total areas) and I % (intersection). Orange and blue are used to color the total areas. % % Output is a figure handle. % % Lukas Kunz, 20...
70e61e7c303d324ee2742100a82c803bfe2ec0a6bd8b002490ba7c879c995b08
MATLAB
502
19
function bfunc = basisFuncConcGrad(obj,n) % Outputs basis function for index n of concomitant gradient terms % n = index of phs_conc in sampHighOrder.m x = obj.phs_grid.x; y = obj.phs_grid.y; z = obj.phs_grid.z; switch n case 1 bfunc = z.*z; case 2 bfunc = x.*x ...
22ace78f915342eb42ce47c90d0a7731f7f2ff9a63b129012b220292e4c83c90
MATLAB
508
23
function st_saveBOLD(DT,output_dir) %% % if (~exist('synBOLD', 'dir')); mkdir('synBOLD'); end%if % fname = DT.pm(1).Temporal.Name; % RFs = [DT.pm(1).RF.Centerx0 DT.pm(1).RF.Centery0 DT.pm(1).RF.sigmaMajor]; % RFs = num2str(RFs); % RFs(RFs == ' ') = []; % fname1 = [output_dir '/synBOLD.mat']; fname2 = [output_dir '...
232eeb5dbfea1f52c533f3c1eaa8d4e8a37ed954ac61aad09543f6b52070f388
MATLAB
508
18
function params=getOptimParams(params,doRidge) params.analysis.optim.decimate = 1; %decimate by 1 so, no decimate params.analysis.optim.fprec = 1e-4; if doRidge == 1 params.analysis.optim.ridge = 1; params.analysis.optim.ridgeAlpha = 0; params.analysis.optim.algorithm = 'interior-point'; elseif doRidge =...
db3d88ef24d743fcdff14026bc9db71017dae5f723112d231e1833e75b1918cd
MATLAB
508
22
%% check_eucl_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; eucl_tree (tree); end end %% test 2 eucl_tree (sample_tree, [], '-s') tprint ('./panels/eucl_tree1', ... ...
a76519c871b84b9fc56770042674d38522c9caef0b3c4ec694573318b7aa4790
MATLAB
509
10
% run this script to put anonymous functions for a Gabor tuning curve and % it's first derivative into the workspace % Define function for Gabor tuning curve gabor_tuning_curve = @(x,p) p(1) + p(2)*exp( -(x-p(3)).^2 / (2*p(4)^2) ) .* cos(2*pi*p(5)*(x-p(3))+p(6)); % Define function for derivative of Gabor tuning curve...
abf6cc4d8c004043aed4b00fa67bca5abdb68a21d416813e8e2eb65be4984ebd
MATLAB
509
19
%% check_cpoints %% test 1 c = hull_tree (sample_tree, 4, [], [], [], '-2d'); for counter = 1 : 1000 cpoints (c); end %% test 2 clf; c = hull_tree (sample_tree, 4, [], [], [], '-2d'); HP = cplotter (c, [0.75 0.75 0.75]); set (HP, 'linewidth', 1, 'linestyle', '-'); [X, Y...
b330dd8421908d4b0a7356b6dc6660c630d3a7d1493d0c8f3b636e0ee966929b
MATLAB
511
16
function refAPDropDown_Callback(obj, ~, ~) % Callback that runs when the value of RefAPDropDown is changed % % function zapit.gui.main.controller.refAPDropDown_Callback % % Purpose % This callback alters the value of the RefAPDropDown.refAP setting % when the user chooses from the drop-down....
a62fcb449e083552cec4400c0047135400045c7af9836bb1fb9950f10bdf7a74
MATLAB
513
16
function [ clustering_results ] = k_means_clustering( reduced_data, number_of_clusters, number_of_iterations ) %K_MEANS_CLUSTERING Summary of this function goes here % Detailed explanation goes here clustering_results = zeros(size(reduced_data, 1), number_of_iterations); % Set the random generator to get st...
26d2c269c8a344e51200741a38b444fe9dedd575d0e67fc394a289c433ffec87
MATLAB
515
1
% An analog output waveform .mat file must contain two variables: % rate - int. samples per second, must match handles.s.Rate % waveform - (N x 4) vector of voltage values function sample_generate_ao_waveform() num_channels = 4; % number of AO channels in fipgui.m rate = 10*10; % samples per second in fipgu...
db596fe54e2fd39a71f9c5e58f4812b0a9dca04fb44b19c7f578d8496ff16d51
MATLAB
515
19
function [closest, cval, err] = taft_findc(mat, val) % [closest, cval, err] = taft_findc(mat,val) % % returns the index (closest), value (cval) and error (err) of the value closest to val % in mat % if val is an array or matrix, returns values for all elements of val % % Laurence Hunt closest = nan(size(val)); cval ...
96a6e2e070db3bdee3e469ed9ba7b25c774c6b3cea284f6255a736b8eba785bc
MATLAB
516
27
function stage_normalization() loadParameters; [ret,messages] = check_files_in_normalization(); if ret fprintf('already processed normalization\n'); fprintf('[DONE]\n'); return end if params.USE_GPU_CUDA normalization_cuda(); else normalization(); e...
11b51e09182ecc5007a24383e7a046206064b69a38f0abffd0a7ba13000cbb45
MATLAB
519
22
%% check_resample_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; resample_tree (tree, 5, 'none'); end %% test 2 resample_tree (sample2_tree, 5, '-s -e -w'); tprint ('./panels/resample_tree1', ... '-j...
1a3f6b715d27c3118eeed1e8bdd7986c28c2521d387df90ffc9b5b84cdcd458d
MATLAB
520
18
function displayID = closeScreen(displayID) % % Usage: displayID = closeScreen(displayID) % % closeScreen closes an opened PTB window which had been opened by % running openScreen. % % History: % ##/##/## rfd & sod wrote it. % 04/12/06 shc (shcheung@stanford.edu) cleaned it and added the help % comments. if(isfield...
7eed7c6f1c34835c29f10db09253cf8603fb96977b904a47e4503cc18afbab8c
MATLAB
520
16
function cmap = makeColormap(colors, n) % LR 2017. Based on lbmap.m % % Inputs: % colors = x-by-3 array of colors (0 to 1 range) % n = number of elements final LUT will have % % Usage: % cmap = makeColormap([0 0 1; 1 1 1; 1 0 0], 255); % for a Blue-White-Red cmap with 255 elements % colormap(cmap) % set the colormap ...
0aed40e3faffe9d4fb87719d4c25eb0722f81fd6c24ee195760c3528f292f33e
MATLAB
521
22
% unpack table cells to arrays % KIS 2021 %% function newT = tableArrayFormat(df) targetVariables = df.Properties.VariableNames; targetVariables = setdiff(targetVariables, {'sRF', 'tRF'}); for vn = df.Properties.VariableNames paramName=vn; if max(ismember(targetVariables,paramName)) if iscell(df.(p...
ea6454b66665236a846de57b94bc06ba6358d649e9f7013cacae680d7625b43d
MATLAB
521
23
function Kbag=generateKcluster(Xl) [n d] = size(Xl); iterations = 10; maxclusters = 4; options = statset('Display','off'); scale=0; KK = zeros(n,n); for k = 2:maxclusters for it=1:iterations scale = scale+1; try obj = gmdistribution.fit(Xl,k,'Options',options); Pgmm = post...
283dcc87540625340c682e41d88daf3ea8c3a66f2df4ff9522f2f6d84a0374cf
MATLAB
522
31
function [Index,Value] = FindIndexInArray(A,Flag) %% Find the index in an array A % Flag is 1(max), 2(min), ... % % % YC at ES lab % Created on Sep.09, 2008 % Last modified on Aug. 24, 2012 %% Parameters SizeA = size(A); nSizeA = length(SizeA); %% Find index switch Flag case 1 % max [t,ti] = ...
46ee5f93719867fbcb75940e1139358a19228560a678d479175b1eb29dd4f9a1
MATLAB
522
21
%% check_recon_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; recon_tree (tree, 10, 20, 'none'); end end %% test 2 recon_tree (sample_tree, 105, 160, '-s'); tprint ('./panels...
a01035c320269ab9f30602c2bf05a1764de678f828247dccc2ceade4a0c84149
MATLAB
522
20
function [harmfields,mask1,phas,uphas,fl] = calcHarmFields(angleData,mask0,TE,B0,GYRO,vsz) % Convert from Int16 to phase phas = double(angleData) ./ 2048 * pi - pi; % Do the laplacian unwrapping and rescale to units of field uphas = unwrapLaplacian(phas,mask0,vsz); for i = 1:size(uphas,4) uphas(:,:,:,i) = uphas(...
a2a10590a18ed893ce86bd0b1dbec933693ff50f07bfa7aa458a49a7a235bd71
MATLAB
522
18
function ind = balanceClasses(labels,labelList) freqPerLabel = zeros(length(labelList),1); for k=1:length(labelList) freqPerLabel(k) = sum(labels==labelList(k)); end minFreq = min(freqPerLabel); use=false(length(labels),1); for k=1:length(labelList) %curInd = find(labels==labelList(k),minFreq,'first')...
8f0163d569614e0b3092a5a37b57497e1441edb6edd585ba4b997d15d21ea9c1
MATLAB
523
16
function figure9(dataFolder) if(nargin<1) error('Path to data required as input argument. Data can be downloaded from link in README file.'); end % Add paths for function execution myPath = mfilename('fullpath'); basePath = fileparts(fileparts(myPath)); addpath(fullfile(basePath,'auxiliary')); addpath(fullfile(ba...
d806cef31e312ae87d146a55e2a7e38114d0c5d947d7b7485c752e75fa1aac31
MATLAB
523
22
function yl = LK_yline(y, myLineStyle, myColor, myStackLevel) % % LK_yline creates a constant line at a specified y value. % % LK_yline is similar to MATLAB's yline, but allows to stack the line to % the bottom. % % Use as: yl = LK_yline(y, myLineStyle, myColor, myStackLevel) % % See also: yline, LK_xline % % Lukas Kun...
4750865a1e73d408b6a8c30739d50ff781530863087b838ce5de802fbd900e75
MATLAB
524
22
function live2pSendSetup(src, evt, varargin) global ws hSI = src.hSI; out.EVENTTYPE = 'SETUP'; out.nchannels = length(hSI.hChannels.channelSave); out.nplanes = numel(hSI.hStackManager.zs); out.fr = hSI.hRoiManager.scanVolumeRate; out.folder = hSI.hScan2D.logFilePath; % need to grab these from workspace somehow % out....
d3042fd444bee1c8d3eb3c60cce42601772bbc93de42c31e433ca6f373f94cef
MATLAB
525
20
%% check_xdend_tree %% test 1 tree = sample2_tree; clf; hold on; axis off; dendrogram_tree (tree, 0.1); x = xdend_tree (tree); Plen = Pvec_tree (tree); for counter = 1 : length (x) ht = text (x (counter), Plen (counter), num2str (counter)); set (...
57f93109097dc303f225d2bc4d39ce01c71e10815d1d7c9976e0bc6f9d7e669a
MATLAB
526
21
function [breathing_reg,all5_reg] = proc_reg(regfilename) regmat = load(regfilename); reg = regmat.reg; [v,idcs] = max(corr(reg(:,1:16),reg(:,17:end)),'all'); [v2, idc_reg] = max(v); breathing_reg = squeeze(reg(:,16 + idc_reg)); all5_reg = reg(:,17:end); filenamebase = strsplit(regfilena...
c2bbb41e6b79f33419070e3ce57e9f4602302a048559245c28b1cef779af70b3
MATLAB
527
27
function stage_puncta_extraction() loadParameters; [ret,messages] = check_files_in_puncta_extraction(); if ret fprintf('already processed puncta extraction\n'); fprintf('[DONE]\n'); return end punctafeinder; clearvars %Produce a punctavoxels.mat file puncta_ro...
42f5bf8551cf81555f95a7b01604b3e68ce02b7a2753400b09522b0ca0a57a52
MATLAB
530
27
%% check_ipar_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 100 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; ipar_tree (tree); end end %% test 2 tree = sample_tree; ipar_tree (tree, '-s'); tprint ('./pane...
da1f34be5c31507dd4ecb3464a0b3d22c8af5fea637762dd5831d5080263e79c
MATLAB
530
22
%% check_ratio_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; ratio_tree (tree); end end %% test 2 ratio_tree (sample_tree, [], '-s'); tprint ('./panels/ratio_tree1',...
e9c1263105e5d3e35da74b6ed34e5adc3d19ec8e49ec2722a719c1c471bd2434
MATLAB
531
20
function [norm_values] = normd(in_vector, varargin) % calculates the square p-norm along norm_dimension % With default values for it is like sqrt(sum(in_vector.^2,2)). % Mirko Windhoff, 2009 % $Id: normd.m 432 2010-08-05 11:06:14Z mwindhoff $ % USAGE: [norm_values]=normd(in_vector[, p=2, norm_dimension=2]) ...
70347401908743695f765a566a0684bbbc0ee2f0c581175eddd85145a8195e53
MATLAB
532
13
function [output_mat] = lorenzabalone(inp_mtx,rho,tmax) % Solve over time interval [0,100] with initial conditions [input_x,1,-input_x] % ''f'' is set of differential equations % ''a'' is array containing x, y, and z variables % ''t'' is time variable sigma = 10; beta = 8/3; parfor i = ...
cb5e8e27a9bde02130ef8396c7b92f14b2b451542b1e479022461734ecd374c2
MATLAB
532
17
load('Fig2andSupplement_ripple_stats_SWR_TFR') figure, shadedErrorBar(linspace(-1,1 ,4001),mean(group_level_stat_input.all_trace,'omitnan'), ... std(group_level_stat_input.all_trace,[],'omitnan')./sqrt(sum(~isnan(group_level_stat_input.all_trace),1)) ) xlim([-0.5 0.5]), ylim([-30 40]),set(gca,'LineWidth',2)...
9b99573041eca270f5d933ccbe2b0bdaf892d657df824c10f4d0998470e16050
MATLAB
533
20
function direction = dir_tree(tree,options) % -n unit direction vector if nargin < 2 options = ''; end idpar = idpar_tree(tree); direction = zeros(numel(tree.X),3); for n = 1:numel(tree.X) direction(n,1) = tree.X(n) - tree.X(idpar(n)); % node to parent node differences direction(n,2) = tree...
2d8b36f56a9d5379f1bf90a1a6484ee69ebc233c58118da89c0b7d4ba006897c
MATLAB
538
12
function DataTable = createRFsTable(rfArray, stimParamString) degPerBar = 2; relativePosition = degPerBar * (1 : size(rfArray, 2)); dataCell = mat2cell([relativePosition; rfArray], ones(1, size(rfArray, 1) + 1), ones(1, size(rfArray, 2))); labelColumn = [stimParamString; sprintfc('ROI%d', (1: size(...
827531f2e7bebe189fcd3b776b2de2203c775a01e4c0a6366e807da2d1369250
MATLAB
538
21
function gURL = returnProjectGitHubURL % Return the URL of the project on GitHub % % gURL = zapit.updater.returnProjectGitHubURL() % % Purpose % Return the project's GitHub URL as a string without leading "https://" or "www" % % Inputs % none % % Outputs % gURL - String c...
91ae01ce43e17f757ad03ff8517bb2910c692d55dd5a3907da6db469388c0b8b
MATLAB
538
13
function [ filtered_neuron_firing ] = filter_neuron_firing( neuron_firing ) %FILTER_NEURON_FIRING Post processing of the neuronal firing data % Binarize the data of the number of spiking per time frame (any number of % spikes is equal to binary True) filtered_neuron_firing = 1.0 * (~~neuron_firing); % ...
12c882a160502d13962093f62c8d35b740c9dfd17e91c2da05b9f79666c4345b
MATLAB
539
20
%% check_root_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; root_tree (tree, 'none'); end end %% test 2 root_tree (sample_tree, '-s'); tprint ...
bc1c921aeca0a06458d0558a03f0be93a47a5d3a48ea6e564cee68016a66d33f
MATLAB
539
16
function figureS7(dataFolder) if(nargin<1) error('Path to data required as input argument. Data can be downloaded from link in README file.'); end % Add paths for function execution myPath = mfilename('fullpath'); basePath = fileparts(fileparts(myPath)); addpath(fullfile(basePath,'auxiliary')); addpath(fullfile(b...
f2412a518d4762e8f065cd32210e53ee423c4d9057b3c2391bae8883d409af92
MATLAB
539
21
%% check_typeN_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 10 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; typeN_tree (tree); typeN_tree (tree, '-bct'); end end %% test 2 typeN_tree (sample_tree, '-s -bct'); tprin...
a4f94cb2f6a2208d559d7ef787276d426e2dfa4e9fcb5dab4e736ff9f8e8298b
MATLAB
540
19
function [W_NBS, Clist_NBS, CID] = NBS(Wp, threshhold_NBS) % a simple implementation of the network-based statistics % Chuan Wp_NBS = Wp; Wp_NBS(Wp_NBS<threshhold_NBS) = 0; % Wp_NBS(Wp_NBS>=threshhold_NBS) = 1; % find Connected graph components [Cindx,comp_sizes] = conncomp(graph(Wp_NBS)); [CID, C_size] = s...
0b8c88ba487d15e8ebff3fec5ef14e78f0ff956d1c93f2c904809dc5b1645336
MATLAB
541
16
function figureS8(dataFolder) if(nargin<1) error('Path to data required as input argument. Data can be downloaded from link in README file.'); end % Add paths for function execution myPath = mfilename('fullpath'); basePath = fileparts(fileparts(myPath)); addpath(fullfile(basePath,'auxiliary')); addpath(fullfile(b...
7862a1e778b4e3389af5cfb3536fb13fdfabf1bbebc35ddda5e7524df69a2db3
MATLAB
541
9
function [StimSubsetTable, stimRowIndCell] = getStimSubsetTable(PathStimTable, stimSetCellStr, stimInd) %% This function gets a pathStimTable and a cell of stimuli name strings and a % index to the cell of stimuli to retrieve the matching table entries of the % given stimulus. This also works for extracting cycles ...
7f9b443b2aeaa0880a0d0f9e2a79428c9b5573fe6e54d85ad3d0dfb748ff962f
MATLAB
543
16
function figure2(dataFolder) if(nargin<1) error('Path to data required as input argument. Data can be downloaded from link in README file.'); end % Add paths for function execution myPath = mfilename('fullpath'); basePath = fileparts(fileparts(myPath)); addpath(fullfile(basePath,'auxiliary')); addpath(fullfile(ba...
703163778a9ffd76b8b7b6649192f6b66d20a228259ffa64a87d6b6c6b940192
MATLAB
548
14
%% Set the path for the external toolbox folder and add it to MATLAB search directory %% Determine location pathappend = '/rds/project/tb419/rds-tb419-bekinschtein/Sri/'; %'/work/imagingQ/' %% Add paths now.. %TDT toolbox path tdt_toolbox = [pathappend 'SpatialAttention_Drowsiness/Scripts/toolboxes/TDTMatlabSDK']; ad...
d20385ed41a7bfcec047a3373b46ebffeae5f27fbf3507a79f6a1e2b4d44cd30
MATLAB
548
13
% Example callback function for analog input logging. % This funcion is called once the number of acquired time points exceeds % src.NotifyWhenDataAvailableExceeds. % The latest analog input data will be written to the log .csv file. % Use plotLogFile() to view the logged data. function logAIData(src, event, filename...
3e5579ed615dea260a843016c1289d0da944af2c16372e775cf6f229934a3d77
MATLAB
549
22
function [All, outVars] = calcOSI(All, outVars) % settings numExps = numel(All); assert(isfield(All(1).out.anal, 'oriCurve'), ... "No ori curve, can't calculate OSI.") for ind = 1:numExps curve = All(ind).out.anal.oriCurve; [~, po] = max(curve, [], 1); curve(:, po==1) = nan; curve(1,:) = []; ...
98c57636877bf3c19e81cfb681f5f59a8b7120d9790a0f89c782e2542a5c1d2b
MATLAB
553
13
function MRSIStruct = op_CSICombineTime(MRSIStruct, dimensionLabel) newTimeLength = prod(getSizeFromDimensions(MRSIStruct, {'t', dimensionLabel})); [MRSIStruct, prevPermute, prevSize]= reshapeDimensions(MRSIStruct, {'t', dimensionLabel}); data = getData(MRSIStruct); data = reshape(data, newTimeLeng...
12bba9042496a062370ee99386f3417e8d95fb7d3fcfba6674da8e09600ebd60
MATLAB
554
21
function LK_ReportMeanAndSEM_20220322(msg, data) % % LK_ReportMeanAndSEM_20220322 reports the mean and standard error of the % mean of an input vector. % % Use as: % LK_ReportMeanAndSEM_20220322(msg, data); % % Input: % msg --> message; % data --> data as n x 1 vector. % % Lukas Kunz, 2022 % compute mean an...
abef68f1af7bb37f5ffe9c3fb453fb6b66a2fe1c9bc4e68e25667f8dc896ef52
MATLAB
555
24
function DT= tableSumHRF(hrfTable) DT=[]; rois = unique(hrfTable.name); for s = unique(hrfTable.subj)' for r = 1:length(rois) params.subj=s; params.name=rois(r); newDT = tableFilter(hrfTable,params); tmpDT = []; tmpDT.subj = params.subj; tmpDT.name = params....
7d9dbccb2d7bc373a6e4b6e387aa20d4af035cc284b6525788a7363f825ae7d9
MATLAB
557
18
function [A,lambda] = convert_parameters(P,fitType) % Converts parameters used for fitting into parameters reported in paper if(strcmp(fitType,'eq5')) A = 10.^P(3); lambda = 10.^P(3)*exp(P(2)); fprintf('A = %f\n',A); fprintf('l = %f\n',lambda); fprintf('tau1 = %f\n',P(1)); elseif(strcmp(fitType,'eq6...
5ca6554bf2a7b3bc34f053e41d2e5ced718ac7e167311bba4a955531a56d563b
MATLAB
559
22
% Plot a given .csv log file. % Returns the timestamps and data. function [time, data_AI] = plotLogFile(filename, prompt_user) if nargin ~= 1 if nargin > 1 && prompt_user [name, path] = uigetfile([filename '/*.csv']); else [name, path] = uigetfile('*.csv'); end if length(path) == 1 ...