sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fa4d7a15b91c0eba58812be8bb5d356dd14933032044d307dc593b05eb1aa426
MATLAB
1,481
41
function c = tapas_bayes_optimal_whichworld_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuraton for the estimation of Bayes optimal perceptual parameters % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
0bcc1a487db3997f1d7d6f312db4c0e5ec6849a62f630190c351838799419e61
MATLAB
1,482
54
function TMSCluRep4WM(ResMap,Template,OutDir) % ResMap = '/mnt/NCPL09/dALFF/SnPM_result_zdALFF_0.01/SnPM_filtered+.nii' % Template = 25 or 0 if nargin==2 OutDir = pwd; end [ProgramPath, fileN, extn] = fileparts(which('TMStarget.m')); % it provide two template with different probability tract if Template==25 ...
2db9c26e6eb7128eb966f71cbbf30fd1eb623d8019268b338d8d9a0995786ae9
MATLAB
1,482
50
function [ palette,palette_str ] = get_seaborn( ) range = 1; chosen_palette = 'deep'; switch chosen_palette case 'deep' pal = {'#4C72B0', '#DD8452', '#55A868', '#C44E52', '#8172B3','#937860', '#DA8BC3', '#8C8C8C', '#CCB974', '#64B5CD','#000000'}; end palette = cellfun(@(x) hex...
51df2c76a2b301d0e37b6ebec2debd7d53522703fa41996e880e3f9baf7b4441
MATLAB
1,482
41
function parentNode = traverseFolderDepth2(parentNode, currentFolder) % Get all contents of the current folder contents = dir(currentFolder); % Filter out '.' and '..' directories contents = contents(~ismember({contents.name}, {'.', '..'})); [~, sort_idx] = natsort({contents.name}); c...
645a29ba16e17b364fc7bc0d79fc76cc877c98157b9e38c09d3b1f66ab08492c
MATLAB
1,482
35
function TMSLargeCluster(FCImgDir,P_df,type) %% define the target using voxel p and cluster size [OutDir name ext] = fileparts(FCImgDir); [fchead fcdata] = TMSReadNii(FCImgDir) ; % individual space FCImgDir max(fcdata) min(fcdata) VoxThr = invpearson(P_df(1),P_df(2)) ...
8c2ea2ea547d8b80039d4dc23f6ec804a563654a354d0ee9fc92f34fcaf6164b
MATLAB
1,482
49
function this = MrImageGeometry_create_empty_image(this) % Unit test for MrImageGeometry.create_empty_image % % Y = MrUnitTest() % run(Y, 'MrImageGeometry_create_empty_image') % % This is a method of class MrUnitTest. % % IN % % OUT % % EXAMPLE % MrImageGeometry_create_empty_image % % See also MrUnitTest % Aut...
4b3e9da0d396b9be40e0b025126ba227ef568d5fd301f3f86a82dc07ca2255c4
MATLAB
1,483
53
function hash = hlp_cryptohash(data,fromfile) % Compute an MD5 hash of a file, string or generic data structure. % Hash = hlp_cryptohash(Data,FromFile) % % In: % Data : data to be hashed; can be a filename, a string, or any other MATLAB data structure. % % FromFile : if true, data is interpreted as a file name (def...
773957b4c57347d57062e8b429cf09781fa58a86645a193b586358f8465ddd8c
MATLAB
1,483
52
function [X, Y, Z] = faceLocations(m) % [X, Y, Z] = faceLocations(m) % m is a mesh type % This function returns the X, Y, and Z % each one is a face variable itself, and can be used for the calculation % of face variable as a function of locations % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO...
ab6e9c81447f00ebd3bc6cbb344e44e5a5b44b256f8c2c421ebba3e554b87509
MATLAB
1,483
49
function c = tapas_softmax_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the softmax observation model for multinomial responses % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
c25318196156f59773c318f1387e8fd2de614cf5d465b5725450f1f1c43e8898
MATLAB
1,483
59
function [initcond, bestfit, mse] = fit_exp_decay(x, y, iters, varargin) %uses fmincon to fit exponential to data specified by 'x' and 'y'. %inputs: x = vector of x values. % y = vector of y values. % iter = iterations of random initializations. 10-20 is reasonable. %cmc 11/3/21 %adding upper and lower bo...
e9f1e85425a72b141803fb591bd82cb46a0781c44326f2bb44e64e27e273106c
MATLAB
1,483
44
function artifactDuration = getStimArtifactDuration(Params) % GETSTIMARTIFACTDURATION Duration (s) blanked out after each stimulus. % % Spikes between the stimulus onset and the end of this window have already % been removed by batchProcessSpikesFromStim (see allArtifactWindowEnd % there), so any post-stimulus spike c...
171c0a2859f5e5288bc0ae5284eb365ac619f19a80de3f14e3018262644f09d0
MATLAB
1,484
50
function outputImage = imclose(this, structureElement) % Closes image clusters slice-wise; mimicks imclose in matlab functionality % % Y = MrImage() % Y.imclose(inputs) % % This is a method of class MrImage. % % IN % structureElement % morphological structuring element for morphological closing, e.g. %...
30b1f0298ce193243342320d30dcb190b1aaf8cd269e5c9177c9321a08daa9c2
MATLAB
1,484
47
function rf_summary % summarizes the quality of mice set(groot,'defaultAxesColorOrder', parula(4)*0.7, 'defaultAxesLineStyleOrder', '-|--|:') fits = pro(aod_monet.Fit, 'radius*pow(contrast,1.5)->score') & 'preprocess_id=3' & 'spike_inference=2'; keys = fetch(vis2p.Experiments & aod_monet.Fit, 'exp_date', 'ORDER BY exp_...
5bf53759d78f465d43b9b6f9570f593bb065c0d36999ca524a53d2c6f182e8d8
MATLAB
1,484
41
function myelin = Oligo_Apoptosis(myelin, threshold_apop, threshold_stopmy) % OLIGO_APOPTOSIS % % Implements oligodendrocyte apoptosis and function loss based on % accumulated damage in myelin segments. % % INPUTS: % myelin - structure containing myelin state and oligodendrocyte info % threshold_apop ...
ff9573e0bf4c4f49d0154714a26cd6c172ad2f72892c0927860d7269bbb0314b
MATLAB
1,484
38
function [SFC,STA,fSTA,STP,f] = LFP_Coherence(LFPData,SpikeLoc,NoPoints,SampFreq) %% Calculate the Spike Field Coherence % % Inputs % LFPData -- local field potential data for a single channel % SpikeLoc -- corresponding locations of the spikes % NoPoints -- number of data points either side ...
27403545e36ec8223a8c11bb22d6966156aa38357fff4224892b9939758f5156
MATLAB
1,485
53
function [RHSdiv, RHSdivx, RHSdivy] = ... divergenceTermRadial2D(F) % This function calculates the divergence of a field using its face % average value and the vector u, which is a face vector % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar ...
865cb4ff94576caf14c9f295bece4a7690bb3a4d81a1a090f05f792a5e8fa350
MATLAB
1,486
41
function c = tapas_bayes_optimal_categorical_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuraton for the estimation of Bayes optimal perceptual parameters % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
07744514478266deb8750874176b44e59a14c7e3f678afb82dd49c88dfd40c5b
MATLAB
1,487
31
% GET ARTwarp ROOT PATH FOR REFERENCE WHILE RUNNING IN CONTINUOUS % INTEGRATION tstDir = fileparts(mfilename("fullpath")); ARTwarpRoot = fullfile(tstDir, '..'); % Add the ARTwarp root path to the MATLAB path so we can run ARTwarp's % functions addpath(genpath(ARTwarpRoot)) % CONVERT .csv FILES TO .ctr % read from the...
2f5799435cf81dc9266d643a5a83c8c7b280059aebfe5895297fa336a03f119d
MATLAB
1,487
55
function [abpl, ubpl] = tapas_ti_bpl(llh, t) %% Computes the Bayesiand predictive log likelihood. % % Input % llh Multidimensional array of preditive likelihood. Dimensions are % Number of subjects x number of chains x number of samples % t Temperature schedule of size 1 x number o...
4cefb9d7efe6fa5da4f2ee26ce63766c531242780afd8a58c2c936b9559ecd39
MATLAB
1,487
49
function P=participation_coef(W,Ci,flag) %PARTICIPATION_COEF Participation coefficient % % P = participation_coef(W,Ci); % % Participation coefficient is a measure of diversity of intermodular % connections of individual nodes. % % Inputs: W, binary/weighted, directed/undirected connection matrix %...
a152eda4f9463129af44d22e877eb5182bb2b57bdeb0d30d2c89051163d5b0ce
MATLAB
1,487
47
%% [RDF] = Wrapper_BFR_PDF(totalField,mask,matrixSize,voxelSize,algorParam, headerAndExtraData) % % Input % -------------- % totalField : total field map (background + tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial resolution of each dimension ...
f2f2747a42ca905f897ae66222ccf9fe71da0653deb9afbdfa6cd7cd1f88a07b
MATLAB
1,487
48
function imgt = aux_imscale(img, range) %% AUX_IMSCALE: Scale an image to fit the range % This function scales the values of an image to fit the range. % % INPUT: % img = The image. % range = The min target value. (def=[0,1]) % OUTPUT: % imgt = The image scaled. % % AUTHORS: Jizhou Li, Flor...
1bec09f77e51b4ddcd883ec7da1f5683a3aa12c9ae2d5b25ed2c0e370fa244b1
MATLAB
1,488
35
function [df_sta_traces, sta_traces] = make_sta_df_traces(input_traces, stim_frames, pre_frames, post_frames,varargin) baseline_frames = 1:pre_frames-1; % use the entire pre stim window for baselining unless specified baseline_method = 'average'; for v = 1:numel(varargin) if strcmpi(varargin{v},'baseline_frames...
53b03394c7197e36f99fd0c6548023b0a789f04e9c6dec89ed32b843ac06b473
MATLAB
1,488
46
function outputImage = minip(this, applicationDimension) % Computes minimum intensity projection image along specified dimension, % uses Matlab min function % % % Y = MrImage() % Y.minip(applicationDimension) % % This is a method of class MrImage. % % IN % applicationDimension image dimension along which oper...
df094b458a19e3743d6ffd847eb6e5407572ab08e91d3ea5584bcdfdbfd7f2cd
MATLAB
1,488
46
function outputImage = combine_complex(this) % combines dimensions with complex parts (magnitude/phase or % real/imaginary) into a complex array with N-1 dimensions % % Y = MrImage() % outputImage = Y.combine_complex() % % This is a method of class MrImage. % % NOTE: The dimensions reflecting the complex parts are ...
fa077a7de233d0ddd0185df83e6d8ebdd27bde01e6d3f2cbb1242764d2d987b4
MATLAB
1,488
48
function [err,data] = afni_ni_checkfordata() global comm; data = []; err = 1; if (comm.sockcon < 0), comm.sockcon = pnet('tcpsocket',sprintf('%d', comm.socknum)); if (comm.sockcon < 0), fprintf(2,'Could not open socket %d\n', comm.socknum); return; end if (comm.dbg...
aacbd2d34fc86bb0fcc2b68a20a38f2bd53899ea20f01a92a6c24efcdcda70ff
MATLAB
1,489
43
function outputImage = zoom(this, zoom_factor) % Geometric shear of MrImage % % Y = MrImage() % Y.zoom(inputs) % % This is a method of class MrImage. % % NOTE: This is a method of MrImage rather than MrImageGeometry, because % the latter is composed on the fly from affineTransformation and % dimInfo to ...
34cd0678d65ea3950daf677345e4cc6dabb7ef082707e3f34a5d276860ab04a4
MATLAB
1,490
43
function plotNContactsDistributions(eventInfo) % Plot bar plots for the number of contacts within 1s of the cue fig; hold on; axis off % Get counts [countsR, ~] = histcounts([eventInfo.nGrasps_R], 'BinMethod', 'integers', 'Normalization', 'probability'); [countsL, ~] = histcounts([eventInfo.nGrasps_L], 'BinMethod', 'i...
e83c73b3a12ad0eb10bc9bbd3baf2677908ac58ad97fe528498d359fa00aa3be
MATLAB
1,490
52
function [stats] = boxplot_hmt(y, x, isDep, names) % create boxplot with significance labels; % INPUT % y = vector with data to plot; % x = vector with x-positions for data in y; % default settings if nargin<3 isDep = 0; end if nargin<4 names = {"A", "B"}; end % determine number and xPositions ...
1d06fca85a7b7d5957dafbfa9a30e4570a19c5d58b9c22be04cce36376378cd4
MATLAB
1,491
71
function [posterior] = tapas_sem_hier_prepare_posterior(data, model, ... inference, states) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % T = model.graph{1}.htheta.T; posterior = struct('data', data, 'model', model, 'inference', inference, ... 'samples_theta', [], 'fe', [], 'llh', []); np = numel(sta...
7bbd7b7589826e81b587b253d3390cf4cd88082cc98d51c6257009b6fdd603f8
MATLAB
1,491
44
function outputImage = shear(this, shear_dr) % Geometric shear of MrImage % % Y = MrImage() % Y.shear(inputs) % % This is a method of class MrImage. % % NOTE: This is a method of MrImage rather than MrImageGeometry, because % the latter is composed on the fly from affineTransformation and % dimInfo to i...
975c6d8a49350c2c3f53a5124340effe9b41cebb415236d9b7face2be98616cb
MATLAB
1,491
51
function [Xrot, Yrot, Portxrot, Portyrot] = rotationmatrix(tracksx, tracksy, portx, porty); % A rotation matrix is used to perform a rotation in Euclidean space. It % establishes a cartesian coordinate system, and rotates the points in the % plane around the origin. % Written by Astra S. Bryant 4/4/2019 % When rotat...
b04d306a25f4154b861b199303df9d35e9e486021721a668de26c0474e769cff
MATLAB
1,491
45
dataFileName = fullfile('results', 'doseResponseData.mat'); load(dataFileName); data = dff; %% apply PCA, treat each concentration a uniq sample dataTall = permute(data, [1 3 2]); dataTall = reshape(dataTall,[],size(data,2),1); [coeff, score, ~, ~, explained, mu] = pca (dataTall); %% plot the data projection onto t...
c4b1d14cbcf0cc197df7b8aba30fbb49511f9e08f18f8e1cdd806ddcfa0883f8
MATLAB
1,491
52
%% function [r2s, M0final] = R2starmapping_ARLO_complex(img,te) % % Description: Fast monoexponential fitting of R2* by auto-regression % echo spacing should be the same across time series % Assuming time series in last dimension % M0 map is calculated by weighted sum method % ref: Pei et al. MRM 73:843?850(2015) % % K...
f9e2eb7dec911b15b8be03be783d7c515088514e976843c39685495d00c1fd3b
MATLAB
1,491
46
function fear_EIseparation(basename) % load('~/data/Fear/triple/hoegaarden181115/hoegaarden181115.basicMetaData.mat') % basename=basicMetaData.Basename param.threshold=[0.5,0.6]; load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([ba...
56c78685c8b8174883c5c0a509e0acdb6e74b1a47f4605a3e5df554f42a21943
MATLAB
1,492
59
function [itiMdl, itiOpt, V, rpe, alpha, G, belief] =... generate_deltabelief_mdl(... R, alpha0, D) % generate_deltabelief_mdl - generates data for Delta-Belief model % INPUTS: % R - reward vector. Must be 1:5 % alpha0 - Base learning rate % D - Scale parameter % OUTPUTS: % itiMdl - trial intiation time...
23d3fe88a6c9d940985dbfb63e98a710db68e0b81bbac620461df0b5ac3ce826
MATLAB
1,493
47
function otherImage = circshift(this, nShiftSamples, applicationDimensions) % circularly shifts data matrix by nShiftSamples for all given dimensions % % Y = MrImage() % Y.circshift(nShiftSamples, iDim) % % This is a method of class MrImage. % % IN % nShiftSamples [1, nShiftDims] number of samples to shift ...
4c3f64a117febd1e054a3f24be9261edf72cb919a19b74541d8ea827c86989a9
MATLAB
1,493
62
function analyzebehavior_floc_visualize(ppdirs,outputdir) % load alldata = {}; for p=1:length(ppdirs) alldata{p} = load([ppdirs{p} '/behavioralresults_floc.mat']); end % look at duration figureprep([100 100 1000 300]); hold on; cnt = 0; for p=1:length(ppdirs) n = length(alldata{p}.totaldur); plot(cnt+(1:n),alld...
0accd58fde979f41fb157726ae3914bcb5edaff38ad00fe02226d729899109dd
MATLAB
1,495
43
function sizes = getVarSizes(obj, inputSizes) %GETVARSIZES Get the size of the variables % SIZES = GETVARSIZES(OBJ, INPUTSIZES) computes the SIZES of the % DagNN variables given the size of the inputs. `inputSizes` is % a cell array of the type `{'inputName', inputSize, ...}` % Returns a cell array with sizes ...
25fd95494f57d9d901de2a7ebacd9c6f7228f80ea157f55655b9cb345d495ab9
MATLAB
1,495
68
function [croppedImage, boundbox] = autoCropImage(image, varargin) % DESCRIPTION % % SYNTAX % % EXAMPLE % % CONTACT: StanfordVoltageGroup@gmail.com %% GET DEFAULT OPTIONS options.plot=false; options.verbose=true; options.boundbox=[]; options.threshold=0.1; % remove 10% of above background level options.savePath=[]; ...
892d620c52b00a8893f124aefe6db5bab2a7ad03908254c87250996eadd5cccf
MATLAB
1,495
43
clear all %#ok<CLALL> % Clear all workspace variables close all filename = 'C:\Users\Harnettlab\OneDrive\Desktop\Voltage_Data\Sq_camera.bin'; nrow = 96; ncol = 200; stack = readBinMov(filename, nrow, ncol); IPv4 = '127.0.0.1'; % Define TCP/IP communication parameters. port = 30001; % Set the port number for commu...
8cac437610acdde74560a3299a7fd12468aa756c33661d78786642102cbdbe13
MATLAB
1,495
55
function m = copymatrix(varargin) % function m = copymatrix(m,sub,val) % % <m> is a matrix. can be [] when <sub> is a logical, in which case % we assume <m> is zeros(size(<sub>)). % <sub> is % (1) some sort of index (e.g. vector of indices, logical mask) % (2) a function that accepts <m> and outputs an index % ...
bc5b5ed5a05c714bcef49243e2f960c8417e6746417389490f89853b0bba6067
MATLAB
1,495
53
function [pA,pG,pAG,pD,pAD] = runlmestability(behavior, eigenvalue, toi) eigenvalue = permute(eigenvalue,[1 3 2 4]); behavior.Group = categorical(strtrim(string(behavior.Group))); nt = size(eigenvalue,4); pA = nan(2,2,nt); pG = nan(2,2,nt); pAG = nan(2,2,nt); pD = nan(2,2,nt); pAD = nan(2,2,nt); for...
c3e978ae684203dd16872a3661cca52d1366055eee1af09ac1a8313a70b8b5bf
MATLAB
1,495
32
%T=readtable('../Test_Data/csv/Sb_HICEAS1706_20170913_AD259_S123_sel22_220035.csv') % GET ARTwarp ROOT PATH FOR REFERENCE WHILE RUNNING IN CONTINUOUS % INTEGRATION tstDir = fileparts(mfilename("fullpath")); ARTwarpRoot = fullfile(tstDir, '..'); % Add the ARTwarp root path to the MATLAB path so we can run ARTwarp's % ...
ee230f26af27e667940fca5358feac78018d5cc23901d9f65c480e6ef5a5807b
MATLAB
1,495
45
function [markersize] = OptimiseMarkersize(data, I, markertype, markersize, bar_intervals, x_lim, y_lim) % by Julia Becker, 14/10/2021 %UNTITLED Summary of this function goes here % Detailed explanation goes here ui = markersize; threshold = ceil(max(data.modulus)); heatmap_scale = hot(threshold); data1 = data;...
21c698dcc5afbb5fe5fbfb93e28c09479e68172f32486892b667d853ed6b74ac
MATLAB
1,496
64
function [spsmf_out] = spsmf_detector(hsi_img,tgt_sig,mask) % %function [spsmf_out] = spsmf_detector(hsi_img,tgt_sig,mask) % % Subpixel Spectral Matched Filter % matched filter derived from a subpixel mixing model % H0: x = b % H1: x = alpha*s + beta*b % % inputs: % hsi_image - n_row x n_col x n_band hyperspectral...
2cce15205fa76f15385112cc5f8b9a0c6e40532b98f5d0641b2f244521a853a5
MATLAB
1,496
47
%% [h_checkbox,h_edit] = sepia_construct_checkbox_edit(parent,fieldString,defaultValue,pos,wratio) % % Input % -------------- % parent : parent of the constructs % fieldString : text to be displayed in the 'checkbox' field % defaultValue : default value in the 'edit' field % pos : position of the co...
cedf899d756aac73276eb55de9e17c938360a5b4ee16e8c15478227959d8af86
MATLAB
1,497
40
% Example using the phantom Fibercup (2D version) % Data can be downloaded in http://www.tractometer.org/original_fibercup/data/ % % Author: Aina Frau-Pascual % Load Input image, generated with DSI Studio %dsi_studio_run --action=src --source=data.nii.gz --bval=bvals --bvec=bvecs --output=data.src.gz' %dsi_studio_run...
59469c43cb8bf95ca37a472c476dc614deebd66b7f3395b66366f06a8aecb517
MATLAB
1,498
55
function colormap = colormapHSV(colormap, hueMultiplier, satMultiplier, valMultiplier) if ~isempty(hueMultiplier) colormap = colormapHue(colormap, hueMultiplier); end if ~isempty(satMultiplier) colormap = colormapSat(colormap, satMultiplier); end if ~isempty(valMultiplier) colormap = colormapVal(colormap,...
c62472d7cd015ae511f23f2b34be8bc00d27dc6c30d2feece8d3f8408c72fbfe
MATLAB
1,498
32
function [pvec, pstruct] = tapas_ehgf_binary_pu_tbt_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2024 Anna Yurova, Irene Sophia Plank, LMU University Hospital; % ehgf adaptation based on the function tapas_hgf_binary_pu_tbt_trans...
c67120c85fba18a7427066ec0507f7e965cf7c2bdab2cbd61dfd54be81b10724
MATLAB
1,498
38
function R = tapas_physio_scaleorthmean_regressors(cardiac_sess) % create orthogonalized cardiac regressors (Fourier expansion) to ensure % numerical stability of SVD in spm_spm, if regressors are highly % correlated (e.g. after triggered acquisition) % % USAGE: % R = tapas_physio_scaleorthmean_regressors(cardiac_ses...
4c646e6e3a47705590eaf380b6650a3812c01a000875a54a043ea5533b0955ee
MATLAB
1,499
45
function [ratBlk, mdlBlk] =... compare_rat_and_model(BestFit) % compare_rat_and_model - function to compare rat trial intiation time % and corresponding model predictions % INPUTS: % BestFit - Fit to rat's data, e.g., BestFitLate.(RAT_ID) % Outputs: % ratBlk - First row is average rat trial initiation time by b...
d677ff6450a6fe9419adee3be41fe88331995b98848991860cfd2ba306c9cf14
MATLAB
1,499
43
function [logp, yhat, res] = tapas_cdfgaussian_obs(r, infStates, ptrans) % Calculates the log-probability of response y under a cumulative Gaussian distribution. This % model has no free parameters. % % -------------------------------------------------------------------------------------------------- % Copyright (C) 20...
054e20fb3cfe992e146270712a8092077f2e7baace599a14c8c7f9132d1474e6
MATLAB
1,500
68
% [x,y] or x = MS_embed(z,lags) or MS_embed(z,dim,lag) % embed z using given lags or dim and lag % embed(z,dim,lag) == MS_embed(z,[0:lag:lag*(dim-1)]) % negative entries of lags are into future % % If return is [x,y], then x is the positive lags and y the negative lags % Order of rows in x and y the same as sort(lags) ...
328845281c3b12aff37994ee2d5d1cf376c3d19d11df8e0d558f8a03298e6d2e
MATLAB
1,500
38
function [Ne_adj]=Adj_site_effect(NodalE_All,indall_select_All,Site_info,Brainsz_All,Age_gender_sp_All) Ne_adj=NodalE_All; NodalE_Alln=NodalE_All(indall_select_All,:); Site_infon=Site_info(indall_select_All); Brainsz_Alln=Brainsz_All(indall_select_All); Age_Alln=Age_gender_sp_All(indall_select_All,1); Gender_Alln...
8beb238b92d9acb48ee7a3e9d3e13291ea9ba217c2f09de9129591d2fb7f5407
MATLAB
1,500
38
function [time_projection] = assembly_activity(AssemblyTemplates,SpikeCount) % Activities = assembly_activity(Patterns,Activitymatrix): computes the % time course of the activity of assembly patterns defined in Patterns in % the spike matrix Activitymatrix with single bin resolution. % % Description of inputs: ...
1135b5109a715f3df87bb299685f55ad0910e35cb950a0fb6b8200d91b7ec4b4
MATLAB
1,501
42
function p = tapas_physio_prctile(x, percentile) %returns the approximate value corresponding to a percentile for a given data vector % % p = tapas_physio_prctile(x, percentile) % % uses a sorting/interpolation approach as the original perctile in the % Matlab Statistics Toolbox % % IN % x [N,1] data ...
09e7b936d9a14f2d609ae8bdcbbaea63315711cf650602a86570a76ebabbbe57
MATLAB
1,503
74
function gotoDir(varargin) % gotoDir(path, dir) % Goes to path; then goes to dir, making it if necessary. % % gotoDir(path) % Goes to path, making all required directories on the way. %__________________________________________________________________________ % Copyright (C) 2010 Medical Research Council impo...
3c63de4cfaa86ea00241aa278b4c286919cf8200076423fde1faaed992bdc9b2
MATLAB
1,503
46
function outputImage = maxip(this, applicationDimension) % Computes maximum intensity projection image along specified dimension, % uses Matlab max function % % % Y = MrImage() % Y.maxip(applicationDimension) % % This is a method of class MrImage. % % IN % applicationDimension image dimension along which oper...
7981ca626ce15f801fdb7850d04bb3f7714811cee3717a34a1d41043c0f10e38
MATLAB
1,503
52
%% function m0 = ComputeM0GivenR2star(r2s,te,img,method) % % Input % -------------- % r2s : R2* map % te : echo times % img : multiecho images % method : '1stecho','weighted','average' % % Output % -------------- % m0 : T1-weighted images % % Description: compute T1-wigh...
4ed17c8eefb69e4acfe436a5dab081298d160ce866d71fb282c7018cbc074cc6
MATLAB
1,504
61
function [palm_out] = palm_detector(hsi_img,tgt_sig,mask,n_comp) % %function [palm_out] = palm_detector(hsi_img,tgt_sig,mask,n_comp) % % Pairwise Adaptive Linear Matched Filter % % inputs: % hsi_image - n_row x n_col x n_band hyperspectral image % tgt_sig - target signature (n_band x 1 - column vector) % mask - bina...
588771f73942f4ae786f5f9f63bb2a3d80137c59ab85184720838238be19a8aa
MATLAB
1,504
56
function int = compute_int(mu,j,delta,eta,LL,strategy,extra) %COMPUTE_INT: Determine which Lanczos vectors to reorthogonalize against. % % int = compute_int(mu,eta,LL,strategy,extra)) % % Strategy 0: Orthogonalize vectors v_{i-r-extra},...,v_{i},...v_{i+s+extra} % with nu>eta, where v_{i} are the...
2b921dd46839b71c291be29e7098c60bf213e0ccfc7635ae12a7cb8ebaba1814
MATLAB
1,505
52
function [isObjectEqual, out_left, out_right] = comp(... obj, input_obj, tolerance) % Returns non-empty properties where obj and input_obj differ ... % % % Y = MrCopyData() % Y.comp(inputs) % % This is a method of class MrCopyData. % % IN % input_obj % tolerance allowed difference seen still as equal % ...
677a1ba9cc881a70b4cb05d00aea0c399844b2fe8f46327f73c58af4040e3d70
MATLAB
1,505
65
function FigureS1(datadir, codedir) %FigureS1 - Trial initiation time in units of seconds % datadir = directory of dataset % codedir = director of code %% Set up paths s = pathsep; pathStr = [s, path, s]; onPath = contains(pathStr,... codedir, 'IgnoreCase', ispc); if ~onPath % only add code dir to path if ...
d7c8601195fa387ba222196f086612c85e4fed704f432f33a4e9dfc73cdb841f
MATLAB
1,505
40
%VL_NNNORMALIZE CNN Local Response Normalization (LRN) % Y = VL_NNORMALIZE(X, PARAM) computes the so-called Local Response % Normalization (LRN) operator. This operator performs a % channel-wise sliding window normalization of each column of the % input array X. The normalized output is given by: % % Y(i,j,...
39cc453cf0b1e6002e9e37770f8ad775f78d0d51e2846534d5e8cbd3966574d7
MATLAB
1,506
40
function [keptIdx, droppedIdx] = stratify(labels) % Stratifies a set of 2-class labels % Returns the indices for the stratified subset in keptIdx, and the % remainder in droppedIdx % Does so by reducing the number of labels in the larger group to match % the smaller group ulabels = unique(...
7bf665bb0b0958ea5c2b98b63f76c4fee2d6dac5cb35598d2143fe785dff347e
MATLAB
1,506
41
% load_nii(char(fullfile(maskDir,roiName1))); name1 = 'crossMod-Ext.nii'; name2 = 'crossMod-ext-allClusterst.nii'; name3 = 'rrhMT_fwe0pt05_currentCluster.nii'; name4 = 'rrhMT_p0pt05_currentCluster.nii'; name5 = 'rsub-ALL_hemi-R_space-MNI_label-rhMT_radiusNb-8.nii'; % cluster1 = load_nii(name1); % notZero=length(find(...
9ca8c9cf5f5ae97517b2096a20bc291af77351b4c91c2bff12112d4339ef66e2
MATLAB
1,506
26
% Root diagnostics file. % Argument should be a plaintext file listing the qcr's to be loaded % newFolder=$(date +%Y_%m_%d_%H_%M_%S) function main_diagnostics(filePath) % Generate unique csv file [~,fMod] = system('(date +%Y_%m_%d_%H_%M_%S)'); fName = ['diag_',strtrim(fMod),'.csv']; fOut = fopen(fName,'...
9d1cc74aca531191c5e6bc242665e3ddbd7bf37627d8a0b9af97cbf3256cac10
MATLAB
1,506
61
function [ Y I ] = shuffle( X , DIM ) %SHUFFLE Shuffles elements. % For vectors, SHUFFLE(X) shuffles the elements of X. % For matrices, SHUFFLE(X) shuffles the rows of X. % For N-D arrays, SHUFFLE(X) shuffles along the first non-singleton % dimension of X. % % SHUFFLE(X,DIM) shuffles along the dimension DI...
bc075ee94ee0e03b58795662323f6fbbcafbac54ef360440d4a497841996cb80
MATLAB
1,506
44
function [K,dK] = covEye(hyp, x, z) % Independent covariance function, i.e. "white noise", with unit variance. % The covariance function is specified as: % % k(x^p,x^q) = \delta(p,q) % % \delta(p,q) is a Kronecker delta function which is 1 iff p=q and zero % otherwise in mode 1). % In cross covariance mode 2) two data...
045e9ef7580beab13de585f4405ce64f5629252dbe40078807bcbb620552e2ac
MATLAB
1,507
55
function features = LoadSpikeFeatures(filename,rate) %LoadSpikeFeatures - Load spike times, cluster IDs and features from disk. % % USAGE % % features = LoadSpikeFeatures(filename,rate) % % filename spike file name (either .clu, .res or .fet) % rate sampling rate % % OUTPUT % % ...
6141954c098c1fda67fe801bde04378a21d8e00ebbaa90fa6cf5f31d574b287e
MATLAB
1,507
44
function [stack,info] = aux_stackread(filename) %AUX_STACKREAD: Read a stack of images and convert it to a double 3D % matrix. % % USAGE: [stack,info] = aux_stackread(filename) % It reads the stack named 'filename' % and returns a 3D double matrix 'stack' and the stack info 'info'. % % INPUT: % filen...
a79c8e6a5cefaa1c743be866f1919f42d076fcbfa930ab265c3e84ef1fd463b4
MATLAB
1,507
58
function W = get_estimated_weight2(Model,parm,wmode); % Return Full Weight matrix from 'Model' % W = get_estimated_weight2(Model,parm); % W = get_estimated_weight2(Model,parm,wmode); % --- input % Model.W : Weight matrix for active input [Ydim x Nactive] % Model.ix_act : active input index % parm.Dtau % parm....
a99a088ab033dcd29b1584a99b2a5f0254fa8f030841949345108fefd5baf669
MATLAB
1,507
26
% EEGLAB Toolbox to process EEG data % Version - see eeg_getversion() % % eeglab() - Matlab graphic user interface environment for % electrophysiological data analysis incorporating the ICA/EEG toolbox % (Makeig et al.) developed at CNL / The Salk Institute, 1997-2001. % Released 11/2002- as EEGLAB (Delorme, M...
e3ef7f7cbe5549097adca20ae2d76c5e0df8ab7ce6c098612f440c95f898cb87
MATLAB
1,507
58
function R = quatToMat(b, c, d, qx, qy, qz, qfac, pixdim) % % R = quatToMat(qb, qc, qd, qx, qy, qz, qfac, pixdim) % % Convert a quaternion to a 4x4 rotation/scaling/translation matrix. Based on the % nifti1 spec implemented in nifti1_io.c. % % 2008.10.01 RFD: wrote it. % if(isstruct(b)) c = b.quatern_c; d = b....
63808e533b483a6c38706c1a9d912b583d45ed2e11531e4ae735bab6bb8219c3
MATLAB
1,508
52
load(fullfile('.', 'data', 'dataFigureS4H.mat')); %% setup the fitting function hillEq = @(a, b, c, x) a./(1+ exp(-b*(x-c))); ft = fittype( 'a/(1+ exp(-b*(x-c)))', 'independent', 'x', 'dependent', 'y' ); opts = fitoptions( 'Method', 'NonlinearLeastSquares' ); opts.Display = 'Off'; opts.Robust = 'Bisquare'; opts.Lowe...
3f0ea8d923551b97c5cda18f3bf377a9936fa5cc86b0bb801a09e5dd14b5bef6
MATLAB
1,510
34
function fit_res = interpolate_fit(fit,Dims_steps,res_step,Model) %interpolate_fit(fit 'struct', Dims_steps 'double', res_step 'double', Model 'string') % interpolate parametermaps to new size % % fit : struct containing fitting results % Dims_steps : array containing Downsampling steps % res_step : i...
5d53eb0904eb77db5ececb8745634724c49335b008913954edb70b824b8c4402
MATLAB
1,511
84
function fn_par = sero_srr_nii2fit_average(nii_fn, xps_fn, mask_fn, do_t1, opt) % function fn_par = sero_srr_nii2fit(nii_fn, xps_fn, mask_fn, do_t1, opt) if isempty(xps_fn) || nargin < 2 xps_fn = mdm_fn_nii2xps(nii_fn); end if isempty(mask_fn) || nargin < 3 mask_fn = []; end if nargin < 5 opt = sero_srr_...
c683511ea83fe19740f1787e9b461480307a52e58c5deadf483a7fe760045718
MATLAB
1,511
48
%% [unwrappedField] = Wrapper_Unwrap_LaplacianMEDI(wrappedField,mask,matrixSize,voxelSize,algorParam, headerAndExtraData) % % Input % -------------- % totalField : total field map (background + tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial res...
76b8be448aa8a6a893279813d33dcc4329e801b0b3641588b32870dc5c1262a1
MATLAB
1,512
50
%% isHam(Matriz) % % Determina si la Matriz es un Ciclo Hamiltoniano. % % Matriz = |a11 a12 ... a1n| % |a21 a22 ... a2n| % | . . ... . | % |an1 an2 ... ann| nXn % % Propiedad del Ciclo Hamiltoniano % % 1) La Matriz Hamiltoniana e...
fbed94ec9e0a8526e2e5c6e07d572f1936883594a2993b748699a4e58b847543
MATLAB
1,512
51
function plotEC_plotband2axes(y_avg, y_sem, timeAxis, EC_info) % plots EC to axes as plotband % (c) Jiri, Nov22 %% >>> plot G_src -> G_trg <<< for clz = 1:size(y_avg,2) plotband(timeAxis, y_avg(:,clz), y_sem(:,clz), EC_info.info.colors(clz,:)); end axis tight; %% paradigm-specific times if isfield(EC_info.info,...
33ee4da82ec92c9d81db9452e67dbad4dbba1b634e7e7ea5d574690fb4715ca0
MATLAB
1,513
63
function opt=surfing_afni_opts2string(varargin) % translates options as used in AFNI from arguments to a string % % OPT=SURFING_AFNI_OPTS2STRING(...) takes the input arguments and converts % them to a string as used in AFNI programs. % The input arguments can be of any type accepted by surfing_struct, e.g. a % struct ...
27de5e17b7965e041843ab1c1d31b7af8f1f2c20a637e90aac9d8d622456d159
MATLAB
1,515
47
function coals = calccoalitions(ths, thr) N = length(ths); coals = 1:N; while(true) phis = zeros(N,N); % find the two most synchronous oscillators/coalitions for i=1:N thsi = angle(calcphi(ths(coals == i)')); for j=i+1:N phis(i,j) = ... calcphi([thsi, angle(...
3fd5b7de63cde36cec8a547d946dd38140a82174a736b4a44b1c411494423910
MATLAB
1,515
39
%% key = sepiatest.qsm_method_toolbox_key(qsmMethod) % % Description: maps a QSM dipole-inversion method name (as it appears in % methodQSMName, sepia_universal_variables.m) to the field name in % sepiatest.discover_toolboxes()'s output struct that gates whether it % can run on this machine. Returns 'none' for methods ...
8b8dba1fc86bd297dd4548fbe4aa2618544a2f6e3dfa31183f4b05c4ecfafac1
MATLAB
1,515
45
function outputImage = cumsum(this, applicationDimension) % Computes cumulative sum along specified dimension, uses Matlab cumsum function % % % Y = MrImage() % Y.cumsum(applicationDimension) % % This is a method of class MrImage. % % IN % applicationDimension image dimension along which operation is % ...
de63a8829260e23c84eba03d8db9dd8d9cc993017b5c0ca185b4ff294e1c892c
MATLAB
1,516
59
function [ surf_con ] = nf_concat_surf( surf_A, surf_B ) %[ surf_con ] = nf_concat_surf( surf_A, surf_B ) % Vertically concatenates two surface struct (taking care of special fields) % expects .faces/.vertices (Matlab-style) or .pos/.tri (Fieldtrip style) f_A=fieldnames(surf_A); f_B=fieldnames(surf_B); f_all=unio...
1c7aa588ecfd58e434100938aa35d84998d417033bf362366393914aac199cc9
MATLAB
1,517
47
function plotPvalHistograms(pvals, labels, colors, outname) if nargin < 4 || isempty(outname), outname = 'pval_histograms'; end if nargin < 3 || isempty(colors) || size(colors,1) < numel(pvals) colors = lines(numel(pvals)); end figure('Color','w','Position',[300 300 700 450]); hold on; bo...
47e3fccb58a7c0ff3ea96a391eaf4f8df338d10e29ef70410914918e02d91fd2
MATLAB
1,517
43
%% bgColor = sepia_theme_bg_color() % % Output % -------------- % bgColor : background colour (RGB triplet) for interactive uicontrols % (edit/popup/pushbutton fields) % % Description: Returns a background colour for interactive uicontrols % that keeps them legible under both MATLAB's classic light deskto...
74c0129b0f01322d785512b0e9598bc0247968a6df418ed4ed878eb70c09d172
MATLAB
1,517
56
function [output,options]=bpAssistMoco(input,varargin) % perform motion correction in 2 steps, with a band-pass spatial filtering % first. User can input as a variable arguemnt a computed shift options.findBestBP=false; options.vectorBandPassFilter=[2 20]; options.applyshit=[]; options.windowSize=1000; options.spatial...
aec4e0965e2923daa0591b998fabbb3ab6534a812b8f7d85f4a251c265be8b3a
MATLAB
1,518
53
function [axishan, pointhan, surfhan] = plot_points_near_regions_on_surface(DB, r, wh_points, color) % [axishan, pointhan, surfhan] = plot_points_near_regions_on_surface(DB, r, wh_points, color) % % DB: Database of meta-analysis coordinates, from Meta_SETUP.m % r: region object with clusters of regions % wh_points: 1/...
7fc21ca60fbe0118f1e12158da20bc05e4b5ff5a4c4dbf86b66ddafd31c4a92b
MATLAB
1,519
34
function [ Hc, coals] = coalitionentropy(ths, Cth) if nargin < 2 Cth = 0.8; end % For data Xt, consisting of channels Xi,t, i = 1, ?, n, we consider two channels to be in synchrony at time t if the absolute value of the difference between their instantaneous Hilbert phases is less than 0.8 radians (approximately 45...
4eaff061fa7cb0697bc102f165e79c86033e8cf9974b5f1d732e6865796bb348
MATLAB
1,520
46
function this = apply_transformation(this, otherGeometry) % Performs affine transformation on Geometry by multiplying of 4x4 affine matrix % % Y = MrImageGeometry() % Y.apply_transformation(otherGeometry) % % This is a method of class MrImageGeometry. % % IN % otherGeometry MrImageGeometry holding the affine tr...
e763fd60f0ed679d6ab376bea4c705ee1fdda9271a10cdc8da3c77004f0a04e3
MATLAB
1,520
71
function [gwf, rf, dt, ti, rwf] = sero_pulseq_getBlockWaveforms(seq, blockInd) % function [gwf, rf, dt, ti, rwf] = sero_pulseq_getBlockWaveforms(seq, blockInd) if nargin < 2 || isempty(blockInd) || all(blockInd == 0) blockInd = [1 numel(seq.blockEvents)]; end if isscalar(blockInd) blockInd = [1 1]*blockInd; e...
34022c3e3cb8a6093e53216b307193c1de6231654bd03f1a00cee3cbd29b4516
MATLAB
1,521
58
function M = diffusionTermCylindrical1D(D) % This function uses the central difference scheme to discretize a 1D % diffusion term in the form \grad . (D \grad \phi) where u is a face vactor % It also returns the x and y parts of the matrix of coefficient. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % ...
c2766ccbbd61890d0d84a715c918d352a8fde536f6e711a2e34f9f6ad6f22167
MATLAB
1,521
44
% 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...
da382837a548cbb2e883ae5feb61bf45a6891bf8eef8171ad12f07381b6bfb61
MATLAB
1,521
65
function data = getImageBatch(imagePaths, varargin) % GETIMAGEBATCH Load and jitter a batch of images opts.useGpu = false ; opts.prefetch = false ; opts.numThreads = 1 ; opts.imageSize = [227, 227] ; opts.cropSize = 227 / 256 ; opts.keepAspect = true ; opts.subtractAverage = [] ; opts.jitterFlip = false ; opts.jitt...
bc9141ac969fedbcd9424d9139e85b35bf06872523683a19b67c84093d7cf652
MATLAB
1,522
53
function t = ARFIT_tquant(n, p) % TQUANT Quantiles of Student's t distribution % % TQUANT(n, p) is the p-quantile of a t distributed random variable % with n degrees of freedom; that is, TQUANT(n, p) is the value below % which 100p percent of the t distribution with n degrees of freedom % lies. % Modified 13-J...
db98770c1cafbe5395390de9a37aeb013664a52db20c9ab60a0eef72f1c755a3
MATLAB
1,522
51
classdef nnroipool < nntest properties x end properties (TestParameter) method = {'avg', 'max'} subdivisions = {[1 1], [2 1], [1 2], [3 7], [16 16]} end methods (TestClassSetup) function data(test,device) % make sure that all elements in x are different. in this way, % we can com...
022beb624debb4ef843dbd1f4926e33f7ceed302aa821f27cebd521f4f78a763
MATLAB
1,523
64
function [data, V, ve] = pca4Regression(data, nPCs, rotate, denoise, meanSubtract) % data is a struct of matrices in the field "data", each matrix is % observations x variables nChunks = length(data); dataMat = vertcat(data.data); nCols = size(dataMat, 2); if nPCs < 1 % accept a fractional percentage of total number...
2a37f1b05489c11c66644dbe80d0439e058f9bad512bf4e52d6499d1442fb24e
MATLAB
1,524
53
%% get_set_bfr_lbv(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid % ...