sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ffd216e2fda1d62d246a388e894f31cb5fea0a094dd1f662aea59cce4493f48b
MATLAB
1,748
74
function [condNumbers,condLabels] = read_ctf_cls(fname) % READ_CTF_CLS reads the classification file from a CTF dataset % Copyright (C) 2003, Ole Jensen % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % FieldTrip is free software: you can redistribute ...
1df89cc363a468cc32e951f4451cbd4c9dd46388d6cacb97de7817021c4f3e00
MATLAB
1,749
32
function activations = load_encoding_activations_allsubs(paths_activations, tr_duration) run('set_library_paths.m'); addpath(SPM_PATH); % for spm_hrf convolution activations = []; disp('Loading encoding model activation timecourses') n_subjs = length(paths_activations); fprintf('Current su...
52faa6fdf0887bbd0fb7903461f1a7ffbfb77d211d42d3c791ef7fcd2871fe4a
MATLAB
1,749
56
function [output, firstIndexPoint] = read_bti_hs( filename, outfile) %read_hs_file Reads in BTI-Headshape files % filename: file with the headshape informations % outfile: if present, a ctf ".shape" file is written % output: if present, a 3xN matrix containing the headshape-points % % (C) 2007 by Thomas Hartma...
6cb35ede793aee0d13e1af8daca0de05866f143596eced2c404a68be18c1c5a3
MATLAB
1,749
49
function [] = select_types() %% Ask user to define which plots to generate and which analyses to save global info plottypes = {'Plots Only', 'No Plots', ... 'Distance Ratio', ... 'Mean Speed', 'Pathlength', ... 'Instant Speed', 'Travel Path', ... 'Final location in gradient', 'Change in gradient locati...
1c78877c440cfa16434cef8742b7b0f5c3ccb266cbcdbb7b027a2f422aaa5c5e
MATLAB
1,750
26
% startup.m if ispc drive = 'Z:' ; elseif ismac drive = [filesep 'Volumes' filesep 'lab'] ; else drive = [filesep 'mnt' filesep 'lab'] ; end ; setenv('DJ_HOST', 'at-database.ad.bcm.edu'); setenv('DJ_USER','spatel'); setenv('DJ_PASS','spatel12'); addpath([drive filesep 'home' filesep 'atlab' filesep 'pipeline...
dab6627782af1625f07a6f8613be279876bf9772a0d73e678a80c1a793c1419d
MATLAB
1,750
66
function truncated_svd_bfgs_test(A, p) % Generate some random data to test the function if none is given. if ~exist('A', 'var') || isempty(A) A = randn(402, 500); end if ~exist('p', 'var') || isempty(p) p = 5; end % Retrieve the size of the problem and make sure the req...
f71284f2b2149e21030b03263a267b70bc700d3e3525ca3802497e3fc814484c
MATLAB
1,750
51
function this = apply_inverse_transformation(this, otherGeometry) % Applies inverse of given transformation (as an Image geometry) to this % %(e.g. given mapping stationary -> transformed image transformation that % now shall be applied to transformable image to warp into space of % stationary image ) % % Y = MrAffin...
2281619cfeb1564c7bd217bf157dde94334d1160c609d27ea8dd78e19ea56f36
MATLAB
1,751
51
function available = buffer_wait_dat(selection, host, port) % BUFFER_WAIT_DAT implementation that is also backwards compatibility with ft buffer version 1 % % Use as % available = buffer_wait_dat(selection, host, port) % where % selection(1) = nsamples, 0 indicates not to wait % selection(2) = nevents, 0 indica...
3433fac557f1f1f8b81e11b0b46ce9b972228a6600504c439787d5423545e624
MATLAB
1,751
44
function out = DN_TrimmedMean(y, n) % DN_TrimmedMean Mean of the trimmed time series using trimmean. % % ---INPUTS: % y, the input time series % n, the percent of highest and lowest values in y to exclude from the mean % calculation % -----------------------------------------------------------------------------...
da645afccd3c0d978bd96e2ace2a45ee9bded28c4a3a1f7473b54cf65f7a92cd
MATLAB
1,751
45
% checkRequiredToolboxes - Checks for required MATLAB toolboxes. % If any are missing, an error is returned. function checkRequiredToolboxes(toggles) if toggles.parallelization required_toolboxes = {'Optimization Toolbox', ... 'Parallel Computing Toolbox'}; else required_tool...
816be1e2fed0bbf3a446354813902d91b3ebdb771fb5b9df56aa9c15bfcd2a0c
MATLAB
1,753
55
function newTarget = ReturnToGoodies(newRoot) % Function uses a previously selected vector stored in SelectedVector and % generates a permutation of the vector at the called position and % introduces the vector as the new target vector. global numFact numDose global TabuList % Generate a pool of vec...
87a438e73196979ff8a2275210eb25d36b6860fc734ee0c5765092eb01f941a8
MATLAB
1,753
58
function features = FD_clVAE_extractFeatures(img) newMin = 0; newMax = 1; redChannel = double(img(:, :, 1)); greenChannel = double(img(:, :, 2)); blueChannel = double(img(:, :, 3)); gray = double(rgb2gray(img)); % relative channel proportions rd = redChannel./(redChannel + greenChannel + blueChannel); ...
c10eecddffca054cd2f3d6c288d42873a03c820a2de60d6a6db5e44d6062689d
MATLAB
1,753
72
function [fid, pnt, label] = read_ctf_pos(filename) % READ_CTF_POS reads Polhemus file created with the CTF digitizer application % % Use as % [fid, pnt, label] = read_ctf_pos(filename) % Input: % filename - Polhemus ASCII file containing digitized points % % Output: % fid - fiducial locations of fiducial...
6361fbf3d989ab1153ab5641fdb0de082243cd6a032ba8ee12f33195c5924536
MATLAB
1,754
44
function colormap = BF_MakeBrightenedColorMap(rgb,numGrads) % BF_MakeBrightenedColorMap Given an rgb vector, progressively brightens into a colormap % ------------------------------------------------------------------------------ % Copyright (C) 2013-2026, Ben D. Fulcher <ben.d.fulcher@gmail.com>, % <http://www.benfu...
7f8286ada1c38106eef1a5d57b9d4904a344b8bd78e5691480e0034258b20d85
MATLAB
1,754
58
%% [h_text,h_edit] = sepia_construct_text_edit(parent,fieldString,defaultValue,pos,subratio) % % Input % -------------- % parent : parent of the constructs % fieldString : text to be displayed in the 'text' field % defaultValue : default value in the 'edit' field % pos : position of the constructs, ...
1b9c76a4a5fbeea110e4ac61196a28e60bcdeb11321de210d7dc7c0c469f0197
MATLAB
1,755
56
function this = permute(this, order) % Permutes image geometry % % Y = MrImageGeometry() % Y.permute(order) % % This is a method of class MrImageGeometry. % % IN % order [1, 3] vector or permutation of 1:3 indicating order % of dimensions after permutation. % Note: if only a subset of 1:3 i...
1e352359b2b44c94607b6e037947876e8a549f4f1e27bb7bfaa58eb20dd706aa
MATLAB
1,755
83
%% [r2s, t2s, m0] = R2star_pi(img,te,m0mode,method) % % Input % -------------- % img : multiecho images, time in last dimension % te : echo times % m0mode : method to compute m0, 'default','weighted','average' % method : method to compute R2* ('interleaved; or '1stecho') % % Output % ...
72c5cda97d008301b1d0110f8c2fe44d2eb2ad51867a85e40b4ad3055483ee7c
MATLAB
1,755
54
%PDIST vl_nnpdist dagnn wrapper % Accepts 2 or 3 inputs, where third input is used as variable % 'instanceWeights' parameter. Derivatives for the 3rd input are not % computed. % By default aggregates the element-wise loss. classdef PDist < dagnn.Loss properties p = 2; aggregate = true; noRoot = false;...
7747525f49a5e65d46b0b0f9e40e20ef0146516a111ee8dbcf53bec77e1a2219
MATLAB
1,755
39
% Bidirectionally aligns 3D movie % Input: movie, an x*y*t 3D array % Output: movieL, an x*y*t 3D array function movieL = bidi_align(movie) % subpixel computation of the shift for each image of the stack shifts = zeros(size(movie,3),1); cross_template = zeros(size(movie,2),1)'; cross_template2 = zeros...
77975f8b8425dc049ef4bebe4e61bfe109bada5ba76ce528c301d6c7db69d99a
MATLAB
1,755
65
x = rawData(:,1); %% sgolay wSize = 251; ord = 2; tic; sgData = sgolayfilt(x, ord, wSize); tSg=toc; %% asg wSize = 251; ord = 2; rOffset = 0.1*500; tic; %smoothKernel = SavitzkyGolay([-(wSize-rOffset-1),rOffset],'PolynomialOrder',ord); !!! WRONG, has to be in reversed order??? smoothKernel = flipdim(SavitzkyGolay([...
924cdb6cebd19d9be8e364f954e5b2610faa3fdb0d96f1e25f0ea94d6ef30b10
MATLAB
1,755
65
function h = mysigstar(ax, xpos, ypos, pval, color, pexact,pname,fz) % replaces sigstar, which doesnt work anymore in matlab 2014b if ~exist('fz','var'); fz = 16; end %add name of test if ~exist('pname','var'); pname = ''; end %add name of test if ~exist('pexact','var'); pexact = false; end %print exact pvalue instead...
b742a3ce0c1b83ecde565c1983198514fac7747d0cec7214c127342ffd7f3541
MATLAB
1,755
54
function [sideOnByDelay, AUC, baseline] =... DA_ResponseByDelay(pdata, bdata, bins,... auc1, auc2, bl1, bl2) % DA_ResponseByDelay - calculates average DA response by reward delay % INPUTS: % pdata - photometry data % bdata - corresponding behavioral data % bins - bins for delays % auc1 - time point for ...
c50b7797b3aca358c86ca8bf63c5d92b2c4d55c2a3b6dd446ea0642211c54602
MATLAB
1,756
74
function obj = update_latent(obj) N = numel(obj.data); D = prod(obj.lat); % ---------------------------------- % precision (common across subjects) % ---------------------------------- % Common to all subjects so we pre-compute the value % > Az = A + lam * (U'*L*U + inv(Au)) obj.Az = ...
ef6a3437fad7b12b48a638c29d2ec234e16119ce60cbc49d9bc85f4331ef9900
MATLAB
1,756
60
function makeGifti(file,varargin) % function rsa_makeGifti(file,varargin) % Convert file into the GIFTI file format and write it into % the same directory. Aligns surface with the volume anatomical for the % subject. % % INPUTS % file: full path and file name for the file to be converted % % USEROPTIONS / VARARGIN: ...
4113697d90ffa2e12a6d9e378a9e7057caac9d5ee372e3be90346154ff8c3e72
MATLAB
1,757
45
function band_signal = modwt_single_band(data, wavelet_type, level, target_band) % MODWT_SINGLE_BAND - Decompose and reconstruct a single wavelet band % % Convenience wrapper that performs MODWT decomposition and then reconstructs % only the requested band. Optimized for memory efficiency in incremental % band processi...
97aa4015ad5207a2fbfe7ba8535b67ac0ba2933aeaa618040dd7652c57ee7acc
MATLAB
1,757
61
function [spatial] = Setup_Storage(step_cap, C1, C2, C3, myelin) % SETUP_STORAGE % % Preallocates storage for spatial simulation outputs across all timesteps. % Stores positions of cell populations (C1, C2, C3) and myelin state data. % % INPUTS: % step_cap - total number of timesteps % C1, C2 - initial ...
c462c31cd8c8b87f8d4e9a1d0df0dc2723ce4c2499e686ec840eb546a8aaf120
MATLAB
1,757
64
%specify clusters to load % load rezFinal % ScalD = 10; SelectCh =[1:32]; % [d, timestamps, info] = load_open_ephys_data(sprintf('100_CH%d.continuous',1)); % [b1, a1] = butter(3, [rez.ops.fshigh/rez.ops.fs,rez.ops.slow/rez.ops.fs]*2, 'bandpass'); % inx1 = round(1:length(d)/30); % inx2 = round([length(d)/2:(length(d)/...
8a009b0b1d070450b893ca29bd55155c78e428c91042c7376dce04fd57994299
MATLAB
1,758
39
%{ preprocess.CircleMap (computed) # my newest table # add primary key here -> preprocess.Eye -> preprocess.CirclesLookup ----- # add additional attributes map : mediumblob # map of cluster membership, i.e. how many eye # positions lie within a radius centered at each element in the map x...
c474dc7b01330ce7f87f781887bda625c4e771938b7d39c3ffd49d2703f42448
MATLAB
1,758
54
%PDIST vl_nnpdist dagnn wrapper % Accepts 2 or 3 inputs, where third input is used as variable % 'instanceWeights' parameter. Derivatives for the 3rd input are not % computed. % By default aggregates the element-wise loss. classdef PDist < dagnn_bc.Loss properties p = 2; aggregate = true; noRoot = fal...
e597ad1793a67c7b1c4af0be47b6d3820111b34468784d27d471336336e2ed38
MATLAB
1,758
48
function [fileNameArrayMatch, fileNameArrayResiduals] = ... tapas_uniqc_find_info_file(fileNameArray, matchString) % Searches a fileNameArray for uniqc file names except for matchString % % output = tapas_uniqc_find_info_file(fileNameArray, matchString) % dimInfoFiles = tapas_uniqc_find_info_file(fileNameArray,...
ffae6f831fa98eb7720a00e3bdf97a2f79d6b064c8d6437e22d32dc58e6d88e4
MATLAB
1,759
62
function S=afni_niml_readsimpleroi(fn) % Reads a AFNI NIML ROI dataset (extension ".niml.roi") % % S=AFNI_NIML_READSIMPLEROI(FN) reads an AFNI NIML .niml.roi dataset and % returns a struct S with the ROIs. % If FN specifies N rois, then S is a Nx1 cell with structs with the % following fields: % .Label string ...
187af734440b9c7e9fedc72b0ab87d97142ad6a3cdb0c7d2e6ebcfce4504e77e
MATLAB
1,760
61
function [Mout,Qout,num_repeats] = mod_consensus_cluster_iterate(adjM,threshold,repNum) % Written by H Smith, Cambridge, 2020 % Consensus clustering method from Lancichinetti & Fortunato, 2012, to % produce modularity groups from methods of community detection that can % produce different groups for each clas...
5078fc9783eed16f64a03ac8e67759368dfda2cb75d653dc07140ef0cb0d929b
MATLAB
1,760
53
function [patternId,stimPatterns] = checkStimPattern(candidatePattern, stimPatterns, stimTimeDiffThreshold) %UNTITLED Summary of this function goes here % Detailed explanation goes here % Parameters % ----------- % stimTimeDiffThreshold : consider these patterns the same if the mean difference in stim times % is le...
2901e36371e4c9cda3425a33fed6d6377ef46e4ddbdb34fe1afb7f044e56b43f
MATLAB
1,761
51
function model_object = SLM_model(data_obj, tc, alpha, dta, r, f0) %% the below is based on ChatGPT's translation of Ryan Greenhalgh's slm_hyp1f1_model in models.py from pyforce %% created 7/4/2025 % Extract the necessary data f = data_obj.fdt(1, :); % force or signal d = data_obj.fdt(2, :); ...
2dc10a31cb69b8e22a6b03cb5c337c39b44358bb46f66461b84eee6c7ae76d34
MATLAB
1,761
54
function [p,tbl,stats] = multcmp_stats_on_struct( input_struct, varargin ) test_type = 'anova'; displayopt = 'off'; for v = 1:numel(varargin) if(strcmp(varargin{v},'test_type')) test_type = varargin{v+1}; elseif (strcmp(varargin{v},'displayopt')) displayopt = varargin{v+1}; elseif (...
6a0d0ebb10a2eef712198be40779cb914fdb8fa22f7f805d5a7374a5783a3f5f
MATLAB
1,761
53
function this = specify_and_estimate_1st_level(this) % Specifies the 1st level design of the MrSeries. % Uses SPM's specify 1st level function. % % Y = MrSeries() % Y.specify_1st_level(inputs) % % This is a method of class MrSeries. % % IN % % OUT % % EXAMPLE % specify_1st_level % % See also MrSeries % Author:...
70f141572226d35486585ecac5a641c904a25eb90361ef046d712ddf66e8990d
MATLAB
1,761
47
function varargout = covSE(mode, par, varargin) % COVSE Squared Exponential covariance function with unit amplitude. % % Report number of hyperparameters % s = COVSE (mode) % s = COVSE (mode, par) % s = COVSE (mode, par, hyp) % % Evaluation of k(x,x) % k = COVSE (mode, par, hyp, x) % k = COVSE (mode, par...
846fe665a1eed0ce2bda43d825a3503054b681bd0d7b6e1c2f86fee17d33f79b
MATLAB
1,761
65
function sliceThick = sero_pulseq_plotSliceProfile(rfShape, rfTime, gAmp, flipAngle, sliceThick, dz, do_rewind) % function pulseq_plotSliceProfile(rfShape, rfTime, gAmp, flipAngle, sliceThick, dz, do_rewind) [M, z, sliceThick] = sero_pulseq_sliceProfile(rfShape, rfTime*1000, flipAngle, mr.convert(gAmp, 'Hz/m', 'mT/m')...
bb9e8c5b9c7fb329decf5135a80b8742109ea30d31a69ebc9469f555c6dc5fd7
MATLAB
1,761
56
% Please cite this paper if you use any component of this software: % D. Cunefare, L. Fang, R.F. Cooper, A. Dubra, J. Carroll, S. Farsiu, "Open source software for automatic detection of cone photoreceptors in adaptive optics ophthalmoscopy using convolutional neural networks," Scientific Reports, 7, 6620, 2017. % Re...
c4ec71b007f6570d6d22b162518f194906ab352f6fd23c1b691544dce4f2be28
MATLAB
1,761
64
function [state] = tapas_sem_multiv_init_state(data, model, inference) %% Generate the structure of the states of the sampler. % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2016 % nc = size(model.graph{1}.htheta.T, 2); ns = size(data, 1); mu = model.graph{4}.htheta.y.mu; nb = numel(mu...
3d0dead0ca321f1016fab2b4592d06f4d49f2464bdbcd7365a1917d9d6af7dc8
MATLAB
1,763
67
function DBRemove(database) %DBRemove - Remove database. % % Actual removal will require confirmation from the user. % % USAGE % % DBRemove(database) % % database database name % % SEE % % See also DBRemove, DBRemoveFigures, DBRemoveVariables. % % Copyright (C) 2007-2016 by Michaël Zugaro % % This p...
6c547e9ebefaaa6a6eae714d6b200bf47310c8f272e6c090620fdd5b78bd8da5
MATLAB
1,763
36
% NDIMS - number of dimension of memory mapped underlying array % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2008 % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and details. % % Redistribution and use in source and binary for...
afdf917330508e02ca217c5cd627bd8220365bfe0fe2c037deae050232ec811b
MATLAB
1,763
52
% Phantom 2D small example. Compare potentials in 3 points. % Validating superposition property % Author: Aina Frau-Pascual % Input image im = phantom(10); im = im(2:end-1,3:end-2); % Construct mesh structure Lx = size(im, 1); % domain length Nx = size(im, 1); % number of cells Ly = size(im, 2); % domain length Ny ...
d39332a3f25f0ffdfac205d88a34e4313f4599c1ee4a5fde3368e6f794d5ea35
MATLAB
1,763
56
function [AR, RI, MI, HI] = RandIndex(c1, c2) %RANDINDEX - calculates Rand Indices to compare two partitions % ARI=RANDINDEX(c1,c2), where c1,c2 are vectors listing the % class membership, returns the "Hubert & Arabie adjusted Rand index". % [AR,RI,MI,HI]=RANDINDEX(c1,c2) returns the adjusted Rand index, % the unadjust...
1e0824ed3a8cc357f65b413eccad018bcc2b9e6a0d8311da3bc64c52ac708207
MATLAB
1,764
56
function outputImage = smooth(this, varargin) % Smoothes image (or image time series) spatially with sinc-truncated Gaussian kernel, % i.e., using spm_smooth and mimicking its functionality % % Y = MrImageSpm4D() % sY = Y.smooth('fwhm', fwhm) % % outputImage is a method of class MrImageSpm4D. % % NOTE: For comple...
e1a0c971619b17cb2af7352f37c7e1b7e22586bd443ba660964cc4bbc5e1338e
MATLAB
1,765
51
function outputImage = mean(this, applicationDimension) % Computes mean along specified dimension, uses Matlab mean function % % % Y = MrImage() % Y.mean(applicationDimension) % % This is a method of class MrImage. % % IN % applicationDimension image dimension along which operation is % ...
13de4bc811953768ba16aaa6702ded83e17400fff5beeb480b77bd2729812482
MATLAB
1,766
61
function rho = WeightedCorrCirc(weights,x,alpha) % Provide a matrix of weights, and this function will check the % correlation between the X and Y dimensions of the matrix. % You can provide the X-values and the (angular) Y-values for % each column and row. if exist('x','var') && ~isempty('x'), if isvector(x), ...
be02ad31d200f570c5451ef043e98f23a2e9b437a388cc1757cfc9771108f639
MATLAB
1,766
65
%% ext = get_nifti_extension_from_input(input) % % Input % -------------- % input : input directory (char/string) or structure containing input % NIfTI filenames, as accepted by the SEPIA I/O wrappers % % Output % -------------- % ext : '.nii' if the input data uses uncompressed NIfTI, % ...
80b83931f70da534c17eb626855540b45b190a8263a83ce824d6647b4d1aa0cb
MATLAB
1,767
57
function [ijkoffsets,distbox,m3]=surfing_spherical_mask(radius,voxelsize) % constructs a sphere-shaped mask for use in a 3D volume (e.g. searchlight) % % [OFFSETS,BOX,M]=SURFING_SPHERICAL_MASK(R,VOXSIZE) returns % a set of linear offset values and a box with computed distances from the % center, using a mask radius R...
d3831f7faf32cf87bfa68d9fcaabf148fca9fb3623e066d0ed8ce45decd74038
MATLAB
1,769
41
%{ aod_monet.DriftTrial (computed) # noise drift trials -> aod_monet.DriftTrialSet drift_trial : smallint # trial index --- -> psy.Trial direction : float # (degrees) direction of drift onset : double # (s) onset ti...
bde68701ee4645fcfac9845980e09b655da054ceb330fa2e77ef3255236be230
MATLAB
1,770
50
function stats = applyStatsfun(problem, x, storedb, key, options, stats) % Apply the statsfun function to a stats structure (for solvers). % % function stats = applyStatsfun(problem, x, storedb, key, options, stats) % % Applies the options.statsfun user supplied function (if it was provided) % to the stats structure, a...
d3d94bb4e592ac420f933df31734d58fac523f270f270609dc24205fa374f656
MATLAB
1,770
54
%% unitTest.m % This function performs a command line unit test based on the jobTesting.m file in the % ci folder. All Osprey modules are tested in dependence of the % included dataset. You can change the jobTesting.m file according to your desired % needs. The results unittest class includes detailed informati...
db66f2e06452f306769d8b7a676e59cb26b8d62078fc6a50cc10d80bd576027f
MATLAB
1,770
63
function params = SEI_job_classDefinitions(params, clzDefName) % defines the classes which the triggers of which are extracted from trials % (c) Jiri, Apr22 %% job-specific settings: E-I vs. I-E if strcmp('switchin_EI_IE', clzDefName) % define paradigm classes params.triggering.classes = {... 'E-I',{'E...
7aa8ac4cdf78e78f4bf9640738bda3d3ca559c90b548b13c9fced2ca51bf95ac
MATLAB
1,771
57
% load in master information on the manifold a1 = load('~/Dropbox/nsddata/templates/hrfs_func1mm.mat'); % hrfs is TR x different-hrfs % fit parameters options = optimset('Display','final','FunValCheck','on','MaxFunEvals',Inf,'MaxIter',Inf,'TolFun',1e-6,'TolX',1e-6); fun = @(pp) pp(7)*subscript(conv(spm_hrf(0.1,[pp(1:...
7c176722050877d79d340431ef0d8b13b28fa9370e94e4f21d6497ffecdf3869
MATLAB
1,771
49
function [lp,dlp] = priorSmoothBox1(a,b,eta,x) % Univariate smoothed box prior distribution with linear decay in the log domain % and infinite support over the whole real axis. % Compute log-likelihood and its derivative or draw a random sample. % The prior distribution is parameterized as: % % p(x) = 1/w*sigm...
c51e4deabc0823fd3a345a8278fd3b98a7170735c55668e334233d2eafbbb694
MATLAB
1,771
48
function [rez,chan] = split_cluster(rez) M_clust = length(unique(rez.st(:,end))); chan = NaN(1,2*M_clust); Nrank = 3; del = []; for i =1:M_clust Spike_id = find(rez.st(:,end)==i); channel = rez.Merge_cluster{i,5}; Nchan = length(channel); PC = rez.PC{i}; if isempty(PC) rm = rez.st(:,end)==...
e453c63ccdd6a42085041f21493f6bdb12672104d640f595aa27b14c3f6050b9
MATLAB
1,771
48
function [rez,chan] = clean_cluster(rez) M_clust = length(unique(rez.st(:,end))); chan = NaN(1,2*M_clust); Nrank = 3; del = []; for i =1:M_clust Spike_id = find(rez.st(:,end)==i); channel = rez.Merge_cluster{i,5}; Nchan = length(channel); PC = rez.PC{i}; if isempty(PC) rm = rez.st(:,end)==...
1eb45d4d5234e7065dcca68ce3fd9d8fd02103731eb03d156e7be495195d3af9
MATLAB
1,772
90
load(fullfile('.', 'data', 'dataFigureS3D.mat')); colormap1 = [204,236,230; ... 153,216,201; ... 102,194,164; ... 44,162,95; ... 0,109,44]/255; colormap2 = [253,212,158; ... 253,187,132; ... 252,141,89; ... 227,74,51; ... 179,0,0]/255; figure; hold on; for ff = 1:2 switch ff case 1 data...
cf46375de969728d8ea8f5dbe0279d83bed9e83eb84a5cb0d0015e2d1efa22bc
MATLAB
1,772
48
function plotOptoTrajectories(kinematics, plotParams) % Plot trajectories from an opto dataset % Make figure fig; hA = gca; axis off hold on; hA.View = [-22,4]; axis equal % Plot only right trials, opto in blue and normal in gray optocount = 0; normalcount = 0; target = 2; % Rights only for tr = 1:length(kinematics) ...
d505567ad16f10631215d693cea8b98bf162e51aec9aab4577d4e7cf72487f74
MATLAB
1,772
57
function tuning_summary % summarizes the quality of mice set(groot,'defaultAxesColorOrder', parula(4)*0.7, 'defaultAxesLineStyleOrder', '-|--|:') von = monet.VonMises & 'segment_method=2' & 'spike_inference=2'; keys = fetch(pro(common.Animal, rf.Session, 'max(session_date)->sess_date') & monet.VonMises, 'sess_date', 'O...
1d28ce2efe9f20bdec1b43535393aeb9d1a82ea040e0fa99a5a4a0acc2f78b60
MATLAB
1,773
63
classdef Conv < dagnn.Filter properties size = [0 0 0 0] hasBias = true opts = {'cuDNN'} end methods function outputs = forward(obj, inputs, params) if ~obj.hasBias, params{2} = [] ; end outputs{1} = vl_nnconv(... inputs{1}, params{1}, params{2}, ... 'pad', obj.pad, .....
9d59b4d2063d988c2ca83f99e624444121d55f505f0b36b7d4e027ec94d0658f
MATLAB
1,773
53
function s = export(this,target) % Export a GIfTI object into specific MATLAB struct % FORMAT s = export(this,target) % this - GIfTI object % target - string describing target output [default: Matlab] % s - a structure containing public fields of the object %______________________________________________________...
a3741caf913af40eb5ea553b6d3257b82bb1659fa98e8e23ed4ef1518c129389
MATLAB
1,773
57
%issamples - Test if parameter is a list of samples satisfying an optional list of tests. % % A list of <a href="matlab: help Samples">samples</a> is a vector or matrix of doubles containing at least one column % for (sorted) timestamps, and optionally more for continuous variables. % % USAGE % % test = issamples...
a3eb8abeff1e9ee1f05d3f55e90c5811bcb47a3ff1e2e505a24af69b0b1d4512
MATLAB
1,773
60
function [handleImageArray, nameImageArray] = get_all_image_objects(this, type) % Returns cell of handles & names for all/selected image objects in MrSeries % % Y = MrSeries() % [handleImageArray, nameImageArray] = Y.get_all_image_objects(inputs) % % This is a method of class MrSeries. % % IN % % OUT % handleImage...
266d85e86cdf0b9d91b86c59cc1d4654104d3ec18c4656addf7db5c653f7dfbc
MATLAB
1,774
51
function download_toolboxes() % One-stop setup: checks every SEPIA add-on that can be fetched % automatically (FANSI, HEIDI, Tensor-MP-PCA) and downloads whichever % ones are missing, instead of you having to call each % download_<toolbox>_toolbox() script separately. % % Safe to run repeatedly - each individual setup ...
0215daf384fcf93ef54879026e05848664bae24913506a02f7fbb35b09310ab4
MATLAB
1,775
40
function [edges, nodes] = load_inputs(cfg) % LOAD_INPUTS Load edges and optional nodes; ensure RSN columns on edges. % Load edges epath = fullfile(cfg.data_dir, cfg.edges_file); [~,~,ext] = fileparts(epath); switch lower(ext) case '.csv', edges = readtable(epath); case '.mat', S = load(epath); assert(isfield(...
2119f7c0d31773fce9240e7cf3e09b97c734f48374764c1d2d199f67a22690ad
MATLAB
1,775
104
function c = perform_contour_extraction(M, t) % perform_contour_extraction - exctract the geometry of % a black contour. % % c = perform_contour_extraction(M, t); % % the output is a sampled curve in [0,1]x[0,1] % % Copyright (c) 2004 Gabriel PeyrŽ if nargin<2 t = mean(M(:)); end if M(1)<t M = 2*t-M...
fed46b0799b68cffa8c9197b60f277cb16ad22c8502b7c1bfed94f3a077701d2
MATLAB
1,775
39
function LowDimDisplayTopLoadings(numTopLoadFeat,numPCs,pcCoeff,pcScore,TS_DataMat,Operations) % LowDimDisplayTopLoadings Display feature-loading-onto-PC info to screen % ------------------------------------------------------------------------------ % Copyright (C) 2013-2026, Ben D. Fulcher <ben.d.fulcher@gmail.com>,...
2ef0bc9d12a8f63d5a5a22433c9539f3a76fe4a39e55c3d22c895681cd7dcb23
MATLAB
1,776
63
classdef Conv < dagnn_bc.Filter properties size = [0 0 0 0] hasBias = true opts = {'cuDNN'} end methods function outputs = forward(obj, inputs, params) if ~obj.hasBias, params{2} = [] ; end outputs{1} = vl_nnconv(... inputs{1}, params{1}, params{2}, ... 'pad', obj.pad,...
603b7cb8d2f8b49ac2b9327ab06abdd7633ba3d7b061d1a3bcd3ca3a170dca0a
MATLAB
1,777
54
function spikeTimesStimRemoved = removeStimSpikes(allStimTimes, spikeTimes, Params) %REMOVESTIMSPIKES Remove spike times around the stimulation time % INPUTS % ---------- % allStimTimes : vector % vector of size (numStimTimes, 1) % stimulation times in seconds % spikeTimes : cell % cell of size (1, numChan...
6f703f268f28e74ae42221ee8036e385522346d3f3efe48ec2037aebc0b6de30
MATLAB
1,777
39
function mask = transientmask(trace, dTmin, nsigmarise, nsigmadecay, sigma) % Make a mask that identifies the significant transients in a calcium % recoridng that cross the nsigmarise and last until crossing nsigmadecay. % Adapted from Dombeck et al., 2007. % Note H.-L. Chen: dTmin is in unit of frame numbers (inde...
ff9eba2f26c8f30aa610391fd113dc3208d51548f4ee7cebd0afeaf45b349042
MATLAB
1,777
49
% Script demo_bayes % 1st level model specification and estimation using a Bayesian estimation % % demo_bayes % % % See also % Author: Saskia Bollmann & Lars Kasper % Created: 2018-05-04 % Copyright (C) 2018 Institute for Biomedical Engineering % University of Zurich and ETH Zurich % % This fi...
0519e201be58ed59e1f6f40f8cdf7ad47a61ad226bd1a9a4df0dc90172021328
MATLAB
1,778
41
function [U,pivcol,nonpivcol] = ref(A,tol) %REF The (R)educed (E)chelon (F)orm of A. % Computes the reduced row echelon form of A using partial pivoting. % % Formats: U = ref(A) % U = ref(A,tol) User specifies tolerance to determine % when ...
212db817ddcb2860943f0e3d99a27ad0eb9e7f2ce76a789051df372309367b8f
MATLAB
1,778
89
function S=smooth3D(X,FWHM,vox) % will apply a 3D gaussian smoothing filter to a 3D image, call with % S=smooth(X,FWFHM,voxdims) % FWHM is in mm - (FWHM = 2.35 * stdev) %zero fill to required just in case it is not even elements dimsorig=size(X); dim = round(dimsorig(1:3)./2)*2; if dimsorig(1:3) ~= dim X = zero...
98b9071daad36603497e6fead273f331dfd9e35cc468b82515e2b4b4208828a8
MATLAB
1,778
58
function [diffGeometry, isEqual, isEqualGeom3D] = diffobj(this, targetGeometry, tol) % Compares image geometries, and gives detailed info about differences % (2D/3D/4D, other params) % % Y = MrImageGeometry() % Y.diffobj(inputs) % % This is a method of class MrImageGeometry. % % IN % inputGeom MrImageGeometry ...
6c0e9b5b44b0a1c64ec8abc3ec1801e9e898cd926aa4b458a9a4c9ce2782cbcd
MATLAB
1,779
64
function fear_tripleCCG(basename) % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115' load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([basicMetaData.AnalysesName '-tripleCCGact.mat']) load([basicMetaData.AnalysesName '-t...
e2d0ad35b03e09ab1cb9e64be8312140b88d614be69decee521df48c4e63f140
MATLAB
1,779
63
function Y = SurfStatReadData1( filename ) %Reads data (e.g. thickness) from a single .txt or FreeSurfer file. % % Usage: Y = SurfStatReadTxt( filename ); % % filename = .txt or FS file name, either new version binary or ASCII. % % Y = n x v vector of data, v=#vertices. [pathstr,name,ext] = fileparts(filename); sw...
f22e00958c00f3feca46a170dffccb94073d22d67aa10c743ff2cdac54957f43
MATLAB
1,779
64
function [template,summary]=generateTemplate(movie,varargin) % generate an acurate template for motion correction using n last, % first or random frames. Inspired from Normcorr template estimation % DEPENDENCIES > NormCorr package %% GET DEFAULT OPTIONS options.nFrames=20; options.order='last'; % options: 'last' (def...
528ccd56a2bbde2c6b14b464b6c06824b9b540ef6f740955d8c25f662d3701f4
MATLAB
1,780
54
function manualMask = draw_mask(this, varargin) % Displays slices of a 3D volume to manually draw a polygonal mask on % them and combines output into 3D mask with same image dimensions. % % Y = MrImage() % manualMask = Y.draw_mask('z', Inf, 't', 1) % % This is a method of class MrImage. % % IN % % z def...
5ff20f36ce6b9800c37233c16d74bf89bd0f092039d86105031b7a272c71cb04
MATLAB
1,780
63
function orthonormal_basis = Gram_Schmidt_Process(A) % % Gram-Schmidt Process % % Gram_Schmidt_process(A) produces an orthonormal basis for the subspace of % Eucldiean n-space spanned by the vectors {u1,u2,...}, where the matrix A % is formed from these vectors as its columns. That is, the subspace is the % co...
7e7e577dcb3db5b4dc189798dfeb8a430007b3ce9ffbf52aa86de10f8877a300
MATLAB
1,780
64
function [raw, hdr] = tsvload(filename) % _ % Load TSV-file with non-numeric data % FORMAT [raw, hdr] = tsvload(filename) % % filename - a string, the filepath to the TSV file % % raw - an n x c cell array of file contents % hdr - a 1 x c cell array of file header names % o n = ...
86982d726f1ea4b1551d199a58a22b4d3ec8511ae0fb5e7f72c5db7456c02de9
MATLAB
1,780
52
function varargout = preprocess_data(data,scalingMethod) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % preprocess_data performs preprocessing on data provided. % Preprocessing consists of rescaling and, if provided, removing % confounds from data. % % Arguments: % data: Structure compr...
afc6ad0073ccd7fcf3d04bd55039da058869f5a2c5ed5e6f960e1ed413fca702
MATLAB
1,780
40
% This script implements the regularization proposed in: % % O’Brien, et al, 2014. % Robust T1-Weighted Structural Brain Imaging and Morphometry at 7T Using % MP2RAGE. % PLOS ONE 9, e99676. doi:10.1371/journal.pone.0099676 % % which allows the creation of MP2RAGE T1w images without the strong % background noise in ...
2b4dda838d0d2dca4fec83198344f7db090479ca03f2a98985c3acdd7945e521
MATLAB
1,782
53
function [ spike_probability , spike_probability_raster , spike_probability_raster_thresholds , oopsi_deconvolution ] = findDF_FSpikeProbability( dF_F , dT , t1_2 ) %FINDDF_FSPIKEPROBABILITY( dF_F , dT , t1_2 ) % % PARAMETERS: % \_ dF_F [TxN matrix]: dF/F-signal for N units in T time steps % \_ dT: signal temporal res...
4073a6762f87bd022927f7e066420a002f44bda5134691b88bd59f8a6ce473c4
MATLAB
1,782
64
function tapas_BLT_initDatafile(params) % tapas_BLT_initDatafile initializes the main data file for the BLT % ________________________________________________________________________% % % EVENTS (Time stamps for screen on and offsets) % __________________________________________________________________...
a09bbba079188f5f5852f3d31f5ab1f6cc5491b5d539f7c188951ca626ff729a
MATLAB
1,782
62
function [m,r,p] = meanangle(angles,weights,d) % Computes the mean of a set of angles (in radians). % % Usage: [m,r,pvalue] = meanangle(angles,weights,dim/groups) % where m is the mean angle, and r is the mean vector length % % 'angles' is a vector or matrix of angles (in radians). % 'weights' is the relative weight g...
75180a77c0e00385d3abefd1dd24e22c6cb544fdf8b7a22c343af76da7ab8169
MATLAB
1,783
60
function [xsmooth, Vsmooth, VVsmooth, loglik] = kalman_smoother(y, A, C, Q, R, init_x, init_V, varargin) % Kalman/RTS smoother. % [xsmooth, Vsmooth, VVsmooth, loglik] = kalman_smoother(y, A, C, Q, R, init_x, init_V, ...) % % The inputs are the same as for kalman_filter. % The outputs are almost the same, except we cond...
c25064e5f7558d6465506312e2dcce49bb0ec37c1a6cc8ddce0e556c725a063e
MATLAB
1,783
50
function PATH = naj_postICAopt_paths() % set all relevant folders, create them if they do not exist yet % add toolbox paths, start eeeeglab w/o GUI % % version 1.0, written by Nadine Jacobsen, Uni Oldenburg, April 2022 if strcmp(getenv('COMPUTERNAME'), 'LAPTOP-796NEANK') PATH.main = 'E:\nadine\otto_projects...
e9319d910d5c767d252fb0f355a1924c49e6136b0ee52bc040d33dc3ea3c9bb4
MATLAB
1,783
19
function contrasts = calc_contrasts_level1_naturalistic(condition_names) contrasts = cell(1, 8); contrasts{1}.tcon.name = 'dog'; contrasts{1}.tcon.weights = contains(condition_names, "dog") - (contains(condition_names, "cat") + contains(condition_names, "frog") + contains(condition_names, "spider") + contai...
22a6618e041bca956c93cb66a48fd3b86b0938a5a458b41bdc8d98dd66bf2010
MATLAB
1,784
47
function plotMetricAlignedToStim(frAlignedToStim, rasterBins, Info, Params, ... ylabel_txt, figFolder, figName, figureHandle) %PLOTMETRICALIGNEDTOSTIM Summary of this function goes here % Detailed explanation goes here % figureHandle = figure; numChannels = size(frAlignedToStim, 1); set(figureHandle, '...
0e865a722e6265112cb69d7c4cc146fad31f902ce707c5f2ba24b522a73f44fb
MATLAB
1,785
72
function [UMX, a]=sh_PieceWiseUMX(signal, reference, scale, FrequencyBand, Fs) % for now, only work with vectors for both inputs % first scale is always correspond to 4 slices signal=zscore(signal); reference=zscore(reference); n=length(signal); alpha=zeros(n,scale); % default scale =5 from [4 8 16 32 64], number o...
63f2f4cbaa3f72886cd7c3d094ea58ec68c1e4b19449087b483ec528e376a7a9
MATLAB
1,785
83
function [Stat] = VectStat (M) % % [Stat] = VectStat (M) % %Purpose: % calculates very basic stats of vectors % % %Input Parameters: % M : MxN matrix % NAN or Inf values are not considered and the user is warned of their existence % %Output Parameters: % % Stat is an Mx1 vector of structures with the follo...
efc31327baa5981c9874945a3b1a408177294fa947e58d79082966a4c741d5b6
MATLAB
1,785
70
function Test_symYY() % function test98() % Test for symfixedrankYYquotientfactory geometry (low-rank PSD matrix completion) % % Paper link: http://www.di.ens.fr/~fbach/journee2010_sdp.pdf % % This file is part of Manopt: www.manopt.org. % Original author: Bamdev Mishra, July 11, 2013. % Contributors: % Change log: ...
f27a2b311e71dcbe22f021316afc38206713f2851b302d2a49a28c709610e48f
MATLAB
1,785
56
function json = ft_read_json(filename) % FT_READ_JSON reads information from a JSON file and represents it as a MATLAB structure % % Use as % json = ft_read_json(filename) % % See also FT_WRITE_JSON, FT_READ_TSV, FT_WRITE_TSV, JSONDECODE, JSONENCODE % Copyright (C) 2018-2022, Robert Oostenveld % % This file is part...
3ebb7fdca5cbea19de98622c0df3943bc62bad9eba7a678392521b8b83641d2a
MATLAB
1,787
49
% parsebvmrk() - convert Brain Vision Data Exchange format marker % configuration structure to EEGLAB event structure % % Usage: % >> EVENT = parsebvmrk(MRK); % % Inputs: % MRK - marker configuration structure % % Outputs: % EVENT - EEGLAB event structure % % Author: Andreas Widmann, University o...
f16b2c8d8087b85807ad330d90f69ee39df53dd8383c9fd4b32967b6220d0e63
MATLAB
1,787
52
function [outermost, inside] = find_outermost_boundary(bnd) % FIND_OUTERMOST_BOUNDARY locates outermost compartment of a BEM model % by looking at the containment of the triangular meshes describing % the surface boundaries % % [outermost] = find_innermost_boundary(bnd) % % with the boundaries described by a struct-a...
9a9c048280d7027b0c7b2a2c024c945a3035690135e6eb193ff13ea109cc3092
MATLAB
1,788
54
function Data = CreateData(subjectID, nconditions, viewdist, scrnvbl, stimdur) %nconditions = nstaircases ScrnRes = [1280 1024]; ScrnPPI = []; conditions = []; Data.SubjectID = subjectID; Data.ViewingDistance = viewdist; Data.ScreenSpecs.ScrnRes = ScrnRes; Data.ScreenSpecs.ScrnVbl = scrnvbl; Data.Scre...
ee677049e3d18daa096562c03eb7c667061e0bcb3370361b177cd45806e52d23
MATLAB
1,788
50
function out = DN_MinMax(y, minOrMax) % DN_MinMax The maximum and minimum values of the input data vector % % ---INPUTS: % % y, the input data vector % % minOrMax, either 'min' or 'max' to return either the minimum or maximum of y % ------------------------------------------------------------------------------ % C...
afc20cc9fdcdf6775c90a460f7701bc928186bb206d52abe3bdfa859b9abbf99
MATLAB
1,789
64
path='F:\GEVI_Wave\Preprocessed\Visual\m14\20210322\meas00\mat'; temp=dir(fullfile(path,'*.mat')); load(fullfile(temp(1).folder,temp(1).name)); summaryG=summary; load(fullfile(temp(1).folder,temp(2).name)); summaryR=summary; frameG=summaryG.framesDroppedVec; frameR=summaryR.framesDroppedVec; timeG=summaryG.intervalD...
b0e5e4586a02a09300219297a0188118587a8053995150475008d0d0391f79b0
MATLAB
1,789
57
% Compare potentials in 3 points. % Author: Aina Frau-Pascual % Input image generated to have 2D tensors im = zeros(3) + 0.5; im(1, :) = 0.8; im(:, 1) = 0.8; im(:,:,2) = 1 - im(:,:,1); im(im==1) = 0; % Construct mesh structure Lx = size(im, 1); % domain length Nx = size(im, 1); % number of cells Ly = size(im, 2); %...