sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9f6fad12513758c43ee99519814c9b5ca8873be1d06318f403d0d9833bbf7c89 | MATLAB | 359 | 16 | function cod = afni_ni_rowtype_name_to_code(t)
ni_def=afni_ni_defs();
nt = size(t,1);
cod = -ones(1,nt);
for (i=1:1:nt),
mm = strmatch(t(i,:), ni_def.type_alias, 'exact');
if (isempty(mm)),
mm = strmatch(t(i,:), ni_def.type_name, 'exact');
end
if (~isempty(mm))
cod... |
dcd5d62589e43a500f1661e52f806260225bada0a357354f30105b4a8f7474ef | MATLAB | 359 | 14 | function f = sizefull(m,numdims)
% function f = sizefull(m,numdims)
%
% <m> is a matrix
% <numdims> is the number of dimensions desired
%
% return the size of <m> with respect to the first <numdims> dimensions.
% the result is a vector of length <numdims>.
%
% example:
% isequal(sizefull([1 2 3],3),[1 3 1])
f = place... |
1d9dfa5b8a6802f5f5c0a79ff46582749d164be4a073bb956a711da6b1df508f | MATLAB | 360 | 21 | %{
# difference between 99 and 1 percentile across time
-> meso.Quality
-> shared.Field
-> shared.Channel
---
contrasts : longblob #
%}
classdef QualityContrast < dj.Computed
methods(Access=protected)
function makeTuples(self, key)
%!!! compute missing fields for key her... |
44271640cc6719642a200549d45a230b81e908e78a8e503d1c9687d3ef71ebad | MATLAB | 360 | 25 | function r = uminus(p)
%UMINUS: this function applies a unary minus to 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
r=p;
r.xvalue = -p.xvalue;
r.yv... |
8d891a09018903db08765fa7b238d5f1a8535c612fb3ce765bbcaff4eee1a698 | MATLAB | 360 | 9 | function p = getStructureParameters(mystruct, myfield, value)
% Sets p to mystruct.myfield if it exists, other assigns it to value
if ~exist('value', 'var') && ~isfield(mystruct, myfield)
error('Either value of mystruct.myfield must exist');
elseif exist('value', 'var') && ~isfield(mystruct, myfield)
p = valu... |
a0720f334fd4d37557432bd14abcdf91d0a2a8b4ae0ad285cffa18e05548239c | MATLAB | 360 | 21 | %{
# difference between 99 and 1 percentile across time
-> reso.Quality
-> shared.Field
-> shared.Channel
---
contrasts : longblob #
%}
classdef QualityContrast < dj.Computed
methods(Access=protected)
function makeTuples(self, key)
%!!! compute missing fields for key her... |
36c6aed5e9f5ede3bad03d64d701f543b6695a816d3a778dc6fa78c2eaa4be42 | MATLAB | 361 | 21 | function [Fadd,ix_add] = fincrease_add_act(S,Q,SY,ix_non)
%
% --- dF for inactive index 'ix_non'
%
qq = SY * sum(Q(:,ix_non).^2,1);
s = S(ix_non);
ix = find( qq > s );
qq = qq(ix);
s = s(ix);
if ~isempty(ix)
x_add = qq./s;
Fadd = x_add - log(x_add) - 1;
else
Fadd = [];
end
% Back to full sp... |
8f152b99559ee0a6ccecff2074290fb76197376ea9f852f7fe4095e6240b7b35 | MATLAB | 361 | 12 | function [row, col, mu] = isolated_peaks(S1, loc_range, long_range, Th,ops)
% loc_range = [3 1];
% long_range = [30 6];
smin = my_min(S1, loc_range, [1 2]);
peaks = single(S1<smin+1e-3 & S1<Th);
sum_peaks = my_sum(peaks, long_range, [1 2]);
peaks = peaks .* (sum_peaks<1.2).* S1;
peaks([1:ops.nt0min end-ops.nt0:end]... |
1258bbbdf345246a0db66748687cc9f6616d45f24fdce64070f4a546c7de307c | MATLAB | 362 | 7 | function nsd_et_savefig(h, filename, outpath)
% ----------------------------------------------------------------------- %
% save figures in favorite formats. MN, July 2021
% ----------------------------------------------------------------------- %
saveas(h,fullfile(outpath, strcat(filename, '.jpg')));
saveas(h,fullfil... |
33b87eed384db084d660095f9414b11f7c23c9243e9a5668aab538fba7792267 | MATLAB | 362 | 19 | %{
# average temporal correlation between each pixel and its eight neighbors
-> reso.SummaryImages
---
correlation_image : longblob #
%}
classdef SummaryImagesCorrelation < dj.Computed
methods(Access=protected)
function makeTuples(self, key)
%!!! compute missing fields for key h... |
6369e7ca3e978d3f9754547b256cb8c5cf91d626a1dc3809614780d8a1903265 | MATLAB | 362 | 18 | function [ H ] = cplot( t,y,lineProps,transparent)
if ~exist('lineProps','var') || isempty(lineProps)
lineProps = [];
end
if ~exist('transparent','var') || isempty(transparent)
transparent = [];
end
N = size(y,1);
Y = mean(y);
SEM = std(y)/sqrt(N);
H = shadedErro... |
75ea4435e8e44f0395008f1352574519681785c6db7e6a0f2b2dbb00a1dfcf9e | MATLAB | 362 | 19 | %{
# average temporal correlation between each pixel and its eight neighbors
-> meso.SummaryImages
---
correlation_image : longblob #
%}
classdef SummaryImagesCorrelation < dj.Computed
methods(Access=protected)
function makeTuples(self, key)
%!!! compute missing fields for key h... |
9382f017ad05348d4d73e013b9d30e5d547de8fb3b5cbfb9493dd15b952cb9e3 | MATLAB | 362 | 22 | function r = mpower(p,q)
%RDIVIDE 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
error('FVMtool: mpower (^) is not defined f... |
bda725532aafd9bb61ff259a37ee248b2425b61544b67d195f33f3ba24884559 | MATLAB | 362 | 22 | function r = mpower(p,q)
%RDIVIDE 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
error('FVMtool: mpower (^) is not defined f... |
faf4de847a0e418df8894edb285df5a29749c20f0201266a626aa1d2682dad31 | MATLAB | 362 | 14 | function [ output_args ] = parse_FIM_PSF_PSR_ASSEMBLIES( input_args )
output_args = cell(0,0);
for a = input_args
R_ = regexp( a{:} , '([\d\s]+) \[supp=\d+\]' , 'tokens' );
if( ~isempty( R_ ) )
output_args{ numel( output_args ) + 1 } = sort( cellfun( @str2double , strsplit( char( R_{1} ) ) , 'Uni... |
17829c9fc0d8425d3937828d238bfa07eb6b61035b578392dccd60cde55de535 | MATLAB | 363 | 14 | function A = fast_setdiff(A,B)
% A fast version of setdiff for cell arrays of strings.
try
if isempty(A)
A = {};
else
A(CStrAinBP(A,B)) = [];
end
catch
disp_once('Using the slower MATLAB fallback for setdiff(). Consider setting up a compiler to get much improved BCILAB performance (in ... |
313841160a1d82ca5f31e661589bb21f8226dcd52e1b34a4d1d0b305cd8b9953 | MATLAB | 363 | 18 | function [fe] = tapas_ti_trapezoidal(llh, T)
%% Computes the free energy using the trapezoidal rule
%
% Input
% llh -- Samples from the log likelihod
% T -- Temperatures at which the samples were drawn
% Output
% fe -- Free energy
%
% aponteeduardo@gmail.com
% copyright (C) 2016
%
ellh... |
0cd37d10538d18e0b36ad17f8c90f39c753966ff9c66c93f0277e777d476130e | MATLAB | 365 | 17 | function [data_tfidf] = calcTFIDF(data)
% TF-IDF normalization of raster data
% INPUT:
% data: N-by-T raster matrix
% OUTPUT:
% data_tfidf: N-by-T normalized matrix
% Shuting Han, 2018
dims = size(data);
tf = data./(ones(dims(1),1)*sum(data,1));
idf = dims(2)./(sum(data,2)*ones(1,dims(2)));
idf(isnan(idf)) = ... |
1d5f7aa480491b540d236aa9d2b4e2042172fd919ae10467ed49ae98ea00b521 | MATLAB | 365 | 11 | function out = deinterlaceAndConcatenate(im, Nplanes)
tmp = zeros(size(im, 1), size(im, 2), size(im, 3)/Nplanes, Nplanes);
for i = 1:Nplanes
tmp(:,:,:,i) = im(:, :, i:Nplanes:end);
end
out = zeros(size(tmp, 1), size(tmp, 2)*Nplanes, size(tmp, 3));
for i = 1:Nplanes
out(:, (i-1)*size(tmp,2)+(1:size(tmp,... |
6c7e39023963a73b8f105dded26ca6843fe8c52235f54774098858f047ff69d2 | MATLAB | 365 | 17 | tt2 = tt;
tt2(1) = nan;
tt2 = tt2*1000;
edges = linspace(prctile(tt2, 1), prctile(tt2, 99), 100);
figure(1)
histogram(tt2, edges, FaceColor='k')
box off
set(gca,'TickDir','out'); % The only other option is 'in'
ylabel('Count')
xlabel('ms')
title('uint16 512x796 internal')
yticks([0:500:1000])
ylim([0 1000]) ... |
da8b235027332bd5cdf2eceac83d1cd1d14976ad4aeeae95615cf7eac5d3024b | MATLAB | 365 | 15 | function f = linspacefixeddiff(x,d,n)
% function f = linspacefixeddiff(x,d,n)
%
% <x> is a number
% <d> is difference between successive numbers
% <n> is the number of desired points (positive integer)
%
% return a vector of equally spaced values starting at <x>.
%
% example:
% isequal(linspacefixeddiff(0,2,5),[0 2 4 ... |
704ce10e84c74ff2c940b0d5531438879291b4cfb0606bf6945a22f5fa851d2d | MATLAB | 366 | 21 | function str = cstring(x)
%
%CSTRING Print to a string like c
% CSTRING(x) takes an array x, of type char, and prints it to
% a string the way C would.
% the first null, or non-ascii character is the terminator
i=1;
while (x(i)>0 & x(i)<128 & i<length(x))
i=i+1;
end
if i==1
str = char(0);
else
str = char(x(1... |
8430d2fbda4c517076bdde9083ef440be14578a6546f1c07f09e938a80ad37ff | MATLAB | 366 | 12 | function [output_trace,episodes] = get_continuousabove_trace(input_trace,mintime,ignorepts)
try
episodes = pt_continuousabove(input_trace,0,0.1,mintime,Inf,ignorepts);
output_trace = zeros(size(input_trace));
for t = 1:size(episodes,1)
output_trace(episodes(t,1):episodes(t,2)) = 1;
end
catch
output_trac... |
0c1b9f6d109fc73919f05d949beabbb167bd4456a1c9479a3316e493f20ac8e1 | MATLAB | 367 | 13 | function quartiles = get_delayQuartile(datadir, ratname)
% get the bottom and top quartiles of reward delay to set lower and upper
% bounds
load(fullfile(datadir, 'data-published\A_structs', ...
strcat('ratTrial_', ratname, '.mat')), 'A')
delays = A.reward_delay;
delays(delays==100) = [];
delays(delays<0.75) = []... |
9d5ed695d3ab3ace419b845ad3da58849abe258d7f641d16857b39d26e65b8e5 | MATLAB | 367 | 24 | function y = isnatural(x)
% ISNATURAL - True for natural numeric arrays
%
% test = isnatural(x)
%
% Where
%
% X is a numeric array.
%
% TEST is true if all the elements of X are natural numbers. Otherwise,
% TEST is false.
%
%
% See also: isinteger
import misc.isinteger;
y = false;
if (isinteger(x)... |
f3a78a8a81813210ed271b3537618e234108abe486b2f4d63117714208311634 | MATLAB | 368 | 14 | function times = getTimes(obj)
fnm = fetch1(obj,'file_name');
dr = fetch1(Experiments.*obj,'directory');
files = dir([dr '/' fnm '_ts*']);
if isempty(files)
timestamp = GetFileTime([dr '/' fnm 'p0.h5']);
save([dr '/' fnm '_ts'],'timestamp');
times = timestamp.Creation;
else
tm = load([dr '/' files... |
1c839abeba74b14732a00d9b007a99d75f2fe003eaa2b46d0e402b90654290d5 | MATLAB | 369 | 14 | % master function to compile mex functions
% including those into toolbox_fast_marching
% NNO June 2013
surfing_infixes={'eucldist','invertmapping','uniqueidxsperrow'};
n=numel(surfing_infixes);
for k=1:n
infix=surfing_infixes{k};
fn=sprintf('surfing_%s.c', infix);
eval(['mex ' fn]);
end
e='p=pwd(); cd to... |
df0d495461d9ff5c539135d31d82ac92773f305454d303a862a4c838803f60e5 | MATLAB | 369 | 15 | function L = fp_get_lf(L1)
% keyboard
%L1 = inverse.MEG.L;
ns = size(L1,2);
L = zeros(size(L1,1),size(L1,2),2);
for is=1:ns
% clear L2
% L2 = L1{is}./10^-12;
%remove radial orientation
clear u s
[u, s, ~] = svd(squeeze(L1(:,is,:)));
% L(:,is,:) = u(:,1:2)*s(1:2,1:2);
% L(:,is) = u(:... |
f3da7528f0ecb9284226fb188466d91f57efb95d2b6cf36ed1d769d8e8d7f75a | MATLAB | 369 | 17 |
function trials = gettrials(eeg,markers,epoch)
if islogical(markers); markers = find(markers); end
if isvector(eeg); eeg = eeg(:); end
% For uniform epoch lengths:
if isvector(epoch)
epoch = epoch(:);
markers = markers(:)';
epochs = bsxfun(@plus,bsxfun(@plus,epoch,markers),size(eeg,1)*permute(0:size(e... |
ffc5996fa6dc0137d629cb1e27e115fca8b58cdbe8279a9e774b224502cd49b4 | MATLAB | 369 | 23 | function matrix = ng_fc_matrix_read(path)
matrix = importdata(path);
pat = '\[|\]|\,|\s';
mat_sub=regexp(matrix{1}, pat, 'split');
mat_sub(cellfun(@isempty,mat_sub))=[];
num = sqrt(length(mat_sub));
mat = reshape(mat_sub,num,num);
matrix = zeros(size(mat));
for i = 1:size(mat,1)
for j = 1:size(mat,2)
ma... |
0814496e1e7cc6ae226297531ac316a9550226a28bb7af68fa25c17a82665c07 | MATLAB | 370 | 26 | function Meta_tasktype_nmds(Xi,dat)
ntasks = size(Xi,2);
[nstudies,nvox] = size(dat);
% get average activation of each task
taskvec = zeros(ntasks,nvox);
for i = 1:ntasks
wh = find(Xi(:,i));
taskvec(i,:) = mean(dat(wh,:));
end
taskvec = taskvec';
% NMD... |
b39ed617809c90ed90f426c63ee886059c5b48bb8bb2d4f59359d67d96b2bee4 | MATLAB | 370 | 12 | %{
# methods to classify extracted masks
classification_method : tinyint #
---
name : varchar(16) #
details : varchar(255) #
language : enum('matlab','python') # implementation language
... |
fa4b05782b4e4c45ce7d6c732e07332c9bf0fb775e3ad72b9d2a87c843dd14cc | MATLAB | 370 | 16 | function R = chiLogLik(S,M,n,sig)
% S - model signal
% M - measurement
% n - number of coils * 2
% sig - noise level
S = double(S/sig);
M = double(M/sig);
lb = S.*M;
cut = 500;
lb(lb<cut) = log(besseli(n/2-1,lb(lb<cut)));
R = sum ((S.^2 + M.^2)/2 - n/2*log(M) - (1-n/2)*log(S) -lb);
R = R/size(S,1);
R = R/sqrt(2); % ... |
2bd74359d4a95bbec2121cd549c27165d85ab1115fc416be65fb77cb4403f252 | MATLAB | 371 | 25 | function r = atan(p)
%UMINUS: this function calculates the atan of a 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
r = p;
r.xvalue = atan(p.xvalue);
r.y... |
16976bb98c141f81b47bdff6db9dacfc395e49e3171d68b40a1feec2c77ffd0f | MATLAB | 372 | 21 | %{
# 16-part summary of the scan (mean of 16 blocks)
-> reso.Quality
-> shared.Field
-> shared.Channel
---
summary : longblob # h x w x 16
%}
classdef QualitySummaryFrames < dj.Computed
methods(Access=protected)
function makeTuples(self, key)
%!!! compute missing fields... |
2b1ad0cb295e81150589b19c808ba4443d5aedf511efb337038c00b1fcff1770 | MATLAB | 372 | 6 | %1 This function binarizes original data with respect to a threshold value.
function [binarizedData] = pfunc_01_Binarizer(originalData, threshold)
[nodeNumber,dataLength] = size(originalData);
average = mean(originalData,2);
binarizedData = sign(originalData - average*ones(1,dataLength) - (threshold+eps)*ones(nodeN... |
32a568f0c51cd4c79c71cde6ddd97138e2976555af3d7a412af98dd8bd8d7086 | MATLAB | 372 | 11 | %{
#
rf_method : tinyint # rf computation method
---
stim_selection : varchar(64) # stim to use. If no stimulus, the parts will be missing.
algorithm : varchar(30) # short name for the computational approach for... |
5ae0022956e649f71299504bfa0c4c5df0c1eb3c1f0aa97271391ecbdcfb3a1a | MATLAB | 372 | 19 | function [itiMdl, itiOpt, V, rpe, alpha, G] = generate_ms_mdl(...
R, alpha0, D)
[V, rpe, alpha] = deal(nan(size(R)));
V(1) = 2.5;
alphas = alpha0*(1:5);
for tt = 1:length(R)
alpha(tt) = alphas(R(tt));
rpe(tt) = R(tt) - V(tt);
V(tt+1) = V(tt) + alpha(tt)*rpe(tt);
end
G = alpha./alpha0;
itiOpt = D./V;... |
7e8dc54a132d024fcc933bb2d408e7064c094585d7606fe48c9d8eec6e2ae3c6 | MATLAB | 372 | 22 | function [nx] = tapas_ti_gen_state(y, x, u, theta, ptheta)
%% General method to generate state space.
%
% aponteeduardo@gmail.com
% copyright (C) 2016
%
gen_state = ptheta.method_state;
ns = size(theta, 1);
nc = size(theta, 2);
nx = cell(ns, nc);
for i = 1:ns
for j = 1:nc
nx{i, j} = gen_state(y{i, j}, [... |
ab325aad4dcacc4de5bdfb41eead85f904bf668450ac9777857cf21b6324b640 | MATLAB | 372 | 21 | %{
# 16-part summary of the scan (mean of 16 blocks)
-> meso.Quality
-> shared.Field
-> shared.Channel
---
summary : longblob # h x w x 16
%}
classdef QualitySummaryFrames < dj.Computed
methods(Access=protected)
function makeTuples(self, key)
%!!! compute missing fields... |
273b0e39f36c8e6ddc6fbbeb12a3993b4f53f737dd9f39a7db8b2d2fc91ff670 | MATLAB | 373 | 19 | %{
preprocess.ExtractRawGalvoSegmentation (imported) # segmentation of galvo movies
-> preprocess.ExtractRaw
-> preprocess.Slice
---
segmentation_mask=null : longblob #
%}
classdef ExtractRawGalvoSegmentation < dj.Relvar
methods
function makeTuples(self, key)
%!!! compute missing fiel... |
62d05f1bfe9d83a0811f0e580326fa3cfd12bcde064eec726b5b68c50f9a959b | MATLAB | 373 | 18 | function Q = qNormalize( Q1 )
% qNormalize: quaternion normalization, i.e. ||Q||=1
% Q = qNormalize( Q1 )
% IN:
% Q1 - input quaternion
%
% OUT:
% Q - normalized (unity) quaternion, i.e. Q1 = Q / ||Q||
%
% VERSION: 03.03.2012
Q1 = reshape( Q1, 4, 1 );
if( Q1 ~= 0 )
Q = Q1 ./ qLength( Q1 );
else
... |
66871bd3cdc140f8bd2c0eac9b5c5041c54df27158f9334535e3a8a774858cbe | MATLAB | 373 | 19 | function opt = sero_srr_data2fit_opt(opt)
if nargin < 1
opt.initialized = 1;
end
opt.lsq = optimoptions('lsqcurvefit');
opt.lsq.Display = 'off';
% Fitting bounds
opt.lb = [0 0.3 .3 0 ];
opt.ub = [4 4 5 2 ];
% Guess bounds
opt.lg = [0.8 0.7 1 0.0 ];
opt.ug = [1.2 2 3 0.1 ];
opt.la... |
1d514c16c76a925228862193b2cf6217052c4ec5326e530d753f4e000ea62a1c | MATLAB | 374 | 12 | function probMEM = mfunc_stateProb(h,J)
nodeNumber = size(h,1);
vectorList = mfunc_VectorList(nodeNumber);
numVec = size(vectorList,2);
Z = sum(exp(-(-diag((0.5*J*vectorList)' * vectorList) - sum(((h * ones(1,numVec)) .* vectorList)', 2))),1);
probMEM = exp(-(-diag((0.5*J*vectorList)' * vectorList) - sum(((h *... |
06349c70119a41d3255b4f38eb9878b9d017a248beb18ae5e3cccbe77c6a215a | MATLAB | 375 | 18 | function [inference] = tapas_linear_prepare_inference(data, model, inference)
%%
%
% aponteeduardo@gmail.com
% copyright (C) 2016
%
nc = numel(model.graph{2}.htheta.T);
np = size(data.u, 1);
nb = size(data.u{1}, 2);
inferece.kernel = cell(4, 1);
inference.kernel{2} = struct('k', [eye(nb)], 's', [0.5]);
inference.... |
2acfa02b0d7d8a693354af9a83d83a39ed813d1b1e8f5cbbacc022e37745fb04 | MATLAB | 375 | 12 | %{
trk.ProtocolStep (lookup) # single filter in a protocol to accept frames
-> trk.SelectionProtocol
-> trk.FrameSelector
priority : int # priority of the filter step, the low the higher the priority
---
filter_param=null : longblob # parameters that are passed t... |
85cbdb8ba9df43d7e41283b56ab434cd51db025b2b7537402d870ea1b7cb9e48 | MATLAB | 375 | 17 | function txt=legalize_label(txt)
txt=strtok(txt,'(');
txt=strtrim(txt);
txt=strrep(txt,'>','more');
txt=strrep(txt,'<','less');
txt=strrep(txt,' - ','-');
txt=strrep(txt,'- ','-');
txt=strrep(txt,' -','-');
txt=strrep(txt,' ','_');
txt=strrep(txt,'[','_');
txt=strrep(txt,']','');
txt=strrep(txt,'__','_');... |
b195186c614576589f9563df4989754c1e4f63d5cc0fdb06d7dafda416d7cbfb | MATLAB | 375 | 16 | classdef (Abstract) base
methods
data = read(obj,array,index,dimension)
array = write(obj,array,value,index,dimension)
n = numel(obj, array)
lat = size(obj, array)
[type,complex] = class(obj, array)
array = allocate(obj, lat, prefix)
array... |
8ffda1758dabed1bb0197a88afc85d9199e00dc00d576de88b0e88ba64e86319 | MATLAB | 377 | 11 | % Call ARTwarp_csv.m to check no runtime errors are thrown when creating
% the main figure object. This unit test should be further developed using
% MATLAB's app testing framework to check the correct function of all
% uimenu objects, and that the uimenu callbacks are executed correctly.
ARTwarp_csv
% Close the windo... |
76bd5b88d1d2940ac3585c68dd9ef66c1ff6158053332e4b94a1b1ba08143791 | MATLAB | 378 | 20 | %{
#
-> quality.SpikeMethods
-> preprocess.ComputeTracesTrace
---
corr=null : float # correlation between spike method 1 and 2 on that trace
%}
classdef SpikeMethodsCorrelation < dj.Computed
methods(Access=protected)
function makeTuples(self, key)
%!!! compute missing... |
bf1dbd00050afd31171fefee568db9e04e054c2562d7d65103e7c6ebd45078f8 | MATLAB | 378 | 8 | %% This file specifies the Checkpoint of xQSM
% Specify the directory of the xQSM code from Github
deepMRI_HOME = '/home/common/matlab/sepia/external/deepMRI/';
% If you have your own trained network, specify the file that contains the trained parameters
% otherwise, uses the one provided with the tool
checkpoint_d... |
2c6d5fcc2037828c5d6ca958ff7e6ffd230ebf8bde46c4808bfb9627be959156 | MATLAB | 379 | 21 | function [htheta] = tapas_sem_prosa_htheta()
%% Returns the standard hyperpriors.
%
% Input
%
% Output
% htheta -- Standard hyperpriors. htheta.pk is the precision kernel.
%
% aponteeduardo@gmail.com
% copyright (C) 2015
%
dim_theta = tapas_sem_prosa_ndims();
% Precision kernel
htheta.pk = eye(dim_theta);
hthe... |
5ad1c0d01ee7a768474a12cc67dd7f3ce2ff0aaf20c70922073bcf4782429a7e | MATLAB | 379 | 14 | function res = length(this);
tmp = struct(this);
%if any(cellfun(@length, { tmp.EEG }) > 1)
% error('EEG structure in object with more than 1 element')
%end
try
res = length(tmp.EEG);
catch
res = length(tmp);
return;
end
if res > 1, error('EEG structure in obj... |
0fd4fa0bcd969bd0fc95999c92814092f072e2ba4692af5c3de3388d4ee7d16e | MATLAB | 380 | 20 | function FORMAT = create_blocks(format,min_length,tr)
FORMAT = {};
curr_block=[];
j = 1;
for i = 1:numel(format)
if format(i)
curr_block = [curr_block i]; %#ok<*AGROW>
else
if numel(curr_block)*tr >= min_length
FORMAT{j} = curr_block;
j = j + 1;
end
curr_block=[];
end
end
if numel(curr_... |
5fe0e63d3aed8dc3f68d40c8d0c15fda9ec461b4e2aa1adc991b3400ac9f71f2 | MATLAB | 380 | 14 | function plot(segStream, cfg, varargin)
% This is just a placeholder function please see
%
% help McsHDF5.McsAverageSegment.plot
%
% for plotting of the contents of a segment stream with averages and
%
% help McsHDF5.McsCutoutSegment.plot
%
% for plotting of the contents of a segment stream with spike cuto... |
6d6d605f3cc01d627fcf51a3ff3d6704b68a8ff70446d47a9564b5b8556b1178 | MATLAB | 380 | 17 | function [conn] = tapas_open_connection(config)
%% Return a connection object
%
% aponteeduardo@gmail.com
% copyright (C) 2016
%
conn = database(config.database.database, ...
config.database.user, ...
config.database.password, ...
'org.postgresql.Driver', ...
sprintf('jdbc:postgresql://%s:%d/', conf... |
092e02c82cdb61112c39f6871bad6a264329d7fd2ff004340ee98f71627ec47d | MATLAB | 381 | 19 | %{
# cut out of the field in the stack after registration
-> stack.FieldRegistration
---
reg_field : longblob # 2-d field taken from the stack
%}
classdef FieldRegistrationFieldInStack < dj.Computed
methods(Access=protected)
function makeTuples(self, key)
%!!! compute mis... |
8d8e2a828bc538a884ec897b6e680abdb8cc89ac7d274ef3a1d2ddea83eb1012 | MATLAB | 381 | 13 | scalp_ud=get(findobj('Tag','ve_eeg'),'UserData');
comp_ud=get(findobj('Tag','ve_ica'),'UserData');
comp_keep=~comp_ud.chan_marks_struct(1).flags;
comp_proj=EEG.data;
comp_proj(EEG.icachansind,:) = EEG.icawinv(:, find(comp_keep))*eeg_getdatact(EEG, 'component', find(comp_keep));
scalp_ud.data2=comp_proj;
set(findobj... |
ac6764cd63b7104a95035486c117ae1334bc46384b44539f0ba780de40a0e2dd | MATLAB | 381 | 11 | function [zSampled, zMean, zLogvar] = FD_clVAE_sampling(encoderNet, x)
compressed = forward(encoderNet, x);
d = size(compressed, 1) / 2;
zMean = compressed(1:d, :);
zLogvar = compressed(d+1:end, :);
epsilon = randn(size(zMean), 'like', zMean);
sigma = exp(0.5 * zLogvar);
z = eps... |
e47f4a3c6eea0dcfb2e5c3cde1a2092e13fd9dce5ffcec6800a84c13299c8a9c | MATLAB | 381 | 6 | function result = hlp_memavail()
% Get the amount of potentially available memory, in bytes
% This is usually more than what is reported by hlp_memfree, because some memory is tentatively
% allocated by the OS for caches, etc.
bean = java.lang.management.ManagementFactory.getOperatingSystemMXBean();
result = bean.getT... |
24998a243585f7dc612751359364217a2c4d239de4d10c232e1754f111afd4b9 | MATLAB | 382 | 13 | function modScores = loadCombinedModscores(datasets, dataPath, eventName)
% Loop over datasets, loading and combining the modScores from the M
% structs
modScores = [];
for dataset = datasets
mouse = dataset{1}{1};
session = dataset{1}{2};
[~, M, ~] = loadData(mouse, session, 'R', 'DLC3', dataPath);
mo... |
c0de21e33878ee42ee087464921a225ecc5d38c0318abb0e0db05d59b2833051 | MATLAB | 382 | 14 | function mask = getMyMask(roi, dummy, xoffset, yoffset)
api = iptgetapi(roi);
polypts = api.getPosition();
polypts(:,1) = polypts(:,1) + xoffset;
polypts(:,2) = polypts(:,2) + yoffset;
mask = ones(size(dummy))<0;
for ii = 1:size(mask,1)
for jj = 1:size(mask,2)
mask(ii,jj) = inpolygon(ii,jj, poly... |
3bd0bc4618c3940626383b406e323aa14181dd8beff8e868a760170beb46754d | MATLAB | 383 | 12 | %{
# methods for mask extraction for multi-photon scans
segmentation_method : tinyint #
---
name : varchar(16) #
details : varchar(255) #
language : enum('matlab','python') # implement... |
498f5f5230420df138349555e58bda8d839e3322beb130821e6918301dac7ba8 | MATLAB | 383 | 16 | function startingFunction()
% computing waves from the raw data
eletrodesLines=choosingTHeElectrodes();
behavior=load('outputBehavioral.mat');
wavesCreatorAllFreqs(eletrodesLines,behavior.output);
[results100]=wavesAnalyzerAllFreqs(behavior.output);
%plotting the results
load('dataWavesAttention.mat')
... |
76bff7871d73a69f976c8b2b7c56ded0e9a7cb9efa3dd65af9fbab5271fa9818 | MATLAB | 383 | 17 | function mkdirquiet(x)
% function mkdirquiet(x)
%
% <x> refers to a directory location
%
% make the directory, suppressing warnings
% (e.g. that the directory already exists).
% assert that the result was successful.
%
% example:
% mkdirquiet('temp');
prev = warning('query'); warning('off');
success = mkdir(x);
w... |
5b10cc59bfcb3c6155766f225083b3eab32cbbdf143e976b090f1bf91a8c80ef | MATLAB | 384 | 13 | function prevComputed = checkMetricPrevComputed(prevNetMet, lagValFieldName, netMetName)
% Check if the lag has previously been done before
if isfield(prevNetMet, lagValFieldName)
if isfield(prevNetMet.(lagValFieldName), netMetName)
prevComputed = 1;
else
prevComputed = ... |
b4d458129bcadb6b633ba7d3c8c387addf693ab7461568d988e4956a7bc79b03 | MATLAB | 384 | 18 | function tapas_BLT_logData(dataName, params, input)
% tapas_BLT_logData logs data specific to the staircase paradigm
%data
%
% Inputs:
% params: data storage file
% eventName: string with event name
%
% Outputs:
% params: data storage file
%
% Matlab time
load(params.path.datafile);
data.(dataName) = [data.(dataNa... |
6e04477c68a17c953992103eedc461e350cec0c8e2365f56fa5dff762a0d4d47 | MATLAB | 385 | 9 | % Wrapper to apxSparse to remain backwards compatible.
%
% Note that covFITC is not a valid covariance function on its own right.
%
% Copyright (c) by Ed Snelson, Carl Edward Rasmussen
% and Hannes Nickisch, 2016-08-25.
function varargout = covFITC(varargin)
varar... |
a50067f410635920c3761cb929bd81d411fd084baf9270575fa122fd8827188d | MATLAB | 385 | 12 | %{
# filenames that compose one stack (used in resonant and 3p scans)
-> experiment.Stack
filename_idx : tinyint # id of the file
---
filename : varchar(255) # file base name
surf_depth=0 : float # ScanImage'... |
aa8c36bd53de72a8453a62fadf3a275d8f4d1107eecb4721783f021b7e40b689 | MATLAB | 385 | 24 | function [x,iter] = randexp(min,avg,max,siz)
if nargin < 4
siz = [1,1];
end
if nargin < 3
error('Wrong input argument(s).');
end
x = min-log(rand(siz))*(avg-min);
iter = 0;
while true
iter = iter+1;
isup = find(x(:) > max);
nsup = numel(isup);
if nsup == 0
break
... |
f7cdd4b8c516c3754e8a227f76cf3ab765a2be34f80af244506ff0646e1e93df | MATLAB | 385 | 20 | function [f,g] = driver1(x)
% An example function, from "driver1.f" in the fortran releaes
n = length(x);
g = zeros(n,1);
f = .25*(x(1)-1.0)^2;
for i = 2:n
f = f + ( x(i) - (x(i-1))^2 )^2;
end
f = 4*f;
t1 = x(2) - (x(1)^2);
g(1) = 2.0*( x(1) - 1.0 ) - 16*x(1)*t1;
for i = 2:(n-1)
t2 = t1;
t1 = x... |
30c1d6925e144c0dfe0511ee405e08eb3e3fe0d7fc4f5f64f8e58a6c9d262227 | MATLAB | 386 | 18 | function [x] = conjgrad(A, b, x)
r = b - A * x;
p = r;
rsold = r' * r;
rsold
for i = 1:length(b)
Ap = A * p;
alpha = rsold / (p' * Ap);
x = x + alpha * p;
r = r - alpha * Ap;
rsnew = r' * r;
if sqrt(rsnew) < 1e-10
break;
end
... |
4bee1903bd8fdb88f24fb13b7413aa44f096c1bcd2f6af8744c23be33b294070 | MATLAB | 386 | 18 | function scale=convertFromSIunit(unit)
switch unit
case 's'
scale = 1;
case 'ms'
scale = 10^3;
case 'µs'
scale = 10^6;
case 'M'
scale = 10^-3;
case 'mM'
scale = 1;
case 'µM'
scale = 1... |
56df57928aae64492feb14e47bc60c2bcfee68363e0fab25cec63d7287ad9712 | MATLAB | 386 | 6 | function simpleBoxPlot(x,boxPlotVal,edgeColor,faceColor,centerLineColor,width)
if ~exist('width','var'); width=0.8; end
plot(x+[0,0],boxPlotVal.minMax,'-','color',edgeColor)
rectangle('Position',[x-width/2,boxPlotVal.lower,width,boxPlotVal.iqr],'EdgeColor',edgeColor,'FaceColor',faceColor)
plot(x+wi... |
6a0255bb8f56a15f66dd4ab3bd725dbc2740b18f62aae592527f58cc4cb43d2b | MATLAB | 386 | 16 | function [ output_args ] = iif( input_args , true_output_args , false_output_args )
%IIF( input_args , true_output_args , false_output_args ) Inline
%if-then-else function to use in anonymous functions.
%
%
% === Jan Moelter, The University of Queensland, 2016 ===================
%
if( input_args )
output_args = tr... |
8f5f9b3d909fc746229efff085baa280a250cd7fc4ec655287dfe03d1dd6c995 | MATLAB | 386 | 11 | function root = vl_rootnn()
%VL_ROOTNN Get the root path of the MatConvNet toolbox.
% VL_ROOTNN() returns the path to the MatConvNet toolbox.
% Copyright (C) 2014 Andrea Vedaldi.
% All rights reserved.
%
% This file is part of the VLFeat library and is made available under
% the terms of the BSD license (see the COP... |
a15627705bf3292537a2480dd29690950ad968c08abd9f48a9a8835f5c109039 | MATLAB | 386 | 13 | function [version, released] = manopt_version()
% Returns the version of the Manopt package you are running, as a vector.
%
% function [version, released] = manopt_version()
%
% version(1) is the primary version number.
% released is the date this version was released, in the same format as the
% date() function in Mat... |
d741f1a9ebadff7dd972822f0bd507018727e597e33faadcdf1c1e871f9dfb32 | MATLAB | 386 | 30 | function Pipeline_getExpInfo(params)
fn.si = getImFiles(params);
fn.ws = params.wsfn;
fn.pth = params.pth;
savefn = getFileName(params, 'ExpInfo');
analysisDir = getAnalysisDir(params);
save(fullfile(analysisDir, savefn), 'fn');
disp(' ');
disp('Saved experiment file: ');
disp(['filename: ' savefn]);
... |
07ca4743027a298ee0db522b2c8df8806fef18220b4c2c37b1665fd3cd02ffd3 | MATLAB | 387 | 14 | %{
#
vis_protocol : varchar(255) #
-> experiment.Person
---
stim_version=1 : tinyint #
vis_filename=null : varchar(255) #
discription=null : varchar(255) #
timestamp=null : timesta... |
d8d15be2c7c768401385ca61e3c9937113ad86622df1bb329cf301310f9f93f3 | MATLAB | 387 | 18 | function scale=convertToSIunit(unit)
switch unit
case 's'
scale = 1;
case 'ms'
scale = 10^-3;
case 'µs'
scale = 10^-6;
case 'M'
scale = 10^3;
case 'mM'
scale = 1;
case 'µM'
scale = 10... |
5398a92e8164e611733d7633c0e5f3a08ac4bf46a9f85b1cce3801151091183f | MATLAB | 388 | 19 | %{
# source extraction using constrained non-negative matrix factorization
-> reso.Segmentation
---
params : varchar(1024) # parameters send to CNMF as JSON array
%}
classdef SegmentationCNMF < dj.Computed
methods(Access=protected)
function makeTuples(self, key)
%!!! comput... |
7f90ff8799522e69e18d941b460eb391ec9bb5665a769a71f0449e9510e43d9f | MATLAB | 388 | 19 | %{
# source extraction using constrained non-negative matrix factorization
-> meso.Segmentation
---
params : varchar(1024) # parameters send to CNMF as JSON array
%}
classdef SegmentationCNMF < dj.Computed
methods(Access=protected)
function makeTuples(self, key)
%!!! comput... |
43e91cb89ce16b34b83c1ab79677d04ae0bc2c7cea9457fc14b9d25f174a8ff8 | MATLAB | 389 | 11 | function plot_ncc(rez,i)
Spike_id = find(rez.st(:,end)==i);
ncc_score =rez.st(Spike_id,4);
[Ncc,edgesSc] = histcounts(ncc_score,min(ncc_score):0.01:max(ncc_score));
h = figure;
movegui(h,'southwest')
bar(edgesSc(1:end-1),Ncc(1:end))
ylabel('Spike count')
xlabel('NCC score')
... |
6a3264e3ff62af48a54a1af963b44e590698472d251b793fe7d5ac23a5213990 | MATLAB | 389 | 24 | function S = domainInt(phi)
%INTEGRATE integrate the value of phi over the domain defined by the mesh
%structure using the trapezoidal rule
%
% SYNOPSIS:
%
%
% PARAMETERS:
%
%
% RETURNS:
%
%
% EXAMPLE:
%
% SEE ALSO:
%
% Copyright (c) 2012-2016 Ali Akbar Eftekhari
% See the license file
v=internalCe... |
87a98e864ca9d28a78d62b9158f38b209593520744ceeb16bff748fda5fc6f1f | MATLAB | 389 | 26 | function [ txt ] = nmri_pnumberformat( num, crit1, crit2 )
%[ txt ] = nmri_numberformat( num )
% Automatically format a number in p-value logic
if ~exist('crit1','var')
crit1=0.05;
end
if ~exist('crit2','var')
crit2=0.5;
end
if num<0.001
txt='<0.001';
elseif num>crit2
txt=['>' sprintf('%0.1f',crit2)];
else
tx... |
b2d61210da448e905f38b459a7cac15bae64b02b0c058c3293704ad70dcd8e7c | MATLAB | 389 | 21 | function [correctness] = AnalyzeResponse(dir, answer, depthorder)
%OUTPUT
%incorrect = 0; correct = 1
%0 = first interval (39)
%1 = second interval (38)
if depthorder == 1 %far
if answer == 38
correctness = 1;
else
correctness = 0;
end
else %near
if answer == 40
... |
c784771e9172db2deb45e25b332db0223302bc165aa674442fbc89ba6eae71d6 | MATLAB | 389 | 17 | classdef nnsoftmax < nntest
properties (TestParameter)
h = {1 2 3}
w = {1 2}
end
methods (Test)
function basic(test,h,w)
d = 10 ;
n = 3 ;
x = test.randn(h,w,d,n)/test.range ;
y = vl_nnsoftmax(x) ;
dzdy = test.randn(size(y)) ;
dzdx = vl_nnsoftmax(x, dzdy) ;
tes... |
00836219527187edd4064a13638265ff35db2600fe5baea6e1498f5555a9f59b | MATLAB | 390 | 13 | %{
# declare scan fields to register to a stack as well as channels and method used
(stack_session) -> stack.CorrectedStack
(scan_session) -> `pipeline_experiment`.`scan`
-> `pipeline_shared`.`#field`
(stack_channel) -> `pipeline_shared`.`#channel`
(scan_channel) -> `pipeline_shared`.`#channel`
-> `pipeline_shared`... |
5e0157c39cc5a705e7f0f0880d00fe9491597f2d0e38add1cf629aa6b716c7ab | MATLAB | 391 | 21 | function [correctness] = AnalyzeResponse(order, answer, depthorder)
%OUTPUT
%incorrect = 0; correct = 1
%0 = first interval (39)
%1 = second interval (38)
if depthorder == 1 %near
if answer == 38
correctness = 1;
else
correctness = 0;
end
else %far
if answer == 40
... |
6dcdfc2a71150c0e72cb64faf1a66f7012b06c3c1262fc4215a7725840e79066 | MATLAB | 391 | 12 | %{
vis.MatisseCenterLoc (lookup) # location of center for Matisse scans.
id : smallint # one is default, 2 is online change.
---
x_loc : decimal(4,3) #
y_loc : decimal(4,3) #
r : decimal(... |
a0b7c534a1ab1a2c91a1ef9efbcfca5f326b4b585ad05040a76ce4c06d79bfe8 | MATLAB | 391 | 17 | function [A,W,SW,S,Q] = compo_init_alpha(XX,YX,xx,ix)
% --- Initialization
% XX = X(ix,:)*X' % 1 x M_all
% YX = Y * X' % N x M_all
% xx = diag(XX)' % 1 x M_all
M_all = length(xx);
% alpha_ini = 1
A = zeros(1,M_all);
a0 = 1;
A(ix) = a0;
SW = 1/(a0 + xx(ix)); % 1 x 1
W = YX(:,ix)*SW; % N x 1
S =... |
abfabe69bc3aa3bc9df0b559598d56ef4abda5368303a4bc3f4f5a0af0e64f52 | MATLAB | 391 | 15 | function Vol = spm_vol_gz(FileName)
% FUNCTION Vol = spm_vol_gz(FileName)
%
% A wrapper around spm_vol that unzips .nii.gz files in a temp-folder
[~, ~, Ext] = myfileparts(FileName);
switch Ext
case '.nii.gz'
FileName = char(gunzip(FileName, tempdir));
case '.nii'
otherwise
error('Unknown f... |
c52ec4bbcec6e535325469d0451cd80d882413c08884a28a79b3dd119bc6d0dd | MATLAB | 391 | 23 | function x=demean(x,dim)
% DEMEAN(X)
% Removes the Average or mean value.
%
% DEMEAN(X,DIM)
% Removes the mean 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 = size(x);
dimsize = size(x,dim);
dimrep = ones(1,len... |
78c905a84092350055a96a1b5b1c9662b5d890c09acc1ccc4186db2e1d2eb289 | MATLAB | 392 | 14 | function bool = is_sccn()
% IS_SCCN - returns 1 if computer is located at SCCN (Swartz Center
% for computational Neuroscience) and 0 otherwise
bool = 0;
domnane = ' ';
try
eval([ 'if isunix, [tmp domname] = unix(''hostname'');' ...
'end;' ...
'bool = findstr(domname(1:end-1), ''ucsd.edu'');' ...
... |
1dd52241b9ea68a4599a139ea9ce2b00dd73f983c46c69545f3235a97a53414d | MATLAB | 393 | 22 | function tapas_validate_data(data)
%% Check that data complies with the inferface.
%
% aponteeduardo@gmail.com
% copyright (C) 2016
%
if ~isstruct(data)
error('tapas:validate:data', 'data is not a structure')
end
if ~isfield(data, 'y')
error('tapas:validate:data', 'data lacks field y');
end
if ~isfield(data,... |
dd33522adb17262698abdfb9106c3fc7f04e0ded46141af65e03b7c9579f3bca | MATLAB | 393 | 17 | %{
pre.SegmentMethod (lookup) # cell segmentation method
segment_method : tinyint # id of the method
-----
method_name : char(8) # name of the method for switch statements
%}
classdef SegmentMethod < dj.Relvar
methods
function fill(self)
self.inserti({
1 'ma... |
7b8a862caad16f12f6f4e9a24b1d2e936d0d54490b1365f0ee7f5276f358d322 | MATLAB | 394 | 10 | addpath c:\pipeline
addpath c:\pipeline\datajoint
addpath(genpath('c:\pipeline\commons\schemas'));
addpath('c:\pipeline\commons\lib');
addpath('c:\pipeline\pipeline\matlab\');
addpath('c:\pipeline\pipeline\matlab\schemas');
addpath('c:\pipeline\pipeline\matlab\lib');
addpath('c:\cajal\auditory_stimuli\matlab') ;
addpat... |
fc89587a476bad2a97adcb58bec16fe81c0f4a38c231986b67c39096f05d0521 | MATLAB | 394 | 19 | function s = compute_cuvilinear_abscice(c)
% compute_cuvilinear_abscice - compute the curvilinear abscice of a curve
%
% s = compute_cuvilinear_abscice(c);
%
% A curve is a ndims x npts matrix.
%
% Copyright (c) 2004 Gabriel Peyré
if size(c,1)>size(c,2)
c = c';
end
npts = size(c,2);
D = c(:,2:end)-c(:,1:(e... |
a869410ff3b7398b2a7115cb9e3a8ca40c491f374570d2a26893e63999a94fad | MATLAB | 395 | 15 | function output = loadRTClassifier(dataPath, mouse, session)
% Wrapper around rtClassifier
% Load preprocessed data
% This data is already subsampled to the best 100 neurons and the desired
% time points
load(sprintf('%s%s_%s_liftLockedRT', dataPath, mouse, session), 'neurons', 'M')
% Params
config = M.config;
config.... |
1ab4db10b41ee536726d0cab4e1374f522a51b07957d41c71d526aad5d8521c1 | MATLAB | 396 | 20 | %{
# grouping table for matched masks
-> preprocess.MatchedScanSite
-> preprocess.Slice
---
translation_correction : longblob # translation correction to account for shifts between scans
%}
classdef MatchedMasks < dj.Computed
methods(Access=protected)
function makeTuples(self, key)
%!... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.