sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9f9e2cd6e2f63c78a4073c84f4be2e7061c2fe8a98179147ed9363bf10fca503
MATLAB
2,815
84
% master % open dataset % run openETS, extracts image stack into memory % get two files, baseline and treatment disp("reading ETS and VSI...") % rbase and rtreat raw data files, nbase ntreat meaningful names [ baseRaw, basetiming, baseName, baseETS ] = openETSui(); % puts image stack into 'stack' [ treatRaw, treattimin...
5c4cfc6c2db18a8ecee1cccd4fb42a43fe9d3d3afec6f0ea901de31010fa434f
MATLAB
2,817
94
function ET_stopRecording() %ET_stopRecording Function to run at recording stop %get globals global sET; global sEyeFig; %close video writer if isfield(sET,'objVidWriter'),close(sET.objVidWriter);end if isfield(sET,'objVidWriterROI') close(sET.objVidWriterROI); try,fclose(sET.ptrFileLuminance);catch,end ...
7d2da32afac0b9be68172aa47ca82a16ffdc87d0ea071f568c95aabb53856400
MATLAB
2,818
76
function [objopt,kopt,kvec,maps,gev] = cluster_globalkoptimum(obj,varargin) % Calculate optimum microstate maps at the group level. options = microstate.functions.make_options(varargin) ; % default options defaults = {'clustermethod','kmeans'; % kmeans, aahc, pca, ica, hmm 'kmeans...
48e5a990b3b9fd0b70d8feadb2ff0c3e084dcd6dfe47ba49a9b428aa65045760
MATLAB
2,826
56
function plot_all_udf_one_ens_pr(app) udf = app.StimulusEV.Value; dataset = app.ViewEnsPerfButtonGroup.SelectedObject.Text; newcolors = app.newcolors; num_udf = app.params.num_udf; all_udf = [1:app.params.num_udf]; all_udf = setdiff(all_udf, udf); legend_string = cell(1+num_udf,1); legend_string{1} = app.params.udf_...
8146441ea66fa7c0aa1f158b7ba1f5d985700daa9238718e801bc7250ee68e86
MATLAB
2,834
90
function [actstates,hmm,Gamma,Xi] = getactivestates(hmm,Gamma,Xi) %ndim = size(X,2); K = hmm.K; orders = formorders(hmm.train.order,hmm.train.orderoffset,hmm.train.timelag,hmm.train.exptimelag); if isfield(hmm.state(1),'Omega') ndim = size(hmm.state(1).Omega.Gam_rate,2); else ndim = size(hmm.state(1).W.Mu_W,2)...
a6a7122b7e71ca6bc618ea212f2d836f2d3e44083579d168e83537d2a7cfad35
MATLAB
2,849
88
function [G1, G2, G3] = zef_tetra_gradient_field(nodes, tetrahedra, volume, tensor, eval_point_inds, K, N) % Calculates a gradient field [G1,G2,G3] for a given set of nodes, tetrahedra, % volume, volume current tensor, gradient field evaluation points and matrix % size K and N. G1 = spalloc(K,N,0); G2 = spalloc(K,N,0...
cd9b2a9cbffb393ddfb13d9585fadc059556dd9bb41ad6aaf7a8a1e924fb5d9a
MATLAB
2,855
90
function sUniqueCombos = getUniqueFieldCombos(sData,cellFields) %getUniqueFieldCombos Retrieve unique value-combinations from data structure % Syntax: sUniqueCombos = getUniqueFieldCombos(sData,cellFields) % % Outputs four fields in structOut: % vecUniqueIdx vector containing unique indices corresponding to mat...
2d8846c0895fa7e6207683d454eb58e193d63e36fd49a3e4579fab6a9d47b204
MATLAB
2,856
82
function points = zef_strip_coordinate_transform(strip_struct,transform_type,points) if nargin > 2 points = mat2cell(points,1); strip_struct.points{1} = points{1}; else points = strip_struct.points; end if isequal(transform_type,'reverse') points{1} = points{1} - strip_struct.tip...
b4b682e3261e3dede8702dc706a5d09f74a48eb8085e2fa51d7f0ee2150309ec
MATLAB
2,860
117
function matGabor = getGabor(matMeshX,matMeshY,dblCenterX,dblCenterY,sigma,length,theta,dblSF,psi) %getGabor Creates scaleable gabor filter % matGabor = getGabor(matMeshX,matMeshY,dblCenterX,dblCenterY,sigma,length,theta,dblSF,psi) % % inputs: %matMeshX = mesh grid for x %matMeshY = mesh grid for y %dblCenterX...
006deac78a693a365471a09c254e3a9042ed58dbe24b12a2caaad5ef153525ea
MATLAB
2,862
73
function [hmm,info] = hmmsinith(Xin,T,options,hmm) % Initialisation before stochastic HMM variational inference, when an initial % hmm structure is provided % % 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 %...
567edb593cf7c68ffec830ab92079aab543244d354d43ee49a996fe9e0e919a4
MATLAB
2,863
70
% OV_MATLAB toolkit % OV_define.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % This file is meant to be executed prior to any user defined script. % It declare all stim IDs as variable for use by the user. % MEANT TO BE CALLED BY OPENVIBE % % Stimulation codes % Origi...
ec637277bd8f2259bb93d8eb687d41f318f5c432e8231a7458a55d49ad95a8ae
MATLAB
2,864
81
function obj = simulate(obj,varargin) ; % Wrapper for default simulation pipelines. % By default, this method will: % - Generate time axis. If one is a property of the microstate object, it % will use this. Otherwise, 2 seconds of data at a sampling rate of 256 % will be simulated. % - Get number of state...
e9774338d934894807cf6fbd4b2d212b7e6635c599cfde16c159ed7205efc599
MATLAB
2,868
81
function gamma = mymcs_gamma_yao2003 ( headmodel, order ) % Returns the Gamma series expansion for EEG leadfields. % % Use as: % Gamma = mymcs_gamma ( headmodel, order ); % % where: % headmodel FieldTrip concentric spheres definition: % headmodel.r Radius of the spheres. % headmodel.cond Conduct...
eb90480b4d2701ff6b5ffc83ac74ef1462954696f22e0f3d82bc2585cea2e148
MATLAB
2,868
139
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_import_parcellation_colortable(zef,varargin) if nargin==0 zef = evalin('base','zef'); end if isempty(zef) zef = evalin('base','zef'); end fileFolder = zef.file_path ; ...
1a4ab14b91fefff540fa6bbd4802e6acbca21e90cc161e08dec07de71a669973
MATLAB
2,874
98
function ET_setVidOut(strRecFile) %UNTITLED Summary of this function goes here % Detailed explanation goes here %% globals global sET; global sEyeFig; %% set video writer %create videowriter object to save video using MPEG-4 cellVidFormats = {'Motion JPEG AVI','Motion JPEG 2000','MPEG-4','Archival'}; cel...
65608c53039e5d1112e6d2cd9ebee62c7cab20874ab752a1e63760715fbfa4e3
MATLAB
2,875
75
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'ramus_multires_dec')); zef.ramus_multires_dec = []; end; if not(isfield(zef,'ramus_multires_n_decompositions')); zef.ramus_multires_n_decompositions = [20]; end; if not(isfi...
f128d1e2970b5af25dae06cf8de8b959a25d0494606f94904a8462ae795d263a
MATLAB
2,876
110
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [shape_param, scale_param, snr_vec] = zef_find_g_hyperprior(snr_val, tail_length_db, varargin) L = []; source_space_size = 1; normalize_data = 'maximum'; eps_val = 1e-10; delta_val = 0.1; ba...
0b12b46c99011281e35f485f5b96fb7182c05182d4921c3f1e9e024823bf713b
MATLAB
2,883
83
function [dblRoundness,dblArea,vecCentroid,imBW] = getApproxPupil(gMatVid,dblPupilT,objSE,vecPrevLoc,boolLowest) %getApproxPupil Thresholds an image to find a potential pupil area % [dblRoundness,dblArea,vecCentroid,imBW] = getApproxPupil(gMatVid,dblPupilT,objSE,vecPrevLoc,boolLowest) %% take trough in histogram ...
2b63cd58f193d04ed77d8e42a1003df6a002894fa674d1fc23cc4e141da6380c
MATLAB
2,890
107
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [shape_param, scale_param, snr_vec] = zef_find_ig_hyperprior(snr_val,tail_length_db,varargin) L = []; source_space_size = 1; normalize_data = 'maximum'; eps_val = 2e-3; delta_val = 0.1; bala...
2e7c90404042859ec01d35fe3ddd8883ded58be51c49389524237269da43f9fe
MATLAB
2,896
80
function [] = compute_voxel_based_temporal_functional_connectivity(subject,part,window) % This script is meant to be the continuation of the % extract_voxel_based_BOLD_signal.m and compute_voxel_based_functional_connectivity.m % scripts and it will generate voxel-based temporal functional connectivity % matrices for...
73795095a971481b8b51b220b6011e906d7a82f5a775b4682efe9dbc1390470d
MATLAB
2,896
102
function out_info = spike_state_max_output(state, spike_state) % --- estimated spike state for window % out_info = spike_state_max_output(state,spike_state) % --- Estimated spike info for extracted window % out_info.spike_num(n) = spike peak number within n-th window : (1 x Nwin) % out_info.spike_time{n} = e...
f0ea2883b7f6ca650957be61ff36f638480721aba8d2c9adacee36e764f77ea5
MATLAB
2,897
62
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D function [boundary_vec_1, boundary_vec_2, s_orbit] = boundary_source(fade_out_param, source_points, orbit_triangles, orbit_nodes) n_triangles = size(orbit_triangles(:,1), 1); n_nodes = size(orb...
9c615492cdb3cab18d747397f867e41bf6183f67146f140da583e7a8b8d90ae2
MATLAB
2,899
57
function varargout = nancorr(vecA,vecB) %NANCORR Linear or rank correlation. % RHO = NANCORR(X) returns a P-by-P matrix containing the pairwise linear % correlation coefficient between each pair of columns in the N-by-P % matrix X. % % RHO = NANCORR(X,Y,...) returns a P1-by-P2 matrix containing the pairwise % ...
ad9a003d726bb1ea9c8b3e97ba0579dc84e0c048b37953d9c7d5eea405a96ed1
MATLAB
2,899
76
function s = structappend(s0,s1) ; f1 = fieldnames(s1) ; s = s0 ; for i = 1:length(f1) % deal with matrices if strcmp(class(s1.(f1{i})),'double') ; dim = size(s1.(f1{i})) ; if (length(dim) == 2) && (dim(2) == 1) % column vector s1.(f1...
a4f5cc2567e08166bb7d447ca98b8d0d697cfa6bd81a15610d945291c1390b9c
MATLAB
2,900
84
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'exp_em_q')) zef.exp_em_q = 1; end if not(isfield(zef,'exp_em_hyper_type')) zef.exp_em_hyper_type = 2; end if not(isfield(zef,'exp_em_beta')); zef.exp_em_beta = 1.5; end...
edaf9d42d26f7e5d0249b10efddd5f9eb88763b3d8af4df1d4c6c2eaf067af1d
MATLAB
2,902
54
function [path,version,versionmatfiles] = toolbox_path() ; % Version 1.7 updates % - Fixed bug with plotting Neuromag MEG sensors % Previous version updates: % Version 1.6 % - Update allowing option to keep polarity when clustering in sensor % space, useful for ERPs/ERFs. % - Updated methods for choosing...
233b0fb1a7bc603d0dc4b5884da5e82f1c46e29c895a07e4f44fffbc06e17ccf
MATLAB
2,903
101
function [Lsignx, Lsigny, Lsignz] = zef_lead_field_sign( ... p_source_positions, ... p_electrode_positions, ... p_L ... ) % Documentation % % Calculates the x-, y- and z-signs of the given lead field p_L based on % cartesian source positions, their directions, the electrode positions % and the lead fie...
2b349fc465f83c0c40830edfff7b1fa99be1f0fba17621c725d06b79be089393
MATLAB
2,904
64
function [identified_neurons, auc_threshold, node_threshold, node_scores] = identify_motifs(params, best_model, node_performance, random_ensemble_performance, ensemble_nodes, threshold_type) % Consolidated Function for Motif Identification % Darik O'Neil 12-14-2021, Rafael Yuste Laboratory % % Purpose: To identify mot...
7a555446e5f4647d5a0d093b50d19f993ba4e07fc2013d4c92e5b4f6284474c0
MATLAB
2,920
90
%% Nat Comms Ictogenesis Figure S9 clear load('20230127_PooledData.mat'); %% Load pulsogram for recording EXP = "EXP_OP141_D210415-1211"; recdat = load(rectable.MATFile(EXP)); pcacfg = rectable.pcacfg{EXP}; pcacfg.eeg_channel = 1; [PCA, recdat.pulsogram] = pulso_pca(recdat.streams.(pcacfg.EEG), "pulsogram...
6d62665033f13fae15e1e28e9dc887748dc66faba19c8894d842a6bbd6b447a3
MATLAB
2,922
64
function p = if2_paths(version) %if2_paths Canonical paths for the interface2 repo. Cross-platform. % % p = if2_paths(version) returns a struct with fields: % .home — user home dir % .data — IF2_DATA_ROOT, or ~/University of Michigan Dropbox/Richard DeFazio/data % .sts — <data>/STS/STS...
e3ac61e5495263d885eb800613d7beb2f445e0aca4ddf9c30b3ab70c7e094ae2
MATLAB
2,923
71
function [optimization_results, params, model_collection] = smbo(params, model_collection, app_handles) %% Description % This is an implementation of a sequential model-based bayesian optimization % Darik A ONeil, 04/10/2023 % At instantiation, we take the the valid_likelihoods we've already got % We then form a sur...
25d03e29d485e40447b28bc3f7839631641b99a2ade409159b83602911d425d1
MATLAB
2,926
88
function [fracMissGauss,binsGauss,spikeCountsGauss,gaussCutoff] = getFractionMiss(amplitudes,nBins,makePlot) % April 2024, RH based on bombcell's bc_percSpikesMissing() % estimate fraction of missing spikes amplitudes = double(amplitudes(:)'); %prep if ~exist('nBins','var') || isempty(nBins) nBins = 50; end if ~...
d07e6b75b6640dd47c6f1ab7e55379d8407242bc526c9c0af5906d8711671e0d
MATLAB
2,927
97
function result=mahalanobis(x,locvct,varargin) %MAHALANOBIS computes the distance of each observation in x % from the location estimate (locvct) of the data, % relative to the shape of the data. % % Required input arguments: % x : data matrix (n observations in rows, p variables in columns) % ...
8bb29e4bd5b39916e75ad3f16c00e191fe293b3db183dc8b68b318309e763d2d
MATLAB
2,929
52
function TDATA=bsliang_Trandata(DATA) % ¶ÁÈ¡ºÍת»»Êý¾Ýµ½´¦ÀíÊý¾ÝµÄ¸ñʽ % ================================ % DATA structure: % turn: L T S % block: % Id_Di BLOCK NAME NUMBER % Id A T_CLEAR_ID 1 % Id B P_CLEAR_ID 2 % Id C ...
0f7abd79d1d944bdbe5eeab85a448021ef48a4eabf1adf9e6953dd45961e7db0
MATLAB
2,930
94
function avg = plot_pulsopower_summary(TB, tt, cfg) cmap = struct(); cmap.lines = lines(7); cmap.base = [0.8 0.8 0.8]; cmap.onset = 'k'; cmap.onset1 = [0.5 0.5 0.5]; cmap.powseg = cmap.lines([5 2 3],:); % Calculations pp = cat(3,TB{:}); avg.tt = tt; avg.pulso = nanmean(pp,3)'; tmask = 100:200; ...
1d8241403e22ff1ccee6b768b932668bbbf25a391312e265d8bf5f884f5e0e87
MATLAB
2,930
102
function M = centeredmatrixfactory(m, n, rows_or_cols) % Linear manifold struct. for optimization over matrices with centered cols % % function M = centeredmatrixfactory(m, n) % function M = centeredmatrixfactory(m, n, 'cols') % function M = centeredmatrixfactory(m, n, 'rows') % % Returns M, a structure for Manopt desc...
95853a533f07aada131605a0b7161d0b3ad15dda835aaf956963763f8c0d5edc
MATLAB
2,930
88
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.filter_name_list = cell(0); zef.filter_file_list = cell(0); zef.filter_parameter_list = cell(0); if not(isfield(zef,'filter_zoom')); zef.filter_zoom = 1; end if not(isfield(zef,'filter_epoch...
7f3ce1d07484033ecf3142f4b156ee3bdbbf76dd2e4a93a44fb5ce250f8d2988
MATLAB
2,935
89
function [newstatetimecourse,stats] = fitEquivUnsupervisedModel(X_train,Gamma,X_test,T_train,T_test) % Given a precomputed TUDA model, this function estimates an equivalent % unsupervised model - that is, the distribution oer only the data that % best describes the state timecourse % % INPUT % X_train: Data that the TU...
00673ec0e0c1234a75798e894b0a737e3c786c5b9ca4be8ffb36e644f5e503e0
MATLAB
2,936
84
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'exp_ias_q')) zef.exp_ias_q = 1; end if not(isfield(zef,'exp_ias_hyper_type')) zef.exp_ias_hyper_type = 2; end if not(isfield(zef,'exp_ias_beta')); zef.exp_ias_beta = 1....
a5c7ce984e4e2dda52c7f76914c52ddcfc090729851e32b620e7892992f900e6
MATLAB
2,937
86
% zef.reconstructionTool.currentInfo=cell(1,5); % % % if ~isfield(zef, 'reconstruction_information') % zef.reconstruction_information=[]; % end % % % if isfield(zef, 'reconstruction_information') && isfield(zef.reconstruction_information, 'tag') % zef.reconstructionTool.currentInfo{1}=zef.reconstruction_informa...
0670b017ccbaf795ed19e178b320c18c74926be6dd2751d09da4f4400eee6fa2
MATLAB
2,938
104
function [stats]=sw_get_stats(dat,ev,opt) %[stats]=sw_get_stats(dat,ev,opt) if isfield (ev, 'auto') ev=ev.auto; end histwin=10;% histogram window for averaging event properties in s %% some descriptive stats--------------------------------------------------- % histogram, mean, std, var of propert...
1d537e34efd1af84b0c6c3a138a811944c2617173afcf7a6b9a9d346740feb58
MATLAB
2,940
86
function gamma = mymcs_gamma_yao2000 ( headmodel, order ) % Returns the Gamma series expansion for EEG leadfields. % % Use as: % Gamma = mymcs_gamma ( headmodel, order ); % % where: % headmodel FieldTrip concentric spheres definition: % headmodel.r Radius of the spheres. % headmodel.cond Conduct...
49a4491e4804f86e07042976725e433b9787a7df8808a7b9c3e41a0d41353cf5
MATLAB
2,942
148
function zef = import_electrodes_callback(zef) % % import_electrodes_callback % % The callback called by Menu tool > Import > Import elecrodes. Adds the % fields "sensors" and "s2_name_list" to the given zef struct, or overwrites % them if they already exist. If the chosen input file could not be read, an % error dialo...
b0980e9e91cf528355117283981d19a12dcb6e81c9e678a5036e3e3b67ff6e32
MATLAB
2,945
96
function hmm = obsupdate (T,Gamma,hmm,residuals,XX,XXGXX,Tfactor) % % Update observation model % % INPUT % X observations % T length of series % Gamma p(state given X) % hmm hmm data structure % residuals in case we train on residuals, the value of those. % % OUTPUT % hmm ...
c6abefcfe7e3bb405e7817d6a85e87858dd8b18a5267e98e766b5018bf67734b
MATLAB
2,955
66
function [performance] = calculate_performance_given_threshold(log_likelihood_by_frame, node, true_labels, data_index,... threshold) % prune ll log_likelihood = log_likelihood_by_frame(node, data_index); % prune labels true_labels = true_labels(data_index); [fpr, tpr, threshold, AUC, operating_point] = perfcurve(...
c0d2782c4d7958d3f8737430c91a0b154090bc5eb44a47405483c55b2bd0458f
MATLAB
2,959
51
zef_data = zef_wireframe_creator_app; zef_assign_data; if not(isfield(zef,'wireframe_edge_threshold')) zef.wireframe_edge_threshold = 1.2; end if not(isfield(zef,'wireframe_printer_resolution')) zef.wireframe_printer_resolution = 0.15; end if not(isfield(zef,'wireframe_relative_permittivity')) zef.wirefr...
abdd743945614c68ff1810e6095c5d8d3f6ed32381877955d8fe3e9d068c534e
MATLAB
2,960
104
function zef_play_cdata(varargin) warning('off'); if evalin('base','exist(''zef'',''var'');') zef = evalin('base','zef'); else zef = []; end show_frame_number = 0; loop_count = 1; if not(isempty(varargin)) loop_count = varargin{1}; if length(varargin) > 1 show_frame_number = varargin{2}; ...
605f350814c48b61430184402ab29b1401c53049116095e2da1031cef8e600e7
MATLAB
2,964
66
function [inmat_s_rm_sp_rlr,inmat_s_rm]=bsliang_tmssham_lr_out(TDATA,inmat,LT_ind,outTag,is_rmsd) % is_rmsd: ÊÇ·ñÈ¥³ý3SD % ±ê×¼»¯£¨¡÷TMS=(rTMS-Sham)/Sham£©£¬·Ö×óÓÒÄÔ£¬Êä³öSPSS¸ñʽ % inmat£º block(4)*turn(5)*subj(197) % LT_ind£ºlarynx tongue index % outTag£ºÊä³öÓÃÓÚSPSS·ÖÎöµÄmatÎļþÃû % Êä³ö£ºinmat_s_r...
9b7a672df9f3ec3db89fdc1e9204cd19e3e7d8444adabf86f99fd035a534fe72
MATLAB
2,971
87
%% Copyright © 2025- Joonas Lahtinen function self = initialize(self,L,f_data) % % initialization function % % Initialize recursively updated variables before the computation of % the first time step. % % Inputs: % % - self % % An instance of KalmanInverter with the method-...
a0b5321639dce50000428d41aa75a51250de50a500e595491e742cf3880498fc
MATLAB
2,972
121
function result = cvmultnet(object, lambda, x, y, weights, offset, foldid, ... type, grouped, keep) if nargin < 10 || isempty(keep) keep = false; end typenames = struct('mse','Mean-Squared Error','mae','Mean Absolute Error',... 'deviance','Multinomial Deviance','class','Misclassification Error'); if strc...
6ee419fcbfe33cc1a16af500d208ac80d17615cf1f345483fa886f7c75a2fa1a
MATLAB
2,984
70
%This is the startup script for CSM app. One must add this as launch %script to zeffiro_plugins file: %Beamformer, inverse_tools, zef_CSM_start zef.CSM = CSM_app; %_ Names of methods that are included in app _ zef_csm_names = {'dSPM', 'sLORETA', '3D sLORETA', 'Sparse Bayesian Learning' }; zef.CSM.csm...
94219cabcd336efe5776221e5f73616a2def64b6b39efb5d90390387c4141472
MATLAB
2,987
136
clear all close all clc addpath('./tools/') %% test for network size, training length, % reset time and noise level % please record the rmse and running time % network_set = round(linspace(20, 500, 10)); % training_length_set = round(linspace(20000, 200000, 10)); network_set = round(exp(linspace(log(20), log(250),...
33eeb9eb5b339248b46d75d27889c36b98f68969816794fd96bc9479a994da7e
MATLAB
2,991
88
%% Copyright © 2025- Joonas Lahtinen function self = initialize(self,L,f_data) % % initialization function % % Initialize recursively updated variables before the computation of % the first time step. % % Inputs: % % - self % % An instance of KalmanInverter with the method-...
33f5887e710938c4f137f2b60e50e7078de434e8dc160d86c06a2f2136d6317b
MATLAB
2,997
53
%This is the startup script for MUSIC app. One must add this as launch %script to zeffiro_plugins file: %MUSIC, inverse_tools, MUSIC_app_start zef.RAPMUSIC = RAPMUSIC_app; %_ Initial values _ zef.RAPMUSIC.RAPMUSIC_leadfield_lambda.Value = '1e-3'; zef.RAPMUSIC.inv_snr.Value = '30'; zef.RAPMUSIC.RAPMUSIC_n_dipoles.Valu...
d63024a616cd89d5bd9e20b49026c8cb1e685f45e59595e77379fa1caace566e
MATLAB
3,000
83
function zef = zef_disable_box_ROIsource(zef) shapeValue = zef.h_synth_source_ROI_style.Value; Ori_style = zef.h_synth_source_ROI_dipOri_style; Ori_options ={ 'Custom','Max SVD direction','Min SVD direction','Normal to cortex','Normal to patch surface'}; switch shapeValue case 1 %flat set(zef...
59fea850e8931c4c28bc066b5c7dd1d7b4a5e39fdde58f7dad22377cc645f6ff
MATLAB
3,003
83
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef_arrange_windows(varargin) arrange_mode = 'on-screen'; arrange_target = 'windows'; arrange_function = 'tile'; if not(isempty(varargin)) arrange_function = varargin{1}; if length(...
d61116f896de034581def1a525103d62c831cda2f8c4735d68d6ce8b54415989
MATLAB
3,004
85
function [newtree, listOld, listNew] = zef_dataBank_reorderTree(tree) %reorders the tree nodes so that the numberings starts at 1 and continues %without jumping %this is needed to rebuild the tree when things were deleted %derive new hashList on this level array=[]; arrayToGive=1; N=length(fieldnames(tree)); listOl...
e827a4e55a41724b6ef575027b2e9b122957e034ffde3754f11446e77e0cfeb2
MATLAB
3,004
126
function [] = func_plot_figures(control_infor, output_infor, val_length, plot_movie) data_pred=output_infor.data_pred; q_pred=output_infor.q_pred; qdt_pred=output_infor.qdt_pred; q2dt_pred=output_infor.q2dt_pred; tau_pred=output_infor.tau_pred; q_control=control_infor.q_control; qdt_control=control_infor.qdt_control;...
036e3c5d5f98350e05443a7bafdd1d40d7f8bc76fda89f326ade778397dd2873
MATLAB
3,009
103
function Model = update_spike_model(state) % update noise variance & spike amplitude/bias for spike model % --- % Model = update_spike_model(state) % --- Model parameters (update parameter) % Model.a % Model.b % Model.sx % --- amplitude & bias estimation % E = sum((y(t) - a*g(t) - b)^2) % % y0 = mea...
5a79f06fd747682b01313b53f37d5cb173ade77c46d92578767bae4a1f21326f
MATLAB
3,023
74
function [log_lh,mahalaD]=WeightedCondDensity(positions, mu, weight, Sigma, p, sharedCov, CovType) %WDENSITY Weighted conditional density and mahalanobis distance. % LOG_LH = WDENSITY(...) returns log of component conditional density % (weighted by the component probability) of X. LOG_LH is a N-by-K matrix % LO...
ac78adb8848c8dd03cfc22f2183a6befaa65f01c62f84831980e21ba6e1c6f4c
MATLAB
3,024
71
function [] = threshold_voxel_based_structural_connectivity_matrices(subject,dataset,h5_file_ID) % The purpose of this script is to take the structural connectivity matrices generated by MITTENS % (and converted into .mat format) and apply a density-threshold on them (currently 70%). % % Requirements: % 1. The Python ...
2e724fd72e44f69c1cf2ceffb303ac6797f6a73ef5349f2a26e9fe6a2d812eca
MATLAB
3,029
97
function [psd_tf,coh_tf,pdc_tf] = hmmtimefreq(spectra,Gamma,center) % obtains a time-frequency representation of the power spectra density, % coherence and PDC - the estimations of which (contained in 'spectra') had to be % estimated with hmmspectramar or hmmspectramt. If coherence or PDC are % missing from the estimat...
4e663e5cdacbe733baa6f42b6f8848b5ae4a025e5d219ff26e9e2993f23a3aae
MATLAB
3,030
88
function install() % Function to install the latest version of the toolbox. % Make options for webpage - timeout after 2 minutes webopts = weboptions('Timeout',120); % Get path to toolbox and current version [path,currentversion] = microstate.functions.toolbox_path ; % Get latest version tmpfile = sprintf(...
b1c3efc178053859021fea04a7c89f043012f5a00e5def9cec0fa9d749298f3e
MATLAB
3,034
155
function [y_1, y_2, y_3, b_coord, volume] = zef_volume_scalar_matrix_uFG(nodes, tetra, h, x_1, x_2, x_3, u_field, scalar_field, i_node_ind, b_coord, volume) % % zef_volume_scalar_matrix_uFG % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % -...
2fc99c7d80396e879d3779f4ad27c48082dd85867a27e9537816174fdb20a654
MATLAB
3,036
101
function [tracedtensor] = diagsum(tensor1, d1, d2) % C = DIAGSUM(A, d1, d2) Performs the trace % C(i[1],...,i[d1-1],i[d1+1],...,i[d2-1],i[d2+1],...i[n]) = % A(i[1],...,i[d1-1],k,i[d1+1],...,i[d2-1],k,i[d2+1],...,i[n]) % (Sum on k). % % C = DIAGSUM(A, d1, d2) traces A along the diagonal formed by dimensions...
fc6f3e7a42dbdae220990fc3f2aad8e526b5b04f2b7482ce88a9cdde1474d272
MATLAB
3,047
82
function [Lsamps,Rsamps,ITDt,dur_real] = GetMovingNoiseBand(params) global ChanConfigInfo %This global variable is set by the user at startup, and determines which channel is considered "contra-lateral".... taking into account the recording side, and the connections between channels and ears (i.e., this should be ro...
03220351bcffc233aa446eecfe05b005b27b8cc2a23674db2fcda8a1599ec19a
MATLAB
3,059
86
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D parameters; if system_setting_index == 1 loop_constant = 2; else loop_constant = 1; end for k = 1 : loop_constant*n_r if exist(['./data_' int2str(folder_ind) '/point_' int2str(k) '...
e2111f7363f01c2e6c8434bd608a8a392d382b344339771815d6be82f9b79516
MATLAB
3,060
86
function [y,ty,x,tx] = vl_ode_wrapper(P,M,U,integrator) % Wrapper to enable SPM or Matlab integrators to be used with % variational_laplace.m. % % P - model parameters [Np x 1] % M.x - starting values for hidden states [Nx x 1] % M.ns - number of samp...
f64f97d67fa7e36790b3dee9bf0fa3ea56a90a31dc21d2b24c7f206440c4fc64
MATLAB
3,062
80
%Copyright © 2018- Joonas Lahtinen, Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [z] = SESAME_inversion(void) h = waitbar(0,['SESAME iteration.']); [s_ind_1] = unique(evalin('base','zef.source_interpolation_ind{1}')); sampling_freq = evalin('base','zef.in...
63d60e0f3f07524022c350ca5c6d6e831397ccec0a91e1f372fe1232713558ca
MATLAB
3,077
78
% script to test sleepwalker ripple detection close all; clearvars; %% run ripple detection test %% test loading data: add your data location here: pathfile= 'data/csc_CA1_rest.ncs'; %load data [dat] = sw_load_LFP (pathfile); figure(1); clf plot(dat.ts, dat.csc,'k'); pause(2) close all %% settings for ripple detect...
f70fcf1db30297ead76777b5df23c0506caa192b7a22c098da4cd7ad8b11ea03
MATLAB
3,083
28
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef_data = zeffiro_interface_lf_bank_tool; zef.fieldnames = fieldnames(zef_data); for zef_i = 1:length(zef.fieldnames) zef.(zef.fieldnames{zef_i}) = zef_data.(zef.fieldnames{zef_i}); end clear zef_...
8ea61ddf185806a2fbe22aa611b16a7967fb21605e7c4f3caa98194ff232dc64
MATLAB
3,084
71
function Read_fMRI(varargin) % Converts the HCP subject data as provided by the MIPlab and stored in % functional_HCP_folder (external drive) in a matrix N x T per session % where N is the number of voxels and T is the time points. % Results are still saved on the external drive % to avoid undesired c...
2f9cb9b1c43173deb61057746dcbcf06a6439b4e42418bec11c57df7567157b5
MATLAB
3,091
102
function M = skewsymmetricfactory(n, k) % Returns a manifold struct to optimize over k skew-symmetric matrices of size n % % function M = skewsymmetricfactory(n) % function M = skewsymmetricfactory(n, k) % % Returns M, a structure describing the Euclidean space of n-by-n % skew-symmetric matrices equipped with the stan...
a10881aed5ee057ef136d460bb00847db79fb4078061bd9f7c11838437d5e662
MATLAB
3,094
84
function checkretraction(M, x, v) % Check the order of agreement of a retraction with an exponential. % % function checkretraction(M) % function checkretraction(M, x) % function checkretraction(M, x, v) % % checkretraction performs a numerical test to check the order of agreement % between the retraction and the expon...
020e6b9bb3677b7b2272f5f3fb4808bc57450a5112be938f3653ae9548d8200e
MATLAB
3,095
75
function [Predictions, SegTime] = SegmentVol(DataVol,NumFrames) % The segmentation is done 2D slice-wise. Speed is dependent on number of frames you can push 'NumFrames'. This is dependent on GPU size. Please % try different values to optimize this for your GPU. In Titan Xp 12GB, 70 slices were pushed giving segmenta...
b23cd64a65ee3aa269eac35dcf6ed4b12a7e3caf0c66e8248edceb3199ad67de
MATLAB
3,098
79
function bsliang_saveDDMform(TDATA,group_indx,save_path) % ¶ÁÈ¡ºÍת»»Êý¾Ýµ½´¦ÀíÊý¾ÝµÄ¸ñʽ % ================================ % DATA structure: % turn: L T S % block: % Id_Di BLOCK NAME NUMBER % Id A T_CLEAR_ID 1 % Id B P_CLEAR_ID 2 ...
7752d87b74b1ffe9e8d07d9cbe13a93b1f510473d5f3c7d2c76f06c629a1c4d7
MATLAB
3,099
125
%% 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 %...
b4a384793c258995744b5d9b1207d35f4bcdc18691490fa4d445ad309c2bcf20
MATLAB
3,099
101
function [xfigure, yfigure]=axescoord2figurecoord(varargin) % AXESCOORD2FIGURECOORD Transform axes coordinates in current % figure units coordinate to the figure for annotation location % [xfigure, yfigure]=axescoord2figurecoord(xaxes,yaxes) % [xfigure, yfigure]=axescoord2figurecoord(xaxes,yaxes,handle_axes) % % Ex. %...
538a99123863bced0b7b9737374b82dba345adbaa7c07ff44db79ee5a8aa8453
MATLAB
3,100
111
%% Copyright © 2025- Joonas Lahtinen function [reconstruction, self] = smoother(self, z_inverse, L) % % smoother % % Computes the desired smoother for Kalman filter solution % % Inputs: % % - self % % An instance of KalmanInverter with the method-specific parameters. % ...
4655d95ee15355a5a7e64d401e665c2ceb0eccbfdd5a4f9f1a21713c10867287
MATLAB
3,116
74
function [frame_log_likelihood] = calculate_log_likelihood_blockwise(node_potentials, edge_potentials, logZ, ... samples, blocks) %Function to compute frame-wise log_likelihood %blocks=2; %Initialize [sample_count,nodeCount] = size(samples); L = floor(sample_count/blocks); finalPartition = sample_count-(L*(blocks...
6c3bddf0f89e89e2d3e022b249355d1f0b3e91806b03914081695d2afdda066d
MATLAB
3,125
73
function zef = zef_strip_tool_update(zef) struct_aux = zef.([zef.current_sensors '_strip_cell']){zef.strip_tool.current_strip}; struct_aux.tip_point = [str2num(zef.strip_tool.h_tip_point_1.String) ; ... str2num(zef.strip_tool.h_tip_point_2.String) ; ... str2num(zef.strip_tool.h_tip_point_3.String) ]; struct_...
193b2ff7d95700afc2bcec5d8846ab1ae8b4d5a002fbd0cdc2b4ac7e7743199a
MATLAB
3,133
116
function [ ... out_deep_nodes, ... out_deep_node_inds, ... out_deep_tetra, ... out_deep_tetra_inds ... ] = zef_deep_nodes_and_tetra( ... in_nodes, ... in_tetra, ... in_volume_inds, ... in_acceptable_depth_mm ... ) % Documentation % % Produces the nodes and tetra which are deep e...
214a2618f7cf71661b4c35c4297585ef646a23b79fad4bebfb2e532c0eb5f814
MATLAB
3,134
105
%{ This script contains example commands for demonstrating the log-Gaussian inference routines implemented in this folder. This implementation is slightly slower and less complete than the Python implementation. Key files: - NORMALIZEPOSITION(XY,MARGIN): This converts XY path data into normalized [0,1)² coordin...
eb5b049bcab460aa4ca61f7f8da4cd8e3b9a0c577523dbd9e5e6d05a2625bdb2
MATLAB
3,134
100
function obj = stats_markov(obj) % Calculate Markov matrix and Markov statistics % Check inputs if isempty(obj.label) error('To calculation Markov property, property label is required') end % Number of states and number of samples % Number of states label = obj.label ; ...
e2dec612f59290512dd32eae6dac5cb75be531d117d4fcd3a3d98f6c413bc054
MATLAB
3,136
91
% deprecated! XXX RUN COMBINE ROIS FIRST!!!!!!!!!!!!!!! first_file=0; %45; % 34; % 0; % 20240722 hard coded to use S.hROI.DFoF0! projection_type = 'DFoF0'; stack_type = 'Smoco'; % get dir path = uigetdir('C:\Users\defazio\Documents\data\complete'); % get list of files in dir codekey = 'complete*.mat'; if ismac ...
df9502bffaba73dfdc2c1c682e94058fa76934cbc77b887bb4620a09fad6eb08
MATLAB
3,142
160
function [Model] = estimate_spike_init(tau, Data) % ----- Initial Estimation of model parameters % using peak of windows % [Model] = estimate_spike_init(tau, Data) % Model.opt_threshold = opt_th; plot_mode = -1; if plot_mode >= 0 fprintf('--- Estimate_spike initial step\n') end Ntau = length(tau...
f1edf6be92626d07fb4c34b8533fc9d59ba90155bbb4e420b24aa6e213f5b4de
MATLAB
3,142
102
function B = doubly_stochastic(A, maxiter, mode, checkperiod) % Project a matrix to the doubly stochastic matrices (Sinkhorn's algorithm) % % function B = doubly_stochastic(A) % function B = doubly_stochastic(A, maxiter) % function B = doubly_stochastic(A, [], mode) % function B = doubly_stochastic(A, maxiter, mode) % ...
ddfba1f43262c3c05550fa3d862058ebebc5a522602cf8b99fd82f6ad09f3cdc
MATLAB
3,149
78
%% 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...
f256b4e33ab5a646e37cdf442951bb51fa9a529c63905bbcc84f63c7096b6bee
MATLAB
3,158
123
function [Points, Tri, Normals, Scalars, LUT] = VTKPolyDataReader(filename) % Usage: % [Points, Tri, Normals. Scalars, LUT] = VTKPolyDataReader(filename) % Copyright modified by Jean Dumoncel % Output: Points = []; % set of vertices Tri = []; % set of triangles Normals = []; % set of normals Scalars = []; % set ...
86c8cc6639ef1cde412d7c64ace2e9e34fbce61ffbebde01e50c244062be3e84
MATLAB
3,159
104
function hmmproj = project_hmm(hmm,A,B,V) % Projects an hmm estimation from PCA space to original space % A : standard PCA % B : PCA on MAR (per order) % V : PCA on regressors (all orders) % using the matrix A/B/V % it projects the HMM-MAR parameters to the space spanned by A/B/V % it ignores the covariance of W, just...
471cf726a4c06a7a83a873e2c1969e57be3cd5adc6068506797a581bd957ea29
MATLAB
3,162
64
if size(zef.resection_points,1) > 1 A=alphaShape(zef.resection_points(:,1), zef.resection_points(:,2), zef.resection_points(:,3),3.4); [AF, AP]=alphaTriangulation(A); dist_resection = zef_distance_to_resection(z_ref_points,AP,AF); dist_final_resection_max = zef_distance_to_resection(z_final_max_point,AP...
3faba3457785e54782023cdfaa3974fdf6414b46f735ed9660af421e048e37ca
MATLAB
3,172
113
function hmm = hsupdate(Xi,Gamma,T,hmm) % % updates hidden state parameters of an HMM % % INPUT: % % Xi probability of past and future state cond. on data % Gamma probability of current state cond. on data % T length of observation sequences % hmm single hmm data structure % % OUTPUT % hmm single hmm da...
0171d677a0ca1010c6dd7603e71524732d5da89e5166e1ad231be68fbf1b16b3
MATLAB
3,173
111
function obj = stats_syntax(obj) % Calculate syntax matrix % Check inputs if isempty(obj.label) error('To calculation microstate syntax properties, property label is required') end % Get microstate transitioning sequence transition = diff(obj.label) ~= 0 ; label = [obj.lab...
3b6f8c55f7bde3ea395869f512dde803fb1d86da88ea26da37554da3b5114137
MATLAB
3,177
90
function [ICs mixMat wavePacks] = applyOnlineICAmethodWaveNowsobi( EEGdata ) % % applyOnlineICAmethodWave % % Apply an online (has to be fast) ICA method. % % Inputs: % % EEGdata - N x M matrix of N channel by M sample EEG. % % Outputs: % % ICs ...
1eaccdb144c861df3aaebacb96eb6c6d657df28aa36455e2359c13167873c13b
MATLAB
3,178
132
function zef_source_tree_selection_changed(~, ~, ~) zef = evalin('base','zef'); sel = zef.h_source_tree.SourceTree.SelectedNodes; if isempty(sel) zef.h_source_tree.SourceParameters.Data = {}; return; end nd = sel(1).NodeData; if isempty(nd) || (isstruct(nd) && isempty(fieldnames(...
8aa4deefa205b87d0639e029615ee5ec0f98ab560eb079d47395606342f0b0c3
MATLAB
3,181
75
function [avg_log_likelihood] = compute_avg_log_likelihood_blockwise(node_potentials, edge_potentials, logZ, ... samples, blocks) %Function to compute frame-wise log_likelihood %blocks=2; %Initialize [sample_count,nodeCount] = size(samples); L = floor(sample_count/blocks); finalPartition = sample_count-(L*(blocks...
778f44a67bb8f34ab1ee2a822d3181e1f7963cfeb06ad76f544eca4c6fc70a4a
MATLAB
3,182
98
function sLabels = ETP_SetLabels(hObject,eventdata) %get globals global sETP; global sFigETP; global ETP_sLabels; global ETP_matAllIm; global ETP_matAllImOrig; %% check bounds intTempAvg = str2double(sFigETP.sHandles.TempAvg.String); if ~isnumeric(intTempAvg) || intTempAvg < 1 sFigETP.sHandles.TempAvg.St...
21285a63714a1682f93ad8d9c76de641dfe1e3300962df494c6d9849130a11c8
MATLAB
3,185
81
function plot_model_graph_structure_style_2(app) cla(app.model_structure); app.model_structure.NextPlot = 'replacechildren'; % 1 neuron_id = app.HighlightedNode.Value; rois = app.rois; num_rois = length(rois.xpix); best_model = app.best_model; edge_mat = best_model.structure(1:length(rois.xpix), 1:length(rois.xpix))...
92bf2c9555e95f67ba163ba2772ae47e81705dca6bd4a95ce5f4cc6031b2c320
MATLAB
3,199
68
classdef SolverFactory2 % ================================================== % dir = C:\Program Files\MATLAB\R2019a\toolbox\nnet\cnn\+nnet\+internal\+cnn\+solver % ================================================== % SolverFactory Class for creating solvers. % Copyright 2017 The Math...
74b42ae46f8415e6fe115e84e36f5f501e3dfc4f35a25ca8c3267046774d991a
MATLAB
3,204
69
classdef SolverFactory2 % ================================================== % dir = C:\Program Files\MATLAB\R2019b\toolbox\nnet\cnn\+nnet\+internal\+cnn\+solver % ================================================== % SolverFactory Class for creating solvers. % Copyright 2017 The...