sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
eb3c587338b45b9a3de71434dc3ffa20df7073dda7fbeebe5425741cf14fbe8a
MATLAB
2,464
132
%{ _ _ ___ _ __ __ _| |__ ___ ___ _ __| |_ / __| '__/ _` | '_ \/ __|/ _ \| '__| __| | (__| | | (_| | |_) \__ \ (_) | | | |_ \___|_| \__,_|_.__/|___/\___/|_| \__| # NNtimer **Syntax** ``` C.NNtimer(~,~) ``` **Description**...
fc11e1f9fa153853bf782b8c507231df4ce9e3dcf109174bde8fea2a4ed789e5
MATLAB
2,464
103
% 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,...
35adc6210af35b4d8320d55af4e41e83ea8e43ff102043ae797677967ca51166
MATLAB
2,465
55
% To get to know dataspace, selection "..?/Introduction to Dataspace" from % the main menu of the Dataspace-App or type in Matlab: % dspace.help('dspace.resources.docs.Introduction_to_Dataspace') %% IRIS Dataset load fisheriris; X = meas.'; Y = species; irisData = table(X(1, :)', X(2, :)', X(3, :)', X(4, :)',...
cd9ecaebe6e891f0ccefc71946ef0dd7234f99962b1aea76fdee4ef5ba15c42d
MATLAB
2,465
47
clear all %% %Define default parameters [opt] = ParameterOptions(); %% %Modify options for time dependent framework - designed to accelerate the estimation opt.Precision=10^-10; % Cut off for pathway amplitudes opt.nPeriods=2; % Maximim number of TRs in the transverse plane per dictionary el...
56489aebeaddafe02ba113a5876e22ca223556ecd865ca64205f84b515b867f0
MATLAB
2,466
91
function printstruct_as_table(s) % PRINTSTRUCT_AS_TABLE prints a struct-array as a table in Markdown format % % Example % s(1).a = 1 % s(1).b = 2 % s(2).a = 3 % s(2).b = 4 % printstruct_as_table(s) % % See also PRINTSTRUCT, APPENDSTRUCT % Copyright (C) 2017-2019, Robert Oostenveld % % This file is part of F...
5b9220657a62a1a867c53a6986c6717dab0b54e1feea5ab8098a19ef0a96c02c
MATLAB
2,467
89
%% autocov_to_pwcgc % % Calculate pairwise-conditional time-domain MVGCs (multivariate Granger causalities) % % <matlab:open('autocov_to_pwcgc.m') code> % %% Syntax % % F = autocov_to_pwcgc(G) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % G aut...
740631a9f0836937b7224e53a508681aa72163d124a74d84a7753052f590210b
MATLAB
2,467
111
function hout=suptitle(str, fs) %SUPTITLE Puts a title above all subplots. % SUPTITLE('text') adds text to the top of the figure % above all subplots (a "super title"). Use this function % after all subplot commands. % This file is from pmtk3.googlecode.com %PMTKauthor Drea Thomas %PMTKdate June 15, 1995 %PMTKemai...
e2e4d2b0405a87959c5654376df726004cbbf32c52e958e11ef17c4809cbefcf
MATLAB
2,467
102
% %PMTKauthor Chris Williams %PMTKdate 22 October 1996 % % script for generating data from a GP (with nncovfn), so as to be able to %compare finite and infinite networks (1d, not 2d) % clear close all global XVEC XTEST; XVEC = -5:0.02:5; XTEST = [-0.27 0.454654]; % dummy ndat = size(XVEC,2); varnoi = 1e-10; ra...
ff7c8a820b5f8e882ee17c660ddc5fde9fe9130e925359c570281d93964fbf3e
MATLAB
2,467
64
function optoStim = make_opto_stimulation_file(basepath,varargin) %Make opto event files associated with stimulation and detection file loads % the processed digitalin.events file and retrieves the TTL pulses from % the online detector. % input: % basepath: path (char/string) to data location of digitalin.events.ma...
188eed3e5b4f8dbd8ce746a19efd1ebd3ed5c892b77f293002672d183fe921fd
MATLAB
2,468
87
clear all; freq = [1000;1020]; % Hz amp = 0.4*[7,-7]; % [35;5]; % No unit Fs = 18; % kHz Twidth = 200; % Nullclines % dV/dt = V-V^3/3-W+I % dW/dt = 0.08(V+0.7-0.8W) fig=figure('position',[100 100 850 600]); ax1 = subplot(4,1,1); hold on; Vgrid = -5:0.05:5; W1 = Vgrid-Vgrid.^3/3; W2 = (Vgrid+1)/0.01; %vnull ...
7152f5bbe8902b28c26e83a983f25a59cb9d4fb307351bef429099ab3f1a40f9
MATLAB
2,468
66
function h_zoomOut3(handles) [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); xlim = get(handles.imageAxes,'XLim'); ylim = get(handles.imageAxes,'YLim'); [x_lim,y_lim,z_lim] = h_getLimits3(handles); if isfield(currentStruct.state,'lineScanDisplay') && currentStruct.state.lin...
62be5c002dc3fadf92edead21b39dcfbbf93865a8d87d40d74bd5a859989c4a0
MATLAB
2,469
85
%% Imputation for a mixture of Gaussians % PMTKneedsStatsToolbox regstats %% % This file is from pmtk3.googlecode.com function mixGaussImputationDemo() requireStatsToolbox %% Make data setSeed(1); %d = 10; n = 100; pc = 0.5; d = 10; n = 500; pc = 0.1; K = 5; mu = rand(d,K); mixweight = normalize(rand(1,K)); Sigma =...
6eb7136da8a7081d4c8ef98532367427ec4ca952ae2ea0b63473b37d27925ef5
MATLAB
2,469
77
clear;clc; %% parameters params = struct('a',1.6e-2,'n',4,'beta',10,... 'ind_input',[11],'ind_output',[13,14],... 'u_input',[0,-0.005*9.8],'u_output',[0,-5e-4;0,-8e-4]); % change the u_output to be [0,1;0,0] if you use cross entropy loss [DT,bonds] = Triangle(params); n_spring = size(bonds,1); w1 = 1.5*10^(-3)...
b7182b0caaf936cf4c68659a31a6857bf6e08bfa3106a040df62514c11c3395b
MATLAB
2,469
87
function [IL_PET] = IL_PET_atlas(PET_scan,MRI_atlas) save_imgs = 0; %% Slices regions = cell(6,1); regions{1,1} = [83 75;90 75;91 96;83 96]; %slice=155 regions{2,1} = [83 75;90 75;91 96;83 96]; %slice=156 regions{3,1} = [83 75;90 75;91 96;83 96]; %slice=157 regions{4,1} = [83 75;87 75;87 96;83 96]; %slice=158 regio...
58e0fe84ae7eb53376b460a9708990c29ac6a02e5d2d87b7c2e8078295465762
MATLAB
2,470
75
datRoot = '/Volumes/LaCie/Farries recordings/'; % choose rat rat = 'IM1261'; sesList = dir([datRoot rat '/20*']); sesList = arrayfun(@(x) x.name, sesList, 'UniformOutput', false); % list sessions sesList = dir([datRoot rat '/20*']); sesList = arrayfun(@(x) x.name, sesList, 'UniformOutput', false); for i = 1:length(se...
a110e48c160c4cf6c072a480ec8d9a9cc032ccc2cdd5020cc00249696b886cd1
MATLAB
2,470
107
clear; clc; srate = 500; n_subjects = 6; %% hist_data = []; for isub = 1:n_subjects load(['zs' num2str(isub) '_cho_method_seeg_rest_v1.mat']); load(['zs' num2str(isub) '_limbic.mat']); start_time_ch = []; start_time_tp = []; n_trials = size(method_outputs,2)...
b064f5479ac2ff0d0f1f26c6210c780c30f4e6b07535722f8f4cf4c3df966b99
MATLAB
2,471
68
function [sourcemodel] = lbex(cfg, sourcemodel) % This function will add the field "subspace" to the sourcemodel definition. % % The subspace projection is based on the LBEX (local basis expansion) % method. % set the defaults if ~isfield(cfg, 'lbex'), cfg.lbex = 3; end if ~isfield(cfg, 'lbexeigtol...
d8ef4edc8b0d0bc26516be39f758bfd1a3222197880618c35801536bda8ceb80
MATLAB
2,471
64
% 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 z = Z(1); % Display NIFTI slice I = round(z/d1d2d3(3) + N1N2N3(3)/2); S = VT(:, :, I)'; % choose the...
b63e88f2e478e0b6ed494d3716140530b335f4fd72c58ed01be5dcf9bffc1e25
MATLAB
2,472
81
function [posterior, out] = demo_VolterraKernels () % // VBA toolbox ////////////////////////////////////////////////////////// % % demo_VolterraKernels () % demo of Volterra kernel estimation and use % % This code demonstrates how to extract Volterra kernels from a % dynamical system trajectory. In this particular exa...
b9140ac7d0d1c1fb16f596e6fbf3907777a80668634f702271d564753b8b971b
MATLAB
2,472
92
% generate a video with randomly oriented squares and its corresponding trx % file. nframes = 30; n = 5; imsz = [200,200]; locs = [50 50 100 100 150 50 50 150 150 150]; sz = 10; vid_file = '/home/mayank/temp/test_apt.avi'; trx_file = '/home/mayank/temp/test_apt_trx.trx'; %% trx = stru...
ea64c8360f14016d4aa5366f0f862d799bcc13e5ca8cb7841288878b0ace9aed
MATLAB
2,472
89
function structList = VBA_factorial_struct (varargin) % // VBA toolbox ////////////////////////////////////////////////////////// % % structList = VBA_factorial_struct (param1Name, param1Values, param2Name, param2Values, ...) % Create an array of structures with fields 'param1Name', 'param2Name', ... % whose values, a...
5bd844b5d1d123ae24ce8007c6a03bc94f39caf455bfd05ef638123660bb552b
MATLAB
2,473
95
function headmodel = ft_headmodel_simbio(mesh, varargin) % FT_HEADMODEL_SIMBIO creates a volume conduction model of the head % using the finite element method (FEM) for EEG. This function takes % as input a volumetric mesh (hexahedral or tetrahedral) and % returns as output a volume conduction model which can be used ...
8dd3d3e7384eaa9fb3eff3ebb214154bde00e3847af88fce1e6702d126d91d3b
MATLAB
2,474
71
function varargout = dsxy2figxy(varargin) % dsxy2figxy -- Transform point or position from axis to figure coords % Transforms [axx axy] or [xypos] from axes hAx (data) coords into coords % wrt GCF for placing annotation objects that use figure coords into data % space. The annotation objects this can be used for are % ...
b5efed5c6eb914e8a42ea7909af539b54f9900d1088f2fffafdbf1869b2c641d
MATLAB
2,474
64
function B = fevalArrays( A, fHandle, varargin ) % Used to apply the same operation to a stack of array elements. % % The only constraint on the function specified in fHandle is that given % two differrent input arrays a1 and a2, if a1 and a2 have the same % dimensions then the outputs b1 and b2 must have the same dime...
402a4e27625c987f6dd9ddf566165d7efab1d3e9a30ca7daac6470c33a462f41
MATLAB
2,475
83
function [blockOrder, attBlockOrder, targetBlockOrder, cueBlockOrder, targetTypeBlockOrder, targetPedestalBlockOrder] = ... block_gen2(blockNames, attBlockNames, targetBlockNames, cueBlockNames, run) %% setup blank = find(ismember(blockNames,'blank')); fast_side = find(ismember(blockNames,{'fast-left','slow-left'}...
b9edac7a142cba7da0f75049f6cc53ce3caa38509e218b2373dce5b8de228588
MATLAB
2,475
76
function [tok] = tokenize(str, sep, rep) % TOKENIZE cuts a string into pieces, returning the pieces in a cell array % % Use as % t = tokenize(str) % t = tokenize(str, sep) % t = tokenize(str, sep, rep) % where % str = the string that you want to cut into pieces % sep = the separator at which to cut (default ...
473cb388dbbe8e7fe3a14f128859d056f867fa5037b517e3131068226c327e4c
MATLAB
2,477
68
function [connmat] = triangle2connectivity(tri, pos) % TRIANGLE2CONNECTIVITY computes a connectivity-matrix from a triangulation. % % Use as % [connmat] = triangle2connectivity(tri) % or % [connmat] = triangle2connectivity(tri, pos) % % The input tri is an Mx3 matrix describing a triangulated surface, % containing i...
b73484a7e7db54cf8e53424a2e0ed31adc75dba898a01a2d237aadd4103d6e03
MATLAB
2,477
59
function ContinouousPlayback(FIGHANDLE,PLAYBACKON,ImageArray,PauseInterval,IntensityLimits,AllBoutonsRegion,BorderLineStruct,HighlightFrames,HighlightColor,MovieColormap) figure(FIGHANDLE); set(FIGHANDLE,'WindowKeyPressFcn',@Navigation_KeyPressFcn) LastRangeNumber = size(ImageArray, 3); ImageNumber=0; ...
d4e4ac272d961c22820aa582b6064446966ce6a1cca088152c330bb605d95d87
MATLAB
2,477
96
%% Demonstrate a non-parametric (parzen) density estimator in 1D %% % This file is from pmtk3.googlecode.com function parzenWindowDemo setSeed(2); %[data, f] = generateData; % http://en.wikipedia.org/wiki/Kernel_density_estimation data = [-2.1 -1.3 -0.4 1.9 5.1 6.2]'; f = @(x) 0; n = numel(data); domain = -5:0...
93f725e76aa8b89046694123d877a83beb1f9e3d086462614d9de71ee0c38f40
MATLAB
2,478
81
% demo VB-learning (free learner) % This demo simulates a VB agent that reacts to outcomes by choosing the % action that maximizes the expected gain. Here, the agent learns the % distribution of outcomes associated with each available action. The key % trick is that this distribution is summmarized in terms of its two ...
429d244b6d988ebdfececbfbf2b42943a0d5fd9598f7b13389a6b0da90bd3321
MATLAB
2,479
88
function M = VBA_spm_mesh_inflate(M,T,S) % Surface mesh inflation % FORMAT M = spm_mesh_inflate(M,T,S) % % M - surface mesh structure (see patch) or GIfTI object % or handle to a patch in a figure % T - number of time steps [default: Inf (auto)] % S - update display every S time steps [d...
e7301176b239b626c4c63dda0c56b7e2c22ff12b534108bdc1e37b329f01588d
MATLAB
2,479
85
function [AUC, cutoff, EER, fpr, tpr] = rocPMTK(confidence, label) % Compute ROC curve % confidence(i) is a real value % label(i) is 0 or 1 % % AUC is area under curve % cutoff is the threshold that gives equal error rate (EER) % EER is the fpr=tpr at cutoff % fpr(t) is false positive rate for threshold t (x ax...
047cfaff084ee6020f63ea3888f58c7ae0371c7de659dcb8d918dc06938fc20a
MATLAB
2,480
88
function [ax,hl1,hl2] = plotxx(x1,y1,x2,y2,xlabels,ylabels); %PLOTXX - Create graphs with x axes on both top and bottom % %Similar to PLOTYY, but ... %the independent variable is on the y-axis, %and both dependent variables are on the x-axis. % %Syntax: [ax,hl1,hl2] = plotxx(x1,y1,x2,y2,xlabels,ylabels); % %Inputs: ...
0a58b9a2cb844e6c1818acd01caa3dc8fff6f5283634cc8b8c54a4e765f7b781
MATLAB
2,480
43
function bool = isoctave() %ISOCTAVE True if the operating environment is octave. % % Usage: t = isoctave(); % % ISOCTAVE returns 1 if the operating environment is Octave, otherwise % 0 (Matlab) %***************************************************************************** % Copyright (c) 2010-2012 Quality & Us...
5b64dd327beb284ceb07616227683329d86eb21098c700de7f4c27f186bdc9d3
MATLAB
2,480
78
function FM = ft_preproc_online_filter_init(B, A, x) % function FM = ft_preproc_online_filter_init(B, A, x) % % Initialize an IIR filter model with coefficients B and A, as used in filter and butter etc. % One sample x of the signal must be given as a column vector. % % This function will calculate the filter delay st...
a8f3710f540232cca078c1dede5764ae76edcbab043efb9f72b5bc981a006622
MATLAB
2,481
106
%% Gauss Imputation Demo % PMTKneedsStatsToolbox regstats %% % This file is from pmtk3.googlecode.com function gaussImputationDemoEM() requireStatsToolbox %% Make data setSeed(1); d = 20; n = 100; pcMissing = 0.5; mu = randn(d,1); Sigma = randpd(d); trueModel = struct('mu', mu, 'Sigma', Sigma); Xfull = gaussSample(t...
96ed511b0a4c8fd189fd7af790acf0a301f582135da8df6b7387e960b729b969
MATLAB
2,482
82
function [stimulus, response, segment, timezero] = read_brainvision_vmrk(filename) % READ_BRAINVISION_VMRK reads the markers and latencies % it returns the stimulus/response code and latency in ms. % % Use as % [stim, resp, segment, timezero] = read_brainvision_vmrk(filename) % % This function needs to read the head...
83a211e975c45577c437dec78778fbe3deaf84fdfb7244151c59c1884a0aaa10
MATLAB
2,483
54
function plot_PSDs load PSD_data if ~exist('./figures/PSD','dir') mkdir('figures/PSD'); end for i=1: length(all_PSD) f=figure(i); if isfield(all_PSD,'PSD_F_awake') ax= subplot(1,2,1); title(strcat(['channel: ' num2str(all_PSD(i).CSCchannel) ' awake'])); hold on u= plot(all_PSD(i)....
ccaa8d12f7c8f6e858e3f94a13830195c447ae12268542ae09f412f94c42b9f8
MATLAB
2,485
68
function [subs,vals,keepLocs] = nonMaxSuprWin( subs, vals, ... strLocs, endLocs, thresh, maxn ) % Nonmaximal suppression of values outside of a given window. % % Suppresses all location in subs that do not fall in given range (defined % by strLocs and endLocs). For example, if subs are 3D coordinates of % maxes over...
cdf9f1a262363c06affefcacd8f96dc7c130935c52ec4df8e92ef13835419839
MATLAB
2,485
62
function [triggerUpdateFcn] = waitbarParfor(totalLoops, varargin) %waitbarParfor Waitbar implementation for parfor loops. % [triggerUpdateFcn] = waitbarParfor(totalLoops) creates a waitbar for use in parfor loops. totalLoops indicates the number of loops until % completion. Use the triggerUpdateFcn to increm...
da677dc9b5d56bd52db02c24d6b7a49b2e4013ba613a7f87d94d70adba8e7786
MATLAB
2,485
94
function artifactstruct = wlFT_getEventsAsArtifacts( ... eventmatrixdata, ftlabels, bandwanted ) % function artifactstruct = wlFT_getEventsAsArtifacts( ... % eventmatrixdata, ftlabels, bandwanted ) % % This function converts an "event matrix" structure as described by % EVMATRIX.txt into an artifact definition str...
e4edcf8d27e3ccdf39bae3b316a7d8aac71e688edf5c76174c6ef0b5e69e1c03
MATLAB
2,485
85
%% projfile = '/groups/branson/bransonlab/mayank/temp/fly245_trk_2017212.lbl'; J = load(projfile,'-mat'); for ndx = 1:size(J.movieFilesAll,1) trk = []; for view = 1:2 J.movieFilesAll{ndx,view} = strrep(J.movieFilesAll{ndx,view},'\','/'); % for 220 % J.movieFilesAll{ndx,view} = ['/groups/branson/branson...
ac94122c71cf9136cde882aae6a22389d0907db2709ea42aabb1a25ee0a05859
MATLAB
2,487
79
function h = HumanOdorRep_plot_raster(spikes, x, condition, plot_colors, linewidth) %% function h = HumanOdorRep_plot_raster(spikes, x, condition, plot_colors,linewidth) % creates raster plot of spike-times % spikes is expected to be a cell array of vectors of spike-times % per trial (e.g. spikes{trialnr} = [-199, 20, ...
e4f08641612ef0d375ba728c0c39dd6fbfd1838b65f075a862dc43a2c42a96e4
MATLAB
2,487
94
function Par = CircleFitByPratt(XY) %-------------------------------------------------------------------------- % % Circle fit by Pratt % V. Pratt, "Direct least-squares fitting of algebraic surfaces", % Computer Graphics, Vol. 21, pages 145-152 (1987) % % Input: XY(n,2) is the array of coordinate...
faff7e4969d65923adbc20251c9c06b768177ef910984a9af6f3525370dccf7d
MATLAB
2,487
92
function vol = read_hdr(fname) % Get a variety of information from a NIFTI header % FORMAT vol = read_hdr(fname) % fname - filename of image % vol - various bits of information %__________________________________________________________________________ % Copyright (C) 2005-2018 Wellcome Trust Centre for Neu...
da25d7a602d07dc30888b45d46b4cae7323effe9312e163f32cfc2361fa6f23e
MATLAB
2,488
89
function ColorSet=varycolor(NumberOfPlots) % VARYCOLOR Produces colors with maximum variation on plots with multiple % lines. % % VARYCOLOR(X) returns a matrix of dimension X by 3. The matrix may be % used in conjunction with the plot command option 'color' to vary the % color of lines. % % Y...
f36764eae9de98a31686c05fd5683c37e00a18853f430562f8df0cf4a22d9c50
MATLAB
2,489
97
% to read in an lfp trace from during an in vivo ORCHID experiment % in the form of an xlsx file. % it saves a figure of the trace function [lfp, lfptime] = read_in_lfp (path_lfp, path_results, date, cell_num, trace_num, cf) fn = date + "_" + cell_num + "_" + cf; xlname = fn + "_LFP.xlsx"; path_lfpfile = fullfile ...
f627b0164ae93d90b5ae538867ea465389880fc205831dc027e24443f9b190bd
MATLAB
2,489
72
function [x, ut, ori, sin_val] = svdfft(f, n, trltapcnt) % SVDFFT computes a rotated FFT matrix, using the real part of the % cross-spectral density matrix. This rotation ensures that the phase % relationship of the underlying sources does not change, while rotating % the channels such that the first channel contains ...
bb85f86797c50cd541ab46b6f1dec94bbdada37592e31e40fa372ae51cf27221
MATLAB
2,490
75
% AUTHORSHIP % Math Lead & Primary Developer: Connor Meehan <connor.gw.meehan@gmail.com> % Secondary Developer: Stephen Meehan <swmeehan@stanford.edu> % Bioinformatics Lead: Wayne Moore <wmoore@stanford.edu> % Funded by the Herzenberg Lab at Stanford University % License: BSD 3 clause % classdef SuhProba...
4f5911600627a68ca761c05da0c6c29b68274e5b2b21899887911ee6ebb8579c
MATLAB
2,491
77
function [trl] = ft_trialfun_twoclass_classification(cfg) % FT_TRIALFUN_TWOCLASS_CLASSIFICATION % % This trial function can be used to train and test a real-time % classifier in offline and online mode. It selects pieces of data % in the two classes based on two trigger values. The first N occurences % in each class a...
210973562da410bed26a34642a2b7f8c2cc7d8c581d2f35d824a5a297870ca9d
MATLAB
2,492
77
function [mi,nbins] = mutualInfoAllPairsMixed(XD,XC,varargin) % compute the mutual information between discrete and cts variables. %[mi,nbins] = mutualInfoAllPairs(XD,XC,[levels,method,smoothing]) % XD is N*DD discrete data (can be []) % XC is N*DC cts data (can be []) % PMTKneedsStatsToolbox hist3 % optional argument...
24ad206518cf9d764121093e7a88bc264e9bc2665ca1fdc652ace67181341804
MATLAB
2,492
97
% BrBG_cmap.m % reference: https://colorbrewer2.org/#type=diverging&scheme=BrBG&n=8 function c = BrBG_cmap(m,varargin) %== Setting default if nargin > 0 m = convertStringsToChars(m); end if nargin < 1 || isempty(m) || ~isnumeric(m) m = 11; end if ~isscalar(m) m = m(:); end m = max(abs(fix(m)), 3); m = mi...
52fc4c0509f52f8db132e26107087fffe79797d10bd93a950e29452b1cdf52d0
MATLAB
2,492
70
function [par] = defParam(sess, dat_path) % loadParam: assign parameters for neuropixel sessions % Detailed explanation goes here switch sess case 1 par.date = '201211M'; sess = 1; par.recordingName = '20201211_Mars_g0_t2_LIP'; case 2 par.date = '201030M'; ...
9e9262bce7077a45db13c3d37a02dd5b07d97a9c52f22320e2fe007df9375bcc
MATLAB
2,492
107
% This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
154d8432b285a6afe35512002d8bb942281f512f397a0c8bfc20c5bc839f1948
MATLAB
2,493
94
%% Create HBM2024 table % _________________________________________________________________________ % % Robert Dahnke & Polona Kalc % Structural Brain Mapping Group (https://neuro-jena.github.io) % Departments of Neurology and Psychiatry % Jena University Hospital % _____________________________________________________...
7ce9871a830d6d00deb0a2518e8aec97a8f4e1bd35a19d67a01f06eac61fa518
MATLAB
2,493
80
function [res] = detectionBadChannels_Algorithm( data, thr ) res1 = zeros(size(data.label,1),size(data.trial,2)); res2 = zeros(size(data.label,1),size(data.trial,2)); checkData = data.trial{1,1}; sizeTrialData = size(checkData,1); % standardize each channel for indexe = 1:sizeTrialData ...
85486764a481d8f9f5a2de243d6f2558a04c0717f6a0a20969217656e69a4656
MATLAB
2,494
84
function M=movpwdph(N,Np,typesig); %MOVPWDPH Influence of a phase-shift on the interferences of the pWVD. % M=MOVPWDPH(N,Np,TYPESIG) generates the movie frames illustrating the % influence of a phase-shift between two signals on the interference % terms of the pseudo Wigner-Ville distribution. % % N : number of poi...
94976c5ef683958910d77c645bc0448414f57eaf00690ed7fdd5404cd1b0f4d1
MATLAB
2,494
86
function x=ifmt(mellin,beta,M); %IFMT Inverse fast Mellin transform. % X=IFMT(MELLIN,BETA,M) computes the inverse fast Mellin % transform of MELLIN. % WARNING : the inverse of the Mellin transform is correct only % if the Mellin transform has been computed from FMIN to 0.5 Hz, % and if the original signal is analytic...
951f211da19c47953b10b90f0eb3346f29f69e38259711badc60f61fa18e2377
MATLAB
2,494
104
function LAN = lan_segment_selected(LAN,seg_time,overlap) % <??LAN)<] toolbox % v.0.3 % % Segment a continuos recording of previous segemnted recording in % selected araes. % seg_time = [] for segmented by exact time of each selected areas % [s] for s second windows in the selected areas, % over...
5a6b8f04aec27b51019217a4f3a10a5d815c458213b047ee502414cc7251b8c7
MATLAB
2,495
65
% JPSTH calculates jpsth for two spike counts aligned around an event % jpsth.m % % Copyright 2008 Vanderbilt University. All rights reserved. % John Haitas, Jeremiah Cohen, and Jeff Schall % % This file is part of JPSTH Toolbox. % % JPSTH Toolbox is free software: you can redistribute it and/or modify % it under ...
f08fac29e182a2bc2717b3048caa2918c5c4098413205226adb41ffcdbd1e9c4
MATLAB
2,495
74
function timefreq_1level(LAN,cfg) % LAN trabajando % v.0.0.0 % % ntype = getcfg(cfg,'type','glm'); ncond = getcfg(cfg,'cond','all') switch ntype case 'glm' if iscell(LAN) if any(isnumeric(ncond)) LAN = LAN(ncond); end for lan = 1:length(LAN) if lan == 1 ...
0d0cd0962330b5863a25301ae5ce36974028ddee214b3c9cfd2273d2ad4e96cb
MATLAB
2,496
68
% TSDEFINETRIALTYPE Define a trial type. % TSDEFINETRIALTYPE(TRIALNAME,CODES) defines a trial named <TRIALNAME> % where <TRIALNAME> is a name of your choosing, such as, for example, % "CS1". CODES sequence of MATCHCODES specifying what constitutes this % kind of trial--see TSmatch for an explanation of match...
6b0d2ae7be0b565b84f37f2207dafaf24c24d6b7f470b10b4b76d06291132c81
MATLAB
2,496
88
function [Mnew,PCout] = step1_PCA(M,Npc_max) %STEP1_PCA Apply Principal Component Analysis % INPUTS % M matrix Npix X Nt - movie image % Npc_max scalar - number max of principal components % OUTPUTS % Mnew matrix Npix X Nt - centralized movie image used for PCA % PCout ...
b07aadccd88b7598fe7fe59730b2b71d1bd3be2c473a030f409e735046fbb470
MATLAB
2,496
61
% Main script for the Behavior analysis for Control periods % By: xinyuan Zheng Jan 18 2022 - xinyuan.zheng@yale.edu %% paths clear; close all; group = 'BehControl_1uA'; datapath = 'F:\xinyuan\Mouse Project\Behavior_partial_confirmed_LOVO'; res_path = 'F:\xinyuan\Mouse Project\Results'; %% important variables na...
cee257e94869dcdbadee87f16bffd1b91e8c100d3d30f5449530d1142d43fa06
MATLAB
2,497
63
function EWsig=McNemar_Figs2(dataOut,IM,B,params) % Plot network pairs meeting significance if ~exist('B','var'),B=1;end Pth=0.05./B; PthMcN=0.05; [NNidx,Tidx,TNidx]=IM2idx(IM); Npairs=length(TNidx); Nnets=max(IM.key(:,2)); NetKey=[[1:Nnets]',[1:Nnets]']; %cMap=[1,1,1;0,0,0]; %% Significant stats by network block gt...
09d6eaadfaa27d24ce2ccb453ecadbb73e2942fa0dd873eb1af637f1a38d7acd
MATLAB
2,499
59
function [ titleStr, settings, results ] = deleteGraphs( dataview, settings ) % This function removes one or more graphs from the datasource. % % % %<PRE> % This file is part of dspace-core. % % Copyright (C) 2020 University Zurich, Sepp Kollmorgen % % This program is free so...
885e4342bc2fef35a1cce48b5bbaa7fb95b8f82d299e0f8c4ee8aa5bfabc4f63
MATLAB
2,499
110
function[AIF_v, t_IDIF_virtual,par_names,p_est,cv_est,rho2,W] = feng_fitting(IDIF_raw,t_IDIF_emi,t_IDIF_delta, obj_fun_choice, par) %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % FIT del modello sulla IDIF % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% t_fit = t_IDIF_emi/60; %t_fit_delta = t_IDIF_delta/60; t_end = t_IDIF_emi(end)...
8bec1bc80b14f05c78ba7c2f170a7863484646026e68be70f3d92ad755376bfc
MATLAB
2,499
90
function flip_endianness(imgs) % Flips fMRI images (swap R/L) % % :Usage: % :: % % [Vimgs] = flip_endianness(imgs) % % .. % Author and copyright information: % % Copyright (C) <2006> <CANLab> % Written by Tor? Documented by Marianne % % This program is free software: you can redistribute it and/or ...
a32a38802168fad7ad933e7bbcaec0d13825dd1fc93d5b2bbe74e01f7f13d85b
MATLAB
2,499
67
% Author: Javier Lopez-Calderon % Newencode Analytics % www.newencode.com % Talca, Chile % 2022-2023 % % This function gets all the filenames within a folder (pathname) with an % specific extension (dataExt). Additionally, it searches for a common string % among the found filenames located at the end of their names. %...
96e8b2d00ec5583e9406252d4e39672da5a0e75bc9eb1783cafa60bc862b593b
MATLAB
2,500
82
%init_intrinsic_param_fisheye % %Initialization of the intrinsic parameters. %Runs as a script. % %INPUT: x_1,x_2,x_3,...: Feature locations on the images % X_1,X_2,X_3,...: Corresponding grid coordinates % %OUTPUT: fc: Camera focal length % cc: Principal point coordinates % kc: Fisheye distortion coe...
f80bb8eb7160c784c21d16786f8fb2baefd5a9d9746a1514d59a32b1221d1933
MATLAB
2,500
76
function [fx, dfdx, dfdp] = f_QlearningAsym (x, P, u, in) % // VBA toolbox ////////////////////////////////////////////////////////// % % [fx, dfdx, dfdp] = f_QlearningAsym (x, P, u, in) % Reinforcement-learning evolution function for a n-armed bandit task with % asymmetric learning for positive and negative feedbakcs...
ff75b27e7efcd63e0839436021808cb7c471cc793a77ac79fb90dedc48e24831
MATLAB
2,500
79
function [posterior, out] = demo_staticModel () % // VBA toolbox ////////////////////////////////////////////////////////// % % [posterior, out] = demo_staticModel () % Demo of simple linear Bayesian regression % % The problem is to fit observations with a linear combination % of regressors. Formally, this can be writt...
740a39f5184c190f2ef906cc50bea71b505c7ece8205c98cede3e6bf6d4528d5
MATLAB
2,501
74
function [hhead,hline] = vectarrow(p0,p1,arrowheadlength,arrowheadwidth,varargin) %Arrowline 3-D vector plot. % vectarrow(p0,p1) plots a line vector with arrow pointing from point p0 % to point p1. The function can plot both 2D and 3D vector with arrow % depending on the dimension of the input % % Example: % ...
0dfc65e412bc708181fd97abc3487aeba493d1b9daffe622d53781686e909b32
MATLAB
2,502
76
function [apk,ap,meanoks,apvals] = ComputeOKSStats(data,kappa,varargin) [conddata,pttypes,datatypes,labeltypes,apvals,meanapvals,distname,netname,exptype] = myparse(varargin,'conddata',[],'pttypes',{},... 'datatypes',{},'labeltypes',{},'apvals',[40,50,60],'meanapvals',30:5:70,'distname','gamma2','netname','','exptyp...
11fa2744980a585bd2fe376bab96ff7f6b9024d481fd5eb68483dbae1f3aa29c
MATLAB
2,502
95
function norm = quantilenorm_simple(data) row_size = size(data,1); col_size = size(data,2); sort1_start = tic; disp('sort 1'); d = cell(1,col_size); d_mean = zeros(row_size,1); div_size = 8; sub_idx = [1:ceil(row_size/div_size):row_size row_size+1]; for i = 1:col_size fpr...
e1eb62974f69b36d6c786eb7f8bfe41f022f38a840622996b558c10a0d21c578
MATLAB
2,502
64
function mask = maskCircle( angleStart, angleSiz, r, nSamples ) % Creates an image of a 'pie slice' of a circle. % % Creates a 2D array of size (2rx2r) with values between 0 and 1. % Specifically, mask has values 1 inside the pie slice of the circle % defined by angleStart and angleSiz. For example, using % angleStart...
5573e8c8da6d69558b754a12065e2c8604e71342bccaca22fe9a52f8e1b8216b
MATLAB
2,503
71
function [x, ut] = svdfft(f, n, trltapcnt); % SVDFFT computes a rotated FFT matrix, using the real part of the % cross-spectral density matrix. This rotation ensures that the phase % relationship of the underlying sources does not change, while rotating % the channels such that the first channel contains the maximal a...
e2224ef07d4d89d4ce7a2c7ca24c976fd43d4075971bf0a493a852a83144cbca
MATLAB
2,503
41
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
f9bdc80f8745a26efcedb45ea8c9083243103a6469359e7a6b100fbfe2b1f757
MATLAB
2,503
74
function [path, filter_idx] = uibrowse(filter_spec, start_path, dialog_title, type) %UIBROWSE Displays a file or folder selection dialog. % Usage: % path = uibrowse % path = uibrowse(filter_spec) % path = uibrowse(filter_spec, start_path) % path = uibrowse(filter_spec, start_path, dialog_title) % path = uibr...
28434a6aa36cce23eb29b949c76ca9c8ea2a2a67e321897d9527ea0216c14128
MATLAB
2,505
49
% Code to perform flat hyperellipsoid projection. In this code we take a % current density input which can be the output of a gradient descent % procedure and project it inside (on the boundary) of an ellipsoid to % satisfy the constraint of the problem. This is the generalization of % projecting to an ellipsoid in...
d82dacb6ec3193ac44a4c1ffde2142ea7a3030115139d009328fdadcc2e6ef3f
MATLAB
2,506
77
function [warp,L,LnInv,bendE] = tpsGetWarp( lambda, xsS, ysS, xsD, ysD ) % Given two sets of corresponding points, calculates warp between them. % % Uses booksteins PAMI89 method. Can then apply warp to a new set of % points (tpsInterpolate), or even an image (tpsInterpolateIm). % "Principal Warps: Thin-Plate Splines...
f596d505c1d4b59a3c370b2f5a9b12290e3073ceadaac8099690c296d3606a26
MATLAB
2,506
76
% this demo reproduces the dissociation between fit accuracy and % generalization accuracy. % In brief, it simulates data under a GLM compriing n=16 regressors (with % random weights). This simulated data is then splitted into train (2/3) % and test (1/3) datasets. GLMs equipped with 0<i<32 regressors are then % fitted...
6bc80cbc1f095b95fe911e4b9b8e08166dda57882daf3473b418fe1d18ce1023
MATLAB
2,507
66
%% This file creates the trace averaged nii for the reduced direction simulations %% transfer nii to trace nii data for reduced directions numDir32 = [16, 4]; numDir64 = [16, 4]; PATH = pwd; subjects = {'sub_001'};%, 'sub_003', 'sub_004', 'sub_005', 'sub_006', 'sub_007', 'sub_001_rescan', 'sub_003_rescan', 'sub_...
d3b9f0ec56f0ebcb19fa4b84dcbd3897185daf393099ee0cc8ea1ab571f5e720
MATLAB
2,507
110
function [st quality area zeroflag edges edgeflag] = CheckMesh2D(e,p,inputflags) % Checks the 2D triangular mesh for quality and consistency. % The quality measure is the ratio of circumcircle to incircle and its % range is between 0 and 1. % If edgeflag is 1 it means there are edges that are shared by more than % two ...
fa0c3f90845f3488c29583d8c7f06166864b6cfed164a3a3be00f457f38e1c1e
MATLAB
2,507
95
% 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,...
318288407546ed5575b6d6d9ac72d244c3372e1f5d2e781ea2dad9ea4dfe65b4
MATLAB
2,508
83
function AutoPlaybackNew(ImageArray,FrameInterval,PauseInterval,IntensityLimits,Coloring) % 1,0.0001,[],'jet') if isempty(Coloring) Coloring=jet; end if isempty(FrameInterval) FrameInterval=1; end ImageHeight=size(ImageArray,1); ImageWidth=size(ImageArray,2); ScreenSize=get(0,'ScreenSize'); AspectRatio=Imag...
c6a299bf1862a6034407ca69dd7f5751749e06e54af0a7a446f3dcf74466dc9d
MATLAB
2,508
92
function V = mttkrp(X,U,n,vers) %MTTKRP Matricized tensor times Khatri-Rao product for tensor. % % V = MTTKRP(X,U,n) efficiently calculates the matrix product of the % n-mode matricization of X with the Khatri-Rao product of all % entries in U, a cell array of matrices, except the nth. How to % most efficientl...
e6ba2fccd7058bfb60d15813183ee14e5a8bdbc5d731949d10e124d10bffd0ab
MATLAB
2,508
93
function hmm = dgmSeqToHmm(dgmSeq) %% Convert a dgmSeq to an hmm % work in progress % This file is from pmtk3.googlecode.com intra = dgmSeq.intra; inter = dgmSeq.inter; slice1CPDs = dgmSeq.slice1CPDs; slice2CPDs = dgmSeq.slice2CPDs; emission = dgmSeq.emission; intraH = intra(1:end-1, 1:end-1); interH...
2d60e7c85e11678decfb51f72c42b6dd8ffd426e1904206754deb053c0647380
MATLAB
2,509
115
function demo_doubleWell % Demo for Double Well system. % This demo inverts a model of chaotic double-Well system, which is % observed through a nonlinear sigmoid observation function. % Choose basic settings for simulations f_fname = @f_doubleWell; g_fname = @g_sigmoid; u = []; n_t = 2e2; deltat = 2e-2; alpha ...
6f4f39f2ba128cd7a8e40a14c0dae1a7d053ab230664392444a29b36f96be5b4
MATLAB
2,509
83
function [closestPtBef,closestPtAft,idxB] = findBeforeAfter(A,B,type) % This function finds the closest value of B to each value of A. % % Inputs: % A: A matrix of values % B: A matrix of reference values % Type: Type of points we want to return (3 options) % 'both' = find the closest point of B ...
7af9c624d34a0646ed516332e170fcdf9649f42153d7300c7e477df738b4460c
MATLAB
2,509
77
function [model, loglikHist] = mixDiscreteFit(data, nmix, varargin) %% Fit a mixture of product of multinoullis via MLE/MAP (using EM) % % By default we lightly regularize the parameters, so we are doing map % estimation. To turn this off, set 'prior' and 'mixPrior to 'none'. See % Inputs below. % %% Inputs % % data ...
1f15a0824958090d8e88f25bd0660079b7338f2ebc9665899aa6d8cea951b558
MATLAB
2,510
63
function e_global = error_cam_proj(param); global n_ima x_1 X_1 xproj_1 x_proj_1 x_2 X_2 xproj_2 x_proj_2 x_3 X_3 xproj_3 x_proj_3 x_4 X_4 xproj_4 x_proj_4 x_5 X_5 xproj_5 x_proj_5 x_6 X_6 xproj_6 x_proj_6 x_7 X_7 xproj_7 x_proj_7 x_8 X_8 xproj_8 x_proj_8 x_9 X_9 xproj_9 x_proj_9 x_10 X_10 xproj_10 x_proj_10 x_11 X_11...
8c1a9e582ac23435516b2cd6084401415bcfcb110c2066f73e601e199dd2fbd8
MATLAB
2,510
70
function diff = getDirectionalDerivative(problem, x, d, storedb, key) % Computes the directional derivative of the cost function at x along d. % % function diff = getDirectionalDerivative(problem, x, d) % function diff = getDirectionalDerivative(problem, x, d, storedb) % function diff = getDirectionalDerivative(pr...
c3ac0e5667fc9293a6d6aacc8d3860424f2a7532ffe603f9078793583660af06
MATLAB
2,511
68
function Image_wColorMap=EmbedColorMap_Color(Image,Orientation,Location,Height,Width,ColorLimits,ColorMap) %Image=TempDeltaFF0; Image_wColorMap=Image; %Location=[120,80] %Orientation=1; %Height=20; %Width=100; if Orientation==1 DivisionSize=(ColorLimits(2)-ColorLimits(1))/Width; NumDivisions=Width; else Div...
34d43a9c769fc4b401377e60251e970b332dc051d6fb2cf8847de3e3ce7e5661
MATLAB
2,513
75
function [XfieldOfView, YfieldOfView] = calculateFieldOfView(ScanImageZoom) % calculates field of view in um for given ScanImageZoom % A.Sobczyk <sobczyk@cshl.edu> % PLEASE INCLUDE NAME DATE AND RIG OF CALIBRATION set(0, 'DefaultFigureColor', 'w'); % JBM 071515 Naga (In-Vivo Two-Photon Rig On 3rd Floor [...
3bf53cad4375a803c1f0f1fc3afa5361a36e1ae541d636d5442cf650dc4f14d7
MATLAB
2,513
72
function [fileinfo,trackerinfo,scfg] = loadTracker(cfgjsonfile) % Load metadata about a trained tracker from its tracker-config json % file, locating the training package files and the last network % checkpoint for each stage and view. fileinfo = struct; fileinfo.cfgjsonfile = cfgjsonfile; trackerinfo = str...
7a30704e870fd6a25a130dbdee7fb8753107d4969e1c06ee3135aba290fbe328
MATLAB
2,514
69
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% s1_conductivity_selection.m %%% %%% Choose a conductivity set. %%% %%% This script will generate a model folder and tissue file for the %%% %%% selected patient...
a100e549b532888d5453bddc0adfc23cd8e68c8e01d1451b00629687724b54ad
MATLAB
2,514
62
% Compiles all mex routines that are part of toolbox. % % If you get warnings about "omp.h", your compiler may lack default OpenMp % support (for info about OpenMP see http://en.wikipedia.org/wiki/OpenMP). % To compile without OpenMP alter code below to 'useOmp(:)=0'; and re-run % toolboxCompile. Note that this will di...
b799017a3555b4fb85d757fdc76e7df8d8869a669dc232079a9d180cf5c577e7
MATLAB
2,514
79
%% tsdata_to_autocov % % Calculate sample autocovariance sequence from time series data % % <matlab:open('tsdata_to_autocov.m') code> % %% Syntax % % G = tsdata_to_autocov(X,q) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % X multi-trial time se...
e664f6d1e1e95e40bbf6d270b3ca8ad681c8051abfdd9057f679ea80d136760d
MATLAB
2,516
67
%% computeSDO_KLDMeasures % Compute the Knullback-Liebler Divergence (KLD) between two provided % probability distributions, from M1 --> M2. % If M1 is 3D, while M1 is 2D, calculate the KLD for each xy 2D array page, % indexed by the third dimension (z). % % DEPENDENCIES: % pxTools Library (pxTools_KLDiv) % % INPUT...