sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7092c7032d090f4fd659a20269a237ecfb7606bb8a560c7a162782af61d7c1e6
MATLAB
471
20
function [OFC,notOFC] = onlyOFC(all_S,cells,all_SU,all_index) for i = 1:length(cells) S = all_S{all_index{cells(i),4}}; SU = all_SU{cells(i)}; try depth(i,:) = [SU.AP,SU.ML,SU.DV]; location{i} = SU.location; catch SU = channelLocation_MD(S,{SU}); depth(i,:) = [SU{1}.AP,SU{1}.ML,SU{1}.DV...
d359132d4cc921794a8e7580c8653239ab746b1d7ea29c2667e022f9d61606ec
MATLAB
471
15
function TMSTPCalc % Written by Dr. Gong-Jun JI, jigongjun@163.com, Anhui Medical University inpath = spm_select(1,'dir') outpath = spm_select(1,'dir') list = dir (inpath); for i = 3 : length(list) img=dir([inpath,filesep,list(i).name,filesep,'*.nii']) ; head = spm_vol([inpath,filesep,list(i).name,filese...
5a9aee1b8462c5cb89615d801c271330762fe7e928636f1c24c729ff107bf071
MATLAB
472
22
%{ # -> tune.MovieOracle -> `pipeline_fuse`.`__activity__trace` -> stimulus.Clip --- trials : int # number of trials used pearson : float # per unit oracle pearson correlation over all movies %} classdef MovieOraclePearson < d...
8f76c91431a82b9b629b41e591f082b778f1f1ec62247449e9770ef312f65e42
MATLAB
472
26
%% test weighted random selection in fortran data = dlmread('./testout.txt'); for c = 1:10 counts(c) = nnz(data(:,2)==c); end %% list = 1:10; plot(list,counts,'.-',list,list.^2/sum(list.^2)*size(data,1)) %% check sampling without replacement data = dlmread('./testout.txt'); any(data(:,2)==data(:,3)) for c = 1...
ae271d5b4167403609c442286e7dcc098a54e5faacaf95092c1e7d8e5579fffd
MATLAB
472
22
function [v] = tapas_mh_mc3_arc(ollh, olpp, nllh, nlpp, ... ratio, T) %% Acceptance rejection criterion for metropolis hastings in the context of % population mcmc. % % aponteeduardo@gmail.com % copyright (C) 2016 % v = bsxfun(@times, nllh, T) + nlpp - (bsxfun(@times, ollh, T) + olpp) ... + ratio; nansv = isn...
ccd9e69ec956d6c91c0d6ee3b3571f8627e3665cbc5c89c3ae862e3df89582d7
MATLAB
472
12
% This script removes the 'elec' field from the MEG files meg_files = dir([main_path 'Dataset/*_meg_rest_60sec.mat']); for i=69%1:length(meg_files) meg = load([meg_files(i).folder '/' meg_files(i).name]); if isfield(meg,'elec') disp(['removing the elec filed from the meg file ' meg_files(i).name]) ...
d4f8fb437810982a1dc5c8fe1d8478e8348316c54e0650c1e58a40c899f3fc54
MATLAB
472
14
function [tpl, str] = subst(tpl,handle) %TEMPLATE/SUBST Substitute a replacement field by its value % STR = SUBST(TPL,HANDLE) substitute all the known fields of variable HANDLE % in the template TPL. % Copyright (C) 2003 Guillaume Flandin <Guillaume@artefact.tk> % $Revision: 1.0 $Date: 2003/05/05 22:19:51 $ tpl =...
4dd919c40e0ff0f5fc1bce5e4c34f354959a13335809eb8a1b51a5d86345fcff
MATLAB
473
20
classdef CellVariable %CELLVARIABLE Summary of this class goes here % Detailed explanation goes here % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file properties domain value end methods function cv = CellVariable(meshVar, cellval) i...
9ccc0096529e33855f03069ff86b4c04e1f89ffe92dfb9056f1cfb81b618c7ad
MATLAB
473
22
%{ # -> tune.MonetOracle -> `pipeline_fuse`.`__activity__trace` -> stimulus.Monet --- trials : int # number of trials used pearson : float # per unit oracle pearson correlation over all movies %} classdef MonetOraclePearson < ...
06e62f84727cf0a8b45ad2602c85796ff4935ab60d88da4894e32a1476b43fd8
MATLAB
474
22
%{ pre.ExtractSpikes (computed) # inferences of spikes from calcium traces -> pre.ExtractTraces -> pre.SpikeInference --- %} classdef ExtractSpikes < dj.Relvar & dj.AutoPopulate properties popRel = pre.ExtractTraces * pre.SpikeInference & struct('language','matlab') end methods(Access=pro...
2799a4e6904f097cfc2d0a4cabd4ec2e8f93330f5f4475143fd507c0a2e98140
MATLAB
475
20
function c_code_works = test_sttc_c_code() %UNTITLED Summary of this function goes here % Detailed explanation goes here Time = [1, 10]; spike_times_1 = [1, 4, 5, 8]; spike_times_2 = [2, 4.5, 6, 10]; dtv = 0.5; % in seconds, the delay time to look for conincidental spikes N1v = length(spike_times_1); N2v = length(s...
42689e84194d8e38ca596e3671894ecff2e3df721d345480880f06104723a376
MATLAB
475
17
function struct_out = concatStruct(struct1,struct2,concatdim); %function struct_out = concatStruct(struct1,struct2,concatdim); if nargin<3 concatdim = 1; end fields1 = fieldnames(struct1); fields2 = fieldnames(struct2); if ~all(ismember(fields1,fields2)) error('Structure fields don''t match!'); end struct_ou...
5977621a316622ae1628a23a3648135f6c9fb3cd8c46e718d1ccd8c0fe257cdc
MATLAB
475
23
%{ aod_monet.DriftResponseSet (computed) # my newest table -> aod_monet.DriftTrialSet -> aodpre.ExtractSpikes --- %} classdef DriftResponseSet < dj.Relvar & dj.AutoPopulate properties popRel = aod_monet.DriftTrialSet*aodpre.ExtractSpikes & aodpre.Spikes end methods(Access=protected) ...
b00268c2936e3383820dc654a43b6a8dabdef5f985368abca7581cda19dcf67e
MATLAB
475
20
function [clean,isOutlier] = RemoveOutliers(data,whisker) if ~exist('whisker','var') whisker = 1.5; end % if size(data,2)>0, % clean = data; isOutlier = zeros(size(data)); % for i=1:size(data,2) % [clean(:,i),isOutlier(:,i)] = RemoveOutliers(data(:,i)); % end % end q1 = quantile(data,0.25...
17591420bef0bd519dc64842625d8be26ef77f420cb2c9ba7ef557824e9ea618
MATLAB
476
31
function r = times(p,q) %TIMES this function multiplies the x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if (isa(p, 'CellVariable')&&isa(q, 'CellVariab...
af0ef17f245f652d8eebf65b512eecae390468f8b2a8aa2f7f0b9c87a8126205
MATLAB
476
31
function r = power(p,q) %power this function power (.^) the x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if (isa(p, 'CellVariable')&&isa(q, 'CellVariab...
eeffdf91d6d8555ebdb367ac3d8a1ed46e0ca77531188ad8881f1a30d8140fb3
MATLAB
476
20
classdef NormOffset < dagnn.ElementWise properties param = [1 0.5] end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnnoffset(inputs{1}, obj.param) ; end function [derInputs, derParams] = backward(obj, inputs, param, derOutputs) derInputs{1} = vl_nnnoffset(...
79c5786a6f8fb38357db7026ce17f5b3111399c4e28e11dca518e0c4f1667070
MATLAB
477
22
classdef FaceVariable % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file properties domain xvalue yvalue zvalue end methods function fv = FaceVariable(meshVar, facevalX, facevalY, facevalZ) if nargin>0 fv.domain = meshVar...
8f31ca0b7ab1af0332eee4bde1473c589727bd9e836b366f788e8854e1e18820
MATLAB
477
31
function r = rdivide(p,q) %RDIVIDE this function divides the x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if (isa(p, 'CellVariable')&&isa(q, 'CellVaria...
be85138e3057467915da5580e75d9b444a3ba7f87d22ea717aba7fd6f02d1d2b
MATLAB
477
21
function h=setfpos(x,y) %setfpos Set figure position. % % % h = setfpos(X,Y) % X - Horizontal length. % Y - Vertical height. % h is the figure handle to the figure just handled % Sets current figure lower left position to X by Y pixels (measured from % lower left corner of screen. On image, max pixels are about % ...
086c7bc888748a9267c8bf86bd497784f9042e6f9aa8c498efc3d8ef45b04df8
MATLAB
478
21
%{ rf.Lens (lookup) # objective lens list setup : char(4) # two-photon setup lens : char(4) # objective lens --- %} classdef Lens < dj.Relvar methods function fill(self) self.inserti({ '2P1' '16x' '2P1' '25x' ...
41f31f5d8f6447dfd073e6859b25fde0af8557415ed26e77b58cd0c944adac48
MATLAB
478
20
classdef LRN < dagnn.ElementWise properties param = [5 1 0.0001/5 0.75] end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnnormalize(inputs{1}, obj.param) ; end function [derInputs, derParams] = backward(obj, inputs, param, derOutputs) derInputs{1} = vl_nnn...
52be0a8b4f37e0c08aa50dedcc5818125bb357de1b817b7174ed3c0c80ac6564
MATLAB
478
18
function [SY,ix] = compo_init_index(xx,YX,YY,T) % % --- Initialization: Find input component with maximum correlation % % N # of output % M # of input % T Total number of data % xx = diag(XX)' % 1 x M_all [N, M_all] = size(YX); R = sum(YX.^2,1) ./xx; % (YX)^2/(XX) : correlation of Y & X [Rmax, ...
57ee7762084d36ee3c559663f7ace2fd206a6fefefc313e4897ec019c0c9677d
MATLAB
478
23
%{ trk.SelectedFrame (computed) # This schema only contains detected frames that meet a particular quality criterion -> trk.EyeFrameDetection -> trk.SelectionProtocol --- %} classdef SelectedFrame < dj.Relvar & dj.AutoPopulate properties popRel = trk.EyeFrameDetection*trk.SelectionProtocol % !!! update the popul...
8b2397fce94186d0a0188c1aebc3d457c7fe7ca959798ecbedd0dd99c039424b
MATLAB
478
14
function [popt] = screen_optrate(S) %calculate the probability of opting out for each session, ignoring violation trials. %inputs: S struct. %outputs: opt-out probability for each session. %modified by cmc 10/19/21. popt = nan(length(S.pd),1); for j = 1:length(S.pd) if isstruct(S.pd{j}) goods = ~isn...
c964c8d47f8cae5be9fbf49d170796dd6f6760a521a6ad5b8770ec655b417ebf
MATLAB
478
14
function map2surf = BoSurfStatMakeParcelData(mapOnParcel, S, parcel) % map2surf = BoSurfStatMakeParcelData(mapOnParcel, S, parcel) % makes a surfacefile with 1 x v points from a 1 x p parcellation data, % needs to supply a 1 x p surface parcellation (with p unique elements) % % author: boris@bic.mni.mcgill.ca map2su...
8b5d9a06726a868e658c5f7cb3137b487e875f7f82fc607ef2863f22148f1452
MATLAB
479
20
classdef NormOffset < dagnn_bc.ElementWise properties param = [1 0.5] end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnnoffset(inputs{1}, obj.param) ; end function [derInputs, derParams] = backward(obj, inputs, param, derOutputs) derInputs{1} = vl_nnnoffs...
aff4cba6153cbb41fbb5c979b8a0183f7a10bd387a4ff3c952ff1d62a2a4c26c
MATLAB
479
34
function curfol() % EXAMPLE USE WITH ARGUMENTS % curfol() - use 1 % HELP: % Simple opening of the current folder in Windows explorer. % % HISTORY % - 19-04-24 17:34:40 - created by Radek Chrapkiewicz % % ISSUES % #1 - issue 1 % % TODO % *1 - get the first working version of the function! %% CONSTANTS %% VARIABLE CHE...
df820800fd912da19d3394510edc31ac9c5d9ed653a3c7e8b6a05383e4cc4b61
MATLAB
479
20
classdef SpatialNorm < dagnn.ElementWise properties param = [2 2 10 2] end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnspnorm(inputs{1}, obj.param) ; end function [derInputs, derParams] = backward(obj, inputs, param, derOutputs) derInputs{1} = vl_nnspnor...
ed5d50973e20cbd022b012dab6ae2dd55ae7f39b461ac54aa133d77176b99d34
MATLAB
479
12
function[xvalscm, yvalscm] = convert_to_cm(xvals, yvals, ppcm) %%convert_to_cm converts between pixels and cm % [xvalscm, yvalscm] = convert_to_cm(xvals, yvals, ppcm) % This function takes worm tracks, represented as % x-, y-coordinates in pixels, and turning them in to cm values. % %% Convert Camera Data from p...
efab0f07d3719e6dde91296431f558bdd63315af579c0852002485b40970d1a4
MATLAB
479
8
function [indmin mdall notenough]=multimodelnlm_global(Age_gender,Brainsz,data_r,ylabelname,Plotornot,indall_select,betarealinitial) for i=1:size(indall_select,2); Age_gender_new=Age_gender(indall_select(:,i),:); Brainsz_new=Brainsz(indall_select(:,i)); data_r_new=data_r(indall_select(:,i)); [indmin(:,:,i) mdall{i...
89a2c1f7d6a249d135dee493b36a8056f3e696e41afbdb36ed65e9177af77e75
MATLAB
480
17
function txt=SurfStatDataCursor(empt,event_obj) pos=get(event_obj,'Position'); h=get(event_obj,'Target'); v=get(h,'Vertices'); x=get(h,'FaceVertexCData'); id1=min(find(v(:,1)==pos(1)&v(:,2)==pos(2)&v(:,3)==pos(3))); tag=get(get(h,'Parent'),'Tag'); [s,a,id0]=strread(tag,'%s %d %d'); id=id1+id0 txt = {['x: ',num2str(pos(...
46d220b2dc33e62109c00fe384d68bb61629c5595aa59848e7a5786414898bd0
MATLAB
481
20
classdef LRN < dagnn_bc.ElementWise properties param = [5 1 0.0001/5 0.75] end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnnormalize(inputs{1}, obj.param) ; end function [derInputs, derParams] = backward(obj, inputs, param, derOutputs) derInputs{1} = vl_...
9857a3c73897e78517a70e2f99e5b28f67d10e6e115ef78c1ca0ed33465c573b
MATLAB
481
23
function [scut] = calc_scut(data) % calculate threshold of similarity values from shuffled data num_shuff = 20; p = 0.98; dims = size(data); % calculate similarity matrix warning('off') S = zeros(dims(2),dims(2),num_shuff); for n = 1:num_shuff data_shuff = shuffle(data,'time'); S(:,:,n) = 1-pdist2(data_shuff'...
bd860f5e1c735961b4ba16c84039130e2a4cfcd1208bb130e28ccd437b147fb8
MATLAB
481
22
%{ # individual units corresponding to <module>.ScanSet.Unit -> `pipeline_experiment`.`scan` -> `pipeline_shared`.`#pipeline_version` -> `pipeline_shared`.`#segmentation_method` unit_id : int # unique per scan & segmentation method --- -> fuse.ScanSet %} classdef ScanSetU...
cf6e46d28aa782f0c1f1b264c678e6cf38d86ee02d025fa6d6891f948295d641
MATLAB
481
21
function [v] = tapas_mh_mc3g_arc(ollh, olpp, nllh, nlpp, ... ratio, T) %% Acceptance rejection criterion for metropolis hastings in the context of % population mcmc generalized for hierarchical models. % % aponteeduardo@gmail.com % copyright (C) 2016 % v = nllh .* T + nlpp - (ollh .* T + olpp) + ratio; nansv = is...
d14a1cadb767a5b1c78eecbc3bfb2ae711b6990fc6763ab5a8f166bcf4b373c9
MATLAB
481
24
function [rx1,pxy,frq] = NormedSingleCurveLength(x,lag,fs,figurep,nrmdegree) % this function computes crossed curve length for single time series x rx1 = zeros(1,lag+1); for delay=0:lag rx1(delay+1) = norm(x(1:end-delay) - x(delay+1:end),nrmdegree); end rx = [fliplr(rx1) rx1(2:end)]; pxy = abs(fft(rx)); frq =...
20d2fb630da164839a25c3909aa3eb2e018128532facf229a7c5242025202aa7
MATLAB
482
44
function WriteAveragedStack(fn, Nplanes) Nfiles = numel(fn); im = loadTifFast(fn{1})./Nfiles; for i = 2:Nfiles im = im+loadTifFast(fn{i})./Nfiles; end figure; for i = 1:Nplanes subplot(1,Nplanes, i); imagesc(mean(im(:,:,i:Nplanes:end), 3)); axis image; end pth = fileparts(fn{1}); ...
4781f2886ea2e94dbecdf3b2e0fa20d578cbe19a5a604002a6c6d8d2f631d602
MATLAB
482
23
function [jcut] = calc_jcut(data) % calculate threshold of similarity values from shuffled data num_shuff = 20; p = 0.99; dims = size(data); % calculate similarity matrix warning('off') S = zeros(dims(2),dims(2),num_shuff); for n = 1:num_shuff data_shuff = shuffle(data,'time'); S(:,:,n) = 1-pdist2(data_shuff'...
e908115a69e551fca8dcf14989d42a15b0d0eff586b29d5df18bd58e77490d77
MATLAB
482
20
classdef SpatialNorm < dagnn_bc.ElementWise properties param = [2 2 10 2] end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnspnorm(inputs{1}, obj.param) ; end function [derInputs, derParams] = backward(obj, inputs, param, derOutputs) derInputs{1} = vl_nnsp...
16a8c5c494760f8a16202b8215a0f5ac29b0c28d51bc7d4a34c52feec850e237
MATLAB
483
19
function A = invPD(A) % FORMAT iA = brca.utils.invPD(A) % A - A positive-definite square matrix % iA - Its inverse % % Stable inverse of a positive-definite matrix. % Eigendecomposition is used to compute a more stable inverse. % John Ashburner [V,D] = eig(A); if any(diag(D) <= 0) warning('Matrix has...
afe9b57c35feacbf33b430e6b920bf752ecd144e48b9735bc3bcdae1ad4ffb9d
MATLAB
483
25
%{ rf.Fluorophore (lookup) # calcium-sensitive indicators fluorophore : char(10) # fluorophore short name ----- notes = '' : varchar(2048) %} classdef Fluorophore < dj.Relvar methods function fill(self) self.inserti({ 'OGB' '' 'GCaMP6s' '' ...
e58dbd7212ce5e210a2a47827a34f022d629965b64d30975253971becab3c542
MATLAB
483
25
%close all %clear all % path(path,'.\AGORA\FUZZCLUST') %the data data.X =Z(:,[1 2]); [N,n]=size(data.X); %data normalization data = clust_normalize(data,'range'); plot(data.X(:,1),data.X(:,2),'.') hold on %parameters given %param.c = [.821 .7132 % 0.1 .5 % .1535 .7775] param.c=ii; param.vis=1; par...
3a843431fce5e77cc0ea0c363299ba90b8fe5103c92b4a0d49a62b286eba8fd9
MATLAB
484
18
function Y = multiskew(X) % Returns the skew-symmetric parts of the matrices in the 3D matrix X. % % function Y = multiskew(X) % % Y is a 3D matrix the same size as X. Each slice Y(:, :, i) is the % skew-symmetric part of the slice X(:, :, i). % % See also: multiskewh multiprod multitransp multiscale multisym % This f...
3c08197b43a51aab48d7e0d0100ea3946a03238cbfaae53a0ee597f83511660e
MATLAB
484
18
function Y = multiherm(X) % Returns the Hermitian parts of the matrices in the 3D matrix X % % function Y = multiherm(X) % % Y is a 3D matrix the same size as X. Each slice Y(:, :, i) is the % Hermitian part of the slice X(:, :, i). % % See also: multiprod multitransp multihconj multiscale multiskew multiskewh % This ...
63b1b697a03a6b0f4a24b6969075d97feb22d81a3a585d5220d33272ff0b4f74
MATLAB
484
12
function ret = findFivePercentageOutliers(flatdata) %isoutlier(..., 'percentiles', [5 95]) written to treat all values at once numelems = numel(flatdata); ret = false(size(flatdata)); if numelems < 1 return end numexclude = floor((numelems + 9) / 20); %in R2021a, isoutlier excludes 0 for...
6c2f03dd082297af735c029936b684a738c84c955d94bea9fd297fef5598d3cd
MATLAB
484
20
function [p,tval] = ttestfast(x) %function [p,tval] = ttestfast(x) dim = 1; nans = isnan(x); if any(nans(:)) samplesize = sum(~nans,dim); else samplesize = size(x,dim); % a scalar, => a scalar call to tinv end df = max(samplesize - 1,0); %xmean = nanmean(x,dim); %sdpop = nanstd(x,[],dim); xmean = mean(x,...
9c1c62cb53a70121a5f16db803ae2a039c663d92187a871f26cc9dacfac40ce8
MATLAB
484
14
%{ experiment.LaserCalibrationPowerMeasurement (manual) # -> experiment.LaserCalibration wavelength : int # wavelength of the laser attenuation : tinyint # power setting bidirectional : tinyint # 0 if off 1 if on gdd : int # G...
f5083da6d0d64581c24f5c2ef9b4dc5ea87c663caeba6a7513e13769b62fd22a
MATLAB
484
11
% This function calculates mean and correlation with respect to the pairwise MEM % with given h and J. function [modelMean, modelCorrelation] = mfunc_ModelMeanCorrelation(h,J) nodeNumber = size(h,1); vectorlist = mfunc_VectorList(nodeNumber); prob = mfunc_StateProb(h,J); modelMean = mean((vectorlist.*(ones(nod...
8a79fc7fb6e3e5f489e67eb4ebd34df8a723bf190c62d67692ed500ffe857ebf
MATLAB
485
17
function dfBreak=essential_distMinAnglePair_computeDfBreak(tBreak,Q21) c=cos(tBreak); s=sin(tBreak); % The code below is an optimization exploiting the structure of RBreak to % substitute the following code % RBreak=Q1'*[c -s 0; s c 0; 0 0 1]*Q2; % % %compute v0 such that RBreak=rot(pi*v0) % [U,~,~]=svd(R...
9dc20df7c7bbccbad5c0a8ed07111048fc6a283db606d383e531a4eb6c0c8c84
MATLAB
486
31
function r = lt(p,q) % this function compares the less than condition of x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if (isa(p, 'CellVariable')&&isa(q...
2de7b79b2fd630aec14ca8ee8eda2c4af40d8ef871a7e94e619f3b7598989344
MATLAB
487
19
function in = zscorein(in) for i = 1: numel(in) d = cell2mat(in(i).data'); for ch = 1: size(d,3); d(:,:,ch) = zscore(squeeze(d(:,:,ch)),0,'all'); end numtrialspercell = cell2mat(cellfun(@(x) size(x,1), in(i).data,'un',0)); C = cell(1, numel(in(i).data)); trialstart = 1; for c = 1:numel(in(i)...
ccfc9ed41921bd8e91479a0728335f38446a52a4ba314c38d812b2a47e14c5df
MATLAB
487
19
function plot_proba(rez,i) f=figure; channel = rez.Merge_cluster{i,5}; Nchan = length(channel); h=0.001; for k=1:Nchan PDF = rez.PDF{i,k}; subplot(Nchan,1,k) N = histcounts(PDF,0:h:1); bar(0:h:1-h,(N)) title(['Channel:', num2str(channel(k))...
34be7f467a20cc9ad138dadc92aebc45331367890218158aef67fce452a619ed
MATLAB
488
17
function setDefaultFigProps set(groot,{'DefaultAxesXColor','DefaultAxesYColor','DefaultAxesZColor'},{'k','k','k'}) set(groot, 'DefaultFigureColor', [1 1 1]) set(groot, 'defaultLineLineWidth',1) set(groot, 'defaultAxesLineWidth',1) set(groot, 'defaultAxesFontName','Arial') set(groot, 'defaultTextFontName', 'Arial') s...
53fbf02c614b67e566953556d554245b1972248f187a6ad9d18e00d655bf5f79
MATLAB
488
31
function r = eq(p,q) % this function compares the equality condition of x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if (isa(p, 'CellVariable')&&isa(q,...
853413914a83ecc757562ff0b8e163106a09d19210d40e571c74fd36cd82fffd
MATLAB
489
16
%{ # threshold for masks created manually -> reso.Segmentation --- threshold_type : tinyint # 1=in SD relative to mean, 2=absolute pixel value threshold_value : float # depending on type, this is the tresholding value entry_time=CURRENT_TIMESTAMP : timestamp # time ...
8a5b1f38ed77a4db21a2546a9274804b00fdd2fc7c667b38a931c52027e267b2
MATLAB
489
31
function r = gt(p,q) % this function compares the greater than condition of x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if (isa(p, 'CellVariable')&&is...
8bdfd21fce35d43d123954c2859671c2174521ee12ff5e5ae50795d4fe7ac43c
MATLAB
489
25
function Wd = diagW(WM) % build huge diag gram matrix % % W = diag(W_1, W_2, ..., W_M) % % Inputs: WM, N-by-N-by-M matrix, M N-by-N gram matrix % % Output: Wd, N*M-by-N*M diag gram matrix [row,col,num] = size(WM); B = zeros(row,col); P = cell(num); for i = 1:num for j = 1:nu...
27c09a1c30bf4f25cd11ab35a9adc6b6b6c47b1f90b7a62935fd7dcd7213822f
MATLAB
490
31
function r = ne(p,q) % this function compares the inequality condition of x, y, and z values of the structures that I use in % the FVtool. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPLE: % % SEE ALSO: % % Copyright (c) 2012-2016 Ali Akbar Eftekhari % See the license file if (isa(p, 'CellVariable')&&isa(...
a8663b8ce97b41d6f09ce7a982312e57c15dec430b64ec4981c216619ff75ade
MATLAB
490
20
%{ # inferred background components -> meso.SegmentationCNMF --- masks : longblob # array (im_height x im_width x num_background_components) activity : longblob # array (num_background_components x timesteps) %} classdef SegmentationCN...
b856a637d6260c2ad80fdbc28bc7c2e09a6a3269106b58faaf8917e91f9c1138
MATLAB
490
25
function x=normalise(x,dim) % normalise(X) % Removes the Average or mean value and makes the std=1 % % normalise(X,DIM) % Removes the mean and makes the std=1 along the dimension DIM of X. if(nargin==1), dim = 1; if(size(x,1) > 1) dim = 1; elseif(size(x,2) > 1) dim = 2; end; end; dims = siz...
c6088f7a893fb4ae67d49294461a5e109ace5a4d843f4092686bc9faf5b0eb30
MATLAB
490
20
%{ # inferred background components -> reso.SegmentationCNMF --- masks : longblob # array (im_height x im_width x num_background_components) activity : longblob # array (num_background_components x timesteps) %} classdef SegmentationCN...
d4c96a59093f2ea3ce73518c8af60cf5f5005f99448fb6292347e1cc3998e0ac
MATLAB
490
15
function [nirs, partName] = loadSubjectData(subjectName) % Loads NIRS data for a specific subject from file and ensures proper data % structure formatting. Initialises measurement activity list if not % present in the original data. % Load .nirs data partName = subjectName; nirs = load(partName, '-mat')...
f2897f7660b076de9e8f801051fb05e8e48ee67a6de08e432c3d144eead7804c
MATLAB
490
23
function [alpha, beta] = tapas_gamma_moments_to_ab(m1, m2) %% Transforms the central moments of a Gamma distribution into the alpha beta % parametrization where x^alpha-1 b^alpha exp(-x * beta) % % Input % m1 -- First central moment (mean) % m2 -- Second central momement (variance) % % Output % ...
3678fb8e3d30dba9e2622b87796baf608c8a5d350d414135adaa02825d03cf1a
MATLAB
491
23
function [jcut] = calc_jcut(data) % calculate threshold of similarity values from shuffled data num_shuff = 20; p = 0.99; dims = size(data); % calculate similarity matrix warning('off') S = zeros(dims(2),dims(2),num_shuff,'single'); for n = 1:num_shuff data_shuff = shuffle(data,'time'); S(:,:,n) = 1-pdist2(da...
667a64dd63a903eb15fe691dc31090ab86367836b69bd8d3b0b02c476d11d12c
MATLAB
491
22
function [Result] = Feta(eta,y,sig2) %Implemented by Christian Beckmann if nargin<3 sig2=1; end bm=sig2*(1-sqrt(y))^2; bp=sig2*(1+sqrt(y))^2; Result=zeros(size(eta)); teta=bm:1/1000:bp; feta=zeros(size(teta)); feta=((2*pi*y*teta).^(-1)).*sqrt((teta-bm).*(bp-teta)); % fig...
f679bfc9eabcdfdb3f53cc4b4fbdf4dbe09a783a53eaffdec87cefb903f79043
MATLAB
491
18
function string=compactPvalueString(p) % given a numeric p-value returns a string that expresses it in scientific format. %__________________________________________________________________________ % Copyright (C) 2012 Medical Research Council import rsa.* import rsa.fig.* import rsa.fmri.* import rsa.rdm.* import rsa...
75a5a83c33b84d78769f5c4c86985c5ced4e7085c794f18c2a82a46bdfd44baf
MATLAB
492
8
%% This file specifies the Python environment and Checkpoint of QSMnet+ % Specify the directory of the QSMnet+ code from Github QSMnet_HOME = '/home/common/matlab/sepia/external/QSMnet/QSMnet-9ca283a'; % Specify the Python environment that has QSMnet+ installed python_interpreter = '/home/common/matlab/sepia/...
02b846407d59b152970a07da1781714a7df4cbef2ec0b559a13b634fead5a578
MATLAB
493
30
function [version] = tapas_get_current_version() %% Get the current version of tapas. % % Input % % Output % version -- A string with the the three version digits. % aponteeduardo@gmail.com % copyright (C) 2018 % f = mfilename('fullpath'); [tdir, ~, ~] = fileparts(f); logname = fullfile(tdir, 'log_tapas.tx...
0a95f4adc720c0cf63b20b888e13309f026802c6107f655cd25467fee227749d
MATLAB
493
20
function [ out ] = nf_update_struct( orig, update ) %[ out ] = nf_update_struct( orig, update ) % will update all fields in orig by respective fields in update % items=fieldnames(update); for i=1:length(items) if isfield(orig,items{i}) if isstruct(orig.(items{i}))&&isstruct(update.(items{i})) orig.(items{i}...
6383e72089468f72367594ae9b5c55e2322f45cb1aee9ecebfee1675e92d1ab3
MATLAB
493
22
function correctedStackTiff(key,filepath,direction) % direction can be 'normal' or 'reverse' if nargin <3 direction='normal'; end stk = stack.loadCorrectedStack(key); switch direction case 'normal' ind = 1:size(stk,4); case 'reverse' ind = size(stk,4):-1:1; otherwise error('dir...
8962b6375fc6654d63502ee8d5e9f0e5ce1870af95e1a55bee27cbacaed86fad
MATLAB
493
22
function [ss] = dabest(csvFile, varargin) d = readtable(csvFile); identifiers = d(:,{'Identifiers'}); identifiers = table2cell(identifiers); data = d(:,{'Values'}); data = table2array(data); close(gcf); if length(varargin) > 0; if strcmp(varargin{1},'Paired'); [ss] = FscatJit2(identifiers, data,'Y'); ...
8dc997af18c8f0dd4898a78105e93b0ac62d89e7e00fc9f8b1e91577df0f0709
MATLAB
493
17
%{ # -> eye.FittedContour frame_id : int # frame id with matlab based 1 indexing --- center=null : tinyblob # center of the ellipse in (x, y) of image major_r=null : float # major radius of the elli...
425d55c3ac305b0b1a10075073c0cd65c93c6a39715750dd662e497b76fdbf2a
MATLAB
494
21
%{ # -> preprocess.ManualCellLocations cell_id : smallint # cell identifier --- x : float # x coordinate of the cell y : float # y coordinate of the cell %} classdef ManualCell...
560d4e170794694ffc1198387780b551305f88e63914bf93cbda3b74324776f0
MATLAB
494
18
function Y = multiskewh(X) % Returns the skew-Hermitian parts of the matrices in the 3D matrix X. % % function Y = multiskewh(X) % % Y is a 3D matrix the same size as X. Each slice Y(:, :, i) is the % skew-Hermitian part of the slice X(:, :, i). % % See also: multiskew multiprod multitransp multiscale multisym multiher...
82fc2cf4de2dd4ef5e382330b720182b32c67b72c855b21216bc3a5e2d083349
MATLAB
494
15
function DB = meta_study2contrast(DB) % DB = meta_study2contrast(DB) % helper function to turn unique studies stored in DB.Study % into unique contrast codes stored in DB.Contrast % % in case contrasts are not manually entered. % contrast numbers in order -- unique with no sorting [u,ii]=unique(DB.Study); ii = sort(ii...
6877b776ddd6b66789f153794c4fb1ffa194d2ce09f954ff32b367f8df5ad523
MATLAB
495
18
function h = sero_pulseq_plot_pns(seq, blockInd, hw) % function h = sero_pulseq_plot_pns(seq, blockInd, hw) % % This function requires the SAFE nerve stimulation framework: % https://github.com/filip-szczepankiewicz/safe_pns_prediction if nargin < 2 || isempty(blockInd) blockInd = [1 numel(seq.blockEvents)]; end ...
171ee80c74d1634ef4d6705788f8e8a3f6eed28c04767db1b0be1a741b617934
MATLAB
496
21
function [Mask0,zstack]=OpenImage(NameMask,aux) Info=imfinfo(NameMask); NumberImages=length(Info); zstack=NumberImages > 1; if zstack C=zeros(Info(1).Height,Info(1).Width ,NumberImages); for i=1:NumberImages A=imread(NameMask, 'Index', i); C(:,:,i)=A; e...
549176ed178d02c2311eb78af3c304fc77244d4b81c041a1a734953f46ecb5fa
MATLAB
496
21
function ratlist = loadRats(datadir, sensortype) % load list of dopamine or acetylcholine rats % sensortype: 'da' or 'ach' if strcmpi(sensortype, 'da') sensortype = 'da'; elseif strcmpi(sensortype, 'ach') sensortype = 'ach'; end load(fullfile(datadir, 'data-published', 'ratlist.mat'), 'sensorList') allrats = ...
74292a56f2e745c7887648c519621df0f6b58ab2948bf4a602b405f8e26f7278
MATLAB
496
20
function p=relRankIn_includeValue_lowerBound(set,value) % returns the relative rank of value within set. % the relative rank is the proportion of set smaller than value. %__________________________________________________________________________ % Copyright (C) 2009 Medical Research Council import rsa.* import rsa.fi...
9fd623b62056b410d17c7fad1eb9c6ef68e78918a5c7e697238953f399254e6a
MATLAB
496
13
function [mouse_heatmap] = get_mouse_heatmap(mouse_position,frame_size) mouse_heatmap = zeros(frame_size); for p = 1:size(mouse_position,1) if sum(isnan(mouse_position(p,:)))<1&&(mouse_position(p,2)<=frame_size(1))&&(mouse_position(p,1)<=frame_size(2)) mouse_heatmap(mouse_position(p,2),mouse_position(...
253a190662494ef6861beb734c0baa11648b62a61300d72a4c03208807045884
MATLAB
497
23
function [ ID_info] = get_mat_ID_INFO( AA,L) subgraph=zeros(4,4); kk=1; A=AA; ll=size(A,1)/4; ss=size(A,2)/4; ID_info=ones(2,ll*ss); for i=0:ll-1 for j=0:ss-1 for ii=1:4 for jj=1:4 subgraph(ii, jj)= A(ii + i*4, jj + j*4); end end ...
624aa65613ece58b1e775e72f909f17797ab2739ed0818e7f9186a55f112f5f0
MATLAB
497
25
function h = axisNotSoTight(h) % after axes tight, enable a bit of white space if ~exist('h', 'var'); h = gca; end % enforce axis tight axis(h, 'tight'); % find the current limits xlims = get(h, 'xlim'); ylims = get(h, 'ylim'); % get the range xrange = range(xlims); yrange = range(ylims); % enlarge with X percent ...
6c77a72f9c12620d3d42ea27369185bda2f58de850d9d4c5e44b953217155a6d
MATLAB
497
17
function [P] = likelihood_fun_local(x0Mean,x0Std,AMean,Astd,data,nMean,nStd,Conc,noiseStd) %% data -- rows are concentrations, columns are trials. There's one x0 and % one A guess for every trial Ptrial = ones(1,size(data,2)); for ii = 1:size(data,2) %loop over trials rr = permute(data(:,ii),[3,2,1]); %one dose ...
7c8086500fd728467775e8c9f367ffc070ecdaa49d4a4584814861546b865670
MATLAB
498
24
%% function export_nii(img,fn,v_size) % % Description: Directly save to nii.gz format % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: ?? % Date last modified: 1 Oct 2022 % function export_nii(img,fn,v_size) % load_module_NIfTI; try filename=fn; catch; filename='Result';end try voxel_size = v_size; ca...
a5e687107038f33f4baf06c6c2d90b4aa33165d67be9ce9f8f882de473586e95
MATLAB
498
20
function plotAutoCorrelogram(spikeRaster,Fs,varargin) nTrace=size(spikeRaster,2); BW=100; %for gamma figure('defaultaxesfontsize',16,'color','w') for iTrace=1:nTrace [r,lags] = xcorr(spikeRaster(:,iTrace),Fs,'coeff'); r((length(r)+1)/2)=0; subplot(nTrace,2,2*(iTrace-1)+1) plot(lags,r,'k','linewid...
d848a7a44da5b05b8022472a14206b740149581d7c901736dafcbca5bfcdb8f2
MATLAB
498
14
function spectogramMax = get_spectogram_max(hObject, handels) spectogramMax = str2double(get(handels.SpectogramMax,'String')); contents = cellstr(get(handels.spectogramScalePopup,'String')); scale = contents{get(handels.spectogramScalePopup,'Value')}; if ( isnan(spectogramMax) | spectogramMax ...
e0871e0436523a70f2a495d8294ee3135e2ae0022854d5a0d8c6582f3861944f
MATLAB
498
10
function [verbose] = tapas_physio_plot_sync_bundles(Nallvols, t, SLICELOCS, verbose) %UNTITLED Summary of this function goes here % Detailed explanation goes here stringTitle = 'Sync: Slice bundles belonging to 1 volume'; verbose.fig_handles(end+1) = tapas_physio_get_default_fig_params(); set(gcf, 'Name'...
0ff7129c47738004b9f8d291822e536f92ad51083668fd6ccb72c563dbd1cbec
MATLAB
499
17
function [directionsCondition1, directionsCondition2] = getDirectionBaseVectors(cfg) % % [directionsCondition1, directionsCondition2] = getDirectionBaseVectors(cfg) % % % (C) Copyright 2020 CPP visual motion localizer developers % Set directions for static and motion condition % condition1...
4d4dd2be39a4289e53e4683625e0f5c5e106fa1482814f91150811f59fdc57df
MATLAB
499
20
%{ # motion correction for each slice in the stack -> stack.RasterCorrection --- y_shifts : longblob # y motion correction shifts (num_slices x num_frames) x_shifts : longblob # x motion correction shifts (num_slices x num_frames) %} clas...
0182a6b11a28cc4b041bd56ba84f9a5d145e1f43271d6e3c603a1d5426d32176
MATLAB
500
13
function data = extract_VAE_embeddings(encoderNet, options, ClusteringData) % Resize the images to match the input image size images = zeros([options.imageSize, size(ClusteringData, 1)]); for i = 1:size(ClusteringData, 1) images(:,:,:,i) = imresize(ClusteringData.Spectrogram{i}, options.imageSize(1:2)); end images...
303424d599f4f2b1d99ab635e37d779b31c07c0608a95950eeb70c16948256e2
MATLAB
500
15
function s = char(tpl) %TEMPLATE Convert a template object in a one line description string % S = CHAR(TPL) is a class convertor from Template to a string, used % in online display. % % See also DISPLAY % Copyright (C) 2003 Guillaume Flandin <Guillaume@artefact.tk> % $Revision: 1.0 $Date: 2003/05/05 22:19:51 $ ...
5c8bb182002ac710e8c7543e7f9e13038fe51c3403c7ed889c83c06e6ef7c2c4
MATLAB
500
23
function [da_rats, T, bins, delay_legend] = DelayEffectAcrossRats(ratlist,... block, delaybins, event, Bstruct, Pstruct) %input %block = behavior block to use %numbins = number of delay bins da_rats = cell(length(ratlist), 1); for rat = 1:length(ratlist) ratname = ratlist{rat}; disp(ratn...
7cca40b00c70e80c0dbf13d80b46a74cf7d5116412b4f41275b5a846f388548c
MATLAB
500
20
function indic = make_indicator(aus,aulistr) % indic = make_indicator(aus,aulistr) % % aus is list of cell arrays with words (rows of indic are cells) % aulistr is string matrix of words for columns of indic indic = zeros(length(aus),size(aulistr,1)); % Make study table for i = 1:length(aus) for j = 1:length(aus{i...
8492c939b0100100a9bcf712d9bb15bf1cb273a03d66577462a92989819b4ca1
MATLAB
500
15
%{ # most exciting images generated from multiple models mei_id : int # image id -> experiment.BrainArea -> experiment.Layer model : varchar(12) # --- image : longblob # image std ...
a6a4073d7a957268acf0cb8fea0d7c6c0b1872fc0572dd5cac2b4a1f5fbca2ff
MATLAB
500
20
function [dWU,top] = SVD_topchan(dWU,criteria) [~, ~ ,Nfilt] = size(dWU); top = zeros(Nfilt,1); dWU(isnan(dWU)) = 0; for i=1:Nfilt if(isempty(nonzeros(dWU(:,:,i)))) else [Ws,~,Us] = svd(dWU(:,:,i)); %To get the correct sign for the peak deep [~, imax] = max(abs(Ws(:,1))); Us(:,1) = -Us(:,...
c6a557d7d6cd76fcdc02c11d686b95dfaa840c60a8a519bc84ab637084d82246
MATLAB
500
23
% performs transformation from geometry of % recon-code to output of spm_read_vols % % % INPUT % Y - congruent with FullImReconStackData & imagesc-orientation % % OUTPUT % newY - from spm_read_vols function newY = tapas_uniqc_transform_matrix_matlab2analyze(Y) nSlices = size(Y,3); nVolumes = size(Y,4); ...
346d5c53c0f88928d77581910871382555684c50e6f6d43af6e076d6cc8167ca
MATLAB
501
22
classdef (Abstract) base < handle % brca.dot.base % Abstract base class for dot products of the form <x,y> = x'*L*y % Dot products are handle classes that must implement the methods % `solve`, `dot` and `logdet`. methods (Abstract) x = solve(obj,x) % y = obj.solve(x) % Compute L*x...
4dc513f6e51745304d108f2189a95f3569074c99ca575c4a2d5e9ae8d68edf88
MATLAB
501
19
function R = TMSfastCorr(X, Y) % % XiNian.Zuo@nyumc.org [numSamp1 numVar1] = size(X); % n*p1 [numSamp2 numVar2] = size(Y); % n*p2 if (numSamp1 ~= numSamp2) disp('The two matices must have the same size of rows!') else X = (X - repmat(nanmean(X), numSamp1, 1))./repmat(nanstd(X, 0, 1), numSamp1, 1); Y = (Y ...
8fbed2213e8765a57c3a5f8cca8700b6f4b7e274c999a794ee1a7432da601df0
MATLAB
501
18
function [AUC_byrat, DA_normalized_mixed_byrat] =... RewardEffectByBlockAcrossRats_stages(window, Stages, ratlist,... Pstruct, Bstruct) %initiate variables AUC_byrat = cell(1,length(ratlist)); DA_normalized_mixed_byrat = cell(1,length(ratlist)); for rat = 1:length(ratlist) ratname = ratlist{rat}; disp(...