sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f33369555af85487d8b1811d0d656e46d7b307c0f0801afa65a91353f3084224
MATLAB
1,151
31
function run_tier3() %% run_tier3() % % Description: runs the Tier-3 toolbox-dependent regression matrix % (test/tier3_matrix/) against the real dataset configured via % sepiatest.get_real_dataset(). Rows requiring an unavailable toolbox, or % missing a real dataset/reference, are skipped (not failed). Errors % (non-ze...
0439d22cd23c5de7c424eb6e24249e76646c02e180ab844cafd40831dfc465b8
MATLAB
1,152
38
function y = vl_nncrop(x, crop, dzdy, inputSize) %VL_NNCROP CNN crop. % Y = VL_NNCROP(X, CROP) crops the input X spatially. CROP specifies the % amount of cropping as [TOP, BOTTOM, LEFT, RIGHT]. % % DZDX = VL_NNCROP(X, CROP, DZDY) computes the derivative DZDX of the % function projected on the output derivative...
c01634f4c3f3858674042f3ebb90494ef4dfb943518540201b7cb6d0e4fb22fa
MATLAB
1,154
45
function [ params ] = nmri_get_modality_params( params, mod_type ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here % check if we have a specific subfield if (isfield(params,mod_type)) params_b=params.(mod_type); params_a=rmfield(params,mod_type); % will use the versatible update...
b4ebd1903896cce89aa5dad9d8f6808a05e0dbd9b51e79916fec3179ddf3964b
MATLAB
1,155
31
function [m,dm] = meanWSPC(d, hyp, x) % Weighted Sum of Projected Cosines or Random Kitchen Sink features. % % This function represents the feature function of a zero mean GP with % stationary covariance function. See the paper "Sparse spectrum GP regression" % by Lazaro-Gredilla et al., JMLR, 2010 for details. % % m...
7cf9cfc1fbe6d2db56eccf9fb8a916f94c450982f6978f636590de5dccbdc189
MATLAB
1,157
51
function [SNRmean, STD, E] = sero_srr_snr_check_invivo(fn_nii, fn_fit, fn_xps, fn_msk, do_t1) % function SNR = sero_srr_snr_check_invivo(fn_nii, fn_fit, fn_xps, fn_msk, do_t1) %read files I = mdm_nii_read(fn_nii); I = abs(I); xps = load(fn_xps); P = mdm_nii_read(fn_fit); S0 = P(:,:,:,1); M = mdm_nii_read(fn_ms...
ce5e724c96e6cc4d06675bcec9b4c31595c7a515ccbdfb78d88bcaed70757f65
MATLAB
1,157
35
%{ preprocess.CirclesLookup (computed) # my newest table # add primary key here -> preprocess.CircleRadii ----- # add additional attributes width : smallint # width of the reactangle over which the map is # created height : smallint # height of rectangle base...
d5d92f5353543171a403407ff8543789254bc719e345307f9247ea52f3f13d80
MATLAB
1,157
23
% reward_time=[time2uL time5uL time7uL time10uL time15uL] (The length of water supply for different amounts of water) % reward_time2= Actual water supply sequence(Random order) reward_order=[find(reward_time2==reward_time(1)) find(reward_time2==reward_time(2)) find(reward_time2==reward_time(3)) find(rew...
fbd1c4e68e4897254632c83dc24bc878dcf89fecda87226e994c2b2689be5557
MATLAB
1,157
39
clear, clc, % set simulation metadata T = 1000; % # of time steps V.dt = 1/8; % time step size % initialize params P.a = 1; % observation scale P.b = 0; % observation bias tau = 1.5; % decay time constant P.gam = 1-V.dt/tau; % C(t) = gam*C(t-1) P.lam = 0.1; % firing rate = lam/dt P...
254de6c7717a7e3775052dec2d6175db22d51696f1350f499954531c2673884c
MATLAB
1,158
56
function Q = qGetQ( R ) % qGetQ: converts 3x3 rotation matrix into equivalent quaternion % Q = qGetQ( R ); [r,c] = size( R ); if( r ~= 3 | c ~= 3 ) fprintf( 'R must be a 3x3 matrix\n\r' ); return; end % [ Rxx, Rxy, Rxz ] = R(1,1:3); % [ Ryx, Ryy, Ryz ] = R(2,1:3); % [ Rzx, Rzy, Rzz ] = R(3,1:3); Rxx = R(1,1...
814ec9c546f65c7ff82c4c069bc86f3b25f0ddaf5f90ed362cad76c363e552c3
MATLAB
1,158
44
function SortCalls(hObject, eventdata, handles, sort_type, show_waitbar, select_added) % Sort current file by score set(handles.hFig, 'pointer', 'watch') if nargin < 5 show_waitbar = 1; end if nargin < 6 select_added = 0; end if show_waitbar h = waitbar(0,'Sorting...'); end switch sort_type case 'score'...
96c4440763528107f5e30a96fe407881feb435acf17055b2c5a2514ff9ac2bb2
MATLAB
1,158
20
%{ vis.FancyBar (manual) # Moving Bar stimulus that keeps the size and speed of the bar constant relative to the mouse’s perspective. -> vis.Condition --- pre_blank : double # (s) blank period preceding trials luminance : float # (cd/m...
db1f5ba39b8c5043e7d5a83abf084d0c81623933adab5d6da38c1258b4b3885a
MATLAB
1,158
36
function xyzvox = meta_get_voxel_coords(DB,contrastnumber,V,maskdata) % Given a) x,y,z fields in DB, 2) 3-D mask data; and 3) a contrast number indexed in DB.Contrast, % return voxel coordinates xyzvox of in-mask coordinate points. % % xyzvox = meta_get_voxel_coords(DB,contrastnumber,V,maskdata) % See meta_prob_activat...
452589ba8cf215ea0cc27cc649b215377c7fee880421fc96756b4563cba4a65a
MATLAB
1,159
33
function ProcessData_ExtendedData8(datadir, savedir, codedir) %ProcessData_ExtendedData8 - Process raw data saved under datadir such that it can be plotted by PlotExtendedData8. % INPUTS: % datadir - Local directory where 'Golden_Nature/RawData_ExtendedData8.mat' from Zenodo was saved % codedir - Local directory wh...
96a7fa769ed0eb1dda970a91aedce717ad7300d72477e055b43ad6399e489fbe
MATLAB
1,160
55
function V=surfing_afni2spmvol(I) % returns an affine matrix for an AFNI brik similar to SPM % % V=SURFING_AFNI_AFFINEMATRIX(INFO) % INPUT: % INFO: Info brik as returned by BrikInfo (or a filename of an AFNI brik) % OUTPUT: % V: struct with the following fields: % V.mat: 4x4 affine transformation matrix, ...
b03b54cedd1d76e6ca4faf910dfe457554413843d7cf7c01562a381c5efbf936
MATLAB
1,160
38
function this = set_from_geometry4D(this, geometry) % Updates affine transformation from read-in MrImageGeometry % % Y = MrAffineTransformation() % Y.set_from_geometry4D(geometry) % % This is a method of class MrAffineTransformation. % % IN % geometry MrImageGeometry % OUT % % EXAMPLE % set_from_geometry...
dd1e608d71d6cf23f09832b92e346553c7ed9d8b8a184e5919a008fce1c3fe35
MATLAB
1,160
33
n = 3; M = rotationsfactory(n, 1); A = randn(n); problem.cost = @(X) .5*norm(X-A, 'fro')^2 + trace(X) + cos(X(1, 1)); Z = zeros(n); Z(1, 1) = 1; problem.egrad = @(X) X-A + eye(n) - sin(X(1, 1))*Z; at = @(M, i, j) M(i, j); problem.ehess = @(X, Sdot) X*Sdot - cos(X(1, 1))*at(X*Sdot, 1, 1)*Z; M.exp = M.retr_qr; % check*...
f8c6e73c660779e527e237b4e595aac8f6a693f62069369020f70ae44b38bb30
MATLAB
1,160
27
function logical = IntervalsIntersect(intervals1, intervals2) % This function returns a logical vector the size of intervals1, with ones % if any portion of intervals2 is present in the respective interval1. % % This can be useful if, for example, you want to have the identity of % the windows intervals1 which conta...
160f88ea8c585a10289a40a1ea3eed15bca392902ffe919e6844bd5b093f4f8b
MATLAB
1,161
49
% op_rmempty.m % Georg Oeltzschner, Johns Hopkins University 2018. % % USAGE: % [out]=op_rmempty(in); % % DESCRIPTION: % Removes empty FIDs (for example in Philips *_ref.sdat files). % % INPUTS: % in = input data in matlab structure format. % % OUTPUTS: % out = Output dataset function [out]=op_rmempty...
1f3bdaa722b0cd174aeab2b9210161251d3939da6da52935aa576e26e0a8d590
MATLAB
1,161
43
function phiBC = cellBoundary1D(phi, BC) % This function calculates the value of the boundary cells and add them % to the variable phi of size (1 .. Nx) % the output includes the boundary is of the size (1..Nx+2) % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Al...
c5302e05cd196cc5e4ea66700dc93a7e1f9678b33bacfaed3375404b6e2ec1ce
MATLAB
1,161
42
function [ft,tBreak]=essential_distMinAnglePair_ftFromQ(t,Q1,Q2,varargin) kFlip=1; term='both'; ivarargin=1; while(ivarargin<=length(varargin)) switch(lower(varargin{ivarargin})) case 'kflip' ivarargin=ivarargin+1; kFlip=varargin{ivarargin}; case 'term' ivarargin...
1ac44cbfaf8832c14d773e2341c275da366a22640312ad14f8d8fc32834eb6e7
MATLAB
1,162
25
function eletrodesLines=choosingTHeElectrodes() channelsLabel ={'Fp1','AF7','AF3','F1','TP9','F5h','F7','FT7','FC5h','PO9','FC1','C1','C3','C5','T7','TP7','CP5','CP3','CP1','P1','I1','P5h','P7','P9','PO7','PO3','O1','Iz','Oz','POz','Pz','CPz','Fpz','Fp2','AF8','AF4','AFz','Fz','F2','TP10','F6h','F8','FT8','FC6h','...
679ff2c9e139bda3649fa66ed9edcb5c4544714ce2a3b7bdd8a076e8ea558172
MATLAB
1,162
38
%Hamming distance. LC Dec 2013 Calcula la distancia de Hamming entre todos %los picos. %La distancia de Hamming entre dos cadenas del mismo %tamanhio esta definida como el numero de elementos diferentes en cada %posicion de ambos arreglos. Un arreglo binario de longitud n puede ser %visto como un vector de n dimensione...
860569a4522b6c8c81f7d648f530695f9173500a48ab4845c0384c8c37aae4a8
MATLAB
1,162
39
function [mapALL]=sh_TTLPowerMap(mov,TTL,freqRange,Fs,Nttl) mov=double(mov); mov=sh_Standardize(mov); % find the 0 before 0-1 transition [idxBehP,~]=find(diff(TTL) == 1); %Baseline [idxBehN,~]=find(diff(TTL) == -1); %Baseline n=length(idxBehP); onT=(idxBehN(1)-idxBehP(1)+1); deadT=(idxBehP(2)-idxBehN(1)+1); fprint...
eb030ee91e8dc2f5c3d1dc3e1d3063144c8120f1b58d78057ef0155d2ebae0a2
MATLAB
1,162
29
function storage = DBExternalStoragePath %DBExternalStoragePath - Get path for database external storage space. % % This is an 'internal' function used by FMAToolbox. You should not need % to use it, unless you are developping new functions for this toolbox. % Copyright (C) 2016-2023 by Michaël Zugaro % % This pro...
067cc3a6da437c118fccd107c5367b883f99fdcb3700f0ef118535ed097daece
MATLAB
1,163
37
function simpleVP(x,vp,edgeColor,faceColor,lineColor,width,type,rawRad,jitter) if ~exist('width','var') || isempty(width) width = 0.8; end if ~exist('type','var') type=''; end if ~exist('rawRad','var') rawRad=[]; end if ~exist('jitter','var')||isempty(j...
292cf0e605f7e5fd8b0d4faddcf1c38bdbc20bbdbd09720106d51ca69c4e23f1
MATLAB
1,163
35
function [logp, yhat, res] = tapas_bayes_optimal_binary(r, infStates, ptrans) % Calculates the log-probabilities of the inputs given the current prediction % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2016 Christoph Mathys, TNU, UZH & ETHZ %...
518f4498bf0c1017abca358169d4b89369c976ff980a9962591523c5b33cb6ec
MATLAB
1,163
47
function nsd_savenifti(data,res,file0,tr,origin) % function nsd_savenifti(data,res,file0,tr,origin) % % <data> is X x Y x Z x D (where D >= 1) with volume data % for one or more datasets. Can be of a specific format % like 'double' or 'int16'. % <res> is [A B C] in millimeters for the voxel size % <file0> is the ...
0e789e744101ee59d59e0151ba388fcc93877ea7ea6fea6ec0dcd9a4eeda18fc
MATLAB
1,164
43
function [ mi ] = GaussianMI(X, Y) %%GAUSSIANMI Mutual information between Gaussian variables % I = GAUSSIANMI(X, Y) calculates the mutual information between matrices X % and Y, assuming they are jointly Gaussian distributed. Matrices must be % of size [T, Dx] and [T, Dy] respectively, where Dx,Dy are the ...
202861326aaf8f98754712681c517e96cc0074a720d37b108da0e9b9f1095e0f
MATLAB
1,164
46
% op_fddccorr.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_fddccorr(in,npts); % % DESCRIPTION: % Correct and DC offset in the frequency domain. This is equivalent to a % vertical shift in the frequency domain. The required vertical shift is % calculated by taking the average of the first and last "NP...
e26f508be804f67c24e1d6a2e7034d02a49a0802a87122e3da65f11b4a91906a
MATLAB
1,164
30
%% HECPredictiveScripts resultPath = 'D:\Data\Lobster\EventClassificationResult_4C_Predictive_NonOverlap'; filelist = dir(resultPath); sessionPaths = regexp({filelist.name},'^HEC_Predictive.*.mat','match'); sessionPaths = sessionPaths(~cellfun('isempty',sessionPaths)); sessionPaths = fliplr(sessionPaths); midpoints =...
1200e01fa9300c84a0b5a59e747aa3a92cd890f6b936f0d721cf634a0d087418
MATLAB
1,165
53
function [image] = create_slice(domain,BV,WM,occupancy,slice_ind) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here i = slice_ind; dx = 1; %slice thickness %%Create image wm_slice = squeeze(sum(WM(:,i-dx:i+dx,:),2)); bv_slice = squeeze(sum(BV(:,i-dx:i+dx,:),2)); brain_slice = ...
7bfd3a67381d9d1bc1c6692afedcfcbada77fef50a1ae0f03ef79777e7c5a3f1
MATLAB
1,165
16
% EEG_OPTIONS - eeglab option script % % Note: DO NOT EDIT, instead use POP_EDITOPTIONS or the menu % /File/Maximize memory in EEGLAB gui % STUDY options (set these checkboxes if you intend to work with studies) option_storedisk = 0 ; % If set, keep at most one dataset in memory. This allows processing hundreds...
9f8002d1b5b77f281e0c0e6f5d31591976f689190f224580916a8bddfb53d880
MATLAB
1,165
34
function varargout = covRQiso(varargin) % Wrapper for Rational Quadratic covariance function covRQ.m. % % Rational Quadratic covariance function with isotropic distance measure. The % covariance function is parameterized as: % % k(x,z) = sf^2 * [1 + (x-z)'*inv(P)*(x-z)/(2*alpha)]^(-alpha) % % where the P matrix is ell...
83fb4025b75dc91b60db4641d8e301031931609718f8c1160384c8965c58fd6d
MATLAB
1,166
53
%% getM(Ciclo) % % Obtiene la matriz de un ciclo % % Ciclo = string % % NOTA: el ciclo debe terminar en el vértice donde comienza. % % Ejemplo, % Ciclo="abcabcdabaa" % % 1 2 3 4 % % Matriz = 1 | 1 1 2 0| % 2 | 1 0 2 0| % 3 | 1 0 0...
941ddf61a0842641e14f44e80c8832d198434019db9f4cad133d6aace89e8f10
MATLAB
1,166
46
function [ITIacrossrats, ITIbins_density] =... get_ITIbins(ratlist, Bstruct, numbins) %Use mixed blocks and violations only %input %ratlist %numbins: number of bins to sort all ITIs into ITIs_rats = cell(length(ratlist), 1); numbins_vector = linspace(1,numbins,numbins); for rat = 1:length(ratlist) ...
a76ac9752e2d2e716e7f708062c49da22619add7dc583e841db28f5c9dbb3e7f
MATLAB
1,166
21
%{ # Dot stimulus, for receptive field mapping -> vis.Condition --- rng_seed : blob # RNG seed luminance : float # cd/m^2 contrast : float # Michelson's 0-1 bg_color : smal...
daf661aa7bdb1dac2800ccc449d4d8bbcfc25daa73b2b8af9a51f6ebbbdfef59
MATLAB
1,166
38
function X = tapas_uniqc_flip_compatible(X, dim) % For older Matlab versions (<2013b), this redirects tapas_uniqc_flip_compatible to flip_compatibledim % % X = tapas_uniqc_flip_compatible(X, dim) % % IN % X N-d matrix % dim dimension which shall be flip_compatibleped (i.e. element indices changed % ...
5d638c18ed55674326b6990dbc78143e2eb98ce0b4e37c952583cdb8b49bfa3d
MATLAB
1,167
29
function Model=features2ModelRDMs(features,varargin); % function RDMs=rsa_features2ModelRDMs({Feature1,'name1',Feature2,'name2'},options); % generates a Model structure from features % for parametric analysis of RDMs Opt.dissimilarity='LDC'; % Could be covariance import rsa.*; Opt=getUserOptions(varargin,O...
6cf17d9739ac9701c5a2c3233d49dae35e1817a06e23f1ea16b45aaf797fb403
MATLAB
1,167
36
function varargout = compute_mRCVscore(truePredLabels, metric) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % compute_mRCVscore computes mean repeated CV scores using given % true and predicted labels. % % Arguments: % truePredLabels = Cell containing true and predicted labels obtaine...
ab27178ea3b7542d907ac24c6ffb020a99e7642fdbe5788a10dcdd0a95482efe
MATLAB
1,167
34
%This code will generate a csv file with the global component gs_sd or estimated_drowsiness value of %the 543 subjects %Author: Kim Kundert-Obando for questions please reach out to me at k.rogge.obando@gmail.com %Load subject list subj= readtable('/data1/neurdylab/datasets/nki_rockland/vigilance_analysis/great_HR_su...
b2ce6b942d1e9c6ae62c604910a77f93c780c3b59d570e5a0f528b07aa15e410
MATLAB
1,167
31
function resizedWeight = ART_Add_New_Category(weight, input) % ART_Add_New_Category Adds a new category to the given weight matrix. % RESIZEDWEIGHT = ART_Add_New_Category(WEIGHT) % This function returns a new weight matrix which is identical to the % given weight matrix except that it contains one more cate...
b7939b18e8537617ef21e186354a8fcfc820f063a4c6449f472f283859f41b27
MATLAB
1,167
45
%io_writesdat.m %Georg Oeltzschner, Johns Hopkins University 2019. % % USAGE: % RF=io_writesdat(in,outfile); % % DESCRIPTION: % Takes MRS data in matlab structure format and writes it to a SDAT file % that can be read by LCModel. % % INPUTS: % in = input data in matlab structure format. % sdatFile = Desired...
f04787f99beec9717f35b74bab27f579d0454e449a9f04bf655e158b713bb90f
MATLAB
1,167
48
function [hout]=bandwidth_SJ(xi,K) % % Bandwidth selection with Sheater and Jones(1991) % and Wand and Jones (1995) pp.74-75 syms uh if K=='norm' fk=1/sqrt(2*pi)*exp(-0.5*uh^2); interK1=-inf;interK2=inf; elseif K=='biwt' fk=15/16*(1-uh^2)^2; interK1=-1;interK2=1; elseif K=='expn' ...
e2b61b022dc796cfbad64020014904314ff74c2d72c5ea8b27b8671801f517de
MATLAB
1,168
54
function [xopt, Y] = hyperbolic_frechet_mean_computation(n, N) % This is an example of how to use the hyperbolic manifold factory to % compute the Frechet mean of points. % This file is part of Manopt: www.manopt.org. % Original author: Bamdev Mishra, Nov. 2, 2018 % Contributors: % Change log: if ~exist('n', 'var') |...
6fb6fddfdb1daecca7e6f0ce9daafeddebd3dfa4d56ee81d8135df407c6c68e1
MATLAB
1,169
31
function [values] = modal_control(A) % FUNCTION: % Returns values of MODAL CONTROLLABILITY for each node in a % network, given the adjacency matrix for that network. Modal % controllability indicates the ability of that node to steer the % system into difficult-to-reach states, given inp...
d2514ae57af2491a0aa45e402399f020998eae9025d9329f09fa94039e28b8cf
MATLAB
1,170
37
function [ S_index_query ] = sindex_query( query,tf_idf_Rasterbin,Rasterbin ) %Busca los vectores de query en el diccionario de Rasterbin %Para buscar los que pertenecen a un estado dado %query=Rasterbin(:,Pk_edos(find(Pk_edos(:,edo)>0),edo)); %Normalizo query tf-idf [sis_cti sis_pools]=size(query); tf_query=zeros(si...
2bb79c618c912e1d2402eee2a2235bd5853a331325bdc3a292abd905d6c93ae5
MATLAB
1,171
46
function Xtensor = tucker2multiarray(X) % Converts a 3d Tucker form tensor to a multiarray. % % function Xtensor = tucker2multiarray(X) % % X has fields U1, U2, U3, and G. % % The matrices U1 (n1-by-r1), U2 (n2-by-r2) and U3 (n3-by-r3) are % orthogonal matrices. % G (r1-by-r2-by-r3) is a multidimensional array. % % See...
7d7f538041ad42b0cc70d898447ad3734ae959565fe1581373574cdc18544ac3
MATLAB
1,171
53
function fn = tapas_uniqc_get_fig_name(fh, isSaveCompatible) % Automatically creates reasonable figure name based on Name, suptitle or axis % title % % fn = tapas_uniqc_get_fig_name(fh) % IN % fh figure handle (default gcf) % isSaveCompatible {0} set to 1 to remove blanks, slashes, colons ...
922ef012447413b4dca7a76dce0c08fe07f2e134810358b9a9aba61afe57614b
MATLAB
1,171
37
% conf_dist: confidence response probabilities for -6,-5,...,-1,1,2,..,6 % (those probabilioties must sum to 1) % noise_std: std of noise. % criteria: the 11 confidence criterions that account for the confidence % distribution given the noist function criteria=my_confidence_criteria(conf_dist, noise_std,stimuli)...
92dbb8893ec8e79782a047ff1fc948af2c0137cc0e8a66731e88dab31f1f17ec
MATLAB
1,171
44
function [u,xpdf,ypdf,xcdf,ycdf,h] = d_pdf(vec,crit_p,varargin) % [u,xpdf,ypdf,xcdf,ycdf,h] = d_pdf(vec,crit_p,[opt] plot, [opt] figure handles) % % vec vector of values with unknown distribution % crit_p p value at which to make height threshold (e.g., .05) % plot Optional. 0 = none, 1 = pdf, 2 = pdf + ...
9a5aa1c6f7007b74ad4d91f9cb3dce1d2a4bf701ad2ad437dfe51cffadf87301
MATLAB
1,171
39
function eeglabciplot(lower,upper,x,colour, alphaval) % eeglabciplot(lower,upper) % eeglabciplot(lower,upper,x) % eeglabciplot(lower,upper,x,colour) % % Plots a shaded region on a graph between specified lower and upper confidence intervals (L and U). % l and u must be vectors of the same length. % Uses the 'fil...
bb828c1891fa0f4741342af5b4e82be67334e6f50321a1b260e1c6d23caebbd2
MATLAB
1,171
39
% Regularization Enabled Sophisticated Harmonic Artifact Reduction for Phase data (RESHARP) % RDF = RESHARP(iFreq, Mask,matrix_size,voxel_size, radius,alpha) % % output % RDF - the relative difference field, or local field % % input % iFreq - the unwrapped field map % Mask - a binary 3D matrix denoting th...
317128c58d93c536ebefd4b24831eedce62ba08104bd223b33c8eb38a85e95f3
MATLAB
1,172
32
function i_aa = assign_ch2aa(chnlStruct_H, cytoarchAreas, subjTag, chnlNum) % converts channel topology to (larger) anatomical areas 'aa' % input: channel info from header H = H.channel(N) % output: vektor of AA indices % (c) Jiri, Jun17 if nargin < 4, chnlNum = 0; end if nargin < 3, subjTag = 'noName'; end %% defin...
5090a6f87007bb4246138c81c07d8e7c1d08f7b7357669eef0e39d7fa75eddb1
MATLAB
1,173
40
function [ H ] = tapas_rdcm_spm_logdet(C) % returns the log of the determinant of positive semi-definite matrix C % FORMAT [H] = spm_logdet(C) % H = log(det(C)) % % spm_logdet is a computationally efficient operator that can deal with % sparse matrices %__________________________________________________________________...
87a536d314ad495ddf8cb12a1cd539983aec010d0109d9a36a133112de2b13c7
MATLAB
1,173
38
classdef MaxAbsScaler < baseScaler %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % MaxAbsScaler scales data by its maximum value. % % Parameters: % data: Input data to be scaled. % % Attributes: % maxAbs: Absolute maximum value. % % Example: ...
9db4ed216d74a494eadf3d73f1471f86f92ef54db241cd74f75d8671937c4d04
MATLAB
1,173
45
function [posterior] = tapas_mcmc_blocked_estimate(data, model, inference) %% Estimate a model specified. % % aponteeduardo@gmail.com % copyright (C) 2016 % nfuncs = numel(inference.sampling_methods); nmeta = numel(inference.metasampling_methods); [states] = inference.initialize_states(data, model, inference); [stat...
e75eb46ba8ac1be1d62a5883c0d0d73709a231201434c2082889fe287e9d6a68
MATLAB
1,173
45
function [M_out, RHS_out] = maskCells(meshstruct, M, RHS, cellIndex, cellValue) % This function masks the specified cells by giving them a constant value. % It modifies the matrix of coefficient and the RHS vector % % SYNOPSIS: % [M_out, RHS_out] = maskCells(meshstruct, M, RHS, cellIndex, cellValue) % % PARAMETERS: %...
67a1fc2cab259b211343a78ca45d29d0107428eb4d74c3cdd54778c8bbf53206
MATLAB
1,174
38
function[PreFix] = osp_generate_SubjectAndSessionPrefix(Name,kk) %% function[PreFix] = osp_RemoveSuffix(Name) % Function to add subject and session filenames while respecting key-value pairs % as defined in BIDs specification. try subs = num2str([contains(Name,{'sub'},'IgnoreCase',true) contains(Name,'S'+ digitsPa...
5cb987ae811527c81c3d393a98de79de38feb7a86bbfcd24c179689c44ef4791
MATLAB
1,176
40
function y = tapas_condhalluc_obs3_sim(r, infStates, p) % Simulates responses according to the condhalluc_obs model % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2020 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, whic...
4efed97d72f7aa3fd55145cb61b52b126c9f6a90b69bbd382093995db6e01706
MATLAB
1,177
29
function [homerPruneMat, sciAvgs, pspAvgs, motionWindows] = updateQualityMetrics(nirs, qualityMatrices, nsub, homerPruneMat, sciAvgs, pspAvgs, motionWindows, saveFlags, params) % Updates the quality metrics matrices with data from the current subject, % including SCI averages, PSP averages, and motion window info...
a1549d8dcdba63040c09a15dcd332e04ff1d21580acb4158e398707313168a01
MATLAB
1,178
44
function freesurfer_asc_averagesurfaces(fnout,varargin) % take the average of a number of freesurfer ASCII surface files % % freesurfer_asc_averagesurfaces(FNOUT,FNIN1,FNIN2,...) % INPUTS: % FNOUT: surface output file name % FNIN*: surface input file name % % surffns=varargin; surfcount=numel(surffns); % l...
dcdf7141baccb4cc91c745b35d1f609ae49a5f0354f00c5ea4b3dd6567868204
MATLAB
1,178
51
function [slt, W] = sero_pulseq_seq2sliceThickness(seq, dz) % function [slt, W] = sero_pulseq_seq2sliceThickness(seq, dz) nEvents = numel(seq.blockEvents); Lib = {'initialized'}; c = 1; for i = 1:nEvents cEvent = seq.blockEvents{i}; if cEvent(2) && cEvent(5) && cEvent(7) block = seq.getBlock(i); ...
489342c2e238aa7ed0a82ad3bb3a5643f7f78f81fec7ac1c7fd76ba685bfa402
MATLAB
1,179
27
function [pvec, pstruct] = tapas_hgf_binary_mab_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Pub...
58b8d182f34b86e74afcc73b1c7090b8eca8b0fc008ecfa2c55b9014d0367c3b
MATLAB
1,179
51
function phi = solveExplicitPDE(phi_old, dt, RHS, BC, varargin) % phi = solveExplicitPDE(phi_old, dt, RHS, BC, varargin) % SolveExplicitPDE solves for the new value of variable \phi in an explicit % discretization scheme: \phi_new = \phi_old + dt/ * RHS % the real equation is d\phi/dt=RHS % The code calculates the new ...
a78787ef594b4c2a694f38cc527ffd75b52bcacf7bc0af5800561e19ad0ae527
MATLAB
1,179
31
function dist = distancetosurface(coords,vertices) % Won't work unless all vertices are on the actual surface! % % This function is old and may work for its intended purpose, % but it is not a general function for calculating distance from a set of % surface vertices. therefore, use dist_to_surface.m for i = 1:size(c...
64246d2b583150dbfdc90bf699803c39fb60acff2cc90383600b74d2972ff383
MATLAB
1,180
37
function [Opt] = Args_to_opts(Opt, autoconvert, varargin) % Convert arguments to items in the Opt structure % This ability should be particularly useful for creating compiled % functions in Matlab, where there is no desktop environment to set % variables before running a program % the compiled program should take a var...
7b4af3bd03673470012565b53031d58771718e21b7b6bc8f75e55eb1495efc98
MATLAB
1,181
33
function varargout = preSaveSetup(varargin) % % thisEvent = postInitializatinSetup(thisEvent, thisFixation, iBlock, iEvent, ... % duration, onset, cfg, logFile) % % % (C) Copyright 2020 CPP visual motion localizer developers % generic function to prepare s...
e4d87763332f96e3edd01ce52392bbc3ff87eaf6dcbf372c72f27ea2e7b9e8e9
MATLAB
1,181
39
function [K,dK] = covRQ(mode, par, hyp, varargin) % Rational Quadratic covariance function. % The covariance function is parameterized as: % % k(x,z) = [1 + maha(x,z)/(2*alpha)]^(-alpha) % % where maha(x,z) is a Mahalanobis distance and alpha is the shape parameter % for the RQ covariance. The hyperparameters are: % %...
ef1840e5262b6af8bccd78a3494875154e7d604a9f8ea2b9e95862f8fb0cc9d1
MATLAB
1,181
40
% pnt = [-2,-2,-4,1;-2,2,-4,1;2,2,-4,1;2,-2,-4,1;... % -2,-2,-8,1;-2,2,-8,1;2,2,-8,1;2,-2,-8,1]'; % F = 200; % N = 40; % a = -(F+N)/(F-N); % b = -2*F*N/(F-N); % thx = 0; % thy = 0; % thz = 0; % % for k = 1:1 % thx = 1/180*pi; % thy = thy+1/180*pi; % Rx = [1,0,0,0;0,cos(-thx),-sin(-thx),0;0,sin(-thx),c...
215889db7d91392e92b64ca757f1545d6dae233eed3b85a52c7b2acc68fd99d2
MATLAB
1,182
44
function figHandle = plotStimHeatmapWmetric(nodeMetric, vrange, cmap, cmapLabel, stimInfo, patternID, figHandle) %PLOTSTIMHEATMAP Summary of this function goes here % Detailed explanation goes here if ~exist('figHandle', 'var') figHandle = figure(); elseif ~isgraphics(figHandle) figHandle = figure(); end ...
73d9d52403404e47c52e3e0f3b0582b78852ee5d78fc8f364ab1c3669b13481c
MATLAB
1,182
43
function faceGrad = gradientTerm3D(phi) % this function calculates the gradient of a variable in x and y direction % it checks for the availability of the ghost variables and use them, otherwise % estimate them, assuming a zero gradient on the boundaries % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % %...
3726786cb5505bf5e74fe0e9dc2ea9d3f2d20f7d8a6102698f0047bda6782444
MATLAB
1,183
34
function getTriggers_stimuliTypes(params) % determines trials which contained the selected keyword (in params.thisCategory) % MUST match trials 'tr' with the same keyword in trials(tr).stim_type % saves result into respective column of 'trials_events' in each sessionCacheFile % - rows = trials % - values = zeros (e...
493598b409e3bc6d6177ab08d9b55e5f97ae0495f5a5609a791f0666e869f679
MATLAB
1,183
39
function [hi, lo, mix, all] = iticurves_SS(A, postUnrewArg) %Get ITIs for each block. Applies threshold to filter out top 1% of ITIs l = A.ITI; postunrew = [0; ~A.hits(1:end-1)]; % post unrewarded trials (Hit = 0) if postUnrewArg % Pull Post-unrewarded Latency usethese = ~isnan(l) & postunrew; else us...
7c16ece989bc9e3c4992255fbcea0e45bfef1a7db8b493be00574dc3b96d59da
MATLAB
1,183
29
function su_hdr = GE_readHeaderSuite(fid, byte_align) % % su_hdr = GE_readHeaderSuite(fid, byte_align) % % Loads the suite header from the file with filed id fid % and returns it as a structure. % if byte_align = 1 then 32-bit alignment (SGI, LX2 format) % if byte_align = 0 then 16-bit alignment (Sun, 5.X format) % % %...
f9e750f462eb6009a765cedda3ef7f260f9c3c68bbd3e100d87e166f5af88456
MATLAB
1,183
33
% Please cite this paper if you use any component of this software: % D. Cunefare, L. Fang, R.F. Cooper, A. Dubra, J. Carroll, S. Farsiu, "Open source software for automatic detection of cone photoreceptors in adaptive optics ophthalmoscopy using convolutional neural networks," Scientific Reports, 7, 6620, 2017. % Re...
404f54343c3e585431c5c466b6c665bacdfd38b8c4b58fbd1c7bbe797e88c413
MATLAB
1,184
42
%% [file,numFiles] = get_filename_in_directory(inputDir,pattern,ext) % % Input % -------------- % inputDir : input directory % pattern : string pattern in the filename % ext : file extension % % Output % -------------- % file : structure contains all filenames with the specified % ...
2c168a7b312b6ddb4f7817985c0fae37cbc4163c4845fd5b1dcaa649c3174947
MATLAB
1,185
41
% Samples - List of timestamps and corresponding values % % In FMAToolbox, 'samples' refer to matrices in which the first column % contains timestamps, and subsequent columns optionally contain values % recorded at these timestamps. % % (Obviously, in functions implementing statistical tests, the word 'samples' % is us...
9a85bc03bb76e4e3863b3e3c6b0c5a4d6c9a4e92feed8c0a6092cebeaf0d410f
MATLAB
1,185
54
%% filter's frequency response % compares different filter responses (sgolay, butterworth lowpass) %% settings srate = 1200; %% sgolay order=2; winLen=1.5*srate + 1; % in [s] B=sgolay(order,winLen); sgB = B(round(winLen/2),:); sgA = 1; %% butterworth hiF = 1; % in [Hz] Wn = hiF/(srate/2); % normalized b...
13bbbba31efe371a7790dbe6567d6deb7f8703e53ea672bee125816dba6f7753
MATLAB
1,186
59
function [outputArg1,outputArg2] = PlotSubjectResponses(ResponseMatrix, TitleStr) if ~exist('TitleStr','var') % title parameter does not exist, so default it to something TitleStr = ' '; end % --- means & standard deviation per azimuth for this subject s_responses = ResponseMatrix; % --- vectors for ea...
aebca21a3726208b01803aab9a17e1930eccaa8f74378c2d7143440eab9dd1f7
MATLAB
1,187
30
function MultiRunCalc f1 = uigetdir([],'select one folder') ; f2 = uigetfile('.txt') ; f3 = uigetdir([],'select output folder') ; f1list = dir(f1) ; f2list = dir(f2) ; parfor i = 3 : length(f1list) mkdir([f3,filesep,f1list(i).name]) ; [head data1] = TMSReadNii([f1,filesep,f1list(i).name,filesep,'fundata.nii'])...
eb82c92f1292f495e0430c7fa0697595f533ad7b76b524ec6f826798f160b51f
MATLAB
1,187
34
function getTriggers_DES_intensity(params) % determines trials which contained the selected keyword (in params.thisCategory) % MUST match trials 'tr' with the same keyword in trials(tr).stim_type % saves result into respective column of 'trials_events' in each sessionCacheFile % - rows = trials % - values = zeros (...
0bc34b64fd7af8b01ec923ca0bbaaa7920754cceba6e0882c8b1e539a4e2dac4
MATLAB
1,188
45
function result = is_orthogonal_set(A) % % Orthogonal Sets % % is_orthogonal_set(A) determines if a set of vectors in Euclidean n-space % is orthogonal. The matrix A is formed from these vectors as its columns. % That is, the subspace spanned by the set of vectors is the column space % of A. The value 1 is r...
834d2008b2f9bdcf1267c472fb173dc7294edfe6d16b3e3d0bd6206c99b392a3
MATLAB
1,188
50
function obj = init_latent(obj) N = numel(obj.data); % --------------------------------------------------- % Generate random coordinates from prior distribution % --------------------------------------------------- Z = zeros(obj.M,numel(obj.data)); for n=1:numel(obj.data) Z(:,n) = mv...
0d850da3b3c8a75df05dae58a48f33be895a3c687f21e343bed461e300dfbb44
MATLAB
1,189
29
%{ trk.EyeFrameDetection(computed) # eye frames with detected eye ->trk.EyeFrame --- pupil_x : float # pupil x position pupil_y : float # pupil y position pupil_r_minor : float # pupil radius mi...
1823b7ec85161d9a8b1df5adf0a7192437bc13a28a50c9da80b0d93c3925e45e
MATLAB
1,190
39
function report fprintf '\nReso pipeline:\n' r = rf.Session & 'session_date>"2016-02"'; %r = 'animal_id=8623';%r = 'animal_id=8628'; fprintf('Mice %s\n', sprintf('%d ', fetchn(common.Animal & r, 'animal_id'))) progress(pre.ScanInfo, r) progress(pre.ScanCheck, r) progress(pre.AlignRaster, r) progress(pre.AlignMotion, ...
3b29cd075e774585be595eec7eb64c4436b09dda9bf8fc4727bbb07bb1d59d40
MATLAB
1,190
29
function setup_sepia() % One-time setup: creates local, machine-specific copies of SEPIA's % config files from their tracked templates, for whichever ones don't % already exist. thisDir = fileparts(mfilename('fullpath')); % {template filename, local filename, message shown when it's created} configs = { ... 'Spec...
52302aadcf2eb171416ce6b9d81f0aee3dfe68f6255b2dae9b42e2cd12d24754
MATLAB
1,190
28
function nodeSize = getNodeSize(z_i, nodeScaleF, Params) %GETNODESIZE Summary of this function goes here % Detailed explanation goes here if isfield(Params, 'nodeScalingMethod') if strcmp(Params.nodeScalingMethod, 'Linear') nodeSize = max(Params.minNodeSize, z_i/nodeScaleF); elseif strcmp(Params.nodeS...
e95cdab88247926728fd104145a51c6e12f8b1c76aa367b32c22d0c9dcbe5ac8
MATLAB
1,190
41
function [K,dK] = covGE(mode, par, hyp, varargin) % Gamma Exponential covariance function. % The covariance function is parameterized as: % % k(x,z) = exp(-r^gamma), r = maha(x,z) % % where maha(x,z) is a Mahalanobis distance and gamma is the shape parameter % for the GE covariance. The hyperparameters are: % % hyp = ...
1510ee626937988bf1ca7c03ecde4229d7b1ed7322c17642b41774e02d348010
MATLAB
1,191
29
function [ output_re ] = myRescale( stimuli_time, output, output_time ) %Background: %1, Camera is working at the limit speed, the read out time for each %frame may vary a little bit from file to file. %2, Input and Output are recorded from different files. %3, The initiate of the each trial is well aligned (time poi...
461c00c87ad9eed0a759dc2f97829e8e49df09b8c77865041b84709379e05b17
MATLAB
1,191
33
function basename = basenameFromBasepath(basepath) % basenameFromBasepath-gets basename from a basepath input to a function. Uses name of the last % directory on the path to give basename. Takes care of the problem of the % fact that if a fileseparator is on the end of the basepath, you have to % take it off first. %...
a529955105d065509b10061ccf383264ee8e496a507733a7392365c073d33628
MATLAB
1,191
40
function plot_pca(ax,pcs,ens_labs,ens_cols) % Reference paper: Herzog et al. 2020 "Scalable and accurate automated method % for neuronal ensemble detection in spiking neural networks" % https://www.biorxiv.org/content/10.1101/2020.10.12.335901v1 % Rubén Herzog October 2020 cla(ax); np = size(pcs,2); if isempty(ens_la...
f8d2b9adef2f585363d46cf219e437c8a6304d4c124f3e245c7dcc610455f14d
MATLAB
1,191
36
function v = makemodel(p,ng) %MAKEMODEL Helper function to make model matrix % P = max model term size, NG = number of grouping variables % or % P = vector of term codes % We want a matrix with one row per term. Each row has a 1 for % the variables participating in the term. There will be rows % summing up to ...
3073e10983c100e5d52d5777aa01c8c4e8a5fba0420ce783eb05b49260422d7e
MATLAB
1,192
42
function myelin = Restore_Oligos( ... myelin, replacement_percentage) % RESTORE_OLIGOS % % Reintroduces a proportion of previously non-active (dead) % oligodendrocytes and restores their associated myelin to a fully % healthy state. % % INPUTS: % myelin - myelin structure containing state inform...
f446323f907121bf86bf8078ca46469ea3dcafcfd4d11ecaa399134b6198373b
MATLAB
1,193
45
function [X_scal] = test_pretreatment(X,param) % pretreatment for test data % % INPUT % X: data matrix (samples x variables) % param: output data structure from data_pretreatment routine % % OUTPUT % X_scal: pretreated data matrix (samples x variables) % % version 1.0 - september 2009 % Davide Ballabio...
f63ee430b4e8c1abe00da22c328543ff334087675302ea3e7e9c9ec4c6566c43
MATLAB
1,193
40
function img_labels=expand(msk,img_labels,Ngh,c) ind=find(~msk); %index of voxels in subcortical mask ind_labels=find(img_labels); ind_missing=setdiff(ind,ind_labels); %%% tmp=zeros(size(img_labels)); tmp(ind)=1:length(ind); adj=spalloc(length(ind),length(ind),10000); for i=1:length(ind) [xx,yy,zz]=ind2sub(size(im...
fdf5f73a3c603fb7a00b29b0715978ebf378bb52fefd36167ab0919044e6819a
MATLAB
1,193
42
function sero_pulseq_nii2LineProfile(niftiFile, sliceNum) % Function allowing the user to choose a column from a nii image and % plot the line profile of that column. try %Read the NIfTI image with double precision nii = mdm_nii_read(niftiFile); %Display the nii image if nargin<2 %get cen...
1ba63338414e854fac43dc7650968078b736a352b46c8a18b910a36d0d461766
MATLAB
1,194
45
function r = celleval(f, varargin) %FUNCEVAL calculates the value of the function f at the cell variable phi % f must be able to accept matrices % f: function handle % phi: input to the function f % r: output of the function f % f can handle 6 input phi variables, but they should all be of the same % class % % SYNOPSIS...
4ff29852db4d6b08c27a67de4a6981a5fdeed5ed7fb5e12bcadd4dc8b2dad098
MATLAB
1,194
41
function stats = regionprops3(this, varargin) % Estimates properties from a binary image via connected components. % % Y = MrImage() % Y.regionprops3('conn', connectivity, 'props', {'Prop1', 'Prop2'}) % % This is a method of class MrImage. % % IN % % OUT % % EXAMPLE % stats = Y.regionprops3('conn', 6, 'properties...
a302ecde2068259bca6ec78286f18ea4e559034f0360fd57001e807a39503ae4
MATLAB
1,194
38
function [b, er, stats] = regress_RPE_vs_rew(A, nback) %regress model-predicted RPEs against rewards %inputs: A struct. If you give it the S struct, will convert it to A struct. %nback specifies number of previous trials to regress. if isfield(A, 'pd') %if it's an S struct. [A, ~, ~] = parse_data_from_mysql(A); en...
29521df43e2c5197d89c5c072d0bcc55f0b4d528f027dc6dcdf75583e45e7400
MATLAB
1,195
27
function vectors = shuffle2(vector,nsample,window) % Randomly shuffle "nsample" times an input vector broken into segments of % windows and return an output matrix containing all the shuffled vectors. % vector: 1-by-n datapoints % nsample: the number of repetition % window: the minimum size of the segment to be s...