sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ab5e133d0aadd1cee353cfdc609d4a557427192c3d5300572291ec7a13ca4282
MATLAB
1,833
69
classdef Scale < nntest properties x a b end properties (TestParameter) dim = {1 2 3 4} end methods (TestClassSetup) function data(test,device) test.x = test.randn(15,14,3,2) ; test.a = test.randn(15,14,3,2) ; test.b = test.randn(15,14,3,2) ; end end methods (T...
01ac2346fc90839c6f6e67731381459f1b0f7a060cdbfa086c7feadc642fa51f
MATLAB
1,834
43
%% do stats on dynamic coding data = decodingmatrix; %this is the group-level cross-temporal decoding matrix (subjects X time X time) data = (data + permute(data,[1 3 2]))./2; %make matrix symmetric nsubs = size(data,1); ntimes = size(data,2); xdiag = nan(nsubs,ntimes,ntimes); ydiag = nan(nsubs,ntimes,ntimes); ...
1bccf355e9bdd0bf5f6ba18575d9571375b8e4b7e9980bdd82d905753ef781e2
MATLAB
1,834
56
function [K,dK] = covPeriodic(hyp, x, z) % Stationary covariance function for a smooth periodic function, with period p % in 1d (see covPERiso and covPERard for multivariate data): % % k(x,z) = sf^2 * exp( -2*sin^2( pi*(x-z)/p )/ell^2 ) % % where the hyperparameters are: % % hyp = [ log(ell) % log(p) % ...
64b682ec4aa8d54012237dc11f357755f6fe6a77b5fd4907f59981c1405fbf06
MATLAB
1,835
42
% 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...
6de7a7f4193372fa38fdd282544af0c53441c42ab742f95d21d0bfea14cb91d2
MATLAB
1,835
67
function colList=setCoactColor(); regList={'vCA1','vCA3','vSub','BLA','LA','CeA','PrLL23','PrLL5','STIA','others'}; col=flatColorMap(length(regList)); for regIdx=1:length(regList) colList.region.(regList{regIdx})=col(regIdx,:); end colList.region.PL5=colList.region.PrLL5; colList.region.PL23=colList.region.PrLL2...
c11c9a550b81c7674c769ff255115a011deb445e43c620ffe1f97741b61bd3dc
MATLAB
1,836
60
function [DA_sub, DA_err, T, tstartbl, tzero, tafter, yint, slope] =... rew_effect_stages(bstruct, pstruct, block, Alignments,... rewards, Stages, window) %initiate variables DA_sub = cell(length(rewards), length(Stages)); DA_err = cell(length(rewards), length(Stages)); yint = NaN(1, length(Stages)); slope =...
c670958dd30d69d1a3a803580d2ae44cbc7ff3fc8e36f391f2851069ada524df
MATLAB
1,836
62
function otherImage = binarize(this, threshold, caseEqual) % transforms image into binary image with pixels >= threshold set to 1 %(0 stays 0) % % NOTE: NANs set to 0 and Infs are set to 1. % % Y = MrImage() % Y.binarize(threshold) % % This is a method of class MrImage. % % IN % threshold thresholding value...
02e9ee7bac6fa63fb68813b0f45c87d86e8c92e8a61097e63067dea68a81b538
MATLAB
1,837
44
function [out] = op_combine_water_subspecs(in,average) % Some formats end up having subspectra in their reference scans % (e.g. Philips), as well as empty lines. Intercept these cases % here. if nargin < 2 average = 1; end out = in; if out.subspecs == 2 raw_A = op_takesubspec(out,1); ...
0c2a58933e36a726a6ce7d86b82faae1f4a87470bf217b87f86b5469d9b87220
MATLAB
1,837
55
%% [RDF] = Wrapper_BFR_VSHARP(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 dimensi...
a9689cd9905e6b4415b4bbc56b8ff19f8cf4723e16b507dd771320983d2a6bd0
MATLAB
1,837
57
function [c,slope,rSquared,SSres] = CorrByColumn(A,B,parametric) % CorrByColumn - correlate each column of matrix A to each column of matrix B % % This is a faster implementation of the loop: % for i=1:size(A,1), c(i) = corr(A(:,i),B(:,i)); end % % Input: % A matrix % B matrix % parametric ...
61ae24529c26e25971f4b2fa34da8abe5f33d5f75ca92358f201f915715f0740
MATLAB
1,838
58
classdef diffeo < brca.dot.field % FORMAT dot_diffeo = brca.dot.diffeo() % % Inner product between 3D volumes based on a a mixture of differential % energies (absolute, membrane, bending, linear-elastic) implemented using % finite differences. % % References: % ----------- % - Ashburner J., "A Fast Diffeomorphic Regist...
6f45207e97ed2d5a64abc084ab118333ecb0c06bd48fd04e6e7896d59b185066
MATLAB
1,838
55
function outputImage = resize(this, newDimInfo) % Resizes ND-array to a new matrix size (nSamples), given by dimInfo. % Singleton-dimensions are replicated, while others are interpolated to the % new number of samples in that dimension % % Y = MrDataNd() % Y.resize(newDimInfo) % % This is a method of class MrDataNd...
76c2d2121bbca51deb08f1a3b50b196d8fbc000b6ffccca44a44efab5d321f1d
MATLAB
1,838
50
function R = CheckDuplicate(R,vecPosition) % Function checks whether any newly generated combination set vector has % been previously generated and tested. All tested vectors are listed in % TabuList to prevent re-testing of previously tested vectors. Function % returns value 'duplicate = 0' if R is uniqu...
0727bc1cce75c34380663be6c0d0bab84a1ed433faaa35a11b56905081e0c6dc
MATLAB
1,840
55
function merge_Callback(hObject, eventdata, handles) cd(handles.data.squeakfolder); [detectionFilename, detectionFilepath] = uigetfile([handles.data.settings.detectionfolder '/*.mat'],'Select Detection File(s) for Merging','MultiSelect', 'on'); if isnumeric(detectionFilename); return; end [audiofile, audiopath] = uig...
4ab853bfdec8e932b685703f70afff383e0ec0119d984b810e38de0656b69c8f
MATLAB
1,840
48
function ss = FastFirstEchoEddyCorrect(ss,mask); dims = size(ss); to = dims(4)-(mod(dims(4),2)); % This is to ensure the same number of even and odd echos are used in the estimation PhaseDiff_2_1 = (abs(ss(:,:,:,2)).*(ss(:,:,:,2)./ss(:,:,:,1))); PhaseDiff_2_1(isnan(PhaseDiff_2_1)) = 0; PhaseDiff_end_2 = (mean(abs(s...
7ee227143f74bceb1965ed7ee77f9279eca0a1fa35788dbe074675f88279b579
MATLAB
1,840
71
function [xnew, Vnew, loglik, VVnew] = kalman_update(A, C, Q, R, y, x, V, varargin) % KALMAN_UPDATE Do a one step update of the Kalman filter % [xnew, Vnew, loglik] = kalman_update(A, C, Q, R, y, x, V, ...) % % INPUTS: % A - the system matrix % C - the observation matrix % Q - the system covariance % R - the observat...
ab7c14db69148a45908b9a63b04bd8879b17cee187a754ff3ae38ae802594792
MATLAB
1,840
68
function [ k_ , k_distibution , g_ ] = computeGraphCommunityStructureMarginals( estimate_output ) %COMPUTEGRAPHCOMMUNITYSTRUCTUREMARGINALS( estimate_output ) Computes the %marginal distributions to estimate community structure of a graph given %the results of (several rounds) of Markov-Chain-Monte-Carlo sampling to %fr...
980dbe01588213ae603a4036f288cfb345fc2ca6b50f24424ee6f39045390922
MATLAB
1,841
48
%% function [MaskThresholded, Gmag, Stats] = GradientBasedThreshold(FieldMap, Mask, Lambda) % % Description: Compute a mask based on the (magnitude) of the gradient of % the fieldmap. % Input % _____ % FieldMap : local field map in [Hz] (3D) % Mask : input brain mask (logical, dim...
8fcead0d67e593c76945cfd3c91215c706d937d952fc278d7c1f22ced0ca4dd3
MATLAB
1,842
65
% op_concatAverages.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_concatAverages(in1,in2); % % DESCRIPTION: % Concatenate two scans along the averages dimension. Two scans with 50 % averages each will now look like a single scan with 100 averages. For % looping, it is possible to enter a blank structu...
d6d425c7ec0c1029b3cf9f81c3b8b06196971b1db43cc0d2061b6280854c2808
MATLAB
1,842
44
function tapas_kf_plotTraj(r) % Plots the estimated or generated trajectories for the Kalman filter. % Usage example: est = tapas_fitModel(responses, inputs); tapas_kf_plotTraj(est); % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2016 Christoph Ma...
dcc54bddd158e517079a4c49655309a483e4382b1ddcf001ef27bb050fd62381
MATLAB
1,842
37
function [post nlZ dnlZ] = infGaussLik(hyp, mean, cov, lik, x, y, opt) % Exact inference for a GP with Gaussian likelihood. % % Compute a parametrization of the posterior, the negative log marginal % likelihood and its derivatives w.r.t. the hyperparameters. The function takes % a specified covariance function (see co...
7ebf1f57d482014c54fd9e0d761d0823c7859dc224f87dc0e678f01576ff24cc
MATLAB
1,843
45
%% ============================= % PALM Analysis: Extinction CS % ============================= % --- Locate repo root (relative to this script) thisfile = mfilename('fullpath'); [scriptdir, ~, ~] = fileparts(thisfile); cd(scriptdir); % Ensure consistent working dir % Navigate up to FEARTUS root repo_root = fullfil...
c16d8cc0ef4da39255491728e90860e5bf774fa2a82a79c065d1ff2fd4b2d9e9
MATLAB
1,843
47
function [bestParam,bestParamScore,bestParamIdx] = gridSearch(objFun,data,... paramGrid,varargin) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % gridSearch performs grid search over hyperparameter space provided and % returns best hyperparameter combination. % % Arguments % objFun =...
e23f14fc1064e37e6490eea5d22d8150267cd15e81ebb1918ae62d1593fac6cc
MATLAB
1,843
49
Wd = function (matvec) %take a 12 param matvec, typically WARPDRIVE_MATVEC_INV_000000 and %change it to a WARP_DATA %Used to test transformations needed to make AFNI use 3dWarpDrive's output %as a TLRC transform if (nargin == 0) matvec = []; if (isempty(matvec)), WARNING: Using preset matvecs!\n\n'); %test case...
e5562f3834d0c73c1dd1b4467d870795c5337ae8129b79d6de3d2fd800b5cd79
MATLAB
1,843
45
%% ============================= % PALM Analysis: Extinction CS % ============================= % --- Locate repo root (relative to this script) thisfile = mfilename('fullpath'); [scriptdir, ~, ~] = fileparts(thisfile); cd(scriptdir); % Ensure consistent working dir % Navigate up to FEARTUS root repo_root = fullfil...
b746701000ffff116b9fa48bb5a6815f41300c342fa58a6f2efc7f09135ea133
MATLAB
1,844
49
for yy=1:length(viewswanted) Lookup = []; % for each new view, need to reset the cache for zz=1:length(atlases) % define if ischar(atlases{zz}{1}) dataname = atlases{zz}{1}; if isequal(atlases{zz}{1},'curvature') data = []; % in this case, we just allow default mechanisms to take hol...
f00017891d2b872867ece99944058a806d711882812acfe9c7467179afbcc575
MATLAB
1,844
73
clc clear all close all % The IoU, F1 score (Dice coefficient) calculated from the DL-based Pupil Segmentation output mask and the manually marked pupil area processedpath = input('Enter processed_data location(such as /home/processed_data): ', 's'); [diceleft,miouleft] = textread([processedpath ,'\Pre-trained_model...
2489a837679173ff5d6fdad46ae24c2a6ec4780428b99398806cb067f7d1866a
MATLAB
1,845
65
function plot_fig3g_right(datadir) % Plot z-scored rat trial initiation time and model simulation regressed % against reward delays in the last 15 trials. For visualization, only 7 % trials are shown. N = 10 rats. % % INPUTS % datadir: file path of data downloaded from Zenodo. Link to download can % be found in README....
4edbf6eaebea656668091c7deecd14ea5983a698521cc0f5daa48fa1fe5a7733
MATLAB
1,845
54
function [icon,ctxtxi,betas,num_act,prop_act] = meta_apply_contrast(data,varargin) % % Fast form for use in Monte Carlo: % [icon,ctxtxi] = meta_apply_contrast(data,ctxtxi) % % Full form used in setup: (meta_prob_activation) % [icon,ctxtxi,betas,num_act,prop_act] = meta_apply_contrast(data,Xi,wts,contrasts) % betas = OL...
64be5cca7adb8de2bee2aed7c661e381980ca17150b0c303bdea3a609ec720a1
MATLAB
1,845
60
function f = CR_RAD(x, tau, doAbs) % RAD Compute the rescaled auto-density, a metric for inferring the % distance to criticality that is insensitive to uncertainty in the noise strength. % Calibrated to experiments on the Hopf bifurcation with variable and unknown % measurement noise. % % Devised and implemented by Bre...
b7a9c880d187a01edfcf0451cf734fdbb2ced944074f3fc4bc26514b6a36a839
MATLAB
1,845
70
function [xf,p] = fsgwindow(x,ord,fw,lag,step,positions) % function sgwindow - fast windowed Savitzky-Golay filtering % % syntax: xf = fsgwindow(x,ord,fw,lag) % syntax: [xf,p] = fsgwindow(x,ord,fw,lag,step,positions) % % Input parameters: % x: Input data, will be filtered column-wise. % ord: Filter order. % fw: For sc...
0fce579f8024d04f92c3577bc508cf0bddc5c8dbf03981bd7f68125b4d01f54a
MATLAB
1,846
57
function this = compute_stat_images(this) % computes statistical images for time series QC, such as % mean, standard deviation (sd), signal-to-noise ratio (snr) % coefficient of variation (1/snr) images % difference images between last/first (drift) and odd/even (image noise) % volumes % % Y = MrSeries() % ...
72f2233db1d505e213a8b171751e8f7b966e9f935d65fe9dfa6946e94a49a9f6
MATLAB
1,846
71
function plot_fig2e(datadir) % Plot average event-aligned dopamine release split by delay to reward % quartile. Signals are z-scored and baseline corrected before pooling % across rats (N = 10). % % INPUTS % datadir: file path of data downloaded from Zenodo. Link to download can % be found in README. basedir = fullfi...
e0e6b8aa1c675ec94910deefa29eeeb61c05b99f786f5e97e6628197b3a9e451
MATLAB
1,846
65
function pks_all = gp_match(AllData, tICAData, factor) %UNTITLED7 Summary of this function goes here % Detailed explanation goes here pks_all=zeros(1,12); [~,time_dim]=size(AllData); % similarity=dot(tICAData,AllData)'; % for j=1:time_dim % similarity(j,1)=similarity(j,1)/norm(tICAData(:,j))/norm(AllData(:,j)); %...
811feae38f89ea93672f33170e04dd55117d66f9b95cd9c810db7c898dbced53
MATLAB
1,848
45
function [Parameters] = BullwinkleParameters() %function [Parameters] = BullwinkleParameters() % % Create a parameters stucture for scoring with Bullwinkle % % Bullwinkle is a per-pixel scoring method, made to complement % the blob-based scoring method ROCKY % % to complain about the bad pun, email bjm@wossamotta.e...
d02df6fa388b8d55c2eb7b3e23d5e85751dd6c79124b5b94594550b6a84ba7ae
MATLAB
1,848
56
function [DA, DA_err, T, AUC] = rew_effect(bstruct,... pstruct, block, rewards, Alignments, port) DA = cell(length(rewards), length(Alignments)); DA_err = cell(length(rewards), length(Alignments)); AUC = nan(length(Alignments), length(rewards)); %initialize AUC output for a = 1:length(Alignments) T = lin...
f1719ec5f7364a07f387860d51d749aa4fc8a9b37a7cd9e904dcbd4026afe060
MATLAB
1,848
47
% DISPLAY - display an EEG data class underlying structure % % 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, w...
983f31ed76f0616f2bbb314f0d72c2291e436e9bc8b5f6a33096203c3d0f4b56
MATLAB
1,849
58
function [D] = mahal_trialwise(data,angs,foldvar,timelist) % [D] = mahal_trialwise(data,angs,foldvar,timelist) %assign stimulus variable for decoding sortvar = angs; trl_ind = 1:size(sortvar,1); nbin = 2; pbin = 1/4; D = zeros(size(data,1),nbin,size(data,3)); % time window for covariance sigmawin = timelis...
9e441432d457fcd440444afa4c857feffd3db3e6688e5cc2992927f38edaf0ee
MATLAB
1,849
53
% (C) Copyright 2020 Remi Gau, Marco Barilari function opt = getOption() % % returns a structure that contains the options chosen by the user to run % slice timing correction, pre-processing, subject and group level analysis. % % for more info see: % <https://cpp-bids-spm.readthedocs.io/en/late...
9b98684672f37483e047dcd32f13a2f202a134e20c39e0adb00d29351cde34be
MATLAB
1,850
47
function ProcessData_ExtendedData10(datadir, savedir, codedir) %ProcessData_ExtendedData10 - Process raw data saved under datadir such that it can be plotted by PlotExtendedData10. % INPUTS: % datadir - Local directory where 'Golden_Nature/RawData_ExtendedData10.mat' from Zenodo was saved % codedir - Local director...
ccca5cd65a72992468d617aa1dd10eb14d555a9a1c1bb4bad97ac6b05165c6b3
MATLAB
1,850
47
function fieldtrip2bis(filename, elec, mrifile) % FIELDTRIP2BIS writes BioImage Suite .mgrid files with eletrode % positions in 'xyz' coordinates using a elec datatype structure and the % corresponding MRI volume % % Use as % fieldtrip2bis('Subject_grid.mgrid', elec, 'Subject_MR.nii') % % See also BIS2FIELDTRIP, ...
dc09a6b22790004986b5ab10f0024f7ec7ade2ebeae6d73f918ebb0db4edbc38
MATLAB
1,850
68
Pmodels = fullfile(Pbase, [filesep 'models' filesep 'SN' filesep]); Pdata = fullfile(Pbase, 'spm_datasets_anon'); Psave = fullfile(Pmodels, 'GCM_fitted'); use_parfor = 0; winStart = 61; winStop = 240; files = dir([Pmodels filesep 'GCM*.mat']); %% if ~exist(Psave, 'dir') mkdir(Psave); end if use_p...
2edffb899a3fd53b99efbd9164b2765a9accf9dcd9605f0a7999383e31847eba
MATLAB
1,851
68
Pmodels = fullfile(Pbase, [filesep 'models' filesep 'DMN' filesep]); Pdata = fullfile(Pbase, 'spm_datasets_anon'); Psave = fullfile(Pmodels, 'GCM_fitted'); use_parfor = 1; winStart = 61; winStop = 240; files = dir([Pmodels filesep 'GCM*.mat']); %% if ~exist(Psave, 'dir') mkdir(Psave); end if use_...
7ab143c1e60be87327feb3727db7cc6228567ee10057acd808dd7cb105efa23b
MATLAB
1,851
46
%{ preprocess.SyncedMonet (computed) # Monet stimuli synced to frame times -> preprocess.Sync ----- movie = null : longblob # movie synced to frame times %} classdef SyncedMonet < dj.Relvar & dj.AutoPopulate properties popRel = preprocess.Sync & preprocess.PrepareGalvo end methods(Ac...
6f845549c63ae6bab683dc90d08e615aac611ae763e93c82a41dc81279324215
MATLAB
1,852
44
function [lp,dlp] = priorGaussMulti(mu,s2,x) % Multivariate Gaussian hyperparameter prior distribution. % Compute log-likelihood and its derivative or draw a random sample. % The prior distribution is parameterized as: % % p(x) = exp(-r2/2) / sqrt(det(2*pi*s2)) where r2(x) = (x-mu)'*inv(s2)*(x-mu), % % mu(Dx1) is th...
afaa9d2dfdbaa7f09eb9ed7a5cbd87c1d4b817822fbb3a1104fae062afa90214
MATLAB
1,852
66
function [realblock, treal, tincong, vios] = blockhmat_withvios(A) tot_trials = [0; cumsum(A.ntrials)]; [~, A.reward] = convertreward(A.reward); realblock = nan(length(A.ntrials), max(A.ntrials)); treal = realblock; vios = realblock; rew = realblock; tincong = realblock; for sess = 1:length(tot_trials)-1 realbl...
e40b8657beab05880de3697951119270352b75b31c382cacca5ffafca2b9811c
MATLAB
1,852
58
function convertGallantV1Aligned(directory, dryRun) if ~exist('dryRun', 'var') dryRun = false; end if ~exist('directory', 'var') directory = 'v1_nis_data'; end stimuliDir = [directory, '/stimuli']; addpath(genpath([directory, '/../functions'])); scriptDir = fileparts(mfilename('fullpath')); addpath(genpath([scr...
6f5b3ded826bb3e67ef6f5afe06ff00b01a0dfe547761ad581c7d8403ffddff8
MATLAB
1,853
63
function [RHSdiv, RHSdivx, RHSdivy, RHSdivz] = divergenceTermCylindrical3D(F) % This function calculates the divergence of a field using its face % average flux vector F, which is a face vector % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari %...
b7aa5c3baf45f53d6aaa4dcc3b7e6019c78b1e2159897438565d8ab5cd59f2a7
MATLAB
1,853
64
function ft_plot_moco(file_rp, software, path_output, name_output) % Plot moco % % ft_plot_moco(file_rp, software, path_output, name_output) % % Inputs: % file_rp - file name of textfile with realignment parameters. % software - which software was used (spm or afni). % path_output - path where output is wr...
03af6a781b42e81e49d0822170c2675f76de5acf397cc30989ad54100591c1ce
MATLAB
1,854
47
function [matched,logicalReference,missingElements] = MatchMatrices(reference,query) % MatchMatrices - match matrices and find conserved rows between them. % % USAGE % % [matched,logicalReference,missingElements] = MatchMatrices(reference,query) % % reference 2D matrix where the elements of query will se...
e268e7192a88ce27b338c6e13e482873e5c70c308ce69e8b3ace50a2e8fc07d9
MATLAB
1,854
64
function ft_flush_event(filename, varargin) % FT_FLUSH_EVENT removes all events from the event queue % % Use as % ft_flush_event(filename, ...) % % See also FT_FLUSH_HEADER, FT_FLUSH_DATA % Copyright (C) 2007-2010 Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the do...
7ae44391f326570109e30cb9c879685a86376e8b07eda58b6abb75f800e5b9dc
MATLAB
1,855
66
%io_writejmrui.m %Jamie Near, McGill University 2014. % % USAGE: % RF=io_writejmrui(in,outfile); % % DESCRIPTION: % Takes MRS data in matlab structure format and writes it to a text file % that can be read by jMRUI. % % INPUTS: % in = input data in matlab structure format. % outfile = Desired filename of o...
435a034c9aa4b21cac238927bfebdfbafd4585cb5adecdf6a5bb0c1e8e713d0a
MATLAB
1,856
50
% This function calculates the principal angles between two subspaces % % Inputs: % A - A matrix whose columns form an orthonormal basis for the first subspace. % B - A matrix whose columns form an orthonormal basis for the second subspace. % (Note: Inputs are assumed to be orthonormal. If not, consider usin...
6e9f556c469484b50aee3168531f3a5626d360b7ae88084d42dae4efbc5b6e75
MATLAB
1,856
51
function [INP_mops,INP_ops] = TS_GiveMeInputFiles(whatFeatureSet) % TS_GiveMeInputFiles Gives a set of input files corresponding to a named feature set % %---INPUT: % whatFeatureSet: The name of a feature set. % %---OUTPUTS: % INP_mops: the filename for a master operations input file. % INP_ops: the filename for an op...
760ebf660c9ef189cc8d59a973395e6b3c65a6c20b702174162d99dbc19669e7
MATLAB
1,856
62
% # (JM) MODIFIED FROM ORIGINAL FUNCTION 'EstimateBaselineNoise' function [deltaFoF, mu, sigma, params]=EstimateBaselineNoise(deltaFoF, params) % # ansMethod = questdlg('Choose method for estimation of noise in baseline fluorescence', 'Select method', 'Gaussian model', 'Standard deviation', 'Gaussian model'); ansMeth...
b20033ab766fbb628165daa2bff5104a2ae9370308ca1d50fdf1ffeff8ba4d32
MATLAB
1,856
46
%paired comparisons ttest clear all load('/Volumes/IqraMacFmri/visTac/fMRI_analysis/outputs/derivatives/mvpaStats_pseudo/statsPseudo_anat_HDPT_HUPT_vs_HDFW_HUFW_beta_202404182045.mat') anatSubAccu=mvpaStats.subAccu ; roiList=mvpaStats.roiList load('/Volumes/IqraMacFmri/visTac/fMRI_analysis/outputs/derivatives/mvpaS...
3e8f513e77998e58a77c044413e5183173d65adcd0b376edfd0f1098e2ca54b8
MATLAB
1,857
62
classdef CmdProgress < handle %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % CmdProgress writes progress of a process on the command window. % % Attributes: % base_msg: Message to be shown on the command window. % total_iter: Total number of iterations. % %...
2399aa5be11a11a5948a0d4849bfb067a2cb75117e0e37b1b061babbda920f01
MATLAB
1,858
62
% FORMATTING clear all close gcf global warpFactorLevel vigilance bias learningRate maxNumCategories maxNumIterations sampleInterval resample load Default.mat; warpFactorLevel = 3; % Set to 3 by default addpath(pwd); % GENERATE FIGURE h0 = figure('Units','normalized', ... 'CloseRequestFcn','callback1', ... ...
d2943d932445302de14592c6d7356cd6f5dbf9fcddd567f966eff299513570ce
MATLAB
1,858
52
% (C) Copyright 2020 CPP visual motion localizer developpers function varargout = preTrialSetup(varargin) % varargout = postInitializatinSetup(varargin) % generic function to prepare some structure before each trial [cfg, iBlock, iEvent] = deal(varargin{:}); % set direction, speed of that event and ...
283c6e1e25b8b45aec03af6d6f96673d8e954facb6adc2e1021fde5fcc09283a
MATLAB
1,860
51
function [varargout] = modelFitScore(Mdl,trainTestData,metrics) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % modelFitScore fits model on train data, test model performance on test % data and return its performance score. % % Arguments: % Mdl = Structure of model where function handle...
6a2cb3ae706e70372aa23201c91fc73b4ff57b981068118a7fa0cd68bcd13238
MATLAB
1,861
65
%Encuentra los picos que pertenecen a cada estado tambien las celulas que %pertenecen a cada estado %[Pk_edos,Cells_edos]=Pkedos(C_edos,Rasterbin) LC %C_edos=result.data.f de KmedoikcallLC %Cada columna es un estado diferente y cada elemento es el pico que %pertenece a ese estado % 1 2 7 % 4 3 9 % 6 5...
35592108205a71b1ae73786efcca697ef5efcee6a10a2ba9019d804f3df8cc17
MATLAB
1,863
58
% op_ppmref.m % Jamie Near, McGill University 2015. % % USAGE: % [out,frqshift]=op_ppmref(in,ppmmin,ppmmax,ppmrefval,dimNum); % % DESCRIPTION: % Search for the peak located between ppmmin and ppmmax, and then give that % peak a new ppm reference value. % % INPUTS: % in = input data in matlab structure format....
9bb371fc822df6abf75416809d94dd1bb50fd2244c9bb37b4e481303e993ad67
MATLAB
1,863
59
function herr = plot2BarsWithDots(plotdat,colormat,plot_sig,plot_sig_diff,plot_exact,plot_dots_on_top,xshift) if nargin<7 xshift = 0; end if nargin<6 plot_dots_on_top = true; end if nargin<5 plot_exact=true; end if nargin<4 plot_sig_diff=true; end if n...
78af55343085ab39617630db08ca5fc5703770b3168ef8ee8c01b2a9dbb9e6f9
MATLAB
1,864
57
function [myelin,C1,C2,C3,tau] = Setup_Agents(myelin,borders,sizing) tau = 20; % minutes, timestep duration mins_per_day = 1440; %% CELL 1 C1.init = 5; C1.deathrate = 0.35/(mins_per_day/tau); C1.age = zeros(1,C1.init); C1.x = zeros(1,C1.init); C1.y = zeros(1,C1.init); for ii = 1:C1.init C1.x(ii) = randi([...
1cef30a1729940a7e8af76af974643aa69814e0f424e83804a4b44b7735bb4fd
MATLAB
1,865
57
%% Example code for ensemble detection from raster %1.- Creating synthetic raster N=100; T=10000; fr=0.2; nens = 6; ntimesperens = [0.1 0.1 0.1 0.1 0.1 0.1]; % probability of each ensemble ncellsperens = [10 15 20 25 30 35]; % cells per ensemble [ensmat_in,enscells_in,raster,frates] = MakeEnsembles_fix_rate(N,fr,T,nen...
1f1dd0819a2a2a99216419a3ffebb7c78ab521fbe4e35ee125e5488c8d986b09
MATLAB
1,867
69
function keep(varargin); %KEEP keeps the caller workspace variables of your choice and clear the rest. % Its usage is just like "clear" but only for variables. % % Xiaoning (David) Yang xyang@lanl.gov 1998 % Revision based on comments from Michael McPartland, % michael@gaitalf.mgh.harvard.edu,...
9dca3796deaa57dca64ca91d29ab034b74971d304498413927c76fc2b33d15bc
MATLAB
1,867
61
%% h = sepia_handle_panel_bkgRemoval_VSHARPSTI(hParent,h,position) % % Input % -------------- % hParent : parent handle of this panel % h : global structure contains all handles % position : position of this panel % % Output % -------------- % h : global structure contains all new and...
12ae91b40525e1b13c55e94729e818b6907f80783ac80bb389e9b9b0e70e0395
MATLAB
1,868
59
%% [RDF] = Wrapper_BFR_PDF(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 ...
c30241ef56b0551f98eafd57d09f645485f0389ab92eed28a42db1e8fb5812af
MATLAB
1,868
54
function [x, cost, info, options] = manoptsolve(problem, x0, options) % Gateway helper function to call a Manopt solver, chosen in the options. % % function [x, cost, info, options] = manoptsolve(problem) % function [x, cost, info, options] = manoptsolve(problem, x0) % function [x, cost, info, options] = manoptsolve(pr...
a53000886f3262d9812d02e8ea50ac2b5bba9c0de9514d499eac8701d7338cea
MATLAB
1,869
54
% [totalField, N_std, headerAndExtraData] = Wrapper_EchoCombine_MEDInonlinearfit_bipolar(fieldMap,mask,matrixSize,voxelSize,algorParam,headerAndExtraData) % % Input % -------------- % fieldMap : original single-/multi-echo wrapped phase image, in rad % mask : signal mask % matrixSize : size of the inpu...
03b37d29e988602e2b8228591e9cf85e19d85e8d0878bb1f24dc665de706ef84
MATLAB
1,870
59
function herr = plotBarsWithDots(plotdat,colormat,plot_sig,plot_sig_diff,plot_exact,maxdat,maxdat2,showBaseline) if nargin<8 showBaseline = true; end if nargin<7 estim_maxdat2 = true; else estim_maxdat2 = false; end if nargin<6 estim_maxdat = true; else ...
218981d140cfcfe90fd2f26d962bad2a989337abd822da77efd390bea66d0e4a
MATLAB
1,870
49
% logging_override_disp() - Return the current stack trace as a string % formatted with the provided format string and % starting with the preamble % Usage: % >> logging_override_disp(display) % % Inputs: % display - true|false if you want to override disp functi...
8b491c825537b9c06c33c0aa3210ed279f4427d91bc36e3262d2cb82000c062d
MATLAB
1,870
68
function [chi2, df, p, sig, warn, tab, isnonpar] = Meta_Parcel_chisq(MC_Setup, parcels, parcel_stats) % % Documentation here. % % [chi2, df, p, sig, warn, tab, isnonpar] = Meta_Parcel_chisq(MC_Setup, parcels, parcel_stats) % % First run Meta_Activation_FWE('setup'....) which creates MC_Setup (stored in MC_Info.mat) %...
a28f72d856a5649326e426207d511d8fce6a11b501cbf594742c8b157dbf2e46
MATLAB
1,870
41
function [slope intercept] = findFlipCorrectionSlopeLR(leftmyelin, rightmyelin, leftFlipFraction, rightFlipFraction) lowguess = -1; highguess = 5; searchratio = 1 - 2 / (sqrt(5) + 1); % 1 - inverse of golden ratio currange = highguess - lowguess; points = [lowguess, lowguess + searchratio * currange...
a4644754a9e1d412782d376634f0bfcacf18cc2bfe29cfced2548f474c755e70
MATLAB
1,870
50
function data = transientrates2(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 nargin...
259dbb6904e484033538383ac05281aece830befa248aa700c7b525efdc4450e
MATLAB
1,872
46
%% ============================= % PALM Analysis: Re-Extinction CS % ============================= % --- Locate repo root (relative to this script) thisfile = mfilename('fullpath'); [scriptdir, ~, ~] = fileparts(thisfile); cd(scriptdir); % Ensure consistent working dir % Navigate up to FEARTUS root % palm_code -> p...
5684ff5df94e3944ad2570b2157db84ee136b5db5eb2734ec949eb78f291bcc4
MATLAB
1,872
46
%% ============================= % PALM Analysis: Re-Extinction CS % ============================= % --- Locate repo root (relative to this script) thisfile = mfilename('fullpath'); [scriptdir, ~, ~] = fileparts(thisfile); cd(scriptdir); % Ensure consistent working dir % Navigate up to FEARTUS root % palm_code -> p...
6426053b1ca88d7e526e161588622bd20b22b4c4d69d4da68ddc47cdbcb514a8
MATLAB
1,872
59
function sim_default() % Minimal, no-input driver: generate V1 inputs and run 3 simulations. % --- Paths thisFile = mfilename('fullpath'); repoRoot = fileparts(fileparts(thisFile)); dataDir = fullfile(repoRoot, 'data'); utilsDir = fullfile(repoRoot, 'src', 'utils'); addpath(utilsDir); % --- Config simulation_type = ...
14e463ec43225208338b4dad1e7a78043c8758e3d649400c9908e8a70952bc28
MATLAB
1,874
58
function this = remove_dims(this, iDim) % Removes information of dimension(s) specified (by names or index) % % Y = MrDimInfo() % Y.remove_dims(inputs) % % This is a method of class MrDimInfo. % Use cases are the selection of single values from one dimensions to loose % all information on the specifie ddimension % ...
2a8c07177cd49199278999c113cf8808d95411e9e133570e614f2a212e3d1151
MATLAB
1,875
61
function [options, param_changes] = parse_simulation_inputs(varargin) % PARSE_SIMULATION_INPUTS - Parse and validate input arguments % % H1 Line: Parse optional inputs for simulation configuration % % Syntax: % [options, param_changes] = parse_simulation_inputs() % [options, param_changes] = parse_simulation_inputs...
6e7e3c312069b79b79af83a899da298646d0cc7d87ab07af6c40658ce1d993ed
MATLAB
1,875
70
function [C1] = Renew_Cell_1(C1, nn, tau, relapse_schedule) % RENEW_CELL_1 % % Introduces new C1 cells (T cells) in the peripheral blood according to % specified relapse schedules. % % INPUTS: % C1 - structure containing current C1 cells (x, y, age) % nn - current timestep % tau ...
70b7b044a290ce11569e5997ce8bf9cff9e33fd3a5b066ff5d1a5f78c27ce8da
MATLAB
1,875
55
function [logp, yhat, res] = tapas_rs_belief(r, infStates, ptrans) % Calculates the log-probability of response speed y (in units of ms^-1) according to the belief % model introduced in: % % Vossel, S.*, Mathys, C.*, Daunizeau, J., Bauer, M., Driver, J., Friston, K. J., and Stephan, K. E. % (2013). Spatial Attention, P...
cd288a62f1af833285d729689100495c53504415e11eafa1540fb665640f33b1
MATLAB
1,875
56
% logging_ffileline() - return a string containing the file and line % Usage: % >> output = logging_ffileline(formatstr, unroll) % % Inputs: % formatstr - format string containing string and line number % unroll - number of levels of recursion to unroll % % Outputs: % output - formatted string to return %...
0d1af542927c17fe7471013b1f1e6904f928396ac16238263eedcd4f0036f87f
MATLAB
1,877
88
% load it... EEG = pop_loadset('filename','example_set.set','filepath','/data1/Dropbox/Dropbox/Prog/GitWork/CWRegr/eeglab13_1_1b/plugins/CWRegrTool/example_dataset/'); % do an actual CW regression... EEG = pop_cwregression(EEG, 500, 4.000000, 0.050000, 4, 'hann', [33 34 35 36 37 38 39 40], [1 2 3 4 5 6 7 8 9 10 11 12...
91a5d5ea0ccf54c262ae5d10f982f715ff1387e0c3d7bd2ec9c3b6c9d35dcacc
MATLAB
1,877
72
function plot_fig2d(datadir) % Plot average event-aligned dopamine release during mixed blocks for % different reward offers. Signals are z-scored and baseline corrected % before pooling across rats (N = 10). % % INPUTS % datadir: file path of data downloaded from Zenodo. Link to download can % be found in README. bas...
cec94348851cb153a139196c280db924c4572bd0052c4843fb327b86cb1b4d54
MATLAB
1,877
81
function result=kmeans(data,param); %checking the parameters given %if exist('param.c') == 1, c = param.c;else error('Nincs megadva a c, es ez baj...');end; %if exist('param.vis')~=1, param.vis=0;end; %data normalization data=clust_normalize(data,'range'); X=data.X; [N,n]=size(X); %initialization if max(size(param...
2611522d2025977e556bb022731e8730f9d74413ca3ecde1b784a984dd0cb937
MATLAB
1,878
67
function c = tapas_logrt_linear_binary_minimal_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the linear log-reaction time response model % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
5412b49371d237eb7e531264b92736746548b7300e5362a08a8737407755dfb9
MATLAB
1,878
72
function [cost, info, x, A] = test02(n) % function [cost, x, A] = test02(n) % All intputs are optional. % % Typical call: [cost, x, A] = test2(1000); % Perhaps the simplest test code: computes the dominant eigenvector of an % n-by-n matrix. % % This file is part of Manopt: www.manopt.org. % Original author: Nicolas Bo...
6758486c6de4551b0060366e551027601d9608485f0a16c29bc4e1cea8841900
MATLAB
1,878
63
function h=pageFigure(figI,paperSizeORheightToWidth,proportionOfScreenArea,horPos0123,landscapeFig) % creates a page figure with figure with specific properties. % h=pageFigure([figI,paperSizeORheightToWidth,proportionOfScreenArea,horPos1234]); %__________________________________________________________________________...
6f189420fce0e0681935562717917669d56259650b347884dbd76c04a1f3edef
MATLAB
1,878
53
%{ pre.Trace (imported) # calcium trace -> pre.ExtractTraces -> pre.SegmentMask --- ca_trace : longblob # raw calcium trace %} classdef Trace < dj.Relvar methods function plot(self) for key = fetch(pre.Segment & self)' X = fe...
b913d60019d8841b6fd9e18ad4fe80e49ca6140031b261d34429d27622760779
MATLAB
1,878
47
% SUM - sum 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 or withou...
c3427c46fe3035b407100d5094c4c246ede0c43027168e1aac6b285c67662369
MATLAB
1,878
79
% Tools for finding your way around a layout. % % (a) Recreate the complex layout from demopanel1 % (b) Show three tools that help to navigate a layout %% (a) % create panel p = panel('defer'); % layout a variety of sub-panels p.pack('h', [1/3 -1]) p(1).pack([2/3 -1]); p(1,1).pack(3, 2); p(2).pack(6, 2); pause(3...
e03f2c55c578f24932a094c2509ef02a27dbea3bc604b3226831bbba35b499eb
MATLAB
1,878
54
%% JPKforce_batch_processing.m 14/08/2020 Julia Becker % This script makes the conversion of .jpk-force files into .txt files more % efficient if data in many different subfolders need to be converted. Move % all experimental folders you want to convert into one folder. Use a % search to find all "*.jp...
7540ca00f1e39b773551e16ed3402160fdda69d1104516ce2a08b801f01439fc
MATLAB
1,879
83
function [maxprop,uncor_prop,maxcsize] = meta_stochastic_activation(MC_Setup) % MC_Setup = meta_stochastic_activation(DB) % % This function randomizes n locations for each study within analysis mask % and computes null-hypothesis weighted proportion of activated studies % (contrasts) % for whole-brain FWE corrected Mon...
ccd0eb57f5f4ccf667d8de642ce745ec5b86f25bc15956b2db55606878e7eef1
MATLAB
1,879
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....
64f586ef94525c00cc696450cfb656fb356a0da6d6837fcf8dec4779bcef9a8a
MATLAB
1,880
42
function [ensmat_in_sort, enscells_in_sort, ens_id] = sort_by_equivalence_rh(ensmat_gt,ensmat_est,enscells_est,metric) % Sort ensembles detected by its equivalences with generated ensembles sequences. % INPUT: % ensmat_gt: <logical> nens_1-by-T matrix with the activity of each generated ensemble. % ensmat_est: <log...
ecb7c71d47e99c3d0d49f71e9318bdea95beed9973b54de4a29b3bf87c3ac451
MATLAB
1,880
67
function arrow3D(pos, deltaValues, colorCode, stemRatio) % Plots a simple 3D arrow via a cylinder and a cone X = pos(1); Y = pos(2); Z = pos(3); % Get polar coordinates [sphi, stheta, srho] = cart2sph(deltaValues(1), deltaValues(2), deltaValues(3)); % Create stem as cylinder cylinderRadius = 0.05*srho; cylinderLength...
0d0630988dd72f79e7ee4bf8a34a6fd709445dd56f3dec30337ffab1327216d9
MATLAB
1,881
64
function this = MrDataNd_permute(this) % Unit test for MrDataNd.permute() % % Y = MrUnitTest() % run(Y, 'MrDataNd_permute') % % This is a method of class MrUnitTest. % % IN % % OUT % % EXAMPLE % MrDataNd_permute % % See also MrUnitTest % Author: Saskia Bollmann & Lars Kasper % Created: 2018-08-28 % Copyrigh...
3c4935ce70b8aed9bb8242a4ec103870d0b1389fa5fd25fef806fd2846069649
MATLAB
1,881
59
function [count,cycles] = CountSpikesPerCycle(spikes,phases) %CountSpikesPerCycle - Count number of spikes per LFP cycle. % % Count the number of spikes per cycle in the ongoing oscillatory LFP % (e.g. during theta). % % USAGE % % [count,cycles] = CountSpikesPerCycle(spikes,phases) % % spikes list of sp...
a8a00eaee8177f0685aa9b02e77bf3dc67696216f758b49cc6abde81ae01712f
MATLAB
1,882
50
function [D, fX] = dfunm(funm, X, H) % Fréchet derivative of matrix functions. % % function [D, fX] = dfunm(funm, X, H) % % Computes the directional derivative (the Fréchet derivative) of a matrix % function (such as @logm, @expm, ...) at X along H (square matrices), % according to a very nice trick which appears in th...