sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0687eaff1089cbd6b4c17eb0a713412f82286bd52a048ff524eeb5c955a11e86
MATLAB
705
31
function profile_end(profile_on, profile_dir) if ~exist('profile_on','var'), profile_on = 0; end; switch profile_on case 0, ptime(toc) case 1, ptime(toc) if str2num(strtok(version,'.')) > 6 % profile off if ~exist('profile_dir','var'), profile_dir = 'profile'; end; profi...
23d64a9fc3a0b24ee9b047188aa2a48ce8fc5c70bb45cca0a5ca130747ce5d99
MATLAB
705
36
function setOut = fisherTransform(setIn, fakeIt) % Computes a Fisher Transformation on the input vector % % USAGE: % setOut = fisherTransform(setIn[, fakeIt]) % % (setting fakeIt to true will replace inf values by 1/eps) % % Cai Wingfield 2-2010 %_______________________________________________________________________...
32bc0df4d67e8529b758c3c39a6954c7c6947fb53465f4d479e4b1341886a732
MATLAB
705
35
function r = mtimes(p,q) %TIMES this function multiplies the x, y, and z values of the structures that I use in % the FVtool. % reassign the scalar to new variable a and the struct to new variable b % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekh...
983148e6e06c64ea0d19403e3f9c8c636b6bbfe8fa0644e1f086d121148dfe1a
MATLAB
705
25
% dicome_header = dicominfo(['/Users/bo/Desktop/' ... 'MRI_examplar_image/bold/sms_bold_run1-00001.dcm']); slice_timging = dicome_header.Private_0019_1029; slice_timging = slice_timging * 0.001; slice_timging = slice_timging/2; % dicome_header = dicominfo(['/Users/bo/Documents/data_liujia_lab/analysis_liuP1_g...
b220011cf1486c699c6ddd5e2c1db6880a23ef844bf7264a7aa5d12d0345b2c6
MATLAB
705
23
function reader = getReader(key) % Returns reader object for key. Key can be a key struture or % any relvar where fetch(rf.Align & key) returns a single tuple. if ~isstruct(key) key = fetch(rf.Align & key); end assert(length(key) == 1, 'one scan at a time please') % Fetch path and basename from TpSession and Tp...
44a56eff871376d6dfa10f7f891d0b9f83b8f6c5c05d83f3bca4275416027b2a
MATLAB
706
20
function plot_amp_ncc(rez,i) Spike_id = find(rez.st(:,end)==i); Nchan = length(cell2mat(rez.Merge_cluster(i,5))); %Get histogram of spikes amplitudes amplitudes = rez.st(Spike_id,5); [Ncount,edgesS] = histcounts(amplitudes);figure; subplot(1,2,1) bar(edgesS(1:end-1),Ncount(1:end)) ...
44bf7e51d6d0e35ca0ccfda1f914518714e5138306a60bf1be38e0bdea8a45c5
MATLAB
706
26
function keyCode = detectkey(params) %DETECTKEY checks if there is an input either from the keyboard or form the %response box % % Inputs: % params: data storage file % % Outputs: % keyCode: vector of numbers corresponding to the pressed keys % % About: % Coded by F.Petzschner 19. April 2017 % Last change: F.Pet...
79058eb4dfc64217ddd2b55003c888db3a87bb208de5a09be402e47e0fb92dc4
MATLAB
706
15
function vers = eegplugin_viewprops( fig, try_strings, catch_strings ) %EEGLABPLUGIN_POP_PROP_EXTENDED View extended channel/component properties % Displays ERPimage, spectopo, topomap, activity scroll, dipole, and pvaf vers = 'ViewProps1.5.4'; if nargin < 3 error('eegplugin_viewprops requires 3 arguments'); end ...
84a0b002a163609e0636b958a35efddf7dbb9f5675ac3154b9178395f3300be8
MATLAB
706
25
function [CPInByRewMean, CPInByRewSEM] =... DA_CPInByReward(pdata, bdata) % DA_CPInByReward - average photometry response by reward in mixed blocks % INPUTS: % pdata - photometry data % bdata - corresponding behavioral data % OUTPUTS: % CPInByRewMean - mean response % CPInByRewSEM - SEM response % Prealloc...
d606e118f9fc2a3ddd0deb95d9bbb5511476941109e53798113f35c0ca58c52f
MATLAB
706
50
function xopt = testhyperbolicmanifold() n = 10; N = 5; transposed = 1; if transposed % BM: okay trnsp = @(X) X'; else trnsp = @(X) X; end problem.M = hyperbolicfactory(n, N, transposed); Y = randn(n+1, N); problem.cost = @cost; problem.egrad = @egrad; problem.ehess = @ehess; function f = cost(x...
f9d6735b6c456a08ce90adb5c4392297ff1d266080d8d624cdced6528047e2ce
MATLAB
706
23
function tapas_BLT_runEnd(params) % tapas_BLT_runEnd ends the task and stores and close everything if params.doMRI == 1 % Show preliminary end screen for the duration of the field map Screen('DrawTexture', params.screen.window, params.text.endfieldmap, [], params.screen.fit, 0); Screen('Flip', params.scre...
ddbe5121c70241e7b66bd4d92a4d92df08d7e52cb80429268da008bd3fef0c4f
MATLAB
707
26
function varargout = covPERard(varargin) % Wrapper for PERiodic covariance function covPER.m. % % Periodic covariance function from an arbitrary covariance function k0 via % embedding IR^D into IC^D. % The covariance function is parameterized as: % % k(x,z) = k0(u(x),u(z)), u(x) = [sin(pi*x./p); cos(pi*x./p)] % % wher...
2429de68f887da33dae09b15bf2612038073507c85e3faf7cc5ad9461fa8aabf
MATLAB
708
33
function colors = niceColorsWarm2(Ncolors) % just a simple one-liner to produce up to 4 colors for plotting. Uses % predefined colors from a nice figure in a paper if nargin == 0 figure; meansembarFigure(rand(6),'color',niceColorsWarm2(6)) return end if Ncolors > 6 error('Only 6 colors implemented') end dark...
33475e63732ae3e5b1c5f3bf0e9687e0c864742a2315c7d10e208efbf10630e2
MATLAB
708
15
function outdata = Switch_MergeExperiments(indata,pairedsessions,experimentID,mergesides,sideindex) outdata = indata; if mergesides dimsize = ndims(indata); outdata = permute(outdata,[1 sideindex setdiff([2:dimsize],sideindex)]); outdata(experimentID==2,1,:,:,:,:,:,:,:,:,:,:) = mean(outd...
6063ffbc768dfc63965fc2a3e8537d6abb7405efe763e5e18d1433ed42ea08ae
MATLAB
708
17
function R = loadCombinedDataset(dataset, dataPath) % Loads two datasets from the same mouse and combines them mouse = dataset{1}{1}; session1 = dataset{1}{2}; session2 = dataset{1}{3}; % First [R1, ~, ~] = loadData(mouse, session1, 'R', 'DLC3', dataPath); % Second [R2, ~, ~] = loadData(mouse, session2, 'R', 'DLC3', d...
ae5fe8a6eae910247bc1b05c7a052fa92b660f4b2df6418da9bd004f20ccb282
MATLAB
708
24
function out = vl_nnsigmoid(x,dzdy) %VL_NNSIGMOID CNN sigmoid nonlinear unit. % Y = VL_NNSIGMOID(X) computes the sigmoid of the data X. X can % have an arbitrary size. The sigmoid is defined as follows: % % SIGMOID(X) = 1 / (1 + EXP(-X)). % % DZDX = VL_NNSIGMOID(X, DZDY) computes the derivative of the % blo...
ce076ea95047ca0a54c72b38c7c6d6f0e8eb179870bc78e1dfab16f809e8486f
MATLAB
708
23
function varargout = covSEiso(varargin) % Wrapper for Squared Exponential covariance function covSE.m. % % Squared Exponential covariance function with isotropic distance measure. The % covariance function is parameterized as: % % k(x,z) = sf^2 * exp(-(x-z)'*inv(P)*(x-z)/2) % % where the P matrix is ell^2 times the u...
45e5f8e4d1bb8bcef4de828ab4d4ed38b20623a6e2499be93f3a963c6165335c
MATLAB
709
23
function params = preprocColorSpace_GetMetaParams(argNum) params.class = 'preprocColorSpace'; switch argNum case 1 % Convert to L*A*B colorspace, keep luminance channel params.class = 'preprocColorSpace'; params.colorconv = 'rgb2lab'; params.colorchannels = 1; params.gamma ...
482822dd591032ab4cbde9d0570a993ce9e63108d6a3b083ce6b100e68fb1064
MATLAB
709
30
% Computes (unnormalized) cross-covariance function out to +/- L lags % (TR shifts) between each column of Avg1 and Avg2 % Avg1 and Avg2 are time x region matrices/vectors % See tdmx_template.m for appropriate normalization of lagged_cov output function r = lagged_cov(Avg1,Avg2,L) L1 = size(Avg1,2); L2 = si...
5b8516c92e345759305250296fa67044cbf0b28907e888297db7a39d50ca8933
MATLAB
709
26
load('Spinalgain_EMG_relationship') figure for perf = 1:4 dat = emg_para{1,perf}(:); [N,edges] = histcounts(dat,10); subplot(2,2,perf), bar(edges(2:end),N./length(dat)) hold on, plot([0.05 1.05],[0.1 0.1],':k') title([emg_para{2,perf},' ',emg_para{3,perf}]) p_row = ones(...
7d8baae53a1de0bb2398f96254b6bfecdaee7394b0787a1d65645b1427d9f101
MATLAB
709
22
% Compute the log intensity for the inverse link function g(f) = log(1+exp(f))). % Output range: 0 <= g(f). % % The function can be used in GLM likelihoods such as likPoisson, likGamma, and % likInvGauss. % % Copyright (c) by Hannes Nickisch, 2016-10-04. function [lg,dlg,d2lg,d3lg] = glm_invlink_logistic(f) l1pef = ...
8ddd0fa676d537bdf5c2efdbf39dd5f750c65e8f506571741454731b3af3fde6
MATLAB
709
35
% % Same as sh_layoutLayoutPowerAB but also include the non-oddball trace to % compare with oddball (e.g. A baseline + B oddball + B baseline) % % sh_singleERPcolor(array,epoch,cRange,Fs) % % Frg: frequency range to compute the band power % step: time length to compute the bandpower % % % global ChLayout % global nB...
41426248bf6863b1cefe0a9cbceebf3145e727a4728c6712aafc26d55c36b774
MATLAB
710
21
data = readtable("filename.csv"); test_data = data(data.freq_band == "beta", :); % GLME model = fitglme(test_data, "br ~ period * region + (1|subject)"); anova(model) % ANOVAN [p, tbl, stats, terms] = anovan(test_data.br, ... {test_data.period, test_data.region}, ... 'model', 'interaction', ... 'varnames'...
469627bcd2f89d9074a1c0376e9289d3a4892e7eba67bd8fe580ce6c53aa1737
MATLAB
710
42
% Panel can incorporate an existing axis. % % (a) Create the root panel. % (b) Create an axis yourself. % (c) Pack an automatically created axis, and your own axis, % into the root panel. %% (a) % create a column-pair layout, with 95% of the space given % to the left hand panel p = panel(); p.pack('h', [95 -...
75fbed2a9db968b887ae3368cddc18b526f2622729f7dfec7677a8ebd392fdc8
MATLAB
710
17
function dphase = tapas_physio_downsample_phase(tphase, phase, tsample, rsampint) % Author: Lars Kasper, using code from Chloe Hutton (FIL, UCL London) % % Copyright (C) 2013 Institute for Biomedical Engineering, ETH/Uni Zurich. % % This file is part of the PhysIO toolbox, which is released under the terms of the GNU...
c1754a746726caa3a7e460f88be395c2fa94978f613165c59c70fe9f142b4cad
MATLAB
710
25
function [CPIn20ByBlkMean, CPIn20ByBlkSEM] = DA_CPInByBlock(pdata, bdata) % DA_CPInByBlock - average photometry response by 20 ul across blocks % INPUTS: % pdata - photometry data % bdata - corresponding behavioral data % OUTPUTS: % CPIn20ByBlkMean - mean response % CPIn20ByBlkSEM - SEM response % Preallocate ...
c29d21098d333eb13bd3833ba4dafa5dd2e40f19a7607869a74c349b18bfa13f
MATLAB
712
25
function [ output_args ] = normalisePatternEnumeration( input_args ) %NORMALISEPATTERNENUMERATION( input_args ) Normalised the enumeration of %the input pattern while keeping the overall pattern unchanged. In the %enumeration new indices will be added as required. % % INPUT: % input_args [1x? matrix]: input pattern...
82333ec3b2d3408238d6fa421bc4b14b8153b5d3345d9ad964c873877b9c0516
MATLAB
713
29
function hirf=boyntonModel(res) %returns a vector containing the hemodynamic impulse response function %as estimated by boynton, engel, glover and heeger (1996) for two subjects' V1. %the parameter res controls the temporal resolution (time bin width is 1 ms). %________________________________________________________...
28244fa0932af08dca6ef3c94947791647ec74cdf3f683e8c4895f284e99cfa7
MATLAB
716
34
function faceGrad = gradientTerm(phi) % this function calculates the gradient of a variable in x direction % it checks for the availability of the ghost variables and use them, otherwise % estimate them, assuming a zero gradient on the boundaries % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALS...
48013ca8809cf43e19aac461a892a6ea6d772fa01951ee5fee99b9e203276c50
MATLAB
716
23
function Protated = qRotatePoint( P, Qrotation ) % qRotatePoint: rotate a point according to rotation quaternion % Protated = qRotatePoint( P, Qrotation ) % IN: % P - point which is rotated % Qrotation - quaternion describing the rotation (axis and angle) % % OUT: % Protated - rotated point % % EXAMPLE: ...
786cb55bde1e5cb11cd49b9adb18249f6de117056725cc7ebfd1ea4d7e57600f
MATLAB
716
33
clear all;clc % open a file to store random factors for rank=0:49 fname = sprintf('../input/proc_%02d/random.dat',rank);%don't forget the PPT in the file name fid=fopen(fname,'w'); %fileID=fopen('input/proc/random.dat','w'); %fprintf(fileID,'%6s %10s\n','normal','log_normal'); %rng(0,'twister'); % randn...
7d483bdcafad774df1f6a39a0653cdfb14f30ab423141dc8182594edfa780373
MATLAB
716
50
function xopt = test_transpose_hyperbolicfactory() n = 10; N = 5; transposed = 1; if transposed % BM: okay trnsp = @(X) X'; else trnsp = @(X) X; end problem.M = hyperbolicfactory(n, N, transposed); Y = randn(n+1, N); problem.cost = @cost; problem.egrad = @egrad; problem.ehess = @ehess; function ...
98421ec4d914b69cbc73e05e7f40be6592dc747052b41017e9b9151ce7eacc30
MATLAB
716
32
%% weights = sepia_utils_compute_weights_v0p8(fieldmapSD,mask) % % Input % -------------- % fieldmapSD : standard deviation of fieldmap % mask : signal mask % % Output % -------------- % weights : weighting map % % Description: (For legacy purpose) This is how SEPIA calculate the weights % before v1.0...
8de82232d924bdb8f61dadbf11addbac769fab1b952c70db209111230199452a
MATLAB
717
30
function [model] = tapas_linear_model(model, pars) %% Define the model. % % aponteeduardo@gmail.com % copyright (C) 2016 % model = struct('graph', []); model.graph = cell(4, 1); for i = 1:4 model.graph{i} = struct('llh', [], 'htheta', []); end model.graph{1}.llh = @tapas_linear_llh; model.graph{2}.llh = @tapas_l...
9ebf1ca0e15003ecffb943575f5ee5d6a20b0a3a1b7bf08ed3fd8b7614ed1c81
MATLAB
717
30
classdef MaxPsi < FitnessFunction % Fitness function for maximizing psi. properties Params = struct(); Spec = 'psi'; end methods function obj = MaxPsi(varargin) % Constructor. obj@FitnessFunction(varargin{:}) end function...
d47e7efec4e0e6700c21f7927555302ba2998616f9b3b699ca149855de0d2b7a
MATLAB
717
19
function pstruct = tapas_logrt_linear_binary_namep(pvec) % -------------------------------------------------------------------------------------------------- % Copyright (C) 2016 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...
ea65a3b1880d3d716c892f0ce5a13bbdf70648c606ae66f5c065b04198be9b2c
MATLAB
717
20
function [m,dm] = meanNN(c,v, hyp, x) % Nearest neighbor mean function. The mean function is parameterized as: % % m(z) = v_j, j = arg min_i d(ci,x) where d is the Euclidean distance and ci is % the ith cluster center. % % The hyperparameters are: % % hyp = [ ] % % Copyrigh...
0b6caa757b73ef5b0eb57f7d08dc013952fa1238e81604a18a11e1113c610b47
MATLAB
718
31
function cols=colorScale(anchorCols,nCols,monitor) % linearly interpolates between a set of given 'anchor' colours to give % nCols and displays them if monitor is set %__________________________________________________________________________ % Copyright (C) 2012 Medical Research Council import rsa.* import rsa.fig.*...
343bb4d9a882b32a126ec2aa22717d6b0b2d82462d70f75fab2bad126481d0f1
MATLAB
718
29
% put file detection to avoid overwrite % put varargin for various option function makeMovie(movie,Name,FPS,varargin) % tic; frc=0.75; DIM=size(movie); mm=min(min(min(movie,[],1),[],2)); MM=max(max(max(movie,[],1),[],2)); % switch % case 'InvFilp' % if varin{3}==YES % At this stage, movie is flip in y-axis...
6753dd0bfc74ddca05176bfea96aebc95edc693ffbc2f6df2563a86a9cbd03a9
MATLAB
718
20
function [sha, ui8] = sero_pulseq_array2sha(array, ver) % function [sha, ui8] = sero_pulseq_array2sha(array, ver) % % This funciton returns a 1x64 char array (128 bytes) that is unique for % the numerical array. Note that it is sensitive to the precision specified, % and that it is also perturbed by the optional versi...
939e9b4be00782c9f8c978c56185a4c7391e4626aae628854c2a938e99c22f16
MATLAB
718
17
function [ccg_data, sig_idx] = get_significant_ccgs(ccg_data, flag) noise_distribution2 = [ccg_data.ccg_control(:, 1:50), ccg_data.ccg_control(:, 151:201)]; ccg_data.noise_std2 = std(noise_distribution2,0,2, 'omitnan'); ccg_data.noise_mean2 = nanmean(noise_distribution2,2); sig_idx = (ccg_data.noise_std2>flag.sig_min...
e2c98c56bffa653f06cc77c92ba505eb5e5361995b9f594484854fa5668b9fb9
MATLAB
718
24
% (C) Copyright 2020 CPP visual motion localizer developpers function varargout = preSaveSetup(varargin) % varargout = postInitializatinSetup(varargin) % generic function to prepare structures before saving [thisEvent, iBlock, iTrial, duration, onset, cfg, logFile] = ... deal(varargin{:}); t...
9be71d3d3e99be7ef180b8ceb78a1724d4446c1c24251f8e5020b5129fe12267
MATLAB
719
24
function [u,y,R]=Create_Dissimilar_Vectors(NumElements,avg_FR,rho,RS) u = rand(NumElements,1); % Force u to have mean = avg_FR (does not affect Pearson corr definition) u = u(:); u = u + (avg_FR - mean(u)); % Build y with corr(u,y) = rho (Pearson) uc = u - avg_FR; % centered u (since mean(u)=avg_FR) ...
d938f4da560e8d8445723c53af72b749cb968bd0f26b7f8a440731489205696b
MATLAB
719
24
function C=clustering_coef_bu_fast(G) n = size(G,1); % binary, symmetric, zero diagonal G = G~=0; G(1:n+1:end) = 0; G = G | G.'; % ensure symmetry % convert to sparse if reasonably sparse if ~issparse(G) && nnz(G) < 0.25*n*n G = sparse(G); end k ...
116688798cacce1c3cd80da8d258f738642c1acfefde8630ab173c1a9a6a625e
MATLAB
721
32
function DI=dunns(clusters_number,distM,ind) %%%Dunn's index for clustering compactness and separation measurement % dunns(clusters_number,distM,ind) % clusters_number = Number of clusters % distM = Dissimilarity matrix % ind = Indexes for each data point aka cluster to which each data point % belongs i=cl...
6007c3087efdd694625fd5cf4b3e71e8021b957a5b94e8a4997ed52ff9f68884
MATLAB
721
27
%% function [resnorm,residual] = ResidualGivenQSMLocalFieldDipolekernel(chi,localField,kernel) % % Description: compute the residual and residual norm given the local % field, dipole kernel and QSM % % Input % ----- % chi : QSM % localField : local field perturbatios % kernel ...
c09b83f0b96c88334a6c49f7aaf36261f567483c807788ee68df0a9938e0a066
MATLAB
721
21
function [mean_iti, sem_iti, p] = iti_by_reward(data) first_trial = [1; cumsum(data.ntrials(1:end-1))+1]; data.ITI(first_trial) = nan; data.ITI(data.ITI>prctile(data.ITI, 99)) = nan; post_vios = logical([0; data.vios(1:end-1)]); usethese = ~post_vios & data.block==1; l = data.ITI(usethese...
4ac11b7f80927b6cb31202f6057a0d6dfcc652ffc2242d97c6280f559fbb62de
MATLAB
722
36
function [ output_args ] = cell_union( input_args , mode ) %CELL_UNION( input_args , mode ) Returns the union of all sets (vectors) in %the a cell array. % % INPUT: % input_args [1x? cell]: cell array of sets (vectors) % mode [string]: union mode ('','sorted','stable') % % % === Jan Moelter, The University of Q...
9cb3a106ac8fb7813835aedf30a752955195b917b73c6da8e5894f0cdcd9cdd0
MATLAB
722
25
function varargout = covLINard(varargin) % Wrapper for Linear covariance function covLin.m. % % Linear covariance function with Automatic Relevance Determination (ARD). The % covariance function is parameterized as: % % k(x,z) = x'*inv(P)*z % % where the P matrix is diagonal with ARD parameters ell_1^2,...,ell_D^2, wh...
ebc468e646cb48baaaadb2e06dd3f6ba3055af0af48ee5598273b0e24a2e2fae
MATLAB
722
26
%CheckChronux - Make sure chronux is installed and functional. % % USAGE % % CheckChronux % Copyright (C) 2007-2014 by Michaël Zugaro % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; eithe...
98ba73677baf38c3b580aa1ca33785b6739e00ec9172d2afaf8490e87cc0c7fa
MATLAB
723
32
function set_tick_timestamps(axes, use_milliseconds) %% Find nice round numbers to use number_of_ticks = 6; x_lim = xlim(axes); xrange = x_lim(2) - x_lim(1); xrange = xrange / number_of_ticks; nice = floor(log10(xrange)); frac = 1; if nice > 1 frac = 4; end nice = round(xrange * frac / 10^nice) / frac * 10^nice; ...
1da6c4384112dc1efe7acc250943fa37a6d096ebd294490c625afdbdcfef5c5a
MATLAB
724
35
function ang = pix2angle(display,pix) %angle = pix2angle(display,pix) % %converts monitor pixels into degrees of visual angle. % %Inputs: %display.dist (distance from screen (cm)) %display.width (width of screen (cm)) %display.resolution (number of pixels of display in horizontal direction) % %ang (visual ang...
9831dbaf86d5a74328da18e10e5f46f7b6b585c2c2821005fa09c2741b16e4ef
MATLAB
724
30
classdef MinLoss < FitnessFunction % Fitness function for minimizing loss. properties Params = struct(); Spec = '-loss'; end methods function obj = MinLoss(varargin) % Constructor. obj@FitnessFunction(varargin{:}) end fun...
a2fc61812f028fba28664c27ff5277a2cd57e0ec2fa9f458491b3def7bd4234e
MATLAB
724
27
%% function img = load_nii_img_only(filename) % % Description: Load images data only % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 9 October 2016 % Date modified: 11 September 2018 % Date modified: 26 June 2020 (v0.8.0) % function img = load_nii_img_only(filename) % try % info = niftiinfo(filen...
05e9aa7ea05a8897e4d154c476c4858097eaa05156998426b24ff1673e18075b
MATLAB
725
27
function [] = image_thr(im,thr); % this function takes an image (im) and a threshold (thr) as its input. It % thresholds the image and displays the values *bellow* the threshold in % red. The other values are shown in grayscale. %__________________________________________________________________________ % Copyright (C)...
12659f4c6080136ea0469ea3254d99a578883732ca5af5df7d21624d45e2a327
MATLAB
725
25
function Irecord = select_recording_neurons(params) % SELECT_RECORDING_NEURONS - Choose neurons to record % % H1 Line: Select random neurons for detailed recording % % Syntax: % Irecord = select_recording_neurons(params) % % Description: % Randomly selects excitatory and inhibitory neurons for % recording synapti...
1a980286524fef346bda1f1e8342d5b3e81a7bb575ccb51cb65795d0c7abfcd3
MATLAB
725
22
function [Q, R] = orthogonalizetwice(M, x, A) % Orthonormalizes a basis of tangent vectors twice for increased accuracy. % % function [orthobasis, R] = orthogonalizetwice(M, x, basis) % % See help for orthogonalize. This function calls that algorithm twice. % This is useful if elements in the input basis are close to b...
b99336003f4af84259942f2c46fa52bbb860845276d6a6e24dba0701035560d5
MATLAB
725
18
function [this_attack_start_times,this_attack_stop_times] = filt_event_timestamps(this_attack_start_times,this_attack_stop_times,min_dur, max_isi) % discard events that are too short and merge events close together % merge close events isi = this_attack_start_times(2:end) - this_attack_stop_times(1:end-1...
3e7301cbcc281786b20f3b75677a88409b94761574eba6ba1083bdb4f3c10851
MATLAB
727
31
%% get_set_bfr_lbv(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid % ...
f0dcf2618b9752e8a13c1024f80b81d39768563100208d04c81c8c408ee7ec39
MATLAB
727
42
function [f] = zeta(z) %ZETA Riemann Zeta function % %usage: f = zeta(z) % %tested on version 5.3.1 % % This program calculates the Riemann Zeta function % for the elements of Z using the Dirichlet deta function. % Z may be complex and any size. Best accuracy for abs(z)<80. % % Has a pole at z=1, z...
24405925440b02119e4d4c49bdedc4b45b8014596acbf14197d7be63fc08507c
MATLAB
729
31
function [Ts] = Calculate_t(P,Q, polarity_list) max_iterations = 50; % Maximum number of iterations NS = createns(Q,'NSMethod','kdtree'); % Create Kdtree Ts = [0,0]; j=0; while j<max_iterations j=j+1; [idx,~] = knnsearch(NS,P,'k',1);% kdtree finds the nearest points to a point and returns the position of the ...
b9a492eded4f4e7d381b915cb945b3c949d6127b5b28b7a67bfc01b410ceaac7
MATLAB
729
41
function mfunc_ActivityMap(vectorList, LocalMinIndex, Name) % Show activity map [sy, sx] = size(vectorList); if (nargin < 3) || isempty(Name) Name = 1:sy; end dat = vectorList(:,LocalMinIndex); dat = [dat, dat(:,end)]; dat = [dat; dat(end,:)]; figure(103); h = surf(dat); view([0 90]); colormap([...
4ffa6e98bfad7423f8ab3d1bfe1d1cf21a8988ea7f59a9743bcfeeb5d64e222c
MATLAB
730
35
function [llh] = tapas_sem_multiv_llh(data, theta, ptheta) %% Compute likelihood of the eye movement model in a hierarchical format. % % Input % % data -- Stucture array of dimension Nx1 with fields y and u % theta -- Structure array of dimension 1 X 1 % ptheta -- Priors % % Ouput % % ...
63b77ea7d5584996b226aea9f6e9838e09b5ffd11c9d983e9d6473bfd87a0e11
MATLAB
730
29
function r = circ_dist(x,y) % % r = circ_dist(alpha, beta) % Pairwise difference x_i-y_i around the circle computed efficiently. % % Input: % alpha sample of linear random variable % beta sample of linear random variable or one single angle % % Output: % r matrix with differences % %...
a85e4d1a1726a123caff12cc5538ceee864a16806516d2db0872e4f079cbc55a
MATLAB
730
24
function tpl = loadtpl(tpl,handle) %TEMPLATE/LOADTPL Read a template from file % TPL = LOADTPL(TPL,HANDLE) read the template file associated with the % handle HANDLE in the template TPL and store it in the variable HANDLE. % Copyright (C) 2003 Guillaume Flandin <Guillaume@artefact.tk> % $Revision: 1.0 $Date: 2003/...
fe0f9b26908fa683e79c17da572a507e7c6efa60a258819da616ec716079bdce
MATLAB
730
24
%% Figure 5 S2 YOURDATAPATH = ''; savePath = [YOURDATAPATH '/' 'models' '/']; %% Load model outputs load(sprintf('%sall_regression,M1,angles,radrates', savePath), 'outputsM1_rr') load(sprintf('%sall_regression,S1,angles,radrates', savePath), 'outputsS1_rr') %% Panel A and B: % RADICaL angles proximal/distal partial d...
9da6251449390597478e9625bede67d0d0f4d8bf048881dce1dacaadc380e39e
MATLAB
731
21
% for each eye position, determine which circles it falls in function circlemembership = fillcirclemembership(x, y, xrange, yrange, lut) circlemembership = zeros(diff(yrange)+1,diff(xrange)+1) ; for ii=1:length(x) if ~isnan(x(ii)) && ~isnan(y(ii)) x0 = round(x(ii)-xrange(1)+1) ; y0 = round(y(ii)-yrang...
dad503ee623bc369fe8be3f15e9139cc6f7809cb2d7baaac3b6fea666685c536
MATLAB
731
37
function [ptheta] = tapas_sem_prosa_later_gaussian_priors() %% Generates standard priors for a gaussian distribution. % % Input % ptheta -- Structure with the priors. % % aponteeduardo@gmail.com % copyright (C) 2016 % DIM_THETA = tapas_sem_prosa_ndims(); ptheta = struct(); [mmu, mvu, vmu, vvu, me, ve, ml, ...
1002ffee8989304649ac48de2de4a25a99fa1b4c7a7a0edc048b6fcda634d0ae
MATLAB
732
29
%% get_set_bfr_BFRnet(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid...
582691e790fea121143d4354a183f075ca19b8edb133eda347616530cd83661a
MATLAB
732
33
clc; clear; enrich_file = 'C:\Users\lihon\Desktop\abcd_study\pnc\vis_v2_r400_ro1\GOCOMPONENT.xls.xlsx'; tbl = readtable(enrich_file, 'VariableNamingRule', 'preserve'); go_term = tbl{:, 1}; go_desc = tbl{:, 2}; p_val = tbl{:, 3}; q_val = tbl{:, 4}; enrichment = tbl{:, 5}; B = tbl{:, 7}; b = tbl{:, 9}; figure; hold o...
6b4d8c2cc7d8e03eb589e5681ff42beb7923d4a3ba03364f31491945762d21a3
MATLAB
732
30
function img_new=cropped2full(CroppedImage,FullImage) %Convert cropped image to full size image in MNI space %Read in cropped image. This image will be converted to full size [~,img_crop]=read(CroppedImage); %Read in original full size mask. [~,img_full]=read(FullImage); %Dimensions of full image N=size(i...
97afa6dca99c5348b81572e2d61c1e7747fd5a84439b567538348cbbb7230b31
MATLAB
732
27
function Q = qGetRotQuaternion( teta, rotationVector ) % qCreateRotQuaternion: outputs a quaternion which is used to perform % rotation % Q = qGetRotQuaternion( teta, rotationVector ) % IN: % teta - rotation angle % rotationVector - vector around which the rotation will be performed % % OUT: % Q - rotatio...
a9648aaf060654ee34b35c665fdc82fadf74025b7c69e6ecf39d00d996585fdb
MATLAB
732
17
%% Miniscope PC dropbox matlab folder matlab_path = 'C:\Users\Zoe\Dropbox\Matlab'; %% set up fonts set(0,'defaultAxesFontName','Arial') set(0,'defaultfigurecolor',[1 1 1],'DefaultTextColor', [0, 0, 0]) set(0,'DefaultAxesColor',[1 1 1]) set(0,'DefaultAxesXcolor', [0, 0, 0], 'DefaultAxesYcolor', [0, 0, 0], 'Default...
ce9f6e6242d75e357f5d3569cc8313f47e04a46db5db6d45beff7c0ede14c752
MATLAB
732
28
function X = arg_setdirect(X,value) % Recursively set the arg_direct flag in a data structure to the given value. % [Result] = arg_setdirect(Data,Value) % if nargin < 2 error('please supply a value'); end if isempty(X), return; end if iscell(X) for k=1:numel(X) X{k} = arg_setdirect(X{k},value); ...
0c80f32cd57979e0786a5d6ac9c22a135feffa1e53ca5be775c06582c8cf610c
MATLAB
733
22
function T = perform_tensor_recomp(e1,e2,l1,l2) % perform_tensor_recomp - create the tensor field corresponding to the given eigendecomposition. % % T = perform_tensor_recomp(e1,e2,l1,l2); % % 'e1(i,j,:)' is the main eigenvector at location (i,j) % with associated largest eigenvalue 'l1(i,j)'. % 'e2(i,j,:)...
57baf02725b17c595a0b3c45e30e5b26f72eda8711ff2527ae535b62229ec2db
MATLAB
733
31
function [ c_path_times ] = c_pathways( Pks_Frame,sec_Pk_edos ) %28Mar14 Para encontrar el numero de rutas diferentes en un experimento. %times_secb tiene que ser un arreglo [ d_sec,times_sec ] = d_assemblies( Pks_Frame,sec_Pk_edos ); times_secb=cell2mat(times_sec); d_sec_time=cat(2,d_sec,times_secb); d_st_1a=sortrows...
1ee875204f394f1c9db19268d2a6db7cdba46d450769cf917d8f98da3440fdc2
MATLAB
734
25
function vl_simplenn_start_parserv(net, ps) %VL_SIMPLENN_START_PARSERV Setup a parameter server for this network % VL_SIMPLENN_START_PARSERV(NET, PS) registers the network % parameter derivatives with the specified ParameterServer instance % PS and then starts the server. for i = 1:numel(net.layers) for j...
9db8a5a01bc22dda2cef41be3a677a3c209077bc89fa65dce5eec9183fc8b80b
MATLAB
734
25
function unit_vector = normalise(v) % % Normalisation % % normalise(v) produces a unit vector that is in the same direction as the % vector v. Both column vectors and row vectors can be normalised. An error % is returned if the zero vector is attempted to be normalised. % % For example, normalise([1 1]) produ...
591c8111944f4c0d2da776a8089268a55807c31165408e429aebd26c5b1e53da
MATLAB
735
34
function [llh] = tapas_dlinear_llh(data, theta, ptheta) %% Likelihood function of a linear model where we assume that the covariance % is diagonal. Note that this is the prior of a Gamma Gaussian model. % % aponteeduardo@gmail.com % copyright (C) 2016 % y = data.y; u = data.u; theta = theta.y; [~, nc] = size(y); l...
1b7d228d60d901e0900cb3e4eedec8aea389c4d7b4e09972684a00bd62a12f5e
MATLAB
736
25
function getMemoryUsage() %GETMEMORYUSAGE Summary of this function goes here % Detailed explanation goes here % Get memory usage if ispc user = memory; total_mem_usage_mb = user.MemUsedMATLAB / (10.^6); else [tmp pid] = system('pgrep MATLAB'); pid_split = strsplit(pid); total_mem_usage_mb =...
1bed8a1ae771555ac061e71bd8d55fddf26bc74e3ccd129354db5b206b8ce885
MATLAB
737
21
function ptvalidateparamin(x,y,arg) %PTVALIDATEPARAMIN Validate input parameters of PERMUTOOLS functions. % PTVALIDATEPARAMIN(X,Y,ARG) validates the input parameters X and Y, and % input arguments ARG of the main PERMUTOOLS functions. % % See also PTPARSEVARARGIN. % % PERMUTOOLS https://github.com/mickcrosse/P...
bc4b20d06bba531ddb62cd95150d0c203fdb6476bc17ccf123f112959650300a
MATLAB
737
32
%% get_set_qsm_lpcnn(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid ...
f4729ccf3ed27233e1e3f7a2e23ecac860e56d975d0677ab8d1f9aa5fdb00a34
MATLAB
737
21
function ptvalidateparamin(x,y,arg) %PTVALIDATEPARAMIN Validate input parameters of PERMUTOOLS functions. % PTVALIDATEPARAMIN(X,Y,ARG) validates the input parameters X and Y, and % input arguments ARG of the main PERMUTOOLS functions. % % See also PTPARSEVARARGIN. % % PERMUTOOLS https://github.com/mickcrosse/P...
a60de729b9a0e10679732fe8c23292465271a893c63e58c173b0cf5dea4390a1
MATLAB
738
23
function run_peth(cluster1,cluster2,rez) edges = -50:1:50; Spike_id = find(rez.st(:,3)==cluster1); M1 = rez.st(Spike_id,2); Spike_id2 = find(rez.st(:,3)==cluster2); M2 = rez.st(Spike_id2,2); TrialN = length(M2); C = zeros(TrialN,length(edges)-1); SpikePETH_M = zeros(length(edges)-1,1);...
eb18d2e5285354e5f0e8c528e955251ea1323dfc7f5dc829224b875483a66293
MATLAB
738
34
function [hf,ha,figI]=selectPlot(figI) % - activates or creates figure figI(1) % - activates or creates plot [figI(2:4)], % or [1 1 1] if figI(2:4) are missing % - sets background color to white %__________________________________________________________________________ % Copyright (C) 2009 Medical Research Council ...
f7baa0acb9d41152a668ddab753cb896c5d4361e4452dc866a5ea33490604495
MATLAB
738
22
function outTrain = downSampleSum(spikeTrain, newSampleNum) %downSampleSum performs downsampling via summation (basically binning) of %2D matrices. % Author: Tim Sit % Last Update: 20180518 % INPUT % spikeTrain | numSamp x numChannel matrix % newSampleNum | new sampling rate to use, ie. the num...
577717bb0eb2fe975d4441fb723679aafeecbabd901bfdff37d1292305614942
MATLAB
739
26
function A = functional2system(FC) % Translate functional connectivities to system matrix % A = -L/(\lambda_{max}(L)) % L is the laplacian matrix for FC % Inputs: FC, N-by-N or N-by-N-by-M matrix, functional matrix % % Output: A, N-by-N, system matrix [row,~,num] = size(FC); if num =...
72588fcc14e8c74b0672d68d4f1326f08f9b443047f8b39c526f56453f824d33
MATLAB
741
37
function h = plot_maps(fit) % h = plot_maps(fit) % Plot parameter maps from model % % USAGE: % h = plot_maps(fit) % % INPUTS: % fit = fit results from IVIM model % % OUTPUTS: % h = figure handle % % AUTHOR: % Dr. Helge Zoellner (Johns Hopkins University, 2025-06-12) % ...
06ddcf0edc5bf525bfd4807b34753d1763b9b41eef39b90509ae5973afcb8ba4
MATLAB
742
28
function [handle,matrix,u] = semplotBin(x,y,nBins,varargin) if size(y,1)==1, y = y'; end if size(y,2)>1, y = y(:); end if size(x,1)==1, x = x'; end if size(x,2)>1, x = x(:); end if numel(x) ~= numel(y), error('x and y should be vectors of equal length'); end nans = isnan(x); x(nans) = []; y(nans) = []; if nBins==0 ...
3214338f410205f2fbab62a6591b06af1a11e953609333c10d102dff367dc6e1
MATLAB
742
37
function RHSdiv = divergenceTerm1D(F) % This function calculates the divergence of a field using its face % average value % % SYNOPSIS: % RHSdiv = divergenceTerm1D(F) % % PARAMETERS: % F: Face Variable % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file ...
6396d6ad9b8b9e69c6b5a3c9dc6e2a6552c8173ed718760d47faf6f1cc168a0a
MATLAB
742
28
function err = TCA_chooseRank(data, savePath) % plots the error for a variety of different rank models, used to select % rank for the model %% Fit CP Tensor Decomposition % these commands require that you download Sandia Labs' tensor toolbox: % https://github.com/andrewssobral/tensor_toolbox/ % https://www.tensortool...
fa1d5990ea1829bdf3aafdfa10faedcbae4e49bcc2ae450a908d88b912b2f4f5
MATLAB
742
33
function RHS = constantSourceTerm2D(phi) % RHS vector for a Explicit source term % % SYNOPSIS: % RHS = constantSourceTerm2D(phi) % % PARAMETERS: % phi: Cell Variable % % RETURNS: % RHS: vector % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file % extract data from t...
c57e3bfd46315c8121ee6390ee9b3d63eee9b20e67ef6c0b546865931f079a1d
MATLAB
743
30
clear numCams = 6; baseFolder = 'D:\\20191122\mouse'; load([baseFolder filesep 'calibration\camera_params.mat']) load([baseFolder filesep 'calibration\intrinsic\cam_intrinsics.mat']) % extrinsics % r = rotation matrix % t = translation matrix % intrinsics % K = intrinsic matrix % RDistort = RadialDistortion % TDisto...
bc9fa35dd74958557c244151781c4b5e591f3dfbedaa13ae22974b0235639979
MATLAB
744
24
function X = hlp_applyscaling(X, si) % Apply some previously determined scaling structure % X = hlp_applyscaling(X, ScaleInfo) % % This is just a convenience tool to implement simple data (e.g. feature) scaling operations. % % Examples: % scaleinfo = hlp_findscaling(data,'whiten') % hlp_applyscaling(data,scaleinfo...
dc599960f4c0a71e1fbbf7b75465b32d50c5825ffd22780305ec262f8128217a
MATLAB
744
44
function x0 = sero_srr_setGuess(S, TR, B, W, do_t1, do_v, sm_siz) % function x0 = srp_setGuess(S, TR, B, W, do_t1, sm_siz) z = size(TR,2); TRnan = TR; TRnan(TRnan==0) = nan; if nargin < 4 || isempty(W) W = TR>0; end if nargin < 5 || isempty(do_t1) do_t1 = 1; end if nargin < 6 || isempty(do_v) do_v = 1; ...
e35038cbd9d6350ececb190c364c602e3211cf43732cf89a014b16c3f27388a0
MATLAB
744
29
classdef nnrelu < nntest properties x end methods (TestClassSetup) function data(test,device) % make sure that all elements in x are different. in this way, % we can compute numerical derivatives reliably by adding a delta < .5. x = test.randn(15,14,3,2) ; x(:) = randperm(numel(x)...
33d46c5b14e337c73375f5a77d762316e2f9fc4fb14db785e7f2f76b9145aaa7
MATLAB
745
24
function mad = compute_MAD(inputVector) %It computation is based on the %following article: https://www.sciencedirect.com/science/article/pii/S0022103113000668 %This indice is to be better than the standard deviation because it is %less sensible to outlier. The script assume that the data approximatively normaly distri...
45c4c3abf62535b59a26685c56c24b386d43fd8e7139469924dbd9d176599bc5
MATLAB
745
28
function [eyelikeres, S, P]= eyelike(E) % EYELIKE - calculate a permutation matrix P and a scaling (diagonal) maxtrix S % such that S*P*E is eyelike (so permutation acts on the rows of E). % E must be a square matrix. % Usage: % >> [eyelike, S, P] = eyelike(E); % % Author: Benjamin Blanke...
92d204223a08c78757006b58a098434ef2b7476ba23781b8dafd37bb6f7a109d
MATLAB
745
16
function [seq_ent,seq_maxent,dkl] = compute_HOM_seq_ent(nsymbs,symbprobs) % Computes the entropy for a k-th order markov chain sequence % seq is a sequence of integers (symbols) going from 0 to max(seq) % %nsymbs = length(symbprobs); %minprob = eps; %symbprobs(symbprobs==0) = minprob; symbprobs=symbprobs(symbprobs>0); ...
be2b4beafb47f43fcf039d4410ab1d99013e640c46e2956e66532acb8c3ef313
MATLAB
745
39
function pix = angle2pix(display,ang) %pix = angle2pix(display,ang) % %converts visual angles in degrees to pixels. % %Inputs: %display.dist (distance from screen (cm)) %display.width (width of screen (cm)) %display.resolution (number of pixels of display in horizontal direction) % %ang (visual angle) % %Wa...