sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
873658b20907eb78f4b423d81a0885a3385f4cc433765f11e465db5bbb3892f3 | MATLAB | 3,265 | 114 | function [posterior, out] = demo_HodgkinHuxley ()
% // VBA toolbox //////////////////////////////////////////////////////////
%
% [posterior, out] = demo_HodgkinHuxley ()
% Demo of Q-learning simulation and inference
%
% Demo of the Hodgin-Huxley neuronal model.
%
% Background:
% ~~~~~~~~~~~
% Input current (u) are se... |
2ac0d0fd2e4ce500db667e7ef39ef120f33ee2626fd916c84130f7ffb53f48ec | MATLAB | 3,266 | 122 | function [ phi_G, Cov_E_p, A_p ] = phi_G_Gauss_AL( Cov_X, Cov_E, A, Z, normalization )
% Calculate integrated information "phi_G" based on information geometry
% with an augmented Lagrangian method
%
% See Oizumi et al., 2016, PNAS for the details of phi_G
% http://www.pnas.org/content/113/51/14817.full
%
% The cod... |
b22aa2af372ba2bf0ad0fb0b7045f178c6dc0e9f0abcf59f2495ffdd4536ac19 | MATLAB | 3,266 | 70 | % This function fits sinusoids of different frequencies to the residual
% bump velocities as a function of bump position
function [BinnedFly] = Fit_Sinusoids_To_Bump_Velocity_Residuals(BinnedFly, Freqs, Bump_HD_Good_Left, Bump_AV_Good_Residual_Left, ...
Bump_HD_Good_Right, Bump_AV_Good_... |
b3abf80ac6a68b9423be7543679c983a6bc356b7ff8ffce4b7907769e9c03c3b | MATLAB | 3,266 | 82 | function raPsd2d(img,res)
% function raPsd2d(img,res)
%
% Computes and plots radially averaged power spectral density (power
% spectrum) of image IMG with spatial resolution RES.
%
% (C) E. Ruzanski, RCG, 2009
%% Process image size information
[N M] = size(img);
%% Compute power spectrum
imgf = fftshift(f... |
3b0d4d65bcb01eadaf90a78df16c3e430935f07930b257b146b4824be023ea8f | MATLAB | 3,267 | 98 | %% Demonstrate failure of MLE for GMMs in high-D case, whereas MAP works
% PMKTauthor Hannes Bretschneider
% PMTKmodified Matt Dunham
%% Create data
% This file is from pmtk3.googlecode.com
setSeed(0);
trialsPerDeg = 10;
N = 100;
K = 3;
%dims = [3:2:13, 15:5:50];
dims = [10:10:100];
%%
% Don't display these warnin... |
803c90ea657c02c58321ae8682cf43ad5ff2e14ea286a3195feb38c26db6210d | MATLAB | 3,267 | 68 | classdef lightSource
%BEAM This class includes all properties and methods
%related to a beam in an MCmatlab.model.monteCarloSimulation.
properties
%% Input properties
sourceType (1,1) double {mustBeInteger, mustBeInRange(sourceType,0,5)} = 0 % 0: Pencil beam, 1: Isotropically emitting line or point sourc... |
84c7e2f44b1b4e0fbb813d90ba109edde65a48b3be75b3f8e7f9b155d4fffa6a | MATLAB | 3,268 | 102 | function [zest, xest, zsamples, xsamples, w] = pfSlds(N, par, y, u, resamplingScheme)
% particle filtering for switching linear dynamical system
% See Doucet, Gordon, Krishnamurthy
% "Particle filers for state estimation of Jump Markov Lienar Systems", 2001.
%
% N: num samples
% par: parameters of SLDS (se below)
% y... |
302803ef26ab22ec294348fda81bf73c255688962a6da447a8fb2d0606b9035f | MATLAB | 3,269 | 80 |
clear;
clc;
% This script used to generalize the FU3 model to external dataset
train_group = 'FU3';
test_group = 'Stratify';
% output file
output_path = fullfile('W:\Results_Shen_GT\General_results\ICV');
mkdir(output_path);
output_file = fullfile(output_path,[train_group,'_predict_',test_group,'.mat']);
% train mat... |
4e9f092f8f637afb4650100eba6b7b71c53f390566a4007649c984e489d80939 | MATLAB | 3,269 | 55 | clear
%%
load('/home/sonya/Data_exercise/T3_I/groupANALYSIS/pINFO.mat','p'); % load p-structure
%%
p.paths.output_dir = @(id) [p.subj.subj_dir{id},'ANALYSIS/'];
%%% INPUTS / OUTPUTS %%% (update anonymous function's workspace if any edits to subject paths made)
p.paths.epoching_info = @(id,ext) [p.paths.output_dir(id... |
2b00e3e7764adc4bd671b64cc8ad19c31fb0c68c22efb5efd45829e47b25d6ca | MATLAB | 3,270 | 77 | classdef (Sealed) AdjMatrixCircSqrLatt < adjmatrix.AdjMatrix
properties (Access = private)
R;
end
methods
function this = AdjMatrixCircSqrLatt(params, loadOnInit)
% creates a complete graph (mean-field network)
%
% params {AdjMatrixParams}: params of ... |
8cbf0ba034826c2d48df34c79d78526ddfc760375666f03aefcd9e653d3bf415 | MATLAB | 3,274 | 105 | function Xsol = nonlinear_eigenspace(L, k, alpha)
% Example of nonlinear eigenvalue problem: total energy minimization.
%
% function Xsol = nonlinear_eigenspace(L, k, alpha)
%
% L is a discrete Laplacian operator,
% alpha is a given constant, and
% k corresponds to the dimension of the least eigenspace sought.
... |
280eb843ac4700703410c0540bddd2e26d50851797c9b602837c43c78ccd4efe | MATLAB | 3,275 | 85 | function I = imShrink( I, ratios )
% Used to shrink a multidimensional array I by integer amount.
%
% ratios specifies block dimensions. For example, ratios=[2 3 4] shrinks a
% 3 dimensional array I by a factor of 2 along the first dimension, 3 along
% the secong and 4 along the third. ratios must be positive integers.... |
c1b749ed767ebc023fe34fc9bb48519ee120dcdee8c38e5c181d797b475ba27c | MATLAB | 3,275 | 129 | % measures the signal-to-noise ratio in sorted data
function data = SNR(varargin)
% options and defaults
options.DataDir = pwd;
options.MakePlot = false;
options.UseCache = true;
% validate and accept options
options = corelib.parseNameValueArguments(options,varargin{:});
[~,exp_name] = fileparts(options.DataDir... |
dcccd554c0506ec560292b400ed43b12171714aac8d132c4392aed51a43bf4b0 | MATLAB | 3,275 | 59 | function [targetedSubjRinROIpair,randomSubjRinROIpair,totalNumFramesRemaining,totalNumFrames, ...
meanSamplingVar,meanRunsVar,harmMeanFrames,harmMeanRuns,meanRunsNoSamplingVar,harmMeanFramesMinus3] ...
= parameterSweepIteration(FDcutoff,gevDVcutoff,useGSR,rawCutoff,useFDgev,useDVgev,TR,numROIpairs,SETS,... |
1ca40d2569a014dca494a942a7982dbd9fb7659e7cabe503de5d03c90eb28ee3 | MATLAB | 3,276 | 93 | %% mergeSDOChunkArr
%Recompile the full SDO, if created chunkwise; Depreciated usage.
% Copyright (C) 2023 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
... |
59f0a998a09b6405ade5fd74526fc313f4e9cba47af93b8f4f8340ee19697560 | MATLAB | 3,276 | 94 | %-----------------------------------------------------------------------------------------
% Peri-stimulus time histograms for odor-modulated neurons compared to
% other neurons
%
% Kehl et al. 2024 (DOI:XX)
% Single-Neuron Representations of Odors in the Human Brain
% Figure 1j
% Author: Marcel Kehl
% License: MIT... |
7b7e24837c800ae1769fa418d1b3e63df44051001afd5db7eb33adfb12c6a27d | MATLAB | 3,276 | 147 | figure,
mu = [-0.8 -0.8];
Sigma = [0.8 0; 0 0.8];
X = -4:.1:4; Y = -4:.1:4;
[X1,X2] = meshgrid(X,Y);
Z = mvnpdf([X1(:) X2(:)],mu,Sigma);
Z = reshape(Z,length(Y),length(X));
Z=Z*10000;
grid off
s=surf(X,Y,Z,'FaceColor','interp','EdgeColor','none');
hold on
az=45;
el=50; view(az, el)
caxis([min(Z(:))-.5*rang... |
cd340a3ce82fd918e3aeeb17691ed6395ce3194fddac8624ced1c32f32e0ac4f | MATLAB | 3,277 | 92 | function [ferns,hsPr] = fernsClfTrain( data, hs, varargin )
% Train random fern classifier.
%
% See "Fast Keypoint Recognition in Ten Lines of Code" by Mustafa Ozuysal,
% Pascal Fua and Vincent Lepetit, CVPR07.
%
% Dimensions:
% M - number ferns
% S - fern depth
% F - number features
% N - number input vectors
% H... |
3b0068008a1852e53eef5622ee79e19e28653c280afbf48d2315b76d45ae50c7 | MATLAB | 3,278 | 64 | psthPara.binsize = 10; psthPara.binstep = 10; % ms
cwStr = ["correct", "wrong"];
if contains(protStr, "duration")
devStr = "devDur";
end
for cwIdx = 1 : length(cwStr)
switch cwStr(cwIdx)
case "correct"
%% (cwStr(cwIdx))
if dIndex == 1
tIndex = [trialAll.... |
aaae920319002f5234b2e0948ef3f9963552c08687c658ab49f6e5bbb25eee3c | MATLAB | 3,278 | 133 | %% islinearsdo()
% Script to provide a quick check if the provided matrix satifices the
% assumptions necessary for use as a linear differential operator.
%
% INPUT
% L = 'Linear Operator' to test
% OUPUT
% flag = Boolean [0/1]
% 0 - L fails to suffice assumptions
% 1 - L satisfices assumptions of line... |
95ad7fed3989edc040a50bbd6caf210e3c669b23841a2d6b1e9f922b7c9a6dbf | MATLAB | 3,279 | 105 | function [headmodel] = ft_read_headmodel(filename, varargin)
% FT_READ_HEADMODEL reads a volume conduction model from various manufacturer
% specific files. Currently supported are ASA, CTF, Neuromag, MBFYS
% and Matlab.
%
% Use as
% headmodel = ft_read_headmodel(filename, ...)
%
% Additional options should be speci... |
dd19b0214337e8baa99139a2ae4ab6418f01f631f95284f605aeaa52763b253f | MATLAB | 3,279 | 60 | clear all
%%
%Identify optimal SNR Efficiency as function of b-value
%%
%Define Parameters
[optScanner,optSample,optSSFP,optSE] = ParameterOptionsSNROscillating();
%%
%Define b-value associated with single Gradient instance (ms/um2) - Used to calculate relative effective b-value with DW-SSFP only
bOsc=1;
%%
%Define Enc... |
47c9e75e485d6516b1cbb256480f092417f1973dcd9502c8bd11e28a227a3ede | MATLAB | 3,280 | 111 | %% Generate SPECTROGRAMS across entire electrode
DIRspectro=[DIRresults, '/spectro'];
mkdir(DIRspectro)
spectro_word = nan(250,945, n_all);
spectro_noise = nan(250,945, n_all);
window = 256;
overlap = 255;
nfft = [1:1:250];
%plot spectrograms
for j=1:length(good_chan)
the_chan = good_chan(j);
%the_chan = go... |
742734eb59bb811e08d2541e1686600d64bbdd4bef66f977655c560e4ace2c9d | MATLAB | 3,283 | 127 | function [Iphi,SigmaPhi,deltaMuPhi,suffStat] = VBA_Iphi(phi,y,posterior,suffStat,dim,u,options)
% Gauss-Newton update of the observation parameters
% !! When the observation function is @VBA_odeLim, this Gauss-Newton update
% actually implements a gradient ascent on the variational energy of the
% equivalent determinis... |
73f706b0ce2db6b0f8b4087a42cbdfe9ca87f2909ad6ca1159f66993ad512234 | MATLAB | 3,284 | 84 | function headmodel = triangle4pt(headmodel)
% TRIANGLE4PNT takes the volume model and estimates the 4th point of each
% triangle of each mesh.
%
% Use as
% headmodel = triangle4pt(headmodel)
%
% In each headmodel.bnd sub-structure, a field '.pnt4' is added. The '.pnt4'
% field is a Ntri*3 matrix, with the coordinate... |
40b0678bdde420787cac7af8e232795a767087baa6fe8befb1ef01ca955c6856 | MATLAB | 3,285 | 80 | function [trl,Events] = mytrialfun_all(cfg, threshold, trigNum)
%MYTRIALFUN_ALL detects down-flank triggers from an MEG sqd file with
% specified trigger threshold and defines epochs of data that could be
% used for further processing and analysis using Fieldtrip functions,
% i.e., data that will be read in by FT_PRE... |
cef962c30ae3d17517fd7302252b947b525b7bfb10b8d099818f594123ee842a | MATLAB | 3,285 | 98 | function [tfr,t,f] = tfrpwv(x,t,N,h,trace);
%TFRPWV Pseudo Wigner-Ville time-frequency distribution.
% [TFR,T,F]=TFRPWV(X,T,N,H,TRACE) computes the Pseudo Wigner-Ville
% distribution of a discrete-time signal X, or the
% cross Pseudo Wigner-Ville representation between two signals.
%
% X : signal if auto-PWV, o... |
2d6ac4f68a2488f3ddb91d8edcd7da9cee6121f439f8b97e855303ab245ed57f | MATLAB | 3,287 | 108 | function [logZ, nodeBel, edgeBel, mrf] = crf2InferNodes(model, Xnode, Xedge, varargin)
% Compute node and edge marginals, and log partition function
%
% XNode: Ncases * NnodeFeatures * Nnodes
% Xedge: Ncases * NedgeFeatures * Nedges
% where Nedges = Nnodes * (Nnodes-1) / 2
% if Xedge = [], it is automatically created... |
a441b8e5643fd167d082a3b41a852a46000ed3dff387035b4b80cc626ca4b6a6 | MATLAB | 3,289 | 112 | function [info,isdone] = CheckSplitTracking(lblFile,infoFile,varargin)
% added support for passing unbundled project AR 20190913
[resubmit,ncores,unbundledLbl] = myparse(varargin,'resubmit',false,'ncores',1,'unbundledLbl',[]);
fid = fopen(infoFile,'r');
fns = {'jobi','movieFile','trxFile','startFrame','endFrame','jo... |
0c18ff6e399f5a3655dc139fc57e88e2e66a19974a1ad37d2a21aa784cabfa87 | MATLAB | 3,290 | 103 | function [posterior, out] = demo_multisession ()
% // VBA toolbox //////////////////////////////////////////////////////////
%
% [posterior, out] = demo_multisession ()
% Shows hot to use to fit multiple sessions at once
%
% /////////////////////////////////////////////////////////////////////////
%% Model definition ... |
e4c9e1e99e8a41b4fae24a5ac142fdf5f9ba0bfb0bb6ef5095fbe506d00c2eb0 | MATLAB | 3,290 | 93 | % Pairwise interactions on the unit line, Laplace kernel.
%
% This example computes the interactions between random points on the unit line
% via the Laplace kernel. The associated matrix is square, real, and symmetric.
%
% This demo does the following in order:
%
% - compress the matrix
% - check multiply error/ti... |
4b0e0f7b53cac72b077e1bf1a66536b0f0fd858a7afa5dec926b1568a5baa9a8 | MATLAB | 3,291 | 105 | function c = ttv(a,v,dims)
%TTV Tensor times vector.
%
% Y = TTV(X,A,N) computes the product of 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) - 1 because the N-... |
eda3cdc0671bdce8303784e68f2060ac9e8d1c697a59baae9f30c05f79597bee | MATLAB | 3,291 | 65 | function Analysis = RunBioSigKit(Sig,Fs,Gr)
%% =========== This Function initiates BioSigKit =========== %%
%% Inputs :
% Sig: Input Signal
% Fs : Sample Frequency
% Gr : Set 1 if you want to use the interface otherwise 0.
%% Outputs :
% Analysis object: This is an object with subroutines detailed below.
%% ===... |
5efabb227ce5135c563be41267963e68e18e9cdabb2f2b9cb2dfaeb72b2793db | MATLAB | 3,293 | 101 | function I2 = FbReconstruct2d( I, FB, patch )
% Use to see how much image information is preserved in filter outputs.
%
% Reconstructs the orginal image from filter outputs (approximately). The
% filter output for a patch is given by IFR=F*P where F is the set of
% filters in matrix form, P is the patch and IFR is the ... |
9fb7e564de1a7d4090b078c02bfd85b00f2ebd1e06d3b972ae234128d636593d | MATLAB | 3,293 | 121 | function [ INT ] = bz_IDXtoINT( IDX ,varargin)
%bz_IDXtoINT(IDX) Converts state indices to state on/offsets
%
%INPUT
% IDX: structure with fields: IDX.statenames
% (see buzcode wiki) IDX.states
% IDX.timestamps
% -or-
% [len x 1] vector of state... |
18e9bdf04f044201ae39e44405bd3bda69475b4a8b8436bde02d3b79babc9ce1 | MATLAB | 3,294 | 99 | %% (pxTools) getH0Array
% Get null hypothesis matrix of defined dimensions and filtering.
% If no filtering used, return the identity matrix
%
% For this to be truly comparable to px1|x0, need to normalize mat to px0
%
% Note that columns of terminal states cannot be normalized to 1 (otherwise
% the predicted... |
2eddd79e2600cdcb1a9996a5ccaa04e0ee1f3f776d4bed6d36e1061071d92f7e | MATLAB | 3,294 | 116 | function [Samp, Sph, EjeX, EjeF] = spectrogram_lan( SIG, FE, FRANGE, TRANGE, WinSig, ResHz, step)
% [Rho, Phi, EjeX, EjeF] = spectrogram_lan( SIG, FE, FRANGE, TRANGE, WinSig, ResHz, step)
% uses a FFT transform to compute the spectral power and phase values, of a matrix of signals 'SIG'.
% The smaller dimension of 'SI... |
ab0dc7eef6d89ccb85269d4402db422a6cbd2e204cec1b842a9e222db9dc9f33 | MATLAB | 3,294 | 126 | function s = getPlotStruct(x, y, yErr, xLabel, yLabel, xScale, yScale, legendParName, legendParValues, showLegend, plotTitle)
% xScale -> 'linear', 'log' or 'bar'
% if 'bar', then values on x are given such that the plot looks like a 'bar plot', with each x{i} y{i} being a bar
if (nargin == 0)
s.c... |
4489e495b08e3f62ef08577d3bc5f84311fef690bbf3ac61561fb5f33dcb0cd1 | MATLAB | 3,297 | 83 | function CBIG_KRDNN_generate_K_train(setup_file)
% CBIG_KRDNN_generate_K_train(setup_file)
%
% This function generate kernel for training set for kernel ridge regression
% algorithm.
%
% Inputs:
% - setup_file
% Path of the setup file (.txt file).
% setup_file has the following fields:
% 1. Line 1
% ... |
eaec875499fdfecedcb139fd2bf92f3a482f083bfca8f8ff669e04377dd9ef20 | MATLAB | 3,297 | 99 | function [indx, label, blockindx, blocklabel] = labelcmb2indx(labelcmb, label)
% LABELCMB2INDX computes an array with indices, corresponding to the order
% in a list of labels, for an Nx2 list of label combinations
%
% Use as
% [indx] = labelcmb2indx(labelcmb, label)
% or
% [indx] = labelcmb2indx(labelcmb)
%
% Lab... |
42ed8eba07042768b0db575b6d43d914f25a98707af2a484fe4b7a1e58490d8d | MATLAB | 3,298 | 75 | function y_NormalizeWrite(SourceFile,OutFile,RefFile,ParameterFile,Interp)
% FORMAT y_NormalizeWrite(SourceFile,OutFile,RefFile,ParameterFile,Interp)
% SourceFile - source filename
% OutFile - output filename
% RefFile - reference file to get the voxsize and bounding box
% ParameterFile - the parameter for... |
bd4271782f4966927f3d7b95f83b5a36b5f5906a69bf3a757f167efc2f530692 | MATLAB | 3,298 | 135 | function h_cLimitQuality3(handles)
global h_img3
[currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles);
[maxIntensity, sliderSteps] = h_getMaxIntensity3(handles);
state = currentStruct.state;
%%%%%%%%%% Green %%%%%%%%%%%%%%%%%%%
climit(1) = str2num(get(handles.greenLimitStr... |
45e1fea234aab70d0ed963df89ef03c868a7af2058d11922e88c0eef7ce83957 | MATLAB | 3,299 | 95 | function [DataStructure]=LogFit_ZN(Xdata,Ydata,LogType)
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)~=size(Ydata,2)
warning('... |
6bdee745a5a1f6de27986cac6c6ead79d22406ec4e4ffb85a60c1597d62e74dd | MATLAB | 3,299 | 91 | % SegmentTimeseriesData.m
% Sarah West
% 10/13/21
% A function that segments timeseries data using a list of start and end points for each behvior.
% Is general, so you can use with all kinds of timeseries data.
function [parameters] = SegmentTimeseriesData(parameters)
% Display progress message t... |
d0a33015d77aaa51fed5f9fd73c4fb23e9293436073bda0d01ce70505d7c9a14 | MATLAB | 3,299 | 97 | % CorrelateTimeseriesData.m
% Sarah West
% 2/2/21
% A function that correlates timeseries data.
% Is general, so you can use with all kinds of timeseries data.
% need inputs: parameters.sourceDim, parameters.timeDim
function [parameters] = CorrelateTimeseriesData(parameters)
% Display progress message to use... |
b7d4b7bded6dc8104ea7c04063853e0e017051c3a5406f076d27c62adbbf6f8c | MATLAB | 3,302 | 95 | %% All-at-once optimization for CP tensor decomposition
% We explain how to use |cp_opt| with the POBLANO toolbox.
%% Poblano Optimization Toolbox
% Check that you have Poblano 1.1 installed. The output of your 'ver'
% command should look something like the following.
ver
%% Create an example problem. Here we have 10... |
4b4fc1b01aed3870b0f647161f343a50d5496a8903257fc478acb2b36b1bff7f | MATLAB | 3,303 | 108 | function [ht,rho,theta]=htl(IM,M,N,trace)
% HTL Hough transform for detection of lines in images.
% [HT,RHO,THETA]=HTL(IM,M,N,TRACE).
% From an image IM, computes the integration of the values
% of the image over all the lines. The lines are parametrized
% using polar coordinates. The origin of the coordinates is fixe... |
0209c32814aca1987f2ebf16b1c8d1c87eedfb474dc8b3317dfd078ad3f51565 | MATLAB | 3,304 | 89 | function [dtf,ctf]=SOFAhrtf2dtf(hrtf,varargin)
%SOFAHRTF2DTF converts HRTFs to DTFs (and CTFs)
% Usage: [dtf,ctf]=SOFAhrtf2dtf(hrtf)
% [dtf,ctf]=SOFAhrtf2dtf(hrtf,f1,f2)
%
% Input parameters:
% hrtf: SOFA object with SimpleFreeFieldHRIR convention
%
% Output arguments:
% dtf: S... |
3704bb40c8ad7971a6edb05b0866b3be96fb2e6f6c269ffd742ec76e64d62a93 | MATLAB | 3,304 | 106 | function SAMe = calc_SAME_score(SPM_mat, con_vec, SPM_ref, ref_map, do_plot)
% _
% Calculate SAMe score for a single subject using reference map
% SPM_mat - filepath to SPM.mat of estimated GLM
% con_vec - the memory contrast vector (e.g. [+1 -1 0])
% SPM_ref - filepath to SPM.mat of reference GLM
% ... |
7eaacaf1a77ed96fcd3c196550160ff26dae7bcb76fa8e2da749e7ee15688268 | MATLAB | 3,304 | 98 | function out = afxPlotMovement(rpFilePtrn,outPng)
% see Power et al., 2012, NeuroImage, "Spurious but systematic
% correlations in functional connectivity MRI networks arise from
% subject motion"
if nargin < 1,
[fn,pth,~] = uigetfile('rp*.txt', 'Select rp-file ...');
rpFilePtr... |
599c3d0e6a0bcc0468cf7733cdef156bbf31f477063c395dfed7ff978eb4ea19 | MATLAB | 3,305 | 86 | function GND = myGNDTesting(data, chanInds, EEG, condNames, diffBins, nGoodTrials, nBadTrials, nPerms, expDesc, fNames, doUnivars)
% function GND = myGNDTesting(erpFiles, data, chanInds, EEG, condNames, diffBins, doPerm, expDesc, fNames)
% Put data into an empty GND structure, then run a set of tests on
% difference wa... |
c0556831231c3214ab0df341b25d0d54ece9556ab4bf9d802c72daa8133aac08 | MATLAB | 3,305 | 101 | function [MergedStack] = StackMerge_wBorders(FileID,Stack1_Input,Stack2_Input,Borders,Limits)
%this will load in two stacks and merge them vertically and help avoid
%memory loading issues if large stacks
if length(Limits)~=1
Stack1=load(FileID,Stack1_Input);
Stack1_Name = fieldnames(Stack1);
Stack1 = ... |
e018d228aeb1220bfffe1bc324020c350441f3cb18e6710a6df3545f15d59caf | MATLAB | 3,305 | 94 | function [] = generateBox(params,extensions,directory,folders)
d_side = directory{1};
d_bot = directory{2};
id_side = extensions{1};
id_bot = extensions{2};
boxFold = folders.boxFolder;
videoFolder = folders.vidFolder;
DLT_params = params.DLT_params;
assert(numel(d_side)==numel(d_bot));
nVid = numel(d_side);
%for ... |
332acbc7a04c62f62710a421a67d93ca98f4dcba9ed983f0bb1804ae52414307 | MATLAB | 3,306 | 80 | function [dist] = ft_warp_error(M, input, target, varargin)
% FT_WARP_ERROR computes the mean distance after linear or non-linear warping
% and can be used as the goalfunction in a 3D warping minimalisation
%
% Use as
% dist = ft_warp_error(M, input, target, 'method')
%
% It returns the mean Euclidian distance (i.e.... |
7c82ba03e7b35c27d72c1e2f22f11d3adb01ea8f2a558490ac61f6fc30649eef | MATLAB | 3,306 | 80 | function [dist] = ft_warp_error(M, input, target, varargin)
% FT_WARP_ERROR computes the mean distance after linear or non-linear warping
% and can be used as the goalfunction in a 3D warping minimalisation
%
% Use as
% dist = ft_warp_error(M, input, target, 'method')
%
% It returns the mean Euclidian distance (i.e.... |
e5f9b89a34450c7582fd4ca84339b110f2a2e7acee99840724c518dda91d8508 | MATLAB | 3,307 | 79 | function [J,boundX,boundY] = textureMap( I, rsDst, csDst, bbox, fillVal )
% Maps texture in I according to rsDst and csDst.
%
% I has (nrows*ncols) coordinates. Each coordinate has an associated
% intensity value. A transformation on I can be defined by giving the
% destination (r',c') of the intensity associated wit... |
f4abbb2e18281726443b783acee31ddbf8ce34db711dcb8ea0d3bc53313cca99 | MATLAB | 3,307 | 110 | %ISOLATE_AXES Isolate the specified axes in a figure on their own
%
% Examples:
% fh = isolate_axes(ah)
% fh = isolate_axes(ah, vis)
%
% This function will create a new figure containing the axes specified, and
% also their associated legends and colorbars. The axes specified must all
% be in the same figur... |
cc567cceae4314071edeb7f8db44e51b22af43bd59f5bf82e1a99deb4a163727 | MATLAB | 3,308 | 108 | function [sel1, sel2] = match_str(a, b, fullout)
% MATCH_STR looks for matching labels in two lists of strings
% and returns the indices into both the 1st and 2nd list of the matches.
% They will be ordered according to the first input argument.
%
% Use as
% [sel1, sel2] = match_str(strlist1, strlist2)
%
% The strin... |
836547c11cb0080f589fa1fcc4cbc6b367b0de54b4da44fdf3feb028d738c1ed | MATLAB | 3,309 | 94 | function [dat,beta,x] = ft_preproc_polyremoval(dat, order, begsample, endsample, flag)
% FT_PREPROC_POLYREMOVAL removed an Nth order polynomal from the data
%
% Use as
% dat = ft_preproc_polyremoval(dat, order, begsample, endsample, flag)
% where
% dat data matrix (Nchans X Ntime)
% order the order o... |
37fb6ef48a05e9b4ac0dceadf7a519e4dbbc98421c2b664017c81504549bed52 | MATLAB | 3,310 | 84 | function [X, info] = dominant_invariant_subspace_complex(A, p)
% Returns a unitary basis of the dominant invariant p-subspace of A.
%
% function X = dominant_invariant_subspace(A, p)
%
% Input: A complex, Hermitian matrix A of size nxn and an integer p < n.
% Output: A complex, unitary matrix X of size nxp such t... |
62dae532fb65e8039521e5d508f06f4852251732b78177b36ed946ac8b68dfa8 | MATLAB | 3,310 | 108 | function [sortedMat,rowOrd,colOrd] = sortMatDiag(d,discoutrate,rowSortType)
% function [sortedMat,rowOrd,colOrd] = sortMatDiag(d)
% % sort matrix such that digonal lines tended to have large values
%
% [input]
% d: original matrix
% discoutrate: discout rate for judging to move next row. default = 1;
% rowSortTyp... |
95c637fe6c85d865bfb7108003d6d8ede6b9009759fab19922bab28b9f8c3099 | MATLAB | 3,310 | 135 | % 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,... |
65ae3e8f92fc3d518bf24562cb8ba4dd1d93a8c451d231abba1a8af5da92b262 | MATLAB | 3,311 | 175 | function [LAN] = eeglab2lan(EEG,nonQ)
% transform EEGLAB format to LAN
%
% v.0.0.7
%
% 17.10.2012
% 16.4.2010
% 20.4.2010
%
% 24.4.2010
%
% Pablo Billeke
if nargin <2
nonQ=0;
end
if iscell(EEG)
for lan = 1:length(EEG)
LAN{lan} = eeglab2lan_str(EEG{lan},nonQ)
end
elseif length(EEG) > 1
for... |
52882b2e664d6f8db49c057d399e05e59cd2bd06d64f6e610660c8aaf88d1061 | MATLAB | 3,312 | 85 | function Y = sym_sne(X, d, perplexity)
%SNE Implementation of symmetric Stochastic Neighbor Embedding
%
% mappedX = sym_sne(X, no_dims, perplexity)
%
% Runs the symmetric Stochastic Neighbor Embedding algorithm. The
% high-dimensional datapoints are specified by X. The target dimensionality
% is specified in ... |
d3133d52228c28225d4cc1dd748b6c8a70caac7252d38f62bc67073376529e57 | MATLAB | 3,312 | 84 | % create_mice_all_no_missing_bodydata.m
% Sarah West
% 7/22/22
% Load list of missing data (all other mice)
load('Y:\Sarah\Analysis\Experiments\Random Motorized Treadmill\behavior\body\missing_data.mat');
list_1 = missing_data;
% Load list of missing data (mouse 1099)
load('Y:\Sarah\Analysis\Experiments\Random Motor... |
26a61fc058ecfde4909f0920cdaa12ad7a575053cdf44af69500442f514ca0ad | MATLAB | 3,313 | 130 | % eeg_emptyset() - Initialize an EEG dataset structure with default values.
%
% Usage:
% >> EEG = eeg_emptyset();
%
% Outputs:
% EEG - empty dataset structure with default values.
%
% Author: Arnaud Delorme, CNL / Salk Institute, 2001
%
% See also: eeglab()
%12345678901234567890123456789012345678901234567890123... |
756f0e9f7645b98eab3e444b8070ce2d3e3f1e14b41861418f2856024b25ad3d | MATLAB | 3,313 | 98 | %% for active touch behavior with surface grids, quantify late LFP amplitude and slope in hits vs cr
% you manually annoate the onset of the late wave and this finds the late
% wave peak
clear;clc
Fs = 1000;%samples/s
touchTime = 100;%ms
%path to TW results from generalized phase
load('D:\InVivo\ActiveTouc... |
ebe240bcb34ed57b9e33437ae12c2595525dd6e93f0679a9c5b47b92c68e382b | MATLAB | 3,313 | 97 | function [tfr,t,f] = tfrpmh(x,t,N,h,trace);
%TFRPMH Pseudo Margenau-Hill time-frequency distribution.
% [TFR,T,F]=TFRPMH(X,T,N,H,TRACE) computes the Pseudo Margenau-Hill
% distribution of a discrete-time signal X, or the
% cross Pseudo Margenau-Hill representation between two signals.
%
% X... |
d9dcaf2ad94a4d4a52525ecf9bea1a73867ef3e396e29b990478417659258b24 | MATLAB | 3,315 | 98 | function event = read_serial_event(filename)
% READ_SERIAL_EVENT
%
% changed A.Hadjipapas 2010
%
% The only thing transmitted is the event.value (no info about sample) but it works
% Copyright (C) 2007, Christian Hesse
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and... |
fdb5d6181f207741fda09bd78bfac58a9c8baa9187620e741f34a6b9afbeb250 | MATLAB | 3,315 | 106 | function h = nifti(varargin)
% Create a NIFTI-1 object
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging
%
% $Id: nifti.m 7758 2019-12-16 16:04:25Z guillaume $
switch nargin
case 0
hdr = empty_hdr;
h = struct('hdr',h... |
2de5bcf6707df1dc87d526343f918211b462c5af2562b74e281a9cdafa758926 | MATLAB | 3,316 | 128 | % This script takes fluoro data, finds the max, finds the baseline region as x
% images before the max, calculates the average fluorescence over that
% region, calculates max deltaF/F
% TODO: should change this figure to display time and not images
function [bf, maxF, df, sds, maxFSmooth, dfSmooth, sdsSmooth, bdps, w... |
56872b706fc6c8c976edfce61a988c086b630d20127e9719785b0fd750bc39a1 | MATLAB | 3,316 | 84 | function Y = sne(X, d, perplexity)
%SNE Implementation of Stochastic Neighbor Embedding
%
% mappedX = sne(X, no_dims, perplexity)
%
% Runs the Stochastic Neighbor Embedding algorithm using a Gaussian kernel
% with fixed perplexity. The high-dimensional datapoints are specified by X.
% The target dimensionali... |
8d91ff863307b2c4e5b3e78f130759226dfa6150cacc5130fa0fad93e31197ce | MATLAB | 3,316 | 97 | function seqinfo = r_readseqinfo(fname,indx_fname)
% r_readseqinfo: function to read info from a .seq file
%
% form:seqinfo = r_readseqinfo(fname)
%
% modified from shay ohayon's modification of piotr dollar's initial code
strSeqFileName=fname; % (0)
fid = fopen(fname,'r');
fseek(fid,0,'bof');
% first 4 by... |
fe9a6dd4571f6a689428a09f77a4b4a7e3f2c8c57b7f4661fe5fcc1190a2005f | MATLAB | 3,318 | 96 | function log = read_neuromag_maxfilterlog(filename)
% READ_NEUROMAG_MAXFILTERLOG reads the ascii logfile that is produced by MaxFilter
%
% Use as
% log = read_neuromag_maxfilterlog(filename)
%
% See also READ_NEUROMAG_EVE, READ_NEUROMAG_HC
% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, s... |
213993b5fdd7676aeac75c60720ccae0f47efa9487e2858d7e28206c31ce9f15 | MATLAB | 3,319 | 121 | % AUTHORSHIP
% Primary Developer: Connor Meehan <connor.gw.meehan@gmail.com>
% Secondary Developer: Stephen Meehan <swmeehan@stanford.edu>
% Bioinformatics Lead & Secondary Developer: Wayne Moore <wmoore@stanford.edu>
% Provided by the Herzenberg Lab at Stanford University
% License: BSD 3 clause
%
funct... |
01d6dd9309c245553bb1b886c1c67723cf266b16cac768d6d5ed01cad6431d6a | MATLAB | 3,320 | 106 | function rightClickCallback(self,p)
if isempty(self.channel_to_work_with)
return
end
channel = self.channel_to_work_with;
ylimits = self.handles.ax.ax(channel).YLim;
xlimits = self.handles.ax.ax(channel).XLim;
xrange = (xlimits(2) - xlimits(1))/self.dt;
yrange = ylimits(2) - ylimits(1);
p(1) = p(1)/self.dt;
... |
efa68531f8a9836d8dd45da400876a46bd9c3f005a37791f7124256689d97524 | MATLAB | 3,320 | 86 | function network = backprop(network, X, T, max_iter, noise, lambda)
%BACKPROP Trains a network on a dataset using backpropagation
%
% network = backprop(network, X, T, max_iter, noise, lambda)
%
% The function trains the specified network using backpropagation on
% dataset X with targets T for max_iter iteratio... |
fc8c9b990fc161ac46425894be4a295308677f925fa7be58932045809304b1d2 | MATLAB | 3,320 | 101 | function varargout = pcaApply( X, U, mu, k )
% Companion function to pca.
%
% Use pca.m to retrieve the principal components U and the mean mu from a
% set of vectors x, then use pcaApply to get the first k coefficients of
% x in the space spanned by the columns of U. See pca for general usage.
%
% If x is large, pcaAp... |
38bbc28e993e6b6589d6d8222f45d2ca31ecdc70a78e2da87a9d4ac3736d5df5 | MATLAB | 3,321 | 88 | function err = h_loadDefault3(handles, flag)
global h_img3;
% flag = 1 (default), 2 or 3
if ~exist('flag', 'var') || isempty(flag)
flag = 1;
end
[currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles);
pname = h_findFilePath('h_imstack3.m');
fileName = fullfile(pname... |
6f0681a55e7c08c21cd22b2da2cd53ccfb8449a71e270ae349e69bae9c36ba00 | MATLAB | 3,321 | 88 | %% Converting sparse tensors to matrices and vice versa
% We show how to convert a sptensor to a matrix stored in _coordinate_
% format and with extra information so that it can be converted back to a
% sptensor.
%% Creating a sptenmat (sparse tensor as sparse matrix) object
% A sparse tensor can be converted to a spa... |
fb1a82e300279809d4023998d935b1d81062ede955f989c561a4b9820ae511c8 | MATLAB | 3,321 | 107 | function [ rate_avg rate_dev rate_sem ] = wlStats_getMatrixBurstRates( ...
detectmatrix, time_bins_sec, bootcount )
% function [ rate_avg rate_dev rate_sem ] = wlStats_getMatrixBurstRates( ...
% detectmatrix, time_bins_sec, bootcount )
%
% This computes the average burst rate across trials within a set of
% time b... |
7139b8788dcce5d41d14a258c591406f85a494c8ccc646f77ab8b5d9ab4cff8a | MATLAB | 3,323 | 59 | classdef About_Dataspace
% Dataspace (short: dspace) is a set of data structures, analysis functions and a graphical user interface intended to facilitate data analysis in various fields of science.
%
% Copyright (C) 2020 University Zurich, Sepp Kollmorgen
%
% This program is distributed in th... |
780cbd7e333430fe3998c197e2f20f3307e9c9b9253a5fce20781c0732d3615f | MATLAB | 3,324 | 88 | function [pts_in_smallBin, bigbin_idx_in_smallBin] = part_cluster_linkage(...
pts_in_bigBin, distMat, sl_histo_bins, linkage_method)
% Function part_cluster_linkage
% Partial clustering with single linkage and histograms
% Notation: Mapper does two binning steps. We give the name "bigBins" to
% the... |
15b64afb745602f0162c496d0271baa3f64a132724ae942f89ca152a734e98ec | MATLAB | 3,325 | 111 | % copyaxis_lan() - helper function for axcopy()
%
% Usage: >> copyaxis();
% >> copyaxis( command );
%
% Note: The optional command option (a string that will be evaluated
% when the figure is created allows to customize display).
%
% Author: Tzyy-Ping Jung, SCCN/INC/UCSD, La Jolla, 2000
%
% See also: axc... |
15e492ad53c9eb7f0f13634eceb2b83054f0be58b34f76f939e8c891caa0fbcc | MATLAB | 3,326 | 130 | function [priors] = getPriors(nreg,n_t,options,reduced_f,stochastic)
% builds priors for DCM inversion
% function [priors] = getPriors(nreg,n_t,options,reduced_f,stochastic)
% IN:
% - nreg: # regions in the network
% - n_t: length of the time series
% - options: options structure, containing at least the .inF and... |
aca376e40f10584c7e58e3d1842857e5cf1f086e8696b1c73a329ed45ca16299 | MATLAB | 3,327 | 124 | function [datsmooth] = ft_preproc_smooth(dat, n, tol)
% FT_PREPROC_SMOOTH performs boxcar smoothing with specified length.
% Edge behavior is improved by implicit padding with the mean over
% half the boxcar length at the edges of the data segment.
%
% Use as
% datsmooth = ft_preproc_smooth(dat, n)
%
% Where dat is ... |
5140e7e5b00effc9e6d60435755eaee858299ecdbdc445c5fac57b5248d9e6c1 | MATLAB | 3,328 | 80 | % Author: Birgit Nierula
% nierula@cbs.mpg.de
function blocks = eeg_prepro_loop5(subjects, conditions, srmr_nr)
%% loop 5: inspect how many percent of the data got excluded
art_rej_all = struct();
c = 0; % dataset index
for subject = subjects
subject_id = sprintf('SRMR%01i_S%02i', srmr_nr, subject); % this is th... |
4ab9d09279771133ebf25c7e54d915d280cda1db37fb3589f1ecf770ea88448d | MATLAB | 3,329 | 86 | function [PFmat, PFpeaksSequence] = calculate_PFmat(linfields, modelParam, network, varargin)
% calculate_PFmat
%
% Calculate the matrix of place fields PFmat and the sequence of place
% field peaks PFpeaksSequence from the linfields cell array
%
% Inputs:
% - linfields: linear place field cell array matching Jadhav ... |
7347e57de746e7d8ff4675e141a060887ce66641155c8559bd7dcd7d4f200b8b | MATLAB | 3,329 | 96 | % Better Stitcher v 0.99, released Feb, 23, 2021
% An improved version of the wably stitcher done by YTW in YK lab
clear
close all
% Basic inputs
Sorce_folder = 'E:\lab_member\YTW\KN387_raw'; % This one "refered" to be SSD
Working_folder = 'E:\lab_member\YTW\KN387_testing'; % This one "have" to be SSD that i... |
b3426f0e0bd2cd3916b49bf36350e3e4fc6976ec2d8323ba61779bd89efee9c6 | MATLAB | 3,329 | 93 | %% NVR Select HA and LA epochs
% Select epochs with two or 1 ECG events and two (identical) or l arousal
% events (LA or HA)
% 2024 by Antonin Fourcade
function NVR_11_sepHALA(cropstyle, mov_cond, path_data)
%% 1.Set Variables
%clc
%clear all
%1.1 Set different paths:
% input paths:
path_data_eeg = [path_data 'EEG/']... |
e275d3890675aa76f4d49c06a12f63833e6a884cd40aec3dd4c68844909476fe | MATLAB | 3,330 | 102 |
function run_ks2(basepath,ks2_folder)
%% you need to change most of the paths in this block
rootZ = basepath; % the raw data binary file is in this folder
rootH = basepath; % path to temporary binary file (same size as data, should be on fast SSD)
pathToYourConfigFile = 'C:\Users\schafferlab\github\Kilosort-2.5'; % t... |
f5c38b0bd0c93962e8757ad34340ee7d118438683c69943ef98942748f32e6a0 | MATLAB | 3,330 | 99 | function tests = test_VBA_sigmoid
% Unit Tests for VBA_test_sigmoid
tests = functiontests (localfunctions);
% simple cases
function test_empty (testCase)
actual = VBA_sigmoid([]);
testCase.verifyEmpty(actual);
function test_canonical_scalar (testCase)
for x = - 5 : 5
actual = VBA_sigmoid(x);
... |
237b06e6a6ee6fe05befc9911f9bcfbfc718a5a060e5ee1713a79dfed4049815 | MATLAB | 3,331 | 86 | function ft_postamble(cmd, varargin)
% FT_POSTAMBLE is a helper function that is included in many of the FieldTrip
% functions and which takes care of some general settings and operations at the end
% of the function.
%
% This ft_postamble m-file is a function, but internally it executes a number of
% private scripts ... |
781b9833088d7039d636c9e7f971fd7b2bb9c62fdaef5a4582caa2ccc929ae6b | MATLAB | 3,332 | 108 | classdef TrackingVisualizerMTFastModel < TrackingVisualizerModel
% Model layer for TrackingVisualizerMTFast.
%
% Holds non-gobject properties extracted from TrackingVisualizerMTFast:
% tracking data, current-frame xy cache, show/hide flags, etc.
properties
lObj % Labeler reference
trk % scalar TrkFile, view... |
a254a11bb35aaa206bdbfe0c115081521053036351e6d33027d4cbdf582ffedb | MATLAB | 3,332 | 111 | % CorrFluor.m
% Sarah West
% 1/20/23
% High-level function to calculate correlation between changes in
% fluorescence and correlation per condition.
function [parameters] = CorrFluor(parameters)
% parameters.correlations -- 7 x 16 x 48 ; mouse, node, comparison
% parameters.fluorescence -- 7 x 16 x 48 ; ... |
0e74d59f94fef94ba36bd05765b3a3b4956146feb78248df9ed7fbd191ac10ac | MATLAB | 3,333 | 89 | classdef AbstractDerivedFeatures < dspace_features.AbstractFeatures
% Derived features are computed for each datapoint as some transformation
% of some other coordinates (the parent-coordinates).
%
% Any coordinates should be subclasses of either dspace_features.AbstractFeatures
% or dspace_fea... |
407a6088d1f59720e925772b86ea835acbb2678ee3f836682f4b1b8874886a1b | MATLAB | 3,336 | 78 | function cPPI_without_deconv_FIR(stat_path,exp_folder,N,N_ROIs,q_level,ground_truth)
% ========================================================================
% Ruslan Masharipov, October, 2023
% email: ruslan.s.masharipov@gmail.com
% ========================================================================
tic
for s... |
b9fadfeeabf2a5e88e5d257fcf6eb22ab01d3b8b40c7296142939ce0ca71aa99 | MATLAB | 3,336 | 121 | function export_data(A, fname)
%EXPORT_DATA Export tensor-related data to a file.
%
% EXPORT(A,FNAME) exports object A to the file named FNAME in plain ASCII
% text. Export currently supports exporting the following data types:
%
% - tensor
% - sptensor
% - matrix
%
% In the case of a tensor, th... |
a669cbd13d465157860b7c786bbf53a9db4301e7af01f01723093cda010537c0 | MATLAB | 3,337 | 105 | function EEG = myEyeArtefactFlagging(EEG, varargin)
% function EEG = myEyeArtefactFlagging(EEG, varargin)
% wrapper function to call my eye artefact flagging routine, uses eeglab.
% Flags muscle artefacts using pop_artextval, and uses FlagTriggersInWindow
% to remove blinks/saccades (detected by eyetracker and trigger ... |
d960adbdb003136a92202b053ed861fed63528a841e83765e6ed59e86795d07a | MATLAB | 3,337 | 86 | close all
fold = 'D:\BS_Videos\L320 Retinal Female\';
botView = [fold 'Bottom View\100fps\210316_Afternoon2_BS_AllTrialVid_100Hz_bot.avi'];
sideView = [fold 'Side View\100fps\210316_Afternoon2_BS_AllTrialVid_100Hz_side.avi'];
fold = 'D:\BS_Videos\L320 Retinal Female\';
botView2 = [fold 'Bottom View\100fps\210923_After... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.