sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f410e51fda825e00ff995664fe488eab48f8f60da311c6aa5e4649a93debfec0
MATLAB
1,089
41
function [neighbours,neighboursp] = SESAMEneighbours(V) radius = 1.5 * ((max(V(:,1))-min(V(:,1))) * (max(V(:,2))-min(V(:,2))) * (max(V(:,3))-min(V(:,3)))/ size(V,1) ) ^(1/3) ; neighbours = compute_neighbours(V, radius); neighboursp = compute_neigh_prob(V, neighbours, radius); end function [ NProb] = compute_neigh_pro...
83f8bac317e57a59ba600533c450f5c58bb8b5e77eed73920d914e9e5e99bdaa
MATLAB
1,092
47
function [C,I] = findmax(A,maxnum) %findmax Finds the highest n values from a vector % syntax: [C,I] = findmax(A,maxnum) % input: % - A: data vector % - maxnum: number of maximum values to be returned % output: % - C: Vector containing highest values % - I: Vector containing indices of highest values % % Note: findma...
1c73f24c1923650160ca185cb6791c207fd74653809d8fede100f99a50494882
MATLAB
1,093
27
function S = getROIvalues( image, h ) % return values for ROIs, deadzones, and penumbra % h contains handles for ROI polygons, more crucially the masks!!! % image is the image % S contains a value for the mean of ROI, pen and pensub nROIs = size( h, 2 ); % number of ROIs for j = 1 : nROIs % loop over each ROI, ...
f65a87ba00c0c360c17ba2cfc3c172b40868e75ca1ce55cec2647d4134296174
MATLAB
1,093
35
function zef_close_all(zef) if nargin == 0 if evalin('base','exist(''zef'',''var'')') zef = evalin('base','zef'); end end zef.h_window_aux = findall(groot,'-regexp','Name','ZEFFIRO Interface*'); %zef.h_window_aux = findall(groot,'-property','ZefTool','-or','-property','ZefFig'); set(zef.h_window_aux,...
2754613de4f57d86efa2e7e14bed8feb153e06183ec69721f5e14cea4b780dad
MATLAB
1,095
15
function [colormap_vec] = zef_contrast_1_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); colormap_vec = [([20*(colormap_size/3)*[c_aux_1:-1:1]/c_aux_1 zeros(1,colormap_size-c_aux_1)]); ([15*(colormap_size/3)*[1...
28f246feaf1caaa3024b84bcfc01a7c08560d3e3c5bc213fb7fd52e0e3e22c89
MATLAB
1,098
35
function patch_data = zef_set_surface_resolution(zef,patch_data,surface_resolution) if not(isempty(patch_data.vertices)) mesh_res = eval('zef.mesh_resolution'); area_val = sum(sqrt(sum(cross(patch_data.vertices(patch_data.faces(:,2),:)'-patch_data.vertices(patch_data.faces(:,1),:)', patch_data.vertices(patc...
129e6cd70a0b9b2a1064b630c073704c8e60c703afb7f9bba83cfbbecd1b64a9
MATLAB
1,100
44
%-------------------------------------------------------------------------------- % mdp_risk.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...
40de7ebbbd6299bea36bda4d06a413a7d072835a45ea97d6de00d50ae196f2c5
MATLAB
1,100
28
function [dip, p_value, xlow,xup]=HartigansDipSignifTest(xpdf,nboot) % function [dip,p_value,xlow,xup]=HartigansDipSignifTest(xpdf,nboot) % % calculates Hartigan's DIP statistic and its significance for the empirical p.d.f XPDF (vector of sample values) % This routine calls the matlab routine 'HartigansDipTest' th...
6db290c2e627761c7789d91886d19989148392907634fc4801e55fe20b43c624
MATLAB
1,101
48
function zef_update_signal_parameters_table(zef, signalStruct) if isempty(signalStruct) || ... (isstruct(signalStruct) && isempty(fieldnames(signalStruct))) zef.h_source_tree.SignalParameters.Data = {}; return; end rows = signalstruct_to_rows(signalStruct); zef.h_source_tree.Sig...
c132dd9b6a83014543bc60dde7b0b040cd26d022c5803f1ee934271f84061a8c
MATLAB
1,102
31
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_topography(zef) if nargin == 0 zef = evalin('base','zef'); end zef_topography_app; set(zef.h_topography,'Name','ZEFFIRO Interface: Topography tool'); set(findobj(zef.h_topography....
cb3198f87a30075b47ef362361c350822c31b5ed0f6a4aa481bf6b80357e8564
MATLAB
1,104
30
function [L, source_positions,source_directions] = zef_lead_field_filter(L,source_positions,source_directions,filter_quantile,varargin) amp_vec = sqrt(sum(L.^2)); filter_ind = find(amp_vec > quantile(amp_vec,filter_quantile)); source_ind = [1:size(source_positions,1)]'; if isequal(size(L,2),3*size(source_positions,1...
163034200095599f9aa5fc79cb6dcd077bc2dc19c08e6a16aff8910be5ee8d20
MATLAB
1,105
34
function uiunlock(handles) %uiunlock Shared Core GUI unlocker % uiunlock(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{in...
a95885f24664c6c62af0a1993d61542d8d9e4b989bc6473e4a233febef0098d1
MATLAB
1,105
33
function [dblR2,dblSS_tot,dblSS_res,dblT,dblP,dblR2_adjusted,dblR2_SE] = getR2(vecY,vecFitY,intK) %getR2 Calculates R-squared % [dblR2,dblSS_tot,dblSS_res,dblT,dblP,dblR2_adjusted,dblR2_SE] = getR2(vecY,vecFitY,intK) % %intK is number of regressors %for SE: https://stats.stackexchange.com/questions/175026/form...
7dfd58a0755dbfd1d668c6e1e054366cae867db49a3b0869928c973beabc8d0c
MATLAB
1,107
74
function M = zef_volume_scalar_diagonal_matrix(nodes, tetra, scalar_field, weighting) % % zef_volume_scalar_diagonal_matrix % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - scalar_field % % TODO: explanation. % % - weighting % % TODO:...
a3053a14d142dda2fd4676cf706b6567e7d322ed07ab6d570654de3da6387a8d
MATLAB
1,110
41
%zef.L=zef.L/max(max(abs(zef.L))); if ~strcmp(zef.dataBank.app.Entrytype.Value, 'reconstruction') error('wrong type'); else datetime for mmm=[3,1,2] for psnr=([-50 -40-30 -20 -10 -5 0 5 10 15 20 30 40 50 6070 80 90]) zef.inv_prior_over_measurement_db=psnr; for snr=-40:1...
6e1dea4aff9e9e4beaead5e85536aa6bd1dacd79ab33d5a49d60b6c0facafb2d
MATLAB
1,111
49
function [alpha, epsilon] = zef_ES_find_parameters(varargin) switch nargin case {0,1,2} if nargin == 0 zef = evalin('base','zef'); warning('ZI: no input argument.') else zef = varargin{1}; end alpha = zef.ES_alpha; alpha_max = zef.ES_alpha_max; epsilon_min = zef.ES_epsilon_min; epsilon = zef.ES_epsil...
2608f8c83e9dd0a72ff8211ee63988be04a532a0d1d70abdec50bce9d7f9f9e3
MATLAB
1,113
34
function [alpha_psi, epsilon_psi] = zef_ES_centralize_recursive_search(alpha, epsilon, sr, sc, original_window, s_alpha, s_epsilon, varargin) if ismember(varargin{1}, 1) non_floating_flag = varargin{1}; else non_floating_flag = 1; end B_alpha = sqrt(( max(alpha)/min(alpha) )*s_alpha); B_epsilon = sqrt(( max(e...
84875ff74dde87f42184126997a841dab7800aadf0b0de213b0c2ea83bf9dfe2
MATLAB
1,113
29
function obj = cluster_globalmaps2individual(obj,makeIndividualMaps,keep_polarity) % Align global maps to each individual if nargin < 3 || isempty(keep_polarity) keep_polarity = false ; end if nargin<2 || isempty(makeIndividualMaps) makeIndividualMaps = false ; end validateattributes(makeIndividu...
6c7117c14c3d2dfae2475f28a86a18306af01392c77d1023162faf37c90a18b5
MATLAB
1,115
36
function [processed_data] = zef_simple_ica_cleaning(f, ica_reference_channels) %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 arguments can be controlled v...
f2f82d378a22b190c70803730c9191dbd7b3aacaef615811af14b9dd4eb66b3a
MATLAB
1,115
35
function obj = stats_occurrence(obj) % Calculate number of occurrences of a microstate per second % Check inputs if isempty(obj.time) || isempty(obj.label) error('To calculation microstate occurrence, properties time and label are required') end if length(obj.time) ~= length(obj.label) ...
a6bcff0d524bbde6c5f5821a5d434ffa8ab3200565a6a190e10e80ab9a75a9e8
MATLAB
1,116
34
function [alpha_psi, epsilon_psi] = zef_ES_centralize_recursive_search(alpha, epsilon, sr, sc, original_window, s_alpha, s_epsilon, varargin) if ismember(varargin{1}, 1) non_floating_flag = varargin{1}; else non_floating_flag = 1; end B_alpha = sqrt(( max(alpha)/min(alpha) )*s_alpha); B_epsilon = sqrt(( max...
b7e528cc3792fb6e2ea393b02bf4ef31204b493f3e0bda9bab7ad074aa649cd8
MATLAB
1,116
52
function [Model] = train_shape_step(data, tau, tau_id, tau_list) % training shape parameter using training data % data.y(n,:) : y(n,t) % data.Dt{n} : spike onset time of n-th window [sec] % relative time when window onset time is t=0 % data.dt = sampling step [sec] Ntau = length(tau); Nlis...
5bf958cd855336d16c67272d2692a1db6034da2ca12eb10eae6aeb017acda428
MATLAB
1,117
39
% estimate the center of the ROI and the theeshold given a set of % covariances matrices. % [C th dist] = potato_estimation(COV,method_mean,method_th,method_distance,args) % Inputs : % * COV : a set of covariance matrices % * method_mean : method for center of ROI estimation. 'riemann', % 'logeucli...
cf88817e75f527c45f4438a53426630ca04d74fdca37bc022a827a1f48c60de7
MATLAB
1,117
37
function [file, file_path, mesh_type] = zef_import_surface_mesh_type file = 0; file_path = 0; mesh_type = -1; selection_cell = {'stl','points','triangles'}; d = dialog('Position',[300 300 350 150],'Name','Select One','Resize','on'); txt = uicontrol('Parent',d,... 'Style','text',... 'Position',[72 90 210 40],...
15df76e40e9914b073373f130221cf314ccd26128c2f2e4fd24eb3026de9aed4
MATLAB
1,118
25
function [Y_orth,Y_partialled] = decorrelateDesignMatrix(Y) % Given a design matrix Y, this method decorrelates regressors using % symmetric orthogonalisation. This approach finds the timecourse Y_orth % with zero correlation between columns that minimises (Y-Y_orth)^2. % This approach is best used when wanting to int...
1dc6f4d171a085536444812d96d60a71cd0790bd91b87c1cd9f47acd8ab45381
MATLAB
1,119
22
function [IMAGE,LABEL] = fun_generate_mMNIST(numTrain) %% load image %========================================================================= array_num_train = [numTrain numTrain numTrain]; IMAGE = cell(length(array_num_train),3); LABEL = cell(length(array_num_train),3); %% Type 1 : shape max_Amp = 0.0;pos_n...
fb69466d2fba518ae52e729e611b52776a6a5c8f3b2c36d03c0227b221be41c2
MATLAB
1,120
46
function [folder_list] = zef_add_path(import_path,varargin) folder_list_aux = []; subfolder_status = 0; d = dir(import_path); folder_list = cell(0); if not(isempty(varargin)) if isequal(varargin{1},1) || isequal(varargin{1},'recursive') subfolder_status = 1; end if length(varargin) > 1 fol...
3b4a767e8da20a4c74153196e611b3ea287c92e10e35eb6c8b9d65bb20b35c67
MATLAB
1,124
29
function Entr = GammaEntropy(Gamma,Xi,T,order) % Entropy of the state time courses Entr = 0; K = size(Gamma,2); for tr = 1:length(T) t = sum(T(1:tr-1)) - (tr-1)*order + 1; Gamma_nz = Gamma(t,:); Gamma_nz(Gamma_nz==0) = realmin; if any(isinf(log(Gamma_nz(:)))), Gamma_nz(Gamma_nz==0) = eps; end Entr ...
5f4d811be9c7a4295b0f44dbcb9fd44565097b4eb44b0a4a35a1cc25b4baa61f
MATLAB
1,124
17
%----------------------------------------------------------------------- % Job saved on 31-May-2021 14:48:01 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7771) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- matlabbatch{1}.spm.util.imcalc.input = { ...
d06e1ffc594ef59571aa94960500d032ec686a9d1bdaecc97ae7734371745737
MATLAB
1,125
35
function cfArray = ERBSpace(lowFreq, highFreq, N) % function cfArray = ERBSpace(lowFreq, highFreq, N) % This function computes an array of N frequencies uniformly spaced between % highFreq and lowFreq on an ERB scale. N is set to 100 if not specified. % % See also linspace, logspace, MakeERBCoeffs, MakeERBFilters. % %...
f8d02ef827b93b23bdf0388292b4639826b347c1709d584aae911e98ea76e4ca
MATLAB
1,125
35
function [im,imBackground,vecAdjustLim,intSurroundSize] = doEnhanceContrast(im,intSurroundSize,vecAdjustLim) %doEnhanceContrast Enhance contrast of image % [im,imBackground,vecAdjustLim,intSurroundSize] = doEnhanceContrast(im,[intSurroundSize/imBackground],vecAdjustLim) %normalize range if max(im(:))>1 || min(i...
9a3c78cfbad90c6ff294fbcb2b833b3009afed580f6136e8538ead2962de8789
MATLAB
1,126
33
function [MSO] = Coincidence_detect(spkL, spkR, maxISI) %spkL and spkR are trials of spikes in NEL format (2 columns, first has %trial # and second has spike times %maxISI = max interspike interval for conincidence detection (in seconds) %MSO = output of coincidence detector (MSO simulation) in NEL format %This 'if' ...
b58d48f9face7133e1befcb61dc88edce36c2016eb1b3f296a94f228c48ea211
MATLAB
1,126
56
function to_out = copy_fields ( from, to, kwargs ) % % copy_fields ( from, to ) % % Copies the fields from one struct to another. % % Inputs: % % - from % % The scruct fron which the fields will be copied. % % - to % % The struct that the fields will be copied to. % % - kwargs.error_on_overwrite = false % % If th...
b0b166aeb6f77d8f518fe446b1c4e4e9f365be917f7bc323d3178b6e0ccabb1a
MATLAB
1,128
47
% res = Par2( myobj, op, filename ) % % Create, Verify, or Repair Par2 redundancy files for % 'filename'. Arguments: % % op: a string that is either 'c', 'v', or 'r' for create, % verify or repair respectively. % % filename: the .par2 or .bin file to which 'op' is appled. % % Progress is reporte...
1d4c575e2bc4a1a978b494c2788b199be1ac9edbcae7b2b1f305a7a61fa2bd3b
MATLAB
1,129
24
function add_header_and_save3D(flatten_voxels, reference_nii,save_path) output_3D = reshape(flatten_voxels, size(reference_nii.img)); output_3D = make_nii(output_3D); output_headers = output_3D; output_headers.hdr.dime.pixdim = reference_nii.hdr.dime.pixdim; output_headers.hdr.dime.scl_slope = ref...
97c7dc8446b599e1e4ae6e30ed8052dd9f5650ea56252339a7703471f50f2c21
MATLAB
1,130
45
% myobj = StartRun( myobj ) % myobj = StartRun( myobj, params ) % myobj = StartRun( myobj, runName ) % % Start data acquisition run. Optional second argument (params) % is a struct of name/value pairs as returned from GetParams.m. % Alternatively, the second argument can be a string (runName). % Last-us...
4268086beb49c64f20f6c7c9eeee0fa6fdfc112157e94bb434e4599479d879fc
MATLAB
1,131
36
function [X, unique] = sylvester_nochecks(A, B, C) % Solve Sylvester equation without input checks. % % function [X, notunique] = sylvester_nochecks(A, B, C) % % Solves the Sylvester equation A*X + X*B = C, where A is an m-by-m matrix, % B is an n-by-n matrix, and X and C are two m-by-n matrices. The returned % flag 'u...
467e7dca33b8a6b1ed3bd67cf518c0f1d2e1f58714e2dd67e5b47f928aeb75a5
MATLAB
1,131
36
function tetra_ind = zef_get_tetra_to_refine(domain_ind, thresh_val, k_param, nodes, tetra, domain_labels, reuna_p,reuna_t) tetra_ind = []; I_aux = find(sum(ismember(domain_labels,domain_ind),2)); tetra = tetra(I_aux,:); domain_labels = domain_labels(I_aux); for i = 1 : length(domain_ind) u_t_ind = unique(reuna_...
d72c5ccb79e7cfa1accb948f2405ae9afe83a3f0778d204538753250b9157d64
MATLAB
1,132
45
function varargout = export_fig(varargin) %wrapper for export_fig cellExportFigs= which(mfilename,'-all'); strThisFile = mfilename('fullpath'); indOtherFiles = ~contains(cellExportFigs,strThisFile); if any(indOtherFiles) %invoke other function strTarget = cellExportFigs{find(indOtherFiles,1)}; strPath=filepa...
742005ea865dc0209bca9a66aa2482f0011df2306206d4034f5aac9bfce8501c
MATLAB
1,134
16
%Copyright © 2018, Sampsa Pursiainen zef.h_find_synthetic_gravity_data = open('find_synthetic_gravity_data.fig'); zef_init_find_synthetic_gravity_data; uistack(flipud([zef.h_inv_roi_sphere_1; zef.h_inv_roi_sphere_2; zef.h_inv_roi_sphere_3; zef.h_inv_roi_sphere_4; zef.h_inv_roi_perturbation; zef.h_inv_compute_...
97b5c9f820815fd09e8c11a7d159f0f65698636c6d049f0cc36595258a99a8fa
MATLAB
1,134
41
% [daqData,headCt] = FetchLatest( myObj, streamID, scan_ct, channel_subset, downsample_ratio ) % % Get MxN matrix of the most recent stream data. % M = scan_ct = max samples to fetch. % N = channel count... % If channel_subset is not specified, N = current % SpikeGLX save-channel subset. % %...
97929d506e5ffed842cccc293a0bf800c6849ddc49fc2729fd721bf0529b8e3d
MATLAB
1,142
45
classdef BCFWObjective < handle % BCFWObjective Interface for block-coordinate Frank Wolfe problems. % Thread-safe properties M, xwavg end methods (Abstract) step_size = line_search(th, dir, max_step); step_size_m = line_search_block(th, m, dir, m...
8b13c5793d8d2fdcc968cbcd7f7491ed7e0a7b61a86fcc0fec015fe25c737bb9
MATLAB
1,144
26
% To Run the File your current directory has to be the RunFile Directory as all the paths are defined relative to it clc clear close all %% Load the Data % Enter the path to your data DataPath = '../SampleData/'; addpath('../QuickNAT_Networks'); % FileName FileName = 'SampleData.mgz'; % This is a sample Data from OASI...
17b66fef9423897fa91ddced81872ce3d2fa1c41aacd7d8101fff523f52322cd
MATLAB
1,145
37
function status = checkGamma(Gamma,T,train,subj) % Check that the state time courses are well-defined (no NaNs) % and that the HMM inference wasn't trapped in a trivial local minima if nargin<4, subj = 0; end if any(isnan(sum(Gamma,2))) t = find(isnan(sum(Gamma,2)),1); if train.order>0 d = train.order...
ee51d577ea3a1228ff166f076f9d9835c8e52ed09fed7a36e8d31b3d3da50ccc
MATLAB
1,147
35
function [Release] = toolbox_chk % Requires 3 matlab toolboxes (Released later than 2017) : % Deep Learning Toolbox warning('on') matlab_version=ver; toolbox_names={matlab_version(:).Name}; toolbox_Release={matlab_version(:).Release}; Index_matlab = find(strcmp(toolbox_names,'MATLAB')); if ~isempty(Index_...
45842b4d3270b1788520e69761902725ef81592e6f96c08493d7dfeea122280d
MATLAB
1,149
42
function [newtree] = zef_dataBank_rebuildTree(tree) %nargin==1 means a normal tree that was not saved to disk. The other files %are needed to give a new savefile and an ordered hashList hashes=fieldnames(tree); newtree=struct; % list=cell(length(hashes)); if ~isempty(hashes) newtree.(zef_dataBank_number2hash(1)...
7789eceb52141cd5e3d003df0b7cd81eb402ececc077adf274ba85c43ebc8d46
MATLAB
1,149
32
function [params] = learn_neighborhoods(params) %grab necessary parameters & pre-allocate x_train = params.x_train; neighborhoods=params.neighborhoods; options = params.glm_options; node_count = params.num_neurons + params.num_udf; glm_array=cell(node_count,1); wb = CmdLineProgressBar('Learning Neighborhoods'); for...
c2c684f773a68c4a4dfeaaca99e75aebf77a2b86f07117069b0e87fe759fe795
MATLAB
1,149
32
function h = moveROIs( dx, dy, h, axe ) % dx, dy is movement in pixels % h contains the ROI handles % axe is the image axes handle msize = 1; lsize = 1; nROIs = size(h,2); for i = 1:nROIs h(i).ROI = h(i).ROI + [ dx, dy ]; %h(i).handles.ROI.Position; % roi; h(i).deadzone = h(i).deadzon...
b6074bbcfd3426dab0b4d39219515ee76d32779e475064e274051d05d0a6f7d8
MATLAB
1,150
48
function [pos, label] = getElectrodePositions(data, OptionalNameforElectrodeFile, OptionalNameForLabelFile, OptionalSaveToFile0or1) if nargin==3 OptionalSaveToFile0or1=1; end if nargin==2 OptionalNameForLabelFile='./electrodesLabel.dat'; OptionalSaveToFile0or1=1; end if nargin==1 OptionalSaveToFile...
269f96422537d8236a9b32ce1fc41fc703175b7633f7fb4b086a91fe8efae3f8
MATLAB
1,152
21
zef_data = zeffiro_interface_create_dipolar_pair; zef.h_create_dipolar_pair = zef_data.UIFigure; zef.h_create_dipolar_pair_add = zef_data.h_create_dipolar_pair_add; zef.h_create_dipolar_pair_table = zef_data.h_create_dipolar_pair_table; zef.h_create_dipolar_pair_plot = zef_data.h_create_dipolar_pair_plot; set(zef.h_cr...
6154fff9982691ac00d9e3c3cee7ded856757ae68dbe6d82d8a8b90935c61359
MATLAB
1,154
73
function M = zef_volume_scalar_matrix_Kx(nodes, tetra, h, x, u_field, volume, b_coord) % % zef_volume_scalar_matrix_Kx % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - h % % TODO: documentation. % % - x % % TODO: documentation. % % - ...
f68aaef000a170df83bc63feaf7364ce5e8a7757694c707b14c0335f003e6859
MATLAB
1,154
49
function nse_field = zef_smooth_nse_field(nse_field, n_smoothing, s_mode) if nargin < 3 s_mode = 1; end if s_mode == 1 M = zef_averaging_matrix(nse_field.nodes,nse_field.tetra,nse_field.i_node_ind); for i = 1 : n_smoothing nse_field.u_1_field = M*nse_field.u_1_field; nse_field.u_2_fi...
5b83bd1109ece03d0775a193cf85b16df3988ecd1d8ef878cee9f5960d90216f
MATLAB
1,155
42
function [Xe,valid] = embedx (X,lags) % % Embeds a [samples x channels] array X using a vector of time lags % resulting in a [samples x (channels x lags)] array Xe. The embedded array % Xe is structured as: % % Xe = [channel 1, lag 1 % channel 1, lag 2 % channel 1, lag ... % channel 1, lag...
f61c58a276e2359694842292691a0359c1ffb01f570dad95a09eb1ad031f067a
MATLAB
1,156
47
function X = simgauss(T,hmm,Gamma) if iscell(T) if size(T,1)==1, T = T'; end T = cell2mat(T); end T = sum(T); if nargin < 3 Gamma = ones(sum(T),1); end ndim = size(hmm.state(1).W.Mu_W,2); if ndim==0, ndim = size(hmm.state(1).Omega.Gam_rate,1); end K = size(Gamma,2); X = zeros(T,ndim); mu = zeros(T,ndim)...
3fddcf5fd800bb51366f1351f19c55e1c06836c7cc7eed2ad3275d2361afa4be
MATLAB
1,158
41
function [D] = gauss_kl (mu_q,mu_p,sigma_q,sigma_p) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % [D] = gauss_kl (mu_q,mu_p,sigma_q,sigma_p % % computes the divergence % / % D(q||p) = | q(x)*log(q(x)/p(x)) dx % / % between two k-dimensional Gaussian probability %...
5172c633f5456995cb56a539a6c9a290aab230a620a58c2f0681ecd0d26bb0bc
MATLAB
1,158
35
function [likelihood] = optimization_wrapped_estimator(... s_lambda, p_lambda, params) [coefficients] = learn_structures(params, s_lambda); learned_structure = process_structure(coefficients,... params.density, params.absolute, params.mode, params.neighborhoods); model.s_lambda = s_lambda; model.p_lambda = p...
958256580248597de33bea343d0123176cb82ad9666f9f00bc8ee41aca6887c9
MATLAB
1,158
35
function dcor = distcorr(x,y) % This function calculates the distance correlation between x and y. % Reference: http://en.wikipedia.org/wiki/Distance_correlation % Date: 18 Jan, 2013 % Author: Shen Liu (shen.liu@hotmail.com.au) % Check if the sizes of the inputs match if size(x,1) ~= size(y,1); error('Inputs m...
2a0bb3b7648b330009d6315873b201b5e204fffbc4014eabccbc97118188d4ff
MATLAB
1,159
46
function [data] = generate_ca_response(parm) % generate spike train spike_train = generate_poisson_spike(parm); duration = max(spike_train) + 2./parm.fs_spike; t_raw = 1/parm.fs_raw:1/parm.fs_raw:duration; t = 1/parm.fs:1/parm.fs:duration; [~,idxList] = findClosest(t,t_raw); % elementary Ca transient model.tau = [pa...
96bdda12e51b17e617cd1dc644dfacad2803d7db76d663ad9c22651cd5987b41
MATLAB
1,160
29
% compare white noise oscor to filtere noise oscor clear Data_path = '/media/ravinderjit/Data_Drive/Data/BehaviorData/IACbehavior/'; oscor_white = load('/media/ravinderjit/Data_Drive/Data/BehaviorData/IACbehavior/OSCOR_white/S211_whitenoise_OSCORfmThresh.mat'); oscor_filt = load('/media/ravinderjit/Data_Drive/Data/Beha...
b54e3c9395a315c9978c733781b5cf3f75cb2ed1aa3edb70d864d30e1116daba
MATLAB
1,162
38
function nowVisited = runDfs(A,N,node, visited) % % Run a depth first search on the network A from the given node. % This is performed recursively, and works ok on my machine up to size N = 250 - % I suspect it will need to be rewritten iteratively for larger network sizes. % % Inputs % - A - connectivity matrix (can ...
509ee1952e8a4f508f80614f28bf5e77f694e0cfee669c67162b44b5857f1522
MATLAB
1,163
48
function [current_score_nnz, y] = zef_ES_rwnnz(y, rwnnz, varargin) if any(isnan(y)) || isempty(y) y = []; current_score_nnz = 0; return end rwnnz = 1 - rwnnz; current_score_nnz_lim = Inf; if not(isempty(varargin)) current_score_nnz_lim = varargin{1}; end if not(isequal(current_score_nnz_lim, 2)) ...
c6bf26048fb99b327e3b9d227cbf8a4dab7dd1affc253413156f4d78f63664ab
MATLAB
1,164
42
function zef_dpq_plot_resection(varargin) %This function plots a convex hull enclosing a set of resection points. alpha_value = 0; resection_color = 'g'; if not(isempty(varargin)) resection_points = varargin{1}; if length(varargin) > 1 resection_color = varargin{2}; end if length(varargin) > 2 ...
55bdf49aac090f77530deccf4579e27aa2e82293c3e06896eeee2efe0193f1c7
MATLAB
1,165
29
function [processed_data] = zef_define_time_interval(f, start_time, end_time, 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 arguments ...
6fe173b15a16d96fede385e800992c4ccd9c11581bf9c077e165519c31473bec
MATLAB
1,171
45
function n=hist2a(A,B,L) %HIST2 Calculates the joint histogram of two images or signals % % Note, this is a trimmed down, speed optimised version of the hist2 % function, optimised for use in the FORCe method. Do not try to use this % code of other purposes, it most likely won't work properly. % % Modified by: ...
bd3d5ed1c79ebcc622b23d86cccbc39b86e0d017dc4185123fe459d7cef48032
MATLAB
1,172
30
function zef_source_tree_deletenode_pushed(~, ~, ~) %ZEF_SOURCE_TREE_DELETENODE_PUSHED Delete currently selected tree node % (and its children) and update zef.source_tree accordingly. zef = evalin('base','zef'); selected_node = zef_source_tree_get_selected(zef.h_source_tree.SourceTree); if isempty(selected_nod...
06ed1815503e7304b849ce23b892ad723a438de07486cb886cb4b957751789f3
MATLAB
1,174
47
function ETC_DeleteFcn %UNTITLED Summary of this function goes here % Detailed explanation goes here global sETC; global sFigETC; %ask to quit opts = struct; opts.Default = 'Confirm exit?'; opts.Interpreter = 'none'; strAns = questdlg('Are you sure you wish to exit?','Confirm exit','Save & Exit','Exit & Di...
3d1c1533fb2d4ebc96594aace8fa79b7fc0523973f2a78eb1532f3c79fddc827
MATLAB
1,174
58
%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(A,b,tol_val,max_it,M,x) if nargin < 5 M = []; end if nargin < 6 x = zeros(size(b,1),1); end if isequal(class(A),'function_handle') r =...
5a0ff5f41a047d19c74bc8bc96c370b63a20e448879cd9ccc708f9ddf5853b5f
MATLAB
1,174
39
function [S, cfg] = getEEGSpectro(eeg, fs, cfg_) % spectro = getEEGSpectro(eeg, fs, cfg) % % Input: % eeg - eeg signal % fs - sample rate in hz % cfg - struct with following fields: % spwin__s - segment window size for spectrogram(), in seconds % spovl__pc - fraction of overlap betwee...
adeb75a5e854c00b3c89ef24044f83160f2a5ead12c29f5d4f2ebce94c6b066e
MATLAB
1,174
37
function [contrast_val, brightness_val] = zef_update_contrast(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_fig...
ea02c1788bb37784124125293b0f121109d4935a8c7c30841bda1a712d2accb9
MATLAB
1,174
32
% 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','tutorial4_TopographicERP') ; % path to folder containing the data addpath(datadir) % add this to the path % Check...
ff15913de6d0b72c10dab130eb32e1aec282706377e044e7f554030b83aec96f
MATLAB
1,175
39
function zef = zef_dataBank_importNodeButtonPress(zef) if nargin == 0 zef = evalin('base','zef') end if strcmp(zef.dataBank.app.typeDropDown.Value, 'Node') [savefile,savepath] = uigetfile('*','Select One or More Node Files','MultiSelect', 'on'); else [savefile,savepath] = uigetfile('*','Select a dataBank ...
7fa67780738ed22390ae2d8f2903e9a3fc4b92096af4dd093f3489a2d5ffaa8e
MATLAB
1,179
42
function zef_nse_plot_roi(h_axes,zef,nse_field) if nargin == 0 h_axes = evalin('base','gca'); zef = evalin('base','zef'); nse_field = zef.nse_field; end axes(h_axes); hold_val = ishold(h_axes); if not(hold_val) hold(h_axes,'on'); end h_sphere = findobj(h_axes.Children,'Tag','additional: nse_sphere')...
b4c1a8ca26d781b89ddc323522131029fb782d0bd036005d09d91daaca1bba2a
MATLAB
1,180
33
function plot_potentials(app) v = app.PlotModelEditField.Value; p_lambda =app.model_collection.models{v}.p_lambda; s_lambda = app.model_collection.models{v}.s_lambda; %newcolors = app.newcolors; %% NODES FIRST weights = reshape(app.model_collection.models{v}.theta.node_potentials,[],1); weights(weights==0)=[]; if ...
1ebe4f403fa4cbdad36856d0efd7c0c938a63db2320a427e1c040676056e45dd
MATLAB
1,181
37
function runComputeSyncResults(parameters) % % Compute the sync results for randomly generated networks as specified in the % parameters object (or file). % This script is mainly intended for running on a cluster, where % we need to set the Matlab path also and then run over multiple values of % S (number of emp...
650af1baf10e28f41be3a6c4c3cb69fad96d04d3494879841c15b61f16584712
MATLAB
1,181
33
load('sleep_deprivation_lifetime') figure for t=1:6 r=normrnd(0,0.1); plot([1.2,1.8],[qingxing_life_time_new',kunjuan_life_time_new'],'--o','linewidth',3,'color',[r+0.7,r+0.7,r+0.7],'MarkerFaceColor',[r+0.7,r+0.7,r+0.7]) hold on end h=boxplot(qingxing_life_time_new,'position',[1.2],'colors',[255/255,...
f0a1d1028c4c949bcf39527b61b5c3b50a48e33b72d6b17c00e3e5c94e9cd7c7
MATLAB
1,181
30
function evaluate_ensembles_button_pushed(app) update_log(app, 'Evaluating Ensembles...'); identified_ensemble_performance = struct(); bounds = size(app.params.data, 1); identified_ensemble_performance.full_performance = calculate_ensemble_performance(app.params, app.ensemble_nodes,... app.log_likelihood_by_fra...
163a2c2bb918e94a3def935d8e3f4da6a89709e6018e011e6abae5c0909e5f34
MATLAB
1,182
31
function zef = zef_add_transform(zef) if nargin == 0 zef = evalin('base','zef'); end if not(eval('zef.lock_transforms_on')) zef_i = 1 + eval(['length(zef.' zef.current_tag '_transform_name)']); eval(['zef.' zef.current_tag '_transform_name = [zef.' zef.current_tag '_transform_name, ''Transform ' num2st...
b462917a76122a9a033d7c5017f477eeebf5b8d36faf8e0cd9583b3373706292
MATLAB
1,185
33
function perDISRIB=bsliang_generatepermuteDISTRIB(inmat,LT_ind,Npermute) perDISRIB=nan(4,4,2,Npermute); % 4*block, 4*turn, 2*LT_ind, Npermute % inmat: block(4)*turn(5)*subj(197) % turn£º Left iTBS Left cTBS Right iTBS Right cTBS Sham % block£ºT_CLEAR_ID P_CLEAR_ID T_NOISE_ID P_NOISE_ID ...
06a4c5328523c01652d56384462214516437663be54731c546ccfae06331bc97
MATLAB
1,186
49
if not(isfield(zef,'h_create_dipolar_pair_x')) zef.create_dipolar_pair_x = 0; end if not(isfield(zef,'h_create_dipolar_pair_y')) zef.create_dipolar_pair_y = 0; end if not(isfield(zef,'h_create_dipolar_pair_z')) zef.create_dipolar_pair_z = 0; end if not(isfield(zef,'h_create_dipolar_pair_ori_x')) zef....
0ce49caabbf4f4b51c17c96a18e50ae786bacb43a9021339bccd4d72cea2de72
MATLAB
1,186
46
function G = grammatrix(M, x, vectors) % Computes the Gram matrix of tangent vectors in the Manopt framework. % % function G = grammatrix(M, x, vectors) % % M is a Manopt manifold structure obtained from a factory. % x is a point on the manifold M. % vectors is a cell containing n tangent vectors at x. % % G is an n-by...
a3924880b1868884a08ededbac3e2df213673af510ef20d02ba94e85309879c9
MATLAB
1,186
24
function [ensemble_nodes] = recompare_random_ensembles(node_performance, random_ensemble_performance, num_deviations) %grab [num_node, num_stim] = size(node_performance); auc = cell2mat(node_performance); %preallocate ensemble_nodes = cell(num_stim,1); %fill for ii = 1:num_stim temp_deviations = num_deviations; ...
bf312a60f8db5b91289730e5b625277887520295de83d631d076259d8bb7be47
MATLAB
1,186
49
function Gamma = simgamma(T,P,Pi,nrep,grouping) % % Simulate data from the HMM-MAR % % INPUTS: % % T Number of time points for each time series % P Transition probability matrix % Pi Initial probabilities % nrep no. repetitions of Gamma(t), fro...
f922ebd3ff9f4badaef3ecb016380ace346b10f8c4bf033a6b3c3cf47319586f
MATLAB
1,191
31
% openvibe toolbox for Matlab % OV_getSpectrumOutputHeader.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % Set the header information on a signal output. % MEANT TO BE USED IN USER SCRIPT function [errno, nb_channels, channel_names, nb_abscissas, abscissas_names, abscissa...
5b673aac1182cf439d46352938035bc21f9f25ee5b79c1ba7f1412234647a2f3
MATLAB
1,193
33
% 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','tutorial1_RestingEEG_SingleSubj') ; % path to folder containing the data addpath(datadir) % add this to the path ...
7005a883cc612c7d08596140066d0a240bafc2cb23b402d00aa62715e6f090e5
MATLAB
1,199
34
function [ll, post, logpdf]=estep(log_lh,prob_th) %ESTEP E-STEP for Gaussian mixture distribution % LL = ESTEP(LOG_LH) returns the loglikelihood of data in LL. LOG_LH % is the log of component conditional density weighted by the component % probability. % % [LL, POST] = ESTEP(LOG_LH) returns the posterior pro...
1b7efb26b2b10454f48c86b1caa2b76d3fc49b39094bbe429189e9e6f9968425
MATLAB
1,202
56
% [] = XXXX() % % -----------------------------Definition---------------------------------% % % description % % usage : % % -----------------------------Input--------------------------------------% % % XX : description + dimension % % -----------------------------Output-------------------------------------% % % XX : d...
05fe71aa12395874b6a61381fde69235e2ecefccfb9a2dcb62d51340fc9e881f
MATLAB
1,204
45
function [dblBlinkiness,dblCenter] = ETO_CalcBlink(vecLum) %fill vecFilledData = fillfromtrough(vecLum); %invert vecHill = max(vecFilledData(:)) - vecFilledData; %estimate mean + sd vecX = (1:numel(vecHill))'; vecM = vecHill(:).*vecX; dblMean = sum(vecM)/sum(vecHill); vecV = vecHill(:).*((vecX-dblMean).^2)...
fe558f36532a04930ae5ddf2fd523626dc68dd4798999ca95706d52ceb196645
MATLAB
1,208
49
function onsets = getStateOnsets(vpath,T,Hz,K) % Finds the onset times of the states for each session. % % vpath must be the Viterbi path, and T is the length of the sessions % Hz is the sampling frequency % onsets is a cell (subjects by states), where each element is a % vector of onset times % K (optional) prespeci...
1898f119cfa53196acc2910d3a879f48a5e6b833a79b99de30742f2004f4f720
MATLAB
1,210
32
function evaluate_best_model_button_pushed(app) if app.params.assess_decoding update_log(app, 'Now Assessing Decoding Performance'); [log_likelihoods_each_frame, model_performance] = assess_decoding(app.params, app.best_model); app.model_performance = model_performance; % make sure not to overwrite ...
5b72464f31e69e805ce90511d6e773c25a26c1c21505ed3a69d123a9224ccc83
MATLAB
1,210
34
function ORDERnum=bsliang_gainORDERnum(PARnum) % tranMAT=[1:47;2:48]'; tranMAT=[1,1;... % ÕâÊÇBSLiang±¾ÈË£¬²»ÄÉÈëÆ½ºâÐòÁкÍÊý¾Ý; 142,2;...% Larynx Å® 202,1;...% Larynx Å® 201,3;...% Larynx Å® 55,4;...% Larynx ÄÐ 104,5;...% Larynx Å® 206,6;...% Lary...
7c438c9f4b5814e04f8f23503035755f37686d9c3ad29cd5cfc62ea6f71d3bd2
MATLAB
1,210
47
function zef_closereq(tool_name) if nargin==0 tool_name =''; end if not(isempty(tool_name)) h_tool = findall(groot,'ZefTool',tool_name); end % if evalin('base','exist(''zef'',''var'');') % zef = evalin('base','zef'); % % if not(isempty(tool_name)) & not(isempty(h_tool)) % time_val = now; % ...
6eec4929628571ec4d0fc50f3cd7507f68b50b8ee378714f852451d02dc83ae9
MATLAB
1,211
34
function plot_epochs(params,EEG) nepochs = cellfun(@length,{EEG.epoch}); nRec = length(EEG); f = figure('units','normalized','outerposition',[0 0 1 1]); bar(nepochs); % Recording IDs s_ids = cellfun(@(x) regexp(x,'.*(?=_eeg.set)','match','lineanchors'),{EEG.filename}); % For a short version of the recordings IDs: del...
513944f6efe3b2881d6d31f4cb1b92592163963f4d9d6af761ddc2c2d69adfc0
MATLAB
1,213
15
options = rmfield(options,'BIGNbatch'); if isfield(options,'BIGNinitbatch'), options = rmfield(options,'BIGNinitbatch'); end if isfield(options,'BIGtol'), options = rmfield(options,'BIGtol'); end if isfield(options,'BIGcyc'), options = rmfield(options,'BIGcyc'); end if isfield(options,'BIGprior'), options = rmfie...
58519db3d97247832dd0d5316cfc29b146bc34b0a577aeb4f02ce9e140378803
MATLAB
1,213
41
function Gamma = padGamma(Gamma,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 state time courses to have the same size than % the data time series, padding the state time courses with probabilities...
7e31377c18eaeeb9877ac73ef4a85ad74aa4070862c147b59ef918fe5065ba7a
MATLAB
1,216
31
function [frame_log_likelihoods] = calculate_log_likelihood(frames, node_potentials, edge_potentials, log_z) %Function to compute frame-wise log_likelihood % frames is m frames x n nodes % node_potentials is 1 x n nodes % edge_potentials is n nodes x n nodes % log_z is scalar % frame_log_likelihoods is m frames x 1 %...
c0632d2354af541394aba8759378e87839bb10b8dbb76f0227f4d3b014b01254
MATLAB
1,216
37
function [EEG_filt, EEG_clean] = EEG_preprocessing(EEG_raw, Fs, chans) addpath(genpath('clean_rawdata-master\')) addpath(genpath('FORCe\')) [b,a]=butter(3,[0.5 45]/(Fs/2)); EEG_filt=filtfilt(b,a,double(EEG_raw)')'; ALL_DATA.data=EEG_filt; ALL_DATA.srate=Fs; ALL_DATA.nbchan=s...
6679ea89cdbd73f0c8fb4c78ed5253e5f2897c5a15ebdf7966292461ae0a9deb
MATLAB
1,218
36
function update_pattern_completion_text(app) %who is now udf_num = app.Stimulus_PCN.Value; % who are mine app.PCNNeuronsTextArea_PCN.Value = num2str(app.pattern_completion_nodes{udf_num}); %Who is total all_neur = []; for i = setdiff([1:size(app.params.udf,2)],udf_num) all_neur = [all_neur app.pattern_completion_...
db7052ca2de19aba1a4eca266bca6c18df2b4038e9a413a083bd681f68f31e22
MATLAB
1,219
35
function update_ensemble_text(app) num_udf = app.StimulusEditField.Value; %temp debug app.EnsembleNeuronsTextArea.Value = num2str(transpose(app.ensemble_nodes{num_udf})); %Who is total all_neur = []; for i = setdiff([1:size(app.params.udf,2)],num_udf) all_neur = [all_neur transpose(app.ensemble_nodes{i})]; end ...
67994e5b543373f1726860ed246009219303503dae9308f9ad0e9256810c59b7
MATLAB
1,220
37
function [models] = append_additional_models(params,models) originalL = length(models); currentL = originalL; numP = length(params.p_lambda_sequence); numToBeAdded = (length(params.s_lambda_sequence)*numP)-originalL; newL = originalL + numToBeAdded; i = originalL/numP; j = originalL; while currentL < newL i = i +...
dbe52cba055dccc11cb9fd95ae6f0da7ff9ba3217b8e3c244fcf96e1ac5c98bd
MATLAB
1,220
33
% Performs fast detrended fluctuation analysis on a nonstationary input signal to % obtain an estimate for the scaling exponent. % % Useage: % [alpha, intervals, flucts] = fastdfa(x) % [alpha, intervals, flucts] = fastdfa(x, intervals) % Inputs % x - input signal: must be a row vector % Optional inputs % ...