sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8d5047e86ec5dfd2dce5ad154c06d31ee63701ae8ccfd620e573d5a881427f69
MATLAB
1,173
23
function mscmd_branch_cluster_v2(timeseries_path,detect_path,adjacency_matrix_path,out_firings_path,opts) % TODO: Docs if (nargin<5) opts=struct; end; if (~isfield(opts,'clip_size')) opts.clip_size=100; end; if (~isfield(opts,'min_shell_size')) opts.min_shell_size=50; end; if (~isfield(opts,'shell_increment')) opts.sh...
b633261543e470cb49679c8c3815971d6430a4966992e068b86ef6ffc1b735c8
MATLAB
1,173
38
function writeims(sloc,packdir) % Currently single-view only sdir = TrnPack.SUBDIRIM(); if exist(fullfile(packdir,sdir),'dir')==0 mkdir(packdir,sdir); end imovall = [sloc.imov]'; imovun = unique(imovall); fprintf(1,'Writing training images...\n'); bufsize = 128; for iimov = 1:numel(imovun), ...
14a823a230aa3bfa7139e4285ab86c7b3f504937b15970e3e6a96dcc1403a641
MATLAB
1,174
1
function out = randtest1d(a,b,paired,tail,nrand) % function out = randtest1d(a,b,tail,nrand); % tail = 0 (test A~=B), 1 (test A>B), -1 (test A<B) if ~exist('b', 'var'), b = zeros(size(a)); end if ~exist('nrand', 'var'), nrand = 100000; end if ~exist('tail', 'var'), tail = 0; end if ~exist('paired', 'var'), paired = ...
1f4bd138876edbfc8326d42c87eb5165079be50cba71c609e0d2e9b605c2ac5e
MATLAB
1,174
31
function [shape] = ft_transform_headshape(transform, shape) % FT_TRANSFORM_HEADSHAPE applies a homogenous coordinate transformation to a % structure with headshape and fiducial information. % % Use as % shape = ft_transform_headshape(transform, shape) % % See also FT_READ_HEADSHAPE, FT_TRANSFORM_GEOMETRY % Copyrigh...
b5173f1daf74540766185dd56d949d81f76f9534bc172812b3d6bad42148588e
MATLAB
1,174
39
function data = afxCsvRead(fname,delimiter) % Import CSV-Files % array = mycsvread(filename,delimiter) % % max.wawrzyniak@medizin.uniklinikum-leipzig.de if nargin < 2, delimiter = char(9); end % Tab data = {}; % check if file exists if ~exist(fname,'file') disp(['F...
bb7ee4f031fe46627286e1f537fa4384cbdbf26b6af7cf6f1aae5d63d683bd2f
MATLAB
1,175
39
%% Illustration of central vs high posterior density intervals % %% % This file is from pmtk3.googlecode.com function postDensityIntervals f = @(x)gaussProb(x, 0, 1) + gaussProb(x, 6, 1); domain = -4:0.001:10; h = plot(domain , f(domain), '-r', 'LineWidth', 2.5); axis([-4, 10, 0, 0.5]); shade(f, 0, -1.5, 7.5, 'b', 0....
be2118b0172c3412569786e21f629c12e41c17bc216b105fea356fd7b10a2133
MATLAB
1,175
44
function [preproc, X] = preprocessorApplyToTrain(preproc, X) % Apply Preprocessor to training data and store updated % parameters inside pp object for use at test time % This file is from pmtk3.googlecode.com if isempty(preproc), return; end % For backwards compatibility, we replicate the % behavior of preprocessorC...
35d423fac94ec812e792e8932647f1e285a24fffedfcfa954cc630d67b8f2deb
MATLAB
1,176
41
function MovT = NoCamp_MovieTime_Gaps(data,Sr,Nz) %% old data (summer 2014) % UP=[1;find(data>-1)]; % Step=find(diff(UP)>1000); % for i=1:NFilms % if i+1>length(Step) % MovLim(i,:)=[UP(Step(i)+1) UP(end)]; % else % MovLim(i,:)=[UP(Step(i)+1) UP(Step(i+1))]; % end % dttmp=diff(MovLim(i,:...
1797ad414da03100fc46e2f587b17cafcf1f57c072e2dae683e1dbf35efe65b3
MATLAB
1,177
49
function [x] = comp_fisheye_distortion(xd,k) %comp_fisheye_distortion.m % %[x] = comp_fisheye_distortion(xd,k) % %Compensates for fisheye distortions % %INPUT: xd: distorted (normalized) point coordinates in the image plane (2xN matrix) % k: Fisheye distortion coefficients (5x1 vector) % %OUTPUT: x: undistorted...
204d2a07e6f4442983cd8b6ebeee42f6c7f6d785333b352d3c1c3a4c8ed43e7a
MATLAB
1,177
35
function pMat = calculatePosteriorMatrix(trajExpectedSpikes, trajExponExpectedSpikes, spkPerBin) % pMat = decode.calculatePosteriorMatrix(trajExpectedSpikes, trajExponExpectedSpikes, spkPerBin); % % Baye's rules: calculate posterior prob for given traj and event % %% Set up nSpkPerTBin = squeeze(sum(spkPerBin, 3)); ...
247257c7b2f64523d79d27affa52a122a25da9889302cddf71ff2925788e4c0c
MATLAB
1,177
32
function [calibModelError, reconModelError] = test_reconstruction(frame, camPts, numTrials) nCamera = round(size(camPts,2)./2); reconModelError = zeros(numTrials, 1); calibModelError = zeros(numTrials, 1); camPts_good = camPts(sum(~isnan(camPts),2)>2,:); frame_good = frame(sum(~isnan(camPts),2)>2,:); numPoint...
8f04be556cc41bb0a9fabbe838fa6cbdb38bcca40ca47ce430912db8766a11c6
MATLAB
1,177
22
function output = SOFAappendText(Obj,attribute,new) %SOFAappendText % % output = SOFAappendText(input,new) appends the new text to the % attribute using the correct SOFA separators. If the attribute is empty % or non-existing, the output will be the new text only. % % SOFA API - function SOFAappendText % Copyri...
4667e7be072749384b0634226f4a042de5b0242d392f201bfe3fe726f1dccb88
MATLAB
1,178
51
function S = VBA_sqrtm (C, inv) % // VBA toolbox ////////////////////////////////////////////////////////// % % S = VBA_sqrtm (C, inv) % quick derivation of the square root of a matrix % % IN: % - C: the entry matrix % - inv: binary flag for inverse square root (inv = true). % Default = false. % % OUT: % -...
55d126b8df07a9e065e6dc1eae2295ead920189d6434c5f6e610b6cd7ba4fcd2
MATLAB
1,178
52
%% Fit a Gamma distribution to the rainfall data by MLE and moment matching % Rice (1995) p383 %% % This file is from pmtk3.googlecode.com function gammaRainfallDemo() X = loadData('rainfall'); X = X'; X = X(:); % concatenate across rows, not columns %X = X(1:end-5); % removing trailing 0s [a(1), b(1)] = gamMOM(X);...
4dba1eef95d5f3f46789c88b0df87e4a65a1ce7b2739c673898dd1b39f09108a
MATLAB
1,179
28
clear all %% %Define default parameters [opt] = ParameterOptions(); %% %Create an oscillating gradient waveform (here consistent with definition in Aggarwal et al.) opt.nOscillations=3; % Number of oscillations per TR opt.Waveform='Sine'; % Type of Oscillating Gradient ('Sine' or 'Rect') opt.G=674; %...
880bac02f930f32c01a4086a5b9de05bb7400af902a0e31ecc28441547d84d69
MATLAB
1,179
35
function ok = tt_sizecheck(siz) %TT_SIZECHECK Checks that the size is valid. % % TT_SIZECHECK(S) throws an error if S is not a valid size array, % which means that it is a row vector with strictly postitive, % real-valued, finite integer values. % % X = TT_SIZECHECK(S) returns true if S is a valid and false otherwi...
edde8f99ab9665190db02f9ab42481e6a902b199aa2d1b8f14ae8335cb068b3c
MATLAB
1,179
53
function rt_2_ev2(RT,cfg) % v.0.0.0 % <*LAN)<| % write ev2 file from reaction time (RT) structure % % cfg.filename = 'nombredearchivo.log' % cfg.where % cfg.srate = n ; % % cfg.first_laten = 45, % Corregi la priemra latencia % if isfield(cfg,'unit') RTunit = cfg.unit; elseif (isfield(RT,'cfg') && isfield(...
31a64f55d389d5b80ff784cf982c5290f4171e8819baaf2c7eaae51321c0f8a4
MATLAB
1,180
38
function [w, loglikHist] = probitRegFitEm(X, y, lambdaVec, EMargs) %% Find MAP estimate (under L2 prior) for binary probit regression using EM % y(i) is +1,-1 % This file is from pmtk3.googlecode.com % PMTKauthor Francois Caron % PMTKmodified Kevin Murphy, Matt Dunham if nargin < 4, EMargs = {}; end model.w = [];...
51e78e02ff5e3890dfd70554fa2c676775fde425cf198192b58010ac80945491
MATLAB
1,180
27
% compile mex file disp('Compiling perform_front_propagation_mesh, might time some time.'); files = { ... 'perform_front_propagation_mesh.cpp', ... 'gw/gw_core/GW_Config.cpp', ... 'gw/gw_core/GW_FaceIterator.cpp', ... 'gw/gw_core/GW_SmartCounter.cpp', ... 'gw/gw_core/GW_V...
70e203d6650ba449c3c5648cb232f5ce3ba7381fde821d1c5e59cf0c58b6ed56
MATLAB
1,180
38
function [pvalue] = mmdTestBoot(X1,X2,shufflenum,fvalue) global sigma2 n1=size(X1,1); n2=size(X2,1); D1 = rbf_dot(X1,X1,sigma2); D2 = rbf_dot(X2,X2,sigma2); D12 = rbf_dot(X1,X2,sigma2); Kz = [D1 D12; D12' D2]; MMDboot = zeros(shufflenum,1); for bootnum=1:shufflenum [~,indShuff] = sort(rand(n1+n2,1)); KzShu...
989bc4c2b67feea3baec491185a926daf9a7c178f4919bb9559c798e0cb00f97
MATLAB
1,180
63
% h = drawfly(trk,varargin) % h = drawfly(x,y,theta,quartermaj,quartermin,varargin) % draw triangle corresponding to fly position % extra arguments will be fed to patch function varargout = drawfly(x,y,varargin) % draw an isosceles triangle with center (x,y) % with rotation theta % with height maj*4 % with base min*4 ...
d58518aa19d74be552fe0915b8b08a168aa7533d6763ab53ceef906347439cdc
MATLAB
1,180
48
%% Residuals Demo % %% % This file is from pmtk3.googlecode.com setSeed(2); %xTrainRaw = (-10:1:10)'; n = 20; xTrainRaw = randn(n,1); %xTrainRaw = (-3:0.5:3)'; Ntrain = length(xTrainRaw); xTrain = [ones(Ntrain,1) xTrainRaw(:)]; wtrue = [1 1]; sigma = 1; yTrain = wtrue(1) + wtrue(2).*xTrainRaw + sigma*randn(Ntrain,1)...
630058ecb8220c33b642165f541faae1596dd21c379871c74ecc46bc6691684e
MATLAB
1,181
34
function PlotFigure2_S1(vars) % function PlotFigure2_S1() % Figure 2 - Figure Supplement 1 % sRT vs distractor pull, per incentive*thp level % only distractor-present trials %% load if not given if nargin==0 load('Figure 2 - Source Data 1.mat', 'vars') % vars is struct with fields of [nPP, nConds, ...
fae6494fb3dde38d7fc5bd89a18fc4e6d15ed930e72062cf69b41fc671ff212a
MATLAB
1,181
41
% CalculateSigmasWithinMice_Inverted.m % Sarah West % 10/24/23 % need for calculating corr of fluorescence with corrs by nodes. % Made to be called by RunAnalysis.m function [parameters] = CalculateSigmasWithinMice_Inverted(parameters) MessageToUser('Calculating sigmas ', parameters); % INVERT HERE ...
2faf8efe788902c57485638563d567fe3aaa54c66ed0ae82f3f4a35262e9323d
MATLAB
1,182
41
function tests = mex_mergefilesTest tests = functiontests(localfunctions); end function setup(testCase) if ~exist('/mp/nvme0/tmp/testworks') mkdir('/mp/nvme0/tmp/testworks') end n = 4000; data = {}; for i = 1:4 data{i}=[rand(n,1); (1:n)']; end data{1}(2,1)=0.1; data...
64291e7762f0ed7f3497ede8d1f10c3d0241fd5729c3228dca20b117a97a0bb2
MATLAB
1,182
32
function run_image_list = spm5_image_list(num_vols, file_list) num_runs = length(num_vols); if(length(file_list) == num_runs) % EITHER cell array with full image list OR single 4-D image names for i = 1:num_runs if size(file_list{i}, 1) == num_vols(i) % we have the ...
07a6885c5da24ef4324415252babed2695c50283d74c36f57eb7c39cbe2822e3
MATLAB
1,183
35
function model = discreteFit(X, alpha, K) % Fit a discrete distribution, or if X is a matrix, a product of discrete distributions % % X(i, j) is the ith case, assumed to be from the jth distribution. % X must be in 1:K. % % alpha - dirichlet alpha, i.e. pseudo counts % (defau...
34ec761f48a9263e7e00222966010ae54f8adb19d36f9d681e0e1d7585c693ac
MATLAB
1,183
38
% Translate an image to subpixel accuracy. % % Note that for subplixel accuracy cannot use nearest neighbor interp. % % USAGE % IR = imtranslate( I, dx, dy, [method], [bbox] ) % % INPUTS % I - 2D image [converted to double] % dx - x translation (right) % dy - y translation (up) % method - ['linear...
05925d3d543928bd349680fba6527c1be63771339e6c5b9c7678ad98632dcea0
MATLAB
1,184
52
% % _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % function S = getFilesWithSortedSpikesOnChannel(self,channel) arguments self (1,1) crabsort ...
12643e0959edbc38dacefc067f42ad53f984d19f9dbe3e90a2d846aa9acfb5b9
MATLAB
1,184
51
function model = shrunkenCentroidsFit(model, Xtrain, ytrain, lambda) %author Robert Tseng C = length(unique(ytrain)); [N, D] = size(Xtrain); Nclass = zeros(1,C); % compute pooled standard deviation xbar = mean(Xtrain); sse= zeros(1,D); for c=1:C ndx = find(ytrain==c); Nclass(c) = length(ndx); % if there...
7e717545434a9eb6832a3cb5e77177b2e12411e5c27fe8a1f221564a6a20b2d9
MATLAB
1,184
47
function [tfsucc,movfile,trxfile] = promptGetMovTrxFiles(tfMultiSelect,tfHasTrx) % [tfsucc,movfile,trxfile] = promptGetMovTrxFiles(tfMultiSelect,tfHasTrx) % % tfsucc: scalar logical % movfile: cellstr % trxfile: cellstr same size as movfile if nargin < 2, tfHasTrx = true; end multiSelOnOff = onIff(tfMultiSelect); ...
af5a5fd0559aea1a290d671ce7285314844d839c5bab8ec4babb558503333be7
MATLAB
1,184
32
function source = find_source_points( evaluation_points, X, Y, dx, dy ) % *SPONTANEOUS WAVE DEMO* % % FIND SOURCE POINTS find "putative" source points - the most likely % starting point for a wave on the mulichannel % array by locating the arg max of divergence of a...
dd7a58df633709d8038fe92073375b91f5571444c7b8caad6c7001c8e93baf8b
MATLAB
1,184
36
function [XX, XY,Yn,allstim,n,T] = MkSuffStats_BilinReg_Sims(Z,X,hk) [n,T,N] = size(Z); % P = cols(X); P = size(X,2); allstim = cell(n,1); ntrials = sum(hk,1); Yn = cell(n,1); % neural responses (each cell has resps for one neuron) for ii = 1:n % loop over neurons allstim{ii} = zeros(ntrials(ii),P); % stim vals ...
1c36226c5585c9d1b268a6afd76a06221a15ee3933b3d18ad593a53e27d058fc
MATLAB
1,185
35
%% pro_Create: Create an empty new project structure % % Usage: % pro = pro_Create() % % Inputs: % % Output: % pro project structure % .Inputs.pdfs: cell-array of the model inputs with the pdf handles % .Inputs.Names: cell-array with the input names...
b7ec3fe336da221facb75cbbd02f640a1027686793e2018a91bc648a037b397c
MATLAB
1,185
46
function clean() % checks every files, and makes sure we can load it. if we can't, % puts it in a folder called "corrupted" self = crabsort(false); % figure out what file types we can work with allowed_file_extensions = setdiff(unique({self.installed_plugins.data_extension}),'n/a'); allowed_file_extensions = cellfun...
be608cf1452bf6652402839b9d531aca4d90132f7c8a5c7be4eff7a6bdeefa1f
MATLAB
1,185
62
% % disp("This is an example matlab driver"); disp("On output the code prints the pot+grad in example1 and, pot+pottarg in example2"); disp(" "); disp(" "); %% source to source, charges only, pot+grad example % clear srcinfo ns U eps pg zk; disp("Example 1: source to source, charge, pot+grad"); disp(" "); disp(" ");...
c1eec5638b31f86d977824d7c6c491d33ea81e138228a6898451ea240be513d6
MATLAB
1,185
47
function [ conn_lengths ] = get_graph_lengths( nodes ) %GET_GRAPTH_LENGTHS Summary of this function goes here % Detailed explanation goes here parameters; % get dx, dy, dz % TODO: Test weather z is really z-stack dimension n_nodes = max(size(nodes)); % todo: may fail in rare cases %% Traverse the nodes Adj = zero...
1289b11c145e196830d404592db6bdb3dd0663c2b72056bf70463123619c92d2
MATLAB
1,186
41
function FileSiteDistribution(SiteID, savepath) % Count unique elements [uniqueElements, ~, indices] = unique(SiteID); counts = histcounts(indices,1:(numel(uniqueElements) + 1)); % Create figure fig= figure('Visible', 'off'); b = bar(counts, 'FaceColor', '#007FFF', 'EdgeColor', 'w'); %...
351d5e1be68168f8b4ec2ca88512be70eb19db9c636d49b675b1f4ae5d4d3a80
MATLAB
1,186
36
% Author: Birgit Nierula % nierula@cbs.mpg.de function [labels, elec_pos, grid_size, grid_pos] = get_gridparameters(subjects) %% electrode positions in mm % import electrode positions for isubject = 1:length(subjects) subject_id = sprintf('sub-%03i', subjects(isubject)); raw_path = [getenv('RAWDIR') subject...
d5eaea4defe458f8916ebb05935f9564f79833d997badafc994dcb62144237a6
MATLAB
1,186
42
function [ dataOut ] = meglegacy_fftFiltHilb( dataIn, f1, f2, srate ) %MEGLEGACY_FFTFILTHILB Filters data using an FFT and calculates hilbert transform % % Uses an FFT and inverse FFT to filter and calculate hilbert transform of % the input data set in one step. % A bandpass filter is applied to the data between the sp...
ef3c95584dc1af68c1be6ab00aea71ad324657bb3e07120c852fddf8244dc450
MATLAB
1,186
51
function writenodes_tetgen(fn,p,nodemap) % writenodes_tetgen(fn,p,nodemap) % Writes the 3D nodes in 'p' to a file called 'fn' in tetgen format % <# of points> <dimension> <# of attributes> <boundary markers (0 or 1)> % nnodes 3 0 0 % 1 x y z % 2 x y z % 3 x y z fprintf('%s','Writing data to file...') np=size(p,1); dim=...
051590b303bc4c7e20f2597e51e6f4303fa2f584076c9ac02c6599bca294a063
MATLAB
1,187
52
%% Burgers_test.m -- an executable m-file for solving a partial differential equation % Automatically created in CHEBGUI by user Prateek Bhustali. % Created on April 22, 2020 at 18:43. %% Problem description. % Solving % u_t = -u*(u)' + (0.01/pi)*u", % for x in [-1,1] and t in [0,1], subject to % u = 0 at x = -1 %...
263f7d5023dbe7e0603553956de9b6e47790ed537fa2894932883c5a6d47a8c4
MATLAB
1,187
41
function varargout = figureResized( screenratio, varargin ) % Creates a figures that takes up certain area of screen. % % Almost same as figure, except get to specify what fraction of available % screen space figure should take up. Figure appears in center of screen. % % USAGE % varargout = figureResized( screenratio...
59fbe72f0e24034543e1c21c558e4672af7d2ab8de1afff6a397a04a5427755c
MATLAB
1,187
39
function [model, logev] = logregFitVb(X, y, pp, useARD) % Variational bayes inference for logistic regression % This is a wrapper to Jan Drugowitsch's code. % We use the following prior: % p(w, alpha) = N(w | 0, diag(alpha)^{-1} ) * prod_j IG(alpha(j) | a0, b0) % where a0, b0 are set small (vague prior) % where alph...
a03f370fc54ce50467b793777bdbc40343d452bb7e6e5dc6099c04e58678d567
MATLAB
1,187
58
addpath .. load clab_example; load ../../surfaces/skin sa=prepare_sourceanalysis(clab_example); vcx=skin.vc; trix=sa.vc{1}.tri; vcx=sa.vc{1}.vc(:,1:3); [np ndum]=size(vcx); vcx=vcx-repmat(mean(vcx),np,1); rads=sqrt(sum(vcx.^2,2)); vcx=vcx./repmat(rads,1,3); sphere.vc=vcx; sphere.tri=trix; figure;showsurface(sphere);...
74f18b72fdd6578039f02157bce6c65a1f01b6283af0293c46799aa86cf8e366
MATLAB
1,188
40
function output = gzipdecode(input) %GZIPDECODE Decompress input bytes using GZIP. % % output = gzipdecode(input) % % The function takes a compressed byte array INPUT and returns inflated % bytes OUTPUT. The INPUT is a result of GZIPENCODE function. The OUTPUT % is always an 1-by-N uint8 array. JAVA must be enabled ...
e3d9b80d5f24b8621349a70f30d9cfbbd657ce46c0c2fc11a0b6425868c2a8c3
MATLAB
1,188
51
function LAN = lan_autoref(LAN,tol) % <*LAN)<] lantoolbox % v.0.0.1 % % Auto local references for iEEG % tol = 0 ; how many distances of electrode tolerate for the local references % 0 = Only the immediately adjacent electrode % n = n electrode of distance % % Pablo Billeke % 16.11.2013 if na...
11304d5c8a343755b75aa6ed69f417548d11b38c3e0d6dc8045d5a9bed8759a6
MATLAB
1,189
27
function linkToolName(tool_fig,target_fig,tool_name) % LINKTOOLNAME(TOOL_FIG, TARGET_FIG, TOOL_NAME) uses the function % createFigureName to set the name of TOOL_FIG. It then creates a listener % that will update the TOOL_FIG name property to match changes that occur % to the TARGET_FIG name property. % Copyright 2...
1c416890f126bef39cf65ddf4122d2dd109b29cd56bc56dddca55a38613446ea
MATLAB
1,189
43
function [x_comp] = comp_distortion(x_dist,k2); % [x_comp] = comp_distortion(x_dist,k2); % % compensates the radial distortion of the camera % on the image plane. % % x_dist : the image points got without considering the % radial distortion. % x : The image p...
9b76b0e041ed9b8ed280ef0c5dede0ac641629267775ab47df58a5ff538efb8a
MATLAB
1,189
36
%% sdotype % Utility to quickly classify an SDO matrix as 'L' (linear/ dpx) or 'M' % (markov/transition matrix). An array of all zeros should be passed as % 'L'. % % Tolerance value calculated is relative to the number of states. % Copyright (C) 2023 Trevor S. Smith % Drexel University College of Medicine ...
c2a38e085ae539aa79a76f15bf235e581b42e761e92f143579a25825999f16c5
MATLAB
1,189
53
function [hax,hfig] = get_axes(hax,hfig,varargin) [axparams,axi0,axi_create,figi,figpos] = ... myparse(varargin,... 'axparams',{},... 'axi0',1,'axi_create',[],'figi',1,... 'figpos',[]); if isempty(axparams), nax = 1; else nax = axparams{1}*axparams{2}; end if isempty(axi_create), axi_create = axi0:axi0+...
f6224b7045962c72c15a1dbf6a016f73b8fd18676e53068519cef200898fb866
MATLAB
1,189
50
function u = SB_ATV(g,mu) % Split Bregman Anisotropic Total Variation Denoising % % u = arg min_u 1/2||u-g||_2^2 + mu*ATV(u) % % g : noisy image % mu: regularisation parameter % u : denoised image % % Refs: % *Goldstein and Osher, The split Bregman method for L1 regularized problems % SIAM Journal on Imag...
27da8824470cddb2bcd547a944338064daf7fea6001d6141d826346bc2cc4e4c
MATLAB
1,190
36
function r = randSample( n, k, isArray ) % Generate values sampled uniformly without replacement from 1:n. % % If n is an integer, samples k values from 1:n without replacement. If n % is an array, samples k values without replacement from n. This function % implements much of the same functionality as randsample.m in ...
8ad2771eda628cd7a74328ce7a10301f6cdffd6f98fd5304e63fbdc3bf325d05
MATLAB
1,190
45
function [fx] = f_HRF(Xt,P,ut,in) % Balloon (HRF) model evolution function in log-space (wo options) % function [fx] = f_HRF(Xt,P,ut,in) % This function evaluates the evolution function derived from the balloon % model for the hemodynamic response function. Note that the hemodynamic % states are in log-space, for posit...
0d56b901fcd9bae67feb1b67765204653e3bcaa2e2f64f643aaeb4ffcb6d77df
MATLAB
1,191
32
%----------------------------------------------------------------------------------------- % Plot spike shape of example amygdala neuron % % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Figure 4b % Author: Marcel Kehl % License: MIT License %--------------------------------...
0d6c6cdcee977524b2652e023babc93306ecb07fade9c2fdb0465aa482ce0481
MATLAB
1,191
53
function TF = tabularFactorMultiplyDomain(facs, dom) % Multiply tabular factors % T = tabularFactorMultiplyDomain({fac1, fac2, fac3}, domain) % Same as tabularFactorMultiply, except we explicityl specify % the domain of the resulting factor, which may not be in sorted order % This file is from pmtk3.googlecode.com N...
2ec22e9a1ba5b831003e028afca926ccdb6e27c7eebbb59a68b53742f1628a70
MATLAB
1,191
50
% HIFIE_SPDIAG_SV_H Dispatch for HIFIE_SPDIAG with DINV = 1 and F.SYMM = 'H'. function D = hifie_spdiag_sv_h(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find act...
7130d3161fa8937cda0f98b8fc48e75ce254c53292b6ce2ab8cd001c589642ef
MATLAB
1,191
40
ind = 1; data = dir('/DATAPOOL/ERRORMONITORING/SEM_mri_data/P*'); %% for i = 1:size(data,1) data_func = dir([data(i).folder, '/', data(i).name, '/mri/SEM_', data(i).name, '/nifti/func/run*']); for j = 1:size(data_func,1) images = [data_func(j).folder, '/', data_func(j).name, '/wra', data_...
a9b7387f6ff085d179f58ade7c5f6e7ebe57f5e1b31cd6c4bc87e077b31f37b7
MATLAB
1,191
31
function flag=istfraff(method); % flag=istfr2(method) returns true is method is an affine % time frequency representation. % See also istfr1, istfr2. % F. Auger, may 98 % Copyright (c) CNRS - France 1998. % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU Genera...
bdf1ce73f478f2f56114a0c7fb46f7be88a0394e78c50355dde786607cea38e4
MATLAB
1,191
34
% Quick script to get a maxProjection of all images to show % the difference between pre/post registration and color correction function reporting_getMaxProjections(directory_images, channels) loadParameters; if ~exist(params.reportingDir,'dir') mkdir(params.reportingDir); end for roundnum = 1:params.NUM_ROUNDS ...
e23ef4d5799d4d30a553e625740ed3c05524a560f42df50f44cb5afc9ead2626
MATLAB
1,192
50
% HIFIE_SPDIAG_MV_H Dispatch for HIFIE_SPDIAG with DINV = 0 and F.SYMM = 'H'. function D = hifie_spdiag_mv_h(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find act...
f579db2bf9e1a2e4040249cd50522dd35693f337736d1564e4c0aed491c6df48
MATLAB
1,192
33
function downloadAllData(destnRoot, quiet) %% This function downloads all pmtkData from pmtkData.googlecode.com % By default, it stores data in pmtk3/data, but you can specify a % diffferent destnRoot. This function does not add the folders to the % matlab path. If the folders already exist, the contents are overwritte...
fd10808734d1785fc4e55a9d8f8fec4fb0ac2564da079326c4ac4afeff1c5823
MATLAB
1,192
12
fprintf(1,'Saving the stereo calibration results in Calib_Results_stereo.mat...\n'); string_save = 'save Calib_Results_stereo om R T recompute_intrinsic_right recompute_intrinsic_left calib_name_left format_image_left type_numbering_left image_numbers_left N_slots_left calib_name_right format_image_right type_numberi...
fe3ca718fd43395ba096dc8b9311ee85b08f6c8183595abc1b50734170404bc1
MATLAB
1,192
46
%% MLP Classification Demo % Based on Mark Schmidt's Demo from %http://people.cs.ubc.ca/~schmidtm/Software/minFunc/minFunc.html#9 %% % This file is from pmtk3.googlecode.com H = [3, 6, 9]; H = 6; for hi=1:length(H) nhidden = H(hi); setSeed(0); nVars = 2; nInstances = 400; options.Display = 'final'; options.MaxIter ...
29172df164dbdccd24bad39ee72885f673736d9d372e9287f9740fac64024a08
MATLAB
1,193
31
% ALIGNTIMESTAMPS align signal by subtracting event timstamp from spike % timeStamps % alignTimeStamps.m % % Copyright 2008 Vanderbilt University. All rights reserved. % John Haitas, Jeremiah Cohen, and Jeff Schall % % This file is part of JPSTH Toolbox. % % JPSTH Toolbox is free software: you can redistribute it ...
30f02175d7a7ee864b71bcaca3e05c20d158d9bba5596eed060b8d21160afd79
MATLAB
1,194
28
function [exFactor, iReSIGt, norm, centroid] = getonlineparameters(EMG, EMGmask, MUFilters, fsamp) EMG(EMGmask > 0,:) = []; nbextchan = 1000; exFactor = round(nbextchan/size(EMG,1)); eSIG = demean(extend(EMG,exFactor)); ReSIG = eSIG*eSIG'/length(eSIG); iReSIGt = pinv(ReSIG); nMU=1; for i = 1:size(MUFilters,2) Pul...
43211acab28509a5f6faea80ba122f49ad20c612eae85b49b6e84ce7de8fe708
MATLAB
1,194
25
function dbURL=SOFAdbURL(dbURL) % dbURL=SOFAdbURL % % dbURL=SOFAdbURL returns the internet URL to the directory containing % HRTFs. The default URL is http://www.sofacoustics.org/data. % % dbURL=SOFAdbURL(newURL) sets the internet URL to the newURL for further calls % of SOFAdbURL. % SOFA API - function SOFA...
49b1c881f1f7a6b827c5cc35b1d7ecba5fb6247ab872ba50e407ceded63e76e7
MATLAB
1,194
26
function SC = state_colors(obj) %#ok<INUSD> % Colors that the various states take when plotting SC = struct( ... 'wait_for_cpoke', [210 105 205]/255, ... % orchid 'wait_for_cpoke_dir', (255/210)*[210 105 205]/255, ... % orchid 'wait_for_cpoke_freq', (105/255)*[210 105 205]/255, ....
53c22b322b07be2387148d4c57f1d905739d477d8e028b8d058dcc7ae80c969d
MATLAB
1,194
34
% This code will calculate the relative displacements value for the 2d glass. function out = Compute_StrainCumulative_2D(small_x,big_x,small_y,big_y) %tracks the particle between two subsequent stacks and calculates the strain filename = ['d2_af=73_10neibs_squared_']; savepath = '/media/hdd2/softness/review/final/...
5d8e30d210300c542d8f01ab299ce9379a5c25a883ff94dd60b9c304c68e1b77
MATLAB
1,194
27
% MESH_SUPPORT Calculates total area (2D) or volume (3D) of elements % connected to each node. (how much support is around a node). % % SYNTAX: % [SUPPORT] = MESH_SUPPORT(NODES,ELEMENTS,ELEMENTS_AREA) % % [SUPPORT] = MESH_SUPPORT(NODES,ELEMENTS,ELEMENTS_AREA) Sums all element % areas/volumes around a node. % ...
a9bab339d95a25786b8492f4ffd0719c06f36bae2cf459c2f4d0d599aba5b607
MATLAB
1,194
34
function result = fillInCustomStage2(rawTCI3, stage2Spec) % Used to fill in the type of stage 2 in a custom two-stage tracker. % This is a pure function. if ~isempty(stage2Spec) if iscell(stage2Spec) , stage2ConstructorArgs = stage2Spec ; result = stage2ConstructorArgs ; elseif isa(stage2Spec...
b710d815a03ff4eb021bc30caa00132db424d52bcd629f90aa3082af36af8604
MATLAB
1,194
35
function dataArray = splitPSTH(PSTH,waveforms,inputCat) uniqueCat = unique(inputCat); PSTHCell = cell(1,length(uniqueCat)); waveFormCell = cell(1,length(uniqueCat)); uniqueWhere = cell(1,length(uniqueCat)); [~,numBins] = size(PSTH); for ck = 1:length(uniqueCat) curVal = uniqueCat(ck); curLoc = find(curV...
c71808a4dc73b2bbec4c2ebb6f275f525dc1f20dcf6d8e60025f8d4b8b7a6fa2
MATLAB
1,194
42
% mtrax2fixedtrx(inmatname,outmatname) % inmatname: name of a matfile created by mtrax % outmatname: name of a matfile to save results to % results will be saved in the format returned by fixerrorsgui function mtrax2fixedtrx(inmatname,outmatname) load(inmatname); load(inmatname,'angle'); % because matlab is retarded :...
04dbb5913e1d608a3196ed1543bd4cfa29aaa7f4feb3ac6626085532910f2739
MATLAB
1,195
65
function [inF, n_r] = extend_dcm(inF,hA,hB,hC,hD,dim,sources) %%- get dimensions n=dim.n; n_u=dim.n_u; n_r = get_dims(hA,hB,hC,hD) ; sourcesDim = cellfun(@numel,{sources(2:end).out}); for i=1:sum(sourcesDim) respSource(i) = sum(i>cumsum(sourcesDim))+1 ; end %% [inFtemp] = prepare_dcm(hA,hB,hC,hD,respSource); %...
1698cc503e7e5f52313ad1fff66c8f909c32110a92123cb816d7016a945df789
MATLAB
1,195
39
% Author: Birgit Nierula % nierula@cbs.mpg.de function EEG = find_exactRpeaks(EEG, trigger_name, ecg_chanName, debug_mode) % if data was down-sampled it is necessary to search for more exact R-peaks % data needs to have an ECG channel! % BN, 06,2020 idx_ecg = find(ismember({EEG.chanlocs.labels}, ecg_chanName)); % ge...
3d69f48465e164483c8e5c9ed5e729b811d8e2620e80b7b1a21c7eb81c2b7ffa
MATLAB
1,195
33
function h_setROIProperties3(handles, flag) [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); roi = findobj(handles.imageAxes, 'Tag', 'annotationROI3', 'Selected', 'on'); if length(roi)>1 error('more than one ROI selected! this should not happen!'); elseif length(roi)==...
884136247b04124b784ebe5ea76a9a4b4f37cfbc2837daa126f5a4603a53d810
MATLAB
1,195
30
function nc_copy_file_list(fromdir, folder_prefix, file_prefix, file_suffix, todir, newprefix, insubfolder) from_folders=dir(fullfile(fromdir, [folder_prefix, '*'])); if isempty(folder_prefix) from_folders(1:2)=[]; end if exist('insubfolder', 'var') == 0 insubfolder = 1; end for i=1:length(from_folders)...
9fc0e55af8463ce81d1ed0ac8eb4dd35b1f4c9d29bf90eb9001f4f2d89a63e8d
MATLAB
1,195
32
function [SNReff,bEff,Delta] = DWSE_SNREfficiency(x,optSample,optScanner,b,~) %% % calculates DW-SE SNR Efficiency % % input: % x = array with diffusion gradient (mT/m), duration of diffusion gradient (ms) and repetition time (ms) % optSample = T1 (ms), T2 (ms) & D (um^2/ms) % optScanner = Maximum readout duratio...
1f88c59bcf0fece961c17190b491989a8b953714126355548a3d3d08067cb559
MATLAB
1,196
34
classdef (Sealed) AdjMatrixLinLatt < adjmatrix.AdjMatrix methods function this = AdjMatrixLinLatt(params, loadOnInit) % creates a complete graph (mean-field network) % % params {AdjMatrixParams}: params of the adjacency matrix % loadOnInit {boolean}: loads the...
288701239c69a8c7057065ae7edb9aa8445ac1798ceb9d0e42ebed880cbe5c8e
MATLAB
1,196
48
function u = SB_ITV(g,mu) % Split Bregman Isotropic Total Variation Denoising % % u = arg min_u 1/2||u-g||_2^2 + mu*ITV(u) % % Refs: % *Goldstein and Osher, The split Bregman method for L1 regularized problems % SIAM Journal on Imaging Sciences 2(2) 2009 % *Micchelli et al, Proximity algorithms for image models: ...
a07841e5116c74e9bb011bc875cdfeafb72260fd50250a4e0bc59e461e69701b
MATLAB
1,196
77
function [hits,task,choice,gfreq,gdir,side,nta,vecr,vecl,vechi,veclo] = ... get_trials_stim(sessions,trials,minperf,mintri,minbe) ind=find([sessions.hit]>=minperf & ... [sessions.valid]>=mintri & [sessions.good]==1 & ... ([sessions.bdir]+[sessions.bfreq])/2>=minbe); tr=trials(ind); hits={tr.hits_all}; h...
2233be9df0778b70f8afa1edecd181728cd71995a7ac5649fe8f8cf5004fd14d
MATLAB
1,197
30
% ISCUDA Determines if there is a NVidia CUDA enabled GPU in the system. % Also, checks if the compute capability is at least 3.0. % % SYNTAX: % ISCUDA % [IS] = ISCUDA % [IS, INFO] = ISCUDA % [IS, INFO, MESSAGE] = ISCUDA % % ISCUDA Returns logical true or false: % 0 - no available NVidia GPUs with ...
4484525a8dab47201251c42b1ab9e86fd7890d826c47c49f2fd9893d229228df
MATLAB
1,197
42
clear; basefolder = fileparts(fileparts(fileparts(mfilename('fullpath')))); codefolder = [basefolder,'/code']; addpath(genpath(codefolder)); config1_path = [basefolder, '/tests/fixtures/config.json']; config2_path = [basefolder, '/tests/fixtures/config2.json']; config5_path = [basefolder, '/tests/fixtures/config5.jso...
7466bb0bd9ffd96c210bc635dc100aeddbfbf8021d0bcfd3d0c225735fc13581
MATLAB
1,197
34
% pstCoincidenceHistogram calculates a psth coincidence histogram of % a given width for a JPSTH % pstCoincidenceHistogram.m % % Copyright 2008 Vanderbilt University. All rights reserved. % John Haitas, Jeremiah Cohen, and Jeff Schall % % This file is part of JPSTH Toolbox. % % JPSTH Toolbox is free software: you...
c975fc8e0b109469de65005b245b18383575efdd5092b91f51df13beb2610aa6
MATLAB
1,197
51
function [L, Lij] = discreteLogprob(arg1, X) % Compute the log probability of the data. X must be in 1:K. % [L, Lij] = discreteLogprob(model, X) or % [L, Lij] = discreteLogprob(T, X) % % model is a structure with a field T, a K-by-d stochastic matrix, %(as returned by discreteFit). % % X(i, j) is the ith case from the ...
f8ea82ab3c95293bb4634af8ccdbc34441c824b442439de342604f5aa2624745
MATLAB
1,197
45
function C = minus(A,B) %MINUS Binary subtraction for ktensor. % % C = MINUS(A,B) computes C = A - B. A and B must both be ktensors % and have the same size, and the result is another ktensor of the % same size. % % C = MINUS(A,B) is called for the syntax 'A - B' when A or B is a % ktensor. % % See also ...
0b7c1b92a7717c8244dc7327ae4bbbec879e711347140c1382dee4eceb418325
MATLAB
1,198
62
function [om3,T3,dom3dom1,dom3dT1,dom3dom2,dom3dT2,dT3dom1,dT3dT1,dT3dom2,dT3dT2] = compose_motion(om1,T1,om2,T2); % Rotations: [R1,dR1dom1] = rodrigues(om1); [R2,dR2dom2] = rodrigues(om2); R3 = R2 * R1; [dR3dR2,dR3dR1] = dAB(R2,R1); [om3,dom3dR3] = rodrigues(R3); dom3dom1 = dom3dR3 * dR3dR1 * dR1dom1; dom3dom2 =...
a9ebfe9aeef675401200917fb815d1ce8d3935a7d7247d0d45c6a2e8e2bd39a8
MATLAB
1,198
41
% slightly more robust version of matlab's waitbar function varargout = mywaitbar(varargin) if nargin >= 2 && ischar(varargin{end-1}) && ... strcmpi(varargin{end-1},'interpreter') && ... ischar(varargin{end}), interpreter = varargin{end}; leftovers = varargin(1:end-2); else interpreter = 0; l...
7880af5612f4c9430babbb75c6cfd06a9ed03bdaa459d9058e5e7bf4753bf90d
MATLAB
1,199
30
classdef dectree < handle %Decision tree data structure. properties isRegression; %0 for classification, 1 for regression. examples; %Indicies of the training examples directed to this node during fitting. features; %Indicies of all available features remaining at ...
f915aba5fbf8aab04343d498628e9e9e995009d3f7b5cd668037001c334fbedd
MATLAB
1,199
35
%% dataAtPercentile % Simple macro for establishing a cdf of the observed data, setting up %the appropriate percentile search, and returning value which is at x% of %the data amplitude %// Data should be rectified prior to percentile search if absolute %magnitude of percentile is sought % Copyright (C) 2023 T...
07da21e3fd148edb2d65bca6dbe69bee8da4918699cbca77413c3ffbb6e71331
MATLAB
1,200
46
%% % ================= EXPORT CONN CONDITION FILE ================= %% clear all; close all; clc; %% part = 1; idx=1; for s = 1%subs if s < 10 sub = strcat('P0',num2str(s)); else sub = strcat('P',num2str(s)); end dir_files = strcat('F:\SEM_mri_rawdata\', sub, '\'); ...
6244867d3934172151fa63e93da675f415f953110b046b58105c6559fa40a60d
MATLAB
1,200
50
function [locs pks]=peakseek(x,minpeakdist,minpeakh) % Alternative to the findpeaks function. This thing runs much much faster. % It really leaves findpeaks in the dust. It also can handle ties between % peaks. Findpeaks just erases both in a tie. Shame on findpeaks. % % x is a vector input (generally a timeco...
70cce2d814dabceab6505c8ea7d9aaf2bdcdf4532793e52cebc7fe148fa92098
MATLAB
1,200
43
function dgm = dgmRebuildJtree(dgm, varargin) % Rebuild the precomputed jtree after CPD params have changed % The jtree structure does not change, just the clique potentials. % This file is from pmtk3.googlecode.com % In this implementation, we start from scratch, % and ignore any existing jtree structure %{ factors...
77cb85bafb3acdf152decd543f367e53ff2ffe140e9688f410b30b14265b8352
MATLAB
1,200
54
function y = costdist (x, numstat, cdf) % function y = costdist (x, numstat {, cdf}) % % Function calculates the distribution of the cost function % Inputs: % x - the value of cost function % numstat - number of statistics being fitted by fitparam % cdf - if = 1 cumulative distribution is found; default = 0 if exi...
78767a1332c0fd4a9a9ea574af16a68d30387eba07535eece447ad37b5486383
MATLAB
1,200
38
function [fi,ind] = interpF2d(F,n,s1,s2,h) %% returns interpolated function value fi = F(s1,s2,s3) % where s1 = row index, s2 = col index, s3 = depth index %interpF(V,n,xi,xj,xk) == interp3(par.Yc,par.Xc,par.Zc,V,xj,xi,xk) if nargin < 5 h = [1,1]; end fi = zeros(length(s1),1); [n1,n2]=deal(n(1),n(2)); % conv...
c3cff33483b0303457bcdc878beb97fe50b637d409a2cddeaf9d5c956f2fce25
MATLAB
1,200
35
% fixedtrx2mtrax(inmatname,outmatname) % inmatname: name of a matfile created by fixerrorsgui % outmatname: name of a matfile to save results to % results will be saved in the format returned by mtrax function fixedtrx2mtrax(inmatname,outmatname) load(inmatname); nflies = length(trx); nframes = 0; for fly = 1:nflies, ...
039e893248d7e929a1cb53e04e8b0f30a91ec4cbfe3b9a4bad5fa9028c975e71
MATLAB
1,201
56
function [xc,yc,radius,h] = fitcircle_manual(hfig,color,ti) xc = []; yc = []; radius = []; h = []; if nargin < 1, hfig = gcf; end hold on; if nargin < 2, color = 'm'; end if nargin < 3, ti = 'Click points on circle'; end title(ti); try [x,y] = getline(hfig,'closed'); catch %#ok<CTCH> return; end if isemp...
6721610ce87a9406bc3adf4a692caae2c4b698ee1162ab0c3a3d9038395164b6
MATLAB
1,201
45
function [mask] = image_stack_adjust_nucleus(stack, name) % TODO: optimize %load parameters parameters; % number of z-slices Nz = length(stack(1,1,:)); %% ------------------------------ 3D matrix ------------------------------ tic fprintf('Contrast enhancemenet: ') % Allocate 3d matri...
6be0094391094ea1f7f18c15a0fa840cbfad7b6b043e7588298d6b3de93f2f21
MATLAB
1,201
36
function out = pointprop_gaussaperture(x,y,c1,c2,c3,x1a,y1a,dz1) % analytical solution of a point source propagating through a gaussian aperture % -> analytical solution for phase as a function position has the the same % quadratic factor, but now also has a linear slope as well offrad = sqrt(x1a.^2+y1a.^2); o...
728ab4a9910920eb8c739a2b848251df59dc7e2e68171f223423901bb0d24331
MATLAB
1,201
27
function max_run_jobs = concurrency_size_in_colorcorrection_3D_cuda(cond) loadParameters; if ~isfield(params,'COLOR_CORRECTION_MAX_RUN_JOBS') bead_downsample_imgsize_dbl = cond.downsample_imgsize_dbl * (cond.dim(3) - params.BEAD_ZSTART)/cond.dim(3); main_mem_usage = params.MATLAB_PROC_CONTEXT...