sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
54866269320d15af9870b491e1bc5ad2767dd3155c0722662757d35ac63c26ca
MATLAB
5,115
145
function M = stiefelcomplexfactory(n, p, k) % Returns a manifold struct. to optimize over complex orthonormal matrices. % % function M = stiefelcomplexfactory(n, p) % function M = stiefelcomplexfactory(n, p, k) % % The complex Stiefel manifold is the set of complex orthonormal nxp % matrices. If k is larger than 1, thi...
26001c532f9e5a57998225f48a0fe817c923472ca968d3707998825125992190
MATLAB
5,147
184
function [electrode_data, electrode_labels] = electrodes_from_csv(file, kwargs) % % electrodes_from_csv % % Reads a set of electrodes from a CSV file into a format that can be stored % into the central struct of Zeffiro Interface. The CSV file should contain a % header row with the titles % % x, y, z [, label] [, inn...
75c991240f407cbf177cf12d039211c6cec95b2973eb23ef574daf548a5c72c5
MATLAB
5,152
134
function [vecSpikeCh,vecSpikeT,intTotT] = DP_DetectSpikes(matData, sP, vecChanMap) %DP_DetectSpikes Performs fast GPU-accelerated thresholded-spike detection % [vecSpikeCh,vecSpikeT,intTotT] = DP_DetectSpikes(matData, sP, vecChanMap) % %input: % - matData [Ch x T]: gpuArray [Channel by Timepoint] data matrix % - ...
48e58c0e98926f0f301c4a3b5dc708b3048dff82f0962e3b0dc329b222e3f2c2
MATLAB
5,176
168
function M = unitaryfactory(n, k) % Returns a manifold structure to optimize over unitary matrices. % % function M = unitaryfactory(n) % function M = unitaryfactory(n, k) % % Unitary group: deals with arrays U of size n x n x k (or n x n if k = 1, % which is the default) such that each n x n matrix is unitary, that is...
9789c18fc82f6b69063862a49775c7c1ff0747f877af9a9369265e36c5075ff1
MATLAB
5,185
138
function [SSW] = detect_SSW_Carrier(signals,OPTIONS) % signals.data is a Ntrials x Ntime (IN MICRO VOLTS) % signas.fs is the sampling rate % OPTIONS.Sleep contains the parameters for the SSW detection % output: % SSW ----- .marker{i} ---.nsamp : table [start end] (samples in the data) % .P...
25a7550dc9653f1ee3e34c4618c5aafd6cd3d17dac564403374734784c682234
MATLAB
5,189
120
%% Sample script to set up the parameters object. % You can not only assign values here, but have differential processing % (e.g. to do different things on your desktop or cluster). % Required members are described as they appear below. % %% Linear Sync Toolkit (linsync) % Copyright (C) 2023 Joseph T. Lizier % Distribu...
31b6ff445ea43e69a80affd44470712789bf71545153b9089629c6817194a1c9
MATLAB
5,190
159
%% process HCP data with Brainstorm hcp_dir = '/path/to/megdata/and/results/'; reports_dir = strcat(hcp_dir, 'brainstormReports/'); loadedsubj = load(fullfile(hcp_dir, 'myMEGList.mat')); subjList = split(loadedsubj.myMEG, '_'); subjList = subjList(:,2); channels = load(fullfile(hcp_dir, 'myMEGbadChannels')); badChann...
c563c9f5501a843755b8b3a0e8d2c271eebae62c74b43e0957689d361ed45221
MATLAB
5,191
178
function M = fixedrankMNquotientfactory(m, n, k) % Manifold of m-by-n matrices of rank k with two factor quotient geometry. % % function M = fixedrankMNquotientfactory(m, n, k) % % This follows the quotient geometry described in the following paper: % P.-A. Absil, L. Amodei and G. Meyer, % "Two Newton methods on the ma...
0a5f07203ce982dd009cf7e4e42a380591bfacda6c76182f6a786ec4515a7ce2
MATLAB
5,195
130
% Define preprocessing and brain features parameters % % Cristina Gil, TUM, 10.06.2022 function params = define_params(fname) %% Read json file with all the parameters if isempty(fname) fname = 'params_example.json'; end fid = fopen(fname); raw = fread(fid,inf); str = char(raw'); fclose(fid); params =...
d4f91afbe3e23d8a73dc7f5bb134e977d4f76588ef6094cba3f1a145aee7915b
MATLAB
5,197
141
function zef_ES_plot_error_chart(varargin) switch nargin case {0, 1} if nargin == 0 zef = evalin('base','zef'); warning('ZI: No zef were called as an input argument.') vec = zef_ES_table(zef.y_ES_interval); [sr, sc] = zef_ES_objective_function(zef); el...
2a3002fbbd9e58000de3fec170702d7c33125b044f112cfc5126e9b87e117c59
MATLAB
5,209
126
function events = custardWrapper( timing, fluo_matrix, params_in, detailed ) % params_in contains multiple sets of custard parameters % timing 1 x npoints % fluo nROIs x npoints % params_in, detailed structure with params for multiple runs % detailed, flag for showing details of custard algorithm detailFlag=false; if ...
8cbc00f5aff9193bcd9cf468f8f1acf79fd6a470c947d223ed276d44b72d4d56
MATLAB
5,216
120
%% Script to set up the parameters object for the figure 4a experiment (d=2, c=0.5, various p). % You can not only assign values here, but have differential processing % (e.g. to do different things on your desktop or cluster). % Required members are described as they appear below. % %% Linear Sync Toolkit (linsync) % ...
a58af094e0050117fa8958c3d0c2ef5008b7f0fd2f5071bfd501eba47f51421c
MATLAB
5,253
120
%% Script to set up the parameters object for the figure 4f experiment (d=4, c=1.0, various p). % You can not only assign values here, but have differential processing % (e.g. to do different things on your desktop or cluster). % Required members are described as they appear below. % %% Linear Sync Toolkit (linsync) % ...
5dc1c56ade6cac45088f9b2dd32211e08fd8d0687b9e25de4be10bdfa6ab4510
MATLAB
5,260
109
zef.h_ES_parameter_table.Data = cell(0); if ismember(zef.ES_opt_solver, 1) zef.h_ES_opt_method.Items = zef.ES_opt_method_list([1 3 4]); zef.h_ES_opt_method.ItemsData = [1 3 4]; zef.h_ES_opt_algorithm.Items = zef.ES_opt_algorithm_list([2 3]); zef.h_ES_opt_algorithm.ItemsData = [2 3]; ...
3c255fcf0df515b4460e52d6acc8af898df9d552bf4775e8dbeb28054316ba05
MATLAB
5,264
186
function [p,info] = erp_clusterperm_TANOVA(obj,design,varargin) % Perform cluster permutation TANOVA analysis %% Check inputs % Check multiple conditions appear in the data if length(obj.conditionlabels) == 1 error('The cohort structure must contain multiple conditions'); end % Get pairs of conditions -...
84cea43fe4ea56fad58c81da21cac106c2fd6caa270363a1467c02b831e75d94
MATLAB
5,268
186
function[s,t,E] = sta(data_spk,data_lfp,smp,plt,w,T,D,err) % Spike Triggered Average % Usage: [s,t,E] = sta(data_spk,data_lfp,smp,plt,w,T,D,err) % % Inputs % % Note that all times...
084fa175c62dd690c8715486628296aa7082b3d45e0332143374814c730b3a90
MATLAB
5,280
154
function low_rank_tensor_completion_embedded() % Given partial observation of a low rank tensor (possibly including noise), % attempts to complete it. % % function low_rank_tensor_completion_embedded() % % NOTE: Tensor Toolbox version 2.6 or higher is required for this factory: % see https://www.tensortoolbox.org/ or h...
fc9b681f25dc9cc166facbe52fd6fe330cba272f33429bb1ffe360d3cefde0ac
MATLAB
5,287
146
function hessfun = approxhessianFD(problem, options) % Hessian approx. fnctn handle based on finite differences of the gradient. % % function hessfun = approxhessianFD(problem) % function hessfun = approxhessianFD(problem, options) % % Input: % % A Manopt problem structure (already containing the manifold and enough % ...
9face11ac15b741ae2a18bb9ec296a244b6acfed04fb54a97b9fc59b1415b79c
MATLAB
5,298
120
%% Script to set up the parameters object for the figure 4c experiment (d=8, c=0.5, various p). % You can not only assign values here, but have differential processing % (e.g. to do different things on your desktop or cluster). % Required members are described as they appear below. % %% Linear Sync Toolkit (linsync) % ...
15cc4dfd440c1d222daf5aec5659237598ef63464e95f21aaf76db37adc9c030
MATLAB
5,299
121
%% Script to set up the parameters object for the figure 4a experiment (d=2, c=0.5, various p). % You can not only assign values here, but have differential processing % (e.g. to do different things on your desktop or cluster). % Required members are described as they appear below. % %% Linear Sync Toolkit (linsync) % ...
8ded7fde07ae11e3c8f147ba076564a4880eb409719617f244c657f939efc0de
MATLAB
5,299
121
%% Script to set up the parameters object for the figure 4b experiment (d=4, c=0.5, various p). % You can not only assign values here, but have differential processing % (e.g. to do different things on your desktop or cluster). % Required members are described as they appear below. % %% Linear Sync Toolkit (linsync) % ...
b4c8d54f9ff98b59d12571723ba5178dfcb688174a59ec42e68f0060e39dafa9
MATLAB
5,299
121
%% Script to set up the parameters object for the figure 4e experiment (d=4, c=1.0, various p). % You can not only assign values here, but have differential processing % (e.g. to do different things on your desktop or cluster). % Required members are described as they appear below. % %% Linear Sync Toolkit (linsync) % ...
f18a53b28312b99366ed8530a3d90882007b3267122f1fb0704311a42ab66b01
MATLAB
5,299
121
%% Script to set up the parameters object for the figure 4d experiment (d=4, c=0.1, various p). % You can not only assign values here, but have differential processing % (e.g. to do different things on your desktop or cluster). % Required members are described as they appear below. % %% Linear Sync Toolkit (linsync) % ...
add92506051e13d8e42de25e2e2eb8462bb5bf4e5734ef6c9ed1ba2eb97bd438
MATLAB
5,304
156
function M = multinomialfactory(n, m) % Manifold of n-by-m column-stochastic matrices with positive entries. % % function M = multinomialfactory(n) % function M = multinomialfactory(n, m) % % The returned structure M is a Manopt manifold structure to optimize over % the set of n-by-m matrices with (strictly) positive e...
e222bc4f138e88a914f036907997f263106028e470c21e3f99e16483ca5795dc
MATLAB
5,324
63
function update_ensemble_eval_text(app) %% Documentation Contents % Darik O'Neil 05/11/2022 % Function to update Eval text %% Function Contents %duplicate to be safe, vad for memory tho %bring results into caller memory %set value v = app.StimulusEV.Value; dataset = app.ViewEnsPerfButtonGroup.SelectedObject.Text;...
3154c0c187104130d757d84f189b1097d9692e50179d3d7bd4fba88c387acd8f
MATLAB
5,328
176
function visualize_segmentation(stats, imdb, net, opts) epoch = stats.epoch; plotErrors(opts, epoch, stats, false); drawConfusionMatrix(opts, stats); showImages(imdb, net, opts); % print to disk if(opts.savePlots) print(opts.vis.hnd_loss, sprintf('%s/summary.pdf',opts.expDir), '-dpdf')...
8b502aec30ed5e557d600ac5b48242642ff93fc4e1d440140785efabda14307e
MATLAB
5,329
156
function [tuda,Gamma,encmodel,decmodel] = tudasparsify(X,Y,T,tuda,... Gamma,temp_sparsity,spatial_sparsity,doplot) % Given an estimation of a TUDA model and the corresponding model time % courses Gamma, this function creates sparse estimates of the decoding models. % This is done: % - Temporally: after fitting a Ga...
e59ad4c99db1f2f549926fba44f5419a4009678c4554c875cba06ac64f78ed6d
MATLAB
5,334
108
classdef SolverSGDM_conv5 < nnet.internal.cnn.solver.Solver % ==================================================== % dir = C:\Program Files\MATLAB\R2019b\toolbox\nnet\cnn\+nnet\+internal\+cnn\+solver % ==================================================== % SolverSGDM Stochastic gradien...
f1d36e2c5b4256ffdd6738f383818a986ba88e97fd937e87234c57356a9698fb
MATLAB
5,334
108
classdef SolverSGDM_conv5 < nnet.internal.cnn.solver.Solver % ==================================================== % dir = C:\Program Files\MATLAB\R2019a\toolbox\nnet\cnn\+nnet\+internal\+cnn\+solver % ==================================================== % SolverSGDM Stochastic gradien...
47138d11a26abb63c09e686d0af98061d79cb24c2dd2e0d8bf67bc7b53e98202
MATLAB
5,352
168
function M = stiefelstackedfactory(m, d, k) % Stiefel(k, d)^m, represented as matrices of size m*d-by-k. % % function M = stiefelstackedfactory(m, d, k) % % Points on this manifold are matrices Y of size n x k, with n = m*d. % Y is thought of as m matrices of size d x k each, stacked on top of each % other. Call them Y...
a965e6fbe011370c23d89da9cce713954b57b0f48fb626c3d776ba93db98a9dd
MATLAB
5,355
172
clear Data_path = '/media/ravinderjit/Data_Drive/Data/BehaviorData/IACbehavior/'; Fig_path = '/media/ravinderjit/Data_Drive/Data/Figures/DynBin/'; sqtone = load([Data_path 'IACsquareTone_Processed.mat']); oscor = load([Data_path 'OSCORfmThresh_processed.mat']); oscor_white = load([Data_path 'OSCORwhite_processed.mat'...
6868bf6feebb4293db6e244794742545a949d3d21c47af3c6fa3881ae7761e63
MATLAB
5,357
142
%This is the startup function for KF app. %Beamformer, inverse_tools, zef_KF_start function zef = zef_kf_open_window(zef) if nargin == 0 zef = evalin('base','zef'); end zef.KF = zef_kf_app; zef.KF.filter_type.Items = {'No standardization' 'EnKF' 'Spatiotemporal standardization' 'Spatial standardization' 'Doub...
c20a9f53a004e3a10c9c2bbb549ccdc979c6a3bfd871f2aa40ca8d0e87d97664
MATLAB
5,366
121
%% Script to set up the parameters object for the figure 1 experiment (d=4, c=0.5, various p, L). % You can not only assign values here, but have differential processing % (e.g. to do different things on your desktop or cluster). % Required members are described as they appear below. % %% Linear Sync Toolkit (linsync) ...
8a54c0029b25dee9913911c7579ce88a06bc9b70cee0732904f444e1ec8aca02
MATLAB
5,374
130
function data = load_preprocessed_data(params,bidsID) if exist(fullfile(params.PreprocessedDataPath,bidsID,'eeg',[bidsID '_eeg.mat']),'file') load(fullfile(params.PreprocessedDataPath,bidsID,'eeg',[bidsID '_eeg.mat']),'data'); else % Load data ses =''; if contains(bidsID,'_') bidsparts = strspl...
5829b6e6b2aef9d15113eedd98e604ec9c627812daebda3e59edc0b6aad9992a
MATLAB
5,382
235
function [rmse_l, rmse_c, rmse_m, rmse_i, t] = func_train_val(n, train_t, reset_t, noise_level, bias) dt=0.01; input_infor={'xy', 'qdt'}; dim_in=length(input_infor) * 4; dim_out=2; m1=1;m2=1; l1=0.5;l2=0.5; lc1=0.25;lc2=0.25; I1=0.03;I2=0.03; properties=[m1, m2, l1, l2, lc1, lc2, I1, I2]; val_t=500; % prepare for t...
f693dd6a79e65bed03247d1a24198351fcb7f71f33319765eff6442d05be27b2
MATLAB
5,384
177
%% Copyright © 2025- Joonas Lahtinen function [z_vec, self] = invert(self, f, L, procFile, source_direction_mode, source_positions, opts) % % invert % % Builds a reconstruction of source dipoles from a given lead field with % the Kalman filtering method. % % Inputs: % % - self %...
59c41a244f351c5b220f8a9304b2a72b49a00044ba6ec0909cc75732d310ccde
MATLAB
5,387
168
function [h_cone_field, h_streamline, h_colorbar] = zef_plot_cone_field(zef, h_axes, varargin) if eval('zef.cone_draw') || eval('zef.streamline_draw') rec_ind = 1; position_case = 1; if not(isempty(varargin)) rec_ind = varargin{1}; if length(varargin) > 1 position_case = vararg...
63ccbbec99cc2a798529dc1726fcb30ddc04ef66543091cb21a6b4b435127a02
MATLAB
5,390
146
function [zef] = zef_KF(zef, q_value) % Optimal q_value as parameter %% Initial parameters snr_val = zef.inv_snr; pm_val = zef.inv_prior_over_measurement_db; amplitude_db = zef.inv_amplitude_db; pm_val = pm_val - amplitude_db; std_lhood = 10^(-snr_val/20); sampling_freq = zef.inv_sampling_frequency; high_pass = zef.inv...
0403f59a5da3b4046e30ac7295eee664e200f8d30a67d744c3d6541104d70230
MATLAB
5,395
216
function zeffiro_setup ( kwargs ) % % zeffiro_setup ( kwargs ) % % Downloads dependencies specified in the .gitmodules file into the external/ % folder and calls their installation scripts. % % Inputs: % % - kwargs.submodules = string([]) % % This column vector of submodule names specifies, which submodules listed in...
02b8fb7f8de8089fca3184fb9ece9d40d64a2ce92ac04750ae899dc6f9589158
MATLAB
5,424
216
function [Model] = estimate_shape(data, parm) % training shape parameter using training data % % data.y = observed spike data with noise % data.t = sample time [sec] % data.fs = sampling rate for observed data [Hz] % % parm.fs =sampling rate for observed data [Hz] % parm.fs_est =estimation freq [Hz]...
1d1111fea68cbba9ca1aeb692079a63487b6b524db850a702c5b4c85aef27634
MATLAB
5,426
121
%-------------------------------------------------------------------------------- % This demo is included in % Reverse engineering neural networks to characterise their cost functions % Takuya Isomura, Karl Friston % % Copyright (C) 2020 Takuya Isomura % (RIKEN Center for Brain Science) % % 2020-05-08 %---------------...
138133fec1794886fc953061f25175730b76646cf0b74c0668163b66a0ecf4ea
MATLAB
5,435
144
function nodes = zef_inflate_surfaces(zef, nodes, tetra, domain_labels) if isempty(zef) zef = evalin('base','zef'); end waitbar_opened = 0; if evalin('caller','exist(''h'')') if evalin('caller','isvalid(h)') h = evalin('caller','h'); else h = zef_waitbar([0 0], [1 1],'Inflating.'); ...
e60d69b0ccf94b650447d21aa01207adf03abda53a16c5b64284bcc36da7926b
MATLAB
5,448
121
%% Script to set up the parameters object for the figure 1 experiment (d=4, c=0.5, various p, L). % You can not only assign values here, but have differential processing % (e.g. to do different things on your desktop or cluster). % Required members are described as they appear below. % %% Linear Sync Toolkit (linsync) ...
dcabf1ed00a6f007811906937a9a729d97788f423301fee92d3e3dc21291c699
MATLAB
5,454
145
function [matW, dblMSE, intRankT, sSuppOut, intOutputFlag] = doRRR_CV(matX, matY, intRankT, intFoldK, dblLambda, matB, matCov) %doRRR_CV Performed CV reduced rank multivariate regression. % [matW, dblMSE, intRankT, sSuppOut] = doRRR_CV(matX, matY, intRankT=min(R,S), intFoldK=10, dblLambda=0, [matB], [matCov]) % ...
417c6625c0333d88bd2c19c2042a4c7fce62ab6876eae2cd2a93889aa1500d4e
MATLAB
5,465
166
function ETP_AutoSettings(hObject,eventdata) %get globals global sETP; global sFigETP; global ETP_Fit; %% check bounds intTempAvg = str2double(sFigETP.sHandles.TempAvg.String); if ~isnumeric(intTempAvg) || intTempAvg < 1 sFigETP.sHandles.TempAvg.String = '1'; elseif intTempAvg > sETP.intS sFigETP.sHandl...
f7cff0b7e0778a7089ae34071bf6f619fa19176007a00230d6dc67a2a2034e6f
MATLAB
5,486
119
clear all Fig_path = '/media/ravinderjit/Data_Drive/Data/Figures/DynBin/'; Subjects = [{'S001'},{'S132'},{'S205'},{'S206'},{'S207'},{'S208'},{'S203'},{'S204'},{'S211'}]; Data_path = '/media/ravinderjit/Data_Drive/Data/BehaviorData/IACbehavior/'; responseTracks = {}; for i =1:numel(Subjects) ThisData = load([...
936d583aa7801e602203beb11e723a1949d171aaa7b69ef487da8e42d7edc848
MATLAB
5,505
152
function [cellHandles,sOut] = doPEP2(vecTrace1,vecTrace2,vecOn,sEvents) %doPEP2 Performs Peri-Event Plot of 2 supplied traces %syntax: [cellHandles,sOut] = doPEP2(vecTrace1,vecTrace2,vecOn,sEvents) % input: % - sEvents, structure containing the following fields: % - handleFig; handle to figure % - vecOn; vector...
a916350cfa1a587914033c68701d53385e1c146aeb01a79407b640763883f185
MATLAB
5,515
153
function [h_contour,h_text] = zef_plot_contour(zef,rel_val,surf_func,triangles,nodes,varargin) if not(eval('zef.show_contour_text')) h_text = []; end n_iter = eval('zef.contour_n_smoothing'); line_width = eval('zef.contour_line_width'); c_lim = zef.h_axes1.CLim; if not(isempty(varargin)) if not(isempty(vararg...
7f1fb142f28c79f37aa1fd9d6d045d4091d573f3a0866c146457bd027cc139c8
MATLAB
5,517
117
function update_params(app) % access parameters and instance a new copy since matlab does'nt do memory % references???? params = app.params; % always validate params.ignore_dataset_ = true; params = parameterize(params); params.ignore_dataset_ = false; app.params = params; % GENERAL app.ShuffleDataEditField.Value =...
e2cd2a778316061b5a260296ac37b7c6a3ee594fe099c2d36bbf89376871226c
MATLAB
5,520
163
function [opt,delta,stats,fh] = sw_run_delta_LFP(varargin) % [rip] = run_ripple_LFP(dat, opt) % top level function to perform ripple detection % inputs: % 1) dat - data input which can be either % a) string dat='C:/lfpdata/rec001.ncs' or % b) data structure with the following...
9644afab339c526ad94f9ddc546b0676af1fb4a4df0b3552b42197870fb024ed
MATLAB
5,526
91
% clean_rawdata(): a wrapper for EEGLAB to call Christian's clean_artifacts. % % Usage: % >> EEG = clean_rawdata(EEG, arg_flatline, arg_highpass, arg_channel, arg_noisy, arg_burst, arg_window) % % ------------------ below is from clean_artifacts ----------------------- % % This function removes flatline channels, lo...
1446162f881ba8598132c0a6640d3263ecaaa8d5f82ca3f97aef2fba86c55599
MATLAB
5,540
162
function [GMModel,GMModelDipoles] = zef_GMMcluster h = zef_waitbar(0,1,['Gaussian mixature model.']); %Options options = statset('MaxIter',evalin('base','zef.GMMcluster_MaxIter')); if evalin('base','zef.GMMcluster_covtype')==1 Sigma = 'full'; else Sigma = 'diagonal'; end if evalin('base','zef.GMMcluster_covid...
496a061490646b518d5f187eaefc62eeccb567ddabd9c8329aa6b7c7e672a5cf
MATLAB
5,541
157
function [C, Q] = procCosp(DATA, WINDOW_TYPE, WINDOW_SIZE, OVERLAP, FREQUENCY_RANGE, PHASE_CORRECTION) % [C, Q] = procCosp(DATA, WINDOW_TYPE, WINDOW_SIZE, OVERLAP, FREQUENCY_RANGE) % % This function computes cospectra and quadrature spectra on multivariate % data using Welch's method. For a better estimation, each...
c5f9d6a0d5efbf724b91cc944bd4c96676f5680c8d25c53d458101c9d5280ca4
MATLAB
5,554
130
clear clc scale_factor = 16;%ͼÏñÔÚ¼ÆËãµÄʱºòµÄËõ·Å´óС8 12 32(´óͼ) 2»ò3£¨Ð¡Í¼µ½´óͼ£© 5.12 ´óͼ12 8²»ÐÐ 16 stack_img_dir = 'E:\Zhu\myownex\ETreg\img\TOM\stack\result\'; ava_img_dir = 'E:\Zhu\myownex\ETreg\img\TOM\stack\ava\'; file_name = dir(stack_img_dir); num_stack = length(file_name) - 2; %% ÇóstackµÄ¾ù...
29c52ae466217e38843d4bcea4f7832c54c445aa778177a428780ea500251270
MATLAB
5,556
125
function Fun_ExportTimeSpentTC(Path, Subject, ScoringPerFileTC,... ScoringMappingForVS, SleepFragTC, NumOfTimePoints, TimeBin,... EpochLength, NumberOfFilesPerSubject, FileNamesForSubjects) %% Written and updated by M. Nollet (Aug 2023) % % Function to be used to export sleep architecture and sleep fragme...
6e51928e432f06bc37841b965e80346ec448c3d19cabdbb767067f69ebd532ad
MATLAB
5,556
195
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [nodes, nodes_b, tetra, johtavuus_ind, surface_triangles,name_tags] = zef_fem_mesh(void) void = []; h = zef_waitbar(0,1,'Initial mesh.'); mesh_res = evalin('base','zef.mesh_resolution'); re...
0a1df762e1459c4fa424c3edef0d11c8d85f6ae6c4bc4f7d3de01c66f2043630
MATLAB
5,563
139
function [Y_pred, loglikelihoodX] = LDApredict(model,Gamma,X,classification,intercept) % For an inferred LDA model and state timecourses, computes the % likelihood manifold in X space and computes the likelihood function for % each class of labels. if nargin<4 classification=true; end if nargin<5 intercept=true...
b8b80e10c61f4350b1076d54c62abd7ed5b7f5827b6b8e1264f2e5d930f720b1
MATLAB
5,565
176
% This is a template script that runs the HMM on a fictional fMRI data set % using a number of different settings, involving how many PCA components we use to % describe the data, and how many HMM states we set up for the HMM inference. % It assumes that there are 2 different % conditions (for example rest and some t...
8c9c98839f9afa72f74dd9619e64b31e018c21f0f1b45963c410b22a5918315b
MATLAB
5,584
152
function [opt, rip, stats, fh] = sw_run_ripple_LFP(varargin) % [rip] = sw_ripple_LFP(dat, opt) % top level function to perform ripple detection % inputs: % dat - data input which can be either % a) string with path/file.dat or % b) a data structure with the following fields: ...
3da8ea9fdd5005bc3403017fee0644eedba47800d12bbdadcf887e5f6d3ce8b0
MATLAB
5,585
150
function h = image3(im,ij2xyz,handle) % Display a 2-D image in Matlab xyz 3-D space % h = image3(C, IJ2XYZ, handle) % % C is an image, encoded with scalars or rgb-values, i.e. the dimensions of % C are either N x M or N x M x 3. Scalars correspond to indices in the % current colormap and rgb-values should be within the...
211a5b12c598ae1f9a36e296affeb1050fd8fd6d03791d73b6bff7b8dc08938a
MATLAB
5,594
119
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef_plot_hyperprior axes(evalin('base','zef.h_axes1')); cla(evalin('base','zef.h_axes1')); tail_length = evalin('base','zef.inv_hyperprior_tail_length_db'); snr_val = evalin('base','zef.inv_...
c3f713ba7b4106cb15f4c5ba0a285f56105438fa83b77166f87448e4d4bc6847
MATLAB
5,607
152
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D parameters; nodes = load([torre_dir '/system_data/nodes_' int2str(system_setting_index) '.dat']); tetrahedra = load([torre_dir '/system_data/tetrahedra_' int2str(system_setting_index) '.dat']); ...
dd0fce2b5fdb8fbc4e7d8f64f0fa846d3feeae95fd33198a9585b48284faf565
MATLAB
5,620
253
function plotting_simulations addpath('./scripts'); outdirpath = './output_dir'; %% plotting AI regime_type = 'AI'; plotting_helper0(regime_type, outdirpath); %% plotting BS regime_type = 'BS'; plotting_helper0(regime_type, outdirpath); %% plotting SZ regime_type = 'SZ'; plotting_helper0(regime_type, outdirpath); ...
8d5475b7fce3a2af5cc994df2e8a26f61f8f297ec5411cc29a0a9f708e7682b3
MATLAB
5,626
182
% sobi() - Second Order Blind Identification (SOBI) by joint diagonalization of % correlation matrices. THIS CODE ASSUMES TEMPORALLY CORRELATED SIGNALS, % and uses correlations across times in performing the signal separation. % Thus, estimated time delayed covariance matrices must be no...
ff553bbf912542f994453cdf5b1d38bf5a8bc8e45f510e1840ea4b17d4a6ea23
MATLAB
5,631
152
function [contacts, sensor_info, triangle_ind] = zef_get_strip_contacts(contact_index,strip_struct,zef,domain_type,global_index) if nargin < 4 domain_type = 'model_geometry'; end if nargin < 5 global_index = []; end contacts = []; sensor_info = struct; triangle_ind = []; sensor_info.strip_id = strip_struct.s...
2592e5506eaa5f1e909e82c95e6902dba48c8c3f708398bfbe97d62cd539da50
MATLAB
5,679
172
function [C,hmm] = hmmtestretest(data,T,options) % % Test the reliability of the solutions across repetitions of the HMM % inference. Runs are aligned using the Hungarian algorithm and compared % for each subject/segment (each element of T). The compared metric is the % amount of agreement between the state time course...
98585b5ae68e402f37c14356c414cd0a253c9f711d5c03cdb6d7fe8000474af7
MATLAB
5,708
114
classdef SolverSGDM_conv3_LRC < nnet.internal.cnn.solver.Solver % ==================================================== % dir = C:\Program Files\MATLAB\R2019b\toolbox\nnet\cnn\+nnet\+internal\+cnn\+solver % ==================================================== % SolverSGDM Stochastic gra...
dc0381f4f0c164f9017bfe1f4c687772ded21b7bad47618fb4f357eea0c38d15
MATLAB
5,708
114
classdef SolverSGDM_conv3_LRC < nnet.internal.cnn.solver.Solver % ==================================================== % dir = C:\Program Files\MATLAB\R2019a\toolbox\nnet\cnn\+nnet\+internal\+cnn\+solver % ==================================================== % SolverSGDM Stochastic gra...
d253e6aa723845308b7720632a2e762b9dfddf30fbe3b9ad97fda78599bd6e4d
MATLAB
5,718
172
function [CIN]=dat2mat(file); % % loads events from a jAER .dat/.aedat file. % allAddr are int16 raw addresses. % allTs are int32 timestamps (1 us tick). % noarg invocations open file browser dialog (in the case of no input argument) % directly create vars allAddr, allTs in % base workspace (in the case of no output ar...
1a1d505617008a1b1db4727dcceb4cf085470b1143308895ca6edb36097046aa
MATLAB
5,737
234
function [G, interpolation_positions] = zef_st_venant_interpolation( ... p_nodes, ... p_tetrahedra, ... p_brain_inds, ... p_intended_source_inds, ... p_nearest_neighbour_inds, ... p_regparam ... ) % Documentation % % Produces an interpolation matrix G in a tetrahedral finite element mesh % ...
aac2055ae420dbb8580ec636e91168f1fdfb62b889804af13fc90d868c8a90f2
MATLAB
5,748
128
function detection = ferrarelli_spindle_detection(C3,fs,stage_file) % FERRARELLI Detect sleep spindles using the Ferrarelli algorithm. % Ferrarelli et al. "Reduced Sleep Spindle Activity in Schizophrenia % Patients", Am J Psychiatry 164, 2007, pp 483-492 % % Input is recorded EEG for a whole night of sleep (any channel...
f5a9ea8526c73f68264b3931f427ebb7ecd68af1404b7f4f61077680b4151277
MATLAB
5,749
143
%% 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...
6f80c2b6eab5f19ac719f2d87470fd2d2f772770f0708658cdf06dc6057bb627
MATLAB
5,759
197
%% plot both size distributions in one graph figureHandle=figure; set(gcf,'units','centimeters','position',[4,4,8,12.2]) load('kesten_workspace.mat') %% Intrinsic dists in_inds=[3,4,5]; all_lims=[-3,0.3 ; 0, 0.01 ; 0 ,1]; positions_X=([0.25, 2.25, 4.25, 6.25]); positions_Y=([10.25, 8.25, 6.25, 4.2...
5faf29382f87d87758d394e3a05c3dc457b31d098fbd15dc7e25cd35799e9d00
MATLAB
5,803
201
function [ electrode_data, electrode_labels ] = electrodes_from_dat(file, kwargs) % % electrodes_from_dat % % Imports a set of electrodes and their (optional) labels from a given text % file. Throws an error if the given file could not be read. % % Inputs: % % - file (1,1) string { mustBeFile } % % The text file that...
6339b1164e59beeacc391aa90433b1c4f974249be06846d61c05e6898e239cb4
MATLAB
5,807
179
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [z,reconstruction_information] = zef_mcmc(zef) inverse_gamma_ind = [1:4]; gamma_ind = [5:10]; h = zef_waitbar(0,1,['MCMC sampling.']); [s_ind_1] = unique(eval('zef.source_interpolation_ind{1}...
fd7b509e676a2129d736cf001ffd227f691152e7771b8005fcdea58ffaeed976
MATLAB
5,810
231
function projection_points_in_DSP = DPalgo_optimal_trajectory_withnan(DS_plane_feat, baby_data_feat_withnan, radius) % To find the optimal projection of the data points onto the model % [K^+]_{Buffer}-[O_2]_{Buffer} plane. % % Previous to this step, we perform feature normalization (for both DS_plane % and baby_data) b...
a9155ac6388fe6c6acb177b85f0f1af00b5e33a97a7e6baea01a35ab0848fe10
MATLAB
5,836
157
function [stepsize, newx, newkey, lsstats] = ... linesearch_adaptive(problem, x, d, f0, df0, options, storedb, key) % Adaptive line search algorithm (step size selection) for descent methods. % % function [stepsize, newx, newkey, lsstats] = % linesearch_adaptive(problem, x, d, f0, df0, options, storedb, key) ...
67b8e7cc1a911b26e2e8e8bca142ccdc5bc204f87957b7cb973ef4dd801dd7e1
MATLAB
5,842
112
function [forward_pressure, backward_pressure, forward_velocity, backward_velocity, intensities] = zef_nse_separate_waves_roi(zef, nse_field) roi_ind = zef_nse_roi_ind(zef,nse_field); dir_aux = zef_nse_vel_dir(zef,nse_field); % [~, dir_aux] = zef_nse_mean_velocity_roi(zef,nse_field); n_time = length(zef.nse_field.bp_...
f8f3e782b065aa5cb2f2f05a0b4dabee07d02d343238c9203acb8073a313594d
MATLAB
5,855
174
%% Fieldtrip preprocessing of data % 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 resting-state data ...
f336912283db3ee3d961815a42ba10d34ea97fdcfe945c5bb036e29aa47befcc
MATLAB
5,858
194
function [C,A,e,Av] = corrStaticFC (data,T,options,use_pca) % When running the HMM on fMRI data (with order=0, i.e. a Gaussian % distribution with mean and covariance), % it can happen that states are assigned to entire subjects % with not much switching between states. This happens typically when the % static functio...
b22f68b4528c7dd8f27affa0c9dab6b54e2517f05e29a909493e2578109d4c71
MATLAB
5,888
123
function [coupling] = structure_function_coupling(subject) % The purpose of this script is to compute the structure-function coupling % based on the correlational approach, on each HCP subject's brain region. % % Requirements: % 1. Download the gifti and cifti-matlab toolboxes. Instructions can be found in: % https://...
3556bf4e1aa7d3e5da6c82aa9ccf3285415197e0a090adb45663cc6f5a5bf40b
MATLAB
5,894
178
function sClustered = getPreProClustering(sFile,sRP) %% get paths & files strTempDirSSD = sRP.strTempPath; strPathToConfigFile = sRP.strConfigFilePath; strConfigFileName = sRP.strConfigFileName; strDataDir = sFile.sEphysAp.folder; strDataFile = sFile.sEphysAp.name; strNiqdName = sFile.sMeta.strNidqName; ...
91a2bde6b9fd7b6b919b1eaaf58ba1f8bc1b2d8e0ece588b23dceac20630211d
MATLAB
5,908
118
%This is the startup script for beamformer app. One must add this as launch %script to zeffiro_plugins file: %Beamformer, inverse_tools, zef_beamformer_start function zef = zef_beamformer_window(zef) zef.beamformer = zef_beamformer_app; %_ Names of methods that are included in app _ zef_bf_names = {'Linearly constrai...
74b611be471464c90f96a19fa893241153c8a9033b71eed2287b01c777dcab63
MATLAB
5,916
120
function zef = zef_electrode_strip_multiple_probe(zef) clear strip_struct orientation(1,:) = 1/norm(zef.strip_struct.dir_vec(1,:))*zef.strip_struct.dir_vec(1,:); orientation(2,:) = 1/norm(zef.strip_struct.dir_vec(2,:))*zef.strip_struct.dir_vec(2,:); position(1,:) = zef.strip_struct.center_point(1,:) - 4*zef.strip_stru...
f586262e9edef620fd13bf16f345241f809be1d9fb95e6e4a2b4cc18cd1e2660
MATLAB
5,924
74
function [W Ms crit]=uwedge_c(M,W_est0); % % Uniformly Weighted Exhaustive Diagonalization using Gauss itEration (U-WEDGE) % for complex-valued matrices (not necessarily symmetric). ...
65453980ab1ed89f103bee4f044698e3a6f0a26a721c1b5d8e364fd13b0e5e2e
MATLAB
5,932
127
function [empiricalCovarianceProjected] = empiricalCovariancesProjected(C, discreteTime, S, dt) % % Returns an empirical measurement of the covariance in the space orthogonal to the zero mode psi_0=[1 1 1 ... 1] % for either continuous time Ornstein-Uhelnbeck or discrete time AR % dynamics as required. % % There was...
5fb5cec0c06a332e55a72b43eb709e495fbb08a6936b0f930aeffa2f18769e38
MATLAB
5,937
245
function Mn = powermanifold(M, n) % Returns a structure describing a power manifold M^n = M x M x ... x M. % % function Mn = powermanifold(M, n) % % Input: a manifold structure M and an integer n >= 1. % % Output: a manifold structure Mn representing M x ... x M (n copies of M) % with the metric of M extended element-...
18c8f78c902e6308b41562715ded1933a4a487506776ac47bbe2c2285aea0c0e
MATLAB
5,942
183
function [fe,ll] = hmmfe(data,T,hmm,Gamma,Xi,preproc,grouping) % Computes the Free Energy of an HMM % % 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 % hmm ...
1a99edc1a8db1ddd937fd6ecd354b5407feeb5668dfa6e26af2756aeb6fdaef8
MATLAB
5,942
137
function sLocCh = getBrainAreasPerChannel(varIn,tv,av,st,boolCalcDistToBound) %getBrainAreasPerChannel Retrieves brain area for each channel using Allen Brain Atlas % sLocCh = getBrainAreasPerChannel(varIn,tv,av,st,boolCalcDistToBound) % %Input can be sAP structure, sFile structure, sProbeCoords structure or a pr...
3654761a7e5c47d3e10e4916c9716f556fbd6b4eb9ef217eb98f56a702a26e69
MATLAB
5,943
148
% Code used in Vidaurre et al. (2018) Cerebral Cortex % % Detailed documentation and further examples can be found in: % https://github.com/OHBA-analysis/HMM-MAR % This pipeline must be adapted to your particular configuration of files. %%%%%%%%%%%%%%%%%%%%%%%%% %% Setup DO_PLOT = 1; mydir = '/home/diegov/MATLAB/'; ad...
a11d293947ecfe2da9fcdc646e6539df80ba689d1b14b5365bd186e4ab9ffc6a
MATLAB
5,944
159
%-------------------------------------------------------------------------------- % This demo is included in % Reverse engineering neural networks to characterise their cost functions % Takuya Isomura, Karl Friston % % Copyright (C) 2020 Takuya Isomura % (RIKEN Center for Brain Science) % % 2020-05-08 %---------------...
46a7bb85dcf709ad8ce755d2976061a51895eb52669097c83b0ab545471d0ca3
MATLAB
5,967
119
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if zef.mlapp == 1 zef.preconditioner = get(zef.h_as_opt_1,'Value'); zef.preconditioner_tolerance = str2num(get(zef.h_as_opt_2,'Value')); zef.smoothing_steps_surf = str2num(get(zef.h_as_opt_...
3dccfe8b9233d933c1a2dffbff6b9f1ea66dd731f878e8bd0cd39f19e2f7f7a2
MATLAB
5,968
139
%% Result 2 : Long-Range Connections Integrate Global Features (Figure 3) %% Generate dataset if ~exist('IMAGE_mod') tic disp('generating modified MNIST ...(~ 30 sec)') [IMAGE_mod,LABEL_mod] = fun_generate_mMNIST(numTrain_mod); toc end %% Show dataset disp('Showing stimulus (Classs X Exampl...
1360d27766658aeacc150bfed2f97ad1a3aee248f6e1ad8167043d99f0fb7aea
MATLAB
5,978
197
function [s_roi, roi_specs] = zef_ROI_finder(source_positions, roi_specs) %beware: this function only moves s_p to the nearest source point if %the roi is completely empty, therefore if the roi is not empty, there is %not necessarily a source at the exact center s_p = roi_specs.roi_center; radius = roi_specs.rad...
accefadf16609cd47b19303894d6167339e504ce8af34f59247986cee15bd646
MATLAB
5,979
185
function [Gamma,vpath,error,Ypred] = tudadecode(X,Y,T,tuda,new_experiment,parallel_trials) % Having estimated the TUDA model (i.e. the corresponding decoding models) % in the same or a different data set, this function finds the model time % courses (with no re-estimation of the decoding parameters) % % INPUT % X: Bra...
741f1eb22f1214d90381006f1d51133391a69e9975827578c12f09b3e1bace16
MATLAB
6,009
154
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [z,reconstruction_information] = exp_ias_iteration(void) h = zef_waitbar(0,1,['IAS MAP iteration.']); hyper_type = evalin('base','zef.exp_ias_hyper_type'); n_ias_map_iter = evalin('base','zef...
c9ea343bcab9843d6a7c5392c860ed76d469c53744efd99ed6bc2a328f049ec3
MATLAB
6,014
147
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if zef.save_switch == 1 if not(isequal(zef.file,0)); zef.save_file = zef.file; zef.save_file_path = zef.file_path; zef_close_tools; zef_close_figs; zef_data ...
a9ee345e65c7f6209ddb0dd048cfded2fc351c25cf003fba3a1d22e021cf60f4
MATLAB
6,022
184
classdef BeamformerInverter < inverse.CommonInverseParameters & handle % % BeamformerInverter % % A class which defines the properties needed for different types of % beamforming, and the method itself. % properties % %The inverse algorithm used. The options are currently:...
45a1e4708f4debe6c7023cbd5f57679587685c74d15dec35aafb235c1e5b93a5
MATLAB
6,035
228
%% Copyright © 2025- Joonas Lahtinen function [z_vec, self] = invert(self, f, L, procFile, source_direction_mode, source_positions, opts) % % invert % % Builds a reconstruction of source dipoles from a given lead field with % the CSM method. % % Inputs: % % - self % % An ...
47e885bc8cfdc6244b2db70f6a9277e4c8a4102db6bf39a6a64a4c10c4223933
MATLAB
6,043
146
%This function plot intensity as curves or histograms depending on is the %ground truth setted or not. function zef_plot_source_intensity %Get needed variables if str2num(evalin('base','zef.find_synth_source.h_plot_switch.Value')) == 1 name_label = evalin('base','zef.find_synth_source.h_source_list.Data(zef.find_s...