sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
27294e0ce8232ffbbb47288d53297ce36426438c5048f7983a9d1c007a4f4421
MATLAB
973
30
function zef = zef_dataBank_startNameChange(zef) if nargin == 0 zef = evalin('base','zef'); end zef.dataBank.app.Tree.Enable='off'; zef.dataBank.selectMultiple=false; zef = zef_dataBank_getHashForMenu(zef); zef.dataBank.nameChangeapp=zef_dataBank_nameChange_app; zef.dataBank.nameChangeapp.Label_oldName.Text=z...
bc85ba562381077e5a8f9a7da75abc33af07ba4834f3fed73a00392f11e00cc8
MATLAB
973
43
function [C,I] = findmin(A,minnum) %findmin Finds the lowest n values from a vector % syntax: [C,I] = findmin(A,n) % input: % - A: data vector % - n: number of lowest values to be returned % output: % - C: Vector containing lowest values % - I: Vector containing indices of lowest values % % Note: findmin is just an e...
fb718a759e6839f66073f258c06c36fbe9adfdc8ad1bca3a8c0819dcd3337488
MATLAB
973
40
function [varargout] = iff(cond, evalTrue, evalFalse) %IFF 'if' expression implementation % v = IFF(cond, evalTrue, evalFalse) returns 'evalTrue' if 'cond' is true, % otherwise returns 'evalFalse'. % % This enables you to write succint one-liners like: % signstr = iff(x > 0, 'positive', 'negative'); % % Eith...
025806818a208e704931805e15dec70b3c0bf42600679f7b956a814907aa1445
MATLAB
976
21
function [colormap_vec] = zef_monterosso_colormap(colortune_param, colormap_size) color_mat = [26 26 26; 0.2 11.8 13.2; 42.5 98.5 108.5; 203 203 100]; color_mat = color_mat'; c_aux_1 = floor(colortune_param*colormap_size/3); c_aux_2 = floor(colormap_size - colortune_param*colormap_size/3); colormap_vec_aux = [...
3f6ffea6d7be8714b235056b719f938fb73d6db1b1b5510c12bfa5305d53e458
MATLAB
976
23
function [conditional_probability] = calculate_frame_conditional_probability(frame, edge_potentials, node_potentials, z) [num_frames, num_nodes] = size(frame); log_likelihood = zeros(num_frames, 1); %add nodes log_likelihood = log_likelihood + sum(frame.*node_potentials',2); %limit edge_potentials to one triangular...
c420c8c0c551e463c490c84702661b52a64d2535b3c3ae4345cb2b6412bcf44d
MATLAB
977
16
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'inv_synth_source')); zef.inv_synth_source = [0 0 0 1 0 0 10 0 3 1]; end; set(zef.h_inv_synth_source_1 ,'string',num2str(zef.inv_synth_source(:,1)')); set(zef.h_inv_synth_source...
45af4b2557ebdb950546d324ebc2c97de4ef5de7a577f0b2c99a66318c1c2f7e
MATLAB
978
47
% 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_mean(B,args) N_itermax = 100; if (nargin<...
c460e2d344f511913b858bf79fa794dcd41bb877b7d621982a8957f22c80ab8b
MATLAB
979
33
function KLdiv = KLtransition(hmm) KLdiv = 0; if length(size(hmm.Dir2d_alpha))==3 Q = size(hmm.Dir2d_alpha,3); else Q = 1; end % KL divergence for the transition and initial probabilities if Q > 1 for i = 1:Q kk = hmm.train.Pistructure; KLdiv = KLdiv + dirichlet_kl(hmm.Dir_alpha(kk,i)',hmm....
077db37ae439c6c2dedf34dcbe2ff5ae61141b5ae9f9c298b5cdc4613c8b7edb
MATLAB
980
32
function S = openETSbatch( full_path_filename ) % open dataset ets = full_path_filename; % fullfile( path, file ); exp = '\d{8}[a-z]_\d*'; name = regexp(ets,exp,'match','once'); data = bfopen(ets); % creates cell array, frames x 2 metadata = data{ 1, 2 }; [timing,interval] = bfTime( metadata )...
605a7d8252e91057c098ca786906da53a7ca799edf47a424f74006679387cf04
MATLAB
980
27
function [neighborhoods] = initialize_neighborhoods(num_neurons, num_udf, edge_constraints) % Reviewed Darik A O'Neil 04-15-2023 % % Inputs: % num_neurons is a scalar indicating total number of neuronal nodes % num_udf is a scalar indicating total number of udf nodes % edge_constraints is a boolean indicating whether ...
32730c8bc2dae66865658440abe746576698a9d16cc6cc98564410fc26dff274
MATLAB
981
33
function [valueVector,yVector,xVector] = mat2idx(matrix) %mat2idx Transforms a matrix into a triple of indexed vectors; one % vector containing x-locations; one vector containing y-locations; % and one vector containing the value so that v(i) corresponds the % original value of the input matrix at y-location y(i) a...
54c2209a7adb61eddbe4a28d11321ab379dc3f0f3a497ed258be47b71b1ed32d
MATLAB
981
52
% 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] = opttransp_mean(B,args) Imat = size(B,3); N_itermax =...
592014307a0f90c03d7078f4b2a4a9ec2ce1bbfaf733ae8395e40a4bd5aec684
MATLAB
981
48
% A = riemann_median(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_median(B,args) N_itermax = 100; if (nargi...
76647f5baaa6cfacff0b70b8711235d5cfd86b5b3d981db5a3c476afd5a4ea68
MATLAB
982
42
function [node_scores] = grab_node_scores(graph_structure,overcomplete_edges,metric,num_original_nodes,node_score_neurons_only) % Function to grab node scores % Darik O'Neil 12-14-2021 Rafael Yuste Laboratory % % Metric Order: 00(1) 01(2) 10(3) 11(4) if node_score_neurons_only graph_structure = graph_structure(1:...
d402c18c3995f76937ba510d1db5c407ff37fd36b3e0852bad0cc36c58527c77
MATLAB
982
38
function ret = run_cluster_job(file_path, profiler_on) try if profiler_on profile on end ret = cell(0); ret{1} = maxNumCompThreads; %file_path = '/scratch/project_2002680/Kalman/Noise14dB/data/'; %file_path = '/media/datadisk/paavo/thesis_results/TestProject/'; orig_file = 'P20N20_SEP_withbig.mat'; save_file = 'P2...
652d2cb6c35efefbafbdcb52c29f71ff32fbf62398d6503999102cd6bdcd486a
MATLAB
983
41
function zef = zef_dataBank_setData(zef) if nargin == 0 zef = evalin('base','zef') end dbFieldNames=fieldnames(zef.dataBank.tree.(zef.dataBank.hash).data); for dbi=1:length(dbFieldNames) if strcmp(zef.dataBank.tree.(zef.dataBank.hash).type, 'gmm') zef_load_GMM(zef.dataBank.tree.(zef.dataBank.hash).d...
99516ef12e7a2774ff9cf99ea26de9adf9ced27452935c16e8cb241b66619d76
MATLAB
983
22
function EEG = converterET2EEG (ET, ET_stream, EEG_stream) for ss=1:length(fieldnames(ET)) slide_id = strcat('Page',int2str(ss)); for bb=1:length(fieldnames(ET.(slide_id))) BB_id = strcat('Product',int2str(bb)); seg_dur=[]; for iter=1:size(ET.(slide_id).(BB_id),1) ET_i...
50bc38dddd8057df3ae1c60e0f992f7998b43b39b10be5723427b95f0f1ab61d
MATLAB
984
29
% OV_MATLAB toolkit % OV_popOutputBuffer.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % pops the last chunk in the output buffer % MEANT TO BE USED IN OPENVIBE function [box_out, start_time, end_time, linear_matrix_size, linear_data] = OV_popOutputBuffer(box_in, output_i...
d0bd6b2b8f6b565639db999ca61964f0bf260dedb5f4e34ea0039339e5727b6b
MATLAB
984
36
% res = VerifySha1( myobj, filename ) % % Verifies the SHA1 sum of the file specified by filename. % If filename is relative, it is appended to the run dir. % Absolute path/filenames are also supported. Since this is % a potentially long operation, it uses the 'disp' command % to print progress info...
75917238f1136bb927a6cc618cc0d2002803baac473c68d7e80911158c815327
MATLAB
986
33
function [valueVector,yVector,xVector] = mat2index(matrix) %mat2index Transforms a matrix into a triple of indexed vectors; one % vector containing x-locations; one vector containing y-locations; % and one vector containing the value so that v(i) corresponds the % original value of the input matrix at y-location y(...
b97832943e887da62abcf4c1f813dc6f215ba6a7464247806a5284beb1fd05d7
MATLAB
989
25
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isempty(zef.s_points)) zef_process_meshes; end zef_i = length(zef.lf_bank_storage)+1; zef.lf_bank_storage{zef_i}.source_interpolation_ind = zef.source_interpolation_ind; zef.lf_bank_stora...
4d1067ed95cdfbb098eff17c24c73dc0235f51650a652adf5b4c909257af62ca
MATLAB
990
44
function distance_vec = zef_distance_to_mesh(p,nodes,triangles) nodes = nodes'; c = nodes(:,triangles(:,1)); p = p'; v_1 = nodes(:,triangles(:,2))-nodes(:,triangles(:,1)); v_2 = nodes(:,triangles(:,3))-nodes(:,triangles(:,1)); v_3 = cross(v_1,v_2); v_3 = v_3./repmat(sqrt(sum(v_3.^2)),3,1); distance_vec = zeros(1,siz...
89f66b1c81c2614e0c98e73524e1afebb91602687d72272cb9c63ba6c50d79d0
MATLAB
995
19
function zef = zef_fix_sensors_get_functions_array_size(zef) n_sensors = size(zef.([zef.current_sensors '_points']),1); if isequal(n_sensors,0) n_sensors = 1; end if not(isfield(zef,[zef.current_sensors '_get_functions'])) zef.([zef.current_sensors '_get_functions']) = cell(1,n_sensors); end zef.([zef.current_sensors...
19040c0324d912de319cf92d005efd31458341cd7350c2e1eb6046b7dc674c68
MATLAB
996
28
function erp_TANOVA_plot(info_TANOVA,plottype) if nargin<2 plottype = 'clusterperm' ; end hold on switch plottype case 'clusterperm' area(info_TANOVA.time,info_TANOVA.DISS) ; % plot the DISS vs time plot([info_TANOVA.time(1),info_TANOVA.time(end)],... [info_TANOVA.thres...
f83ae960c01fe4a5657dce308be1f4b1366d607c17ebc26ebdfe97d59bef5375
MATLAB
996
39
function h_output = zef_find_object_handles(zef, h_input, h_output, node_name) if nargin < 3 h_output = struct; end if nargin < 4 node_name = 'zef'; end fields = fieldnames(eval(node_name)); for i = 1 : length(fields) aux_string = [node_name '.' fields{i}]; aux_field = eval(aux_string); try ...
1405c0d259cfb00718d108000f5f5ae3db50c489b25bd06a34ed8017d6429269
MATLAB
997
30
load('postprandial_somnolence_branching_parameter') figure for t=1:77 r=normrnd(0,0.1); plot([1.2,1.8],[wakefulness_ratio(t),drowsiness_ratio(t)],'--o','linewidth',1,'color',[0.7+r,0.7+r,0.7+r],'MarkerFaceColor',[0.7+r,0.7+r,0.7+r]) hold on end h=boxplot(wakefulness_ratio','positions',[1.2],'colors...
8868573b529244af9d1756f956d4117ca5c67dcc34a9f9e4bbb79207301b9f54
MATLAB
997
29
function [models] = pre_allocate_models(params) z=1; for j = 1:numel(params.s_lambda_sequence) for k=1:numel(params.p_lambda_sequence) model.s_lambda = params.s_lambda_sequence(j); model.p_lambda = params.p_lambda_sequence(k); model.structure = params.learned_structu...
10b8dc66cca2ed4d52ed2e2475c4e643bdc7baaaa8d5814afffc1642dd7f5554
MATLAB
998
14
function [colormap_vec] = zef_contrast_2_colormap(colortune_param, colormap_size) c_aux_1 = floor(colortune_param*colormap_size/3); c_aux_2 = floor(colormap_size - colortune_param*colormap_size/3); c_aux_3 = floor(colormap_size/2); colormap_vec = [([20*[c_aux_3:-1:1] zeros(1,colormap_size-c_aux_3)]); ([15*(colormap_si...
b10851db19714ba977325eb0d961c8a09164e6b9a712aa605d3c20753cdf779f
MATLAB
998
33
function strGreek = getGreek(intChar,strUpLow) %getGreek Get Greek letter; 1=alpha,25=omega % strGreek = getGreek(intChar,strUpLow); e.g., "getGreek(1,'lower')" %OR: % strGreek = getGreek(strChar,strUpLow); e.g., "getGreek('rho','upper')" if ~exist('strUpLow','var') || isempty(strUpLow) if ischar(intChar) ...
41ccfb939354aee0b521385f99dc89cb0c13f407f2a6f6312b2343470fe75d23
MATLAB
999
30
function vec = zef_ES_error_criteria(zef) if nargin == 0 zef = evalin('base','zef'); end %% Variables and parameters setup load_aux = eval('zef.y_ES_interval'); B = cell2mat(load_aux.residual); B = B/max(abs(B(:))); E = cell2mat(load_aux.field_source.relative')'; F = cell2mat(load_aux.field_source.magnitud...
c4aca752022263b5c28c2335723530c6e6327e7c6f5e1e8312c835a5d6fdf15d
MATLAB
999
37
function h = scatterim2(X,Y,images,scales) % Make a 2-D scatterplot using one or several images as glyphs % % h = scatterim2(X,Y,images,scales) % % Images are painted at the locations of pairs (x,y) from the vectors X and % Y. Images can be either a cell array of images or a single image. An % image can either be scala...
2edfd77fcf8588bb7fd853ecfa82f7c5ff453285b300196c4c0384b0f7b5546e
MATLAB
1,001
33
function zef = zef_strip_tool_delete(zef) struct_aux_1 = cell(0); struct_aux_2 = zef.([zef.current_sensors '_strip_cell']); strip_id = struct_aux_2{zef.strip_tool.current_strip}.strip_id; domain_type = 'sensor_info'; if isfield(zef, zef.([zef.current_sensors '_get_functions'])) for i_ind = 1 : length(zef.([zef.curre...
2080f7b377c3a7fdd2fdfa842f35c1f378353be83a5eb3b5ea8916d185461b47
MATLAB
1,002
42
function slider_value_new = zef_update_colorscale_max(varargin) if isequal(evalin('caller','exist(''zef'')'),1) zef = evalin('caller','zef'); else zef = evalin('base','zef'); end if not(isempty(varargin)) h_figure = varargin{1}; else h_figure = eval('zef.h_zeffiro'); end h = findobj(get(h_figure,'Chi...
49ef2175ecd531aba77f7e42f61bcf6a5c4f66899a8a0aa419ccf0f2235672ab
MATLAB
1,003
25
zef_create_dipolar_pair_update_struct; if isfield(zef,'h_create_dipolar_pair_arrow') delete(zef.h_create_dipolar_pair_arrow); end zef.aux_field = sqrt(zef.create_dipolar_pair_ori_x.^2 + zef.create_dipolar_pair_ori_y.^2 + zef.create_dipolar_pair_ori_z.^2); zef.create_dipolar_pair_ori_x = zef.create_dipolar_pair_or...
9fc9fcbe67c819ac0c739b201cc73ca51c2e78e7e4cfc02c326c89ee58139b1c
MATLAB
1,004
38
function [residuals,W] = getresiduals (X,T,Sind,maxorder,order,orderoffset,... timelag,exptimelag,zeromean,W) % % Compute residuals - useful when using a global model to remove global trends % % INPUT % X time series % T length of series % % % OUTPUT % residuals % W % % Author: Diego Vidaurr...
72cde67da390a4419420d815ef40a1db837da9df69d2cc1493d2eef51a14fed7
MATLAB
1,006
32
% crop in x-y plane: get crop from max/sd projection, crop stack function [ cstack, rectout ] = cropStack( stack ) % cstack is the cropped stack % J are the coordinates selected by the user %maxpro = projectMax( stack ); [meanp,maxp,stdp]=projMeanMaxSTD(stack); %maxpro = histeq( maxpro ); minp = min(meanp,[],'all'); im...
e070f4bdcff93907c175943ef90344534635b6118269b05555e0c16d8814e64d
MATLAB
1,007
32
%% load('postprandial_somnolence_lifetime') figure for t=1:77 r=normrnd(0,0.1); plot([1.2,1.8],[wakefulness_life_time(t),drowsiness_life_time(t)],'--o','linewidth',1,'color',[0.7+r,0.7+r,0.7+r],'MarkerFaceColor',[0.7+r,0.7+r,0.7+r]) hold on end h=boxplot(wakefulness_life_time','positions',[1.2],'c...
f0f4d074bd42c4aaaa1e0b6362b21205214ff3cdc4a6a7a8290e2a497a57a364
MATLAB
1,008
31
function plot_training_optimization_structural_learning(app) %need models = app.model_collection.models; model_stats=characterize_learned_models(app.model_collection.models); interpolated_s_lambda = linspace(min(model_stats.s_lambda), max(model_stats.s_lambda), 100); interpolated_p_lambda = linspace(min(model_sta...
25866717c0b5c7dfa75a33f5091d5ad881b4b6d9ca515a5fc42c1577a773cabe
MATLAB
1,009
23
function [frame_log_likelihoods] = compute_log_likelihood_no_loop_by_frame(nodePotentials,edgePotentials,logZ,samples) %Function to compute frame-wise log_likelihood %Initialize [sampleCount,nodeCount] = size(samples); log_likelihood = zeros(sampleCount,1); %add nodes log_likelihood = log_likelihood + sum(samples.*no...
289fe236c1a28bdf1ea0f9a225d6da0773671658ceec82a40f0ea37c711e68d7
MATLAB
1,012
26
function [p_lambda_sequence,s_lambda_sequence_glm,glm_options] = generate_lambda_sequences(p_lambda_count,p_lambda_min,p_lambda_max,p_lambda_distribution,s_lambda_count,s_lambda_min,s_lambda_max,s_lambda_distribution,params) %Generate pLambda Sequence if p_lambda_distribution p_lambda_min_exp = log10(p_lambda_min)...
8427a784524eed3d5099c9835410c43a76d01943aa1e1945e4dfd816d9e2545b
MATLAB
1,013
47
function zef_set_lights(lights_vec,varargin) if isequal(evalin('caller','exist(''zef'')'),1) zef = evalin('caller','zef'); else zef = evalin('base','zef'); end if not(isempty(varargin)) h_1 = varargin{1}; else h_1 = eval('zef.h_axes1'); end delete(findobj(h_1.Children,'Type','Light')); for i = 1 : l...
43cd1e59e7fe4e2554fadfa03949f582ceccf94a49ec2dfc678ee1c89b7083d5
MATLAB
1,014
29
% OV_MATLAB toolkit % OV_popOutputBufferReshape.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % pops the last chunk in the output buffer % MEANT TO BE USED IN OPENVIBE function [box_out, start_time, end_time, linear_matrix_size, linear_data] = OV_popOutputBufferReshape(bo...
96b6d4ecdc291566bbb1a61340998cfab7123079df4fc8cd73e98554658ec1fa
MATLAB
1,015
35
function List = adjMatrixToList(A, listForLinksIn) %% Convert the adjacency matrix A to an adjacency list of who the connected nodes are, % for connections into each node iff listForLinksIn == true, else % for connections out of each node iff listForLinksIn == false. % Node pair is considered connected iff A(i,j) ~= 0...
3af726ff8d7cc91b6dcedb3eeb64ec1187aacdf21e1eb7f684f0365b84f458f5
MATLAB
1,017
28
classdef BCFW < AbstractFW methods function th = BCFW(objective, varargin) th = th@AbstractFW(objective, varargin{:}); th.algo_name = 'BCFW'; end function step_size = iter(th, t) m = randi(th.objective.M); ...
76ef35f82b1875c5f949ad78b06710520a413c0e485ff1d7b4c52c14726a53de
MATLAB
1,017
38
function varargout = dimfun(intSplitDim,hFunc,matData,varargin) %dimfun Performs hFunc over matrix split by supplied dimension % varargout = dimfun(intSplitDim,hFunc,matData,varargin) %split into cells vecSize = size(matData); strSplit = ''; for intDim=1:numel(vecSize) if intDim==intSplitDim strSplit = s...
945b550c18352d8311291ee059308bd958d727dac159a2bfb8dc1c4952e4a69e
MATLAB
1,017
35
function V = pcapred_decomp (X,T,options) % it assumes that X is centered is_cell_strings = iscell(X) && ischar(X{1}); is_cell_matrices = iscell(X) && ~ischar(X{1}); is_struct = ~is_cell_strings && ~is_cell_matrices && isstruct(X); orders = formorders(options.order,options.orderoffset,options.timelag,options.exptimel...
0950169ccc8742d19e1684179c0199172a59d38eb96384ce531dfab4c4e13f0e
MATLAB
1,019
15
zef.use_gpu_graphic = get(zef.h_use_gpu_graphic,'Value'); zef.parcellation_type = get(zef.h_parcellation_type,'Value'); zef.parcellation_quantile = str2num(get(zef.h_parcellation_quantile,'Value')); zef.cone_lattice_resolution = str2num(get(zef.h_cone_lattice_resolution,'Value')); zef.cone_scale = str2num(get(zef.h_con...
74a62d66247536881b3855de0dbfa4546321a0706028609bc044845034289410
MATLAB
1,022
47
function ETC_preload(varargin) %get globals global sETC; global sFigETC; %% lock uilock(sFigETC); sFigETC.ptrButtonPreload.UserData = 'closed'; sFigETC.ptrButtonPreload.Enable = 'off'; sFigETC.ptrButtonPreload.Value = 1; %% redraw image %msg hWaitbar = waitbar(0,sprintf('Loading frame %d/%d',1,sETC.int...
5a6ce78cf6dbe6f9ed11b020830a301fa68d872abdbb552adc7a43d359e7f0d8
MATLAB
1,024
36
function sETO = ETO_populateStructure(sETO) %ET_populateStructure Prepares EyeTracker parameters by loading ini file, % or creates one with default values %check for ini file strPathFile = mfilename('fullpath'); cellDirs = strsplit(strPathFile,filesep); strPath = strjoin(cellDirs(1:(end-2)),filesep); strI...
683889743302e7f47ba3144e9f351304deaa9f4983d9e2f912a45f0597dca102
MATLAB
1,025
33
%% make all reconstructions %set all parameters! % beamformer app needs to be open and set to 'Locations' %choose node to add to %enjoy! %mne [zef.reconstruction, zef.reconstruction_information]=zef_find_mne_reconstruction; zef_dataBank_addButtonPress; %sLoreta [zef.reconstruction, zef.reconstruction_information]=z...
b69385be4b9e9993f8fdb438d7f56b517cb85711e5f69105f4bc76b1309e5b22
MATLAB
1,025
30
function expl_var = explainedvar_singleMAR(X,T,options) % Tells how much variance (between 0 and 1) explains a (maximum-likelihood) % MAR model on data X, parametrised by options % % Author: Diego Vidaurre, OHBA, University of Oxford (2016) ndim = size(X,2); N = length(T); if ~isfield(options,'order'), error('order w...
5cda3bc46e2fbf3c8e7d12e3beed47056c6bd583100e0743ce5f7fd67cd150af
MATLAB
1,026
37
function c = redgreen(m) %redgreen Shades of red and green color map % redgreen(M), is an M-by-3 matrix that defines a colormap. % The colors begin with bright blue, range through shades of % blue to white, and then through shades of red to bright red. % redgreen, by itself, is the same length as the current...
1684ed6306b79952bec5cfc530c53f766999b5a801083c09fb6ad9cfe2ee2454
MATLAB
1,030
40
function wrapped_startup(app) params = app.params; %pull current params filename = app.file_data; [~,name,~] = fileparts(filename); data_directory=pwd; data_directory = strcat(data_directory, filesep); %Source Directory %source_directory = uigetdir(pwd,'Select Programs Directory'); source_directory=pwd; source_dir...
b89d872ee0624adc85461a5d2ee2421ebc75f650689656361bc0775e59f9de4f
MATLAB
1,030
40
z_inverse_results = cell(0); data_tree = zef.dataBank.tree; rec_ind = 1; fn = fieldnames(data_tree); for k=1:numel(fn) node = data_tree.(fn{k}); if (strcmp(node.type, 'reconstruction')) rec = node.data.reconstruction; z_inverse_results{rec_ind} = rec; rec_ind = rec_ind + 1; end en...
0465ab98cc72a826efabe832f6b62e7467ca153056f50882ebf7bbf5d9ea6ceb
MATLAB
1,033
39
function zef = zef_ES_find_currents_recursive(varargin) switch nargin case {0,1} if nargin == 0 zef = evalin('base','zef'); else zef = varargin{1}; end % UnFixing Electrodes zef.h_ES_fixed_active_electrodes.Value = 0; zef_ES_optimization_update; zef.ES_active_electrodes = zef_ES_fix_active_electrodes(zef); % 1st s...
c19e7d69b476547a6308ef2e2765c960bd8528c30f3b6f60facfd48c4de367a7
MATLAB
1,033
23
function [processed_data] = zef_simple_downsampling_filter(f, downsampled_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 time %steps. The other arg...
ffb0c2c67979caa35c4d9339391b549852319e4cf7428f942a59d0a603bd6407
MATLAB
1,034
34
% Display measured/predicted/corrected EMI spectra % ========================================================================= clear all;close all;clc; root = '~\Deep Learning based EMI Elimination Codes and Data\'; dir = [root 'demo\results\']; sub_file = {'label','output'}; Nfile = size(sub_file,2); ksize = [128 ...
baa24661c0c14814150acca9debd0c6414392d6f317958963230a81d66c54355
MATLAB
1,035
31
function [varDataOut,vecUnique,vecCounts,cellSelect,vecRepetition] = label2idx(varData) %label2idx Transforms label-entries to consecutive integer-based data %Syntax: [varDataOut,vecUnique,vecCounts,cellSelect,vecRepetition] = label2idx(varData) varDataOut = nan(size(varData)); vecUnique = uniquetol(varData,1e-10...
217cc5d2cd30f87d328282038736762cb815d8408e6588b6ccd1f73cf088fed6
MATLAB
1,036
21
function [dataOUT]=correct_bad_lines(dataIN) %%R.S: Modified on 09/25/18 if isempty(dataIN.Stimuli.bad_lines) || isfield(dataIN.Stimuli, 'bl_status') dataOUT = dataIN; else bad_lines = dataIN.Stimuli.bad_lines(end:-1:1); dataOUT=dataIN; %Remove the bad lines lines=dataIN.spikes{1}(~ismember(...
746fa8423c899b620f64d874aa16cabcce9a3f76111dde65cd98dc63c6b62013
MATLAB
1,036
37
function [sx, b0] = update_model_variance(tau, data) % update variance for spike model % --- % [sx, b0] = update_model_variance(tau, data); % --- data in spike window % data.a : spike amplitude % data.b : bias of spike data % data.y : y(k,n) : window data % data.Dt : Dt(k,n) = t(k,n) - T(k) % -...
9f877e9405b1c6a9463fa4e68b889ab7f64583ce916023814a296ffbfd5e86b8
MATLAB
1,037
35
function zef_simple_plot_sphere_max(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. if not(isempty(varargin)) radius_val = varargin{1}; if length(varargin) > 1 color_val = vara...
dd830814f3f1bcd642aa37097d82380c82a1a546870c2d8e6c4976fe0489eeb1
MATLAB
1,037
29
function [hmm,Gamma,order] = hmmorder(hmm,Gamma,T,indexes) % Reorder the states according to their mean ocurrence % % Author: Diego Vidaurre, OHBA, University of Oxford (2019) exponent = 5; % this is to boost the main peak K = size(Gamma,2); mGamma = getFractionalOccupancy (Gamma,T,[],1); if nargin>3, mGamma = mGamma(...
804e0e1effa855fedff282676cb1bcdbae24f8265443de70f159864053390eed
MATLAB
1,038
28
function fnames = realign_nifti(raw_nifti_folder, folder_name, rid_list, modality) if ~exist(folder_name,'dir') mkdir(folder_name); end listing = dir(raw_nifti_folder); fnames = {}; for i=1:length(listing) if ~listing(i).isdir && strcmp(listing(i).name(end-3:end), '.nii') rid = regexp(listing(i).name,'...
c98ca1a7f29e306e3cbfe6613b3bac7b1a160f50e5627bdfb5fc18b9ac01e029
MATLAB
1,038
62
function v = zef_surface_scalar_vector_Fn(nodes, tetra, n_ind, scalar_field) % % zef_surface_scalar_vector_Fn % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - n_ind % % TODO: explanation. % % - scalar_field % % TODO: explanation. % % ...
eb12b6fc8944f98b571ef646aca01992bdfc2e90721e88cf3af1098f2a87fba2
MATLAB
1,038
36
function [data,M] = leakcorr (data,T,order) % Correction for volume conduction, when working with source space M/EEG % If order > 0, it performs Pasqual-Marqui's method (order refers to the MAR order) % Pascual-Marqui et al. (2017) % If order < 1, it performs symmetric orthogonalisation as specified in % Colclough...
c2a62b0897af4dddc2a602935953ac054cf0bfdc858f8d2220ca85e341c34407
MATLAB
1,039
32
function [spike_num] = evaluate_spike_number(spike_info) % evaluate spike number at evaluation sampling frequency % [spike_num] = evaluate_spike_number(spike_info) % --- Estimated spike info for overlap window % spike_info.spike_num(n) = estimated spike number of n-th overlap window % spike_info.twin{n} = tim...
ad001f11d0c512cd4d7dd77a510a6d77a57e9dbaf0f43f1f39ded2b3539569d5
MATLAB
1,040
25
function [ptrPanel,ptrSliderFrame,ptrEditFrame] = ETP_genMovieSlider(ptrMainGUI,vecLocation,sETP,sFigETP,fCallback) %% set constants %unpack location vector dblSliderWidth = 0.8; dblSliderHeight = 0.5; %% make panel ptrPanel = uipanel('Parent',ptrMainGUI); vecColor = get(ptrMainGUI,'Color'); set(ptrPanel,'P...
c2a6369c70701f526dfcc04223d93c4cf1652cc9caa9378152c21f332c51e04d
MATLAB
1,044
37
function c = redgreenyellow(m) %redgreenyellow Shades of red and green color map % redgreenyellow(M), is an M-by-3 matrix that defines a colormap. % The colors begin with bright blue, range through shades of % blue to white, and then through shades of red to bright red. % redgreen, by itself, is the same len...
c1f97323f4b0a4631dc7079eb9a9d755a9197253e5702850aa779e8ed264ac67
MATLAB
1,045
35
function zef_simple_plot_sphere_min(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. if not(isempty(varargin)) radius_val = varargin{1}; if length(varargin) > 1 color_val = vara...
1a60ee40d79882d410a42485357c0172dd574b173bd2adadb3ed69d4168db39f
MATLAB
1,049
31
function perDISRIB=bsliang_generatepermuteDISTRIB(inmat,LR_ind,Npermute) perDISRIB=nan(4,2,2,Npermute); % 4*block, 2*turn, 2*LR_ind, Npermute % inmat: block(4)*turn(3)*subj(197) % permute inmat wb=waitbar(0,'permuting'); for nper=1:Npermute wb=waitbar(nper/Npermute,wb,'permuti...
a0d8ac0d3932b3d239aa28481c08ec2b29380ef1b638c51e4f3b21d55aec3fad
MATLAB
1,049
26
for zef_LeadFieldProcessingTool_index=1:zef.LeadFieldProcessingTool.bankSize if zef.LeadFieldProcessingTool.app.BankTable.Data{zef_LeadFieldProcessingTool_index, 6} zef.LeadFieldProcessingTool.bank2auxIndex=zef_LeadFieldProcessingTool_index; zef_LeadfieldProcessingTool_bank2aux_bank2auxIndex; ...
6112597c2bd6879e4dbe4e613adbf07d913c030c7d21dcc4b97329793320952b
MATLAB
1,050
39
function vp = padVP(vp,T,options) % Unless a Gaussian distribution is used to describe the states, the state % time courses are shorter than the data time series. % This function adjusts the Viterbi path to have the same size than % the data time series, padding the Viterbi Path with NaN. % % Author: Diego Vidaurre,...
9f7b919d32b205064e8dab623a447c40c0fb00d2565c75374a6eef185ca3a76d
MATLAB
1,053
42
%-------------------------------------------------------------------------------- % create_maze.m % % This demo is included in % Canonical neural networks perform active inference % Takuya Isomura, Hideaki Shimazaki, Karl J. Friston % % The MATLAB scripts are available at % https://github.com/takuyaisomura/reverse_eng...
e376f61e9d571221d52253b942133a94da074d6f72aa8a663a9b6dfc9fe1e3d5
MATLAB
1,053
32
function simfun = map_similarity_funhandle(modality,keeppolarity) if nargin < 2 keeppolarity = false ; end if keeppolarity switch modality case 'eeg' simfun = @(x,c) ( (x./vecnorm(x,2,2)) * ((c-mean(c,2))./vecnorm((c-mean(c,2)),2,2))' )' ; case 'meg' simfun = @(x,c) ...
4894067edd4a8cb36e5e71f8595256bb02f047ffc30c3eab3705656ac4ae4dd8
MATLAB
1,056
30
function matD = getCohensD(mat1,mat2,intDim) %getCohensD Calculates Cohen's d measure of effect size % matD = getCohensD(mat1,mat2,intDim) %check input format matD = nan; if isempty(mat1) || isempty(mat2),warning([mfilename ':InputEmpty'],'Input empty; returning NaN');return; %if empty elseif ndims(mat1) == 2...
21b8ea0f5e0830a29194776c293d8fc4f999dad3a8d6fd056e014c6ad1a06af2
MATLAB
1,059
17
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.mne_prior = get(zef.h_mne_prior ,'value'); zef.mne_type = get(zef.h_mne_type ,'value'); zef.mne_likelihood_snr = zef.inv_snr; zef.mne_sampling_frequency = str2num(get(zef.h_mne_sampling_frequency,'...
4a8b42a400c8d5c4e47b795189b1d85615e97102d84f94e389b648ebf568ee21
MATLAB
1,059
48
function [Ytest d C] = kmeanscov(Ctest,Ctrain,Nclass,varargin) if isempty(varargin) method_mean = 'riemann'; method_dist = 'riemann'; else method_mean = varargin{1}; method_dist = varargin{2}; end % initialisation Ntrial = size(Ctrain,3); Y_old = zeros(Ntr...
c70781e0b282079c93604d52762738330b44e2e93959579ed7dfe93d586c76d2
MATLAB
1,059
25
if get(zef.h_iasroi_roi_mode,'value')==1; set(zef.h_iasroi_plot_roi,'enable','on'); set(zef.h_iasroi_plot_source,'enable','on'); set(zef.h_iasroi_roi_sphere_1,'enable','on'); set(zef.h_iasroi_roi_sphere_2,'enable','on'); set(zef.h_iasroi_roi_sphere_3,'enable','on'); set(zef.h_iasroi_roi_sphere_4...
17a82ea6c3437e449df1af57a05187e311ae5ee18f17aa89d37a772d550e0d8b
MATLAB
1,060
38
function matOut = imcontrastx(matIn,dblContrast,dblBaseline) %imcontrast Change contrast of image % matOut = imcontrast(matIn,dblContrast,dblBaseline) % % matIn can be matrix of class uint8 or double in range [0-1]; % dblContrast will change contrast by this factor (0.5 will half the % contrast); dblBaseline is...
3ed1bc354b59c0e04965df3e75f4f28c26db28c4ca212737e2fb1d43db1a9f6a
MATLAB
1,061
39
%Script for initializing possibly invisible advanced plotting options for GMM app. if ~isfield(zef,'GMM_comp_ord') zef.GMM_comp_ord = 1; end if ~isfield(zef,'GMM_dip_comp') zef.GMM_dip_comp = []; end if ~isfield(zef,'GMM_ellip_comp') zef.GMM_ellip_comp = []; end if ~isfield(zef,'GMM_dip_num') if isfiel...
460577bb1024090dcbf9fde3756c69aaa9c1602027d019938275d1126884c4b7
MATLAB
1,062
44
%% initialize clear; clc; disp(' Copy original files >> '); pathCurrent = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives dirPrep = 'spm-preproc'; mkdir(dirPrep); cd(dirPrep); pathPrep = pwd; cd(pathCurrent); %% make directories BIDS = spm_BIDS(pathBIDS); subdir = BIDS.participants...
838592d7f1dc5086601373d5c4bc42b5a938a0478b8af98fd214a7f1c0332b3c
MATLAB
1,064
49
% A = riemann_trimmed_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_trimmed_mean(B,args) N_itermax = 10...
8bed6cba92d38647fc9bfcf763e7fa14a265dc32cb9e8a0066b36c9669b3261c
MATLAB
1,067
46
function [tetra_ind_out, face_ind_out] = zef_find_adjacent_tetra(tetra,tetra_ind,face_ind) tetra_ind = tetra_ind(:); face_ind = face_ind(:); ind_m = [ 2 4 3 ; 1 3 4 ; 1 4 2 ; 1 2 3 ]; tetra_ind_out = tetra_ind; face_ind_out = face_ind; triangles = zeros(length(tetra_ind),3); for i = 1 : 3 I = sub2i...
e7a8142d535c2b6e1d70a9df223cbfaf28481d5f9e95416db58f9447ce67a043
MATLAB
1,067
43
if not(isfield(zef,'GMModel')) zef.GMModel = struct; end if not(isfield(zef.GMModel,'frame_number')) zef.GMModel.frame_number = 1; end if not(isfield(zef.GMModel,'max_n_clusters')) zef.GMModel.max_n_clusters = 20; end if not(isfield(zef.GMModel,'credibility')) zef.GMModel.credibility = 0.90; end i...
5668a504fafa794427718b3b0b2ed1570078a19b7c84ab95c7f090dce8f14647
MATLAB
1,068
35
function zef_plot_GMModel_max(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. if not(isempty(varargin)) color_val = varargin{1}; else color_val = 0.7*[0 1 1]; end [X_0,Y_0,Z_0] = sph...
360061c3f6e3c594d5edef36e725d7776180b215d87c207ec12e88e7416a8ba2
MATLAB
1,071
24
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if isfield(zef,'h_lf_bank_tool') if isvalid(zef.h_lf_bank_tool) set(zef.h_lf_item_list,'Value',cell(0),'Items',cell(0),'Multiselect','on'); end end zef.lf_item_list = cell(0); for zef_...
981eb5044aaf4e91b32fe2ab9943a5d323a78210ccc09eea7c67e8e2231adc5b
MATLAB
1,071
27
function wrap_seeds_into_optimization(app) params = app.params; model_collection = app.model_collection; model_stats = characterize_learned_models(model_collection.models); s_lambda = optimizableVariable('s_lambda', [params.s_lambda_min, params.s_lambda_max], 'Type', 'real'); p_lambda = optimizableVariable('p_lambda'...
45410c0ab4345fffdd5bc77f1700b2d46ecb8f49c807223531c0ecd57a584b13
MATLAB
1,073
39
% myobj = SetMetaData( myobj, metadata_struct ) % % If a run is in progress, set meta data to be added to the % next output file set. Meta data must be in the form of a % struct of name/value pairs. % function [s] = SetMetaData( s, meta ) if( ~isstruct( meta ) ) error( 'Argument to SetMetaData ...
d90e0f189c8b7919720fc7571ec6377055a892d371dc987faa92906bbd8d22ef
MATLAB
1,073
46
function [plv, f] = PLV_nerve(spikes,stim,fs,TW) %% Calculate PLV from spike data %Sooo, how should I do this .... %Gonna start with treating each spike like a delta function and see how %well this train of deltas phase lock to a stimulus %fs = sampling rate of stimulus %spikes = in Nel format %stim = vertical vector %...
03fb4bbdaef4781e969f88e65ffb40783128300978f2362bb234eb886e6dd5f9
MATLAB
1,074
31
function strPath = ET_getIniPath() try if isdeployed && ismac NameOfDeployedApp = 'EyeTracker'; % do not include the '.app' extension [~, result] = system(['top -n100 -l1 | grep ' NameOfDeployedApp ' | awk ''{print $1}''']); result=strtrim(result); [status, result] = system(['ps xuwww -p ' result ' | t...
1ce16a1ec47ad31e7dd7bd245225ed50ee23bd7a7d1ca6542b2a6759a4eb7bdc
MATLAB
1,074
36
%Copyright © 2019- Sampsa Pursiainen & GPU-ToRRe Development Team %See: https://github.com/sampsapursiainen/GPU-Torre function [nodes,triangles,interp_vec] = zef_triangular_mesh_refinement(nodes,triangles) eps_val = 15; n_nodes = size(nodes,1); n_triangles = size(triangles,1); nodes = [nodes; (1/2)*(nodes(trian...
a6277f423a7fc83c70382b616b96c495cbf2cea4a9bde81e9364ca61cd06f8b7
MATLAB
1,076
34
%Copyright © 2018- Joonas Lahtinen, Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef_GMM_export(save_file_path,GMM,saved_ones) if not(isempty(save_file_path)) && prod(not(save_file_path==0)) [zef_aux_file,zef_aux_path] = uiputfile('*.mat','Select Gaus...
24756d0f811cad95e8dba047726243fd9d6ca99d4abe5c524f1aa1545fd5e5ff
MATLAB
1,079
18
function [condition_number, volume, longest_edge] = zef_condition_number(nodes, tetra) ind_m = [1 4 7; 2 5 8 ; 3 6 9]; Aux_mat = [nodes(tetra(:,1),:)'; nodes(tetra(:,2),:)'; nodes(tetra(:,3),:)'] - repmat(nodes(tetra(:,4),:)',3,1); volume = (Aux_mat(ind_m(1,1),:).*(Aux_mat(ind_m(2,2),:).*Aux_mat(ind_m(3,3),:)-Aux_mat(...
4bff212f9cf576ae0ca2736a92842ba735e2beaa126b09d1ca282c4635a3ccac
MATLAB
1,079
27
function zef = zef_ES_recursive_search(zef, num_lattice) zef.ES_step_size = num_lattice; zef_ES_find_currents; adapted_y_ES{1} = zef.y_ES_interval; original_window = zef.ES_step_size; adapt_instances = zef.ES_step_size; % M = Number of adaptive instances adapt_window = 40; % K = Size of the adaptive wi...
7e3b2842ef4aa2cc81a83e88d63cfb9c36aed0eb1334a5216ebb91410835b1de
MATLAB
1,079
30
function generate_optimization_plot(app) app.optimization_plot = axes('Parent',... app.OptimizationPanel, 'Units', 'pixels', 'OuterPosition',... [21 192 860 518], 'InnerPosition', [60.4 27.4 815.6 663.3],... 'Box', 'on'); app.optimization_plot.Title.FontName = 'Arial'; app.optimization_plot.Title.Font...
0d8d8bdbe23971571e4228f7298e8ed49abbc001021b5ba794bfc290d1a60044
MATLAB
1,082
38
function [residuals,W] = getresidualslogistic (X,T,Ydim) % % Compute residuals - for logistic models this amounts to just saving the % data Y values (class labels) being predicted. % % INPUT % X time series % T length of series % % % OUTPUT % residuals % % Author: Diego Vidaurre, OHBA, Universit...
9540c61ac9494225f1432ebe8fe482b4d7fa106fe0568b8bad961a6def06c2c2
MATLAB
1,082
31
% ´ÓÊý¾ÝÀï»ñÈ¡steps£º % load DATA % steps=sort(DATA(5).Id_Di.data(1,1,1).rawdata(:,1))'; steps=[1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5]; ls=length(steps); sim_n=10000; curves=nan(5,sim_n); slopes=...
c6aec701f0a56a41167b263aab147fb6a28f738fddc7f5f920d87a88044da9dd
MATLAB
1,086
51
clear load('Mseq_IAC_ITD.mat') EEG_fs=4096; Sound_fs = 48828.125; IAC_val = 1; ITD_val = 500e-6; EachPoint = 2441/Sound_fs; %each point in M_seq is roughly 50ms AddPoints_ideal = EachPoint*EEG_fs; AddPoints = round(EachPoint*EEG_fs); CompensateEvery = ceil(1/(AddPoints - AddPoints_ideal)); Mseq_sig =...
4f859e1991716d5a87f1ad1ebaf94e25fea698c3e1d854f8eafcd0342865f9f6
MATLAB
1,089
74
function M = zef_volume_scalar_matrix(nodes, tetra, scalar_field, weighting) % % zef_volume_scalar_matrix % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - scalar_field % % TODO: explanation. % % - weighting % % TODO: explanation. % % ...
77c5db7a02b6d19e8035414837e8da516fd8e4e6f4fd5414262e3c27a8866724
MATLAB
1,089
42
function wrapped_run_all(app) % panel one if isempty(app.is_validated) validate_data_button_pushed(app); end unlock_buttons(app, app.params.stage); % panel two A app.TabGroup.SelectedTab = app.SLTab_2; app.TabGroup2.SelectedTab = app.StructuralLearningTab; perform_stru...