sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
28080b7d2f1e7c4e3494fb3d5c56d309b09616db403358dd5db32452347f890b | MATLAB | 925 | 32 | function [P] = likelihood_fun_global(AMean, Astd, x0Vec, x0StdVec, nMean, nStd, noiseStd, r, conc)
% r: concentratio number - by - trial number - by - pair number
Ppair = ones(size(r, 3),1);
%%
parfor pp = 1:size(r, 3)
cTrial = conc(:,:,pp);
rTrial = r(:,:,pp);
trialIdx = find(~isnan(rTria... |
430a8acd21bfc81d88d8cefd601ddc0317b1320a7c8c6e910cee44314ca62c3a | MATLAB | 925 | 35 | function [outputArg1,outputArg2] = display_iGABASnFRs(nam)
%displaying iGABASnFR signal during visual stimulation
%signals to image motion stimuli to 8 direction
%set the MATLAB path including iGABASnFR signal data (e.g. 'iGABASnFR1_dF.mat') on cd0 (Line8)and
%run this script with the file name
close all;
cd0=[... |
8a8f7fd2ff543614631babd8954e2c16f5f9331f8b099e2c828ae96ad3a374ad | MATLAB | 925 | 40 | function [llh] = tapas_sem_prosa_hier_llh(y, u, theta, ptheta)
%% Computes the likelihood function of a hierarchical model.
%
% Input
%
% y -- Observed behavioral data. A structure with fields 't' times and 'a'
% action
% u -- Experimental input. A structure with fields: 'tt' trial type, either
% pros... |
e9e839393320e1878872fc5fe6f5d1b0d9d58a57daae43fd41ace8f41d338d6b | MATLAB | 926 | 30 |
function [C0,maxC]=SourceType(app,op)
dy=app.ds(1);
dx=app.ds(2);
dz=app.ds(3);
d3=dx*dy*dz;
dt=app.Timestep.Value*convertToSIunit(app.Units.Value);
if op==1
TN=app.TN.Value; % TMA Transport number RTI
F=96485.332;%s*A/mol (Faradays Constant)
I=app.Current.Value*10^-12; % A
... |
4863cedb3350bf89e457c4792d1475db9f1b663376a49a53b25766ba385b1dd3 | MATLAB | 927 | 31 | function iDim = get_singleton_dimensions(this)
% returns vector of indices of singleton dimensions (i.e. 1 or less elements)
%
% Y = MrDimInfo()
% Y.get_singleton_dimensions(inputs)
%
% This is a method of class MrDimInfo.
%
% IN
%
% OUT
%
% EXAMPLE
% get_singleton_dimensions
%
% See also MrDimInfo
% Author: ... |
b819d2b609fba2e5cdc77a4a9aa6e6cd581b27f6c109183f5e4e2225bd5f3ba7 | MATLAB | 927 | 32 | function osp_QuantTabChangeFcn(src,~,gui)
%% osp_QuantTabChangeFcn
% This function is triggered when the quantify tab is changed. It refreshes
% the figure.
%
%
% USAGE:
% osp_QuantTabChangeFcn(src,~,gui);
%
% INPUT: src = handle of the fit tabs
% gui = gui class containing all handle... |
c90182a354526458786bcfdd7c584a571a7641a38513c6dd7a60dd70e522789b | MATLAB | 927 | 32 | function runMLspikeBatch(path)
options.skipCleanFile=true;
filelist = dir(fullfile(path, '**\*_clean.mat'));
if isempty(filelist)
error('no extract output file detected in any subfolder')
end
for i=1:numel(filelist)
filePath=fullfile(filelist(i).folder,filelist(i).name);
savePath=strrep(filePath,'.mat','... |
ca5c0e9d6fe4b8b42a4e975476481d85bcc9bb6120b23035402bec21fe205e6c | MATLAB | 927 | 31 | clear all, close all
% GP spec
mean = {@meanSum, {@meanLinear, @meanConst}}; hyp.mean = [0.5; 1];
cov = {@covMaterniso, 3}; ell = 1/4; sf = 1; hyp.cov = log([ell; sf]);
lik = @likGauss; sn = 0.1; hyp.lik = log(sn);
inf = @infGaussLik;
% synthetic data
n = 20; x = gpml_randn(0.3, n, 1);
K = feval(cov{:}, hyp.cov, x);
... |
3b804b9b8ae532185ea258c85714192febf9c71e3fc8b916a25c96a6f477f776 | MATLAB | 928 | 33 | function complex_stiefel_test()
% Minimize the complex Brockett function
% Generate the problem data.
n = 100;
p = 10;
A = randn(n)+1i*randn(n);
A = .5*(A+A');
N = diag(p:-1:1);
% Create the problem structure.
manifold = stiefelcomplexfactory(n, p);
problem.M = manifold... |
ec8c46a64aa335191e2fbca668f65c4d11f2b29d33cf3cf352b65679a65be074 | MATLAB | 928 | 36 | function this = compute_roi_stats(this)
% Computes statistical values for defined rois of an Image
%
% Y = MrImage()
% Y.compute_roi_stats()
%
% This is a method of class MrImage.
%
% IN
%
% OUT
%
% EXAMPLE
% compute_roi_stats
%
% See also MrImage extract_rois MrRoi.compute_stats
% Author: Saskia Klein & La... |
efec36cb485d8d4fe8b75f127e8595c49468236f288cf1297219c58f680e60be | MATLAB | 928 | 27 | function [width, trough2peak] = GetWaveformStats(waveforms)
% Stats are in index values. To convert them to seconds, multiply with your sampling frequency
% Check that we have a single waveform
if isvector(waveforms),
waveforms = waveforms(:)';
end
n = size(waveforms,1);
for i=1:n,
try
waveform = wav... |
a664b39757e0db9109f2149e168c05e6fb588663a2b4373277b2d71eb8b91a9d | MATLAB | 929 | 40 | function [W ,ix_act] = get_embed_weight(Model,parm);
% return Weight matrix from 'Model'
% [W ,ix_act] = get_embed_weight(Model,parm);
% --- input
% Model.W : Weight matrix for active input [Ydim x Nactive]
% Model.ix_act : active input index
% parm.Dtau
% parm.M_all
% --- output
% W : Weight matrix for norma... |
e2fb895384b7d39e36c060f05cfd1517e64ae76204e435e21aec7c2cc3e7b0ff | MATLAB | 929 | 35 | function outputImage = exp(this)
% Computes image of exponential per pixel
%
% Y = MrImage();
% expY = Y.exp()
% expY = exp(Y);
%
%
% This is a method of class MrImage.
%
% IN
%
% OUT
% outputImage exponentiated value image
%
% EXAMPLE
% expY = exp(Y)
%
% See also MrImage MrImage.perform_u... |
ec713b9ca022f8d2f3487565d7e60ee8f5e8755613d96f88c9f7bcb00a47af03 | MATLAB | 929 | 31 | function osp_onPub( ~, ~)
%% osp_onPub
% Callback function on publication button. Visits HERCULES paper.
%
%
% USAGE:
% osp_onPub( ~, ~ );
%
%
%
%
% AUTHORS:
% Dr. Helge Zoellner (Johns Hopkins University, 2020-01-16)
% hzoelln2@jhmi.edu
%
% CREDITS:
% This code is based on numerous func... |
1182267b2f34bf66c275577d83c11caed08c18c1dc5a141e81eb26c9e102131a | MATLAB | 930 | 38 | function runTests()
%
% (C) Copyright 2022 CPP visual motion localizer developers
% Elapsed time is ??? seconds.
tic;
initEnv();
if bids.internal.is_github_ci
fprintf(1, '\nThis is github CI\n');
else
fprintf(1, '\nThis is not github CI\n');
end
fprintf('\nHome i... |
1b82242186e1f0fd0966bbd2b4b92d0f7e171a084c321dc45b8d797bdd9b94aa | MATLAB | 930 | 26 | function [meshstruct, D, M, RHSbc] = computeDiffusionMatrix2D(im, voxel_size)
% Compute Diffusion Matrix M from mesh 2D of tensors
%
% Author: Aina Frau-Pascual
% Construct mesh structure
Nx = size(im, 1); % number of cells
Lx = Nx * voxel_size(1); % domain length
Ny = size(im, 2); % number of cells
Ly ... |
64564b70bdd70fab7f08889f6abfe8d43bf8e9f08e1606feb7ee8b5bd4c8e2e1 | MATLAB | 930 | 35 | function [ vertices, faces ] = nf_load_surf_flexibele( surf_file )
%[ vertices, faces ] = nf_load_surf_flexibale( surf_file )
% Wrapper script to load the different surfaces formats, i.e.
% Freesurfer format (no extension)
% ASCII (.asc extension)
% GIFTI (.gii extension)
%check if we have the files
if (~exist(surf_fi... |
c35368d5b01b9707edf8cf6df6bad5a186b020d19de8cb63ed73bb62c478e3d8 | MATLAB | 930 | 41 | function [ output_args ] = graph2NETWORK( graph )
%GRAPH2NETWORK( graph ) Builds a NETWORK structure from a graph object.
%
% INPUT:
% graph [graph]: undirected, unweigted graph
%
% OUTPUT:
% output_args [struct]: NETWORK structure
%
% EXAMPLES:
% analyseGraphCommunityStructure( ZacharyKarateClub , s... |
f182ba9541536bc5397790cc710322949836a73ffc307597dea224e45e1b5fb4 | MATLAB | 930 | 30 | function osp_pop_corrOvCorr_Call(src,~,gui)
%% osp_pop_corrOvCorr_Call
% This function is triggered when the correlation choice popup menu is changed. It refreshes
% the figure.
%
%
% USAGE:
% osp_pop_corrOvCorr_Call(src,~,gui);
%
% INPUT: src = handle of the fit tabs
% gui = gui clas... |
52c0ea08ae536dafcf0f44f9f7ada335bea2221ebf54d213b96ecde0bb85a7d9 | MATLAB | 931 | 30 | function osp_pop_meanOvPlot_Call(src,~,gui)
%% osp_pop_meanOvPlot_Call
% This function is triggered when the mean spectra choice popup menu is changed. It refreshes
% the figure.
%
%
% USAGE:
% osp_pop_meanOvPlot_Call(src,~,gui);
%
% INPUT: src = handle of the fit tabs
% gui = gui cla... |
8c7c90feab2d43386114a20ed45563781f14dbe4cbc9de9b8d54d54d413e6c98 | MATLAB | 931 | 34 | function outputImage = sqrt(this)
% Computes image of square root per pixel
%
% Y = MrImage();
% sqrtY = Y.sqrt()
% sqrtY = sqrt(Y);
%
%
% This is a method of class MrImage.
%
% IN
%
% OUT
% outputImage square root per pixel value image
%
% EXAMPLE
% sqrtY = sqrt(Y)
%
% See also MrImage Mr... |
f664e300e082ec83184c73aa6d1636c4ee34af12fa57df8d479a3866f72f44b3 | MATLAB | 931 | 28 | function savesession_Callback(hObject, eventdata, handles)
handles.v_det = get(handles. popupmenuDetectionFiles,'Value');
if isfield(handles,'current_detection_file')
handles.SaveFile = handles.detectionfiles(handles.v_det).name;
handles.SaveFile = handles.current_detection_file;
else
handles.SaveFile = [s... |
1c02d1b7be920f5be0bc4b27300c4115045560653523b160dd66609021c3e3f4 | MATLAB | 932 | 26 | function [wAdjMat] = gen_weightedAdjMat(lenNodes,edgeIdx,edgeWeight)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% gen_weightedAdjMat generates n x n weighted sparse adjacency matrix
% consisting a number of edges are weighted.
%
% Arguments:
% lenNodes = Number of nodes.
% edg... |
4d374db30a8b6fcb9365f24269bc2b9c4892225c56680f5f5c852aecd98af81f | MATLAB | 932 | 23 | function [mapOfOdds] = SignificantOdds(deltaFoF, sigma, movements, densityData, densityNoise, xev, params, plotFlag)
deltaFoF(logical(movements),:)=NaN;
transfDataMatrix=bsxfun(@rdivide,deltaFoF,sigma);
points(:,1)=reshape(transfDataMatrix(1:end-1,:),[],1);
points(:,2)=reshape(transfDataMatrix(2:en... |
57d0b2340ca58bcfd70022944fd3f662a24532509c4d8cf3a6d96730b5620344 | MATLAB | 933 | 44 | function issame=samedir(a,b)
% dirty check if two paths point to the same directory (as soft links may
% obscure this)
%
% ISSAME=SAMEDIR(DIR1,DIR2)
% INPUTS:
% DIR1,DIR2 Paths to two directories
% OUTPUT:
% ISSAME true iff DIR1 and DIR2 point to the same directory
%
% If either DIR1 or DIR2 is not... |
755383701e1c497701973d5b778d254e71e618fb9e2b033f0792834616e00426 | MATLAB | 933 | 28 | function [raster] = ts2binaryraster(spks,bin,sr)
% [raster,poprate] = ts2raster_poprate(spks,bin,sr,op)
%
% converts timestamps (timepoints) of N x 1 (or transpose) cell array
% 'spks' samples at 'sr' sampling rate into a
% binary (logical) raster 'raster' with bin size 'bin' s.
% Reference paper: Herzog et al. 2020 "... |
9d769fe906fb0888b9c4d6d55ee08523b41a67d72c7875f09530548660891c7a | MATLAB | 933 | 24 | function [pvec, pstruct] = tapas_logrt_linear_whatworld_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2014 Christoph Mathys, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General ... |
21e9911cf8b75f0cd5bfc58d0ee25fb3701a254cef5e61fa2c3cb89f3564d86c | MATLAB | 934 | 35 | %% icon = sepia_theme_open_icon()
%
% Output
% --------------
% icon : 16x16 CData image matrix for the folder/file 'open' icon
% used on the GUI's push buttons
%
% Description: Returns the folder icon used for file/directory 'open'
% push buttons, automatically switching between the light-theme
% ('fo... |
5c8a0753594bdf0a11ff499a33b84573fbc5d8ac0be26e9afcb4909f6eb0819b | MATLAB | 934 | 48 | function auc = auc_upto_far(far,score)
% auc = auc_upto_far(far,score)
%
% compute area under the ROC curve up to a given FAR from the Bullwinkle scoring output
% or if score is a N by 2 array, treat it as x,y values for an ROC
%
% 5/28/2013 - Taylor Glenn - tcg@cise.ufl.edu
% given the scoring output
% auc is su... |
6a14553cd7a751a6b7f33d644a5228b5be5e4d8ac1c7b873f4d49b8210cd65c3 | MATLAB | 934 | 25 | function getTriggers_applyLogicalOperator(params)
% executes a logical operator between two sets: AND, OR
% set 1 = triggers_clz from previous evaluation (or init)
% set 2 = trials_events of certain category
% saves result in session cache file in variable 'triggers_clz'
% (c) Jiri, Nov16
for sess = 1:size(params.sto... |
8a629edb94b278cda07559a9d0185eaa6afcb71159eec78202f87afc90332155 | MATLAB | 934 | 40 | function f = l1vectorlength(m,dim)
% function f = l1vectorlength(m,dim)
%
% <m> is a matrix
% <dim> (optional) is the dimension of interest.
% if supplied, calculate L1 vector length of each case oriented along <dim>.
% if [] or not supplied, calculate L1 vector length of entire matrix
%
% calculate L1 vector leng... |
a06ff6e66329122330ba1f4c4f8a30e6e13bb4f7cde19d17a3edde30a4f38b77 | MATLAB | 934 | 35 | function outputImage = real(this, varargin)
% Computes real value per image pixel
%
% Y = MrImage();
% realY = Y.real()
% realY = real(Y);
%
%
% This is a method of class MrImage.
%
% IN
%
% OUT
% outputImage real part image
%
% EXAMPLE
% realY = real(Y)
%
% See also MrImage MrImage.perfor... |
016ab136763ae3917b1b93c5fc3a52f7fa26be04479cf60811add303e1d88dee | MATLAB | 935 | 52 | function c=nanpadcat(a,b,d)
%Performs horzcat on matrices that might have different lengths by filling
%the empty places with NaNs.
% 20120313 adjusted to do either horz- and vertcat, using a third variable
% the dimension. Dimension can be 'v' or 'h'.
% % for testing--------------------
% clear
% clc
% b=magic(7)... |
3d0d74851f84cea35a94c4fa10a0adcc896e91e284033c2bd86b23ed9c5989d1 | MATLAB | 935 | 39 | function h=subplotInMM(Xpos,Ypos,Width,Height,SetTop,sumerimpose)
if nargin<5 || isempty(SetTop)
SetTop=true;
end
if nargin<6 || isempty(sumerimpose)
sumerimpose=false;
end
unit=get(gcf,'paperunit');
if ~strcmp(unit,'centimeters');
set(gcf,'paperunit','centimeters');
end
paperPos=get(gcf,'paperPosition'... |
511a915cb793f54a3caa42ee02436fac893e0076ce8e62f518b974993b246572 | MATLAB | 935 | 33 | function [ordering,groupbreaks] = sortByCluster(X,grouping,type)
%sorts on subgroups
%
%Inputs:
%X: (nn x nt) data of interest, nn neurons, nt time points
%ops: structure with following
% grouping: (nn x 1) vector of integers, assignign each to a class
%
%Outputs:
%ordering: (nn x 1) vector of idx of each neurons, so... |
9063f72739a8ef05c37f431fa7b0dd6b559fe43decd64498d6a72135a6faa060 | MATLAB | 935 | 37 | function [itiMdl, itiOpt, V, rpe, alpha, G] = generate_ms_mdl(...
R, alpha0, D)
% generate_ms_mdl - generates data for Mackintosh Surprise model
% INPUTS:
% R - reward vector. Must be 1:5
% alpha0 - Base learning rate
% D - Scale parameter
% OUTPUTS:
% itiMdl - trial intiation time with added noise
% itiO... |
f489c3de51ad0ed3e7f000f79ea5b5c5e7ae3f93bff65db4f07dee0756ac4dfa | MATLAB | 935 | 35 | function outputImage = abs(this, varargin)
% Computes absolute value per image pixel
%
% Y = MrImage();
% absY = Y.abs()
% absY = abs(Y);
%
%
% This is a method of class MrImage.
%
% IN
%
% OUT
% outputImage absolute value image
%
% EXAMPLE
% absY = abs(Y)
%
% See also MrImage MrImage.perf... |
33f70209674e25202f59eaf7ffea4cebdf77615c415258dd9fb78c3225d0e6f1 | MATLAB | 936 | 17 | %function [haloInd] = haloAssign(dist, clustInd, dc, rho, isHalo)
function [haloInd] = haloAssignv2(dist2cent, clustInd)
% 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.33590... |
5475d9525871637ed5815e877dc23647e73b1c619905441571d7e230242bc0d6 | MATLAB | 936 | 31 | function plot_stftBaseline(params, freqAxis, timeAxis, B_avg, B_std, figName)
% plots STFT baseline for all channels
% input: B_avg, B_std = 2D: [freq x channels]
% prepapres struct 'trialsData'
% plotting: plotTrials.m
% (c) Jiri, Aug23
if nargin < 6
figName = 'baseline_RS';
end
%% data
trialsData = struct;
tri... |
6799f692449620847709c226a5fd00eb1685bcdd815fcbd2c8ca93714dfb54ee | MATLAB | 936 | 39 | % getHalfFourier.m
%
% $Id:$
% usage: d = getHalfFourier(im)
% by: justin gardner
% date: 07/08/11
% purpose: returns the half-fourier representation of the image.
% (See reconstructFromHalfFourier)
%
function d = getHalfFourier(im)
% check arguments
if ~any(nargin == 1)
hel... |
a12d3cdf24ccab68cebe5fa371dc43a99866e45a2116f73e4ddbedb8d045bbea | MATLAB | 936 | 43 | function write_pulse(fname,mat,flag)
% WRITE_PULSE(fname,mat,flag)
%
% write a matrix (mat) to a file in the binary format written by
% write_binary_matrix() in miscmaths (FSL library)
% if flag=0 use the standard format; if flag=1 use the hybrid
% PMatrix format (from POSSUM)
%
% See also: read_pulse (for binary... |
e6606279cfa7f80974134c9279c156e5818a4a35ba44db56874649996835ff08 | MATLAB | 936 | 30 | function osp_pop_quantOvPlot_Call(src,~,gui)
%% osp_pop_quantOvPlot_Call
% This function is triggered when the quantification choice popup menu is changed. It refreshes
% the figure.
%
%
% USAGE:
% osp_pop_quantOvPlot_Call(src,~,gui);
%
% INPUT: src = handle of the fit tabs
% gui = gu... |
0b21ac4c4d9e5fdce0a914a1f9e829a12abfc8f75c57affb31de149cd8a117bd | MATLAB | 937 | 35 | function [ylimits, outliers] = getYLims(statData, stdThr)
% ylimits: cats values in statData (3D: samples x channels x trials) together,
% fits normal distribution & sets y-limits at 6 sigma
% 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 ... |
66569bcd067d3b8d8e8e1aa159e4b3ff912285d4a2803067745578759ad73148 | MATLAB | 937 | 35 | function ShowCmap(M, h)
% ShowCmap(M, h)
% a function to display and examine a colormap
% M (nx3): color map
% h: figure handle
%
% see also readXcol, ROIcmap, rgbdectohex, and ScaleToMap
%
figure(h); clf
subplot (211);
colormap(M);
image ([1:1:size(M,1)]);
str = sprintf('%d colors color map. Pick colors... |
7db0c40ca4116cd2494a8fc47cd8df14ddc2ddbc5c58bdbd0771561846020df8 | MATLAB | 937 | 28 | function [version,data] = tapas_check_online_version()
%% Read online the current version of tapas there.
%
% Input
%
% Output
% version -- Current version of tapas on github (as string)
% If the service is not available, an empty string
% data --... |
0ecce3088de98829fbc914cbe7fe4d06039d4d4af73cf32d5c17533e7dfb745a | MATLAB | 938 | 31 | function [m,dm] = meanDiscrete(s, hyp, x)
% Mean function for discrete inputs x. Given a function defined on the
% integers 1,2,3,..,s, the mean function is parametrized as:
%
% m(x) = mu_x,
%
% where mu is a fixed vector of length s.
%
% This implementation assumes that the inputs x are given as integers
% between 1 ... |
2a06ec8280a7880b8d350446b23b25e20f3fac6b9b95a49e3caf3f4d60dbe15d | MATLAB | 938 | 42 | function img=s2v(node,face,div)
%
% img=s2v(node,face,div)
%
% shortcut for surf2vol, coverting a surface to a volumetric image
%
% author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu)
%
% input:
% node: node list of the triangular surface, 3 columns for x/y/z
% face: triangle node indices, each row is a triangle
%... |
4caa086b643343bd2be7960869258ffae49fef74486d38b6d88cb4b1c93ef8b1 | MATLAB | 938 | 31 | % Export brain volume images
%
% This script requires BrainDecoderToolbox2 (https://github.com/KamitaniLab/BrainDecoderToolbox2).
%
% Change Log:
%
% 2019-01-15 Shuntaro Aoki <aoki@atr.jp>
%
% * Initial version.
%
clear all;
for i = 1:5
bdata_file = sprintf('./data/Subject%0d.mat', i);
template_file... |
a229f0566669df2eed3d1e283c49fb6acaa6373c25fb003df149a5793476cfb3 | MATLAB | 938 | 46 | function correctedStackMovie(key,filepath,direction)
% direction can be 'normal' or 'reverse'
if nargin <3
direction='normal';
end
stk = stack.loadCorrectedStack(key);
figure
writer = VideoWriter(filepath, 'MPEG-4');
writer.Quality = 100;
writer.FrameRate = 24;
writer.open
set(gcf,'color','w')
switch direction
... |
098910412b5b69a17e3c4e9d8b33308587a79a76dc05887f9a1169276889a420 | MATLAB | 939 | 29 | function y = tapas_unitsq_sgm_mu3_sim(r, infStates, p)
% Simulates observations from a Bernoulli distribution
%
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2018 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is r... |
361d6383c18554c49087bf0d9b130cfaec3339d539ff3619195ef17e4a9e67ab | MATLAB | 939 | 35 | function outputImage = log(this)
% Computes image of natural logarithm per pixel
%
% Y = MrImage();
% logY = Y.log()
% logY = log(Y);
%
%
% This is a method of class MrImage.
%
% IN
%
% OUT
% outputImage natural logarithm value image
%
% EXAMPLE
% logY = log(Y)
%
% See also MrImage MrImage... |
a2645ec7c13118fe90a09ffd941a0367d1d490a735f01d221dad2fea197f04e0 | MATLAB | 939 | 41 | function [bnd,gap] = refinebounds(D,bnd,tol1)
%REFINEBONDS Refines error bounds for Ritz values based on gap-structure
%
% bnd = refinebounds(lambda,bnd,tol1)
%
% Treat eigenvalues closer than tol1 as a cluster.
% Rasmus Munk Larsen, DAIMI, 1998
j = length(D);
if j<=1
return
end
% Sort eigenvalues to use inte... |
b1b086d3b6c463c22ce6f55e3beaaa2e84962afed7979237a6ecd43fb3230252 | MATLAB | 939 | 31 | function tapas_physio_suptitle(titleString)
% if Biodemo toolbox not installed, use simple title instead of suptitle
%
% tapas_physio_suptitle(titleString)
%
% IN
% titleString that should be displayed on top of figure with multiple
% subplots
% OUT
%
% EXAMPLE
% tapas_physio_suptitle
%
% ... |
d869e872293cb2e4935d9fa63a518d471fc8146d008870a6855c9bc33135efa1 | MATLAB | 939 | 30 | function osp_pop_corrOvMetab_Call(src,~,gui)
%% osp_pop_corrOvMetab_Call
% This function is triggered when the correlation metabolite popup menu is changed. It refreshes
% the figure.
%
%
% USAGE:
% osp_pop_corrOvMetab_Call(src,~,gui);
%
% INPUT: src = handle of the fit tabs
% gui = g... |
8154a53396d0989ead6361d2c666d25fb9ad05db917e308cdba882e049486773 | MATLAB | 940 | 25 | function [lp,dlp] = priorWeibull(lam,k,x)
% Univariate Weibull hyperparameter prior distribution.
% Compute log-likelihood and its derivative or draw a random sample.
% The prior distribution is parameterized as:
%
% p(x) = (k/lam) * (x/lam)^(k-1) * exp(-(x/lam)^k)
%
% where lam(1x1) is the scale parameter, k(1x1) i... |
9012f50a368b661e64fff5a0a9e88ad7ddeb340d3ff6387af9e3d10c387ca0a2 | MATLAB | 940 | 43 | function GE_dumpHeader(IFileName, OutFile)
%
% GE_dumpHeader(IFileName,OutFile)
% Dumps much of the header from a GE lx2 or 5.X file to
% OutFile. If OutFile is not specified, the output goes
% to stdout.
%
% Souheil J. Inati, PhD
% Dartmouth College
% May 2000
% souheil.inati@dartmouth.edu
%
%%%% Call GE_readHeader ... |
993f03428c6ba2123993dbda2f8edacbf56f93e915068dd03a119776bdfe4eb5 | MATLAB | 940 | 30 | function osp_pop_specsOvPlot_Call(src,~,gui)
%% osp_pop_specsOvPlot_Call
% This function is triggered when the spectra overview choice popup menu is changed. It refreshes
% the figure.
%
%
% USAGE:
% osp_pop_specsOvPlot_Call(src,~,gui);
%
% INPUT: src = handle of the fit tabs
% gui = ... |
07de7fc4d29bce6bfe31e4992a29e84321f36a35832e32e81ab77243f5868087 | MATLAB | 941 | 47 | %% object = getLargestObject(bw,conn)
%
% Input
% --------------
% bw : binary mask contains objects
% conn : number of connected component required
%
% Output
% --------------
% object : mask of the largest object
%
% Description: get the largest connected object from binary mask
%
% Kwok-sh... |
e52198f2edcc869bb257524710eb828c15e516a0c34a1ad2c2f79dba18792b36 | MATLAB | 941 | 41 | function X = redo_scaling(X_scal,param)
% redo scaling (from scaled data to original data)
%
% INPUT
% X_scal: pretreated data matrix (samples x variables)
% param: output data structure from data_pretreatment routine
%
% OUTPUT
% X: data matrix (samples x variables)
%
% version 1.0 - september 2009
% Davi... |
f50d071b8a22bfb5ce32593a072ace63dd3283dd81a9d3e229ec0a1825c5f169 | MATLAB | 942 | 45 | function [C,has_unlabeled] = make_confusion(out_img,truth_img,n_class)
%function [C,has_unlabeled] = make_confusion(out_img,truth_img,n_class)
%
% make a confusion matrix, treat nan and zero as extra unlabeled class
%
% 10/31/2012 - Taylor C. Glenn - tcg@cise.ufl.edu
has_unlabeled = false;
if or(any(isnan(out_img(:))... |
3ef8b8fcc0266cbf33e939cf2b6e0affc3a8acfead1d504cac69518166ee237e | MATLAB | 943 | 27 | function pstruct = tapas_hgf_ar1_namep(pvec)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General Public
% Licence (G... |
47d677909c4558b024f205f73d038ccc939ffdb73c39597e3b7b563c6ad133a7 | MATLAB | 943 | 29 | function f = resamplingindices(x,y,n)
% function f = resamplingindices(x,y,n)
%
% <x> is the beginning index (integer)
% <y> is the ending index (integer). <y> must be >= <x>.
% <n> is
% A means the number of indices desired (positive integer)
% -B means upsample by a factor of B (positive number)
%
% treat <x> an... |
611cf6677f592eaa40a2149af8f96a657c7c68a71f4ca966d7900013fa007a3b | MATLAB | 943 | 19 | function params = changeDir_outputResults(params, dir_outputResults)
% changes paths of output results to a new directory specified in dir_outputResults
% rewrites: params.storage.dir_results
% the dir_outputResults does not include the outName (nasme of the output
% directory), just the root directory
% for example: ... |
e074ddf1320cfe17cab343337bec5e6e388207aa0814e9797394816ae6862952 | MATLAB | 943 | 33 | function f = prepFigure(ops,fignum,varargin)
%helper function to make creation of figures easier
%handles visibility, figure number, and lists of figures.
%this is just a lot of code to keep writing
if isfield(ops,'fignum')
assert( ~isempty(fignum) | fignum~=0 ,...
'figure numb... |
02556df8ba73dbf3fb0313cd11a12f9983fddf5405f147eb9455f8cef37e05d5 | MATLAB | 944 | 38 | function out = defToColor(d, nrm)
% FORMAT c = defToColor(d)
% d - categorical (4D) image.
%
% Generate an RGB volume from a displacement (e.g. initial velocity)
% volume.
d = d();
if nargin < 2 || ~isfinite(nrm)
nrm = max(max(max(sum(d.^2, 4)))); % normalising constant
end
% Create HSV
... |
6a1483fdb3702eef6e03f147115968ac3e5d8c0eb91fc18bd8cba92804e10222 | MATLAB | 944 | 26 | function varargout = covPPard(v,varargin)
% Wrapper for Piecewise Polyonomial covariance function covPP.m.
%
% Piecewise Polynomial covariance function with compact support, v = 0,1,2,3.
% The covariance functions are 2v times contin. diff'ble and the corresponding
% processes are hence v times mean-square diffble. T... |
fca77446560b3ba57652e4fd80d1aac7e9dcf418bcaabb56fdfef1ce3980e3a4 | MATLAB | 944 | 34 | function res = fit_models_binned(D_list, cfg)
% FIT_MODELS_BINNED Run models within myelin bins (quantiles by default)
res = struct();
for li = 1:numel(D_list)
D = D_list{li};
levelName = util.get_level_name(D, 'fit_models');
my = D.(cfg.col_myelin);
nb = cfg.myelin_num_bins;
edges = quantile(my... |
ddd90c7ca89b258128849a9481fa83bf03249d5044ad3a994c2dc4dfd4bdf4b7 | MATLAB | 945 | 36 | function [RPEbins_density, RPEbins_equallyspaced] =...
get_RPEbins(RPEs_rats, numbins)
%Use mixed blocks and violations only
%input
%numbins: number of bins to sort all RPEs into
numbins_vector = linspace(1,numbins,numbins);
RPEacrossrats = cell2mat(RPEs_rats);
fractions = numbins_vector/numbins;
%% get ... |
7342a94d8e917dbf17c10a74a15f5da60928d8a5ed097ab0ddb0e59a35a11602 | MATLAB | 947 | 30 | function osp_pop_distrOvMetab_Call(src,~,gui)
%% osp_pop_distrOvMetab_Call
% This function is triggered when the distribution metabolite popup menu is changed. It refreshes
% the figure.
%
%
% USAGE:
% osp_pop_distrOvMetab_Call(src,~,gui);
%
% INPUT: src = handle of the fit tabs
% gui ... |
77f7845adaec71e4f60cac83f420665ee767779f35d8698d8bd6eba55de2c146 | MATLAB | 947 | 27 | %{
quality.Spikes (computed) #
-> preprocess.Spikes
---
leading_nans : tinyint # whether or not any of the traces has leading nans
trailing_nans : tinyint # whether or not any of the traces has trailing nans
stimulus_nans : tinyint ... |
8da65349667f6ad4b0554ae45a8de54c67299c867d2d81d311878747965a6b7b | MATLAB | 947 | 33 | function generatePatchInfo(suvr_dir, label_dir, output_dir, subject_id)
%%
% generate patch information from SUVR and Reeb graph patches
%
% Inputs:
% suvr_dir: the path of SUVR data
% label_dir: the path of Reeb graph
% output_dir: output directory of the patch information
% subject_id
%%
fid = fo... |
17db325d2a070a7aba785fe76079de3d0a67e1ac9ab1baf7e02d248bacb64d87 | MATLAB | 948 | 25 | function candoit = canGetPartialGradient(problem)
% Checks whether the partial gradient can be computed for a given problem.
%
% function candoit = canGetPartialGradient(problem)
%
% Returns true if the partial gradient of the cost function can be computed
% given the problem description, false otherwise.
%
% See also... |
8c6cfc9dc7a0c3e3d56cf589d297dd8e87f8e9cb9e8ccba79eecf6dec48d09e3 | MATLAB | 948 | 25 |
function [mov, nframe] = readBinMov(fileName, nrow, ncol)
% [mov nframe] = readBinMov(fileName, nrow, ncol)
% If only one input: mov = readBinMov(fileName, nrow, ncol)
% The output, mov, is a 3-D array or unsigned 16-bit integers
% The binary input file is assumed to be written by Labview from a
% Hamamatsu .dcimg fi... |
be40fb3f583a792df9d9bf8b4bf7687b6def5a756bcbbfad2a73d0170c6b9376 | MATLAB | 949 | 35 | function faceGrad = gradientTerm2D(phi)
% this function calculates the gradient of a variable in x and y direction
% it checks for the availability of the ghost variables and use them, otherwise
% estimate them, assuming a zero gradient on the boundaries
%
% SYNOPSIS:
% faceGrad = gradientTerm2D(phi)
%
% PARAMETERS:
... |
43b7863ace4d4fda1f52b52ec3e1c05c95ea9d18250ed4c3f500bb2a318bbe66 | MATLAB | 950 | 26 | function [lp,dlp]=priorLogNormal(mu,s2,x)
% Univariate Log-normal hyperparameter prior distribution.
% Compute log-likelihood and its derivative or draw a random sample.
% The prior distribution is parameterized as:
%
% p(x) = exp(-(log(x)-mu)^2/(2*s2)) / (sqrt(2*pi*s2)*x)
%
% where mu(1x1) is the log scale paramete... |
114eb8d37b8062d00dbaeaf40021e7e868e6d1137167617e36746ce262304672 | MATLAB | 951 | 44 | function [vectorIndex, EnergyIndex] = mfunc_VectorIndex(vectorList)
% Calculate vector index
%
% So as to speed up calculation, get the vector index
% from binary of vector value.
%
% Example: vectorList = mfunc_VectorList(3)'
% -1 -1 -1
% 1 -1 -1
% -1 1 -1
% -1 -1 1... |
92d1e3f4fc56d45c6f2b2ba67e06db20727a0fb2dc150d6f4530157b2b628186 | MATLAB | 951 | 42 | function J = costaccfun_misbind_itemdistance(param,x,y,td,usepriors)
if nargin < 5
usepriors = false;
end
mu = 0;
sigma = param(1);
lapse = param(2);
msbnd = param(3);
itmdst= param(4);
if length(param)==5
sigma2 = param(5);
else
sigma2 = sigma;
end
if usepriors
%for Lapse rate: Beta distribution
... |
a80b0b2bfc4e3c1ee403ab75289f283c09e53f938c34ff77475da07584de8190 | MATLAB | 951 | 35 | function outputImage = imag(this, varargin)
% Computes imaginary part image for complex image
%
% Y = MrImage();
% imagY = Y.imag()
% imagY = imag(Y);
%
%
% This is a method of class MrImage.
%
% IN
%
% OUT
% outputImage imaginary part image
%
% EXAMPLE
% imagY = imag(Y)
%
% See also MrIma... |
a7bbb9d0ec9019b3928b779d280b16ca06a4f6d333080fb76cb61ac87971b883 | MATLAB | 952 | 35 | function this = smooth(this)
% Smoothes all images in the time series
%
% MrSeries = smooth(MrSeries)
%
% This is a method of class MrSeries.
%
% IN
% parameters.smooth.fwhmMillimeter
%
% OUT
%
% EXAMPLE
% smooth
%
% See also MrSeries
% Author: Saskia Klein & Lars Kasper
% Created: 2014-07-02
% Copyright (C... |
aed7f8077627d5f8d10e81899752ac32af8d382a785912d198a2f5ff8219e605 | MATLAB | 952 | 33 | function osp_MRSImapListChangedFcn(src,~,gui)
%% osp_SelectionChangedFcn
% This function is triggered when the main tab is changed. It refreshes
% the figure.
%
%
% USAGE:
% osp_SelectionChangedFcn(src,~,gui);
%
% INPUT: src = handle of the fit tabs
% gui = gui class containing all ha... |
e0ce18bd1ca4230a3f667e260897f10d31b6d4ec20e2fb8f9f7307157a6d683a | MATLAB | 952 | 24 | function u = tapas_datagen_categorical
% This function generates categorical input data for the hgf_categorical model
%
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2015 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, wh... |
35c497ff67846ff2d20e027b927a1187993b95b9d4e9a768c0fdce3b98233b06 | MATLAB | 953 | 25 | function wv_ccg(rez,i)
Spike_id = find(rez.st(:,end)==i);
SpikePETH_M = rez.PETH(:,i);
Nchan = length(cell2mat(rez.Merge_cluster(i,5)));
h=figure;
movegui(h,'south');
subplot(1+ceil(Nchan/4),4,[1,2,3,4])
bar(-50:1:48,SpikePETH_M(1:99,1))
title(['PETH of cluster:',num2str(i),' wi... |
d09296230a9d7e70396fcecb092c386e0ce7757ca2ec161f7057676a244db13b | MATLAB | 954 | 40 | function [U,S,V] = svdsecon(X,k)
% Input:
% X : m x n matrix
% k : extracts the first k singular values
%
% Output:
% X = U*S*V' approximately (up to k)
%
% Description:
% Does equivalent to svds(X,k) but faster
% Requires that k < min(m,n) where [m,n] = size(X)
% This function is useful if k is much smaller than m and... |
6784fd0838968af39db5e1fa469b60d373fd32be87cd92ac64bea878f1640b49 | MATLAB | 955 | 32 | function this = set_from_geometry4D(this, geometry)
% initializes dimInfo from MrImageGeometry (nifti etc) with standard labels
%
% Y = MrDimInfo()
% Y.set_from_geometry4D(geometry)
%
% This is a method of class MrDimInfo.
%
% IN
% geometry MrImageGeometry (4D nifti...)
%
% OUT
%
% EXAMPLE
% set_from_geometr... |
d4bb5276c56a944e73bf3257ac7104941d837dc57697ea55116f7c431f3ad7f6 | MATLAB | 955 | 34 | function interactiveConductance2D(fa, dims, potentials, mask_index)
% Interactive conductance map from 2D data
%
% Author: Aina Frau-Pascual
mnx = prod(dims);
% Conductance map
figure(101); image(fa','CDataMapping','scaled'); colorbar;
title('FA of the image')
% Interactive conductance map
for i=1:100
figure(101... |
02a1ef5b6a3b1fbc5420d1916b6e91a671a42c578bafa60c99db876f2d4986ea | MATLAB | 956 | 33 | function [rsc_pdf, edges] = get_rsc_pdf(spktr, bin_width)
% GET_RSC_PDF
% Syntax:
% [rsc_pdf, edges] = get_rsc_pdf(spktr)
% [rsc_pdf, edges] = get_rsc_pdf(spktr, bin_width)
% Description:
% Return the probability density of pairwise correlations across neurons.
% Inputs:
% spktr : [N x T] spike-count matrix... |
353ad4e3cc45d6ecedeb2ad70a45ec7966d1e9a5cb7eb5189a6c3f898dedb7d9 | MATLAB | 957 | 28 | function proj_auc = cal_proj_auc_random_dist_2sides(env1_data, env2_data, num_permutation)
% envX_data: features X cells/voxels
n_features = length(env1_data(:, 1));
num_cells = length(env1_data(1, :));
% env1
env1_data = env1_data - repmat(mean(env1_data),n_features,1); % substract the mean over condition
[U1,S1,~]... |
9eee6d17d964c40b87e08634e96808da0ebf587684f3907a49153d23adcb45f3 | MATLAB | 957 | 27 | function pstruct = tapas_ehgf_ar1_binary_namep(pvec)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2012-2020 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General Public
% Li... |
df70eb1e03de708f4391f0fbe4805a13d209d74f842c0cd797d743b75d259d8b | MATLAB | 957 | 29 | function tpr = tpReader( obj )
import vis2p.*
assert( length(obj)==1 );
[path,name] = fetch1( Experiments*obj, 'directory','file_name' );
scan_prog = fetch1(obj,'scan_prog');
if strcmp(scan_prog,'MPScan')
filename = getLocalPath([path '/' name 'p%u.h5']);
tpr = tpReader( filename );
elseif strcmp(scan_prog,'... |
eaa43af85d4709e9af2b8637f8a945e67340fea643533ead9847115699ab489d | MATLAB | 957 | 37 | %% sepia_read_popup_value(config_txt, str_pattern, action_handle, popup_list)
%
% Input
% --------------
% config_txt : variable contains config text
% str_pattern : string pattern to be printed after algorParam parameter
% action_handle : handle of the GUI popup
% popup_list : popup list, in cell
%
% Descripti... |
fe1fad53e5e0773dbff58d1dd19625b7d9ef5f5098946e409dbc84e53b57d900 | MATLAB | 957 | 34 | function outputImage = flipud(this)
% Flips all slices Up-Down; mimicks flipud in matlab functionality
%
% Y = MrImage()
% Y.flipud(K)
%
% This is a method of class MrImage.
%
% IN
%
% OUT
% this MrImage where data matrix is flipped and header is updated to
% reflect that change
%
% EXAMPLE
% Y = M... |
17a6cae0101c06e1ab429cb1be74e7b7f0cbe5fd49d0d80c9d1cf70cde5bd515 | MATLAB | 958 | 41 | function RemoveFromLegend(h)
%RemoveFromLegend - Remove graphic objects from axis legend
%
% USAGE
%
% RemoveFromLegend(h,fig)
%
% h handle(s) to graphic object(s)
% Copyright (C) 2025 by Pietro Bozzo
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of ... |
fd03e4cad5d11c35edb193d39c88f0bbed72cfc0975cde5599da97d2c0a642d8 | MATLAB | 958 | 39 | function [] = graphgen_PAIRS(pairs,pairs_ref,meanvals_dat,meanvals)
%plots angle distributions and visualizes PAIRS statistic
%
%
%written by dlh Oct. 2021
figure(8)
clf
histogram(pairs_ref,100,'Normalization','probability')
CI_95 = 1.95*std(pairs_ref);
vline(mean(pairs_ref)+CI_95,'k')
vline(mean(pairs_ref)-CI_95,'k'... |
a2b997366bb081db2c81dc327e04fe4d7cdfcbc0df7b8d2721b4d1133d563808 | MATLAB | 959 | 28 | function count = CountInOverlappingIntervals(spikes,intervals)
% If you call CountInIntervals with overlapping intervals, a spike already
% counted in the first interval will not be counted again in the next
% (overlapping) interval.
% To prevent this behavior and count the same spike in as many intervals as
% it appe... |
bd7fb834679235436d6a4979c12ce7a16ab124fa95c90f36b333ccbf9572b1e4 | MATLAB | 959 | 34 | function positions = LoadPositions(filename,rate)
%LoadPositions - Read positions from file.
%
% USAGE
%
% positions = LoadPositions(filename,rate)
%
% filename position file name
% rate optional sampling rate (if timestamps are not
% provided in the file)
% ... |
be70a430835f42652e99711b981d1db66463890ff047cf10ef57ab4a90749b2b | MATLAB | 960 | 38 | function [EIGV, AA] = fitDynamics_modes(input, stflk, endtflk, stresp, endtresp, samples, PCs)
EIGV = cell(size(input));
AA = cell(size(input)); % <-- nuovo output
for ii = 1:numel(input)
x = input{ii};
if ii == 1
st = stflk;
endt = endtflk;
else
st = stresp;
... |
d285318c5d71810e00cecc86a4c458673dd886c58ca3d4d18e7e422d04d57f15 | MATLAB | 960 | 35 | function isDataReal = isreal(this)
% Checks whether all data elements in image are real
%
% Y = MrImage();
% isDataReal = isreal(Y)
%
%
% This is a method of class MrImage.
%
% IN
%
% OUT
% isDataReal true, if all elements in MrImage.data are real
% false, otherwise (i.e. com... |
1cc12151bb045c2e59ada1090f6b756d94566d6ee07e3be944be4b44b7c8ec07 | MATLAB | 961 | 35 | function outputImage = conj(this, varargin)
% Computes complex conjugate value per image pixel
%
% Y = MrImage();
% conjY = Y.conj()
% conjY = conj(Y);
%
%
% This is a method of class MrImage.
%
% IN
%
% OUT
% outputImage complex conjugate value image
%
% EXAMPLE
% conjY = conj(Y)
%
% See ... |
8d28721af41fa1533c6bbf45ffa205a2f32d3c81fdb3299ea00fcef1c650211a | MATLAB | 961 | 44 | function [Dmat,mumat,S] = clustdist(fet,labs)
%calculate mahlanobis distances of points in feature space to cluster distributions
nclust = numel(unique(labs));
[nn,nx] = size(fet); %number samples, number of features
S = zeros(nclust,nx,nx); %cluster covariance
mumat = zeros(nclust,nx); %cluster means
Dmat = zeros(n... |
9c949ff512d6ce26a7c7e5aef3035e807266eff186e4a790a703de193b393ced | MATLAB | 961 | 25 | function SaveFigures(axes_handles)
% Saves the figure on the 'axes_handles' axes and opens a dialog box for
% choosing the place to save
% 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/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.