sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a787ccba8860525b75823c96c7b9ae9788c3d7c0f597702dcb071f5726422860
MATLAB
1,039
28
function [sta_traces] = make_raw_sta_traces(input_traces, stim_frames, pre_frames, post_frames,varargin) % grab episodes from input traces only baseline_frames_offset = []; for v = 1:numel(varargin) if strcmpi(varargin(v),'baseline_frames_offset') % back trace to the baseline of eventonsets baseline_fr...
d1f4dbaa5c6bbf92fce786fb7976b95a0a20569005e9145382d8b25e72610483
MATLAB
1,042
30
function pstruct = tapas_hgf_jget_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2017 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % Licence (GPL),...
7c2a6241052f0dfa74687d1846400363f311719d65d516c51ec0750ccaa120ee
MATLAB
1,043
19
function [event_frames] = reindex_subsession_event_frames(event_frames,sub_session_frame_range) num_offset_frames = cumsum(cellfun(@(x)numel(x),sub_session_frame_range)); num_offset_frames = [0 num_offset_frames(1:end-1)]; for s = 1:numel(event_frames) event_fds = fields(event_frames{s}); this_event_frames...
8ff736112ba245d79155fbaab429a81d7179cad2e831d621b4ec8b168f17dc88
MATLAB
1,043
46
function [model] = tapas_sem_multiv_model(data, ptheta, pars) %% Set up the model. % % Input % hgf -- Hgf model. % pars -- pars structure. % Output % model -- Model structre. % % aponteeduardo@gmail.com % copyright (C) 2016 % %% Define the model. % % aponteeduardo@gmail.co...
905728e69d642eb7617754d3a55c53c2a35ff5565ee5168c601075933413a346
MATLAB
1,043
34
function data = importfileXLS(workbookFile, sheetName, range) %IMPORTFILE Import data from a spreadsheet % DATA = IMPORTFILE(FILE) reads all numeric data from the first worksheet % in the Microsoft Excel spreadsheet file named FILE and returns the % numeric data. % % DATA = IMPORTFILE(FILE,SHEET) reads fr...
25f16e340c9f7c8a51c7119d731895ee3498849ee3a843152db70d2c29ed96a0
MATLAB
1,044
26
function [cnm_struct] = make_cnm_struct(results) % make cnm_struct out of cnmfe results cnm_struct = struct(); cnm_dims = [results.options.d1 results.options.d2]; cnm_A = full(results.A); num_frames = size(results.C,2); num_comp = size(results.A,2); cm = com(sparse(double(cnm_A)),cnm_dims(1),cnm_dims(2)); % cent...
48e4dd178dc4ff51fda22735b8b7bc2222bef6f281638cf33ba54a23fc66b0ff
MATLAB
1,044
30
function pstruct = tapas_ehgf_jget_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2017-2020 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % Licence ...
f07623026c1dc4295e2c6a017ebd85a5b70fb57215657cd0fccbb1f3be96d112
MATLAB
1,044
44
function cell2csv(filename,cellArray,delimiter) % Writes cell array content into a *.csv file. % % CELL2CSV(filename,cellArray,delimiter) % % filename = Name of the file to save. [ i.e. 'text.csv' ] % cellarray = Name of the Cell Array where the data is in % delimiter = seperating sign, normally:',' (it's defa...
10e8b5dedadcea4b98f31f8b3637d68091acbd8e92637b959e4db64abd83e629
MATLAB
1,045
45
%% h = sepia_handle_panel_bkgRemoval_BFRnet(hParent,h,position) % % Input % -------------- % hParent : parent handle of this panel % h : global structure contains all handles % position : position of this panel % % Output % -------------- % h : global structure contains all new and ot...
27a60c9c75246e9b9b27d23acd44c0137edee54b64f4f86ba63bd80cd4295b34
MATLAB
1,045
37
function [this, saveFileName] = save(this, varargin) % Saves 4D MrImage in single file. % % Y = MrImageSpm4D() % Y.save('fileName', fileName) % % This is a method of class MrImageSpm4D. % % IN % fileName string: default via get_filename % OUT % % EXAMPLE % save % % See also MrImageSpm4D MrDataNd.save MrDat...
f20089ca98754cb531dcbb7c751bfa2311649d46adff87bbb804129533123324
MATLAB
1,045
26
function EEG = threshContinous(EEG, V_tsh) %% mark segments w/ extreme values (exceeding threschold V_tsh) % will be stored in EEG.etc.valid_eeg EEG.etc.valid_eeg = true(EEG.pnts,1); % edit these indices later to keep samples out of analysis bad_seg = find(any(abs(EEG.data) > V_tsh)); bad_EEG = false(EEG.pnt...
34f2210d3972fbdf460f6033062564693cf7917d93f353a3abcd68b7b92cb914
MATLAB
1,046
48
function [C,volLR,probLR,condlist] = getallContingencies(file_idx,A,ops) %gets contingencies for all files from A struct condlist = {'prevWin'..., 'prevLoss',... 'prevOptOut',... 'left',... 'right',... 'win',... 'loss',.....
903a1b73346a5a4faa4723286e0c1dd23688f1ed552693f000764e9bc5615e12
MATLAB
1,047
54
%% Colormaps that are pretty awesome: DEMO2 % In this demo we will show how to supereasily use the new colormaps % % % this is an exampe of 4 colormaps that are being considered as the default % colormap in python's matplotlib lybrary. % % All of them look quite good and they dont have any official name, so at % the m...
725b7d783d6395af933f46c2c187547ad3fcc79e0b38c574ade4e8ae794158e3
MATLAB
1,048
46
function xcorr = crosscorr(x,y) %% xcorr = crosscorr(x,y) % This function calculates the cross-correlation between two vectors x and y. % % USAGE: % xcorr = crosscorr(x,y) % % INPUTS: % x = a vector % y = another vector % % OUTPUTS: % xcorr = cross correlation between vector x an...
9bac0e2b193bbe850f7a8e329945708d7c5a076d190e22ef37d5236f1aa15cbb
MATLAB
1,048
25
function [mouse_position,mouse_bodyparts,mouse_heatmap] = get_mouse_position(data, dlc_vars,mouse_vars,frame_size, varargin) mouse_vars_savenames = mouse_vars; for v = 1:numel(varargin) if strcmpi(varargin{v},'mouse_vars_names') mouse_vars_savenames = varargin{v+1}; end end [~,var_idx]=intersect...
b8110b3b991cd4ac8e856921e588d29dc07d5dc480ba7a37cc0b3d9cc7d621cb
MATLAB
1,048
40
%%%make PSTH function [h,p,spk_row,ind_row] = psth_ST(unitdata,unitSR, stampdata,stampSR,binlength,sttime,endtime) if unitSR == stampSR else stampdata = round(stampdata.*unitSR./stampSR); end spk_row=[]; ind_row = []; for trial = 1:max(size(stampdata)) st=stampdata(trial)+sttime*unitSR; et=stampdata(tri...
ecb766945a09b5c999c52d6e45c0bfa8f405af4a489b6baa2d6748745573ba50
MATLAB
1,049
19
%{ # table that stores the paths for the params for pupil_tracker pupil_tracker_param_id : int # id for param collection --- convex_weight_high=null : float # parameter for tracking convex_weight_low=null : float # parameter for tra...
d6d0877ba7355af3f6b829e80b49c96fac190d52eb43b3fcc02f3e7dcb984c19
MATLAB
1,050
38
function c = redblue(m) %REDBLUE Shades of red and blue color map % REDBLUE(M), is an M-by-3 matrix that defines a colormap. % The colors begin with bright blue, range through shades of % blue to white, and then through shades of red to bright red. % REDBLUE, by itself, is the same length as the current figu...
e97868356e66d6986cf0fb591f7c159bd0821f8eca84c9d0f9f47d896c252588
MATLAB
1,050
36
function figHandle = plotStimHeatmap(stimInfo, figHandle) %PLOTSTIMHEATMAP Summary of this function goes here % Detailed explanation goes here if ~exist('figHandle', 'var') figHandle = figure(); elseif ~isgraphics(figHandle) figHandle = figure(); end p = [100 100 600 600]; set(figHandle, 'Position', p); ...
4155b734bb7c2852939fd56e1c2566e7673231ba7db2bcd7c5c3dd3a9c304d98
MATLAB
1,051
51
function [npp, ipp, nt] = tapas_genpath(t, llh, minv, type) %% Create a new path for thermodynamic integration using a Hermite % polynomial. % % Input % t -- Temperature schedule. Nx1 double array % llh -- llh. Samples of the temperature. N x M array, where M is the % number of samples. % ...
3f14f62a43dd30d4da519bd5ab994b7a8bb2c9cea84c7321766949d61d10c932
MATLAB
1,052
31
function param_diff_w = sero_srr_f_params(param_diff, num_edge, lower_val, rampType) %param_diff_w = sero_srr_f_params(param_diff, num_edge, lower_val, rampType) if nargin < 3 || isempty(lower_val) lower_val = 1e-3; end if nargin < 4 || isempty(rampType) rampType = 'linear'; end N ...
deceb1981d64782e894f8839debef98b111cbeb3939115b8656de1bf68a5217d
MATLAB
1,052
31
classdef Roessler < Environment % Roessler attractor. properties D = 3; % system dimension Ranges = [50, -20; 50, -25; 100, 0]; % variable ranges Params = struct('a', 0.2, ... % ODE parameters 'b'...
4f0ae6419ed1070b1811e0fb1ceadb77635de3dbcd2b8015a05480f1fbf4493a
MATLAB
1,053
39
function [DA, T, tzero, delay_legend, bins] =... delay_effect_cg(bstruct, pstruct, event,... block, delaybins) %%Plot dF/F as a function of reward delay. Exclude first 2s following side %%LED to avoid cue response (see SideLED_resp.m for reference) cmc 8/6/20. %currently, it's using screened behavioral data 9/...
c3be9db67d376ca76b090aed532cc6bf8baf53aaa8eb75d365db3d8f9cabd4c8
MATLAB
1,053
41
function pfx = tapas_uniqc_get_common_prefix(fileArray) % determines tapas_uniqc_common prefix in list of strings % % pfx = tapas_uniqc_get_common_prefix(fileArray) % % IN % % OUT % % EXAMPLE % tapas_uniqc_get_common_prefix % % See also % Author: Saskia Bollmann & Lars Kasper % Created: 2016-11-08 % Copyright...
2424c03cf511682c347a61ec3b8cec5e4e2f89dbb4652f74eab20897624fbeb5
MATLAB
1,054
30
% (C) Copyright 2020 CPP visual motion localizer developpers function varargout = preSaveSetup(varargin) % varargout = postInitializatinSetup(varargin) % generic function to prepare structures before saving [thisEvent, thisFixation, iBlock, iEvent, duration, onset, cfg, logFile] = ... deal(vararg...
bfcc3b69d2f733d5225872d3a23574523a3ef832089d57d3e0357f6f646de327
MATLAB
1,054
47
function [state] = tapas_linear_init_state(data, model, inference) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % nc = numel(model.graph{1}.htheta.T); np = size(data.u, 1); nb = size(data.u{1}, 2); state = struct('graph', [], 'llh', [], 'kernel', []); state.graph = cell(4, 1); state.llh = cell(4, 1); state.k...
b2d817b3cfffc9b58e5ccdc0a225c5b33dafde317d3ddc86894281a4728cf326
MATLAB
1,055
28
function [spatial] = Tidy_To_Plot(spatial) % TIDY_TO_PLOT % % Fills empty cells in spatial data structures with Inf for plotting purposes. % % INPUT: % spatial - structure containing cell arrays for C1, C2, C3, and myelin states % % OUTPUT: % spatial - updated structure with no empty cells %% Replace empty fields...
e2c91d3d9a6e2989c47c9f5f424aae7e163c352265a1a16ba10529f3155d7285
MATLAB
1,055
39
function bw_img = getLargestCC(bw_img, number_cc) %GETLARGESTCC Select largest connected components in a binary image. % % DESCRIPTION: % getLargestCC selects the largest connected components in a binary % image. The number of connected to components can be specified using % number_cc. % % USAGE: % bw_i...
e57061e7f9c3fbcb645fa8148ecc67b0f325e3d6308ea7e8beabc3e6dd23037a
MATLAB
1,055
58
function [pp, pa, ap, aa] = tapas_sem_prosa_gen_lh(x, theta, ptheta) %% Generate the likelihood function. % % Input % x Time interval to plot the likelihood function. % theta Parameters to use % ptheta Priors % % Output % pp Prosaccade trials, prosaccade action % pa Prosaccade trial, antis...
0412d6a9d7d43a6ba054bea8861206b7a47232ad3203c118a72367e279f64222
MATLAB
1,056
35
function test_permuanova2 %TEST_PERMUANOVA2 Unit tests for permuanova2.m. % © 2018-2026 Mick Crosse <crossemj@tcd.ie> % CNL, Albert Einstein College of Medicine, NY. % TCBE, Trinity College Dublin, Ireland. % Generate test data rng(42); x = randn(30,5); group = 1:5; % Perform one-way ANOVA [p1,tbl1,stats1] = ...
2515b75f334cbbe25ebdb4ae05009c9209cdac2bdfe803e3ceb3b781ac3b0d3b
MATLAB
1,056
35
function test_permuanova1 %TEST_PERMUANOVA1 Unit tests for permuanova1.m. % © 2018-2023 Mick Crosse <crossemj@tcd.ie> % CNL, Albert Einstein College of Medicine, NY. % TCBE, Trinity College Dublin, Ireland. % Generate test data rng(42); x = randn(30,5); group = 1:5; % Perform one-way ANOVA [p1,tbl1,stats1] = ...
317e79d8d1b5e1b7e16f48ea002b9d0bbe0aeded7aa70b5f34cbe3ca0a0e677a
MATLAB
1,056
34
classdef nnmnist < nntest properties (TestParameter) networkType = {'simplenn', 'dagnn'} end methods (TestClassSetup) function init(test) addpath(fullfile(vl_rootnn, 'examples', 'mnist')); end end methods (Test) function valErrorRate(test, networkType) clear mex ; % will reset GP...
78dde944260aa7b272c821891a1835b73264b2ea2dab23e76df08cb4af30ba0d
MATLAB
1,056
35
function test_permuanova1 %TEST_PERMUANOVA1 Unit tests for permuanova1.m. % © 2018-2026 Mick Crosse <crossemj@tcd.ie> % CNL, Albert Einstein College of Medicine, NY. % TCBE, Trinity College Dublin, Ireland. % Generate test data rng(42); x = randn(30,5); group = 1:5; % Perform one-way ANOVA [p1,tbl1,stats1] = ...
a9ec325e1d667ae7417eef7c7b113f8411322c4d6604f2c1aea19228bca3e7f9
MATLAB
1,057
50
function [y_img,dice]=svm_test(img_dil,Out,s_test,ind) % INPUT % img_dil:3-D image (matrix) comprises region of interest and its uncertainty zone % Out: classifier computed from svm_train.m % s_test: similarity matrix of new subject in testing samples % ind: index of all subcortical voxels in the 3-D atlas image...
10875bc753d3492d2d9f4b024e1cdb8c1c5b33e5b10984635c8544a69aa24884
MATLAB
1,058
32
function subj_data = update_latent_one(obj,subj_data) % ----------------------------------- % Update latent [posterior precision] % ----------------------------------- % Common to all subjects so we just copy the pre-computed value % > Az = A + lam * (U'*L*U + Au) subj_data.Az = obj.Az; % ...
70a64475126ca4d2183480c1792875e751579d0392e4fc2463052733673c3eeb
MATLAB
1,058
26
function volumeName = getChSpecBrainVolName(channelStruct, volume2plot, groupInfo) % TBD !!! (now = Nov22) % returns volumeName (e.g. wDefault, wDorsal Attention, ...) % based on channel information in channelStruct and specification in volume2plot % (c) Jiri, Nov21 brainAtlas_name = strrep(volume2plot, 'ch-spec_', '...
f20b099e4b0fd4f219f05739194d23d49b46302785ad0fbce96e562dfae8cf51
MATLAB
1,058
31
% (C) Copyright 2020 CPP visual motion localizer developpers function varargout = preSaveSetup(varargin) % varargout = postInitializatinSetup(varargin) % generic function to prepare structures before saving [thisEvent, thisFixation, iBlock, iEvent, duration, onset, cfg, logFile] = ... deal(vararg...
61a38adcb02cdbc49000fb7bbb288bcd9ac83bfffe8a2a1b24d3264c4d458c60
MATLAB
1,059
28
function [meshstruct, D, M, RHSbc] = computeDiffusionMatrix3D(im, voxel_size) % Compute Diffusion Matrix M from mesh 3D of tensors % % Author: Aina Frau-Pascual % Construct mesh structure Nx = size(im, 1); % number of cells Lx = Nx * voxel_size(1); % domain length Ny = size(im, 2); % number of cells Ly ...
de14ac5358c6afa6dc5c57c2d4cd0c0d05680da042870b3c68cde76ec0c37e38
MATLAB
1,059
31
%{ aodpre.Scan (imported) # synchronized AOD scans -> vis2p.Scans --- hdf5_file : varchar(255) # raw data file %} classdef Scan < dj.Relvar & dj.AutoPopulate properties popRel = (vis2p.Scans & 'aim="Cajal"') - aodpre.Ignore end methods(Access=protected)...
f25754fdbdd0f2972da085bb93e12665d3f43fea80583ff46664e08048ab0871
MATLAB
1,059
45
function glm_nsdimagery2(ppdir,ppdirname,designfile,hrfbasisfile,tr,glmdirname,hrfmanifoldfile) % notes: % - essentially unchanged wrt glm_nsd... % - 3-s events for vis, imag, and att. % - att does have two adjacent 3-s trials. it's going to be noisy. glmdir = regexprep(ppdir,'ppdata',glmdirname); mkdirquiet(glmdir...
cf6236f8affa77a9ec14870c84d3199bef62bbd9b73d221b1b58616df42834a2
MATLAB
1,060
34
function [data, missingFields] = bc_addMissingFieldsWithDefault(data, defaultValues) % JF, Check input structure has all necessary fields + add them with % defualt values if not. % ------ % Inputs % ------ if ~isstruct(data) && ~istable(data) error('Input must be a structure or table'); end if...
dfac2f9b8a0ba7424e294835c1b265d82be89b7a48bde9de48a81eed2a8ff96e
MATLAB
1,060
41
% Calculate the value of lambda so that if lambda >= lambdamax, the TVD % functional solved by l1pwc is minimized by the trivial constant % solution x = mean(y). This can then be used to determine a useful range % of values of lambda, for example. % % Usage: % lambdamax = l1pwclmax(y) % % Input arguments: % - y ...
4f66a3bfcac7d11fdd1c3c96bf5902188b4a9b8f0c5c4fa43cd8f170a4300525
MATLAB
1,061
31
classdef Lorenz < Environment % Lorenz system. properties D = 3; % system dimension Ranges = [40, -20; 50, -25; 50, 0]; % variable ranges Params = struct('sigma', 10, ... % ODE parameters 'rho', 28, ...
77404557a3299fff660f617dbe5b05a5106d6a232090fa8641c8b1f73f990183
MATLAB
1,061
35
function [color,MOLEC] = colorcodefunction (model, molec) % Set legend color based on molecule and model colorMatrix = [1, 0.4, 0.4; 1, 0.4, 0.4; 1, 0.4, 0;... 0, 0.8, 0.6; 0.2, 0.6, 0.6; 0, 0.4, 0.6; ... 0.6, 0.8, 0.8; 0.2, 0.6, 0.6; 0, 0.4, 0.6; ... 0, 0.8, 1; 0.2, 0.6, 0.6; 0, 0....
bdf3cb479ba50e41fa7e17b5e5604d2230745cb04b0c4c4a1cf0c4257b13f1f3
MATLAB
1,061
44
function [img,msk]=vector2tensor(gx,gy,gz) % This function convert vector file to tensor image (Model 1) for streamline % visulization Diffusion Toolkit using the DTI model. Only show one direction % with respect to each of the 3 eigenvectors N=size(gx); %Constrained tensor model parameters d_parallel=0.001...
5abbb5b7b33ee43ee2e9c79eb888c5d55ed34daea751592feeb9885615c09ede
MATLAB
1,062
26
%----------------------------------------------------------------------- % Job saved on 29-Aug-2017 13:31:07 by cfg_util (rev $Rev: 6460 $) % spm SPM - SPM12 (6906) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- function TMSwriteDTL(MATdir,ImgDir,vsize) s...
037ddf02ec3df388e8792a41539cbb558ef5c052fe301681bab8420760a5e81c
MATLAB
1,063
20
%{ twop_setup : varchar(256) # two photon setup name, e.g. 2P1 setup : varchar(256) # Setup name of behavior/stim computer, e.g. at-stim01 --- ip : varchar(16) # setup IP address, e.g. at-stim01.ad.bcm.edu state="ready" : enum('systemReady...
1419940508556faf86ffe8aa0b92ccb2fbec6116b44a6a52b6a010159c7c302c
MATLAB
1,063
40
function [lpp] = tapas_sem_prosa_lpp(theta, ptheta) %% Log prior probability of the parameters of the prosa model. % % Input % pv -- Parameters in numerical form. % theta -- Parameters of the model % ptheta -- Priors of parameters % % Output % lpp -- Log prior probability % % aponteeduardo@gmail.com % copyrig...
3e505c540867e555c047bfe430493e27e08fdb6e9bb9cc8a6f2a68f6faa692b0
MATLAB
1,063
28
function i_base = stftBaselineIndices(params, nSamples_sess) % returns session indices used for STFT baseline % nSamples_sess = number of samples of the processed session % (c) Jiri, Aug16 % indices of game state "search" if strfind(params.paradigm.usedParadigm, 'uboat') gameState = 'search'; % load "raw"...
0e43b78cd353738266ad5a7a28fc0352534cb895b439a60cc132ec38908a7d49
MATLAB
1,064
45
% clear % clc Pdata = fullfile(Pbase, [filesep 'models' filesep 'DMN' filesep 'GCM_fitted']); Psave = fullfile(Pbase, [filesep 'models' filesep 'DMN' filesep 'fitted_adjusted']); if ~exist(Psave, 'dir') mkdir(Psave); end files = dir([Pdata filesep 'GCM*.mat']); use_parfor = 1; %% if use_parfor ...
190bbb243ba61ca4277b096ef9be976e5d0c049b89519dcf0de61698823dfd28
MATLAB
1,064
46
% clear % clc Pdata = fullfile(Pbase, [filesep 'models' filesep 'SN' filesep 'GCM_fitted']); Psave = fullfile(Pbase, [filesep 'models' filesep 'SN' filesep 'fitted_adjusted']); if ~exist(Psave, 'dir') mkdir(Psave); end files = dir([Pdata filesep 'GCM*.mat']); use_parfor = 1; %% if use_parfor ...
4370b8a10f55537ac9e040a9c5504ae831d33a878eb78b1a3fbd5f2b9e7ebea8
MATLAB
1,064
37
function faceGrad = gradientTermRadial2D(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: % faceGrad = gradientTermRadial2D(phi) % % ...
6fe92d9f3361a3c74746db3334ef065eee77053e0cfa0e097f64063d6fc3650e
MATLAB
1,064
28
function pleaseComputeMetric = checkIfRecomputeMetric(Params, prevNetMet, lagValFieldName, netMetName) %CHECKIFRECOMPUTEMETRIC Check whether to recompute metric % Detailed explanation goes here % TODO: write function to also check the Parameters related to metric % calculation matches % Check if user ask to recomput...
d99aad41e45ded8e2b8c4cc89c16dfd908466548bd678487d2a4956b4f00ba88
MATLAB
1,064
26
%{ # align a 2-d scan field to a stack -> stack.RegistrationTask --- reg_x : float # (px) center of scan in stack coordinates reg_y : float # (px) center of scan in stack coordinates reg_z : float ...
6e230e1086ce99420bea070c31c1a58fac2526c2471e5cd32367d7ea8ef490f2
MATLAB
1,065
46
%% output = zeropad_odd_dimension(input,mode,matrixSize_o) % % Usage: % % Input % -------------- % input : input image % mode : 'pre' - preprocessing (zero padding); 'post' - % postprocessing (remove zero padding) % matrixSize_o : original matrix size beofre zero padding % % Output % -...
8a69818c42569cb7d5c141a58f0f749814b5061ba8e301c85d1cd4db0363c3ad
MATLAB
1,065
44
function h = imshow_categorical(f, vs, z, slice, pal) if nargin < 5 pal = []; end if nargin < 4 slice = 3; end dim = [size(f) 1 1]; if nargin < 3 || ~isfinite(z) switch slice case {2,3} z = ceil(dim(slice)/2); case 1 ...
e33fed253fa2545597c62aea2cee34c7f2c579528a022df4b9e04d486702efe7
MATLAB
1,065
35
function [ptheta] = tapas_sem_prosa_ptheta() %% Returns the standard priors of the model. % % Input % % Output % ptheta -- Structure containing the priors. The prior distribution is assumed % to be log Gaussian, so that the prior are the means and covariance % matrix. It is assumed that the covaria...
f15a958896b401530e5b6aea332633077b788938c3b77a7cfda5f1cbdf5aa829
MATLAB
1,065
61
% function tau = MS_firstzero(y); % % Find the first zero of the autocorrelation function of y. % % Michael Small % michael.small@uwa.edu.au, http://school.maths.uwa.edu.au/~small/ % 3/3/2005 % For further details, please see M. Small. Applied Nonlinear Time Series % Analysis: Applications in Physics, Physiology and Fi...
fcd840613362e7a07dcf5de591c65858a4fc71beaf5f8561981a66fc32945dd8
MATLAB
1,066
17
%% Standard script to display input sepia header information % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 22 Jan 2021 % Date modified: 12 August 2021 (v1.0) % % disp('----------------------'); disp('Basic data information'); disp('----------------------'); fprintf('Voxel size(x,y,z) = %s mm x %s ...
237b8af69b3eae9f5d5fd8f50805a6683f084c0f44f6d786258f83d824281dac
MATLAB
1,067
36
function d_struct = load_fromCacheFile(dataStruct) % loads results stored in cache file % (c) Jiri, Oct20 d_struct = struct; %% cache file outName = [dataStruct.outName_prefix '_' dataStruct.this_neur '_' dataStruct.this_traj]; cacheFile = [dataStruct.pathBeg filesep outName filesep dataStruct.this_subj filesep 'cac...
f25d094365e9b765c7d9d6bc47b28e44cc77370a6a52dc27af0a6136bcd81325
MATLAB
1,067
35
function [times_resample, sorted_data] = heatmat_byblock(pstruct, bstruct) resample_freq = 0.1; T = linspace(-5, 10, size(pstruct.('CPIn'), 2)-1); bdata = bstruct.('CPIn'); rewards = convertreward(bdata.Reward); blocks = bdata.Block; %reorder blocks into low=1, mixed=2, high=3 blocks(blocks==1) = 0; blocks(blocks==3)...
4033abe8ce6776b7dfabee0a8de3c645bb55791515aac1dfde0ee4508a7ec652
MATLAB
1,068
25
function [new_traces, new_times, traceKeys] = getAdjustedSpikes(key) % function [new_traces, new_times,traceKeys] = getAdjustedSpikes(key) % % Adjusts traces for time difference between slices in a scan [traces, slice, traceKey] = fetchn( ... preprocess.SpikesRateTrace * preprocess.Slice & preprocess.ExtractRawG...
6da647082ea1c322f70a56142978b21163bd5514925b00c4a0f0cc2d2748e9ea
MATLAB
1,068
39
function basicexample() % Verify that Manopt was indeed added to the Matlab path. if isempty(which('spherefactory')) error(['You should first add Manopt to the Matlab path.\n' ... 'Please run importmanopt.']); end % Generate the problem data. n = 1000; A = randn(n); ...
0d01f2ebbc446006cde6d7f44a89ce785b80736c720886aa2595b032f4c2b821
MATLAB
1,069
26
%{ # motion correction for galvo scans -> meso.RasterCorrection --- template : longblob # image used as alignment template y_shifts : longblob # (pixels) y motion correction shifts x_shifts : longblob ...
1c06468c01f4e2e5d38dd0b97897cde8d43d1aec9989bec0002b902ce01acb61
MATLAB
1,069
26
%{ # motion correction for galvo scans -> reso.RasterCorrection --- template : longblob # image used as alignment template y_shifts : longblob # (pixels) y motion correction shifts x_shifts : longblob ...
4c03108b7073d87f6a1f4092df417720135b6bee5cb31d0be0a4851d2de86f7f
MATLAB
1,069
56
function [llh] = tapas_mixedlinear_llh(data, theta, ptheta) %% Likelihood of the nodes of a linear multivariate model with diagonal % precisions on each parameter. % % It is the likelihood of % % p(y|x, beta, pi) = N(y - x*b, 1/pi) % % Note that this is a multivariate regression problem, so beta is a matrix % in whi...
ad00c92d8a8927a9df245dbcacba532c386a838e17abf490fd01155e45520f56
MATLAB
1,069
36
function tapas_add_tapas_prefix() % directory where the renaming is to be done dir1 = 'C:\Sudhir\Tapas\admin\testfolder\testtest\'; % prefix to be added prefix = 'tapas_toolbox_'; % collect all filenames from current directory filelist= dir(strcat(dir1,'*.m')); % go through each file and replace filena...
2576614fdda862c445e034f1a0072aedc981bf7c8d2b2785b8bf5b3d0d8d304f
MATLAB
1,070
31
function colors = getColorScheme(datatype) % get color scheme for visualization % INPUT % datatype (string): 'volume', 'side', 'delay' % 'volume': light purple (smallest reward offer) to dark purple (largest % reward offer) % 'side': orange (reward port contralateral to recording hemisphere) and % light blue (reward p...
3f5fb3b62f0b5471850299647584c52c93d6c2134c934be372e9d4dc9e13dd55
MATLAB
1,070
31
%% filterSpec = sepia_get_nifti_uigetfile_filter() % % Output % -------------- % filterSpec : filter spec to be passed as the 2nd input of uigetfile % for selecting a NIfTI (*.nii or *.nii.gz) file % % Description: macOS's native uigetfile file-type selector does not % reliably honour a ...
4c5c1b6f04402a0feb8694751df0154d77803347d2b5db3e72869dc2fe27df0f
MATLAB
1,070
37
function medianValue = median(this, varargin) % Returns median value of data matrix of MrImage by applying prctile(50) % % Y = MrImage() % medianValue = ... % Y.median('ParameterName1', 'ParameterValue1', ...) % % This is a method of class MrImage. % % IN % varargin parameterName/Value pairs for selectio...
35d563ccbc50912fa3fc334dd64be1c6cd52b6c5bccee0d85ab5f870489997b1
MATLAB
1,071
26
function[column1_index, column2_index, number_of_columns] = FindColumnsNeeded(source, column1, column2) % In the context of batchforce, use FindColumnsNeeded(headerinfo, 'vDeflection', 'measuredHeight') % Find line in headerinfo which specifies the column names indexc = strfind(source{1,1}, '# columns: '); if ise...
f2aa729c969caa1d90e64cb537d57e1b254d1973fc0528605347f6c239b27766
MATLAB
1,071
41
function clusters = smooth_dens_and_mask(P,varargin) % function clusters = smooth_dens_and_mask(P,[P2: extract img]) % % tor wager % % P is an input file, usually a density results mask % this function smoothes the image with a 3 mm kernel % and thresholds the results at i1 > 0, so that % you end up with a mask. Th...
5a841bb5c54171d270edcbec38d38da2548cda59478f2127b63468c64c6ce4b5
MATLAB
1,072
34
% [num, wh, weighted_num, conindx] = meta_count_contrasts(DB, testfield, fieldvalue) % % e.g., testfield = 'Stimuli' % fieldvalue = 'faces'; % [num, wh] = meta_count_contrasts(DB, testfield, fieldvalue) function [num, wh, weighted_num, conindx] = meta_count_contrasts(DB, testfield, fieldvalue) wh = strcmp(DB.(tes...
85435c9329ad74ba8711493f8ddc3cb08317bbd6ad6fe72d4f6bb2b8a809145e
MATLAB
1,072
26
function lims = sero_pulseq_sysLims_prisma() % function lims = sero_pulseq_sysLims_prisma() % % Here, I hope that we can use three sets of limits so that we can optimize % imaging, diffusion, and spoiling gradients separately. B0 = 2.89; deadTime = 10e-6; % Set system limits for imaging lims.img = mr.opts('MaxGrad',4...
ebc2caab368264c731925008e4c3447509168c8fd498bbaf9a6a0df2a3f7afc7
MATLAB
1,072
35
function [ordering,groupbreaks] = sortAmplitudeByCluster(X,grouping) %does time 2 peak by subgroups of data % %Inputs: %X: (nn x nt) data of interest, nn neurons, nt time points %ops: structure with following % useZScore: do normal sorting on X, or z score it first % grouping: (nn x 1) vector of integers, assignign...
f5acb4c922d979d369ea1859a6bfe917fd88b7563c616350e82a57434b2ba328
MATLAB
1,072
34
function ellipse_parameter = read_csv(path,user_num,session,pattern,whicheye) % path_folder_label= ['E:\label_ellipse\Data_Dvs_Unlabelled_',num2str(session),'_0_',num2str(pattern),'\user',num2str(user_num),'\',whicheye,'\','session_',num2str(session),'_0_',num2str(pattern),'\events\','user_',num2str(user_num),'.csv']...
fea1d6a0d1deff82280295682f7ff61c84fe6adfe6ed64c12ed8dc99932f4409
MATLAB
1,072
33
function t_trig = getTimeOfTrigger(params, trialStruct) % returns trigger time of specific trial in trialStruct % (c) Jiri, Jun20 t_trig = []; switch params.triggering.cutPoint case 'onGetReady' if isfield(trialStruct, 't_prep') t_trig = trialStruct.t_prep; end case 'on...
0b74f2a82fdba6126fb0d37054153e0ee187c02205e80d6cfd6d6670a71da035
MATLAB
1,073
37
function b = ShowBatch(bfile) %ShowBatch - Show data sets in a batch job. % % USAGE % % b = ShowBatch(bfile) % % bfile batch file listing the parameters for each iteration % % See also StartBatch, GetBatch, BatchInfo, CancelBatch, CleanBatches, Store, Recall. % % Copyright (C) 2007-2013 by Michaël ...
53b23363cb04a8c1517c1520bb7523aef5c1b9597985d02846ff30a10c5ba0b7
MATLAB
1,073
34
% 2016/11/11 by T. Ezaki % This function infers h and J by pseudo-likelihood maximization. % binarizedData: nodeNumber x tmax function [h,J] = pfunc_02_Inferrer_PL(binarizedData) [nodeNumber,dataLength] = size(binarizedData); iterationMax = 5000000; permissibleErr = 0.00000001; dt = 0.2; dataMean = mean(...
2d7d3e54f80084c58fbf01b7ce3b5b55d26190a60dbaf730d08f41251c09005a
MATLAB
1,074
25
function [pressure, flow] = ExtractData(nv,ntp,file_id) % NOTE: Results are stored such that the first 1:N entries are the PROXIMAL % large artery (1-15) and large vein (16-27) predictions, N+1:2N are the % MIDPOINT predictions in the same vessels, and 2N+1:3N are the DISTAL % predictions. data = load(sprintf(...
4d04343701222022ca42e9864a8f13fc812acf70f1f249efaf23be658f9e62fc
MATLAB
1,074
36
%{ pre.Spikes (computed) # traces of infered firing rates -> pre.ExtractSpikes -> pre.Trace ----- spike_trace :longblob %} classdef Spikes < dj.Relvar methods function plot(self) for key = fetch(pre.Segment & self)' X = fetchn(self & key, 'spike_trace'); X =...
93877171c6aa205a658f019b80ba1b10186eace8c3094075de40fdc3e8aba535
MATLAB
1,074
44
%% function [tolerance,stepSize,iteration,weight,b0dir] = parse_varargin_NDI(arg) % % Description: parser for NDI.m % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 5 June 2019 % Date last modified: 27 Feb 2020 (v0.8.0) % function [tolerance,stepSize,iteration,weight,b0dir,isGPU] = parse_varargin_NDI(a...
e0d361d037b177f77f846a1862a0fe009d61ed43e2eb73fd00a9f00af83da44d
MATLAB
1,074
44
function parcels_random_all=random_parcels(mskfile,MM) [~,parcels]=read(mskfile); parcels_random=zeros(size(parcels)); parcels_random_all=zeros([size(parcels),MM]); for m=1:MM ind=find(parcels); J=length(ind); %total number of voxels in subcortex M=length(unique(parcels))-1; %number of sub...
455606e5340a8f60f43085b7610080c4814c49bab6fc1eb969e03eda9ed41c15
MATLAB
1,075
42
function [slop, ampVec, kdVec, rSquare] = EnsembleMiniSearch(dataX, dataY, hillEq, slop0, ampVec0, kdVec0) % dataX, size: trialNum-by-xPoint, same as dataY. [trialNum, ~] = size(dataX); p0 = [slop0; ampVec0; kdVec0]; eSSR = @(p) EnsembleSSR(p, dataX, dataY, hillEq); % options = optimset('PlotFcns',@optimplotfval); ...
a11daaccaf67aadbe01fe4c8170b01a0fdc7f47bdabce32b0eacd894cf5b1f6e
MATLAB
1,075
19
%{ # speaker sound pressure calibration speaker_id : int # some number that identifies the speaker rig : char # setup name location : tinyint # 1 = Left, 2 = Right trial : int # trial number of calibrati...
1a62fba09cf574f2d8f661b7b881f55ab07abe7a6868ddf5b71be01eced2d491
MATLAB
1,076
40
function [D] = euclproj_trialwise(data,angs,foldvar,timelist) % [D] = euclproj_trialwise(data,angs,foldvar,timelist) %assign stimulus variable for decoding sortvar = angs; nbin = 2; pbin = 1/4; D = zeros(size(data,1),size(data,3)); ft_progress('init','text'); th = []; folds = unique(foldvar); nfold...
7c614f4790943e2fc74a7c38060fbe495688f0be09ffc17a20f7a49f868f7dd3
MATLAB
1,076
38
%% Parameters rawDataFolder = '/media/timothysit/Elements/MAT_files/MPT_MEC/'; fileName = 'MPT200108_2B_DIV14.mat'; channelNameToPlot = 14; plotTimeRange = [0, 60]; % in seconds filterTrace = 1; % 0 : plot raw trace, 1 : plot filtered trace filterLowPass = 600; filterHighPass = 8000; traceColor = 'black'; data = l...
8292c6c4b495fe79774d40bd229bae077896d24ed81654590eea5533add48a14
MATLAB
1,076
33
classdef SprottF < Environment % SprottF system. % ALSO RATHER DIFFICULT TO FIND WELL-BEHAVED ATTRACTOR. EXPLODES FOR LONG % TIME SERIES. properties D = 3; % system dimension Ranges = [3, -2; 4.5, -4; 5, 0]; ...
8693b7eeb592e1c9e247cc3ffc5ebff48ff0ca4d8af26b2e720241c59d02fcd4
MATLAB
1,076
33
function [tpl, str] = parse(tpl,target,handle,append) %TEMPLATE/PARSE Fill in replacement fields with the class properties % [TPL, STR] = PARSE(TPL,TARGET,HANDLE) fills in the replacement field % HANDLE using previously defined variables of template TPL and store % it in field TARGET. HANDLE can also be a cell array...
c72ae8e57f34fbe56a3e93f01f2d8bd4993b44a628dd1631699315e458648038
MATLAB
1,076
49
function afni_niml_write(p,fn,format) % simple function to write niml files in ASCII format % % AFNI_NIML_WRITE(P,FN) writes a NIML struct to file FN. P should be in the % form as returned by AFNI_NIML_READ. % % The order of the arguments may be reversed. If FN is numeric, then it is % assumed to be a file identifier. ...
0c0ed3c7b5eea1784ac2dc863d075c98ae31309778dfc8d2ad37340706d1b45c
MATLAB
1,077
42
%A partir del S_index vectorizado compara todos los renglones para %determinar cuales son diferentes. El numero de renglones diferentes %constituye el numero total de estados de la red. LC Mayo 2010. function [Edos_vector]=Nedos_b(S_index) N=size(S_index,2); %Número de picos S_indext=S_index>0.2; %Considera los vecto...
2cc2559184bebbf35b0d09400640f9b5bbf5874f98ad5b83104fbca50e49975a
MATLAB
1,077
34
function wait_time_mean = waittime_20ul_by_previous_vol_SS(A, inferredMixArg) % Wait times for 20ul trials conditioned on whether the previous trial was % <20 or >20 % INPUTS: % A - .mat file with rat data % OUTPUT: % wait_time_mean - Average wait time for < 20 uL and > 20 uL [~, rew] = convertrewa...
bc0300b8eabd40dc0c7b4979c68761429ee8a2716927624869c1dd1f7cdb264d
MATLAB
1,077
23
function params = preprocNonLinearOut_GetMetaParams(argNum) % Usage: params = preprocNonLinearOut_GetMetaParams(argNum) % % Get preset arguments for preprocNonLinearOut % % params.class = 'preprocNonLinearOut'; switch argNum case 1 % Original params recommended by SN params.gainControl = []; % Br...
23038515e929bb11cced440f3355d5cc1d59ca7cdd49e1e4fcf29cc43ace04b1
MATLAB
1,078
55
function map = arr2map2(arr,ROI) dim = size(ROI); idx = find(ROI); %assume arr is a 3d map in 1xN form; if 4d timeseries with M timepoints, %arr will be MXN form %dim should have 3 dimensions if size(arr,1) == 1 || size(arr,2) == 1 if size(arr,1) < size(arr,2) arr = arr'; end end % f...
6f3a58736619c79a64e0837f881fa5909dc9d88c20bd4bd6df3636a27dd399f1
MATLAB
1,078
30
%% addon_config % % Description: Addon script to incorporate new method to the SEPIA framework % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 27 June 2020 % Date modified: 01 December 2025 by Taechang Kim @ SNU (sakkar2@snu.ac.kr) % % DO NOT change the variable names, update the variable value instea...
c1a082dbc6b3740f88f5edd66655e79c2a00bda6f5bd494b7b08e64288aff94e
MATLAB
1,078
40
%islscalar - Test if parameter is a (pseudo) logical scalar. % % USAGE % % test = islscalar(x) % % x parameter to test % % NOTE % % To be considered logical, the scalar should be equal to 0 or 1, but it does % not need to actually be of class 'logical' (class(x) could be e.g. 'double'). % % ...
12802c4c9a30f28aafd0049528caaf036f6542ce3cc16d2b5be22859b6aaf525
MATLAB
1,079
37
function [name,file] = hlp_getcaller(indirection) % Find the name & file of the calling function. % [Name,File] = hlp_getcaller(Indirection) % % In: % Indirection : optional level of indirection (default: 1) % % Out: % Name: MATLAB name of the calling function, if any % File: file name of the calling function, i...
5730dd9508cba3becd0120e19adb4456d464f8cc9c5a5c739bf87cb6080b769c
MATLAB
1,079
35
function defaults = get_additional_constructor_inputs(this) % Returns additional (non-property) inputs that can be set in constructor % of MrDimInfo, e.g., 'firstSamplingPoint', along with their defaults % % Y = MrDimInfo() % Y.get_additional_constructor_inputs() % % This is a method of class MrDimInfo. % % IN % % ...
77b285c46a6ac1027428722e1c9030a31203cf8a93d601a5becf0549698b5d3d
MATLAB
1,080
34
function getTriggers_emoReco_answer(params) % finds events when subject answered correctly (= right) or wrong % (c) Jiri, Mar16 display([' - finding events for: ' params.thisCategory]); %% per session: load trials, find events and save for sess = 1:size(params.storage.sessionCacheFiles,2) % load trials ...
99787c38c1ad78d5e2688e543ecf57414ae58d722e5b620d3d1b947d658f77d3
MATLAB
1,080
34
function c = redblue(m) %REDBLUE Shades of red and blue color map % REDBLUE(M), is an M-by-3 matrix that defines a colormap. % The colors begin with bright blue, range through shades of % blue to white, and then through shades of red to bright red. % REDBLUE, by itself, is the same length as the current...