sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9c399dd69acd2d38df96724c1bcbe67ebb858501cee31899968614bedad7dfd6
MATLAB
2,734
88
function GMMTrack2DTo3D(fmoviefile,smoviefile,kinelistfile,outdir,redo) %% Constructs smoothed 3D construction for videos listed in file addpath /groups/branson/home/bransonk/behavioranalysis/code/Jdetect/Jdetect/filehandling; addpath /groups/branson/home/bransonk/behavioranalysis/code/Jdetect/Jdetect/misc; addpath ...
c10118b3528524aa18282ca11ac355667cc712cff6d85e866b0d38c44ff5661e
MATLAB
2,734
102
function [model, loglikHist] = binaryFAfit(Y, K, varargin) %% Fit factor analysis for binary data (using EM) % % % Inputs % % Y - Y(n,t) in {0,1} or {1,2} % K - num latent dims % % If you don't request loglikHist, we don't compute % loglik, which is quite slow (35% of the time!) % This file is from pmtk3.google...
3d8c6d9c2fd843de33359066548dadc4625c4176cd8956022555cef2037c5729
MATLAB
2,735
80
%_______________________________________________________________________ % % Allow the experimenter to advance or exit the presentation %_______________________________________________________________________ % % In testing or development mode the presentation can be advanced by % pressing expInfo.keyReturn and exited ...
4f1b3ff2535594464efb0eaba23605c8f23ac4744ebc9ad973d8d94e98fffb97
MATLAB
2,735
86
% Author: Birgit Nierula (May, 2020) % nierula@cbs.mpg.de function [out] = prepro_defineInterpolWindow(subject, srmr_nr, bids_dir) %% loop 1: downsample for ica and channel inspection (make plots for all subjects and conditions) % set variables subject_id = sprintf('sub-%03i', subject); if srmr_nr == 1 raw_path ...
0c237a9b59e27a8fc34203208b15bf781bea9120ae663f1d70aebc4042c80918
MATLAB
2,736
93
function data = analyze_AB_abundance(params,roi,AB_chs) %calculates correlation and volume overlap between different AB channels folder = params.parentfolder; %Extract parameters xystep = params.xystep; zstep = params.zstep; nchannels = length(AB_chs); for im1 = 1:nchannels %nested loops because we are looking at co...
46d1b9e857a5e3f933c7f460e20039fe8b6724d39c341777495a1ef5836f97af
MATLAB
2,736
105
% % Used to calculate the sum-squared error between each shuffle and the mean % of the shuffles, vs. the spike-triggered unit and the mean of the % shuffles. Signfificance is provided as the relative magnitude of the test % statistic vs. the PVal % % Copyright (C) 2023 Trevor S. Smith % Drexel University College of Me...
69ad058e7ba743ba921fcd525d6cf77197240ef830bab58ddd67c817c71906fd
MATLAB
2,738
52
function isargstruct(varargin) %ISARGSTRUCT tests if the given arg is a struct and returns an error otherwise % % Usage: isargstruct(arg1,arg2,...) % % Input options: % args - list of args % % ISARGSTRUCT(args) tests if all given args are a struct and returns % an error otherwise. % % see also: i...
86cbf2639a170862608e034dac94194edbc24858d0e7c30738ee6122a7d2c05d
MATLAB
2,738
79
function HMM = fit_HMM_cv(datadir, kerneldir, hmmdir, HMM_name, leaveout_foldN, iterN, k) % HMM = fit_HMM_cv(datadir, kerneldir, hmmdir, HMM_name, leaveout_foldN, iterN, k) % % fit a group-level HMM to the HCP resting state fMRI data. % This uses a Gaussian observation model, either using the mean or pinning % it to 0 ...
17498f124e165df9061a76e5718f0bb1ddf141a2debe803a7c13726f116f51c7
MATLAB
2,739
71
function order = bestFirstElimOrder(G, node_sizes, stage) % Greedily search for an optimal elimination order. % % Find an order in which to eliminate nodes from the graph in such a way as % to try and minimize the weight of the resulting triangulated graph. The % weight of a graph is the sum of the weights of each of ...
40931622e8696a8eecec1ac62d2fe278d5acdafe61ce31058d131d15fcceb9f9
MATLAB
2,739
81
function [missing, pg] = pmlMissingCodeReport(bookSource, includeCodeSol, destFile) % Display an html table of files referenced in PML but not in PMTK % This file is from pmtk3.googlecode.com %% Input % % bookSource - path to the PML latex source containing e.g. pml.tex % (default = C:\kmurphy\...
ca45ed9f23731e58c0c3c4e602a4c63ed1eb9dc81f45a15967b9378331167e3e
MATLAB
2,739
105
function islight = plotPercentileCircles(im,prcs,labels,prc_vals,hpar,txtOffset,ntotal,fp,fn,isma) if nargin<5 hpar = figure; end if nargin<6 txtOffset = 5; end if nargin<7, ntotal = []; end nviews = size(prcs,3); if numel(hpar) == 1 && strcmpi(hpar.Type,'figure'), hfig = hpar; clf(hfig); hax = createsub...
de305f385d28f1f7b80344aa40e4f279656bb65c471874853ee2c0d65b0af78b
MATLAB
2,739
109
function wlPlot_plotDetectCurves(cfg, tuneseries, tunelabel, ... dataseries, figtitle, filelabel) % function wlPlot_plotDetectCurves(cfg, tuneseries, tunelabel, ... % dataseries, figtitle, filelabel) % % This function plots one or more accuracy-vs-tuning-parameter curves. % % "cfg" contains figure configuration in...
56b81d7deb3e304fab631f43f30ab2a90f1603d20b5ba9f5ac8dff11fde666e7
MATLAB
2,741
82
function [hillCoeff ec50]=doseResponse(dose,response) % DOSERESPONSE Computes the Hill Coefficient and EC50 of a % dose/response relationship given two vectors describing the doses and % responses. A semilog graph is plotted illustrating the relationship, upon % which the man and standard error of the response to ...
6b79b41ac578e726962b108495fa5feaeaa5e56f0cf1287620407fd47802c7ae
MATLAB
2,741
108
function [a,res,c_theo]=lm_start_comp_general(a_in,c,forwpar,type) F=fcnchk(forwpar.method); [n,ndum]=size(a_in); ndip=n/5; if type=='real'; nc=ndip*(ndip+1)/2;nc_R=nc; elseif type=='imag' nc=ndip*(ndip-1)/2;nc_I=nc; elseif type=='comp' nc=ndip^2;nc_R=ndip*(ndip+1)/2;nc_I=ndip*(ndip-1)/2; else error...
67d959a95ac088d598111e67c2cfc2887d7feaec833489b86e2f3d5fcf68fafe
MATLAB
2,742
78
function [posterior, out] = demo_GLM() % // VBA toolbox ////////////////////////////////////////////////////////// % % [posterior, out] = demo_GLM() % Demo of multiple regression (General Linear Model) inference % % The problem is to fit observations with a linear combination % of regressors. Formally, this can be writ...
f5d24c009fc0809c1b6dbed3ae425765fe9f382b3e4d6e2afd08daf52935568d
MATLAB
2,742
73
% Noam Saadon-Grosman % August 2020 % This code creates laterality surface map from the output of "Laterality_computation" %%% input: some files are in BrainVoyager format, for matrices extracted from %%% other formats exclude the xff command. Fill in names and directories % Template BrainVoyager map % Somatosens...
0b443c6df1f867c0589a3c7260c687bf3b6e2ae9957855ef9fe89dbe2a08e306
MATLAB
2,744
69
%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...
143be36919c09d61605f19f74885191c58df02939ab2d9c35fddc583199cfaf5
MATLAB
2,744
79
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef BlockVectorSet < handle %BLOCKVECTORSET is a grouping of data and metadata for a series of data contained within an AxisFile. % this class is composed of 4 major parts: % % ...
5fc1bf82e13d4a5fb3e99ca5834153e214978aa062aa7eb56ebe7ecb0f6eadf9
MATLAB
2,744
74
function ValidFullPath=Check_Dir_and_File(InputFileDir,InputFileName,LengthLim,ForceFix) if ~exist(InputFileDir) mkdir(InputFileDir) end OS=computer; if strcmp(OS,'MACI64') dc='/'; if strcmp(InputFileDir(length(InputFileDir)),dc) FullPath=[InputFileDir,InputFi...
1854b8893d40413f0894d382b02421f1b700b4cbed0567a4c4943fd28b7f389d
MATLAB
2,745
66
function result = determineArgumentsForSpawningJob_(obj, tracker, gpuid, jobinfo, aptRootRemoteAsChar, train_or_track) % Get arguments for a particular (spawning) job to be registered. if isequal(train_or_track,'train'), dmc = jobinfo; containerName = DeepModelChainOnDisk.getCheckSingle(dmc.trainContaine...
2311a9ab4d3ff3b829b1734cdbf4d57304a97cacf591e013e3a333989e291437
MATLAB
2,745
93
function tbl = lblCompileSH(lblList) % tbl = lblCompileSH(lblList) % Compile labeled frame info from a list of lbl files % s = struct(... 'lblCat',cell(0,1),... % int enum for type of label file 'lblFile',cell(0,1),... % 3-level path 'iMov',[],... % movie index within lblFile 'movFile',[],... % [1xnview] movie...
296ae557cfe53fb3b1b48a71a67041e6202e7f9bb73c036e2abbf45fe72a125a
MATLAB
2,746
74
function cpd = tabularCpdCreate(T, varargin) %% Conditional probability density function p(y|x) for use in a DGM % T(a,b,...z) is distribution of z given parent values a, b,... % % A dirichlet prior has the form prod_k theta_k^{alpha_k - 1} % We define cpd.prior(k) = alpha_k - 1 % So setting cpd.prior(k) = 0 will give ...
a22073a92aeb8cbf1e022338291238e8af28e4714b660a084d4fa1fa01ebfe00
MATLAB
2,746
99
function [yy,map] = oneOfK(y, K) % Convert class labels to a one of K encoding % (see also dummyEncoding) % The class labels are first converted to 1:K. The number of class labels % is automatically infered. If K is explicitly specified, the class support % is forced to be contiguous. The output map stores the unique ...
1c0e98ec6c2aebf3eb0c8e2c977239362bde15e11dbed5bd7dce651740d00b1c
MATLAB
2,747
45
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
44e3bd74b243403e7bd877c50d0bfde055ad7938f8620faf9e4ae80152b5c1dc
MATLAB
2,747
75
function C = multiTimes( A, B, type ) % Matrix multiply each submatrix of two 3D arrays without looping. % % type controls the matrix multiplication to perform (for each i): % 1 - C(:,:,i) = A(:,:,i)*B(:,:) % 1.1 - C(i,:,:) = A(:,:,i)*B(:,:) % 1.2 - C(:,:,i) = A(:,:)*B(:,:,i) % 2 - C(:,:,i) = A(:,:,i)*B(:,:...
af84999ff39a482b8b6d578400407a94673146e66e0b609d92b81d379868b1f7
MATLAB
2,747
78
%% Minfunc Kernelized Logreg Demo % PMTKauthor Mark Schmidt % PMTKmodified Kevin Murphy % PMTKurl http://people.cs.ubc.ca/~schmidtm/Software/minFunc/minFunc.html#7 % It is modified by replacing penalizedKernelL2_matrix, % which uses sum_c w(:,c)' K w(:,c) as the regularizer, % with the simpler penalizedL2, which uses w...
31f564d4ec77b6705549d8e0959c22e8fbc6d744f2a697378668552baeed908d
MATLAB
2,748
60
function chiSquare = exgauss_chi_square(y,X) % EXGAUSS_CHI_SQUARE Computes the chi-square statistic % % DESCRIPTION % Pearson's chi-squared test provides a measure of goodness-of-fit, based % on the observed and predicted frequencies. The observed response times % are grouped into bins. The edges of these bins are bas...
862abe7a87e45e527fc99f9c9350c761e9ecc226268afc77a145c07efe1fb9d2
MATLAB
2,748
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...
ed7734e26bcb4f6409d170fd06d1b1331302a3b60a010a9bf27e37a9ad64e5f0
MATLAB
2,748
61
function [lpfDV] = getLPFdvars(timeSeries,brainMask,TR) %If it is a cifti, then it will give a time x greyordinates matrix. %Otherwise, this will do nothing to a 4D (3 space x 1 time) matrix. %Unless, of course, you are feeding in a matrix with a singleton %spatial dimension. if(ndims(timeSeries) ~=...
5ee3436c2c4c20cde27928c8720ec1c676880997f54aacd0a6f22db587fd996c
MATLAB
2,749
78
function [e p] = image2mesh_cgal(fn,param,outfn) % Tries to read stack of 2D images (with file name 'fn') and create a % tetrahedral mesh using CGAL library. It returns the mesh in 'e' and 'p', % tetrahedral elements and node coordinates. % % param.pad : add padding to 4 sides of each 2D image % param.medfilter : appl...
b26b54e1ce215dcc9619afde9270e382efb410198b4c3b92c9e7887a90124d76
MATLAB
2,749
101
function KS2Wrapper(basepath) %Kilosort 2 wrapper for neuroscope users. It extract informations from your %.xml to perform spike sorting. % %Eliezyer de Oliveira 02/03/2020 %% some flags for the script neurosuite_files = 0; %% you need to change most of the paths in this block if nargin<1 basepath = pwd; end %...
33f6c2a3d9b2860a6518ff00b6f01702d444dc14c6e573c23718af9b6c91211d
MATLAB
2,750
88
function stabilityvals = CBIG_determineK_single(x,res) % stabilityvals = CBIG_determineK_single(x,res) % % Compute stability of parcellation computed from re-sampled data. The % stability is defined by the cost of Hungarian matching between two label % assignments. The first label assignment is computing the probabili...
53fcbda788ec9d52441cf090d2e0d1ac45ccca89e96698cb443927e5d8e9fb5b
MATLAB
2,750
106
%% plot SpikeWaveforms % Generic Method to plot the spikeWaves from the 'SpikeTimeCell' % % --> Also called as a method for ppDataCell % --> Future stability upgrades will be needed. % Copyright (C) 2023 Trevor S. Smith % Drexel University College of Medicine % % This program is free software: you can redistribute i...
8415cd2819b8bfd4c401ff8877c5592ff81a454b84344e4e75bfd9d985eca809
MATLAB
2,750
78
function [model, logev, postSummary] = linregFitBayes(X, y, varargin) % Bayesian inference for a linear regression model % The model is p(y|x) = N(y | w'*[1 x], (1/beta)) % so beta is the precision of the measurement noise % % INPUTS: % prior: one of these %- 'uninf' means use Jeffrey's prior on w and beta %- 'vb' mea...
8466fb25a4df5062741e4e329f8b7802927f52c3603a649bfd2a115cef4473a6
MATLAB
2,750
52
function isargfile(varargin) %ISARGFILE tests if the given arg is a file and returns an error otherwise % % Usage: isargfile(arg1,arg2,...) % % Input options: % args - list of args % % ISARGFILE(args) tests if all given args are a file and returns % an error otherwise. % % see also: isargdir %**...
cd34811c689e949383b4109996fea8b4ba2e2dffa2fb64b64528dbb8ea5e01f7
MATLAB
2,750
101
%% clear workspace close all; clear all; clc; %% load tf data addpath C:\code\spm12 spm('defaults','eeg') addpath('C:\Code\fieldtrip-20210302') addpath('C:\Code\wjn_toolbox') % ft_defaults %Dt=spm_eeg_load('data/iEEG/tf_spm_ecog.mat'); % modfied path Dt=spm_eeg_load('D:\ECoG_Atlas\iEEG\iEEG\tf_spm_ecog.mat') %% set ...
f38fcc51d59bff06ffb62446c4606becacdbda6bc7f9c6bdd917687da670f5ef
MATLAB
2,750
114
function [omckk,Tckk,Rckk,JJ] = compute_extrinsic_refine_fisheye(omc_init,Tc_init,x_kk,X_kk,fc,cc,kc,alpha_c,MaxIter,thresh_cond) %compute_extrinsic % %[omckk,Tckk,Rckk] = compute_extrinsic_refine_fisheye(omc_init,x_kk,X_kk,fc,cc,kc,alpha_c,MaxIter) % %Computes the extrinsic parameters attached to a 3D structure X_kk ...
0b4df2235a9eac82255d6cdc02e805141664bb0adf0bb393f7e97cc5e042d3e1
MATLAB
2,751
101
function [theta,phi] = get_HRFparams(TR,microDT,lin,verbose) % get Ballon model parameters from canonical SPM HRF % function [theta,phi] = get_HRFparams(TR,microDT,lin,verbose) % IN: % - TR: the data sampling (in sec) % - microDT: the micro-time resolution (in sec) % - lin: a flag for the linearized version of ...
26653a79cef7c44ab07b873cc5d2ff5f12235d269f8cafac7692d1e648cb016c
MATLAB
2,751
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.....
f38b236fac8877ba31493c76c57903022df79f90eca04f8d937aa3651ffc0112
MATLAB
2,751
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.....
247e044a611d8832f0f709f753718060203016904c139d0b99abde986d285ae0
MATLAB
2,752
122
function LAN = vol_thr_lan(LAN,thr,type,tagname,elec) % <*LAN)< % v.1.1 % % Detect voltange variations, in voltages, zscore, or corre % thr : threshold % type: v : voltage % z : voltage (zscore) % c : between-electrode correlation (zscore) % % 17.06.2023 fixed posit...
311f7376e9aac7d3ffa8dc6d93e20baccdb961792415aeba1c221de4c089b928
MATLAB
2,752
88
classdef Grid < handle % Grid is a class used to represent basic information about a grid, % including how @dimension_count, the @points along each axis, its % @shape in terms of number of points per dimension, and its @origin, % i.e. the vector composed of minimums of @points along each dimension. ...
58117b52efaf492d9e31eeabb5c2ff56f63706360cd374282a7c1b7ba5324a9c
MATLAB
2,753
80
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...
caf72c5e965964638d68aeff2a4f3982060ada9f4ce0c8f25fe0668f05dcb87b
MATLAB
2,754
69
function SetFont(typeface, fontsize) % Set typeface and font size for all defaults. % SetFont(typeface [char], fontsize [int]) % SetFont('Arial', 16) % This function can be run as a standalone or called at the beginning of a figure % generation script to ensure that all font elements are consistent...
32c359089cf28cfe2853ed393f0320c967d7e117d6ec134a672b7b0c97c92017
MATLAB
2,755
66
% Fix possible splitting of responses between two consecutive frames % Version 2 - accumulate everything from one frame to the next function ImageArray_NoStim_CorrAmp_norm_2 = FixSplitting2_noProg(ImageArray_NoStim_CorrAmp_norm, ImagesPerSequence) ImageArray_NoStim_CorrAmp_norm_2 = zeros(size(ImageArray_No...
c8348e4d24e9947a63588946791f6eb54f354cab4712a831816e11f889cf7387
MATLAB
2,755
105
%% Sketch of difference between Generative vs Discriminative classifier % %% Class conditional densities % This file is from pmtk3.googlecode.com figure; hold all; domain = 0:0.001:1; f1 = @(x)gaussProb(x,0.7,0.09.^2); %f2 = @(x) 0.4*gaussProb(x,0.2,0.09.^2) + 0.6*gaussProb(x,0.5,0.09.^2); f2 = @(x) 0.6*gaussProb(x...
9bb98ec0b402c3faac53df85e3fb9685a8cf34fd7a34b31ab85880a34449f67b
MATLAB
2,756
96
function visualizeData( X, k, IDX, types, C ) % Project high dim. data unto principal components (PCA) for visualization. % % Optionally IDX can be specified to indicate different classes for the % points; in this case points in different classes are displayed using % different colors. Up to 12 types are handled (for t...
3154eb0670693366f8f3eff8d0167aa316b6b26e1f8395b13a37a5560d7e0420
MATLAB
2,757
73
function [a,res_out,k,field_theo]=dipole_fit(f,fp,ndip,para); % fits an n-dipole model to a given surface potential or magnetic % field at one time-point using the Levenberg-Marquadt method. % % usage: [a,res_out,k,field_theo]=dipole_fit(f,fp,ndip,para); % % input: % f: nx1 vector with n measurements for n-channels...
8b30d0f2530caa9d4b8d987530154b119436530ee5e0f65bca1d2bdbb40a9db6
MATLAB
2,758
108
% theta = choose_orientations(x,y,phi,velocity_angle_weight,[max_velocity_angle_weight=1]) % % we will set the orientation to theta_t = phi_t + s_t * pi % we want to choose s_t to minimize % \sum_t cost(s_t|s_{t-1}) % cost(s_t|s_{t-1}) = [(1 - w(||v_t||^2))*d(\theta_t,\theta_{t-1}) + % w(||v_t||^2)...
64b23a14b64c34de1fe1c8bb481b7d4523ed9044d0dcbe6abfa12f72027fd05d
MATLAB
2,759
75
% Purpose: Convert lh_labels and rh_labels to gifti shape files for later WB % visualization % Inputs: lh_labels and rh_labels from calculate_ai.m and template gifti % files in appropriate resolution. % Outputs: .shape.gii files containing AI values. % % Note: Template .shape.gii files can be created using mris_vol2su...
8bdec2b8b23749c27194b1b2052a1b805eeeca40c85c999fbd3a95fbe0dc1e38
MATLAB
2,759
111
% 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,...
8e22d07d862e75499730e13c474b130a2c758eaa453462254cf7bebfe3829fee
MATLAB
2,762
96
%% Simple Tests of the svmFit interface % PMTKslow % PMTKneedsOptimToolbox quadprog %% First we check that the 3 implementations give the same % results on a simple binary dataset % This file is from pmtk3.googlecode.com requireOptimToolbox loadData('crabs'); model = svmFit(Xtrain, ytrain); yhat = svmPredict(model...
63bcd65fef3dcda52975fe3d4ea3572c288af8a89e941918f3fa69d96c2c5067
MATLAB
2,764
81
% check_events processes digitalin events from intan digitalin.dat. Allows % user to verify number of events and duration of epochs in case of event % errors that may arise during acquisition. % % Load info.rhd for recording parameters [~, ~, ~, ~,~, ~, frequency_parameters,~ ] = ... read_Intan_RHD2000_file_snlab(...
fb8b4ee86c5b3e6ac7c7277ab9b364cac811c9ef8966bdf343ae852959ccc871
MATLAB
2,764
65
function [lh_label, rh_label] = CBIG_project_from_fslr_to_fsaverage(lh_label_fslr, rh_label_fslr, abs_path_to_output_folder) % [lh_label, rh_label] = CBIG_project_from_fslr_to_fsaverage(lh_label_fslr, rh_label_fslr, abs_path_to_output_folder) % % This function projects labels (parcellation labels, activation % patter...
11dd7e815a48b78fe06b7d4c8de89791e2412f4fd3f830ca6ff563b8c2e098e2
MATLAB
2,766
87
% SIMPLSFunction.m % Sarah West % 6/30/22 % SIMPLS Basic SIMPLS. Performs no error checking. Taken from source code % of Matlab built-in function plsregress. function [Xloadings,Yloadings,Xscores,Yscores,Weights] = SIMPLSFunction(X0,Y0,ncomp) [n,dx] = size(X0); dy = size(Y0,2); % Preallocate outputs outClass = supe...
bce6940a1d05f91230ba8ca6a673c0ac1239a3fd46b1970c902215279331dac3
MATLAB
2,768
84
function check_process_summary(paths) %Run to update summary for all folders titled data %paths is a list (>=1) of strings of parent folder paths containing target %"data" folders % %Input (for mac): % paths (str array): ["/Volumes/sn data server 3/laura_berkowitz/app_ps1_ephys",... % "/Volumes/sn data server 3/la...
58ca1b0babee25f8c3d069f742b661daed1ed6420b40bf1b9241116ce3faa7dc
MATLAB
2,769
105
function [zeitgeberTime relativeTime absTime] = bz_getZeitgeberTime(basename,downSampleFactor) % assumes pwd is basepath for now %% get timestamps for recording starts parts = strsplit(basename, '_'); date = parts{end-1}; if strcmp(parts{end},'merge') % if multiple sessions are merged, find the start times of each ...
1d57afcec712e1a72435492ae80963200113548c7a28b4f0e26f3a0cf29c78e9
MATLAB
2,771
110
function showvc_prog_plain(loc,tri,view_dir,para); cmap=1; voxelkont=0; mycolormap='jet'; colorbars=1; if nargin>3 if isfield(para,'cmap') cmap=para.cmap; end if isfield(para,'voxelfield') voxelfield=para.voxelfield; voxelkont=1; end if isfield(para,'mycolormap') mycolormap=para.mycolormap...
21089214d4d8a90981ba23e8a9aed128fae64de48773a7767cba0777161bb104
MATLAB
2,771
98
function coords = sam_unwarp_command(sn3d, img, coordsFile, talUnits) % % coords = sam_unwarp_command(sn3d, img, coordsFile, talUnits) % % [sn3d] is the sn3d.mat warping file % [img] is an unwarped ANALYZE (*.img) file % [coordsFile] is mx3 matrix of mni or tlc coords. m=how many points. % [talUnits]=1 for tlrc, 0 for...
87858a2ad265c2c5460b8f29d9a8526d50550a332304cd676ee47fc8680711bd
MATLAB
2,771
98
function plot_task(res, timing_table, save_path, no_legend, cmap) % PLOT_TASK Plot the Mapper Graph based on task data % % :param res: the results from running Mapper % :type res: Mapper struct % % :param timing_table: describes the task performed as classifying % each TR as a value described in 'task...
ba2cf34348f6a01177538cc2a1d711c3a9dd0d893e8c9d452165a1beb017d7d1
MATLAB
2,771
92
%% Cohen's D Effect Size; Tabular Display; % Use for multi-comp HH testing, evaluate effect sizes; % % Display a UI figure here for ease of interpretation, rather than save to % var-space. (Expectation: We will first have screened for significance, so % this is just a measure of the differences in the means of the e...
ca523a14638ecbbc8e93f5b0cb4cc854d9b610fc93dfd5613b74fec1004f0950
MATLAB
2,771
93
%% Generates the figure 2g %% Requires set: % - fn_timing % - res_path % - mapper_name % - CHANGE_POINTS workspace = getenv('WORKSPACE'); fn_timing = [workspace, 'data/cme/timing.csv']; res_path = [workspace, 'results/cme/ch10_mappers_cmev3_disp.json']; mapper_name='BDLMapper_12_30_60'; CHANGE_POINTS = 10; % Get the ...
8fac8db0da5a416a9bb67b6f303b30c5f31356dc30a40062369c907ecbca0c0c
MATLAB
2,772
80
function [ehat,v_e,etahat,v_eta] = VBA_getNoise(posterior,out) % returns the Laplace approximation to the innovations posterior density % function [ehat,v_e,etahat,v_eta] = VBA_getNoise(posterior) % This may be useful if one is interested in recovering, e.g., the state % noise that enters and perturbs the system. In pa...
c93adce6c4cbafd69cd943ece4fde25f05261af3a8ee728b44ffb07775f3541b
MATLAB
2,772
115
function cl = iimg_stouffer(Pimg,maskname,thr,clsize,outname) % This function performs combination of p-values across images using the % Stouffer method (see refs below). % % :Usage: % :: % % function cl = iimg_stouffer(Pimg,maskname,thr,clsize,outname) % % :Inputs: % % **Pimg:** % string mtx of p-value...
d8cff40a0f984eb6350f43c2797afec5d63f7b934151285d3878e7085add48a6
MATLAB
2,772
88
function [isvalid msg] = verify_tracks(filename,targettype) % function [isvalid msg] = verify_tracks(filename,targettype) % Check integrity of tracks file (see published doc as a guide). % % filename: full path to trx file % targettype: JLabelData targetType % % isvalid: true if trx file passes all checks, false other...
e9374be3ec8e52e49ccd87697a93f82b15eac550481dd3cc8012395ce7a28e16
MATLAB
2,772
109
function hout=suptitle_mod(str) %SUPTITLE puts a title above all subplots. % % SUPTITLE('text') adds text to the top of the figure % above all subplots (a "super title"). Use this function % after all subplot commands. % % SUPTITLE is a helper function for yeastdemo. % Copyright 2003-2014 The MathWorks, Inc. % W...
8600c484b011bcad5ebab188cd674f529cb9b50d44cfc0abaf1b8592bdfd014b
MATLAB
2,773
95
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef CRC32 < handle %CRC32 Class for calculating CRC32s % For Quick Reference, see http://en.wikipedia.org/wiki/Cyclic_redundancy_check % CRC32 implementation adapted from: http://da...
07c94c2bcbb0d7d81c52ca9d82a2afe8bd87e29a4bbbce083b1ffa3af7ae8cd7
MATLAB
2,774
73
areatxt{1} = 'lip'; areatxt{2} = 'fef'; rgb = [0.1 0.4 0.5; 0.7, 0.4, 0.7]; timevector = -0.05:0.001:0.2; clear h labels = [{'Singleton distr in RF'}; {'Non-singleton distr in RF'}]; for iArea =1:2 xlimToPlot = [-0.05 .2]; figtitle = upper(areatxt{iArea}); figure('Name', figtitle , 'NumberTitle',...
7e3ac03bfcc46cc8edaf190c559b986f13339afaf5449640a3764cfe9145b015
MATLAB
2,774
115
%% 1d Gaussian MRF for inferring a function % Based on p140 of "Introduction to Bayesian scientific computation" % by Calvetti and Somersalo function gmrf_1d() [obs, obsNdx, hidNdx] = make_data(); demo(obs, obsNdx, hidNdx, sqrt(1/60)); %demo(obs, obsNdx, hidNdx, 0.1) %demo(obs, obsNdx, hidNdx, 0.01) end ...
99fbded81a71864b06ed0ee6d729d4cda8d2a9f6fb60dda91c076fae591957f8
MATLAB
2,774
99
% Compare energy statistics with KS and parametric Hotelling % prob_sr replicates Table 1 from % Szekely & Rizzo (2004) Testing for equal distributions in high dimensions % See also % Baringhaus & Franz (2004) On a new multivariate two-sample test % for Hotelling T^2 comparisons n = [10 15 20 25 30 40 50 75 100]; de...
9b619cb40ee3eb73a0f21928d723d0dcc42c8d36d3749585df499797c1f1c2e7
MATLAB
2,774
74
function [a,res_out,k,field_theo]=dipole_fit_field(f,fp,ndip,para); % fits an n-dipole model to a given surface potential or magnetic % field at one time-point using the Levenberg-Marquadt method. % % usage: [a,res_out,k,field_theo]=dipole_fit_field(f,fp,ndip,para); % % input: % f: nx1 vector with n measurements fo...
e3bd1ceea181504216671aa261688f9977cb1e9d12e752426c84115b77145cf7
MATLAB
2,774
92
%% Stochastic gradient descent for logistic regression problem % This file is from pmtk3.googlecode.com %PMTKslow setSeed(0); % Use classes 2,3 for simplicity Ntrain = []; [Xtrain, ytrain, Xtest, ytest] = mnistLoad([2 3], Ntrain); % replicate the training set to illustrate % benefit of SGD rep = 1; Xtrain = repmat...
ee85eb801a0978afa48ae8bc7105f6adfe5b727247fcedc38aeeff6cd4ebb8cf
MATLAB
2,774
66
function suffStat = VBA_Hpost(posterior,suffStat,options) % Posterior entropy calculus % function suffStat = VBA_Hpost(posterior,suffStat,options) % This function evaluates the entropy of each marginal posterior density. % IN: % - posterior: a structure containing the natural parameters of the % marginal posterior ...
5b04c56dbfa00a3f6a807b53a45d7cede432ea9bb777ce227fc44bf1a2553753
MATLAB
2,775
59
function Obj = SOFAaddVariable(Obj,Name,Dim,Value) %SOFAaddVariable % Obj = SOFAaddVariable(Obj,Name,Dim,Value) adds a user-defined variable % to the SOFA structure OBJ. NAME must be a string with the variable name % ('API', 'PRIVATE', or 'GLOBAL' are not allowed). DIM is a string % describing the dimensions ...
485fa81b63174e0d0e0ab48c68d0f0f0a905c3eec44343ff8b56f28066174b17
MATLAB
2,778
105
function [position,hline] = get2ptline(varargin) if nargin < 1, hax = gca; hfig = gcf; else h = varargin{1}; htype = get(h,'type'); if strcmpi(htype,'figure'), hfig = h; hax = get(hfig,'CurrentAxes'); elseif strcmpi(htype,'axes'), hax = h; hfig = get(hax,'parent'); else error('Parent ...
063ce144b9e6ec319d31a28dfafd82f19ddc7a7d5835cc584897f9e1ec46fefe
MATLAB
2,779
67
function h_makeRoi3(handles) [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); obj = get(handles.imageAxes, 'Children');%unselectAll. set(obj, 'Selected', 'off');%unselectAll. Roi_size = h_getROISize3(currentStruct.state.ROISizeOpt.string); switch currentStruct.state.roiS...
3583681c8a08b3d8b15bb15ba54eac5848f262e6d258975d7fb0a8a24d5ed242
MATLAB
2,780
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...
cf953ef7969739dfd3f2b3e3b50a5394a04d1df2627b8b0fd5db59cf8d15cbc2
MATLAB
2,780
80
% 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,...
de2e90089ac61d0b89084f17fc4d335d57617ed1f0dc09b22c2261b5df503e92
MATLAB
2,780
126
load ../data/sigSL_allSessions_Ariel_230522.mat S = sigSL_Ariel; MinC_minus_I = S.MinC - S.MinI; %% RT = S.rt/1000; ntr = length(S.choice); % tind = S.t>=0.2 & S.t<=0.3; % min_RT = 0.4; % max_RT = 0.7; tind = S.t>=0.1 & S.t<=0.4; min_RT = 0.5; max_RT = 2; d = nansum(MinC_minus_I(:,tind),2); % d = nansum(S.TinC(:,...
1eb4d170c30b3b542e59c7fd395735c708a2d07b90ae6867eed52a392f634559
MATLAB
2,782
79
function [track] = read_trk(filename, refine) %read TrackVis .trk format data % fillPath: filename of track to read. %for format details http://www.trackvis.org/docs/?subsect=fileformat fid = fopen(filename); hdr = get_hdr(fid); if hdr.hdr_size~=1000 fclose(fid); fid = fopen(filePath, 'r', 'b'); % Big endian for...
2090f048a2cda6b5cb5d12778730a1ef3289b1d4a7a02f817ad38daa9964ca09
MATLAB
2,782
82
%% This file should exist in the same folder with 'createCirclesMask.m' and 'fluorescentimagefile.jpg' files close all; clear all; clc; I=imread('Picture6.jpg'); I_red=I(:,:,1);I_green=I(:,:,2);I_blue=I(:,:,3); %%%identify DAPI and count number of cells BWb=I_blue>50; BWc = bwareaopen(BWb,10); BWb2 = bwm...
b8dd561b359e61b3d49848036df09def79abe3c6172e4f0b67619f41c4ef5436
MATLAB
2,782
92
%% % Plot significance of the population through time with the specified % threshold value (0.05 by default.) multiple plots allowed. args=opts.PlotFCN{plotFCNidx,3}; [args,PlotValueField]=ProcVarargin(args,'PlotValue',[]); [args,PValField]=ProcVarargin(args,'PVal',[]); [args,SigThresh]=ProcVarargin(arg...
d0485ace0a5bffc46a1e9adce4cd0948b8947074cbd90a794b45253dc13b00bc
MATLAB
2,782
94
% Main script for the state switching EEG experiment (September 2017) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% enter subject ID & task variant %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% prompt = {'Enter subject ID:','Enter paradigm (dynamic/words/visual):'}; dlg_title = 'StateSwitch Input'; num_lines = 1; defaultans =...
4d781931377c49f71e0182f54b434661c0710301d5e4952b776673eca245ff9b
MATLAB
2,783
119
function [omckk,Tckk,Rckk,JJ] = compute_extrinsic_refine2(omc_init,Tc_init,x_kk,X_kk,fc,cc,kc,alpha_c,MaxIter,thresh_cond), %compute_extrinsic % %[omckk,Tckk,Rckk] = compute_extrinsic_refine2(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 pro...
95cb26466fdbafea20f7bafa5b133b52720b1b7a300c13c1eb0fabad44947ede
MATLAB
2,783
120
function hout=pathtitle(str) %SUPTITLE Puts a title above all subplots. % SUPTITLE('text') adds text to the top of the figure % above all subplots (a "super title"). Use this function % after all subplot commands. % Drea Thomas 6/15/95 drea@mathworks.com % John Cristion 12/13/00 modified % Mark Histed 03/13/04 histed@...
b2497a62c66839f5bc6150b0a44e77545cdf864f4ffe6f74ae5cda74dd5dfc76
MATLAB
2,783
100
function W = compute_mesh_weight(vertex,face,type,options) % compute_mesh_weight - compute a weight matrix % % W = compute_mesh_weight(vertex,face,type,options); % % W is sparse weight matrix and W(i,j)=0 is vertex i and vertex j are not % connected in the mesh. % % type is either % 'combinatorial': W(i...
be421ea56281e6b84847452fa58104fcfc55029aaaaba1f890158131eaf893db
MATLAB
2,783
100
movfile = '/groups/huston/hustonlab/aviFrameStamped/frameNumAdded_Xvid.avi'; nreads = 3; nframestest = 200; %% read in frames using get_readframe_fcn, but in order, so calling read(f) [readframe,nframes0,fid,headerinfo] = get_readframe_fcn(movfile); nr = headerinfo.nr; nc = headerinfo.nc; nframes = min(nframestest,nf...
15f7ec73ae7222c42d609bb4daa47e4931ef06e3ff9d66dc6e6ebe425de193f6
MATLAB
2,784
85
function [tfr,t,f] = tfrwv(x,t,N,trace); %TFRWV Wigner-Ville time-frequency distribution. % [TFR,T,F]=TFRWV(X,T,N,TRACE) computes the Wigner-Ville distribution % of a discrete-time signal X, % or the cross Wigner-Ville representation between two signals. % % X : signal if auto-WV, or [X1,X2] if cross-WV. % T ...
6c8bd42181844d2f9b19a69398b674920c8c7d31a2fa3c4712c454662f572f84
MATLAB
2,784
67
function [hM,meta,stimPar]=SOFAconvertSOFA2ARI(Obj) % OBJ=SOFAconvertSOFA2ARI(hM,meta,stimPar) converts the HRTFs described in hM, meta, and % stimPar (see ARI HRTF format) to a SOFA object. % % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences; % Licensed under the EUPL, Version 1.1...
88a8e0aece9d57dc40e9aaf3cd6c5f749db224eb3d08d7d854a859ce206d4d1d
MATLAB
2,784
92
function [subm, vidx, submFidx] = submeshFromV(mesh, vidx, clipears) % get a submesh by specifying vertex indices % % subm = submeshFromV(mesh, vidx) % % mesh : struct with fields v, f, vn, (optionally u) % subm : same % vidx : logical index %--------------------------------------------...
d47d7f11fc7a32ff5af30bf26bdf8b04703bfa1ddc147ce58990d39d21b5cbf0
MATLAB
2,784
64
function [output_signal, G1, G2] = reconstruct_signal(input_signal, first_order_kernel, second_order_kernel) % Adapted from a script by Ayad Al-Rumaithi from the Mathworks File Exchange % https://uk.mathworks.com/matlabcentral/fileexchange/71799-volterra-wiener-characterization % Calculate the length of input...
2de001fbf4494da43c2ef06993360b4ca3de8fe54387984c99633e5416b9694d
MATLAB
2,785
72
function [Kernel, features, D] = build_kernels_cv(datadir, hmmdir, kerneldir, HMM_name, leaveout_foldN, Fn, Kn, iterN) % [Kernel, features, D] = build_kernels_cv(datadir, hmmdir, kerneldir, HMM_name, leaveout_foldN, Fn, Kn, iterN) % % build kernels from HMMs fit only to training fold subjects % (wrapper for hmm_kernel)...
034f9fe72199a9bfe6dea93a7fc7812e12c23f479a27869f4c9bffb0bff3cba0
MATLAB
2,786
85
function f = VBA_spm_Npdf(x,u,v) % Probability Density Function (PDF) of univariate Normal distribution % FORMAT f = spm_Npdf(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 %_______________________________________________________________...
0ca4621ef0f2dc0bf5ae560460ce989ff97c490706c4bf4d6ea67c7d846e74b0
MATLAB
2,786
114
%b8d3721ed219e65100184c6b95db209bb8d3721ed219e65100184c6b95db209b % For EEGLAB and LAN format % windows in points of signal % Only for continuous data % % % Author: Javier Lopez-Calderon, CMB % Davis, December 2007 - June 2008 % % Copyright (C) 2008 Javier Lopez-Calderon & Steven Luck, % Center for Mind and Bra...
8dbf9fa3d31e451fb0e6e115727713403f0def68ece528ff5c1ef6f24a36c4b0
MATLAB
2,786
83
% ReshapeContinuousData.m % Sarah West % 1/23/23 % Reshapes continuous data from PLSR so each contnuous data type is in its % own entry in a new, last dimension. % Needed inputs: % parameters.data % parameters.variablesDimIn % parameters.this_comparison_set % Outputs: % parameters.data_reshaped function [paramete...
f414fa021efab13924c283e8e8cfaa9e5df65c6c76ea70773f1a7ac23a3e5bc4
MATLAB
2,786
118
function hf = unwrapKTOM(x,inG) % display k-ToM's evolving beliefs over trials % function unwrapKTOM(x,options) % IN: % - x: k-ToM's hidden-states % - inG: the input structure to g_kToM.m % OUT: % - hf: display figure handle K = inG.lev; % sophistication level nt = size(x,2); % nb of trials Ntot = inG.indParev ...
fcc96cd4d3da04884dfd907ddad9be41380cfa1f3d9713a2a1d12bd39721e892
MATLAB
2,786
80
function clusterRates(spikeMat, modelParam, network, varargin) % plots.clusterRates(spikeMat, modelParam, network); % % Generates a plot of the mean spike rate, mean cluster-wise spike rate, % and z-scored cluster-wise spike rate from the data in spikes_V_m % % Inputs: % - spikeMat: E-cell binary spike matrix from one ...
23a7a436e53926c06362f267d1970b32e5c61cddb9e50aba4872f3af8f101607
MATLAB
2,788
96
function model = svmlightFit(X, y, C, kernelParam, kernelType, saveAlphas, options) % Call svmLight to fit a binary SVM classifier using the specified kernel, % (rbf by default). If RBF, the kernelParam is gamma in % exp(-gamma ||X-X'||^2). % % Supports classification and regression. % % % model is a structure which c...
dfd7cbe850e4ee7b244a776a1848751155d9e12cac0d9442dcb7421472959b76
MATLAB
2,788
77
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef LeapInductionEvent < Tag & matlab.mixin.CustomDisplay %LEAPINDUCTIONEVENT Tag that describes a LEAP induction event properties(GetAccess = private, Constant = true) CurrentVers...
fe1ccfb79cb0dc8a67ed2e9052582b61659473865740e8cc441cf7fe4f502bc5
MATLAB
2,789
101
function mesh = make_cylinder(sizevar,surf) % mesh = make_cylinder(sizevar) % % Creates a 3D cylindrical mesh % % sizevar.xc - x coordinate of the center % sizevar.yc - y coordinate of the center % sizevar.zc - z coordinate of the center % sizevar.r - radius % sizevar.height - height % sizevar.dist - distance between ...