sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d2f5ac3aabfab41348099fd78fbb2af0996ffad2793fbec098873ca449a33366
MATLAB
1,355
35
function [blk_rat_mean, blk_rat_sem, blk_mdl_mean, blk_mdl_sem] =... ratAndMdlWTCurves(ratname, BestFit) A = BestFit.(ratname).Test.ratTrial; usethese = A.catch & A.optout & ~isnan(A.wait_time); rew = convertreward(A.reward(usethese)); blk = A.block(usethese); wt_rat = A.wait_time(usethese); wt_mdl = Bes...
1b87d85d71b307b1d86825e68c253dcfb15ce86c4ddd264a8b21901256ac2cec
MATLAB
1,356
41
%% CheckboxEditPair_Callback(source,eventdata,handleToBeDisable,trueValue) % % Input % -------------- % handleToBeDisable : uicontrol to be disabled when the paired checkbox is % chekced % trueValue : the condition of when the uicontrol should be % disabled % % Descriptio...
a503259a235c45ff88b5189a6a85cfad7322e55f31262d9d4bfa419a8dc54b52
MATLAB
1,356
36
%{ rf.Scan (manual) # scanimage scan info -> rf.Session scan_idx : smallint # number of TIFF stack file --- -> rf.Site file_num : smallint # number of HD5 file depth=0 : int # manual depth measurement laser_wavele...
a8c935295b6eb0610ce7c240f9118cc2cd69151f7648f290d3ae30799881b879
MATLAB
1,356
47
function renameVar(obj, oldName, newName, varargin) %RENAMEVAR Rename a variable % RENAMEVAR(OLDNAME, NEWNAME) changes the name of the variable % OLDNAME into NEWNAME. NEWNAME should not be the name of an % existing variable. opts.quiet = false ; opts = vl_argparse(opts, varargin) ; % Find the variable to renam...
c29dc27801fce8776bcc455f8dff161a017191d67b1f7c5a471d162754487067
MATLAB
1,356
40
function test_suite = test_setBlocksConditions %#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 ...
08fc332688eb769bffbc00a66e1f1d3e605088cf4c8db817d7a049fe34b961b1
MATLAB
1,357
38
function [cropMovie, corn] = postCropping(movie,corn) [movie_pad]=padarray(movie,[1 1],0,'both'); if nargin<2 % needs to compute corn % to get mask with 1 in the overlapping area maskNAN = isnan(movie); % detect any nan value % maskZERO=~movie; % detect any zero value mask3d=maskNAN;%+maskZE...
229765213299c90fdd0c4eb2ab21f22724ac9283fff8c58d200f3314405b3655
MATLAB
1,357
47
function [lp,dlp] = priorGamma(k,t,x) % Univariate Gamma hyperparameter prior distribution. % Compute log-likelihood and its derivative or draw a random sample. % The prior distribution is parameterized as: % % p(x) = exp(x/t)/gamma(k)*x^(k-1)/t^k % % where k(1x1) is the shape parameter, t(1x1) is the scale paramete...
e19415bdffc3e5b3211b31038db67d2238e64170a596c99222544dbb4d7b6d7a
MATLAB
1,357
44
function pathName = tapas_uniqc_simplify_path(pathName) % Simplifies path name string by replacing all relative paths in it, i.e. ..\, .\ % % pathName = tapas_uniqc_simplify_path(pathName) % % IN % pathName string with relative path symbols, e.g. % 'C:\bla\recon\test\..\code\classes\..\..\test\.\' %...
1e2172b5935b4f6682807b0f6f175bc59d7ff3c63d06a311004d325974978d01
MATLAB
1,358
47
function [stability] = compute_stability(featureSet) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % compute_stability computes stability from given matrix of feature sets % using Pearson Correlation Coefficient. % % Arguments: % featureSet: NxM matrix of feature sets, given each row i...
988e0384d4b342c939487ba5175dfead03816d38d75ea36eb7103b688863c95d
MATLAB
1,360
50
function varargout = get(tpl,action,varargin) %TEMPLATE/GET Access data stored in a Template object % TPL = GET(TPL,ACTION,VARARGIN) % ACTION 'var' % ACTION 'undefined' % Copyright (C) 2003 Guillaume Flandin <Guillaume@artefact.tk> % $Revision: 1.0 $Date: 2003/05/05 22:19:51 $ narginchk(2,3); switch lower...
ed82a624c9f518361c0008dd633e614a6378a3d73f7f8a5ba5cd408098df7d13
MATLAB
1,360
33
%% TestingScripts %% Load Unit Class Data ClassifyUnits; clearvars -except Unit %% Load Two Data targetTank = '#21JAN2-210406-190737_IL'; result_distance = load(fullfile('D:\Data\Lobster\FineDistanceResult_syncFixed_May', ... strcat(targetTank, 'result_distance.mat'))); result_event = load('D:\Data\Lobster\BNB_Re...
04d987ef06695e7669c9eae73b37f0127c2ab819111c276bc8c7bdbd8b6eac39
MATLAB
1,361
47
function outputImage = plus(this, otherImage) % Adds data of other image to this one and writes output in new image % % NOTE: If voxel dimensions of 2nd image do not match - or a scalar is % given as 2nd argument - data in the 2nd argument is automatically % replicated to match this image geometry. % % % Y = MrImage(...
d3cca6a7d8b9ba76babc397d453439ee94704c271574ef690fc7654ada2f424d
MATLAB
1,361
56
function DB = meta_get_contrast_numbers(DB,varargin) % function DB = meta_get_contrast_numbers(DB,testfields) % % e.g., for Pain meta-analysis % DB = meta_get_contrast_numbers(DB,'Study','Subjects','Kind_of_Pain','Limb_v_Head_or_Chest','Right_vs_Left'); % concatenate fields of interest % ------------------------------...
0562e3bb594b6af19e18c4909a12b634a7eb914dca9919332b7a014a72c86e73
MATLAB
1,362
31
%T=readtable('../Test_Data/csv/Sb_HICEAS1706_20170913_AD259_S123_sel22_220035.csv') % GET ARTwarp ROOT PATH FOR REFERENCE WHILE RUNNING IN CONTINUOUS % INTEGRATION tstDir = fileparts(mfilename("fullpath")); ARTwarpRoot = fullfile(tstDir, '..'); % Add the ARTwarp root path to the MATLAB path so we can run ARTwarp's % ...
b42e8623dd2e5c84d62f93ec2330595c9f8f9a28212081e66cd95dd1214ef57e
MATLAB
1,362
52
function [output] = volumefillholes(input, along) % VOLUMEFILLHOLES is a helper function for segmentations % % See also VOLUMETHRESHOLD, VOLUMESMOOTH % check for any version of SPM %if ~ft_hastoolbox('spm') % % add SPM8 to the path % ft_hastoolbox('spm8', 1); %end if nargin<2 inflate = false(size(input)+2); ...
15333719ff1687c34da14ffcad7d62a2e0d745f053236e7f9d330877c776f743
MATLAB
1,363
45
function match = ART_Calculate_Match(input, weightVector) % ART_Calculate_Match Calculates the match value of an input to a category. % MATCH = ART_Calculate_Match(INPUT, WEIGHTVECTOR) % This function returns a value which represents the amount of match % between the given input and the given category. % %...
18bb5dd646118cb34b8d8f8268b54370634d57308046ac8011718b060ef33343
MATLAB
1,363
68
function ft_cubic_mask(input, path_output, name_output, c, r) % Cubic mask % % ft_cubic_mask(input, path_output, name_output, c, r) % % Inputs: % input - file name of time series. % path_output - path where output is written. % name_output - basename of output file. % c - array of center coordin...
6b79dbbbe1ebec2f5f77e4f397f6fd182a7f5f7a5e836e156530159f433127b3
MATLAB
1,363
63
function [Fup,ix_up,Fdel,ix_del,ix_bad,dmax] = ... fincrease_update_act(A,S,Q,SY,ix_act) % % --- dF for Update component % global a_min; % % --- Residual correlation for active index 'ix_act' % a = A(ix_act); s = S(ix_act); qq = SY * sum(Q(:,ix_act).^2,1); b = 1 - s./a; % scale factor ...
782034e5c5bf273f948e34a6ccb0e9e6870a4703633511aaddcd6982e73ab2b0
MATLAB
1,363
45
function varargout = PlotXY(X,varargin) %PlotXY - Plot two columns of a matrix against each other. % % Plot the second column of a matrix as a function of the first column. % Optionally, alternative pairs of columns can be plotted against each other. % % USAGE % % p = PlotXY(X,columns,<options>) % % X ...
1683528e8df27575876e827d3b7ad55f330a47d4e2f47fe078c77a4fd5d8b15c
MATLAB
1,364
53
function [ output_args ] = seed_devrandom( verbose ) %SEED_DEVRANDOM( verbose ) Seeds the internal random number generator from %the /dev/urandom device (only on Unix systems). % % INPUT: % verbose [boolean] % % OUPUT: % output_args [scalar]: 4 byte random seed % % % === Jan Moelter, The University of Queensl...
30aa48d43bf31b29be5d0e430990b2a3d4d7c3244ea31319d4380eea6c2abc4e
MATLAB
1,364
46
function fear_makeUnitInfo(basename) load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([basicMetaData.Basename '.okUnit.spikes.mat']) load([basicMetaData.Basename '.ngUnit.spikes.mat']) tBinSize=60; %in sec tBin=basicMetaData.detect...
a1ebe696be859610470ef75d9c46b8d5f64130c2c92a61c1084fc6cf8334fad1
MATLAB
1,364
26
function [ismoving,v] = movingmask3(y, framerate, span, minspeed) % Creates a mask [ismoving] for a given trace that is 1 if the calculated speed [v] exceeds minspeed. % y: a vector of recorded positions indexed by frame numbers. Note that 1 unit of y equals 2 meters of real-world distance (as in the ball-VR system) ...
5b18040cddd4cfe8d8efe26020d22d209ce4acbb0e80ff30238472b1434ef9a2
MATLAB
1,365
64
function[Xopt, Y] = testsimplexmatrices() clear all; rng(103) n = 2; k = 3; Y = zeros(n,n,k); for kk = 1:k Y(:,:,kk) = randn(n,n) + 1i*randn(n,n); Y(:,:,kk) = 0.5*(Y(:,:,kk) + (Y(:,:,kk))'); %Y(:,:,kk) = sparse(diag(diag(Y(:,:,kk)'*Y(:,:,kk)))); %Y(:,:,kk) = sp...
64e0016610cfcbbfa5e2216c4dd0d3571e99cfd2b49e72c503ea95ee2bad286a
MATLAB
1,365
48
function out = isText(value,opt) %isText - Test if value is character vector or string % % USAGE % % test = isText(value) % % value item to test % <options> optional list of property-value pairs (see table below) % % ========================================================================= %...
7afb71f389ddec6179fae9a1a1f9d52f5720b234d4a243f92b919f5a7f3a1dea
MATLAB
1,365
43
function save_avw(img,fname,vtype,vsize) % SAVE_AVW(img,fname,vtype,vsize) % % Create and save an analyse header (.hdr) and image (.img) file % for either a 2D or 3D or 4D array (automatically determined). % fname is the filename (must be inside single quotes) % % vtype is 1 character: 'b'=unsigned byte, 's'=short...
0ea80c0ca7255d28c6079604373dab9f3f14fb393ed25685905aa1f46c3b05ec
MATLAB
1,366
47
% support function for eegobj function varargout = subsref(this,s) if strcmpi(s(1).type, '()') && length(this) > 1 %if length(s(1).subs{1}) % error('Unsuported object feature - a.field or a([x y]).field is not supported for object arrays'); %end % if length(s) == 1 % b = this(s(1).subs...
a72a1396482dacef8c8034046fba8ba6c0f8fd8256bace3fe7fc894c0601d1a0
MATLAB
1,366
39
function outputImage = snr(this, varargin) % Computes snr along specified dimension, uses Matlab mean/std function % % Y = MrImage() % Y.snr(applicationDimension) % % This is a method of class MrImage. % % IN % applicationDimension image dimension along which operation is % performed ...
f7774e08eb71ce18b4616ba7cef78ddcf343934f179bf3d4fad3026ab96e6140
MATLAB
1,366
69
function [err,XYZmm,map] = THD_dicomm_to_3dmm (Info, XYZdic) % % [err,XYZmm,map] = THD_dicomm_to_3dmm (Info, [XYZdic]) % %Purpose: % % Change from image-oriented mm coordinates to AFNI dicom (RAI) coordinates % %Input Parameters: % Info: Structure of header file, see BrikInfo % XYZdic: Nx3 matrix of dicom coord...
8d25e79668e42288b4965a9de53837376c0571d927ba327bee2bc6ca9dd6f58a
MATLAB
1,367
32
function params = configureMethodParameters(params, timepoint) % Sets up the specific parameters for signal processing and artifact % detection methods. Includes thresholds for motion detection, channel % pruning, and signal quality assessment based on established research % parameters. % Motion detection wind...
c6d70e46ffbe39bb2bafd8b5bad763a06f4a77ecffbc95362ad9f73f775b227c
MATLAB
1,367
35
% Read the data from the CSV file data = readtable('../../Results/single_ct_acc.csv'); % Extract the 'best_acc_2' column acc_data = data.best_acc_2; % Define the value to test against mu0 = 0.5; % Perform a one-sample t-test (right-tailed) % H0: mean(acc_data) = mu0 % H1: mean(acc_data) > mu0 [h, p, ci, stats] = tte...
035bedf9bc4ab618c3575205eb033192ee8786018f58a614a912cfc4bd06a21b
MATLAB
1,368
47
classdef nnpdist < nntest properties (TestParameter) oneToOne = {false, true} noRoot = {false, true} p = {.5 1 2 3} aggregate = {false, true} end methods (Test) function basic(test,oneToOne, noRoot, p, aggregate) if aggregate % make it smaller to avoid numerical derivative issues...
25a467f8cfdb78566b5905d64fabe8cd7271dd1a812836a094a2b7fda48b16bc
MATLAB
1,368
49
function [] = plotAnalysis01B(saveFigures) % Produces plots to visualize the results of analysis01B. % save figures by default if nargin==0 saveFigures = true; end % get file paths paths = addPaths(); analysisName = 'analysis01B'; % get names of all files in analysis directory files = dir(fullfile(paths.outputs,...
262a6559ddf55e343032602735c4747d6b2e05ea60b8f740e16ee7e3d19dad67
MATLAB
1,368
43
function hist = read_ctf_hist(filename) % READ_CTF_HIST % Copyright (C) 2010, Arjen Stolk [p, f, x] = fileparts(filename); if strcmp(x, '.ds') % the filename should point to the hist file, not the ds filename = fullfile(p, [f x], [f '.hist']); end fileline = 0; fid = fopen(filename,'r'); % the hist file ...
75092daa7e00e02114f230cb6c5435c46989bc6ae1973af2943d39c08fda4040
MATLAB
1,368
47
classdef nnpdist < nntest properties (TestParameter) oneToOne = {false, true} noRoot = {false, true} p = {.5 1 2 3} aggregate = {false, true} end methods (Test) function basic(test,oneToOne, noRoot, p, aggregate) if aggregate % make it smaller to avoid numerical derivative issues...
5c9281e9099217b3581c98762d27ee2a4e2f3afbc1530c95cf851aedf13f93b7
MATLAB
1,369
31
function [pvec, pstruct] = tapas_hgf_binary_pu_tbt_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2015 Rebecca Lawson, Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the term...
62cba2fe11717f5423cfeb96e797e2b81691887425a7d2b7203c35a45c9eb0da
MATLAB
1,370
40
function varargout = ft_error(varargin) % FT_ERROR prints an error message on screen, just like the standard ERROR function. % % Use as % ft_error(...) % with arguments similar to fprintf, or % ft_error(msgId, ...) % with arguments similar to error. % % See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ...
e1cecc06b2a5097251e655206532c483848b97fb0169592334c31334751f0a10
MATLAB
1,370
49
function [node2area,face2area]=surfing_surfacearea(c,f,n2f) % Computes node and face areas of a surface % % [NAREA,FAREA]=SURFING_SURFACEAREA(C,F[N2F]) % INPUTS: % C Px3 (or 3xP) coordinates for P nodes % F Qx3 (or 3xQ) node indices for Q faces % N2F Optional node to face mapping (from SURFI...
6079ef803e4394fdc6310e49a8505d59dbe424dd6b45875596beb82960b99c24
MATLAB
1,371
41
function plot_raster(ax,tt,raster,ens_labs,ens_cols) % plots raster and colors each bin according to the identity given on % ens_labs vector. ens cols is a nens x 3 matrix with colors for each % ensemble. If ens_labs and ens_cols are empty, plots only the raster. % ax is the axes to plot % Reference paper: Herzog et a...
a1021dba3cd4a8fc1f2671eb0054feca06150e83fcbca917f183b2924f779b02
MATLAB
1,371
40
%{ monet.DriftResponse (computed) # calcium responses to drift trials -> monet.DriftResponseSet -> monet.DriftTrial -> pre.Trace ----- response: float # averaged response %} classdef DriftResponse < dj.Relvar methods function makeTuples(self, key) disp 'preparing traces...' frameTimes = f...
1032f9cb277b5ba52facdd257c9ae0dbfb241b2681ccf512980050bbc5227521
MATLAB
1,372
37
function db_insert_blob(tablename, fieldname, s) % DB_INSERT_BLOB converts a Matlab variable of arbitrary type into % a binary stream and inserts this stream into a binary blob in the % database table. % % Use as % db_insert_blob(tablename, fieldname, s) % % See also DB_OPEN, DB_SELECT, DB_SELECT_BLOB, DB_INSERT, DB...
482f362e5fd35f859b076efff87285563370b51e261f702569599ea8b8a00f7f
MATLAB
1,372
42
function outputImage = shuffle(this, iDimArray, shuffledSamplingPointsIndexArray) % Shuffles sampling points of specified dimensions, and dimInfo-description % (?) % % Y = MrDataNd() % Y.shuffle(inputs) % % This is a method of class MrDataNd. % % IN % % OUT % % EXAMPLE % shuffle({'y','z'}, {[nSamples:-1:1], [1:2:...
af61d0d39bdf7f083cf5d6f63dc05864606fbe3835956b9c128d94c16cd89702
MATLAB
1,372
53
% % 'overseer' function for performing & logging subtraction without % any kind of windowing. % % % [data,cfg]=m_do_everything(data,cfg) function [data,cfg]=m_do_everything(data,cfg) % % probably can be removed.. % cfg.cwregression.srate = 1000; %srate=1000; % cfg.cwregression.windowduration = 1.3; ...
d742db08054a782f5d421adc68ea0558036182954a10e417c86b1cb1263fd81d
MATLAB
1,372
51
function [y,n_dim,vecs,vals,mu] = pca(x,frac,mask) % %function [y,n_dim,vecs,vals,mu] = pca(x,frac,mask) % % principal components analysis % transforms input data x using PCA, reduces dimensionality % to capture fraction of magnitude of eigenvalues % % inputs: % x - input data M dimensions by N samples % frac - [0...
59aa0a2d0e7bb81b502c257bd419c0aea49f0d39dfafbde1b90a2a96565fcff1
MATLAB
1,373
47
function UpdateCluster(ClusteringData, clustAssign, clusterName, rejected) %% This function saves the files with new cluster names h = waitbar(0,'Initializing'); [files, ~, file_idx] = unique(ClusteringData.Filename,'stable'); % Merge "Noise" and "noise" clusterName = mergecats(clusterName, {'Noise', 'noise'}); % A...
5edac581443905b866f15114c4620adebd4ab80b33d1320f83931321bf3a96b6
MATLAB
1,373
52
function [b b0] = circ_skewness(alpha, w, dim) % [b b0] = circ_skewness(alpha,w,dim) % Calculates a measure of angular skewness. % % Input: % alpha sample of angles % [w weightings in case of binned angle data] % [dim statistic computed along this dimension, 1] % % If dim argument i...
12f43e921fbec1f5c7ee9524348e41ae7025f3774b9a01c9f7c1c2050a79e11f
MATLAB
1,374
41
function outputImage = sum(this, applicationDimension) % Computes sum along specified dimension, uses Matlab sum function % % % Y = MrImage() % Y.sum(applicationDimension) % % This is a method of class MrImage. % % IN % applicationDimension image dimension along which operation is % p...
51e220200fa7b60252309108317832787711be2a0de75e3dbf04ed48ad26d3ee
MATLAB
1,374
30
=============== RAW DATA (rawdatamovies) √ LOOK AT RAW DATA LIKE movie itk-snap of 1 random run. sess10, run06 ls -d *NSD134*nsd10/dicom/*MR*bold* cp -r DATECENSORED-NSD134-nsd10/dicom/MR-SE019-cmrr_mbep2d_bold_84slices_1pt8mm_1600TR_MB3_R2 ~/Dropbox/KKTEMP/subj01 cp -r DATECENSORED-NSD139-nsd10/dicom/MR-SE019-cmrr_...
922163d50343ba1af0d5258e1284b11a56092e6340619490b8fc8027ab126d75
MATLAB
1,374
42
function eegTopoplot(H_topo, mapVals, info) % plots head topology of EEG values % (c) Jiri, Aug16 % figure if ~isfield(info.plot, 'figHandle') f = figure('visible','on', 'Position',[1, 1, 1920, 1200]); set(f, 'PaperUnits','inches', 'PaperPosition',[0 0 19 12]); else f = info.plot.figHandle; end % axes ax...
daddb99b8645236c6050496612cf83e891ac316d38587e04366f99418bea54e9
MATLAB
1,374
61
function [ace_out,mu,siginv] = ace_detector(hsi_img,tgt_sig,mask,mu,siginv) % %function [ace_out,mu,siginv] = ace_detector(hsi_img,tgt_sig,mask,,mu,siginv) % % Adaptive Cosine/Coherence Estimator % % inputs: % hsi_image - n_row x n_col x n_band hyperspectral image % tgt_sig - target signature (n_band x 1 - column vec...
e8c5ff99431168332e8750443aa7bb75a075298f5ade836ce1a78ac31f67292a
MATLAB
1,374
55
function h = imshow_deformation(d, vs, z, slice, nrm) dim = size(d); if numel(dim) > 4 dim = [dim(1:3) dim(end)]; d = reshape(d, dim); end if nargin < 5 nrm = nan; if nargin < 4 slice = 3; end end dim = [size(d) 1 1 1]; if numel(size(d)...
fa16b637c0f5cbe754f7b7341968a2e2e917b100f99231361560e503ba19e4fe
MATLAB
1,374
37
function [fpr, tpr] = fpr_tpr(data_real, data_est) % Calculate the FPR and TPR values. % INPUT: % data_real: <logical> D-by-T matrix with the real data, where D is the number of data to % compare in a trial and T is the number of trials. % data_est: <logical> D-by-T matrix with the estimated data, where D is t...
1ecc6fa68daba8b2bcc88fbe606e1288f6f9c8af54aa932b6a9aa651bfb74893
MATLAB
1,375
63
function fig_save(varargin) % saves figure % varargin{1} = figure handle % varargin{2} = figure name % varargin{3} = output directory % further input arguments in varargin are tuples: attribute,value % usage: % fig_save(f, 'figname', outDir, 'format',{'png','fig'}, 'res',600); % (c) Jiri, Mar20 assert(size(varargin...
31fa683bd0f577510a5f422b17be0666e0fc9e835f49ddc93a10119228679e65
MATLAB
1,375
43
%{ tuning.MonetRFMap (computed) # receptive fields from the monet stimulus -> tuning.MonetRF -> preprocess.SpikesRateTrace ----- map : longblob %} classdef MonetRFMap < dj.Relvar methods function save(self) path = '/Volumes/scratch01/RF-party'; for key = self.fetch' ...
7ded9603afd64ac5a8aac7286de72b5d1fbd6941ee177250633e87d5f0ea2121
MATLAB
1,375
44
function [Cost, Path] = mfunc_DisconnectivityGraph(E, LocalMinIndex, AdjacentList) try % Set adjacecy matrix [sy, sx] = size(AdjacentList); AdjacencyMatrix = zeros(sy, 'logical'); tmp1 = repmat(1:sy, sx, 1); tmp2 = AdjacentList'; AdjacencyMatrix(sub2ind(size(AdjacencyMatrix), tmp1(:), tmp2(:))) = true; Adjace...
b293660bc9a31ad40d72609037fde3143d57b49664a092854eb5f83f8bb8e13f
MATLAB
1,375
23
function [mean_zscore,diff_zscore] = get_zscore_sta_mean(raw_trace, this_event_frames, this_pre_frames, this_post_frames,baseline_frames,avg_frames,varargin) % the mean difference in z-score during the first three seconds following % each event onset (avg_frames) % and 5 to 2 seconds before the event onset from ra...
fedab57cd279d3e736277b8ab2bf26d29e9ecd679fcccaa9e4f55f25f8f3746c
MATLAB
1,375
62
function [xyzall,codesall,orderall] = average_nearby_xyz(XYZ,thresh,codes) % [xyzall,codesall,orderall] = average_nearby_xyz(XYZ,thresh,codes) % % for plotting peak coordinates on the brain, for example, eliminating % redundant nearby coordinates from the same study % % Fixed bug for SINGLE coord with unique code, Jan ...
03e8292b5d5f01740b615a18dae61dce1c3aebc26b62c0e54c06d469235c34c4
MATLAB
1,376
37
function E = dynamicMiniEnergy(A,B,delta_t,x0,xf) % Calculate the minimum dynamic control energy under unrestricted control path % Wm = \int_{0}^{T} e^{A_m t}BB^Te^{A_m^T t}dt % W = diag(W1, W2, ..., WM) % S = (\prod_{i=M}^{2}e^{A_i\Dleta t},..., % \prod_{i=M}^{t+1}e^{A_i\Dleta t},...I_N) % W_{eff} = SW...
67c7843f01744a6c60973b123adbfd1708b19dab18b3f89a63752ad8c2763dc2
MATLAB
1,376
53
function betas =... DA_rewardHistoryRegression(pdata, bdata, nback, usethese,... auc1, auc2) % DA_rewardHistoryRegression - Regresses dopamine response against previous % rewards % INPUTS: % pdata - photometry data % bdata - corresponding behavioral data % nback - number of trials back to include % uset...
8ebb537e1b736f14edbf18f172baa91329791f9fef439661e1297a89cfaa9a1f
MATLAB
1,376
45
function validate_connectivity(Wrr, Wrf, params) % VALIDATE_CONNECTIVITY - Check connectivity matrix validity % % H1 Line: Validate connectivity matrices for consistency % % Syntax: % validate_connectivity(Wrr, Wrf, params) % % Description: % Checks that connectivity matrices have correct dimensions and % propert...
c8ab21997bf93dd056ae518494d5d7b24868cef6c891b18d2d20f987695f2b40
MATLAB
1,376
55
function [ output_args ] = PROMAX_CS_ASSEMBLY_DETECTION( RASTER_file ) %PROMAX_CS_ASSEMBLY_DETECTION( RASTER_file ) % % % === Jan Moelter, The University of Queensland, 2018 =================== % narginchk(1,1); fprintf( 1 , [ '\n' ] ); timerVal = tic; %% > PRINT FUNCTION-CALL if( isdeployed ) printConsoleSec...
d722435b9ff2fe672afb640b6aa082fb8dc72e308fe7ee70eb5011ffcdfba27a
MATLAB
1,376
42
%{ # master table that gathers data about the scans of different types, prepares for trace extraction -> experiment.Scan --- %} classdef Prepare < dj.Imported properties keySource = experiment.Scan - experiment.ScanIgnored & 'aim="2pScan"' end methods(Access=protected) f...
1f8e1ed55af9f034f8af8812436983793b0e077f6af765806af37872b7761940
MATLAB
1,377
55
%Creado por LC. %Grafica el histograma de la actividad global y pone encima de cada pico el %numero del estado al que pertenece. % % plot detected states % Modifications by Shuting Han function [Hist_Edos] = HistEdos(Spikes,Pks_Frame,sec_Pk_Frame,pks) Hist_Edos = sum(Spikes,1); numT = size(Spikes,2); figure(4); clf...
8cd55b6987bb313c31f85b3a234266c4b9590e6c9a13ed8b0ca4f18383f3c8df
MATLAB
1,377
47
function img = read_avw_img(filename); % [img] = READ_AVW_IMG(filename) % % Read in an Analyze (or nifti .img) file into either a 3D or 4D % array (depending on the header information) % Ouput coordinates for all dimensions start at 1 rather than 0 % Note: automatically detects char, short, long or double f...
e5adfbf8ef006ad13ffa84847efbaf92c9c8311e1147c6bf79240fd74b0940f0
MATLAB
1,377
31
% Cadata=Ca_signal; % index=event time; sampling_rate = 100; time_window1= -2*sampling_rate; time_window2= 20*sampling_rate; ii=length(index); for i = 1:ii; i trial_mean(i) = mean(Cadata(index(i)+time_window1:index(i)+time_window2, 1)); trial_std(i) = std(Cadata(i...
b93b76b493dc3619d483c002a3ae5af51ba3a724d7c038532ce2ec0d09df30db
MATLAB
1,379
58
function [outDat] = nmri_path_absolute(inDat) %will take care of havin absolute paths from some relevant fields %f=fieldnames(inDat); % only check specific fields f = cell(28, 1); f{1,1} = 'raw_dataset'; f{2,1} = 'analysis_dir'; f{3,1} = 'dataset_mapping'; f{4,1} = 'layout'; f{5,1} = 'montages'; f{6,1} = 'elec_file'; ...
01b75c7f00030fb72195056840f74e356bffcaef44c3cb0bebc2544451b794f2
MATLAB
1,380
51
function [k k0] = circ_kurtosis(alpha, w, dim) % [k k0] = circ_kurtosis(alpha,w,dim) % Calculates a measure of angular kurtosis. % % Input: % alpha sample of angles % [w weightings in case of binned angle data] % [dim statistic computed along this dimension, 1] % % If dim argument i...
3b5f9a6ac2dc17ff9ac71df1ba6bc647b6d655e213181f06815b0830d99e9856
MATLAB
1,380
49
function this = MrDimInfo_index2sample(this) % Unit test for MrDimInfo index2sample and sample2index % % Y = MrUnitTest() % run(Y, 'MrDimInfo_index2sample') % % This is a method of class MrUnitTest. % % IN % % OUT % % EXAMPLE % MrDimInfo_index2sample % % See also MrUnitTest % Author: Saskia Bollmann % Create...
446f0e985a84da00e1f1059052f85d38c65281eb6ebbdef5dee09fa8909da36e
MATLAB
1,380
49
%% upsampled = fft_upsample_complex(img, newSize) % % Input % -------------- % img : 2D or 3D image % newSize : target size % % Output % -------------- % upsampled : upsampled image % % Description: Upsample 2D or 3D data using k-space zeo-filling % % Kwok-shing Chan @ MGH % kchan2@mgh.harvard.e...
64f676f91b2f6f7ca3e8441aa925faaa204042a6a5c03703f34884eb93c39580
MATLAB
1,380
60
function [outputArg1,outputArg2] = PlotSubjectSignedBias_All(sn, TitleStr, lp_Color, hp_Color, bb_Color) if ~exist('TitleStr','var') % title parameter does not exist, so default it to something TitleStr = ' '; end % --- RGB vector for grey grey = 0.75*[1 1 1]; % --- means & standard deviation per azimut...
3a35f00603fb06e0b0f9a6061066c407ab6c6eb90440d790b2592f20a43f0b36
MATLAB
1,381
58
function [f,file] = stripfile(x,flag,sep) % function [f,file] = stripfile(x,flag,sep) % % <x> is a string referring to a file (it is okay if the file % does not actually exist). if <x> ends in /, we automatically % act as if that / does not exist. % <flag> (optional) is whether to swap the output arguments. defa...
b9eb2046f4ab5dac6fad0c4ce1d3f1b65054b13d8738cf7e05f268ccb3ac7708
MATLAB
1,381
51
function D=sqrtsim2dis(S) %function D=sqrtsim2dis(S); % %PURPOSE % %To transform elements of a similarity matrix S into %dissimilarities D by D=sqrt(1-S) % %INPUT % %S (matrix) MxM similarity matrix whose elements must be in [-1,1], % for example, absolute values of linear correlation coefficients. % %OUTPUT % % D ...
f810bbe3b89bd947a515f8eaf7f27d11bc94971e79a0b7681dec387c523cf798
MATLAB
1,381
41
function pfi = permutation_feature_importance(WholeTestResult, PFITestResult, options) % Larger the more important arguments WholeTestResult; PFITestResult; options.method {mustBeMember(options.method, {'difference', 'ratio', 'relative'})} = 'difference'; end numDatapoint = size(PFITestResult, 1); numUnit...
a7525367d90a56c85c1e19912b081658677c40834fe43ca6ac4eb171afd46359
MATLAB
1,382
34
function D = build_design_table(edges, nodes, level, cfg) %#ok<INUSD> % BUILD_DESIGN_TABLE Table of predictors for a given level switch lower(level) case 'global', D = local_global(edges, cfg); case 'rsn_pairs', D = local_rsn_pairs(edges, cfg); case 'nodewise', D = local_nodewise(edges, cfg); other...
ded864e7abdb302a8328f54c8345af269aa93ac61dd94d32ef89f5fd39e2f212
MATLAB
1,382
35
function [ output_args ] = refreshAssemblyPatterns( input_args ) %REFRESHASSEMBLYPATTERNS( input_args ) % % INPUT: % input_args [struct]: findAssemblyPattern output % % % === Jan Moelter, The University of Queensland, 2018 =================== % output_args = input_args; %% > RE-ANALYSE COMMUNITY STRUCTURE ...
c1349ff19dd19d915f4951355903d089ff966dd3961ee8fcec574e7c381e0817
MATLAB
1,383
48
function [numc, max_clsize] = density2clusters(dm,th,cls) % % dm : density mask % th : height threshold, or vector of thresholds % cls : vector of cluster sizes to test for % % numc : matrix of number of clusters % rows index density thresholds % columns index cluster size thresholds for i = ...
d74793dcc9ea9b498d5b154f37d112383f1f800b33f548c203035271544a6c67
MATLAB
1,383
39
function fileNameTemp = write_temporary_nifti_for_spm(this) % saves the object to a nifti file in a unique temporary location, e.g., % for display in SPM % % Y = MrDataNd() % fileNameTemp = Y.write_temporary_nifti_for_spm() % % This is a method of class MrDataNd. % % IN % % OUT % fileNameTemp unique, temporary...
ea66e2198b5726b810f25739d80e5aff661db61ad9339e4d7d6ab1de56d36d3c
MATLAB
1,383
23
%----------------------------------------------------------------------- % Job saved on 18-Nov-2014 09:28:14 by cfg_util (rev $Rev: 6134 $) % spm SPM - SPM12 (6225) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch{1}.spm.stats.fmri_spec.dir = '<UNDEFIN...
7f547bce0d67bcca2028e08b3046097ac20c5edf456e87f92df6c710d18b137b
MATLAB
1,384
30
% Authors: Eve LoCastro (locastre@mskcc.org), Dr. Ramesh Paudyal (paudyalr@mskcc.org), Dr. Amita Shukla-Dave (davea@mskcc.org) % Institution: Memorial Sloan Kettering Cancer Center % Address: 321 E 61st St, New York, NY 10022 % This is an example usage script for MSK Medical Physics Dave Lab QAMPER IVIM % Please ...
4073cc2ac89cbfe0bdddedf5a28fad7a4fb1951db41ab647e52c7ff8219ad131
MATLAB
1,385
42
classdef StandardScaler < baseScaler %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % StandardScaler standardizes features by removing the mean and scaling % to variance of 1 (i.e., z-transformation). % % Parameters: % data: Input data to be scaled. % % At...
24b4bfdbe55dd1ee958ae701a5a258458c77cc59d1d3a2ebb323029b967810cc
MATLAB
1,386
78
function [err,Sc] = tross_Encode_String (S) % % [err,Se] = tross_Encode_String (S) % %Purpose: % encodes a string a la Tom Ross for use in AFNI's HEADER % % %Input Parameters: % S % % %Output Parameters: % err : 0 No Problem % : 1 Mucho Problems % Se : the encoded version of S % % %Key Terms: % %More In...
37a5236c804b591f4a95da4afb9967eae9e141bcccda488a551dc1c8cb68392d
MATLAB
1,386
42
function this = set_from_dim_info(this, dimInfo) % Sets resolution/offcenter from dimInfo (via 1st sampling point), rotation % and shear is 0. % % Y = MrAffineTransformation() % Y.set_from_dim_info(dimInfo) % % This is a method of class MrAffineTransformation. % % IN % % OUT % % EXAMPLE % set_from_dim_info % % ...
5650f3db7d922697effa281b9bac53fc5bb1d5a8ddcb4f351ab5008a571fc053
MATLAB
1,386
57
function [s, freq] = searchindex(mfile, szmin) %SEARCHINDEX Compute keywords statistics of an M-file % S = SEARCHINDEX(MFILE) returns a cell array of char S containing % all the keywords (variables, function names, words in comments or % char arrays) found in M-file MFILE, of more than 2 characters. % S = SEARCHIND...
053ce7a68f222685184c48680fb461aaf6b5220e70b0f74c03212e6b8482740a
MATLAB
1,387
40
set_up_paths_and_data_directories; beh_data = load(fullfile(folder_project, 'data', 'BehavioralRatingsPerVideoAndDim.mat')); behTab = beh_data.behTab; emotions = {'Good', 'Bad', 'Calm', 'AtEase'}; behTab = structfun(@(tbl) tbl(:, emotions(ismember(emotions, tbl.Properties.VariableNames))), behTab, 'UniformOutput', fa...
0a73769bd1581ec748795c7ab164cd01f72e93f666f5d4109ef6a791ae4ce14b
MATLAB
1,387
36
function transients = transientmask2(trace, nSigmaStart, nSigmaEnd, mindur, SD) % Create mask for transients exceeding the nSigmaStart level lasting until % crossing nSigmaEnd again with a specified minimum duration. Adapted from % Dombeck et al., 2007. Mindur is in SAMPLING POINTS! % Note H.-L. Chen: this is a "re...
4fa9ed1fa31c51b0173387fcf0e5db30b54052c8faf72d44bf0bf6d604409019
MATLAB
1,387
48
function [I,windowsize,noverlap,nfft,rate,box,s,fr,ti,audio,AudioRange] = CreateSpectrogram(call) %% Extract call features for CalculateStats and display rate = call.Rate; box = call.Box; audio = call.Audio{:}; if ~isfloat(audio) audio = double(audio) / (double(intmax(class(audio)))+1); elseif ~isa(au...
bb44393673a6a90c0ba6133da33b214886f2d1cca5ad8ea87b6f85ce89f93a9b
MATLAB
1,387
61
function err = figarng (hvect,xll,yll,xur,yur,nfx) % err = figarng (hvect,xll,yll,xur,yur,nfx) % arranges the figures with handles present in hvect. % The figures are placed in the region bound at the lower left corner % by (xll,yll) and the upper right corner by (xur,yur) % nfx is the number of figures placed in the x...
251a42fdb8ca049e3ceb266d9be65ca0f456c7be4cdf757790d0db86ca05909c
MATLAB
1,388
46
%% EditInputMinMax_Callback(source,eventdata,defaultValue,isIntegerInput,lb,ub) % % Input % -------------- % isIntegerInput : true for returning integer, false for float value % lb : minimum value of the input % ub : maximum value of the input % % Description: This is a callback function t...
2a3effbfb89bcd20d6d2b7b8918af35407c83301e3c9e4e20671e950272e7259
MATLAB
1,388
48
function [chVals_out, chMNIs_out] = voxelAvg_chVals_inCube(chVals, chnlsMNI, subj_inds, d_mm, n_subjContribute) % finds average value from all channels that are located within a cube of d_mm % (c) Jiri, Jan19 %% number of different subjects in each larger voxel if nargin < 5 n_subjContribute = 2; end %% define a...
6518275e8afbc0a857f5e6d41922626011b0102b125eb835ac9ef38ad0c710d3
MATLAB
1,388
41
function exportaudio_Callback(hObject, eventdata, handles) %% Save the audio within user defined time smapn to a WAV file. The %% default span is the span of the currently selected call. current_box = handles.data.calls.Box(handles.data.currentcall,:); % Get the relative playback rate answer = inputdlg({'Choose Playb...
a30930918318b628fdfd02e22b7e97f8955275e7e1e4fefa8b4a68fa6b887982
MATLAB
1,389
40
function res = ctranspose(obj,useconj); if nargin == 1 useconj = 1; end if length(obj.dimensions) > 2 error('Cannot transpose array'); end % make new memory mapped data file % -------------------------------- newFileName = mmo.getnewfilename; copyfile(obj.dataFile, ...
d867e184d41c4b37d40b123c233182e07954fe107d44457c42b5da0546a5d1ba
MATLAB
1,389
56
function [fitresult, gof,output] = createFitExp(input) %CREATEFIT1(TEST) % Create a fit. % % Data for 'fit2' fit: % Y Output: test % Output: % fitresult : a fit object representing the fit. % gof : structure with goodness-of fit info. % % See also FIT, CFIT, SFIT. % Auto-generated by MATLAB on 06-D...
9c84a1f54c6aa9c9b14e3831be230b95cca0ca31c70c10e8a7729ae83fb07557
MATLAB
1,390
45
function [wait_time_mean, pval] =... waittime_20ul_by_previous_vol(A, varargin) %waittime_20ul_by_previous_vol Finds wait time on 20 uL trials in mixed % blocks divded into whether the previous volume is < 20 uL or > 20 uL. % Input: A - A struct (if you accidentally put in S struct, code will % convert) % ...
1397f3bb6ade54d8049be1385d116d35aa3551e07891fc9d015f16f72989593a
MATLAB
1,391
35
% Read the data from the CSV file data = readtable('../Results/single_ct_acc.csv'); % Extract the 'best_acc_wordvector' column acc_data = data.best_acc_wordvector; % Define the value to test against mu0 = 0.5; % Perform a one-sample t-test (right-tailed) % H0: mean(acc_data) = mu0 % H1: mean(acc_data) > mu0 [h, p, c...
5afeb1ae466b1446b06fb52dfded8b2b52c775cb6add549a0a57555cdbdd3d81
MATLAB
1,391
45
function cellvol = cellVolume(meshvar) % cellvol = cellVolume(meshvar) % returns the volume of each cell as a cell variable % SYNOPSIS: % cellvol = cellVolume(meshvar) % % PARAMETERS: % MeshStructure: a mesh structure created by buildMesh* functions % % RETURNS: % cellvol: a (1D, 2D, or 3D) matrix depending on th...
7f252d9bbcfc0d69032f789584300885200d75b9a80e6bc366feac15388e92a7
MATLAB
1,391
49
function main_execute(params, subj) % analyzes the iEEG experiments for a single subject 'subj' in subject list % runs analyses based on configuration % (c) Jiri, 2016 - ... % based on: whitenoise/mainEcog.m (c) Jiri, 2011 - 2015 %% subject tag params.storage.subjTag = params.storage.subjList{subj,1}; disp(['Processi...
0a8439146ab8ed1bdfdd2558d3d2ef4cbfc3b98e20367f811735bcddabb796c5
MATLAB
1,392
46
function otherImage = unwrap(this, applicationDimension) % Unwraps phase of images along specified dimension %(or assumes phase image as input for real valued data) % % Y = MrImage() % Y.unwrap(inputs) % % This is a method of class MrImage. % % IN % applicationDimension along which unwrapping is performed % ...
3a5d161753544b36782dbace012ee2ad37fc480d07232fde05bc7e89b7a89b52
MATLAB
1,392
57
% osp_spiral.m % Helge Zollner, Johns Hopkins University 2020. % % USAGE: % [x, y] = osp_spiral(n); % % DESCRIPTION: % This function calcualtes the x,y coordinates of the nth point of a ulam % spiral. This is usful if you want to fit MRSI data following a spiral % trajectory. % % % INPUTS: % n = nth point o...
d50ba99595a693fa459bf12feb8cc644a8dedc050e716d29147632cc22900139
MATLAB
1,392
47
function [mmu, mvu, vmu, vvu, me, ve, ml, vl, p0m, p0v] = ... tapas_sem_unified_gaussian_priors() %% A single set of priors in terms of mean and variance. % % Input % % Ouput % mmu -- Mean of the mean of the units % mvu -- Variance of the mean of the units % vmu -- Mean of the vari...
4460cea4ea5b3ebb93d4782ecde33c85737fe2aff5f681ed6342df5bb7a38fa6
MATLAB
1,393
47
function this = t_filter(this, cutoffSeconds) % high-pass filters temporally (4th dimension of the image) as SPM % % MrImage = t_filter(MrImage) % % This is a method of class MrImage. % % IN % cutoffSeconds slower drifts than this will be filtered out % % OUT % % EXAMPLE % t_filter % % See also MrImage spm_fi...
4f8f65c705d1d27267d761228a0f590ec9f74b32ea2ecb338f784bac825821ba
MATLAB
1,393
50
function [averageImage, rgbMean, rgbCovariance] = getImageStats(images, varargin) %GETIMAGESTATS Get image statistics opts.gpus = [] ; opts.batchSize = 256 ; opts.imageSize = [256 256] ; opts.numThreads = 6 ; opts = vl_argparse(opts, varargin) ; avg = {} ; rgbm1 = {} ; rgbm2 = {} ; numGpus = numel(opts.gpus) ; if n...