sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
af16a3c55b607effbec9cb722c38edcb7660ab691594d4b07f2eac7151975325
MATLAB
2,684
84
%% Resample X(t) to Specified Hz % Macro to handle resampling time series data from sampling frequency 'FS' to % desired frequency 'newFS' % % CONFORM = ensure xt max and xt min are preserved by resampling; clipping % if necessary; % Copyright (C) 2023 Trevor S. Smith % Drexel University College of Medicine % % This...
a5469117e0292d6e69a5141f05532bd164c42c02197852a1d9fcb1d13c0c10ae
MATLAB
2,685
60
function [optimalDV, optimalFD, optimalPCT, minMSE] = mseCalculation(maxBias,totalNumFrames,targetedVariance,targetedRs,randomRs,FDcutoffs,gevDVcutoffs, totalNumFramesRemaining, pathToInternalDataFolder,useGSR) %Calculation of delta MSE-RSFC per Section 2.3.2 subjTotalNumFrames = sum(totalNumFrames,2); ...
b7ca8ac7cdf178aed3ef2accb9691ce423fb89c93f802e32d737ef474d40175f
MATLAB
2,685
81
%% Get Cell Centered Gradient Matrix % % Returns the gradient matix in either two or three dimensions. % % G = getCellCenteredGradMatrix(bcFlag,h1,h2,h3); % % Where G is the gradient and h# = [d1 d2 ... dn]'; where d is the size of % each cell. % % Here, 'bcFlag' is a boundary condition flag. Set this to either:...
1547587ae190a1430c1cb024d7af71ba1ff3fc47508d2d041aa76df14978ee3f
MATLAB
2,686
77
function [data_reg] = CBIG_VK2019_regrOutConfounds... (data_nonreg,names_regr,regr_dir,motion_dir,RSfile_stem,idx_subj,names_subj) % This function regresses out the effects of confounds on a data matrix. % % Inputs: % % - data_nonreg : N x X matrix, N is #subjects, X is #data variables % - names_regr ...
5c0b89b36d00d1d555d24d105c195e24788790b673b4bf2848d8d2da253a5f14
MATLAB
2,686
68
function Dist = lme_mass_RgDist(Surf,maskvtx,vtxInd,Dtype) % Dist = lme_mass_RgDist(Surf,maskvtx,vtxInd,Dtype) % % This function computes the distances among all vertices inside a region. % % Input % Surf: Triangular surface. It is a structure with Surf.tri = t x 3 matrix % of triangle indices, 1-based, t=#triangles...
22bf2f4b3c15a52be69ef70b3c82502202ae274871331e4c81433eed92df3c25
MATLAB
2,687
92
function [varargout] = mesh_heights_distribution(mesh,varargin) % MESH_HEIGHTS_DISTRIBUTION Plots FEM mesh elements heights distribution. % % SYNTAX: % MESH_HEIGHTS_DISTRIBUTION(MESH) % MESH_HEIGHTS_DISTRIBUTION(MESH,RESOLUTION) % [H] = MESH_HEIGHTS_DISTRIBUTION(MESH) % [H] = MESH_HEIGHTS_DISTRIBUTION(MESH,RESOLU...
2497b67cf6c50f6bb8c29d28cc60d7862b4bdaa61db010ca4a9976bfdf6a0c0c
MATLAB
2,687
129
function par_out = paramInitFunc(n,nt,dt,sigma,alpha,beta,niter_pcg,dTri,spacing,chi) % this function returns the par structure % defines the models size, parameters % BC values if needed par.dim = length(n); if par.dim==2 %% 2D verison %% Domain size, uniform grid n1 = n(1); n2 = n(2); h1 = ones(n1,1)*spaci...
ab9cf53ca86516c08554edadc8f716ef03091c32fc9896e2b5a50773eb8ada8a
MATLAB
2,687
79
function Icombo = id_synapses_pre_and_post_coloc(preinds,postinds,Iall,xystep) %Creates a mask for synapses (combined channels) based on the intersection of pre- and %post-synaptic markers %intersection logic: OR within pre or post, AND between pre and post %separate out pre-synaptic channels and combine using...
30ecc00730bb0ae4753bd279e8e73375595ee5ca6a46360ff4f081ac45a9aa07
MATLAB
2,688
88
function [ newstruct1, newstruct2 ] = bz_Matchfields( struct1,struct2,mode ) %[ newstruct1, newstruct2 ] = bz_Matchfields( struct1,struct2,mode ) %Takes two structures that may have different fields and gives them the %same fields. Mode can either be 'remove' or 'add' (mismatching fields) % %If struct1 is a cell array ...
b44a22921f54177c200684ace9bd4df31cccfcb065f4b751fbc3fd9ac4d0de96
MATLAB
2,688
57
function parallel_estimate_FIR_GLM(stat_path,sots_path,exp_folder,N,TR,model,FIR_window,FIR_bins) % ======================================================================== % Ruslan Masharipov, October, 2023 % email: ruslan.s.masharipov@gmail.com % ======================================================================...
39ff9ed2b77a85c20235d6da6ab9599837a6320b5dfb0b7516e2077b380f02f3
MATLAB
2,689
78
function linecolor = linecolor_common(cfg, varargin) % LINECOLOR_COMMON implements consistent color handling for multiple channels/conditions % % This function is used by % ft_databrowser % ft_multiplotER % ft_singleplotER % % It is not yet used by % ft_connectivityplot Ndata = length(varargin); % it is ass...
8eea70537b7bcb21d0d63b1dc16fbf097281d80ecc053d4bab400be20880d0e4
MATLAB
2,690
71
function index = CBIG_gwMRF_index_trans_btwn2versions(lh_old_annot, rh_old_annot, lh_new_annot, rh_new_annot) % index = CBIG_gwMRF_index_trans_btwn2versions(lh_old_annot, rh_old_annot, lh_new_annot, rh_new_annot) % % We now have different versions of Schaefer2018 parcellations. If you want % to update from v0.8.1-Scha...
07bb843aa31f4691c14dbd3c0ee5625884195b965d8a1850402745e22bcb57c8
MATLAB
2,691
70
function h_loadQCamAnalysis3(handles) global h_img3; [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); currentFilename = get(handles.currentFileName,'String'); [pname, fname, fExt] = fileparts(currentFilename); analysisNumber = h_img3.(currentStructName).state.analysisNum...
c4c5fbba59cc452a3e618c9f161b3a5facf45f924cd1b80070b8c961ee72ba66
MATLAB
2,691
51
% IMAGES % See also % % Display: % clusterMontage - Used for visualization of clusters of images and videos. % im - Function for displaying grayscale images. % filmStrip - Used to display R stacks of T images as a "filmstrip". % makeGif - Writes a matlab movie to an animated GIF. % mon...
e4045fee44a8a613edf2259c85b373077b32072567ccc092e5197843a50fe924
MATLAB
2,691
89
function noise=noisecg(N,a1,a2) %NOISECG Analytic complex gaussian noise. % NOISE=NOISECG(N,A1,A2) computes an analytic complex gaussian % noise of length N with mean 0.0 and variance 1.0. % % NOISE=NOISECG(N) yields a complex white gaussian noise. % % NOISE=NOISECG(N,A1) yields a complex colored gaussian noise % obta...
1924ac0f383cf1314c60b7ce1554481bac162898fbfdddd69b0e7728155c99bc
MATLAB
2,692
97
function coloredIm = drawSurfaceMap(scores,colMap,col,rang) % function I = drawSurfaceMap(scores,colMap,color) % - this code is used to make a surface map colored by score. % % [input] % scores: values used for drawing map % colMap: map information % .idxSurfMap: map for index % .colSurfMap: template map for ou...
5186c3f9fb7baaa26d76cc8ff1a6eac2a25d78d6e5041daf71606b40ec963283
MATLAB
2,693
103
classdef Recording < handle properties name filePath sampleRate sampleCount end properties (SetObservable) timeOffset = 0 % in seconds. (allows recordings to be offset in time to sync up with other recordings) muted = false end ...
a41223a80b1eca4484a5219f39e61436018c0142c93c31bb17ca9acec76efc3c
MATLAB
2,694
120
load ../data/sigSL_allSessions_Ariel_230522.mat S = sigSL_Ariel; load ../data/sigRL_allSessions_Ariel_230522.mat R = sigRL_Ariel; do_save_fig = 0; %% Natalie will re-do this for the version that's in the paper (06/05/2023) %% % av_win = 0.01; av_win = 0.05; sm = round(av_win/(S.t(2)-S.t(1))); % v = 'TinC'; v = 'wh...
e5fd8887eeeb113068cfb6ba545cbecd9b0a699dbb0ef6fa4eed9bec587881c8
MATLAB
2,694
69
function [hdr] = read_nex_header(filename) % READ_NEX_HEADER for Plexon *.nex file % % Use as % [hdr] = read_nex_header(filename) % % See also RAD_NEX_DATA, READ_NEX_EVENT % Copyright (C) 2007, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and deta...
0947b428b673fa81ef2ac4b8ca417fb3f521e0605888a53af141013cc28ee00c
MATLAB
2,695
52
function making_npy_files_for_w_st_lc(folder_tif, folder_npy, inverting_x_y,num_of_cores_npy) mkdir(folder_npy); lc_channel_list = dir([folder_tif, '/*']); lc_channel_list = lc_channel_list(~startsWith({lc_channel_list.name}, '.')); lc_channel_list = lc_channel_list(cell2mat({lc_channel_list.isdir})==1); l...
1d540070622c622ce420a3b1f170ae147badd8792e602b8e554df785b0535443
MATLAB
2,695
108
function [Reg,FinSize,DomId] = ClustReg(map,thr) s=size(map); s1=s(1); s2=s(2); Reg=zeros(s1,s2); ClusSize=zeros(1,70000); if map(1,1)>0 ClusNum=1; Reg(1,1)=ClusNum; ClusSize(ClusNum)=ClusSize(ClusNum)+1; else ClusNum=0; end for n=2:s2 if map(1,n)>0 if Reg(1,n-1)>0 Reg(1,n)=R...
f8ca8f7d0068871e689cd8830e62bff1f70fd46069c1c7d653dbe10becbca360
MATLAB
2,695
104
function newmatrix = wlFT_calcEventErrors(oldmatrix, errfunc, errlabel) % function newmatrix = wlFT_calcEventErrors(oldmatrix, errfunc, errlabel) % % This function calculates reconstruction error for each detected event in % the specified event matrix. Error is computed between the event and one or % more context wave...
fd304f107f4d964a2e246f4c4f6b9db3c0fab88f5d075d9a133433c27683e596
MATLAB
2,696
91
% Demo for 2D neural field model. % This demo inverts a linear 2D neural field model. % NB: in this instance, the neural field is deterministic. clear variables close all %---- Choose basic settings for simulations ----% % dimensions n_t = 2e2; % number of time points ns ...
0ac92b25fde6181fe43a6e5878ee4c2b06d07eac3ec6d93f4f38240d3e828337
MATLAB
2,697
70
% RegisterStack_WithPreviousDFTShifts.m % Sarah West % 8/26/21 % Takes the frame-by-frame transforms previously calculated by a % dftregistration and applies it to a stack. (dftregistration will give % this to you as Greg variable as you're calculating transforms, but this % code allows you to apply the transforms to ...
96e24c5bdb145e54517f19fa832743b012628209910b428f88547ccdd4117500
MATLAB
2,697
73
function [] = SpectrumPlotDensity(opt,xlims,ylims,npaths,PathwaySignal,Gwave,GridSize,ColorLims) %% %Estimate E1 & E2 E1=exp(-opt.TR/opt.T1); E2=exp(-opt.TR/opt.T2); %% %Convert G to G/cm opt.G=opt.G/10; %% %Gradient Block Calculations %Define temporal gradient spacing dt=(opt.TR*10^-3/opt.SpectraResolution); %Perform ...
c3e9139dff28f5a4680c496664af6223a982b7c4aa816790df645f2cb5b5bdb0
MATLAB
2,698
56
function Xmatrix = Method_Protein_matrix(atlas_img,brain_sphere,out_path) % Function: Preprocession of receptor PET images. % Updata date: 2022.12.16 % Email:luolongcao@163.com % addpath('E:\Project\AHBAenrich\utils1026'); %% recepter matrix of AAL116 % atlas_img='D:\work_dir\AHBAenrich\rawdata\brain_atla...
f42592d2b52f72d34502125e13d524aecd8a7199deac2a5bec184ca87e0bef2b
MATLAB
2,698
92
function [mi, nmi, pij, pi] = mutualInfoAllPairsDiscrete(X, values, weights) % Compute mutual information between all pairs of discrete rv's % % INPUT % X(n,j) is value of case n=1:N, node j=1:d % values is set of valid values for each node (e.g., [0 1]) % weights is an optional N*1 vector of weights per data case % %...
315645473af5f9ac3851079d40394cd1819589b9fb5262eb43fcd907b84514b2
MATLAB
2,699
70
function probs = data_to_probs(X, params, options) % Compute probability distributions for time series data X % %----------------------------------------------------------------------- % INPUTS: % X: time series data in the form (units X time) % % params: parameters used for estimating probability d...
a441b21fd872ab9feab6729a71076264bba3619c7d9a047d604c560955b79518
MATLAB
2,699
72
% Normalized n-dimensional cross-correlation with a mask. % % Similar to normxcorrn, except takes an additional argument that specifies % a figure ground mask for the T. That is T_fg must be of the same % dimensions as T, with each entry being 0 or 1, where zero specifies % regions to ignore (the ground) and 1 specifi...
dfed3bf8513c126599d6a68d8133eda6c996b35cd1518da692109fa19b5be366
MATLAB
2,699
76
function [avg] = read_ns_avg(filename) % READ_NS_AVG read a NeuroScan 3.x or 4.x AVG File % % [avg] = read_ns_avg(filename) % % The output data structure avg has the fields: % avg.data - ERP signal in uV (Nchan x Npnt) % avg.nsweeps - number of accepted trials/sweeps in avg % avg.variance - varian...
3baed327d7870f7694ad30e217e17dfa5cacc4b5eea6c6b9e3ad5577bd0fc4b1
MATLAB
2,700
75
% Run for ToR-ORd+Land electro-mechanical model % (Margara, F., Wang, Z.J., Levrero-Florencio, F., Santiago, A., Vázquez, M., Bueno-Orovio, A., % and Rodriguez, B. (2020). In-silico human electro-mechanical ventricular modelling and simulation for % drug-induced pro-arrhythmia and inotropic risk assessment. Progress in...
6f766ec411eccdfbd6af306d3d8029ef049b8d61f7896aee6ed99c48ef6863d1
MATLAB
2,700
69
function N = tangentspacefactory(M, x) % Returns a manifold structure representing the tangent space to M at x. % % N = tangentspacefactory(M, x) % % N defines a (linear) manifold that is the tangent space to M at x. Points % are represented as tangent vectors to M at x. Tangent vectors are also % represented as...
ba34d82411883401881390ab4057745b7beb1e0aa666adb1cc42d3ac6395293e
MATLAB
2,703
60
function AllRegions = FindRegionsOneImage(Image, dilateSize, min_pixels, fudgeFactor) if size(Image,1)*size(Image,2)>300000 f = waitbar(0,'Large File! Please Wait While I Find Regions...'); end % find threshold from Image, will use it in a few lines % trying with 'log' edge detection method instead of 'sob...
8d8284d98705eef4605cca1502529f771145ef5319dfdaa3f7479b84e92e4caf
MATLAB
2,704
93
function varargout = eigs_2x2(S,neigs) S = reshape(S,[4,numel(S)/4]); [n1,n2] = size(S); if ~exist('neigs'), neigs = 2; end; % compute the eigenvalues a = S(1,:) + S(4,:); b = sqrt(4*S(3,:).*S(2,:)+(S(1,:)-S(4,:)).^2); lambda = zeros(neigs,n2); isless = b <= 0; if any(isless), lambda(1,isless) = (a(isless) - b(isle...
8ed729dde67ec6029f98f97f1125282f48ee6c0a4faf2843e099f8c45c8830c2
MATLAB
2,704
69
function plot_wave_examples( x, options, trial, evaluation_points, source, rho ) % *SPONTANEOUS WAVES DEMO* % % PLOT WAVE EXAMPLES plot specific examples of spontaneous waves based % on calculated values of \rho_{\phi,d} % % INPUT % x - datacube (rows,cols,timepts) % options - options struc...
1d8edcafd216465657cb10114b7e7223060259813527704b7b9bcb8843ac9394
MATLAB
2,706
119
%% Generic fMRI preprocessing % % Scan spider applicable to most fMRI. % % Performs: % Drop initial volumes if requested % Slice timing correction % Motion correction % Coregistration to T1 anatomical % Transform to MNI space using specified warp from the T1 % Spatial smoothing %% DEPENDENCIES...
b58306178db3edd4b58342a0fb4deece009767492fffbeaf30aadea7b4b79435
MATLAB
2,706
54
%% 功率谱密度 | power spectral density %% 非参数方法-Welch法 % 使用welch方法[pxx,f] = pwelch(x,window,noverlap,nfft,fs)进行功率谱估计 % 调用调用bandpower(pxx, f, [f_low, f_high], 'psd')提取相对average band power特征 % 默认window=fs(即1s), nooverlap=window/2 % X: single channel EEG signal (either a row vector or a column vector) % opts.fs: sampling frequ...
02f02e4f76dd53e15881633503d52b150e23539aaf66f07de993a570cd5f7eab
MATLAB
2,707
76
function plot_place_fields(varargin) %plots place fields on each track, sorted by each of the tracks (2 tracks=4 %plots, 3 tracks=9 plots). first plot is a heat map of place field, second %plot is a firing rate vs. position plot % %leave input empty if you want to use previous extracted place fields saved %as a .mat fi...
8dfc1b64070cd109ed54864aa3d7b8df01832cc0bf630842b0d91460f278de7e
MATLAB
2,707
78
function varargout = removevars(varargin) % T2 = removevars(T1,vars) deletes the table variables specified % by vars and copies the remaining variables to T2 (see diagram). You % can specify variables by name, by position, or using logical indices. % % Use as % T2 = removevars(T1, vars) % % This is a compatibility f...
32e8bcf0f5b64b7c63f52723d78098184af2c3ed5f600506289434eafd37fa90
MATLAB
2,708
108
function Results=PopAnal_FormatCorrShuff(AllTrialData,Phase,unit,timeWindow,opts) %% % timeWindow=[-1.5 -.5]; % Task related Firing Rate disp(timeWindow) %% Conditions={ 'NancyPinchCheek','NancyPressCheek','NancyRubCheek','NancyTapCheek',... 'NancyPinchShoulder','NancyPressShoulder','NancyRubShoulder','NancyTapSh...
0da4ea8a8d78f126e9bca5251089c2883daa6b795279dc5a68d6f6146c83fbc3
MATLAB
2,709
81
function EEG = FlagTriggersInTrial(EEG, varargin) % function EEG = FlagTriggersInTrial(result, varargin) % flag trials for removal based on triggers in EEG, works across entire % trial, not just the epoch (use FlagTriggersInWindow for within-epoch % flagging). % The trigger flagging looks at a period defined by two tri...
dd0ecb49f2e56f2665a2d46e71088021f72cec0dd9379616d833b1220f3f98e1
MATLAB
2,709
80
%_______________________________________________________________________ % % Allow the experimenter to advance or exit the presentation %_______________________________________________________________________ % % In testing or development mode the presentation can be advanced by % pressing dotInfo.keyReturn and exited ...
c7c7730b66025170f1e4d11d384ddf7a4f869652915a241209ba1d180415157f
MATLAB
2,710
95
%% Simple test to make sure the logZ calculation is correct % This file is from pmtk3.googlecode.com %% Sprinkler network % Small network, so we can use brute force enumeration to test dgm = mkSprinklerDgm(); N = dgm.nnodes; tol = 1e-5; for trial=1:2 trial if trial==1 clamped = sparsevec(1:3, [1 1 1], N);...
ee0d7a9c4f63108d967365b8584450d0a4185839f86f4fb00fa75b50e2fd7662
MATLAB
2,711
109
function [y, x] = resample_scnlab(data, p, q, varargin) % Resample : Uses matlab's resample.m, but pads ends to avoid edge % artifacts % % :Usage: % :: % % [y, x] = resample_scnlab(data, p, q) % % OR % [y, x] = resample_scnlab(data, p, q, origHz, targetHz) % % Y = RESAMPLE(X,P,Q) resamples the sequence in v...
6a7deaa65337d260c8b423fd3edf908ca916c3c05d92d93b841d18ad29bcf148
MATLAB
2,712
88
clear;clc path = 'D:\InVivo\ActiveTouch\2022-10-24_Daniel_Mix2_M1_Surface_221024_145539\'; load([path 'Processed\Processed.mat']) load([path 'RawAnalog\badChannels.mat']) %design bandpass filter for the broadband LFP Fc = [300]; Wn = Fc./(20000/2); [b1,a1] = butter(4,Wn,'low'); Fc = [10 90]; Wn = Fc./(1000...
925d5a183f862fdaba9c494b372a77a097cccc9a2b5275f1c4ceafa74dc3253e
MATLAB
2,713
80
function BW = utils_RFC( par, mysize, dimvals ) % original version by: Hans Op de Beeck % 2009 D Drucker % 2016 Peter Kok % 2017/10 Coraline Rinn Iordan w = par.w; A = par.A; P = par.P; step = par.step; ODBsize = 299; % original image size used by Op De Beeck. Need this because the amplitudes and the smoothing kernel...
a14333c56758cf0fc81488f57f6a1d861a8ff4e87fa008c81f233df765d9e005
MATLAB
2,713
90
%% Compare the results of imputation on a MVN using three imputation methods: EM, ICM, and Gibbs % PMTKauthor Cody Severinski %% % This file is from pmtk3.googlecode.com setSeed(1); d = 10; n = 100; mu = randn(d,1); Sigma = randpd(d); pcMissing = 0.2; model = struct('mu', mu, 'Sigma', Sigma); Xfull = gaussSample(mod...
b20468f8ebedfbcb97026a61f667a9e32440c66c3e06dca1d191388139ea1679
MATLAB
2,713
71
function file = dccnpath(filename) % DCCNPATH updates the path in the filename of a test file located on DCCN central % storage. It helps to read test file from Linux, Windows or macOS computers in the % DCCN. % % Use as % filename = dccnpath(filename) % % The function assumes that on a Windows machine the DCCN home ...
86c9385bd1746db499bb808053f139a5e02aab4e5a875814157e302b112df2b1
MATLAB
2,714
117
function draw_figureS3AB(p,encRes) % % This code is for drawing figure S3AB % % %% settings nSbj = length(p.sbjID); %% draw figure S3A % draw results close all h = ffigure; cnt = 0; drawScores = {... 'category' 'categcontinuous' 'dimension' 'dim28binary' 'dim28continuous' }; % display sett...
252eb0ab195f9d728173da63c5a832bee995b7a52a885c64cc3cf3f9dcd88e37
MATLAB
2,715
65
function C = bst_bsxfun(fun, A, B) % BST_BSXFUN: Compatible version of bsxfun function. % % DESCRIPTION: % Matlab function bsxfun() is a useful, fast, and memory efficient % way to apply element-by-element operations on huge matrices. % The problem is that this function only exists in Matlab versi...
621a25f5e04bb1b85c11b11bc18d5d326c5a1dc51885b4fbf19ff8aba6bed497
MATLAB
2,716
73
function mesh = ft_defacemesh(cfg, mesh) % FT_DEFACEMESH allows you to de-identify a scalp surface mesh by erasing specific % regions, such as the face and ears. The graphical user interface allows you to % position a box over the anatomical data inside which all vertices will be removed. % You might have to call this...
9dd38574d147139e281aa233453656832357b01e56251e9af1be772cc1fff89a
MATLAB
2,716
98
%% plot_saveModule % Internal shared macro to handle saving figures; ensure that exported svg % files remain fully-editable for offline post-hoc modifications % % Function should be fully defined % Generally, this function will only be called from internal code, % not from the user % % PARAMETERS % f = figure to save ...
ac6ad6c71666a48b0f6af2dccd33336f8498d4e010c6002255a95e6a85951ac5
MATLAB
2,716
73
function mesh = ft_defacemesh(cfg, mesh) % FT_DEFACEMESH allows you to de-identify a scalp surface mesh by erasing specific % regions, such as the face and ears. The graphical user interface allows you to % position a box over the anatomical data inside which all vertices will be removed. % You might have to call this...
cbb3fdea1f8d8f45e5c1f2b682b2ed60a20906b8ba4754b479b9f45a4ea70db1
MATLAB
2,716
72
function result = find_conda_executable() % Attempt to find the path to the conda executable. persistent memoized_result if isempty(memoized_result) , apt_conda_path = '/opt/conda/condabin/conda' ; if exist(apt_conda_path, 'file') , % On Ubuntu, if you install conda via apt (apt as in Ubuntu/Debian apt-get, ...
051c4c8260c7694543a487c3f07d1df19fc97f31ae0b8949cdb4f23b02b4673f
MATLAB
2,717
111
function [EEG, cuantos] = sound2event(EEG, channel, code, Threshold, win) % sound2event v.2 % 3.4.2009 % % for LAN & EEGLAB structur % Sound 'si' or 'yes' to event % needed --> earasecode.m % eeglab % % EEG = data (EEG.data) % channel = 53 % channel % Threshold = 2 ...
5b3f634a3f7e7ef214dffe2d0754c403990e28d5dddd582e954c8998d708670b
MATLAB
2,717
86
function [ EEG, bad_chans ] = s1_prep_childmind_eeg( eegpath, cfg ) % S1_PREP_CHILDMIND_EEG contains automated preprocessing procedures. See "prep_childmind_eeg_batch" % for details. % Copyright (C) 2023, Christoffer Hatlestad-Hall % throw error if insufficient input if nargin < 2 error( 'requires two i...
3c2749d409d7149332f5356fa9c424fa6e79d21fd1ff80f078d02f6dcb559a0d
MATLAB
2,718
76
clear all close all HPC=1; % roi definition file if (HPC==1) roifile="/scratch/cs/networks-pm/effects_externalfactors_on_functionalconnectivity/data/mri/conn_matrix/movie/group_seitzman-set1_info.xlsx"; else % working on local computer roifile="\cs\networks-pm\effects_externalfactors_on_functional...
6f08c27edd43198ab5b41685b3f2d5616b84d6ffb9539007e4dd661e2b2b9b80
MATLAB
2,718
90
function [varargout] = lmoutr(varargin) % LMOUTR computes the la/mu parameters of a point projected to a triangle % % Use as % [la, mu, dist] = lmoutr(v1, v2, v3, r) % where v1, v2 and v3 are three vertices of the triangle, and r is % the point that is projected onto the plane spanned by the vertices % Copyright (...
15523a4a739eb4693fc72318bcd494f7c03fc86bb1803f453c502bad8a89b21f
MATLAB
2,719
60
function y_Vol2Surf(InputFile,OutputFile,interp, TargetSpace) % FORMAT y_Vol2Surf(InputFile,OutputFile,interp, TargetSpace) % Input: % InputFile - input filename % OutputFile - output filename % interp - interpolation method. 0: nearest. 1: trilinear. % TargetSpace - Define the target space. 'fsaverage' o...
d75e1de6b80d472a08244d8d7586a5171823200f888f1105ac426319b2a99c70
MATLAB
2,719
102
%% GSA_FAST_GetSi: calculate the FAST sensitivity indices % Ref: Cukier, R.I., C.M. Fortuin, K.E. Shuler, A.G. Petschek and J.H. % Schaibly (1973). Study of the sensitivity of coupled reaction systems to uncertainties in rate coefficients. I Theory. Journal of Chemical Physics % % Max number of input variables: 50 % %...
f9c80054a2eb7ba694df008777aba9ebe35ea2314ab7dd42b7a822b2aa259255
MATLAB
2,719
91
function [varargout] = mesh_nodal_distance_distribution(mesh,varargin) % MESH_NODAL_DISTANCE_DISTRIBUTION Plots FEM mesh edges length % distribution. % % SYNTAX: % MESH_NODAL_DISTANCE_DISTRIBUTION(MESH) % MESH_NODAL_DISTANCE_DISTRIBUTION(MESH,RESOLUTION) % [D] = MESH_NODAL_DISTANCE_DISTRIBUTION(MESH) % [D] = MES...
fcf3bed43fe6a7b49f8927e5538888c5591473ec1cf890321c7840df1fda546c
MATLAB
2,719
99
function spkDat = ResortSpikes(spkDat, trodeFile, ops) pk = ops.peakLoc; wL = ops.waveLength; verbose = ops.verbose; numFeatures = ops.numFeatures; batchSize = ops.batchSize; % not currently used--just loads all of trodeFile into RAM. % delete any repeated timestamps [~, ia] = unique(spkDat.ts); repeatTs = unique(spk...
5cfe22da2298278ade8958fe9d2b70605c9cca3ac703725be2744aa53ff3b166
MATLAB
2,720
58
function [deformation, seg_files]=segmentation(anat_file, tpm) anat_vols=strcat(anat_file,',1'); [tpm_p,tpm_n,tpm_e] = fileparts(tpm); tpm_cell=cellstr(spm_select('ExtFPList',tpm_p,['^' tpm_n tpm_e '$'],inf)); matlabbatch=[]; matlabbatch{1}.spm.spatial.preproc.channel.vols = {anat_vols}; matlabbatch{1}.spm.spatial.pr...
60604f06a170308ba4d68af02712a80366d780a4fe5f2aafdd721418e6e75b58
MATLAB
2,720
108
% This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
d6fa8976de56b82cd8177e1e4c9ca61d76e900c11d1fd991c0f0045a1970b561
MATLAB
2,720
99
function [img_filtered] = pystripe(input_img,varargin) % This is adapted from pystripe / Kwanghun Chung Lab @ MIT % and pystripe is adapted from ClearMap2 / Christoph Kirst % % Trying my best to do a faithful port. % 'quick-lightsheet-correct' and 'nD-smooth' are not included % Yuan-Ting Wu @ Yongsoo Kim Lab ...
ea23ddeb6e480c80bbbeaf19c71347b16aeb822d70fa07f3643059afeecb23c9
MATLAB
2,720
114
function [omckk,Tckk,Rckk,JJ] = compute_extrinsic_refine(omc_init,Tc_init,x_kk,X_kk,fc,cc,kc,alpha_c,MaxIter,thresh_cond), %compute_extrinsic % %[omckk,Tckk,Rckk] = compute_extrinsic_refine(omc_init,x_kk,X_kk,fc,cc,kc,alpha_c,MaxIter) % %Computes the extrinsic parameters attached to a 3D structure X_kk given its proje...
217da0e9c1788368b19139030d4d51299804a4531310386afad15d0a3991ed6b
MATLAB
2,721
58
% SOFA API - script demonstrating the usage of variables in the API % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may not u...
864aab9d45c82c3c1a0ac920d09429eedbcdfcb7eb9b78491080d633594b26c9
MATLAB
2,721
71
function FSM=CBIG_KRDNN_kernel_with_scale(data_KbyS1,data_KbyS2,index_S1,index_S2,type,scale) % CBIG_KRDNN_kernel_with_scale(data_KbyS1,data_KbyS2,index_S1,index_S2,type,scale) % % This function compute kernel for kernel ridge regression algorithm based on % data from two sets. % % Inputs: % - data_KbyS1 % data ...
b786c0be721a6d7f219d96c42027dd6ba53cc39494da6a4e64fe1faf22aa31f5
MATLAB
2,721
72
function dgm = dgmTrain(dgm, varargin) %% Fit parameters of a DGM % If data is missing, we fit using EM % otherwise we compute MLE/MAP of each CPD analytically % % If structure of graph is unknown, use dgmFit % %% Inputs % % dgm - a struct: use dgmCreate to create the initial dgm. % e.g. dgmCreate(G, mk...
22e05303c122ed60d945b65cf27c731d76a14fb8c4af15e6afd169d608744c73
MATLAB
2,722
80
function BW = utils_RFC( par, mysize, dimvals ) % original version: Hans Op de Beeck % (c) 2009 D Drucker % (c) 2016 Peter Kok % (c) 2017/10 Coraline Rinn Iordan w = par.w; A = par.A; P = par.P; step = par.step; ODBsize = 299; % original image size used by Op De Beeck. Need this because the amplitudes and the smoothi...
a3b6747c2ac5e91a38775c81edee56e905f4f892e4ab8a0a78819b7127437537
MATLAB
2,722
69
% Fix possible splitting of responses between two consecutive frames % Version 2 - accumulate everything from one frame to the next function ImageArray_CorrAmp_2 = FixSplitting2(ImageArray_CorrAmp, ImagesPerSequence,DisplayOn) ImageArray_CorrAmp_2 = zeros(size(ImageArray_CorrAmp)); NumOfSequences = ...
eb6ce7e9af6f8527b3cd1017fe3ec4bee24ec731634a908fdbe3e0607b626e7e
MATLAB
2,722
59
%Step 1 of CBIG Kong2019 Brain Parc Pipeline % %To run: 1. Open Matlab using salloc (ex: `salloc --mem-per-cpu 200G --time 2:00:00 --x11`) % 2. source your config file containing the $CBIG_CODE_DIR variable % -It might be helpful to `cd` to the $CBIG_CODE_DIR/stable_projects/brain_parcellation/Kong2019_MSHBM/step1.....
a5ade063950338b2071bd4a75b59f05297b3fb01abec0ee69b208475e9d76991
MATLAB
2,723
77
function subgrad = getSubgradient(problem, x, tol, storedb, key) % Computes a subgradient of the cost function at x, up to a tolerance % % function subgrad = getSubgradient(problem, x) % function subgrad = getSubgradient(problem, x, tol) % function subgrad = getSubgradient(problem, x, tol, storedb) % function sub...
ee8eebc8796ed5a7b84f770390523f6eeacbe77fd323dfc4045a4f62f1ddaece
MATLAB
2,723
66
function bin_map = CHT_Segmenter(my_image, centers, radii) HT_size = size(my_image); bin_map = false(HT_size(1), HT_size(2)); num_detections = length(radii); for this_rad = 1:num_detections this_center_colony = centers(this_rad,:); this_radius_colony = radii(this_rad); % cover center of colony ...
f46c7def2068b04fcbac99c69ddd20a0930c604046d8e414f72398c56f19f8e1
MATLAB
2,723
103
function [data] = selfromraw(data, varargin) % FIXME this function is not documented selrpt = ft_getopt(varargin, 'rpt', 'all', 1); selchan = ft_getopt(varargin, 'chan', 'all', 1); seltim = ft_getopt(varargin, 'latency', 'all', 1); if ischar(selrpt) if strcmp(selrpt, 'all') selrpt = 1:numel(data.trial); e...
f4c3b661bc80ced8ef63d35f935c69808cf70c4a58a787ab0e68cfba5c87ed18
MATLAB
2,723
102
function [accuracy, balanced_accuracy] = VBA_accuracy (pred, data, type, isYout) % // VBA toolbox ////////////////////////////////////////////////////////// % % [accuracy, balanced_accuracy] = VBA_accuracy (pred, data, type, isYout) % classification scores of binary or categorical predictor % % IN: % - pred: predict...
5ca80fd163b3678290c066f0a6303c7b8f2169942f84b6f6d4313f94e91e5e9b
MATLAB
2,724
90
function [varargout] = lmoutr(varargin) % LMOUTR computes the la/mu parameters of a point projected to a triangle % % Use as % [la, mu, dist] = lmoutr(v1, v2, v3, r) % where v1, v2 and v3 are three vertices of the triangle, and r is % the point that is projected onto the plane spanned by the vertices % Copyright (...
c7b813c7f2d8d1de92b86922bbf1c10ac0cc739a48bae420dbac542355c6d65d
MATLAB
2,724
94
function COR = cor_merge(COR1,COR2,varargin) % <*LAN)<] % % v.0.0.02 % Pablo Billeke % % 06.06.2011 % 12.05.2011 %%% comprobaciones if nargin > 2 COR2 = cor_merge(COR2,varargin{:}) ; %COR = cor_merge(varargin{1:end-2}) ; %return end %COR1=varargin{1} %COR2=varargin{2} c1f = sort(fields(COR1));...
cea1ae4bc6d13c8b9180b8e8d2b16897402927d6e1773c2b27135a440b7be74c
MATLAB
2,724
120
function [XO, YO, XI, YI, XP1, YP1, XP2, YP2, theta1, theta1_FK, ... alpha1, gamma1, gamma2, beta1, beta2, MuscleLength] = ... MuscleOneJoint_SegmentAngles(a1,a2,phi1,phi2,R1,f1,n1,y1,y2,XC1,YC1) % MATLAB code provided by Seyed Mohammad Ali Rahmati % Affiliation: Biomechanics and Motor Control Lab, ...
9f3d492475165900b0f5bd21ef35cb4502db450be9caf9d11ff97c3ea60a2160
MATLAB
2,726
102
% Code to solve the spatio=temporal IRES. Basically a block coordinate % projected gradient descent algorithm where the edges and the solution % itself will be updated sequentially. % Abbas Sohrabpour % 5/5/2017 function [x, y] = FISTA_ADMM_IRES (Phi, TBF, TBF_norm, T_norm, alpha, lambda, W_v, V, L_v, x_0, W, W_...
a43052339f37ae013efd056ce0dbb68a756f150c19c3f9461d722a0d256a2932
MATLAB
2,726
95
function model = discrimAnalysisFit(X, y, type, varargin) %% Fit a Discriminant Analysis model % Input: % X is an n x d matrix % y is an n-vector specifying the class label (in range 1..C) % type is one of the following % 'linear' (tied Sigma) % 'quadratic' (class-specific Sigma) % 'RDA' (regularized LDA) % 'diag' ...
01b4a0d82ab722298d7cb7c1bcdcd53117201d0d365c810d08aa26c53f1b2b3a
MATLAB
2,727
85
%% Step 0: Put your data in the right file structure % If you wish to do a rapid test with a small amount of data, run the % simulator example in analysis/simlator/runSimulatorRound.m % This is the demonstration from a full-size field of view sample, used in % the publication Alon et al 2021 https://doi.org/10.1126/sc...
b265bd92a34ec6332bc1cee59e74b6df9ed08891914760a0cb2c9a0418e13b4b
MATLAB
2,727
56
clear all %% %Define default parameters [opt] = ParameterOptions(); %% %Create an oscillating gradient waveform (here consistent with definition in Aggarwal et al.) opt.nOscillations=3; % Number of oscillations per TR opt.Waveform='Sine'; % Type of Oscillating Gradient. Choose from Rect (conventional rectangular ...
b556f31bd10ee0ff2cc7d7bc2a4d172f4e56232b5e3e9e13fe95a1beb068e993
MATLAB
2,727
68
%go_calib_optim % %Main calibration function. Computes the intrinsic andextrinsic parameters. %Runs as a script. % %INPUT: x_1,x_2,x_3,...: Feature locations on the images % X_1,X_2,X_3,...: Corresponding grid coordinates % %OUTPUT: fc: Camera focal length % cc: Principal point coordinates % alpha_c...
2678cbb5d9e8c10d42ee99c8974f9ed3288ad88ed6756e9272cbb276104c4707
MATLAB
2,728
68
function opts=Config_FormInvarSubsAnal(GlobalOpts, varargin); opts=GlobalOpts; opts.PlotShuffle=0; [varargin,opts.Dates] = Utilities.ProcVarargin(varargin,'Dates',{opts.Dates}); [varargin,opts.shuffle] = Utilities.ProcVarargin(varargin,'Shuffle',opts.shuffle); [varargin,opts.overwrite] = Utilities.ProcVara...
5f1478c51c279ed48f4fe2c7acba4cd9fa395bb90dffd92eab1c2161a20987fc
MATLAB
2,728
52
function isargchar(varargin) %ISARGCHAR tests if the given arg is a char and returns an error otherwise % % Usage: isargstruct(arg1,arg2,...) % % Input options: % args - list of args % % ISARGCHAR(args) tests if all given args are a char and returns % an error otherwise. % % see also: isargstruct...
06bb8560de03ac4ddd06e9f0020caf125970b5705cb5a7d3cc0bd69ec388fd56
MATLAB
2,729
77
function hdr = read_deymed_ini(filename) % READ_DEYMED_INI reads EEG data from the Deymed Truescan file format % % Use as % hdr = read_deymed_ini(filename) % % See also READ_DEYMED_DAT % Copyright (C) 2013, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documenta...
1cd3f89145a21dd7125ffe9492b8b8a365ccfde13e151fd46b44fa8c5755ac32
MATLAB
2,729
136
clear % close all Monkey = ['Monkey1']; % ['Monkey1' or 'Monkey2'] %--------------- AlignBase = ['PER_ON']; %--------------- Align = [{'PER_ON'} {'GO'} {'MOV'} {'Touch'}] ; %--------------- nPERM = 1000; % -------------- Analysis = ['BETA']; % ['BETA' 'GAMMA'] for al = 1:length(Align) cle...
2b7dd04c7d4fbd9f46cbeaa1f838f24370fde782529ab7f36d341a35e2dcbe00
MATLAB
2,729
93
function [tri] = projecttri(pos, method) % PROJECTTRI makes a closed triangulation of a list of vertices by % projecting them onto a unit sphere and subsequently by constructing % a convex hull triangulation. % % Use as % [tri] = projecttri(pos, method) % where method is either 'convhull' (default) or 'delaunay'. % ...
0efbe4d37c6299ae8f86dc2b0200e286cafc36dca37020feaa48f03f76b90178
MATLAB
2,730
61
function [ titleStr, settings, results ] = deleteFeatures( dataview, settings ) % This function removes one or more coordinate systems from the datasource. % Attention: If other coordinates depend on the deleted coordinates (because they % are derived from them), errors will result if those coordinates a...
b6ff9dfbcf568042fbbb24a2026916ca81d672f36adfd1985b9062f4e3dc0ea0
MATLAB
2,730
76
function data_out = kpcaSimple(data_in,num_dim) % % This function does principal component analysis (non-linear) on the given % data set using the Kernel trick % % Data_Out = kernelpca_tutorial(Data_in,Num_Dim) % % Data_in - Input data (d (dimensions) X N (# of points) % Num_Dim - Dimensions of output data. (Nu...
0d61c1a2edd556bf2d328b4c8f2d7be7ae95566e77c3a4720bcd763d71776a45
MATLAB
2,731
107
function [muPost, SigmaPost, logZ, lambda] = varInferLogisticGauss(y, W, b, muPrior, SigmaPriorInv, computeLoglik) % Use a variational approximation to infer a Gaussian posterior % given a Gaussian prior and a logistic likelihood for single case % % y(t) is {0,1}, t=1:T (num outputs) % W is K*T where K is num latent d...
c2193a4ba55faac66964fba8396e0fcf9f1c0f465aba2f967bb79d9618bb4ed9
MATLAB
2,731
54
function [genotype] = interp_shortUnconfidentFrames(genotype,conf_thresh,dur_thresh) nFlies = numel(genotype.trialID); nBodyPart = size(genotype.bodyPartUV_sideConf{1},2); nTrial = 15; nPts = size(genotype.bodyPartUV_sideConf{1},1)./nTrial; lowConfFrames = cellfun(@(x,y) x<conf_thresh | y<conf_thresh, genotype.bodyPart...
eb9a00ee1ddf12c8da821ff6cd5200a14d3b62bda56be6b1f02e81606c911efc
MATLAB
2,731
95
function Aout = h_executecalcQCamRoi3(handles) global h_img3 [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); Aout = struct('roiNumber',[],'roi', [], 'timestr', '', 'filename', ''); fname = get(handles.currentFileName,'String'); [filepath, filename, fExt] = fileparts...
321ec625733c1b93b17d1614c9a419ceb6694203956166af2368cebb4c29228b
MATLAB
2,732
102
function [Itheta,SigmaTheta,deltaMuTheta,suffStat] = VBA_Itheta(theta,y,posterior,suffStat,dim,u,options) % Gauss-Newton update of the evolution parameters if options.DisplayWin % Display progress set(options.display.hm(1),'string',... 'VB Gauss-Newton on evolution parameters... '); set(options.display...
339118bb6b15ba28aea8f406c2af5e4214364a332e81f0851925ee629668e0ce
MATLAB
2,732
76
function Image_Mesh_Data_2hem(meshL,meshR,params,side,ctx,fig) % This function renders a mesh with the shading/coloring determined by the % values of the data at those points. % Update 170222, info is now needed to account for acquision direction. % Prev, his was optimized for transverse only. now sagittal is supporte...
7ceb9bc4f7dba17acca5f1d8bea985c6bc758c1194a0da805bd996041e76f7c4
MATLAB
2,732
100
%% Detect small calcium transients Tr = traces.all; disp('Detecting SCEs...') [NCell,Nz] = size(Tr); % Savitzky-Golay filter Tr = sgolayfilt(Tr',3,5)'; % figure % for i = 1:NCell % plot(time,traces(i,:)+i-1) % hold on % end % Detect Calcium Transients using a sliding window TrRest = Tr(:,mvm.restEpochsInd...
99da13175fbefafef9c9ea36290301bca75091647ad4a54ddeb1377bb2ba8e60
MATLAB
2,732
69
function [rois, delInd] = afxCheckRois(rois,subjects) fprintf(' Check for empty ROIs ...') % get functional space [~,XYZmm,~,~] = afxLoadFunc(subjects(1).conditions(1).func(1,:)); % get brain mask [brainMask,~] = afxLoadMasks([],fullfile('masks','brainmask.nii'),XYZmm); % load ...
9ea79f9286e6816fbd7eab95a50540b545b5e28c2833caaeaa2fc423387eee13
MATLAB
2,732
104
function [detvtx,sided_pval,pth,m0] = lme_mass_FDR2(pval,sgn,maskvtx,rate,tail) % [detvtx,sided_pval,pth,m0] = lme_mass_FDR2(pval,maskvtx,rate,tail) % % Two-stage FDR approach to achieve tighter control of the FDR. This % procedure is more powerful than the original FDR procedure implemented in % lme_mass_FDR. % % Inpu...
1d9733e0c956be854bff6f7e7db42095039e03d3323705547c1bd81588d86389
MATLAB
2,734
113
% freq_correlation.m % v.0.1 %------------- % correlaciones entre frecuencias por trial % experimental % % REQUIERE EN LAN.freq.cfg % .corfr = 1 % .corfr1 = {f1:f2} {} ... Rangos de freciencia acorrelacionar de % con corfr2 % .corfr2 = {f1:f2} {} ... Rangos de ...