sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ad57296396eed878b9b6715ece435d88fe697716f348e0c1a3b8e933c301b4eb | MATLAB | 676 | 25 | function plot_ens_corr(ax, ens_corr, corr_thr, ens_cols)
% Reference paper: Herzog et al. 2020 "Scalable and accurate automated method
% for neuronal ensemble detection in spiking neural networks"
% https://www.biorxiv.org/content/10.1101/2020.10.12.335901v1
% Rubén Herzog October 2020
cla(ax);
hold(ax,'on');
nens =... |
25fa62b024477f05b3a7991480b7ddda645ae415ca78190812e9d24d1ebca99f | MATLAB | 677 | 32 | function [y] = randdv_step(dim,dvmu,fixdvmu)
% RANDDV_STEP Random decision value generator using step PDF
% [y] = randdv_step(dim,dvmu,[fixdvmu])
if nargin < 3
fixdvmu = false;
end
if nargin < 2
error('Missing input argument(s).');
end
if size(dim) ~= 2
error('dim should be [n(trials) n(sampl... |
41645c52ddcf9b078206f246c9cda77e5fa6eed38388ddb9f88a390198b4110b | MATLAB | 677 | 16 | function [pvec, pstruct] = tapas_softmax_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General Public
% L... |
52988d901cf3e3680a7c58c1829fd5c2c3ef9ef2c63bbaaacb2576cf83f215a8 | MATLAB | 677 | 36 | function panelLetter2(Xpos,Ypos,Letter,varargin)
param.fontSize=8;
param.isBold=true;
param=parseParameters(param,varargin);
if param.isBold
fontWeight='bold';
else
fontWeight='normal';
end
unit=get(gcf,'paperunit');
if ~strcmp(unit,'centimeters');
set(gcf,'paperunit','centimeters');
end
paperPos=get(g... |
838c6b87aeb2d5787ada8de081f439a91c3c95a407468340350feaad2e3c348a | MATLAB | 677 | 37 | 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, 'FaceVariable')&&isa(q,... |
8da88cb883310b7ee0dd89f3d555d7c121e7ee6af20b4bee5075da2e387ec5c2 | MATLAB | 677 | 27 | %% sepia_print_popup_as_string(fid,str_pattern,action_handle)
%
% Input
% --------------
% fid : fid of the sepia config file
% str_pattern : string pattern to be printed after algorParam parameter
% action_handle : handle of the GUI popup
%
% Output
% --------------
% val : (optional) output
%
% ... |
335ef0764a9bbc668e8f15a3b56506c7765cd7149966a1849cf70eb0b8e3b9c0 | MATLAB | 678 | 23 | % addphase.m
% Jamie Near, McGill University 2014.
%
% USAGE:
% PhasedSpecs=addphase(specs,AddedPhase);
%
% DESCRIPTION:
% Add equal amount of complex phase to each point of a vector. This
% function operates on a vector (fid or spectrum), not on a FID-A data
% structure. For a phase shifting function that operat... |
8108321f914f0ace9c513ce2497483589151f66c84c51f84aa14b2a602aef9d5 | MATLAB | 678 | 24 | %{
# spike-triggered average of receptive fields
-> preprocess.Sync
-> preprocess.Spikes
---
nbins : smallint # temporal bins
bin_size : float # (ms) temporal bin size
degrees_x : float # degr... |
278e5ff71a9edd38eef618fdeaf193f4c4980b32d0fa399a536d073db6569acf | MATLAB | 679 | 21 | function [dprime, crit] = dprime(stim, resp)
% function [dprime, crit] = dprime(stim, resp)
% use only 2 identities, however this is coded
stim(stim~=1) = -1;
resp(resp~=1) = -1;
% compute proportions
Phit = length(find(stim == 1 & resp == 1)) / length(find(stim == 1));
Pfa = length(find(stim == -1 & resp == 1)) / l... |
424fe5fdabd6e5ae2ef8f9c17ef8b7f8e58b2c0944158dca0979424b2c92298e | MATLAB | 679 | 18 | function pstruct = tapas_kf_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
% Licence (GPL), versi... |
8155d09d3c3d071e0432d5f291f85bf4944c3aa412816b247d4b5d626332ed7f | MATLAB | 679 | 32 | function [S,Y,YS,lbfgs_start,lbfgs_end,Hdiag,skipped] = lbfgsAdd(y,s,S,Y,YS,lbfgs_start,lbfgs_end,Hdiag,useMex)
ys = y'*s;
skipped = 0;
corrections = size(S,2);
if ys > 1e-10
if lbfgs_end < corrections
lbfgs_end = lbfgs_end+1;
if lbfgs_start ~= 1
if lbfgs_start == corrections
lbfgs_start = 1;
e... |
ab5ab42c689aa3d26ecba9f5e24df828705c9ea493c8d66a2dfe1810776601ab | MATLAB | 679 | 37 | 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, 'FaceVariable')&&isa(... |
c7c2e005d1d706db4ec06c043f660de1961f956b099fe8b9d1a4c406f86a8b8b | MATLAB | 679 | 28 | function str = printor(strs, quote)
% PRINTOR prints a single or multiple strings as "x1, x2, x3 or x4". If there is
% only one string, that string is returned without additional formatting.
%
% See also PRINTAND
if nargin<2
quote = false;
end
if quote
if numel(strs)>2
str = sprintf('''%s'', ', strs{1:(end-2... |
d062020412cfc8e0fdc19b52c86f40c097122405ea73e45fd254d4d67e17c3b8 | MATLAB | 679 | 40 | % set your options here and then call visualMotionLocalizer(cfg)
%
% (C) Copyright 2020 CPP visual motion localizer developers
clc;
clear;
initEnv();
% cfg.subject.subjectGrp = 'pilot';
cfg.subject.sessionNb = 1;
cfg.subject.askGrpSess =[false true];% [true false];
cfg.verbose = 1;
cfg.debug.do = false;
cfg.debug.... |
d3ae19028974d949ce0a9c4b97aef9516b22342afb77e2ddca3f0bbc519c5ea3 | MATLAB | 679 | 20 | function outlier_stat = std_outlier(data)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
data_reshape=reshape(data,[],1);
[data_length,~]=size(data_reshape);
if any(isnan(data_reshape))
error('found NaN in std_outlier');
end
isoutlier_stat = findOut... |
e3703daa9c7b3217dadaa69a4d41ee715be422081546e03c6835a0adae00847a | MATLAB | 679 | 17 | function[OutName] = osp_RemovePreFix(Name)
%% function[OutName] = osp_RemovePreFix(Name)
% Function to remove prefix from filenames while respecting key-value pairs
% as defined in BIDs specification.
% i.e. osp_RemovePreFix('sub-001_MyDataSet_acq-press_act') = MyDataSet_acq-press
% while osp_RemovePreFix('sub-001_MyD... |
23edd816650b314e515af5c2185b60977509c01039ecce165a934c524b7eed3b | MATLAB | 680 | 25 | function [maskdata,xyzlist,V] = meta_read_mask(mask)
% [maskdata,xyzlist,V] = meta_read_mask(mask)
% read mask and get XYZ voxel list of in-mask voxels
%
if isempty(mask), mask = which('scalped_avg152T1_graymatter_smoothed.img');, end
% make sure it exists
if ~exist(mask,'file'), disp(mask); error('Image does not exis... |
833d72f71ed525d61ffdb1c5661f9ead8c74c097f4fa83250f9f1cb391f1eb97 | MATLAB | 680 | 24 | function arg_toworkspace(args)
% Copy the arguments in the given Struct into the workspace of the calling function.
% arg_toworkspace(Struct)
%
% In:
% Struct : an argument structure, as produced by arg_define
%
% Examples:
% function myfunction(varargin)
% opts = arg_define(varargin, ...
% arg(...... |
0ced990abe9139d90475a30d7d198de87d61cf65431035d3f9abe565c1d05c52 | MATLAB | 681 | 14 | % inject noise pulled from a normal distribution before calculating OSI
%
% there are miniscule artifacts biasing towards vertical and horizontal oris simply due to the nature of of square pixels
% if you rescale without setting the minimum to 0, you will magnify these effects thousands of times in magnitude
% 0 is th... |
8bd70ab9d157073416767cd19181c65cacdb586c575c196a1f3a776baadfe5dd | MATLAB | 681 | 33 |
% Recovering a Panel from a Figure.
%
% (a) Create a grid of panels, and show something in them.
% (b) Recover the root panel from the Figure.
%% (a)
% create a 2x2 grid in gcf.
p = panel();
p.pack(2, 2);
% show dummy content
p.select('data');
%% (b)
% say we returned from a function and didn't have a handle
... |
97279f67bf8594441a743033732567114f02d77d634826f76c909f0eed5f41ec | MATLAB | 681 | 22 | function [T, iT] = ortho_matrix(ZZ, ULU)
% FORMAT [T, iT] = ortho_matrix(ZZ,ULU)
%
% ** Input **
% ezz - E[ZZ'] = E[Z]E[Z]' + inv(Az)
% ww - E[U'LU] = E[U]'LE[U]' + inv(Au)
% ** Output **
% T - Orthogonalisation matrix, s.t. T * ZZ * T' ~ diag
% iT - Almost inverse of T, s.t. iT' * ULU * iT ~ diag
... |
d64f4eb4e8fccb2647bd0a24d1182b9c15ea70f7a1e5045fcb3eebb94978a7ee | MATLAB | 681 | 26 | function outliers = getOutliers(statData)
% statData: 3D = samples x channels x trials
% outliers: if a value of a channel is out at 6 sigma of the normal
% disctribution of all channels, the channel is marked as an outlier
% outliers: 2D = channels x trials
% (c) Jiri, Mar16
% threshold
stdThr = 6; % in [SD]
%... |
7607c92eee3eecf037f9e4bd98125ff0fcdfa142534f0bbe40bca84bf848b8bf | MATLAB | 682 | 16 | function [pvec, pstruct] = tapas_condhalluc_obs3_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2020 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General Pu... |
968db53b6b437e5667c2a17cf46d6b6f3852fc509d2cb853017d764378cb764d | MATLAB | 682 | 36 | function imgt = imscale(img, range)
% IMSCALE Scale an image to fit the range
%
% This function scales the values of an image to fit the range.
%
% Params:
%
% img = The image.
% range = The min target value. (def=[0,1])
%
% imgt = The image scaled.
% Check params:
if nargin<2
range=[0,1];
end
% Transform ... |
0d261d3a006850a65ca3b8dfb6750ddee8248443313fb2e55a32f228e6cb0cf6 | MATLAB | 683 | 24 | function [data, deviate] = RemoveWrongForce(data, cutoff) % by Julia Becker, 01/04/2020, changed 05/01/2021 to accommodate the case that curves with deviating forces exist
%REMOVEWRONGFORCE Delete curves where the actual force applied was too far from force setpoint
% Find all curves which deviate more than cutoff
... |
64a1be3edf902633880d923dd88d4f7d106d39ae6ba7e16362e393764fc0f320 | MATLAB | 683 | 18 | function badtrials = detect_bad_trials(output, chantype, data_seg)
trials = (1:length(data_seg.trial))';
vartrials = zeros(length(data_seg.trial),1);
for ntri =1:1:length(data_seg.trial)
vartrials(ntri) = var(sum(data_seg.trial{1,ntri}(chantype,:)));
% var sum change order ?
end
outliers = isoutlier(vartrials)... |
c954eafe644ba18b12461f2debb489ff6271012c0894078121d6a22c802e8804 | MATLAB | 683 | 16 | %{
# the job reservation table for +tune
table_name : varchar(255) # className of the table
key_hash : char(32) # key hash
-----
status : enum("reserved","error","ignore") # if tuple is missing, the job is available
key=null : blob # structure containing the key
error_message="" ... |
deba5740d7d3aaf98d0054776ca2d8c155af68951df0e31b0a814652eafe0561 | MATLAB | 683 | 23 | function matchIdx1=findPatchPairs(C,Cunpair, THD)
% C: cost matrix
% Cunpair: unpair cost
matchIdx1 = matchpairs(C,Cunpair); % firstly apply a linear assignment to find the best matched result
% check if unpaired patch also meet the threshold setting
flag1=1;
while flag1
unpairedPatchIdx = setdiff([1:siz... |
fda0e8205a3dda8dfb58e0c4d49088fbac98f2955766f8847c098e86e4d58630 | MATLAB | 683 | 37 | function [img_t,img_c,img_s] = voxel2world_space(V,voxel_ctr)
% MM (180221): Code borrowed from spm_orthviews.m
bb = spm_get_bbox(V,'fv');
dims = round(diff(bb)'+1);
cent = voxel_ctr';
M = V.mat;
TM0 = [1 0 0 -bb(1,1)+1
0 1 0 -bb(1,2)+1
0 0 1 -cent(3)
0 0 0 1];
TM = inv(TM0*M);
TD = dims([1 2]... |
0d1f64a73f2b98c2665e8d8d36480c69917c1bdf42e8f64909051ac13a06ecfd | MATLAB | 684 | 27 | function [A,W,SW,S,Q,ix_act] = ...
compo_add_act(XX,Xadd,A,W,SW,S,Q,SY,i_add,ix_act)
% Add component
% XX = X(ix_act,:)*X' [M_act x M_all]
% Xadd = X(i_add,:) *X' [1 x M_all]
% New alpha
anew = S(i_add).^2 ./(SY*sum(Q(:,i_add).^2,1) - S(i_add));
A(i_add) = anew;
% Weight & variance update
ss = 1./... |
747eb43b9685680ffa0f368e993480a914192ca688bfbf0f849119a798fafd8b | MATLAB | 684 | 16 | function [pvec, pstruct] = tapas_beta_obs_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General Public
% ... |
d5e2998da1e7ece5598147f3936a412a99dbd8091563c0be43ed78502535650a | MATLAB | 684 | 16 | function [pvec, pstruct] = tapas_condhalluc_obs_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2015 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General Pub... |
ecfd3b5ef273f9c7d1a93dcfcec8e55d0ef11457c9c6ccc7643d9ecc51254c1e | MATLAB | 684 | 23 | %{
# coordinates for each ROI in the stitched volume
-> stack.Stitching
-> stack.MotionCorrection
---
-> stack.StitchingVolume
stitch_xs : blob # (px) center of each slice in the volume-wise coordinate system
stitch_ys : blob # (px) c... |
02da828c863a86a809d3a9597c8246673a7127b393e5cc214f19b76b219e8376 | MATLAB | 685 | 16 | function [pvec, pstruct] = tapas_unitsq_sgm_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General Pu... |
26b117ffa5bf8ceb08d0d9654a17d5d284f96773b09a9678606d03a608093f32 | MATLAB | 685 | 16 | %{
#
-> eye.ManuallyTrackedContoursFrame
---
roi=null : longblob # roi of eye
gauss_blur=null : float # bluring of ROI
exponent=null : tinyint # exponent for contrast enhancement
dilation_iter=null ... |
4fcd918e395c94b3877814c3c06c57cad4f7bc7439e7b62c1e3459e40fb633b0 | MATLAB | 685 | 35 | function r = minus(p,q)
%MINUS: this function subtracts 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
% First implementation:
% m = size(p.xvalue);
... |
6319d8a317c20d26a056ff2f8a3b688a437de9f60539c37ef71c9290f3aa29cd | MATLAB | 685 | 11 | %-----------------------------------------------------------------------
% Job saved on 10-Nov-2014 11:29:00 by cfg_util (rev $Rev: 4972 $)
% spm SPM - SPM12b (5556)
% cfg_basicio BasicIO - Unknown
%-----------------------------------------------------------------------
matlabbatch{1}.spm.spatial.normalise.write.subj.d... |
645e74a88ce606e4f2a70b5df6d65c70fc216955c768fd7077aecf5dd2d1c6b2 | MATLAB | 685 | 16 | function [pvec, pstruct] = tapas_squared_pe_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General Pu... |
ed6a56de2c55515dcdf92646d85fed119cdacd9e4e04d11e5483b8d695ba1f9f | MATLAB | 685 | 16 | %{
# the job reservation table for +movies
table_name : varchar(255) # className of the table
key_hash : char(32) # key hash
-----
status : enum("reserved","error","ignore") # if tuple is missing, the job is available
key=null : blob # structure containing the key
error_message=""... |
03b8237701e4158c8106f2e0bbedf72d5d77a9c95fed1621c6ffaa1e73e18263 | MATLAB | 686 | 33 | function [theta] = tapas_sem_sample_gaussian_uniform_priors(ptheta)
%% Sample from a Gaussian prior.
%
% aponteeduardo@gmail.com
% copyright (C) 2016
%
np = size(ptheta.jm, 2);
sample_pars = logical(sum(ptheta.jm, 2));
if size(ptheta.pm, 2) ~= np
pm = diag(ptheta.pm);
else
pm = ptheta.pm;
end
lt = chol(pm)... |
2d614feaa5d278bad37d0690b7eec32bf6906f9f72cc41d320d81aa7ff3bc19f | MATLAB | 686 | 19 | % cmp = MS_complexitybs(x,n);
%
% calculate the Lempel-Ziv complexity of the n-symbol stream x.
%
% x\in{0,1,2,...,(n-1)}
%
% cmp is the normalised complexity, that is the number of distinct
% symbol sequences in x, divided by the expected number of distinct
% symbols for a noise sequence.
%
% Algorithm is implemente... |
957c9eaa510220aff10d0b0d25cff7b17b3b45b8f85bd33f9aecb3152d1c6769 | MATLAB | 686 | 16 | function [sta_traces] = make_cell_sta_traces(input_traces, stim_frames, pre_frames, post_frames)
% grab episodes from input traces for each cell, average across trials
num_cells = size(input_traces,1);
sta_traces = zeros(num_cells, pre_frames+post_frames+1); % trial average
for c = 1:num_cells
this_sta_traces ... |
ae5de2d6988613403a9ee35a7e7ded53828736d074387ff836575a77e5411cfc | MATLAB | 686 | 21 | function bboxeso = bbox_remove_duplicates(bboxes, minSize, maxNum)
% Copyright (C) 2016 Hakan Bilen.
% All rights reserved.
%
% This file is part of the VLFeat library and is made available under
% the terms of the BSD license (see the COPYING file).
bboxeso = cell(size(bboxes));
for i=1:numel(bboxes)
bbox = bboxes{i... |
b12df146d13091bd65e6ca5c683d141b27238a53df75a8dd6cbe57ae044ab1f7 | MATLAB | 686 | 19 | function data=clust_normalize(data,method);
% method description
% 'var' Variance is normalized to one (linear operation).
% 'range' Values are normalized between [0,1] (linear operation).
data.Xold=data.X;
if strcmp(method,'range')
data.min=min(data.X);
data.max=max(data.X);
data.X=(... |
c13cb022581176193b2b392d596eec10e7cf10da3c1339a5eeab22bf1296f76d | MATLAB | 686 | 13 | % conf_criteria: 11 response crietria for the subject (in increasing order)
% noise_std: std of perceptual noise
% responses_by_gaussian: the distribution of responses (confidence) for
% each gaussian. Each row is a gaussian (increasing mean) and each column
% is confidence increasing -6,-5,...-1,1,2...6
function ... |
e05edaeafebafd7f7cf155e1a79836a39cb084a9892a8699030bbceef6b308e2 | MATLAB | 686 | 18 | function varargout = eucdist2(varargin)
%EUCDIST2 Compute 2-D Euclidean distance transform.
% D = EUCDIST2(BW) computes the Euclidean distance transform on the input
% binary image BW, which must be 2-D. Specifically, it computes the
% distance to the nearest nonzero-valued pixel.
%
% [D,L] = EUCDIST2(BW)... |
e5d858ba59353949ace719ff1f2cf95aa46250b723bd5e2af782530b6c0e8971 | MATLAB | 687 | 16 | function [pvec, pstruct] = tapas_gaussian_obs_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General ... |
7d36b4134c33147bb354a54e21dc005b652150470681456f7b161f7770a56eb7 | MATLAB | 688 | 20 | function fid = openfile(filename,permission)
%OPENFILE Open a file in read/write mode, catching errors
% FID = OPENFILE(FILENAME,PERMISSION) opens file FILENAME
% in PERMISSION mode ('r' or 'w') and return a file identifier FID.
% File is opened in text mode: no effect on Unix but useful on Windows.
% Copyright (C... |
86e62f3a99caf02a7b6819da942df36f827a1ed7d3cbc16edde92249a02a6be7 | MATLAB | 688 | 29 | function Xscaled=scale01(X,range)
% USAGE
% Xscaled=scale01(X[,range])
%
% FUNCTION
% ..linearly scales matrix X into the range [0,1].
%
% if range is given, min(range) and max(range) define the scaling and
% shifting, rather than min(X(:)) and max(X(:)).
%_______________________________________... |
c9eb5df6423b53e4a167c6b825022a1fdc6d3bf3606471eda1b383b9561408c6 | MATLAB | 688 | 23 | function bins = Bins(startpoint,endpoint,window,step)
%Bins - build temporal bins with specifying start and end points, window and step.
% Just a quick function to make bins spanning from
% t=startpoint to t=endpoint, with a given window and step
%
% Copyright (C) 2019 Ralitsa Todorova
%
% This program is free softw... |
3063b79c9c0a0588d7ad1fb94fb9073d18b08a3c2ea326330e072400f076eba2 | MATLAB | 689 | 16 | function [pvec, pstruct] = tapas_softmax_binary_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU Genera... |
510a1c677a81b1936b6f3f3ab68b7442829e7538b1d9a8f6e1ca1ebc27438e26 | MATLAB | 689 | 20 | % (C) Copyright 2020 CPP visual motion localizer developpers
function [conditionNamesVector, CONDITON1_INDEX, CONDITON2_INDEX] = assignConditions(cfg)
[~, nbRepet] = getDesignInput(cfg);
conditionNamesVector = repmat(cfg.design.names, nbRepet, 1);
% Get the index of each condition
nameCondition1 = '... |
7640bcf130ce657fbd5d0d21a894cb369a73dafdf8a80e0a3d50692762dd1cf9 | MATLAB | 689 | 23 | function [wMLnew,opsnew] = addParams(wMLold,params,index,ops,sizeops)
%will insert params and update the ops struct
%sizing info that will be added to ops
ls = sizeops.ls; %kernel length
dimst = sizeops.dimst;
dimbcst = sizeops.dimbcst;
nkern = ops.nkern+1;
opsnew = ops;
... |
d40f34818d3cec60e6f4fe0e7331ce638980b3a6b5d4741d759af56b71a4c3bb | MATLAB | 689 | 22 | function varargout = covSEisoU(varargin)
% Wrapper for Squared Exponential covariance function covSE.m.
%
% Squared Exponential covariance function with isotropic distance measure with
% unit magnitude. The covariance function is parameterized as:
%
% k(x,z) = exp(-(x-z)'*inv(P)*(x-z)/2)
%
% where the P matrix is ell... |
df23d404293835dcb702f3e1861f32ee7d66c78e8a124d70f74e472367bc0358 | MATLAB | 689 | 16 | function [pvec, pstruct] = tapas_softmax_2beta_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General Publ... |
bd0587ce2419e94e1cab6266954007d50ddb300a728a45d6e954dbfb41da6377 | MATLAB | 690 | 37 | function r = le(p,q)
% this function compares the less than or equal to 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, 'FaceVaria... |
ee2e713ea0ffa4645353690f7ab8accf65b2106e7f681901586986ec7bc7c3ef | MATLAB | 690 | 27 | a = load('Z:\ProcessedRatData\ratList.mat');
ratListAll = a.ratList;
sexListAll = a.sexList;
ratList = {};
sexList = {};
test = nan(size(ratListAll));
savedir = 'Z:\ProcessedRatData\A_Structs_Final\';
for rr = 1:length(ratListAll)
disp(rr)
a = load(['Z:\ProcessedRatData\A_Structs\ratTrial_' ratListAll{rr}]);... |
a452b5f7bcb0384e33cc4f4d29f0a7a3dbfd4ebe9ca5f991937897cab12a7dc7 | MATLAB | 691 | 26 | function B = sero_pulseq_calculateBtensor(seq)
% function B = sero_pulseq_calculateBtensor(seq)
%
% Returns b-tensor in 1x6 "Voight-like" format
% This function may not be general!
if ischar(seq) || isstring(seq)
tmp = mr.Sequence;
tmp.read(seq);
seq = tmp;
end
ind = sero_pulseq_getExcitationBlockInd(se... |
b4b774179db982141d100fa9fe9dda12c1e324f2b7f2a436f5c1d376a9eae0de | MATLAB | 691 | 20 | function [m,dm] = meanGP(hyp,inf,mean,cov,lik,x,y, hypz,z)
% Mean function being the predictive mean of a GP model:
%
% m(z) = posterior mean of another GP at location z as given by
% m(z) = gp(hyp,inf,mean,cov,lik,x,y, z)
%
% The hyperparameters are:
%
% hypz = [ ]
%
% Copyright (c) by Hannes Nickisch, 2016-04-16.
%
... |
987885591daf93a59f18d440062af6ca34ddcab061f19005d9e69c58f32d76fe | MATLAB | 692 | 25 | %{
# spike-triggered average of receptive fields
-> preprocess.Sync
-> preprocess.Spikes
-> tuning.RFMethod
---
nbins : smallint # temporal bins
bin_size : float # (ms) temporal bin size
degrees_x : float ... |
c2a56d2587c7894a74aef08a8059808c1f6ffedb301a1735c5d3c2dcf4a66075 | MATLAB | 692 | 25 | % comm = afni_talk_defs() for getting communications defaults
% If you have a port offset PO to pass along, use:
% comm = afni_talk_defs(comm, PO);
function [comm] = afni_talk_defs(comm, np)
comm.con = -1;
comm.sockcon = -1;
if (nargin > 1),
com = sprintf('suma -npq %d -port_number_quiet MATLAB_SUM... |
de9d0c3137c1a4f19eba592d6a90ed4f4c683a5986675d0319d0f6b301fca43f | MATLAB | 692 | 16 | %{
rf.Jobs (job) # the job reservation table
table_name : varchar(255) # className of the table
key_hash : char(32) # key hash
-----
status : enum("reserved","error","ignore") # if tuple is missing, the job is available
key=null : blob # structure containing the key
error_messa... |
135805295915b485a1b3277f0133ffa9c82fa9cbaa8be34eb96d386af3d3369b | MATLAB | 693 | 28 | function [tau, newy] = get_tau(xvals, yvals)
%myx = floor(length(xvals)/3);
iters = 25;
if sum(~isnan(yvals))>0
b = robustfit(xvals(1:3), yvals(1:3));
%need a tight window for the opt-outs
if b(2)<0 %if negative slope
m = min(yvals);
y = yvals-m;
[~, bestfit, ~] = fit_exp_decay(xva... |
2c8819ac28af7f3c008f41831405f45516563a5ea850923ac4ed95a2267f0ce8 | MATLAB | 693 | 37 | function r = ge(p,q)
% this function compares the greater than or 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, 'FaceVa... |
734b62c449a3c1cd0608fc1911d22057462adbbc39d64ac842b675fa59ab0b55 | MATLAB | 693 | 16 | function saveProcessedData(nirs, partName, outputsFolderPath, params)
% Saves the processed NIRS data after pruning to an output file with a
% name that indicates the pruning method and parameters used.
if params.pruneQT == 1
paramsAppend = strcat(params.pruneName, '_SCI', num2str(params.sci_threshold), ... |
92e2f9fd642c723fdb378ae9018537ba54ec8934720b9579daa5acbcb626afbd | MATLAB | 693 | 16 | %{
pre.Jobs (job) # the job reservation table
table_name : varchar(255) # className of the table
key_hash : char(32) # key hash
-----
status : enum("reserved","error","ignore") # if tuple is missing, the job is available
key=null : blob # structure containing the key
error_mess... |
e1bfd34bdec5e68511f77009c96c09a83ce9be8d47accbb278edb641fa321ec4 | MATLAB | 693 | 30 | function [model] = tapas_vlinear_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_... |
ec6e15088de82527e105153b7908fa5c8f8f518daf0d3dc456e72330635177f3 | MATLAB | 693 | 19 | function [md5hash] = JavaMD5(filename)
%% [md5hash] = JavaMD5(filename)
% Use a java routine to calculate MD5 hash of a file
% Based on http://stackoverflow.com/a/304350/2531987
% Written by Marcin Konowalczyk
% Timmel Group @ Oxford University
narginchk(1,1);
assert(exist(filename,'file')==2,'JavaMD5:FileNotFoud','Fi... |
762401469af00cca52d4e6d5c55fba1aea41f05f4ac99f6a717b15b1208b790a | MATLAB | 694 | 20 | function [FaceNormals]=CalcFaceNormals(FV)
%% Summary
%Author: Itzik Ben Shabat
%Last Update: July 2014
%CalcFaceNormals recives a list of vrtexes and faces in FV structure
% and calculates the normal at each face and returns it as FaceNormals
%INPUT:
%FV - face-vertex data structure containing a list of verti... |
2fdd54e7d3f9654e0ce117627f7c3cc9b413bd87dd7db538e1635eb3d8f970dc | MATLAB | 695 | 22 | function f = imagefilter3D(vols,flt)
% function f = imagefilter3D(vols,flt)
%
% <vols> is X x Y x Z x N with one or more 3D volumes
% <flt> is a 3D magnitude filter in the Fourier domain (not fftshifted)
%
% Perform filtering in the Fourier domain and return the filtered volumes(s).
% We force the output to be real-v... |
d377bd56af501535f9dcf511ea7e58407423a03ea60b603252e73f6f16d20681 | MATLAB | 695 | 16 | %{
monet.Jobs (job) # the job reservation table
table_name : varchar(255) # className of the table
key_hash : char(32) # key hash
-----
status : enum("reserved","error","ignore") # if tuple is missing, the job is available
key=null : blob # structure containing the key
error_me... |
efd58550113c9a71ce5bd97d9a57469b88ead37040ab22b53eeec8bd06a040a4 | MATLAB | 695 | 40 |
% You can repack Panels from the command line.
%
% (a) Create a grid of panels, and show something in them.
% (b) Repack some of them, as if at the command line.
%% (a)
% create a 2x2 grid in gcf.
p = panel();
p.pack(2, 2);
% have a look at p - all the child panels are currently
% uncommitted
p
% commit all the ... |
0662abb2276776cc99042f571ce81f73a3c64c632e39488d3ecdc12d0639675d | MATLAB | 696 | 16 | %{
aodpre.Jobs (job) # the job reservation table
table_name : varchar(255) # className of the table
key_hash : char(32) # key hash
-----
status : enum("reserved","error","ignore") # if tuple is missing, the job is available
key=null : blob # structure containing the key
error_m... |
3093302c032875e321cced7b727fc2a69ab8a8f00c1048ee6c680a50db9144bd | MATLAB | 696 | 15 | function data = clust_denormalize(data)
% method description
% 'var' denormalization from a data whitch variation was normalized to one (linear operation).
% 'range' denormalization from a data whitch values were normalized between [0,1] (linear operation).
if isempty(data.min)==0
%if exist('data.min... |
53d83bde3fdd9d5b5f6e69794454024318f6d8939be4e4b15bf368e02ae04f85 | MATLAB | 696 | 16 | %{
trippy.Jobs (job) # the job reservation table
table_name : varchar(255) # className of the table
key_hash : char(32) # key hash
-----
status : enum("reserved","error","ignore") # if tuple is missing, the job is available
key=null : blob # structure containing the key
error_m... |
6ab4d373c59a0a0d9b4fa7f381c15ac672be9fdb9a27c8928f1a4162ed11d6c5 | MATLAB | 696 | 38 | % plot estimated weight
plot_mode = 1;
% = 1: Weight in embedded space
% = 2: Weight in original input space
% Subplot fig number
NX = 1;
NY = 1;
nfig = 0;
%
% --- Recover Estimated Weight matrix
%
[W ,Ydim, Xdim, Dtau] = get_estimated_weight(Model,parm);
nfig = nfig + 1;
subplot(NY,NX,nfi... |
814878d354c4d0900b3747c3dee2c4b804c4bf2e090bc53bce9049b980e1ce1c | MATLAB | 696 | 16 | %{
fields.Jobs (job) # the job reservation table
table_name : varchar(255) # className of the table
key_hash : char(32) # key hash
-----
status : enum("reserved","error","ignore") # if tuple is missing, the job is available
key=null : blob # structure containing the key
error_m... |
9d92e5407b40185b2f5681b7dbe4056f8e2c8f78b8743bed14e18e70c124fe83 | MATLAB | 696 | 20 | % startup script to make Octave/Matlab aware of the GPML package
%
% Copyright (c) by Carl Edward Rasmussen and Hannes Nickisch 2018-08-01.
% disp ('executing gpml startup script...')
mydir = fileparts (mfilename ('fullpath')); % where am I located
addpath (mydir);
% core folders
dirs = {'cov','doc','... |
b47c103bdf4977c4e4bcf0a54e41e1228bec1acb572476137d9c667d1f7e85c7 | MATLAB | 696 | 32 | function [d] = lbfgsProd(g,S,Y,YS,lbfgs_start,lbfgs_end,Hdiag)
% BFGS Search Direction
%
% This function returns the (L-BFGS) approximate inverse Hessian,
% multiplied by the negative gradient
% Set up indexing
[nVars,maxCorrections] = size(S);
if lbfgs_start == 1
ind = 1:lbfgs_end;
nCor = lbfgs_end-lbfgs_... |
4cfc55bef6a5ce031416ca7a49ad9500d4e438929da8b22957e3e04a0c65d1dc | MATLAB | 697 | 15 | %{
experiment.PMTFilterSetChannel (lookup) # PMT description including dichroic and filter
-> experiment.PMTFilterSet
pmt_channel : tinyint # pmt_channel
---
color : enum('green','red','blue') #
pmt_serial_number : varchar(40) #
spectrum_center ... |
bade665cc39061c180f7359b2c6068dcc7d125f5646302b59d118c030d9d1fb2 | MATLAB | 697 | 15 | function Fy = discretize2(F, y, yedges)
% Discretize/distribute a data vector F(t) according to its positions y(t)
% and return the result of averaged F as a function of y.
% F: 1-by-n datapoints, e.g. fluorescence trace
% y: 1-by-n coordinates, e.g. the average y position recorded during the corresponding frame
... |
0b0e250d8bf8200832f3e6c218753579731ddedde4b4476f676047b38ade067d | MATLAB | 699 | 27 | function [ y ] = SSQSM_vsharp( X, D, Del_Sharp, cDel_Sharp, DiffMask, mu, fdx, fdy, fdz, cfdx, cfdy, cfdz, magn_weight )
%APPLY_FORWARD Summary of this function goes here
% Detailed explanation goes here
x = reshape(X, size(D));
Dx = D .* x;
tmp = 0;
for k = 1:size(Del_Sharp,4)
tmp = tmp + DiffMask(:,:,:,k) .* ... |
1a5bc2117445e2957e5098b72c75c0e2b5659e733c8d53df58ade4bd5e7de4a0 | MATLAB | 699 | 16 | %{
aod_monet.Jobs (job) # the job reservation table
table_name : varchar(255) # className of the table
key_hash : char(32) # key hash
-----
status : enum("reserved","error","ignore") # if tuple is missing, the job is available
key=null : blob # structure containing the key
erro... |
630b95b3a79c6a53733cfcaef0c9a6f46c71ebee5e6e5524ec8ef7e739fd5b12 | MATLAB | 699 | 24 | function doCoactDemo(rootDir,sessionName)
reAnalyses = false;
if ~exist('rootDir','var') || isempty(rootDir)
rootDir='~/Desktop/data';
end
if ~exist('sessionName','var') || isempty(sessionName)
sessionName='hoegaarden181115';
end
icaReactFile=fullfile(rootDir,[sessionName '-icaReac.mat']);
if reAnalyses || ~... |
966ebbd453e668a834e58907bd6abbc6d2414f087b2fedf15ff2cc56db17bc00 | MATLAB | 699 | 31 | function [Mout, RHSout] = combineBC(MeshStructure, BC, Meq, RHSeq)
%COMBINEBC This function combines the boundary condition equations with the
%main physical model equations, and delivers the matrix of coefficient and
%RHS to be solved for the internal cells.
%
% SYNOPSIS:
%
%
% PARAMETERS:
%
%
% RETURNS:
%
%
% EXAMPLE... |
a77e4770d7762ebd933514c4224626372d027956001d2368d0be846901705473 | MATLAB | 699 | 30 | classdef BoundaryCondition
%CELLVARIABLE Summary of this class goes here
% Detailed explanation goes here
% Copyright (c) 2012-2016 Ali Akbar Eftekhari
% See the license file
properties
domain
left
right
bottom
top
back
front
end
me... |
20bd7b3346d7e652a105b3f596b890b77491077d995d8d1a6d8f03f339c8134f | MATLAB | 700 | 16 | %{
preprocess.Jobs (job) # the job reservation table
table_name : varchar(255) # className of the table
key_hash : char(32) # key hash
-----
status : enum("reserved","error","ignore") # if tuple is missing, the job is available
key=null : blob # structure containing the key
err... |
5a0a9b062eccc1d1d884a61a8e4b7874dc79a6aed62ddfa79340c993628fe89c | MATLAB | 700 | 38 | function [lpp] = tapas_sem_prosa_lpp_uniform(theta, ptheta)
%% Log prior probability of the parameters of the prosa model.
%
% Input
% pv -- Parameters in numerical form.
% theta -- Parameters of the model
% ptheta -- Priors of parameters
%
% Output
% lpp -- Log prior probability
%
% aponteeduardo@gmail.com
%... |
74be76bd97360559558ff9e8c4ae50455d1cfa5ab3464fed6d1bddc470a11572 | MATLAB | 700 | 20 | function D=struct2dataframe(S);
% function D=struct2dataframe(S);
% Converts a structure-array into a dataframe structure.
% The pre-requisite is that all fields in the structure a 1xK matrices or
% cell arrays, so that they can be vertically concatenated
fields = fieldnames(S(1));
numStruct = length(S);
for f=1:lengt... |
a8b4af77fcc880ddf2d5841661a0b6c8cd9539c86e6eb506f53024e39f00425a | MATLAB | 700 | 30 | function [A,W,SW,S,Q,ix_act] = ...
compo_update_act(XX,A,W,SW,S,Q,SY,i_up,jx,ix_act)
% Update component
% XX = X(ix_act,:)*X' [M_act x M_all]
% New alpha
a0 = A(i_up);
s0 = S(i_up);
b0 = 1 - s0./a0; % scale factor for Q & S
qq0 = SY*sum(Q(:,i_up).^2,1);
anew = s0.^2 ./(qq0 - s0.*b0);
%if (anew - a0)... |
fccc07ea314f42fdd834507b25d2826a45b23b23be679470d956d639aa86616f | MATLAB | 700 | 26 | %{
preprocess.MaskCoordinates (imported) # mask center of mass of a segmented cell
-> preprocess.ScanCoordinates
trace_id : smallint # trace id
-----
xloc : double # x location in micro meters relative to the frame start
yloc : double # y location in micro meters rel... |
03e19bad82b2763691f1059f21c7e57477e1db0919dfa0ca588ef7950a6a8707 | MATLAB | 701 | 31 | function [weight, bins] = sero_srr_sliceProf2weight(slp, z, dz, sliceThick, do_plot)
% function [weight, bins] = sero_srr_sliceProf2weight(slp, z, dz, sliceThick, do_plot)
ar = round(sliceThick/dz);
z_mm = z*1e3;
dz_mm = dz*1e3;
if iseven(ar)
bins = (ceil(min(z)/dz):1:ceil(max(z)/dz))*dz_mm;
weight = zero... |
2d080d28d16c4ac10ae27ca7e33d0c17ecc5ecf5baf51a9091024bfcad2046fd | MATLAB | 701 | 11 | function [bodyparts_position] = get_bodyparts_position(mouse_bodyparts,bodyparts)
% get average position of specific body parts from mouse_bodayparts
% structure saved out by 'get_mouse_position'
data = cell2mat(struct2cell(mouse_bodyparts)');
xidx =cell2mat(cellfun(@(x)find(contains(fields(mouse_bodyparts),[x,'_x... |
9a707ade7e073fe4272aefb4693f181eb4703b517891ba59a3a2fc0590ec6911 | MATLAB | 701 | 33 | function cellvar = reshapeCell(MS, phi)
% this function reshapes a vetorized cell variable to its domain shape
% matrix based on the mesh structure data; it is assumed that the phi
% includes the ghost cell data as well.
%
% SYNOPSIS:
%
%
% PARAMETERS:
%
%
% RETURNS:
%
%
% EXAMPLE:
%
% SEE ALSO:
% cellBoundary
% C... |
a6e89aee2fb68b341f1acc80c47e193df71c5a18f162ddc383af56bd353b2da0 | MATLAB | 702 | 31 | clc;
clear;
rt_dir = '/cbica/home/lihon/comp_space_recover/ABCD_comp/dl_prediction/pred_res_cog_abcc_bl_cv/non_dl_pnc_res/vis_v2_r400_ro1';
metric_mat_file = [rt_dir, filesep, 'sel_K_ver2_metric.mat'];
load(metric_mat_file);
m_ari = mean(ari_vec);
s_ari = std(ari_vec);
m_sumd = mean(md_vec);
s_sumd = std(md_vec);
... |
bd17c2d0a5a2e4da2273720167a453ccbb018a605a61f2c2a79c65764751df88 | MATLAB | 702 | 22 | function [nonopto_norm, opto_norm] =...
CompareOptoITIbyBlock_overrats(ratlist, optoafterdates,...
AlignedRats, SRats)
optosessions_rats = NaN(length(ratlist), 3);
nonoptosessions_rats = NaN(length(ratlist), 3);
for rat = 1:length(ratlist)
ratname = ratlist{rat};
disp([ratname ': ' num2str(rat) ' out ... |
d158e6c2fcccb892703ce030dffba9d7f45926db6d1657c392e0323305547eb1 | MATLAB | 702 | 27 | classdef nnnormalizelp < nntest
properties (TestParameter)
h = {1 2 3 4}
w = {1 2 3 4}
d = {2 3 4}
p = {2 4}
end
methods (Test)
function basicl2(test, h,w,d)
x = test.randn(h,w,d,3) ;
y = vl_nnnormalizelp(x) ;
dzdy = test.rand(size(y))-0.5 ;
dzdx = vl_nnnormalizelp(x,d... |
08765a43b3294ec2e4f833d002d933b787a00b4a5809926e8b661149c16162d2 | MATLAB | 704 | 28 | function [fluxsim,tvals,cumflux,tavg] = loadTotFluxSim(filename)
% load flux from simulation results
% that output *total* flux only
% also returns cumulative flux and average times corresponding to
% cumulative flux evaluation
data = dlmread(filename);
% is this flux out of permeable nodes
isperm = data(1,4);
% numb... |
7f0ae479ab9ab793ce45ab4b0c3a3117796edd20aa79805b876ae3de741ad7f6 | MATLAB | 704 | 23 | function [seeds] = makeseed(B_L,sample_size,num_seeds)
%Function to make lists of seeds for non-parametric hierarchical
%bootstrapping so results can be reproducible across multiple runs of code.
%Input is the number of values needed within a seed to match bootstrap
%repitions and the number of seeds needed based ... |
e6fc36918077b3d3f0011739b3180ce5c4d1d1abbf58cef6b9c24863bf0f712c | MATLAB | 704 | 26 | function nf_json_write( filename, data )
%nf_json_write( filename, data )
% Writes a JSON data file with some formatting to be editable
fid=fopen(filename,'w');
[json, delim]=split(jsonencode(data),{',','{','(','}',']','":'});
charcount=0;
for i=1:length(json)-1 % last item should always be empty
if (strcmp(del... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.