sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
db6d7db0744e4e376569e702f42f54c5d63093c6bfcff3112316f54b9e40407b
MATLAB
2,197
92
function [inference] = tapas_vlinear_inference(inference, pars) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % if ~isfield(inference, 'estimate_method') inference.estimate_method = @tapas_mcmc_blocked_estimate; end if ~isfield(inference, 'initialize_states') inference.initialize_states = @tapas_linear...
3ab294af899b3b673cb93da070fb2479f7b824499cf3a044cda9c0adf7b73e82
MATLAB
2,198
83
function FigureS4(datadir, codedir) %FigureS4 - Average trial initiation time in mixed blocks conditioned on % the previous block % datadir = directory of dataset % codedir = director of code %% Set up paths s = pathsep; pathStr = [s, path, s]; onPath = contains(pathStr,... codedir, 'IgnoreCase', ispc); if ~...
6a19f583395fd805517d0f122d9912f62f75a210e7c26002fed7d7d6bf575e37
MATLAB
2,199
65
%% [chi] = Wrapper_QSM_CFSL2(localField,mask,matrixSize,voxelSize,algorParam,headerAndExtraData) % % Input % -------------- % localField : local field map (tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial resolution of each dimension of the data,...
fa089b5072069ef80435158122f994ab339cab5bc4685fa05a527e858132d3bf
MATLAB
2,199
54
function truncated = TruncateIntervals(intervals, duration, flip) %TruncateIntervals % % Sometimes it makes sense to limit the duration of the intervals you are % analysing: for example, taking the first hour of slow wave sleep to % score reactivation/replay. TruncateIntervals will truncate the inputted % intervals f...
d29b661a512771a1005c78ef84bb7ed3b5b09805e9df4f17d9dc59d8ca39d124
MATLAB
2,200
59
%% function sphereKernel = SphereKernel(matrixSize,radius,voxelSize) % % Input % -------------- % matrixSize : chi matrix size % radius : radius of sphere, in mm % voxelSize : voxel dimensions, in mm (1x3 vector); default = [1 1 1], % i.e. radius is treated as being in voxe...
fc715a8a3d470d7f69c033d34f88a8b8a42588d4b6cc71cc67df4b184de80643
MATLAB
2,200
75
function fear_cueTrigReact_cond(basename,varargin) load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) param.binSize=0.02; param.halfWindow=5; param.targetHC=3; param.varName='cueTrigReactCond'; param.saveFile=[basicMetaData.AnalysesName '-cu...
31fd57638ae9d2a1cf3ba45e77ba4b118a6afd447d3bd751496f2b7805599488
MATLAB
2,201
59
function [ T ] = getMultilevelThresholds(I, ttotal) % OTSUREC Returns a set of thresholds for the input image using the multi-level % otsu algorith. % % OTSUREC computes a set T of thresholds from the input image I employing the % multi-level Otsu algorithm. The multi-level Otsu algorithm consists in % fin...
328a9ecdfac21ae2d9839d7328ac03cc031f5f0591723ad96ee5d851230779dd
MATLAB
2,201
47
function mask = select_this_atlas_subset(region) run('set_library_paths.m'); addpath(SPM_PATH); % per spm docs, do not genpath it addpath(genpath(CANLABTOOLS_PATH)); addpath(genpath(CANLABMASKS_PATH)); % this atlas is not implemented through CanlabCore/Neuroimaging_Pattern_Masks % so we're just...
4f2a7cf7a92bab27a13e6379336dc6ab7a83ad9e7498d47e2ed15dbd87134621
MATLAB
2,202
59
% -------------------------------------------------------------------- function set_static_box_height_Callback(hObject, eventdata, handles) % hObject handle to set_static_box_height (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see G...
e005a7bb3602d29873621937095210332be87a7aca7c416f627c9e25a00775da
MATLAB
2,202
75
function cellid = fname2cellid(fname) %FNAME2CELLID Convert filenames to cell IDs. % CELLID = FNAME2CELLID(FILENAME) converts valid filenames into cellids % or returns empty if it fails. % % Valid filenames % (1) start with the default path or only include 'rat\session\unit.mat' % (2) unit 1 of tetrode 1...
2da8e29bdef0640baf2c1e97e90c2d5a0c1e343d412c30047ac5e37fd8e57f30
MATLAB
2,203
57
function plotOptoHists(data) % Plots histograms of contact times during optogenetic stimulation % Requires data already concatenated across behavior files into a "data" % struct % Separate trials trialsNormal = [data.success] == 1 & [data.optoProblem] == 0 & [data.optoTrial] == 0 & [data.grabTimeC] > [data.liftTimeC] ...
9c6f478f31e88215bc4bfe34dde64492480bdd893040d94f4dbe13f196f084c1
MATLAB
2,203
49
% EEG_CHANINDS - look up channel indices in a EEG structure. Function is obsolete. % Use EEG_DECODECHAN instead. % % Usage: % >> inds = eeg_chaninds(EEG, channames); % Inputs: % EEG - EEG structure containing a chanlocs substructure. % the chanlocs structure may also be ...
61f9327e84a49c4a121f83c053424cf8108dec297790f09f1c42847a536ec83f
MATLAB
2,204
70
function paths = config() % CONFIG - Configuration file for SwitchBeta analysis % % Returns a structure containing all path information needed for the analysis. % % INSTRUCTIONS FOR SETUP: % 1. Copy this file to config.m (which is git-ignored) % 2. Edit the paths below to match your local system % 3. Run config(...
6d8d7f6c21f563fffc0414a29f4ee2a09c3dcab39e09bae7cb639ee01f942085
MATLAB
2,204
87
function db_insert(tablename, s) % DB_INSERT inserts a structure into a database table. Each field of % the structure should correspond with one of the fields in the table. % % Use as % db_insert(tablename, s) % % See also DB_OPEN, DB_SELECT, DB_SELECT_BLOB, DB_INSERT_BLOB, DB_CLOSE % Copyright (C) 2007, Robert Oos...
496676430fe23337a7f187bb8bf88dcf0981f27627ced5251e1497017cc22d24
MATLAB
2,205
54
function TMSDeepTargetComp (t1dir,outdir,coord,roiradius,depthx) %% example for input parameters t1dir = 'E:\tt\wc1co3.nii' % the pathway of your c1co*.nii in MNI space outdir= 'E:\tt' % folder saving associating results coord = [-35.06 -8.97 79.47] % MNI coordinate % this funciton was based...
b03ca32c4d366e9d99e68e654ca569dc0e8215eab2727f103c89dbac877adec1
MATLAB
2,205
71
function matlabbatch = tapas_physio_update_batch_with_spm_jobman(matlabbatch, ... fileBatchM) % loads existing matlabbatch into SPM Job manager and returns updated % matlabbatch object (e.g., if created with old version and new fields % were added to matlabbatch structure) % % matlabbatch = tapas_physio_updat...
be80775222f4d85bbb78d67ab0c10a95113a19cbf147edfffab4f5d3bbd128ce
MATLAB
2,205
59
% prior distributions to be used for hyperparameters of Gaussian processes % using infPrior. % There are two different kinds of prior distributions: simple and composite: % % simple prior distributions: % % priorGauss - univariate Gaussian % priorLaplace - univariate Laplace % priorT ...
e37e125940a045ace4454880c3c82b197c0fc5940364857f56e2a78c6a0db320
MATLAB
2,205
86
function [gx_sym,gy_sym,gz_sym,u_sym,v_sym,w_sym]=symmetrize_vector(gx,gy,gz) % This function symmetrize gradient vectors %Shift the image if the first dimension is odd number if mod(size(gx,1),2)==1 Shift=1; if Shift gx_old=gx; gy_old=gy; gz_old=gz; NN=size(gx); gx=zeros(NN(...
0dc720b48ddc3c5f68e0ba0efe564711b3bb1703ec23622b895b90bde3f515e8
MATLAB
2,206
69
%% inputNIFTIList = read_default_to_filelist(inputDir, filePattern) % % Input % -------------- % % Output % -------------- % % Description: % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 11 August 2021 % Date modified: % % function [isLoadSuccessful, inputNIFTIList] = read_default_to_filelist(inputDi...
8a8b047a7fa9e9e4a41135064947abc5594220646d940a90d7a4abfc68f20af2
MATLAB
2,206
62
function glm_prfINITIALSCREENING(ppdir,runix) % approach: assume HRF, average the 3 reps up front, fit all data, do supergrid. % define tr = 1; % load data data = {}; for p=1:length(runix) a1 = load_untouch_nii(sprintf('%s/preprocessVER1/run%02d.nii',ppdir,runix(p))); data{p} = single(a1.img); end clear a1; % l...
5abd0260672b1b78e16fab4c49d2d2abe8b327fa06d0e6efddb5bee7490c0cc4
MATLAB
2,208
69
function [SW,w,CC,PLn] = small_worldness_RL_wu(A,R,L) %SMALL_WORLDNESS_RL_WU Small-worldness % % [w,CC,PLi] = small_worldness_RL_wu(A,R,L); % % The value of small-worldness, w, is between -1 and 1. Values close to % 0 have small-world properties; values close to 1 have random % properties; values c...
b8a883e1d8acbed26b91b25e31b64c3540a82d8cd86c44c215b5bf6b4c3eb7d6
MATLAB
2,208
91
% op_takeaverages.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_takeaverages(in,index); % % DESCRIPTION: % Extract the averages with indices corresponding to the 'index' input % array. % % INPUTS: % in = input data in matlab structure format. % index = vector indicating the indices of the average...
a9ba0734a1bc2f27c2516b819945d4d00b4fcfafe0cd9d50bb4e16e12259b845
MATLAB
2,209
69
function violin(hA, Y, axLoc, color, alpha, mrkSz, mxStr, txtCol, fntSz, bw) if isempty(hA) hA = gca; end %% Calculate the kernel density if axLoc(1) == 0 plotY = 1; axLoc = axLoc(2); else plotY = 0; axLoc = axLoc(1); end if nargin > 9 [f, u, ~] = ksdensity(Y, 'Bandwidth', bw); else [f, ...
76be9f0b59326120c640d42a61e81627daba3fd1006b3e66fab26b04fb754f7c
MATLAB
2,210
95
function y = tapas_softmax_wld_sim(r, infStates, p) % Simulates observations from a Boltzmann distribution with volatility as temperature % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2019 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of...
486527575b0292ff504ea95fd77305ec9ab3e1ff35586f9aeb75486a649b93af
MATLAB
2,211
59
function MakeTableOfFunctions() % MakeTableOfFunctions Outputs a csv summarizing INP_mops.txt % ------------------------------------------------------------------------------ % Copyright (C) 2013-2026, Ben D. Fulcher <ben.d.fulcher@gmail.com>, % <http://www.benfulcher.com> % % If you use this code for your research, pl...
d8369dd338b37e10f8aa1ea7ec89be10c41b22e110e3ff90afb2636d0854e115
MATLAB
2,211
75
function [w, state] = adam(w, state, grad, opts, lr) %ADAM % Adam solver for use with CNN_TRAIN and CNN_TRAIN_DAG % % See [Kingma et. al., 2014](http://arxiv.org/abs/1412.6980) % | ([pdf](http://arxiv.org/pdf/1412.6980.pdf)). % % If called without any input argument, returns the default options % structure....
26c2490d3e004e1d5eba9f3f97537f5f10b73d608ad6026f5c4876ba18fb530c
MATLAB
2,213
62
function id = defaultId(stack) % DEFAULTID returns a string that can serve as warning or error identifier, % for example 'FieldTip:ft_read_header:line345'. % % See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG % Copyright (C) 2017, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptool...
b7eed09f57270c5018b25edf28958b0eed188d819b3ff67ba25e8f6f2ab1cbef
MATLAB
2,214
76
% function output = test_add_overlay(input) % Test image overlay creation and plotting of 3D-RGB-image via montage % % output = test_add_overlay(input) % % IN % % OUT % % EXAMPLE % test_add_overlay % % See also tapas_uniqc_add_overlay % Author: Saskia Bollmann & Lars Kasper % Created: 2014-11-25 % Copyright (...
146f023677a05449b34d8ca8fb5c370e35479c9cf10e4f5dabe386596018803e
MATLAB
2,218
62
%% choose an arbitrary pupil trace key.animal_id=8804; key.session=1; key.scan_idx=3; %% fetch timestamps, fetch and filter pupil radius trace r = fetchn(preprocess.EyeTrackingFrame & key,'major_r'); pupilTime = fetch1(preprocess.Eye & key,'eye_time'); % interpolate over undetected frames rInterp = interp1(pupilTime...
1af7bed66a0457c304bd8def80e2050f2b23d1471696dae294c7e625260cc267
MATLAB
2,218
79
function vl_testnn(varargin) %VL_TESTNN Run MatConvNet test suite % VL_TESTNN('option', value, ...) takes the following options: % `cpu`:: true % Run the CPU tests. % % `gpu`:: false % Run the GPU tests. % % `single`:: true % Perform tests in single precision. % % `double`:: false % Perform tests in do...
ce0af48f253485525f636205c23707063ad7187765b64a224ab539e9591172b8
MATLAB
2,218
79
function indic = meta_stochastic_mask_blobs(volInfo,cl) % indic = meta_stochastic_mask_blobs(volInfo,cl) % % Shuffles blob locations (centers) for a study % Makes a mask first and then returns % indicator (indic) format for aggregation across studies % % Inputs: % volInfo.xyzlist: list of all in-mask coordinates (e.g.,...
251820d6b0ade450c2ba130df8967e8c627b091e6cfc3d7a86657db3052405c5
MATLAB
2,220
74
function interactiveConductance3Droi(fa, mask, atlas, dim_size, potentials, dim, slice, max_limit) % Interactive conductance map % % Author: Aina Frau-Pascual % Conductance map if dim==3 fa2 = squeeze(fa(:,:,slice)); mask0 = squeeze(mask(:,:,slice)); dimx_size = dim_size([1,2]); atlas_slice = squeeze(...
5cb1fb35df42dcc084925e51e885486a0c747ed7f469625c292f74254b3f9a32
MATLAB
2,220
59
function [dataheat, ind_lim] = get_norm_rsc(spktr, norm_ind, nbins, prct_bounds) % GET_NORM_RSC % Syntax: % [dataheat, ind_lim] = get_norm_rsc(spktr, norm_ind) % [dataheat, ind_lim] = get_norm_rsc(spktr, norm_ind, nbins, prct_bounds) % Description: % Given neurons-by-time spike counts (spktr) and a per-neuron nor...
03bb5b38d71c8837798613a0d6ed01709e840c666ba658db492f30479b5aee08
MATLAB
2,221
40
function outputStruct = pairsProcessing(recordingData, recordingName, ... singPulseRange, multPulseRange, show_plots) disp("Processing singPulseRange") mult = 0; calculateCurrent(recordingData, singPulseRange, mult, show_plots); disp("Processing multPulseRange") mult = 1; calculateCurrent(rec...
56193357296237f2c12fb20b36054f5b3cdd755f3bb13475b42da034117c271f
MATLAB
2,221
73
function n2f=surfing_nodeidxs2faceidxs(f) % finds the mapping from vertices to face indices. % % N2F=NODEIDXS2FACEIDXS(F) % INPUT: % F: Px3 node indices for P faces (base1) % OUTPUT: % N2F: QxR mapping matrix for Q nodes (Q==MAX(F(:))), if R is the % maximum number of faces that contain a single n...
3992cf656f597eaf4f4e8cee5fa4513d2320f4902c6db1fa7d77a8865de158f7
MATLAB
2,222
54
function UKeywords = TS_WhatKeywords(whatData) % TS_WhatKeywords Lists keywords contained in the specified HCTSA data file % ------------------------------------------------------------------------------ % Copyright (C) 2013-2026, Ben D. Fulcher <ben.d.fulcher@gmail.com>, % <http://www.benfulcher.com> % % If you use...
732175c371b2ad30422c3d4ecc9bf1dd81089ced21b46075a0a85a2ebe6a22fe
MATLAB
2,222
54
% Regenerates the small-worldness ground-truth fixture used by % test_pipeline_small_worldness.py. Unlike the other gen_*_reference.m % scripts, this does NOT depend on a real MATLAB pipeline run's saved % adjacency matrices (OutputData03Mar2026/ExperimentMatFiles isn't always % present in every environment) — it build...
e981b8b0ef9e2ccbe892de9ee2bceddcf9ee2870a9b39f8e244b69b05882279d
MATLAB
2,222
67
function results = analyze_simulation_results(s2, params, elapsed_time) % ANALYZE_SIMULATION_RESULTS - Calculate simulation statistics % % H1 Line: Analyze spike data and compute network statistics % % Syntax: % results = analyze_simulation_results(s2, params, elapsed_time) % % Description: % Computes firing rates,...
867a3638466b3d1b27786c851fe840180674f90070fc716a65507f3d4daa23dc
MATLAB
2,223
72
% generateSFTimeSeries - Generate stimulus time series from run info % Converts SF indices into a vector of SF values. % Blank periods are filled with a small value (0.0001) to avoid log(0) in logGauss. % % Syntax % I = generateSFTimeSeries(p, t) % % Input Arguments % p - structure containing ...
17617f420667c83e5e0e59b258d138d94fcc0465975111e8fd7757efa9d5eb93
MATLAB
2,224
51
%-------------------------------------------------------------------------- % voxelize.m script is used generate voxelized tif file from sparse points % %% Developed and maintained by Kannan Umadevi Venkataraju <kannanuv@cshl.edu> %% do not distribute without permission. % % Usage % nx=450; minx=0;maxx=450;ny=650;miny...
410aa5fd1cd8d644da9dc5b4ac85f31dbce1fce99e0e74018c9f18c611650dd0
MATLAB
2,224
84
function [BCMatrix, BCRHS] = boundaryCondition1D(BC) % It creates the matrix of coefficient based on the BC structure provided % by the user. It also generates the right hand side vector of the linear % system of equations % % SYNOPSIS: % [BCMatrix, BCRHS] = boundaryCondition1D(BC) % % PARAMETERS: % % % RETURNS: % % ...
6f5dc95983c8039bcd0b6a7472354ba869cf6e06ea6382b4f7d143e2fb111745
MATLAB
2,225
54
function [nirs, qualityMatrices] = pruneWithQT(nirs, params, numChan) % Applies the QT-NIRS algorithm to prune channels based on scalp coupling % index (SCI) and power spectral power (PSP) thresholds. Ensures that both % chromophore channels are consistently pruned if one is marked for % removal. % Check if pa...
8e34ae3b7746d92bc12c49b0c2bd31dcbbeaccb2a277809fd048b8611bb13895
MATLAB
2,225
86
function [m1gs] = GS_orth_1D(fname, rescale, show, oname) % % [A_orth] = GS_orth_1D(fname, rescale, show, oname); % % A function to perform Gram-Schmidt orthogonalization % on 1D files. % % fname: Name of AFNI 1D file % If nothing is specified, GUI file selector is used. % Note that you can pass a m...
c46089d690dc56439407224f164b6facdb78ed6baaeacc707b58db2d22426447
MATLAB
2,225
54
function out = DN_PLeft(y, th) % DN_PLeft Distance from the mean at which a given proportion of data are % more distant. % % Measures the maximum distance from the mean at which a given fixed proportion, % p, of the time-series data points are further. % Normalizes by the standard deviation of the ti...
f86caf65cb2964465090d1869fd611a9480572cef00a3e6d9a83a80c38259535
MATLAB
2,225
77
function data = read_asa_msr(fn) % READ_ASA_MSR reads EEG or MEG data from an ASA data file % converting the units to uV or fT % Copyright (C) 2002, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free software: you ca...
2de4922a00bde574b413cc309109f31c2ff8977396135341751955d327fb15ef
MATLAB
2,226
71
function [fh, this] = plot_regressors(this, module) % Plots regressors % % G = MrGlm() % G.plot_regressors(inputs) % % This is a method of class MrGlm. % % IN % module which type of regressors shall be plotted % 'realign' Realignment parameters. % See also MrImage.re...
e49b3edd005dcd46d905ea64df5cea17115c530397c9b8077609a158d8471430
MATLAB
2,226
58
function [rez]=projection_2(rez,DATA) M_clust = length(unique(rez.st(:,end))); nt0 = rez.ops.nt0; Nchan = rez.ops.Nchan; batch = length(unique(rez.st(:,end-1))); Nrank = 3;%default value for projection hard coded [~,W, ~, ~,~] = SVD_template(single(rez.M_template/(rez.ops.bitmVolt*rez.ops.scaleproc)), Nrank,rez.ops....
305dc1224f21135725ec686db2fdc82b52f3a852cd6deafb7ba75fc67bf63787
MATLAB
2,227
87
function [amsd_out] = amsd_detector(hsi_img,tgt_sigs,mask,n_dim_tgt,n_dim_bg) % %function [amsd_out] = amsd_detector(hsi_img,tgt_sigs,mask,n_dim_tgt,n_dim_bg) % % Adaptive Matched Subspace Detector % % ref: % Hyperspectral subpixel target detection using the linear mixing model (article) % Manolakis, D. and Siracusa...
3b2ba51603fe987ba801d92cb066cbaa7679b3a3bc01c6c3ff75536298fe8058
MATLAB
2,228
66
function export_Calls(loop_function, file_postfix, hObject, eventdata, handles) % hObject handle to excel (see GCBO) % This function xports selected call files to excel sheets with stats for each call %% Select Files % Select the files [fname, fpath] = uigetfile([char(handles.data.settings.detectionfolder) '/*.mat'...
7972f51610fe85bdaff91b28937b0d791ee378bf7af28f07c47caab00f08372d
MATLAB
2,229
58
function M = specialeuclideanfactory(n, k) % Returns a manifold structure to optimize over the special Euclidean group % % function M = specialeuclideanfactory(n) % function M = specialeuclideanfactory(n, k) % % The special Euclidean group (the manifold of rigid transformations): % This is a product manifold of the ro...
b186cab4f198d5a98f6d794e7331ba286079e766525f86447716d16aaed749f5
MATLAB
2,229
69
function plotMP2RAGEproperties(MP2RAGE, HG) % Don't plot anything if the user has closed the figure if nargin<2 HG = gcf; set(HG, 'Name','MP2RAGEproperties'); end if ~isgraphics(HG) return end % define signal and noise function as in the paper Signalres = @(x1,x2) x1.*x2./((x2.^2+x1.^2)); noiseres = @(...
44d14b8c3e2a190ccadec38956419a3baccb0c11e8ed0af4da7fda549ff104a7
MATLAB
2,230
87
function [LocalMinIndex, BasinGraph, AdjacentList] = mfunc_LocalMin(nodeNumber, E) % Find local minimum points % Get vector list vectorList = mfunc_VectorList(nodeNumber); % Calculate vector index (See mfunc_VectorIndex()) [vectorIndex EnergyIndex] = mfunc_VectorIndex(vectorList); % Calculate local minimum ...
57f3549762c6c7ec32f046937c79624cd76222960b4c5253a475f205a9c20075
MATLAB
2,230
58
%VL_NNBNORM CNN batch normalisation. % Y = VL_NNBNORM(X,G,B) applies batch normalization to the input % X. Batch normalization is defined as: % % Y(i,j,k,t) = G(k) * (X(i,j,k,t) - mu(k)) / sigma(k) + B(k) % % where: % % mu(k) = mean_ijt X(i,j,k,t), % sigma2(k) = mean_ijt (X(i,j,k,t) - mu(k))^2, % ...
b2c2a804b69529066c1ea1e8cc7ea0573710d6c725e0652068e8743eddface56
MATLAB
2,230
91
function h_line=signalplot(S) %function h_line=signalplot(S) % %PURPOSE % %To plot several signals, e.g., estimated sources into the same %graphic axis; a simplified alternative to MATLAB's native subplot %command. % %EXAMPLE OF BASIC USE % %Get the "best" estimated sources from Icasso result struct sR and %plot them...
984a62b3e8fecfc9f9189bc0da50b0bf35fb1fe10dca0954aed4748fed499e72
MATLAB
2,231
48
function tapas_ph_binary_plotTraj(r) % Plots trajectories estimated by tapas_fitModel for the tapas_rw_binary perceptual model % Usage: est = tapas_fitModel(responses, inputs); tapas_rw_binary_plotTraj(est); % % -------------------------------------------------------------------------------------------------- % Copyri...
41a7d3d3bbb5a05731261f43f04b971e8198a471447d1d4b8dc1ded049e77880
MATLAB
2,232
59
function propIncreased = computeTrialProportion(all_spike_times_s, allStimTimes, poststim_window_s, baseline_window_s) % COMPUTETRIALPROPORTION Proportion of trials with more post-stim than pre-stim spikes. % % For a single electrode, this function: % 1. For each stimulus trial, counts spikes in the pre-stim and post-s...
667ed2f3ca0bdb1e9848c4ae27d301150b1463352bee2211c4e4ab2322fd4fb1
MATLAB
2,232
50
% TUTORIAL - Bring up the ICA / electrophysiology toolbox tutorial % in a browser window (see docopt.m in the toolbox dir). % Tutorial URL: http://www.sccn.ucsd.edu/tutorial/ % Download: See http://www.sccn.ucsd.edu/ica.html % % Authors: Scott Makeig & Tzyy-Ping Jung, SCCN/INC/UCS...
c496ff3dfa63c333448b0850ed7aa8b2526f91b798671051a0111b6892e4efa1
MATLAB
2,232
41
function [HeadMotion FD_Jenkinson FD_VanDijk FD_Power]=HMCal(RPDir,MeanFunDir) RP = load(RPDir) ; % [path aname b] = fileparts(RPDir) MaxRP = max(abs(RP)); MaxRP(4:6) = MaxRP(4:6)*180/pi; MeanRP = mean(abs(RP)); MeanRP(4:6) = MeanRP(4:6)*180/pi; %Calculate FD Van Dijk...
e49b851e1702973ed54fed73e23026f56bec8f5502a0158d2be13c87d8c90504
MATLAB
2,232
70
[data4 timeEP] = load_open_ephys_data_faster('\*.spikes'); NumSpikes = 4; % indicate the number of diff cells from the particular electrode Tfile= FindFiles('TTp113.0n0*.t64'); r= LoadSpikes(Tfile); RawData = zeros(40 +3, 4*NumSpikes); InterpFactor = 20; %interpolation factor for i = 1:NumSpikes for k = 1:4 data = ...
0b5460c67c284e7532de2dacf7d50a73dd85c0db8122974e456c7956c06ce7fa
MATLAB
2,233
75
%{ Copyright (c) 2024 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef Waveform < matlab.mixin.Heterogeneous %WAVEFORM Container for single dimensional recorded sample data % % Channel: Source Location of the waveform % % Start: Tim...
5f1e426154708ffc09ae55f63faf23a3dd06f1eb1cda39579312a84cc66564bf
MATLAB
2,233
51
function [ floatVAXF ] = uint32le_to_VAXF( uint32le ) %UINT32LE_TO_VAXF Converts from IEEE-LE (UINT32) to VAXF (single precision) % This function takes a raw 32bit unsigned integer (little endian) % and converts it into the equivalent floating point number it represents % in the VAXF file format for floating point n...
3ad1b618d7987164a59534bc0228d95d0bb3d2534181190de2851916709d85a4
MATLAB
2,234
70
function [vol] = read_ctf_hdm(filename) % READ_CTF_HDM reads the head volume conductor model from a *.hdm file % % vol = read_ctf_hdm(filename) % Copyright (C) 2003, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free...
79cbe868dba0a7a2bdc8bd6f37da038a4d083cd13c3f34b04d85bf02dddc3ed6
MATLAB
2,234
69
function [M, Mx, My] = diffusionTerm2D(D) % This function uses the central difference scheme to discretize a 2D % 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: % %...
d4fa6e6961e0e37f62c0d82d9c6443373919c2e34f02418f555353e3e06f202c
MATLAB
2,234
76
function cost = plotprofile(problem, x, d, t) % Plot the cost function along a geodesic or a retraction path. % % function plotprofile(problem) % function plotprofile(problem, x) % function plotprofile(problem, x, d) % function plotprofile(problem, x, d, t) % function plotprofile(problem, x, [], t) % function plotprofi...
f5839bb24605355c6574290a2c70470785f2cb1b8d2d5ff13d4abed5c92f91b5
MATLAB
2,234
53
%{ # all directional drift trials for the scan -> preprocess.Sync --- ndirections : tinyint # number of directions %} classdef Directional < dj.Computed properties keySource = preprocess.Sync & (vis.Trial*vis.Monet & 'speed>0' & 'trial_idx between first_trial and la...
4808cd4eaeeb359428c7bc912dd7a942f45fe9b3ee5a0140fa7260eea72481f4
MATLAB
2,235
68
function ImportFromXBAT(hObject, eventdata, handles) [fname, fpath] = uigetfile('*.mat','multiselect','on','Select X-BAT logs'); if isnumeric(fpath); return; end [outpath] = uigetdir(handles.data.settings.detectionfolder,'Select Output Folder'); if isnumeric(outpath); return; end if ischar(fname) fname = {fname};...
0fa378b8b440b44594f428b4e689319f5c04d9be98197a5542026615bf046479
MATLAB
2,236
50
function [pval,norm_zscore] = get_episode_signif(raw_trace,this_eventonset_frames,this_eventoffset_frames,shuf_frame_range) % determine whether each cell’s activity was significantly correlated with a behavior % ZZ 2022 % Ref: Paquelet et al, Neuron, 2022. num_shuff = 1000; if isempty(this_eventonset_frames)||isem...
77175c2b03151ae93588567b3bc205b2f597d171d5ddda9a1f1af65159271309
MATLAB
2,237
62
function otherImage = compute_mask(this, varargin) % transforms image into binary mask with pixels >= threshold set to 1 % 0 for all other pixels % % Y = MrImage() % Y.compute_mask('ParameterName', ParameterValue) % % IN % varargin 'ParameterName', 'ParameterValue'-pairs for the following % prope...
78325088af41c2145cc3e02d6f63c0464d5a5089e51b5569fdd10c781a0f1bca
MATLAB
2,238
56
function [lp,dlp] = priorTMulti(mu,s2,nu,x) % Multivariate Laplace hyperparameter prior distribution. % Compute log-likelihood and its derivative or draw a random sample. % The prior distribution is parameterized as: % % p(x) = ( 1 + r2/(nu-2) )^(-(nu+D)/2) / Z, where % Z = gamma(nu/2) * sqrt(det(pi*(nu-2)*s2))...
b58529af15322ae8d7c8499aa0be413fbb12957e1ccf3b03dce8b66e07848396
MATLAB
2,238
52
function osp_updateMMSpecsOvWindow(gui) %% osp_updateSpecsOvWindow % This function updates the specs overview tab. % % % USAGE: % osp_updateSpecsOvWindow(gui); % % INPUT: % gui = gui class containing all handles and the MRSCont % % % AUTHORS: % Dr. Helge Zoellner (Johns...
d50fd079e1de1849a202a0f6347791150d679fc150d394eb95621e984361d92e
MATLAB
2,239
73
% op_phaseCrCho.m % Georg Oeltzschner, Johns Hopkins University 2019. % % USAGE: % [out,phaseShift]=op_phaseCrCho(in, suppressPlot); % % DESCRIPTION: % This function fits two Lorentzians to the Cr and Cho peaks, and optimizes % the phase of the input spectrum based on Cr/Cho. % % If data with multiple averages is sup...
de4810d9bd98bd906dedd7c76e3b38adc26dcefb6e130033845e9737093b2764
MATLAB
2,239
73
% Bang et al (2020) Private-public mappings in human prefrontal cortex % % Reproduces Figure 3C % % Visualises ROI contrast estimates under GLM1 and performs associated % statistical test % % Note that contrast estimate for "signalled vs hidden" (SvH) context is not % shown in Figure 3C but is included here % % Statis...
257f704424c4cefeb1748ba2ff758b506955a40ddcd3e6f4600f4eede417e36d
MATLAB
2,240
58
function [Wrr, Wrf, degree_params] = load_indegree_connectivity(options, params) % LOAD_INDEGREE_CONNECTIVITY - Load connectivity with degree information % % H1 Line: Load connectivity matrices with heterogeneous degrees % % Syntax: % [Wrr, Wrf, degree_params] = load_indegree_connectivity(options, params) % % Descrip...
f2e6b791271c03ee37e186c9fbbf2b86eacebff1aaf883f412b58b19286b9fea
MATLAB
2,240
58
function out = DN_CustomSkewness(y, whatSkew) % DN_CustomSkewness Custom skewness measures % % Compute the Pearson or Bowley skewness % % ---INPUTS: % y, the input time series % % whatSkew, the skewness measure to calculate, either 'pearson' or 'bowley' % % cf. https://mathworld.wolfram.com/PearsonsSkewnessCoeffici...
fcfb0cf7af12727f4d3da5058e48aa3453caac060265812a9323ad389b31fb5a
MATLAB
2,240
69
% Preprocessing of fmri time series % % This script performs slice timing correction, fieldmap undistortion and % realignment of an array of fmri time series. Realignment can be done % across multiple time series. Note that the same slice timing and fieldmap % parameters are assumed for all time series. So, it makes m...
863d31402f6db94105d456b60f26a163953b1cbc8b04d5c6db59478a2dac71cb
MATLAB
2,241
73
function [gx,gy,gz,mag]=compute_grads_local(img) %Neighbourhood for connected components %6 or 18 or 26 Ngh=6; %Pad edges to account for excessive cropping of full image img_new=zeros(size(img)+2); img_new(2:end-1,2:end-1,2:end-1)=img; img=img_new; ind=find(img); fprintf('%d voxels in mask\n',length(i...
6738ae72aff391fca52093219ee033f9e179e654bdef6066d5ded56ee8989b01
MATLAB
2,243
68
function L = compute_slice_leakage(this, dy, dz) % Computes slice leakage as cross-correlation between this image and a FOV % and slice-shifted copy % % Y = MrDataNd() % L = Y.compute_slice_leakage(dy, dz) % % This is a method of class MrDataNd. % % IN % dy [1, nShifts], FOV shift(s) in number of pixels in y (ph...
339ec12c7486323a771463ac179922f143c9e4a8a2d21e4a8ed505a339019421
MATLAB
2,244
55
function [ensmat_in,enscells_in,raster,frates] = generate_data(N,T,nens,ncellsperens,fr,timesperens,show_plot) % Generate a synthetical raster with pre-defined ensembles. % INPUT: % N : <integer> with the number of neurons in the population. % T: <integer> with the number of total frames. % nens: <integer> with t...
7c4e95bc0965059d7c0b52ab454a974c41a87d6e889f6a5d8d20231edbbee8dd
MATLAB
2,244
96
function y = tapas_softmax_mu3_wld_sim(r, infStates, p) % Simulates observations from a Boltzmann distribution with volatility as temperature % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2017-2019 Christoph Mathys, TNU, UZH & ETHZ % % This file i...
564121fc709fbfb3dd45050e509590ea5c8fa9b617b504ab5bb5748d02006aac
MATLAB
2,245
70
function [rez]=merge_temp(rez,Threshold) %Variable initialization SF = rez.ops.fs; %sampling frequency to convert from sampling rate to second Nclusters = length(unique(rez.st(:,3))); %Number of initial clusters from kilosort NG_clus = Nclusters; %Number of clusters nt0 ...
5c57c1f37a4c7d05eefc92cd77f521e970fe4c0d311128cc576d636aa9df77ba
MATLAB
2,245
54
% compute abscissas and weight factors for Gaussian-Hermite quadrature % % CALL: [x,w] = gauher(N) % % x = base points (abscissas) % w = weight factors % N = number of base points (abscissas) (integrates an up to (2N-1)th order % polynomial exactly) % % p(x)=exp(-x^2/2)/sqrt(2*pi), a =-Inf, b = Inf % % Th...
2a9fa3c03f7dd6081fe0ddcbb95913748e5f5ddd70de632ceecc76dcd1120a99
MATLAB
2,246
61
function Show_RVT_Peak(R,fg), for (icol = 1:1:length(R)), figure(fg); clf set (fg, 'KeyPressFcn', @afni_fig_interface); subplot(211); plot (R(icol).t, real(R(icol).X),'g'); hold on if (~isempty(R(icol).RVT)), subplot (211); plot (R(icol).tmidprd,... ...
2f484acee382ad80840b91601cc27ca045d7b759339036497f580c9f0a2e92e6
MATLAB
2,246
94
%% === compare timings for MULT % number of repeats (to increase measurement accuracy) R = 10; % what sizes of (square) matrices do we want measure? (log spacing) nn = unique(round(exp(linspace(log(4),log(100),10)))); % number of different sizes to try N = length(nn); % size of the output C, in Megabyte...
533200edfeb4fe34e255d6c90dd691dd95f31e067bd6f338b50a9cb1157963f0
MATLAB
2,246
78
% op_getSNR.m % Jamie Near, McGill University 2014. % % USAGE: % [SNR]=op_getSNR(in,NAAppmmin,NAAppmmax,noiseppmmin,noiseppmmax); % % DESCRIPTION: % Find the SNR of the NAA peak in a spectrum. % % INPUTS: % in = input data in matlab structure format % NAAppmmin = min of frequncy range in which to searc...
edcd34c3b98c6822e3390b932843f4ac95919c68cee2124717177123e5f2694f
MATLAB
2,246
81
function [vertex,face,normal, uv, sphparam] = read_mesh(file) % read_mesh - read data from OFF, PLY, SMF or WRL file. % % [vertex,face] = read_mesh(filename); % [vertex,face] = read_mesh; % open a dialog box % % 'vertex' is a 'nb.vert x 3' array specifying the position of the vertices. % 'face' is a 'nb.f...
4f0069f756267a1a3eea43d2698fba18154b097df361cf41afa05bad2a6f2204
MATLAB
2,247
54
function y = BF_PreProcess(y,preProcessHow) % BF_PreProcess Preprocess a time series, y % ------------------------------------------------------------------------------ % Copyright (C) 2013-2026, Ben D. Fulcher <ben.d.fulcher@gmail.com>, % <http://www.benfulcher.com> % % If you use this code for your research, pleas...
abe13d5e63d4b917d1b7c5e4988158bc85aa581eef816dce6288a6e673ee09c6
MATLAB
2,247
53
function signal = clean_drifts(signal,transition,attenuation) % Removes drifts from the data using a forward-backward high-pass filter. % Signal = clean_drifts(Signal,Transition) % % This removes drifts from the data using a forward-backward (non-causal) filter. % NOTE: If you are doing directed information flow analys...
6ca6a2a49dbee8563f8cc2bee8cf99061868cba561e7836e2d3ef7abf0c89ff1
MATLAB
2,248
46
clear all close all %% data_path='path_to_the_dataset'; load(fullfile(data_path,'data_ccg_nCRF.mat')); %% scatter plot of BO modulation index vs CCG asymmetry figure('Color',[1 1 1],'Position',[100,100,450,300]); scatter(ccg_BO_sig.Asymmetry,ccg_BO_sig.MI_BO,10,'black','Marker','o','LineWidth',1);hold on mdl=fitlm(cc...
86dea00b0414db8e276144ecd90d0b736d6719cb484bd3064a3d70ec40a02973
MATLAB
2,249
67
clc; clear; addpath('C:\work\code\download\cifti-matlab-master'); bag_res_file = 'C:\Users\lihon\Desktop\abcd_study\pnc\vis_v2_r400_ro1\bag_cen_K3_regional_r400.mat'; bag_res = load(bag_res_file); bag_p2 = bag_res.bag_mat(bag_res.st_idx==2, :); bag_p3 = bag_res.bag_mat(bag_res.st_idx==3, :); num_r = size(bag_p2, 2...
1c3e4151b8dd8cbff2d9adecee29e2ecc590013bdcd033403e05cc6f5632c75e
MATLAB
2,250
67
function b=surfing_cluster_borders(cl,nbrs) % Finds the borders of clusters, useful for visualization % % B=SURFING_CLUSTER_BORDERS(CL,NBRS) % % INPUT: % CL Px1 cluster indices for P clusters; CL{K} are indices of % cluster K. Typically this is the output of SURFING_CLUSTERIZE % NBRS KxN neigb...
1514598637eb802bbb6dc96e2942fb45b670df3ccbf97c5b529e675bda3a6fcb
MATLAB
2,251
71
function [cst X] = test03(n, m) % function [cst X] = test03(n, m) % All intputs are optional. % % Crude attempt at spreading m points over the (n-1) sphere to test the % oblique manifold implementation. Based on April 13, 2012 notes: % % Maximize sum |xi-xj|^2 over all (i, j) pairs is equivalent to % Minimize sum xi'*x...
772873f15575ac958e35396566bcfce03d83639deb3ecbe19de8b2a1fce1453b
MATLAB
2,252
61
clear all close all clc exp_root = 'C:\Users\User\Documents\fMRI_EXP\'; more_code = fullfile(exp_root, 'cells_data_muller'); data_folder = fullfile(more_code, 'wetransfer_neil-s-data_2023-09-25_1057'); addpath(genpath(more_code)); addpath(genpath(data_folder)); place_cells_rats = [4, 6, 7, 8]; num_place_rats = length...
7b56e1c4d27d3d819a57ff0525c191e6e6da51314d003664f20dcc1c9343b74f
MATLAB
2,252
77
function [b, tau, er] = regress_wt_vs_rew(A, nback, plotarg, cond) %regress waittime against rewards, a la Wang/Uchida 2013. %also fits exponential. Adapted from regress_latency_vs_rew %inputs: A struct. If you give it the S struct, will convert it to A struct. %nback specifies number of previous trials to regress. %av...
8933a516b9690fea623875ebcbb7ce2c5dba12be98df02fed3d479909c1fb3a4
MATLAB
2,252
88
function Test_synchronization n = 3; m = 10; A = randn(m, n) SOn = rotationsfactory(n); B = A*SOn.rand()+.1*randn(m, n) C = A*SOn.rand()+.1*randn(m, n) % Create the problem structure. manifold = rotationsfactory(n, 2); problem.M = manifold; % Define the problem cost function and its gradient. problem.cost = @cost; ...
b7f1504a1811cb36c226853aa845628bcf38474704a78bc3b911e546c4db1911
MATLAB
2,252
63
% Main script for resampling subject-specific supragranular and % infragranular SANDI surface overlays to the fsaverage surface % using FreeSurfer mri_surf2surf % % Reference: % Lee H, ..., Huang S, Communications Biology, 2026 % % Requirements: % - FreeSurfer installed and configured % - FreeSurfer recon-all completed...
f2448554d92e255d1838d064835e1532ebdcc2ff32b0469fb46ef082a7e0d26f
MATLAB
2,252
67
function [clustAssign] = GetARTwarpClusters(LineData, net, settings) % Return clusters from existing ARTwarp2 model after training h = waitbar(0,'Initializing'); %% Standardize all data, determine scaling factor for shape distance CallLengths = zscore(cellfun(@length,(LineData))); CallLengthsMean = mean(cellfun(@leng...
50be600a5e40f57468d08e8233bf8c7e3a89ecca437465409613f384252941e1
MATLAB
2,254
72
function [nLL, nLL_Trial] =... lognNLL_latency_secondhalf(params, lat2fit, ratTrial,... mdl, likparams) %lognNLL_latency_secondhalf - calculate nLL of model parameters given data % INPUTS: % params - model parameters % lat2fit - data to compare model outputs to % ratTrial - rat beahvioral data % mdl - ...
0040afc5602879c1b04f916fd4ce6f841ece4ae03ec58b2278e95a0636a22340
MATLAB
2,256
59
%VL_NNBNORM CNN batch normalisation. % Y = VL_NNBNORM(X,G,B) applies batch normalization to the input % X. Batch normalization is defined as: % % Y(i,j,k,t) = G(k) * (X(i,j,k,t) - mu(k)) / sigma(k) + B(k) % % where: % % mu(k) = mean_ijt X(i,j,k,t), % sigma2(k) = mean_ijt (X(i,j,k,t) - mu(k))^2, % ...
90412173e6467c5805eea543408a62af52b7dd22e768b72bd13e64aea0805904
MATLAB
2,256
58
function survive = prune(bfile, pval_vec, pval_thresh, r2_thresh) % Args: % bfile: plink bfile prefix (N SNPs and M samples). All chromosomes in corresponding bim file must be int. % pval_vec: array of p-values, size(pval_vec) = N, the order of SNPs must correspond to the order in bfile. % pval_thr...
d5811a55e8077846814828e6aff8aea0a57610ab44a456a408a59ac45ceaa373
MATLAB
2,257
75
% (C) Copyright 2019 CPP BIDS SPM-pipeline developpers function opt = getOptionSearchlight() % returns a structure that contains the options chosen by the user to run % decoding with cosmo-mvpa. if nargin < 1 opt = []; end % suject to run in each group opt.subjects = {'001','002','003','004','005','0...