sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
800a4d733853749b9e377f2c232d0d84c3672b6510c73024d4ddb7ec19ac5935
MATLAB
5,746
150
%% Figure 5c clear morph_path = '/oak/stanford/groups/kalanit/biac2/kgs/projects/babybrains/mri/code/morphology_allparameters/'; addpath(morph_path) cd(morph_path) set_participant_information hemi = 'rh'; R1_data=[]; CU_data=[]; SD_data=[]; CT_data=[]; ALL_profiles_SD = []; ALL_profiles_CT = []; ALL_profiles_CU = [];...
d77afe0150d30d4879e5c74ac84e89f64914b395c65f8e906d9296a43c175020
MATLAB
5,747
135
%{ stack.StackMotion (imported) # motion correction -> stack.StackInfo ----- raw_motion_xy : longblob # (pixels) y,x motion correction offsets motion_xy : longblob # (pixels) y,x motion correction offsets after detrending %} classdef StackMotion...
b392a0d62c9154dae3f9e6deb4c47fc5097fe148e96451948f9f651aec2c9d96
MATLAB
5,751
119
function plot_RNN_recurrent_synaptic_weights close all clear all clc % Plot RNN recurrent synaptic weights. % Select a folder containing data. folder_name = uigetdir; cd(folder_name) load('RNN_recurrent_synaptic_weights.mat'); % Get mean of absolute recurrent weight matrices for control RNNs. control_weights_mean =...
7b0887034de5d8e2ab053b09ddc728991765c282194385b11d1eeef09d5e7ab1
MATLAB
5,752
197
%% Linlin Data close all clear all filename = 'C:\Users\Harnettlab\OneDrive\Desktop\Voltage_Data\Sq_camera.bin'; nrow = 96; ncol = 200; mov = readBinMov(filename, nrow, ncol); figure(100); imshow(imadjust(uint16(mean(mov(:, :, 1:100), 3)))); rois = load('C:\Users\Harnettlab\OneDrive\Desktop\Voltage_Data\ROI.mat'); ro...
33b9d035849d3a8f9906fd99188d1d95fe8db2b465b1456010e7988e4205d709
MATLAB
5,755
152
function colors = distinguishable_colors(n_colors,bg,func) % DISTINGUISHABLE_COLORS: pick colors that are maximally perceptually distinct % % When plotting a set of lines, you may want to distinguish them by color. % By default, Matlab chooses a small set of colors and cycles among them, % and so if you have more than ...
80d20078881a778c00fb1d33da7035804fe9690bab7709bd647d690ffb3809c0
MATLAB
5,755
144
%% get_set_TotalField_ROMEO(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should ...
c943204175f867a71658d3a8ff08d334b4ecf2b24b860dca81aac9bcc71d257c
MATLAB
5,757
145
%% Parameter % Distance threshold distTh = 90 % nm % Synapse filters LowerThSynSigma_nm_ = 80; UpperThSynSigma_nm_ = 800; LowerThSynIntensity_photon_ = 200; input_folder =uigetdir() %% Analysis based on Thunderstorm output mutant = []; exp = []; ratio75 = [] at180 =[] syn = [] folder = input_fol...
9b4d45c6b0a374433bb3b880cd40f04da57dc2371f29c7e5c1d4cc03e0835cdd
MATLAB
5,759
158
function plotPCA(a,b,c,d, chanlocs, i12, i16,i21, coeff,lambda, outputFolder) toi = linspace(-1, 1,size(a{1},2)); a = cat(4, a{:}); b = cat(4, b{:}); c = cat(4, c{:}); A = [a;b;c]; corr = find(contains(d(1).alignements, 'FIC')); incorr = find(contains(d(1).alignements, 'FIW')); ...
a93774c835b0300055f126445d0ee4f88e8dcaecd5fd429fd244d0ce1cf86379
MATLAB
5,759
143
%FIX_LINES Improves the line style of eps files generated by print % % Examples: % fix_lines fname % fix_lines fname fname2 % fstrm_out = fixlines(fstrm_in) % % This function improves the style of lines in eps files generated by % MATLAB's print function, making them more similar to those seen on % screen. Grid ...
7f775e876d47152b59ddcd8fa7b9da29d0969eb0296f59e7741ac2c3344a83b0
MATLAB
5,761
202
function ARTwarp_cli_builder() % This file creates the CLI command based on the input parameters. % --- Required inputs (enforced) --- % Input folder while true % strtrim to ensure there are no leading or trailing spaces. inputFolder = strtrim(input('Enter input folder name: ', 's')); if ~isempty(inputFol...
f7daf23f4d559e604d6922ba9a7904eaa1961b3c0bd24f5ee0da3ead3cc784d7
MATLAB
5,761
145
% EEG_MATCHCHANS - find closest channels in a larger EEGLAB chanlocs structure % to channels in a smaller chanlocs structure % Usage: % >> [selchans,distances,selocs] = eeg_matchchans(BIGlocs,smalllocs,'noplot'); % Inputs: % BIGlocs - larger (or equal-sized) EEG.chanlocs structure ...
610f098af9568e3969c44a0ae0f190fa28fabd94987d3c8bdd5e84b67e079759
MATLAB
5,764
179
function biomk = extractBiomarkers2(window) % Computes Ca-transient biomarkers % minCa, maxCa, CaT_Duration (CTD10), CTD80, % RT10topeak, RT1050, RT1090, DT9010, Rate_Cai (Hz) % % Inputs (required fields in 'window'): % window.Time : time in ms % window.Cai : Ca concentration (mM) % % Output (struct): % bio...
0bf53d3c7f41d825c6b3a57a9d469a72127dadad373f08796df2ac530c997621
MATLAB
5,765
143
function newFileName = TS_FilterData(whatData,ts_keepIDs,op_keepIDs,newFileName) % TS_FilterData Filters data in the hctsa data file, and saves to a new file % % Can use TS_GetIDs to search keywords in hctsa data structures to get IDs % matching keyword constraints, and use them to input into this function to % genera...
f810856bd2674bbde25be374f0b49671a06f80e61e71b3bdaeef1212a2ea4109
MATLAB
5,769
191
function varargout = physionet_hea(filename, hdr, begsample, endsample, chanindx) % PHYSIONET_HEA reads data from PhysioNet .hea and .dat files % % Use as % hdr = motion_c3d(filename); % dat = motion_c3d(filename, hdr, begsample, endsample, chanindx); % evt = motion_c3d(filename, hdr); % % This is for data hoste...
76cb0f64145b29e39b8cd661e6840bc7e198d68a6db3666cf362c8b1c7d94240
MATLAB
5,770
135
function ok = compile_ripser() % compile_ripser Compiles and installs the ripser persistent-homology tool. % % This script must be run in the Toolboxes directory (same requirement as % compile_mex.m, which calls this as part of its own build sequence). % % Split out from compile_mex.m into its own function so that, i...
e422e9b861c14ab28020cf34748bc8dcff48e1e0908208fdc30788cd8ade0927
MATLAB
5,774
142
function out = DN_FitKernelSmooth(x, varargin) % DN_FitKernelSmooth Statistics of a kernel-smoothed distribution of the data. % % ---INPUTS: % x, the input data vector % <can also produce additional outputs with the following optional settings> % [opt] 'numcross': number of times the distribution crosses the given t...
0006d6f15c382b004ecbed481b3428473ec97e4809bff050c8ad2e519b6aa28e
MATLAB
5,778
126
%% Load data data_path = 'Y:\Alice\0012_NeuroGI\NeuroGI_ephys_data\2024-11_all_ex-vivo_experiments\20241119_ExVivo-12\'; load([data_path 'datafile0024.mat'], 'data') %% Preprocess data reorder = (1:32:64)' + (0:31); reorder = reorder(:); y = single(data(2200001:4600000, :)); % get middle 10 minutes y =...
46decf17b7c9d54e18fab96e91c59c68806645532ff828ad6f00b60830b593aa
MATLAB
5,782
135
% =============== parameters section =============== % Required args: % out: output file prefix % pheno: file with phenotyes % bfile: plink bfile prefix if ~exist('out', 'var'), error('out file prefix is required'); end if ~exist('pheno', 'var'), error('pheno file is required'); end if ~exist('bfil...
3eaa22d6801ccbc811659d1baef93c0401c48c1669f2dfeeb1cff9bef326e336
MATLAB
5,783
124
function chGroups = ch2roi_getSelChnls(params, subjTag) % returns selected channels for subjTag % based in criteria in params.connectivity.selectedChnls, where: % - params.connectivity.selectedChnls{nn,1} = brainAtlas (e.g., 'Yeo7', 'Yeo17', 'Mars', ...) % - params.connectivity.selectedChnls{nn,2} = aaName (e.g., 'D...
0d7a9d06b92301ec9b1af56d7cd330d96b5d646d12023eea0f33a05afaa08b3a
MATLAB
5,785
151
% STD_SUBSTUDY - create a sub-STUDY set by removing datasets, conditions, groups, or % subjects. % Usage: % >> [ STUDY ALLEEG ] = std_substudy(STUDY, ALLEEG, 'key', 'val', ...); % % Optional Inputs: % STUDY - existing study structure. % ALLEEG - vector of EEG data...
711069a5c194e85d733a7bb3ed665a6aaf437a06124f4d545a2a71c2d98f5279
MATLAB
5,787
143
function [C2,cfg] = mahal_twoclass_trialwise(dat,labels,cfg) % [C2,cfg] = mahal_twoclass_trialwise(dat,labels,cfg) % authors: M Stokes, E Spaak, N Myers if nargin < 2 help mahal_twoclass_trialwise error('missing input arguments!') end ntrl = size(dat,1); % number of timepoints nsens =...
e12d3bdcf2f6b7301221649346643faa883ba2ce762a264e7faa37c9afbecc98
MATLAB
5,787
90
function aaName = getLargerAnatomicalArea(ass_cytarch, mode) % based on the cytoarchitectonic assignment 'ass_cytarch' by SPM Anatomy toolbox, % returns larger anatomical structure 'aaName'. % Useful for getting more channels into anatomical areas. % (c) Jiri, May17 % current version of SPM Anatomy toolbox: 22c or 18 ...
ade0cb494496a0396013a453abb23fbfd530e580da32e61e67cc9e03f51fe97c
MATLAB
5,790
100
% eegplugin_dipfit() - DIPFIT is the dipole fitting Matlab Toolbox of % Robert Oostenveld and Arnaud Delorme % % Usage: % >> eegplugin_dipfit(fig, trystrs, catchstrs); % % Inputs: % fig - [integer] eeglab figure. % trystrs - [struct] "try" strings for menu callbacks. % catchstrs ...
40ca1b6bb04222e0f2c4f594f442c37afbb269103a5e9d2ffcc43b6758fecbd5
MATLAB
5,791
177
function PhilipsDeIdentify(fnames) % PhilipsDeIdentify % Reads Philips SPAR files and removes participant information. Newly % de-identified SPAR files are then output, with filenames appended with % '_noID'. The original files are not overwritten. % % PhilipsDeIdentify will also create copies of the SDAT files...
b611c707147bfc2fc0876db92c2fdcbfcf7b6df72a994de411896e399fdbc084
MATLAB
5,797
160
function out = ST_MomentCorr(x, windowLength, wOverlap, mom1, mom2, whatTransform) % ST_MomentCorr Correlations between simple statistics in local windows of a time series. % % The idea to implement this was that of Prof. Nick S. Jones (Imperial College London). % % ---INPUTS: % x, the input time series % % windowLen...
5c854b656d68b74e9c33d115ae84ad9a5739941f1cb6492cdd6b6ce76c9b81a7
MATLAB
5,799
168
function grad = getGradient(problem, x, storedb, key) % Computes the gradient of the cost function at x. % % function grad = getGradient(problem, x) % function grad = getGradient(problem, x, storedb) % function grad = getGradient(problem, x, storedb, key) % % Returns the gradient at x of the cost function described in ...
b169a73ab24e52ea0cb8017247067c5ec3f30e54824d3099a7688bb95c22013f
MATLAB
5,800
167
function slowWaveDetection(basename,varargin) %Vyazpvskiy et al., Tononi, 2007 Sleep, %Vyazpvskiy et al., Tononi, 2009 Neuron % band pass at 0.5-4Hz (stopband edge 0.1-10 Hz,Chebyshev Type II) % Slow waves were detected as positive deflections between 2 consecutive negative deflections below the zero-crossing separated...
0d658b7be70f8af8f2b05ad291671a87ff061aff9323b7aba31aaea8e9deb7fa
MATLAB
5,802
116
function RNN_variable = get_example_choice_mode_activity_RNN close all clear all clc % Extract RNN variables. % Select a folder containing data. folder_name = uigetdir; cd(folder_name) load('example_RNN.mat'); % Control. L = example_RNN.example_distractor_2_5_no_ablation_control.L; L_pos = example_RNN.example_distr...
bfe43235c942434a0205241ad483b8a3a13790c8ae7a152c73b1bda310d2d5e1
MATLAB
5,804
181
function [ccg,x,y] = ShortTimeCCG(times1,times2,varargin) %ShortTimeCCG - Time-varying auto/cross-correlograms of point processes. % % Determine how xcorrelograms vary in time, i.e. repeatedly compute xcorrelogram % over successive short time windows. % % USAGE % % [ccg,bins,time] = ShortTimeCCG(times1,times2,<opt...
f6aae85367fdcb48c1a0107a5a857f36f84ea93dbb3db5f0d55a30503e690124
MATLAB
5,808
151
% createTextures - Generate stimuli for acquiring pSFT % Generates a set of bandpass filtered noise textures for a given image size and ppd. % % Syntax % [textures, filters] = createTextures(diameter_px, contrast, noise_filter_count, noise_sample_count, ppd, save_textures, texture_filepath) % % Input Arguments % ...
1056c42894f914f039977b06506943359bb429766b3479be871a3277e739303a
MATLAB
5,810
113
% Database and batch processing functions for FMAToolbox. % % These functions can be used to perform batch data processing and store data % and figures into one or more databases. % % Batch Processing % % Batch processing is useful if you need to repeatedly perform a given analysis % on different data sets. This can be...
ea4618308c6644b52cb41891df91859b30c33a5086eb031147b9c6cdb03e7785
MATLAB
5,813
159
function out = IN_AutoMutualInfoStats(y, maxTau, estMethod, extraParam) % IN_AutoMutualInfoStats Statistics on automutual information function % of a time series. % % ---INPUTS: % y, column vector of time series data % % maxTau, maximal time delay % % estMethod, extraParam -- cf. inputs to IN_A...
8cf1db6b193f7631cc803c320f8ee8c7fc8e458a3095651643c87ce373d13bdb
MATLAB
5,814
163
function plotPolarHist2axes_realVals(ampPhiBins, plotInfo) % plots the tuning bins in: ampPhiBins [ampBin x phiBin] of real values % into polar histogram, axes position spec. in 'plotInfo' % (c) Jiri, Mar12 %% plot colorbar if plotInfo.colorbar % vals nCols = 2; nRows = 359; ...aRes = 1/nCols; aVe...
de49b65219c414175da65b810e3da6659319c4a58022cefdfb55ee4542076f2f
MATLAB
5,814
137
%io_writerda.m %Georg Oeltzschner, Johns Hopkins University 2019. % % USAGE: % RF=io_writerda(in,outfile); % % DESCRIPTION: % Takes MRS jeader data in matlab structure format and writes it to a pair % of Siemens RDA files that can be read by LCModel, jMRUI etc. % % The written RDA file header information will be enti...
7eace6b56b835411c94246da5919073b11745bebe698303fd8cc880e518dce36
MATLAB
5,815
179
function [varargout] = maus_textgrid(filename, hdr, begsample, endsample, chanindx) % MAUS_TEXTGRID reads speech segments from a file that has been processed with MAUS % see https://clarin.phonetik.uni-muenchen.de/BASWebServices % % Use as % hdr = maus_textgrid(filename); % dat = maus_textgrid(filename, hdr, begsa...
37690c799c7f8f20b363a2d6b6a8e26cd67eae17ec9c746491530fc2b4cff2cd
MATLAB
5,817
143
function out = SY_LocalDistributions(y, numSegs, eachOrPar, numPoints) % SY_LocalDistributions Compares the distribution in consecutive time-series segments % % Returns the sum of differences between each kernel-smoothed distributions % % ---INPUTS: % % y, the input time series % % numSegs, the number of segments to b...
5a71ae00c180edeec317e32438b39ef42374f4d789d62367aade2df118d80c42
MATLAB
5,820
140
% Main script for computing group-mean fsaverage surface maps of % fraction-weighted laminar SANDI metrics for supragranular and % infragranular layers across subjects % % Reference: % Lee H, ..., Huang S, Communications Biology, 2026 % % Requirements: % - FreeSurfer installed and configured % - Subject-specific SANDI ...
74df90c32b14fa5fc798bd66b3e674907b574ef63c02adf0ec3bd08263426732
MATLAB
5,820
130
%% h = sepia_handle_panel_qsm_MEDI(hParent,h,position) % % Input % -------------- % hParent : parent handle of this panel % h : global structure contains all handles % position : position of this panel % % Output % -------------- % h : global structure contains all new and other handl...
e333396166950af916f5f6287d55d336e6e3d0780af0079c36281e1e4807907d
MATLAB
5,821
173
% COMPPLOT - plot a data epoch and maps its scalp topography at a given time % % Usage: To plot the projection of an ICA component onto the scalp % >> projdata = icaproj(data,weights,compindex); % % then >> compplot(projdata); % % else to plot an EEG epoch with a topoplot at one selected time point % >>...
599d3a9631d887a3f1465580808d0dfb988697a9a794fac2e1f3e71d2049ffb4
MATLAB
5,824
150
% BIOSIG2EEGLABEVENT - convert biosig events to EEGLAB event structure % % Usage: % >> eeglabevent = biosig2eeglabevent( biosigevent, interval) % % Inputs: % biosigevent - BioSig event structure % interval - Period to extract events for, in frames. % Default [] is all. % % Outputs: % ...
d7c85ff314524d39486d2367c6c8a248ab92bb6cd0242d2cef886799ccb899d1
MATLAB
5,824
183
function [msi] = read_bti_m4d(filename) % READ_BTI_M4D % % Use as % msi = read_bti_m4d(filename) % Copyright (C) 2007, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free software: you can redistribute it and/or modi...
751bdb6e426a98045a965a43dc56006bc44eaabb57aa26f2c2af30acede14efd
MATLAB
5,829
157
% genStimCalcResp.m - wrapper function for generating a set of grating stimuli and calculating a set of RF responses to generated stimuli function [responseP1, responseP2, complex_response] = genStimCalcRespBar(stimParams,rfParams,rfsP1,rfsP2,stimOriIdx,stimLocIdx,splitByColumns) if ~exist('splitByColumns','var'); sp...
450a17e599e22c52869fcc597b76fb7678c5892de46d277bffa15b0caf7c5b43
MATLAB
5,838
157
function [stepsize, newx, newkey, lsstats] = ... linesearch_adaptive(problem, x, d, f0, df0, options, storedb, key) % Adaptive line search algorithm (step size selection) for descent methods. % % function [stepsize, newx, newkey, lsstats] = % linesearch_adaptive(problem, x, d, f0, df0, options, storedb, key) ...
834e2453e04825525bf433734da0cdacd5697686cd82c7e46d09dd1ab5ae2f89
MATLAB
5,839
205
%% MMX - Multithreaded matrix operations on N-D matrices % mmx treats an N-D matrix of double precision values as a set of pages % of 2D matrices, and performs various matrix operations on those pages. % mmx uses multithreading over the higher dimensions to achieve good % performance. Full singleton expansion is ava...
b9d3602f986ca20aabf220695f2a77cd315b7f6372fb44fc9693c38c84bdca2f
MATLAB
5,840
135
%%% 提取指定路径下Control ROI下的RSA分析结果,当前为提取CA层的结果,计算了是否控制featureRDM的两部分结果,结果已经过**FisherZ**转换 clear;clc; addpath(genpath('/data0/user/lxguo/Downloads/DPABI_V8.1_240101')); addpath(genpath('/data0/user/lxguo/Downloads/REST_V1.8_130615')); addpath('/data0/user/lxguo/Downloads/spm'); load("./featureRDM.mat"); addpath...
fa9ab4de79416bf3157e6635b0bf09b8e4730002b1e702b38ea921698511a320
MATLAB
5,847
145
function [ModelOutput] = fit_OspreyParamsToModel_nophase(inputData, inputSettings, fitParams) % This function applies a set of LCModel fit parameters to a basis set of % metabolite basis functions, and a set of cubic baseline spline basis % functions. % % The function returns the complete fit, the baseline, the...
7635a12c6f6eacc21b6de05e70dc66f609a531d0408daacda1e92fc605ae70e6
MATLAB
5,848
181
clc; clear; addpath('C:\work\code\download\freesurfer\matlab'); addpath('C:\work\code\download\cifti-matlab-master'); % load brain atlas num_roi = 400; num_roi_str = num2str(num_roi); atlas_file = ['C:\Users\lihon\Desktop\abcd_study\atlas\Schaefer2018_', num_roi_str, 'Parcels_17Networks_order.dlabel.nii']; atlas_ci...
c0f829de729685e56ba23715c097905cd6ffd24e83f11e7f1a09eac8691ef19c
MATLAB
5,848
137
function [ recoveredLocData ] = recoverLocData( originalLocData, X_RANGE, Y_RANGE ) % tracking loss·Î ÀÎÇÑ µ¥ÀÌÅÍ ¼Õ½Ç ºÎºÐÀ» ÁÖº¯ µ¥ÀÌÅ͸¦ Åä´ë·Î ÃßÃøÇØ¼­ À籸¼º. % ÇöÀç »ìÆìº» ¹Ù¿¡ µû¸£¸é trackingÀÌ ²÷±â´Â °æ¿ì X µ¥ÀÌÅÍ´Â -1, Y µ¥ÀÌÅÍ´Â 481ÀÇ °ªÀ» ÃëÇÏ°Ô µÈ´Ù. % ÀÌ·¯ÇÑ °ªÀÌ Áß°£¿¡ µîÀåÇÏ°Ô µÇ¸é ±× ÀüÈÄ µ¥ÀÌÅ͸¦ Åä´ë·...
bd87996946c0c66052b4949c52be2c7ed9692c40d88fd60299668e48201047f8
MATLAB
5,852
131
function [data] = iEEG_func_generate_noise(fsetup) %% ######################################################################## % - [data] = iEEG_func_generate_noise(fsetup) % ######################################################################### % ...
ec1b5475e008bfd246fdf8a6efe41b9ba7d56fd9340c935c4adc66fb831ab4e2
MATLAB
5,854
140
function OutputToCSV(whatData,writeTimeSeriesData,writeMasterFeatures) % OutputToCSV Outputs data to csv for external analysis % %---INPUTS: % whatData, which hctsa .mat file to use (default: HCTSA.mat) % writeTimeSeriesData, (logical)[false] whether to also output time-series data to file % writeMasterFeatures, (l...
e81cc6d572468bf44bb7f29628268b4f28cbc8af144880531626629ba088cf17
MATLAB
5,859
160
function [response,stimParams,rfParams] = simulateBarStimuli(barOrientation,barType,boundType,stimParams,rfParams) pixSize = 1200; % set stimulus parameters if ieNotDefined('stimParams') % defaults if not user-specified stimParams.size = pixSize; stimParams.barWidth = 2; % in degrees stimParams.stepSiz...
2078d4a2ac9e9c9ab78ce8b23f4ad2189b4333a3bbb9480c135f2a17e70d577f
MATLAB
5,863
160
% Compute rivalry onset data % % From the condition logfile of the binocular rivalry paradigm, onsets and % durations for the following GLM analysis are computed. Onsets are split % into rest, left eye, right eye or piecemeal periods. Double button % presses are defined as same button presses falling within a defined ...
9bcf50a0d6dd56fdca0eb552dcbcbe2d377fb8b60023a02a103b1e764444e6a4
MATLAB
5,864
92
function [ons,dur,tr_names,values,missing_onsets] = onsetMaker(fname,startISI) % Analysis script for Responsibility_fMRI % rearranges the onsets of the important events of the fMRI experiment into % a cell array according to their distinctive trial types % Number of Trial types: 19 figFlag = 0; load(fname); % define...
745ab0feaebdf8a51cab2de45c0218ddacd6eb8fac696adbc95f905f4cf83669
MATLAB
5,865
154
function [eta, Heta, hesscalls, stop_str, stats] = arc_gradient_descent(problem, x, grad, gradnorm, sigma, options, storedb, key) % Subproblem solver for ARC based on gradient descent. % % [eta, Heta, hesscalls, stop_str, stats] = % arc_gradient_descent(problem, x, grad, gradnorm, sigma, options, storedb, key) % %...
be4b1d49e5af34678979d50c96a1ea9b466169e30fc423441cfd2e9df3eddb24
MATLAB
5,865
121
function [ripplepeaks, rippletrough, sharptransient] = iEEG_ripplechar(data,locs,maxsamples) %% ######################################################################## % - [ripplepeaks, rippletrough, sharptransient] = iEEG_ripplechar(data,locs, maxsamples) % ##############################...
2f9d6efd02ca813f91a0a28efc551c75b04844af2626f76f6800e42dffb9fd57
MATLAB
5,868
139
% Matlab script to export to BIDS % This is a simple example to export the tutorial EEGLAB dataset % You can run this example and checks that the data passes the BIDS % validator, then modify it for your own purpose % % Arnaud Delorme - Oct 2021 data = []; p =fileparts(which('eeglab')); data(end+1).file = { fullfile(...
a8b0967fae8462428bf9787bf918a52eb699b3f6a03a27c6dbf35fedbab33a5e
MATLAB
5,870
166
function output = rtClassifier(data, config) % Params nFolds = 1; nPartitions = 5; % PCA neural data, keep top 10 PCs [data, ~, ~] = pca4Regression(data, 10, 0, 0); % Average data over -100 to -10 and 10 to 100 ms preBins = ismember(config.tPts, -100:10); postBins = ismember(config.tPts, 10:100); for tr = 1:length(d...
0307c42e6047602aa58dd1f6da87e617e84dc2cae2aab04be34280ce73ecb6bb
MATLAB
5,873
162
function [occupancy] = SimulationFunction(params) %SimulationFunction Performs a stochastic simulation of cell %migration/proliferation in a brain with both white matter tracts and blood %vessels. % @params: params(1) = Pm (migration) % params(2) = Pp_base (proliferation) % params...
cc3d594a08d96c930f3efed1f2ba6fca9a9caa5e116affe5ace6be62b3f65173
MATLAB
5,873
115
function [datac,datafit,Amps,freqs]=rmlinesmovingwinc(data,movingwin,tau,params,p,plt,f0,fscanbw) % fits significant sine waves to data (continuous data) using overlapping windows. % % Usage: [datac,datafit]=rmlinesmovingwinc(data,movingwin,tau,params,p,plt) % % Inputs: % Note that units of Fs, fpass have to be cons...
790c564789965c563d6ac74fc5287ddb3c438873bbb86a23f55278dec7bdfc32
MATLAB
5,874
157
%%%%%% THIS IS JUST VERY SIMILAR TO PLACES, should write more general code setenv('SUBJECTS_DIR','/home/surly-raid4/kendrick-data/nsd/nsddata/freesurfer'); %% %%%%% transfer all current ROIs to fsaverage files = {'floc-bodies'}; hemis = {'lh' 'rh'}; vals = zeros(163842,2,8,1); % V x hemis x 8 x quantities for f...
5fbb0e6f6ee613825666993065fa109d938861495b38f456b118046d6b07f709
MATLAB
5,875
187
function sR=icassoProjection(sR, method, varargin) %function sR=icassoProjection(sR,[method],['identifier1',val1,'identifier2',val2,...])) % %PURPOSE % %To project points on plane so that Euclidean distances between the %projected points correspond to the similarity matrix between IC %estimates in the Icasso result str...
f063b2e8c24e1b27b3bb3fe6949ad4f67e6dafca2df965982f0106be2674573c
MATLAB
5,884
147
function ITIbyBlock = ITIbyBlock_females(f_ratlist, RatBehaviorData) %Create variables nback = 7; prctile_cutoff = 98; frats = length(f_ratlist); %Create functions block_avg = @(x, blocks) arrayfun(@(y) mean(x(blocks==y), 'omitnan'), 1:3); block_err = @(x, blocks) arrayfun(@(y)... std(x(blocks==y), 'omitnan')./sq...
090c34c5b2fe6dd928a678a851983324f22d9176429fc45d1f02cd606e6b7b2d
MATLAB
5,887
160
function getFet_KS2(baseName,datFile) % Read dat file and generate Fet on each shank. % results will be saved in [analysesdir]/CluFetRes/sessionname.spikefet.sahnk##.mat % Also mean wave forms were calculated and saved in [basicMetaData.Basename,'.waveform.mat']] % % Hiro Miyawaki, @OCU % 2019 June % %% test data % ba...
d170de5f6e202dff27da4540ee323dfd2d18ff8b65aa687c041d0d6285865551
MATLAB
5,887
165
function [R] = McRetroTS(varargin) % McRetroTS calls RetroTS to generate slice based regressors % using respiration and pulse oximetry data. % Compilable function % Non-compiled version example (inside Matlab) : % McRetroTS(Opt.Respfile=resp4444.1D,Opt.Cardfile=card2222.1D,\ % Opt.VolTR=2, Opt.Nslices=34, O...
5703fcb07c81d1d378737f47bfe533ce0db8f349e40157d4a70519dcc4aba6af
MATLAB
5,891
167
function [positions, axesHandles] = divideAxes(varargin) % DIVIDEAXES Divide figure into custom grid of axes with specified spacing % % Syntax: % positions = divideAxes(divX, divY) % positions = divideAxes(divX, divY, bounds) % positions = divideAxes(divX, divY, bounds, sepX, sepY) % [positions, axesHand...
2026fb6ce3f7bab0d4614a7ce891bc8fc9cd0dcfc1cc1c070b89163a8926fbe2
MATLAB
5,894
140
function TOL_fig_muir2004(config,params,dat) % TOL_fig_muir2004, figure of Muir and Taube's (2004) apparatus and design % Figure S9 for: Duvelle and Grieves (2026) Tolman's Sunburst Maze 80 % years on: A meta-analysis reveals poor replicability and little evidence for % shortcutting. European Journal of Neuroscience....
5517a7b4493461d8a5f1158ad4da68847d0a585c40aa322076512289b3fbfe18
MATLAB
5,894
189
% op_addVoxel.m % Helge Zoellner, The Johns Hopkins University 2020. % % USAGE: % out=op_takeVoxel(in1,in2,index); % % DESCRIPTION: % Adds a certain voxel with indices corresponding to the 'index' input % array. For multivoxel it is a single input, for 2D-MRSI a vector with 2 indices % corresponding to the x- and y...
8ce3506d2e9770470e22dfeb47f1d9aecc0a44566faea168f109e53fdf23611b
MATLAB
5,895
109
function Volume=polygon2voxel_double(FacesA,FacesB,FacesC,VerticesX,VerticesY,VerticesZ,VolumeSize,Wrap) Vertices=[VerticesX(:) VerticesY(:) VerticesZ(:)]-1; % List with all vertices coordinates of a face FaceVertices=[Vertices(FacesA,:) Vertices(FacesB,:) Vertices(FacesC,:)]; Volume=false(VolumeSize); Volume=Dr...
57e64c97be47210c9b64538a14ba6edc60172262a7231d7692fbaf8077fe3cad
MATLAB
5,896
152
function res = permutation_expression_null_brain(geneset, expressions, gene_symbols, background) % PERMUTATION_EXPRESSION_NULL_BRAIN(GENESET, EXPRESSIONS, GENE_SYMBOLS) % performs permutation testing to examine in which regions the input gene % set is overexpressed. % % INPUT % geneset -- a cell array of gene symbo...
747ccdef3f8f5d97e9dcd960e4596de69abf75bde61a719198ad1f841a314009
MATLAB
5,902
192
function [ltom, htom, mtol, mtoh, ltom_incong, htom_incong, sems] =... block_dynamics_wt_noNormalization(A, twin, binSize, smoothfactor, ... volType, varargin) %computes the change in raw wait time around each block transition. **Does not include % violation trials**. adapted from block_dynamics_wt_binTrials...
db738ca89538f50592c70c47f8923dc8526876d1944a79a800db24847b96745f
MATLAB
5,902
138
function out = generate_physiological_properties() %GENERATE_PHYSIOLOGICAL_PROPERTIES Build maps, filters, and weights, then save to /data. % Syntax % out = generate_physiological_properties() % % Description % - Adds src/simulation to path and loads network/constants via neuronConstants() % - Generates orientati...
41314f77a41fb25dfab186e8addd88efb1792793ac0e7a19a7b307ab8af3a17e
MATLAB
5,906
168
function [opts, args] = vl_argparse(opts, args, varargin) %VL_ARGPARSE Parse list of parameter-value pairs. % OPTS = VL_ARGPARSE(OPTS, ARGS) updates the structure OPTS based on % the specified parameter-value pairs ARGS={PAR1, VAL1, ... PARN, % VALN}. If a parameter PAR cannot be matched to any of the fields % ...
fba393bfcdb0f0dd0aeab6b302f03853ec8bae8c5cb69a03bc40ec5c5f0c9891
MATLAB
5,907
185
function [ltom, htom, mtol, mtoh, ltom_incong, htom_incong, sems] =... block_dynamics_wt(A, twin, smoothfactor, varargin) %computes the change in z-scored wait time, normalized to mean wait time % for each reward volume around each block transition. cmc 10/19/21. % inputs: A struct % twin = time window t...
f7487997da7ada610df54b15f7ac490aa3a43c3b6ec0faa822f506ae5112c278
MATLAB
5,908
155
function out = MF_CompareAR(y, orders, testHow) % MF_CompareAR Compares model fits of various orders to a time series. % % Uses functions from Matlab's System Identification Toolbox: iddata, arxstruc, % and selstruc % % ---INPUTS: % y, vector of time-series data % orders, a vector of possible model orders % testHow, s...
4092cc526bc3436fa00788748433dd9ad00dfec5d9e24868842ad83d358cfc79
MATLAB
5,910
186
%% ConcatAllBehaviors % Concat all behaviors (HW and Licks) in all sessions basePath = 'E:\Data\Lobster\BehaviorData'; filelist = dir(basePath); sessionPaths = regexp({filelist.name},'^#\S*','match'); sessionPaths = sessionPaths(~cellfun('isempty',sessionPaths)); fprintf('%d sessions detected.\n', numel(sessionPaths)...
ab4b014094ff04e9a5e1df4c8dc86be1413deb7c1ab59a06eee1237fcc421f44
MATLAB
5,913
149
function [maxpar maxind silhAll idxAll]=nodalclusternew(nodalEg_All_Node,Distmetric,Startmethod,numclu,Reptimes,fname); Allpar=[];silhAll=[];idxAll=[]; for i=2:numclu idx=[]; for j=1:1 rmpath('H:\Dpan\Program Files\MATLAB\R2011b\toolbox\stats\'); rmpath('H:\Dpan\Program Files\MATLAB\R2011b\toolbox\stats\s...
5d74e65d4ad93252b4062ab66b2e2edbbe492bc3fc65cb754d26ffbc8172cb02
MATLAB
5,919
128
function sched = hlp_beginschedule(tasks,varargin) % Begin the scheduling of some set of tasks across a pool of (possibly remote) workers. % Id = hlp_beginschedule(Tasks,Options...) % % Returns a scheduler handle to wait for and obtain results upon completion. % % In: % Tasks : cell array of tasks; each cell can be f...
87390713d8e3d87812e2344dd6398ff49e49a7a6168b61a41f8320f1c4065cff
MATLAB
5,920
169
% Use like: h = rm_raincloud(data, colours, plot_top_to_bottom, density_type, bandwidth) % Where 'data' is an M x N cell array of N data series and M measurements % And 'colours' is an N x 3 array defining the colour to plot each data series % plot_top_to_bottom: Default plots left-to-right, set to 1 to rotate. % densi...
5dfe8c0451cf48e93d7a09a44855a0982aff28b28e4d31fdeaf0a78018515406
MATLAB
5,921
148
function start_segmentation(input_img, T2_optional) % % Input: input_img <string> fullpath to T1 MRI image to be segmented % T2_optional <string> fullpath to T2 weighted MRI image. % Supports SPM during segmentation. % % This function calls step-by-step the full s...
6a69d8b4e5059428729eda92d35766c44543c36bb0b18a447ed8526738d6f490
MATLAB
5,921
151
function deltaWaves = DetectDeltaWaves(channel,spikes,doSave,opt) %DetectDeltaWaves - Detect cortical delta waves from LFP and refine selection using local spiking activity. % % Detects delta waves (1–6 Hz) from LFP signals by: % 1) Extracting LFP from the specified channel (GetLFP) % 2) Cleaning the sign...
c6c83cea563d5187ca90b72a4656a12f24d245e9efc76ae9bc3d174afe95d22d
MATLAB
5,923
72
function [matlabbatch] = batch_anat_job(path_anat, filter) selector = strcat({'File Selector (Batch Mode): Selected Files'}, {' '}, {'('}, filter, {')'}); matlabbatch{1}.cfg_basicio.file_dir.file_ops.file_fplist.dir = {path_anat}; matlabbatch{1}.cfg_basicio.file_dir.file_ops.file_fplist.filter = strcat('^', filter); ...
fe59a787da960c598b7ffa55ba3cf27a890f2a1140d1889913bbf2a3d9e93d5c
MATLAB
5,924
116
%% get_set_qsm_Chi_separation(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input shoul...
7ec0f62d7ae6d8b0bc548a8cf7129ec06296351090dd9bca7e71ba22c3c21b67
MATLAB
5,925
191
function [Iq,in_avg,ext_avg,in_min,ext_max]=icassoStability(sR,L,graphmode) %function Iq=icassoStability(sR,L,graphmode) % %PURPOSE % %To compute and/or plot the stability (quality) indices of the ICA %estimate-clusters. % % Iq=avg(intra-cluster similarity) - avg(extra-cluster similarity) % %See publication Himberg et...
a0072d0cdb3cda28001f710a7b1f550b4bad7688f3cf8052e575138a907b36c3
MATLAB
5,930
69
function contrasts = calc_contrasts_level1_controlled(condition_names) contrasts = cell(1, 28); contrasts{1}.tcon.name = 'attend_animal'; contrasts{1}.tcon.weights = contains(condition_names, "animal"...
458c1334291569e3f04322acb9d98197d7868bb0453452b30acbb6bc4387e18c
MATLAB
5,932
190
function [X,Zf] = filter_fast(B,A,X,Zi,dim) % Like filter(), but faster when both the filter and the signal are long. % [Y,Zf] = filter_fast(B,A,X,Zi,Dim) % % Uses FFT convolution. The function is faster than filter when approx. length(B)>256 and % size(X,Dim)>1024, otherwise slower (due size-testing overhead). % % See...
8edb569dafc6ea8ac93328cff31208bd4c07f18977b2a9d3efa0c7ed3d16073f
MATLAB
5,932
195
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Setup %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % What I need to do - convolve each person's task timeseries with the HRF. % I can read in each peron's EV text file, make a boxcar function with it, % convolve i % t with the HRF,...
cc8a95b8091bd698ffd022c0b42466913773dcab95f9fd1affabcf4097be2de7
MATLAB
5,932
124
function out = SP_SinusoidFit(y, model) % SP_SinusoidFit Fit sinusoids or a Fourier series to the time series. % % Fits a sum of 1-3 sinusoids, or a Fourier series with 1-3 terms, to the time % series y as a function of its time index t = 1:N (the values are fitted in the % order in which they occur, so the result dep...
de43d3153cbd078a2025a5784184044ff6364ea4fdb1d3bf05e8231a35581e57
MATLAB
5,937
210
function [merged unused] = tapas_physio_propval(propvals, defaults, varargin) % Create a structure combining property-value pairs with default values. % % [MERGED UNUSED] = PROPVAL(PROPVALS, DEFAULTS, ...) % % Given a cell array or structure of property-value pairs % (i.e. from VARARGIN or a structure of parameters), ...
42907243867f2a1baf4135ba02be41cbf34db1005a5056d3d46ba8bf69ca2b0c
MATLAB
5,940
112
function [post nlZ dnlZ] = infKL(hyp, mean, cov, lik, x, y, opt) % Approximation to the posterior Gaussian Process by direct minimization of the % KL-divergence. % % The optimisation procedure is an implementation of the CVI algorithm for GP % models, based on Algorithm 1 and Equation 13 in [1]. % To estimate ...
619edb63712ca4ae449f0d2061166537d63c5e079555d6791e9b3cdd747117ba
MATLAB
5,946
165
%{ stack.SliceAlignment (imported) # my newest table -> preprocess.PrepareGalvoAverageFrame -> experiment.Stack ----- score: float # cross correlation score depth: float # depth in the stack in microns x_shift: float # shift in x direction in microns y_shift: float # shift in y direction in micr...
af3300169290cefbef65206782506c48e2d53911ceb6d615109b535bb1239a87
MATLAB
5,947
157
function [spectrum,f,s] = MTSpectrum(lfp,varargin) %MTSpectrum - Compute LFP spectrum by multi-taper estimation. % % The spectrum is computed as the average spectrogram, using the <a href="http://www.chronux.org">chronux</a> toolbox. % % USAGE % % [spectrum,f,s] = MTSpectrum(lfp,<options>) % % lfp u...
4d7196f4a081205f6f52c9353ad66337dd5ce38649bbbba03a5f918b26391f11
MATLAB
5,949
167
function ft_write_spike(filename, spike, varargin) % FT_WRITE_SPIKE writes animal electrophysiology spike timestamps and/or waveforms % to file % % Use as % ft_write_spike(filename, spike, ...) % % Additional options should be specified in key-value pairs and can be % 'dataformat' string, see below % 'f...
39236bd19afd19b40e0125f9b5b81a6779f03c2083b3e63be8b7633cbb2edf79
MATLAB
5,950
182
%% %%%%% From the hrfbasis fit (to all runs), visualize and record coordinates on unit sphere %% [do a GLM fit in the special hrfbasis(3PCs) and then look at distribution of the loadings for good voxels] nsdsetup; ns = []; allpoints = {}; for p=1:size(sessmatrix,1) for q=1:size(sessmatrix,2) if sessmatrix(p,q)~...
6e9100972a242f5ec30e89d254ccd1c96a376600d61c82e564f03f2bc44f3d9c
MATLAB
5,951
205
function sphere_handles = addspheres(surface_handles, DB, varargin) % DB database struct % - must have xyz, contrast, condf % optional args: % 'contrast_num' vector of contrast numbers, for averaging coords % 'average_nearby' average nearby clusters from same contrast %...
4e3f947fadcd4a623a735c7c0e7bf841478baa651be38d61af82e09aed9f6ce5
MATLAB
5,957
91
% BIDS_METADATA_STATS - Check the BIDS metadata content % % Usage: % >> stats = bids_metadata_stats(bids); % % Inputs: % bids - [struct] BIDS structure (for example ALLEEG(1).BIDS) % % Outputs: % stats - BIDS metadata statistics structure % % Authors: Arnaud Delorme and Dung Truong, SCCN, INC, UCSD, February, 2...
5ec32c006c3bf68adbcd58795382b16ef698d4a7e27245c22055725bd6c97196
MATLAB
5,957
166
%{ pre.SliceAlignment (imported) # my newest table -> pre.AverageFrame -> rf.Stack ----- score: float # cross correlation score depth: float # depth in the stack in microns x_shift: float # shift in x direction in microns y_shift: float # shift in y direction in microns %} classdef SliceAlignme...
cd417e2eb791da45dccdbef56c5512975978d1e8d6defc0eb1ca3b648d2554bc
MATLAB
5,958
129
function out = EN_PermEnComplexity(y, m, tau) % EN_PermEnComplexity Jensen-Shannon statistical complexity of ordinal patterns. % % Computes the Bandt-Pompe ordinal-pattern distribution (as in EN_PermEn) and % pairs its normalized Shannon entropy with the Jensen-Shannon statistical % complexity of Rosso, Larrondo, Mar...
55082f651c617f2bec5aed28f0b4ef94472118ae3a3ec39b69d183871a6e97d1
MATLAB
5,960
145
%{ pre.AlignMotion (imported) # motion correction -> pre.AlignRaster -> pre.Slice --- -> pre.Channel motion_xy : longblob # (pixels) y,x motion correction offsets motion_rms : float # (um) stdev of motion align_times=CURRENT_TIMESTAMP: time...
ec9cf3f3f559143131f6ca8bbfaf0488f0f3500ef2b66467f640c1cf75a73f9a
MATLAB
5,960
171
function out = CO_HistogramAMI(y, tau, meth, numBins) % CO_HistogramAMI The automutual information of the distribution using histograms. % % The approach used to bin the data is provided. % % ---INPUTS: % % y, the input time series % % tau, the time-lag (1 by default) % % meth, the method of computing automutual i...
d32ad0a3c2550c193a8dd00d37d7661161916fb1aae511005205a1da733e7fbd
MATLAB
5,961
162
function Behaviour_analysis(path_to_data) % Get the path to the behavioural data, calculates the relevant variables % and plots figures. % % Kakaei, Schlecht, Hauser 2025 % % See also Pupil_analysis if nargin<1 path_to_data = pwd; end for exper = 1:2 % experiment counter if exper==1 arms = 3; % numbe...