sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ac4aa92f9e3bbf773abe57656304175809528148dadad039e2ebccbb5afe9008
MATLAB
7,298
253
%% Copyright © 2025- Joonas Lahtinen and Alexandra Koulouri function [z_vec, self] = invert(self, f_data, L, procFile, source_direction_mode, source_positions, opts) % % invert % % Builds a reconstruction of source dipoles from a given lead field with % the GroupLasso method. % % Inputs: % ...
9cc13992a7456dabb84eaf7fe3d0cd88e4e616fa8187dd58374ca8899fc18326
MATLAB
7,340
250
classdef ZefSourceModel % An enumeration of the different source- or interpolation models used by % Zeffiro Interface. enumeration Hdiv Whitney StVenant ContinuousHdiv ContinuousWhitney ContinuousStVenant Error end methods function ...
2a65949bf7abba2f9d4843798c765d5da9e1e7970eed3500f6fac67747fcf24c
MATLAB
7,341
257
function M = spherefactory(n, m, gpuflag) % Returns a manifold struct to optimize over unit-norm vectors or matrices. % % function M = spherefactory(n) % function M = spherefactory(n, m) % function M = spherefactory(n, m, gpuflag) % % Manifold of n-by-m real matrices of unit Frobenius norm. % By default, m = 1, which c...
2ad6692c153264eb719f1eab566e2b41168bf792c2461c130769a769d69b5d03
MATLAB
7,353
258
% The idea of this script is that everytime someone changes something in % the core code, runs it to check everything is still alright. % That is: we won't update stuff to git without running this script first % gen data X = randn(4000,3); T = 500*ones(8,1); B = rand(3); for i=1:length(T) X((1:250)+sum(T(1:i-1...
6cbe0470a7bf391f9e1cd902061cbf8cf47587e96835d31144db131978c3a9c5
MATLAB
7,379
171
function [z,Var_loc,reconstruction_information] = RAP_MUSIC_iteration %Based on %- "Source Localization Using Recursively Applied and Projected (RAP) MUSIC" (1999) %- "EEG and MEG Source Localization using Recursively Applied (RAP) MUSIC" (1997) %by John C. Mosher and Richard M. Leahy h = zef_waitbar(0,1,['RAP MUSIC.'...
8acac0f6689bbe8a4437fb5f579dbf78f08159728cf4e8797f52c8fda7436065
MATLAB
7,385
222
function [dblClustP,sClustPos,sClustNeg] = clustertest(matCond1,matCond2,intReps,vecT,dblClusterCutOff) %clustertest Cluster-based statistical test for paired data; Maris and Oostenveld (2007) % [dblClustP,sClustPos,sClustNeg] = clustertest(matCond1,matCond2,intReps,vecT,dblClusterCutOff) %% check inputs if nar...
7351977e0c66dccddf6f498e4bc7b5207383d714d39500e12dcb22eb8275a6a0
MATLAB
7,387
130
function plot_ensemble_coordinates_style_2(app) cla(app.ensemble_coordinates); app.ensemble_coordinates.NextPlot = 'replacechildren'; % 1 udf_id = app.StimulusEditField.Value; udf_label = app.params.udf_labels{udf_id}; neuron_id = app.HighlightedEnsNode.Value; % 1 app.ensemble_coordinates.Title.String = strcat(udf_lab...
164976a092d71a5613522b50c1f502e049f2759239db75124a87ea60ea276f75
MATLAB
7,408
252
function M = obliquefactory(n, m, transposed) % Returns a manifold struct to optimize over matrices w/ unit-norm columns. % % function M = obliquefactory(n, m) % function M = obliquefactory(n, m, transposed) % % Oblique manifold: deals with matrices of size n x m such that each column % has unit 2-norm, i.e., is a poin...
fc8b15e79ba915844841a8122ac5b52af7c6435b18118e7b3305b75ac22772fc
MATLAB
7,422
174
classdef ModelCollection properties %Properties & Definitions models; % individual models in collection x_train; % training dataset x_valid; % validation dataset x_test; % testing dataset end methods function self = ModelCollection(models,para...
85b8a2f32ee994ec628c2e77946cd307787bb325b3d47a292d7dc788e793c67d
MATLAB
7,441
143
%This is the startup script for GMModel app. One must add this as launch %script to zeffiro_plugins file: %GMMclustering, inverse_tools, GMModel_start zef.GMMclustering = GMMclustering_app; %_ Initial values _ if ~isfield(zef,'GMMcluster_clustnum') zef.GMMcluster_clustnum = 3; end if ~isfield(zef,'GMMcluster_reg...
227bf0ad6a5109d813947d7f14f79afaab8810fca572b672012190a0282863b1
MATLAB
7,472
233
%Copyright © 2018, Sampsa Pursiainen function [eit_data_vec] = zef_compute_gravity_data(nodes,elements,rho,electrodes,varargin) N = size(nodes,1); L = size(electrodes,1); if iscell(elements) tetrahedra = elements{1}; prisms = []; K2 = size(tetrahedra,1); waitbar_length = 4; if length(elements)>1 ...
ece93d75e0425647a4f6d24a9a994081fabc8706fccd9cb263237c7ff05c24d5
MATLAB
7,472
233
%Copyright © 2018, Sampsa Pursiainen function [eit_data_vec] = zef_compute_gravity_data(nodes,elements,rho,electrodes,varargin) N = size(nodes,1); L = size(electrodes,1); if iscell(elements) tetrahedra = elements{1}; prisms = []; K2 = size(tetrahedra,1); waitbar_length = 4; if length(elements)>1 ...
a4d0a72226793099c0da73cf44e881b021780acb1e1105390a4ba923fa767312
MATLAB
7,491
228
function Gamma = cluster_decoding(X,Y,T,K,cluster_method,... cluster_measure,Pstructure,Pistructure,GammaInit,repetitions,nwin) % clustering of the time-point-by-time-point regressions, which is % temporally constrained unlike TUDA % INPUT % X,Y,T are as usual % K is the number of states % cluster_method is 'regre...
c4f203d1c1785aeb1fd56b4968ab693e65a1971d908272688cb194bee7b52624
MATLAB
7,491
220
function [Y, R, E] = Isomap(D, n_fcn, n_size, options); % ISOMAP Computes Isomap embedding using the algorithm of % Tenenbaum, de Silva, and Langford (2000). % % [Y, R, E] = isomap(D, n_fcn, n_size, options); % % Input: % D = N x N matrix of distances (where N is the number of data points) % n_...
d4fe51ee1eeb56fe19678f8fc674f0ace4ca7d4551fe4cafb0034a945d42d52b
MATLAB
7,495
120
if isfield(zef,'h_mesh_tool') if isvalid(zef.h_mesh_tool) delete(zef.h_mesh_tool) end end zef_data = zef_mesh_tool_app_exported; %zef_data.h_mesh_tool.Visible=zef.use_display; zef = zef_assign_data(zef, zef_data); zef.h_mesh_tool.CloseRequestFcn = 'zef.h_mesh_tool.Visible=''off'';'; zef.h_mesh_tool.De...
a872beaa229a3f836d466725a3de0a6b7dd223f1c69f27735ecb7de07cbe8de5
MATLAB
7,499
137
function zef = zef_ES_optimization_window(zef) zef_ES_optimization_init; zef_data = zef_ES_optimization_app; %% zef_data % Figure zef.h_ES_workbench = zef_data.h_ES_workbench; % DropDown zef.h_ES_opt_solver = zef_data.h_ES_opt_solver; zef.h_ES_opt_method = zef_data.h_ES_opt_method;...
363dcb3ce6b50072271e4ced8dc90c122e7c50bc8c75f14f3961f3ba38cb9923
MATLAB
7,518
172
function [z,Var_loc,reconstruction_information] = RAP_MUSIC_iteration %Based on %- "Source Localization Using Recursively Applied and Projected (RAP) MUSIC" (1999) %- "EEG and MEG Source Localization using Recursively Applied (RAP) MUSIC" (1997) %by John C. Mosher and Richard M. Leahy h = zef_waitbar(0,1,['RAP MUSIC.'...
426cd6665ff01d71a62fb12a180f160e2d57c084fbd7b172605eada2e562a9d7
MATLAB
7,542
243
function [sTrackParams,sLabels] = getEyeTrackingParameters(sFile,strTempPath,boolAutoRun,boolOnlyLabels) %getEyeTrackingParameters Run offline pupil detection parameter setter % sTrackParams = getEyeTrackingParameters(sFile) %sFile=sETO.sFiles(intFile); %strTempPath=sETO.strTempPath; %% globals global sFigE...
4b2bc280a7ffc3e7d2d591bf245f5257a02ed9213bfba8ed91739b15943ec3fa
MATLAB
7,550
224
function [mcv,cv,rmcv_rand,rcv_rand,rmcv_train,rcv_train] = cvhmmmar(data,T,options) % % Obtains the cross-validated sum of prediction quadratic errors. % % INPUT % data observations, either a struct with X (time series) and C (classes, optional) % or just a matrix containing the ti...
63b1daa8e24b5b06e7ecff81dddaf0adb03d2801f29445f3a886d6cb6fe75d65
MATLAB
7,558
189
function detection = moelle_spindle_detection(C3_N2,C3,fs) % MOLLE Detect sleep spindles using the Moelle algorithm. % M. Molle et al. "Grouping of Spindle Activity during Slow Oscillations % in Human Non-Rapid Eye Movement Sleep", J Neurosc 22(24), 2002, pp % 10941-10947 % % First input is a structure containing EEG f...
72e58acf17b7658d33a073050f8eef38393165bdc85df39655dd0f238f365921
MATLAB
7,580
212
function [bandwidth,density,X,Y]=kde2d(data,n,MIN_XY,MAX_XY) % fast and accurate state-of-the-art % bivariate kernel density estimator % with diagonal bandwidth matrix. % The kernel is assumed to be Gaussian. % The two bandwidth parameters are % chosen optimally without ever % using/assuming a parametric model f...
802d87dbca73ed8fa0651c2c07e98f8c22e47e153ed7e3890c02025897a0c8d1
MATLAB
7,598
213
%-------------------------------------------------------------------------------- % maze.m % % This demo is included in % Canonical neural networks perform active inference % Takuya Isomura, Hideaki Shimazaki, Karl J. Friston % % The MATLAB scripts are available at % https://github.com/takuyaisomura/reverse_engineerin...
eb32f8525e905ae7c0ea4285380918a75d029e31138ef74b50f6701106aeb4dd
MATLAB
7,623
180
function [hScrollPanel, hPanel] = attachScrollPanelTo(hObject) % attachScrollPanelTo Places the input control/panel in a scrollpanel % % Syntax: % [hScrollPanel, hPanel] = attachScrollPanelTo(hObject); % % Description: % attachScrollPanelTo places the specified control/uipanel handle in % a scroll-panel (a Jav...
94eb23ad5d4f3c4e257ba5bf892f6cd3d4f7df2b12f88df4fe28c4286d4fcbc3
MATLAB
7,645
256
function info = erp_chi2stateprobs(obj,expectedConditions,observedConditions,varargin) % Perform chi2 test for responses %% Check inputs % Check multiple conditions appear in the data if length(obj.conditionlabels) == 1 error('The cohort structure must contain multiple conditions'); end % Check if numbe...
92d023e7c21e51c989e90e6e2454bf28c02091f23b6af6daa0267b41ed0037bb
MATLAB
7,657
196
function [ptrPanelParent,ptrSlider,ptrPanelTitle,sPointers] = ETO_genSliderPanel(ptrMasterFigure,vecLocation,sFiles) %% set constants %unpack location vector dblTitleHeight = 0.15; dblTitleY = vecLocation(2)+vecLocation(4)-dblTitleHeight; dblPanelX = vecLocation(1); dblPanelY = vecLocation(2); dblPanelWidth = ...
72fc486d3feb4e2da31b41c5d88342829842b9694d98c83dfeec37f3aa4ce7da
MATLAB
7,669
296
load('postprandial_somnolence_avalanche') wakefulness_value=[]; drowsiness_value=[]; drowsiness_mean_ratio=[]; drowsiness_std_ratio=[]; wakefulness_mean_ratio=[]; wakefulness_std_ratio=[]; for t=1:20 drowsiness_mean_ratio(t)=mean(drowsiness_ratio(:,t)); drowsiness_std_ratio(t)=std(drowsiness_ratio(...
5e1951064fadbdd60844c0d2a50484e6b6bc87da935594b037a177371a57824d
MATLAB
7,704
180
%% Fieldtrip processing % NOTE: This script does not contain any tutorials for +microstate toolbox, % and is just used for pre-processing the data. For the tutorial on % +microstate, see the script example_script_EEGcanonicalmaps.m % % This script follows the Fieldtrip tutorial for cluster permutation % analysis...
70a20c0034876814488b501d2ff5cd5a0d59dde13b8d04ca34a5ddad7e9011a4
MATLAB
7,712
123
% NLX2MATNRD Imports data from Neuralynx NRD files to Matlab variables. % % [Timestamps, Samples, Header] = Nlx2MatNRD( Filename, ChannelNumber, % FieldSelectionFlags, HeaderExtractionFlag, % ExtractMode, ExtractionModeVector); % % Version 6.0.0 % %...
f5b75cd0c5dcbdae2bc993b1ced2a887837adf97ecb0db53c39ebe8cfc5c039e
MATLAB
7,729
172
%% Result 3 : Long-Range Connections for Balancing Performance and Wiring Cost (Figure 4) %% Generate dataset if ~exist('IMAGE_nat') tic disp('generating gray-scale CIFAR-10 ...(~ 1 min)') img_dim = x_dim; [IMAGE_nat,LABEL_nat] = fun_generate_grayCIFAR10(img_dim,numTrain_nat); toc end %...
1a8d7c3adc9f7b740c58b9a47de6681dd4fb3de113fb97f9ae99dab103a4c58f
MATLAB
7,733
199
function M = sympositivedefinitefactory(n) % Manifold of n-by-n symmetric positive definite matrices with % the bi-invariant geometry. % % function M = sympositivedefinitefactory(n) % % A point X on the manifold is represented as a symmetric positive definite % matrix X (nxn). Tangent vectors are symmetric matrices of ...
13b736cc754067c7e7c1eb38f702c32cc891692109a065f40ed84f8ca6de036e
MATLAB
7,740
188
function d = stoi(x, y, fs_signal) % d = stoi(x, y, fs_signal) returns the output of the short-time % objective intelligibility (STOI) measure described in [1, 2], where x % and y denote the clean and processed speech, respectively, with sample % rate fs_signal in Hz. The output d is expected to have a mono...
b3a43540656faf1b219ad852bf9f16c53067616e1a0851268d7ba46b0364c5e7
MATLAB
7,746
188
function d = stoi(x, y, fs_signal) % d = stoi(x, y, fs_signal) returns the output of the short-time % objective intelligibility (STOI) measure described in [1, 2], where x % and y denote the clean and processed speech, respectively, with sample % rate fs_signal in Hz. The output d is expected to have a mono...
6ebb526eb95e98114cdf5f3f9d2ae074e9083574903ab7de96e7dcee285c9a4d
MATLAB
7,774
189
function detection = wamsley_spindle_detection(C3_N2,C3,fs) % WAMSLEY Detect sleep spindles using the Wamsley algorithm. % E. Wamsley et al. "Reduced Sleep Spindles and Spindle Coherence in % Schizophrenia: Mechanisms of Impaired Memory Consolidation", % Biol Psychiatry 71, 2012, pp 154-161 % % First input is a struc...
7d68b446b450c689305c7e72abb71b137672e15b4d504fdda94d3759c060adff
MATLAB
7,822
164
if isfield(zef,'h_mesh_visualization_tool') if isvalid(zef.h_mesh_visualization_tool) delete(zef.h_mesh_visualization_tool) end end zef_data = zef_mesh_visualization_tool_app_exported; %zef_data.h_mesh_visualization_tool.Visible = zef.use_display; zef.fieldnames = fieldnames(zef_data); for zef_i = 1:l...
bceb2128e362d6eb34086b939dc559919bc095eb4393c9c989bbe3bdb1004bdf
MATLAB
7,836
206
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [z,reconstruction_information] = zef_CSM_iteration h = waitbar(0,['CSM MAP iteration.']); [s_ind_1] = unique(evalin('base','zef.source_interpolation_ind{1}')); n_interp = length(s_ind_1); snr...
c3e7f646d65bbc5dc00962af47d01a55dd93b39f6d0d8ae9451bba041368e01a
MATLAB
7,907
251
function [P,Psession,D] = permtestFC(data,T,options) % % Test the how different are the states in terms of FC % % INPUT % data observations, either a struct with X (time series) and C (classes, optional) % or just a matrix containing the time series % T length of series ...
f313c609d128488d16cfc3ff4570bbca4d1b2171d5bd3960d028d355a2ca7bbf
MATLAB
7,909
127
% NLX2MATEV Imports data from Neuralynx NEV files to Matlab variables. % % [TimeStamps, EventIDs, TTLs, Extras, EventStrings, Header] = % Nlx2MatEV( Filename, FieldSelection, ExtractHeader, % ExtractMode, ModeArray ); % % Version 6.0.0 % % Requires MATLAB R2012b...
5dfb0de8510d44b7dbfa96777dece5ac8cda3746b3b77320aa929b83afcbc681
MATLAB
7,946
209
function plotErrorInEmpiricalSyncResults(varargin) %% function plotErrorInEmpiricalSyncResults(N, b, c, undirected, discretized, repeats, networkType, p, d, S, maxMotifLength, folder, MaxK, dt) %function plotErrorInEmpiricalSyncResults(parameters) % % Plot the error between analytic and empirical synchronisation versus...
f3358f678b893eff0b274e7ee310e142f6fc19ba066fe8e84492dc62025ae777
MATLAB
7,947
128
function varargout = zef_bst_plugin_start(folder_name,zef_bst,open_dialog) if nargin < 2 zef_bst = struct; end if nargin < 3 open_dialog = 1; end varargout = cell(0); zef.program_path = folder_name; addpath(fullfile(folder_name,'m')); zef = zef_apply_system_settings(zef); position_vec = zef.segmentation_tool_de...
a1ea4a0bed40b47b2304eced3742738e0381b812235914affbb476e1d34de9fa
MATLAB
7,965
268
function [A, B, C] = zef_build_electrodes(nodes, electrode_model, impedance_vec, impedance_inf, ele_ind, A) % zef_build_elecrodes: constructs the matrices B and C [*] from given nodes, % impedances, a stiffness matrix A and electrode indices. Notice that the % stiffness matrix A is also returned from the function, to ...
31d873485f7e2117ac6975da3c220d29c0633ffcee6c4e5bb0890a88217210be
MATLAB
8,009
226
%Copyright © 2018, Sampsa Pursiainen function [L_gravity, bg_data, source_locations, source_directions] = lead_field_gravity(nodes,elements,rho,sensors,varargin) % function [L_eeg, source_locations, source_directions] = lead_field_gravity(nodes,elements,rho,sensors,gravity_ind,source_ind,additional_options) % % Input:...
8a5ff8feeeb039346abd00ee51cb988d507c31c070c88c68c0a000d9d90ad6dc
MATLAB
8,014
196
function detection = martin_spindle_detection(C3_N234,C3,fs) % MARTIN_SPINDLE_DETECTION Detect sleep spindles using the Martin algorithm. % N. Martin et al. "Topography of age-related changes in sleep spindles", % Neurobio Aging 34(2), 2013, pp 468-476 % First input is a structure containing EEG from C3-M2 during all N...
6ef4b20790251aac251631aabc46a0bde8fc872b7c93ec9281d7da464c1ecf65
MATLAB
8,030
214
% eegfilt() - (high|low|band)-pass filter data using two-way least-squares % FIR filtering. Optionally uses the window method instead of % least-squares. Multiple data channels and epochs supported. % Requires the MATLAB Signal Processing Toolbox. % Usage: % >> [smoothdata] = ...
e2ec72b749b9f73abc6b793a300c4e9032ca947dd9a35a367c4b2c9e80ebedf3
MATLAB
8,031
226
function obj = simulate_data(obj,varargin) % Simulate time series data % check inputs options = microstate.functions.make_options(varargin) ; % default options defaults = {'params',struct ; 'fsample',[]} ; options = microstate.functions.add_options(options,defaults) ;...
65216a7228d34226b1255af303237833c1730bc57e55391320ffa30204de717c
MATLAB
8,048
231
function x = beeswarm(x,y,varargin) %function xbee = beeswarm(x,y) % % Input arguments: % x column vector of groups (only tested for integer) % y column vector of data % % Optional input arguments: % sort_style ('nosort' - default | 'up' | 'down' | 'fan' | 'rand' | 'square' | 'hex...
13423f81fe1872aabb2014dd2c43cc770474b9d1460048da98e06eecd11a1d02
MATLAB
8,073
188
%% DOES NOT NAME FILES RELIABLY! %% ZERO FOR NON-RIGID MOCO rigid = 0; % set to zero for non-rigid crop = 0; minFrames=2999; target_binWidth = 150; force_frame_count = 1; %33450; % 33450; % prime numbers crash the moco force_resize = 0; % checking if changing size of frame helps with crash % moco settings bounds = 10...
25b368903386a64475fa4353d52d637a64a0669ee39e9209c9f835ee43950a98
MATLAB
8,083
128
% NLX2MATCSC Imports data from Neuralynx NCS files to Matlab variables. % % [Timestamps, ChannelNumbers, SampleFrequencies, NumberOfValidSamples, % Samples, Header] = Nlx2MatCSC( Filename, FieldSelectionFlags, % HeaderExtractionFlag, ExtractMode, ExtractionModeVector); % % Version 6.0.0 % % ...
fb0143bd895d80add06312127a3e4eff37575bfe00ed71f5df811a57745019ec
MATLAB
8,110
284
function varargout=shadedErrorBar(varargin) % function varargout=shadedErrorBar(x,y,errBar,varargin) % generate continuous error bar area around a line plot % % function H=shadedErrorBar(x,y,errBar, ...) % function H=shadedErrorBar(ax,x,y,errBar, ...) % % Purpose % Makes a 2-d line plot with a pretty shaded er...
c8f0349a21f99a98a20d1084aebc904b8e759afde55c6d980a20b8d862f2ddc6
MATLAB
8,111
128
% MAT2NLXTS Exports data from Matlab into a Neuralynx NTS file. % % Mat2NlxTS(Filename, AppendToFileFlag, ExportMode, ExportModeVector, % FieldSelectionFlags, TimeStamps, Header); % % Version 6.0.0 % % Requires MATLAB R2012b (8.0) or newer % % % Notes on export data: % 1. Each export variable'...
4ba825f1ecad6338e08f7edabf07b77e4db787b445bc541cc949078800d84644
MATLAB
8,147
304
function [dip,xl,xu, ifault, gcm, lcm, mn, mj] = HartigansDipTest(xpdf) % function [dip,xl,xu, ifault, gcm, lcm, mn, mj]=HartigansDipTest(xpdf) % % This is a direct translation by F. Mechler (August 27 2002) % into MATLAB from the original FORTRAN code of Hartigan's Subroutine DIPTST algorithm % Ref: Algorithm AS 217...
741414e3aa73b98f8e730e88db6e7884b79a0c9b1400218d775cfb6f586ad819
MATLAB
8,150
207
%% initialize clear; clc; pathCurrent = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives pathDeriv = pwd; cd(pathDeriv); cd('rawdata'); pathRaw = pwd; cd(pathDeriv); mkdir('behavior');cd('behavior'); pathBehav = pwd; outlier_idx = 16; %% load data cd(pathBIDS); subdir = dir('sub-*'); ...
20a6cbd8bd7c4e65ef12a631cc787fe3d13db7c61d25bca99e23d8ba55f430aa
MATLAB
8,179
338
%% clear all disp('Preparing for clearing all and restart...') m=input('Do you want to continue, Y/N [Y]:', 's'); if m ~= 'Y' return end clear all close all clc addpath('./tools/') %% pre training dt=0.01; % input_infor={'q'}; input_infor={'xy', 'qdt'}; % input_infor={'q', 'qdt'}; % input_inf...
9f8f7bd518969f38f1a62f34523e539d7e79d302ae9ba43697ff365e37bcadc5
MATLAB
8,209
322
function [G, interpolation_positions] = zef_whitney_interpolation( ... p_nodes, ... p_tetrahedra, ... p_brain_inds, ... p_intended_source_inds, ... p_nearest_neighbour_inds, ... p_optimization_system_type ... ) % Documentation % % Produces a lead field interpolation matrix G with position-b...
a9745341e873fe78de26704123ee3e669c7df58f1b270f10d30e9981fb030ebf
MATLAB
8,217
212
function model = standard_classifier_train(X,Y,T,options,binsize) % Fit a classifier to the data given in X with labels Y of the type % specified in the options - see below for details % % INPUT % X: Brain data, (total time by regions) or (time by trials by regions) % Y: Stimulus, (total time by q). This variable can e...
a50bad84ec535202b9099fb4b378c699999d3c3082ac211e5ade30d7547ef805
MATLAB
8,221
235
function [hmm,fehist,feterms,rho] = hmmstrain(Xin,T,hmm,info,options) % Stochastic HMM variational inference % % INPUTS % Xin: cell with strings referring to the files containing each subject's data, % or cell with with matrices (time points x channels) with each % subject's data % T: cell of vectors, wher...
3ac448dbdeb0f6ca3080b0522ff07766692e37d867e69137779159ee4360e26f
MATLAB
8,230
241
clcl clear all rednumber=0; %redundant to analyse. if 0, use all. t1=250; t2=799; t3=800; t4=1350;%times of analysis; longer lead-ins bc need buffer times on teh edges for fileload=1; files1={};% files2={};%; end ft_defaults load dataTEMPLATE_for_fieldtrip %control for fila=1:size(files1,1); da...
94b2ac48dd970e594b2fe161ebc89bb87333a90ca2231e9a3d3b6cf9ce07dc99
MATLAB
8,231
133
function cat12_slice_and_dice_all_job(nyrs) %----------------------------------------------------------------------- % Job saved on 09-Nov-2020 12:54:55 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- addpat...
1afc60ddf8f281d7ce1397e832357e3033e23f10f69d60b3987a152a5b7a3727
MATLAB
8,232
266
function [meshStruct,tissueTable] = main(meshFile, tissueListingFile, kwargs) % % [meshStruct, tissueTable] = utilities.simnibsToZef.main(meshFile, tissueListingFile, kwargs) % % Loads a mesh and a related tissue data table from a set % of given mesh file and a tissue listing file generated % by the charm pipeline of ...
8edd2c86aa834cd160d2dc8a068ba9f2148d46efaf625a265fe2b6975ea8b5e4
MATLAB
8,232
131
% NLX2MATVT Imports data from Neuralynx NVT files to Matlab variables. % % [TimeStamps, ExtractedX, ExtractedY, ExtractedAngle, Targets, Points] = % Nlx2MatVT( Filename, FieldSelection, ExtractHeader, % ExtractMode, ModeArray ); % % Version 6.0.0 % % Requires M...
f3a9734e865f41b017555fe90accc101ab860fe3057327b8ca1bfe3c53ec9177
MATLAB
8,259
255
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_postprocess_fem_mesh(zef) if nargin==0 zef = evalin('base','zef'); end if isempty(zef) zef = evalin('base','zef'); end h = zef_waitbar(0,1,'Mesh post-processing'); parame...
c169c2b96f2031b7193657b9c767256316daea76b74a9806a2666d0c03ad1458
MATLAB
8,267
132
% NLX2MATSPIKE Imports data from Neuralynx NSE, NST and NTT files to Matlab variables. % % [Timestamps, ScNumbers, CellNumbers, Features, Samples, Header] = % Nlx2MatSpike( Filename, FieldSelectionFlags, % HeaderExtractionFlag, ExtractMode, ExtractionModeVector); % % Versio...
e098cb3d0dd76d350897f3f5277e7b7574dee3901145ac5416e036ae8c647f41
MATLAB
8,280
207
function [stepsize, newx, newkey, lsstats] = ... linesearch(problem, x, d, f0, df0, options, storedb, key) % Standard line-search algorithm (step size selection) for descent methods. % % function [stepsize, newx, newkey, lsstats] = % linesearch(problem, x, d, f0, df0, options, storedb...
3d2c38a7ec8d1620ca46225356ffaba51f8ca90490cba95771c5df8958781d25
MATLAB
8,329
123
function batch_mrionly_job_nacc(suffix) addpath(genpath('/home/mfromano/spm/spm12/')); BASE_DIR = ['/data2/MRI_PET_DATA/processed_images_final' suffix filesep]; MRI_folder_new = [BASE_DIR 'ADNI_MRI_NACC_recenter' suffix filesep]; maxNumCompThreads = 1; spm('defaults', 'PET'); spm_jobman('initcf...
853cab2f31c8a66e672bb29c914a08964b20496b632f03322b2a36c509ae8dfb
MATLAB
8,344
227
function [GMModel,GMModelDipoles,GMModelAmplitudes,GMModelTimeVariables] = zef_GMModeling_K h = zef_waitbar(0,1,['Gaussian mixature model.']); GMModelTimeVariables = []; if evalin('base','isfield(zef,''reconstruction_information'')') reconstruction_information = evalin('base','zef.reconstruction_information'); ...
065e16905e1f9a91330a87758be00a66acc5c6158ab5b7d1729759a59658e075
MATLAB
8,387
125
function batch_mrionly_job(suffix) addpath(genpath('/home/mfromano/spm/spm12/')); BASE_DIR = ['/data2/MRI_PET_DATA/processed_images_final' suffix filesep]; MRI_folder_new = [BASE_DIR 'ADNI_MRI_nii_recenter' suffix filesep]; fnames = dir(MRI_folder_new); fnames = {fnames.name}; maxNumCompThreads...
661c818b2d5f27108ae88614f5f740b57c69a2bb6822517127d1bf173a9a66e2
MATLAB
8,396
310
%% load('sleep_deprivation_avalanche') drowsiness_mean_ratio=[]; drowsiness_std_ratio=[]; wakefulness_mean_ratio=[]; wakefulness_std_ratio=[]; for t=1:20 drowsiness_mean_ratio(t)=mean(drowsiness_value(:,t)); drowsiness_std_ratio(t)=std(drowsiness_value(:,t)); wakefulness_mean_ratio(t)=mean(...
8ba0103a49ded6e2656afdbd87e481c2c12f0d6bde7159f703ba364972ce43e4
MATLAB
8,401
125
function batch_mrionly_job(suffix) addpath(genpath('/home/mfromano/spm/spm12/')); BASE_DIR = ['/data2/MRI_PET_DATA/processed_images_final' suffix filesep]; MRI_folder_new = [BASE_DIR 'ADNI_MRI_nii_recenter_NL' suffix filesep]; fnames = dir(MRI_folder_new); fnames = {fnames.name}; maxNumCompThre...
708e65fa3323a30887d061d27681cb944b36a1050348c1c305df6cbdecd1c4e7
MATLAB
8,408
229
function low_rank_matrix_completion() % Given partial observation of a low rank matrix, attempts to complete it. % % function low_rank_matrix_completion() % % This example demonstrates how to use the geometry factory for the % embedded submanifold of fixed-rank matrices, fixedrankembeddedfactory. % This geometry is des...
0560e73550de617f63da67b4bfa8acbde30946f11283114177a3ca57a5fa57a8
MATLAB
8,459
234
% pop_eegfiltnew() - Filter data using Hamming windowed sinc FIR filter % % Usage: % >> [EEG, com, b] = pop_eegfiltnew(EEG); % pop-up window mode % >> [EEG, com, b] = pop_eegfiltnew(EEG, locutoff, hicutoff, filtorder, % revfilt, usefft, plotfreqz, minphase); % % Inputs: % EEG ...
02c847081d8553d169fb6d8a51930c67fc2b4e98c7304537ce89c76644243e7e
MATLAB
8,479
242
%%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [L_eeg, dipole_locations, dipole_directions] = lead_field_eeg_fem(nodes,elements,sigma,electrodes,varargin) % function [L_eeg, source_locations, source_directions] = lead_field_eeg_fem(nodes,...
c97bdffab1f26ada46fa05890f853296d28b856ce316ee608ba3d250643e8dd0
MATLAB
8,480
296
function [Model, state] = estimate_multispike_em(Model,Data,Spike_state) % Estimate multispike state % [Model, state] = estimate_multispike_state(Model,Data,Spike_state) % --- Model parameters (input: fixed parameter) % Model.tau % --- Model parameters (input/output: update parameter) % Model.a % Model.b % ...
5d524756ec2d192e2656c8fb5fc1d8ce5fb307500d69385beb663f636ec28fb1
MATLAB
8,519
189
function zef = zef_strip_tool_init(zef) if not(isfield(zef.strip_tool,'current_strip')) zef.strip_tool.current_strip = 1; end if not(isfield(zef,[zef.current_sensors '_strip_cell'])) zef.([zef.current_sensors '_strip_cell']) = cell(0); zef.([zef.current_sensors '_strip_cell']){1} = struct; zef.([zef.current_sensors '...
154ed95e6eb193759c4aadf4b68b69820cfb3231f2a9a4054c9afb484803c9f7
MATLAB
8,526
247
function M = rotationsfactory(n, k) % Returns a manifold structure to optimize over rotation matrices. % % function M = rotationsfactory(n) % function M = rotationsfactory(n, k) % % Special orthogonal group (the manifold of rotations): deals with matrices % R of size n x n x k (or n x n if k = 1, which is the default)...
906184641b43a6974c2f99577f671fa1ab6523134e874f89aee38b576f1892e9
MATLAB
8,571
248
function M = stiefelfactory(n, p, k, gpuflag) % Returns a manifold structure to optimize over orthonormal matrices. % % function M = stiefelfactory(n, p) % function M = stiefelfactory(n, p, k) % function M = stiefelfactory(n, p, k, gpuflag) % % The Stiefel manifold is the set of orthonormal nxp matrices. If k % is larg...
e80b5628cbe3b6005aab180503dd23bdb3581de0d60147ac6a52091d3535c89e
MATLAB
8,596
144
%-------------------------------------------------------------------------------- % fig1.m % % Copyright (C) 2025 Takuya Isomura % (RIKEN Center for Brain Science) % % 2025-06-18 %-------------------------------------------------------------------------------- % initialization clear Tinit = 20; ...
3d2b27f86983060256cdac38e1939dc8e6df86fc2d420648aaf42b733874a7b8
MATLAB
8,601
213
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [z,reconstruction_information] = zef_ramus_iteration(zef) h = zef_waitbar([0 0 0], [1 1 1],['RAMUS iteration.']); [s_ind_1] = unique(eval('zef.source_interpolation_ind{1}')); n_interp = lengt...
c248e4a8ebbce10479f1ea64d31a9936b515fee21d7b321f7a7dab8e56cb1d7a
MATLAB
8,611
178
%% initialize clear; clc; currentPath = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives pathDeriv = pwd; cd(pathDeriv); cd('spm-preproc'); % For saving preprocessed file from SPM pathPrepFile = pwd; prepSubjFolders = dir('sub*'); cd(pathDeriv); cd('behavior'); pathBehav = pwd; load('be...
96d8045529fc94a0c5988a09b0f6a618f26eaa85ed6b78cf9d63a84c17ac4e32
MATLAB
8,612
166
function [signal,sample_mask] = clean_windows(signal,max_bad_channels,zthresholds,window_len,window_overlap,max_dropout_fraction,min_clean_fraction,truncate_quant,step_sizes,shape_range) % Remove periods with abnormally high-power content from continuous data. % [Signal,Mask] = clean_windows(Signal,MaxBadChannels,Power...
7c6e813507dec61eac14e67e672e1aa79ec19fd77a3506134379e417ab7c9bff
MATLAB
8,635
217
function hmm = mlhmmmar (X,T,hmm0,Gamma,completelags) % Given the state time courses estimation, does a last estimation of each MAR using (local) ML % % INPUT % X observations % T length of series % hmm0 HMM-MAR structure % Gamma p(state given X) - has to be fully defined % comp...
9fa9e765c364e75a40716e23b4d992654267bca109380651b8f965001aef05b2
MATLAB
8,643
292
function zef = zef_GMModel_window(zef) h1 = figure(... 'PaperUnits',get(0,'defaultfigurePaperUnits'),... 'Units','normalized',... 'Position',[0.43 0.52 0.20 0.45],... 'Visible',get(0,'defaultfigureVisible'),... 'Color',get(0,'defaultfigureColor'),... 'IntegerHandle','off',... 'Colormap',[0...
e3450334dc765fe1dd1abe579cd962a7178d1a2ee2d40d2f15932d6d82777354
MATLAB
8,684
143
% NLX2MATNDE Imports data from Neuralynx NDE files to Matlab variables. % % [StartTimeStamps, EndTimeStamps, SamplesLost, DataTypes, ObjectNames, Header] = % Nlx2MatNDE( Filename, FieldSelection, ExtractHeader, % ExtractMode, ModeArray ); % % Version 6.0.0 % % R...
e0f35baa8da2258d64b5eb8e18e7bca214e67c4492b32260a239594ce2cd4807
MATLAB
8,736
152
%% initialize clear; clc; currentPath = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives pathDeriv = pwd; cd(pathDeriv); cd('spm-preproc'); % For saving preprocessed file from SPM pathPrepFile = pwd; subjFolders = dir('sub*'); subjFolderNames = {subjFolders.name}; clear subjFolders %% p...
9b7b27dbf3c1c2a40d9ae89c022782a11c06b319c3848e5498d4a0ffb5ed3331
MATLAB
8,753
248
classdef RAMUSInverter < inverse.CommonInverseParameters & dynamicprops % % RAMUSInverter % % A class which defines the properties needed by the RAMUS inversion method, % and the method itself. % properties %These three objects are either empty numerics or nested cells. %F...
93adfc59329a3b392803b8ce4619557ff493d2f1b6624107b6b0223232262977
MATLAB
8,768
297
%% Copyright © 2025- Joonas Lahtinen function [z_vec, self] = invert(self, f_data, L, procFile, source_direction_mode, source_positions, opts) % % invert % % Builds a reconstruction of source dipoles from a given lead field with % the HALpR method. % % Inputs: % % - self % % An...
fac24e69d76210b5d0353207be8bc8c89aa4bb324585724e6f838cb03583c04f
MATLAB
8,771
216
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_save(zef,file_name,path_name,save_switch) if nargin == 0 zef = evalin('base','zef'); end if nargin == 3 zef.save_switch = 1; elseif nargin == 4 zef.save_switch = save_s...
67ad02bc134d24125fba30715b9eefff1525f40c9a6a7667e5080423f26ae345
MATLAB
8,786
254
function run_simulation_helper0(params) params = get_final_params_struct_rk4(params); param = params(1); HHWUIS_solver_NCexamples_RK4(param); isdeletebin = 1; merge_all_parts_binfile_NC(param, isdeletebin); end function params = get_final_params_struct_rk4(params) % function params = get_final_params_struct(para...
8321843a7b6f81a06177948eeace44fb32d90bfa53ae34de9168311c31e7a71c
MATLAB
8,844
276
function [dat] = sw_load_EEG (opt) % [dat] = detect_load_EEG (opt) %-------------------------------------------------------------------------- % function to load LFP data % add custom load routines as needed % % inputs: 1) structure opt with fields % opt.pat : path to data file in string % ...
f7cca140c966bf16c69285933344b8c792c1343ebfd75dbdbc1a58ab2a0cfe21
MATLAB
8,870
138
% MAT2NLXEV Exports data from Matlab into a Neuralynx NEV file. % % Mat2NlxEV( Filename, AppendToFileFlag, ExportMode, ExportModeVector, % FieldSelectionFlags, TimeStamps, EventIDs, TTLs, Extras, EventStrings, Header); % % Version 6.0.0 % % Requires MATLAB R2012b (8.0) or newer % % % Notes on e...
9d496214b8970d8651fa56359d90f64ee064d9af142ccb5595bcf113eaad1601
MATLAB
8,875
196
function [connection_w0, connection_w0_len, ... connection_long_range_hidden1, connection_long_range_len,num_LRC,num_SRC,... connection_w1, connection_w1_len] = fun_generate_conn_conv_addLRC_SRC_random(input_cell_num,hidden_cell_num,output_cell_num,... ...
acb104339ae64d7fd9f95c447e777608f165187ad0cf2903ff86b73a5f37b09e
MATLAB
8,909
282
classdef KalmanInverter < inverse.CommonInverseParameters % % KalmanInverter, Copyright © 2025- Joonas Lahtinen % % A class which defines the properties needed by the Kalma filter / Standardized Kalman filter inversion method, % and the method itself. % The method is based on the article: %...
7a8b5e54ec9aec223c3dee9308fc0c604ef6d481ca37bf1f93c190be60a8a2d7
MATLAB
8,923
148
function batch_mrionly_job_errors(suffix) addpath(genpath('/usr/local/spm/spm12/')); BASE_DIR = ['/data2/MRI_PET_DATA/processed_images_final' suffix filesep]; MRI_folder = [BASE_DIR 'ADNI_MRI_nii_recenter_NL' suffix filesep]; maxNumCompThreads = 1; spm('defaults', 'PET'); spm_jobman('initcfg');...
fca73c293fcd58f5b5b615192a454628f286f0f302ef12e47087f88717fb796a
MATLAB
8,978
214
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [z,reconstruction_information] = exp_ias_iteration_multires(void) h = zef_waitbar(0,1,['IAS MAP iteration for EP.']); n_multires = evalin('base','zef.exp_multires_n_levels'); sparsity_factor ...
04a8431224c37b48314cd629ad3a41a2edb9cbcff1659df7a4a0277195df7116
MATLAB
8,993
230
function SleepFrag = Fun_ComputeSleepFrag(NumberOfFilesPerSubject,... Scorings, EpochLength, WepochsSkip, SepochsSkip, NepochsSkip,... RepochsSkip) %% Written and updated by M. Nollet (Aug 2023) % % Function to be used to compute sleep fragmentation and consolidation % data % % Requires runlength.m w...
5a0033517dcf758bff813d99ca4f23e2b6f0a031ea992c20a4864781d722ab85
MATLAB
9,001
189
%% initialize clear; clc; currentPath = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives pathDeriv = pwd; cd(pathDeriv); cd('spm-preproc'); % For saving preprocessed file from SPM pathPrepFile = pwd; prepSubjFolders = dir('sub*'); cd(pathDeriv); cd('behavior'); pathBehav = pwd; load('be...
b8bb4dc169251606fee5156b58e58fc417ea7ef61b141b4d97e7b0a05575b3bc
MATLAB
9,009
140
% MAT2NLXCSC Exports data from Matlab into a Neuralynx NCS file. % % Mat2NlxCSC(FileName, AppendToFileFlag, ExportMode, ExportModeVector, % FieldSelectionFlags, Timestamps, ChannelNumbers, % SampleFrequencies, NumberOfValidSamples, Samples, Header); % % Version 6.0.0 % % Requires MATLAB...
2982f62d69cc08e38eef4c9a5bdbbcd7be8a4592541f1c6bcc6209b11e302502
MATLAB
9,030
241
%Copyright © 2018, Sampsa Pursiainen function [L_eit, bg_data, source_locations, source_directions] = lead_field_gravity_grad(nodes,elements,rho,sensors,varargin) % function [L_eeg, source_locations, source_directions] = lead_field_gravity_grad(nodes,elements,rho,sensors,gravity_ind,source_ind,additional_options) % % ...
b3bcb8ac0390e7b66896ab37bd338b635b758bfb01d1cf7f258ad2cdc50a9076
MATLAB
9,110
245
%Asteroid wireframe modeling package for complex microwave analogue object generation. %Copyright © 2019- Sampsa Pursiainen, Liisa-Ida Sorsa, Christelle Eyraud, Jean-Michel Geffrin. %This function generates a wireframe corresponding to a given tetrahedral mesh. %given as argument. %INPUT: tetra (M-by-4), points (K-by-3...
57e6e25a89650085597b51b8ac4f1d1f2a32204bf99ed8ac6440c69015ba5472
MATLAB
9,155
282
close all clear; clc; tic; %% histogram of the distances of the vessels found in the image % read the image im = imread('veins1.tif'); % flip the image horizontally % Convert to a binary image bw = imbinarize(im); % Sum up all the pixel values total_sum = sum(bw(:)); % Display the result disp(total_sum...
0de19fe623164d0d0809de3f544110e41c45c60ce6f91079098666a16c365c5b
MATLAB
9,175
219
function [data_Processed] = AnalyzeNerveDataMseq(data,Num_dummies,MaxISI,TC_stuff,data_date) % this function will estimate system functions for the NOSCOR mseq stim and % MOVN mseq stim with noise floors. This is data from the nerve,so does a % coincidence detection b/t left and right stim %data should be only OSCOR or...
d25d3d2e410aadcca479aeba1350d9ff40bf58530240563b193fe13a0fe5aac3
MATLAB
9,187
143
% MAT2NLXVT Exports data from Matlab into a Neuralynx NVT file. % % Mat2NlxVT( Filename, AppendToFileFlag, ExportMode, ExportModeVector, % FieldSelectionFlags, TimeStamps, ExtractedX, ExtractedY, ExtractedAngle, Targets, % Points, Header); % % Version 6.0.0 % % Requires MATLAB R2012b...