sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9ac1fc5babe1dbcfc0abae5f251c028dd34527c831d4e303e78aa2a32b267b0b
MATLAB
2,234
80
% Author: Birgit Nierula % nierula@cbs.mpg.de function esg_prepro_loop2(subject, condition, srmr_nr, sampling_rate) % set variables subject_id = sprintf('sub-%03i', subject); analysis_path = [getenv('ANADIR') subject_id '/esg/prepro/']; if ~isfolder(analysis_path) mkdir(analysis_path); end % get condition inf...
10f7e7b6db8f4e62b1a46b1bdb076aa1eef663334a1113094b97679dfd76ac0f
MATLAB
2,235
59
% Purpose: Convert lh_labels and rh_labels to gifti shape files for later WB % visualization % Inputs: lh_labels and rh_labels from generate_network_overlap.m and template gifti % files in appropriate resolution. % Outputs: .shape.gii files containing AI values. % % Note: Template .shape.gii files can be created using...
afb746193323c8223900f52fae47006502ae4598bf1bf2eac02ea6aa7a24b075
MATLAB
2,235
71
% load sessions csv metadata = readtable('Y:\laura_berkowitz\behavior_metadata.csv','Delimiter','comma'); % only use the basepaths basepaths = unique(metadata.basepath); %% overwrite overwrite_coords = true; for i = 1:length(basepaths) % get channel map from anatomical basepath = basepaths{i}; cd(ba...
d8957299e670c2cf9b08db940da07c67a01885cf98489b60e46b5739bcb7c892
MATLAB
2,235
74
function [negResp, negIndex, posResp, posIndex] = zscore_response(responses,stimPnt) %% >>> OPERATION >>> % Defines significant negative and positive responses based on Z-scores % INPUTS % NAME TYPE NOTES % responses m-by-n array m is the number of trials, n are the % ...
8e414bb5b4b11f1dc3ca6ca869705601c81e41b363e87dfab9f6a76aa22a4c1e
MATLAB
2,236
76
classdef Platform < uint8 % apt.Platform - Enumeration for operating system platform types % % This enumeration distinguishes between different operating system families % to enable platform-specific path handling, command formatting, and file % system operations within APT. % % Enumeration values: % ...
9a89cff68174e19c2d6474c00c3dcf7e86c8c6e2ee204a7b486e5e2624f8cc71
MATLAB
2,236
72
function renamefile(f,pat1,pat2,opt) %RENAMEFILE Rename a series of files. % RENAMEFILE(NAME, P1, P2) renames the files matching NAME, replacing % the substring P1 by P2. NAME may be a cell array of strings, and may % contain wildcards (*) and brackets (see RDIR). % % RENAMEFILE(NAME, P1, P2, OPT), where OPT i...
3bf1894f82038bbddd406ac78c28b7bd98bfc0b72f26b01098255d9e074f33a1
MATLAB
2,237
62
% Function: PLS and do permutation. %perform full PLS and plot variance in Y explained by top 15 components %typically top 2 or 3 components will explain a large part of the variance %(hopefully!) % Updata date: 2022.09.18 % Email:luolongcao@163.com function PLSperm_result = Method_PLSpermutation(X,Y,dim,rep,out_...
c8275aca76f448f3f596fa71be816f759ef8973e1ca4c51ccdbcb21ee4c08acf
MATLAB
2,237
59
% Edited by Jerry. 10/26/2023 function [datamean,datastd] = ScatterPlotBehavior_231026... (data,Title,Xlabels,Ylabels,figsize,SaveDir,alpha,ErrType,Yrange) % Function to do a scatter plot with error bar of the data % dataTable: a table with labels corresponding to the categories % title: the title of ...
2c916030d36a0af6a6220613bea2cbf9104adca1b035bf08adff7806145b7326
MATLAB
2,238
50
ops.chanMap = 'D:\GitHub\KiloSort2\configFiles\neuropixPhase3A_kilosortChanMap.mat'; % ops.chanMap = 1:ops.Nchan; % treated as linear probe if no chanMap file % sample rate ops.fs = 32000; % frequency for high pass filtering (150) ops.fshigh = 150; % minimum firing rate on a "good" channel (0 to ski...
2e6e932b07d760e240c03faab0dab739f891499f59e9f7391e23c6247010f331
MATLAB
2,238
70
function dimsiz = getdimsiz(data, field) % GETDIMSIZ % % Use as % dimsiz = getdimsiz(data, field) % % If the length of the vector that is returned is smaller than the % number of dimensions that you would expect from GETDIMORD, you % should assume that it has trailing singleton dimensions. % % Example use % dimord...
ac6dfb79b87994a6187d1d9d80d3d97bcf8d9d1fab8f9d9ac3bb38cb562948bd
MATLAB
2,238
46
for k = 1:length(Z) clf; z = Z(k); % Display NIFTI slice I = round(z/d1d2d3(3) + N1N2N3(3)/2); S = VT(:, :, I)'; % choose the Z cross-section S = S(:, end:-1:1); image([-DimensionX/2 +DimensionX/2], [-DimensionY/2 +DimensionY/2], S, 'CDataMapping', 'scaled'); colormap bone; b...
aee89df6b2d5bc2b7f4bf6c6fa3ebc77b2326429cde7133b7762d2391ad013da
MATLAB
2,239
62
function [nodeBels, logZ, nodeBelArray] = dgmInferNodes(dgm, varargin) %% Return all node beliefs (single marginals) %% Inputs % % dgm - a struct created by dgmCreate % %% Optional named inputs % % 'clamped' - a sparse vector of size 1-by-nnodes. % clamped(t) = j means node t is clamped to state j % ...
c2db7c59e7701c890f5332917fb111922a4508554edd1190c1df40568fef8415
MATLAB
2,239
82
%% Mulitlayer Perceptron HMC Regression Demo % Based on Netlan's DEMHMC3 % We modified the code so the model is as similar as possible % to the one in demev1, so we can compare MCMC with Laplace approx %% Create the data and do EB on the network % This file is from pmtk3.googlecode.com mlpRegEvidenceDemo; % use the...
fe1d7ed6915d6a5d04a32d9620be38ae6e0f7b02671f839b79665c236b0f7da8
MATLAB
2,239
76
function is_same = compare_hdf5_images(srcDir, dstDir, ds, avgErrTol) srcFiles = dir(fullfile(srcDir,'*.h5')); dstFiles = dir(fullfile(dstDir,'*.h5')); if length(srcFiles) == 0 disp('no hdf5 file.'); is_same = false; return; end if length(srcFiles) ~= length(dstFiles) ...
618b82cd2bf0a5da999b0f925316bddeb03f89b99c7d35e1586fe6d57cb037c0
MATLAB
2,240
69
%% NVR Copy ICA weights from HP-1Hz dataset to dataset % 2024 by Antonin Fourcade % Beforehand, need to run ICA decomposition on a copy of the data high-pass filtered at % 1Hz! function NVR_06_copy_ICA(cropstyle, mov_cond, path_data) %% 1.Set Variables %clc %clear all %1.1 Set different paths: path_data_eeg = [path_...
ac74ca77c6da97b662592ee246364bdf3a04aa4db95cdddc5bd053cef1a8d805
MATLAB
2,240
69
function AutoPlaybackBig(ImageArray,PauseInterval,IntensityLimits) SizeScaleFactor=1.5; figure(); set(gcf, 'color', 'white');set(gca,'XTick', []); set(gca,'YTick', []); BringAllToFront(); Beeper(5,0.15) ArraySize=size(ImageArray); ScreenSize=get(0, 'screensize'); if ScreenSize(3)>ArraySize(2)*SizeScaleFactor+40&&...
e0fc71179270ad4fd677d8135398801e2556fe37699346ab00652e0bb8b0fe75
MATLAB
2,240
86
function y = wkeep2_gpu(x,siz,varargin) %WKEEP2 Keep part of a matrix. % Y = WKEEP2(X,S) extracts the central part of the matrix X. % S is the size of Y. % Y = WKEEP2(X,S,[FIRSTR,FIRSTC]) extracts the submatrix of % matrix X, of size S and starting from X(FIRSTR,FIRSTC). % M. Misiti, Y. Misiti, G. Oppenhe...
f004448e410a397bd1cffac537035f849372a662df73e818f256cdfce99a67ea
MATLAB
2,240
71
%% SAT - app_input :: %% getAppXtCellFromXtCell % Name: Phone Kyaw % Date: 09/10/2024 %_______________________________________ % Copyright (C) 2024 Phone Kyaw % 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 Publi...
29f998aacfe50ad89202b094088ad351c32e03d13aa1508ea1057809d9db168c
MATLAB
2,241
68
%% pxTools_getXfromPx % Assign a single state from a distribution, using a given metric; % if passing an MxN array, evaluate each column as a distribution; % % If input is a doubles array, output a doubles array. % If input is a struct, output a struct, with x calculated over all fields % % Current methods in...
2572f318713f0540084b1a1aeeaa742490e1d12cf73a5921f65135743b992ba6
MATLAB
2,242
85
%% Demonstrate a non-parametric (parzen) density estimator in 1D %% % This file is from pmtk3.googlecode.com function parzenWindowDemo setSeed(2); [data, f] = generateData; n = size(data,1); domain = 0:0.001:1; kernels = {'gauss', 'unif'}; for kk=1:2 kernel = kernels{kk}; switch kernel case 'gauss', hv...
fe4590ad8923c0a94c7195a8da01e91430188f3fad7447552b77acf2d7140dd9
MATLAB
2,242
65
function surr = CBIG_RL2017_get_PR_surrogate(TC , n_surr) % surr = CBIG_RL2017_get_PR_surrogate(TC , n_surr) % This function generates phase randomized (PR) surrogates. The two % mandatory inputs are: % 'TC' original time course of size (num_timepoints,num_variables) % In this cas...
75a7c9f2d29b2d6f645c66e2d260cba2e214edc96a42a39e85d592e1be09708b
MATLAB
2,243
52
function [data_filter_above,data_filter_below] = loc_list_clusters_filter_aspect_ratio(data) answer = inputdlg({'Major Axis to Minor Axis Aspect Ratio Threshold:'},'Input',[1 50],{'1.5'}); if isempty(answer)~=1 min_aspect_ratio = str2double(answer{1}); f = waitbar(0,'Filtering Based On Aspect Ratio...');...
04d52acfbf702c0bf02150496745c05cdc822608686af5f1ae2b201b7b127411
MATLAB
2,244
86
function pairs(X,vnames,plotsymbol,diagonal) % PURPOSE: Pairwise scatter plots of the columns of x %--------------------------------------------------- % USAGE: pscatter(x,vnames,pltsym,diagon) % or pscatter(x) which relies on defaults % where: % x = an nxk matrix with columns containing variables %...
c9b48449af6052f5c9255681d023f5b07c38c4cd58ff50793ed862efdb56d1c8
MATLAB
2,245
81
% read_eeglabheader() - import EEGLAB dataset files % % Usage: % >> header = read_eeglabheader(filename); % % Inputs: % filename - [string] file name % % Outputs: % header - FILEIO toolbox type structure % % Author: Arnaud Delorme, SCCN, INC, UCSD, 2008- %1234567890123456789012345678901234567890123456789012345...
0526671df35853011d12d12d8a47acd90bfde50175717ab3403018ebc659e2fa
MATLAB
2,246
94
% 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,...
3a4f624d74f0914a2a5c6a3674b5c3fcc2d543d4bb6b9e031d9060537bc92956
MATLAB
2,246
94
% 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,...
58537e4fb0eff9e69b62223980cbeebceeaf6f155bdc951731131426afbdef45
MATLAB
2,247
76
function [file] = read_bti_ascii(filename) % READ_BTI_ASCII reads general data from a BTI configuration file % % The file should be formatted like % Group: % item1 : value1a value1b value1c % item2 : value2a value2b value2c % item3 : value3a value3b value3c % item4 : value4a value4b value4c ...
8e73be3db1e37518fb5dd9f6b4a895c56f39b6278c678979bb3080de53047a13
MATLAB
2,247
124
function [r,t,p]=spear(x,y) %Syntax: [r,t,p]=spear(x,y) %__________________________ % % Spearman's rank correalation coefficient. % % r is the Spearman's rank correlation coefficient. % t is the t-ratio of r. % p is the corresponding p-value. % x is the first data series (column). % y is the second data series, a matri...
ce65d838303f8b5b98ee2f7b31602365865903b9ca3faad25f72c010483faae8
MATLAB
2,247
56
% QGIF evolution function: % % [fx] = f_CaBBI_QGIF(Xt,Theta,Isyn,inF) % % this function contains the equations and parameters of the QGIF neuron % model, and the over-time integration scheme function [fx] = f_CaBBI_QGIF(Xt,Theta,Isyn,inF) dt = inF.dt; Tau_Ca0 = inF.Tau_Ca0; % hidden variables V = ...
c86c8067d0f913481f740db5931f7a6bff296a10e582b8e62e3985dac3e377c0
MATLAB
2,249
65
% This script plots the electric potential of the primary, secondary, or % the full field for any brain compartment surface % % Copyright SNM/WAW 2017-2020 eps0 = 8.85418782e-012; % Dielectric permittivity of vacuum(~air) mu0 = 1.25663706e-006; % Magnetic permeability of vacuum(~air) %% ...
98c07b4c8692d1550a43cb6f4d312996050e093af2f7162e501a0809a8533e37
MATLAB
2,250
44
function y_Call_dcm2nii(InputFilename, OutputDir, Option) % function y_Call_dcm2nii(InputFilename, OutputDir, Option) % Call Chris Rorden's dcm2nii for different platform as well as for parfor usage. ('eval' is not suitable for 'parfor') % Input: % InputFilename - The Input File name. Could be one of the DICOM file...
d766c197b95e81ebb2b9bcafaf4a45330c3ed233ee0ad2cbdba46e42e9ebf546
MATLAB
2,250
65
function t = getLinesearch(problem, x, d, storedb, key) % Returns a hint for line-search algorithms. % % function t = getLinesearch(problem, x, d) % function t = getLinesearch(problem, x, d, storedb) % function t = getLinesearch(problem, x, d, storedb, key) % % For a line-search problem at x along the tangent di...
6ae35b6233cc6ea418065d6b629029fbac67c88c3ab689647223068c415eb979
MATLAB
2,252
76
% This demo compares exponential vs hyperbolic temporal discounting. % This script simulates an agent making choices between two options, which % differ in terms of the expected reward and temporal horizons, under both % an hyperbolic and an exponantial temporal discounting model. % The choice data are then inverted us...
938dfceec6993b9c4df5eb36203f66cd8b37f27c6380a090c550a2b5b22357a0
MATLAB
2,252
49
% Filters can constrain what data is currently displayed and analyzed. They % are specified as MATLAB expressions that evaluate to logical vectors. % They can access the label table of the datasource through a table % % >> P. % % The filter expression can also access variables a and...
287b4bd0286aaef92b64c7e43a52d80e7738d3b1a38db14e63afee2fcc5d461b
MATLAB
2,253
82
function out = linregPostSummary(model, varargin) % Return summaries of the posterior distribution of the regression weights % You must call linregFitBayes first % out is a structure containing % what % posterior mean % stderr % posterior standard deviation % credint(i,1:2) % 95% credible interval % % If you set dis...
2a273c0bb37b34c2a271999fbed0475f5b318dfcfa12931e74becf23860eb9ba
MATLAB
2,253
87
function newlist = wlAux_mergeEventLists(oldlistarray, ... comparefunc, binsecs, huntbins) % function newlist = wlAux_mergeEventLists(oldlistarray, ... % comparefunc, binsecs, huntbins) % % This function merges multiple event lists, removing duplicates. % Duplicates are those that match according to "comparefunc"....
8a3b19d93f444720342edac6cf1c56d67e2331552ae76a4e82c449a965275f0b
MATLAB
2,253
58
function [ServerIP,ServerName]=Server_Picker(LabDefaults) [OS,~,~,~,~,~]=WhereAmIRunning(1); if any(strfind(OS,'MAC')) CurrentIP='Unknown IP'; else try [~,result] = system('arp -a'); Index1=strfind(result,'Interface: '); Index2=strfind(result,' ---...
c0a93826f552f083c466e57dc4543b194d5911381c191aaf89e77a9c302fdd83
MATLAB
2,253
67
function [res, sampleinfo] = selectSpike(spikeDataset, trials, CTLParams, segOption) narginchk(2, 4); if nargin < 3 CTLParams.temp = []; end if nargin < 4 segOption = "trial onset"; end NoveltySU.utils.parseStruct(CTLParams); if exist("devonset_Win", "var") Window = devonset_Win; end win...
f00a16c8106cf36d17a1b44e9166cb702d445cac79b7e0085f20290c404292b6
MATLAB
2,253
68
% Author: Birgit Nierula % nierula@cbs.mpg.de function bs_preprocessing_loops(srmr_nr, loop_number, subjects, conditions) switch loop_number case 1 %% combine selected EEG and ESG channels % load cleaned EEG + ESG data % load excluded epochs % select epochs that are present in...
2c50f5678b129b9241532e4f233a19a5d03124182bfbdce8b2005c616a0bf1d3
MATLAB
2,255
62
function outputImage = interpolateVolume(inputImage) %Assumes that there are 0s in the input image where the original image was %not able to warp into. To ensure this, a nominal f %Add a nominal amount to the tileM for the interpolation step at the end of %this function %It is rounded back to integers at the very end...
74b3e287ac799c327e99a7e1c7e85af317aa40c210ad4a2bd74e5e0a62c1219c
MATLAB
2,255
80
function toolboxUpdateHeader % Update the headers of all the files. % % USAGE % toolboxUpdateHeader % % INPUTS % % OUTPUTS % % EXAMPLE % % See also % % Piotr's Computer Vision Matlab Toolbox Version 3.50 % Copyright 2014 Piotr Dollar. [pdollar-at-gmail.com] % Licensed under the Simplified BSD License [see extern...
276caf11d8bd0c2f426b18b42a30f23cf37a2664a39ec2fbf029be722ad36ade
MATLAB
2,256
69
function s = angle_stddev(v,avg_type,to_deg) % v -> sample of 2d vectors (1 vector per row) % % returns the stddev of the angles of each vector in v relative to the "average" of v % % the average of v can be one of the following: % - centroid = average of vectors in v weighted by each vector magnitude % - mean ...
6fd4f74b659043f3a2c25af9e8b63eb87e029d648bf09470de4d9b9a78b9098d
MATLAB
2,256
55
%% 非线(神经动力学)性特征 | nonlinear features %% permutation Lempel-Ziv complexity, PLZC (P219) % 相比普通的LZC_mean、LZC_median、LZC_midpoint、LZC_kmeans,PLZC具有计算简单、鲁棒性/稳定性强、计算复杂度低等优点 % LZC的值越大,代表序列越复杂,越接近随机状态 % X: single channel EEG signal (either a row vector or a column vector) % opts.pattern:将信号表示为由不超过m!种模式组成的序列,如3,4 %% Refe...
34fd3a21edcfd96f67abc2799a0bd0e25f5a86f4110fbf68a1e6ebd7608a9b4a
MATLAB
2,257
69
function [bels, converged] = beliefPropagation(cg, queries, varargin) %% (Loopy) belief propagation algorithm % %% Inputs % % cg - a cliqueGraph, see cliqueGraphCreate % % queries - a cell array of queries % % %% Optional named inputs % % 'updateProtocol' - ['async'], 'sync', or 'residual', ...
81e00bdb22287876a6aca5bd0dc6b1f863ab2c96c7eb71d72f88c6119b238dd4
MATLAB
2,257
118
function RT = rt_check(RT,cfg) % <*LAN)<] toolbox % v.1.2 % % 12.12.2023 rt / response -99 if empty % 22.03.2022 .good % 11.12.2014 .est .rt .resp MUST BE MATRIX % 01.04.2014 fix error % 31.03.2014 agrege ifsort option % 20.12.2012 if nargin <2 cfg=[]; end getcfg(cfg,'ifsort',false); % stimuli if ~isfield...
dfdaaf6561e8acf30e83f7ee10a7d03f15da6c3da01296b0f5afe1b4a216d847
MATLAB
2,257
80
clear; basefolder = fileparts(fileparts(mfilename('fullpath'))); codefolder = [basefolder,'/code']; toolsfolder = [basefolder,'/tests/tools']; addpath(genpath(codefolder)); addpath(genpath(toolsfolder)); % Load Data data_path = [basefolder, '/hasegan_et_al_netneuro_2024/data/trefoil_knot/data_treefoil.1D']; fn_tim...
48c2a0b996fd5117bb746faa8868fae38c123f85a4b6383ea105707b0d4111aa
MATLAB
2,258
64
%% Demonstrate the use of a Hopfield network for associative memory. % Requires the neural network and image processing toolboxes % PMTKneedsImagesToolbox % PMTKneedsNnetToolbox % PMTKslow %% % This file is from pmtk3.googlecode.com requireImageToolbox loadData('binaryImages'); % 7 binary images, each 150x150 new...
814c764906eef5cb161f46e514817dc0b8808b6ae3d12a68449134bfe48c2b0a
MATLAB
2,259
63
function plot_fluorescence_trace_and_ratio(fluG, fluR, deltaR_R0, varargin) figure % various arguments in oder: curvature of head, fwd, bkw, turn N = size(deltaR_R0, 1); % odd column for red vs. green fluorescence for i=1:N subplot(N,2,2*i-1); plot(fluR(i,:),'r','LineWidth',1.5);hold on; ...
a619aa782c09d79892b22c1c30042873cd4396bdca931d299d3f4f41ff31d703
MATLAB
2,259
44
clear all load('X.mat'); % single channel EEG signal (either a row vector or a column vector) % X = X'; %% You can call and test each feature extraction function separately. % power spectral density (PSD), welch method opts.fs = 128; % sampling frequency opts.f_low = 1; opts.f_high = 45; % frequency range...
bff3c2092286950a5413343fa9785b6fa2059d3047cc181f1f9805a0541d139b
MATLAB
2,259
54
function h = filledCircle(center,r,N,color) %--------------------------------------------------------------------------------------------- % FILLEDCIRCLE Filled circle drawing % % filledCircle(CENTER,R,N,COLOR) draws a circle filled with COLOR that % has CENTER as its center and R as its radius, by using N point...
5ac63d3a39fb0346ee8f208ea0ede0b23eccbd1bb197b4ba6fb1a7454382e2fe
MATLAB
2,260
59
function [bels, converged] = belPropAsync(cg, varargin) %% Belief propagation with a simple asynchronous update schedule % By asynchronous, we mean that a node can update itself without having to % wait for everyone else to first be ready. A node is ready once it has % messages from each of its neighbors. % See belie...
69a4dc4aaba7a9690d54895f08da9da9862f79e9f71a036f171889a8ee1e4fee
MATLAB
2,261
59
function p_pairwise = CBIG_MMLDA_glmfit_hypotest_forestplot(k, X, y, dependency, out_dir, out_name, compare_factor_names, CI_scale, p_thresh) % CBIG_MMLDA_glmfit_hypotest_forestplot(k, X, y, dependency, out_dir, out_name, compare_factor_names, CI_scale, p_thresh) % % This function will do glmfit, hypothesis tests and f...
91f7a5eae17683995cfc9200f052f35b3c2ceaabba252555c8ddab7de1fc8c9e
MATLAB
2,261
50
clear clc close all nb_models = 1000; stimAmp_step = [-53]; % stimAmp_diffusion = (2:0.1:2.5);%-53*(0.5:0.3:1.5); t = 0:100; Istim = get_diffusion_current(t, 1); max_Istim = max(Istim); % stimAmp_diffusion = unique(round(stimAmp_diffusion*max_Istim)); stimAmp_diffusion = [11]; % Calibrated to achieve stimulation of...
e17501c88b4dc5024c684254ec64375ad45ae587e77f190104c9ab9a6f101c0c
MATLAB
2,261
65
function g = gaussn(f0,n) % function gn = gaussn(f0,n) : generates the order n derivative of the % gaussian window, centered at frequency f0 % The wavelet gn is real, but it is its analytic form that is % synthetized first. The real part is then normalized by the analytical % value of its energy (so, L2 normalizatio...
fb54d297f32a3040061240feb3624df5db23bd6b7c27206d689fd3403d236a31
MATLAB
2,261
109
%% demo of mixture of linear regression experts on an inverse problem % Based on Bishop fig 5.21 % This file is from pmtk3.googlecode.com clear all close all setSeed(0); n = 200; y = rand(n,1); % eta = normrnd(0,0.05,n,1); eta = randn(n,1)*0.05; x = y + 0.3.*sin(2.*pi().*y) + eta; data = [x(:) y(:)]; K = 3; figure...
09fae5d0e20e9443ee312c348588128b4f43838f16d58e0badaa19b1aac60004
MATLAB
2,262
50
%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...
23762f6272a25f1babcfa3907b77a3b5538d5118cce21d81f1a57df5d507c23f
MATLAB
2,263
73
function S = CP_Init(file) %% Unload variables from file and initialize [t_lim,L,div,s,D0,N_neur,tpr,uprr,uprt,uprd] = readvars(file,'Range','A1:J2'); [Kt,Kc,Kr] = readvars(file,'Range','K1:M5'); t = 0; f = 0; [X,Y] = meshgrid(1:div); % Neuron matrix: [position mesh number ; upr(-1) ; upr] NEUR = zeros(N_neur,3); % F...
514549ef3b43047c677d8e35979229dc532d321c18b492bb609da86d7504b692
MATLAB
2,263
94
% 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,...
cabdf1855a3cfff50ed57c6071e4599676a4f54067841cccc947fdd6de0bfb2b
MATLAB
2,263
64
function [H] = rigidbody(f) % RIGIDBODY creates the homogenous spatial transformation matrix % for a 6 parameter rigid-body transformation % % Use as % [H] = rigidbody(f) % % The transformation vector f should contain the % x-shift % y-shift % z-shift % followed by the % pitch (rotation around x-axis, in d...
0b59d3baceef30b8b71d8f7b9d649aa3888273654ff00b10ab103c625f099591
MATLAB
2,265
62
function CBIG_VK2019_plot_loadings(out_dir,LC_behav_loadings,behav_names,LC_RSFC_loadings,nRois,signif_LC) % % This function plots the RSFC and behavior loadings of all % significant latent components (LCs). Behavior loadings are plotted as % barcharts and RSFC loadings are plotted as correlation matrices. % % Inpu...
a8b19ed09e93eaca15d1d3b6f09ee859b2dc235857c7a102e56b175aef97479a
MATLAB
2,265
85
function vol = read_hdr(fname) % Get a variety of information from a NIFTI-1 header. % FORMAT vol = read_hdr(fname) % fname - filename of image % vol - various bits of information % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % %...
0d3742600b5eb4afa919f11176fe4383bcc26a8050cfd8c05a19721e228fc8eb
MATLAB
2,266
62
function normalizeImage(src_folder_name,dst_folder_name,fileroot_name,channels,roundnum) loadParameters; %Check for any missing image file for c_idx = 1:length(channels) filename = fullfile(src_folder_name,sprintf('%s_round%.03i_%s.%s',... fileroot_name,roundnum,channels{c_idx},params....
1a625637922b70b7ab6ca7439ec644cc8135295b9111a42ac58dec4849c7ed70
MATLAB
2,266
53
% LineWithSphere - Determine intersection(s) of a line defined by % two points in space with a sphere % % (published in appendix of Kayser J, Tenke CE, Clin Neurophysiol 2006;117(2):348-368) % % Usage: [P] = LineWithSphere ( P1, P2, Os, r ); % % Implementation of simple linear geometric principl...
4d5136d09126ab97286d88f798128bf26f4362d84e511d8fb0aa1ac2de3244a9
MATLAB
2,266
69
function C = multiDiv( A, B, type ) % Matrix divide each submatrix of two 3D arrays without looping. % % type controls the matrix multiplication to perform (for each i): % 1 - C(:,:,i) = A(:,:,i)\B(:,:) % 2 - C(:,:,i) = A(:,:,i)\B(:,:,i) % 3 - C(:,i) = A(:,:,i)\B(:,i) % Corresponding dimensions of A and B m...
59e73023d173eecde8826cd377486ba1b49516402f80cfa60656639a6d005008
MATLAB
2,266
56
function I=affine_registration_image(par,scale,I1,I2,type) % This function affine_registration_image, uses affine transfomation of the % 3D input volume and calculates the registration error after transformation. % % I=affine_registration_image(parameters,scale,I1,I2,type); % % input, % parameters (in 2D) : Ri...
bfb99a4a06c1815f308656214614775a6f129b33fa2a8b40d3efffc8104c8fa9
MATLAB
2,267
66
function num=getfilenum(f,pat,opt) %GETFILENUM Get the index of a series of files. % NUM = GETFILENUM (NAME, P) returns an array of numbers indexing % the filenames (or directory names) matching NAME from the current % directory. The indices are searched in the strings following the % substring P. Wildcar...
c1a0b20febacf4f21512af9dad4cf4631b3485bc6f0ba99203a0ae3163270e0a
MATLAB
2,267
80
%% Reproduce table 1 from "Robust statistical modeling using the T distribution % Lange et al, JASA 1989 % The estimated coefficients are similar % However, this does *not* reproduce the log likelihoods correctly % The reason for this is not clear - is Lange evaluating the expected % complete data loglik instead? % % P...
94e07a1f6782a6b34fdac53ed37ac50a2a7f6a4279d6ebe46c906738111e92ea
MATLAB
2,268
79
function [shift] = xcorr3fft(image1,image2) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % xcorr2fft computes offsets between images image1 and image2 based % on Phase Correlation method. image1 & image2 are assumed to have % the same dimensions. % % Written by: Sebastian J Streich...
d1bd5ec2849cdccea22302c497aad1331c18d870d21d048bb053ea02c60edb7c
MATLAB
2,268
64
function E=strain(Ux,Uy,Uz) % Calculate the Eulerian strain from displacement images % % E = STRAIN(Ux,Uy) or (3D) E = STRAIN(Ux,Uy, Uz) % % inputs, % Ux,Uy: The displacement vector images in % x and y direction (same as registration variables Tx, Ty) % Uz: The displacement vector image in z d...
da12b53ba19e64d32b7bd0ade56c4b326f44bc9debd0bc2b55ad87fa34852ce7
MATLAB
2,268
89
% 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,...
db004e9e625e79d9247403685109c1531ff9d8d2daeab9686a1a80583d04623c
MATLAB
2,269
66
% MONTAGES2 [4D] Used to display R sets of T images each. % % Displays one montage (see montage2) per row. Each of the R image sets is % flattened to a single long image by concatenating the T images in the % set. Alternative to montages. % % USAGE % varargout = montages2( IS, [montage2prms], [padSiz] ) % % INPUTS % ...
156b78f4c500e2a3c20f34c673255f8ad963790364a5c0c43cb9763bd7906f8a
MATLAB
2,270
50
%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...
1722806115de3994db8ce8685322980a752067529451435c4de3b6d96d9e8492
MATLAB
2,270
50
%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...
fb4c45293cab244e854d33cecfef8ae16ce7153cb1dec9be02d8cb8d9d6a6211
MATLAB
2,270
81
% read_eeglabheader() - import EEGLAB dataset files % % Usage: % >> header = read_eeglabheader(filename); % % Inputs: % filename - [string] file name % % Outputs: % header - FILEIO toolbox type structure % % Author: Arnaud Delorme, SCCN, INC, UCSD, 2008- %1234567890123456789012345678901234567890123456789012345...
b3fcf403c8ab5e45a827ac19edc0b34be9cf93095738e2787629b123c2834181
MATLAB
2,271
95
%% EPOD DTI ROI analysis % % Saves to tracts_mean_XXX.txt in maindir defined below % % Toolbox dependencies: % - DIPimage (dilation function can be reimplemented using other software if needed) % - toolboxes-amc/gfx (optional, code at the end for visualization) % % maindir should point to TBSS-output folder ...
e08682feaaa52808ff9677561dcd5b1c45c95d762eb3e6eab06665b4be572852
MATLAB
2,271
60
function res = run_nanocolumn_autocorr_refAlign(params,fov) %update later with documentation exp_factor = params.exp_factor; %expansion factor, adjust as needed parentdir= params.parentdir; targetdir = params.targetdir; nChannels = params.nChannels; rmax = params.rmax; pixel_size=params.pixel_size; channels_rounds =...
d6d4c265f9e199fa911db431362c7803051f4315e9e23f9250979e990f43382a
MATLAB
2,272
73
function tests = quantilenorm_cudaTest tests = functiontests(localfunctions); end function setup(testCase) if ~exist('logs') mkdir('logs'); end testCase.TestData.tempDir = '/mp/nvme0/tmp/testworks'; if ~exist(testCase.TestData.tempDir) mkdir(testCase.TestData.tempDir) end ...
1bd8082102016c53eb2ba170221c6315e49c73c3fade152775e7c4ef15fba631
MATLAB
2,273
76
function s = appendstruct(varargin) % APPENDSTRUCT appends a structure to a structure or struct-array. % It also works if the initial structure is an empty structure or % an empty double array. It also works if the input structures have % different fields. % % Use as % ab = appendstruct(a, b) % % See also PRINTSTRUC...
1cda47f68afff1195512b08433605d40c53a279fb9a47be9d4d62aba80ff6bfc
MATLAB
2,274
68
%% Setup path to engine addpath(fullfile('Engine')); %% Setup parallel port numThreads = 24; % number of cores to be used tic ppool = gcp('nocreate'); if isempty(ppool) tic parpool(numThreads); disp([newline 'Started parallel pool in ' num2str(toc) ' s']); end %% Load/process base...
7f01dc70ff92ea4b414fa716b02eec7e82791a3fa5df2fe15b81033c4ee924f4
MATLAB
2,274
64
function [D, ni] = find_nn(X, k) %FIND_NN Finds k nearest neigbors for all datapoints in the dataset % % [D, ni] = find_nn(X, k) % % Finds the k nearest neighbors for all datapoints in the dataset X. % In X, rows correspond to the observations and columns to the % dimensions. The value of k is the number of neighbors t...
bc2519be0ae485013a7a5c075e7ddb63d42bca95ed732b484f284cd792c69b40
MATLAB
2,274
54
function plot_gaussian_kernel_replay(folder) cd folder load('significant_replay_events_wcorr.mat'); replay_idx= randi(length(significant_replay_events.track(1).spikes)); replay_event= significant_replay_events.track(1).spikes{replay_idx}; replay_dur= significant_replay_events.track(1).event_duration(replay_idx); repla...
c1468231a2270001b0c0bfc6b2331388c6058f3dad9fcf7b4be177ddc9138a4e
MATLAB
2,274
64
function model = hmmFitFullyObs(Z, Y, type, varargin) %% Fit a fully observed HMM via mle/map % % Z - a cell array of observations of the discrete Markov backbone; % each observation j is 1-by-seqLength(j). % % Y - a cell array of emission observations; each observation j is % d-by-se...
e577e089358d9b0da2f4c3247e5a817b305372b12ad9f9cc08a1524553801bb1
MATLAB
2,274
105
% computes metrics on a bunch of data generated % by crabsort.consolidate function data_out = computePeriods(data, varargin) if length(data) > 1 for i = 1:length(data) data_out(i) = crabsort.computePeriods(data(i), varargin{:}); end return end options.neurons = {}; options.ibis = []; options.min_spikes_per_...
659496a999c49c928e6e49d9b0b381b0bfb9c77631ef63784b33235625ff3a0f
MATLAB
2,276
48
for k = 1:length(Y) clf; y = Y(k); % Display NIFTI slice I = round(y/d1d2d3(2) + N1N2N3(2)/2); S = squeeze(VT1(:, :, I)); % choose the Y cross-section S = S(end:-1:1, end:-1:1)'; image([-DimensionX/2 +DimensionX/2], [-DimensionZ/2 +DimensionZ/2], S, 'CDataMapping', 'scaled'); c...
a776cfd87c6bce7581598edb93c9135e1aca864a0476c123bad09b5f82e458f2
MATLAB
2,276
100
%% Test inference on the Alarm Network % %% % This file is from pmtk3.googlecode.com ntrials = 50; setSeed(1); loadData('alarmNetwork'); G = alarmNetwork.G; CPT = alarmNetwork.CPT; nstates = alarmNetwork.nodeSizes; nnodes = 37; if libdaiInstalled engines = {'jtree', 'libdaiJtree'}; else engines = {'jtree'};...
dbfd5cf184464910a9a74b181d6030038ac155437b3f493383acef47f600d29c
MATLAB
2,276
86
function [tMin,fMin,Q2Flip,output]=essential_distMinAngle(Q1,Q2,varargin) NQ1=size(Q1,3); NQ2=size(Q2,3); if NQ1==1 && NQ2>1 Q1=repmat(Q1,[1 1 NQ2]); NQ1=NQ2; end if NQ1>1 && NQ2==1 Q2=repmat(Q2,[1 1 NQ1]); end if NQ1>1 tMin=zeros(NQ1,1); fMin=zeros(NQ1,1); Q2Flip=zeros(6,3,NQ1)...
a3004f3cd747377c31968511e3d92afa58d4c4c0eefc433e511eafd67087ce91
MATLAB
2,277
43
% align ImageArray and keep result in ImageArray_Reg function [ImageArray_Reg DeltaX DeltaY MaxValue] = Coarse_Reg(ImageArray, AlignRegion, MaxShiftX, MaxShiftY, MinCorrValue) LastImageNumber = size(ImageArray,3); BestImage = ImageArray(:,:,1); % Best Image should be first in ImageArray RegionsProps = regionpro...
f0bc30dc10abfa54b5724cb8b400f617ba2bd36caf3b89c6b32c35452004c794
MATLAB
2,277
85
function v = VBA_indicator (x, S, inverse) % // VBA toolbox ////////////////////////////////////////////////////////// % % x = VBA_indicator (x, S, inverse) % indicator (aka incidence or characteristic) vector of x wrt set S. % % IN: % - x: K x N values to be converted. Indicator vectors are computed for % eac...
bf92bcd5a7cdf494eb1bea4fb2ae43d50905b44e6e268078a9e598063a59933e
MATLAB
2,278
79
%% Empirical Bayes Missouri Cancer Example % Johnson and Albert p67, p24 % See also cancerRatesMh %% Setup Data % This file is from pmtk3.googlecode.com clear data data.y = [0 0 2 0 1 1 0 2 1 3 0 1 1 1 54 0 0 1 3 0]; data.n = [1083 855 3461 657 1208 1025 527 1668 583 582 917 857 ... 680 917 53637 874 395 581 588 ...
1a2963324949d4ce3aa14b235582c02a1a7aca93e0655d0048f85ca98d94a9b0
MATLAB
2,279
128
function LAN = hilbert_ind(LAN, Fre, Norm, baseline ,r_s, texto) % v 0.0.1 % 3.12.2009 % % Falta optimiza memoria % Sig = LAN.data; srate = LAN.srate; %if nargin < 7, cuantos= 1; end if nargin < 6, texto = plus_text([' Hilbert']); end if nargin < 5, r_s = []; end if nargin < 4, baseline = []; end if nargin < 3, N...
fe42b1f0f7fa993b5f1201b5f1a32cb150c5fa4d4ace47f497869e1d3ed1d3d7
MATLAB
2,279
52
classdef (Abstract = true) AdjMatrixFromNetX < adjmatrix.AdjMatrixFromFile properties (Access = protected) Method; end methods function this = AdjMatrixFromNetX(method, params, loadOnInit, delAfterLoad) % creates an adjacency matrix with NetworkX % % met...
05ce9e1d5d635cc7ba64f8a2fc1a7e657c27b9e81b3dc2e737107574988facce
MATLAB
2,280
69
function rowNumber = selectMuscle_from40() % Define the list of muscles muscles = { 'Acromiodeltoideus' 'Anconeus' 'Biceps Brachii' 'Brachioradialis' 'Brachialis' 'Coracobrachialis' 'Extensor Carpi Radialis' 'Extensor Digitorum Communis 2' ...
6150fd503840dfe8057602df03770fd86ce34a891762b163a092691eadf04388
MATLAB
2,280
100
function [pval] = stata_cluster(c_cls, stat, nrandom,elec) % v.0.0.9 % % Realiza Cluster-Randomization-Analysis en cartas timepo-frecuencia % en prueba por cambio de algoritmo de clusters % % un electrodo por ahora % cls -> custers detectados por corrention.m , en { [cluste1] [cluster2] } % % P Billeke % % % 9 agosto ...
77acff1a7acad1d07a754739c643eb1b7719664eaf757db32ad85116f42fde68
MATLAB
2,280
87
%% Illustrate EM for PCA %PMTKauthor Cody Severinski % Some code has been reused by pcaFitEm setSeed(10); n = 25; d = 2; mu0 = mvnrnd(eye(1,d),eye(d),1); Sigma = [1,-0.7;-0.7,1]; X = mvnrnd(mu0,Sigma,n); k = 1; mu = mean(X); X = X - repmat(mu, n, 1); X = X'; % algorithm in book uses [d,n] dimensional X % Generating ...
d91d1f9690cd560df3906318d719343972a51d8436264b7e6b2b7c9013ea1d9e
MATLAB
2,281
71
function errorbar_tick(h,w,xtype) %ERRORBAR_TICK Adjust the width of errorbars % ERRORBAR_TICK(H) adjust the width of error bars with handle H. % Error bars width is given as a ratio of X axis length (1/80). % ERRORBAR_TICK(H,W) adjust the width of error bars with handle H. % The input W is given as a rat...
4663c260ba31e2b80fc30d4aa916f67504bcbc1129e046e37a7be6808603f635
MATLAB
2,282
102
function subSuperGaussPlot() % Plot sub-Gaussian, Gaussian, and super-Gaussian (Laplace) distributios % in 1d and 2d %Generalized Gaussian distribution with mean 0, scale 1, and shape 8 %(see http://en.wikipedia.org/wiki/Generalized_normal_distribution) %PMTKauthor Kevin Swersky setSeed(0); figure; hold on...
4a1f5d5081c23d829004e1ffaf224edecfc1039d08b9d0bdfabdefad8eef504d
MATLAB
2,282
50
clear clc close all nb_models = 1000; stimAmp_step = [-53]; % stimAmp_diffusion = (2:0.1:2.5);%-53*(0.5:0.3:1.5); t = 0:100; Istim = get_diffusion_current(t, 1); max_Istim = max(Istim); % stimAmp_diffusion = unique(round(stimAmp_diffusion*max_Istim)); stimAmp_diffusion = [11]; % Calibrated to achieve stimulation of...
a9376f8f3eefcc880abccd62059b502d2e41c38ee58146f65551cc7618f1127a
MATLAB
2,282
54
function [GwaveInterp]=WaveformCalculate(Gwave,G,delta,TR,nbins,nOscillations,Waveform) %% %Define constants G=G*10^-5; %% %Correct for short pulse approximation if nbins==1 G=G*delta/TR; end %% %Generate Full Gradient Waveform GwaveFull=zeros([1,abs(Gwave(end))]); GwaveFull(abs(Gwave))=1.*sign(Gwave).*G; %% %Inter...
b91e04ebb535e0e83abbb29da8b7da2a736f81b8ba7be577143975a2d1582b12
MATLAB
2,282
75
function labels = saveSensorsToFile(paths, subj_match, ss, output) numView = 10; cfg = []; cfg.dataset = cellfun(@(x) [paths.rawdata '/' x], subj_match.ds, 'UniformOutput', false); cfg.dataset = cfg.dataset{ss}; cfg.channel = {'MEG'}; sensor_level...
caf7644403a223e115da4b0ee68249b36cd58178d7231d25703507a66c1b2e5c
MATLAB
2,282
75
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% wrapper_full_calibration.m -- A wrapper for the calibration runtime. %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function []=set_dipoles(pat_ix) model = 'german7'; inverse_model = 'german3'; pat_cell ...