sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2d088293b39ad40c60aa43f0e6fa264289133c10b4dc68d944be3bc40e3fed56
MATLAB
616
22
function fixed_points = load_fixed_points(model) dire=[model.dire num2str(model.model_num)]; %get fixed points fixed_points.f1=readNPY(['data/' dire '/f1.npy']); fixed_points.f2=readNPY(['data/' dire '/f2.npy']); %output fixed_points.o1=fixed_points.f1*model.wO'+model.bO; fixed_points.o2=fixed_points.f2*model.wO'+mo...
db61994c768dd578fc7eecb2229bd7673c105d168623610ed917d946908c52b1
MATLAB
616
17
function t = uplus(t) %UPLUS Unary plus for ttensor. % % See also TTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under the terms of Co...
ecd013c9a333f9177af624324b901801946f1f78e96485e096d31df129f87c5a
MATLAB
616
29
%% Run Kmedoids on the old faithful data % %% % This file is from pmtk3.googlecode.com X = loadData('faithful'); X = standardizeCols(X); N = size(X,1); Y = X'; % Y(:,i) dst = sqdist(Y,Y); S = exp(-dst); K = 2; [idx,dpsim]=kmedoids(S,K,1,10); [score, bestrun] = max(dpsim(end,:)); ndx = idx(:, bestrun); centroids = uni...
00ad7318c9f7dab3c945b3ae7b7f63bc65751fedc1f5fd83f46c6cd8dfaac2dd
MATLAB
617
24
function [ values, centers,sevalues] = getNonlinearity(linearOutput, spikes, nbins, dt) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here qtStep = 1/nbins; qtEdges = 0:qtStep:1; genEdges = quantile(linearOutput, qtEdges); [a, spikebins] = histc(linearOutput,genEdges); values = ...
43e08c29eaacaac7ffcc80301acf73b5f4e6d495d5bdfc9756b3435f7f293e9c
MATLAB
617
23
function h = circle(ax,xyAll,r,matchZ,varargin) ncircles = size(xyAll,1); if isempty(varargin) c = repmat([0 0 0],ncircles,1); else c = varargin{1}; end hold(ax,'on') axis(ax,'manual') for i = 1:ncircles x = xyAll(i,1); y = xyAll(i,2); th = 0:pi/50:2*pi; xunit = r(i) * cos(th) + x; ...
4e47aa52b4bbbef749e8109ef8e4dd44965fae9203aa31923b9efc1d99241435
MATLAB
617
30
function x = normy(x) %This function performs preprocessing of input micrographs including %normalization to quantiles 2% and 98% for contrast adjustment, clipping %values outside the 0-1 range, resize to [640 448]px and add some noise. [~, ~, ext] = fileparts(x); if strcmp(ext, “.mrc”) x = double(ReadMRC(x)); else ...
658554e19b2f8e35b97a2450fc223dba3538f39e1c9a35b69a4423137706e96a
MATLAB
617
25
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef LedColor < uint16 %LEDCOLOR Color of a Stimulating LED enumeration % None: Indicates that a color hasn't been assigned yet. None(uint16(0)), % None: Indicates t...
a89f919b0035a0b8ab2776f726210310b38a97d3d56c254d0ee1f1fd5ca8a819
MATLAB
617
32
function dgm = dgmClampCpds(dgm, clamped) %% clamp unadjustable cpds prior to e.g. learning % removes precomputed jtree if any % This file is from pmtk3.googlecode.com if ~any(clamped) return; end CPDs = dgm.CPDs; eqc = computeEquivClasses(dgm.CPDpointers); for i = 1:numel(CPDs) eclass = eqc{i}; if clam...
ad392bff4fc7a6d11221cfcc65a49082657af85601ae608cbc46e808f1a24b50
MATLAB
617
18
function Z = xor(X,Y) %XOR Logical EXCLUSIVE OR for tensors. % % See also TENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under the ter...
e1e8945a5fa5f36e75d65cfdc0c93e6bd3185d0184e2164985f9315232f55ad4
MATLAB
617
27
function [xout,yout] = normfig2coords(x,y,h) if ~exist('h','var') h = gca; end if ~strcmpi(get(h,'type'),'axes'), error('Handle must correspond to an axis'); end xax = get(h,'xlim'); yax = get(h,'ylim'); pos = get(h,'position'); yisreversed = strcmpi(get(h,'ydir'),'reverse'); xisreversed = strcmpi(get(h,'xdir'...
72d11e9bf4b8cb3cd649cb135a5ee0eac4207084fa4c876f2bd4303296fe674b
MATLAB
618
27
function [ M ] = mbz_cly_mask(sz, s, h, c, r, g) %mbz_cly_mask Generates a cylindric mask for membrane subvolumes whose % membrane is on plane XY % sz: subvolume size (all parameters are in voxels) % s: starting Z axis point for the cylinder % h: cylinder heigh in Z axis % c: cylinder cente...
0f267f907df0dfaf15aa9f5173cedd6cba7056cbea19fcad5b57e590fbb6ebe3
MATLAB
619
19
function h_removeFromCurrentGroup3(handles, filename) global h_img3; [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); [pname,fname,fExt] = fileparts(filename); groupFileNames = {currentStruct.activeGroup.groupFiles.fname}; I = ismember(groupFileNames, [fname, fExt]); ...
b2384bd9ac34df3ec93cd9d6b1f943999e781d91078aa7e83c614c7e5e4633ee
MATLAB
619
18
function Z = ge(X,Y) %GE Greater than or equal (>=) for tensors. % % See also TENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under the ...
bd9ae2470575dff9f3b89f527c4e15d277ee35f6f0fbd84131cf0b0461e6800b
MATLAB
619
26
function out=normalExpGammaNeglogpdfDeriv(z,shape,scale) % Derivative of normal exponential gamma negative logpdf function % gamma^2 = c = scale % This file is from pmtk3.googlecode.com lambda = shape; gamma = sqrt(scale); %warning off out=(lambda+0.5)/gamma... .*paracyl(-2*(lambda+1),abs(z)/gamma)... ./p...
13be191e0d5ca9a2757acca2157db5c2d13208f5c1d5f31d502a0067e10d4ccc
MATLAB
620
23
function h = filledCircle(ax,xyAll,r,matchZ,stim,varargin) ncircles = size(xyAll,1); if isempty(varargin) c = repmat([0 0 0],ncircles,1); else c = varargin{1}; end hold(ax,'on') axis(ax,'manual') for i = 1:ncircles x = xyAll(i,1); y = xyAll(i,2); th = 0:pi/50:2*pi; xunit = r(i) * co...
4a62cfe63dab44aef33cad1dde8fb2dd550404b957948e90a93636bd981a97c7
MATLAB
620
14
function inside = findInsideVoxels(X,Y,Z,filename,A,v) if ~isequal(size(A),[3 3]) error('The multiplication matrix A (argument 5) must have dimensions 3x3. If you don''t want any scaling, rotation or mirroring, you can input the identity matrix, eye(3).'); end if numel(v) ~= 3 error('The translation vector v (argum...
bb9979608edaf74f1581337c5c62632020084fbf634a22b1e7a80b7299724e90
MATLAB
620
18
% List of open inputs % CAT12: Segmentation: Volumes - cfg_files % Written by Nanbo Sun and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md addpath(spm_dir) nrun = 1; % enter the number of runs here jobfile = {[script_dir '/CBIG_MMLDA_segment_new_template_job.m']}; jobs = repmat(job...
e06bb8f9d23cb1c7fc606516ef635bb8598128e0fdf3bc4ddd1e1bdeadcdafb7
MATLAB
620
18
function display(t) %DISPLAY Command window display of a tenmat. % % See also TENMAT. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under the ...
f8166e7365ad45b07a6021eeb676c78d85c8a80649189d553d0a80bb729f36c4
MATLAB
620
22
%% MC Quantile Demo % %% % This file is from pmtk3.googlecode.com mu = 0; sigma = 1; % standard normal S = 1000; % number of samples setSeed(1); % set the seed for the random number generator xs = gaussSample(mu, sigma, S); % sample from a Gaussian qs = [0.025 0.5 0.975]; % desired quantiles qexact = gaussinv(qs, mu,...
fa239110f058dbd74aed8f6c35cbad1bfa0b9c2791b1a4efa18e535a0f6d1759
MATLAB
620
19
function t = uplus(t) %UPLUS Unary plus (+) for tenmat. % % See also TENMAT. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under the terms of ...
08682f9c2dc49bfc3674fce232f116888c04c7201cd28ce358c26a1e8f3fb4f9
MATLAB
621
18
function B = not(A) %NOT Logical NOT (~) for tensors. % % See also TENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under the terms of Co...
0e2f151ee2b652bf1ac3105565fa895a82cb993c867db0911713b8e76004ddeb
MATLAB
621
24
function enum = enumerate(strings) % Create an inverted map from strings to their index values in a list % % If any string is not a valid field name, it is made valid using % genvarname(), therefore it is good practice to index into enum with % enum.(genvarname(name)). % % EXAMPLE: % % enum = enumerate({'alpha','beta',...
13c904ce5ab162c486b53af26fa4d6b6273c2e606f70c34fc2ebc04e6c7614ab
MATLAB
621
19
function t = uplus(t) %UPLUS Unary plus for a ktensor. % % See also KTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under the terms of...
2666185ee3b4fcf45ceb6c8286512481909f2b4dae62f83e3fa58ee3ea1f6888
MATLAB
621
17
% Slice sampling in 1d % From http://www.mathworks.com/help/toolbox/stats/slicesample.html requireStatsToolbox(); setSeed(0); f = @(x) exp( -x.^2/2).*(1+(sin(3*x)).^2).* ... (1+(cos(5*x).^2)); x = slicesample(1,2000,'pdf',f,'thin',5,'burnin',1000); hist(x,50) set(get(gca,'child'),'facecolor',[0.8 .8 1]); ...
399e0f26119b7efe065eac258b8de5e44342295a3a57b6fb78758f5db7f3e9a4
MATLAB
621
40
function plot_error(x,D,E,C,A) % <°LAN)<] toolbox % v.0.1 % % Plot line graphic with error areas % x : X eje, a vector % D : Data, a vector % E : Error a vector % C : Color a charecter e.g. 'blue' % A : Trasparency, a scalar e.g. 0.4 % % % Pablo Billeke % 07.01.2015 % alpha for transpare...
81aa37e377be42f1930de74315241b7cef43ac34760ec892ea648951321e56ef
MATLAB
621
29
function [data, labels] = make2dData(ndata, Nclasses) % Generate mixture of 2-3 Gaussians in two dimensional space % Based on dem2data from netlab % This file is from pmtk3.googlecode.com data = randn(ndata, 2); % Cluster centres c = [2.0, 3.5; 0.0, 0.0; 0.0, 2.0]; % Cluster standard deviations sd = 1*[1 1 1]; ...
8359431e1678f8450084c5bfaa512e16d5b5c8011f84fc2fce38596791e740c7
MATLAB
621
19
function t = uplus(t) %UPLUS Unary plus (+) for tensors. % % See also TENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under the terms of...
8df47de213187a63c8fb184870121380d17edab440b8b23798b9b7470c604e32
MATLAB
621
20
function [tf,p,occ,ts] = isLabeledPerPtFT(s,frm,itgt) % [tf,p,occ,ts] = isLabeledPerPtFT(s,frm,itgt) % Added by KB 20220202, similar to isLabeledFT % tf(i) indicates whether landmark i is labeled. % p, occ, ts returned are the landmarks locations, occluded labels, % and timestamps i = find(s.frm==frm & s.t...
9545133a8eefa8982f4911da4293c15d348645bb10fd52b2aa333341d763325d
MATLAB
621
17
function display(t) %DISPLAY Command window display of a ttensor. % % See also TTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under th...
d83169aac6136faa942fc164b752f8a18334e1343106f91acde5c388dad7c9c1
MATLAB
621
27
%% Plot Inverse Gamma Distributions % %% % This file is from pmtk3.googlecode.com as = [1 1.5 2]; b = 1; bs = b*ones(1,length(as)); figure; [styles, colors, symbols] = plotColors; legendStr = cell(1, length(as)); for i=1:length(as) a = as(i); b = bs(i); xs = linspace(0.1, 7, 200); model.a = a; model...
d8662d1bb32339d851b017c5abf9afcc38e72c67241456f763f8423b51985b3a
MATLAB
621
22
function [p]=exclude_subj(p,excluding_subj) if isempty(excluding_subj) for ss=1:length(p.subj.include) p.subj.include(ss)=true; end else for ss=1:length(excluding_subj) tmp_index = strmatch(excluding_subj{ss},p.subj.ID); if ~isempty(tmp_index) ...
f8e0605577e5c44fc8b227813583ab9e00e20f53900630f531a09e602538a76b
MATLAB
621
23
function s = createStruct(names, values) %% Create a struct from two separate lists: names, and values. % Usually to create a struct you have to interleave the names and values % as in struct('name1',val1,'name2',val2,...) - here you can pass in the % names and values as two cell arrays. If values is not specified, it ...
6d748ed701f4e706f9d1a5e9efa4bce327f9ac3685d04d6f0bf89916d5018520
MATLAB
622
32
function [w, b] = perceptronFit(X, y) %% Classic perceptron algorithm % X(i,:) for case i % y(i) = -1 or +1 %PMTKauthor Thomas Hoffman % This file is from pmtk3.googlecode.com labels = y; features = X'; [n d] = size(X); w = zeros(d,1); b = zeros(1,1); max_iter = 100; for iter=1:max_iter errors = 0; for i=1:...
8f92d03e4cbd6f99a58e04ea36af8d6bacf5c254b3a132f87e3ff87958f4e23c
MATLAB
622
19
function t = uplus(t) %UPLUS Unary plus (+) for sptenmat. % % See also TENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under the terms o...
9db0278637a139cacce2f14bc1c4f8ff22af2b371f6a830e4c28db75d1770dd8
MATLAB
622
20
function [logp] = mixGaussLogprob(varargin) % logp = mixGaussLogprob(model, X) % or % logp = mixGaussLogprob(mu, Sigma, mixWeight, X) % % logp(i) = log p(X(i,:) | mu(:, i), Sigma(:, :, i), mixWeight(i)) % This file is from pmtk3.googlecode.com if nargin == 2 model = varargin{1}; X = varargin{2}; else mu = vara...
a9c37a3e82159da8dfad76a87cb1746d32b96724ab2b30763d07a24355c06a7f
MATLAB
622
18
function n = nnz(x) %NNZ Number of nonzeros for tensors. % % See also TENSOR, SPTENSOR/NNZ. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Und...
c6aa703346bd7f8b050ac77e8ebdeaef38a6aa2efca421a0b8763517d46a8043
MATLAB
622
23
function result = fastLinearInterp(inputGrids,image,ss) image = single(image); imageInterp = zeros(size(image,1)*ss,size(image,2)*ss,'single'); % divSum = ones(size(image,1)*ss,size(image,2)*ss,'single'); imageInterp(1:2:end,1:2:end) = image; % % interpolate colums; imageInterp(1:2:end,2:2:end) = imageIn...
f4658cf111c0ae92c1094516d074ff69c9edb6423f846bdd0f6577efd4edc545
MATLAB
622
21
function z = zipmats(varargin) % Zip up multiple numeric vectors into one cell array % Takes in an arbitrary number, K, of numeric vectors, v1, v2,...vj,...,vk % all of the same size, N-by-1, (or 1-by-N) and returns a cell array z, % such that z{i}(j) = vj(i) for all i in 1:N and all j in 1:K. % % Example: % z = zipmat...
1495af6ed1f76be7fcb2428fecce976806c73a130c219907cbd37d25c4416375
MATLAB
623
19
function CBIG_KRDNN_KR_TVT_example() % CBIG_KRDNN_KR_TVT_example() % % This function is the example function of the kernel ridge regression % algorithm with normal training, validation and testing. % % Written by Tong He and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md % add ...
1711e5c8927f4a77865e69dfc04030f4888228653b3b676ae180f92e9051a4b8
MATLAB
623
20
function A = Afun_lap_te(i,j,x,nu,area,P,S,contrast,wuse) % AFUN(I,J) computes entries of the matrix A to be factorized at the % index sets I and J. This handles the near-field correction. if isempty(i) || isempty(j) A = zeros(length(i),length(j)); return end [I,J] = ndgrid(i,j); A = 2*bsxfun(@times,lap_neumann_k...
632ad364d0120e16690a54e8d13242ca2f70f426a9873730fdb896ab259ab33a
MATLAB
623
35
%% Load the data %CAN DELETE THIS FILE load('registration_allkeys_round001.mat') %% bigExpParams; %% ROUND=1; numTiles = prod(bigparams.EXPERIMENT_TILESIZE); %Take an estimate size pos = zeros(numTiles*1000,2); running_ctr = 1; for F = 1:numTiles keys = keys_all{F,ROUND}; if length(keys)==0 ...
66179dfb953e27b5ad2c65a6fb69c5a150c33badbee8c7ed1dc13c348b226b64
MATLAB
623
28
function [tffound,iMov,frm,iTgt,xyLbl,mints] = findEarliestLabeledFrameFromLabels(labels) % Look only in labeledposGTaware, and look for the earliest labeled % frame. tffound = false; mints = inf; for jmov = 1:numel(labels) s = labels{jmov}; [mintscurr,i] = min( min(s.ts,[],1) ); if mi...
7167dd867219d605d29e03366ee67d5e0f01dc4591487043a74214b89a762985
MATLAB
623
21
function val = essential_costE2cost(X, costE) % Cost evaluation at X given function handle in the Essential matrix E. % % function val = essential_costE2cost(X, costE) % % costE is the function handle for the cost function in E. % % See also: essential_egradE2egrad essential_ehessE2ehess % This file is part o...
a4f29712329728af49b17de14d52b3ef403f52e221215e831e21737b11ec9c45
MATLAB
623
31
function data = create_stim(R, gamma_dir, gamma_freq, T, res, ntrials) % rates of Poisson events on left and right rrate = R/(exp(-gamma_dir)+1); lrate = R - rrate; % rates of Poisson events on left and right hirate = R/(exp(-gamma_freq)+1); lorate = R - hirate; frac_hi=hirate./(hirate+lorate); frac_lo=1-frac_h...
af029555dd928194ad7db2e2098e617f058085f09c409ec911e9d4923deac93c
MATLAB
623
15
function setup = StateSwitch_settingsTask(setup) % settings for task eeg setup.DEBUG = 0; setup.opacity = .4; setup.keyB = 1; setup.ET.useET = 1; setup.EEG.useEEG = 1; setup.EEG.DIO.parallelTrigger ...
e4acba98e93a76494d74cd7e6875ccebec369e991ac972af4d016a44bb6db3bf
MATLAB
623
29
function [lintrafo, clab_electrodes,chaninds,myinds]=clabstandard2clab(clab_act,clab); %load clab_standard nchan_act=length(clab_act); nchan=length(clab); %lintrafo=zeros(nchan_act,nchan); %clab_electrodes=clab_act; %chaninds=zeros(nchan_act,1); ii=0; for i=1:nchan_act kont=0; for j=1:nchan; if strcmp(clab...
0a45057b996a8ed62194d0b7234c6ac134f4f35ceba55ca59b74f6a2ef3a60ba
MATLAB
624
19
function t = uplus(t) %UPLUS Unary plus (+) for sptensor. % % See also SPTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporation. Under the terms...
462d8913cb78b3a2507de81e08fe150287ecc4d98e187cfc146a173d602e529c
MATLAB
624
19
% Copyright Christopher Fricke, University Leipzig Medical Center, % Neurology 2024 srcf = 'data\raw'; tgtf = 'data\prep\coreg_indiv'; d = dir(srcf); mkdir(fullfile(tgtf,'ct')); mkdir(fullfile(tgtf,'datscan_tf')); for i = 3:length(d) disp(d(i).name); if ((d(i).isdir) && (d(i).name(1) == 'P')) ...
4b6c39bbbbc597c14bf6a15d488cf10d9550bc263b165c8e0796842befb68d01
MATLAB
624
29
function figclosekey(h, key) %FIGCLOSEKEY Add a hotkey for closing the figure. % Usage: % figclosekey(h, key) % % Args: % h: figure handle (default: gcf) % key: hotkey to use (default: 'q') % % See also: event, addlistener if nargin < 2 || isempty(key); key = 'q'; end if nargin == 1 && ischar(h); [h,key] = swa...
52cdf2be7a61f4c8207d889f645c2c1e9891f12c1ed6ec4897eb361d2b37c0cb
MATLAB
624
20
function excludeList = getExcludeList(animalprefix) % excludeList = decode.getExcludeList(animalprefix); % % List of interneurons (from Wenbo's code for Shin et al., 2019) if strcmp(animalprefix,'ER1') excludeList = [1,1;1,2]; elseif strcmp(animalprefix,'KL8') excludeList = []; elseif strcmp(animalprefix,'JS14...
573c7d6eb3be42262ccc20ece48d0c1506a23e6f2d77341d0e6b563cacebd53f
MATLAB
624
26
function Qdec2 = rmQdecCol(Qdec1,col) % Qdec2 = rmQdecCol(Qdec1,col) % % Removes the specify column from cell string array Qdec1. % % Input % Qdec1: Two dimensional cell string array of Qdec data (eg. read with % fReadQdec). % col: Column to be removed. % % Output % Qdec2: Two dimensional cell string array of Qdec da...
6868ebb1096c2d4337fafdece39c9d17ab23ba9fce77632dcb66230ef90ecc42
MATLAB
624
26
function Y = num2strs( X, varargin ) % Applies num2str to each element of an array X. % % USAGE % Y = num2strs( X, [varargin] ) % % INPUTS % X - array of number to convert to strings % varargin - [] additional input to num2str % % OUTPUTS % Y - cell array of strings % % EXAMPLE % Y = num2str...
25c5774b10a8c8f322f3c6603b916f6707dff2e925a29ba034b1f50d593eec4d
MATLAB
625
25
function s = mergeviews(sarr) % sarr: array of Label structures if isscalar(sarr) s = sarr; return; end assert(isequal(sarr.npts),'npts must be equal across views.'); assert(isequal(sarr.frm),'frames must be equal across views.'); assert(isequal(sarr.tgt),'targets must be equal across views.'); ...
620de261e1022fe572e4b07e2e5fe0f62b071d4e122d520929da41ccf1df89d0
MATLAB
625
23
function tr = multitrace(A) % Computes the traces of the 2D slices in a 3D matrix. % % function tr = multitrace(A) % % For a 3-dimensional matrix A of size n-by-n-by-N, returns a column vector % tr of length N such that tr(k) = trace(A(:, :, k)); % % See also: multiprod multitransp multiscale % This file is...
736cd778cca1f5562a68859b0679942447ee9df07cdecaeb8d231e156b19e361
MATLAB
625
24
function [x2,y2] = xformShiftAndRot(x,y,x0,y0,th) % Affine xformation with shift and rotation % % Read coords in a new coord sys that is centered at x0,y0 and rotated at % th relative to original % % x/y: arbitrary arrays of x/y coords (same size, eg outputs of meshgrid) % x0/y0: center of new coord system % th: orient...
a135f4fc8fee36890a9cc249798d7e1e1d03ca5e4c33bf1535eabcb15a0bab59
MATLAB
625
31
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % resets crabsort to default state function reset(self,wipe_all) if self.verbosity > 5 disp(['[...
a5592bc5e6025da2fe615524f34ce990a9461cf8bcddf7700354ef3d147a13d7
MATLAB
625
18
% Add Manopt to the path to make all manopt components available. % This file is part of Manopt: www.manopt.org. % Original author: Nicolas Boumal, Jan. 3, 2013. % Contributors: % Change log: % Aug. 7, 2013 (NB): Changed to work without the import command % (new structure of the toolb...
d1e4463e824ca35113117b183af0106149573f47716126a6f2cfe02fa0c7db48
MATLAB
625
18
function [pos] = moveinward(pos, move) %This functions moves 'pos' inward according to their normals by 'move' %units propos = elproj(pos); % projection to 2D tri = delaunay(propos); %creates delaunay triangulation of 2D plane, which will be used for the the 3D case nor = normals(pos,tri); %compute normals of surface o...
48bf42199a6f3e3fb5a44bbfcc8b4a4d6b88d666c8b62d825b3a5c457ca17c38
MATLAB
626
31
function imout = wInvPCA(im0,w,Cclr0,means); [Nx,Ny,Nclr] = size(im0); im = reshape(im0,Ny*Nx,Nclr); wFull = w; w = w/sum(w); sqw = sqrt(w); undow = zeros(size(w)); undow(sqw>0.0001) = 1./sqw(sqw>0.0001); for icol = 1:Nclr tmpmean = wmean2(im(:,icol),w); tmpim(:,icol) = (im(:,icol) - tmpmean).*sqw; end %tm...
52b96e046f262b38c68c31fa02e8549c9b03b944815214220be048621fe471b7
MATLAB
626
27
function extras = read_extras(fname) % Read extra bits of information %_______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id$ extras = struct; [pth,nam,ext] = fileparts(fname); switch ext case {'.hdr','.img','.nii'} mname = ful...
5982a57cb44d7c668add8bede761c3a49d4c683df8de5c4d02bc1021db3611af
MATLAB
626
21
function div = CBIG_KLdiv_sym(prob1, prob2) % Symmetric KL divergence, also called Jensen-Shannon divergence. % % div = CBIG_KLdiv_sym(prob1, prob2) % Input: % prob1: 1st probability, Nx1 vector % prob2: 2nd probability, Nx1 vector % Output: % div : symmetric KL divergence % % Written by CBIG under MIT licen...
c8081ead44b73223c1cf2ff26b379cbd6d00cc31d8221fc767008fe5e1f6e46d
MATLAB
626
23
function model = svmlibLinearFit(X, y, C, ignore1, ignore2, options) % PMTK interface to svm liblinear % Supports only classification with a linear kernel. % Download liblinear from % http://www.csie.ntu.edu.tw/~cjlin/liblinear/#download % This file is from pmtk3.googlecode.com y = colvec(y); if nargin < 6 if n...
3458c4b135ac5d5ea27bb89f7eeeacd9b31f43ed3622ee77ad72404740b2c76c
MATLAB
627
24
% this class takes a 0 Mg ORCHID recording and gets all the images that light pulses appear on function [light_images] = getLightPulsesORCHID0Mg (puff, camera, npulses) numdps = size (puff, 1); light_images = zeros (npulses, 2); on_stim = false; light_num = 1; for i = 1:numdps if puff(i) > 1 && on_stim == fals...
93667bdace8bb720527fee4352a48164adc73d7cb9839be363bf07fc9e940c7e
MATLAB
627
28
function T = timelan(LAN,type) % v.0.3 if nargin == 1 if isfield(LAN,'pnts') type = 'data'; else type='ERP'; end end switch type case {'data', 'd', 'Data', 'D'} if isfield(LAN,'accept') f = find(LAN.accept,1); else f=1; end T = lin...
a1d747ee1be2a9ea9c4b48330cb890ec1c894fd429b25c9c7bdb609dee3a4496
MATLAB
627
21
%% Apply L2 Logistic Regression to the XOR problem in original feature %% space % We show that the data is not linearly separable % See logregXorDemo for a solution to this problem % This file is from pmtk3.googlecode.com function logregXorLinearDemo() [X, y] = createXORdata(); lambda = 1e-2; % for numerical stabili...
aa6799facdcd6729b4e5a54b68962a04f2ecfe8dab7990fc1e38ced06e3b2955
MATLAB
627
26
function [pID,pN] = FDR(p,q) % FORMAT [pID,pN] = FDR(p,q) % % p - vector of p-values % q - False Discovery Rate level % % pID - p-value threshold based on independence or positive dependence % pN - Nonparametric p-value threshold %______________________________________________________________________________ % $I...
e36205d3bdabc2ccfd735696507b84c76b1044d4d1b991922e59129c245ffd03
MATLAB
627
30
function indices = partitionData(data, pc) % Partition a vector of data into sets of different sizes % function indices = partitionData(data, pc) % % Example: % indices =partitionData(1:105,[0.3,0.2,0.5]) % a= 1:31, b=32:52, c=53:105 (last bin gets all the left over) % This file is from pmtk3.googlecode.com Npart...
32726014b3b4b5b312beff53980adabe1307f8951b46f08295398f57b539dd34
MATLAB
628
16
function outputPatterns = utils_HighPassBetweenRuns( inputPatterns, TR, cutoffTime ) % (c) Megan deBettencourt 07/2011, Coraline Rinn Iordan 06/2018 % Inputs: % - inputPatterns: patterns matrix [time x voxels] % - TR: sampling rate [sec] % - cutoffTime: filter cutoff [sec] % % Outputs: % - output...
32add512d1c829110b58ffabb6c2ca4c9e4b188b2a6d5cdf6a4e9f62e789faba
MATLAB
628
24
function result = splitVector(vector) % result = utils.splitVector(vector); % % Given a vector, produce all possible combinatinations of ways to split % the elements into two vectors of equal length n = length(vector); if mod(n, 2) ~= 0 || n == 0 error('Input vector must have even length and cannot be empty.'); e...
66c91fab6cca83139da1dc2e910afd229101cd530bbf2f8c4a5891eba03604f7
MATLAB
628
28
function J = kjetsmooth(m) % almost the same as JET, except the first color is black, last color is % white if nargin < 1 m = size(get(gcf,'colormap'),1); end mend = max(1,round(m/10)); m = m - 2*mend; n = ceil(m/4); u = [(1:1:n)/n ones(1,n-1) (n:-1:1)/n]'; g = ceil(n/2) - (mod(m,4)==1) + (1:length(u))'; r = g + ...
f88b91e641a96297a45085a0051a0b1a62b8e456a172fa2f1fcfa5aeb67c7cca
MATLAB
628
22
function T = unSandwich(str, leftMarker, rightMarker) %% Like tokenize, but extracts text between 'sandwiching' markers % %% Output % meat - a (possibly empty) cell array of the unsandwiched tokens %% Example % % meat = unSandwich('please see <mywebsite.html> or <wikipedia.org> for details.', '<', '>') % % meat = ...
706b7da2cd0530d3c1d91e1d912aa5b57c3ce58a685cda6cc41f0ee00a6470b4
MATLAB
629
30
function A=merge(D,direction) % this function merge multicell matrix to one matrix % % direction:direction ==1 ?? direction ==2 -> (default=1) % % % HORIKAWA tomoyasu 09/09/03 % modified by tomoyasu horikawa 090917; direction was inversed len=numel(D); if len == 0; A = []; else A=D{1}; if exist...
7097188f70adb69e71db2e61078344ff457d8df40794058473303ce01c259ca9
MATLAB
629
23
function new_str = get_new_string(str, strings, format) %GET_NEW_STRING Returns a new string that does not exist in a provided list by incrementing a number. % Usage: % new_str = get_new_string(str, strings) % new_str = get_new_string(str, strings, format) % % Args: % str: starting string % strings: array of s...
cff05825f6f970273c50d462d8a96b8fa654ae16e8dcb54d99b56448b4c213ee
MATLAB
629
24
function [NNidx,Tidx,TNidx]=IM2idx(IM) % % This function provides indexing into module pairs for fast reference based % on the IM structure of a grouped network. Nroi=length(IM.key); Nnets=max(IM.key(:,2)); Tidx=find(tril(ones(Nroi),-1)==1); TNidx=find(tril(ones(Nnets),0)==1);% Lower triangle w main diag for NN-pairs...
002161ceb32ae8e8226a71dbc176d404e82dc85cee36e52fda88410f480b2e65
MATLAB
630
35
% load ../data/sigSL_allSessions_Ariel.mat load ../data/sigSL_allSessions_Ariel_230522.mat S = sigSL_Ariel; S.MinI_minus_C = S.MinI - S.MinC; session = S.session; times = S.t; dt = times(2) - times(1); choice = S.choice; RT = S.rt/1000; coh = S.sig_coh; % str = {'MinC', % 'MinI', % 'PC1', % 'TinC', % ...
6ba6f7650f87d78b6a3cc7d1a9cff42a7caecb166f485c5aa93ef8a2ecb05cfa
MATLAB
630
23
function fx = f_OpLearn( x,P,u,in ) % re-directs VB updates to the previously chosen action % IN: % - x : 1st and 2nd order moments of the action-dependent beliefs % - P : observer's prior parameters % - u_t : previous action and feedback % - in : [] a = u(1);%+1; % action that was chosen on the previous trial r = u(...
8fb60d14cc610e8a789ce1a55a68f8a380e44c662e22d65c730bef72d9e9f68f
MATLAB
630
20
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % To extend the signal to reach the nb of extended channels (1000 in Negro 2016, % can be higher to improve the decomposition) % Input: % eY: row-wise emg signal % exfactor: extension factor % Output: % esample: extended signal %%%%%%%%%%%...
eaaa70e9450626e20b7c214bab7e6247188078c71da91fd8aa320e55c6900e59
MATLAB
630
33
%{ _ _ ___ _ __ __ _| |__ ___ ___ _ __| |_ / __| '__/ _` | '_ \/ __|/ _ \| '__| __| | (__| | | (_| | |_) \__ \ (_) | | | |_ \___|_| \__,_|_.__/|___/\___/|_| \__| ### say **Syntax** ``` say(self,msg) ``` **Description** U...
4ac76ffa15766362deca3bdc2afe3ed125f7389a3c4f05f666950983e4242b00
MATLAB
631
23
function fevalDistrDisk( funNm, jobDir, jobId ) % Helper for fevalDistr (do no call directly). % % USAGE % fevalDistrDisk( funNm, jobDir, jobId ) % % INPUTS % % OUTPUTS % % EXAMPLE % % See also fevalDistr % % Piotr's Computer Vision Matlab Toolbox Version 3.02 % Copyright 2014 Piotr Dollar. [pdollar-at-gmail.com...
5607966b8e5e0722139f0412abd15e36c87e0cdf69005866eb723b40340ec970
MATLAB
631
20
function img_filtered = dog_filter_graphics(img) %returns dog filtered img %% DoG signal enhancement/filter tic FILTER_SIZE_XY = 6; % for [fxf] filter FILTER_SIZE_Z = 6; STDXY1 = 3;%4 STDXY2 = 4;%5 % btw, spots are black not white if std1 > std2 STDZ1 = 3; STDZ2 = 4; % 3d DoG Gaussian filters gauss1 =...
bcbb1b4c9c2024e616690b9e965b30c21cdade99e51fc64fe8caad34636838c9
MATLAB
631
20
Q = load('~/bransonlab/PoseTF/janLegTracking/35exps@20160421.lbl','-mat'); expdirs = {}; pts = []; expidx = []; ts = []; for ndx = 1:numel(Q.movieFilesAll) expdirs{ndx} = ['/groups/branson/bransonlab/mayank/PoseEstimationData/JanLegTracking/' Q.movieFilesAll{ndx}(13:end)]; lts = find(~any(any(isnan(Q.labeledpos{ndx...
f95838a206da7ecb892cd1227e7c7745363daf294213681a4b30047d12171949
MATLAB
631
27
function Y = localEv2HmmObs(localev) %% Convert data in localev format to hmm obs format % The hmm format is an nobs-by-1 cell array of d-by-T(j) observations % The localev format is a matrix of size nobs-by-d-max(T) potentially padded % with nans. % % See also hmmObs2LocalEv %% % This file is from pmtk3.googlecode.co...
44906daf4e9e92fef4926ad9b4a3bfb39d76ff0faff9467493589e5a3902dd9f
MATLAB
632
24
function [p,b,c,CS]=McNemar_fast(d1,bk) % % This function is optimized to run McNemar on 2 sets of data that are % already binarized. The bk array contains bookkeeping information to keep % track of functional networks. Npairs=length(bk); for j=1:Npairs b(j)=sum((d1(bk{j,1},1)).*(~d1(bk{j,1},2))); c(j...
786b89a0890ea4efe9be2e48a7cadc6a97d844e92b2ea4077c578e844dc6139a
MATLAB
632
29
function prediction = rbmPredict(m, testdata) % Use RBM to predict discrete labels % INPUTS: % testdata(n,d) in [0,1] % OUTPUTS % prediction(n) in {1..C} % This file is from pmtk3.googlecode.com numclasses= size(m.Wc, 1); numcases= size(testdata, 1); F= zeros(numcases, numclasses); %set every class bit in turn a...
bac4c188dc2cc9c787c5b980866439fb30e01c463f47e10d4ddc2d4c0a165e7c
MATLAB
632
13
function [project_file_path, replace_path] = localize_test_project_path(linux_project_file_path) % Map a Linux-style test project path to the local platform's path, % and return the corresponding replace_path for projLoad. On Linux % the path passes through unchanged and replace_path is empty. On % Windows, /...
bd928bd5fa5ffb170dde6aee112a1fe65b6ba130d38e1cd0c3f01f2fffa6a33b
MATLAB
632
40
% M = setdiag(M,v,[k]) % sets diagonal k of square matrix M to v % by default, k = 0 % % examples: % >> setdiag(rand(2),inf) % % ans = % % Inf 0.0746 % 0.5355 Inf % % >> setdiag(rand(2),inf,1) % % ans = % % 0.6837 Inf % 0.3338 0.9480 % >> setdiag(rand(3),[1,2,3]) % % ans = % % ...
e7efb473bff763e81d461ce870a1abf145506c806b01cbaca5ba87a6611e51c2
MATLAB
632
24
function [y] = buffer_variance(data,frame,overlap,type) % [y] = buffer_variance(data,frame,overlap,type) % input data: input vector of data % frame: frame size (scalar value) % overlap: overlap size between frames (scalar value) % type: i.e. std, mean, median, ... if nargin<4 ...
2421a25dceb6069db26b70d5290554d1441ac7b3dcc2692ac06b16e8d3d8fe7b
MATLAB
633
28
function [x0,y0,f,g]=line_exp2par_2d ( x1, y1, x2, y2) % !! LINE_EXP2PAR_2D converts a line from explicit to parametric form in 2D. % ! Formula: % ! The explicit form of a line in 2D is: % ! (X1,Y1), (X2,Y2). % ! The parametric form of a line in 2D is: % ! X = X0 + F * T % ! Y = Y0 + G * T x0 ...
42538d7c662b24ccf2199f421b767c49dac3679daf4e01a865a336264d56b9e5
MATLAB
633
26
% Process the data from http://www.stat.psu.edu/resources/bydata.htm % requires matlab 7 % Save first 2 features (height, weight) in csv format. % Delete data which is missing values (3 cases) fid = fopen('biometric_data.txt'); rawdata = textscan(fid,'%d%n%n%n%n%n%n%n%n',... 'headerlines', 1,... 'delimiter',...
43a83d7a534d0b3a67b0c64ba7ecd0805a70517c21fab92bc46c8dc961833b95
MATLAB
633
32
function evcount = wlAux_getMatrixEventCount(evmatrix) % function evcount = wlAux_getMatrixEventCount(evmatrix) % % This function returns the number of events in a matrix, across all bands, % trials, and channels. % % "evmatrix" is an event matrix, per EVMATRIX.txt. % % "evcount" is the total number of events recorded...
b1e96748d40445ef3bcf41f4630c2a7abd0fb4a6d022b44d4199ba14c0773db0
MATLAB
633
15
function color_array = ColorGradient(color1, color2, num_outputs) % function ColorGradient(color1, color2, num_outputs) % Takes any 2 colors and interpolates between them at the desired number of intervals % Color1 or color2 must be [1,3] in size but can be normalized (0-1) or standard (0-255) % If num_...
f44732d5dbeb771e843a4fe5388fcdeff84f8d8ff5bc5385a9b32cb64e29f2e1
MATLAB
633
18
function s = sum_cells(C,entries) % sum all cells in cell arrays... all cells must be the same size % numel(entries) == numel(C) % if entries is specified, % if entries is logical vector, then sum only those entries of C where entries is true % if entries is numeric vector, then sum only those indices of C contai...
de3c91c52d02716971620f8a7c32f59e9f220c9e90efdb0b2b8fbc03038c7f3b
MATLAB
634
22
function labels = loadMNISTLabels(filename) %loadMNISTLabels returns a [number of MNIST images]x1 matrix containing %the labels for the MNIST images % % http://yann.lecun.com/exdb/mnist/ fp = fopen(filename, 'rb'); assert(fp ~= -1, ['Could not open ', filename, '']); magic = fr...
e2539e3494a208c4a319acbe959d7cc6eb79241a36d97388829aa4f48c500195
MATLAB
634
26
ncoeffs=20;strength=.001; load randomhead ii=floor((length(coeffs)-1)*rand(ncoeffs,1))+1; coeffs_ran_a=coeffs; coeffs_ran_b=coeffs; center=[0 0 0 ]; coeffs_ran_a(ii)=coeffs(ii).*(1+randn(ncoeffs,1)*strength); coeffs_ran_b(ii)=coeffs(ii).*(1+randn(ncoeffs,1)*strength); skin_a=skin;skin_b=skin; vcup_x_a=mk_vcharm(vcu...
84128fc32ced39d9d64308b1fc5f0e5b5133c960447a293c4f16ceb7a1cdb216
MATLAB
635
21
function ret=mscmd_exe %MSCMD_EXE - Return the path to the mountainsort executable file % %This function is used internally by the mscmd_*.m files % % Syntax: mscmd_exe % % Other m-files required: none % % See also: % Author: Jeremy Magland % Jan 2016; Last revision: 13-Feb-2106 mfile_path=fileparts(mfilename('fullpa...
9a5d7c2bf60a48a372c7c641dc0617a4358fa160919306af6c4595ced2ed59f3
MATLAB
635
34
function text = getText(textFile) % Extract the text from a file. The output is a cell array - each cell is a line % from the file. See also writeText() % This file is from pmtk3.googlecode.com text = {}; w = which(textFile); if ~isempty(w) textFile = w; end fid = fopen(textFile); if(fid < 0) fprintf('Sorry ...
9ca1faf3c0156aca90a8e5f7b6f89ad011313bb1a940692ee7e989a9cdc078e2
MATLAB
635
15
function setup = StateSwitch_settingsResting(setup) % settings for resting state eeg setup.DEBUG = 0; setup.opacity = .4; setup.keyB = 1; setup.ET.useET = 0; setup.EEG.useEEG = 1; setup.EEG.DIO.paral...
f9a257726d125caa30209d8d3dfdead97b56b7dc3bf78b478422716a91a2cb42
MATLAB
635
18
function Z = power(X,Y) %POWER Elementwise power (.^) operator for a tensor. % % See also TENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Tensor Toolbox by T. Kolda, B. Bader, and others. % http://www.sandia.gov/~tgkolda/TensorToolbox. % Copyright (2015) Sandia Corporatio...
162c894924941cef16e07efe97ea3705e85276db55fdaa54ddd305cbdd95b550
MATLAB
636
29
function logp = wishartLogprob(arg1, arg2, arg3) % logp(i) = log p(S(:, :, i) | model.Sigma, model.dof) % logp = wishartLogprob(model, S); OR logp = wishartLogprob(Sigma, dof, S); % % This file is from pmtk3.googlecode.com if isstruct(arg1) model = arg1; Sigma = model.Sigma; v = model.dof; S ...
25c7e3d30ea17d4da0b635a4503ecb958606b51547e52be291c97f71c6e65f41
MATLAB
636
19
function mscmd_merge_labels(timeseries_in_path,firings_in_path,firings_out_path,opts) if (nargin<4) opts=struct; end; if (~isfield(opts,'merge_threshold')) opts.merge_threshold=0.9; end; if (~isfield(opts,'clip_size')) opts.clip_size=100; end; cmd=sprintf('%s merge_labels --timeseries=%s --firings=%s --firings_out=%...