sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
f4ce152a6398b7b6b031860b60035a9d286d64de7d377c797f44005dc07ca9d0
MATLAB
1,229
41
function [squares,quad,squares2,quad2,D]=nt_qca2(x,npcs,nsmooth) %[square,quad,square2,quad2,D]=nt_qca(x,npcs,nsmooth) - maximize induced power using quadratic component analysis % % square: linear component closest to most repeatable quadratic component % quad: most reproducible quadratic component % square2: line...
6ac32b49819043160349db9c0e5ae8d8bed8e838af6e05b7247607b46b71ee47
MATLAB
1,230
29
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2017 The Regents of the University of California and the University of Southern California % Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy % % This program is free software; you can redistribute it and/or % modify ...
b01243de23e757f9e26d67b887e34143449dcb46a3f7ae9c3c4671cc286c295c
MATLAB
1,230
29
function [MuseStruct_micro, MuseStruct_macro] = MuseMarkers_update_filepath(cfg,MuseStruct_micro, MuseStruct_macro) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % function readMuseMarkers % % Crawls and searches through patient- and recording-directories to % extracts marker timings (t...
1bb61148988382e9b92849653e741c1a500bfde539f0927b03b226c377f3cbc6
MATLAB
1,231
23
function [configs] = simulation_configs() % Simulation configs, file for handling of paths to toolboxes. % --------------------------------------------------------------------- % Copyright (C) 2023 Simon R. Steinkamp, Iyadh Chaker % This program is free software: you can redistribute it and/or modify ...
f8233bfe6253a70475fc1cdedc8b03040031a3c02e6d54bf8cf225f832bc3dfa
MATLAB
1,233
34
%mask = '/dcl02/lieber/ajaffe/SpatialTranscriptomics/LIBD/spatialDLPFC/Images/Liebert_Institute_OTS-20-7748_rush_posterior_2_nuclei.mat'; %jsonname = '/dcl02/lieber/ajaffe/SpatialTranscriptomics/LIBD/spatialDLPFC/outputs/NextSeq/DLPFC_Br3942_post_manual_alignment/outs/spatial/scalefactors_json.json'; %posname = '/dcl...
28cc9d63a601b3fdaeca1e9134cb567a59b5f5e31675767928546061e9c8265f
MATLAB
1,234
35
function smoothedV = CBIG_Smooth3DVolumeWithMask(V, mask, outside_mask_type, method, filter_size, arg) % smoothedV = CBIG_Smooth3DVolumeWithMask(V, mask, outside_mask_type, method, filter_size, arg) % outside_mask_type = SMOOTH => Everything outside the mask is smoothed ignoring the mask. % outside_mask_type = SAME =>...
c6dfee8ea1a086ed3cbaaa2cbbce082dac830cdfa1ddb0258cc616acb3e4d9de
MATLAB
1,234
46
function x=nt_sns_cluster(x,nneighbors,cluster_size) % y=nt_sns_cluster(x,nneigbors,cluster_size) - sensor noise suppression within clusters % % y: denoised matrix % % x: matrix to denoise (time * channels * repeats * ...) % nneighbors: number of channels to use in projection % cluster_size: target cluster si...
15a19cb3f6af3e7572b60030053951a83cf56179819904b13f5173b3e8d639d1
MATLAB
1,236
37
function [modified_results] = normalise_to_zero(results_to_plot) % if size(results_to_plot, 1) < 9 || size(results_to_plot, 2) < 6 % error('The matrix must have at least 9 rows and 6 columns.'); % end % Number of rows and columns [numRows, numCols] = size(results_to_plot); % Check...
d2331c665aa7981c7a445cef206a8e5e31455fc8acde61c1576279a3ea90e5d7
MATLAB
1,243
48
function out = ctflop(in) % OUT = CTFLOP(IN) % Simple function to permute between a Mx3 color table and % a Mx1x3 image. This allows tools which only support images % to conveniently handle color tables. This can also be done % using permute(), but ctflop() provides a succinct and readable % way to e...
d27e3aca1af836b2ab861a277b3329da24bacf1e064da19d2f0f20850c744842
MATLAB
1,251
28
%% Demo 6 - Linear mixed model with random slopes % Subjects often differ not just in their baseline but in how strongly a treatment % affects them - something repeated-measures ANOVA cannot express, but random % slopes can. Shown on the sleepstudy dataset (lme4; Belenky et al. 2003): % reaction times of 18 subjects ac...
1d6d188c84250869cf67b09b5090ed5b12023486f6781e6ac41c9278bea5c397
MATLAB
1,252
57
% % varargout = estimateVarSize(varType, numE, unit) % % Description: % estimate variable size % % Input: % varType - type of variable, e.g. double % numE - number of elements % unit - unit of Byte % % Output: % varargout - print to screen if no output, otherwise output the estimated size and uni...
4df9cf4612d39fd1fff89855a031fe1cb21d55142a800c4b4e161aab3a632d27
MATLAB
1,253
26
function dict_out = dictInitialize(dict_init, T, N) % dict_out = dictInitialize(dict_init, T, N) % % Function to initialize a TxN sized dictionary. The columns of the % dictionary are normalized to unit norm. If a matrix is fed in as the % first input, that dictionary is just normalized (no random % initialization ...
a8a55e34bc15c858f8e013e048ac4b5f15680b8954d4a37652e4d40c3ba9f3cf
MATLAB
1,253
25
function [epoched_bs_around_AMs,epoched_bs_around_NAMs] = merge_file_BS_epoched(bs_to_tap_predictions, window,s_i) BS = bs_to_tap_predictions(:,2); epoched_bs_around_AMs_i = cellfun(@(BS,s_i) getepocheddata(BS, s_i.AMs, window), BS,s_i,'UniformOutput',false); epoched_bs_around_NAMs_i = cellfun(@(BS,s_i) getepocheddata(...
d08fbc024b3d0736dd45976ba43900a082ab963f4f9971b960e5863d4bb4c226
MATLAB
1,257
40
function pairAng = pairwiseAngles(X, Y, dim, varargin) %% Default arguments if ~exist('dim', 'var') || isempty(dim) dim = 1; elseif ischar(dim) varargin = [{dim}, varargin]; dim = 1; end %% Reshape input to be in the form of column vectors Xdims ...
73f6d0752238b51d33698652582cddb0788ff1a1764ce24def03780e564f26f8
MATLAB
1,259
36
% % BDP BrainSuite Diffusion Pipeline % % Copyright (C) 2019 The Regents of the University of California and % the University of Southern California % % Created by Chitresh Bhushan, Divya Varadarajan, Justin P. Haldar, Anand A. Joshi, % David W. Shattuck, and Richard M. Leahy % % This program is free sof...
1461127d29b51e79753629bd03c7cc7b478026fe0d91ba009a928b6d94d92b8c
MATLAB
1,266
52
function InFormStitch(filename,O,P,fname) % O{1} = 'DAPI'; % O{2} = 'Abeta'; % O{3} = 'pTau'; % O{4} = 'GFAP'; % O{5} = 'MAP2'; % O{6} = 'Lipofuscin'; %filename = '/dcs04/lieber/lcolladotor/with10x_LIBD001/Visium_IF_AD/processed-data/Images/InForm/VIFAD1_V10A27-004/20210204_Visium-IF_Scan1*component_data.tif'; myfil...
4150a742fc3ac859eca15182c1c6136ba281ab8b1531c7750b2c710a6d8ec3dd
MATLAB
1,270
47
%% Compute the dominant eigenvalue using power iteration together with Rayleigh quotient iteration. % http://cis.poly.edu/~mleung/CS4744/f04/CS4744f04Instruction.htm % From http://cis.poly.edu/~mleung/CS4744/f04/ch04/PowerRayQuotF.m function [eVector, eValue, converged, iterations] = dominantEigen(A, x, maxIter,...
df9493a8fc4caf85d33ed7a527382692184c7eaa8989053a7bab75f4fb7aeb07
MATLAB
1,271
39
function next = accumulate_slice(input, header) matrix_size = header.encoding.encodedSpace.matrixSize; function slice = slice_from_acquisitions(acquisitions) disp("Assembling buffer from " + num2str(length(acquisitions)) + " acquisitions"); acquisition = acquisitions(end); sl...
15b6b43016366130f9beaf407cbd710540944d79a621734c7011d812f997aefc
MATLAB
1,274
38
% Returns the sorted order of elements in A, i.e. 1 corresponds to the smallest element and numel(A) % corresponds to the largest element. function order = sortorder(A, dim, asRank, varargin) %% Default arguments if ~exist('dim', 'var') || isempty(dim) dim = find(size(A) > 1, 1, 'first'); end ...
3f46b96bf3c8bb0f58a519f41c2e966cbbdf16b956f6bc32b333e6e0d952c8f8
MATLAB
1,276
45
function rstd = robustSTD(data) % robustSTD compute robust standard deviation % % usage: rstd = robustSTD(data) % % arguments: data - vector of numbers % or array - operates along 1st dim % % outputs: rstd - robust standard deviation % % % translated from lisp (statistics.lisp) to mat...
5ac1bb29cf4baf54ed620d40dfef35fa425166c9a953770d371e6c483f274514
MATLAB
1,276
34
%% BINNEDAVERAGE Computes the average y(x) in bins of x. % % Note that the first and last bins includes under/overflow in the case where xEdges is provided. If % not, the Matlab histcounts() function is used to obtain optimal binning divisions. % function [yAverage, xCenters, yData] = binnedAverage(x, y, xEdges...
a3a3d2bec14be56b23c461a21505e9016b31affe2bb71d9a6cf86bfe8f69632f
MATLAB
1,276
33
function insertion = createArgumentDefaults(hDocument, eventData) %% Obtain inputs from function signature [~,inputs] = parseFunctionSignature(hDocument); tabSize = com.mathworks.services.Prefs.getIntegerPref('EditorSpacesPerTab'); tab = repmat(' ', 1, tabSize); if ...
54ade9fc0a464ebaf7b7dd053a41cc28ddb7915ab48f6c4abba57722acc29c6d
MATLAB
1,279
42
%%*******************************************************%% %%% B1 map calculation %%% %%% Parameters of the Fermi pulse are based on mfc_bloch_siegert_v3e %%% - PhaseDat: phase encoding the B1 amplitude %%% - dwrf: off-resonance frequency in Hz %%% - DurPulse: Fermi pulse duration in sec %%% %%% NC 03.01...
095ead5a56468a29bda53afeacffa15d86530e782bfe15c906bbda867c711566
MATLAB
1,280
33
function handle = cmap(axis, palette, colorRange, numColors, varargin) colormap(axis, palette); handle = colorbar('Peer', axis); if ~isempty(varargin) set(handle.Label, 'String', varargin{:}, 'Rotation', -90, 'VerticalAlignment', 'bottom'); end % Set range of axis color mapping ...
fb345a50f33d4b2102ed0d0ed998e39df10ad90671ad387f2d1d6357f60ba7ac
MATLAB
1,284
36
function generateTests() % this function generates some test data to be used with the consistency % tests. It is just a list of the testcases effectively % the most basic dataset simulate_data('tests/test_cases/test1','2AFC','binom','Blocks10_fix',100,'norm') % test case without blocks simulate_data('tests/test_cases...
fc4d614b1b4dd4d499264be1c6b0aab9e295c828ca52ffba6013c7e0b4741349
MATLAB
1,285
45
function compile_bfp(bfp_version) restoredefaultpath; addpath(genpath('../../src')); bfp_bin_dir=sprintf('bfp_%s', bfp_version); fid = fopen('bfp_version.txt', 'w'); fprintf(fid, bfp_version); fclose(fid); if exist(bfp_bin_dir,'dir') rmdir(bfp_bin_dir,'s'); end mkdir(bfp_bin_dir); mcc -m -v bfp.m % Compile auxi...
d97afe92790a7ef3cdf9f8bbf62708c1398b329d8b404dde36b854c14be377d5
MATLAB
1,286
33
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2019 The Regents of the University of California and the University of Southern California % Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy % % This program is free software; you can redistribute it and/or % mo...
e5c367910c6115385546acd2780e88c9c5689ad7b093ba352c949f0d574f7224
MATLAB
1,286
52
% FASTCORR Fast calculation of Pearson's correlation coefficient for each pair of columns in X and Y % % Inputs % ======== % X : % Y : % % Outputs % ========= % corrCoeff : % pValue : % % Created : 04-Apr-2019 14:50:47 % Author : Sue Ann Koay (koay@princeton...
4e0c95d6a9b16881fd5156ce8748277ebb2a499d70b788ae3039bdd8aab0a071
MATLAB
1,287
35
%************************************************************************** % % Writing data to disk for later use. Developed for writing sensitivities % acquired separately (s-map) for later use in unfolding. % input: Structure with data field % gadNoiseDir: Gadgetron store directory % ...
f95597cf2f79ee83d0e9dd57fea6746945e01766546e6fc4bdfd2969cc4eb4f1
MATLAB
1,289
35
%% load experiment info and set a few variables for analysis clear % load experiments and generic stuff experiments = 'your function here'; repeatCalc = 0; save_data = 1; % folders to save various results folder4power_ramps = 'to save power of ramps'; folder4stim_props = 'to load stimulation properties'; folderSM = ...
6fa510dd06b882876cc0246b56c04c96f4a7e89035be2fd6bf32f505b229e9be
MATLAB
1,292
53
function CBIG_AverageCorrelationMatrixGeneral(output_file, varargin_text) % Read a file list, average all mat files in the list and save output. % % CBIG_AverageCorrelationMatrixGeneral(output_file, varargin_text) % Input: % output_file : output file name % varargin_text: input list name % % Ex...
87039ce0832bc5124e1fac4ed31c05712aff41239798bba212fdb8f5d5184c3f
MATLAB
1,292
45
function FastPrintv2(prefix, filename) %Original code by David J. Barker; Modified by %Carissa A. Bruno for the Barker Lab at Rutgers University. mydir=cd; %create a "Figures" folder if one does not already exist. if isfolder([mydir '/Figures'])==0 mkdir('Figures') else end %To DO: If current directory=f...
a9a90b3b9117e5b7c723b021992042ed231748ba3c25d531d8a5ad35f7e9f4ea
MATLAB
1,292
36
% Like mtimes(), except that slices (3rd and higher dimensions) are supported. function C = mtimes3(A, B) %% Check input sizes szA = size(A); szB = size(B); if szA(2) ~= szB(1) error('mtimes3:size', 'Number of columns (%d) of A must be equal to the number of rows (%d) of B....
0377ca155baf203a8153bb2e6230f9a00573d2421a760b6c45d40566755cbc35
MATLAB
1,294
48
%% function to get bins that are included in analysis function [fieldBins, fieldBinsUpsampled] = GetFieldBins(I, rate_thresh, peakRate) I0 = I; %% get bins that exceed rate threshold Npeak = length(peakRate); [peakRate, ~] = sort(peakRate, 'descend'); FieldX =[]; FieldY = []; [r,c] = size(I); for i = 1:Npe...
fd12ad0ca5e2338ae4db55e0dea98807975271e0fd3c73e1d7d2d2070ac3ac59
MATLAB
1,297
30
% extractDevAdlNmGenes.m % Extract genes intersecting Developing mouse brain atlas & Mouse brain % atlas which have no missing values %% import data load("geneInfoNonmissing.mat") load('structureInfoTableOh2014Sorted.mat') load('expEnergyMatrixOh_nonMissing_sorted_logEps2_zscore.mat') load('connectionMatrixOhP005_sor...
f7fc4090f1059521ea249acf36843bb6b7b55469b83a574fe21e4ff3973b82c0
MATLAB
1,298
55
%% % function [varargout] = replaceTitle(varargin) %----- Default values if nargin > 0 && all(ishghandle(varargin{1})) handles = varargin{1}; iOption = 2; else handles = []; iOption = 1; end options = inputParser; options.addRequired('expressi...
e0694a7dc5cb5ed2e9705da4a2586cffe3536446d0bab21215671dae7a7fbe50
MATLAB
1,300
38
%% % Optimal smoothing amount for a smoothingspline, depending on the % separation of data points. % function [smoothing] = optimalSmooth(sequence, reference) % User provided value if numel(sequence) == 1 delta = sequence; % User provided sequence, calculate average separation ...
3820e0499159fc25f8b17aeb4ff84bef9218ae4055ab560f7a9db23b3d902911
MATLAB
1,302
36
function [data1, data2, inactive] = remove_inactive_bs(data1, data2, window_of_inactivity) %% Removes segments where BS data may have been absent. % Inactive BS data is defined as any sequence of x milliseconds or higher where the sum of the difference between the signals is 0. % % **Usage:** [data1, data2, inacti...
593df350e0cf725dd1e15925ed3a68266536fbb5687666c8d5d9fcf8c641b51e
MATLAB
1,302
46
function I = gcmi_model_cd(x, y, Ym) % GCMI_MODEL_CD Gaussian-Copula Mutual Information between a continuous and a % discrete variable in bits based on ANOVA style model comparison. % I = gcmi_model_gd(x,y,Ym) returns the MI between the (possibly multidimensional) % continuous variable x and the discrete v...
dbf7cf9e3f25f9a44163f0b3d8f7798db1d1956df6e2381053c67e46fa13be12
MATLAB
1,302
49
% Example script for estimating a regression model % % Steve Fleming 2018 clear all Ntrials = 100; Nsub = 50; c = 0; c1 = [-1.5 -1 -0.5]; c2 = [0.5 1 1.5]; group_d = 2; group_baseline_mratio = 0.8; sigma = 0.5; sigma_beta = 0.2; gen_beta = 0.5; cov = rand(Nsub,1)'; mcmc_params = fit_meta_d_params; mcmc_params.estim...
e43daf6043a7ad2890066ea44babe8c7d3ed3ed0bc3d19ffb756994e2e6afc62
MATLAB
1,303
36
function smoothedV = ... CBIG_AuthorTopic_FFTSmooth3DVolumeWithMaskPredfinedFFTKernel(V, ... mask, fftK) % smoothedV = ... % CBIG_AuthorTopic_FFTSmooth3DWithPredefinedKernel(V, ... % mask, fftK) % % Smooth a 3D volume using Fast Fourier Transform (FFT) with a predefined % smoothing kernel and a mask % % Inp...
50f3ca357c34748cd6b361ff7ab2565ae7ae350dc5c3f4859af792c886ed8930
MATLAB
1,305
48
function [Delta490] = DeltaF(Ch490,Ch405,varargin) % Smooth and process 490 channel and control channel data for fiber % photometry. %Inputs: % 1--Ch490-GCamp Channel % 2--Ch405-isosbestic control channel % 3--Start time- Set a specific sample to start at % 4--End time-specify a specific ending sample if...
4a1cb1d6eaadd23a7262dbb1b75617f431a1e3aa6b4778824b0fe7facff389f4
MATLAB
1,306
40
function reorg_neighbors = CBIG_SPGrad_neighbors_exclude_medial(orig_neighbors, mask) % reorg_neighbors = CBIG_SPGrad_neighbors_exclude_medial(orig_neighbors, mask) % % This script excludes medial wall vertices from the neighborhood structure and make % the neighborhood vertices indices contiguous. % % Input: % - ...
5625970d295e22d6021893c671228a0be44ee581c82a6a087e39533e0e465a7e
MATLAB
1,306
32
function CBIG_AnalyzeDirectAndIndirectCorrespondence % CBIG_AnalyzeDirectAndIndirectCorrespondence % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md indirect_count = MRIread('1000sub.FSL_MNI152.1mm.count_map.nii.gz'); indirect_vertex = MRIread('1000sub.FSL_MNI152.1mm.v...
fc277279d12a5a78c69045c6f7823138fbda6377c71b838f78ae51eca890ee45
MATLAB
1,306
59
close all; clear all; clc addpath(genpath('/data/code/matlab')); prepOutput; %%%% PARAMETERS %%%% % Database database{1} = '/data/coord/tyr/tyrunits'; database{2} = '/data/coord/zen/zenunits'; % Data files dataDir = '../data/cohLFP_TestJustPrintReal/500ms_5Hz_Target_-450:1000ms'; dataDir2 = '../data/cohLFP/_old2/5...
fe8f1aff9ba791c075193d36d3f64f0bd9db75eb0cf05b60eca3c5a3bd3aa23a
MATLAB
1,307
37
function splitSlide_IF(fname,O) img = load(fname); %O = fieldnames(img); %N = 4; %number of capture areas disp(['The IF image has ',num2str(numel(O)),' channels']) [y,~,~] = size(img.(O{1})); tic disp('Splitting whole slide into individual capture areas') for i = 1:numel(O) tic I1.(O{i}) = img.(O{i})(1:roun...
2d9d02c4b7d8cdf1ac353dfd418af7b1fc5adcebc334834a8ed974a996b20fe7
MATLAB
1,308
28
%% Demo 3 - Two-way ANOVA (two crossed factors + interaction) % Two crossed factors and their interaction are the classic two-way ANOVA, which % a linear model reproduces exactly on a balanced design. Shown here on the % ToothGrowth dataset (R base): odontoblast length of 60 guinea pigs given vitamin % C by two deliver...
03ecf0567f704120c45f4be62779a0eb2f609f8eb42c9d65ed4f7a660d68bbac
MATLAB
1,309
50
function CBIG_CreateRandomVarargin(num_subjects, num_randomness, varargin_txt, out_path) % Create num_randomness list of files, each containing num_subjects names % % CBIG_CreateRandomVarargin(num_subjects, num_randomness, varargin_txt, out_path) % Input: % num_subjects : number of subjects % num_r...
551d19b3ef55e26059961c5ffc9828ad3ff2317f48bc53cbc5cbb28f2bf0a13b
MATLAB
1,309
45
function [modified_results] = normalise_to_zero_SAP(results_to_plot) % if size(results_to_plot, 1) < 9 || size(results_to_plot, 2) < 6 % error('The matrix must have at least 9 rows and 6 columns.'); % end % Number of rows and columns [numRows, numCols] = size(results_to_plot); % C...
21700cd683095e27ec56b6f0e7b1fe705e3f059eaf047d20e0086af5b334af42
MATLAB
1,313
37
function [idx,distmm] = spm_prf_find_voxel(XYZmm,PRF) % Identifies the index of the voxel in the PRF with coordinates closest to % those provided % % XYZmm - [3 x 1] vector of coordinates (mm) % PRF - PRF structure % % idx - Index of the closest voxel % distmm - Euclidean distance in mm of closest voxel to the tar...
41766a15cfa199ff80b17c5bc69b00e9f27ce36cbd2e5b7fa38583076d2e376c
MATLAB
1,314
49
function [childrenIdListTxt] = extractChildrenIdListTxtFromIDAndPath(structureId,structureIdPath) %% same process with ~~fromPath load("MBStructureTreeData_raw.mat"); idListStr = strrep(structureIdPath,'/',','); idListStr = strip(idListStr); idList = str2num(idListStr).'; % i = 1 childrenCell = struct2cell(MBStruc...
c65b19a6160a8e3f179397b550a126eeaef6d74bd0b4b6445cd66860116493bb
MATLAB
1,319
44
%% Difference of exponentials kernel, normalized such that the maximum probability is 1. function f = differenceExponentials(t, tauRise, tauDecay) %% Special cases norm = tauDecay * tauRise^(tauRise/tauDecay) ... * (tauDecay + tauRise)^(-((tauDecay + tauRise)/tauDe...
18dfa324ab194ce2b078f7a340e7701a280dac9313d54a43c591c6b525cddca1
MATLAB
1,323
57
function x=nt_demean2(x,w) %y=nt_demean2(x,w) - remove mean of each row and page % % w is optional % % if w is a vector with fewer samples than size(x,1), it is interpreted as % a vector of indices to be set to 1, the others being set to 0. % % NoiseTools if nargin<2; w=[]; end if nargin<1; error('!');end if ~is...
ccaac519dd3d8ae54a3d043d94b42853167f247561a511cacc0123b9757faec1
MATLAB
1,324
25
function [r_colormap,g_colormap,b_colormap, y_colormap] = create_rgb_colormaps() %% Create R, G, B colormaps for easier visualisation of IF images % @author: pdzialecka %% r_col = [1,0,0]; g_col = [0,1,0]; b_col = [0,0,1]; r_colormap = [(linspace(0,r_col(1),256)'),(linspace(0,...
b93b288239d281ad8b8de775e929e31d3baa50c6ea58c8c78dbbd99ec534d918
MATLAB
1,325
23
%% load epoched event path_upper = '/home/ruchella/non_attribute_movement_and_EEG/data/all_epochs'; all_epochs = load_EEG_checkpoints(path_upper, 'all_epochs', 'all_epochs', 'save_results', 0); %% load EEG data ancova = load_EEG_checkpoints('/home/ruchella/non_attribute_movement_and_EEG/data/ancova', 'ancova', 'ancova'...
1fff873294092b45ff973bfe1c2b39ab8c0f9373a005fab52284bd266c7e45b2
MATLAB
1,326
44
function [trigTimes, trigLengths] = jw_extract_trig_times(fname,thres,negative) % JW_EXTRACT_TRIG_TIMES reads an incoming trigger and returns the event % timings for when the trigger goes high % % Author: Jeffrey B. Wang <Jeffrey.Bond.Wang@gmail.com> % % Inputs: % fname: Name of input .ncs file with the t...
864a09a3b1fdbf88d52be90685fd8328eaabbcad5c14d4c6b16d70f963c7d6c9
MATLAB
1,326
37
function corr_mat = CBIG_nancorr(s_series, t_series) % Calculate correlation matrix between each column of two matrix where % there could be nan values in the matrices. % % corr_mat = CBIG_nancorr(s_series, t_series) % Input: % s_series: T x N1 matrix, T is number of frames, N1 number of voxels % ...
1abe916338ba5c9821c976aacd97a76d526aa1ff2ca350ab846f0a9c1c92850a
MATLAB
1,327
41
function [figHandle, position] = makePositionedFigure(position, monitor, positionMode, varargin) % Default arguments if nargin < 2 monitor = 1; end if nargin < 3 || isempty(positionMode) positionMode = 'OuterPosition'; end % Get the screen coordinates to reference the figure positi...
a029fdc688af9c4b7f9292628b411d93de549941918121a541a2b618e2dfca04
MATLAB
1,327
38
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2017 The Regents of the University of California and the University of Southern California % Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy % % This program is free software; you can redistribute it and/or % modify ...
cf38b5e25b37af725aea0bc4affdb451362d7a315ed5443efb2ba74968cff500
MATLAB
1,327
46
function outpict = ptile(inpict,szo,varargin) % OUTPICT = PTILE(INPICT,OUTSIZE,{OFFSET}) % Create an image by repeating a smaller image to fill a specified geometry. % This can be used for generating images from tileable pattern/texture images. % % INPICT is an image of any standard image class. % multicha...
6bc4ef9fd129dde062b6b74a241f4aea1893de2e9d3a58c3c957d62b494b8da7
MATLAB
1,329
38
function cmapnew = ctshift(cmap0,stretchamt) % CMAPNEW = CTSHIFT(CMAP,AMOUNT) % Nonlinearly shift the content of a colormap toward one end or the other. % This may be useful if trying to tailor a map to provide good feature % contrast when the distribution of data is significantly asymmetric. % % CMAP is a ...
73484161ac53399888e7c25c4cb8f9e5fb1744da1049064aedceef9e9d08c028
MATLAB
1,329
39
function CBIG_AverageCorrelationMatrix(SUBJECTS_DIR, input_file, session_file, output_file) % CBIG_AverageCorrelationMatrix(SUBJECTS_DIR, input_file, session_file, output_file) % This function is specific to Thomas's project. Please use CBIG_AverageCorrelationMatrixGeneral % % Example: % CBIG_AverageCorrelationMatrix...
bfb46303f6be4be86a498dea1c191b4568cedacebdd565ca96135fc77ef6d2cb
MATLAB
1,329
27
% === main_parameter_setting.m === %% === Set pair data generation options === noiseLevel = 0.01; % define level of noise added to CCA pair data for computational stabilization dataType = "PC"; % define data type for analysis; dataDim = 50; % define PC dimensions being used in the analysis % define seed for noise pa...
5fe911453a84e7b00f0964068a52b74a27f980efcd4a3489007347bf7731a2a2
MATLAB
1,335
41
% Create a long figure with the given aspect ratio but near the default plot area (width*height) function fig = longfigure(aspectRatio, areaScale, varargin) %% Default arguments if nargin < 1 || isempty(aspectRatio) aspectRatio = 4; end if nargin < 2 || isempty(areaScale) if aspectRatio <...
3d0743d987e23b4cfd3986899aa16ef68431a93f45f5f475548444359403756b
MATLAB
1,337
39
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2017 The Regents of the University of California and the University of Southern California % Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy % % This program is free software; you can redistribute it and/or % modify ...
d7536259c9980eb2b9694db440ba6e9cc1c2d52552397a4a55b55983b0da645e
MATLAB
1,340
29
%% function to calculate tuning curves for each cell in both context and to calculate Rayleigh's vector function [RV, HDir_Rate, EventHDir] = Get_HDirTuning(EventTime, binned_HDir, HDirOccupancy,Nbins,binCenter,edges) [Ncells, ~] = size(EventTime); EventHDir = cell(Ncells,2); % heading direction during event for e...
7e764edc4f7577beef23ca6bbc9d35a63e5aafefec98c3fb1e09efce44157182
MATLAB
1,341
54
% Test script, compare with funciton hypergeom from symbolic math toolbox. % Siyi Deng; 10-10-2013; if exist('hypergeom','file') ~= 2 error('Requires the function HYPERGEOM from symbolic math toolbox.'); end numTest = 1000; a = randn(numTest,1); b = randn(numTest,1); c = randn(numTest,1); x = randn...
1c9958ec1cb71a84498005239392453471dd67b4790899dc4278acdfff5acb62
MATLAB
1,342
42
function [s] = mstruct(varargin) % MSTRUCT Makes a struct array with the given fields, each of which is % initialized to an empty array. % % The size of the struct array can be specified as the first arguments, % otherwise the default is [1 1]. Also an initial value (if different % from [])...
aae4493bc28b12ceb8e30f9083d566b6ec10f0fc5516c76b8fc0f9d0f6db1ca5
MATLAB
1,342
34
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2017 The Regents of the University of California and the University of Southern California % Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy % % This program is free software; you can redistribute it and/or % modify ...
21b3d827d97ddb7e1e3c45304c57f39d177da7caf35b136327c1a61b3839b630
MATLAB
1,344
41
function neighborhood_cell=CBIG_ComputeNeighborhood(hemi, mesh_file, radius, surf_type) % neighborhood_cell=CBIG_ComputeNeighborhood(hemi, mesh_file, radius, surf_type) % This function is used to find neighborhood vertices for each vertex % within radius. % Input: % -hemi: 'lh' or 'rh' % -mesh_file: Freesurf...
b7ab2846f32529a398cf6d4cd4a7123c755cb390b1d204866e10e1c3d9f753bb
MATLAB
1,344
41
% Author: Woojae Jeong %% Bad channel interpolation if ~isempty(char(chan{:})) % Process: Set bad channels sFiles = bst_process('CallProcess', 'process_channel_setbad', sFiles, [], ... 'sensortypes', chan); % Specify bad channel names % Process: Interpolate bad electrodes sFiles = bst_proces...
ef2cf67cc53ab61c1a9fb512f36c9a076bc3fc88861ab7e243cec44df0286bac
MATLAB
1,344
43
function X = chisquare_inv(P,V); %CHISQUARE_INV Inverse of chi-square cumulative distribution function (cdf). % % X = chisquare_inv(P,V) returns the inverse of chi-square cdf with V % degrees of freedom at fraction P. % This means that P*100 percent of the distribution lies between 0 and X. % % To check, the a...
4eefe1a0fd1b1d2e48b5f2867c5d70e452e5fcffb1a65d957d54e428ef80b74a
MATLAB
1,345
43
%% Gergely Tarcsay, 2022. Function to read Bonsai behavior data. Files are merged when multiple outputs are found (due to restarting the recordings for example). function [pos, event] = ReadData(rootdir) poslist = dir(strcat(rootdir,'\Pos*.csv')); %if there is more than 1 position csv - merge them pos = []; ...
1d92bbf61bf49d5642f527a24c9c915952b1b802042073906c038c06e441e5ff
MATLAB
1,347
35
% Compute the standard deviation and confidence interval thereof using boostrapping function [stddev, interval] = standardDeviation(data, numBootstrap, probability, w, dim, varargin) if nargin < 3 || isempty(probability) probability = [0.05, 0.95]; end if nargin < 4 || isempty(w) w ...
676871757b4efa1425e5f525d46ca86858cae89360fb4ec13bbc7fc3c2f90a44
MATLAB
1,348
45
%predefine port function [error_type, pairs] = GetWrongChoice(event, reward_ports, Incorrect) ports= ["W", "SW", "S", "SE", "E", "NE", "N", "NW"]; error_type = [0 0 0]; pairs = strings(length(Incorrect(:,1)),2); for i = 1:length(Incorrect(:,1)) %% get correct port msg = string(event{Incorrect(i,2),1}); msg_p...
1d3a51341a2c98a532369b9fdd255dc9aaa42a4d8e82b79769ca6dde3e106c29
MATLAB
1,351
54
function Q = randomFindRange(A, r, epsilon, randMatrix) %% Default arguments if nargin < 2 || isempty(r) r = 10; end if nargin < 3 || isempty(epsilon) epsilon = 1e-5; end if nargin < 4 randMatrix = []; end %% Initial values and stopping conditions maxError2...
24e2d26fa8e880fd2a5db7fdb850baaadf71decf499e4d24265b7457a92c1705
MATLAB
1,354
38
function x=nt_sns1(x,nneighbors,skip,w,threshold) % y=nt_sns1(x,nneigbors,skip,w,threshold) - sensor noise suppression % % y: denoised matrix % % x: matrix to denoise % nneighbors: number of channels to use in projection % skip: number of closest neighbors to skip (default: 0) % w : weights (default: all on...
4bac1318d182c77ea581198610d522be724b2f83061c3c6a20375a82046ed184
MATLAB
1,354
30
%% Demo 7 - Linear mixed model on log-transformed response % Strictly positive, right-skewed outcomes strain the constant-variance assumption % of an ordinary linear model; one remedy is to model them on the log scale. Shown % on the sleepstudy dataset (lme4) - the same reaction-time data as demo 6. The % response is f...
c0b82c4f958b707c525643fba7a9fcb81aa93c9b750e6de831886ceff5877919
MATLAB
1,355
64
function [sbb, sww, icc] = CBIG_manova_cov(data) % [sbb, sww, icc] = CBIG_manova_cov(data) % Implemented as in Equation 3 of Amemiya 1985 (What should be done when an estimated % between-group covariance Matrix is not Nonnegative Definite) % WITHOUT correction for negative-definite covariance % % assume data = n x r x...
c0e99eecdd802070aea76bdd5e97f84f6d01e0f44338e3e4a1412eeb79fbb40c
MATLAB
1,358
37
function PET_slurm_joblist %find config script : addpath (genpath('\\l2export\iss02.charpier\analyses\vn_preictal\scripts\EpiCode\projects\preictal')); config = PET_setparams; sc_version = '1.0.8'; fname = fullfile(config{1}.datasavedir,'spyking_circus_slurm_job_list.txt'); fid = fopen(fname,'w'); for ielec = 1:size...
1c16bfd8d3edd6755373f521581f18ebceb7c961d30657bed9c1e34f4ae73aca
MATLAB
1,360
39
function [rastmat timevec] = mraster(trialspx,pre,post,varargin) % function [rastmat timevec] = mraster(trialspx,pre,post,varargin) % % function generates matrix for raster plot from cell array 'trialspx' generated by mpsth.m % works with ms resolution % % IMPORTANT: pre and post must be as large or larger than pre a...
4906faae1c36d1571d662acf1ef8f1c8f039111ffa1f228b554a6f29322e0bd8
MATLAB
1,360
37
function katia_slurm_joblist %find config script : addpath (genpath('\\l2export\iss02.charpier\analyses\vn_preictal\scripts\EpiCode\projects\preictal')); config = PET_setparams; sc_version = '1.0.8'; fname = fullfile(config{1}.datasavedir,'spyking_circus_slurm_job_list.txt'); fid = fopen(fname,'w'); for ielec = 1:si...
1bc4341eb75505d32c85cda836a47fc3727ca916c250c7defba4fea38020291c
MATLAB
1,364
54
function [c,tw]=nt_tsxcov(x,y,shifts,w); %[c,tw]=nt_tsxcov(x,y,shifts,w) - cross-covariance of X and time-shifted Y % % % c: cross-covariance matrix % tw: total weight % % x,y: data to cross correlate % shifts: array of time shifts (must be non-negative) % w: weights % % This function calculates, for each pair o...
580ea3c496975c9ea982213e2555f2642e3f4472361d55b18a470eb0d4287409
MATLAB
1,364
39
%TEMP Blue-pale-dark red colormap % % Examples: % map = temp % map = temp(len) % B = temp(A) % B = temp(A, lims) % % A colormap designed by Light & Bartlein for visualizing data such as % temperature, with good contrast for colorblind viewers. % % The function can additionally be used to convert a r...
8d7d7a6727420d800e4ec1c0163edc016961a76886754c8cb9d34751a7dd2d4a
MATLAB
1,367
37
function next = noise_adjust(input, header) noise_matrix = []; noise_dwell_time = single(1.0); try noise_bandwidth = header.acquisitionSystemInformation.relativeReceiverNoiseBandwidth; catch noise_bandwidth = single(0.793); end function f = scale_factor(acquisit...
16d1cbde49fa831dfe843b4239d4e656bda4b6886a19af5f767ac3e1bd1b15ba
MATLAB
1,369
46
%% Creates a toolbar button that switches from one figure to another in a linked set function linkfigures(handles, labels, icons) % Default arguments if nargin < 3 icons = repmat({fullfile(matlabroot, 'toolbox', 'matlab', 'icons', 'plotpicker-comet.png')}, size(handles)); end for iFig = 1:nu...
2fd73a5e9983cd57fa3b564af6c07a7dfd0fbe5e79d7ab39e22f3862965f793f
MATLAB
1,372
32
% BINOINTERVAL Binomial parameter estimates and confidence intervals using Jeffreys method. % % Usage: % [phat,pci] = binointerval(x,n) % [phat,pci] = binointerval(x,n,alpha) % % binointerval() computes the maximum likelihood estimate, phat, of the % probability of success in a given binomial trial, based...
6db150e790bfea3dda768a113d998554bd0a1e98cdb880a8aaa91ac503d6235f
MATLAB
1,372
41
classdef HoldoutSplit properties TrainMask (:,:) logical % [#Region,#Region] TestMask (:,:) logical % [#Region,#Region] Description string % explanation for split(e.g. 'RandomSplit_Seed42') end methods function obj = HoldoutSplit(trainMask, testMask, descrip...
7c8e1a962be8964c2982f8f1909cb7eeceb9285b7bd1bfa755437ee21dba0f13
MATLAB
1,372
38
% Compute mean parametric maps averaged across all subjects clear, clc, close all %% Paths path_batches = 'D:\Projects\2023_multib\MK_multi_b\Scripts'; cd(path_batches) load('Table_demographics_biomarkers_2023_10_23.mat') % loads T_subjects n_subjects = size(T_subjects,1); path_stats_group ...
50120cd4e36e4d146cbe5983b99108f39fb2e73643e8bc111da2f3250650cc01
MATLAB
1,379
70
function varargout = memsize(invar,varargin) % MEMSIZE(THING,{UNITS}) % convenience tool to calculate the memory footprint of an array or other variable % % THING can be a variable of any class % UNITS specifies the output units (case-insensitive, default 'MB') % 'B','KB','MB','GB','KiB','MiB','GiB' are ...
f9ea87f407daa5e0b02cd8c98bf4e8f7a2c260de97e1d9b0443beb625fc1fbf9
MATLAB
1,381
45
function outpict = dotmask(dotpict,gridpict,dotfill,dotsize) % DOTMASK(DOTPICT, GRIDPICT, {FILL}, {DOTSIZE}) % Combines two images using an adjustable mask in the form of a grid. % The pattern of square dots or grid lines is often visually-distinct % enough against common image content, allowing di...
bbdecd27cbb8725054c361e5819b04646d4da5252e86ab9fa6570779ce33b159
MATLAB
1,382
46
function PRM2folder(animal, DATfolder_animal, PRMfolder) if ~ exist(PRMfolder) mkdir(PRMfolder) end filePattern = fullfile(DATfolder_animal, '*.dat'); DATfiles = dir(filePattern); filePattern = fullfile(DATfolder_animal, '*.prb'); PRBfile = dir(filePattern); str1 = strcat('experiment_name = ''', animal, '''');...
98462bf11952adc534c0ef4c90784a679f4afb4639690c1fedf35bd5f176950c
MATLAB
1,388
38
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2017 The Regents of the University of California and the University of Southern California % Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy % % This program is free software; you can redistribute it and/or % modify ...
9a6c319e8cc5fe0deb7ebcc34a633311a8011387f8caa81531a097baaa64cf2b
MATLAB
1,391
30
% modify 3D annotation order load('ANO100_ConMatIndOh_subCompManually_onlyRight.mat') %[DV,AP,LR] load('gaussianCenterCoordList_subCompManually.mat') %[DV,AP,LR] load('ANO100_majorRegion_onlyRight.mat') [DVSize,APSize,LRSize] = size(ANO100_ConMatIndOh_subCompManually_onlyRight); ANO100_onlyRight_LRAPDV_flipped = pe...
8df6cdd0622e2823e080257b5e72606282c2ade76d4db632b55ea1f12185e194
MATLAB
1,392
40
function unbinned = unbin(data, origLength, dim, wasSummed) if nargin < 3 [~, dim] = max(size(data)); end if nargin < 4 wasSummed = false; end original = size(data); standardized = [ prod(original(1:dim-1)) ... ...
1f26c0be2fabc29865af7bc881858130c7309cac82c6160d871e20112f9eb3c9
MATLAB
1,394
38
% SVReg: Surface-Constrained Volumetric Registration % Copyright (C) 2017 The Regents of the University of California and the University of Southern California % Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy % % This program is free software; you can redistribute it and/or % modify ...
cb32a790213d0aedd7f39b1f3f213391e6a3a48e50bce029ceee1b2edee7b8e0
MATLAB
1,394
46
function y=nt_resample_interp1(x,p,q,method) %y=resample_interp1(x,p,q,method) - Resample using interp1 (no antialiasing) % % y: resampled signal % % x: data to resample % p,q: resample to p/q original sampling rate (p,q can be non-integer) % method: interpolation method [default: 'spline'] % % From interp1: % ...
e5e785ba718bb81795a9cb49933ce56f253c95095bbe2393e7cf90429ef5f277
MATLAB
1,396
56
function out = noisedither(img,ntype) % NOISEDITHER(INPICT,{TYPE}) % Apply simple noise threshold dither to an I/RGB image % % INPICT is a 2-D intensity image % if fed an RGB image, its luma channel will be extracted % % TYPE is the noise type (default 'blue') % 'white' for noise with a flat pow...
ff0886715a0c7e900b06a52bcd65fcbbb3734b8684b12ce4c4d01dfc3530db69
MATLAB
1,396
56
function [count,prop] = countSpots(BW, R, tbl, posPath) count = []; prop = []; O = fieldnames(BW); nSpots = size(tbl, 1); disp([num2str(nSpots),' Visium spots detected']) disp('Building spot grid') crow = round(table2array(tbl(:, 5))); ccol = round(table2array(tbl(:, 6))); mask = zeros...
b0cad77b8dae92612caa239279ece0c5399fb946d360ecee3fef98d9aac347c2
MATLAB
1,397
74
function [c] = vecchol(x) %computes cholesky decomposition of matrix x, using explicit analytic definition if %size(x,1) < n, otherwise use matlab chol-function n = inf; siz = size(x); c = zeros(siz); siz = size(x); if numel(siz)==2 if siz(2)==1 % 1d response c = sqrt(x); else c =...