sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
180945deee2922d5fbabee580b1cfb6adfc861ab5e3e99cfb7d9f04ea4f5f1a7
MATLAB
854
27
function plot_template_mean(rez,i) temp = rez.Merge_cluster{i,1}; nb_temp = length(rez.Merge_cluster{i,1}); Channel = rez.Merge_cluster{i,5}; f=figure; for k = 1:length(Channel) text = []; subplot(ceil(length(Channel)/2),2,k) plot(squeeze(rez.M_template(:,Chan...
2dff758378219baf6f88f42c28a8144853d601f224d4cdbaef916d9c59ccd9e2
MATLAB
854
32
function c = WeightedCorr(weights,x,y) % Provide a matrix of weights, and this function will check the % correlation between the X and Y dimensions of the matrix. % You can provide the X-values and the Y-values for each column % and row. if exist('x','var') && ~isempty('x') if isvector(x), x = repmat(x(:)',size(...
4380cc1d8a58e50eba9d0cab005e1b11d858122a014c0337efcd1e7d9c3b0f7d
MATLAB
854
31
%minmax - Return overall min and max values for any number of arrays. % % USAGE % % [m,i] = minmax(x,y,...) % % x,y,... variables % % OUTPUT % % m minima and maxima of x,y,... (one pair per line) % i indices of minimum and maximum values % Copyright (C) 2015 by Michaël Zu...
7e43775464918b37aa25a1d939780195d235d846e431994eb0dd89bb122cc9a8
MATLAB
854
40
function [A] = detrendwt_SS(A) %initialize matrix for wait times sess = nan(length(A.ntrials), max(A.ntrials)); ctr = 1; wt = nan(length(A.wait_time), 1); detrendedwt = wt; wt(A.optout==1) = A.wait_time(A.optout==1); xvec = (1:max(A.ntrials))'; s = []; x = []; for jk = 1:length(A.ntrials) sess(jk,1:A.ntrials(jk...
f683e26f68ff8fb291053830f39b22e4943fb9160f99f3b12d91ef5141230105
MATLAB
854
29
function angulo_medio = angulo_medio_axial(angulos) % angulo_medio_axial Calcula la orientación media axial (0–180°) % angulos: vector de ángulos en grados (0–180) % angulo_medio: ángulo medio axial en grados % Asegurar que es un vector columna angulos = angulos(:); % 1.Doblar los ángulos ...
0b7b2a252c70205c8122bbd21778f59b127b6dfa55064edf1216c725e415353e
MATLAB
855
48
function [outputArg1,outputArg2] = PlotSubjectSignedBias(SignedBiasVector, TitleStr) 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 azimuth for this subject S...
f91d138c10dec86cd1cd59359ef495ecf31c3fba53fec386e773bbec3119fd47
MATLAB
855
33
function [d,fs]=high_order_resample(d,fs,fs_new) RFactor=fs/fs_new; if RFactor>1 decItterations=ceil(log10(RFactor)); for i=1:decItterations if i==decItterations fs_out=fs_new; else fs_out=round((fs/RFactor^(1/decItterations))); end % ...
181f95181af3649af8588e760257845cc540ca18aadabff857917b44023782b1
MATLAB
856
29
function [nodeidxs, minds]= surfing_voxel2node(vxyz, nxyz) % maps voxels coordinates to node coordinates % % [NODEIDXS, MINDS]=SURFING_VOXEL2NODE(VXYZ,NXYZ) % INPUTS: % VXYZ: 3xP matrix for P voxel coordinates % NXYZ: 3xQ matrix for Q node coordinates % OUTPUT % NODEIDXS: node index for each voxel...
3b66c2db873e3d5c6d6d9802b66a3293598a2db5a713b782ca3fe4635f9d569b
MATLAB
856
30
function [times_resample, sorted_data] = heatmat_byreward(pstruct, bstruct) resample_freq = 0.1; T = linspace(-5, 10, size(pstruct.('CPIn'), 2)-1); bdata = bstruct.('CPIn'); rewards = convertreward(bdata.Reward); %select trials these = bdata.Block==1 & bdata.PrevTrialType~=2; pdata = pstruct.('CPIn')(t...
956bb75340a7c562b6607fef00722d09cdeda5f81ba00afcbfd962b42174cf7f
MATLAB
856
29
function MPmoments = calculate_moments(MP) % Input: microstructure profiles (MP), with cortical depths as % rows and vertices/parcels as columns. % % Values (i.e. staining or imaging intensities) input must be integers % % Output: mean amplitude (intensity) of profile, as well as the mean, sd, skewness and kurtosis (m...
046d1051646b42fc9ad2c84f14157e01092cf29523529ffa2c77d8f1bb9f4756
MATLAB
858
41
function result = is_orthogonal_matrix(P) % % Orthogonal Matrices % % is_orthogonal_matrix(P) determines if the matrix P is an orthogonal % matrix. An error is returned if a matrix that is not square is attempted % to be determined for orthogonality. % % Function written by Anthony Russo, downloaded from Matl...
7919ebda5d65c7d17909d3f41f64b97511f2a0a1dc2dafb2500f8df8665f6850
MATLAB
858
35
function G = genRandNetwork(numNodes, p, mew) % Generates a random network % Parameters % ---------- % numNodes : int % number of nodes to include in the network % p : float % connection probability % mew : float % mean edge weight, if not specified, then sample % ...
b08311a7f9d1e2e59a2f09349a141749eb37ed46ff7b8f9be575e7d02b364008
MATLAB
858
29
function AllVolume = TMSfilter(DataVol,MaskVol,TR,AHighPass_LowCutoff, ALowPass_HighCutoff) CUTNUMBER = 10; Vol4d=DataVol'; % MaskDataOneDim=reshape(MaskVol,1,[]); MaskIndex = find(MaskVol); Vol4d=Vol4d(:,MaskIndex); %Remove the mean. theMean=mean(Vol4d); Vol4d=Vol4d-repmat(theMean,[size(Vol4d,1),1]); Segm...
a6e74bf114e79b2d0db05f9baccc9b5338373f8215aa6580c134e1f0dc2a5180
MATLAB
859
29
function varargout = env_handleerror(varargin) % Displays a formatted error message for some error object, including a full stack trace. % env_handleerror(Error, Indent) % % In: % Error : error object, as received from lasterror or via a catch clause % (if omitted, lasterror is used) % Indent : optio...
cb10db9dd5f79833b70320c8c273278090fb0a12ca49bd7634cd97b0de64dc9a
MATLAB
859
26
%% key = sepiatest.bfr_method_toolbox_key(bfrMethod) % % Description: maps a background-field-removal method name (as it appears % in methodBFRName, sepia_universal_variables.m) to the field name in % sepiatest.discover_toolboxes()'s output struct that gates whether it % can run on this machine. See sepiatest.qsm_metho...
7400da26e627de42ccca526c7faa0b117c8430c785e3a96635ed51aff50f11ee
MATLAB
860
26
function cfg = postInitializationSetup(cfg) % % cfg = postInitializatinSetup(cfg) % % generic function to finalize some set up after psychtoolbox has been % initialized % % % (C) Copyright 2020 CPP visual motion localizer developers cfg = postInitDots(cfg); % TODO transfer thos...
9b86a186ba0a77d3b497a1a2705588b34cee9ca5c7a92db85779ea204f715ff0
MATLAB
860
27
function set_geometry_callback(this, obj, eventData) % for set-functionality of properties of MrImageGeometry within MrImage % % output = set_geometry_callback(input) % % IN % % OUT % % EXAMPLE % set_geometry_callback % % See also % Author: Saskia Bollmann & Lars Kasper % Created: 2017-11-02 % Copyright (C) 2...
c7f49b31a29ae6a9666435dea0177ee6569057a9d975c5ef2fbeb6b38a6214a6
MATLAB
860
29
function y = vl_nnnoffset(x, param, dzdy) %VL_NNNOFFSET CNN norm-dependent offset. % Y = VL_NNNOFFSET(X, PARAM) subtracts from each element of X the % weighted norm of the feature channels: % % X(i,j,k) = X(i,j,k) - PARAM(1) * L(i,j) ^ PARAM(2) % % where % % L(i,j) = sum_K X(i,j,k)^2 % % DZDX = VL_NNNOF...
3feb7cad736c02cf64ddae5b0360edf673e4bc584121b2e2a473bd2eda1b009d
MATLAB
861
40
%%%%%This program graphs many whistles on one page %%%%%Julie Oswald %%%%%3/10/04 close all clear all loc='C:\ARTwarp\Data\20_per_enc\Sa\to_check\toplot'; %the folder that the whistles are in x=1; d=dir(loc); s=size(d); numfiles=s(1); currentfile=3; while (currentfile+3 <= numfiles) figure for x=1:50; ...
aa256abd2e2bbb6b46ec09899edf947a670171dfeba76d774596c197d9f73190
MATLAB
861
32
% 2016/11/11 by T. Ezaki % This function infers h and J by maximum likelihood estimation. % binarizedData: nodeNumber x tmax function [h,J] = pfunc_02_Inferrer_ML(binarizedData) [nodeNumber,dataLength] = size(binarizedData); % tuning parameters iterationMax = 5000000; permissibleErr = 0.00000001; dt = 0.2...
e3f3432fa1f6738c2ea52175ff53785bb6afdbac224e74746eb496e3b3e7fb2d
MATLAB
861
68
function H = ReadHeader(fp) % H = ReadHeader(fp) % % Reads NSMA header, leaves file-read-location at end of header % % INPUT: % fid -- file-pointer (i.e. not filename) % OUTPUT: % H -- cell-array. Each entry is one line from the NSMA header % % Now works for files with no header. % ADR 1997 % ve...
0926ab14f9134c5bbb34070dae060bc5193bfaf5c2bb652144895448e77e0d08
MATLAB
862
53
%script Test_AFNI_XYZcontinuous2Index % % % %Purpose: % % % %Input: % % % %Output: % % % % % %Key Terms: % %More Info : % % % % % Author : Ziad Saad % Date : Thu Sep 7 16:50:58 PDT 2000 % LBC/NIMH/ National Institutes of Health, Bethesda Maryland %Debug Flag DBG = 1; %Load a Brik Info [err, Info] = BrikI...
391453dea8eec26401166d18acabc6d025226fe5004e99e86f71b3db9ca01054
MATLAB
862
25
function Logical = Unfind(indices, n) %Unfind - the inverse operation of 'find': x = find(y); y = Unfind(x); % % When you have a logical vector, 'find' is useful as it gives you the % indices of the non-zero values. % This function performs the opposite operation, giving you a logical % vector with ones in the positi...
a421e9ae02be2495bee98ff34ed7f7bbaf5ff0e8d643b483c55d34cc9c427d99
MATLAB
862
31
function varargout = covGaborard(varargin) % Wrapper for Gabor covariance function covGabor.m. % % Gabor covariance function with length scales ell and periods p. The covariance % function is parameterized as: % % k(x,z) = h(x-z), h(t) = exp(-sum(t.^2./(2*ell.^2)))*cos(2*pi*sum(t./p)). % % The hyperparameters are: % %...
b19f2fa1c10eb6402b2d27972042ff0c86d9550ed6230a4357c78ee9d847f108
MATLAB
862
59
% Basic use. Panel is just like subplot. % % (a) Create a grid of panels. % (b) Plot into each sub-panel. %% (a) % create a NxN grid in gcf (this will create a figure, if % none is open). % % you can pass the figure handle to the constructor if you % need to attach the panel to a particular figure, as p = % panel(...
e811e043114e4828416c47e3778fc85461181b3a916630cb6f4d4f77c2cf0276
MATLAB
862
42
function [llh] = tapas_sem_prosa_cllh(t, a, u, theta, method, sloppy) %% Computes the likelihood function of a trial using the prosa model. It % relies on a c implementation. % % Input % t Reaction time. Should be a positive number % a Action, should be 0 (prosaccade) or 1 (antisaccade). % u Exp...
063f98f89c90ae484320cd1ffd8612a316a2ef2bb570c386119f57d3a25a349b
MATLAB
863
24
%% SpecifyAtlasDirectory.m % % Description: Specify directories of the atlas % % Kwok-Shing Chan @ MGH % kchan2@mgh.harvard.edu % Date created: 9 October 2023 % Date modified: % %% Specify the directories of the atlas here % please do not change SEPIA_ANALYSIS_SEGMENTATION_dir = fullfile(SEPIA_HOME,'analysis','segment...
8af94e31bc755c7bc48b3b70644a2075e2f2ab26ffe12a8020cefde74b1cde60
MATLAB
863
31
function [edges,idx,edgemap]=uniqedges(elem) % % [edges,idx,edgemap]=uniqedges(elem) % % return the unique edge list from a surface or tetrahedral mesh % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % elem: a list of elements, each row is a list of nodes for an element. % elem can have 2, 3 or ...
f7dfacea0a22275a2f3c33b3c8fdb946c68e3e82bc43e8e8f1f39577a85ca93a
MATLAB
863
25
function [new_ku,new_kuv,new_kv]=ProjectCurvatureTensor(uf,vf,nf,old_ku,old_kuv,old_kv,up,vp) %{ Summary: ProjectCurvatureTensor performs a projection %of the tensor variables to the vertexcoordinate system %INPUT: %uf,vf - face coordinate system %old_ku,old_kuv,old_kv - face curvature tensor variables %up,vp - v...
477678f3b1d6f4f7f4cc69a25cc2b919c75fb7b0bf3b8306016af7739a70d48a
MATLAB
865
43
% (C) Copyright 2019 Remi Gau clear; clc; % Sets up the environment for the analysis and add libraries to the path initEnv(); %% Set options opt = getOption(); checkDependencies(); %% Run batches reportBIDS(opt); bidsCopyRawFolder(opt, 1); % In case you just want to run segmentation and skull stripping % Skull st...
c098932d9e177c3ccd122f8316bc3d49d743bcef6b9fdff3dfcadfdbe21e9ddf
MATLAB
866
28
%% Experiment with the cnn_mnist_fc_bnorm [net_bn, info_bn] = cnn_mnist(... 'expDir', 'data/mnist-bnorm', 'batchNormalization', true); [net_fc, info_fc] = cnn_mnist(... 'expDir', 'data/mnist-baseline', 'batchNormalization', false); figure(1) ; clf ; subplot(1,2,1) ; semilogy([info_fc.val.objective]', 'o-') ; hol...
c91dea41af8a6731bca52642f28783e3fe0aa47c61f6d72298024026aa985ac7
MATLAB
866
39
function RHSout = excludeGhostRHS(MS, RHS) % this function cuts out the RHS values related to ghost cells and returns % an RHS, which is only for internal cells % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file % check th...
dea83bd2f4a9cd6e963ecb494a02e6d881300255472aafd8a3aa3020bdfaac58
MATLAB
866
24
% support function for mmo object function obj2 = unitaryopp(f, obj1, varargin); % make new memory mapped data file (blank) % ---------------------------------------- newFileName = mmo.getnewfilename; data = memmapfile(obj1.dataFile, 'writable', obj1.writable, 'format', { 'single' obj1.dimensions 'x' ...
13aa97c5e0594c3e90201ff8cdd3824f60d1cb020984cf8d5eaf458183dc501c
MATLAB
867
27
function [ out_vertices, out_faces, vertex_mapping ] = nf_remap_surface( in_vertices, in_faces ) %[ out_vertices, out_faces, vertex_mapping ] = nf_remap_surface( in_vertices, in_faces ) % remove vertices set to NaN (at y coord) from surface and relabels face % indices % method from http://www.gomatlab.de/vertices-eckp...
743ef6a145d65b2880d9c3ab4504bcba65137692e5d6ecf0309e44905794b833
MATLAB
867
42
function progressdot(ii,s1,s2,t) % Usage: progressdot(ii,s1,s2,t) % % Keeps tabs on progress through a loop with a display of dots at the % command line. % % Inputs: % ii - index variable to track % s1 - dot every (s1) (prints dot each (s1) ticks through loop) % s2 - new line every (s2) (prints time and new l...
8f761f1186833b0fdb0869f16b55fa01ecdded071447a2beb6515fcb7db90b5d
MATLAB
867
32
clear all; close all; clc; % Online mean computation % July 17, 2018, NB n = 5; p = 3; k = 2; M = stiefelfactory(n, p, k); % M.retr = M.retr_qr; % M.invretr = M.invretr_qr; M.retr = M.retr_polar; M.invretr = M.invretr_polar; sigma = .1; X0 = M.rand(); % true center S = M.randvec(X0); Y = M.retr(X0, S, sigma*randn(1...
0c102ac101f671dc756db2fb12421ec1c34e38ce30bfd48a117ea28a2a3d1828
MATLAB
869
21
function overlap = OverlapIntervals(varargin) % This is a helper function which will return the overlap of all provided arguments. % % EXAMPLE: % overlap = OverlapIntervals(ripples,preSleep, sws); % would only return intervals contained in "ripples", "preSleep" as well as "sws" % % Copyright (C) 2023 by Ralitsa Todor...
bb2efca4b1ec830fe0b9e797f3a4a9abfd6a4bed89e5b04196134a94de0540a7
MATLAB
869
31
function stringORstringInCell=underscoresToSpaces(stringORstringInCell) % % underscoresToSpaces is a function based on deunderscore.m % It takes an incoming string and replaces all underscores (which % are sometimes interpreted by MATLAB as subscript indicators in figures) % as spaces (which aren't). % % Cai Wingf...
f49e5a52234cd31d832b20f24ac274ac5ff04e1b391ab5d2167977730ebf8e6f
MATLAB
869
26
function createSl(root,sub,glm,nVoxelSl) spm_path = '/home/fs0/abaram/scratch/MATLAB/spm12'; addpath(spm_path) util_path = fullfile(root,'code','util'); addpath(genpath(util_path)) cd(fullfile(root,'masks',sub)) %% read ROI/brain mask: wholeBrainMask = fullfile(root,'masks',sub,'brain.nii'); ROI = spm_vol(wh...
96cdf806a64522e9e0f5292a9a32987c446626b3078801cc0e105c90889a99d9
MATLAB
870
49
function [llh] = tapas_mdlinear_hier_llh_sn(data, theta, ptheta, s1, s2i, ... s2j) %% Likelihood of the nodes of a linear multivariate model with diagonal % precisions on each parameter. % % It is the likelihood of % % p(y|x, beta, pi) = N(y - x*b, 1/pi) % % Note that this is a multivariate regression problem, s...
b7b5f43c2f5cd47864ff9e32ad5a20fe966699ec5e5d4df1da36476ae98cca82
MATLAB
870
26
function mustBeGeneralLogical(A) %MUSTBEGENERALLOGICAL Validate that value is a generalized logical % MUSTBEGENERALLOGICAL(A) throws an error if A contains values different from: false, true, 0, 1, "off", "on". % Copyright (C) 2025 by Pietro Bozzo % % This program is free software; you can redistribute it and/or mod...
bfb8c85ec30abddbb0eb1d5a9f69f122d0d3d06a908cdf1ed1173f881b5cd588
MATLAB
870
31
% Recipe_fMRI_searchlight % % Cai Wingfield 11-2009, 2-2010, 3-2010, 8-2010 %__________________________________________________________________________ % Copyright (C) 2010 Medical Research Council %%%%%%%%%%%%%%%%%%%% %% Initialisation %% %%%%%%%%%%%%%%%%%%%% toolboxRoot = 'toolboxPathOnYourMachine'; addpath(genpath...
c93679127156639bf3ed9ba29ee79b4d7bcc3f97820ee4d3ed3ab135bf159f83
MATLAB
870
44
function [nhtheta] = tapas_ti_init_htheta(ptheta, htheta, pars) % Init the parameters of the sampler nhtheta = htheta; % It is better not to adapt certain parameteres if ~isfield(htheta, 'mixed') nhtheta.mixed = ones(size(ptheta.jm, 1), 1); end nhtheta.nmixed = abs(nhtheta.mixed - 1); nhtheta.knmixed = chol(hthe...
e69860c5e7c9bbc47f68974e7babc040382be0dc990fea93482d965846330a90
MATLAB
870
22
% Compute the log intensity for the inverse link function (twice logistic) % g(f) = h(f*(1+a*h(f))), where is the logistic h(f) = log(1+exp(f))). % Output range: 0 <= g(f). % % The function can be used in GLM likelihoods such as likPoisson, likGamma, and % likInvGauss. % % See Seeger et al., Bayesian Intermittent Deman...
3fd7593ac8aa815cd0e602eeb698f866268cd9e8de2eafe994389739bf64c66f
MATLAB
871
32
function resamp = eeg_autocorr_fftw(EEG, pct_data) if exist('resample') ~= 2 error('Signal Processing Toolbox absent: You need the signal processing toolbox to run ICLabel'); end if ~exist('pct_data', 'var') || isempty(pct_data) pct_data = 100; end nfft = 2^nextpow2(2*EEG.pnts-1); % calc autocorrelation ...
6070eb197a82510d78db18660cc3451ed8e2825e5f1f29ffd67e78a8563cbb3e
MATLAB
871
33
function pred_boxes = bbox_transform_inv(boxes, deltas) % Copyright (C) 2016 Hakan Bilen. % All rights reserved. % % This file is part of the VLFeat library and is made available under % the terms of the BSD license (see the COPYING file). if isempty(boxes), return; end widths = boxes(:,3) - boxes(:,1); heights = bo...
60b77de97a44f4ac6486269e064ea6bb0ecd8e9213d55535952574598ad34d37
MATLAB
871
35
function RDMs = interleaveRDMs(RDMs, varargin) % % RDMs = interleaveRDMs(RDMs[, transpose?]) % % interleaveRDMs is a function which accepts an arbitrarily-high-dimensional % struct of RDMs and recursively "interleaves" the final (non-singleton) % dimensions out by shuffling and stacking, finally returning a 1 (or 2...
e9e889ed0ac4478045d981eb2572b70e71bd93c05fc16baca236cb38362cf539
MATLAB
872
37
function in = UIInPolygon(X,Y) %UIInPolygon - Find points in interactively defined polygon zone. % % Mouse buttons: % left = add polygon point % right = remove last polygon point % middle = close polygon % % USAGE % % in = UIInPolygon(X,Y) % % X,Y points to test % in ...
0dc01aab3ecda2db2ef82771e1a8fe6bbec257d160fa515d2abb2919204f8fcb
MATLAB
873
34
function levelName = get_level_name(D, context) % GET_LEVEL_NAME Extract unique level name from a design table. % % levelName = util.get_level_name(D, context) % % D : table with a 'level' column (string/char) % context : optional string for clearer error messages if nargin < 2 context = ''; end if ~istabl...
94d886e1ed1c811fb912a04c7493f6387deeaedcd0c92c0f2722d73b551d77e9
MATLAB
873
33
function y=afni_swapbytes(x) % Perform byteswap for input data of type int, single or double % % (Octave 3.8 does not support a byteswap for data of class 'single') c=class(x); switch c case {'int8','uint8'} % single byte, no swap needed y=x; return; case {...
f61d346737dcd0ddcd842a984b7b0eebddacf74a2bfcbf982ca916c0a0da4c0b
MATLAB
873
23
function targets = bbox_transform(ex_rois, gt_rois) % Copyright (C) 2016 Hakan Bilen. % All rights reserved. % % This file is part of the VLFeat library and is made available under % the terms of the BSD license (see the COPYING file). ex_widths = ex_rois(:, 3) - ex_rois(:, 1) + 1.0 ; ex_heights = ex_rois(:, 4) - ex_r...
3cea0d53c1b7d00d08cb300994604ae1590f8b838da2e569d6ccde2d76346a41
MATLAB
874
25
function [inference] = tapas_sem_mixed_inference(inference, pars) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % % Use the same defaults. [inference] = tapas_sem_multiv_inference(inference, pars); % Overwrite the infernce to include the mixedlinear gibbs step. inference.sampling_methods = { @(d, m, i, s) ...
715d20c0644d5a88e5b04d22ab4cd31859f9bb1f47eee24cc4674945a4c12050
MATLAB
874
54
% Panel interacts with other graphics objects apart from figures and axes. % % (a) Create a figure a uipanel. % (b) Attach a panel to it. % (c) Select another uipanel into one of the sub-panels. % (d) Attach a callback. %% (a) % create the figure clf % create a uipanel set(gcf, 'units', 'normalized'); u1 = uipane...
afdcd9fdabd77515c3bf4ee2cc57389dcd95a5cf948c79fbd80178c8841eb1d1
MATLAB
874
19
function [ens_corr,corr_thr,selection] = filter_ens_by_inner_corr(raster,core_cells,sdfact) % Reference paper: Herzog et al. 2020 "Scalable and accurate automated method % for neuronal ensemble detection in spiking neural networks" % https://www.biorxiv.org/content/10.1101/2020.10.12.335901v1 % Rubén Herzog October 20...
3c2dd1072b118d8f96433c27bab729fc902dc4078a546b3d0fc920c602c0b05f
MATLAB
875
21
function [data, I] = GetImageCoordinates(data, PathName, ui0, source) % by Julia Becker, 01/04/2020 %GETIMAGECOORDINATES Loads conversion variables and overview image, %creates new data column of image coordinates and a roi column set to '0' if strcmp(ui0, 'Simple') == 1 load(fullfile(PathName, 'Pics', 'calibrat...
01d61b95da1a9910e567b39a2710d8f703e3f6688ee109e2b8268d7118cfa3f5
MATLAB
876
17
function mousePositionSelection_Callback(hObject,eventdata, handles) % This fuction runs when the little bar with the green lines or the page window is clicked or handles.data.focusCenter = eventdata.IntersectionPoint(1); % Ensure the new selection is within the range of audio handles.data.focusCenter = max(handles...
c813e5fe19b83e1ddffa5a16b382faebf0bf09b6f8494b5215ceceedb5058892
MATLAB
876
22
function [pvec, pstruct] = tapas_logrt_linear_binary_minimal_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2016 Christoph Mathys, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU Gen...
29ceb75f96a206c4071c46a27d63789605a8f295954a91bbe0bb51fd2608ff92
MATLAB
877
40
function plotDLCaligned(AlignmentStruct) figure; set(gcf, 'units', 'inches', 'position', [4.5,5.77,10.66,3.406]) A = fields(AlignmentStruct.speed); range1 = [0 0]; for a=1:length(A) % head speed subplot(2, length(A), a) plotPretty(AlignmentStruct.Times, AlignmentStruct.speed.(A{a}), ... 'k', 'std')...
db9f41aa82f30506e81c3d0b91e701a46947deb182fbde9c50b7afc24d2225e0
MATLAB
877
28
% Script unit_test_main % Performs the complete unit test for uniQC. All unit test specified in % MrUnitTest are included. % % unit_test_main % % % See also MrUnitTest % Author: Saskia Bollmann & Lars Kasper % Created: 2019-04-04 % Copyright (C) 2019 Institute for Biomedical Engineering % Uni...
15e7f6646532a96419bcecdcf4f97fb0746e38aa3881f2f46c725fc100925655
MATLAB
879
26
% Function to compute the Mahalanobis distance % Handles 3D data of Task * Trial * Channel function distance_matrix = my_Mahalanobis(data_vec) [num_task, ~, ChNum] = size(data_vec); means = zeros(num_task, ChNum); covs = cell(num_task, 1); for task = 1:num_task X = squeeze(data_vec(tas...
68e2c7ddf12174e4dcd8a9e637492baa50d903e0253cdeec1a1f49cbb0ae18c7
MATLAB
879
58
%script Test_AFNI_Index2XYZcontinuous % % % %Purpose: % % % %Input: % % % %Output: % % % % % %Key Terms: % %More Info : % % % % % Author : Ziad Saad % Date : Tue Sep 5 21:48:26 PDT 2000 % LBC/NIMH/ National Institutes of Health, Bethesda Maryland %Debug Flag DBG = 1; %launch afni %unix('afni &'); %Load ...
769755294995237255aa86252a111ce9ffaea9a4fa9715483b187e6fe8c65082
MATLAB
879
25
function pstruct = tapas_ehgf_binary_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2020 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % Licenc...
2038e2ec81daa23bed70ac61dd021cf1cc065384f1db69aaf8671323ff35ae3b
MATLAB
880
28
function p = PlotSlope(x,y,slope,len,varargin) %PlotSlope - Plot line with given slope. % % USAGE % % p = PlotSlope(x,y,slope,length,<options>) % % x,y coordinates of central point % slope line slope % length segment length along the x axis % <options> line and color sp...
2131b9c72e2013b9221ec635091ca2c77399e47b5bd85281708ec1fb064c9ffc
MATLAB
880
26
function f = hlp_makefunction(decl,workspace) % Create a function handle from code and a workspace of variables. For hlp_serialize(). % Function = hlp_makefunction(Declaration,Workspace) % % In: % Declaration : The function's declaration string, e.g. '@(x) x*A + B' % % Workspace : Struct that holds the (non-par...
4547910181451976599ee6773d4133588b886ced7361247a6efb77732124137c
MATLAB
880
33
function [DAbHilo, stageffect, pval] =... HiloAcrossRats_stages(window, thirdrew_arg, ratlist,... Pstruct, Bstruct, Stages) %%for plotting response aligned to event in high versus low blocks across stages, %averaged over rats DAbHilo = []; for rat = 1:length(ratlist) ratname = ratlist{rat}; disp...
ebaa9838dcd8a41b88b4ac314e4b3a60700c7ef2c757081af759fd9392ee2a38
MATLAB
881
23
function csv_Callback(hObject, eventdata, handles) function t = loop_calls(Calls, hc,includereject,waitbar_text,handles,call_file,audiodata) HZ_IN_kHZ = 1000; callboxes = []; for i = 1:height(Calls) % Do this for each call waitbar(i/height(Calls),hc,waitbar_text); ...
9f7e3e939a4be056a82bd17499a2e9f0a28c506b65b8e010764f49c72a9ac18f
MATLAB
882
25
function pstruct = tapas_hgf_binary_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % Licence...
cfd8b623e73f699c95f59c8a310ee8adf72f6c3ac9212bf0b85111e199f8c4db
MATLAB
882
31
function [myelin] = Demyelination(myelin, C3) % DEMYELINATION % % Degrades myelin segments that are in contact with C3 cells. % % INPUTS: % myelin - structure containing myelin state, positions, and timers % C3 - structure containing C3 cell positions (x and y arrays) % % OUTPUT: % myelin - updated myelin st...
e6995eb34639873a2c3b9b35c158af404fdf16867ee49c0cba5c1685ed4a5856
MATLAB
882
29
function [hi, lo, mix, p] = iticurves(A) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here l = A.ITI; usethese = ~isnan(l); L = l(usethese); L(L>prctile(L,99)) = NaN; Lz = (L-mean(L, 'omitnan'))./std(L, 'omitnan'); blk = A.block(usethese); p = ranksum(L(blk==2), L(blk==3), tail='left')...
fbad669ba9f264c8c74e5e443fe02b06fe0c162da8db2e44a58c6867be53e7c0
MATLAB
882
32
function [K,dK] = covLIN(mode,par,hyp,x,z) % Linear covariance function. % The covariance function is parameterized as: % % k(x,z) = dot(x,z) % % where dot(x,z) is a dot product. The hyperparameters are: % % hyp = [ hyp_dot ] % % Copyright (c) by Carl Edward Rasmussen and Hannes Nickisch, 2017-09-26. % % See also cov/...
a742459666167b28c340a77caec21a842ebf1d753911614d6957533fcfd61160
MATLAB
883
33
%Busca los (ciclos Hamiltonianos o Eulerianos) de la secuencia dada por %sec_Pk_edos_Ren. [Cyclic_folds]=CyFolds(sec_Pk_edos_Ren) %str_sec=int2str(sec_Pk_edos_Ren);%No pasa bien la sec para Drakontos function [Ciclos_nums,Ciclos_H_E]=CyFolds(sec_Pk_edos_Ren) str_sec=char(sec_Pk_edos_Ren);%Funciona pero no se ven lo...
f295afddfbd1be400542c98f935c6b98b4d90102ce7ddd24e313f647ac61b7e7
MATLAB
883
44
function [Prefix, Ext] = Remove1DExtension (fname) % % [Prefix, Ext] = Remove1DExtension (fname) % %Purpose: % removes known .1D filename extensions. % Look at code more more details. % %Input Parameters: % fname: filename % % %Output Parameters: % Prefix: filename without extension % Ext: recognized extens...
f35268f78de02b688b2ec35211f98c3f7630612bd2b9d4ed00fd61f30c7f84e1
MATLAB
883
23
function averagedPSD = averagePSDAcrossIntervals(PSD, timeIntervals, timeArray) % Author: Qasim Qureshi May 2024 % PSD: A 3D array (channels by freq by samples) % timeIntervals: A matrix or cell array containing the start and end times % timeArray: A 1D array of time points corresponding to the third di...
9edab1cd2af84a6f082d00b1e23dbd26b6d1432f620cb7534e030f920f9e0275
MATLAB
884
31
%% phase = DICOM2Phase(niiPhase) % % Input % -------------- % niiPhase : NIfTI matlab structure contains phase image directly % converted from DICOM % % Output % -------------- % phase : phase image rescaled to [-pi,pi) % % Description: This function converts the DICOM phase values (usually...
2c7a4964c32a9d2e62ed3e3fb5066048af2706256d7a3ed48e954e6c1c073012
MATLAB
885
40
%mex -v erfc_func.c %mex -v erfc_func0.c %mex -v erfc_func2.c %mex -v trapzf.c %mex -v trapzf2.c %mex -v weight_update_iter.c mex -v weight_out_compo_delay_time.c %return %%% Error dY = Y - W * X mex -v error_delay_time.c mex -v error_delay_time_sw.c %%% Error correlation : dYX = dY * X' mex -v error_...
65af1d345778a3e29b33926cea82e816cbae5c600c910d8f4843e6fcb9a17669
MATLAB
885
42
% example code to load and visualize results % of bolus spreading from FVM simulations % load network object for visualizing (optional) %NT = NetworkObj('../examples/WT_COS7_KDEL_Cell3_um.net'); %% Load in mesh data dirname = '../examples/'; name = 'example_PA'; filename = sprintf([dirname name '.mesh']); MSH = MeshO...
9272283ae8aeaca68d3da9828171a90c59c1e5ea4881c4c466356da07bbfb723
MATLAB
885
24
function [lp,dlp] = priorGauss(mu,s2,x) % Univariate Gaussian hyperparameter prior distribution. % Compute log-likelihood and its derivative or draw a random sample. % The prior distribution is parameterized as: % % p(x) = exp(-(x-mu)^2/(2*s2)) / sqrt(2*pi*s2), where % % mu(1x1) is the mean parameter, s2(1x1...
d40a9101a9921915b1eca52ea7019c20f7dacf075c5d9953d5ddb70f5af7bf24
MATLAB
885
23
function speeds = setSpeedTargets(cfg) % % speeds = setSpeedTargets(cfg) % % If selected as task, it computes the matrix with the speeds set in % ``cfg.dot.speed`` (computed in pixels per frame) and the target ones (higher = faster, % lower = slower). % % If this task is not requested, ...
6e96c3c0e9d251490e771c111e3f5a77df4c79a6f665aea0e36915180beab2ea
MATLAB
886
31
function s = nansem(x,dim) %nansem - Compute standard error of the mean (SEM), ignoring NaNs. % % USAGE % % s = nansem(x) % % x vector or matrix over which the sem should be computed % dim optionally, dimension along which to operate, default % is first dimension of ...
976d90f843b569af6cee46d513995849c2b4d479a6e96ad840605117b14e3098
MATLAB
886
25
function pstruct = tapas_hgf_binary_mab_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % Lic...
39f537c893c71b53596c68dc9670585663bd223dc4072470a49c58c379b49642
MATLAB
887
32
function TMSExtendROI(ROIDataDir,EnlVolNum) ROIHeader =spm_vol(ROIDataDir) ; [ROIData,XYZ] = spm_read_vols(ROIHeader) ; tdata = ROIData ; header.dim(1)=size(ROIData,1); header.dim(2)=size(ROIData,2); header.dim(3)=size(ROIData,3); i=0; while i < EnlVolNum for ii= 2: header.dim(1)-1 fo...
3e594f98d2a3e716d7247b69ff51e2e3a9af629959ec32444253cb0fb3db3df4
MATLAB
887
36
function [con,conname,contype,conweights] = meta_enter_contrasts(ti,tasknms) % % [con,conname,contype,conweights] = meta_enter_contrasts(ti,tasknms) % [xxx,connames,xxx,contrasts] = meta_enter_contrasts(Xi,Xinms) contype = 'contrast'; nconds = size(ti,2); conweights = []; conname = {}; go = 1; while go if ...
4336770fc50e4014e6f1c4621062b640cc4950ca95b8aa96f7f20b60f47f8b77
MATLAB
887
35
function PHI=phase(G) %PHASE Computes the phase of a complex vector % % PHI=phase(G) % % G is a complex-valued row vector and PHI is returned as its % phase (in radians), with an effort made to keep it continuous % over the pi-borders. % L. Ljung 10-2-86 % Copyright 1986-2004 The MathWorks, Inc....
630b0b4ee439e3bbcdc2b982302a1fb693c1e78768f35a0d3b0f43a594db74e6
MATLAB
887
41
function J = costaccfun_misbind(param,x,y,usepriors) if nargin < 4 usepriors = false; end mu = 0; sigma = param(1); lapse = param(2); msbnd = param(3); if length(param)==4 sigma2 = param(4); else sigma2 = sigma; end if usepriors %for Lapse rate: Beta distribution bp = [1.1 1.1]; %uninf...
daa15ac790d2a537e4232547c455503f86e6006df9ca6b5b28b812cdd46a3ea7
MATLAB
887
29
% This script reformats traces into a uniform format: single columns function traces_to_columns update_traces(preprocess.ExtractRawTrace, 'raw_trace') update_traces(preprocess.ComputeTracesTrace, 'trace') update_traces(preprocess.SpikesRateTrace, 'rate_trace') end function update_traces(table, attribute) % convert a...
df5b960d5b33099e7450257c132ad30d4e9691b129d8d7faf074c4bfa067c069
MATLAB
887
48
clear, clc % snr at signal = 1 snr = 100; rng(42) % Get defailt imaging parameters [timeStep, nSamples, z, ar] = sero_srr_default_image_pars(); % create line phantom object T = sero_srr_generate_structure(z, 1); % Create SERO sampling matrix [~, TR, B, W ] = sero_srr_sero_gen1(timeStep, nSamples, a...
3a74a291104ff43f2e469296b6c9adae5488a089d92b25dcec57168176b6a7ca
MATLAB
888
29
%{ preprocess.PrepareAod (imported) # information about AOD scans -> preprocess.Prepare --- %} classdef PrepareAod < dj.Relvar methods function makeTuples(self, key) % get volume info [path, name] = fetch1(experiment.Session * experiment.Scan & key,'scan_path','filename'); ...
a893d3e56ed495c452589f9da5aaa833adf1cf3695a926c20c85190cc2411665
MATLAB
888
27
function rhs = nls_rhs(t, psit, dummy, k) % NLS_RHS Right-hand side of the Nonlinear Schrödinger (NLS) equation % in Fourier space, for use with ODE solvers (e.g., ode45). % % Equation: i*psi_t + (1/2)*psi_xx + |psi|^2 * psi = 0 % % Usage: % rhs = nls_rhs(t, psit, [], k) % % Inputs: % t ...
619c295d917b26da00a3e5a8c09a837f1a1b07e652347d988cd8800adc9e17d3
MATLAB
889
30
function plotXCorrelogram(spikeRaster,Fs,varargin) % varargin > ylim, dt for Refractory Period and OSCillations nTrace=size(spikeRaster,2); BW=100; %for gamma rp=figure('defaultaxesfontsize',16,'color','w'); % refractory period osc=figure('defaultaxesfontsize',16,'color','w'); for iTrace=1:nTrace for jTrace=...
badeb3ea33b5f4ce0eeb43d4fdbef7648a756822e06944ef1cd68189e3c07c41
MATLAB
889
27
function arg_issuereport(payload) % Internal function to issue a report to a requesting function. % This is implemented by throwing an exception. Used by arg_define() and declare_properties() % % In: % Payload : the payload to report % % See also: % arg_define, arg_report global tracking; % first obtain a report...
c2a0ce2fafff5cdf12942c83944798b86efcd7799b34e8fa9b27f8b42f09f8c5
MATLAB
889
11
%----------------------------------------------------------------------- % Job saved on 22-Jul-2014 14:45:14 by cfg_util (rev $Rev$) % spm SPM - SPM12b (5672) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch{1}.spm.spatial.normalise.write.subj.def = {'...
713b945725045dd49d9f5064bbe796ff9cc3d45b9c5c77664c0fbb67f4ce05d0
MATLAB
890
36
function [state] = tapas_sampler_mc3_tempering(data, model, inference, state) %% Sampler for population mcmc (mc3) with generalized temperature. % % aponteeduardo@gmail.com % copyright (C) 2016 % ollh = state.llh{1}; olpp = state.llh{2}; temperature_ordering = state.graph{2}.u.temperature_ordering; T = model.graph{1...
19f3f4a5569b4609d6455e86255a4dcd794781dbf438d0918f3e831910aeef8b
MATLAB
891
22
function [rangequest,qmquestion,chunkquest,channels,filter,stackquest,laserquest]=ephysdefaults % Adam Packer % April 10th, 2007 % Added filter capability December 18th, 2009 % Added laserquest capability June 29th, 2010 % Set defaults for EphysViewer % rangequest=1 lets you decide what range of data you want t...
2b9738e2c61801b4eca401885d8c64b854ead2d62e05a99a5db383eb218c236f
MATLAB
891
22
function [pvec, pstruct] = tapas_rs_transp(r, ptrans) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ % % This file is part of the HGF toolbox, which is released under the terms of the GNU General Public % L...
2b9f3824021c8aaba1dbd1626c1eef7ca252012d55a4d836b20a3f8a4828727e
MATLAB
891
39
%% load data load(fullfile('.', 'data', 'dataFigureS3B.mat')); %% plot dffSort = dff(idx,:); ORNListSort = ORNList(idx); dffRange(:, 1) = min(dffSort, [], 2); dffRange(:, 2) = max(dffSort, [], 2); dffStep = dffRange(:, 2) - dffRange(:, 1); dffGrid = cumsum(dffStep(end: -1: 1)); dffGrid = [0; dffGrid]; figure; set(g...
555657b8541b74fd0dbdf28fa869e357195c59a98f4e026318db7ec6f9014ee7
MATLAB
891
31
function p=get_required_precision(d,epsilon) % Finds the number of decimal positions required to print all data % elements. % % P=GET_REQUIRED_PRECISION(D) returns the least number of decimals % 'after the period' to represent all numbers D without loss of precision. % D should be an array with real numbers and can be ...
fc8c4710a105079c0d6189bc9950b443f5e36d6434d89616462cd5d12cb06784
MATLAB
891
23
% read movie movie + AVG image % implementation of the Tiff-read library by Anastasios Moressis (March 2016) function [movie,movie_AVG] = read_movie(filename,width,height,numberframes,startframe,binning,InfoImage,nb_planes) warning ('off','all'); % binning = 2; TifLink = Tiff(filename, 'r'); movie = zeros(height,width,...
b0b83992c7a6c2f604e52d2a361c950c55fd24e831a90b17a430b2d4eb60d167
MATLAB
892
29
function[headervalue,header_row] = GetHeaderValue(header,info_name) %% extracts a particular value from the header headersize = size(header{1}); info_check = strfind(header{1}, info_name); has_entry_vector = []; for counter = 1:headersize q = size(info_check{counter}); has_entry = find(q(1)); if h...
cad5484d5a158ea2e26a40dbce96343ca6a864409e234a1e0fdafd48b3ba0e16
MATLAB
892
41
function addHeading(heading,figI,x,y) % adds a heading to a figure. The user also has the option of specifying % the location of the inserted heading text. import rsa.* import rsa.fig.* import rsa.fmri.* import rsa.rdm.* import rsa.sim.* import rsa.spm.* import rsa.stat.* import rsa.util.* % replace underscores if is...
753d01963f9dbf4d3bd5a3e133cf05ccfeaf562a5ac2fbfb257f3075278178b9
MATLAB
893
42
function [itiMdl, itiOpt, V, rpe, alpha, G, belief] =... generate_deltabelief_mdl(... R, alpha0, D) belief = nan(3, length(R)); belief(:,1) = [1 0 0]; p_rew = nan(3, 5); p_rew(1,:) = [1/5 1/5 1/5 1/5 1/5]; % mixed block p_rew(2,:) = [0 0 1/3 1/3 1/3]; % high block p_rew(3,:) = [1/3 1/3 1/3 0 0]; % low block ...