sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c375c82f8998c7eae65e534a85d4250376169d07f0350941f9bf44fb7a85e505
MATLAB
3,491
32
subjs={ '/m/cs/scratch/networks-pm/pm_denoise/sub-01/sub-01_task-movie_SGdetrend_24HMP-8Phys-4GSR-Spike_HPF_smooth-6mm.nii' '/m/cs/scratch/networks-pm/pm_denoise/sub-02/sub-02_task-movie_SGdetrend_24HMP-8Phys-4GSR-Spike_HPF_smooth-6mm.nii' '/m/cs/scratch/networks-pm/pm_denoise/sub-03/sub-03_task-movie_SGdetrend_24HMP-8...
2fedb96d4fa0bcf6040309ccdc89d50a1ab484ab18c217d8067e26762d3ac365
MATLAB
3,493
72
clear close all clc %% Load atlas % path to MRI template - must include hdr and img files atlas = niftiread('/Users/jstrohl/Documents/20230908 Pipelines for neural data analysis/Dependencies/ATLAS-MICE 2/2011-10-30_MRI-template3.hdr', ... '/Users/jstrohl/Documents/20230908 Pipelines for neural data analysis/D...
b6a8742287f2ecf20f323dbf03ba884159d0c90cb1849bf55a001f6a4a981d04
MATLAB
3,493
118
function meg_SFig3_sessionPhaseConsistency % Polar plot of the fitted phase difference by precue % Session 1 v Session 2 % Mean phase difference ± 1 SEM % % thetaregion, polarregion requires Matlab R2024a or above %% Load data % Model fit data filename = 'figData/ModelFit_SeparatePrecueT1T2_2Hz_session.mat'; % IT...
303d9520c187cccc2a622bd55206b1da385d606469582b249b1b07b36cc94ad5
MATLAB
3,494
96
function perform_rsa_analysis(p) % % - This code is written for performing multiple ROI representational similarity analysis. % - A total of 383 (HCP360, 13 individual ROIs, and 10 subcortical ROIs) are used. % % % called from emotion2020_analysis_BATCH % %% settinig warning off %% start analysis for scoritr = 1:lengt...
26459c132dd86c12b7b8ff9a0fa4a11d6e696f35358b27f15970a1ea31bc715f
MATLAB
3,495
78
function [GTA] = y_GraphTheoreticalAnalysis_wu(G,RandomTimes) % function [GTA] = y_GraphTheoreticalAnalysis_wu(G,RandomTimes) % Perform graph theoretical analysis based on Brain-Connectivity-Toolbox (BCT, http://www.brain-connectivity-toolbox.net) % Input: G - The weighted undirected connection matrix % ...
05a856ed352db1bb4ee45d2c533508b4920da389a8a2e67bb93d76d0d0a1f2c9
MATLAB
3,497
82
function build(varargin) % Build an APT executable. % Parse optional args [do_run_test_after, do_compile] = ... myparse( varargin ... , 'do_run_test_after', false ... , 'do_compile', true ... ) ; % Define things needed for building or running main_m_file_name = 'APT_deployed.m' ...
abbe1b35785684899addbf7df066d4208dd18b032ef0762d5eea8190040d3d0f
MATLAB
3,497
102
%% SCRIPT TO EVALUATE QUALITY OF REGISTRATION % Uses Dan Goodwin's method from ExSeq paper (Alon et al., Science 2021) % Accompanies the manuscript by Kang*, Schroeder* et al., 2023 % Last modified by Margaret Schroeder on 12/14/2022 % Image processing up to this point: % - background subtraction in Fiji an...
cf19272880ce55529323c92171584e9a0c390fb60424bee2f974d7f9d5f69e09
MATLAB
3,497
113
function opts = metamerOpts(oim,varargin) % %----------------------------------------- % opts = metamerOpts(varagin) % % generates a structure of parameters for % metamer analysis and synthesis % (see metamerAnalysis.m and metamerSynthesis.m) % % oim: original image to be used in analysis % % opts: structure contai...
60e6a6b25c7c98d1bad5816cce89536d0fa4d0062e828ff44dc9bff2bc289722
MATLAB
3,499
87
% This example recreates the MNIST datasource from % http://yann.lecun.com/exdb/mnist/ % % You can load a subsampled version (10k images) from the folder /Tutorials/MNIST_Datasource % (for instance using the dataspace GUI). % % XXXNAT TODO: test % % %<PRE> % This fil...
1a616079cfebda9d92defb7225237d6a0cc3dc2f18a113465973268bcb31f7e4
MATLAB
3,500
99
function Draw_ROIs_Through_Cortex(Anat,ROI,Conn,params) % % This function will draw ROI spheres on a model of the cortical surface. % The ROI spheres may be connected by tubes that are sized by correlation % strength and colored by sign. The cortical surface with have a % transparency. % Anat is a structure that ...
611ddf7a74fbc92ad47141154bcf8a923bca598a15efbf0bcbbe7f63d935dd98
MATLAB
3,500
104
function mappedX = ltsa(X, no_dims, k, eig_impl) %LTSA Runs the local tangent space alignment algorithm % % mappedX = ltsa(X, no_dims, k, eig_impl) % % The function runs the local tangent space alignment algorithm on dataset % X, reducing the data to dimensionality d. The number of neighbors is % specified by ...
4b5319582565203ec98c24b655ebc2f3528686710c560fc242c566c62c124c2d
MATLAB
3,501
105
% ManualMasking.m % Sarah West % 8/23/21 % Is a function that lets you draw masks over mice brains manually. Is % called by manual_masking_loop.m % Inputs: % existing_masks-- % image_to_mask-- % iterator_name -- just for asking user if they're done. % Outputs: % masks-- a function[masks, indices_of_mask]=Manua...
50b82e96c65d306d3125ca180738830cce71c0cb5d9f261415acb2250fb47bbb
MATLAB
3,501
105
function motion_corrected_name = FSL_MoCo_batch(filename,tgframe,iframe,fframe) %====================== % -file input %====================== fprintf(1,' \n Reading Volume ...'); DYN = load_untouch_nii(filename); DYN = double(DYN.img); fprintf(1,' done.'); [inpath, fname, ~] = fileparts(filename); [~, fname, ~] ...
ad732cec57d7ca2173eb0322890fadacb64785ee504ef19b28da615849c8edc7
MATLAB
3,501
107
function dat = read_egis_data(filename, hdr, begtrial, endtrial, chanindx) % READ_EGIS_DATA reads the data from an EGI EGIS format file % % Use as % dat = read_egis_data(filename, hdr, begtrial, endtrial, chanindx); % where % filename name of the input file % hdr header structure, see FT_READ_HE...
30274dda4f79bb48f526c3e25f6b44f5fbf7a08e8034d886fddb079f93bcaf7e
MATLAB
3,502
136
function [Carotids_mask,Pseudo_TOF_final] = segment_arteries(PET_dyn_path,time_PET,out_path,anatomy,options) [~,~,~,~, IDIFTemp_path, IDIFVessels_path, IDIFQC_path, ~, ~, COREG_path] = out_path_preparation(out_path); %loading dynPET [PET_dyn, PET2D, hdr, NIIdyn] = load_PET(PET_dyn_path); %cleaning PET... PET_dyn(:,:,...
75dab82c670776c818160500bbe5e2f09ce94f381b1efccc5fa5b2dcf921f899
MATLAB
3,502
124
%% Multimodal PLS % % % 1. Load data % 2. Regress out confounds % 3. Reduce imaging data dimensionality with PCA % 4. PLS analysis clear close all clc addpath(fullfile(getenv('CBIG_CODE_DIR') addpath(fullfile(getenv('CBIG_CODE_DIR','external_packages','matlab','non_default_packages','PLS_MIPlab'))) data_dir = ...
69248f7e0b3758d8c9ebc6a81e758a7922dd05a1b7fdd0372680ea7acdcdfd91
MATLAB
3,503
82
function compile_apt(varargin) % Build an APT executable. % Parse optional args [do_run_test_after, do_compile] = ... myparse( varargin ... , 'do_run_test_after', false ... , 'do_compile', true ... ) ; % Define things needed for building or running main_m_file_name = 'APT_deploy...
2dcb87c7225375fb88ff827debe44a6f0909e5e7bfb5f4b18ed00ac019bf8765
MATLAB
3,505
70
function [Epri, Ppri] = bemf3_inc_field_electric_gauss_selective(strdipolePplus, strdipolePminus, strdipolesig, strdipoleCurrent, P, t, Center, dipoleClusterCenter, gaussRadius) %% Compute model subdivision parameters % number of integration points in the Gaussian quadrature ...
9a0a49adf13a5208cb8cbc637b2aec83bec8465ee407a98bf91b090a8bb03539
MATLAB
3,505
105
function surr = CBIG_RL2017_get_AR_surrogate(TC,n_surr,order,distribution) % surr = CBIG_RL2017_get_AR_surrogate(TC,n_surr,order,distribution) % This function generates autoregressive (AR) surrogates. The three % mandatory inputs are: % 'TC' original time course of size (num_timepoints,num_variables)....
dda3d58c7c11e10df508113ca8660ddf17901e3c9a9b79d916de43fd31f6f8c5
MATLAB
3,505
70
function [Epri, Ppri] = bemf3_inc_field_electric_gauss_selective_dipoles(strdipolePplus, strdipolePminus, strdipolesig, strdipoleCurrent, P, t, Center, dipoleClusterCenter, gaussRadius) %% Compute model subdivision parameters % number of integration points in the Gaussian quadrature ...
04a57d3b3e40d02aa547ef7d04d8b25e56677c31a96eeda2dac94b296b731dff
MATLAB
3,507
99
function[out] = fit_measure_rois(measure, range, above_SNR_thresh_VTA, above_SNR_thresh, VTA_analysis_out, LC_analysis_out, x_units, grab_laps,range2) if exist("range2", "var") LC_range = range2; LC_x = x_units; x_units = x_units(21:60); else LC_range = range; LC_x = x_units; end if measure == '...
54619c671c24ba57753ca7d2bfcd236fa933ca3221478ec6904081cef7f2f3bb
MATLAB
3,507
136
function [B,MSEs]=jisotonic5(A,direction,weights) % jisotonic5 - isotonic regression (jfm, may 2105) % % [B,MSEs] = jisotonic5(A,direction,weights) % A is the input a vector % direction = 'increading', 'decreasing', 'updown', or 'downup' % weights is the optional input weight vector (same size as A) % B is the ...
f27e7bc27b36c13402776257b3e232b8a5e3da3e85e2665d0b6b62cc39c1aa0c
MATLAB
3,507
114
function sources2vtk(mesh,output_fn,varargin) % SOURCES2VTK Saves sources of a FEM mesh in NIRFAST format into a *.vtk file. % % SOURCES2VTK(MESH,OUTPUT_FN) Saves sources (MESH.source.coord) of a FEM % MESH in NIRFAST format into a *.vtk file. Usefull for visualization % with e.g. ParaView. % MESH - mesh struct...
4690a9ebb56326a59893e0363c62d272c65283bbd5480945b435c93814675dd1
MATLAB
3,508
112
%% pxTools_predictPxtFromPx0 % Core method for predicting and output distribution given an input % distribution. % % Assume input distributions are columnwise % % Can pass two types of operators to this functions: Transition matrices % (px) or difference matrices (dpx); If the later, select between two % different type...
f7003fa75ae0de0779da95171b924609aeb257534ff722a28574c5bd9227b972
MATLAB
3,508
111
function [mappedX, mapping] = laplacian_eigen(X, no_dims, k, sigma, eig_impl) %LAPLACIAN_EIGEN Performs non-linear dimensionality reduction using Laplacian Eigenmaps % % [mappedX, mapping] = laplacian_eigen(X, no_dims, k, sigma, eig_impl) % % Performs non-linear dimensionality reduction using Laplacian Eigenmaps. % T...
76cee028b153d6116669fbc6b8cbb989501f6e8211b38c90aa988873de84ef45
MATLAB
3,509
160
function [A, fH, figNames] = meg_plotDecode(D, I, p, classLabels, classNames, selectedChannels) % function [A, fH, figNames] = meg_plotDecode(D, I, p, classLabels, classNames, selectedChannels) % % ADD doc % % Rachel Denison % March 2020 %% Inputs if nargin < 1 D = []; end if nargin < 2 I = []; end if nargin ...
8fddfca55eb104d90498251317928f8d8bd38ccffcd4cb0505b92d2c3f0c4659
MATLAB
3,510
106
function val = ft_getopt(opt, key, default, emptymeaningful) % FT_GETOPT gets the value of a specified option from a configuration structure % or from a cell-array with key-value pairs. % % Use as % val = ft_getopt(s, key, default, emptymeaningful) % where the input values are % s = structure or cell...
e43f0cbce9cc885e4593b8f508950cd2d6b42ab69c7276a3055d6d3c1595d06a
MATLAB
3,511
173
function [xc,good,bad] = centercirclefinder(xt,I,wintx,winty); %xt = [521.6249 ; 469.9916]; %wintx = 60; %winty = 60; xt = xt'; xt = fliplr(xt); if nargin < 4, winty = 5; if nargin < 3, wintx = 5; end; end; if nargin < 6, wx2 = -1; wy2 = -1; end; mask = ones(2*wintx + 1,2*winty + 1); %mas...
9534aeb603b628befa1899f93c2a69c50d3ca4509fc11460d7f1f1cd461b9dba
MATLAB
3,512
101
function [XX, XY,Yn,allstim,n,T] = MkSuffStats_BilinReg_Data(Data,includeTerms,variable_name,cntxt,ssm,TrainTrials) n = length(Data.unit);%number of units in the data set T = size(Data.unit(1).response,2); allstim = cell(n,1); Yn = cell(n,1); % neural responses (each cell has resps for one neuron) ntrials = zeros(n,1)...
7e6b1566ce30b6a12575b919d163905351babf542f8b4c993f3df48e0c8b4694
MATLAB
3,513
94
loadParameters; if ~params.DO_DOWNSAMPLE fprintf('Skipping downsample because the parameter file says not necessary\n'); fprintf('[DONE]\n'); return; end t_downsample_apply = tic; delete(gcp('nocreate')) conditions = conditions_for_concurrency(); max_pool_size = concurrency_size_in_downsample_apply(condit...
dce24905242b196e729838559f34af9f85c135118bbffb9c56d976b4abf2a49f
MATLAB
3,513
154
% Field Trip-related test scripts - Synthetic FT data - Event detection. % % % Includes. % FIXME - Assume init has already been called. % % % Configuration. % Select the actual parameter extraction method to use. paramconfig_chosen = paramconfig_coarse; if strcmp('amp', param_chosen_type) disp('.. Using det...
4266c20cdd9809f084b25c18b3d98d2d9ae58cc0e59b715f0fa96c8715a4dd69
MATLAB
3,514
124
function catFAdemoAuto() % Factor analysis with categorical and continuous data % We reproduce the demo from % http://www.cs.ubc.ca/~emtiyaz/software/mixedDataFA.html % The original source code for this demo is in % demoFAemt; the results are identical since the underlying % code (and initialization) is identical. %[d...
a70d41a81913d157eaadc1d33af91c87d6b553dc950e15923e5cee8437f69d41
MATLAB
3,514
116
function B = pmlGrabBook(includeEx, includeSol) %% Grab the entire PML book and put it in a cell array % Each chapter is put in its own subcell so that B{i}{j} is the jth line in % chapter i. Comments, (including block comments} and blank spaces are % removed. Does not include, ttl, dummy, preface, or the generated in...
c6303958eb80e5324f2fc835fd0ed28d79aabf222aa5716e4d67bf6d9f74bbe3
MATLAB
3,514
92
function model = svmlibFit(X, y, C, kernelParam, kernelType, varargin) % PMTK interface to libsvm % If RBF, the kernelParam is gamma in exp(-gamma ||X-X'||^2). % %% Setup % (1) Download libsvm from % http://www.csie.ntu.edu.tw/~cjlin/cgi-bin/libsvm.cgi?+http://www.csie.ntu.edu.tw/~cjlin/libsvm+zip % (2) unzip to e....
28ba5a280771c22f790b0dcd6067bc6d2865a7d8c346fa3fb171b392663c034a
MATLAB
3,517
84
function [postSaccTimes, saccLats] = GetTimesBeforeTriggers(saccCodes, beforeCode, trigLats, trigs, times) % function [postSaccTimes, saccLats] = GetTimesBeforeTriggers(saccCodes, beforeCode, trigLats, trigs, times) % Returns boolean matrix of whether each time sample was after the saccade % trigger codes given, on eac...
662081491c6c5c2b0491be99e984979324c5fd638dab2902209624a4740b07e5
MATLAB
3,520
71
function CBIG_AuthorTopicEM_ReplicateBrainMapResults(seed, K, alpha, eta) % CBIG_AuthorTopicEM_ReplicateBrainMapResults % % Wrapper function to replicate the cognitive components estimated from BrainMap % from Yeo et al. 2015. Input data is stored in CBIG's HPC server. % % The inference was performed with ...
5a4aec589897a891be38b8920ef7b2f8600fb2cf5111529aff9ae7da9d6900bb
MATLAB
3,521
109
function [data] = analyze_mExR_5xFAD_abeta_cropped(params,fov,chs) % Analyzes validation data, with same proteins stained in consecutive rounds % Outputs % num_puncta: the number of puncta in each synapse % punctavol: the total puncta volume for each synapse % AR: the aspect ratio of the most ellipsoid volume in each ...
b8d7e179ca8fa3c1632f01278a4e68d0a32fa0078d34a17737323e2c378fdf74
MATLAB
3,521
122
function [tev, tsq] = read_tdt_tev(filename) % READ_TDT_TANK % % Use as % [tev, tsq] = read_tdt_tank(filename) % % Note: % tev file contains event binary data % tev and tsq files work together to get an event's data and attributes % sev files contains streamed binary data % the possible values of the data for...
20b61a36bc8f272147f52e5987a34da0e0be36a837feec83ae3c7ee250297760
MATLAB
3,522
92
% Source-target evaluations on the unit square, Helmholtz kernel. % % This is basically the same as MV_SQUARE1 but using the Helmholtz kernel. The % associated matrix is rectangular and complex. % % Inputs (defaults are used if not provided or set empty): % % - M: number of row points (default: M = 16384) % - N: nu...
34eeda87e8a9179c47345d5e6d07e291e6caee9e83e2d4c0574b497aec26f68e
MATLAB
3,524
92
function [H, basis] = hessianmatrix(problem, x, basis) % Computes a matrix which represents the Hessian in some tangent basis. % % [H, basis] = hessianmatrix(problem, x) % [H, basis] = hessianmatrix(problem, x, basis) % % problem is a Manopt problem structure with a manifold and cost function. % x is a point on ...
9c3d582d64a55d28303871f609fea17ea6896673e96d6893a419f70f6548161a
MATLAB
3,524
92
% Source-target evaluations on the unit circle, Helmholtz kernel. % % This is basically the same as MV_CIRCLE1 but using the Helmholtz kernel. The % associated matrix is rectangular and complex. % % Inputs (defaults are used if not provided or set empty): % % - M: number of row points (default: M = 16384) % - N: nu...
3a357a8c5744fd9ed1c483b708d98f007abfd010f18161708ea6757224842c60
MATLAB
3,525
118
% Author: Birgit Nierula % nierula@cbs.mpg.de function esg_prepro_loop10(subject, condition, srmr_nr) debug_mode = false; %% set variables subject_id = sprintf('sub-%03i', subject); analysis_path = [getenv('ANADIR') subject_id '/esg/prepro/']; cfg_path = getenv('CFGDIR'); % get condition info [cond_info] = get_cond...
04e5d14381cea0eb9905e92fc9ed7193a0a02af97609b34c33410a1e43c452f7
MATLAB
3,527
91
function [Error, Cfg]=DPABISurf_RerunWithGSR(Cfg) % FORMAT [Error]=DPABISurf_RerunWithGSR(Cfg) % The data has been processed without global signal regression for the first pass. Now re-run it with global signal regression. % Input: % Cfg - the parameters for auto data processing % Output: % The processed data...
1dfb20081097ade02cc9af24e731208385079d9854ecc43db24197ec8661c4b8
MATLAB
3,527
110
function copy_ctf_files(oldname, newname, deleteflag) % COPY_CTF_FILES copies a CTF dataset with all files and directories to a new CTF % dataset with another name. % % Use as % copy_brainvision_files(oldname, newname, deleteflag) % % Both the old and new name should refer to the CTF dataset directory, including % t...
7eec7dcdbf5ff7bf2f4ab40d46f8303198fc55c822a4f7c97eb0ccf880566655
MATLAB
3,527
121
function [path, name, ext] = fileparts_platind(file) % % parses paths as in windows, regardless of the os % renamed by KB 20160803 % experiments directories pathes in .jab files created on windows machines % are not parsed correctly % on unix based system because '\' is not a proper delimiter, so this %...
95054c2289dc3bc7633794bfa49b90e09451293032c381b250f94d6042ffbf7e
MATLAB
3,529
72
% This function fits sinusoids of different frequencies to the drift at % different bump positions (starting and restarting) function [A_All_Begin, A_All_End, Theta_All_Begin, Theta_All_End, DC_All_Begin, DC_All_End,... Model_FitToData_Begin, Model_FitToData_End, Model_FitToData_Begin_Plot, Model_FitToDa...
10d6fc2192707af78bf69811c570d21b519062c89626814d8cb57548a8f3f740
MATLAB
3,530
104
function [hdr] = read_nihonkohden_hdr(filename) % READ_NIHONKOHDEN_HDR reads the known items from the Nihon Kohden EEG % system header file (*.m00) and returns them in a structure. This reading % function is an adaptation of get_nkheader.m written by Timothy Ellmore % % Use as % hdr = read_nihonkoden_hdr(file...
fc11d7d801ea0b87c05fe144e52a484fe80bf61a360d8952f036c470c8fcb510
MATLAB
3,530
130
classdef ParameterVisualizationTgtCropRadius < ParameterVisualization properties % If true, a prop for this pvObj is currently selected, and we are % successfully initted/displaying something. initSuccessful = false; hRect % scalar line handle. set/created during init isMA % scalar ...
15835dcc18b83108985672b6613857d5dd9a545161a97a0da75d4b427ce2ae78
MATLAB
3,531
103
function [AllVolumeBrain, GHeader] = y_bandpass_Surf(InFile, ... ASamplePeriod, ALowPass_HighCutoff, AHighPass_LowCutoff, ... AAddMeanBack, ... AMaskFilename,... AResultFilename,... CUTNUMBER) %Ideal Band pass filter %Algorithm re-written to call y_IdealFilter by YAN Chao-Gan % FORMAT [AllVo...
a058cb72bbba5b4e872b562accab452f376e34abbb9006525006eb7e408ff4fb
MATLAB
3,532
120
function state = randomseed(setseed) % RANDOMSEED retrieves or sets the random seed, taking into account the different % MATLAB version specific methods % % Use as % state = randomseed(setseed) % % INPUT % setseed [] does not reset the state, but saves out the state for future use % intege...
a59163bf5224a524b2ad796776f40d6639c7318df852ada4baac543951f93711
MATLAB
3,532
79
% note: change current folder to figure "number" clear all;close all;clc; rawPath=pwd; %displays the current working directory - set it to the figure "number" savePath=rawPath; addpath Panels/ addpath Functions/ load("StaticBars_width900_VS_width300_basedOnRF_Population_All") load('colors.mat') %% Figure 4 dataPath...
83cfa8c7d827cfdde73afe52ecad593746612230b8bf30f6c1ee4a1ce2a48bba
MATLAB
3,533
175
function [H,Hnorm,inv_Hnorm] = compute_homography(m,M); %compute_homography % %[H,Hnorm,inv_Hnorm] = compute_homography(m,M) % %Computes the planar homography between the point coordinates on the plane (M) and the image %point coordinates (m). % %INPUT: m: homogeneous coordinates in the image plane (3xN matrix) % ...
28a7a17429fd1ac3601197e015817636ef601f6079073a480d8f4cb112301d1c
MATLAB
3,534
144
%% Demo of group lasso compared to vanilla lasso % PMTKauthor Mark Schmidt %% % This file is from pmtk3.googlecode.com function linregGroupLassoDemo() setSeed(1); %% Make data % Generate categorical features nInstances = 200; %nStates = [10 5 10 5 20 5 10 5 20 5 10 20 10]; nStates = [10 5 10 20 10 20 10]; % Numb...
386528d145d6f2ae7c6640965363a47a81ca4a2f5c60661a082d9c944265a0e5
MATLAB
3,535
90
function [theta_AIC,phi_AIC,reg_id_AIC,cut_id_AIC,AIC_value] = ... AICfun_ForStepRegression_constrained(Y,phi,theta,ori_reg_id) % Akaike Information Criterion Forward selection method. % given Y, phi, and the regulator IDs before AIC % calculate AIC and output theta_AIC, regulator IDs after AIC, regulator IDs c...
6b2c2bc535c95d64458805b7c716ab5113b73336b9606e90ee8392b3a0d60fe2
MATLAB
3,535
97
%% Code to run sleep-session decoding of Shin et al., 2019 data % sleep_decode_batch_new.m % % This was adapted from exptSleepDecoding.m to run decoding of % experimental data from Shin et al., 2019 using the decode_events function % created for simulated preplay events. %% Set up % Get data directory userDir = char...
7bfb1a721352b430f2dd267a110ee628259e2943d625cb7807dcbc89df6952ac
MATLAB
3,535
81
function [ gx ] = ObsRecGen(x,P,u,in) % observation function for k-ToM's bet about her opponent's next move % [ gx ] = ObsRecGen(x,P,u,in) % Marie Devaine wrote this function in November 2015 (comments: JD). % A k-ToM learner bases her decision (a=1 or a=0) upon her prediction of % her opponent's next move, given the g...
223f2a40714938323a541c924e87adacfaa119b36c26c9304d1cf0d98456b446
MATLAB
3,537
106
function X = ttm(X,V,varargin) %TTM Tensor times matrix for ttensor. % % Y = TTM(X,A,N) computes the n-mode product of the ttensor X with a % matrix A; i.e., X x_N A. The integer N specifies the dimension % (or mode) of X along which A should be multiplied. If size(A) = % [J,I], then X must have size(X,N) = I...
a889eef2aced865106ec501c180ebe5042d90ce5639286ae923c0056326f6558
MATLAB
3,537
102
function [Xdata,ydata,W] = bolassoMakeData(n,d,r,nDataSets,requireConsistent,noise) %Generate synthetic data as per section 4.1 in %Bolasso: Model Consistent Lasso Estimation throught the Bootstrap by %Fracis R. Bach, available at www.di.ens.fr/~fbach/icml_bolasso.pdf. % % n - number of examples % d ...
5918269eb1bb92f73061725af3888012cdc2a1796626d8818967bb3c3ccafc25
MATLAB
3,538
131
function createFromDeeplabcut(dlc_data_file,mov_dir,varargin) % function convertFromDeeplabcut(dlc_data_file,mov_dir) % Creates a APT project from Deeplabcut project. % dlc_data_file is the csv file generated by deeplabcut during training. % mov_dir is the directory with the movie files used for the deeplabcut % projec...
2b170417a243da3f078fb8249551a9180c3cbeae1d602182acd959e9db657d83
MATLAB
3,540
115
%% Split Drift/Diff SDOs. % % If the Fokker-Planck Equation underlying the stochastic process is an % appropriate estimation of the underlying Kraymer-Moyals' Expansion, then % the effects in probability DRIFT and DIFFUSION can be segregated as the % first and second order approximations. % % In the SDO, passive diff...
4ff1de74c253c719a2d0d0fea07bc6a36ea4d1804dff93d0abec4b5c169f9cda
MATLAB
3,540
106
function DataStructure=PowerFit3D_ZN(Xdata,Ydata,ZData) FitBuffer=0.2; FitDeviations=1000; beta0 = [1, 1, 0]; % Guess values to start with. Just make your best guess. modelfun = @(b,x) b(1) * x(:, 1) .^ + b(2) + b(3); if size(Xdata,2)>size(Xdata,1) else Xdata=Xdata'; Ydata=...
3d6f406ce5f887942c8c20644a0123bf6fb1eac7f18be2e4dcc1267689516c02
MATLAB
3,541
93
%% cifReshuffle % Utility to reshuffle spiketimes based upon the Conditional Intensity % Function (CIF) generated from the supplied spikes. The number of output % spikes will equal the number of input spikes. % % Used here to generate an arbitrary number of reshuffled timestamps. % % INPUTS % timeStamps - [...
4fe92a5315ed7f4ef4e895dccd755e7f599ee3dadb9e5ce1195f2e79d72f355e
MATLAB
3,544
115
function plotmesh_fiducials(mesh) % PLOTMESH_FIDUCIALS Plots sources and detectors of meshes in NIRFAST format. % % SYNTAX: % PLOTMESH_FIDUCIALS(MESH) % % PLOTMESH(MESH) MESH is NIRFAST mesh structure. % % Part of NIRFAST package. %% load mesh if ischar(mesh)== 1 mesh = load_mesh(mesh); end %% plot source...
5610517fc03207f45c8823e66aa67d3b3e02ce3c50264c489f3f4ace0796d8dc
MATLAB
3,544
136
% makes the leaderboard function make(look_here, nerve_name, neuron_name, window_size) if isempty(look_here) look_here = pwd; end data = crabsort.leaderboard.measure(look_here); all_exp_id = categorical(zeros(length(data),1)); all_best_snr = (NaN(length(data),1)); all_worst_snr = (NaN(length(data),1)); all_mean_s...
a8344652c4909d846599e2a3f719c8c09f3aae3a44b4959cd6186bbbb662b6d9
MATLAB
3,544
102
%% refrence and citation %%%%%%%%%%%This code is a modified version of the the available code in Zajkowski et al 2017 article %%%Zajkowski, Wojciech; Kossut, Malgorzata; Wilson, Robert, 2017, "A causal role for right frontopolar cortex in directed, but not random, exploration", https://doi.org/10.7910/DVN/CZT6EE %%...
a2b86b12775f0b1f45a9fcc9461a29cdd392b7d7d6c6a8ab99ed02408a93b057
MATLAB
3,545
102
% DeleteMasks.m % Sarah West % 10/7/21 % Plots all the masks you drew with ManualMasking.m and lets you pick some % for deletion. function [masks, indices_of_mask] = DeleteMasks(masks, indices_of_mask, bRep) % Inputs: % masks -- a 3D matrix (pixels, pixels, mask #) of all the masks you drew. % bRep -- a representativ...
a537398ba1e693543796a6d2b6c52662a15585416f7b2f9a7f8de09513dabf84
MATLAB
3,546
91
function segmentation = fixsegmentation(segmentation, fn, style) % FIXSEGMENTATION is a helper function that ensures the segmentation to be internally % consistent. It is used by ft_datatype_segmentation and ft_datatype_parcellation. % % % See also CONVERT_SEGMENTATIONSTYLE, DETERMINE_SEGMENTATIONSTYLE switch style ...
d153113176d461d59b0f565a5123362870e2be48feee5619744574519516c2d8
MATLAB
3,547
102
%% initialize settings % This script loads position data from the flytrack_video script, collapses % data from multiple replicates, and makes a heatmap of where the flies went. % Jeff Stafford % How long is the assay (in seconds)? If one of the csv files is shorter % than this, defaults to the shorter time. total_t...
f9f3caebba24197d339de51e0c7cd2b8469347808618a7308fbfdae1886af4ee
MATLAB
3,547
176
function ignore = ignorefields(purpose) % IGNOREFIELDS returns a list of fields that can be present in the cfg structure that % should be ignored at various places in the code, e.g. for provenance, history, % size-checking, etc. switch purpose case 'appendtimelock' ignore = { 'cfg' 'label' ...
6041af6ef6f67e3170e6bf7e49661b756ab6a20b43a8e5d90fdf4266243a7a1a
MATLAB
3,549
65
%G distribution, AUC ratio comparisons. clear close all clc % Excel_Names_G = ['All_feature_Whole_G_Feb29_Injury2022_Glial_30SB'];% % raw distribution % Excel_Names_S = ['All_feature_Whole_S_Feb29_Injury2022_Neuron_30SB']; % Excel_Names_G = ['All_feature_AUC_G_Feb29_Injury2022_Glial_30SB']; % AUC calibrated for ...
dbaaa48e144c7c3dddf4da2d2b6596a9c1e2585e8151a51eed3d4458ebea9015
MATLAB
3,550
101
function [model, p_lr] = CBIG_ASDf_logReg_clusterBehavAssoc(cluster_idx, id_scoreGrp, ... sub_info_file, behav_score_file, idx_score) % [model, p_lr] = CBIG_ASDf_logReg_clusterBehavAssoc(cluster_idx, id_scoreGrp, % sub_info_file, behav_score_file, idx_score) % % Performs logistic regression to compare ASD participants...
ecb88b3af6b8e6c98fdbdd49746696cb9340cb2736f9b12a21ba33ef5d8b76af
MATLAB
3,550
134
%% SP-ComBat % implement ComBat harmonization at the image level with 3D superpixel parcellation % requirement: MATLAB R2016b and above % original environment for the implementation: % MATLAB R2022a, SPM (v7771), and CAT12 (v12.8.2) pkg_dir = '/path/to/the/pkg_spcombat'; addpath(pkg_dir); %% Preprocessing...
c0dbe4c501f5783175eff237ab9daad969be194b5f00f528ab335bb4db20563a
MATLAB
3,551
110
function X = ttm(X,V,varargin) %TTM Tensor times matrix for ktensor. % % Y = TTM(X,A,N) computes the n-mode product of the ktensor X with a % matrix A; i.e., X x_N A. The integer N specifies the dimension % (or mode) of X along which A should be multiplied. If size(A) = % [J,I], then X must have size(X,N) = I...
0086e3b9aaa0d8ac573dd89e850eedf3a8570c52afc53da84b38306fefb9cdfc
MATLAB
3,552
139
%% %load trnDataSH_Apr18.mat; load trnData20180503.mat %% t = tMain20180503; id = strcat(t.lblCat,'#',numarr2trimcellstr(t.flyID),'#',t.movID); idC = categorical(id); tCats = sortedsummary(idC) idC = reordercats(idC,tCats.cats); %% hFig = figure; cla; ax = createsubplots(2,1); plot(ax(1),tCats.cnts,'.'); grid(ax(1),'o...
67c4dfd13eca5014ca2d6e506f13687634f58dc106f068ae10bb0a35287b2498
MATLAB
3,553
111
% Script for running Enrichment analyses between fc data and behavioral % data. % It is assumed that the fc data is organized as ROI-ROI-Subject and the % behavioral data is a vector with the same order and number of subjects % in the fc array. outputdir = 'filepath to output directory/'; addpath(genpath('filepath to ...
7c2a23fcc604575de6e8141d28b787ee5ad5fb7bd9a889a38ff59e2d49e504e6
MATLAB
3,553
110
function event = presentation_log(filename) % PRESENTATION_LOG reads a NBS Presentation scenario log file and % represents it as a FieldTrip event structure. % % See also FT_READ_EVENT % Copyright (C) 2018 Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentatio...
e120426b52f1a80704ff0fdd1825ef25d9d4e15bc99924707fa02766edc493ef
MATLAB
3,553
87
% Need to test more. % Compute power in a signal along a frequency trajectory. numel(inSig) has % to be equal to numel(freqTrajectory). Options to use both multitaper PSD % (pmtm) or DFT. % If stim_freq_shift is undefined, then stim_freq_shift is set to the % geometric mean of the desired freauency trajectory. functi...
0af24fa665f8d085d2efe7615913ac0eec8a8e0f47b43805838b10c662189591
MATLAB
3,554
87
function [subs,vals,keep] = nonMaxSuprList( subs, vals, radii, ... thresh, maxn, flag) % Applies nonmaximal suppression to a list. % % See nonMaxSupr for more information. Has the same effect as nonMaxSupr % except it operates on a list of position/values pairs. Running time is % n^2 in the number of such pairs. F...
8c2f20a4709c05744e7940ecde5b6a923246a73d4e10b1840d7e80a364d06745
MATLAB
3,554
98
function generateSupportReport() %% Generate the html table describing packages in pmtkSupport % and write it to PMTKlocalSupportPath/docs/authors/packageAuthors.html % You need to commit this modified file in svn. % Creating the report takes a few seconds. % PMTKneedsMatlab %% Setup % This file is from pmtk3.googlec...
fa0d982ab49006cfe33afa8a44736cb3127bb3105920b27c57de63cb7fde50db
MATLAB
3,554
114
%% plot_autocov % % Autocovariance plotting utility % % <matlab:open('plot_autocov.m') code> % %% Syntax % % plot_autocov(G,leg,dt,trange,auto,acorr) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % G matrix of autocovariance matrices % leg ...
2c54113a9537e1bb1f20666d727f170266a9b17b39e076528900c91f8fd4e0cc
MATLAB
3,555
103
%% Start by processing the clusters, aligning them median_W = median(W, 'all'); std_W = std(W,[],'all'); range_max = median_W + 2*std_W; %FIX:consider switching to 3 std dev? log_range = log(range_max); log_max = log(range_max +std_W); for t=1:num_groups cluster_map = zeros(16,64); for k=1:length(good_ch...
7800f1e1c7f7e7627ab77ff93024306b0fb8011715c596894b9e96a9835b5199
MATLAB
3,555
123
%% sdoAnalysis_demo (OOP) % % Demonstration of the SDO Analysis Toolkit; % Run an SDO analysis using the Object-Oriented Programming (OOP) % class-method data wrappers. % % This can be used as a framework for designing custom SDO analysis %_______________________________________ % Copyright (C) 2023 Trevo...
acbdc148f66aa713c2cfc7d830629646b08c30c3d34ac72272bc185d00ce220d
MATLAB
3,555
104
%% Plot 2d sigmoid functions for various values of w1, w2. % i.e. sigmoid(w1*x1 +%w2*x2) %% % This file is from pmtk3.googlecode.com function sigmoidplot2D % Plot sigmoids with these parameters w_1 = [-2 ; -2 ; 0 ; 1 ; 1 ; 2 ; 2 ; 3 ; 5 ; 5]; w_2 = [-1 ; 3 ; 2 ; 4 ; 0 ; 2 ; -2 ; 0 ; 4 ; 1]; lowRes = 0; % Set...
0c9ad672bc4aafec82ccd4578b95db5205c33f827d254ed8dbf3ede4709dc522
MATLAB
3,556
67
function Obj=SOFAconvertFHK2SOFA(miroObj) % OBJ=SOFAconvertFHK2SOFA(miroObj) converts the HRTFs described in miroObj % to SOFA. miroObj is the miro object saved at the Fach-Hochschule Köln % provided by Benjamin Bernschütz. % Reference to the source format: http://www.audiogroup.web.fh-koeln.de/ku100hrir.html % Referen...
3f152f644ea4221304b3c964035c3875d2ce4e74ce616f5723490004ff6dacf6
MATLAB
3,556
159
function [t,F,p,df,R2,cR2,B,r,aR2,iR2,Bcov] = glm(y,X,c,pflag); % [t,F,p,df,R2,cR2,B,r,aR2,iR2,Bcov] = glm(y,X,c,pflag); % % Generic function for General Linear Model (GLM) % Note: assumes error is spherical (residuals white) % Rik Henson, 2004 % % (Note requires Matlab stats toolbox, or SPM functions to be on path) %...
aae04d95fad3727abe2532379a701f5a6c673217f02f2a21c83832ddcb325506
MATLAB
3,556
94
function [grid] = mollify(cfg, grid) % This function does something % % Copyright (c) 2006, Jan-Mathijs Schoffelen & Robert Oostenveld, F.C. Donders Centre % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free software: you can redistribu...
6f2dae255957934f0a96d0918658210a74b02cf5b3fdbaf778dea38548b1c721
MATLAB
3,557
69
%% SAVE MATLAB FILE cd(['F:\DataResearch\' PatientName '\Label']) mri_name = dir(['F:\DataResearch\Brainstorm\' ProtocolName '\anat\CAT\subjectimage*01.mat']); sMRI = load([mri_name.folder '\' mri_name.name]); bs_low = load(['F:\DataResearch\Brainstorm\' ProtocolName '\anat\CAT\tess_cortex_pial_20484V.mat']); bs_headmo...
bb4a3fae5a5cbb4edb9105aa239102b3775a2bd9cea395aa2bdcbf6d629d368f
MATLAB
3,558
164
if ~exist('n_ima'), fprintf(1,'No data to process.\n'); return; end; if n_ima == 0, fprintf(1,'No image data available\n'); return; end; if ~exist('active_images'), active_images = ones(1,n_ima); end; n_act = length(active_images); if n_act < n_ima, active_images = [active_images ones(1,n_ima-n_act...
ea995752ef1fb4d276d9960d636be49b145d7523c404b60c1c7fdb430e7e15be
MATLAB
3,559
115
%% GSA_FAST_GetSi: calculate the FAST sensitivity indices for multi-output systems % 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 o...
20c51ee997bc14b335303f710938ae8b12be46da52e795d8b843ba78c2cb59d7
MATLAB
3,560
122
function s1 = mergeconfig(s1, s2, emptymeaningful) % MERGECONFIG merges the fields of a structure with another structure. The fields of % the 2nd structure are only copied in case they are absent in the 1st structure. % % Use as % s3 = mergeconfig(s1, s2, emptymeaningful) % % See also MERGE_TABLE % Copyright (C) 20...
8e82be31f163ae76c7bea358c62041f4390e02dab643b114d606060974b260e9
MATLAB
3,561
124
function [ IDX,timestamps ] = bz_INTtoIDX(INT,varargin) %[IDX] = bz_INTtoIDX(INT) Converts state on/offsets to vector of indices % %INPUT % INT: {nstates} cell array of [nintervals x 2] start and end times. % (optional) can be TSObject intervalSet % -or- % structure with f...
7ba26bd7e6d0d984d9ee9add46ff59bd534488b520decdb16406487d6afc0a95
MATLAB
3,562
98
%----------------------------------------------------------------------------------------- % Example raster plot of a human piriform neuron responding to odors % % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Figure 1g % Author: Marcel Kehl % License: MIT License %---------...
b0ee76005681bc32e9f4fe8bf3767b41477fbbab2ac58e583c9c9e83b2be2fda
MATLAB
3,563
90
%% SAT - app_input :: %% determineXtFileType % Name: Phone Kyaw % Date: 09/19/2024 % Description: Return a xt_cell when a user inputs XT files % Parameter: None % Return Value: xt_cell - Nx2 cell array where the {1,1} contains the header % and the second column contains xt...
c6d0438e1da2c840b2364bcbeb867121945810cf043c2ec632edd1a9489db723
MATLAB
3,563
80
ind = 1; data = dir('/DATAPOOL/ERRORMONITORING/SEM_mri_data/P*'); %% for i = 1:size(data,1) data_func = dir([data(i).folder, '/', data(i).name, '/mri/SEM_', data(i).name, '/nifti/func/run*']); fprintf(data(i).name); dir_folder = [data(i).folder, '/', data(i).name, '/mri/SEM_', data(i).name, '/...
1a25737ea159e09f46a621ed059b238f3088fa8df00f0cfe3da8a268395a66bc
MATLAB
3,564
93
function [ simulated_data] = makeSimulatedRound(num_puncta,bases,cross_talk,puncta_positions,puncta_sizes,puncta_variability,outputDims) %MAKESIMULATEDROUND % num_puncta: how many puncta are going into this volume? % bases: what base is each puncta showing % cross_talk: what percentage of each signal is in each round...
2d00b979c1d6f388d0389dd2dcfb9fff6c12aec444b686a9f1c1495f340c334d
MATLAB
3,564
95
% Source-target evaluations on the unit cube, Helmholtz kernel. % % This is basically the same as MV_CUBE1 but using the Helmholtz kernel. The % associated matrix is rectangular and complex. % % Inputs (defaults are used if not provided or set empty): % % - M: number of row points (default: M = 16384) % - N: number...
2ee62afe5ad654e3e76644543393704864c160eed39db11f74d8ae05bff7c0a4
MATLAB
3,566
123
medA = load(fullfile(saveLoc, 'for_plots_mediation_norm_to_se')); mediatedDimsA = [52 19 27]; dimTin = 27;% ramp, PC1, Tin ('for_plots_mediation_norm_to_se') tt = medA.leverage(medD).per_session.self_mediated.tt; tpt = find(round(tt, 3) == 0.40); allMed = []; allP = []; for medD = mediatedDimsA ...
22a09a7aae20775d514fc87e632e5702433c15a6530350af541046035abca517
MATLAB
3,567
148
%% Compare SMLR selecting lambda on grid or on path. % If path, we use the same kernel basis for all lambda % If grid, we change the basis depending on the fold. % % See also linearKernelDemo % This file is from pmtk3.googlecode.com %PMTKslow % Results: rows = soy, colon % cols = 'smlrPath', 'smlrNoPath', 'rmlrPat...
9c78ad5253e3806ba0169eb5b2d5569e2bb82b4095e71abf2645f8fd5d4f16c9
MATLAB
3,567
103
function [b,idx,outliers] = deleteoutliers(a,alpha,rep); % [B, IDX, OUTLIERS] = DELETEOUTLIERS(A, ALPHA, REP) % % For input vector A, returns a vector B with outliers (at the significance % level alpha) removed. Also, optional output argument idx returns the % indices in A of outlier values. Optional output argume...
d994663ef89370696a196892dff34f0d449a6c8a918e8304efb62471a86116fa
MATLAB
3,567
119
function vol = read_asa_vol(fn) % READ_ASA_VOL reads an ASA volume conductor file % % all data is converted to the following units % vertices mm % conductivities S/m % Copyright (C) 2002, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and...