sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
823c9f3016f1257d3222f9a4eb19975d2bf639a8dc97a2199a5881fdcd9bb8a2 | MATLAB | 2,331 | 69 | function O_trans=make_init_grid(Spacing,sizeI,M)
% This function creates a uniform 2d or 3D b-spline control grid
% O=make_init_grid(Spacing,sizeI,M)
%
% inputs,
% Spacing: Spacing of the b-spline grid knot vector
% sizeI: vector with the sizes of the image which will be transformed
% M : The (inverse... |
df20a24bf0a9bd0beef99158ad47bf3b2bd68c23ff9f3242fb094ccf65f1d650 | MATLAB | 2,332 | 77 | %% Gauss Imputation Demo using Gibbs
%
%%
% This file is from pmtk3.googlecode.com
function gaussImputationGibbsDemo()
setSeed(0);
d = 10;
mu = randn(d,1); Sigma = randpd(d);
% Training data is larger than test data, and is missing data at random
[XfullTrain, XmissTrain] = mkData(mu, Sigma, 100, true);
% Test dat... |
b727ced5d31e7239aa8dfe7d790225cb3e8ef2769dd3c077dcb7a562037b6a9e | MATLAB | 2,333 | 73 | function [model, loglikTrace] = gaussMissingFitICM(data, varargin)
% Perform imputation using the ICM algorithm -- plugging in posterior mode
% data is an n*d design matrix with NaN values
% Optional arguments and their defaults:
% maxIter [100] - when to stop the ICM algorithm
% tol [1e-4] - convergence tolerance for... |
d60dad3e4f8abb930629ea25c13f8f1e0dd3b2381f7f770cdbb37f631f2c806a | MATLAB | 2,333 | 95 | % logregGradeResiduals
%[X, y, bs, perm] = logregGradeMH();
[X, y, bs] = logregSatMhDemo(0);
perm = sortidx(X(:, 2), 'ascend');
SATscores = X(:,2);
%[X,y] = satDataLoad;
N = length(perm);
figure;
% posterior predictive residuals A&J p97
for ii=1:N
i = perm(ii);
p1s = 1 ./ (1+exp(-X(i,:)*bs')); % p1s(s) = p(y=1|... |
d832d0a037e9cef99011b9d89aa19e54a586b67ba586eea23b4bcf5402488447 | MATLAB | 2,333 | 59 | function [varargout] = isfile(varargin)
%ISFILE Determine if the input points to a file
% TF = ISFILE(INPUT) returns true if INPUT points to a file and false otherwise.
%
% This is a compatibility function that should only be added to the path on
% MATLAB versions prior to R2017b. Note that currently this function o... |
6d9dc10671475420da585f832ec30051978127e3ecb884523fa70a2133e4037f | MATLAB | 2,334 | 110 | function [opt,sigma,out] = VBA_GaussNewton(fname,init,options)
% Gauss-Newton maximization scheme
% Get default options
try
args = options.args;
catch
nargs = nargin(fname)-1;
args = cell(nargs,1);
end
try
maxIter = options.GnMaxIter;
catch
maxIter = 32;
end
try
rdI = options.GnTolFun;
catch
... |
61f61c960eaf4f315d66f250a26c6615b2f8a6debaddebebd59c32d47a28c263 | MATLAB | 2,335 | 50 | function [params,ro_blocks] = prepare_fix_parameters(params)
params.gen.del_k = (1./params.gen.fov);
if params.gen.ro_type == 's'; params.gen.del_k(1:2) = params.gen.del_k(1:2).*params.spi.rxy; end
if params.gen.ro_type == 'c'; params.spi.interl = 1; end
if params.gen.ro_type == 'c'; params.gen.del_k(2... |
8791707a19a0d08dccfe0a5d12d5e5fa4ad6ba2468e8797f143142444e9e3fb2 | MATLAB | 2,335 | 99 |
% When queries are not in topogical order
% problems may arise...
% This file is from pmtk3.googlecode.com
setSeed(0);
G = zeros(2,2);
%C = 1; S = 2;
C = 2; S = 1;
G(C, S) = 1;
nstates = [2 2];
CPDs = mkRndTabularCpds(G, nstates);
dgm = dgmCreate(G, CPDs, 'infEngine', 'jtree');
clear fac
fac{C} = tabularFa... |
b345ce517296754c4d268bda1dd6cf366f6d8134c61d02fa3196c36106c96e22 | MATLAB | 2,335 | 57 | function opts=Config_FormatDecodeDynamic(GlobalOpts,varargin);
%% Arguements for wrapping function
% opts.Dates={'20150413' '20150415','20150424'}; Note that 20150415 has
% only 7 NoGo trials
opts=GlobalOpts;
opts.PlotShuffle=0;
[varargin,opts.Dates] = Utilities.ProcVarargin(varargin,'Dates',{opts.Dates});
... |
ee9fc1d8bdf6252bedade54b48b1e5a4717f98045eac7760f9d63139c6c51859 | MATLAB | 2,335 | 99 | function showfield_general(z,loc,pars);
% makes plots of potentials on head
% usage showfield_general(z,loc,pars);
% displays fields/potentials specified by z
% in channels at locations specified in locs as a contour-plot
%
% pars is optional
% pars.scale sets the scale of the color map. Either a 1x2 vector
% ... |
049ecb75327d51a5d3b80c0e7c29827ee628af85b031b1f8fd3a9897e11054fc | MATLAB | 2,337 | 68 | function convolved = myconvn(stack, filter)
% convn with periodic bcs
%
% myconvn(stack,filter)
%---------------------------------------------------------------------
% license
%---------------------------------------------------------------------
% Copyright 2015 Idse Heemskerk and Se... |
1faa5370b72d53057cfe1386dc1db75d488021ec3c5617df7af945573af7c71d | MATLAB | 2,337 | 68 | %% Matrix Triangle Up/Down Sum
% Computes the sum of the absolute values of the upper and lower matrix
% triangles (Off-diagonal elements) for each matrix column. Then takes sum
% over all columns.
%
% If matrix is 3D, assume dimensions 1 and 2 comprise the square matrix,
% and iterate over every XY page, indexe... |
3e92f0259955ea8d637bc7e9ef940ccb80a618a0834214e68aadda24cb6d78bb | MATLAB | 2,337 | 89 | %
% _ _
% ___ _ __ __ _| |__ ___ ___ _ __| |_
% / __| '__/ _` | '_ \/ __|/ _ \| '__| __|
% | (__| | | (_| | |_) \__ \ (_) | | | |_
% \___|_| \__,_|_.__/|___/\___/|_| \__|
%
% populates the data_to_reduce property of crabsort
% using the options on hand
function getD... |
0b948b5b1b1a4f6a8566e10d7c60788e1695fdf8224a19a5806d39f851a6731c | MATLAB | 2,338 | 69 | function Pd = getPrecon(problem, x, d, storedb, key)
% Applies the preconditioner for the Hessian of the cost at x along d.
%
% function Pd = getPrecon(problem, x, d)
% function Pd = getPrecon(problem, x, d, storedb)
% function Pd = getPrecon(problem, x, d, storedb, key)
%
% Returns as Pd the result of applying ... |
22406cd9636d06b1aa8b1f5c74c27c0a3a81e8af7e62611dbcbb7eabdc41aecd | MATLAB | 2,338 | 80 | function [mappedX, mapping] = lda(X, labels, no_dims)
%LDA Perform the LDA algorithm
%
% [mappedX, mapping] = lda(X, labels, no_dims)
%
% The function runs LDA on a set of datapoints X. The variable
% no_dims sets the number of dimensions of the feature points in the
% embedded feature space (no_dims >= 1, default =... |
6322ebc9d51dff0cf2aa2dce52cd2da88b71343b40d794e1925d323ccc38653a | MATLAB | 2,338 | 60 | classdef Matrixlayout < Abstractlayout
%% Create a specialized layout to display a grid in matlab matrix order
% i.e. [1 4 7
% 2 5 8
% 3 6 9];
%%
% This file is from pmtk3.googlecode.com
properties
xmin; % The left most point on the graph axis in data units
xmax; ... |
7f7d107d065182a480f0c38da4d1792b9fc644d6e3614fa3a760480044d49670 | MATLAB | 2,338 | 31 | clear;clc;close all
ROOTPATH = strcat(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 4), "Data\Processed Data\");
cd(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 2))
protStr = "Active duration";
temp = NoveltySU.utils.dirItem(strcat(ROOTPATH, protStr), "spkData.mat");
popRes = cell2mat(cellfun(@(x)... |
22205ab394b6c56ec5179516b069e4cdae8f101387455b4a6cc5e2ab13f49141 | MATLAB | 2,339 | 84 | %USER_STRING Get/set a user specific string
%
% Examples:
% string = user_string(string_name)
% saved = user_string(string_name, new_string)
%
% Function to get and set a string in a system or user specific file. This
% enables, for example, system specific paths to binaries to be saved.
%
% IN:
% string_name - ... |
5e77432d78f187579d304326b5df9cbc1920553d13defb35afc587c43cad030c | MATLAB | 2,339 | 75 | function plot_voxels_brain(COREG_path, IDIF_path, anatomy1, anatomy2)
%Transforming MNI
coreg_matrix = convertpath2lnx(fullfile(COREG_path,'coreg_flirt.mat'));
MNI_brain_path = '/nfsd/biopetmri4/Projects/lavori_PET/IDIF_extraction_tool/Test_tool/Template_OLD/MNI152_T1_1mm_brain_extended.nii.gz';
MNI_head_path = '/n... |
93bd3f7e35cd287d0c0f4380b513cb98723937c85bf921b0f67fa7eaf8996c1c | MATLAB | 2,339 | 77 | function a = gmmactiv(mix, x)
%GMMACTIV Computes the activations of a Gaussian mixture model.
%
% Description
% This function computes the activations A (i.e. the probability
% P(X|J) of the data conditioned on each component density) for a
% Gaussian mixture model. For the PPCA model, each activation is the
% condi... |
305e740a06977bd53622cc55f462b68479539560f42d9b17ec948333f377baa9 | MATLAB | 2,340 | 67 | function [G,Signal,SignalAtt] = GwaveAttenuation(opt,GwaveInit,Gwave,n,PathwaySignal,E1,GwaveBlock,dt,MSD,GwaveFirstOrder)
%%
%Define spacing of gradient elements
Spacing=floor(length(GwaveInit)/max(abs(Gwave)));
%%
%Determine number of longitudinal periods
nLongPeriods=sum(diff(abs(Gwave))-1);
%Identify starting point... |
47bf8229b0e1259c2268d25a632e5766080491ea594c90185f0d587b74f57b8e | MATLAB | 2,340 | 46 | % LINE FITTING
% Find best-fit-line using radon transform.
% The output will be a 'R' matrix where each column is the radon transform per degree.
% and 'XP', which are the radian coordinates along the x axis.
% Loads 'decoded_replay_events'
% Adds line fit score for each replay event to a new column in replay_... |
55670ccd0ad6a6d643404819611e376e3b274599c9cba0e3b90b431d9528a899 | MATLAB | 2,340 | 78 | function generateModelLists()
%% Make the model list html pages
% This looks for PMTKdefn tags in model constructors.
%PMTKneedsMatlab
%%
% This file is from pmtk3.googlecode.com
error('deprecated')% KPM 25 Oct 2010
% this function generates an html table listing
% the name of every model within a given super-class,
... |
728700090dd1cce1ce72366906877ed1993c84fe8c5b6a9b06ebd00b3f6c3065 | MATLAB | 2,340 | 94 | function mscmd_whiten(input_path,output_path,opts)
%MSCMD_WHITEN - Channel-whiten an array of raw or preprocessed data
%
%This is a wrapper to the command-line mountainsort procedure. It has
%similar functionality to ms_whiten.
%
% Syntax: ms_whiten(input_path,output_path,opts)
%
% Inputs:
% input_path - path to Mx... |
8e7eac2d8500d0a87344ea476ff2943ab11410183d62430d0526f57be4c023bc | MATLAB | 2,340 | 53 | function [M,O] = gradientMag( I, channel, normRad, normConst, full )
% Compute gradient magnitude and orientation at each image location.
%
% If input image has k>1 channels and channel=0, keeps gradient with
% maximum magnitude (over all channels) at each location. Otherwise if
% channel is between 1 and k computes gr... |
dec2132227c312875e672d9a20d8ed37fff19b2ea595ff1dbe2c6f4fd98f9322 | MATLAB | 2,340 | 69 | function [] = generateGenotypeKinematicsComparison(dataset,figureName)
close all
nGenotype = numel(dataset);
fs = 20;
yl = {[0 2],[0 1], [0 15],[0 15],[10 60], [10 60],[150 180],[10 30],[-4 4]};
units = {'mm','norm','mm/s','mm/s','deg','deg','deg','deg','norm'};
nObs = 8;
smoothFun = @(x) medfilt1([repmat(x(:,2),1,2) ... |
17f1c719447f97acf0705a3f5c64375c12abb3a129348babf06dc6f99ad89c84 | MATLAB | 2,341 | 56 | %channel map file location
ops.chanMap = fullfile(basepath,'chanMap.mat');
% number of channels in recording
ops.NchanTOT = 64;
% sample rate
ops.fs = 30000;
% frequency for high pass filtering (150)
ops.fshigh = 300;
% minimum firing rate on a "good" channel (0 to skip)
ops.minfr_goodchannels = 0;
% thre... |
252150f03d6bc72358c58800e4f255061db1b53236931daaa1abc1b584fa28f2 | MATLAB | 2,341 | 89 |
%% PARAMETERS
folder_path = '.\extracted\'; % Output folder.
selected_features = [1:4 6 7 9:12 28 41 42 43 45 48];
feat_names = ["Volume","Volume/nEdges","Average Curvature","Max Curvature","Compactness","Polarity","Link Density","Average Node degree","Mean Edge Length","Max Edge Length","S-Metric","Ending Nodes De... |
d495d093549cff5cac365daa10988fcbb6013a1da8679e8ddd015f5e385e4eed | MATLAB | 2,341 | 71 | %% binarizePPData
%General method for converting spiking events into a binary signal (xt)
%representation; (i.e. rounding 'continuous' measured times to discrete
%indices)
%
% INPUTS:
% 'eventTimes': {N x1 } cell. If N > 1, use each cell element as a
% new row in the resulting binArr. If passed as a vector, t... |
dc4c68fff7b52c84910ebe003c82011a8b6ec881091cac786afb7a1e1058099a | MATLAB | 2,341 | 70 | % COVARIOGRAMBRODY computes a covariogram of spike_1 and spike_2 at a
% given lag
%
% to compile enter the following command at the MATLAB Command Window
% >> mex('covariogramBrody.c')
%
% MATLAB equivalent to covariogramBrody.c listed below
%
% covariogramBrody.m
%
% Copyright 2008 Vanderbilt University. All right... |
e69b51fbbacefc237118ff41c3e934b9e12560c9f060dc4719a7aa815bac4e69 | MATLAB | 2,341 | 96 | %% Reproduce figure 2.2 from GP book
%
%%
% This file is from pmtk3.googlecode.com
setSeed(0);
L = 1;
xs = (-5:0.2:5)';
ns = length(xs);
keps = 1e-8;
muFn = @(x) 0*x(:).^2;
Kfn = @(x,z) 1*exp(-sq_dist(x'/L,z'/L)/2);
% plot sampled functions from the prior
figure
for i=1:3
model = struct('mu', muFn(xs), 'Sigma', ... |
efd10bb88298ba2da1165c31604e25a888e4fca88da2b8fc443872f1f218382f | MATLAB | 2,342 | 56 | function [Data_Filtered] = y_IdealFilter(Data, SamplePeriod, Band)
% FORMAT [Data_Filtered] = y_IdealFilter(Data, SamplePeriod, Band)
% Input:
% Data - 2D data matrix (nDimTimePoints * nTimeSeries)
% SamplePeriod - Sample period, i.e., 1/sample frequency. E.g., TR
% Band - The frequency ... |
f141f50c66ebfd4d6372b162e6e5fc3b7c7b02713eda65f16e44a39e84392061 | MATLAB | 2,342 | 109 | % deletes spikes of a nerve that are probably artifacts
% of another neuron on another nerve
% example
%
% crabsort.pruneSpikes('828_114_2','lvn','lgn/LG')
function pruneSpikes(self, based_on, tolerance)
arguments
self (1,1) crabsort
based_on char
tolerance (1,1) double = 5e-4
end
disp('pruning spikes...')
ass... |
fac5311465f57a7d3e4886a94706dfebfcc4baac787f41fab9796c75a5221acb | MATLAB | 2,342 | 61 | function [la, mu, dist, proj] = lmoutrn(v1, v2, v3, r)
% LMOUTRN computes the la/mu parameters of a point projected to triangles
%
% Use as
% [la, mu, dist, proj] = lmoutrn(v1, v2, v3, r)
% where v1, v2 and v3 are Nx3 matrices with vertex positions of the triangles,
% and r is the point that is projected onto the p... |
e7eda0ff07c0bedb84766c052d604f6bc1a4b2fe3f713a974a6c571cbcf81929 | MATLAB | 2,343 | 62 | function [model, mappedX] = train_deep_autoenc(X, layers, lambda)
%TRAIN_DEEP_AUTOENC Trains a deep feedforward autoencoder on X
%
% [model, mappedX] = train_deep_autoenc(X, layers, lambda)
%
% The function trains a deep feedforward autoencoder on
% the specified X and labels. The variable X should be a Nx1 cell
% ar... |
fd9aa8bccf97ba2ef71cb72372f34733d99e1ab99e9d77c535671ce9b7b91560 | MATLAB | 2,343 | 84 | function [model, path] = linregFitPathCv(X, y, varargin)
% Fit a regularization path for linear regression model
% using L1 or L2 regularizer and then pick best model.
% Also return params on the path.
% (This is a wrapper to the glmnet package.)
% INPUTS
% X ... N*D design matrix
% y ... N*1 ... |
53ed46667048917c47198fd619ca192a384ac1a2e3baecea687db7946f03bff2 | MATLAB | 2,344 | 81 |
%%
[varargin,rescale] = Utilities.ProcVarargin(pltFCNArgs,'rescale',0);
% typeID={'DecodeTest_corrNM'};
%
% cvAccuracy=DataConvert.embCell2mat(Analyze.returnFieldValues(PlotData,typeID{decodeType}));
%
% FigHandels(1)=plt.fig('units','inches','width',8,'height',8,'font','Arial','fontsize',12);
%
% im... |
8d57b69ae1836952e5753ed94e00ce3059ba4f94f75697f6f2cf040543559967 | MATLAB | 2,344 | 105 | %% Figure 1 from Figueiredo'07, "Gradient projection for sparse reconstruction"
% PMTKauthor Figueiredo
% PMTKurl http://www.lx.it.pt/~mtf/GPSR/
% PMTKmodified Kevin Murphy
% PMTKslow
%%
% This file is from pmtk3.googlecode.com
setSeed(0);
% n is the original signal length
n = 2^12;
% k is number of observations to... |
22db4573ec88e7931cda94053a1c58bff4270fdcb318c9e99b2caba8ceba9b64 | MATLAB | 2,345 | 83 | %% Image denoising using Ising prior and Gibbs sampling or mean field
% This file is from pmtk3.googlecode.com
%%
function isingImageDenoiseDemo()
%% Generate Data
% input matrix consisting of letter A. The body of letter A is made of 1's
% while the background is made of -1's.
setSeed(0);
sigma = 2; % noise level... |
5f70d061c594032df76b5d22fbb207d8a248567985000154eeae709402d072db | MATLAB | 2,345 | 58 | % Example 1
%
%
% Citation: Cannavo' F., Sensitivity analysis for volcanic source modeling quality assessment and model selection, Computers & Geosciences, Vol. 44, July 2012, Pages 52-59, ISSN 0098-3004, http://dx.doi.org/10.1016/j.cageo.2012.03.008.
clear
clc
% create a new project
pro = pro_Create();
% add 5 i... |
761eaebdd6166eefdd250df1a92f783e8133ff2f1dcabd875b0d786bc215fbd3 | MATLAB | 2,345 | 55 | classdef GatingMl
methods(Static)
function fullFile=GetFile(epp)
argued=epp.args.gating_ml_file;
[gatingMlFolder, f, ext]=fileparts(argued);
if isempty(gatingMlFolder)
fullFile=fullfile(epp.folder, [f ext]);
else
gatingMlFolder=... |
082af68acf4d8caf80d28dcf94a264332858e84bea62b9791f5b48cc3c197583 | MATLAB | 2,346 | 51 | %Step 3 of CBIG Kong2019 Brain Parc Pipeline
%
%To run: 1. Open Matlab using salloc (ex: `salloc --mem-per-cpu 6G --time 2:00:00 --x11`)
% 2. source your config file containing the $CBIG_CODE_DIR variable
% 3. `cd` to the $CBIG_CODE_DIR/stable_projects/brain_parcellation/Kong2019_MSHBM/step3... folder
% 4. `cp` thi... |
55a092048ea32d85b07e084ede383ee7a6b78c5c364960518d7c24c00826705b | MATLAB | 2,346 | 63 | % TSSESSIONSTAT Compute within-session statistics.
% TSSESSIONSTAT(STATNAME,FUNHAND,VARARGIN) creates a stat called STATNAME
% that is determined by running the function FUNHAND (passed in as a
% function handle) on the current session data (usually TSData) and the
% remaining arguments given in VARARGIN.
%
... |
866d56a1f6226a8d366331be3873ba083241f51a9efe850e95d36bc7a67862e4 | MATLAB | 2,347 | 68 | function r=renyi(tfr,t,f,alpha);
%RENYI Measure Renyi information.
% R=RENYI(TFR,T,F,ALPHA) measures the Renyi information relative
% to a 2-D density function TFR (which can be eventually a TF
% representation).
%
% TFR : (M,N) 2-D density function (or mass function). Eventually
% TFR can be a time-frequency rep... |
a1a774a9092a185c8ec1b98e3513c2e127eee071328dcbababb622d174eb4a06 | MATLAB | 2,347 | 73 | function [nCellsSCE,SCEindex,SCE_logic,nSpikes_SCE,SCEthresh,spikenums_binned,SCEfreq] = defSCEs(spikenums,si_img,minDistSCEs,binning,rasterOptions)
%% >>> OPERATION >>>
% Defines SCEs in spike raster. 1000 surrogates matrix of synchronous events
% is generated. The 95th/99th percentile of each column (data point) is
%... |
c4210ab89e9f1447521444de4e1495f3b16191450a02a6919fe94c1a967bbf77 | MATLAB | 2,347 | 57 | % Plot stimulus-locked mean traces for all coherences
% meanTracesSL_Fig4
absCohs = unique(beh.dot_coh); absCohs = flip(absCohs);
dirs = unique(beh.dot_dir);
diros = [nanmean(beh.dot_dir(beh.dot_dir<180)),...
nanmean(beh.dot_dir(beh.dot_dir>180))]; dirs = diros;
chos = unique(beh.cho_trg); if length(par.d... |
cc8a82b0da8ca633f316908d1c67ae8d1ff1449665104c583df9d26915a0e697 | MATLAB | 2,347 | 70 | % COVARIOGRAMBRODY computes a covariogram of spike_1 and spike_2 at a
% given lag
%
% to compile enter the following command at the MATLAB Command Window
% >> mex('covariogramBrody.c')
%
% MATLAB equivalent to covariogramBrody.c listed below
%
% covariogramBrody.m
%
% Copyright 2008 Vanderbilt University. All right... |
df5a0e1fe0f61ced5d80c46b44bc54b9d5cbcf14ab387e2205c0c9682e449266 | MATLAB | 2,347 | 91 | function [hEllipse,X,Y] = ellipsedraw(a,b,x0,y0,phi,lineStyle,varargin)
%ELLIPSEDRAW can draw an arbitrary ellipse with given parameters.
% The properties of that ellipse plot can be customized
% by setting the ellipse handle.
%
% hEllipse = ellipsedraw(a,b,x0,y0,phi,lineStyle)
%
% Input parameters:
% ... |
fd6333076faa0188a0ab8866209dacee50173284486fa68ba8f414821d4c847e | MATLAB | 2,347 | 84 | function [xout yout] = mkWinFunc(center,width,tWidth,range,wrapping,min,max)
%-----------------------------------------
% [xout yout] = mkWinFunc(enter,width,tWidth,range,wrapping,min,max)
%
% create a flat windowing function with raised
% cosine transition boundaries, suitable for
% use with interp1
%
% center: cente... |
160ebe55070499e1d74a4cf9b653d8725a5dc39f25c0c716d286e88524603fdf | MATLAB | 2,348 | 61 | % dataset contains all the redox ratio distributions from Neurons, Glial,
% Overall generated from 3_Int_xxx steps.
Plot_name = ["R1_6hr","R2_6hr","R1_24hr","R2_24hr","R1_72hr","R2_72hr"];
RR_size = size(dataset{1},2);
RR_axis = linspace(0,1,RR_size);
Extra_RR_axis = linspace(0,1,51);
All_Data_raw_RR = [];
Gr... |
48613cd764ae000f38db4f11c15140274afa36c7cebdbde0c0ef90540269602f | MATLAB | 2,348 | 50 | for k = 1:length(Z)
clf;
z = Z(k);
% Display NIFTI slice
I = round(-z/d1d2d3(3) + N1N2N3(3)/2);
S = squeeze(VT1(end:-1:1, I, :))'; % choose the Z cross-section
S = S(:, :);
image([-DimensionY/2 +DimensionY/2], [-DimensionZ/2 +DimensionZ/2], S, 'CDataMapping', 'scaled');
colo... |
5a316bc0a1785adcccf0082fb989635bc1a487280fa76080903c17dcb43d484e | MATLAB | 2,348 | 117 | %
% Test Laplace particle FMMs in R^3
%
nsource = 2000
source = zeros(3,nsource);
idist=1;
if( idist == 1 ),
theta=rand(1,nsource)*pi;
phi=rand(1,nsource)*2*pi;
source(1,:)=.5*cos(phi).*sin(theta);
source(2,:)=.5*sin(phi).*sin(theta);
source(3,:)=.5*cos(theta);
end
if( idist == 2 ),
source(1,:)=rand(1,nsource);
s... |
69104bafdbf5be6196a2481bba553785f54344f70a9adffa224a28f51c72af94 | MATLAB | 2,348 | 107 | % This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,... |
b967219071b781ef894f73a6ef635668c3602373cb410d0184eab6decdf9d455 | MATLAB | 2,348 | 79 | function rc = simpletrain(xyLblVar,imgVar,viewIdx,trnSetVar,trnSetCol,...
prmVar,resID,varargin)
%
% OLD: tblVar: varName of table to use. mat.(tblVar) has size [Nxncols]
% xyLblVar: varName of xyLbl array. [nxnptx2x2]. row,ipt,x/y,vw
% imgVar: varName of image cell array I to use. mat.(imgVar) has size [NxNvw]
% vie... |
e2e5441a0e20555fedab660d39d921b0ed8b0df1adbb9f533b3bc9efd2184a1f | MATLAB | 2,349 | 86 | %H6 STA-Effects on Background;
%_______________________________________
% Copyright (C) 2024 Trevor S. Smith
% Drexel University College of Medicine
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Found... |
06e373e6a9fc5d45e8955f894b38fb7201adfc9ec68ca9334507a01bd90fe353 | MATLAB | 2,351 | 75 | function [varargout] = routlm(varargin)
% ROUTLM computes the projection of a point from its la/mu parameters
% these equal the "Barycentric" coordinates
%
% Use as
% [proj] = routlm(v1, v2, v3, la, mu)
% where v1, v2 and v3 are three vertices of the triangle
% Copyright (C) 2002-2009, Robert Oostenveld
%
% This fi... |
33e0d14fd143d1aae014dcd7ae7d13c4121367b8686f5d7c770125ea51f43311 | MATLAB | 2,352 | 50 | function CBIG_AuthorTopicEM_ReplicateMostTypicalOrBestSolutionWrapper
% CBIG_AuthorTopicEM_RunEMwithGibbsInitExample
%
% Wrapper function to replicate the most typical and best1 12-component solution
% Output:
% - Visualization of the most typical/best solution is saved under ./figures directory
%
% Exa... |
c55e7aafe3771e140aa29f253821bc6cd482717adf9a81bccdb07e2f950d1164 | MATLAB | 2,352 | 91 | % plot the quality of fit in each cluster center using interpolation and
% angle-based distance
%% load bem-fmm engine
clear all
restoredefaultpath;
addpath('Engine');
%% load data table
data_table = readtable('dip_4000.csv');
errors = data_table.Dist_mm;
%% load cluster data
CL = load(fullfile('data/cluster_4000... |
ce87b971b1b2d02b3973361e882cfae6fe427c829530cd54af34af7f77475c25 | MATLAB | 2,352 | 81 | function GonzalezPereyra_etal_Fig_06
load ([pwd '/Data_GonzalezPereyra_etal_Fig_06.mat']) %#ok<*LOAD>
Color_500=[238 0 0]./255;
figure;
set(gcf,'position',[2850 272 490 205],'color','w')
subplot(1,2,1)
boxplot(ToBoxPlot(:,1),ToBoxPlot(:,2),'notch','off','colors','k'); %#ok<*USENS>
h=findobj(gca,'tag','Outlie... |
ed2ce30d8a501190e2edaa3487ec6d39942743cd15365b6f1bc6128c7b576de9 | MATLAB | 2,353 | 87 | %% ------------------------------ Initialize ------------------------------
% include all functions
% summary variable
% summary = {};
% TODO: Somos centro detekcija imant sankirtą su branduoliais
% TODO: Ląstelės branduolio detekcija: branduolys turintis didžiausią sankirtos tūrį su lastele.
% name = 'P15_No1... |
fe40eb1fde9745578524b625be3b23426bc8be2b97ab853a2853f3071496bcbb | MATLAB | 2,353 | 82 | function [model, loglikTrace] = catFAfit(discreteData, ctsData, Dz, varargin)
% We can specify one or more data types:
% discreteData(n, j) in {1..data.nClass(j)}
% ctsData(n, k) in real
% Any location can be NaN, meaning missing value
%
% Dz is the number of latent factors
% nClass(j) is the number of categories for d... |
63a7db8267853b55563490960a4ff31c89a3dfe061cfdc2b6c8a6e60946bce94 | MATLAB | 2,354 | 74 | function [hdr] = read_bucn_nirshdr(filename)
% READ_BUCN_NIRSHDR reads the header information of ASCII-formatted NIRS
% data acquired with the UCL-BIRKBECK machine and postprocessed by the
% Paris group. The first line contains the channel labels and the rest of
% the file contains per line a time sample. The first co... |
f89325fa87064a0b2b64988e55fe4ebb36f4869b8f801ea94e6034169007ad5a | MATLAB | 2,354 | 77 | function c = ttv(a,v,dims)
%TTV Tensor times vector for ktensor.
%
% Y = TTV(X,A,N) computes the product of Kruskal tensor X with a
% (column) vector A. The integer N specifies the dimension in X
% along which A is multiplied. If size(A) = [I,1], then X must have
% size(X,N) = I. Note that ndims(Y) = ndims(X... |
8dc5d2c2aaed0bc704a6b3f4517524c1210b8fef2d12c51ddb51863675238778 | MATLAB | 2,355 | 56 | % SOFA API - demo script
% Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences
% Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License")
% You may not use this work except in compliance with the ... |
c3235d2e6593836b454ec0b736f02be03cb60f037eb0e38862e98823835e6a7f | MATLAB | 2,355 | 115 | %LOADPPM Load a PPM image
%
% I = loadppm(filename)
%
% Returns a matrix containing the image loaded from the PPM format
% file filename. Handles ASCII (P3) and binary (P6) PPM file formats.
%
% If the filename has no extension, and open fails, a '.ppm' and
% '.pnm' extension will be tried.
%
% SEE ALSO: saveppm loadp... |
da2a9cadf6bfe508eee7fd970b2984f7e11daccb72b1f76b038fad76b3617d1a | MATLAB | 2,355 | 74 | function [r2 rmse] = rsquare(y,f,varargin)
% Compute coefficient of determination of data fit model and RMSE
%
% [r2 rmse] = rsquare(y,f)
% [r2 rmse] = rsquare(y,f,c)
%
% RSQUARE computes the coefficient of determination (R-square) value from
% actual data Y and model data F. The code uses a general version of
% R-squ... |
71c1fc5d7e860a9110b4b041d7eb1a60b042a397f9778bba0e05dcd930ca6b82 | MATLAB | 2,356 | 69 | function [Xc,Z]= airPLS(X,lambda,order,wep,p,itermax)
% Baseline correction using adaptive iteratively reweighted Penalized Least Squares;
% Input
% X:row matrix of spectra or chromatogram (size m*n, m is sample and n is variable)
% lambda: lambda is an adjustable parameter, it can be adjusted ... |
26216abad3d167e88e04fbc6027df4bf1ab97e13440e6922a18edb2ea4569467 | MATLAB | 2,357 | 68 | % segmentVelocities.m
% Sarah West
% 10/13/21
% Segments velocities by calling the SegmentData function.
function [] = segmentVelocities(parameters)
% Give parameters their original name
dir_exper = parameters.dir_exper;
periods_long = parameters.periods_long;
periods_transition = parameters.... |
c818e6b3a3d2b37328a728f2c51ada5a17f0fbdcef1ff61e0ea86b9052cd7c44 | MATLAB | 2,357 | 69 | function [Stats]=VectorStats(Data,Mode,Bin_Range,Bin_Size)
%Mode 1 All calcs including histograms
%Mode 2 just Mean STD SEM CV
if ~isempty(Data)
if iscell(Data)
Data1=[];
for i=1:length(Data)
Data1(i)=Data{i};
end
Data=Data1;
... |
d53d04ce202f6213158ff4b61fe9b3a2e0248c7f22a1b66b512f300a31edb68e | MATLAB | 2,357 | 75 | function [varargout] = routlm(varargin)
% ROUTLM computes the projection of a point from its la/mu parameters
% these equal the "Barycentric" coordinates
%
% Use as
% [proj] = routlm(v1, v2, v3, la, mu)
% where v1, v2 and v3 are three vertices of the triangle
% Copyright (C) 2002-2009, Robert Oostenveld
%
% This fi... |
b245374153265214529189893e58418b1f61c5a3882850feec2894e099e3a53b | MATLAB | 2,358 | 95 | function [video,n_frames] = tif_to_video(filename,frame_rate)
%
% >>> OPERATION >>>
% Converts series of TIFF files into an AVI video. Uses MPEG-4 compression by default.
%%
% >>> USE >>>
%Select first TIFF file in the folder. The remaining files will be
%automatically found and concatenated
%If not provided, frame r... |
261aa06a707327c8c5817d5fc5a6867a5471de5b2e75770d2e987d11ba4fda0b | MATLAB | 2,359 | 86 | function R = shadowedFilesReport(rootDir)
%% Generate an html report of the shadowd files in rootDir
% If rootDir is left blank, the report reflects all m-files on the path.
% This file is from pmtk3.googlecode.com
if nargin == 0
files = allMfilesOnPath();
else
files = filelist(rootDir, '*.m', true);
end
m... |
26d34274486784f914322d4e9250fcafb918891d9d6b023ebd314a51cbc2c600 | MATLAB | 2,359 | 74 | %% NVR add ECG to dataset
% 2024 by Antonin Fourcade
% Run HEPLAB beforehand to get R-peak events (ecg .mat files)!
function NVR_05_addECG(c_style, mov_cond, path_data)
% 1.1 Set different paths:
% input paths:
path_data_eeg = [path_data 'EEG/'];
path_in_eeg = [path_data_eeg '04_HPF/' mov_cond '/' c_style '/'];
path_... |
86a728d691725ab0f9d20bd5ffbd957adc140a38ac5c38cd174b82db6d437529 | MATLAB | 2,359 | 52 | function h_fileTypeQuality3(handles)
global h_img3
[currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles);
currentValue = currentStruct.state.fileTypeForSynAnalysis.value;
switch currentValue
case {2, 3}% if other instances have the same value, then set them to 1
... |
c51b81c9951186e41e87b39d12d583425aa820215c3cc9d19cdcb0eae8e38485 | MATLAB | 2,359 | 80 | function c = ttv(a,v,dims)
%TTV Tensor times vector for ttensor.
%
% Y = TTV(X,A,N) computes the product of ttensor X with a
% (column) vector A. The integer N specifies the dimension in X
% along which A is multiplied. If size(A) = [I,1], then X must have
% size(X,N) = I. Note that ndims(Y) = ndims(X) - 1 b... |
951d3b7ac2ab6edb67e9c0801c2a14b99eee78d39437ebbd987a49a7606be757 | MATLAB | 2,360 | 70 | function keys_total = reporting_registration(channels, registeredImagesDir, num_rounds, reportingDir)
%For every round,
% create a max projection of each registered image
% get the number of features
% save the 3D plots of feature agreements
save_types = {'fig','jpg'};
keys_total = [];
%Get the number of rounds and c... |
9fe7718211a7b9fafd591af54a15865f57c0a1db916f8730490c73292981ca5e | MATLAB | 2,360 | 72 | clear all;
clc;
% Create a figure with specified size
figure('Position', [100, 100, 1200, 400]);
%% Methods
subplot(1,3,1);
% Data for the number of mentions for each method
methods = {'CNNs', 'Hybrid CNNs', 'Dictionary Learning CNNs', 'LSTM', 'SVM, RF, ELM', 'XGBoost, Decision Trees'};
counts = [29, 6, 1, ... |
a5415687d70094c415381d05ece37f029be804d71ef8e7d88bd165e78bcf7a5f | MATLAB | 2,360 | 61 | function [] = plotBetas(beta, colors)
% This code reproduces the analyses in the paper
% Urai AE, Braun A, Donner THD (2016) Pupil-linked arousal is driven
% by decision uncertainty and alters serial choice bias.
%
% Permission is hereby granted, free of charge, to any person obtaining a
% copy of this software and ass... |
442f6612aec29c6fa0ebf31cc761ba92c731e6f02b0491ac95fc0bf2b6e82d8e | MATLAB | 2,361 | 78 | function [nts] = read_neuralynx_nts(filename, begrecord, endrecord)
% READ_NEURALYNX_NTS reads spike timestamps
%
% Use as
% [nts] = read_neuralynx_nts(filename)
% [nts] = read_neuralynx_nts(filename, begrecord, endrecord)
% Copyright (C) 2006-2007, Robert Oostenveld
%
% This file is part of FieldTrip, see http:/... |
ac0dc4938ef713b0e9f1a046529a58c8545e2764440acbdff00301d2903deac4 | MATLAB | 2,361 | 63 | %% SAT - app_input::
%% fill_xtdc
% Name: Phone Kyaw
% Date: 09/19/2024
% Description: Create an XT data cell object for SMM
% Parameters: xt_cell - Nx2 cell where N is trials
% The headers are at {1,1} position
% The 2nd column has all the xt data
% ... |
29e1669936b3ef086fed47210dfa186de5c25a0f1477814dc26b58f34b47605f | MATLAB | 2,362 | 75 | %% mvgc_confint
%
% Confidence intervals for sample MVGC based on theoretical asymptotic distribution
%
% <matlab:open('mvgc_confint.m') code>
%
%% Syntax
%
% [xup,xlo] = mvgc_confint(alpha,x,p,m,N,nx,ny,nz,tstat)
%
%% Arguments
%
% See also <mvgchelp.html#4 Common variable names and data structures>.
%
% _input_
%... |
0d8508a7fc32f4f12a99de515d6bbfe9096a753259b2b63b2644a6fa096d5918 | MATLAB | 2,363 | 54 | function h_copyROIImg3(handles)
% [currentInd, handles, currentStruct, currentStructName] = FV_getCurrendInst(handles);
selectedROIObj = findobj(handles.h_imstack3,'Tag','ROI3', 'Selected', 'on');
if ~isempty(selectedROIObj)
% first find the image axes and get the image
parentObj = get(selectedROIObj, ... |
8fbae24770066ef462997121b74054d50f20630359773174e8614a88d3b2c648 | MATLAB | 2,363 | 74 | function [hdr] = read_bucn_nirshdr(filename)
% READ_BUCN_NIRSHDR reads the header information of ASCII-formatted NIRS
% data acquired with the UCL-BIRKBECK machine and postprocessed by the
% Paris group. The first line contains the channel labels and the rest of
% the file contains per line a time sample. The first co... |
cc698e6babdaf170ddc68e8447a05323fd59b462600c41ba425534c9f018f6f6 | MATLAB | 2,363 | 81 | % HOTELL2 Hotelling's T-Squared test for two multivariate samples
%
% [pval,T2] = hotell2(x,y)
%
% Hotelling's T-Squared test for comparing d-dimensional data from two
% independent samples, assuming normality w/ common covariance matrix.
%
% INPUTS
% x - [n1 x d] matrix
% ... |
070180f9fa3ae3c06a223e7e54b1aa6490edcfa8b0efa6adce8525e731ccb1a7 | MATLAB | 2,364 | 64 | function CBIG_RF_make_xyzIndex_surf(reg_dir, output_dir, output_prefix)
% CBIG_make_RF_xyzIndex_surf(reg_dir, output_dir, output_prefix, faces_num)
%
% This function creates index files using a subject's lh.sphere.reg and
% rh.sphere.reg from reg_dir
% The index files created are curvature files containing a vector of... |
45615d289838a6a152e00a1056df37d909cfa1986c8517e7bd98ce80adc3837d | MATLAB | 2,364 | 123 | function [Irec,ind_new,ind_1,ind_2,ind_3,ind_4,a1,a2,a3,a4] = rect_index(I,R,f,c,k,alpha,KK_new);
if nargin < 5,
k = [0;0;0;0;0];
if nargin < 4,
c = [0;0];
if nargin < 3,
f = [1;1];
if nargin < 2,
R = eye(3);
if nargin < 1,
error('ERROR: Need ... |
ac67eff1297fc5f2985c892d485221ca0cb3286faf105b5f9bcfdac2ad20d25e | MATLAB | 2,364 | 61 | function [data, header, err] = h_openScanImageTif2(fname, frameNumbers);
if ~(exist('frameNumbers')==1)
frameNumbers = [];
end
data = struct('red',[],'green',[],'blue',[],'size',[]);
header = [];
[data1, header1, err] = h_OpenTif(fname,0);
try
total_Channels = header1.acq.savingChannel1 + header1.... |
b67705716a8e179306f368ff2f7423062ba2c2784b67c983cda8139b288d9fb0 | MATLAB | 2,364 | 78 | function runPollingLoop(toClientDataQueue, poller, suitcase, pollInterval, projTempDirMaybe)
% Run the polling loop; typically called via parfeval
%
% toClientDataQueue: parallel.pool.DataQueue created by BgClient
% worker: object with method cObjMeth
% callInterval: time in seconds to wait between calls to
% worker... |
cbab676b5a3be0468f7d4e44b05b3925f31716d6b20c232f990b187bc4fd9b2e | MATLAB | 2,364 | 53 | function subjects = afxUpdatePaths(subjects)
baseDir = fullfile(pwd(),'data');
% return, if t1 of first subject has not moved
dirCond = fullfile('func',subjects(1).conditions(1).name);
tmp = afxUpdate(subjects(1).conditions(1).func(1,:),dirCond,fullfile(baseDir,subjects(1).dir));
if strcm... |
0b609874a51271d0d858fc867a99034fa9e1f668c4ea66e428639a1d7934952e | MATLAB | 2,365 | 81 | %% Bayes Factor Gene Demo
% PMTKneedsStatsToolbox ttest2
%%
% This file is from pmtk3.googlecode.com
function bayesfactorGeneDemo()
requireStatsToolbox
%load('bayesFactorGeneData.mat');
%ngenes = size(Xtreat,1);
%setSeed(1);
ngenes = 100; nsamples = 2;
mu1 = 0; s1 = 1; mu2 = 5; s2 = 1;
ndx = find(rand(1,ngenes) > 0... |
75b9004d678b5687411f169374e05d13df42ce9b900aa2c24cebc566b513c881 | MATLAB | 2,365 | 67 | function [] = plot_staggered(data,time,chan_list,scale,spacing,h)
% plot_stagged(data,time,chan_list,scale,spacing,h)
%
%plot <time> V.S. each row of the matrix <data> and arrange them vertically
%in a staggered way. If a <chan_list> is provided each channel has its own
%label (on the right), otherwise an automatic (an... |
784c87aa5a2d9d36adbb5056d3164d40c0bfe046888af178bb7547f867451365 | MATLAB | 2,366 | 107 | % This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,... |
79f21b1c76d088a30ce5dc16fbcdfac642000dfe11954d5c05fd4092378c475e | MATLAB | 2,366 | 65 | function Log2DPlotZeroCorrection(TempXData,TempYData,Input_Color_Map,MarkerSize,AdjustRatio)
warning on all
warning off verbose
warning off backtrace
if length(size(Input_Color_Map))>2
for i=1:size(TempXData,2)
Color_Map(i,:)=horzcat(Input_Color_Map(1,i,:));
end
e... |
990e5c78c72fc1526556c3b863e2c63ae2806a4c5d3c74a83d69eaecac28b20a | MATLAB | 2,366 | 75 | function outFile = meg_combineSqd(dataDir, outName, tag, delimiter)
%
% function outFile = rd_combineSqd([dataDir], [outName], [tag], [delimiter])
%
% Append multiple sqd files. Finds all the sqd files in a directory that
% have a given tag.
%
% INPUTS:
% dataDir is the full path to the directory with the sqds to combi... |
df9c7e2d47035db57a8a12238ba8966e059420f488bebfbf6d7c33fbc6227137 | MATLAB | 2,366 | 82 | function [pre, post, pred, cycle, d, f] = dfsearch(G, start, directed)
%% DFS Perform a depth-first search of the graph starting from 'start'
%
% Input:
% G(i, j) = 1 iff i is connected to j.
% start is the root vertex of the dfs tree; if [], all nodes are searched
% directed = 1 if the graph is directed
%
% Output:
% ... |
e92d7927280e9e2dab133fe6542d400d42c75c7d18e1b8a56e371f0cf963b748 | MATLAB | 2,366 | 82 | % Renamed from calc_Fig4a_S9
%% Decoder performace: fixed time window
%% weights from 450ms applied to all time points for
%% 1. all neurons,
%% 2. only Tin neurons,
%% 3. no Tin neurons,
%% 4. no Tin or Min neurons
load(fullfile(saveLoc, 'par_sess'))
%% Aligned to motion onset
load(fullfile(save... |
b5bada83a9fd6d0d285824ad540f1e911727c6bce0f12357bd00247cb7b933c6 | MATLAB | 2,367 | 58 | %% SAT - app_input::
%% getXtDataCellFromConcatenatedFile
% Name: Phone Kyaw
% Date: 09/19/2024
% Description: Get the XT data and header from concatenated XT file
% Parameter: xt_data - A cell array containing XT data
% char_index - Index of row numbers where char/str row exists
% ... |
c6d40d243c5f659598862ea35c20491ab0fdd306707f7fae70649481c91886cf | MATLAB | 2,367 | 67 | function [output, output_seg] = CBIG_RF_propagate_in_vol(input_lh, input_rh, mask_input)
% CBIG_RF_propagate_in_vol(input_lh, input_rh, mask_input)
%
% This function grows a volume (e.g. segmentation labels) to fill up an input mask
%
% Input:
% - input_lh :
% path to input volume in left hemisph... |
10457b96a45be3d0ea486271807c82639482ed3d190885bc62f2444f234c19de | MATLAB | 2,369 | 39 | function [netMat_betas] = PCmultregressionconnectivity(activityMatrix)
%[netMat_betas] = PCmultregressionconnectivity(activityMatrix)
%
%This function computes multiple regression-based functional connectivity, but allows for more regions/voxels than time points. This is accomplished by decomposing the provided time s... |
45413f2029a308028ff232e102deb154a8dc28e46a9cf190df7a2f74503bfc60 | MATLAB | 2,369 | 69 | function [grid] = lbex(cfg, grid)
% This function will add the field "subspace" to the grid definition.
%
% The subspace projection is based on the LBEX (local basis expansion)
% method.
% set the defaults
if ~isfield(cfg, 'lbex'), cfg.lbex = 3; end
if ~isfield(cfg, 'lbexeigtol'), cfg.lbexeigtol =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.