sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9d10ebea9d29f8d90d77c6e447d9cbbb6ea43930ff8843bda880d54ed98fd692
MATLAB
5,962
157
function fear_getIcaCoactTimeHighThreshold(basename,varargin) % clear % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115'; % basename='~/data/Fear/triple/achel180320/achel180320'; param.thrshold=25; %in (z-score)^2 load([basename '.basicMetaData.mat']) load([basicMetaData.AnalysesName '-icaReac.mat']) ...
d17299dd5f7dfc54a51d1cdf2077b622225f8724d7b5e0cf9d9f9ba4a9f17c6b
MATLAB
5,962
160
function hessfun = approxhessianFD(problem, options) % Hessian approx. fnctn handle based on finite differences of the gradient. % % function hessfun = approxhessianFD(problem) % function hessfun = approxhessianFD(problem, options) % % Input: % % A Manopt problem structure (already containing the manifold and enough % ...
4bf56644e41c60035c25f83a248f4c36beb1c8fdd2a6d80f62e9d222e74a10ff
MATLAB
5,965
208
function [OUT] = cluster_overlap_npm(cl1,cl2,varargin) % function [OUT] = cluster_overlap_npm(cl1,cl2,[mask_fname],[iterations]) % tor wager % takes 2 clusters structures and determines overlap % - then runs Monte Carlo simulation randomizing cluster % centers within a mask % % Mask and input files must have the same...
f066361a4bb99fe716b3ca530a783ca71d0f88664dc869ade3b82bd488366763
MATLAB
5,965
149
function lme = plotSummary(quantVar, subj, useNum, probeInfo, exSubj, quantVarStyle, colAni) % remove nan days quantVec = quantVar(~isnan(quantVar(:))); uses = useNum(~isnan(quantVar(:))); subjVec = subj(~isnan(quantVar(:))); % Is this wrong? probesVec = cellfun(@(y) y{2}, cellfun(@(x) strsplit(x,'...
8e759ce1abe0521dd3d18542451f23213701cb2ce365aad6c877e2ca3126e1ac
MATLAB
5,967
156
% SLIDER - add slider to a figure % % Usage: % >> slider( handler, horiz, vert, horizmag, vertmag); % % Inputs: % handler - figure handler (for the current figure, use gcf) % horiz - [0|1] add a horizontal slider % vert - [0|1] add a horizontal slider % horizmag - magnify the width of the figure befo...
dda24d3f1bf7676b422f6b7389908f19f7536ed3e2724dcbad658c5a7d8fe2fc
MATLAB
5,975
155
function shuffle_icaReacCCG_chamber(basename) [rootPath,sesName,~]=fileparts(basename); fprintf('%s load files for %s\n',datestr(now),sesName); load(fullfile(rootPath,'data',[sesName '-icaReac.mat'])) load(fullfile(rootPath,'data',[sesName '.sleepstate.states.mat'])) load(fullfile(rootPath,'data',[sesName '.sessions.e...
fbf19f71cc8bde0fef447f87f76aa4974810965fb75b2d9a76539ea1c540ee06
MATLAB
5,975
170
function [err, ErrMessage, Info, V] = ResliceBrick (BrickName, NewCode, Opt) % % [err, ErrMessage, Info, M] = ResliceBrick (BrickName, NewCode, [Opt]) % %Purpose: % Reslices an AFNI brick kinda a la 3daxialize but in any orientation desired % No interpolation or shananigans are done % %Input Parameters: % BrickNa...
fd4295d8a94152653fe730ab15b7fc506d5462610d8a1583f4714207a6d08570
MATLAB
5,978
116
function [post, nlZ, dnlZ] = infVB(hyp, mean, cov, lik, x, y, opt) % Variational approximation to the posterior Gaussian process. % % Compute a parametrization of the posterior, the negative log marginal % likelihood and its derivatives w.r.t. the hyperparameters. The function takes % a specified covariance function (...
d0cd248dbb7f12ea664e677f77e8c13241ed86b5d8705ddeb51928c61bf6bd8f
MATLAB
5,985
225
function [bw] = Bullwinkle(detector_out, params) %function [bw] = Bullwinkle(detector_out, params) % % Score a detector image with Bullwinkle % % Bullwinkle is a per-pixel scoring method, made to complement % the blob-based scoring method ROCKY % % to complain about the bad pun, email bjm@wossamotta.edu % % 8/14/2012...
4b94c07c93801e43417a6de19eee7e878c8ef094116373835ffbdad782f3b2c7
MATLAB
5,986
158
function out = CO_PosNegAsymmetry(y) % CO_PosNegAsymmetry Asymmetry of local dynamics between positive and negative regimes. % % Splits the time series by the sign of each value (assumes y is z-scored, so % the split is around the mean) and asks whether the one-step-ahead dynamics % differ between the two regimes: is...
51b545cb9cff5e24244d34cc7ae90859d6915e2d03edf8eb9ed86e514d31f38c
MATLAB
5,986
170
function [G, gainArray, normFactor] = tapas_physio_rescale_gradient_gain_fluctuations(G, ... minStepDistanceSamples, verbose, varargin) % Removes infrequent gain changes in gradient time courses (i.e. steps) % % G = tapas_physio_rescale_gradient_gain_fluctuations(G, ... % minStepDistanceSamples, doPlot, var...
13c112be9037e4957ffce04c6498d5edc6472a79ecd178b4b061ab8e38495816
MATLAB
5,987
185
function BpRF_run_pRF_simulation(subj_id, session, mod_name, ana_name, sim_file, avg, conf, voxels) % _ % Estimate Voxel-Wise Population Receptive Field Model % FORMAT BpRF_run_pRF_simulation(subj_id, session, mod_name, ana_name, sim_file, avg, conf, voxels) % % subj_id - a string, subject ID (e.g. "EDY7") % ...
bf55805dc33690dd1bbeaca956ddc4be9c0021f984dd60a5abf256cce73d5b5a
MATLAB
5,992
151
%% BipolarCorr = FastBipolarCorrect(Bipolar,unwrap) % % Input % -------------- % bipolarCplxME : complex-valued multi-echo GRE data with bipolar readout % unwrap : phase unwrapped method (optional) % % Output % -------------- % bipolarCorr : eddy current corrected data % % Description: correct the inconsistent...
d6abcc22fabe49df4f5592003f97d47c5c7d4c38a337b1acf962ce68d12e2454
MATLAB
5,997
154
%% %%%%%%%% Determine alignment between HRT2 and T2 and warp labels for subjix=1:8 % setup nsdsetup; outputdir = sprintf('%s/ppdata/%s-structurals',nsddir,allnsdids{subjix}); % define file1 = sprintf('~/nsddata/ppdata/subj%02d/anat/T2_0pt5_masked.nii.gz',subjix); % official T2 0.5-mm masked volume file2...
1c86788f36d64fb35601a4d85b9329da1775701c3e79741b3e9e9b910973af8d
MATLAB
6,004
200
function plotTrials_yy(params, trialsData) % double y-axis plots, plotyy mode (2 y-axis) % plots values in 'trialsData' struct with fields: % yVals_1: [sample x ch] % yErrs_1: [sample x ch x clz] -> optional (plotband) % xVals_1: x-Axis values (vector), typically time in [s] % and % yVals_2: [sample x ch] %...
f1336f6cbe72c4d986d1bff806f7db9c9e4c3ab5733e5873ecb99559af60bed5
MATLAB
6,004
186
% EEG_EVENTHIST - return or plot histogram of event or urevent field values. % If NO output args, plots the histogram. If the field values % are not numbers or strings, no histogram is computed. % Usage: % >> figure; eeg_eventhist(EEG.event,'field',bins); % plot histogram %...
d5c07877cf4ad56e6a171a1efe4451a00739f5368a9d1bcd1843d3f7edd410d2
MATLAB
6,005
171
function [info] = decode_fif(orig) % DECODE_FIF is a helper function for real-time processing of Neuromag data. This % function is used to decode the content of the optional neuromag_fif chunk(s). % % See also DECODE_RES4, DECODE_NIFTI1, SAP2MATLAB % Copyright (C) 2013 Arjen Stolk & Robert Oostenveld % % This file is...
b6eda56e6fe0994aa2fd8a35a1b8904e505be7352695c9871004274cc03b6c77
MATLAB
6,006
129
% =============== parameters section =============== % Required args: % zmat_names_array: array of file names with univariate GWAS results from the MOSTest analysis % out: output file prefix if ~exist('zmat_names_array', 'var'), error('zmat files array is required'); end if ~exist...
8d5507e615e030dea1d051f29c10d86fb509c825015e2d216f2c320f5b6421d5
MATLAB
6,008
175
function [nel, comm] = ToyTalk() % ToyTalk() % % A sample function to illustrate how matlab can listen to communication from % SUMA. % %Dependency: %----------- %The TCP communication is based on pnet.m by: % Peter Rydesäter, % Mitthögskolan(Mid Sweden University) campus Östersund, SWEDEN %pnet is...
d12d0e384551763eb04537e0968284863e23b887520227bbcbc201fe70eae261
MATLAB
6,008
179
% ICAPROJ - project ICA component activations through the % associated weight matrices to reconstitute the % observed data using only the selected ICA components. % Usage: % >> [icaprojdata] = icaproj(data,weights,compindex,[datameans],chansout); % % Inputs: % data - data matrix (chan...
1c2fa3a6df4871b1580d64fedc93ed4f0f473fddc654a9798b8b9a00c87d6d01
MATLAB
6,009
134
function out = SC_HiguchiFD(y, kmax) % SC_HiguchiFD Higuchi's fractal dimension of a time series % % Estimates the fractal dimension of the time series' waveform (its graph in % the (index,value) plane) via Higuchi's curve-length method: at each scale % k, the series is split into k interleaved subsequences, each sub...
cbacb76a9a2c1e63b76b46aa12e5b0f053b7c44b7459e1bc9cb61d07f08bb7e7
MATLAB
6,009
213
function [ DCM ] = tapas_rdcm_to_spm_struct(output) % [ DCM ] = tapas_rdcm_to_spm_struct(output) % % Converts the output structure from rDCM into a DCM structure that SPM12 % can read. % % Input: % output - rDCM output structure % % Output: % DCM - DCM structure (for integrability...
05e87576dba773ff677d4ad16616ac7eae58e4edc1b5252abf6616d441e1efde
MATLAB
6,013
183
%% Linlin Data close all clear all filename = 'C:\Users\Harnettlab\OneDrive\Desktop\Voltage_Data\Sq_camera.bin'; xpixels = 96; ypixels = 200; mov = readBinMov(filename, xpixels, ypixels); fft_tts = fft2(mean(mov(:, :, 1:50), 3)); clear mov IPv4 = '127.0.0.1'; port = 30001; % Port number used for communica...
e19604460dfe01b3286e3065c03f5d14550a6a91f1e1afc5b2d5f5015a6d20f6
MATLAB
6,017
172
function isSimilar = compareLFPPeaks(peak1_time, peak1_volt, peak2_time, peak2_volt, options) arguments peak1_time (1,:) double {mustBeReal, mustBeVector, mustBeNonempty} peak1_volt (1,:) double {mustBeReal, mustBeVector, mustBeNonempty} peak2_time (1,:) double {mustBeReal, mustBeVector, mustBeNonem...
ebe768bcc146fd07cf611c8b1389d00afdc09d98c217a23597fedadf387f6376
MATLAB
6,018
168
function featureCorrelation(nodeLevelData, recordingLevelData, Params, subset_lag, plotSaveFolder) % Looks at the correlation of features at the node level and the recording % level % Parameters % ---------- % nodeLevelData : % recordingLevelData : % Params : % subset_lag : int % Returns % ------- useFullName = 1...
4af1f58ec34be7c8f848b43d4ee68bfdb1d2b13db12abde91bffc37330c625d7
MATLAB
6,024
154
%% Main lag script used to compute time delay matrix and lag projection % Version 2: % In this version, I modified the computation of probability flow % projection map. The positive and negative value in the map will be % normalized to 1, respectively. % % This script was orignally obtained from Github (https://g...
4cf347711ae3a0e9f70ad7f68b059f9831d26bd84fc8456e032f060426b07a60
MATLAB
6,024
205
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FIRST, DEAL WITH VIDEO FEED % files are in nsd/rawdata (both .edf and .mp4 files) % ignore the following: % eyevideo-20191013-NSD134-nsdsyntheticpilot.mp4 % eyevideo-20191103-NSD134-nsdimageryFAILED.mp4 % .edf recorded only for actual NSD (experiment) runs, not resting st...
7f4b496001d255c1a6c233302964f90b9087f56a5159438f6e60b5323614347e
MATLAB
6,024
154
%% Main lag script used to compute time delay matrix and lag projection % Version 2: % In this version, I modified the computation of probability flow % projection map. The positive and negative value in the map will be % normalized to 1, respectively. % % This script was orignally obtained from Github (https://g...
11cea14f3b308e50cbe2d8bad42397b21e4167e48598c81c75da7ae0d10f220a
MATLAB
6,026
201
%% This script generates Figures 2, 3, and 4 % Note: SP stands for sulcal span and SD stands for sulcal depth. clear; clc; close all; % Uncomment the parameter you want to run: %param = 'AREA'; %param = 'SULC'; %param = 'R1'; %param = 'THICK'; param = 'CURV'; % Set axis limits for figures switch param ca...
4f1e2b07abde31bc771124cbb5a7940031bbb4c637bdc3107d16a2944b00b9ee
MATLAB
6,026
154
%% Main lag script used to compute time delay matrix and lag projection % Version 2: % In this version, I modified the computation of probability flow % projection map. The positive and negative value in the map will be % normalized to 1, respectively. % % This script was orignally obtained from Github (https://g...
53c0d65cacb4eddc8aef07f8ebc448e6546f44cfaed427426a3318eeedf6a0be
MATLAB
6,032
160
function obj = test(obj, test_data, varargin) % obj = test(obj, test_data, varargin) % % test_data should be voxels x maps matrix of test data % can be either binary (i.e., meta-analysis peaks) % or continuous (e.g., single-subject t- or contrast maps) % Different methods are used for each data type. % % dobinarize ...
df660cbabeea853b4f516669a4274e37233f474b9f48eedf9ac153028e021e50
MATLAB
6,032
144
function pctFilename = convert(inputFilename, options) %CONVERT Convert PETRA image to pseudo-CT. % % DESCRIPTION: % convert converts a PETRA image to a pseudo-CT using the following % steps: % % 1. Debiasing the image using N4ITK MRI bias correction % 2. Applying histogram normalisation to shif...
858ac5e3ac684e80ec647253550bc2161b37ba19d34ddba2d2bbcaa63ac2a98d
MATLAB
6,033
125
% STD_READCUSTOM - Read custom data structure for file save on disk. % % Usage: % >> data = std_readcustom(STUDY, ALLEEG, fileext, 'key', 'val', ...); % % Required inputs: % STUDY - an EEGLAB STUDY set of loaded EEG structures % ALLEEG - ALLEEG vector of one or more loaded EEG dataset structures % ...
a85565cdb038c26e456458ed3c0ff3bcdbbe1509cd1d1d4c41106abc11d35ec2
MATLAB
6,034
137
% Same as example 3 but uses different sessions and runs % % Arnaud Delorme - May 2022 data = []; p =fileparts(which('eeglab')); data(end+1).file = { fullfile(p, 'sample_data', 'eeglab_data.set') fullfile(p, 'sample_data', 'eeglab_data.set') fullfile(p, 'sample_data', 'eeglab_data.set') fullfile(p, 'sample_data', 'ee...
35e5df07ebd07698bfe2d8ad067d2c4c94e4e861ee7f62aa44f9ad9f03453230
MATLAB
6,038
173
A = MVAR.MCA.class_avg_indicator(:, 6); B = MVAR.MCA.class_avg_indicator(:, 9); %% clear z % Make table z of counts. % Note: A and B should be 0 or 1 % table in same format as Patel 2006 paper % A's activity = columns, active then inactive % B's activity = rows, active then inactive n = size(A,1); % number of ...
b17dfa4fbae7f261276add01423d45ed5888f2cbae5532f7e0c93807317dff72
MATLAB
6,038
128
function MDSConditions(RDMs, userOptions, localOptions) % MDSConditions(RDMs, userOptions[, localOptions]) % This function performs first-order MDS, visualising the dissimilarities % between brain response patterns. If specified in userOptions, a coloured % dot will be drawn for each condition and a text label is disp...
ee1a964a40aa71acba9126d4692f39b714ec8074f6853d60eab8abacb2c68485
MATLAB
6,040
98
function cat12_seg(filename,spm_path) try if exist('spm_path','var') addpath(spm_path); else % get SPM12 root directory from matlab search path spm_path = what('spm12').path; end % set spm default parameters spm('defaults','FMRI');...
803acae097e560c2e29d433822be430e204d18a76c04273e3cdf963f1663a196
MATLAB
6,042
167
%{ rf.Motion3D (imported) # motion in 3D computed from a ministack -> rf.MiniStack ----- anchor_slice : smallint # slice that best matched the average movie frame motion_x : longblob # (um) movement x component motion_y : longblob # (um) movement y component motion_z : longblob # (um) movement z component %} ...
88d5d9275aa555b365ba4cc686cf4e670c6e217523809575762e5aaef774fa0f
MATLAB
6,044
115
function [mdlnlm fitresult gofit rp]=Curve_fitting_nlm(initialmd,modelnlmreal,modelfitreal,Lowerboundary,Upperboundary,ylabelname,name,Plotornot,betainitial) tbl=initialmd.Variables;%Using fit to constrain the lower boundary of beta2 above ZERO (Or the model will be failed). if(size(tbl,2)==5) Data_rremain=tbl.data_...
ef71f7ce5b7a5cbf27fff839fc84b821239f38e0969b3b1c43413ddaf6cbf1ee
MATLAB
6,045
165
%%% NUMERICAL METHOD TO SOLVE THE 2D Diffusion Equation for multiple release points at the same time %%% function [C_store]=NumericalSolver2D_multiple(M,ds2,dt,nt,Diff,Source_file,Q,kapa,tp,rate,sc,Mask,Cb, BC,freq) tic %Extract source coordinates Mx=M(2); My=M(1); dy2=ds2(1); dx2=ds2(2)...
677cedde1679077986462188657ea0ee85f7b9ea45f041f9456a0fd8c22178f0
MATLAB
6,046
134
% Regenerates the node-cartography ground-truth fixture used by % test_pipeline_cartography.py. Loads a real thresholded adjacency matrix, % subsets to active nodes (same logic as gen_step4_reference.m), runs % MATLAB's own modularity clustering ONCE to get a real Ci, then calls % MATLAB's own participation_coef_norm /...
65f0324fa7850a543d2f1f0de627f1b78af7f2bab329bbcfd3eff86d49629295
MATLAB
6,048
193
function [idx,p_age,p_sex] = nf_reg_match_ratio(regA,regB,ratio,strategy,p_cutoff,depth) %[idx,p_age,p_sex] = nf_reg_match_ratio(regA,regB,ratio,strategy,p_cutoff,depth) % Function to automatically match two groups by age+sex % % regA = regressor of reference group, i.e. the group that is matched to % regB = regress...
6ae12293dd5667a4d394d0284b9dc8f9c51a71c689cbeb310fe84e6b90cf10aa
MATLAB
6,048
137
% --- Executes on button press in recordAudio. function recordAudio_Callback(hObject, eventdata, handles) % hObject handle to recordAudio (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB get(hObject,'Value'); handles = guidata(hObject); %Check if detection file has changed to save file...
7bf5f799e6d6ab192df80ef0647e24e82126e12cbad2804d3d057312dfbbb88b
MATLAB
6,048
142
%{ vis.MonetLookup (lookup) # cached noise maps to save computation time moving_noise_version : smallint # algorithm version; increment when code changes moving_noise_paramhash : char(10) # hash of the lookup parameters --- params : blob # cell ar...
fd5c6c4c6d79bbbd62fea9cda8b40386ebcc463ae361670dfd718bd4acc122f3
MATLAB
6,050
142
function [d, Sig] = distanceLDCraw(Y,SPM,conditionVec,varargin) % function d=rsa.spm.distanceLDCraw(Y,SPM,conditionVec,varargin); % First, gets the regression coefficent from the SPM, and prewhitens them. % Prewhiten can be controlled using different methods (run-wise or overall). % The same code is used in rsa.spm.noi...
59c319b56c365a78d8f96d1fa4632479b74d8fbf4fc4929e95aa9a2e96be2be1
MATLAB
6,051
228
function f02_applySmoothing(subjectLabel, projectRoot) % f02_applySmoothing % % Apply 6-mm FWHM spatial smoothing to four preprocessed BOLD runs % for one participant using SPM. % % Associated article: % Mano, Y. et al. (2026). % Neural mechanisms underlying decisions to express or suppress emotions. % Social Cognitive...
2da6af7cca3e203b751d87bf297c5c094f3b36d6781feed6c35d3bfd58a237eb
MATLAB
6,052
120
%% load libraries run('set_library_paths.m'); addpath(SPM_PATH); % per spm docs, do not genpath it addpath(genpath(CANLABTOOLS_PATH)); %% VARIABLES THAT MUST BE DEFINED BEFORE THE SCRIPT IS SOURCED % THIS SCRIPT IS DESIGNED TO RUN ACROSS MULTIPLE SUBJECTS FOR A SINGLE ENCODING MODEL % with multiple runs per subject % ...
6a893a368c57d59a0f033f78ba596c9d53fb305833404eebf9bffa4199ae6b40
MATLAB
6,054
172
% op_plotfid.m % Jamie Near, McGill University 2015. % % USAGE: % out=op_plotfid(in,tmax,xlab,ylab,tit); % % DESCRIPTION: % Plot the spectrum in the time domain. % % INPUTS: % in = input data in matlab structure format. This argument can be a % MATLAB structure (formatted according to the FID-A structu...
b8e6429070ca787f9ab45d6263d81dc935f0ff6a09ccbe49d7d91f4e46379ab5
MATLAB
6,054
140
function TOL_fig_ritchie1948(config,params,dat) % TOL_fig_ritchie1948, figure of Ritchie's (1948) apparatus and design % Figure S6 for: Duvelle and Grieves (2026) Tolman's Sunburst Maze 80 % years on: A meta-analysis reveals poor replicability and little evidence for % shortcutting. European Journal of Neuroscience. ...
dbc50fd4ed477d54ca26444885a7a533c5d8a9516aad54ee39a2266b45f3f6d8
MATLAB
6,055
128
main_path='Pathway'; lim_gc=1000; bin_time=linspace(-0.05,30,121); lim_cons=0.8; list_patterns=["20_over","40_over","60_over","80_over"]; for i_data=1:4 path_data=strcat(main_path,list_patterns(i_data)); list_patterns(i_data) cd (path_data) for itera=1:50 %itera % Loading Da...
ecdeffe16e8eb0e4d5a604a838eb59cc5a020ad92101beba8eaad0eb98b687ec
MATLAB
6,055
170
function saveEphysStats(ExpName, Params) % Saves data related to spike and bursts to two csv files % One csv contains node level metrics : NeuronalActivity_NodeLevel % One csv contains network level metrics : NeuronalActivity_RecordingLevel % INPUT % ----- % ExpName : cell array % cell array with size N x 1 whe...
665dff863c887f05ef0415fb27022bcbd8e46f7949789c6ce3745f4917dc702a
MATLAB
6,058
118
% # (JM) MODIFIED FROM ORIGINAL FUNCTION 'assembly_patterns' function AssemblyTemplates = assembly_patterns(SpikeCount,opts) % Patterns = assembly_patterns(Activitymatrix,opts): extracts assembly patterns from the spike matrix. % % Description of inputs: % Activitymatrix: spike matrix. Rows represent neur...
b1d252fa49503e30647c42acea61de4107df8713e9199d3157e4ffc42f6fde4d
MATLAB
6,059
196
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Setup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % What I need to do - convolve each person's task timeseries with the HRF. % I can read in each peron's EV text file, make a boxcar function with it, % convolve it with the HRF, the...
b994836479e8de32aa76a9a6b4edc3f0369bfa0b1c88da90f5dfc81e9c118b6b
MATLAB
6,060
163
% SNAPREAD - Read data in Snap-Master Standard Binary Data File Format % Reads Snap-Master header and data matrix (nchans,nframes). % Ref: Users Guide, Snap-Master for Windows (1997) p. 4-19 % Usage: % >> data = snapread(filename); % read .SMA file data % >> [data,params,e...
3309a0f61390c9275773650b5672956f00980244fd0821126e725c4821fc28da
MATLAB
6,062
148
function [B_avg, B_std] = stftBaseline_fromRS(params) % determines baseline from resting state (RS) % - baseline for normalization (normalization factors) -> B_avg (& B_std) % - baseline activity -> BA_avg & BA_std (saves 'baseData' struct to cache file) % % (1) find RS sessions (based on gameType) % (2) compute ST...
1d7c7b34a916a44bb56ece4b403ac4cbde749a024d735d459f55ea2a6a8866ec
MATLAB
6,063
186
% function lineStyles = linspecer(N) % This function creates an Nx3 array of N [R B G] colors % These can be used to plot lots of lines with distinguishable and nice % looking colors. % % lineStyles = linspecer(N); makes N colors for you to use: lineStyles(ii,:) % % colormap(linspecer); set your colormap to h...
2cdeebf201636114eabea7727336548fa40af1b4cce30f3abe45498e3e7c1878
MATLAB
6,063
159
% EEG_INSERTBOUND - insert boundary event in an EEG event structure. % % Usage: % >> [eventout newind] = eeg_insertbound( eventin, pnts, ... % abslatency, duration); % Required Inputs: % eventin - EEGLAB event structure (EEG.event) % pnts - data points i...
6c4d0feebbfac62e84503f283479cbd69b96ba45e6adf3411a31e3ccab185677
MATLAB
6,065
196
function outputImage = tapas_uniqc_folder2image(pathFolder, savedVariable, filePrefix, ... dimensionLabels) % Collects mat-files of slices (e.g. from Recon-code), and combines to % MrImage % %`outputImage = tapas_uniqc_folder2image(pathFolder, savedVariable, filePrefix, ... % dimensionLabels) % % IN % pathFold...
a833c2731bbb50db18e0560540f2e8ea50d1dea20947764f72a9f2a12809740b
MATLAB
6,066
187
function [output, options] = tapas_rdcm_estimate(DCM, type, options, methods) % [output, options] = tapas_rdcm_estimate(DCM, type, options, methods) % % Main analysis function, which calls the subfunctions necessary to run a % regression DCM (rDCM) analysis. % % Input: % DCM - either model str...
623bc48bbf11f761c54dd9723426efa63fe2e8910ba11d183a9a73d16b617618
MATLAB
6,067
209
%% clear; working_dir = 'G:\CEST-fMRI'; % the actual directory to put the codes gen_figure_path = [working_dir,'\gen_figures']; addpath(genpath(gen_figure_path)); SPM_modified_path = [working_dir,'\scripts\SPM_modified']; addpath(SPM_modified_path); ds_dir = [working_dir,'\datasets\exp3']; % directory of datase...
75d849e08a1078640cf30e3a3194dc0c80b00842e8be0d36d6e8032f4adc36c7
MATLAB
6,067
200
function M = stiefelgeneralizedfactory_HS_KA(n, p, B) % Returns a manifold structure of "scaled" orthonormal matrices. % % function M = stiefelgeneralizedfactory(n, p) % function M = stiefelgeneralizedfactory(n, p, B) % % The generalized Stiefel manifold is the set of "scaled" orthonormal % nxp matrices X such that X'...
c8ec773a8245ef39dbc008eae32f82c68e2b0888a275cc7ec468f33b4dc3dc2a
MATLAB
6,067
199
% The symmetry breaking Area is calculated for the left and the right % antenna % % The code plots the x coordinate for tip of the antenna and then detects % the peak.The peak is used for detecting the beginning of the swimming % cycle. Then the symmetry breaking area is calculated for each swimming % cycle for ...
8abc9f0a1cee1c5e1786b2d855a40f56ee446e74cc030c3cccf04c6612ac4afb
MATLAB
6,068
165
function fieldtrip2besa(filename, data, varargin) % FIELDTRIP2BESA saves a FieldTrip data structures to a corresponding BESA file. This % export function is based on documentation that was provided by Todor Jordanov of % BESA. % % Use as % fieldtrip2besa(filename, data) % with data as obtained from FT_PREPROCESSING ...
03875647a97139a9907c52db2e114e48d9108b881ff340cae006291cc5b5ccdc
MATLAB
6,070
144
function [svolpulse, spulse, spulse_per_vol, verbose] = tapas_physio_get_onsets_from_locs(t, VOLLOCS, LOCS, sqpar, verbose) % creates timing vectors of found % % [svolpulse, spulse, spulse_per_vol] = tapas_physio_get_onsets_from_locs(t, VOLLOCS, % LOCS, sqpar, verbose); % % I...
0e6a5329631ca109721bc09e5ee6527f2463db9b9d329f09c8308d729ff187c6
MATLAB
6,072
153
function out = SY_LocalGlobal(y, subsetHow, n, randomSeed) % SY_LocalGlobal Compares local statistics to global statistics of a time series. % % ---INPUTS: % y, the time series to analyze % % subsetHow, the local subset of time series to study: % (i) 'l': the first n points in a time series, % ...
80cf95346f08571f6e7f4a6fe8f75461945fb65c36960cd57dad46d7a10f779c
MATLAB
6,074
179
% STD_LM_SETEEGFIELDS - set limo fields in eeg sets % % Usage: % >> EEG = std_lm_seteegfields(STUDY,EEG,index,'datatype','Channels','format', 'cell') % % Inputs: % STUDY - studyset structure containing some or all files in EEG % EEG - EEG dataset % index - index of dataset in STUDY.dataset...
ac202a9b57557d5338154227aabcd90963cee2fc5dc2c80942c7029946652af4
MATLAB
6,074
109
function plot_task_performance_APP_mice_6_9_months close all clear all clc % Plot task performance for 6-month-old and 9-month-old APP-KI mice. % Select a folder containing data. folder_name = uigetdir; cd(folder_name) % APP. load('behavior_APP.mat') behavior = behavior_APP; clear behavior_APP animal_6_months_ID = ...
96fd921c7449fe2c8ca31565c03a917327403a497c380e7a91da51c195a29199
MATLAB
6,075
137
%% h = sepia_handle_panel_EchoCombine_medi_nonlinear_fit_bipolar(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 co...
f56796dfea49d29718159949bd1deb35a495435668a3c5f48be9951397311e3d
MATLAB
6,075
170
function ARTwarp_Create_Figure global NET DATA h0 = findobj('Tag','ARTwarp'); %activate the ARTwarp window and clear the figure (clf) clf numCols = round(NET.maxNumCategories^0.5); numRows = numCols+1; rowHeight = (0.98 - 0.01*numRows)/numRows; colWidth = (0.98 - 0.01*numCols)/(numCols+1); %generate the same menu i...
6d91d1acc708525dd4a8f906b915d1e79bd0105b5f27a6782895527075575764
MATLAB
6,076
142
function [MRSCont] = osp_fitHERCULES(MRSCont) %% [MRSCont] = osp_fitHERCULES(MRSCont) % This function performs spectral fitting of HERMES MRS data. % % USAGE: % [MRSCont] = osp_fitHERCULES(MRSCont); % % INPUTS: % MRSCont = Osprey MRS data container. % % OUTPUTS: % MRSCont = Osprey MRS ...
1baecfb863bc93c8f09aa11d8e16aed11cdb4e54eb99956a3e03ab9fa83a4195
MATLAB
6,088
145
function out = NL_LocalDensity(y, NNR, past, embedParams) % NL_LocalDensity Local density estimates in the time-delay embedding space % % Computes a standard k-nearest-neighbor local density estimate at each % point of the time-delay embedding: density(i) is proportional to % 1/r_NNR(i)^m, where r_NNR(i) is the dis...
53bb896a8ebd29428eb81ad30af7170ca6c80dcdeb1218488ad52b18c99afe46
MATLAB
6,088
115
function [mdlnlm fitresult gofit rp]=Curve_fitting_nlm_multicenter(initialmd,modelnlmreal,modelfitreal,Lowerboundary,Upperboundary,ylabelname,name,Plotornot,betainitial,Site_info) tbl=initialmd.Variables;%Using fit to constrain the lower boundary of beta2 above ZERO (Or the model will be failed). if(size(tbl,2)==5) ...
041adb3f30c6fe61ec79e734efe054ddcc30d7958c53585918ea6b020a222a3b
MATLAB
6,089
157
function [ output_args ] = ASSEMBLIES_COLLECTION( CALCIUM_FLUORESCENCE_file ) %ASSEMBLIES_COLLECTION( CALCIUM_FLUORESCENCE_file ) % % % === Jan Moelter, The University of Queensland, 2018 =================== % narginchk(1,1); fprintf( 1 , [ '\n' ] ); timerVal = tic; %% > PRINT FUNCTION-CALL if( isdeployed ) p...
e78165bddd9e0e8a5b13c534f81e36f4970f289ab667ee2206d38d809d05f072
MATLAB
6,091
147
function [ifeat, testStat, trainErr, testErr, testClass] = TS_ForwardFS(whatData,iTrain,criterion,cvFolds,numFeatSelect,annotateParams) % TS_ForwardFS Greedy forward feature selection % % --NOT FULLY FUNCTIONAL CURRENTLY-- % % Uses the sequentialfs function from Matlab's Statistics Toolbox. % After selecting the featu...
abcf9469ad6dd759a9ee10f2418703ee4b7ee4286efef02244096817a5041cc9
MATLAB
6,094
131
% Main script for sampling volumetric SANDI maps onto inferred equivolume % cortical surfaces to obtain supragranular and infragranular layer-specific intensities % % Reference: % Lee H, ..., Huang S, Communications Biology, 2026 % % Requirements: % - FreeSurfer installed and configured % - FreeSurfer recon-all complet...
a22c2182f7228ba871e30567d2222b9dfbff380a8c7f2774e78c03c3ecc1747f
MATLAB
6,097
135
% notes: % - only consider cases of 3 trials % - use all the data for the main version (also do split-half for the split1 and split2 versions) % - be careful about missing data (invalid voxels) % - translate the vmetric to SNR % % history: % - 2021/07/08 - add _split1 and _split2 versions. % - 2020/07/14 - now use sq, ...
b54f67224a28bc139b5e4614e1cf3b54865559049cbc2247d401382ab9addbfa
MATLAB
6,101
178
% EEG_STORE - store specified EEG dataset(s) in the ALLEEG variable % containing all current datasets, after first checking % dataset consistency using EEG_CHECKSET. % % Usage: >> [ALLEEG EEG index] = eeg_store(ALLEEG, EEG); % >> [ALLEEG EEG index] = eeg_store(ALLEEG, EEG, index); %...
6764c22ae88e243e37f1350af070ac0d9f75bfa16e232e270413dd0c27680eb4
MATLAB
6,102
182
function [ obj ] = optional_inputs( obj, varargin ) % Parse and check name-value pair arguments for constructor tapas_Huge and % estimate method. % % This is a protected method of the tapas_Huge class. It cannot be called % from outside the class. % % Author: Yu Yao (yao@biomed.ee.ethz.ch) % Copyright (C) 2019 Trans...
92ca4a268bff60664e5570cc26060c0ff480cae37341fac47dca3e9c16069f28
MATLAB
6,106
166
classdef model < handle properties % Model hyper-parameters dot = brca.dot.euclidean(); % Dot product (< brca.dot.base) M = Inf; % Number of principal components lat = []; % Lattice dimensions A0 = 1; % Prior expected latent precision ...
3a8579f6bce21953ce677ad257b6372d5efd0b68b69d75b919cd2346d047ffca
MATLAB
6,108
143
function [outputImage, selectedSlices, selectedVolumes] = ... select4D(this, varargin) % Creates new image from selected data range, allows interactive picking of % volumes/slices via clicking on montage % % Y = MrImage() % Y.select4D(inputs) % % This is a method of class MrImage. % % IN % % varargin 'Para...
7e44018fc9c0c3dbb06ab3a305124af66656a16356849f20a65423c0092c981e
MATLAB
6,108
152
function [C2,cfg] = mahal_twoclass_trialwise_xtime(dat,labels,cfg) % [C2,cfg] = mahal_twoclass_trialwise_xtime(dat,labels,cfg) % C2: output, nClass x nTrials x NTrainTime x NTestTime % authors: M Stokes, E Spaak, N Myers if nargin < 2 help mahal_twoclass_trialwise error('missing input arguments!') ...
289aac9dcfcb3f6f44f3122e48afbcaf86eeb832f673a2d0b72a1c394ca2f773
MATLAB
6,109
166
function out = CO_Embed2(y, tau) % CO_Embed2 Statistics of the time series in a 2-dimensional embedding space % % Embeds the (z-scored) time series in a two-dimensional time-delay % embedding space with a given time-delay, tau, and outputs a set of % statistics about the structure in this space, including angular % ...
2b42c70852be27a252a82a3619447ad964b5c2666d5c83e7338ac774432de6e5
MATLAB
6,112
145
% GENERATE_ADVDIFF_DATA Solve the linear advection-diffusion equation % using spectral discretization + ode45. % % NOTE: This example is NOT included in the paper. It is provided as % an additional benchmark to demonstrate TASC-DMD on a PDE with % analytically known eigenvalues. % % Equa...
35afa39120174e9a1103b066e098d53c7ac4aa8dda754c4441362ecdc3183d0b
MATLAB
6,112
139
%% h = sepia_handle_panel_EchoCombine_medi_nonlinear_fit(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 a...
3dff5be9be995062a7e14d45df8051528cbcf01f6f3f33bd4d5d39b4561ee96b
MATLAB
6,112
213
classdef ParameterServer < handle properties params paramsRegister method prefix memoryMapFile memoryMap pinnedMemory otherLabs inplace tmoveOpts end methods function obj = ParameterServer(varargin) obj.prefix = 'mcn' ; obj.params = struct('name', {}, 'shap...
667f2d7be11adcd5ab84beaa704bb682cbd63a2283081acb38505006a314bac0
MATLAB
6,113
118
function [post nlZ dnlZ] = infPrior(inf, prior, hyp, varargin) % Inference with hyperparameter prior. Any inference method can be used. % The prior specification is done by means of the prior parameter that has % the same structure as hyp. Examples: % 1) >> prior.cov{2} = {@priorLaplace,mu,s2}; % put a Laplace p...
6e353a79611c6b2f0c67e25e7ff9a3f46aa8c9d8c929fb6980b67f9546cabe01
MATLAB
6,114
157
% fit_setExpectValues.m % Georg Oeltzschner, Johns Hopkins University 2020. % % USAGE: % [EXT2, SDT2, SDSH] = fit_setExpectValues(dataToFit, basisSet) % % DESCRIPTION: % This function determines the expectation and standard deviation values % for the delta (1/T2) parameters describing the Lorentzian linebroadening %...
7db6a3573488d10052c112a358843becf89119af1b158941a0bea2cd1eba4c27
MATLAB
6,117
135
% genFrames - Generate frames for the scan % % Syntax % frames = genFrames(p, t) % % Input Arguments % p – structure containing scan parameters % t – structure containing timing parameters % % Output Arguments % frames – structure containing frames % function frames = genFrames(p, t) ...
641f05430a94d2d3e0951337c4bfd14c4d35ad3998e09534329850e93f1566ec
MATLAB
6,118
168
function checkdiff(problem, x, d, force_gradient) % Checks the consistency of the cost function and directional derivatives. % % function checkdiff(problem) % function checkdiff(problem, x) % function checkdiff(problem, x, d) % % checkdiff performs a numerical test to check that the directional % derivatives defined in...
e5107f4b1bbb541617ec1e508d0f99f0c00c5c8d337124ca1af2436f76e184a8
MATLAB
6,118
198
function [f,p,ci,stats,tbl,dist] = permuanova1(x,group,varargin) %PERMUANOVA1 One-way permutation-based analysis of variance (ANOVA). % F = PERMUANOVA1(X) performs a one-way permutation-based ANOVA for % comparing the means of two or more groups of data in matrix X, and % returns the test statistic. The columns ...
a74d4b0e16c895a239c722570b389f58698b2cfe2aaca971d4b065f2db0f967c
MATLAB
6,121
141
function [datafit,Amps,freqs,Fval,sig]=fitlinesc(data,params,p,plt,f0,fscanbw) % fits significant sine waves to data (continuous data). % % Usage: [datafit,Amps,freqs,Fval,sig]=fitlinesc(data,params,p,plt,f0) % % Inputs: % Note that units of Fs, fpass have to be consistent. % data (data in [N,C] i.e. time...
e01b6e60889eb3be5e33f23069f8c271325aeea16a1829da82d682cc62dba05d
MATLAB
6,126
141
function out = CO_Oversampling(y) % CO_Oversampling Detects temporal oversampling relative to a series' own dynamics. % % Implements the oversampling-detection statistic eta (and its downsampling % correction) from the 'oversampling' stage of the Chaos Decision Tree % Algorithm: % % Toker, D. et al. "A simple method ...
28c4534fb9e850aeafcd67d3ec8da1b23d12416ac5e0906edd6cbc8af9e3209a
MATLAB
6,131
134
% STD_REJECTOUTLIERS - Commandline function, to reject outlier component(s) from clusters. % Reassign the outlier component(s) to an outlier cluster specific to each cluster. % Usage: % >> [STUDY] = std_rejectoutliers(STUDY, ALLEEG, clusters, th); % Inputs: % STU...
a4508e8f510c1f0da5a5d1fbedd0351b9a6ac467a6f08145ab1e9ea74e72256f
MATLAB
6,131
187
function [ listDcms, listConfounds ] = export( obj ) % Export results and data from HUGE object to SPM's DCM format. % % INPUTS: % obj - A tapas_Huge object containing data. % % OUTPUTS: % dcms - A cell array containing DCM structs in SPM's DCM format. % confounds - An array containing group-level confounds...
1f79ae68f17f6a9eaa7752eeddd6c37d4f4954d25ad4839a8eb2bc346704be7e
MATLAB
6,134
158
%% this is for all-session version for osci clear; mypath = '/Users/bo/Documents/data_liujia_lab/analysis_liuP1_greeble'; for sub = 1:35 % access raw table mypath_time_record = [mypath, '/sub', num2str(sub), '_mri_record_fft.txt']; timeFile = fopen(mypath_time_record,'rt'); table_time = textscan...
071beb36638c446f56317eee650ff41d85f1c7ca9d6762d74cc94fb8f1e3517a
MATLAB
6,135
192
function [R,S,T]=surfing_struct(varargin) % Creates a struct from structs, pairs of keys and values, and/or cells % % R=surfing_struct(A1,A2,...) % % The "allowed form" of arguments A1,A2,... can be: % - Ai, Ai+1 are a KEY, VALUE, pair, where KEY is a string (that can be % used as a variable name) and VALUE can be o...
c47cfc3b4f81720a0f625c07bf889b91c59354bc00b05a471f977e42f78e3d84
MATLAB
6,137
115
function [varargout] = likLogistic(hyp, y, mu, s2, inf, i) % likLogistic - logistic function for binary classification or logit regression. % The expression for the likelihood is % likLogistic(t) = 1./(1+exp(-t)). % % Several modes are provided, for computing likelihoods, derivatives and moments % respectively, see...
d5fcd15486f87eda8d575ec0d5baa6380cd6a9fc0c62a5e37c54e090dab9cd4d
MATLAB
6,142
138
function E = efficiency_wei(W, local) %EFFICIENCY_WEI Global efficiency, local efficiency. % % Eglob = efficiency_wei(W); % Eloc = efficiency_wei(W,2); % % The global efficiency is the average of inverse shortest path length, % and is inversely related to the characteristic path length. % % The local effi...
13f018495581e2ece159e651b4a33dbfb3ea6150dbf1f058934ea531283ad57a
MATLAB
6,148
160
function ripples = BatchFindRipples(session,channels, noisyChannel,excludeInterval) % This is the algorithm for finding ripple events developed in May 2016 for % Celine's data. The reasoning is to take the filtered (ripple-band) signal's % envelope from multiple sources (carefully picked informative channels) togethe...
1b0d5bb95e343e39d3b25789d28ff34953da3ac03a29a56584d72c5dc95bfff7
MATLAB
6,152
134
function [peaktopeak,troughs, amplitude] = FindThetaCycles(lfp,varargin) %FindThetaCycles - Find intervals that qualify as theta cycles from the lfp signal % lfp should be in the [timestamps signal] format. Using CleanLFP before % calling this function is recommended. The [start stop] intervals as well % as the troug...