sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fb37011a0166de6464d19f1e433e0fdb7b7850b708028d3b60bb552457dfe158
MATLAB
1,882
66
function [idx] = gen_cvpartition(y,varargin) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % gen_cvpartition generates k-fold cross-validation partitions. It returns % a structure which consists of test and train indices for each % iteration. Stratified folds can be generated for c...
180e7a3bccc784e4e58c33610e01382942ddc49bff55023c6d7996ed659afc80
MATLAB
1,883
75
function tapas_rdcm_plot_fft(y, region_id) % tapas_rdcm_plot_fft(y, region_id) % % Plots signals in both frequency and time domains. % % Input: % y - data % region_id - region index % % Output: % % ---------------------------------------------------------------------- % % Authors: ...
b391cf5b072c02934295ddf5794ea8e4ad1aee5bf898f4078ec8947a2cfda31c
MATLAB
1,883
64
function [CL] = visutil_getCommonRange(erp,ivals,varargin) %VISUTIL_GETMAXRANGE - get maximum CLim range for several scalp plots of %data in erp defined by ivals % %Synopsis: % CLIM= visutil_getMaxRange(erp, ivals) % %Input: % erp: eeg data % ERP: struct of epoched EEG data. % IVAL: time intervals for which scalp topog...
376770aa9b3adbefd18f52c4e7e9af1fdb1bd23e3f23c8279ce94f88dc83f5e5
MATLAB
1,884
58
function varargout = subsref(this,subs) % Subscript referencing for GIfTI objects %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: subsref.m 4136 2010-12-09 22:22:28Z guillaume $ if length(this) > 1 && ~s...
d2f4bd53272d18d1291038e85ff381366bed7735b8b3758399c61db2ee0174aa
MATLAB
1,884
69
function [novSC, repSC] = count_spikes(procData, window) %{ PURPOSE: Counts the number of spikes in a given window using the spikeTimes in a procData file. ARGUMENTS: - procData: (struct) - window: (array) 1x2 with start and end time for spike count window (in ms) OUTPUTS: - novSC: (struct) fields...
4633bcf72940d331210f8b7ed110febf5ac4e9340562a6c3c592441dbdb74684
MATLAB
1,885
82
% op_lorentzianPeak.m % Helge Zollner, Johns Hopkins University 2020. % % USAGE: % out=op_lorentzianPeak(n,sw,Bo,centerFreq,lw,ppm0,amp); % % DESCRIPTION: % Generate a noiseless spectrum containing a single lorentzian peak with % desired parameters (frequency, amplitude, linewidth, etc.). % % INPUTS: % n ...
64e54ff57d3e871920d5b657f9679045f8d79aa2bda5cf23b837ba5165e43ebb
MATLAB
1,885
63
function [normval, rbar] = divisiveNorm_fun_2(A, params, rewType) % Divisive normalization model. Based on model in Khaw et al. 2017 https://doi.org/10.1073/pnas.1715293114 %INPUTS: % A = .mat file of rat behavior data % params = 3 parameter values (K, alpha, N) % rewType = string indicating whether to use log2 ...
092e92f77fbbcc633960178844ace2532b233085cb7417f8ff28b1b1741646e1
MATLAB
1,886
57
%% [RDF] = Wrapper_BFR_LBV(totalField,mask,matrixSize,voxelSize,algorParam, headerAndExtraData) % % Input % -------------- % totalField : total field map (background + tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial resolution of each dimension ...
1865b61034c826a088d1856a8519fa6ea1cd206fc4c1dbb9ad29d2e3d821a1e4
MATLAB
1,886
67
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Unit tests for mutual information functions. Can be run from the repository's % root folder with runtests('tests/'). % % Note: these tests are stochastic, so if any of them fails try running them % again :] % % Pedro Mediano and Fernando Rosas, Aug 2020 % %%%%%%%%%%%%%%%%...
3ac45ad2b727a0314065754dbd73ffaefcf8c134d823eb4afa13f7aefb3e3a6d
MATLAB
1,887
57
function output = decodePartialPrxDst(kinematics, neurons, tBins, ROIs, kinematicField, neuralField) % Fit instantaneous regression of joint angles with proximal and distal % variances partial'ed prox = 1:7; dist = 8:24; % Format kinematics outcomes = kinematics([kinematics.locked]); % Subselect to desired time perio...
0fb6ec784d3d91178eab59a56dc675eaa407e0d9b8ba498aab6974e5b4192749
MATLAB
1,888
50
function out = DN_Quantile(y, p) % DN_Quantile Quantile of the data vector % % Calculates the quantile value at a specified proportion, p, using the % Statistics Toolbox function, quantile. % % ---INPUTS: % y, the input data vector % p, the quantile proportion % ------------------------------------------------------...
537ea1fca083438e218ce7d658f49fb05375fc51404bc461b4e284b14bb9a3bf
MATLAB
1,888
65
% clear all % clc % close all % Parameters used in the simulation gT1=1000:100:3000; % unit: ms; T1 of global brain tissue fun=@(beta,x)(beta(1).*(1-exp(-x./beta(2)))); % fitting equation noise=linspace(0,0.05,50); % normalized noise level niter=1000; % iteration number % % Using equidis...
e18f5837c9610c67cc67a25977396cdbd1279f4cc65c81b74139f97420da96c0
MATLAB
1,888
59
%test % Parameters fs = 1000; % Sampling frequency (Hz) t = 0:1/fs:10-1/fs; % Time vector (2 seconds duration) f_low = 10; % Frequency of low-frequency signal (Hz) f_high = 60; % Frequency of high-frequency signal (Hz) % Low-frequency signal (10 Hz) low_freq_signal = 3*sin(2*pi*f_low*t); % Creat...
266dfe99b99c2b9d433c97614fd6d5422041a8c2ece4d36527e6054b75c6f933
MATLAB
1,889
88
function [example_dir] = tapas_download_example_data(version) %% Download example data and install it in tapas/examples/. % % Input % version -- String with the desired release. If empty it defaults % to the current version. % Output % example_dir - folder containing example data % ...
8ffb50e527690e40c5abfe9e3c566b02d4f4bf645781d86a7c61cc0406ec97cf
MATLAB
1,889
53
function varargout = update_NBSPredictFigure(weightAdj,labels,wThresh) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % update_NBSPredictFigure returns thresholded adjacency matrix, graph of % the biggest subgraph, applying weight threshold provided. It also provides % labes for nodes found...
fcb585044ca6bf0dad49a3473e7a8a7f7328a3c2b537306ca1cb25f1fdca8e26
MATLAB
1,890
56
function [I,windowsize,noverlap,nfft,rate,box,s,fr,ti,audio,p] = CreateFocusSpectrogram(call,handles, make_spectrogram, options, audioReader) %% Extract call features for CalculateStats and display if nargin < 3 make_spectrogram = true; end if nargin < 4 || isempty(options) yRange = mean(call.Box(1,4)); x...
c4a6e3dbf15183da16716aeb8d5962a2d0a8c8343d05a65b8f14e9ea0a0b5d63
MATLAB
1,891
65
function tapas_BLT_runStimAnswer(params) % tapas_BLT_runStimAnswer is showing the stimulus question / answer screen % Show stimulus question Screen('DrawTexture', params.screen.window, params.text.imgstimanswer, [], params.screen.fit, 0); % Flip and log Screen('Flip', params.screen.window); tapas_BLT_logEvent('stim_a...
e0b95afb8ed39e6233f078049a4214f1cf300a3d33566912c07e875c11aa2438
MATLAB
1,891
76
function [S, xtr] = RemoveExtension (S, xt) % % [Sx, xtr] = RemoveExtension (S, [xt]) % %Purpose: % removes the extension xt from the end of S % % %Input Parameters: % S : string % xt: string of characters to be removed from the end of S % xt can be | delimited strings. Trainling blanks will be removed % ...
0f5e15fdf8699ccc9a398128d030e905d76ea22f19d4276c63d6f5fdd75ab7c0
MATLAB
1,892
59
function [p0,pa_h0] = p0_monte_carlo(DB) % [p0,pa_h0] = p0_monte_carlo(DB) % % needs fields: % DB.XYZmm % mm coords for each study % DB.maskV % mask mapped volume % DB.radius % in voxels % ---------------------------------------------------- % * get list of all coordinates; select n at random % vol: row, co...
a93ac64930a2fdcbd8b5ed781e58ebcbe675a08f5b14d4cdff0ec95083aa8e53
MATLAB
1,892
55
function [logp, yhat, res] = tapas_rs_surprise(r, infStates, ptrans) % Calculates the log-probability of response speed y (in units of ms^-1) according to the surprise % model introduced in: % % Vossel, S.*, Mathys, C.*, Daunizeau, J., Bauer, M., Driver, J., Friston, K. J., and Stephan, K. E. % (2013). Spatial Attentio...
3d01c1e59f4ac12b3336842ebf2316b7fc52d9a3d5e569f5251aabe517f4aeba
MATLAB
1,893
48
function outi = cellstrfind(targ,str) % Searches cell arrays for a given string occurence. Returns indices of % cells in which target string found. % % Input: % targ : Cell array to search for string % str : target string % % Output: % outi : indices of string % % 2021 Mark C Nelson, McConnell Brain Ima...
4f93e3ba3e562ab277e90fbfa99ebb9318ce84f3f05830a416a70cded0338d73
MATLAB
1,894
70
function figHandle = plotStimTimes(rawData, stimInfo, Params, figHandle) if ~exist('figHandle', 'var') figHandle = figure(); elseif ~isgraphics(figHandle) figHandle = figure(); end p = [100 100 600 1500]; set(figHandle, 'Position', p); stimResamplingHz = 1000; numTimeSamples = size(rawData, 1); stimDataD...
ea262a94aece1330abdd2e27f3a0d1299b81103f19d2ca029e7727744e1e11bf
MATLAB
1,894
59
%% get_set_bfr_lbv(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 be fid % ...
f8601fba6c504fcb8883e1fdb17937bedd1953fc79d4b2fdd47f411d87f99837
MATLAB
1,894
74
function Test_positivedefinite() % function Test_positivedefinite() % Test for sympositivedefinite geometry (matrix completion) % % This file is part of Manopt: www.manopt.org. % Original author: Bamdev Mishra, August 29, 2013. % Contributors: % Change log: % Problem n = 100; B = randn(n, n); C = B*B'...
330e05cb8b8922814bd0e870383841f714ed43f8fb4e74ad8bd4f55cbe546b81
MATLAB
1,895
59
% evaluatePSFT - Evaluate goodness of fit of pSFT parameters % Evaluates the sum of squares error (SSE) between the measured and estimated BOLD. % 1. Neural response, R, is generated from logGauss() % 2. R is convolved with the HRF to generate BOLD time series % 3. Generated BOLD is converted to percent signal ...
51c497db86214c95a4a5b5043ae0f068f463cb28d1449017bc7c916db52cb650
MATLAB
1,895
59
function otherImage = split_complex(this, partitionPair) % Splits complex data in magnitude/phase or real/imag part as extra dim % 'complex_mp' or 'complex_ri' % % Y = MrImage() % Y.split_complex(partitionPair) % % This is a method of class MrImage. % % IN % partitionPair 'mp' for magnitude/phase (default) %...
d8152183843fdc6e21aa7f8b4ed57217587639627546bd29207972003fb16af9
MATLAB
1,895
83
% op_gaussianPeak.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_gaussianPeak(n,sw,Bo,centerFreq,lw,ppm0,amp); % % DESCRIPTION: % Generate a noiseless spectrum containing a single gaussian peak with % desired parameters (frequency, amplitude, linewidth, etc.). % % INPUTS: % n = Number of poi...
2f57e15a218ad82107b46a9b60e0e1fd81389cd89160d8b0a03e39b3e48e185b
MATLAB
1,896
64
function [folderName, folderPath] = ... tapas_uniqc_find_processing_folder(MrSeriesFolder, processingStep) % Finds the folder given a processing step in an MrSeries_folder % % [folder_name, folder_path] = ... % tapas_uniqc_find_processing_folder(MrSeries_folder, processing_step) % % IN % MrSeriesFolder p...
d38a2f68b3212da3b6cc85f9d4790b8c5e0e3cbd36732f8813651266e8611a94
MATLAB
1,896
73
function varargout = preprocColorSpace(S, params) % Usage: [Spreproc, params] = preprocColorSpace(S, params) % % A script for switching between color spaces for color stimuli; relies on % color functions in Matlab's ImageProcessing toolbox. % % Created by SN 2009 % Modified/commented by ML 2013.03.21 % Default parame...
e3348a806c1a7c59223fd120ca9ed8bf65506b65daa5f30b4083f81de0ec2cb5
MATLAB
1,896
46
function V=varianceLDC(d,C,Sig,nPart,nVox); % function V=varianceLDC(d,C,Sig,nPart,nVox); % returns predicted variance-covariance of a set of LDC distances, which are % assumed to caluclated using rsa.distanceLDC. % INPUT: % d/G: d: (nDist x 1) or (1 x nDist) vector of expected distances, % the...
257cc45f852ad7ac57475e57f2da61e0de42069f7194c019a78086122f8fb893
MATLAB
1,897
48
function store = incrementcounter(store, countername, increment) % Increment a manopt counter in a store or storedb. % % function store = incrementcounter(store, countername) % function store = incrementcounter(store, countername, increment) % % function incrementcounter(storedb, countername) % function incrementcount...
364cd05bc48b2dec331b230535ad1d8e1026de4da5c2b6f7c5f6cf1142ac516e
MATLAB
1,897
73
function x = gaussFilt1(x, sd, varargin) % out = gaussFilt1(x, sd) % out = gaussFilt1(x, sd, dim) % % Filter 1 dimension of matrix or n-dimensional array "x" with a Gaussian % of standard deviation sd. Default dimension to filter is dimension 1. To % filter a different dimension, supply the dimension as argument "dim"...
4b38a1ab3fd9397274c46b39cc7b6e02e58dad2ab7149971f55a1a8bdf89d415
MATLAB
1,897
56
function pred = nnrpred(Xtest,X,y,K,dist_type,pret_type) % prediction of new samples with knn regression model % % pred = nnrpred(Xtest,X,y,K,dist_type,pret_type) % % ------------ INPUT --------------------------------------------------- % Xtest: dataset to be predicted [n_test x p] n objects, p variables % X: ...
510d87f7ecfbe4568c9ae998a59e2b7f2d35faf923f8565b48050abc82a62344
MATLAB
1,897
51
function [GMD] = compute_gmd(dataset1) % computediss: computes dissimilarity for a dataset % % inputs: data as 2-D numeric arrays where dimension 1 contains the % timeframes, dimension 2 contains the channels % % outputs: diss and sc as 1-D numeric arrays that contain the % dissimilarity % % Cartool: https://urldefense...
30ad61d8b7ae64e6b0a05a7d0011b919d37d5008f1ff56f62aa0eed52cfa62cb
MATLAB
1,898
79
function MEAbatchConvert(ext, dataFolder) %This function converts MEA bin (binary, RAW) files into mat files in a batch. It will %attempt to convert all "raw" files in the directory, so make sure they are %all MEA files or enter an extension to select a few. % %To create the RAW file, %1. open MC_DataTool %2. F...
884718384751019b117390dd4bc935c046940549e906a6de0ffced4e5ca3eeca
MATLAB
1,898
86
function [x,k,res,negCurv] = conjGrad(A,b,optTol,maxIter,verbose,precFunc,precArgs,matrixVectFunc,matrixVectArgs) % [x,k,res,negCurv] = % conjGrad(A,b,optTol,maxIter,verbose,precFunc,precArgs,matrixVectFunc,matrixVect % Args) % Linear Conjugate Gradient, where optionally we use % - preconditioner on vector v with ...
e51b4d13e25e78b96868d4458c608a7434a2234b33f0a0ae0ddcc9d480ec3d9f
MATLAB
1,898
45
function [pVals, observedEdgeValues, permEdgeValues] = compute_permEdgePvals(observedEdgeValues, permEdgeValues) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % compute_permEdgePvals computes edge-wise permutation p-values. % % Arguments: % observedEdgeValues = Observed edge values as nE...
f3770804b282ec67b796de437995d6d975db2c5242d27c8642498de1ff57d627
MATLAB
1,898
57
function param_complete = bc_checkParameterFields(param) % JF, Check input structure has all necessary fields + add them with % default values if not. This is to ensure backcompatibility when any new % paramaters are introduced. By default, any parameters not already present % will be set so that the quality metrics ar...
79c2ffb17754b9220123d3a4e591d9408f10b9d9e0b0243ed9592f71624fa3dc
MATLAB
1,899
66
function [header] = read_ahdf5_hdr(datafile) %read header if nargin ~= 1 ft_error('Wrong number of input arguments'); end if ~isempty(datafile), id = h5readatt(datafile, '/', 'id'); if ~strcmp(id, 'AnyWave') ft_error('This is not the ahf5 format.'); end ch = h5read(datafile, '/channels'); typ...
d32cd47ec4980496e35339d9fa58123f82c3b10e9736be2051193be9c92197f0
MATLAB
1,899
52
%{ experiment.DisplayGeometry (manual) # geometry -> experiment.Session --- monitor_distance : decimal(4,1) # (cm) eye-to-monitor distance monitor_size : decimal(5,2) # (inches) size diagonal dimension monitor_aspect : decimal(4,3) ...
ff82459fbdd08dc934961c3900c78efe548c813fbb9c0d5cfd2247eba340da57
MATLAB
1,899
69
function physio = tapas_physio_new_philips(physio) % Initializes physio-properties for Philips 3T Achieva system with good % ECG-data % % physio = tapas_physio_new_philips(physio) % % IN % % OUT % % EXAMPLE % tapas_physio_new_philips % % See also % Author: Lars Kasper % Created: 2014-10-09 % Copyright (C) 2014 T...
077cd7c92539fd6698884cf1ca0e685b470862d6f6a773821359c67838d56eda
MATLAB
1,900
49
function [trl] = support_func_trl_determine_overlap(trl,pks) %% ######################################################################## % - [trl] = support_func_trl_determine_overlap(trl,pks) % ######################################################################### % [Notes:] Determine overlap of trials with specifi...
503f770cd91aef349730b212c9867d8059dd1dea883bcd6daa68fd4ad92b30ce
MATLAB
1,900
76
% op_addphase.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_addphase(in,ph0,ph1,ppm0,suppressPlot); % % DESCRIPTION: % add zero and first order phase to a spectrum. % % INPUTS: % in = input spectrum in matlab structure format % ph0 = zero order phase to add (degrees) % ph1 ...
6194476fd4102c923d2cc561f6e5e9e8ab460c35240acf9e6b15f055aec378e8
MATLAB
1,900
39
function [tapers, eigs]= checkTapers(tapers, N, Fs) % Helper function to calculate tapers and, if precalculated tapers are supplied, % to check that they (the precalculated tapers) the same length in time as % the time series being studied. The length of the time series is specified % as the second input argument N. T...
201e1806a9968766f95ed2c263681cb86828310426fd7cad0cdcab0c1ed6e22e
MATLAB
1,901
85
function bn = get_basename_or_root(fullfilename) % returns basename from filename (if standard convention P/C.name.seq) % if not possible try to determine root filename an return this % written by Niels Focke 05/2009 for new UMG basename code bn=get_basename(char(fullfilename)); if (strcmp(bn,'')) % if no basename c...
6cdde2d824832fb330345af63c4e70b6d3a5bd0c31271f579e44bb1d423c17da
MATLAB
1,901
57
function dimInfo = get_dims(this, iDim) % Returns reduced dimInfo object just with specified dimensions % % This can be used e.g. for simple query of all dimInfo of one (or more) % dimensions % % dimInfo = MrDimInfo() % dimInfo.get_dims(iDim) % % This is a method of class MrDimInfo. % % IN % iDim (vector o...
8ed9b6f8eeb89e934a42408bd6e359a08c93b3e2c5e6547f619003186ea56724
MATLAB
1,901
43
% NEURAL_NET - computes clusters using Matlab Neural Net toolbox. % Alternative clustering algorithm to KMEANS. % This is a helper function called from POP_CLUST. % Copyright (C) 2006 UCSD % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and details. % % Redistribution...
bf8c240905f3582e45dae16715c61a5bb1f88042f68190673d9e104fb24c9e35
MATLAB
1,901
61
function [C thetaout] = iem_trialwise(data,angs,angspace,foldvar,exclusion,recenter) % [C thetaout] = iem_trialwise(data,angs,angspace,foldvar,exclusion,recenter) nChan = length(angspace); ntrl = size(data,1); nsens = size(data,2); ntime = size(data,3); if nargin < 5 exclusion = zeros(ntrl,1)...
ca679b67e0b6e5b0287f40dade8bc50543c33376e8ad4d299b311fb05438805a
MATLAB
1,901
55
% defineHRF - Define the canonical hemodynamic impulse response function (HRF) % Boynton & Heeger, 1996 Journal of Neuroscience % % Syntax % HRF = defineHRF() % % Output Arguments % HRF – hemodynamic impulse response function function HRF = defineHRF() %% HRF parameters delta = 2.05; % delay betwee...
f7c47f8a0ce6a63ee9c1691177d7e6801e1950ef1ce093efe4f0c2282f24f7cc
MATLAB
1,901
64
function this = load(this, fileName) % Loads Geometry info from affine image header (.nii/.hdr/.img) or Philips % (par/rec) or recon6-ImageData (.mat, Geometry-object) % % NOTE: .mat-header files (for 4D niftis) are ignored, since the same voxel % position is assumed in each volume for MrImage % % geom = MrAffi...
0b06f80e7d04ab1f6b1e3bd659c8af78d2333a2409e2e405926540a7977f1a5a
MATLAB
1,903
64
function [MRSCont] = RunOspreyJob(jobFilePath) %% [MRSCont] = RunOspreyJob(jobFilePath) % This function creates performs a full Osprey analysis on the supplied % job file. This is the foundation for the compiled version of Osprey. % % USAGE: % MRSCont = RunOspreyJob(jobFilePath) % % INPUTS: % jobFi...
f33c5e403549472998003bd395472963c03d46714cc679bb11da4a6ccba1d00f
MATLAB
1,903
57
function STAImage = createUnitSTAImage(str) % STA Image generator for SpikeSorterUnit Object % % function STAImages = createUnitSTAImage(str) % % Takes a SpikeSorterUnit Object and computes the single Unit STA image % struct % % INPUT: % % str - SpikeSorterUnit Object % % % OUTPUT: % ...
43ae692a7671e3e17bef246f12271f3c0044b8417339c649d557d9315190c421
MATLAB
1,906
47
function [corr_ph, ph_corr_coeff] = ph_k_space(to_phase, all_spec_wat, all_spec_lip, all_spec) %sob, sob :( move_spec = find(to_phase); static_spec = find(to_phase == 0); % Try all phases from 5 to 355 (avoiding 0 degrees) %ph = 5:5:355; ph = 0:180; move_spec_w_ph_wat = all_spec_wat(find(to_phase),:); %move_spec_w_ph_...
aacdf9c9064819a5993d517678e17fe5ae516318b5b7881297cf013fbc5510eb
MATLAB
1,906
48
function yp = resampleSINC(y,m) % TIME-DOMAIN SINC INTERPOLATION (RESAMPLING) % % Syntax: % yp = resampleSINC(y, m) % % Input: % y = input signal to be resampled to higher sampling rate (y must be a row vector) % % m = resampling factor (e.g., if y is 100 sps and yp will be % ...
c7e5a0759abe548174e3b7c985c59b2207cf112cb1e4a5db0ad89a28d8fb0c43
MATLAB
1,907
61
function shepardPlot(dissimilarities,disparities,distances,figI,titleString) % displays a Shepard plot for the result of multidimensional scaling (MDS) % % dissimilarities % the dissimilarities to be depicted % [disparities] % the corresponding monotonically transformed distances MDS % str...
0c7108aa36f4c0a659d2a1444fa319fffedb5f15ec9fcdf3404ae052319baabb
MATLAB
1,908
50
% RESHAPE - reshape 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 forms, with o...
1823b4de24def387681b4246d3b5290139aa288bc21f0af362f9561f3073b641
MATLAB
1,908
62
function ft_flush_header(filename, varargin) % FT_FLUSH_HEADER removes the header information from the data queue % this also removes all data associated with the specific header. % % Use as % ft_flush_header(filename, ...) % % See also FT_FLUSH_DATA, FT_FLUSH_EVENT % Copyright (C) 2007-2010 Robert Oostenveld % % T...
2e46b6ec5aca05c1e445d0bc29484b3ff3a416b759e4d85216556d3272042feb
MATLAB
1,908
51
function data = transientrates2_VRon(data,moving) % Define the rate of Calcium signals for all cells in all categories of a % dataset. Store the average rate for each category. Also stores the % the acquisition rate with each trace in the metadata. % TODO=Swap this step to the dataset conversion routine. if n...
cf00196319f4a750865853f16748e192bc4a1dcd5a7fbd7e78e78f3d32d85b3b
MATLAB
1,908
92
function save_avw_hdr(img,fname,vtype,vsize) % SAVE_AVW_HDR(img,fname,vtype,vsize) % % Create and save an analyse header file % for either a 2D or 3D or 4D array (automatically determined). % % vtype is 1 character: 'b' unsigned byte, 's' short, 'i' int, % 'f' float, 'd' double % vsize is ...
e8a7e18ea8f5787261e3780b8ae22a9e1ab0a46a526e891c2a308cf4a6bf053b
MATLAB
1,908
53
function [dimLabels, dimValues, pfx, sfx] = tapas_uniqc_get_dim_labels_from_string(filename) % parses file name (string) for patterns _<dimLabel><index>... % % [dimLabels, dimValues, pfx, sfx] = tapas_uniqc_get_dim_labels_from_string(filename) % % IN % filename string (e.g. file name) of the form % ...
ede9d83df9e7dc7ed532fa4f4fe460af69d1675b5e12212fcdbfc15505ce5315
MATLAB
1,908
67
function h = cateye(Y, x, col, wid, rawhist) % %cateye(Y, x, [c=hsv(size(Y,2)), wid=2, rawhist]) % % Plots cat eye graph showing how data X are distributed (using kernel density function). % Each column of Y is a variable to plot a cat eye for. % The input x defines the x position of each cat eye. % This can...
ad6d16990b9ac0eed0092c7d46fa9ab22653e6e5b3c1930c2bcfae8f4c21306e
MATLAB
1,909
63
function [logp, yhat, res] = tapas_softmax_2beta(r, infStates, ptrans) % Calculates the log-probability of responses under the softmax model with different betas for % rewards and punishments % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2013-2016...
ec6588c14ba3ac10999ebdf8c350d84db7f871c083aededa1636662bab3a076a
MATLAB
1,909
36
%This function plot values in a dot plot style, in which values that are close to each other (according % to the selected density_distance)are plotted as a single marker. % The size of the marker increases according to the number of the values that it represents function [new_vec,size]=compute_density(col,density_di...
1a8961be7947ff7c8585d7a598e78e96c691e9e9ad09d9fa2f8aa34343325919
MATLAB
1,911
60
%% [chi] = Wrapper_QSM_TKD(localField,mask,matrixSize,voxelSize,algorParam, headerAndExtraData) % % Input % -------------- % localField : local field map (tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial resolution of each dimension of the data, ...
64c1238c83b9563c65a7a97b53d24117b6f0b3526bc5ead660ecb8db2d73b66f
MATLAB
1,911
63
function obj = loadobj(s) % LOADOBJ Initialize a DagNN object from a structure. % OBJ = LOADOBJ(S) initializes a DagNN objet from the structure % S. It is the opposite of S = OBJ.SAVEOBJ(). % If S is a string, initializes the DagNN object with data % from a mat-file S. Otherwise, if S is an instance of `dagnn....
83d34fc593ed37dfa14d3fd884a947cb541c081383bd6f951494f8225856f412
MATLAB
1,911
61
function [logp, yhat, res] = tapas_logrt_linear_binary_minimal(r, infStates, ptrans) % Calculates the log-probability of log-reaction times % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2016 Christoph Mathys, UZH & ETHZ % % This file is part of th...
88b31cef0d8803b555be49dd0f71f40bdad4debce060da85713a7443e0c0d365
MATLAB
1,911
45
function reducedPath = tapas_uniqc_genpath_exclude_subdirs(completePath, pathsExcluded) % works as genpath, but allows to specify excluded subfolders, which are... % removed incl. their subfolders from the returned path % % reducedPath = tapas_uniqc_genpath_exclude_subdirs(completePath, pathsExcluded) % % IN % com...
dec013dc1f1b7454eaabe11600079282575042831842b1512a839a3385a86d45
MATLAB
1,911
69
function [logp, yhat, res] = tapas_softmax_mu3(r, infStates, ptrans) % Calculates the log-probability of responses under the softmax model % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2017-2019 Christoph Mathys, TNU, UZH & ETHZ % % This file is p...
163e326edf16d8f986925dbddcb5baf4b6ce02dbecf0cf0b19e75ece2083e2c0
MATLAB
1,913
79
function [state] = tapas_sem_mixed_init_state(data, model, inference) %% Generate the structure of the states of the sampler. % % Input % % Output % % aponteeduardo@gmail.com % copyright (C) 2016 % ptheta = model.graph{1}.htheta.model; nc = size(model.graph{1}.htheta.T, 2); ns = size(data, 1); mu = mod...
42ba590705cc88e184fb929e8af48dd8929c8e72a5aa73e3587be6c1085f8d6e
MATLAB
1,913
70
function obj = init_elbo_parts(obj) N = numel(obj.data); D = prod(obj.lat); % ---------- % ELBO parts % ---------- mu = brca.format.read(obj.mu); mu0 = brca.format.read(obj.mu0); dot = obj.dot; U = obj.U; M = obj.M; D = pr...
7cadbe7611f3199b8c7a34c08f0b8f048081e3c8a643f7ce097a2947f59203a1
MATLAB
1,914
51
function data = transientrates2_VRoff(data,moving) % Define the rate of Calcium signals for all cells in all categories of a % dataset. Store the average rate for each category. Also stores the % the acquisition rate with each trace in the metadata. % TODO=Swap this step to the dataset conversion routine. if ...
9c4422e614880f4d723f911cbb58772ed073b95c8f4fd67fefab8a6c64733994
MATLAB
1,914
40
function [m,dm] = meanMask(mask, mean, hyp, x) % MEANMASK Apply a mean function to a subset of the dimensions only. % [m, dm] = MEANMASK (mask, mean, hyp, x) % % The subset of dimensions is specified by the input argument mask, and can % either be a 0/1 mask, by a boolean mask, or by an index set. The second inpu...
4aec2e9ad0be40e385102902793d2630ea313e5bed007ebf99e3fe96eee2df6d
MATLAB
1,915
63
function [data_high,pks_frame,pks] = findActiveFrames(data,pks) % find high activity frame using a threshold determined from shuffled data % INPUT: % data: N-by-T spike matrix % pks: significant level of frame activity; if left empty ([]), this % function will determine its value using shuffled data % O...
d4516ca51f5a858afbb55b6488f86b84e7abec6c7f80aab7a5357cfd0bee79fc
MATLAB
1,915
42
function [TS_DataMat,TimeSeries] = FilterLabeledTimeSeries(TS_DataMat,TimeSeries) % % ------------------------------------------------------------------------------ % Copyright (C) 2013-2026, Ben D. Fulcher <ben.d.fulcher@gmail.com>, % <http://www.benfulcher.com> % % If you use this code for your research, please cite ...
e3ef1e2ebe5991a8de494ec92e559526e4557fcd14539038a5131a36a3e87d51
MATLAB
1,915
90
function [range_ttlE,range_ttlO]=alignSyncTTL(ttlE,ttlO,fps,varargin) % align two time trace based off a common syncTTL. Assume that both are at % the same sampling rate % [ttlE_cal,ttlO_cal]=alignRecording(ttlE,ttlO,fps) %% OPTIONS options.savePath=[]; options.plotFigure=true; %% UPDATE OPTIONS if nargin>=4 opti...
e27022183d3da21be3a95bad22c579ff6e177c3a7c6605be25362bb1a0294395
MATLAB
1,916
41
% SPHERROR - CHANCENTER sub function to compute minimum distance % of Cartesian coordinates to a sphere % % Author: Scott Makeig, CNL / Salk Institute, 2000 % Copyright (C) Scott Makeig, CNL / Salk Institute, 2000 % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and deta...
55c4f2e7ff5454c363669c64925ad0efa00a22ea19c31b644054443300aca513
MATLAB
1,917
59
function recastMrImageSpm4D = recast_as_MrImageSpm4D(this) % recasts a 4D MrImage as MrImageSpm4D, enabling usage of SPM interfaces % % Y = MrImage() % Yas4D = Y.recast_as_MrImageSpm4D(inputs) % % This is a method of class MrImage. % % IN % % OUT % % EXAMPLE % recast_as_MrImageSpm4D % % See also MrImage % Auth...
b4768c8694a1e9c12bbeffd0cdb507896372f19cf7aa2854bcbc83456bed1b85
MATLAB
1,917
58
function density_choose_radius(XYZ,radii,niterations) % function density_choose_radius(XYZ,radii,niterations) % % XYZ is 3-column vector of coordinates % radii is a vector of radius values in mm for density analysis % niterations is number of iterations per Monte Carlo simulation % % This function takes an XYZ list of ...
257525a68861795e5b1db446fe6e5427af98736dcd256792bf73b8c98629d69c
MATLAB
1,918
73
function [cl,ptname,pname,pt] = dens_fdr_thresh(fname,histo,varargin) % [cl,ptname,pname,pt] = dens_fdr_thresh(fname,histo,[doplot],[pthresh],[count data]) % % fname is name of image to threshold % histo is vector of Ho (null hypothesis) hvalues of image % distribution of histo is used to convert image intensity val...
3b4d20e086bf0905a4f8dea9d07834c2d519254f87877b83ab55b04d2472c72d
MATLAB
1,918
64
function t_SA = getSignificantActivationTimes(hVals, pVals, xVals, yVals, SA_params) % t_SA = cell(1,2) of significant activation times % t_SA{1} = class 1 > class 2 % t_SA{2} = class 1 < class 2 % % hVals = 1D: lag x 1 % pVals = 1D: lag x 1 % yVals = 2D: lag x clz, where nClz = 2 !!! works only for two classes !!! %...
4f089d7b31c4ea9fe324242d1d8edafc5c81cdcad0593ca3277fd1f5641a4e0c
MATLAB
1,918
61
function test_suite = test_setFixationTargets %#ok<*STOUT> % (C) Copyright 2021 CPP visual motion localizer developers try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> catch % no problem; early Matlab versions can use initTestSuite f...
7f62ac4a56e032df760ef79a2ce5950d7859254957260b30357aa41e66ec9913
MATLAB
1,918
93
function res = mergePeriod(p1,p2,tBeg,tEnd) % res = mergePeriod(p1,p2,tBeg,tEnd) % % res{1,1} p1 off, p2 off; % res{1,2} p1 off p2 on; % res{2,1} p1 on p2 off; % res{2,2} p1 on p2 on; if ~exist('tBeg','var') || isempty(tBeg) tBeg=min([p1(:);p2(:)]); end if ~exist('tEnd','var') || isempty(tEnd) tEnd=max([p1(:)...
fce2b9c52902b4d7c7dad1625d7ca7b33b33bd57d90f27b73aef0d7c67f5ba4b
MATLAB
1,918
60
function [trial_idx,idx_flat] = parse_pseudotrials(ops,trial_id) %make pseudotrials of continuous-time trial sets %based on trial_idx binary mask, will look at start and %stop indices in ops and % %trial_id: trial numbers to be used/extracted from data % %output %trial_idx: [ns,2] array of ns "pseudotrials" of contino...
147bb9c6c7fb9ca242cca4d73fd3d9fce346df850f1a3f87cfb4d43012536448
MATLAB
1,919
44
% remove all path with a given parent path % varargin contains a list of path to exclude % Copyright (C) 2006 Arnaud Delorme % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and details. % % Redistribution and use in source and binary forms, with or without % modification, are permitt...
c0c3760f305fe01496d2fd9bd1cad09cf4613a8a61f81a0723e2b9e3de2da464
MATLAB
1,919
62
function plot_Cz_ERSP_all_clean(PATH, cfg, fieldNames) % Plot ERSP and GPM at Cz of the raw data and clean A-E % with single subject gait ERSPS at data PATHIN named file_in % % INPUT % - sii: vector of subject IDs to be processed % - PATH: structure with all paths leading to diff processing steps % generated i...
411c63c9dce67ac1f99ddef3836bd59645d10268c7c0735ef78f89334966f7d3
MATLAB
1,920
79
function [LatOpt, LatMdl, RPE, Kappa] =... GenerateLatencyData_VanillaAlpha(params, ratTrial,... gen_arg, noise_arg, noise_params) %GenerateLatencyData_VanillaAlpha % params - model parameters % params(1) = learning rate, in [0, 1] % params(2) = scale parameter, [0, 1] % ratTrial - trial data. U...
e06cd40f56b6b60ec8fb45aad92fbddee38c475326d3e5b15c858ad487fbe38d
MATLAB
1,920
90
function [summaries, fits] = tapas_sem_display_posterior(posterior, time) %% Displays a summary of the posterior estimates. % % Input % posterior -- Estimate from the model. % Output % % aponteeduardo@gmail.com % copyright (C) 2019 % n = 1; n = n + 1; if nargin < n time = []; end % Plot the ...
cdc58484b02e36d074a725cc967a39f957b01d85fcca4821b0fe338accb7dd80
MATLAB
1,921
61
%% get_set_bfr_lbv(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 be fid % ...
38b26c33416ce41ea9615b521adc7273e42e911b1a61064e0398948b6fab039f
MATLAB
1,924
80
function [LatOpt, LatMdl, RPE, Kappa] =... GenerateLatencyData_VanillaAlpha(params, ratTrial,... gen_arg, noise_arg, noise_params) %GenerateLatencyData_VanillaAlpha % params - model parameters % params(1) = learning rate, in [0, 1] % params(2) = scale parameter, [0, 1] % ratTrial - trial data. U...
77efdee17a0e11c3ed2d3145bac291998ef88e538994091366fdeea7af23b581
MATLAB
1,924
59
function plot_spectrum_two_groups(fig_num,group_1_2d_data,group_2_2d_data,frequencies,logical_log) %Plot power spectra with mean and SEM. Group one is plotted in red, group %two in black. %find group means and standard errors mean_group_1 = mean(group_1_2d_data,1); SE_group_1 = zeros(1,length(mean_group_1)); fo...
e68fbdc6bb0d4edc91c13cf2192d9349406cf2b7055ceaa584a480301c44f364
MATLAB
1,924
46
function varargout = covPP(mode, par, v, hyp, x, varargin) % Piecewise Polynomial covariance function with compact support, v = 0,1,2,3. % The covariance functions are 2v times contin. diff'ble and the corresponding % processes are hence v times mean-square diffble. The covariance function is: % % k(x,z) = max(1-r,0)...
4ea40973c7373c86835b6ac3a4af5577f65fe7734be92981d16facbcdf0db21e
MATLAB
1,925
94
function [p_ste_avg,iterations] = meta_simulate_nonparamchi2(respfreq,numconds,N) % [p_ste_avg,iterations] = meta_simulate_nonparamchi2(respfreq,numconds,N) % % Perform tests on made-up data to determine what the variability in % nonparametric chi2 p-value estimates is as a function of the number % of iterations in the...
1f7a924d984c2b9cc463e98a0e40699bbbe50c3f4bbf15ba36e608853ee42b13
MATLAB
1,926
61
function fear_memerCell_list(basename,varargin) load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([basicMetaData.AnalysesName '-icaReacInfo.mat']) load([basicMetaData.AnalysesName '-okUnit.cellinfo.mat']) load([basicMetaData.AnalysesNa...
18162f2b5daa6c1ea3c0e6f70f3186e45d1e7b7da01eac9aefbccc2d00d9dd42
MATLAB
1,927
50
function weights = InverseProbWeight(Labels) % Returns inverse probability weights (used for unbalanced classification problems) % %---INPUT: % Labels: integer class label assigned to each observation % %---OUTPUT: % weights: inverse probability weight assigned to each observation % -----------------------------------...
534c72f2ea6aba605742580b4e4047c99906a1f34a3063fa56fdeefc3425bfe6
MATLAB
1,927
62
function [hi, lo, mix] = blocks(A, varargin) %script to calculate wait times in each block type. %inputs: A struct or S struct (which will then be converted to A struct). % varargin, if it exists, specifies trial indices to analyze %output: hi, lo, and mix structs with fields 'wt' and 'er', corresponding to mea...
5f97382b9906654bac7f5e1d565be6980cdf6dc1cab918061135074fe029ba01
MATLAB
1,927
86
function xps = sero_pulseq_SERO_seq2xps(seq) % function xps = sero_pulseq_SERO_seq2xps(seq) % % This function creates an experimental parameter structure from the % sequence object or sequence file path. Note that the funciton is mainly % adapted fro the SERO project and may therefore lack general function. if isstrin...
b198d1824671693e5f1b5a7353dd674a57d1a1610fdf0e0c6c611faa51933f39
MATLAB
1,927
68
function [node,face,elem]=meshacylinder(c0,c1,r,tsize,maxvol,ndiv) % % [node,face]=meshacylinder(c0,c1,r,tsize,maxvol,ndiv) % or % [node,face,elem]=meshacylinder(c0,c1,r,tsize,maxvol,ndiv) % % create the surface and (optionally) tetrahedral mesh of a 3D cylinder % % author: Qianqian Fang, <q.fang at neu.edu> % % inp...
dc4dc39bca9fae95e2debf47b1094ac70e38eca068fb136b56065580e4b900bd
MATLAB
1,927
36
i = 1; db = struct(); animal = 'ZZ39'; date = '20220610'; FOV = 1; % will concatenate recordings from the same FOV session_name = []; % either provide a .isxd file name, or leave blank to read from excel file crop_x_offset = 100; % in pixels, from the left of the raw image crop_y_offset = 100; % in pixels, fr...
efa736601c846a1bd2d06534e589c555c9123c0cf5d31912d39dbd6de95cd2c7
MATLAB
1,927
59
function [paths] = addPaths() % Defines filepaths and adds relevant paths to the MATLAB search path. % Returns % ------- % paths (struct) with fields % main (str): filepath to main.m % data (str): filepath to data directory % external (str): filepath to external directories % outputs (str): filepath to output d...
7c81571d2471613c7b3629370579dfa6168ec5ca9abba64f429ad880aa57357e
MATLAB
1,928
65
function [varargout] = read_ctf_shm(varargin) % READ_CTF_SHM reads metainformation or selected blocks of data from % shared memory. This function can be used for real-time processing of % data while it is being acquired. % % Use as % [msgType msgId sampleNumber numSamples numChannels] = read_ctf_shm; % or % [data]...