sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c5060e2f1a13064215bfc391e9d0db4403fcb59d835f5272a219e877fbf85325 | MATLAB | 2,790 | 99 | %% NVR crop and combine
% 2017 by Felix Klotzsche and Alberto Mariola
% 2024 update by Antonin Fourcade
%
%This script crops out the significant parts of the EEG data stream (SPACE
%coaster, BREAK, ANDES coaster) and combines them to a single stream.
%From the coaster parts, 2.5 secs at the beginning and at the end are... |
f2b23535503c7759200e7b17ea793ec0ea6c05ca9e26ac123d7c3ff7219b6fdd | MATLAB | 2,790 | 123 | function wlPlot_plotEventsAgainstCommon(cfg, evlist, evstride, ...
signal, samprate, figtitle, filelabel)
% function wlPlot_plotEventsAgainstCommon(cfg, evlist, evstride, ...
% signal, samprate, figtitle, filelabel)
%
% This function plots a series of events, showing the reconstructed signal's
% analytic component... |
f4871260c285075d7c3393d08839be1aba8bbca00ff83a4972be2dc660fe3fbe | MATLAB | 2,790 | 111 | function [Samp, Sph, EjeX, EjeF] = spectrogram_hilbert_lan( SIG, FE, FRANGE, TRANGE,r_s)
% v.0.0.2
%
%
% [Rho, Phi, EjeX, EjeF] = spectrogram_hilbert_lan( SIG, FE, FRANGE, TRANGE, WinSig, ResHz, step)
% this function uses a hibert transform to compute the amplitud and phase values of a matrix of signals 'SIG'.
% The... |
0d3a1d188a90c1d64f4927841485d5a10cfc1641d537e1d362af18f17d93cb40 | MATLAB | 2,791 | 123 | function keys = test_sift_cuda_w_harris3d(mode)
%img=zeros(100,100,50);
%for i=0:3
% for j=0:3
% img(30+i,30+j,20)=5;
% end
%end
% img=zeros(20,20,20);
% for i=0:1
% for j=0:1
% for k=0:1
% img(3+i,3+j,3+k)=5;
% img(7+i,7+j,7+k)... |
62e3f0b5e97e87c89b551fa1fb7bd733234bfe1345655b6ae8aaeda3f01e6466 | MATLAB | 2,791 | 69 | function [sz1,sz2] = lme_plannedSampleSize(Zi,ZiCol,Dhat,phisqhat,effsz,...
dr,pw,alpha,gr_pr)
% [sz1,sz2] = lme_plannedSampleSize(Zi,ZiCol,Dhat,phisqhat,effsz,dr,pw,alpha,gr_pr) ... |
db98b7dda844cd12e47b7119e1ff0cd437a007a553d12db7c1cab6a81a322e2f | MATLAB | 2,792 | 118 | % demo "win/stay - lose/switch"
% This demo simulates a number of sequences of choices of a "win/stay -
% lose/switch" agent, and then estimates its expected Volterra kernels,
% given a basis function set that captures the susceptibility to the
% agent's own feedback, as well as the susceptibility to the agent's
% oppo... |
0233576b9a5392a3b3238748b6f5a4ccb7f0bdacf1b57c059820daf0f8d7cd16 | MATLAB | 2,793 | 72 | function M = finerModel(M, level)
%FINERMODEL Make a brain model finer by adding centroids of its triangles as new vertices.
%
% The centroid of a triangle is the intersection of the medians. A median
% of a triangle is a line connecting any vertex to the midpoint of the
% opposite side. The centroid might ... |
7b14a282a2bdfcf45e5f27ad3f72477a5c30e30b7b144439d827fba2f3a0d00b | MATLAB | 2,793 | 90 | function CPD = condDiscreteProdCpdCreate(T, varargin)
%% Create a conditional discrete product distribution
% This differs from a tabularCPD in that it supports vector valued discrete
% observations, (it also supports scalar value observations).
% These are assumed to be conditionally independent.
%
% T is of size nst... |
97b53129b77a61e8e179a9e71415f76bdc17ee78eab3d8c19942d8ce1d1044a1 | MATLAB | 2,793 | 119 | function X=sepblockfun(X,blockdims,fun)
%Perform a separable operation on sub-blocks of an input array. Here, a function
%op() is said to be separable if for any array B with elements B(i,j,k,...),
%the operation op(B(:)), resulting in a scalar, can be equivalently done by
%applying op() first along i, then along j, ... |
356dc98a587953e2782dedc3c44b4c23916a01877ad78e18b95901794a43646c | MATLAB | 2,794 | 98 | function [list, m, g, map] = whoCallsMe(fname, varargin)
% Find out who calls a certain function
% Return a list of all of the mfiles on the current path that call
% the specified fname. This is a simple inverted map of the standard
% dependency report.
%
%% Inputs
%
% fname - the name of the file, (passed to which)... |
41edaa3b2d9c525bf8e0262467b5009113e4931cb4650b3ed8c48b474c79b6fa | MATLAB | 2,794 | 55 | function p = compare_correlation_coefficients(r1,r2,n1,n2)
% This function compare if two correlation coefficients are significantly
% different.
% The correlation coefficients were tansfered to z scores using fisher's r
% to z transformation.
% ref: http://core.ecu.edu/psyc/wuenschk/docs30/CompareCorrCoeff.pdf... |
42547fa39445570d3d50fe7f6e89afb73aaa318f50e0170eea6cd1f5bd11e2bd | MATLAB | 2,794 | 81 | function grad = getPartialGradient(problem, x, I, storedb, key)
% Computes the gradient of a subset of terms in the cost function at x.
%
% function grad = getPartialGradient(problem, x, I)
% function grad = getPartialGradient(problem, x, I, storedb)
% function grad = getPartialGradient(problem, x, I, storedb, key... |
cea02e5e258c0d59b569c9744c4da9598e5a8b74871a7ea04d93563c1b9a7c6e | MATLAB | 2,794 | 90 | function geom = GaussGeometry(X,Y,Z,sigma)
% GaussGeometry computes geometry using Gaussian derivative
%
% geom = GaussGeometry(X,Y,Z,sigma)
%
% X,Y,Z: embedding grids
% sigma: width of Gaussian derivative
%
% geom is structure with fields
%
% g: metric
% ginv: inverse met... |
daf5596d8fc443be3f814eceb692f20522044ea87e6fe43b61b3c6c8d8ecdd2c | MATLAB | 2,794 | 63 | %% This is an example using SSMMDIJ.m.
%% The only difference from RunSubsamplingMMD.m is replacing subsamplingMMD.m by SSMMDIJ.m and a step to calculate IJ variance.
%% Based on SimulatedDatasets.m, our goal is to learn a transformation h(X) = diag([4,2,3,5]) * X + [100,-40,-60,800].
%% First, we attach all required ... |
27a38c4c0f193cf615bf316bab86362a03c23666107b90f414ac39acee949d94 | MATLAB | 2,796 | 105 | % 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,... |
8b41c3817ff83e304845f89b2fdaa7cac626574c8c6bb1f550f402c292275330 | MATLAB | 2,796 | 80 | function id_download_fail = ABCD_check_download(id_list,image_table,mod,data_dir)
% id_download_fail = ABCD_check_download(id_list,image_table,mod,data_dir)
%
% This function checks if all the images of a subject on the image table
% have been downloaded to the data directory
%
% Inputs:
% - id_list
% A string.... |
3e4ee44220ca229e0006ca51a4befd3b7c77baef1cca8c5a62f3594036330650 | MATLAB | 2,797 | 95 | function HDM = spm_hdm_specify(SPM,xY,u_idx,options)
% Specifies an HDM
% (This version unchanged from toolbox version - just two commented lines
% for M.N and M.dt below that illustrate how to change temporal resolution)
%
% SPM - SPM structure
% xY - VOI structure
% u_idx - indices of the ... |
4a8d7045904b6bb8da57601b53dcce178c34e1c996ac58aec4d90fc8447ddb48 | MATLAB | 2,797 | 85 | function CBIG_DrawfcMRISurfaceClusters(clusters_mat, mesh_name, surf_type, colors)
% CBIG_DrawfcMRISurfaceClusters(clusters_mat, mesh_name, surf_type, colors)
%
% This function is used to draw surface map for a given parcellation
%
% Input:
% -clusters_mat:
% a .mat file contains the parcellation informatio... |
62c31c59b519df1b8d102af91e47f0e97004c41b47d192636bb92641c125e3dc | MATLAB | 2,797 | 94 | function neuro = bold_deconvolution(BOLD,TR,alpha,NT,par,xb,Hxb)
% Deconvolves a preprocessed BOLD signal into neuronal time series
% based on discrete cosine set and ridge regression.
% This function does not use confound regressors (e.g. motion).
% This function does not perform whitening and temporal filtering.
% ... |
12d45d882a811e0b111e0ed68ddad77d3cd430c4998c66bc63a047bb3a281d44 | MATLAB | 2,798 | 154 | clear
clc
load('data/combined_kernels_per_context.mat')
%%% (generated by combine_neural_kernels_per_context.m)
data1=data_all_trials_loc;
data2=data_all_trials_freq;
resolution=glm.res*100;
data1.centers=-1:resolution/100:2;
data1.vecx=0.01:glm.res:glm.pulsedur;
data2.centers=-1:resolution/100:2;
data2.vecx=0.01:... |
32315eaaa38db011a196d1f6bf0b23a5acc023595c9764eb37a14b741ebbc960 | MATLAB | 2,798 | 68 | function [h, X1sparse, X2sparse] = plotDecisionBoundary(X, Y, predictFcn, varargin)
% Plot data and the classification boundaries induced by the specified
% predictFcn.
%
% X - an n-by-2 data matrix
% Y - an n-by-1 matrix of class labels
% predictFcn - a handle to a function of the form yhat = predi... |
61110b4f97c11efd60f3fcccfce83bca68c4d2d9bae75df7985fc8223b85e4d8 | MATLAB | 2,798 | 81 | % Function that selects a disc of neurons in a grid, with one specific
% neuron in the center, and a given radius.
% It also takes care of the periodic boundary conditions.
% INPUTS:
% centerIdx : linear index of the neurons that corresponds to the center
% of the disc
% radius : radius of ... |
6e17d24c31f352d478d52d8029520059012ebf01aa8086ab21c9341deef6d6dc | MATLAB | 2,798 | 73 | function fitRes = mPFit(data, varargin)
% Description: do sigmoid fitting via psigfit toolbox
% Input:
% data: n*2 | n*3 matrix, the first column is x, the second column is
% correct ratio(when 2 columns) | correct counts (when 3 columns with
% column 3 being the total counts corresponding ... |
cceef26276d64ad9cc1998f084dd00315540e80ff385637a47ffc5a9d024c617 | MATLAB | 2,798 | 76 |
% PREP_CHILDMIND_EEG_BATCH preprocesses all *.mat located in a directory, and places the
% output in a new directory. The preprocessing parameters are defined in
% the batch script and passed as input argument to the preprocessing function, "s1_prep_childmind_eeg".
% The pipeline contains the following preproc... |
f3e90b1ef68b2c77c0224d39448fafdbd0f0cce18927b9f6aaffcab3e9c74f19 | MATLAB | 2,799 | 81 | function [out] = mediation_contrast(Y,X,M,c,options)
% performs contrast-based mediation analyses
% function [out] = mediation_contrast(Y,X,M)
% Let us consider the following regression equations:
% M = X*a + e_M
% Y = M*b + X*c + e_Y
% where X is the design matrix (containing the independent variables), M is
% the med... |
2da09c1480bbcaed4095a48a4051ac3f99101b84518274a16f0e8e77d2229c77 | MATLAB | 2,800 | 119 | function [out inds] = collectParams(params,opts)
%
%-----------------------------------------
% [out inds] = collectParams(params,opts)
%
% collects parameters from a local statistical
% image model into a matrix and provides
% indices for accessing parameter groups
%
% params: structure with model parameters
% opts: ... |
2fd2e5f89da9c1b91bb8b2b92adfbea466d7bb0db483fddae03db844933579ff | MATLAB | 2,800 | 84 | function [segments, Fs] = CARL_detect_voiced(x, Fs , temp ,segments,distance_s)
y = abs(hilbert(x));
sampling_factor = round(size(x,1)/Fs);
alpha = 0.2;
a = ones(1, sampling_factor)/sampling_factor;
b = [1 alpha-1];
y = filter(a,b,y);
[b,a] = butter(6,0.01);
y = filter(b,a,y);
... |
a50f76cdbe6baec06090b91ade99ccb6edf4fafb53caf98ecfc6c5c85b466dc7 | MATLAB | 2,800 | 70 | clear all
clc
tmp=pwd;
cd ..
addpath(genpath(fullfile(pwd, 'utils/')));
addpath(genpath(fullfile(pwd, 'spmutils/')));
cd(tmp);
% installed directory of spm: e.g. G:\guobin\spm12\
SPMdir='D:\spm12\';
image_dir=fullfile(pwd, 'imgs');
group_t1_dir=fullfile(image_dir, '/T1/');
newseg_jobmatfile=fullfile(pwd... |
ac6f1c6b98b7df836d4ecfffd8406488cad0117ac854655c76b743f4c2cc3d32 | MATLAB | 2,800 | 104 | %% L1 regularization on a deep feedforwrd neural net
%PMTKauthor Mark Schmidt
%PMTKurl http://www.cs.ubc.ca/~schmidtm/Software/L1General/L1General.html#16
fig = 1000;
lambda = 1;
options.maxIter = 100; % Increase iteration limit
options.adjustStep = 2; % Use quadratic initialization of line search
options.order = -1;
... |
e7d53afee14d9303c0762d200f77bdb1fc8e2f95f444e47279ecec611d4b76c2 | MATLAB | 2,800 | 84 |
clear corr_pyr_int Raceprob
[Racesum,NRace] = extract_variables ('SCE',[],resultsPath, 'Racesum','NRace',conditionType,conditionValue);
%[Racesum] = extract_variables ('SCE',[],resultsPath, 'Racesum',[],conditionType,conditionValue);
[pyr,int] = extract_variables ('nCells',[],resultsPath, 'pyr','int',conditionType,co... |
d826bb848d94acf2cb30c252edde0d63ef5130955aa84882120ba74b781184cf | MATLAB | 2,801 | 95 | function [varargout] = mesh_facets_area_distribution(mesh,varargin)
% MESH_FACETS_AREA_DISTRIBUTION Plots FEM mesh facets area distribution.
%
% SYNTAX:
% MESH_FACETS_AREA_DISTRIBUTION(MESH)
% MESH_FACETS_AREA_DISTRIBUTION(MESH,RESOLUTION)
% [S] = MESH_FACETS_AREA_DISTRIBUTION(MESH)
% [S] = MESH_FACETS_AREA_DISTRI... |
878231c1c15ce2181396b89f633f6c7ac9c08bc9a9dc6c72015dfa365c22289d | MATLAB | 2,804 | 95 | %% RBF Network Demo
% PMTKslow
%%
% This file is from pmtk3.googlecode.com
loadData('sarcosData')
setSeed(0);
% Standardize the inputs so they have zero mean and unit variance on the
% training set and standardize the test set accordingly using mu and sigma
% of training set
[Xtrain, mu, sigma] = standardiz... |
bb7a6b81f06c98278a6cbb142c9decb0e8cb889b8a5d06fe8c8e534e2c21af5e | MATLAB | 2,804 | 65 | %% SAT - app_input::
%% getPpDataFromConcatenatedFile
% Name: Phone Kyaw
% Date: 09/19/2024
% Description: Get the PP data from concatenated PP file (.csv)
% Parameter: pp_data - A cell array containing pp data with only two
% columns, the first column contains the time a... |
f1daaa51f5faecdee4c61cc453c2c95f8737f39e744f9cfdaadd46361ea6acf0 | MATLAB | 2,805 | 104 | function Ximpute = imputeKnnMixed( X, K, varargin )
% Impute missing continuous/ discrete values by knn
% types is a string, where types(j) = 'c' or 'd'
% For continuuous features, we use Euclidean distance.
% For discrete features, we use Hamming distance.
% Once we have found the nearest neighbors, we impute
% using ... |
8a374c97412559a13321e917fa617778567f779c7a33f281a3059cb66cf92ad2 | MATLAB | 2,806 | 110 | % 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,... |
5bd0c5afae83ba82d77065093b05dd7b71a4be23d35f35b77386006a4405a158 | MATLAB | 2,807 | 105 | function sa=prepare_sourceanalysis(clab,model,para);
% creates a structure needed for source analaysis
% usage: sa=prepare_sourceanalysys(clab,para);
%
% input:
% clab is a list of N channel names (clab{1} ... clab{N})
% all channels have to be EEG channels and the names must
% be known to this program. (lo... |
fd12873ccb3278c84fdfff715a4d5a12117e6c9287804e567ebf2b1593591828 | MATLAB | 2,807 | 76 | function Image_Mesh_Data_2hem(meshL,meshR,params,side,ctx,fig)
% This function renders a mesh with the shading/coloring determined by the
% values of the data at those points.
% Update 170222, info is now needed to account for acquision direction.
% Prev, his was optimized for transverse only. now sagittal is sup... |
52d6901754da540e923df151dd53cb4d6473442374015b4fcc91d835eedffaf7 | MATLAB | 2,809 | 89 | function prepro_mixedLong(subject, nerve, srmr_nr)
%% set variables
subject_id = sprintf('sub-%03i', subject);
savepath_eeg = [getenv('EEGDIR') subject_id '/'];
savepath_bs = [getenv('ANADIR') subject_id '/bs/prepro/'];
savepath_esg = [getenv('ESGDIR') subject_id '/'];
savepath_other = [getenv('OTHERDIR') subject_id ... |
7dbd4e8546bd0fad7a7377fc7db6d23c07f9102cce022d06314f8c822cd78c33 | MATLAB | 2,809 | 83 | % FADE-SAME: Figure 6
% clear
% close all
%%% Step 1: load data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% set results files
FADE_files = {'../FADE_scores/FADE_SAME_scores_2021_01_11_ref_FADE.xls';
'../FADE_scores/FADE_SAME_scores_2021_01_11_ref_yFADE.xls'};
% load results files
num_files... |
b83e0acd02904d91ab36caca9c8d9773fdae7358d3b92110169a164c57bbe83a | MATLAB | 2,811 | 87 | function [X, map] = readras(filename, ys, ye, xs, xe);
%READRAS Read an image file in sun raster format.
% READRAS('imagefile.ras') reads a "sun.raster" image file.
% [X, map] = READRAS('imagefile.ras') returns both the image and a
% color map, so that
% [X, map] = readras('imagefile.ras');
% image(X)
% colorm... |
1dca4de9cb556c8b6bf24ac701b2bc6f5661d9a66f61ee1e71df3da932273522 | MATLAB | 2,812 | 88 | FigName=['Colorbars'];
figure
set(gcf,'color','w')
set(gcf,'position',[100 100 1500 500])
%%%%%%%%
ax(1)=subplot(1,10,1);
imagesc(fliplr([0:0.01:1])')
colormap('jet')
TempPos=get(ax(1),'position');
set(ax(1),'position',[TempPos(1),TempPos(2),0.05,0.8]);
set(gca,'xtick',[]),set(gca,'ytick',[])
freezeColors
%... |
cba68e352dd6d02c16763a9b4cc19cc7aaf98d9bc2ce14dfa02a5efb9fa2318c | MATLAB | 2,813 | 86 | % [r,x,y,params] = detectcircles(im,...)
% inputs:
% im: image to detect circles in
% parameters:
% cannythresh: thresholds for canny edge detection
% cannysigma: standard deviation for canny edge detection
% binedgesa: bin edges for x-coordinate of center
% bincentersb: bin centers for y-coordinate of center
% bincent... |
7c7d506f8b170322b8bfecd68ae1a32afb6aa9c5b1439774c156dbc01db3d8e3 | MATLAB | 2,814 | 102 | function [img_filtered] = pystripe_gpu(input_img,varargin)
% This is adapted from pystripe / Kwanghun Chung Lab @ MIT
% and pystripe is adapted from ClearMap2 / Christoph Kirst
%
% Trying my best to do a faithful port.
% 'quick-lightsheet-correct' and 'nD-smooth' are not included
% Yuan-Ting Wu @ Yongsoo Kim ... |
f4fc2a49c4f86f4f8149572460ff735d22cd067ca68c686424b768476b207456 | MATLAB | 2,814 | 87 | function [tfr,t,f] = tfrri(x,t,N,trace);
%TFRRI Rihaczek time-frequency distribution.
% [TFR,T,F]=TFRRI(X,T,N,TRACE) computes the Rihaczek distribution
% of a discrete-time signal X,
% or the cross Rihaczek representation between two signals.
%
% X : signal if auto-Ri, or [X1,X2] if cross-Ri.
% T : time inst... |
2cc97bc260d9989e7f28062b8a5ca9dc82d25155482518e9da6c75acc29d6bc8 | MATLAB | 2,815 | 77 | %% Tucker Tensors
% Tucker format is a decomposition of a tensor X as the product of a core
% tensor G and matrices (e.g., A,B,C) in each dimension. In other words, a
% tensor X is expressed as:
%
% $${\mathcal X} = {\mathcal G} \times_1 A \times_2 B \times_2 C$$
%
% In MATLAB notation, |X=ttm(G,{A,B,C})|. The |ttens... |
b71e7b42a4f8afac96aeb7a2d9c2f79c1c11d1e9a305685e35a3e623006f79f5 | MATLAB | 2,815 | 93 | function [ax,h]=suplabel(text,whichLabel,supAxes)
% PLaces text as a title, xlabel, or ylabel on a group of subplots.
% Returns a handle to the label and a handle to the axis.
% [ax,h]=suplabel(text,whichLabel,supAxes)
% returns handles to both the axis and the label.
% ax=suplabel(text,whichLabel,supAxes)
% returns ... |
cfc668c89abad9bfe8b6a375f29a572f6e2b90047031010185281cff315ec1ca | MATLAB | 2,815 | 104 | function [m, V, loglik] = kalmanFilter(y, A, C, Q, R, init_m, init_V, varargin)
% Kalman filter.
% [m, V, loglik] = kalman_filter(y, A, C, Q, R, init_x, init_V, ...)
%
% INPUTS:
% y(:,t) - the observation at time t
% A - the system matrix
% C - the observation matrix
% Q - the system covariance
% R - the observation ... |
8538894427dec3f86a85354db8f39151e2bb08ad042bf51c6fa61f0bffda91c7 | MATLAB | 2,816 | 100 | % Simplification of logregMultinomKernelDemo to the binary case.
% This file is from pmtk3.googlecode.com
function logregBinaryDemo()
%% Setup Data
setSeed(0);
nClasses = 2;
nInstances = 100;
nVars = 2;
[X, y] = makeData('multinomialNonlinear', nInstances, nVars, nClasses);
%tmp = loadData('knnClassify3c'); % 500 sam... |
ba84208d7313bf01255f179c1b4413825f5411edb18c12050921e35f1d55aa4f | MATLAB | 2,816 | 93 | function [dat] = read_nmc_archive_k_data(datafile, hdr, begsample, endsample, channelsel)
% READ_NMC_ARCHIVE_K_DATA reads data from nmc_archive_k datasets
%
% Used in read_data as
% dat = read_nmc_archive_k_data(datafile, hdr, begsample, endsample, channelsel);
%
%
% This function specifically only reads data from o... |
bd980cef53a57e1996bf01fa0bd4e973e0cc712c07beb41a5d6b2f90fc6bcbdf | MATLAB | 2,817 | 79 | % Written by Einat Peled
% einatspeled@gmail.com
%
% Input: ImageArray_CorrAmp_norm: array with response images
% ImageArray_Labels: array with each image split to response labels.
% Output: An image array that shows only the top NumMaxPixels of each
% response
% For each input image: go over individ... |
59d753a6dbee19d646a5248b9cab75d492b0111fd30253f17bccb527e067c4e8 | MATLAB | 2,818 | 77 | function [ret,messages] = check_files_in_registerWithCorrespondences()
loadParameters;
ret = true;
messages = {};
for do_downsample = [true, false]
if do_downsample
filename_root = sprintf('%s-downsample',params.FILE_BASENAME);
else
filename_root = sprintf('%s',... |
e863ae474656d8787eaece54776a6123476f818be94c4e0a8f0fd2ecf4db6724 | MATLAB | 2,818 | 80 | function output = SOFAdefinitions(varargin)
% SOFAdefinitions
%
% SOFAdefinitions returns a struct containing definitions like the time
% format used in the API.
%
% SOFAdefinitions('dateFormat') returns the date format
%
% SOFAdefinitions('APIName') returns the APIName
%
% SOFAdefinitions('dimensions') retur... |
8ad554177b770d23137c9568cb6d230b579baffd05ce57b6318420616ed2f0cd | MATLAB | 2,819 | 61 | function DataStructure=LinearFit_ZN1_LogLog(Xdata,Ydata)
%Changes XFit Data so no Zero!
if size(Xdata,1)<=1&&size(Xdata,2)<=1&&size(Ydata,1)<=1&&size(Ydata,2)<=1
warning('Need to provide more than one data point to fit!')
DataStructure=[];
elseif size(Xdata,1)~=size(Ydata,1)||size(Xdata,2)~=... |
a2ac09e15ae650571e23a90c2df5f3930cdc64cb9585643bdda33289ab2b0bdc | MATLAB | 2,819 | 120 | function [E, yhat] = meg_objectiveFunction1(x,data,t,Fs,paramNames,fitType,freq)
% Define objective function to minimize for fconmin
% August 2023 KT
% Inputs:
% data: values by t, vector
% x: initial coefficients for search
% t: time vector
% Fs: sampling frequency, if not defined default to 1000 Hz
% Ouput... |
cf511db40f1813e0f676bef254c50a58d00e7a1d0e67670986c85c8ff04a142b | MATLAB | 2,819 | 120 | function cal = Calibrate(calDir)
% calibrate accelerometers
bytesPerSample = 2;
% calDir = [ratDir filesep 'calibration'];
%% load calibration data: x
% locate calibration data
datDir = dir([calDir filesep 'x*']);
if isempty(datDir)
disp('calibration data not found')
return
elseif length(datDir) > 1
dir... |
7e4a43c14d1388d9890f9a2d73c92aa45e35c25f1ec629e55f2e719a014f026c | MATLAB | 2,820 | 123 | % eval_time_epoch.m
% v.0.1
%
% LAN = eval_time_epoch(LAN,comp,cut)
%
% comp = tiempo en segundo de latencia minima
% cut : cortar, 0 = no, 1 = desde el fin, 2=desde el inicio
%
% OJO: eventos quedan desfazados
%
% Pablo Billeke
% 24.11.2009
%
function LAN = eval_time_epoch(LAN,comp,cut)
if nargin == 0
e... |
b9864e34f08b321c06ed16e310368927735cca8cb8471ae4404e15aa84d314b6 | MATLAB | 2,820 | 112 | % [trx,matname,succeeded] = load_tracks(matname,[moviename])
function [trx,matname,succeeded,timestamps,rest] = load_tracks(matname,moviename,varargin)
[dosave,savename,annname,verbose] = myparse(varargin,'dosave',false,'savename','','annname','','verbose',false);
succeeded = false;
trx = [];
rest = struct;
isinter... |
7c2e3b3bf02a2c474fe8df29d611346f37734912b5f523d2c3121b09a7096e2c | MATLAB | 2,821 | 102 | function M = euclideanfactory(m, n)
% Returns a manifold struct to optimize over real matrices.
%
% function M = euclideanfactory(m)
% function M = euclideanfactory(m, n)
% function M = euclideanfactory([n1, n2, ...])
%
% Returns M, a structure describing the Euclidean space of real matrices,
% equipped with th... |
9eaac473f2a2b84e5868469edca25a69c622545d778d721cba26fdf94ca3e7c4 | MATLAB | 2,821 | 102 | function [uniquedays,muperday,Sperday,nperday,hax,hfig] = PlotLabeledReachesPerMouse(labeldata,varargin)
[hax,hfig,mousename] = myparse(varargin,'hax',[],'hfig',[],'mousename','');
if isempty(hax),
if isempty(hfig),
hfig = figure;
else
figure(hfig);
end
hax = gca;
end
for i = 1:numel(labeldata.labele... |
bbf7c5d5031c1fe8d3d8a3cf5d80de488ff5576e72c780d04ee11c81d991c8a4 | MATLAB | 2,821 | 97 |
%% Draw Px0 Px1 Parameters
%
% Plotter for visualizing the relationships between pre-spike and post-spike
% distributions using the parameters found in the SDO Analysis Toolkit.
%
% For use with visualizing the relationships between prespike and
% post-spike signal.
%
% Variables:
% 'newFig' [0/1] - Whether to pr... |
244f190d2c0218e52371461e2d32a9263031a90adaab7e3a0e923af5ac3b9c8c | MATLAB | 2,822 | 68 | function Obj = SOFAgetConventions(sofaconventions,flags)
%SOFAgetConventions
%
% List = SOFAgetConventions() returns a list with supported conventions.
%
% Obj = SOFAgetConventions(sofaconvention) returns a SOFA object
% with all metadata and data for the corresponding sofaconvention. Obj
% will be empty i... |
41cda1c7c719a9ba2874398551672e1f2ffc37653217cb6aeeaa6f25197f414a | MATLAB | 2,822 | 69 | function [HurstBrain_DSOD, HurstBrain_WDSOD, HurstBrain_WDRE, Header] = y_Hurst(AllVolume, OutputName, MaskData, Header)
% Calculate Hurst exponent. Using wfbmesti in Matlab Wavelet Toolbox.
% function [HurstBrain_DSOD, HurstBrain_WDSOD, HurstBrain_WDRE, Header] = y_Hurst(AllVolume, OutputName, MaskData, Header)
% I... |
5e1d29c6dd81d1a7603c4cd939169ec03152ab4e9603abe7e9695e47feccb5ae | MATLAB | 2,822 | 106 | function [varargout]=ellipsefit(x,y)
%ELLIPSEFIT Stable Direct Least Squares Ellipse Fit to Data.
% [Xc,Yc,A,B,Phi,P]=ELLIPSEFIT(X,Y) finds the least squares ellipse that
% best fits the data in X and Y. X and Y must have at least 5 data points.
% Xc and Yc are the x- and y-axis center of the ellipse respectively.
% A ... |
13b84ef60e510f9aba3dd7c6b5fd07c95b8336e20cf9e7aa038d2f71addd37e3 | MATLAB | 2,825 | 56 | function [posterior,out] = VBA_main(y,M)
% inverts nonlinear state-space model M given data y
% function [posterior,out] = VBA_main(y,M)
% IN:
% - y: observed data matrix
% - M: model structure, with fields:
% .u: input to the system {[]}
% .f_fname: handle of the evolution mapping
% .g_fname: han... |
191d966f7d822d2f631156db2228b1ad9ab12a6c64976b6f5f6d2941ac69b939 | MATLAB | 2,825 | 110 | function [P,V] = surfaceness( I, s, m, e, v )
% SURFACENESS Enhances local ridges (or edges) with surface shape
% INPUT:
% I - Input tomogram (foreground bright), input data must be single and double
% s - Scale factor
% m - If equal to 1 ridge detection (default), otherwise edge detection
% ... |
6c6a0ca9ff7e9bb0687af83d230e82116fdd7e85be63fbcac62287177e50e391 | MATLAB | 2,825 | 97 | function [X,Y,mX,sX,mY,sY,It,diff,Xrec,Yrec,T,P,C,W,Wstar]=plsmbtsr1(X,Y,A)
% TSR 1 for PLS-MB (adapted from PCA-MB)
%
% INPUTS:
% X: predictor data matrix with NaN for the missing data
% Y: response data matrix with NaN for the missing data
% A: number of PLS components
%
% OUTPUTS:
% X: original predictor data matri... |
c5acb022f28e2f674a660bc8163929842fd844379bdf34217b8b46fccfa8c1d1 | MATLAB | 2,826 | 90 | %% dlyap_aitr
%
% Solve discrete-time Lyapunov equation by Smith's accelerated iterative method
%
% <matlab:open('dlyap_itr.m') code>
%
%% Syntax
%
% [X,iters] = dlyap_itr(A,Q,maxiters,maxrelerr)
%
%% Arguments
%
% See also <mvgchelp.html#4 Common variable names and data structures>.
%
% _input_
%
% A ... |
4771c0d922bdb55733d4fc70a535acca71fb0a37a3a3357fe307b33c788b7b08 | MATLAB | 2,827 | 61 | %Step 1 of CBIG Kong2019 Brain Parc Pipeline
%
%To run: 1. Open Matlab using salloc (ex: `salloc --mem-per-cpu 200G --time 2:00:00 --x11`)
% 2. source your config file containing the $CBIG_CODE_DIR variable
% -It might be helpful to `cd` to the $CBIG_CODE_DIR/stable_projects/brain_parcellation/Kong2019_MSHBM/step1..... |
6c437571a7ef5f165708b97818bdd8a8b14c2a33111a616b9f8a206756a64f69 | MATLAB | 2,827 | 100 | function X = normalize(X,N,normtype,mode)
%NORMALIZE Normalizes the columns of the factor matrices.
%
% NORMALIZE(X) normalizes the columns of each factor matrix using the
% vector 2-norm, absorbing the excess weight into lambda. Also ensures
% that lambda is positive.
%
% NORMALIZE(X,N) absorbs the weights ... |
8bd73e5617c917500fb398c0e6d01da8ee6ca045e09cd689ebe1512e87cdc93f | MATLAB | 2,827 | 90 | function [model, loglikHist, llHists] = emAlgo(model, data, init, estep, mstep, varargin)
% Generic EM algorithm
%
% You must provide the following functions as input
% model = init(model, data, restartNum) % initialize params
% [ess, loglik] = estep(model, data) % compute expected suff. stats
% model = mstep(mod... |
fb33de17c621876e06bead1ff4139f3725e15d1e9c14f3b07eb66b94b7860adc | MATLAB | 2,828 | 110 | function [P,V] = surfaceness( I, s, m, e, v )
% SURFACENESS Enhances local ridges (or edges) with surface shape
% INPUT:
% I - Input tomogram (foreground bright), input data must be single and double
% s - Scale factor
% m - If equal to 1 ridge detection (default), otherwise edge detection
% ... |
525670ae7978587f54c98f306828f9c30b9aa9955fcd358f2cbb99a0ac320571 | MATLAB | 2,829 | 101 | function gr = lme_mass_RgGradient(X,Zcols,W,invH,L,phi,re,ni,GD,invG)
% gr = lme_mass_RgGradient(X,Zcols,W,invH,L,phi,re,ni,GD,invG)
%
% Gradient vector of the restricted log-likelihood for a whole region.
%
% Input
% X: Ordered design Matrix (according to time for each subject).
% Zcols: Vector with the indices of th... |
a0a140eaaafc8f633f9156918dde72a0b315f42b12dd27db64db19fe2bfadc35 | MATLAB | 2,829 | 75 | function mask = maskEllipse( mRows, nCols, varargin )
% Creates a binary image of an ellipse.
%
% Creates a binary image of size (mRows x nCols), with all pixels set to 0
% outside the ellipse and 1 inside. The ellipse is given by 5 parameters,
% a semimajor axis of ra, a semminor axis of radius rb, angle phi (in
% ra... |
dc66bdc11da5dd753c88f800f9f5cabec6e2b356064f8e48430be30a2aaf73b4 | MATLAB | 2,829 | 59 | % eegplugin_MARA() - EEGLab plugin to classify artifactual ICs based on
% 6 features from the time domain, the frequency domain,
% and the pattern
%
% Inputs:
% fig - [integer] EEGLAB figure
% try_strings - [struct] "try" strings for menu callbacks.
% catc... |
397e70cd7432cfd5113ab946a7c64a0ddf4ebba3fd2f896eb79450503f4af1dd | MATLAB | 2,830 | 139 |
% load data
% contact Lead Author for data
%% PLOT %
% S11A-B
indices = [14 9];
ttls = {'1-1', '2-2'};
figure; hold on
for ii = 1:numel(indices)
switch indices(ii)
case {1, 5, 6}
clr = 'm';
ttl = 'avr - ';
case {11, 15, 16}
clr = 'g';
... |
a57551a9eaab1c1a5dc2a97b2093b5289363649103582ddb254aa670a7f79bbc | MATLAB | 2,830 | 76 | %{
Copyright (c) 2025 Axion BioSystems, Inc.
Contact: support@axion-biosystems.com
All Rights Reserved
%}
classdef StimulationLeds < Tag
%STIMULATIONLEDS File data that enumerates LEDs used in a
%stimulation
properties(GetAccess = private, Constant = true)
CurrentVersion = 0;
Min... |
26bf5f902f61e21c5777c5de154db961350f2613b97251eeeb24adeb552a4364 | MATLAB | 2,831 | 88 | function tifd=friedman(tfr,hat,t,method,trace);
%FRIEDMAN Instantaneous frequency density.
% TIFD = FRIEDMAN(TFR,HAT,T,METHOD,TRACE) computes the
% time-instantaneous frequency density (defined by Friedman [1])
% of a reassigned time-frequency representation.
%
% TFR : time-frequency representation, (N,M) matrix.
% ... |
36a6d91b93b76b59e23ed58d61642a4521dd9aa9e95e885b601edfc8f20afdff | MATLAB | 2,831 | 63 | %% 非线性(动力学)特征:基于时域的熵 | nonlinear features: time-domain-based entropy
%% 近似熵 | Approximate Entropy (similar to Sample Entropy)
% 表征时间序列数据的复杂性(complexity)和规律性(regularity),值越大,时间序列越复杂、越不规律
% X: single channel EEG signal (either a row vector or a column vector)
% opts.r:相似容限阈值,通常r在0.1std(X)和0.25std(X)之间时,ApEn有比较合理的统计特性,默认... |
29a707ef605542b596d336427f92268198d46bc2cad08e797a3a37703d17c6e5 | MATLAB | 2,833 | 79 | % Written by Einat Peled
% einatspeled@gmail.com
%
% Input: ImageArray_CorrAmp_norm: array with response images
% ImageArray_Labels: array with each image split to response labels.
% Output: An image array that shows only the top NumMaxPixels of each
% response
% For each input image: go over individ... |
50351ea2e0326648d0b0b90eea73a81e987dbbd4c6e735e5980f84b02a7d6b4d | MATLAB | 2,833 | 102 | function [s,vmax,imax,dip_mom,dip_loc]=Music(patt,V,grid);
% makes a Music-scan from a a given pattern.
%
% usage: [s,vmax,imax,dip_mom,dip_loc]=Music(patt,V,grid);
%
% input:
% patt nxm matrix for n channels;
% each column in patt represents a spatial pattern;
% (only the span(... |
fede5c354158238047192b2b75c87356d370235af440f4b28c35dfbf9d732e27 | MATLAB | 2,833 | 60 | function [coord_norm] = warp_fsaverage(cfg, elec)
% WARP_FSAVERAGE maps electrodes onto FreeSurfer's fsaverage brain.
% This surface-based registration technique solely considers the curvature
% patterns of the cortex and thus can be used for the spatial normalization
% of electrodes located on or near the cortical su... |
f8ba2630bcf96bb3213e895faf899ee5c153522fea1ac0cad4885e9f42512f2f | MATLAB | 2,834 | 80 | % FT_PREAMBLE_LOADVAR is a helper script that optionally loads one or
% multiple FieldTrip data structures from mat files on disk, as an
% alternative to the user specifying the data structures as input variables
% to the calling function. This makes use of the cfg.inputfile variable.
%
% Furthermore, this function com... |
37d633acb646f06a9ab6c3e5523fa3b2bc77431d79c56eab7eb3e5ffd625ba79 | MATLAB | 2,835 | 82 | function result = mergeimports(data, verb)
import yaml.*;
if ~exist('verb','var')
verb = 0;
end;
result = recurse(data, 0, [], verb);
end
function result = recurse(data, level, addit, verb)
import yaml.*;
indent = repmat(' | ',1,level); % for debugging
if iscell(data)
result = iter_cell(data... |
1c6dec245211d20fd05b1e0c2746b7f15bafafe378f8a65b45f29ad08dd30c6d | MATLAB | 2,836 | 97 | %% Bayesian T test demo using estimation method (not Bayes factors)
%
% This file is from pmtk3.googlecode.com
%{
% Data is from BEST.R function from
% http://www.indiana.edu/~kruschke/BEST/
% This corresponds to fig 3 of his paper (the IQ/drug example)
y1 = [101,100,102,104,102,97,105,105,98,101,100,123,105,103,10... |
4ba461f9ad396c4249c3add36c6e71493fda6d3993a0ac7564dc6ffbe824329d | MATLAB | 2,837 | 63 | function index_changes = CBIG_gwMRF_save_index_trans_btwn2versions(new_dir)
% index_changes = CBIG_gwMRF_save_index_trans_btwn2versions(new_dir)
%
% This function generates a cell array to save the index changes for all
% Schaefer2018 parcellations.
%
% Input:
% -new_dir:
% Path of the new parcellation fol... |
4da3be37a8a30f899dfaedd01475d9620fe14d709066799fe98fb9be8ef5a5a4 | MATLAB | 2,837 | 114 | %% Comparing ICA and PCA on data from a 2d uniform distribution
%PMTKauthorAapo Hyvarinen
%PMTKdate Sep 2010
% This file is from pmtk3.googlecode.com
%You need to have access to the FastICA package
setSeed(2);
%Number of data points
N=100;
%Choose a nice mixing matrix
A=[2,3;2,1]*.3;
%% Uniform data
%Create data... |
51f637e4d4243b19dd04d5a196d966ea7eb3299b8c240d08b74a98ed286baf6c | MATLAB | 2,838 | 75 | % This script plots mesh cross-sections and NIfTI data when availble
%;
% Copyright SNM/WAW 2018-2023
%
addpath('../engines/graphics');
VT = VT1;
f = figure('WindowState','maximized');
%% below is XY-code
y = Y(1);
% Display NIFTI slice
I = round(y/d1d2d3(2) + N1N2N3(2)/2);
S = squeeze(VT1(end:-1:1, I, :))'; ... |
5991e91dcfeea38b1238f704bacd86572dad755528aec462e3ed777b3770f3ba | MATLAB | 2,838 | 108 | function r=ksr(x,y,h,N)
% KSR Kernel smoothing regression
%
% r=ksr(x,y) returns the Gaussian kernel regression in structure r such that
% r.f(r.x) = y(x) + e
% The bandwidth and number of samples are also stored in r.h and r.n
% respectively.
%
% r=ksr(x,y,h) performs the regression using the specified ban... |
71ff33d12255dcefc6b4f917afb6972358669e080f4a09d236646cf3e0d3710b | MATLAB | 2,840 | 64 | function [s, cfg] = ft_statfun_pooledT(cfg, dat, design)
% FT_STATFUN_POOLEDT computes the pooled t-value over a number of replications. The
% idea is that you compute a contrast between two conditions per subject The t-values
% are pooled over subjects and compared against the pooled pseudo-values. Since
% according ... |
cb762f5488eae264bc87573a58638a7111e37ed90b421a5680f238fabc9d86ec | MATLAB | 2,840 | 79 | disp(' ');
disp('fdct_wrapping_demo_denoise.m -- Image denoising using Curvelets');
disp(' ');
disp('Denoising is achieved by hard-thresholding of the curvelet coefficients.');
disp('We select the thresholding at 3*sigma_jl for all but the finest scale');
disp('where it is set at 4*sigmajl; here sigma_jl is the noise l... |
e40d5c5b09f990abf2a2215280500f595cb00fa934c0d1d4b796694ea91ddce9 | MATLAB | 2,840 | 104 | function [f P1] = meg_fft(data)
% function meg_fft(data)
%
% data should be t x 1 vector
% October 2023
%% fft setup
% Need at least 2 points to estimate a sin
% If N is the number of points in a signal
% N/2 is the maximum frequency that can be sampled (i.e. Nyquist frequency)
plotFigs = 0;
% --- Load data pa... |
3ac96c9c910b1229a57e12a7a1b045836578bae817d66e74c8705af868cc7675 | MATLAB | 2,841 | 91 | %% Posterior predictive density for Bayesian linear Regression in 1d with Polynomial Basis
% We use a gaussian prior with fixed noise variance
% We plot the posterior predictive density, and samples from it
%%
% This file is from pmtk3.googlecode.com
setSeed(1);
[xtrain, ytrain, xtest, ytestNoisefree, ytest, sigma2]... |
677ca225c6be28405b547bf2ca26c8fe29c4775904590e2057f6a1d7b0ffe5a6 | MATLAB | 2,841 | 85 | function header = constructNPYheader(dataType, shape, varargin)
if ~isempty(varargin)
fortranOrder = varargin{1}; % must be true/false
littleEndian = varargin{2}; % must be true/false
else
fortranOrder = true;
littleEndian = true;
end
dtypesMatlab = {'uint8','uint16','uint32','uint64','int8','int16','i... |
6ceaf58d5e1518c23b21c8dc2dd0c12f41f05839757d980de4395ae384244d57 | MATLAB | 2,841 | 99 | function out = iimg_reslice(matchto, reslicethis, varargin)
% :Usage:
% ::
%
% out = iimg_reslice(matchto, reslicethis, varargin)
%
% out = iimg_reslice(matchto, reslicethis, 'write', 'outname', 'myimg.img')
%
% ..
% tor wager
% nov. 06
% ..
% default flags
% interp = 2 is trilinear
flags = s... |
e51e1e1b2860a17c1e46d2110f8799638fecc1e7c474f082d22d57846f3114b3 | MATLAB | 2,841 | 1 | % TSLOADEXPERIMENT Load an experiment from the .mat file
% TSLOADEXPERIMENT(FILENAME) loads in the file FILENAME as an experiment.
%
% FILENAME must be a .mat file created by TSsaveexperiment.
%
% See also TSSAVEEXPERIMENT, TSLOADSESSIONS, TSUNPACKCODES
function [result] = TSloadexperiment(filename)
result = ... |
46e63a3acaa86d6e5cb997b2b2525ebe0f8db805265a54207c12734f3137648e | MATLAB | 2,842 | 91 | function f = plot_pie_graph(node_adjmat, node_label_counts, cmap, fvisible)
%% PLOT_PIE_GRAPH draws a force plot with heatmaps for nodes
%
% Inputs:
% - node_adjmat: Nodes adjacency matrix (size NxN where N is the number
% of nodes
% - node_label_counts: Number of classes for each node (size NxC wh... |
a4905ae0b61cfd516ef318d3b4d79f3cf0f717523e83e924dd300ee4c3da3f58 | MATLAB | 2,842 | 103 | function [X, Y, Z, pnt1, tri1, pnt2, tri2] = intersect_plane(pnt, tri, v1, v2, v3)
% INTERSECT_PLANE intersection between a triangulated surface and a plane
% it returns the coordinates of the vertices which form a contour
% % Use as
% [X, Y, Z] = intersect_plane(pnt, tri, v1, v2, v3)
%
% where the intersecting pla... |
0f7a47d4ad024d8f655bb699e458aa1a825f6bf6124784d7710c2576cd3851f6 | MATLAB | 2,843 | 91 |
function create_channelmap_assy156(basepath,varargin)
% create a channel map file based on the .xml file. Original script from
% kilosort 1 wrapper. Modified to not use channels that user set as 'skip'
% in the .xml file. Modified further to accomodate probe geometry.
%
% Default map is for neuronexus A1x64-Poly2... |
257024b9eaa4f96dc067162dbfd3e5f160404a849857b186bee546b3b57139c9 | MATLAB | 2,843 | 86 | % SVD_forMSI_function.m
% Sarah West
% 9/6/21
% Runs SVD as a function with mouse number as an input
% Runs SVD on all the data from a given animal. Must be done with MSI or everything will die.
% For each mouse, loads the filtered and blood vessel regressed data, concatenates it all
% together, runs SVD, then saves... |
ab3daf463ddbd4dd145e88fc747bc07dafc541204f380232c54cac136aa4ad7e | MATLAB | 2,844 | 82 | % Output a correlation map between peaks in beta range vs structural and functional connectivity.
%%
clear all;
close all;
clc;
%% load tf data
addpath('C:\Code\wjn_toolbox')
%Dt=spm_eeg_load('data/iEEG/tf_spm_ecog.mat');
Dt=spm_eeg_load('D:\ECoG_Atlas\iEEG\iEEG\tf_spm_ecog.mat')
%% load beta (and other freq) value... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.