sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6b16c5a7054ddecd714cc4cd5d9f303e5cc624b8dabd5494c55d11f47265976e
MATLAB
3,195
99
% read_eeglabdata() - import EEGLAB dataset files % % Usage: % >> dat = read_eeglabdata(filename); % % Inputs: % filename - [string] file name % % Optional inputs: % 'begtrial' - [integer] first trial to read % 'endtrial' - [integer] last trial to read % 'chanindx' - [integer] list with channel indices to ...
260516e325ab4f63ae9659a798fc360a3e03acc5f0ad3f5194d8baf124d39d9e
MATLAB
3,196
155
function leftClickCallback(self,p) if self.verbosity > 9 disp(mfilename) end if isempty(self.channel_to_work_with) return end channel = self.channel_to_work_with; if self.channel_stage(channel) == 0 return end xlimits = self.handles.ax.ax(channel).XLim; xrange = (xlimits(2) - xlimits(1))/self.dt; p(1) = p(1)/s...
58da71c3e1a80e690a82d972b7c1e34cfff8b7f01a481f03b331a555607e534b
MATLAB
3,197
112
% DELCODE-SAME, Table "FADE SAME sgd" % _ % original paper: Soch*, Richter* et al., HBM, 2022 % Table 2: Between-subject ANOVAs for FADE-classic and FADE-SAME scores % % DELCODE paper: Soch et al., medRxiv, 2023 % Figure 2: Effects of site, gender and diagnosis on fMRI scores % % written by Joram Soch <Joram.Soch@D...
0fe2b4a187d066499a2768189c55555eb915f7cf4eeb71064637b69b2b5db26f
MATLAB
3,198
97
function y = tffilter(tfr,x,t,trace); %TFFILTER Time frequency filtering of a signal. % Y=TFFILTER(TFR,X,T,TRACE) filters the signal X % with a non stationary filter. % % % X : input signal (must be analytic). % T : time instant(s) (default : 1:length(X)). % TRACE : if nonzero, the progression...
2617a8757f966234c7f2b9e51ce862fc1a36d5f5c984ee47888c02784251f7e5
MATLAB
3,198
125
function montage = megplanar_orig(cfg, grad) % This is the original method from Ole. It has a different way of % making the coordinate transformation that I do not fully understand. % Copyright (C) 2004, Ole Jensen % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and de...
058c575f3b1a95cf3933d09d613fb76cd7ec30c4c2eeb546ea329c1dead0fb6f
MATLAB
3,200
120
function varargout = subfigure(varargin) % h = subfigure(m,n,p), or subfigure(mnp), divides the screen into an m-by-n % matrix, creates a figure within the pth matrix element, and returns that % figure's handle. The figures are counted along the top row of the screen, then % the second row, etc. For example, % % in...
167cc3a663612cae03332a1363adfc423689310f6c32f8d4bac1f1244f5389e1
MATLAB
3,200
126
%% Gauss Imputation Demo % %% % This file is from pmtk3.googlecode.com function gaussImputationDemoColorHintonDiag() setSeed(1); d = 10; mu = randn(d,1); Sigma = randpd(d); pcMissing = 0.3; % Training data is missing data at random [XfullTrain, XmissTrain] = mkData(mu, Sigma, 100, true, pcMissing); % Test data omit...
3bff182fffb45033a4d7d41ce52194a2553835aa5c9d571866f7419ef978eef8
MATLAB
3,200
107
function [T, cost] = minSpanTreeKruskal (CostMatrix) % Kruskal's algorithm for MST % CostMatrix % T is adjacency matrix % cost is overall cost of tree % This file is from pmtk3.googlecode.com %PMTKauthor Soshant Bali %PMTKurl http://www.ittc.ku.edu/~sbali/graphSoftware.htm % Extract the edge weights from the cos...
8ce80771185f9daca5c8b0457b446d49e673e40e1a411494d63ed96649acde89
MATLAB
3,200
109
function s = getParamString(p,breakLine,omitParams,parPrecision,forFileName) if (nargin < 2) || isempty(breakLine) breakLine = false; end if (nargin < 3) || isempty(omitParams) omitParams = {}; end if (nargin < 4) || isempty(parPrecision) parPrecision = '%g';%'%.2f'; % either...
967ad276a568584cbb9934b6536dd38d845e5061016ae667c53b60f911869459
MATLAB
3,200
73
%----------------------------------------------------------------------------------------- % Script to plot the fraction of odor-modulated neuron per recording session % % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Figure 1h % Author: Marcel Kehl % License: MIT License %-...
b42b28bdde93dd2812a2710b5702c10362e83c4b9da15737267f942872a13c45
MATLAB
3,200
110
function [labels,parcels]=parcelate2(X,target_parcel_size,target_num_parcels,opts) if nargin<1, test_parcelate2; return; end; if nargin<4, opts=struct; end; % final_reassign requires knnsearch - which requires a toolbox if ~isfield(opts,'final_reassign'), opts.final_reassign=0; end; [M,N]=size(X); labels=zeros(1,N); ...
68051cfe40d700fe61890071fd5fbe5c210704d2987ed3149e639439e437df20
MATLAB
3,202
101
function [ax,h]=suplabel(text,whichLabel,supAxes) % PLaces text as a title, xlabel, or ylabel on a group of subplots. % Returns a handle to the label and a handle to the axis. % [ax,h]=suplabel(text,whichLabel,supAxes) % returns handles to both the axis and the label. % ax=suplabel(text,whichLabel,supAxes) % returns ...
cfadef603dc769d4f695576f900b27e3c80b641f384fbc969662650b2a888cf0
MATLAB
3,203
124
classdef TrxUtil methods (Static) function ptrx = newptrx(ntrx,npts) s = struct(); s.id = 0; s.p = nan(npts,2,0); s.pocc = nan(npts,0); s.TS = nan(npts,0); s.x = nan(1,0); s.y = nan(1,0); s.theta = nan(1,0); s.firstframe = 1; s.off = 0; s.n...
d28fb0587614c1431bf2e59f280dea068b2434545c7aa34d8b0ed1408f455679
MATLAB
3,203
80
function wlPlot_plotEventsWithContext(cfg, evlist, evstride, ... signal, samprate, fnom, contextlengths, contextcycles, ... figtitle, filelabel) % function wlPlot_plotEventsWithContext(cfg, evlist, evstride, ... % signal, samprate, fnom, contextlengths, contextcycles, ... % figtitle, filelabel) % % This functi...
5116317a89ae8d397bf450d0951a973805e009a6efaf989a12aded9ba5ae77c0
MATLAB
3,204
108
function [t,x_new,f_new,g_new,funEvals,H] = ArmijoBacktrack(... x,t,d,f,fr,g,gtd,c1,LS,tolX,debug,doPlot,saveHessianComp,funObj,varargin) % % Backtracking linesearch to satisfy Armijo condition % % Inputs: % x: starting location % t: initial step size % d: descent direction % f: function value at s...
5fd66c6dc3c6246721de82cf39cc7a6d6d31c6de45d14bf94a1890cf2c5e6fc1
MATLAB
3,204
108
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% wrapper_full_calibration.m -- A wrapper for the calibration runtime. %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function []=wrapper_3shell_amr(pat_ix, model, inverse_model) pat_cell = {'110411','117...
2fac03d944e3a08fb005c7f387a46453d33758a1f08712862deb0bd91f9fa542
MATLAB
3,206
74
function testCondaBackendConfig_(obj, labeler) % Test the conda backend obj.testText_ = {sprintf('%s: Testing Conda Configuration...',datestr(now))}; labeler.notifyRetrograde('updateBackendTestText'); % Check if Windows box. Conda backend is not supported on Windows. obj.testText_{end+1,1} = ''; label...
1341d9778f81477c15f9ba4b3262634ca62e4b4046b33ee899c98d96ecbef668
MATLAB
3,207
98
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % preferences file for crabsort % crabsort has many preferences, and, instead of wasting time buil...
6b26cd05ded3ea815a44428d441acad43b40c7260a0ebc77082540d703977ed0
MATLAB
3,208
91
%% (predictSDO) anova % For use within the SDO Analysis Toolkit. % Stand-alone header for testing the stats within the errorStruct; % Take observed prediction errors, paired-point bootstrap to produce % distributions w/ confidence intervals, and evaluate differences in a % chosen test statistic (sum, mean, media...
79cbc65dd211339de89f870eaf71e415981097ecccf1f4e479aec4d58fbc39e3
MATLAB
3,208
94
function [stats,st] = lme_mass_fit_vw(X,Zcols,Y,ni,maskvtx,fname,prs,e,Xrows) % [stats,st] = lme_mass_fit_vw(X,Zcols,Y,ni,maskvtx,fname,prs,e,Xrows) % % Vertex/voxel-wise linear mixed-effects estimation. % % Input % X: Ordered (according to time for each subject) design matrix (nmxp, nm % total # of maps, p # of fixe...
e0920d54762cf89d1c75b1cc1b16be940a69972f4debd678eb3b22f349731d10
MATLAB
3,208
114
function [mask] = image_stack_adjust(stack, name, volume_filtering) % TODO: optimize %load parameters parameters; times_smaller_to_take =5; Nz = length(stack(1,1,:)); for ii=1:Nz images{ii} = stack(:,:,ii); end clear stack; max3 = @(x) max(max(max(x))); %% -------------------------...
f3add730eb80168d19bd27a58767fea4b79886343cc0df5a5893ad2e4ed21fd6
MATLAB
3,208
83
%% parameters setting % clear; hemi={'lh';'rh'}; hm=2; surf_tpe='sphere';% or surf_tpe='inflated'; % surf_tpe='inflated'; ssname='litong_xyf'; plotdata = COR_for_plot{1}; load COR_for_plot_new_pearson; sessionix = 2; % data_dir = '/home/xianchige/TL/foolDNN_zc'; hemis = {'lh','rh'}; surfsuffix='orig'; %Non-dense su...
2b76b777b94ea8e84dea8f9db357d566ced8e628444835c59d6820accb324adb
MATLAB
3,209
102
function [D, max_k_val, no_dims] = find_nn_adaptive(X) %FIND_NN Constructs nearest neighbor graph using adaptive nbhd selection % % [D, max_k_val, no_dims] = find_nn_adaptive(X) % % Constructs nearest neighbor graph on the data in dataset X using adaptive % neighborhood selection. In X, rows correspond to the observati...
4b5e5f4eca2536719012d945e2722d8974eaf041db7eae5a49f447e9dca82c58
MATLAB
3,209
90
function process_behavior_folder(basepath,varargin) % process_behavior_folder adds CellExplorer session, event, % and behavior files to folders that only contain behavior (no intan generated digitalin.events. % Dependencies: % SNLab_ephys/preprocessing/behavior % FFMPEG added as enviornmental variable so it...
c0f47aeaa4973bc3021b928ab81d8025b71f74e53e87e95802dccd19a18c30be
MATLAB
3,209
110
clear load('20240207f_00005_analysis.mat', 'Dnum', 'data_compressed','stimuli_start_time','total_trials') load('ROI_cor_20240207f_00005.mat') load('data_20240207f_00005.mat', 'stimulus_info') load('position_info.mat') % figure set(gcf,'color','w'); set(gcf, 'Position', [230,430,350,100]) set(gca, 'box', 'off')...
0c410589122dd7157c857279d999d73ec602fea5ff743bb2c361fe75c4811e51
MATLAB
3,211
83
function loc_list_clusters_data_table_short(data) counter = 0; for i = 1:length(data) data_to = unique(data{i}.area); if length(data_to)>1 counter = counter+1; data_to_send{counter} = data{i}; end end if exist('data_to_send','var') f = waitbar(0,'Extracting Data Table Informati...
1f7396a3b7d40b37510c7e78bbda90bd49cc0cc4ea3836292d9e72b97052a744
MATLAB
3,212
75
function headshape = prepare_mesh_cortexhull(cfg) % PREPARE_MESH_CORTEXHULL creates a mesh representing the cortex hull, i.e. the % smoothed envelope around the pial surface created by FreeSurfer. % % This function relies on FreeSurfer's command line functions and % 'make_outer_surface' in the FreeSurfer/matlab folder...
5fe94a17af3a8ff37f7b948c9bb51be2b665d73558bfb3b43b4823466d5a6c18
MATLAB
3,212
72
function [IDX,M] = meanShift(X, radius, rate, maxIter, minCsize, blur ) % meanShift clustering algorithm. % % Based on code from Sameer Agarwal <sagarwal-at-cs.ucsd.edu>. % For a broad discussion see: % Y. Cheng, Mean-shift, mode seeking, and clustering, IEEE Transactions on % Pattern Analysis and Machine Intelligence,...
61d468bce46f5a2c17059db6c602c01fb8ff5b7bee95591c6b88b7179af8f4ca
MATLAB
3,212
100
% load data % contact Lead Author for data %% run-consistency in AUDIO vs VISUAL % panel 5N figure; hold on useR = 3; % ao iidx = [34 48 68 116]; xidx = 1; xx = cat(1, cueConsistencies{useR,:}); xx = xx(:, iidx); bar(xidx, nanmean(xx, 'all'), 'm', 'FaceAlpha', 0.5); errorbar(xidx, nanmean(xx, 'a...
e094ea8475de6a08ee255f6455589bbfe27d71718a4da025a6ef8598e2352c38
MATLAB
3,212
83
function out=rate_remapping_ONE_TRACK(folders) if isempty(folders) a=pwd; folders={a}; cd .. end cd(folders{1}); data=compare_replay_across_tracks; for epoch=1:size(data,1) for track=1:size(data,2) out(epoch,track).experiment=[]; out(epoch,track).place_fields_BAYESIAN=[]; ou...
4bbcb75e35a395fcb7b405eb73ede90cd86a601b7c9c77e3399c22c708134ad0
MATLAB
3,214
105
function [ newevent, error ] = wlProc_fitAmpGrid(hilmag, oldevent, gsteps) % function [ newevent, error ] = wlProc_fitAmpGrid(hilmag, oldevent, gsteps) % % This function estimates oscillatory burst amplitude by curve fitting a % logarithmic or linear ramp in the region of interest. Roll-on and roll-off % are chosen vi...
c5667308d1ec4ff434e9ed3a1968f447150c19d9e12fe13121efb8c31501d77d
MATLAB
3,216
87
function result = genContainerMountPathBsubDocker_(obj, tracker, cmdtype, jobinfo) % Return a list of paths that will need to be mounted inside the % Apptainer/Docker container. Returned paths are wsl-locale MetaPaths. assert(obj.type==DLBackEnd.Bsub || obj.type==DLBackEnd.Docker); aptRootAsChar = APT.Root...
0c3e051f27219add8caa2523a7f28695f5b9ce758078fe38265281d99facbdb8
MATLAB
3,217
72
function shuffled_track = ground_truth_parallel_shuffles(shuffle_choice,analysis_type,num_shuffles,decoded_replay_events,place_fields_BAYESIAN,BAYSESIAN_NORMALIZED_ACROSS_TRACKS) %runs run_shuffles on multiple cores in parallel % shuffle_choice- determines what type of shuffles will be performed, entered as a string %...
3af9a319e3652ddf0c6220f2dd521298422ce95d1cd672d3e68f5da372b47f63
MATLAB
3,217
95
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % To remove the duplicates (MUs that share most of their discharge times, % the threshold is defined in the script main.m) % Input: % PulseT = Pulse train of each MU % distime = discharge times of the motor units % distime2 = di...
75ecdeedc26b12d0891360a0076960fc8819096a5274f8c0f077f301ff4618e3
MATLAB
3,218
93
function F = VBA_spm_Ncdf(x,u,v) % Cumulative Distribution Function (CDF) for univariate Normal distributions % FORMAT F = spm_Ncdf(x,u,v) % % x - ordinates % u - mean [Defaults to 0] % v - variance (v>0) [Defaults to 1] % F - pdf of N(u,v) at x (Lower tail probability) %________________________________...
0a62b9c707c76b044d585124ae2755fc01fe8c87f933fc01750343c7a01a8a32
MATLAB
3,220
122
function [Iphi,SigmaPhi,deltaMuPhi,suffStat] = VBA_Iphi_binomial(phi,y,posterior,suffStat,dim,u,options) % Gauss-Newton update of the observation parameters, for binomial data if options.DisplayWin % Display progress if isequal(options.g_fname,@VBA_odeLim) STR = 'VB Gauss-Newton on observation/evolution p...
4768344ab04b5db01a23cfd2aa010ee720b0a7021e91f795b458ddf33a931b10
MATLAB
3,220
111
function img = getframe_invisible(img,sz,GRAYBORDER) if nargin < 1, img = get(0,'currentfigure'); if isempty(img), error('No window open'); end end issize = nargin == 2 && ~isempty(sz); if ~ishandle(img) error('Input is not a handle'); end if nargin < 3, GRAYBORDER = 204; end inputType = getInputType(...
9e8ebb58a443076df58de21a316e61e824ebb95d68c465e8d5ee1f4f61345867
MATLAB
3,220
155
%load data: contact lead author %% aoCellIdx=aoRewardIdx; vsCellIdx=vsRewardIdx; i=find(nRuns(:,1)>1); %% rbr consistencies rbrConsistenciesUse=rbrConsistencies(i); ddAO = cat(1, rbrConsistenciesUse{:}); % ddAO=ddAO(iUse); ddAO = ddAO(aoCellIdx); ddVS = cat(1, rbrConsistenciesUse{:}); % ddVS=ddVS(iUs...
1f01bcecb5fa672231312722d5f8c5071644c843c0e16157bfb8ccba0c2f519c
MATLAB
3,221
73
function d = meshsegtrintersection(orig0, dir0, dist0, P0, t0) % This function checks whether or not a segment characterized by orig0, % dir0, dist0 intersects a manifold mesh P0, t0. % Inputs: % orig0 - Origin of the segment (1 x 3) % dir0 - Normalized direction of the segment from origin (1 x 3) % di...
3406d356fc095a8a92dedc7f361021fcc89739e33892614f32d3ddb633c62351
MATLAB
3,222
96
%% NeVRo HEP preprocessing pipeline % % Runs the full preprocessing pipeline over all data sets by calling the % single helper functions. It does this in seperate iterations for (a) the % movement ("mov") vs. the non-movement ("nomov") condition as well as % (b) either including ("SBA" := Space Coaster + Break + And...
2b500dabef30dda59d852fd2cb0341d5443462d6c743d72cd9cfa8518f01649e
MATLAB
3,223
93
function result = interpSurfTriLinear(inputGrids, stack) % interpolate 3D data set over gridded 2D inputs % % interpSurfTriLinear(inputgrids, stack) % % inputGrids is cell array of 2D grids {X,Y,Z} % stack is a 3D numeric array %----------------------------------------------------------...
370ad3f780430fc184ab6db8cdec5e67afa09e36af118062849f6dc95e51b317
MATLAB
3,223
59
clear all %% %Identify optimal SNR Efficiency as function of b-value %% %Define Parameters [optScanner,optSample,optSSFP,optSE] = ParameterOptionsSNROscillating(); %% %Define b-value associated with single Gradient instance (ms/um2) - Used to calculate relative effective b-value with DW-SSFP only bOsc=1; %% %Define T1 ...
ae9c2171659172f406f02012de23721ae7b1960a984e7adfa66a6f884b49d41f
MATLAB
3,223
166
%% Kmeans Model Selection in 1D % Uses netlab since haven't had time to switch over to pmtk %% % This file is from pmtk3.googlecode.com clear all setSeed(0); mix = gmm(1, 3, 'spherical'); mix.centres = [-1 0 1]'; mix.covars = [0.1 0.1 0.1]; %e = 1e-2; e2 = e/2; %mix.priors = [0.5-e2, 0.5-e2, e]; bins = -2:0.1:2; n ...
ee1948788ef13d8e0958caf51dd4f32b81e9280710356cfe53fd7922f20ef42b
MATLAB
3,223
72
function shuffled_track = global_remapped_parallel_shuffles(shuffle_choice,analysis_type,num_shuffles,decoded_replay_events,place_fields_BAYESIAN,BAYSESIAN_NORMALIZED_ACROSS_TRACKS) %runs run_shuffles on multiple cores in parallel % shuffle_choice- determines what type of shuffles will be performed, entered as a strin...
221342737dd5ccc05cf1061c6451f046bed9200b74964429d88a59aab3ec07b1
MATLAB
3,224
87
function x=irfft(y,n,d) %IRFFT Inverse fft of a conjugate symmetric spectrum X=(Y,N,D) % % Inputs: Y(M) The first half of a complex spectrum % N The number of output points to generate (default: 2M-2) % D The dimension along which to perorm the transform % (default: fir...
a8501e8c34119a4475452ccc59c0a3dd2d7f579004a97841cdc5423010f3a23a
MATLAB
3,224
59
clear all %% %Identify optimal SNR Efficiency as function of b-value %% %Define Parameters [optScanner,optSample,optSSFP,optSE] = ParameterOptionsSNROscillating(); %% %Define b-value associated with single Gradient instance (ms/um2) - Used to calculate relative effective b-value with DW-SSFP only bOsc=1; %% %Define T1 ...
f04559d6bfbaaa9260d90d5cce6832b1286cb7d6097b92dfa005f9b0b2b60110
MATLAB
3,225
91
function figHandle = nXnSequenceRaster(network_spike_sequences, plotIDs, spikes_V_m, parameters, network, varargin) % Plots plotIDs' sequences from network_spike_sequences(ithTrial).spike_ranks % sorted against each of the other plotIDs sequences in an nToPlot by nToPlot % grid of subplots % % network_spike_sequences: ...
0521389e1f6b12b91856da14c42a38b5a2183283f0b8ad53e596ec63c6380cbe
MATLAB
3,226
98
function CBIG_ABCD_proc_task_qc(id,proc_dir,bbr_thr,maxFD_thr,length_thr,FD_th,DV_th) % % CBIG_ABCD_proc_task_qc(id,proc_dir,bbr_thr,maxFD_thr,length_thr,FD_th,DV_th) % % This function reads some qc measures and then remove runs that failed qc from the bold list % % Inputs: % % - id: % subject id % % - proc_dir...
a375679c71b8fe096229f80870dd266a11ed2463453b924a79bd91be85307f7c
MATLAB
3,228
95
function filelist = depfunFast(fn,recursive) % Variation on the built-in depfun function, which skips toolbox files % % filelist = mydepfun(fn) % filelist = mydepfun(fn,recursive) % % Returns a list of files which are required by the specified % function, omitting any which are inside $matlabroot/toolbox. % % "fn" is ...
f253ad6b21b9af292848726a653ca20cb5f35a16865d874a083624379d1ccad1
MATLAB
3,228
99
function [hdr] = ft_fetch_header(data) % FT_FETCH_HEADER mimics the behavior of FT_READ_HEADER, but for a FieldTrip % raw data structure instead of a file on disk. % % Use as % hdr = ft_fetch_header(data) % % See also FT_READ_HEADER, FT_FETCH_DATA, FT_FETCH_EVENT % Copyright (C) 2008, Esther Meeuwissen % % This fil...
756b7abd0ee8dfc0a2406204e17be60e05b228aa1038fd78a2401553263b8111
MATLAB
3,229
115
K = 50; D = 2; T = 100; dampen = .25; sigmareal = .1; sigmaobs = .0; appearancemu = .9; appearancesig = .2; badappearancemu = .1; badappearancesig = .2; poslambda = .1; misscost = (appearancemu+badappearancemu)/2 + sigmareal*poslambda; pmiss = .3; Xreal = nan(D,T); noise = randn([D,T])*sigmareal; Xreal(:,1) = noise(:...
b75ed7db5c0c5b8172f3b1855400cc2d211510547c0073a6829981eb6c82786f
MATLAB
3,230
89
function [ ] = run_physIO(phys_file, fmri_file, sf, save_dir, per_slice, overwrite) % Runs TAPAS PhysIO RETROICOR/HRV/RVT estimation % load sf from json and tr/n_slices/n_vols from nii % assumes that the following "package" is installed: % https://nl.mathworks.com/matlabcentral/fileexchange/8797-tools-for-nifti-and-a...
4644f6f50c756a939421db3e4240f7c683f5fd71167d484de596e072c0175b86
MATLAB
3,231
115
% Author: Birgit Nierula % nierula@cbs.mpg.de function figure_spinal_isopotentialplot(dat, subjects, condition, srmr_nr, is_au) % get info [cond_info] = get_conditionInfo(condition, srmr_nr); cond_name = cond_info.cond_name; [~, esg_chans, ~] = get_channels(15, false, false, srmr_nr); %% merge data all_chanvalues ...
b58e227324df854fe67ef2537a2d155fee2999e533489cde32e53ee3cb02aa05
MATLAB
3,231
117
function [in] = selectpoints(POL, ObsPoints, Pof, Eof, Plane) % Select indexes "in" of ObsPoints within multiple tissue(s) cross-sections % defined by vector POL % SNM 2024 if isempty(POL) % nothing selected Points = ObsPoints; return; end %% Initialize Points = []; %% ...
1eab4da634fff1016f00cea8457e6e5003292bfeabc04c7e00d54d639a4286c9
MATLAB
3,232
100
function varargout = motion_c3d(filename, hdr, begsample, endsample, chanindx) % MOTION_C3D reads motion tracking data from a C3D file, see https://www.c3d.org % % Use as % hdr = motion_c3d(filename); % dat = motion_c3d(filename, hdr, begsample, endsample, chanindx); % evt = motion_c3d(filename, hdr); % % See al...
e6ff5af25047172f047a65721c7adaa81be8be40f9dc6746ae2677466741ec7d
MATLAB
3,232
64
% BoutonArray is a structure: BoutonArray(BotuonNumber).Field with fields % .ImageArea, .ImageDeltaGFP, etc. The function will add fields .DeltaX and .DeltaY % BeforeGFPImageArray(y-coord, x-coord, ImageNumber) function BoutonArray = ArrayReg(BoutonArray, BeforeGFPImageArray, MaxShift, MinCorrValue, Jitters); ...
069776ed61226bc7d0422737459961b9dbd84dd2a2b4e7832c73dba1d0293954
MATLAB
3,234
104
function [data_compressed, TP_count_compressed, TP_count_original, photodiode_count_compressed, stimuli_start_time, stim_time_method] = compress_data_file_v4(dataset_name, photodiode_threshold, total_trials, Dnum) load(['data_' dataset_name '.mat']) timepoint = length(data(1,:)); data_compressed = zeros(Dnum, timepoin...
0abb0c890fabd07fdb4936744f4f3d174b7830c5f0fb2536c018a4f9d6599bc8
MATLAB
3,234
113
function p = myredbluecmap(m,varargin) %MYREDBLUECMAP creates a red and green colormap. % % MYREDBLUECMAP(M) returns an M-by-3 matrix containing a red and green % colormap. Low values are bright green, values in the center of the map % are black, and high values are red. If M is empty, the length of the % map w...
4db213014bcfd890f02ec6d6db4898d7754c4735c45506f8cb41a56f6b759844
MATLAB
3,234
91
function [fnorm,t,rejratio]=ifestar2(x,t); %IFESTAR2 Instantaneous frequency estimation using AR2 modelisation. % [FNORM,T2,RATIO]=IFESTAR2(X,T) computes an estimate of the % instantaneous frequency of the real signal X at time % instant(s) T. The result FNORM lies between 0.0 and 0.5. This % estimate is based o...
c368e9998513ef6e8a66d74c507b9b1fdf5a096863bba74a5b478a50cbad7363
MATLAB
3,234
130
function [pval] = stata_cluster_3d(cls, stat, nrandom,elec) % Realiza Cluster-Randomization-Analysis en cartas timepo-frecuencia % por electrdo % recomendado primero hacer correci{on cluster por cada electrodo % cls -> custers detectados por corrention.m , en { [cluste1] [cluster2] } % % P Billeke % 9 agosto 2009 % s...
40ee8c23501fa2040190a599f72c33acac1728f9dd4793f24dce7a2474ae73d6
MATLAB
3,235
181
xx = h5read('02_b3_000_000.hdf5','/estimates/F_dff'); load('02_b7_000_001.mat'); b=size(xx) %x1=posTrials02 peak_num = []; Prom = []; SorWh=size(fields(info)) if SorWh(1)==24 x=info.frame; x=x+1; else i=1 end i=1 for l=1:b(2) w=[]; w1=[]; w2=[]; i=1 w=xx(:,l); for n =...
75f5283504b6c1a728ff19c2caea07241e35250c85ec998daad2935b721e1491
MATLAB
3,237
80
function Obj = SOFAconvertBTDEI2SOFA(BTDEI) % OBJ=SOFAconvertBTDEI2SOFA(BTDEI) converts the HRTFs described in BT-DEI % to a SOFA object. % % BTDEI format is used by Michele Geronazzo, University of Padova. % % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences; % Licensed under the E...
c7bf7980056d3158e2d97d62dd3d348186278ead22a3082a6d509bd0a3924538
MATLAB
3,237
106
clear % clc res=2; dur=66; all_trials_loc.glm_dd=nan(dur/res,3495); all_trials_loc.glm_df=nan(dur/res,3495); all_trials_loc.glm_fd=nan(dur/res,3495); all_trials_loc.glm_ff=nan(dur/res,3495); all_trials_loc.glm_time=nan(length(-1:res/100:2),3495); all_trials_loc.glm_context=nan(length(-1:res/100:2),3495); all_trial...
5b86c04adbbcc6305da9207d60cbc63a88e3c2c2cecb84463c0b34574344843e
MATLAB
3,238
102
function [sessionNames,subjectNames,ITPCsubject,ITPCsession] = meg_sessions(expt) % function [sessionNames,subjectNames,ITPCsubject,ITPCsession] = meg_sessions(expt) % % INPUT % expt % experiment name, 'TANoise' or 'TA2' % % OUTPUT % sessionNames % cell array of session names % subjectNames % cell array of subje...
2add4a5becd124f397b254d472780721e6d653eadbe77ba5d5b6280cb8e8a5eb
MATLAB
3,239
99
function [mappedX, mapping] = lpp(X, no_dims, k, sigma, eig_impl) %LPP Perform linearity preserving projection % % [mappedX, mapping] = lpp(X, no_dims, k, sigma, eig_impl) % % Perform the Linearity Preserving Projection on dataset X to reduce it to % dimensionality no_dims. The number of neighbors that is used...
5c0cbe461c82bbf3e98e37cb0ab68612255f6a51e088e5c5bfc672dcbe75d274
MATLAB
3,239
77
function [data_dir, subject_list_file, behavior_csv, HM_file, corr_mat_file, measure_dir, measure_set] ... = CBIG_KRDNN_mics_load_setup(setup_file) % [data_dir, subject_list_file, behavior_csv, FD_txt_file, corr_mat_file, measure_dir, measure_set] ... % = CBIG_KRDNN_mics_load_setup(setup_file) % % This function split...
83e349c595bcc99da891470ba87526b95749d8a1dc6c3e3d455b7afde26e0c52
MATLAB
3,240
115
function PlotCCG(t,ccg,varargin) %PlotCCG - Plot auto/cross-correlograms of point processes. % % USAGE % % PlotCCG(t,ccg) % % t time bins obtained using <a href="matlab:help CCG">CCG</a> % ccg data obtained using <a href="matlab:help CCG">CCG</a> % <options> optional list of p...
ddc839bc74cf377503767cc4b2372db55951d677aab4f77acc49ffd26f592f56
MATLAB
3,240
108
function [U,s,Vt]=compute_svd(M, method, n_components) %%%%%%%%%%%%%%%%%% % Compute svd on centered M % M is d x T %%%%%%%%%%%%%%%%%% if nargin<2, method='vanilla'; end if nargin<3, n_components=100; end if strcmp(method, 'vanilla') [U, s, Vt] = svd(M,'econ'); elseif strcmp(method,'randomized') [U, s, ...
6aa97a397886b6a6b160ad843fdb8a7526c201d7f984c0e5541518cf4a128ed5
MATLAB
3,241
120
function writenodelm_nod_elm(fn,e,p,nodemap,no_of_att,quiet) % writenodelm_nod_elm(fn,e,p,nodemap,no_of_att) % writes nodes and elements to two seperate files with .node and .ele % extension. the format of the files is as follows. % User should not provide any extension in fn. % The format of .nod header is: % <# of po...
7b66cf17a17bb23e5640915fd1f3f3a6f10ec921fef1910af35b8cf635edc187
MATLAB
3,244
85
function [U,mu,vars] = pca( X ) % Principal components analysis (alternative to princomp). % % A simple linear dimensionality reduction technique. Use to create an % orthonormal basis for the points in R^d such that the coordinates of a % vector x in this basis are of decreasing importance. Instead of using all % d bas...
7a0c26ff96767b2c7032e1866ceefbfdf91393e927b2958a2a5f17be09dd69c6
MATLAB
3,245
96
%% general options elec_path = fullfile(patient_path,'dipoles',strcat(patno,'_',model_name,'_', ... dipole_name,'_electrodes.mat')); %% load BEM-FMM Engine addpath(fullfile('../engines/bem_fmm_engine')); %% load data V_skin = Ptot(Indicator==skin_id,strength_ix,sim...
bbc4e8a9a86cb65d776d0585ee3560d10159ea1746f6ce43d609b8acded4f98b
MATLAB
3,246
97
function peaks = houghcirclepeaks(varargin) %HOUGHCIRCLEPEAKS Identify peaks in 3-D accumulator for Hough %transform. % PEAKS = HOUGHCIRCLEPEAKS(H,NUMPEAKS) locates peaks in the Hough % transform matrix, H, generated by the HOUGHCIRCLES % function. NUMPEAKS specifies the maximum number of peaks to % identify. ...
83ba0a57815fc4709a397e0299d51a49b56b21e68625eab23319a568ae4138b1
MATLAB
3,247
91
function headmodel = ft_headmodel_halfspace(mesh, Pc, varargin) % FT_HEADMODEL_HALFSPACE creates an EEG volume conduction model that % is described with an infinite conductive halfspace. You can think % of this as a plane with on one side a infinite mass of conductive % material (e.g. water) and on the other side non-...
2a7b27b05dc0912fd140b8fa6f343c77abc39c25a54205a6e85e0ccb7457fe44
MATLAB
3,249
72
function shuffled_track = randomised_data_parallel_shuffles(shuffle_choice,analysis_type,dataset_type,num_shuffles,decoded_replay_events,place_fields_BAYESIAN,BAYSESIAN_NORMALIZED_ACROSS_TRACKS) %runs run_shuffles on multiple cores in parallel % shuffle_choice- determines what type of shuffles will be performed, enter...
3bb8e3cbee6d4b22a4f57697ca0ccdfb1b1aea730afe98d3b06e1928314078f2
MATLAB
3,250
96
function varargout = text2( varargin ) % Wrapper for text.m that ensures displayed text fits in figure. % % When text is called, Matlab displays the text, but does nothing to ensure % that all of the text fits in the figure. This function, after calling % text, shrinks the axes until the text is fully visible. Note t...
45c7dacccb0282269d09ae8c8e0103462ff22ab216bda0e560ee2c83d4289cd7
MATLAB
3,250
62
function [input] = soundExtract(input, sample_rate, baseline, aftermath, type) for i = 1:length(input.Mouse_Name) substrings = {'sound', 'saline', 'CNO'}; if any(contains(input.Sweep_Type{i}, substrings)) if type == 1 sound = input.Sweep_MembranePotential{i}; ...
64c4ff684b9bf208e3e0bc857a59f67e8644724717b37a08d37b8d43d8e488d7
MATLAB
3,250
115
fid = fopen('~/work/PoseEstimationData/Stephen//bodyAxisTrainingData.csv'); K = textscan(fid,'%s %s %s',inf,'Delimiter','"'); fclose(fid); %% npermovie = 100; cc = jet(5); J = struct; ts = zeros(1,0); pts = zeros(2,2,5,0); expidx = zeros(1,0); vid1files = {}; vid2files = {}; for ndx = 1:numel(K{1}) %% kfile = K{1}{...
87f3110ba69d071f4673cb12eeea301b618e4461aed8919ca4a70e92c1509f33
MATLAB
3,250
84
% Maximum distance within a spherical volume: translation + rotation about % origin. The formula used is equivalent to 2*R*sin(a/2) where a is the % angle of the single rotation equivalent to the original % translation+rotation, and R is the distance from that axis to the % furthest edge of the sphere. For the sphere...
6ea248b21464cc632b23d30b25e49dd53fb15c1be0a9961fb6b81a97353b1031
MATLAB
3,251
84
function ft_preamble(cmd, varargin) % FT_PREAMBLE is a helper function that is included in many of the FieldTrip % functions and which takes care of some general settings and operations at the % begin of the function. % % This ft_preamble m-file is a function, but internally it executes a % number of private scripts i...
58233ad2f9d548392b848b4f1589d2b56ec61d493491933acb1bd0a735d34fd1
MATLAB
3,252
140
%% Demonstrate inference in a 2d grid of a noisy image of an X % Based on % http://www.cs.ubc.ca/~schmidtm/Software/UGM/graphCuts.html % http://www.cs.ubc.ca/~schmidtm/Software/UGM/ICM.html % http://people.cs.ubc.ca/~schmidtm/Software/UGM/MCMC.html % http://www.cs.ubc.ca/~schmidtm/Software/UGM/variational.html % This...
7c766483feb62cb75935cbb60750ef7954e9382c13398a399137d7c1b6b55937
MATLAB
3,253
105
function [nse] = read_neuralynx_nse(filename, begrecord, endrecord) % READ_NEURALYNX_NSE reads a single electrode waveform file % % Use as % [nse] = read_neuralynx_nse(filename) % [nse] = read_neuralynx_nse(filename, begrecord, endrecord) % Copyright (C) 2005-2007, Robert Oostenveld % % This file is part of Field...
c173456dd6241aab664603e9fdc0e18478d747bc5b4b42d69c4f03a456184792
MATLAB
3,253
88
function x=irfft_gpu(y,n,d) %IRFFT Inverse fft of a conjugate symmetric spectrum X=(Y,N,D) % % Inputs: Y(M) The first half of a complex spectrum % N The number of output points to generate (default: 2M-2) % D The dimension along which to perorm the transform % (default:...
8b59889fe09cf8da7168976cd26346ba46e8ef645db74482c65222bae3146c8b
MATLAB
3,254
84
function batch_ripples(data_folder,varargin) % For all session files in Data folder (path to animal folder or csv of basepaths), runs % findRipple algorithm with default paramters. If session has cell_metrics, % will also run eventSpikingThreshold to keep keep ripples that have % increased firing of CA1 units greater t...
bd2495d6496ac93cc43b7de039885f7782e2070fe7afd4af7fb1210b105ef71f
MATLAB
3,255
135
%script test recursive %%%%% quantitative differences: because of the way the level is updated %%%%% (should be analytically equivalent but not numerically). Small %%%%% deiations for 2-ToM (but accumulates) larger for 3-ToM x=zeros(2,101); xtest=x; y1=VBA_random ('Bernoulli', 0.7, 100, 1); inF.player=1; inF.lev=0; Par...
0ff3aa318ceb448dcb406f14b4deabf20cfc63a2a31cc77400cebbd573e0f8ad
MATLAB
3,256
89
% Pairwise interactions on an exponentially graded line, Laplace kernel. % % This is basically the same as MV_LINE but now with points placed on a % dyadically refined grid. The resulting geometry is highly non-uniform and % provides a good test for adaptivity. % % Inputs (defaults are used if not provided or set empty...
2102ba33cd53b6836c94355dd0cfd94f993a7c0a2325c02fd5092393cbc8855b
MATLAB
3,256
103
function Perm_1tp_Figs2(dataOut,IM,B,params) %% Set parameters if ~exist('B','var'),B=1;end Pth=0.05./B; [NNidx,Tidx,TNidx]=IM2idx(IM); Nnets=max(IM.key(:,2)); NetKey=[[1:Nnets]',[1:Nnets]']; cMap=[1,1,1;0,0,0]; %% Enrichment a=reshape(dataOut.Chi_pval0,[],1);b=reshape(dataOut.Chi_EWpval,[],1); c=res...
7360bbf732a49b14f596ead7242f059213b22519e96247651425b9a0a222cec4
MATLAB
3,256
103
classdef TrackingVisualizerMTModel < TrackingVisualizerModel % Model layer for TrackingVisualizerMT. % % Holds non-gobject properties extracted from TrackingVisualizerMT: tracking % data, point colors, show/hide flags, cosmetic state, etc. properties lObj % Labeler reference trk % scalar TrkFile, views merg...
94e64df1f7f10aa52d8368c80471e6b2416b394ab6161d3d01e4ee0c2d370b62
MATLAB
3,256
78
function cPPI_without_deconv(stat_path,exp_folder,N,N_ROIs,q_level,ground_truth) % ======================================================================== % Ruslan Masharipov, October, 2023 % email: ruslan.s.masharipov@gmail.com % ======================================================================== tic for subji...
21250c47cae21c5da74781979e7066ff56c7507b008fadfb184f34c567b176bf
MATLAB
3,257
146
%% load the labels file Q = load('/groups/branson/home/bransonk/tracking/code/rcpr/data/MousePaw/M118_M119_M122_M127_M130_M173_M174_M147_M194_20160310.mat'); %% convert to new lbl format with the nrs file locations nmov = numel(Q.expdirs); newnames = cell(nmov,1); lclnames = cell(nmov,1); nlabels = zeros(nmov,1); mo...
4dcabb4fe4c9105787cc5649808d4ea2f1a0a7eed23a6e3c93bc29161dcdd075
MATLAB
3,257
115
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % callback when main window is resized function resize(self,~,~) if ~isfield(self.handles,'main...
96acda763cfe03d48d50ba44af19e559a2cc2863a8fe740180211d1605ce36ee
MATLAB
3,257
80
function Base_batch(FUNCTIONAL_FILE, fs_dir, base_dir, TR, sliceorder, scans_to_remove) %%% COPY TO THE CONN BASE DIRECTORY TO WORK % This base example has as input the fmri scan, the t1 scan, and the TR. % Loads the preprocessing done in the script, denoise, and analyze the RRC, % saving everything to disk % sliceorde...
76a16235fc4560819aa67c38de05132bfcb3cafcb94a533a9b1b17bf0e2f0149
MATLAB
3,258
81
function [yRoi, lesioned] = afxRoiTimeseries(rois,y,subjectMasks,brainMask,XYZmm,denoisingOptions) fprintf(' ROI timeseries extraction ...') yRoi = nan(size(y,1),length(rois)); lesioned = zeros(length(rois),1); % initialize atlas cache (avoid repeated resampling of atlas file for % multip...
890fe6df97692cd02baa55f7e43ded700a242e19517c22d27ecc96795c9d5151
MATLAB
3,258
94
function f=expandstr(str) %EXPANDSTR Expand indexed strings. % F = EXPANDSTR('PP[RANGE]SS') returns a cell array of strings in the form % 'PP0000nSS', where 'PP' and 'SS' are prefix and suffix substrings, n is % an index lying in the range RANGE, paded with 5 zeros. RANGE is a % vector, that can be in the for...
28f4b4302d4c1c0fd01e79338657d075a0fe3730e5a8398f7d5f510092bf5218
MATLAB
3,261
103
%% getpxTimeEvolution "getPxTE" % Utility to generate a feedforward prediction of Px over N_STEPS using an initial %probability distribution and a linear (L) update operator (SDO) under the % framework px1 = x0 + dx(0), where dx0 is calculated by an update matrix. % % Permits the time evolution of multiple Ls in paral...
f7bd6f4e4ba5d2583bd7da7f5d63b0430074a4a6efa363746ef0154ccacc6fa5
MATLAB
3,261
77
function CBIG_RF_compute_vol2surf_avgMapping(sub_list, input_dir, input_prefix, output_dir, output_prefix) % CBIG_RF_compute_vol2surf_avgMapping(sub_list, input_dir, input_prefix, output_dir, output_prefix) % % This function computes volume-to-surface avgerage mapping of x/y/z index % across a given list of subjects. ...
8d4c9abc8223d5bc8586680ff85ba04eb2efdb1cb93ebdf59dc0bda5e7bb0fac
MATLAB
3,262
105
% This code loads Results and looks at the peak of spikes and determines % IZ from spike imaging results % Abbas Sohrabpour % 13/8/2018 clear all;close all;clc bad_chan = []; cd('../Grid Location and Defined Parameters') load('UnconstCentLFD.mat') [~, Num_Dip] = size(K); K([bad_chan],:) ...
afc2e07d309a856b7285338f2b86d45878843ad1efdc3a3102bb1a58abb8cd9f
MATLAB
3,262
102
% common plotter for the spike-triggered % Only for use with the newer components of the parameter validation. %Breakout from existing functions; %Here, we passively pass most of the parameters, and hence this is not an %ideal component for the end user; better to call only from the core method % stapxt == A [ N...
d59a30407e1be5721c55dc5d79707f824743f0450333e247e9bc7e0b0a320b83
MATLAB
3,262
134
clear; clc; % close all; %% hist_data = []; n_subjects = 8; load ach_data_final.mat load x_ecog_rt_data.mat; srate = 400; %% all_rt_data = []; for isub = 1:n_subjects % subjects = [06 08 10 12 14 15]; load(['s' num2str(isub) '_cho_method_allperiod_v1.mat']); r...
5abb99bac33433f501c4c19420232339bcc927280699ef27fb7d4e0963791a99
MATLAB
3,265
112
function [trx,savename,timestamps] = cleanup_ctrax_data(matname,moviename,in,ds,varargin) if ~exist('ds','var') ds = ''; end [savename,dosave,annname] = myparse(varargin,... 'savename',strrep(matname,'.mat',['trx',ds,'.mat']),... 'dosave',false,... 'annname',''); if ~dosave, savename = -1; end in.x_pos = in...
7afa05d4b3f81e3464612909c6cf5d260e90f40efe859e6ac64abc1d62dd2f8e
MATLAB
3,265
104
% plot_trialAvg_decision_allSess % new version of plot_bigSbigT_multipleS_trialAvg_decision_normS pSL = colms - plot_resp_aligned; for d = 1 : length(plotSig) dim = plotSig{d}; i = i + 1; assignSignal if sub0 == 1; ylims = ylims - diff(ylims)/2; end % Average traces aligned ...