sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c3315e04ce5b824a7d0f5009cccb45ca3b8eef3d7dd84f10817ad151671c4a53
MATLAB
1,221
47
function hauk_map = zef_sensitivity_map_dipoleScan( ... project_struct, ... n_reconstructions, ... noise_level, ... diff_type, ... dispersion_radius ... ) arguments project_struct (1,1) struct n_reconstructions (1,1) double { mustBeInteger, mustBePositive } = 10 noise...
131ab31ea8078cb5cc68304245e9f742616b079d482439fcb2394bce43fc181f
MATLAB
1,223
56
function Ytest = tslda(Ctest,Ctrain,Ytrain,varargin) if isempty(varargin) method_mean = 'riemann'; update = 0; else method_mean = varargin{1}; update = varargin{2}; end labels = unique(Ytrain); Nclass = length(labels); % Tangent space mapping C = me...
505d6bd0b370ce29441cad732d4a3849e5172956812527715fc98b55481aab05
MATLAB
1,225
40
%%%% computes the same state probabilities of a population of electrodes %%%% input "PR_MAT" is a matrix of PR values where rows=> trials and columns => electrodes function [p_vals] = same_state_probability_dist(PR_MAT) [t_num, e_num] = size(PR_MAT); %%% normalize all the Prs between 0 and 1 ...
a948151a84c32e585e3529460f73f04f9c8611e2a36b4316426663905bb5325b
MATLAB
1,228
50
%-------------------------------------------------------------------------------- % mdp_init.m % % This demo is included in % Canonical neural networks perform active inference % Takuya Isomura, Hideaki Shimazaki, Karl J. Friston % % The MATLAB scripts are available at % https://github.com/takuyaisomura/reverse_engine...
d68300a0d84cbb7d833d5929e6f9a57bf746cb2e97ec4fdd7adc990a9b704a5e
MATLAB
1,229
15
zef_data = zef_github_updater; zef_assign_data; zef.h_github_updater.Name = 'ZEFFIRO Interface: GitHub pusher tool'; zef.h_github_message.Value = 'A regular push adding the changes made in the current local repository to the remote origin. Contents of the folders ./data/ and ./profile/ are ignored. The update necessita...
d86c8efa07bdd072211b1bca008fd53b7245e64c8281b92450a4cc0ea73d5230
MATLAB
1,229
39
function zef = zef_nse_interpolate(zef,type) if ismember(type,zef.nse_field.reconstruction_type_list{1}) for i = 1 : length(zef.compartment_tags) eval(['zef.' zef.compartment_tags{i} '_sources = 0;']) end for i = 1 : length(zef.nse_field.artery_domain_ind) eval(['zef.' zef.compartment_ta...
bebe028da73da31d1d75d24f013fea310674febf393b346a85b17d1dfad511f0
MATLAB
1,231
22
% Adapted from ncomp_tools -- see below. Free license given on this software: function mre = maxrelerr(X,Y) % Return maximum relative error of X with respect to Y % We must be careful with zero elements of Y... %************************************************************************% % ...
233723367a6f45bcac4f0540886b3d6540b1ec1a4d5bddf656fe97996792e0c4
MATLAB
1,232
45
function zef_plot_3D_stem_synthetic_source(varargin) %A static plot showing the active synthetic sources arrow_scale = 1; 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 length(v...
3b91a30822200a5b454a971b61d0326eb1c643a7cb46c07e24995bc9bc7bf278
MATLAB
1,233
80
function [x,y,z,D] = zef_3by3_solver(a,b,c,d,D) % % zef_3by3_solver % % TODO: Sampsa should document this. % % Inputs: % % - a % % TODO: explanation. % % - b % % TODO: explanation. % % - c % % TODO: explanation. % % - d % % TODO: explanation. % % - D % % TODO: explanation. % % Outputs: % % - x % % TODO: exp...
5457f6a85df1f8f30bbf0bca3d54ae36f5cda6787864fe503fbd48a88fee7a81
MATLAB
1,233
45
function zef_plot_3D_arrow_synthetic_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 length(...
a641c2af3be5920ce3412d946567dbdfae13740ae07a9ca4340fe01417745d67
MATLAB
1,235
21
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_ramus_window(zef) zef_ramus_app; set(zef.h_ramus_ias_map_estimation,'Position',[ 0.5764 0.2944 0.15 0.5]) set(zef.h_ramus_ias_map_estimation,'Name','ZEFFIRO Interface: RA...
7686ed50fd1c3f81ca2a59f85274c56268a648e3a95ff64480cfffd1d62258ba
MATLAB
1,236
52
function [smoothed_nodes] = zef_smooth_surface(nodes,triangles,smoothing_parameter,n_smoothing) smoothing_param = smoothing_parameter; smoothing_steps_surf = n_smoothing; N = size(nodes,1); if N > 0 A = sparse(N, N, 0); for i = 1 : 3 for j = i+1 : 3 A_part = sparse(triangles(:,i),triangl...
23bbbe37673d0df066de2e1501f022f13d4858f9f02a4fd9dadd4a9aca701b33
MATLAB
1,243
54
function [S,assig, gamma1] = getGammaSimilarity (gamma1, gamma2) % Computes a measure of similarity between two sets of state time courses. % These can have different number of states, but they must have the same % number of time points. % If gamma2 is a cell, then it aggregates the similarity measures across % elemen...
7b1d913787e7393e527eb7f07073749220f0edb8c9893d4a789dd9ba137a47a7
MATLAB
1,244
37
function matImage = imfilt(matImageIn,matFilt,strPadVal) %imfilt ND image filtering. Syntax: % matData = imfilt(matImage,matFilt,strPadVal) % % input: % - matImage; [X by Y] image matrix (can be gpuArray) % - matFilt: [M by N] filter matrix (can be gpuArray) % - strPadVal: optional (default: 'symmetric'), padd...
e63395c17e369d5ebb721b9ffe208f729fb75245a3ea0b988c853085f8b78ade
MATLAB
1,244
38
function imRotated = imrot(imIn,dblAngle) %imrot Rotates an image using nearest-neighbour assignment % imRotated = imrot(imIn,dblAngle) % %This function rotates the input image coordinates, assigning new %nearest-neighbour values to the rotated frame. The output image is the %same size as the input image. dblA...
a499ac78f57585e5265f6c0c3ebf89a9da168821daed8bc87391f2f64ccf4ae5
MATLAB
1,245
44
function x = L1_optimization(A,sigma,y,gamma,x,maxiter,estimation_type) %MAP estimate using EM algorithm %L1 norm minimization problem (LASSO): %0.5|1/sigma(Lx-y)\|_2^2+0.5*\sum_i [gamma_i |x_i|] % L : lead field matrix % sigma: noise variance % y: measurements %for gamma->0 we have less sparse solutions... %Output:...
8826be3213004403c81ad3b28a2a14cec4ec8714fcab72d38523da9294f1e676
MATLAB
1,250
53
function ETP_ROICallback(hObject,eventdata,strLocation) %get globals global sETP; global sFigETP; %check which slider dblVal = get(hObject,'Value'); if strcmp(strLocation,'LT') %start x intType = 11; elseif strcmp(strLocation,'RT') %stop x intType = 13; elseif strcmp(strLocation,'LB') %start y i...
4b6f48eb48cfac9d7b211bca88110de20d9cbbf4bd477a800da4b37170f8fbc5
MATLAB
1,252
33
for zef_i = 1 : size(zef.parameter_profile,1) for zef_j = 1 : length(zef.compartment_tags) if isequal(zef.parameter_profile{zef_i,8},'Segmentation') && isequal(zef.parameter_profile{zef_i,6},'On') if not(eval(['isfield(zef,' '''' zef.compartment_tags{zef_j} '_' zef.parameter_profile{zef_i,2} ...
9904952a508f7d3e5fa177012e62b5f75984acc2c43cbd53d9750b169fd28def
MATLAB
1,253
39
function matGrid = getFillGrid(matGrid,vecRow,vecCol,vecVals) %getFillGrid Adds values in vecVals to the paired locations [vecRow %vecCol] in the 2D matrix matGrid % % SYNTAX % matGrid = getFillGrid(matGrid,vecRow,vecCol,vecVals) % % INPUT % matGrid: 2D input matrix % vecRow: vector that determines in ...
778c274e3c4fe13368d40f2eed6c092113085b65923c33e543263b2404dfdc63
MATLAB
1,254
45
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D function [nodes,tetra,interp_vec] = refine_mesh(nodes,tetra) tetra_sort = [tetra(:,[1 2]); tetra(:,[2 3]); tetra(:,[3 1]); tetra(:,[1 4]); tetra(:,[2 4]); tetra(:,[3 4]); ...
d0fb2f967461b6c710bc050e3d3a4b93c5562bba713a22512ea3508dd3044267
MATLAB
1,254
32
function [Spikes_jumbled] = Jumble_spikes(Spikes,stimDur) %This function will jumble up spike times to generate noise floors for a %Systems ID type analysis. This function does it by taking a randomizing %the ISIs of the measured Spikes. Also look at stimDur, to only jumble %spikes during driven part of stimulus %Spi...
697a0a90cb32c5c2d4820566ba13bebe5b3c2cb8facb98b6f95cc7e002f7120e
MATLAB
1,256
39
function zef_set_size_change_function(h_window,type,scale_positions,exclude_cell) if nargin < 2 type = 2; end if nargin < 3 scale_positions = 1; end if isempty(scale_positions) scale_positions = 1; end if nargin < 4 exclude_cell = 'cell(0)'; end if isprop(h_window,'AutoResizeChildren') set(h_wi...
656de0f72ab308664d519c21883861c15f56eb13bf5203d465ea058aa49bbb48
MATLAB
1,257
42
function [P_s_store, m_s_store, G_store] = RTS_smoother_normal2standardized(P_store, z_inverse, A, Q, H, R, standardization_exponent, 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_frame...
9c7a52cbf9127c5955f2285e84584f5e3338a7f32b8c4b0ff59bcc1623ed2064
MATLAB
1,257
37
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'bf_sampling_frequency')) zef.bf_sampling_frequency = zef.inv_sampling_frequency; end if not(isfield(zef,'bf_low_cut_frequency')) zef.bf_low_cut_frequency = zef.inv_low_cut...
c714b8f70abde6ec8f045d4e9577dfa9514bfd9d16f7109e2bf7d29a9deda35b
MATLAB
1,257
36
function manualVTA(varargin) p = inputParser; pathExists = @(x) exist(x,'dir'); addRequired(p,'patientfolder', pathExists); parse(p,varargin{:}); leadFolder = fullfile(p.Results.patientfolder,'lead_recon/') load(fullfile(leadFolder,'all_VTAs.mat')) fn = fieldnames(all_VTAs); for k=1...
cb7fff0704dc06b0d61235d38a3803bf7765350d3f98f370679178ce6f111952
MATLAB
1,257
31
function dblOptimPupilT = ETC_FitPupilThreshold(dblPupilT0,matFrame,imPupil,gMatFilt,dblReflT,objSE,vecPrevLoc,boolUseGPU) %ETC_FitPupilThreshold Calculates optimal pupil threshold for an image given a ground-truth pupil area % dblOptimPupilT = ETC_FitPupilThreshold(dblPupilT0,matFrame,imPupil,gMatFilt,dblReflT,obj...
5e7704cb3290e50a73e85734c220712b99409d5ea65d80caf3ed543d9fadb73e
MATLAB
1,263
36
function [vecRefinedT,vecIntervalError] = SC_refineDiffT(vecReferenceT,vecNoisyHighResT) %OT_refineT As OT_getStimT, but no text. Refines event times % [vecRefinedT,vecIntervalError] = SC_refineDiffT(vecReferenceT,vecNoisyHighResT) % %vecReferenceT is the default: these times are known to be correct, but inaccurate...
f72f91cb1fc92f129d046e2fa0ca49b53005df0e30a3dca54760df25245d5a26
MATLAB
1,263
52
function [orientations_roi,s_roi] = zef_get_normal_ori(procFile,s_o,varargin) if nargin<3 s_roi = procFile.s_ind_0; interp_ind = 1:size(procFile.s_ind_0,1); else s_roi = varargin{1}; %only indices that are interpolated s_roi = intersect(s_roi,procFile.s_ind_0); if isempty(s_roi) erro...
68747bc04df8bd95e1424e785ae1530438f97be24af34dabab3944fc3949ed7e
MATLAB
1,265
34
% tuto2_FFT_filter_Uninitialize.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 25 May 2012 % % The function tuto2_FFT_filter_Uninitialize is called when pressing 'stop' in the scenario. % We compute the mean FFT and plot it. % function box_out = tuto2_FFT_filter_Uninitialize(box_in) ...
df609d0085ae11dcb956419ce05bd77d22ae529bd7f8661493375ef67e26c945
MATLAB
1,265
36
function zef_plot_GMModel(varargin) %Plots a red sphere showing the maximizer of the reconstruction. %The optional argument is the scale of the radius. This %function can be either static or dynamical. [X_0,Y_0,Z_0] = sphere(50); h_axes = evalin('caller','h_axes_image'); f_ind = evalin('caller','f_ind'); delete(find...
455688bc419a1c3431cc5bbcbca72d0168fcd8be7fbc13fd57ddafa4ff17e2b7
MATLAB
1,266
1
% MLFIT -- Maximum Likelihood Fitting procedure % MLFIT attempts to find the best fit of a function through a set % of points by minimizing chi-square. % % Usage: % [paramBest, mse] = mlfit('fn', params0, xvals, yvals, stdev); % % where 'fn' is a function defined in an M-file as 'y=fn(x, p)'. % % Alternativ...
3402ca4b87682881219359474435617e176c1bb3e4dc8f58e5b3a09a2ce1173a
MATLAB
1,270
48
classdef LossDice < dagnn.ElementWise properties weights = true; end properties (Transient) average = 0 numAveraged = 0 end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnlossDice(inputs{1}, inputs{2}, obj.weights) ; n = obj.numAveraged ; m = n + siz...
bc9a4b211335de33d70ea3a874c81dfffe6f5a96e1916418057e5dca55f900f1
MATLAB
1,271
40
function [z,mu,sigma] = nanzscore(x,flag,dim) %NANZSCORE Standardized z score with nans. % Z = NANZSCORE(X) returns a centered, scaled version of X, the same size % as X. For vector input X, Z is the vector of z-scores (X-NANMEAN(X)) ./ % NANSTD(X). For matrix X, z-scores are computed using the mean and % stand...
c6949084e2349965adff6f9a25eb025ab662f9792f90ae33b38cc0dd141b2922
MATLAB
1,272
13
zef.h_compartment_table.ColumnName(1:zef.compartment_table_size) = {'Index','On','Name','Visible','Surface nodes','Surface triangles','Merge','Invert normal','Activity' }; zef.h_compartment_table.ColumnEditable(1:zef.compartment_table_size) = logical([1 1 1 1 0 0 1 1 1]); zef.h_compartment_table.ColumnEditable(zef....
ede7aea499ad16ad3fa1913d64df6d61662869687319be82e13a998d3f51745b
MATLAB
1,273
46
function [hmm,fe] = dropstate(hmm,k,X,T) K = length(hmm.state); % if isfield(hmm.train,'grouping') % Q = length(unique(hmm.train.grouping)); % else % Q = 1; % end Q = 1; no_k = setdiff(1:K,k); K = K - 1; hmm.state(k) = []; hmm.K = K; hmm.prior.Dir2d_alpha = hmm.prior.Dir2d_alpha(no_k,no_k); hmm.prior.Dir_al...
ccd55c08c46f567eae205c6b410aeebc0395ea1286ce8cb9f7a96ac45c17d217
MATLAB
1,274
54
% % A matlab example of sending data to OpenViBE via LabStreamingLayer. You need to have the LSL matlab stuff recursively on Matlab's Path. % % At the time of writing this, OpenViBE only supports numeric markers. % nChannels = 8; samplingFreq = 100; disp('Loading LSL library...'); lib = lsl_loadlib(); % make a new st...
91f315126b7b9c52c80dc5077703c87b2a621e584408f71b3f24b452147119bb
MATLAB
1,276
41
function [Y_mult,classlabels] = convertToMultinomial(Y) % takes data object with mutually exclusive classes and converts to the % format of multinomial classification. NOTE THAT TEST SET is unchanged % first check if data_in is a single vector of class labels, in which case % revert to binary matrix format: vals = uni...
b013af0574268fada2cc4faeaaa85c3a528ad9a84c958e64f8871e5f5f17a3ab
MATLAB
1,277
37
function [nodes] = zef_distance_smoothing(tetra, nodes, distance_vec, smoothing_exponent, smoothing_strength, smoothing_steps_dist) N = size(nodes,1); B = sparse(N,N,0); distance_smoothing = exp(-smoothing_exponent*mean(distance_vec(tetra),2)); for i = 1 : 4 for j = i+1 : 4 B...
b0da24008a4c2fd684fa978ec9c860414199b838667e5934c801c2bfaf39950b
MATLAB
1,277
21
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_find_synthetic_source_ROI_window(zef) zef_find_synthetic_source_ROI_app; set(zef.h_find_synthetic_source_ROI,'Name','ZEFFIRO Interface: Find synthetic source ROI'); set(findobj(zef...
816314b70fbc7bd5bed31f49e69c65c6638a380a12b1d54fc77337335f6cdb8e
MATLAB
1,279
48
function [Evec, Ndata] = sq_error_spike_vec(tau, data) % square error vector for spike windows % [Evec, Ndata] = sq_error_spike_vec(tau, data) % --- % data.a : spike amplitude % data.b : bias % data.y : y(k,n) % data.Dt : Dt(k,n) = t(k,n) - T(k) % --- double exponential function % g(t) = ( 1 - ...
f72c94a81b428f9be372f0e60d3be5f50a022d923bf8b83f358ba97ac32f4876
MATLAB
1,279
19
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.exp_em_q = get(zef.h_exp_em_q,'value'); zef.exp_em_hyper_type = get(zef.h_exp_em_hyper_type,'value'); zef.exp_em_beta = str2num(get(zef.h_exp_em_beta,'string')); zef.exp_em_theta0 = str2num(get(zef...
646d86f6d80d5db54861e440cdb1db8f3e0dc5409dbb71a13cc46e61c2f8ddc5
MATLAB
1,280
33
for zef_i = 1 : size(zef.parameter_profile,1) for zef_j = 1 : length(zef.compartment_tags) if isequal(zef.parameter_profile{zef_i,8},'Segmentation') && isequal(zef.parameter_profile{zef_i,6},'On') % if not(evalin('base',['isfield(zef,' '''' zef.compartment_tags{zef_j} '_' zef.parameter_profil...
a600703e80549f74578e5c0ec83015c7215ed0d2e33937965fb09ca0596e6797
MATLAB
1,280
48
classdef Loss_TVReg < dagnn.ElementWise properties weights = 0.05; end properties (Transient) average = 0 numAveraged = 0 end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnloss_TVReg(inputs{1}, inputs{2}, obj.weights) ; n = obj.numAveraged ; m = ...
f813fa1f2534e2f0d3d7d85f3388757f9a8dbd4a1899ef6d6e8419fc7ea31352
MATLAB
1,280
30
function [best_model_index] = get_best_model(model_collection) models = numel(model_collection.models); p_lambda = []; s_lambda = []; test_likelihood = []; valid_likelihood = []; train_likelihood = []; for i = 1:models p...
98f9a1f9bc542c79003f065363b4df6853efac22c1abd2c58909652022bbd9df
MATLAB
1,281
61
tree.all=zef.dataBank.tree; for iii=1:3 switch iii case 1 typ='Prob'; case 2 typ='Comp'; case 3 typ='kmeans'; end dltType='gmm'; onlyIn='node'; allHashes=fieldnames(zef.dataBank.tree); allHashes=allHashes(startsWith(allHashes, onl...
2cdfc093f0530c114a89d5e41f624d3276964dcd58b08c20915c103d1f4358f4
MATLAB
1,285
37
function out_cell = zef_bst_default_fem_mesh_create(run_type,input_mode,settings_file_name,project_file_name,zef_bst) if nargin < 4 zef_bst = struct; end if isequal(run_type,0) out_cell = cell(0); out_cell{1} = []; out_cell{2} = []; out_cell{3} = []; return; end zef_bst = utilities.brainstorm2zef.m.zef_bst_get_s...
5019c7be2a2ab445326ff44b5ffb796cd7a1cb056f8d77227779ef940be3f0fa
MATLAB
1,286
48
classdef LossSemantic < dagnn.ElementWise properties weights = true; end properties (Transient) average = 0 numAveraged = 0 end methods function outputs = forward(obj, inputs, params) outputs{1} = vl_nnlossSemantic(inputs{1}, inputs{2}, obj.weights) ; n = obj.numAveraged ; m =...
0bf56979ae02d30ad99b122cab9463716102cbd3c63e45e43caf1a768cfe8fbd
MATLAB
1,287
40
function zef = zef_build_compartment_table(zef) if nargin == 0 zef = evalin('base','zef'); end zef.aux_field_1 = cell(0); zef_i = 0; for zef_j = length(zef.compartment_tags) : -1 : 1 zef_i = zef_i + 1; zef_init_fields_compartment_table; zef_n = 0; for zef_k = 1 : size(zef.parameter_profile,...
811cb5e50314b654910201dee0cddb3d2564cfca6ffba4c2b6a2bd03f88262a0
MATLAB
1,287
45
function [P_s_store, m_s_store, G_store] = sample_RTS_smoother(P_store, D_store, z_inverse, A, number_of_frames, filter_type) P_s_store = cell(0); m_s_store = cell(0); G_store = cell(0); z_inverse = cell2mat(z_inverse); if (isdiag(A) && all(diag(A) - 1) < eps) Q = cov((z_inverse(:,2:number_of_frames)-z_inverse(:,1...
e597980e427604b98e66c6b3a6d3c43c10cf7308f01ed0f346a16d78217fbf96
MATLAB
1,288
30
zef.aux_data_1 = cell(0); zef.aux_data_2 = {{'Scaling','scaling'},{'X-shift','x_correction'},{'Y-shift','y_correction'},{'Z-shift','z_correction'},{'Xy-rotation','xy_rotation'},{'Yz-rotation','yz_rotation'},{'Zx-rotation','zx_rotation'},{'Affine transform','affine_transform'}}; zef_i = evalin('base','zef.current_trans...
25da33d976bbb99e09831892d2ed76d337f463c15deb0e63dbbc6a59fed3df29
MATLAB
1,291
69
function y = interleave(dim,varargin) %INTERLEAVE Interleave data %--- % function y = interleave(dim,x1,x2,...[,'push']) %--- % Similar syntax to Matlab function CAT, but interleaves the data. % The 'push' flag results in having all dimensions more than dim 'pushed' % rightward. % % Example: % a = reshape(1:6,2,3);...
ac1df94a221c5012eb74680ad69694b95aa3f6a6f930e12d53269715d7da10ab
MATLAB
1,291
46
function [tri_ind, lambda_1, lambda_2, lambda_3] = zef_find_intersecting_triangle(p_1, p_2,sign_val,tri_ref,nodes_tri_ref,varargin) search_type = 'convex'; if not(isempty(varargin)) search_type = varargin{1}; end tri_ind = []; lambda_1 = []; lambda_2 = []; lambda_3 = []; vec_1_aux = p_2 - p_1; ones_vec_tri = on...
262947be60ce032b8b0f29f06252c97cbdce5232622b2d10659cc7e67cf39c54
MATLAB
1,292
41
function [dat]=sw_rectify_csc(dat,av,noise,sd) % [dat]=sw_rectify_csc(dat,band,av,noise,sd) % rectify single csc % uses eeglab eegfilt function! % inputs: dat = single csc channel as vector % cFs = samplig rate in Hz, eg >> cFs=1024; % band = filter band values in Hz, eg >> band=[8 15]; % ...
beda849ece85f0916807df7424ef1f32592eb5f425b509d4bf03f9432c75a254
MATLAB
1,292
26
%reads the current data into the aux field and adds it to the bank zef.LeadFieldProcessingTool.auxData.source_interpolation_ind = zef.source_interpolation_ind; zef.LeadFieldProcessingTool.auxData.parcellation_interp_ind = zef.parcellation_interp_ind; zef.LeadFieldProcessingTool.auxData.source_positions = zef.source_po...
4091dcae2b3ee6992a8c71d30ed1b3c3b57b4509e01c3bfb2ad9e448497a1c27
MATLAB
1,293
39
function ptrWaitbarHandleLocal = UpdateWaitbar(~) %UpdateWaitbar Updates waitbar for (parfor) loop once per second % ptrWaitbarHandle = UpdateWaitbar(~) % %for a parfor looping over i=1:n, put the following before the loop: % global intWaitbarTotal; % intWaitbarTotal = n; % ptrProgress = parallel.pool.DataQueu...
63fa8241406f407f58cf7bf4a4f87377f3f5550cac9e4ba37b1158817724589d
MATLAB
1,294
30
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isempty(zef.save_file_path)) & not(zef.save_file_path==0) [zef.file zef.file_path] = uiputfile('*.mat','Save as...',[zef.filter_save_file_path zef.filter_save_file]); else [zef.file zef...
59f7fc758ebe37912e16d4e46e6ccf4e7dfacdc10d4778f6b6e1f91e90822b66
MATLAB
1,298
39
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [c_table,c_points] = zef_parcellation_roi_embed(zef) c_table = cell(0); c_points = cell(0); if eval('zef.parcellation_merge') c_table = eval('zef.parcellation_colortable'); c_points ...
f5fd5ee6653c830480ad7c5d3cb776e7851230b857992d446ccac1713bf17eac
MATLAB
1,299
45
% myobj = SetParams( myobj, params_struct ) % % The inverse of GetParams.m, this sets run parameters. % Alternatively, you can pass the parameters to StartRun() % which calls this in turn. Run parameters are a struct of % name/value pairs. The call will fail with an error if a % run is currently in ...
9fc308ced93df7bf686beed14b71f9b3b06bb71bb8870c298636ad2fc8c324ae
MATLAB
1,300
19
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.exp_ias_q = get(zef.h_exp_ias_q,'value'); zef.exp_ias_hyper_type = get(zef.h_exp_ias_hyper_type,'value'); zef.exp_ias_beta = str2num(get(zef.h_exp_ias_beta,'string')); zef.exp_ias_theta0 = str2num(...
c0ecc43c0e4cb0b0d4874755c803d26ce4ee5a8b6065c43bdea35e08aef545c7
MATLAB
1,300
38
% tuto3_sinus_generator_Initialize.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 25 May 2012 % function box_out = tuto3_sinus_generator_Initialize(box_in) % we display the setting values disp('Box settings are:') for i=1:size(box_in.settings,2) fprintf('\t%s : %s\n',box_...
d56478e2d20ffa13c1ea96669097a6c732078a130f58dd4734dc5b7bfe5a5822
MATLAB
1,300
34
function [X,T] = read_spm_file(spm_file,mat_file) % Load an (continuous data) SPM file with filename specified in the spm_file % input parameter, and put the data into X in matrix format ready to be used by % the HMM. If mat_file is specified, X is saved in the file mat_file % Importantly, if there are bad time poi...
deaaba2a4911392cf9c2914a94f30eecbd3fe33bf89871cdac03e8f829b720df
MATLAB
1,301
52
function pval = permtest_aux_NPC(X,D,Nperm,confounds) % permutation testing routine, integrating tests through the NPC algorithm % 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, ...
c0d5698e2dd06ad292dff11ee6df726a5f9c951cb1c689a5de94676d5fa52865
MATLAB
1,305
50
function [f] = zef_getFilteredData(zef) %zef_getFilteredData reads the datafrom zef.measurement and applies the %filter that are specified in zef.inv_low_cut_frequency and %zef.inv_low_cut_frequency at a sampling frequency of %zef.inv_sampling_frequency. % f has the same size as the measurement if (nargin == 0) zef = ...
ec0eb66b86d4d169aabe69e98d9c119445d372f71e787e99021979cfb5aad80d
MATLAB
1,307
48
function vecLim = normaxes(varargin) %normaxes Sets the same axis limits for selected subplots % vecLim = normaxes(hFig,strAxis,vecSubplots) % %Note: subplots is given in children IDs, not in subplot numbers %set defaults %drawnow; hFig=gcf; vecSubplots = 1:numel(hFig.Children); strAxis = 'y'; cellCheckAx...
d99bae30875696d8ffed2c7384e85656f9a04dd3d74c031c45f34a4248de15d9
MATLAB
1,311
48
function options = make_options(opts_in) % Initialize options structure options = struct ; % Deal with case of no options in if isempty(opts_in) return end % Deal with structure options if length(opts_in) == 1 && isstruct(opts_in{1}) opts_in = opts_in{1} ; ...
b9a2619bfc2f7b6bde64c9b64f0fecc344a4e9542b46c3c1250641d31c7ac2a4
MATLAB
1,313
35
function passFail = checkThresholds( signal ) % % checkThresholds % % Check the single channel signal against some simple thresholds to % determine if it should be removed. % % Note, output, passFail (0 = fail, 1 = pass). % % Author: Ian Daly, 2012 % % License: ...
e267fa839b692824ba90ea4a2b6cc2ea022a095688f6b7c7c86644848ce6012d
MATLAB
1,313
60
% A = riemann_mean(B,epsilon,tol) % % Calcul du barycentre des matrice de covariances. % A : baricentre des K matrices NxN % % B : Matrice NxNxK % epsilon : Pas de la descente de gradient % tol : arret de la descente si le crit�re < tol function [A critere niter] = riemann_diag_mean(B,args) N_itermax = 10; if (nargi...
0e53355605263803a4b6eb3d5ac0cdce35ed9811fb0fd74717d3c902fa3ff48c
MATLAB
1,316
43
function sEyeFig = ET_populateFigure(handles,boolInit,sFigIn) %OT_populateFigure Populates global figure structure %check for initial run if ~exist('boolInit','var') || isempty(boolInit) boolInit = true; end %which defaults to save cellDefaults = {'String','Value'}; %populate button pointers cellFields = ...
912fcbdb8f39904999f848150ea452e2f75f2694216c18347600af0c18c7b50e
MATLAB
1,317
24
zef.reconstructionTool.bankSize=zef.reconstructionTool.bankSize+1; zef.reconstructionTool.bankInfo(zef.reconstructionTool.bankSize, 1:6)=zef.reconstructionTool.currentInfo; if iscell(zef.reconstruction) zef.reconstructionTool.bankReconstruction{zef.reconstructionTool.bankSize,1}.reconstruction=zef.reconstruction...
d88ba4ebcef973b35b2d4c95e56ea9426a0102d1247ba5ce9703cadc41baab74
MATLAB
1,319
46
load('sleep_deprivation_RT') mean_value=[]; std_value=[]; sizes=size(mean_RT); for j=1:sizes(2) mean_value=[mean_value;mean(mean_RT(:,j))]; std_value=[std_value;std(mean_RT(:,j))]; end figure bar([mean_value(1),mean_value(2)],'EdgeColor','w','FaceColor',[207/255,234/255,241/255],'linewidth',...
a7cc25b6cf43b8ba7e699a3b4fdfc80bf9fc2941837f421b8d9a7a82866259be
MATLAB
1,320
61
function zef = zef_import_mat_struct(zef,varargin) mat_struct = []; extension = []; if not(isempty(varargin)) if not(isempty(varargin{1})) [folder_name, file_name_1,file_name_2] = fileparts(varargin{1}); file_name = [file_name_1 file_name_2]; end if length(varargin) > 1 extension =...
c25085e877c0da588a39bdc86d8cce3c6823b20f779baded97fa80340fadffcb
MATLAB
1,321
43
function output = TDnoise2(data,dt,source) % returns various noise estimates % output.keys = { "SD", "diffSD", "MLspike_sigmaest", "CaImAn_Sn", "cascade" }; % returns a single value, or a struct containing all estimates if nargin==1 dt=0.1; source="all"; end if nargin==2 source="all"; end if size(data,1)==1...
fc08485afaa811a642f6a9cba05799bdde0ec931ee4d63a597fdd0f2866d126b
MATLAB
1,321
37
function [ wind ] = hann(windowLength) % -------------------------------------------------------------------------- % COPYRIGHT 2014 BLACK CAT SCIENCE, INC. % CONTACT INFORMATION: STEM@BLACKCATSCIENCE.COM % WEBSITE: WWW.BLACKCATSCIENCE.COM % -----------------------------------------------------------------...
cc1fd8c3c22516eb2ca3ed787521c2ee1e11b56014369bec295e6afd9ab81778
MATLAB
1,329
84
function M = zef_volume_scalar_matrix_DD(nodes, tetra, g_i_ind, g_j_ind, scalar_field, weighting) % % zef_volume_scalar_matrix_DD % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - g_i_ind % % TODO: explanation. % % - g_j_ind % % TODO: ...
2a2668bc2d72e19ebf71ca921e9b576a20007afea4e03511c36a03f3da4a609e
MATLAB
1,330
50
function [Model] = estimate_nonlinear_model(data, Model, mode, plot_flag) if nargin<4, plot_flag = 0; end % compute model prediction t_model = data.t(1):0.001:data.t(end); y_model = calc_linear_response(data.spike_time, t_model, Model); [~,idx] = findClosest(data.t,t_model); y_model = y_model(idx); % find index o...
ef5269efce741a4a75441938f6c2f586a42461baeddb36a0c95050b9188c2bb2
MATLAB
1,330
59
% ------------------------------------------------------- % % f_writeJson - Write ECG data into json files % % Ver. 1.0.0 % % Created: Claudia Nagel (13.10.2022) % Last modified: Claudia Nagel (13.10.2022) % % Institute of Biomedical Engineering % Karlsruhe Institute of Technology % % ...
3111dfcbd6d9f530e67e36c43959cf47288a903fd0ad0bd02e06a5efbb770781
MATLAB
1,333
47
function [data, udf, nil_neurons, nil_frames] = secondary_validation_dataset(data, udf) %Grab Data Size [data_samples, num_nodes] = size(data); % should be samples x features if data_samples < num_nodes data = data'; [data_samples, num_nodes] = size(data); end assert(d...
4708bac78d3eb5e321fbde957842ee83ad1d08713c56fb1351c46b3bb2580f86
MATLAB
1,333
27
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if ismac zef.h_exp_em_map_estimation = open('exp_em_map_estimation.fig'); elseif ispc zef.h_exp_em_map_estimation = open('exp_em_map_estimation.fig'); else zef.h_exp_em_map_estimation = op...
3f02c0da305784840c08cf6fc0a233b0481d5df3a15a484a87a9fbf4d74df4c7
MATLAB
1,334
103
clear all close all clc addpath('./tools/') % load training data load('./save_file/all_traj_06282022.mat') %% traj_set = ["infty", "circle", "astroid", "fermat", ... "lissajous", "talbot", "heart", "lorenz", "chua", "rossler", ... "sprott_1", "sprott_4", "mg17", "mg30", "epitrochoid"]; order = randperm(le...
e33bdd50ef687b8dab81c815ece4cdce3bb3085a8e5e55146748259e631a890a
MATLAB
1,335
41
function obj = stats_duration(obj) % Calculate durations of microstates % Check inputs if isempty(obj.time) || isempty(obj.label) error('To calculation microstate duration, properties time and label are required') end if length(obj.time) ~= length(obj.label) error('microstate.labe...
eb901ec8bbea77fb819265f185514bbfe8b1d6b0851d222c9f0e8eb9a0cddc08
MATLAB
1,335
27
function clipped_nodes_ind = zef_clipping_plane(nodes, clipping_plane, varargin) clipped = 0; if length(varargin) > 0 aux_node_ind = varargin{1}; clipped = 1; end if length(clipping_plane{4}) == 1 if clipped clipped_nodes_ind = intersect(aux_node_ind,find(sum(nodes.*repmat([clipping_plane{1} clip...
2de0e657befe26cc39fc5c98dcf3607e9e618d1e1e0d32db9911669b0d87f4e3
MATLAB
1,336
24
%zef_LeadFieldProcessingTool_TableUpdate_index has to be set zef_LeadFieldProcessingTool_TableUpdate_index=zef.LeadFieldProcessingTool.bankPosition; if zef_LeadFieldProcessingTool_TableUpdate_index > size(zef.LeadFieldProcessingTool.app.BankTable.Data,1) %new data zef.LeadFieldProcessingTool.TableData={'', '', '...
88bed95f1a8a2c5f5a7c87bdb3d74c3d5e6bf414cd196323d0eb44f9188ff060
MATLAB
1,336
48
function [f] = zef_getFilteredDataClassObj(zef,ClassObj) %zef_getFilteredData reads the datafrom zef.measurement and applies the %filter that are specified in zef.inv_low_cut_frequency and %zef.inv_low_cut_frequency at a sampling frequency of %zef.inv_sampling_frequency. % f has the same size as the measurement if (na...
249250cbea34a9836f9237c81548c42c3a371fc4633a1854d981eb99050bb3a9
MATLAB
1,337
53
% estimate the center of the ROI and the theeshold given a set of % covariances matrices. function [C th dist art Ci thi] = potato_estimation_adaptive(COV,method_mean,method_distance,window,C) I = size(COV,3); if nargin <2 method_mean = 'riemann'; method_distance = 'riemann'; window = I;...
7db566c72cd17ab8a017227be3f911a88c3c99d125e4370cdef2b2ae232deefa
MATLAB
1,337
27
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if ismac zef.h_exp_ias_map_estimation = open('exp_ias_map_estimation.fig'); elseif ispc zef.h_exp_ias_map_estimation = open('exp_ias_map_estimation.fig'); else zef.h_exp_ias_map_estimation...
9e1bcb10ec70aa7863669a4be99481bf192dccb40c05d6253ff8e801fdaf3f23
MATLAB
1,338
17
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D parameters; load([torre_dir '/system_data/mesh_' int2str(system_setting_index) '.mat']) interpolation_radius = 1.15*s_radius; lattice_resolution = round(4*lattice_oversampling_rate*(signal_highe...
077ceb8c6beed4f4f9f32397ddcf00adeb0474d7fb2799f0d56af2cf51e3fe4c
MATLAB
1,339
85
function M = zef_surface_scalar_matrix(nodes, tetra, scalar_field, weighting) % % zef_surface_scalar_matrix % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - scalar_field % % TODO: explanation. % % - weighting % % TODO: explanation. % ...
12a356a84bf63ffb164016d075e762f9a90d340690a3cc78e9e6efccb7ba39c8
MATLAB
1,340
47
% ------------------------------------------------------- % % f_filterECG.m - This function applies high- and lowpass filters and % removes isoline offset from ECGs % % Ver. 1.0.0 % % Created: Claudia Nagel (13.10.2022) % Last modified: Claudia Nagel (13.10.2022) % % Institute of Biomed...
15853cac299d8d919fc97576d20196466281bea120bb5586d4a394778c39f2f0
MATLAB
1,340
27
%Script for add synthetic source button of find_synthetic_source_app. %Display Initial parameters on the list zef.find_synth_source.h_source_parameters.Data=zef.synth_source_init; %Define a possible index for banked method name and add it to the list of selected inversion methods if isfield(zef,'synth_source_data') ...
269e70b56ad45e8541f9f8cd5ef088680e2b1d38c6d6c523ba7c059b9ecf58f5
MATLAB
1,347
43
load('postprandial_somnolence_RT') mean_RT=[mean(RT_wakefulness),mean(RT_drowsiness)]; std_RT=[std(RT_wakefulness),std(RT_drowsiness)]; figure hold on bar(mean_RT,'EdgeColor','w','FaceColor',[190/255,184/255,220/255],'linewidth',3); hold on for t=1:77 r=normrnd(0,0.1); plot([1,2],[RT_wakefuln...
80ae13f952232515cb74f24e098029bff0c5ce2a48108fbf98ce7cffcb7943b6
MATLAB
1,350
36
%-------------------------------------------------------------------------------- % conditional_expectations.m % % This analysis is included in % Experimental validation of the free-energy principle with in vitro neural networks % Takuya Isomura, Kiyoshi Kotani, Yasuhiko Jimbo, Karl Friston % % Copyright (C) 2022 Taku...
99a10a413546a3bd6186482455e250aaf126ed7500415043915d6c38b5735089
MATLAB
1,351
29
[~, indexOfMinimumTrueElement]=max(cell2mat( zef.reconstructionTool.bankInfo(:,7))); zef.reconstruction=zef.reconstructionTool.bankReconstruction{indexOfMinimumTrueElement,1}.reconstruction; zef.reconstructionTool.currentInfo=zef.reconstructionTool.bankInfo(indexOfMinimumTrueElement,1:6); %set every checkbox to fal...
cbc35b3553351ffaa6194b60323130b8f44cc7c92d0972ad80fd4ed04bc86683
MATLAB
1,353
26
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if ismac zef.h_ias_map_estimation = open('ramus_sampler.fig'); elseif ispc zef.h_ias_map_estimation = open('ramus_sampler.fig'); else zef.h_ias_map_estimation = open('ramus_sampler.fig'); ...
0e8a06fc0cd72a944afc5071bcac0dbbde08968999548994b6b8aefc86161efc
MATLAB
1,358
46
function [vecMeans,vecBinEdges,cellValues] = getQuintiles(vecIn,vecBinEdges,intSegments) %UNTITLED Summary of this function goes here % Detailed explanation goes here %calc edges (if necessary) vecIn = vecIn(:); if nargin < 2 || isempty(vecBinEdges) if nargin < 3 || isempty(intSegments) intSegments = ...
2399313e8f7ab88784203cb676a6c9eae516a4bb3bb399b307ba458649a18540
MATLAB
1,363
77
function [x, function_val, flag_val] = zef_cvx_linprog(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]) %...
1b6ddc353c08295a131e8e9072ef642e7860d0beee224859e3ca778bb7c00cbd
MATLAB
1,365
49
function output = TDnoise2(data,dt,source) % returns various noise estimates % output.keys = { "SD", "diffSD", "MLspike_sigmaest", "CaImAn_Sn", "cascade" }; % returns a single value, or a struct containing all estimates if any(isnan(data)) disp('NaN!!') end if nargin==1 dt=0.1; source="all"; end if nargin...
b6ca2b73d92ec80141d45d1ff13ae6a8312ef43256c0048f6007eef526713756
MATLAB
1,367
40
function [M, multigrid_perm_output] = zef_block_diagonal_preconditioner(L, multigrid_dec, multigrid_ind, multigrid_perm,varargin) if not(isempty(varargin)) reg_param = varargin{1}; end multigrid_perm_output = cell(0); n_sources_aux = length(multigrid_perm{1}); n_system_aux = length(multigrid_perm{2}); n_system ...
c169af9e273ad618fac22322a5876eb7fc544fbb6fcb5c52f4258599641640f4
MATLAB
1,367
46
function [zef] = zef_dataBank_hash2tree(zef) if nargin == 0 zef = evalin('base','zef') end %this builds a uiTree in the databank.app from the databank.tree node %hashcodes %zef.dataBank.tree=zef_dataBank_reorderTree(zef.dataBank.tree); %zef.dataBank.tree=zef_dataBank_sortTree(zef.dataBank.tree); % if strcmp(zef...
dc91c09e525798774e799669ff350d1b21930530f1ccd87502e2bbd5fe59d18a
MATLAB
1,368
51
numObj = 4; numObjRepPerRun = numObj; objNums = repmat((1:numObj)',[numObjRepPerRun,1]); numParLoop = 24; minVals = zeros(numParLoop,1); minOrders = zeros(numObjRepPerRun*numObj+1,numParLoop); maxI = 1000; % parfor np = 1:numParLoop minVal = 10^10; minOrder = zeros(numObjRepPerRun*numObj+1,1); aa = zeros...
630aa490cc6f15b6a7ff0df1c89a746acb3adb25f0f5020b205889fed32eb08e
MATLAB
1,369
27
function strip_struct = zef_create_strip(strip_struct) strip_struct = zef_get_strip_parameters(strip_struct); [triangles{1}, points{1}] = zef_simple_cylinder_generator(strip_struct.strip_radius,strip_struct.strip_n_sectors,strip_struct.strip_length); [triangles{2}, points{2}] = zef_simple_cylinder_generator(strip_stru...