sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b9a9f724ed7733c50170a1b5842505c0ca7ec8ceb33e019070eb735737a421ca
MATLAB
309
8
function setFontForThesis(hAx, hFig) fontToUse = 'Helvetica'; set(hAx,'FontSize', 8) set(findall(hFig,'type','text'),'FontSize',8) arrayfun(@(x) set(get(x, 'Title'), 'FontSize', 10, 'FontWeight', 'normal'), hAx); set(hAx,'FontName', fontToUse) set(findall(hFig,'type','text'),'FontName', fontToUse) end
079fb0d1e41d937e63a51c469fc5204f4bcf141848c1e58164c8951211ed2238
MATLAB
312
11
% SAMPLE TREES % % Files % hsn_tree - load a sample HSN cell % hss_tree - load a sample HSS cell % sample2_tree - load a simple sample tree % sample_tree - load a subtree of a sample HSN cell % % the TREES toolbox: edit, visualize and analyze neuronal trees % Copyright (C) 2009 Hermann Cuntz
be798806036043b37a4a58ccdc0c46fadd237f9922bf34dcd8cfe4a71d3f5d2e
MATLAB
317
11
function live2pVisSocket global websocket % THIS IS WEBSOCKET TO LIVE2P visCond = numel(find(diff(ExpStruct.nextsequenceTrigger)>0)); sendThisCaiman.EVENTTYPE = 'LOG'; sendThisCaiman.vis_id = visCond; websocket.send(jsonencode(sendThisCaiman)); disp('trial data sent to caiman')
ce5302efcec466034974a60568b9cdd1404e4db47e67c96bf57a944b4efef326
MATLAB
317
10
function confMat = calcConfusionMatrix(predictLabels,GTLabels,labelsVec) nExamples = length(predictLabels); confMat = zeros(length(labelsVec)); for i=1:length(labelsVec) for j=1:length(labelsVec) confMat(i,j) = sum((predictLabels==labelsVec(i)) .* (GTLabels==labelsVec(j))); end end
db1006d00943606a7212df76dd4e4d7f2f827f839f298bc238d7ee9138f4c394
MATLAB
317
7
function dimensionMap = getMapOfDimensions(MRSIStruct) values = cell2mat(struct2cell(MRSIStruct.dims)); dimsFieldNames = fieldnames(MRSIStruct.dims); zeroIndexs = values == 0; nonZeroFieldName = dimsFieldNames(~zeroIndexs); dimensionMap = containers.Map(values(~zeroIndexs), nonZeroFieldName); end
53de5ed6fbcba1b3110abe2d154716ac39632bba0894c4bc8968560e993e519d
MATLAB
318
13
clear load('../data/2020_07_connectomes90_AllFC.mat') lowVol = sum(volBOLDAll<5); volBOLD = sum(volBOLDAll); volBOLD(810) = []; lowVol(810) = []; writecell(sub','../data/full_subs.csv') writecell(ses','../data/full_ses.csv') writematrix(lowVol','../data/lowVol_subs.csv') writematrix(volBOLD','../data/volBOLD.csv')
c7ca03a93fbe3de9b33fb8151573b266c6b25978179b3fc5c5a79d7f9d3bd670
MATLAB
319
10
%% readme % Related to Viswanathan, Stein, Nieder, PLOS Biol, 2024 % PV 2024 % All code written and implemented in MATLAB R2021a % folder contains one data file (.mat) per figure and matching code (.m) % to load and produce all the figure panels % dependencies: % venn.m needs to be on the matlab path for Figure S2
adea9cf547ce24fc9cae1dd7cf09fb027b08142418664b2fe40dee75350a497b
MATLAB
322
14
function segParams = GetSegParams(sbxInfo) paramsPath = sprintf('%s%s_seg_params.mat', sbxInfo.dir, sbxInfo.exptName ); if exist(paramsPath, 'file') fprintf('\nLoading %s', paramsPath); load(paramsPath, 'IP'); segParams = IP.Results; else error('%s does not exist', paramsPath); end end ...
e3c224f922c32779092e351819acce68689a5b838fa0382a3d5532b991ca07d0
MATLAB
323
13
function newDT = tableFilter(DT,params) for jj=1:width(DT) paramName = DT.Properties.VariableNames{jj}; if isfield(params,paramName) %%|| isempty(params.(paramName)) rows = (DT.(paramName) == params.(paramName) ); DT = DT(rows,:); end newDT = DT; end ...
f263544375bc784b634194cbf99abec43a9a2bc0574d578a48727b12c922b41c
MATLAB
323
10
function dropError = LK_CalculateDropError(x1, x2, y1, y2) % % LK_CalculateDropError calculates the drop error given the response % locations (x1, y1) and the correct locations (x2, y2). % % Use as: dropError = LK_CalculateDropError(x1, x2, y1, y2); % % Lukas Kunz, 2022 dropError = sqrt((x1 - x2) .^ 2 + (y1 - y2) .^ ...
90d5ffe4b94b9edb569321b1dd883ce734eaf94dd011d1c0be73ec187b1d0ef5
MATLAB
325
16
function response = getKeyLabel(response) % % response = getKeyLabel(response) % if(~isempty(response.keyCode)) keyLabel = KbName(response.keyCode); if(iscell(keyLabel)) response.keyLabel = keyLabel{1}(1); else response.keyLabel = keyLabel(1); end else response.keyLabel = ''; end re...
671acc7a6838b23a2815cfc856330356c15be792dfa34eedd9628a484901c7f6
MATLAB
330
17
function colIndex = drawTrig(d, colIndex) % % drawTrig(display, [colIndex=1]) % % Draws a square trigger to sync eCog recording with stimulus % if nargin < 2, colIndex = 1; end; x = d.numPixels(1); y = d.numPixels(2); trigRect = round([.93*x .91*y x y]); Screen('FillRect', d.windowPtr, 120 * colIndex, trigRect); ...
6c283254fd142dc2a9e9c7896d3d477fc0f927c11266cb72be020ec81ed9a1e8
MATLAB
333
20
function sff = sffTrajectorize(sff) %SFFTRAJECTORIZE % % RS, 05/2022 disp([datestr(now,31) ' -- Trajectorizing started...']) % streaks sff = sff_xyzt2strk(sff); sff.prm.flag.stk = 1; % trajectories sff = sff_strk2traj(sff); sff.prm.flag.trj = 1; disp([datestr(now,31) ' -- Processing completed.'])...
3fffb0e30a1615852ff194d6c8f4b0c08c7ee51c314373dafcfda7c73652722f
MATLAB
334
11
function L = drawline_3Dplot(x0,thet,R,H) VW = get(gca,'view'); [a1,a2,a3] = sph2cart((VW(1)-90)*pi/180,VW(2)/180*pi,1); e0 = [a1,a2,a3]; e2 = camup; e1 = cross(e0,-e2); L = [zeros(1,3);R*(e1*cos(thet)+e2*sin(thet))]'+x0(:); if(nargin==4) L = L + e0'*H; end L = line(L(1,:),L(...
c59119e71132e59c1ebf4c90fd67dd61676577c32a3bc336b8ae1af900ab503c
MATLAB
334
13
function DataMatrix = DivideByStd(DataMatrix) %each row is a single variable nVars = size(DataMatrix,1); for k=1:nVars curVals = DataMatrix(k,:); curStd = std(curVals(~isnan(curVals))); if (curStd>0) DataMatrix(k,:) = DataMatrix(k,:)/curStd; else error('something went wrong');...
cce7ffed71aaeb37771ddae56178372d2d5c19446a088ff7f9d074864705fe66
MATLAB
334
13
function out = LK_IndicateThousands(in) % % LK_IndicateThousands adds thousands separators to a 1x1 array. % % Example: out = LK_IndicateThousands(1234567) % % Lukas Kunz, 2023. % add commas to indicate thousands import java.text.* v = DecimalFormat; out = char(v.format(in)); out = strrep(out, '.', ','); % convert do...
49a2bf52bd32f94674994b0d62d1485dfcd35e1ba1f92fa8d33372ade5238a5e
MATLAB
336
11
function dimNumber = getMultipleDimensions(MRSIStruct, dimLabelCell) arguments MRSIStruct (1,1) struct dimLabelCell (1,:) cell end dimNumber = zeros(1, length(dimLabelCell)); for iLabel = 1:length(dimLabelCell) dimNumber(iLabel) = getDimension(MRSIStruct, dimLabelCell{iLabel...
e412608d11fe5db5e60b320ba876f92554292cac494ae30a5090745296ceefb7
MATLAB
336
9
function y = Gaussian1_1D(A, xdata) % Gaussian function % A: parameters of the Gaussian function % A(1) = a1, A(2) = mu1, A(3) = sigma1, A(4) = b % y = a1 * exp( -((x - mu1) ^ 2) / (2 * sigma1 ^ 2 ) ) + b % xdata: a vector which contains x values y = A(1) * exp( -((xdata - A(2)) .^ 2) / (2 * A(3) ...
f1e7ca3a8d9cf8f8a461040728fa68e7a9ce0b45d67d87a45d575487e55a7acd
MATLAB
336
17
function F = root_nu( nu ) % MF equations for solving population firing rates % % Input: 2 unknowns % nu(1) - E population rate % nu(2) - I population rate % % Output: l.h.s. of 2 equations % F(1) - MF eq 1 % F(2) - MF eq 2 global sp sp.nu = abs(nu); nuMF = mfa(sp); F = n...
7db4a5a5aa64ea8e024fdb2f6d7f6df37a21f84325c1a5938e8f62d35c977fc6
MATLAB
337
11
function [] = LK_print(f, filename, formattype, resolution) % % LK_print prints a figure and is the analog to Matlab's print function. It % sets the PaperPositionMode to auto. % % Use as: LK_print(f, filename, formattype, resolution); % % Lukas Kunz, 2021 set(f, 'PaperPositionMode', 'auto'); print(f, filename, formatt...
b4cce4a0d64e5d8e5e26757607485e69373adfa90417cb8b21b905d506cb2188
MATLAB
339
14
function hrfaxes() xticklabels([xticks./10]); xlabel('Time (s)'); ylabel('amplitude (a.u)') tch_set_axes; xlim([0 200]); ylim([-0.5 1.2]) xticks([0 50 100 150 200]) xticklabels([xticks./10]); yticks([-0.5 0 0.5 1 ]) a...
0c1a4cd727b6ae477981c9175824cdac775c0c6784d45723d2addf158e972c15
MATLAB
344
9
expression_tumor_fileName = 'JDS_lung_expression_2_75_var_only_names.csv'; [tumor,~,name_tumor]=importdata(expression_tumor_fileName); tumor_data=tumor.data; for i=1:size(tumor_data,2) C = csnet(tumor_data, i); cand=full(C{1,i}); writematrix(cand, sprintf('H:\\1_PHD\\CSN-master\\CSN_lung_2_75_samp...
36d53df9ad8e850d710399e542309eb64223293888956b8f5836da2b9a0b1aff
MATLAB
348
15
%% check_T_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; T_tree (tree); end end %% test 2 T_tree (sample_tree, '-s') tprint ('./panels/T_tree1', ... '-jpg -H...
4e6855dc1d6ca44a37385f7bb50d99d35d80f6596ddd91c8a1a23dc6e97a2b01
MATLAB
348
15
%% check_C_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; C_tree (tree); end end %% test 2 C_tree (sample_tree, '-s') tprint ('./panels/C_tree1', ... '-jpg -H...
63b66fc147d0af6523785a9d978820cdd90ca4ff907f94697b8e07904ae9185b
MATLAB
348
28
% check construct folder check_allBCTS_tree;% check_BCT_tree;% check_clean_tree; % check_clone_tree; check_cplotter; check_cpoints; check_gscale_tree; check_in_c; check_jitter_tree; check_MST_tree; check_quaddiameter_tree; check_quadfit_tree; check_rpoints_tree; check_smoothbranch; check_smooth_tree; check_soma_tree; ...
cf1faaf87bf001ca39d50842f63d02d62d825c5f9d78a5964e2c4c8c4f8274d1
MATLAB
348
15
%% check_B_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; B_tree (tree); end end %% test 2 B_tree (sample_tree, '-s') tprint ('./panels/B_tree1', ... '-jpg -H...
7e1b6c791eda7daf759b6c18cfc1b4d1c6c0b91c743f371228aa32809f0272da
MATLAB
352
15
function dens = get_IntraInterHemDensity_fromAgreement(CC, hem) dens = zeros(2); for i=[1 2] idx = logical(hem==i); for j=[1 2] jdx = logical(hem==j); tmp_cc = CC(idx,jdx); if i==j tmp_cc = tmp_cc-eye(size(tmp_cc,1)); end dens(i,j) = mean(tmp_cc(...
0c3377027ecc1ba71ae373acbe9a1bed09cb3304d40ce18d3ed647d52d2920cf
MATLAB
354
17
function d = LK_dir(myPath) % % LK_dir functions as MATLAB's "dir" but removes '.' and '..' directories % from the output. % % Use as: d = LK_dir(myPath); % % See also dir % % Lukas Kunz, 2021 % directory information d = dir(myPath); % remove '.' and '..' paths bRemove = strcmp({d.name}, '.') | strcmp({d.name},...
858ccd2103b3da05fb372d2034e45236b3ebc09061593192c28b1a442d207a27
MATLAB
354
25
%% clear all; close all; clc base = 'D:\Mice'; cd(base) folds = findSubF('pcaica',3,[],0); %% for ff = 1:length(folds) cd(folds{ff}) try copyfile([base '\dfofM_LocationConsistency.m'],'dfofM_LocationConsistency.m'); dfofM_LocationConsistency catch err disp(e...
e5ca8b7bb5598662bb8a4cebb59e255ed61b7c7e3f60621094db4d1dd0353f31
MATLAB
354
12
function plotNNSearch(x,numfeatures,NETS,t) figure; imagesc(x'); ystr = {}; for i = 1:size(NETS,2) ystr{i} = num2str(NETS{1,i}); end set(gca,'XTick',1:size(x,1)); set(gca,'XTickLabels',numfeatures); set(gca,'YTick',1:size(x,2)); set(gca,'YTickLabels',ystr); title(t); ylabel('networ...
9b6b177d465da6dd65319b3998d01a6987a6ff35d982ff8ad2c03a8fbc945634
MATLAB
355
18
%% check_LO_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 100 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; LO_tree (tree); end end %% test 2 LO_tree (sample_tree, '-s'); tprint ('./panels/LO_tree1', ... '-jpg...
f85bd2b78d18e2a270e1edf481de8d37dfb02bc0159a868dfef9ee44366ad4b1
MATLAB
355
18
%% check_PL_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 100 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; PL_tree (tree); end end %% test 2 PL_tree (sample_tree, '-s'); tprint ('./panels/PL_tree1', ... '-jpg...
15f04b116055fd3bde79eacc080acef9651ad938b40eaea4173835bb634bfa16
MATLAB
356
25
%% check_graphtheory check_asym_tree check_B_tree check_bin_tree check_BO_tree check_C_tree check_child_tree check_dissect_tree check_dist_tree check_gene_tree check_idpar_tree check_ipar_tree check_LO_tree check_PL_tree check_Pvec_tree check_ratio_tree check_redirect_tree check_rindex_tree check_sort_tree check_sub_t...
31b47695a9dc78ba378fec0db0fc44d4a0a697c647e3502004bac82887d1b772
MATLAB
358
9
function coordinates = createCoordinates(bounds, step) bounds = abs(bounds); coordinates = -bounds + step/2:step: bounds - step/2; %due to numerical instability of floating point numbers, somtimes series %is missing the last point. if(abs(coordinates(end) - (bounds - step/2)) > 1e-10) coor...
67102aecce9a1545c226d3fd4672081b9b7fc4d9628dc7ee0beb91018e445506
MATLAB
358
19
%% check_vol_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; vol_tree (tree); end end %% test 2 vol_tree (sample_tree, '-s'); tprint ('./panels/vol_tree1', ... '-j...
23faa87af680d212e4609624ba4d9111d36847369dc456a1590f0fb3c58fbe72
MATLAB
360
11
%% Processed Images (ProcessedImg Classes) % % * <./pi_CellScan.html |CellScan| quick start guide> % * <./pi_LineScanDiam.html |LineScanDiam| quick start guide> % * <./pi_LineScanVel.html |LineScanVel| quick start guide> % * <./pi_FrameScan.html |FrameScan| quick start guide> % * <./pi_XSectScan.html |XSectScan| quick ...
821809185f30bc9bea3c2507d7a5a21401a1723a78590205fffbb017b2f6c21f
MATLAB
360
18
%% check_surf_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; surf_tree (tree); end end %% test 2 surf_tree (sample_tree, '-s'); tprint ('./panels/surf_tree1', ... ...
200c25384cc261be3a44c17e728f409c8a59643ef48c29dabc589fb551cbb7c1
MATLAB
361
11
% An adaptive thresholding by means % ws is the local window size. % C is substraction to manupullation function bw = adaptive_threshold(IM,ws,C) IM = mat2gray(IM);% convert all to 0 and 1 mean_IM = imfilter(IM,fspecial('average',ws),'replicate'); substract = IM-mean_IM-C; bw=im2bw(substract,0); figure(1); imsh...
f4702039168df5aa4d07b9c16e62beeba0d57522070dc00be27948610dcde4e7
MATLAB
361
17
%% check_cvol_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; cvol_tree (tree); end end %% test 2 cvol_tree (sample_tree, '-s'); tprint ('./panels/cvol_tree1', ... ...
05b5f312c0c06698c93b58eb1d6385772d26a742bd986ccaac81f833c30d8b19
MATLAB
362
15
function oldGamma = setGamma(sn, gt) % % setGamma([screenNumber], [gt]) % AssertOpenGL; if(~exist('gt','var') | isempty(gt) | size(gt,1)~=256 | size(gt,2)~=3) % Set a linear gamma gt = repmat(linspace(0,1,256)',1,3); end if(~exist('sn','var') | isempty(sn)) sn = max(Screen('Screens')); end oldGamma = Scree...
31c42516181e116c9afb296ecdd3ce3baeba71368454cb30d00f1c115ccb658a
MATLAB
364
14
%% % Reproduces all modeling panels in: % IA Oldenburg, WD Hendricks, G Handy, K Shamardani, HA Bounds, B Doiron, % H Adesnik. The logic of recurrent circuits in the primary visual % cortex. Nature Neuroscience (2024) % % Written and edited by G Handy, IA Oldenburg, and WD Hendricks %% clear; close all; clc; p...
9c468ce6efe652b7ecf412f3f1a7abbac721bd385c903bd7bf3c4661b9b7f942
MATLAB
365
16
function rootDir = taft_set_rootDir() % rootDir = taft_set_rootDir() % % Set root directory for functions in TAfT directory. % % EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN. % J. Algermissen, 2018-2021. % Should work in Matlab 2018b. % we are here: % cd /project/3017042.02/Analyses/EEG_Scripts/OutcomeLockedAnalyses/...
734e6422ab6aa1c56bce33fa747d9e76828e2de56ce692eec81a4ae65feabf94
MATLAB
366
18
%% check_idpar_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; idpar_tree (tree); end end %% test 2 idpar_tree (sample2_tree, '-s'); tprint ('./panels/idpar_tree1', .....
77027781b70858eb2f93845f884172f85ac5d603419c3997b64949a86930cac0
MATLAB
366
17
%% check_rindex_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 100 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; rindex_tree (tree); end end %% test 2 rindex_tree (sample2_tree, '-s'); tprint ('./panels/rindex_tree1', ....
a509ee8e81c3788fbd31887a8ac34b9ad4c316c16ad9dcc3e0541cf6f6876e75
MATLAB
366
12
% Start the client, specifying the IP address of the Zapit server client = zapit_tcp_bridge.TCPclient('ip','122.14.143.200'); client.connect; % present the last stimulus condition for a short period nCond = client.getNumConditions; client.sendSamples('conditionNumber',nCond, 'hardwareTriggered', false); pause(3) clie...
05bd87537dc7778e8ed4c01e81e820da59118fa912601cd4d25dee3966b8298c
MATLAB
367
15
%% check_scale_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 50 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; scale_tree (tree, 2); end end %% test 2 scale_tree (sample_tree, 1.2, '-s'); tprint ('./panels/scale_tree1...
b5ef5856af2bbdc8e65336423ffa3fc9364e25296b04888c9d08c32b5ae88bca
MATLAB
367
10
function sessionNum = GetSessionNum(sessionNames) sessionNum = zeros(1,length(sessionNames)); for k=1:length(sessionNames) curName = sessionNames{k}; ind = strfind(curName,'Session'); curName = curName(ind+length('Session'):end); ind = find(curName=='_',1,'first'); curName = curName(1:ind-1);...
be65a7be8319101d5d606d0985aad6c59de7f5fded0fd93792ffb39534869627
MATLAB
369
12
function voxSize = getVoxSize(MRSIStruct, dimension) switch(lower(dimension)) case 'x' voxSize = MRSIStruct.voxelSize.x; case 'y' voxSize = MRSIStruct.voxelSize.y; case 'z' voxSize = MRSIStruct.voxelSize.z; otherwise error('voxSize not ...
2f64fbef4758b44997f8577cbe5c0d2807cc8bbd61fb4d251480fa013d80f4a4
MATLAB
373
16
function rootDir = helpers_set_rootDir() % rootdir = helpers_set_rootDir() % % Set root directory for EEG helper functions. % % EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN. % J. Algermissen, 2018-2021. % Should work in Matlab 2018b. % we are here: % cd /project/3017042.02/Analyses/EEG_Scripts/CueLockedAnalyses/CueLo...
cc8ff12534633541268046410731201bb1f1f17cbb48caace3c2d0c8998b9712
MATLAB
373
15
function [ret,messages] = check_files_in_base_calling() loadParameters; ret = true; messages = {}; outputfile = fullfile(params.basecallingResultsDir,sprintf('%s_results.mat',params.FILE_BASENAME)); if ~exist(outputfile,'file') ret = false; messages{end+1} = sprintf('[ERROR] not c...
47e7ea1af8110cea3f5ee06c62fabf6bfe14ecc09ffe99d9853e756ab77da8d4
MATLAB
374
18
clc;clear;close all %% % number of edges N = 100; NE = N*(N-1)/2; % S = 0.2*ones(NE); for i = 1:NE S(i,i) = 1; end save('data/Example_Covariance.mat','S'); writematrix(S,'data/Example_Covariance.csv'); %% R_vec = 0.2 + (1-0.2)*rand(1,NE); R = squareform(R_vec); save('data/Example_Reliability.mat',...
9ae99e906608f06756a3c4fbb8f6c6d928621aef2a4b63799c40b8449c34eb39
MATLAB
374
18
%% check_idchild_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 10 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; idchild_tree (tree); end end %% test 2 idchild_tree (sample2_tree, [], '-s'); tprint ('./panels/idchild_tr...
fd4eb70dace107ecd3c1338e510bbe06497e2977baca60512ec05cec29d13904
MATLAB
376
14
function[params,minerr] = fitGeneralizedLaplacian( x, f ) minerr = 1e99; for p = 0.01 : 0.05 : 5 for s = 0.01 : 0.05 : 5 gl = exp( -(abs(x)/s).^p ); gl = gl / sum(gl); err = mean((gl-f).^2); if( err < minerr ) minerr = err; ...
b7f857c49badeada59c77726cd11c1f70a408f58be922fcc08346482f94a1338
MATLAB
377
16
%% check_redirect_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 50 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; redirect_tree (tree, 5); end end %% test 2 redirect_tree (sample2_tree, 5, '-s'); tprint ('./panels/redire...
f5d0e45ea7547e9198086c8d69d32b9c6792a15588f65842f763d320ffea51a1
MATLAB
378
11
function outNum = LK_floor(inNum, precision) % % LK_floor is identical to floor with the additional option to specify a % precision to floor towards a specific decimal place. The precision is % specified as a power of 10 (with positive precision values leading to % more precise flooring). % % Lukas Kunz, 2021 prec ...
86166600b54ddad80757735357b465456954215027ea11b120c27e5730aaa8b6
MATLAB
379
12
function MRSIStruct = setCoordinates(MRSIStruct, dimension, value) switch(lower(dimension)) case 'x' MRSIStruct.coordinates.x = value; case 'y' MRSIStruct.coordinates.y = value; case 'z' MRSIStruct.coordinates.z = value; otherwise error...
e9d05b65eeac8dc8ec41e93edaf0c2c685f67a5926447a1fbdf8f0c0e7e3d4b6
MATLAB
379
12
function zapitSettingsFileName = returnZapitSettingFileName % Return the zapit settings file name as a string % % Purpose % Multiple files need access to this file name so we define it here once. % Returns "zapitSystemSettings.yml" % % Rob Campbell - SWC 2022 zapitSettingsFileName = 'z...
ca078011247b9c56e18c8bd9de0fb07cf7c52b2a42299c460af56eef255f3fa6
MATLAB
380
17
function [nRow,nColumn] = DispRowColumn(N) %% function [nRow,nColumn] = DispRowColumn(N) % Return the numbers of rows and columns when display N panels % % % YC at ES lab % Created on Mar. 12, 2009 % Last modified on Mar. 12, 2009 %% Numbers of rows and columns nRow = round(sqrt(N/12)*3); nColumn = roun...
cb3ecf54469a2e53f51a309dc1e7a6abb83ac5fabbfa506c191e6d17aaaab27a
MATLAB
381
11
function outNum = LK_ceil(inNum, precision) % % LK_ceil is identical to MATLAB's ceil with the additional option to % specify a precision to ceil towards a specific decimal place. The % precision is specified as a power of 10 (with positive precision values % leading to more precise ceiling). % % Lukas Kunz, 2021 prec...
3397e8a941c89f509e768e67230eae7a81f60fa4a78a39fc6eebce6657e4f49c
MATLAB
386
15
%This script will run both initialization scripts for T2N and TREES Toolbox %if they are currently not found to have been installed. Run before %attempting any model generation in NeMo-TMS. if ~exist('load_tree', 'file') cd ./treestoolbox-master; start_trees(); cd .. end if ~exist('t2n_writeTrees', 'file'...
431c03894e942de2323fbf8c2c60c7b42901ad7d6d77a74dd35e70982be24f31
MATLAB
387
22
function C = CalculateFilt2D(A,B) %% function C = CalculateFilt2D(A,B) % Calculate 2D filtration of A by B % % Use fft2, so much faster than filter2 in matlab % A and B must be 2D % C has same size as A % % % YC at ES lab % Created on Sep. 29, 2009 % Last modified on Oct. 1, 2009 %% Check inputs and/or outputs %% Fi...
6bf3f149785c706dff0739b07a496c1de8d53b186f3a57a10283150bfb39e008
MATLAB
387
12
function nu = rspnsFunc(trp, tau, a, b) % Neuron's current-frequency response function % % Input: % trp - refractory period time % tau - membrane time constant % a,b - limits of integration provided in the parent function mfa.m % Output: % nu - firing rate nu = 1e3/(trp + ...
4b7067eee68a29d5b0c57335ad9d0409d709f0de1ad5c9a977f2e6c1c388bd2a
MATLAB
388
22
function [M,E] = ising_exact_fluctuations(P,E,spin) % Compute fluctuations of magnetization m = 0; m1 = 0; for i = 1:size(spin,1) m = m + P(i)*(mean(spin(i,:)).^2); m1 = m1 + P(i)*(mean(spin(i,:))); end M = m - m1^2; % Calcoliamo le fluttuazioni dell' energia e = 0; e0 = 0; for i = 1:size(spin,1) e...
13c6e499e264522605a00b52e733529195c227eeba6315238c8559e6847fc34f
MATLAB
391
15
function df = st_tablegiveROInumber(df, roiList) % give number to ROIs pat = ("rh"|"lh"); for r = 1:length(roiList) if contains(roiList{r},pat) == 0 df.roiNumber(find(df.roiName2==roiList{r})) = r; elseif contains(roiList{r},pat) > 0 df.roiNumber(find(df.roiName==roiList{r})) = r; end end ...
ccb4515e54381334f7bf5d826c2b5d86081a078c24d6abb5942d03ca92778109
MATLAB
391
19
%% check_insertp_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 10 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; insertp_tree (tree, [], 'none'); end end %% test 2 insertp_tree (sample_tree, 43, 50 : 10 : 100, '-s'); tprint ('./p...
0e8f8474e67530515dd520bbe09dc5e79c1d7cc4a72ef5d9b5ad60ce8e3f5f22
MATLAB
392
19
function [status, time0] = newStartScan % This code will trigger the 3T GE scanner at CNI using the E-prime trigger % cable. --Michael 09/30/2013 try s = serial('/dev/tty.usbmodem12341', 'BaudRate', 57600); fopen(s); fprintf(s, '[t]'); fclose(s); catch err end if exist('err','var') == 0 time0 = Ge...
f62b0cae69069e9a86d82873bd6a7be28ae98290ccd8c773acf7dc11c1a78901
MATLAB
393
16
function segParams = GetSegParams(sbxInfo) paramsPath = sprintf('%s%s_seg_params.mat', sbxInfo.dir, sbxInfo.exptName ); if exist(paramsPath, 'file') fprintf('\nLoading %s', paramsPath); load(paramsPath); % , 'IP' if ~exist('segParams','var') && exist('IP','var') segParams = IP.Results; ...
ae14d1cf6c153269c0b289a708a7e736dc8af181380d954944a3e9e991536a07
MATLAB
395
16
function rootDir = grouplevel_set_rootDir() % rootdir = grouplevel_set_rootdir() % % Set root directory for EEG grouplevel analysis functions. % % EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN. % J. Algermissen, 2018-2023. % Should work in Matlab 2018b. % we are here: % cd /project/3017042.02/Analyses/EEG_Scripts/CueL...
69e2561e12d4e357d14809968624bcbe05c7f5e1aa18eaf137d196405007bb9d
MATLAB
397
12
function imageOrigin = getImageOrigin(MRSIStruct, dimension) switch(lower(dimension)) case 'x' imageOrigin = MRSIStruct.imageOrigin(1); case 'y' imageOrigin = MRSIStruct.imageOrigin(2); case 'z' imageOrigin = MRSIStruct.imageOrigin(3); otherwise ...
1c5e30d640d15f92efadd452b6dd88f68ce3d5b57e2cffd4790e7bf134ab59ef
MATLAB
398
16
function rootDir = preprocessing_set_rootDir() % rootdir = preprocessing_set_rootDir() % % Set root directory for EEG preprocessing functions. % % EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN. % J. Algermissen, 2018-2023. % Should work in Matlab 2018b. % we are here: % cd /project/3017042.02/Analyses/EEG_Scripts/CueL...
769f735e51bcefe7c6c670fef1e68e45d94a91f59e5b6d92ff83bedd60bb803d
MATLAB
398
12
function [f, t] = getROImean(vol,roix,roiy,roiz,td) %getROImean gets the time evolution of the region of interest inside of vol % vol: 4D data [3d spatial] x [1d time] -> [Nx Ny Nz Nt] % roi: vector with range of indices [3d spatial] -> [3] % f: mean of vol(roi) at each time point % t: time points (0:td:td*Nt) f =...
9008a25999802784f3bca5a4b6212b66103bf043f71e31a63321bb80edb1563f
MATLAB
398
21
function stimConfigEditor % A convenience function for starting the stim config editor standalone from the command line % % zapit.stimConfigEditor % % Purpose % Start the stim config editor without needing to first start Zapit. Useful for % making config file away from the rig machine. % % Inputs % none % % Outputs %...
ce5f6334adea509b8517e7420e89e6adef6e551fffed910ef461dc7edaca3a2b
MATLAB
398
20
%% check_clean_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counter = 1 : length (dLPTCs{1}) clean_tree (dLPTCs{1}{counter}, 20); end %% test 2 clean_tree (sample_tree, 20, '-s -w'); tprint ('./panels/clean_tree1', ... '-jpg -HR', [10 10]); %% test 3 clean_tree (hsn_tree, 20, '-s...
e44e5cea5c8b51c45cee49e665e64e2d3d33a7700609e1e7f910c2f94f7a72ed
MATLAB
398
14
function [mouseIdVec,dayVec] = mouseIdToNumber(mouseIdStrCellVec) mouseIdVec = zeros(1,length(mouseIdStrCellVec)); dayVec = zeros(1,length(mouseIdStrCellVec)); %Mouse28 day1 SP for k=1:length(mouseIdStrCellVec) curStr = mouseIdStrCellVec{k}; numbers = regexp(curStr,'\d*','Match'); mouseId...
07ae092baff2b2cfa68ca4aaea3cea7cf797c13db3f7fe55a0fba09dab404912
MATLAB
399
12
function [mixedfilters] = reload_moviedata(npix1, mov, mixedsig, CovEvals) %----------------------- % Re-load movie data nPCs1 = size(mixedsig,1); Sinv = inv(diag(CovEvals.^(1/2))); movtm1 = mean(mov,1); % Average over space movuse = mov - ones(npix1,1) * movtm1; ...
9e8ce331c2c9ad9c5f8b3af82150e980a2de8a56cbce37d7d6fac5d683dad7e2
MATLAB
399
24
function YesOrNo = FileExistsOverwrite(fn) %% File exists. Overwrite? % % % YC at ES lab % Created on Apr. 25, 2008 % Last modified on Apr. 25, 2008 if exist(fn,'file') Answer = ... questdlg(sprintf('%s has already existed! Overwrite?',fn),'Overwrite?'); drawnow; switch Answer case 'Yes' YesOrNo =...
d3593935b9c0d2c59e332e5fd55d667280954a9450edaab82f10ba4d67454cd7
MATLAB
401
18
function lipidMask = op_CSICreateLipidMask(MRSIStruct) checkArguments(MRSIStruct); dimensionIndexes = checkDimensions(MRSIStruct); end function checkArguments(MRSIStruct) checkSpatialFT(MRSIStuct); checkSpectralFT(MRSIStuct); end function [dimensionIndexs] = checkDimensions(MRSIStruct) dat...
21c16f235dd889951b0e5a2b4c26e851b7fd7265794bfe378ad16ce45f03dc99
MATLAB
402
12
function p = apply_4D_transformation_matrix(points, matrix) % Applys a 4x4 transformation matrix (rotation + translation) to the % points (http://en.wikipedia.org/wiki/Homogeneous_coordinates). % points have Nx3 dim % Alexander Opitz, 2010 % $Id$ if any(size(matrix)~=4) error('matrix has to be 4x4 siz...
e763b088c0d44b90601e58b08c82fef0d7f853c9da879e42f245a6e3f5dedcf2
MATLAB
403
15
%% Convert raw video into single frames V = VideoReader('RawData.avi'); % Read in raw videos V.CurrentTime = 0; num_images = V.FrameRate*V.Duration; i = 1; tic, while hasFrame(V) frame = readFrame(V); fprintf('frame%04d \n',i); Captured_images = im2double(frame(:,:,1)); imwrite(Captured_imag...
130cf2f58661199b04bad8426d252c05744cc935cc4eb8bb78505750b2c9aea8
MATLAB
406
13
% GRAPHICAL USER INTERFACE % % functions relating to the graphical user interface provided by the TREES % toolbox % % Files % cgui_tree - User interface to try out TREES package functions. % cgui_tree_initialize - initialize the GUI % cgui_tree_keys - define the keyboard mapping % % the TREES too...
bd1f3cba08edaf881f41655643d391a5c7101f35079954ae8f1a497d416a882b
MATLAB
406
15
function ste = LK_ste(mat) % % LK_ste computes the standard error for each column of the input matrix % "mat". % % The calculation is performed across the first dimension of the input % matrix ("mat"): ste = std(mat, [], 1, 'omitnan') ./ sqrt(sum(~isnan(mat), 1)); % % Use as: ste = LK_ste(mat); % % See also: std, nanst...
2fa54be2fd6f1e90de3e6189dcaeefa2d1b5bcb8c09ed62dea734cb33f02e008
MATLAB
407
18
function hh = fillAroundLine(dat,err,colz) % h = fillAroundLine(dat,err,color) hh = []; xn = 1:length(err); for i = 1:length(err)-1 hold on; yplus1 = dat(i)+err(i); yplus2 = dat(i+1)+err(i+1); yminus1 = dat(i)-err(i); yminus2 = dat(i+1)-err(i+1); hh(end+1) = fill([xn(i) xn(i) xn(i+1) xn(i+1)]...
ee6990b466c50965a3efe002b839b9b51eb978436cb7ad092be9ec343d4107f5
MATLAB
407
14
%% % Import project-wide constants constants_raw %% Load data [T, G, Map, Ang, Pos, wake, rem, sws] = load_mouse_data(DATA_PATH, MOUSE_NAME); %% Basic extraction of data [full_neuron_firing_per_bin, angle_per_temporal_bin, position_per_temporal_bin] = create_spike_count_and_angles_vector(wake, T, G, Ang, Pos); %% ...
aadab3c28cbaa4589f732e21655982d43fb843db99049bfb48d8f92b9afa46fd
MATLAB
408
24
function Y = FuncWoNFermi(P,X) %% function Y = FuncWoNFermi(P,X) % % Fermi function WithOut Normalization % % P = [Amp,X0,Base,Tao] --- parameters % Y = Amp./(1+exp(-(abs(X)-X0)/Tao))+Base; % % % YC at ES lab % Created on Jan. 13, 2012 % Last modified on Jan. 18, 2012 %% Parameters Amp = P(1); X0 =...
8289c7366035c1af187e2e77eaac48a8707ef9714d3fc6feee514d120d062492
MATLAB
410
18
function [k pauseKey quitKey resumeKey tenKeyFlag] = getKeyboardAuto d = getDevices; if isempty(d.keyInputExternal) fprintf('\n\n10-key not found! Using internal keyboard.\n\n'); k = d.keyInputInternal; pauseKey = 'p'; resumeKey = 'r'; quitKey = 'q'; tenKeyFlag = 0; else k = d.keyInputExte...
a1e511d3eb77ba1ec93221246509bdc6cb6d97f5289e8e9018f104543901de57
MATLAB
410
12
function plotPCAwithRespQuality(pcaCoords, responseInd, respThreshold) qualityInds = responseInd > respThreshold; figure scatter(pcaCoords(qualityInds, 1), pcaCoords(qualityInds, 2), [], responseInd(qualityInds), 'filled') caxis([0 1]) setFavoriteColormap hCBar = colorbar; xlabel('First PC'); ylabel('Second PC'...
b787391c6528cbf5a70d2a011521ec914df731dcc9aabf020c3cf402003da961
MATLAB
413
47
function x=demean(x,dim) % DEMEAN(X) % Removes the Average or mean value. % % DEMEAN(X,DIM) % Removes the mean along the dimension DIM of X. if(nargin==1) dim = 1; if(size(x,1) > 1) dim = 1; elseif(size(x,2) > 1) dim = 2; end end dims = size(x); dimsize = size(x,dim); dimre...
6ead01d04fcb0f48cd221f1b9db382e58080e3af1b1d6a859a96bab4a7e047d8
MATLAB
416
16
%% check_cat_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); sample = sample_tree; for counter = 1 : length (dLPTCs{1}) cat_tree (dLPTCs{1}{counter}, sample); end %% test 2 sample2 = sample2_tree; sample2T = tran_tree (sample2, [55 25 0]); cattree = cat_tree (sample2, sample2T, [], [...
fc5128c1763748bb3d835e0ed5ac46958288255040196a821e2e5892be8dca0b
MATLAB
416
21
function sformatted = stringFormat(s) % Converts s to a standard string format for rgcParameters set/get calls % % sformatted = stringFormat(s) % % The string is sent to lower case and spaces are removed. % % ex: % stringFormat('Spatial sampling Rate') if ~ischar(s), error('s has to be a string'); end % Lower ...
c072d7862622fd48cb6743a13bb1428ee1557d7d3a92cea5f1318d319f506139
MATLAB
419
16
clear; clc; subs=1:1:30; parfor ss=1:length(subs) subnum=subs(ss) ac{ss}=savefor_Figure12(subnum); end for ii=1:length(subs) subnum=subs(ii) filename=[pwd,'\temporary data\fbtrca_ac\sub',num2str(subnum),'.mat']; load(filename) fbtrca_ac(subnum,:,:)=ac; fbtrca_it...
1cab5e382298953f9455346d6c342f89a01b9151ef1ef745213838a5f93c0e74
MATLAB
420
11
function x = goi_copnorm(x) % COPNORM Copula normalisation % cx = copnorm(x) returns standard normal samples with the same empirical % CDF value as the input. Operates along the first axis. % Equivalent to cx = norminv(ctransform(x)) % [~,x] = sort(x, 1); % [~,x] = sort(x, 1); % Ranking of...
651b21c0aa25e83b6f30c6d27aa99196802c35162e9ba5a4273df17064dd8ca7
MATLAB
421
12
function subvector = getSubvector(Clist, CID, i) % split the vector Clist into subvectors using the values of CID as the lengths of these subvectors. % Then, when given an index i, the corresponding subvector from Clist is selected. if i == 1 start_idx = 1; else start_idx = sum(CID(1:i-1)...
7f7402348218ea12bbf1228a8baeb86e32f105ea26d58ba41d44ec67434a49bd
MATLAB
421
20
function RF = createRF(rf) x = linspace(0,24,61); % x = (0.1980:0.1980:20); x = x - mean(x); y = x; % Calculate the spatial sampling parameters [X,Y] = meshgrid(x,y); XY = [{X},{-Y}]; % Y = -Y; rf.values = pmGaussian2d(XY{1}, XY{2}, ... rf.sigmaMajor,rf.sigmaMinor,rf.Theta, ... rf.Centerx0,rf.Centery0); % ...
3b6939c58ce5b018df9d747f5b717c096f6f1ed25ae9f4455b20c9271c7bf1c8
MATLAB
422
17
function convnfft_install % function convnfft_install % Installation by building the C-mex file needed for convnfft % % Author: Bruno Luong <brunoluong@yahoo.com> % History % Original: 16/Sept/2009 arch=computer('arch'); mexopts = {'-O' '-v' ['-' arch]}; % 64-bit platform if ~isempty(strfind(computer(),'64')) mex...
121e6293a773b69d37f190f5b8126b6c65f4110da12ff7fb6f53d9235ceaa3c0
MATLAB
423
13
%% check_spread_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); spread_tree (dLPTCs{1}, [], [], '-s'); tprint ('./panels/spread_tree1', ... '-jpg -HR', [10 10]); %% test 2 dLPTCs = load_tree ('dLPTCs.mtr'); spread_tree (dLPTCs{2}, 200, 2...
d4ae7cf514a7015de4ff9c7ad72cd2e7407c7bb3beb82b39c72c8422695be116
MATLAB
426
15
% returns index of features which seem to be more important, ignoring a % handful of the others which tend to screw things up function keepmetric = filterFeatures(names) keepmetric = []; ct = 0; for i = 1:length(names) if isempty([strfind(names{i},'iqr'), ... strfind(names{i},'25'), st...
1b334c1c0ddcb2ba02155e3a4debbb4e660817c79b97912509da66c568ce760f
MATLAB
427
19
%% check_sub_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 10 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; for counteri = 1 : 100 sub_tree (tree, counteri); end end end %% test 2 sub = sub_tree (sampl...
49150383406e429a435bf75e67fffa235a396c5c9c0a07f15c6cc5f3a4c78609
MATLAB
428
21
function isPressed = isShiftPressed % Return true if shift is pressed % % zapit.utils.isShiftPressed % % Inputs % none % % Outputs % isPressed - boolean. True if shift is presed. False otherwise. % % Rob Campbell - SWC 2022 mod = get(gcbo,'currentModifier'); isPresse...
4afb62ce7fa019fbb0f09839f503bfeec47b5519093e6aa41825c050bd3ce89d
MATLAB
432
18
%% check_gm_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; gm_tree (tree, 'none'); end end %% test 2 gm_tree ...
a66453ead7b7b11b50cee68aed954ef3d62176a7ffa3cb6f16ac98f615a330db
MATLAB
432
13
function newPrevPermute = removeDimPrevPermute(prevPermute, dimNumber) newPrevPermute = prevPermute; for iDim = 1:size(prevPermute, 2) dimensionNumber = prevPermute{1, iDim}; if(dimensionNumber > dimNumber) newPrevPermute{1, iDim} = dimensionNumber - 1; elseif(dimensionNumbe...