sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0e0138294ddf4869689323b2e4d08b7f24c90db0c1a4b928ae8f32b70e2c72c3
MATLAB
1,372
36
function [processed_data] = zef_ellip_low_pass_filter(f, filter_order, ripple, attenuation, edge_frequency, sampling_frequency) %Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface %This function processes the N-by-M data array f for N channels and M tim...
2ca21df7f196d67899bc62a00541ca2a2e1ec45cf531a1aa762a9e35b39b741d
MATLAB
1,376
40
function cleaned = replaceOutliersb( A, outliers ) % out is a logical array identifying outliers to limit search tic sx = size( A, 1 ); sy = size( A, 2 ); cleaned = A; %zeros( sx, sy, sz, 'uint16'); meanround = zeros(1,size(A,3)); for i = 1 : sx for j = 1 : sy if outlier...
73e9f7b6b48d0220e60d3c31545b0a77d10997c855777654b16ff5f7017dc42d
MATLAB
1,380
62
function lights_vec = zef_update_lights(varargin) if not(isempty(varargin)) h_figure = varargin{1}; else h_figure = evalin('base','zef.h_zeffiro'); end h_1 = evalin('base','findobj(get(gcf,''Children''),''Tag'',''axes1'');'); h_2 = evalin('base','findobj(get(gcf,''Children''),''Tag'',''lightsselection'');');...
1e617ee9b6f21b9dffa59510b61bb2d566886cbe2704f38f15df43a15af32279
MATLAB
1,381
59
function c = ismemberstr(a,b,doerrorflag) %ISMEMBERSTR Check whether string is part of a set of strings (faster than Matlab ismember) %--- % function c = ismemberstr(a,b[,'doerror']) % --- % Same as ismember(a,b), but faster!!, for cell arrays of strings only. % For easier programming, the set of strings b can also be ...
8d9327451dd42a38106008ba212538a37d0b3483c74847a884df8da517a2c863
MATLAB
1,382
36
function [processed_data] = zef_ellip_high_pass_filter(f, filter_order, ripple, attenuation, edge_frequency, sampling_frequency) %Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface %This function processes the N-by-M data array f for N channels and M ti...
11b1939d76bf681bc5bc5464558f472c1cf0ec76c8954b6c0ab312836110176f
MATLAB
1,383
48
function zef_plot_3D_stem_reconstructed_source(varargin) %A static plot showing the active synthetic sources arrow_scale = 100; arrow_type = 1; arrow_color = 0.5*[1 1 1]; arrow_shape = 10; arrow_length = 1; arrow_head_size = 2; arrow_n_polygons = 100; if not(isempty(varargin)) arrow_scale = varargin{1}; if le...
552b955011611264f0c4993503bb0b630ff56c7f846ffcfd1980482e69367930
MATLAB
1,383
48
function zef_plot_3D_arrow_reconstructed_source(varargin) %A static plot showing the active synthetic sources arrow_scale = 1; arrow_type = 2; arrow_color = 0.5*[1 1 1]; arrow_shape = 10; arrow_length = 1; arrow_head_size = 2; arrow_n_polygons = 100; if not(isempty(varargin)) arrow_scale = varargin{1}; if len...
991ae6ad52cb54bd6de65de98b5bc2f6812eaa83d2cd4db5462b7fe6d6893636
MATLAB
1,383
58
clearvars -except thepath h; tic y=importdata('y.txt',","); y=y.data;y=y'; u=importdata('u.txt',","); u=u.data;u=u';temp=repelem(1,size(u,2)); u=[temp;u]; N=importdata('N.txt',","); N=N.data; label=importdata('label.txt',","); label=label.data; coord=importdata('coord.txt',","); coord=coord.data; D=pdist(co...
e191ff0f169e8b212744041b757cde49d7ca1b9a61db789678dae82a2c2d22db
MATLAB
1,383
47
function dti_tensor = zef_dti_tensor_condition(dti_tensor,scale_value) nx = size(dti_tensor,1); ny = size(dti_tensor,2); nz = size(dti_tensor,3); if nargin < 2 scale_value = 1; end for ix = 1:nx for iy = 1:ny for iz = 1:nz D = [dti_tensor(ix, iy, iz, 1), dti_tensor(ix, iy, iz, 4), dti_te...
c9d677f56852be935faf3591a0b4a6f3ff07b3337d736bf099bc667e1937430f
MATLAB
1,384
38
function zef = zef_ES_recursive_search(zef, num_lattice, recursive_instances, varargin) zef = zef_ES_find_currents(zef); adapted_y_ES{1} = zef.y_ES_interval; % num_lattice = num_lattice; % num_lattice = num_lattice; % K = Size of the adaptive window % recursive_instances = recursive_instanc...
6c0bfc4d658edb7061ebe281ab4dd807987023b638a82a398af4f6f9a238d3fb
MATLAB
1,385
84
function M = zef_surface_scalar_matrix_DD(nodes, tetra, g_i_ind, g_j_ind, scalar_field, weighting) % % zef_surface_scalar_matrix_DD % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - g_i_ind % % TODO: explanation. % % - g_j_ind % % TODO...
7a5a0cfee805b12ea3e377fcea46e06d57ccd41fbef539c54ffa02b020b57d64
MATLAB
1,385
88
function M = zef_surface_scalar_matrix_n(nodes, tetra, n_ind, scalar_field, weighting) % % zef_surface_scalar_matrix_n % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - n_ind % % TODO: explanation. % % - scalar_field % % TODO: explanat...
94516f995e623466023d3d1cb9bfa1fb2e0ed8247983a17dcaad3a359d12382c
MATLAB
1,386
47
% myobj = SetAudioParams( myobj, group_string, params_struct ) % % Set subgroup of parameters for audio-out operation. Parameters % are a struct of name/value pairs. This call stops current output. % Call SetAudioEnable( myobj, 1 ) to restart it. % function [s] = SetAudioParams( s, group, params ) if( ...
f5f10932c0a2fb4e0edf3cfb02d1ab5537d4c403ef36753bd3651edbea8c0d0b
MATLAB
1,386
46
function [param] = optimize_svm_param(data, param, model) opt_thr = 0; opt_Nrefrac = 0; opt_Npre = 1; opt_Nwin = 4; max_f1 = 0; for svm_thr = 0:0.5:2 for Nrefrac = [0 1] for Npre = [1 2 3] for Nwin = [4 6 8 10] param.threshold = svm_thr; param.Nrefrac = Nrefrac...
a2f1e13a5dd5a9a17062530c26a4310d66fa9c13babe35b85e9b14aa38d5a0f8
MATLAB
1,387
46
function [triangles_out, points_out] = zef_get_sensor_boundary(zef) points_ind = []; triangles_ind = []; compartments_ind = []; if isfield(zef,[zef.current_sensors '_boundary_cell']) boundary_cell = zef.([zef.current_sensors '_boundary_cell']); points_ind = zeros(length(boundary_cell)+1,...
c2d6a89ff3c36b5f2b78e0ea36e9a492161b1529b9b70c4a7f4283d4d005290d
MATLAB
1,389
31
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface set(zef.h_filter_pipeline_list,'Value',cell(0),'Items',cell(0),'Multiselect','on'); zef.filter_pipeline_list = cell(0); for zef_i = 1 : length(zef.filter_pipeline) zef.filter_pipeline_list{zef_i} ...
92205af4a5f0fa2d3851090ea52a597de9bda99d9e3545ebe06e1d2cf8068a05
MATLAB
1,390
48
function h = hashmd5(inp) % Computes the MD5 hash of input data. % % function h = hashmd5(inp) % % Returns a string containing the MD5 hash of the input variable. The input % variable may be of any class that can be typecast to uint8 format, which % is fairly non-restrictive. % This file is part of Manopt: www.manopt...
90d110b967f1d9e51edea4fe747dd6732a529221d4a5fe966a0583e3150a4f1f
MATLAB
1,391
80
function [x, function_val, flag_val] = zef_cvx_linprog(Q,z,A,b,Aeq,beq,lb,ub,varargin) %Finds the minimum of z'*x with respect to x and with the constraint A x - b <= 0 %Outputs: x (size: [n x 1]), flag_val (1 if the solution was found -2 %otherwise) %Arguments: z (size: [n x 1]), A (size: [m x n]), b %(size: [m x 1])...
d3f6f469d412241102081098c73b6a28175c4b3a1b66ff99ab7bb55555ae1444
MATLAB
1,391
56
function implot(matData,vecScale,matColormap,dblLineWidth) %implot Creates vectorized heat map plot using lines instead of bitmaps %as with imagesc(). Syntax: % implot(matData,vecScale,matColormap,dblLineWidth) % % % Version history: % 1.0 - July 22 2015 % Created by Jorrit Montijn % %Dependencies: makeBins...
abf47f344477ef76b523b3bb0d8ee4c6b603cd81f4aed40cbc188f01641c9326
MATLAB
1,399
40
function uilock(handles) %uilock Shared Core GUI locker % uilock(handles) %Enable,'off' %{ cellNames = fieldnames(handles); for intPtr=1:numel(cellNames) if (~isempty(strfind(cellNames{intPtr},'ptrButton')) || ... ~isempty(strfind(cellNames{intPtr},'ptrList')) || ... ~isempty(strfind(cellNames{intPtr}...
d3278a8bcfcc7be11153e7020a85c17a0f6bd82c2baf0c5ae66d2843f8dbba17
MATLAB
1,402
51
function rois = simulate_rois(num_neurons) image_size = [512 512]; radius = 5; illegal_area = radius*2; true_image_area = [512-radius 512-radius]; rois = struct(); rois.xpix = cell(num_neurons,1); rois.ypix = cell(num_neurons, 1); rois.boundaryOutlines = cell(num_neurons, 1); start_time = tic; current_time = tic; ...
c7315bbfff68ecce10a35a2dadf12b943189f88106a0efebbc16a016556e89a4
MATLAB
1,403
53
function zef = zef_dataBank_addButtonPress(zef) if nargin == 0 zef = evalin('base','zef'); end dbtype=zef.dataBank.app.Entrytype.Value; if isempty(zef.dataBank.app.Tree.SelectedNodes) %either no selected or no node in tree, either way start on first level newNode= uitreenode(zef.dataBank.app.Tree); dbPa...
218691ffc5700b3da0d2e95801315947e26780e4357188be22a8b9aff0c7ed4e
MATLAB
1,405
32
function h = box3(vol, I2X, bbox) % Cut out a box from volumetric data and display it using texture mapping. % h = box3(vol, I2X, bbox) % % vol, is a volume that is either N x M x K if it consists of scalar values % or N x M x K x 3 if it is in RGB. The behaviour of the color handling is % is similar to image3 and sli...
589e13f095c62c2291fef256c53b6b59abd2016ab49a9817f9c6642ec93703ae
MATLAB
1,405
58
figure(100); clf surface_triangles = zef_surface_mesh(tetra); u_amp = sqrt(u_1_plot.^2 + u_2_plot.^2 + u_3_plot.^2); hold on; for time_point_ind = 1 : size(u_1_plot,2) time_point_ind u_amp_aux = u_amp(:,time_point_ind); plot_field = db(mean(u_amp_aux(surface_triangles),2)); if time_point_ind > 1 ...
64fb74ef04cc9efd4682ae69134985f5f9552fae9722decadc872fe712731490
MATLAB
1,405
46
%-------------------------------------------------------------------------------- % regression_analysis.m % % Copyright (C) 2024 Takuya Isomura % (RIKEN Center for Brain Science) % % 2024-10-28 %-------------------------------------------------------------------------------- function reg = regression_analysis(data,Tt...
aa60f1fadfd11cf7b377240d234457bc19495b8b56429fa0bac939b65108a576
MATLAB
1,405
83
function [x, function_val, flag_val] = zef_cvx_linprog(z, y, A,b,Aeq,beq,lb,ub,varargin) %Finds the minimum of z'*x with respect to x and with the constraint A x - b <= 0 %Outputs: x (size: [n x 1]), flag_val (1 if the solution was found -2 %otherwise) %Arguments: z (size: [n x 1]), A (size: [m x n]), b %(size: [m x 1...
717db9bcaca62b6f12b3810d73d420b79a1778a5a973573a4cb50a54a6504581
MATLAB
1,409
68
full_address = 'exportImage'; file_name = 'carsten'; file_full = fullfile(full_address, file_name); %% %% Deep Component set(zef.h_axes1,'clim',[0 1]) f1 = gcf; f2 = figure(); %612 510 f2.Position(3) = 620; f2.Position(4) = 600; copyobj(findobj(f1.Children, 'tag','axes1'), f2); f2.Children.Position(2) = 60; grid o...
8d73dfb59c05a0492ed1f95e3b1de1ea6936895a27bf4dd2a77f9147d500ed86
MATLAB
1,409
50
function [P_s_store, m_s_store, G_store] = Block_RTS_smoother(P_store, z_inverse, A, Q, number_of_frames, dim,sL) P_s_store = cell(0); m_s_store = cell(0); G_store = cell(0); h = zef_waitbar(0,1,'Smoothing'); if sL>=dim I1=eye(size(A,1),size(A,1)*dim); else I1=eye(size(A,1)*sL,size(A,1)*dim); end zero_m=zeros(...
8093bbfdefe2d60cbb0469ec4ba2c7110707d913379ef2d9cd115d9ef3c0fdd8
MATLAB
1,411
39
function ET_SwitchOnlineDetection(strSelected) %% globals global sET; global sEyeFig; %% update switch if strcmpi(strSelected,'On') set(sEyeFig.ptrButtonDetectPupilOn,'Value',1); sET.boolDetectPupil = true; %check if an output file has been defined if isfield(sET,'objVidWriter') && isprop(sET.objVidWriter...
707ef2ba07fa294dbd0faf7a5da8c4d171f929656eef503481ed56a64aec178b
MATLAB
1,415
48
function printf(strBase,varargin) %#ok<*INUSL> %printf Writes output to log file instead of printing to screen %define global pointer to file global ptrOutputFile; global strLogDir; global boolClust; if boolClust %format input strExec = 'sprintf(strBase'; for intArg=1:numel(varargin) strExec = [strExec...
76122d5fd8869e07e2b062325675cb9ae62dc303fbc9dc39193cacae40010502
MATLAB
1,415
46
function [acc,acc_star] = tudacv_permutations(X,Y,T,options,nperms) % This function computes a null distribution for decoding by randomly % permuting the labels nperms times. This code is designed to be run % immediately following a call to tudacv, such that the data and % options are exactly unchanged. % % The only ad...
858ec1bd099723dabecc401bf3be44a837668703e3bfb66b11e24f4e0461fcf1
MATLAB
1,415
39
function [params] = learn_neighborhoods_par(params) % Reviewed Darik A ONeil 04-15-2023 % Inputs: % a structure params %Outputs: % a structure params %grab necessary parameters & pre-allocate %% Setup warning('off','all'); x_train = params.x_train; neighborhoods=params.neighborhoods; options = params.glm_options; nod...
c23c95963c62bb0b700453e88021fbec795689cfb5a7de292a2f0104a7f6656b
MATLAB
1,417
45
% load minimum of data to allow ROI selection function S = loadFlatProj(m) varlist = who(m); % m is the result of a call to matfile S.timing = m.timing; % convert to sec index = find(strcmp(varlist,'interval'), 1); if isempty(index) m.interval = mean(diff(S.timing)); disp(append("N...
b89ff686cac92dbdee02ba0f0d2458e1361d385f12aa6ee000843d3c7c43a842
MATLAB
1,418
48
function [tree] = zef_dataBank_importDataBank(tree, savePath, saveFile, parentHash, dataBank) dataTree=load(strcat(savePath, saveFile)); dataTree=zef_dataBank_sortTree(dataTree); dataTree=zef_dataBank_rebuildTree(dataTree); data=dataTree.node_1.data; [tree, firsthash]=zef_dataBank_add(tree, parentHash, data); tree.(...
42fb35ea3c772d73dbd833138cace491cd8fc62a9f26ac180e0a62b38a4c40ca
MATLAB
1,419
52
function recon_spike = calibrate_spike_time(t, y, str_index, dir, length0, dt0, Npre, Nwin, model) Ntp_spike = length(str_index); str_index = sort(str_index, dir); % acquiring spike model t0 = 0:dt0:t(end); N0 = length(t0); N = length(y); transient = dbl_exp_func(t0, model); ...
f12eb78377241b090c98c043ae8a28ec325fa967cd31e7796b0d3c55c3289495
MATLAB
1,420
57
function data = leadingPhEigenvector(data,T) % Computes the leading eigenvectors of the time series of phase coherence. % That is, % - Calculates the iFC (or instantaneous coherence matrix) % - Calculates the instantaneous Leading Eigenvector % - Calculates the instantaneous % of variance % - Calculates de time x time ...
8a0498282c7d15ea4e77e3e460207179036147811012b98d2cdd8463465d68e3
MATLAB
1,422
40
function [preds_K,hard_class_pred] = multinomLogRegPred(preds_N) % function to convert a mmultinomial logistic regression data back to class % probabilities. input should be a [T x nTr x N] matrix of scores, where % N=(K.^2-K)/2 possible permutations [T,nTr,N] = size(preds_N); K = 0.5*(1+sqrt(1+8*N)); %solving by quad...
acefb48d86d089e9e29b37f755e63745b83328f19c605108716ee53856056f0b
MATLAB
1,422
39
function [t, A_fr] = FiringRate(spikes, method, binsize, stim_time,plotit) %Neural Response Tuning Curve = Average firing rate %Designed for output from NEL %A_Fr = average firing rate %t = times corresponding to average firing rate %spikes = 2 columns, first column is trial, second is spike times %method = 'bi...
6b5f0603dbd7cb1c8648a522afcbf08daba926c6c3c70d5beecff8d7c1a3e643
MATLAB
1,424
41
function vecYhat = gnmlinfunc(vecLinCoeffs,matX,cellFunctions,vecLinCoeffFunctions) %gnmlinfunc Wrapper for lsqcurvefit() % vecYhat = gnmlinfunc(vecLinCoeffs,matX,cellFunctions,vecLinCoeffFunctions); % %vecYhat is summed contribution of all predictors into [n x 1] vector, %where n is the number of observations ...
9bb8d25bbe9c3450b8d6f557d48247a2d7d709a40798bd8461602499de32fd38
MATLAB
1,424
47
function [beta,beta_t] = tudabeta(tuda,Gamma_mean) % Given a precomputed TUDA model, it returns the decoding coefficients % (aka the "beta" parameters) % % INPUT % tuda: Estimated TUDA model, using tudatrain % Gamma_mean: (Optional) if time-resolved coefficients are desired, % inputting the mean state timecourse he...
b14f3de11b38099f06a5869c7f1138f84f57dff2c06149589bde36ab7ceda157
MATLAB
1,427
42
function [P_s_store, m_s_store, G_store] = RTS_smoother_standardized(P_store, D_store, z_inverse, A, Q, number_of_frames) P_s_store = cell(0); m_s_store = cell(0); G_store = cell(0); h = zef_waitbar(0,'Smoothing'); for f_ind = number_of_frames:-1:1 zef_waitbar(1 - f_ind/number_of_frames,h, ['Smoothing (standardized...
5d05fdf82f8d48f296066d1a0c27d67e0baeb1c42fcd88addce6084b1718aa24
MATLAB
1,431
22
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.ias_hyperprior = get(zef.h_ias_hyperprior ,'value'); zef.ias_snr = str2num(get(zef.h_ias_snr,'string')); zef.ias_type = get(zef.h_ias_type,'value'); zef.ias_n_map_iterations = str2num(get(zef.h_ias...
d6c6e11ff62ab78531217a8604a760c6eac30cf7eb91c19e93c94b2949dbe766
MATLAB
1,431
22
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.sl1_hyperprior = get(zef.h_sl1_hyperprior ,'value'); zef.sl1_snr = str2num(get(zef.h_sl1_snr,'string')); zef.sl1_type = get(zef.h_sl1_type,'value'); zef.sl1_n_map_iterations = str2num(get(zef.h_sl1...
9a5acb709016f1701aa02ef9d59ac30002256e8be980b05fe0fd432fe143692c
MATLAB
1,432
76
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D function [x,conv_val,n_iter] = pcg_iteration_gpu(A,b,tol_val,max_it,M,x,gpu_extended_memory) if nargin < 5 M = []; end if nargin < 6 x = zeros(size(b,1),1); end if nargin < 7 gpu_...
85405f3a67d4bca666ec9333ca4e304ef0de2a1a17bcab112d81285a2d042dec
MATLAB
1,434
39
function [t, A_fr] = SpikeProb(spikes, method, binsize, stim_time,plotit) %Neural Response Tuning Curve = Average firing rate %Designed for output from NEL %A_Fr = #of spks per bin %t = times corresponding to average firing rate %spikes = 2 columns, first column is trial, second is spike times %method = 'bin', ...
ad5d329484b5d3f00386f042ca41d740fff96f098231dfc3f9ce7d8503d4b051
MATLAB
1,434
22
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.inv_hyperprior = get(zef.h_mcmc_hyperprior ,'value'); zef.inv_snr = str2num(get(zef.h_mcmc_snr,'string')); zef.inv_n_burn_in = str2num(get(zef.h_mcmc_n_burn_in,'string')); zef.inv_sample_size = str...
aff7505a80e4772ddde603c0b74f58feb926983c2d7a22664e3e184f5ec02377
MATLAB
1,435
45
function zef_add_package(package_path, package_folder, file_folder, file_folder_dir) if not(isempty(package_folder)) mkdir([package_path filesep '+' package_folder]); package_path = [package_path filesep '+' package_folder]; end if nargin == 3 file_folder_dir = dir(file_folder); end for k = 1 : length(fi...
eb279b1daf9787d3ef758a408f7a4015b8bba84d1fc56f77b8501c3442c94b5c
MATLAB
1,439
48
function [dti_directions, dti_anisotropy] = zef_dti_directions(dti_tensor) nx = size(dti_tensor,1); ny = size(dti_tensor,2); nz = size(dti_tensor,3); dti_anisotropy = zeros(nx,ny,nz, 'single'); dti_directions = zeros(nx,ny,nz,3, 'single'); for ix = 1:nx for iy = 1:ny for iz = 1:nz D = [ ......
7948c8ea194d061d0dde53068095ecfac92f6cf417a6365c9b7d3831c81412ca
MATLAB
1,440
37
function evaluate_neuronal_contributions_button_pushed(app) update_log(app, 'Evaluating Neuronal Contributions...'); if ispc() [user_mem, ~] = memory(); RAM = user_mem.MaxPossibleArrayBytes/(1024^3)*0.95; else RAM = 0.95*8192; end if app.params.par_proc num_workers = gcp('nocreate').NumWo...
eeeafe32bfba9d6f7691bf745a9f1764304f3a49b41900f863d440a1f1f0b7d7
MATLAB
1,441
39
function [] = concatenate_voxel_based_hurst_exponent(subject) % The goal of this script is to concatenate all hurst exponent parts files % that were generated by the compute_voxel_based_hurst_exponent.m script % Requirements: % 1. The script compute_voxel_based_hurst_exponent.m has been run. % % Input: % 1. subject -...
c345c2b00b8186e3b34b5eff9f5e6dcab167e661ec764662c2eef297046a6c28
MATLAB
1,443
55
%% 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...
fa1540c63b4b47c560badd51cc6597a4e71095bd4e1a2864b0a8b073a73046f5
MATLAB
1,446
60
function obj = preprocess_spatialfilter(obj,pos,kneigh) % CARTOOL style spatial filter, see % https://doi.org/10.3389/fneur.2019.00325 for reference if nargin < 3 kneigh = 6 ; end if strcmp(obj.modality,'source') || strcmp(obj.modality,'ampenv') error('Spatial filtering should only be applied to sensor signa...
00c66c8ddc8bb359cea97d214f44b7098b577ad393557bff20c25fcf2220139e
MATLAB
1,447
58
function [nodes] = zef_inflate_surface(zef,nodes,surface_triangles,varargin) N = size(nodes,1); if not(isempty(varargin)) smoothing_steps_surf = varargin{1}; else smoothing_steps_surf = eval('zef.inflate_n_iterations'); end smoothing_param = eval('zef.inflate_strength'); A = sparse(N, N, 0); diag_ind_aux = unique(sur...
07f5ca3550a33c73a52f4a3cf56b736049fd3ee4a657509322e1f71ce1558e7c
MATLAB
1,451
39
function hmm = updateBeta(hmm) K = length(hmm.state); ndim = hmm.train.ndim; M = hmm.train.pcapred; for k = 1:K if ~hmm.train.active(k), continue; end setstateoptions; if isempty(orders) || train.uniqueAR || ~isempty(train.prior), continue; end % shape hmm.state(k).beta.Gam_shape = hmm.state(...
42337d7d3e78c5fbe241bce205528c79262445f44e6c785e2983cf52a47ffdf8
MATLAB
1,452
48
function [D,HMMs_dualregr] = computeDistMatrix (data,T,hmm) % % It performs dual regression on each element of T in order to compute a % subject-specific HMM per subject; % Then, it uses an approximation of the KL-divergence to compute a % subject-by-subject distance matrix. % % INPUT % data observations; in ...
7d73fac3599310b7f8c0d9ccda87f7e626255e7a0b6a3f9a74cfafe6468c4f54
MATLAB
1,452
51
function [upperEnv,lowerEnv] = getEnvelope(x, n) %getEnvelope Envelope detector. % [YUPPER,YLOWER] = getEnvelope(X) returns the upper and lower envelopes of % the input sequence, X, using the magnitude of its analytic signal. % % The function initially removes the mean of X and restores it after % computi...
ed8fb05c2ec1f214f698de7346daefa5991fc87a4d7ce7bf9abbaa733152157a
MATLAB
1,452
39
function mocoConfirm( fig, stack, smoco_stack, name ) nframes = size(stack,3); step_size = floor(nframes/3); im1 = MeanMaxSTD( stack(:,:,1:step_size), 'mean' ); im2 = MeanMaxSTD( stack(:,:,step_size:2*step_size), 'mean' ); im3 = MeanMaxSTD( stack(:,:,2*step_size:3*step_size), 'mean' ); % ...
297dcc372f17fe53762427e505406c35555411a832b6a7b8b468979d210cd1d8
MATLAB
1,453
36
zef_bst.subject_struct = struct; zef_bst.subject_folder = ""; zef_bst.save_project = 1; zef_bst.import_settings = ""; zef_bst.verbose_mode = 1; zef_bst.use_waitbar = 1; zef_bst.surface_names = cell(0); zef_bst.mesh_resolution = 3; zef_bst.refine_surface = {'Scalp','OuterSkull','InnerSkull','Cortex','Other','subcortical...
db5447c36148b48f0501838f8fbdf9ca26679bd939c886c54937ab9639f890c9
MATLAB
1,453
26
% Adapted from ncomp_tools -- see below. Free license given on this software: function result = negligible(X,Y,tol) % Return true if X is "negligible" with respect to Y with tolerance 'tol' % We must be careful with zero elements of Y... %************************************************************************% % ...
4f3e4ffb1ae0b96b410b548b0e1d4df15c7219ad1315722cfc060335481279ac
MATLAB
1,454
51
function [f,t] = zef_getTimeStepClassObj(f_data, f_ind, zef, ClassObj) %zef_getTimeStep gets the time windows and segments of f_data that are %specified in the zef.inv_time* parameters. f_ind gives the number of the given window (first, second, third ...) % if there is only one time step, f_data is returned. %Should th...
c896129e5538c7c9b61fc89e10eee67faf3dd4447e869302145648aeba3e5f7e
MATLAB
1,455
76
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D function [p] = B_prod(u,entry_ind,n,t,gpu_extended_memory) u = gpuArray(single(u)); n = gpuArray(n); t = gpuArray(t); v_ind = gpuArray([1 2 3 4; 2 3 1 4; 3 4 1 2; 4 1 3 2]); size_n = [size(n,1...
9bfaf3523a6af1dd399ebdec83678d6837744a6f58aa78a2e9c3ddc57232c5c3
MATLAB
1,456
40
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'mne_prior')); zef.mne_prior = 2; end; if not(isfield(zef,'mne_type')); zef.mne_type = 1; end; if not(isfield(zef,'mne_pcg_tol')); zef.mne_pcg_tol = 1e-8; end; zef.mne_s...
170d6f522c1117de434550d9275c19ffccd4cb84fcf26895bf42aaaa9cfbff69
MATLAB
1,459
53
function pval = permtest_aux(X,D,Nperm,confounds) % permutation testing routine (through regression) % X: data % D: design matrix % Nperm: no. of permutations % confounds % grouping: the first grouping(1) rows belong to one group, % the next grouping(2) rows belong to the second group, % and so on and so on - D...
709947356efec8994ecc4273f69f746c7ca8ab4af66a744172e2e160f933517e
MATLAB
1,464
32
function update_udf_press(app, value) switch app.TabGroup.SelectedTab.Title case 'Evaluate Model' current_value = app.StimulusEM.Value; if current_value + value <= app.StimulusEM.Limits(2) && current_value + value >= app.StimulusEM.Limits(1) app.StimulusEM.Value = app.StimulusEM.Va...
6da99ec20251907161c66cf00d82b6af3528b8f398756c5b6092e2adb8fee7c4
MATLAB
1,465
24
%% Result 1 : Long-Range Connections Enhance Object Recognition in Shallow Networks (Figure 2) % ============================================================================================================ %% Add LRC vs Add Layers (Figure 2g) disp('================================================================='...
ad2684cc2a51acb6d3411a02a22fcff011e2fc7772278a1f25aa8bef98c2b007
MATLAB
1,466
36
function [Y, Ind, s, s2] = vl_nnpoolInd(X, POOL, Ind, pad, Kernel, dzdx, varargin) % forward mode if(isempty(dzdx)) % initial padding if(sum(pad) > 0) X1 = [gpuArray.zeros(pad(1), size(X, 2), size(X, 3), size(X, 4), 'single'); X; gpuArray.zeros(pad(2), size(X, 2), size(X, 3), size(X, 4), 'single...
771da0f9d441b5270d7011bfab01039762a70ab6fe8be2db0f7e4905a7e0e671
MATLAB
1,468
48
function new_model(app) % file handles app.file_data=[]; app.file_udf=[]; app.file_rois=[]; app.file_model=[]; app.file_params=[]; % imported handles app.data=[]; %data app.udf=[]; %user defined features in binary app.udf_labels=[]; % labels for udf app.rois=[]; %roi coordinates, can be many forms (see functions for ...
8012c7dab1e1397d2f40a81f940df2b2658e7e737ec36381e726dae1c6c3361b
MATLAB
1,469
69
% script to test loading edf % edf is a little different since one data file has many channels: % always set > optx.load=1; this will always load up the data from the % original data file. % loading edf you have to set a channel index: % eg > opt.edf_ch=1; clearvars close all hidden fprintf (' sw > test edf \n\n'...
823749b796827382e58351ed2c46a588f48d363bb7a33c545229853c519e2153
MATLAB
1,469
48
%% make gmm for every reconstruction for gmm_opt=1:3 zef.GMM.parameters{23,2}={num2str(gmm_opt)}; switch gmm_opt case 1 meth='_kmeans'; case 2 meth='_maxProb_'; case 3 meth='_maxComp_'; end for ii=[0.25, 0.5, 0.75] %open gmm tool ...
f122865caf8401f25fd133cf02185a0646ac0257fc50a0417c3c57a74c9d8de4
MATLAB
1,469
22
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.top_regularization_parameter = str2num(get(zef.h_top_regularization_parameter,'string')); zef.top_sampling_frequency = str2num(get(zef.h_top_sampling_frequency,'string')); zef.top_low_cut_frequency...
2a5ab92ca6e052febff73b98818d58d3368e5fd2d9342fd00919d3d1ba95725f
MATLAB
1,470
50
%-------------------------------------------------------------------------------- % utm_init.m % % This demo is included in % Triple equivalence for the emergence of biological intelligence % Takuya Isomura % % The MATLAB scripts are available at % https://github.com/takuyaisomura/reverse_engineering % % Copyright (C)...
010f4f2d4bc9d4c2b2d3ac420aca5628abe9ce0c0e6d16bb62f570d02966b188
MATLAB
1,472
38
function [cellFoldsX,cellFoldsY,cellFoldsShuffledX,cellFoldsShuffledY] = getFolds(intFoldK,matX,matY) %UNTITLED Summary of this function goes here % Detailed explanation goes here %% general metadata intRepetitions = size(matX,1); intNeuronsX = size(matX,2); intNeuronsY = size(matY,2); intTrialsPerFold = flo...
69d56f2810c7486f576292b13d85ea11f9096a806b4196cd8e0398246438d553
MATLAB
1,472
46
function parm = set_default_param(parm) if nargin<1, parm = struct; end %% parameters for estimating the spike model % number of time constant, 2 or 3 if ~isfield(parm,'Ntau'), parm.Twin = 2; end % decay rate [s] if ~isfield(parm,'decay'), parm.decay = 1; end % sampling window in second if ~isfield(parm,'Twin'), par...
23cf62af32567f173d7de08bdba7442c86608e890ca21a6664a3d10f79a75cde
MATLAB
1,473
78
function [x,fval,exitflag] = zef_gurobi_linprog(f,A,b,Aeq,beq,lb,ub,options) if nargin < 4 Aeq = []; end if nargin < 5 beq = []; end model.obj = f; model.A = [sparse(A); Aeq]; model.sense = [repmat('<',size(A,1),1); repmat('=',size(Aeq,1),1)]; model.rhs = [b; beq]; if nargin > 5 if not(isempty(l...
1bd9e1a218946d3a59862b8aafce6f7c8898fcc1990c1d3b3aa153680a2a2ab8
MATLAB
1,474
58
function [fnc_call, fnc_str, fnc_name] = zef_read_function_call(file_name) [~,fnc_name,~] = fileparts(file_name); fnc_str = ''; %fnc_name = ''; fnc_call = ''; s0=strtrim(fileread(file_name)); s = s0; if not(isempty(s)) c_aux = s(1); nline = regexp(s,'\n'); n_line_counter = 0; while isequal(c_aux,'%') ...
c327fb04d3d8db2c5b3136258a9cdcf7e368348dba9998e61bf1e4fb2edebbbd
MATLAB
1,474
44
function Scorings = Fun_ReadScoringFiles(Path, FileNames,... NumOfEpochsExpected) %% Written and updated by M. Nollet (Aug 2023) % Adapted from a script written by R. Winsky-Sommerer (DE_RWS Jan 2013) % % Read information (scoring of vigilance states) contained in the files % % INPUTS: txt files (with "_s...
56d109d7502b8cf76f1fc21559e6f90dafb64353b1a5ecf53f53fa85d3388b76
MATLAB
1,475
59
function [] = Write_vtk_polyline_multi_scalar(Pts, Tri,Scalars,Scalars2,Scalars3,filename,name) % Usage : % Write_vtk_polyline(contour.',{tri},'MNHN-ZO-MO-1973-115_URM3_slice_contour.vtk'); % Pts : 3xN % Copyright modified by Jean Dumoncel fid = fopen([filename(1:end-4) '.vtk'] ,'wt'); fprintf(fid,'# vtk DataF...
f1fa3f916500155a96367526c3d9102ac3022aad47c894acacae653536b0f3d2
MATLAB
1,475
61
function [info,columnNames, hashList] = zef_databank_showAll(tree, type) %get all hashes of type nodes % this will add a tiny bit of runtime, but makes the funtion more readable info=cell(0,0); columnNames=cell(0,0); dbFieldNames=fieldnames(tree); hashList=cell(0,0); for i=1:length(dbFieldNames) if strcmp(tree....
a89e231b57b54247af0f05eb644a87b3b31e276df73d907b2dab3c91cb4b0097
MATLAB
1,476
44
function p=powerspectrum( data, Fs ) % % powerspectrum % % Take the FFT of the data series and spit back power % spectrum formated data. % % Inputs: % % data - signal of dimmensions 1 x N (N = no. samples). % Fs - sampling rate (Hz) % % Output: % ...
1f3085ad3274a6cdf386946d2764b4753d37261e69b8d81670c0158699461780
MATLAB
1,477
55
%% Copyright © 2025- Joonas Lahtinen and Alexandra Koulouri function self = initialize(self,L,f_data) % % initialization function % % Initialize recursively updated variables before the computation of % the first time step. % % Inputs: % % - self ...
8ac57279437640b8a4d6d6bc633d679b0c2afe9c34bbb67287d7836ce617eafc
MATLAB
1,477
46
function [outdata,errind]=bsliang_rmoutlier3sd(indata) % indata is a list c_extrm=10; c=2.5; %% ÅųýÌØ±ð¼«¶ËµÄÖµ errind=[]; while 1 finished_minextreme=0; finished_maxextreme=0; indata_rm_min=indata(indata>min(indata)); m_rm_min=mean(indata_rm_mi...
dc5a943cb1608b7a954c866b40ef79270eae2b81432df46cc60523f124ef270e
MATLAB
1,478
70
function figure_without_colorbar_fn(figtool, filename, filetypes, resolution) % % figure_without_colorbar_fn % % Saves a given Zeffiro Interface figure tool image without the colobar % included. % % Inputs: % % % - figtool (1,1) matlab.ui.Figure % % An instace of a Zeffiro Interface Figure tool. % % - filename (1,1) ...
11f960198d07b2858337eee7d7198e83822b1f461c37b4859d8e1c123ad117c3
MATLAB
1,479
45
function [tree] = zef_dataBank_rebuildTreeSaveFile(tree) %tree is sorted and rebuild, but the names and hashes of the nodes might %longer match the names of the save files. %rename the old files to tmp-files, then rename them to the new names %(avoids overwriting) and renew the node matfiles % IF the hash and filename...
5774ed3089077d7462ba5306515deadaa3a960b49dab7a0a296de7ca2ffbf0e1
MATLAB
1,480
66
function [pval,d,side] = permtestdiff_aux(Xin,Yin,Nperm,confounds,side,func) % tests if @func (mean by default) of Xin is higher than the mean of Yin % Diego Vidaurre, University of Oxford (2015) % pval : pvalue % d: the permutation values % side: 1 if mean(Xin)>mean(Yin), -1 otherwise % Diego Vidaurre Xin = Xin(~isn...
e63f7aa46db341af388e3e73ae38883389e10ecc6df7ece5d18d678f4f70e3bb
MATLAB
1,482
43
function stats = applyStatsfun(problem, x, storedb, key, options, stats) % Apply the statsfun function to a stats structure (for solvers). % % function stats = applyStatsfun(problem, x, storedb, key, options, stats) % % Applies the options.statsfun user supplied function (if it was provided) % to the stats structure, a...
ee7866f3f8bfd1517b77363c4ecf41bd95b144d1647f36198e012544ca2cba74
MATLAB
1,482
37
function [q] = find_evolution_prior(L, f_data, likelihood_std, evolution_prior_db,evolution_mode) % q to evolution prior switch evolution_mode case 1 %Since R = likelihood_std^2*eye, we have % A_noise = (1/(p*A_signal))*A_signal => SNR = p^2*A_signal^2 = % (q||L||^2)^2/E[||noise||^2] % => E[dy^2] ...
3ff5a7a25de64a1cb06040209577ad8ea750777cde3d87305b767392fa7009e4
MATLAB
1,484
38
% Get location of the toolbox and specify data directory toolbox_path = microstate.functions.toolbox_path ; % location where the toolbox is installed datadir = fullfile(fileparts(toolbox_path),'tutorials','tutorial5_Chi2_Stimulus_Response') ; % path to folder containing the data addpath(datadir) % add this to the path ...
a77e4e3dc91e1e0a37417b7fc71458b478751db3ed9f290bc4b7fe596e6cc1c6
MATLAB
1,484
42
function Tau = set_tau_grid_cs(Ntau) % set_tau_grid_cs % parm.tau = [0.01; 0.5; 1.0]; % [onset time; decay time] [sec] % ??on was constrained to 2 - 30 ms to avoid steep or shallow onsets. % decay constant ??2 was set to a fixed value of 70 ms if nargin == 0, Ntau = 3; end; Tau.Ntau = Ntau; Tau.tau_...
802e989f094d1eb01666210758679a6b40b151ecca5605b8c9a0be5c26e891a4
MATLAB
1,485
20
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_update_fss_legacy(zef) zef.inv_synth_source = str2num(get(zef.h_inv_synth_source_1 ,'string')); zef.inv_synth_source = zef.inv_synth_source(:); zef.inv_synth_source = [ zef.inv_synt...
6764506781b61f0adab12863965d522a4f949ec6129645ef8125eb647db9fc12
MATLAB
1,486
91
function M = zef_surface_scalar_matrix_D(nodes, tetra, g_i_ind, scalar_field, weighting) % % zef_surface_scalar_matrix_D % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - g_i_ind % % TODO: explanation. % % - scalar_field % % TODO: expl...
18ab1ff59e7721d7dc0297fb6682c5b51eb17320d198ddba8223ff54aa728be8
MATLAB
1,491
63
% script to test loading edf % edf is a little different since one data file has many channels: % always set > optx.load=1; this will always load up the data from the % original data file. % loading edf you have to set a channel index: % eg > opt.edf_ch=1; clearvars fprintf (' sw > test edf \n\n' ) fname='data/hu...
f1c27021327d6276eb65dc881cc1ad2dbd9bf2242eaf3941f32d336d1b715cb3
MATLAB
1,491
69
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D function [div_u] = B_T_prod(p_1, p_2, p_3, div_vec, n, t, gpu_extended_memory) n = gpuArray(n); t = gpuArray(t); div_u = gpuArray(zeros(size(n,1),3)); div_vec = gpuArray(div_vec); v_ind = [ 1...
94b6d51ee7439eb955f81b0ccecdda95b641cfbdd6c49e2d01767552614869a4
MATLAB
1,494
35
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'top_regularization_parameter')); zef.top_regularization_parameter = 5; end; zef.top_sampling_frequency = zef.inv_sampling_frequency; zef.top_low_cut_frequency = zef.inv_low_cu...
560d0aa183f73679d64e19718ba1482f6efed591ee152042e380481bedd4c732
MATLAB
1,499
52
function [index_vec,MahalanobisD,GMModel] = zef_find_clusters(n_clusters, rec_points,reg_val,cred_val,max_iter,tol_val) index_vec = ones(size(rec_points,1),1); if isequal(length(cred_val),1) cred_val = cred_val*ones(size(index_vec)); end options = statset('TolFun',tol_val,'MaxIter',max_iter); r_squared = chi2inv...
ecf775f20dad72540982bc5551afb975f91609dadc67c40857bc3471f87258b1
MATLAB
1,499
22
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.inv_multires_n_levels = str2num(get(zef.h_inv_multires_n_levels,'string')); zef.inv_multires_sparsity = str2num(get(zef.h_inv_multires_sparsity,'string')); zef.inv_multires_n_decompositions = str2n...
99440e6c171daeff265c7b96e05e3e10316f67e7a1a0498dbb2eb1125f218a60
MATLAB
1,501
47
function [z] = zef_postProcessInverse(z_inverse, procFile) %zef_postProcessInverse reorders the inverse output z_inverse to fit the %visibility options. The procFile is given by zef_processLeadfield source_direction_mode=procFile.source_direction_mode; source_directions=procFile.source_directions; s_ind_1=procFile.s_in...
c4cbdbf339b7a8ed361fe5d2aebe12f0173fa485ecf346536a0cf7e95ced7fb8
MATLAB
1,502
53
function [Model, Info, Y] = ... train_post_weight(post_info, spike_info,Model) % Sparse classification by probit Model (Covariance method) % % [Model, Info] = ... % probit_sparse_cov(X,Yid,Model_probi,parm) % % --- Input % X : Input data ( M x T ) % Yid : Class id = {1, ..., N} ( 1 x T ) % N ...
fc48cdd00803042800ccdb700edd73de01106bfbe179f4ccf640561c5826651a
MATLAB
1,506
31
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef_i = length(zef.filter_pipeline_list)+1; zef.filter_pipeline{zef_i}.name = zef.filter_name_list{zef.filter_list_selected}; zef.filter_pipeline{zef_i}.file = zef.filter_file_list{zef.filter_list_sel...
d1533bd6046f47816e88e3eb455b26b2e9fbef96e0ade47c551aa8d1e05ca761
MATLAB
1,507
46
folder = '/media/datadisk/paavo/zeffiro_interface/figures'; sg_data = []; lm_data = []; for i = 1:50 zef_import_figure([],['rec_',num2str(i),'.fig'], folder) h = gcf; h_axes = findobj(h.Children, 'type', 'axes'); sg = findobj(h_axes.Children, 'displayname', 'SG 005'); lm = findobj(h_axes.Children...
28b42240efc762d54b9875009442363dbb35b51e06a1ee7a2e6e4059d5f7f053
MATLAB
1,508
53
% V = joint_diag(C,method_diag,arg_diag) % % -----------------------------Definition---------------------------------% % % description : performs a joint diagonalization of a set of covariance % matrices. % % usage : joint_diag(C,'uwedge',{}) % % -----------------------------Input------------------------------...