sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
79ecb36b0742f69b075d4eb5d2f53e6aab561d28b2f78a21f59c36f72c04e594
MATLAB
562
29
function zef = zef_delete_compartment(zef,compartments_selected) if nargin < 2 compartments_selected = []; end if nargin == 0 zef = evalin('base','zef'); end table_data = zef.h_compartment_table.Data; if isempty(compartments_selected) compartments_selected = zef.compartments_selected; end for i = 1 : leng...
ca245ca4150d104b0da00b39f4f5d953afa9d3834ca0c2761d9fc32f384f5b6f
MATLAB
562
22
function zef_logarithmic_distribution(parameter_vec) %Logarithmic distribution axes(evalin('base','zef.h_axes1')); h_axes = evalin('base','zef.h_axes1'); cla(h_axes,'reset'); parameter_vec = max(1E-30,parameter_vec); h_hist = histogram(log10(parameter_vec),200); hist_y = log10(h_hist.Values); hist_x = 0.5*(h_hist.Bi...
012342a1b4207a20c6014470966b27e13b9ee874df7f726de89ca508408f68e2
MATLAB
563
13
function [best_model, best_model_index] = select_best_model(model_collection, params) best_model_index = get_best_model(model_collection); best_model = SingleModel(model_collection, best_model_index); best_model.best_model_index = best_model_index; %Convert to Structures for saving warning('off','all'); model_col...
1c4229501c1f7566be7b8b89f35e4a84fddd5a061c000491ccc991f63a026f4a
MATLAB
564
12
function [y_vals, plot_mode] = zef_corr_max_scaling_max_weighting(time_series) %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...
9eeb95a1e0ea11ca224cd7c030728da8719c6cc73d8c228758ac318b97943a9d
MATLAB
564
17
function browse_data(app) q = figure('Renderer', 'painters', 'Position', [-100 -100 0 0]); %create a dummy figure so that uigetfile doesn't minimize our GUI % see % https://www.mathworks.com/matlabcentral/answers/296305-appdesigner-window-ends-up-in-background-after-uigetfile % Onur Ozdemir solution % Hacky but whate...
d216b3b805f8dbcc37dbf56011516cad645147a88c4e80341c828b17a1be63ad
MATLAB
564
20
%resize the time dimension of an image stack function [resize, resizeT] = resizeZ( stack, time, df ) % x-y-nframes stack % f number of frames to average, % output will be x by y by nframes/f height = size( stack, 1); width = size( stack, 2); nframes = size( stack, 3); newframes = floor(nframes/df); resize = zeros( hei...
056afd9b333330ad829f659bd44bb5bbfee4fb13926d67e93b14daab3aa45467
MATLAB
565
32
function [y,p_avg,p_std]=multinomrnd(p,m,n) %Performs random sampling from a binomial distribution % % [y]=multinomrnd(p,m,n) % where p=1-by-k vector of probabilities of occurrence % n=sample size % and m= number of trials % y=samples-matrix of size k-by-m % % for picking out one of k mixture components,...
3e0277ff9adb5e5244261eedf1abd7ecc3005923408b5d26cc73e3f233dbd9e0
MATLAB
565
24
function [order,exptimelag] = higherorder(minHz,Fs,L,orderoffset) % tells the order and exponential time lag for covering up to the slowest % frequency, using L lags % This can be done exactly, but... order = ceil(Fs / minHz); exptimelag = 1.01; if nargin<4, orderoffset = 0; end if nargin>=3 while 1 orders = ...
9590c50fe6ce5d5bad9fd10583033aff2535e807ef4e7c7d3610d34119698d05
MATLAB
566
24
function data = rawsignal2power(data,T) % Gets *square of* the power time series using the Hilbert transform, % as done in Baker et al (2014), eLife. % % Diego Vidaurre, OHBA, University of Oxford (2017) if isstruct(data), ndim = size(data.X,2); else, ndim = size(data,2); end for n = 1:length(T) ind = sum(T(1:n-1...
aafa0ff159a8ad5215f1883ba172926abb3f64b1d9ebd653f5faf5a899747598
MATLAB
568
23
function [model_idx,model_sets] = index_models(model_sets_input, model_vector) % returns models such that each column is a unique value of % model_sets_input and each row is a unique combination of parameters % containing said value %how many parameters are there model_sets = length(unique(model_sets_input)); %from ...
5d5a75f6374f1aaa80eec9609f94dcd831acfa462e961f740ee045617a05f473
MATLAB
569
18
% OV_MATLAB toolkit % OV_setFeatureVectorInputHeader.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % Set the header information on a Feature Vector input. function box_out = OV_setFeatureVectorInputHeader(box_in, input_index, nb_features, labels) box_in.inputs{in...
2325c2707c031560002c1a5dd752e3bb5736e2df0b83593b3b7bfbf64857b3b4
MATLAB
570
14
function [L, measurements] = zef_lead_field_normalize_maximum_data(lf_bank_index) %Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface %This function normalizes the lead field data for a given lead %field bank entry. %Description: Maximum data entry norm...
31a20646f7a0d04c1a268f1d9ab8f0dc23e5b9c5c2898e6768f600eac6fbd406
MATLAB
571
22
function [proj] = MeanMaxSTD( stackin, type ) % stackin is a single stack % type is mean, max, or std switch type case 'mean' proj = mean( stackin, 3 ); case 'max' proj = max( stackin, [], 3 ); case 'std' stackin = single(stackin); proj = std( stackin, 0, 3 ); case 'all'...
4d1d3775609d0712c2fde2399a0a34a284e66a8b08c4cc0351b69ac3b16b89c4
MATLAB
571
13
function [y_vals, plot_mode] = zef_corr_mean_scaling(time_series) %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 via the ZI use...
01de41c4027dc1859e855643570854b9e6591d126dcb9da10b0e6f6aa2bbca73
MATLAB
572
31
%% 1) N = 10; wb = parwaitbar(N); parfor i=1:N pause(0.1); wb.progress(); end %% 2) N = 100; wb = parwaitbar(N,'BarLength',10); for i=1:N pause(rand); wb.progress(); end %% 3) N = 100; wb = parwaitbar(N,'WaitMessage','Hang on...','FinalMessage','Done!'); parfor i=1:N pause(rand); wb.progress()...
6be0da15b5767a383e9f403b7f8891a1fb104f1942d6cc6c8a8887a24b5fc0c2
MATLAB
572
19
function [cf, bw, hf] = calc_cf_and_bw(t_vec, pulse_vec,varargin) if isempty(varargin) signal_threshold = -20; elseif length(varargin)>0 signal_threshold = -abs(varargin{1}); end f_vec = 1:ceil((length(pulse_vec)-1)/2); s_fft = fft(real(pulse_vec)); db_vec = db(abs(s_fft(2:1+ceil((length(pulse_vec)-1)/2)))); ...
bc2397e7f55d71b54359c0d52375bfc67e503325a24482dd2426d836e587406b
MATLAB
572
13
function [y_vals, plot_mode] = zef_corr_max_scaling(time_series) %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 via the ZI user...
d46dee707064a131a3478da35b04e442f40177eba94f8e89c444b7257afc2170
MATLAB
573
12
function [processed_data] = zef_zero_reference(f) %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 via the ZI user interface. %Th...
dc15e0a7460d7e2301b8a5934d734f8b40de38696da51736e233c096dfbfe510
MATLAB
573
27
% THIS FUNCTION IS PRIVATE AND SHOULD NOT BE CALLED BY OUTSIDE CODE! % function [res] = DoGetResultsCmd( s, cmd ) ChkConn( s ); ok = CalinsNetMex( 'sendString', s.handle, sprintf( '%s\n', cmd ) ); res = cell( 0 ); while( 1 ) line = CalinsNetMex( 'readLine', s.handle ); if( strcmp( ...
4f3bf070b6f003c95ff48ab0572f81990c9de9567610497ef15e16895e6312e3
MATLAB
574
19
function generate_model_structure(app) app.model_structure = axes('Parent', app.BigDecodingPlot, 'Units', 'pixels',... 'OuterPosition', [21 19 860 670], 'InnerPosition', [60.4000 54.4000 812.1000 615.3000],... 'Box', 'on'); set_common_plot_settings(app.model_structure); se...
c1ca4fb628974f40e1ea8a6b9d29a8ab8fa4142b4015d4f8623558c08a06f53e
MATLAB
574
22
function obj = calculate_gfp(obj) ; % Calculate GFP of time series if isempty(obj.modality) return end switch obj.modality case 'eeg' gfp = std(obj.data,[],2) ; method = 'std' ; case {'meg','source','ampenv'} gfp = vecnorm(obj.data,2,2)...
cfbfee9c5795d90d4c22cba10472f485984871f80c57800fe3f83907dd5b38ec
MATLAB
576
14
function [faces, faces_count] = zef_validate_faces(tetra) faces = [[sort(tetra(:,[2 4 3]),2) ones(size(tetra,1),1) [1:size(tetra,1)]']; [sort(tetra(:,[1 3 4]),2) 2*ones(size(tetra,1),1) [1:size(tetra,1)]']; [sort(tetra(:,[1 4 2]),2) 3*ones(size(tetra,1),1) [1:size(tetra,1)]']; [sort(tetra(:,[1 2 3]),2) 4...
18c16dfd22b191edbbd762b4d7cce0b952e2fc83d8d08f26358ca629667fef7e
MATLAB
578
19
function [P_store,z_inverse] = kalman_filter(m,P,A,Q,L,R, timeSteps ,number_of_frames, smoothing) P_store = cell(0); z_inverse = cell(0); h = zef_waitbar(0,1, 'Filtering'); for f_ind = 1: number_of_frames zef_waitbar(f_ind,number_of_frames,h,... ['Filtering ' int2str(f_ind) ' of ' int2str(number_of_frames) ...
f2e57d6fe570540a17e4b98c8d65265c5c05b7c408e3f0ce829ddb516e0a61e5
MATLAB
578
17
for zef_i = 1 : size(zef.init_profile,1) if not(isstring(zef.init_profile{zef_i,2})) zef.init_profile{zef_i,2} = num2str(zef.init_profile{zef_i,2}); end if isequal(zef.init_profile{zef_i,4},'string') eval(['zef.' zef.init_profile{zef_i,3} '= ''' zef.init_profile{zef_i,2} ''';']); else...
4ca39e9226715b4a75ea60b70be1f7ab56c0178b8e804d8fac77fabca305f069
MATLAB
579
13
function [y_vals, plot_mode] = zef_std_no_scaling(time_series) %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 via the ZI user i...
d6e460ea57210b4e570683d924542fb7213e33ca26618755210977c000610f85
MATLAB
579
18
% OV_MATLAB toolkit % OV_setFeatureVectorInputHeader.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % Set the header information on a Feature Vector input. function box_out = OV_setFeatureVectorOutputHeader(box_in, output_index, nb_features, labels) box_in.outputs...
951326c34821a579a4ab00d43d51f3cce6850c0e86e4d73b442e3539fc0b26c3
MATLAB
581
18
function s = getSynchronicity(Gamma,T) % Returns a time resolved measure of synchronicity, computed as the % maximum fractional occupancy across trials, i.e. for each time point % the across-trial average loading of the state that is more dominant % at this time point % % Author: Diego Vidaurre, OHBA, University ...
3d6f4d20f5598ad8013ffc5323b7264a168a6e64f605e673daebde9e885d1346
MATLAB
582
10
if isequal(zef.lock_sensor_sets_on,0) zef.h_sensors_table.ColumnEditable = logical(ones(1,size(zef.h_sensors_table.Data,2))); zef.h_menu_lock_sensor_sets_on.Text = 'Toggle ''On'' unlocked'; zef.h_menu_lock_sensor_sets_on.ForegroundColor = [0 0 0]; elseif isequal(zef.lock_sensor_sets_on,1) zef.h_sensors_...
8727f5737ae10b033325ddd581ea06cd8fe6be5f053cda390022a57e090a1ed5
MATLAB
582
24
function [vecFreq,vecPower] = getPowerSpectrum(varData,dblSampFreq,intDim) %% check inputs if ~exist('intDim','var') || isempty(intDim) intDim = 1; end %% calculate power spectrum dblT = 1/dblSampFreq; % Sampling period intL = size(varData,intDim); % Length of signal vecTime = (0:i...
5647b75f17126152dc11f8b518804991a49c98aacee9b5cf0cac496ab13d4c9a
MATLAB
584
20
% OV_MATLAB toolkit % OV_hasPendingInputChunk.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 13 Jan. 2012 % Tests if there is pending Input chunk in the buffer % ------------------------------- % MEANT TO BE USED IN USER SCRIPT function nb_pending = OV_getNbPendingInputChunk(box_in, ...
a469d307d6cef6665cc6df31836f669463e87b1dca95d103f31594fb777de1a3
MATLAB
587
24
function gaussVector = singleGaussian(xVector,params) %singleGaussian builds a Gaussian with inputs: (xVector,params) %params is a vector: [mu sigma peak baseline] %mu, sigma, peak, baseline mu=params(1); sigma=params(2); peak=params(3); baseline=params(4); %uses matlab's built-in normpdf() function gauss ...
27a48c19aee48e57c1d7c02c3ce9bb454a4bc4781f4b68aa24a166cad482990e
MATLAB
588
26
if not(isfield(zef,'inv_hyperprior_tail_length_db')); zef.inv_hyperprior_tail_length_db = 10; end; if not(isfield(zef,'inv_prior_over_measurement_db')); zef.inv_prior_over_measurement_db = 0; end; if not(isfield(zef,'inv_snr')); zef.inv_snr = 30; end; if not(isfield(zef,'inv_hyperprior')); zef.inv_hyp...
3efcd70d906e47b15d97db47e26152c79878296da309af0350fe484f116ee7af
MATLAB
588
14
%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] = uigetfile('*.mat','Merge lead field with...',zef.save_file_path); else [zef.file zef.file_path] = uig...
f88a224b81838b6b673c95a8e2815f7311d0d1cb560fc964b2cc01946fc3a80b
MATLAB
588
24
function C = map_centroids(X,modality) switch modality case 'eeg' X = X-mean(X) ; % re-reference to average centfun = @(v1) v1 ; case 'meg' % do nothing centfun = @(v1) v1 ; case 'source' X = abs(X) ; centfun = @(v1) abs(v1) ; case 'ampenv' % ...
0ef42d565bebe8cf7e1c8a72662b31fcb0201fa5990f35feecf199a989361dfa
MATLAB
589
16
%Copyright © 2018- Joonas Lahtinen, Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface %Update script for possibly hidden advanced plot options for GMM app. zef_ind = find(strcmp(zef.GMM.parameters.Tags,'dip_num')); if isempty(zef.GMM.parameters.Values{zef_ind}) ze...
44c39a22b57e7ad38829bacfa6cc43f8c64171e5273029a371825ae47fc019ca
MATLAB
590
13
function binned = times2counts(st, factor) %TIMES2COUNTS Bin spike times to counts with linear interpolation % BINNED = TIMES2COUNTS(ST,FACTOR) will sum up spike-time timestamps ST % into bins of length 1.0/FACTOR samples, distributing the point mass of % each spike across two adjacent bins via linear interpola...
d54356584e59e34fe9f70a2d63f2649120f4ccf22154a9111cd2fc5d691b768f
MATLAB
590
13
load(['..',filesep,'data',filesep,'DWIBEHAV']); load(['..',filesep,'data',filesep,'DWIBEHAV_RAW']); for row=2:size(CRcell,1) if CRcell{row,9}==1 % p <.05 *sig X=CORR_RAW.(CRcell{row,1}).(CRcell{row,2}).(CRcell{row,3}).(CRcell{row,4}).(CRcell{row,5}).DWI; Y=CORR_RAW.(CRcell{row,1}).(CRc...
d1f9b020fa5c34d9059ebe7c2272480daf6fec45f25a6b6a2dc07c8836da5876
MATLAB
592
21
function ET_startRecording() %ET_startRecording Function to run at recording start %get globals global sET; global sEyeFig; %set recording text set(sEyeFig.ptrTextRecording,'String','Recording','ForegroundColor',[0 0.8 0]); %lock gui ET_lock(sEyeFig); set(sEyeFig.ptrToggleConnectSGL,'Enable','off'); sET.b...
2e80ec7df82c8a2d1edbcc4085884fa27c5b42b3349517e5644682aa130311e0
MATLAB
593
25
function kappa = zef_update_zoom(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,'Children'),'Tag','axes1'...
6a2221a4fe8eda4e904e7f005b5adfd3920a619dedbacafc7af882c46a48b057
MATLAB
594
24
function s = getAccuracy(X,Y,T,Gamma,options,do_preproc) % Returns a time resolved (cross-validated) measure of accuracy % % Author: Diego Vidaurre, OHBA, University of Oxford (2018) if nargin<6, do_preproc = 1; end if nargin<5, options = struct(); end if ~all(T(1)==T) error('Synchronisity can only be measured if ...
721fcc804cb3777901960fa5aabb019119aa85bc2a41daa2b59383e4aa241e49
MATLAB
594
18
function [Ytest,d,C] = fgmdm(COVtest,COVtrain,Ytrain,varargin) if isempty(varargin) method_mean = 'riemann'; method_dist = 'riemann'; else method_mean = varargin{1}; method_dist = varargin{2}; end labels = unique(Ytrain); Nclass = length(labels); % geodesic ...
a6043a41c6f808c4229e5e497a247ecb5cb8a37d6d43db1c3afb81b0f7d324e8
MATLAB
594
32
function zef = zef_add_compartment(zef) if nargin == 0 zef = evalin('base','zef'); end zef.aux_field_1 = zef.h_compartment_table.Data; zef = zef_create_compartment(zef,zef_compartment_tag(zef)); zef_i = size(zef.aux_field_1,1) + 1; zef_j = 1; zef_init_fields_compartment_table; zef = zef_apply_parameter_profile(...
d631b6bc806d5647905afe40176cc83ba554fce390023c6feb425a16aa7c1005
MATLAB
594
18
function y = logisticfitx0(beta,x) %logisticfit0 Logistic growth centered at (x=0,y=0) % Syntax: y = logisticfit0(beta,x) % beta(1) = L (asymptote) [default 1] % beta(2) = k (slope) [default 1] % beta(3) = x0 (x-offset) [default 0] % beta(4) = y0 (y-offset) [default 0] %define parameters if length(beta) < 1...
14f33e317ae877829736dfa650c3cc7b4707f92bb13d96ccfc6ac86a2716dc83
MATLAB
597
14
function [L, measurements] = zef_lead_field_normalize_frobenius(lf_bank_index) %Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface %This function normalizes the lead field data for a given lead %field bank entry. %Description: Frobenius norm normalizati...
4162a5131cb0061991470ef552a2d895a7edb26c4cf5047c814a432f946b40d3
MATLAB
597
19
function generate_model_evaluation(app) app.model_evaluation = axes('Parent', app.ViewDecodingPerfPanel, 'Units', 'pixels',... 'OuterPosition', [9 10 423 236], 'InnerPosition', [32.4000 45.4000 375.1000 181.3000],... 'Box', 'on'); set_common_plot_settings(app.mo...
b272b78904ebda897d39448ebdebf101ac766f6107db07ea6078106a4375e511
MATLAB
597
20
% OV_MATLAB toolkit % OV_hasPendingOutputChunk.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 13 Jan. 2012 % Tests if there is pending output chunk in the buffer % ------------------------------- % MEANT TO BE USED IN USER SCRIPT function nb_pending = OV_getNbPendingOutputChunk(box_i...
fa4e8d6d241041ed7e5024ddb5b65c9b04e82b71f951229ef79a293b57dd78c9
MATLAB
598
22
function [hMain,hTop,hRight]=multiGraph(varargin) %multiGraph Makes 3 axes in a single graph % Syntax: [hMain,hTop,hRight]=multiGraph([left offset] [,bottom offset] [,size of small graphs]) % params must contain four values: %lO1: left offset %bO1: bottom offset %sGZ: size of small graphs figure [lO1,bO1,sGZ] ...
31898782c47d507695a653ce4dcc2c51431561d3083cd2b2b751475619921860
MATLAB
600
10
if isequal(zef.lock_sensor_names_on,0) zef.h_sensors_name_table.ColumnEditable = logical(ones(1,size(zef.h_sensors_name_table.Data,2))); zef.h_menu_lock_sensor_names_on.Text = 'Toggle unlocked'; zef.h_menu_lock_sensor_names_on.ForegroundColor = [0 0 0]; elseif isequal(zef.lock_sensor_names_on,1) zef.h_s...
dc603bafb9243ce7fc1b77a672d1ba55d58bf02cd246b1f20e626085772dcc2f
MATLAB
600
16
function zef_update_contour(zef) if eval('zef.show_contour') h_fig = gcf; h_axes = findobj(h_fig.Children,'Tag','axes1'); h_contour_old = findobj(h_axes.Children,'Tag','contour'); delete(h_contour_old); h_contour_text_old = findobj(h_axes.Children,'Tag','contour_text'); delete(h_contour_text_ol...
36fdfa41d487990c81f8f7965c7bb74d563487f51dbe359a24cec203707c4b52
MATLAB
601
9
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.bf_sampling_frequency = str2num(get(zef.h_bf_sampling_frequency,'string')); zef.bf_low_cut_frequency = str2num(get(zef.h_bf_low_cut_frequency,'string')); zef.bf_high_cut_frequency = str2num(get(zef...
698c1de8166e6d3395859b66fd61cf57643509a293df1ff1d3f16fbece0e7b48
MATLAB
601
17
% t50 rise alignment function [ t50rise, t50riseIndex ] = t50rise( x, y ) % y data, assumes data have been: % baseline zeroed and there's a single peak % t50rise is the interpolated time of 50% rise % t50riseIndex is the index of the last point below 50% rise amplitude = max(y); crossings = FindLevel( x, y, 0.5*ampl...
269fafa10aff24097581287d839516a532cb49f2d12c40399cb6fefdcc5ff513
MATLAB
602
23
function tr = multitrace(A) % Computes the traces of the 2D slices in a 3D matrix. % % function tr = multitrace(A) % % For a 3-dimensional matrix A of size n-by-n-by-N, returns a column vector % tr of length N such that tr(k) = trace(A(:, :, k)); % % See also: multiprod multitransp multiscale % This file is part of M...
7ee314966a68dd4482a467adac56694fd401b047eb161c2c15c1e27f06748ac8
MATLAB
606
33
function [xarray , Ndata] = vb_cell_merge(xcell) % merge cell array into vector % [xarray , Ndata] = vb_cell_merge(xcell) % --- Input % xcell : cell array % ---Output % xarray : concatenated data vector % Ndata(n) : number of data in xcell{n} % % M. Sato 2006-7-21 % % Copyright (C) 2011, ATR All Rights Reserved. % Lic...
09734eedb9d68ec4941277bb8519b7f22e963e62bdf5d3f9d37a9beecdbf2c53
MATLAB
608
20
function hmm = clearTPM(hmm) % Removes the information about the state transition probabilities (hmm.P) % and the initial probabilities (hmm.Pi). % This is useful if the model is to be applied to a different data set % where the underlying system may be different % % Author: Diego Vidaurre (2020) University of Oxford ...
0a65523f576a16902f53ba41d36ad098a2e5146ff0a6ce1f22762c80bce4fb5a
MATLAB
611
26
function contrast_val = zef_update_contrast(varargin) slider_value_new = evalin('base','zef.h_update_contrast.Value'); if not(isempty(varargin)) h = varargin{1}; else h = evalin('base','zef.h_axes1'); end if not(isempty(varargin)) if length(varargin) > 1 slider_value_new = varargin{2}; end en...
6bec7f0f2ebff687eaa4ee394d6612f20121a9d6b1359efcc024273def7bc02a
MATLAB
611
24
function [y_vals, plot_mode] = zef_parcellation_boxplot_amplitude(time_series) % Description: Amplitude boxplot plot_mode = 4; % custom mode for boxplot rendering if ~iscell(time_series) error('Time series must be a cell array for boxplot mode.'); end [num_rois, num_frames] = size(time_series); y_vals = cell(num...
ce5888b3a321a94d67950f8d66521ab033af8691b3b3945bac3c407e566420a9
MATLAB
611
29
function zef = zef_dataBank_FunctionsDropDown(zef) if nargin == 0 zef = evalin('base','zef'); end zef.dataBank.app.combinePanel.Visible='Off'; zef.dataBank.app.importPanel.Visible='Off'; zef.dataBank.app.mag2gragPanel.Visible='Off'; switch zef.dataBank.app.FunctionsDropDown.Value case 'combine Lf' z...
e0c456886b3a437d231e35360b941f738e779eb93bddd40d74d37d75d4072623
MATLAB
614
30
function [tree, hash] = zef_dataBank_add(tree, parentHash, data) %getData (before!) %make new node %identify parent %add to parent %update gui other function node=[]; node.data=data; node.type=data.type; node.name=data.type; if strcmp(data.type, 'reconstruction') && isfield(node.data, 'reconstruction_information'...
0ab5174ae4ce5497f574cdf1da886c040c96e6627fc05cc95a9ec5f5b0701999
MATLAB
616
15
function generate_rms_degree_structural_learning(app) app.rms_degree_structural_learning = axes('Parent', app.DegreesSL, 'Units', 'pixels',... 'OuterPosition', [566,9,171,210], 'InnerPosition', [586.7333 44.4 126.6 139.3],... 'Box', 'on'); set_common_plot_settings(app.rms_degree_structu...
1c292795444ba4b8007d69b6e01e577d5919ed2d5960f50692770a6397fbe8f6
MATLAB
616
19
% openvibe toolbox for Matlab % OV_addInputBuffer.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 13 Jan. 2012 % Appends a new signal chunk to a signal input buffer in a matlab box instance. % ------------------------------- % MEANT TO BE USED BY OPENVIBE function box_out = OV_addInpu...
53e3747444f8e720b53df80450ffec61905b01961aad0a3e3e45ba57df2e999d
MATLAB
616
27
function brightness_val = zef_update_brightness(varargin) slider_value_new = evalin('base','zef.h_update_brightness.Value'); if not(isempty(varargin)) h = varargin{1}; else h = evalin('base','zef.h_axes1'); end if not(isempty(varargin)) if length(varargin) > 1 slider_value_new = varargin{1}; ...
778e06790035966d51c584f00ae979d3f7a61dd1120c12f1e7bd07d02c574845
MATLAB
616
21
function dblCorr = getCorrAtAngle(dblAngle,vecX,vecY,vecV) %getCorrAtAngle Correlation of vecV with location of X/Y projected unto a line with angle dblAngle % dblCorr = getCorrAtAngle(dblAngle,vecX,vecY,vecV) %center x/y vecX=zscore(vecX(:)); vecY=zscore(vecY(:)); matXY=[vecX vecY]'; %rotate reference vecto...
8d3680003b7196fe763c73958f4484d6985cf7c9171d99e957fc525387faf349
MATLAB
616
30
function zef_make_package(program_path,package_name) if nargin == 1 package_name = 'zeffiro'; end fprintf(['Adding the following list of files into +' package_name ' package:\n'],'%s') package_path = [program_path filesep '+' package_name]; if exist(package_path) rmdir(package_path,'s'); end mkdir(package_pa...
3a44a87df587f1cf9ebfffa9197a6e1fbcf8dce659d7d9ac9cc4130147d1eda7
MATLAB
617
14
function [L, measurements] = zef_lead_field_normalize_mean_data(lf_bank_index) %Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface %This function normalizes the lead field data for a given lead %field bank entry. %Description: Mean data norm normalizati...
6e7d1cad5663b32c7ffe80e16c80bceb2c64f8cb643582ff0f95143b6de0db7b
MATLAB
617
15
function generate_complexity_structural_learning(app) app.complexity_structural_learning = axes('Parent', app.DegreesSL, 'Units', 'pixels',... 'OuterPosition', [751,9,171,210], 'InnerPosition', [771.7333 44.4 126.6 139.3],... 'Box', 'on'); set_common_plot_settings(app.complexity_structu...
cd590b692fdffe1b4e8b0f8a70d781378804e64e2b7ee10bf934d7d0eeabef65
MATLAB
617
17
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D function [boundary_vec_1, boundary_vec_2] = boundary_point_source(source_points, orbit_triangles, orbit_nodes) n_triangles = size(orbit_triangles(:,1), 1); n_nodes = size(orbit_nodes(:,1), 1); ...
946248d5a51aba0126b15fad9a705c649c3983acda1a15289d114d89640289fe
MATLAB
619
28
function zef = zef_dataBank_exportButtonPress(zef) if nargin == 0 zef = evalin('base','zef'); end zef_dataBank_getHashForMenu; [savefile,savepath] = uiputfile('*','Select a file'); if strcmp(zef.dataBank.app.typeDropDown.Value, 'Node') data=zef.dataBank.tree.(zef.dataBank.hash); if isobject(data.data) ...
823e93c513ed64440fe67c2eebf90c5644cd20ee5e576108756dfd99285512a4
MATLAB
621
13
function bsling_plotrawdata(X_clear_sham,clear_sham_raw_mean,clear_sham_raw_se,Y_clear_sham,COL) figure; plot(X_clear_sham,Y_clear_sham,'Color',COL,'LineWidth',2); hold on % errorbar(1:5,clear_sham_raw_mean,clear_sham_raw_se,'o','Color',COL,'MarkerFaceColor',COL,'LineWidth',1.5); xlim([1 5]) set(gca,'XTick',1:5,...
cd133346d487b7a8560f47cb9b418abf281268f32c23ae3335fc3c2b73c43a61
MATLAB
621
24
function labels = loadMNISTLabels(filename) %loadMNISTLabels returns a [number of MNIST images]x1 matrix containing %the labels for the MNIST images fp = fopen(filename, 'rb'); assert(fp ~= -1, ['Could not open ', filename, '']); magic = fread(fp, 1, 'int32', 0, 'ieee-be'); assert(magic == 2049, ['Bad magic number in...
f0f13fd37e1860a4def31b52726d1dba9ae5e054aa56be291f8db51f65fc63fc
MATLAB
621
7
function [roi_ind_1, roi_ind_2, roi_ind_3] = zef_nse_roi_ind(zef,nse_field) roi_ind_1 = find(sqrt(sum((zef.source_positions - repmat([nse_field.roi_x nse_field.roi_y nse_field.roi_z],size(zef.source_positions,1),1)).^2,2))<= nse_field.roi_radius); roi_ind_2 = setdiff(roi_ind_1, find(sqrt(sum((zef.source_positions - re...
096e423bbdf6063f7ac3bdef8f2fc8c73b9a60bf7f5af083e332c5a04c91af9a
MATLAB
622
22
function imageEnhanced = imenhance(image) %imHQ Transform image to contrast-enhanced version % imageEnhanced = imHQ(image) image = im2double(image); imageEnhanced = zeros(size(image)); for intCh=1:size(image,3) imThis = image(:,:,intCh); imThis(isnan(imThis)) = nanmean(imThis(:)); imMin = min(imThis(:)); ...
bf788ee705a7653d8c48c55f543ba01f646a2df0ae1899c23fb3b94604913759
MATLAB
622
25
% Calculates the mean of the 50 rec of the project file 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; number_of_frames = le...
e3b6a6f52cb1990f74cd297701bc8b86e29ddd2d598d9d28f541189138e79676
MATLAB
622
15
function generate_mean_degree_structural_learning(app) app.mean_degree_structural_learning = axes('Parent', app.DegreesSL, 'Units', 'pixels',... 'OuterPosition', [206 9 171 210], 'InnerPosition',... [225.4 44.4 126.6 139.3], 'Box', 'on'); set_common_plot_settings(app.mean_degree_structu...
030ab2755cc9a26a30d6abdba6020763e8687c3676fb450758fef4db94f9dea1
MATLAB
623
28
function vecY = getCumGauss(varargin) %UNTITLED Summary of this function goes here % Detailed explanation goes here if nargin == 2 vecParams = varargin{1}; vecX = varargin{2}; elseif nargin > 2 && nargin < 5 vecParams(1:2) = varargin{1}; vecX = varargin{2}; vecParams = [vecParams varargin{3}]; end i...
ce3e937d89bbacdb8e21ddceee766a4ff9072969fc410de1085eae3680c5a110
MATLAB
623
19
function dblPosInt = getLiberalness(vecData) %getLiberalness Summary of this function goes here % dblPosInt = getLiberalness(vecData) if ~isvector(vecData) || length(vecData) < 3 error('not a vector'); end %sort vecData = sort(vecData(:)); intN = numel(vecData); vecNorm = linspace(1/intN,1,intN); %theor...
8673ea01a1070e4be050a31a60819d599326e696d9139430b531461f2b335ebe
MATLAB
624
15
%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 zef.file_type] = uigetfile({'*.mat','*.dat'},'Import',zef.save_file_path); else [zef.file zef.file_path ...
74757768850a76e0c5c1cdeee4d362b295eab1f766711c407c08c3b88f617723
MATLAB
625
18
function [nodes, triangles] = zef_create_sphere(radius, centre_point, n_faces) warning off; [x, y, z] = sphere(ceil(sqrt(8*n_faces))); tr = delaunayTriangulation([x(:) y(:) z(:)]); fe = freeBoundary(tr); p = reducepatch(patch('Faces',fe,'Vertices',tr.Points),4*n_faces); p = reducepatch(patch('Faces',p.faces,'Vertices'...
28b6f78945869bc2814cb5aac0bd8462025b5f413bb90a3cda8667eead9dccfd
MATLAB
626
20
% openvibe toolbox for Matlab % OV_addOutputBuffer.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 13 Jan. 2012 % Appends a new chunk in an output buffer, % meant to be popped by the openvibe box. % ------------------------------- % MEANT TO BE USED IN USER SCRIPT function box_out = ...
7469517547d12cf02ad641c196885a349ab41fd39acd4256cb4c69fbfe065be6
MATLAB
626
18
function len_MAT = fun_cal_len_LRC(MAT,thr) ind_conn = find(abs(MAT)>thr); len_MAT = zeros(size(MAT,1),size(MAT,2)); for ii = 1:length(ind_conn) input_pos = floor((ind_conn(ii)-1)/size(MAT,1))+1; input_xpos = floor((input_pos-1)/sqrt(size(MAT,2)))+1; input_ypos = mod(input_pos-1,sqrt(size(MAT,2)))...
3459422e9bcd7d27b1afa50cfde4432d263db53f0951a2b66cef671a43ea4935
MATLAB
627
24
function [tree] = zef_dataBank_delete(tree, parentHash, save2disk) hashNames=fieldnames(tree); for i=1:length(hashNames) if startsWith(hashNames{i}, strcat(parentHash, '_')) || strcmp(hashNames{i}, parentHash) %only children should be deleted. node_11 should not be deleted by node_1 if isobject(tree.(has...
d128d574833d0d9d0db2771b7f2ac9dffd40c2d9c1effdfa0981e8579f286133
MATLAB
627
26
function zef_set_compartment_color color_vec = uisetcolor; item_ind = evalin('base','zef.h_compartment_visible_color.Value'); compartment_tags = evalin('base','zef.compartment_tags'); if not(isequal(color_vec,0)) zef_j = 0; for zef_i = length(compartment_tags) : -1 : 1 if evalin('base',['zef.' compartment_tags{z...
0df0bc59c6544e4d8a1772904b6ba537aa1f60c49cedcd640b36ebfe7e32ef26
MATLAB
628
18
function len_MAT = fun_cal_len_input(MAT,thr) ind_conn = find(abs(MAT)>thr); len_MAT = zeros(size(MAT,1),size(MAT,2)); for ii = 1:length(ind_conn) input_pos = floor((ind_conn(ii)-1)/size(MAT,1))+1; input_xpos = floor((input_pos-1)/sqrt(size(MAT,1)))+1; input_ypos = mod(input_pos-1,sqrt(size(MAT,1)...
10f155d4f2bae53b9d34e74e313826f64403748ab836e7138c4ea67a9733deac
MATLAB
628
24
function zef = zef_tes_lead_field(zef) if nargin == 0 zef = evalin('base','zef'); end warning('off'); zef.lead_field_type = 5; zef.imaging_method = 1; zef_delete_original_field; zef = zef_process_meshes(zef); zef.sensors_attached_volume = zef_attach_sensors_volume(zef,zef.sensors); zef = zef_lead_field_matrix(zef...
4b27ebe3135f8a14fddc96b0e779bf921339a07583870e1cd0646876471287ab
MATLAB
628
11
function [m, P] = class_kf_predict(KFclassObj) % kf_predict is the prediction step of kalman filter % Skip multiplications if A is Indentity if (isdiag(KFclassObj.state_transition_model_A) && all(diag(KFclassObj.state_transition_model_A) - 1) < eps) P = KFclassObj.prev_step_posterior_cov + KFclassObj.e...
5eb1375c350b26f5e47fa06fe23390afa5f1e4f562641a88495850cac1eb00a6
MATLAB
628
11
function optimize_button_pushed(app) app_handles = struct(); app_handles.plot_axis = app.optimization_plot; app_handles.all_struct_handle = app.TotalPassedStructuresEditField; app_handles.all_model_learned_handle = app.TotalLearnedModelsEditField; app_handles.s_handle = app.SelectedLambdasTextArea; ...
ccfe059fc1958cf5d3e7d952cbcabbc0f8aa82bcb52b1ab77b9d7280e0b8ede2
MATLAB
628
15
function plot_parameter_space_structural_learning(app) newcolors = app.newcolors; slambda_seq = app.params.s_lambda_sequence_glm; num_slambda = [1:app.params.s_lambda_count]; app.parameter_space_structural_learning.ColorOrder = newcolors; app.parameter_space_structural_learning.NextPlot = 'replacechildren'; area(a...
11084e917a1a91a67cae466e52fd6803bd484de6c17a1ac7817c95136afd2ca6
MATLAB
629
21
function DDATA=bsliang_selectINDdata(DATA,rej_ind,mode) % ¸öÌå²ãÃæÉ¾Êý¾Ý if isequal(mode,'rej') for ind=rej_ind DATA(ind).par_info=[]; DATA(ind).def_range=[]; DATA(ind).practice=[]; DATA(ind).Id_Di=[]; end elseif isequal(mode,'select') ...
38d44a25a1cdbfa2002dd2ebe4f762bdf1b4ba3050fd3c1ae57783c1881cd808
MATLAB
629
22
% openvibe toolbox for Matlab % OV_getSignalOutputHeader.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_features, labels] = OV_getFeatureVectorOutputHeader(box_in, output...
b42400b8d2790bac4e7546bf08f16c3ac6a41e0ae8b26439d94877265ab805dc
MATLAB
629
24
function zef = zef_eeg_lead_field(zef) if nargin == 0 zef = evalin('base','zef'); end warning('off'); zef.lead_field_type = 1; zef.imaging_method = 1; zef_delete_original_field; zef = zef_process_meshes(zef); zef.sensors_attached_volume = zef_attach_sensors_volume(zef,zef.sensors); zef = zef_lead_field_matrix(zef...
d739c5b20baa459ccec5b51e4d27429989933fe4caff31b702a08914b4a0a366
MATLAB
629
30
function rdm = rdm_fn(La, Lfem) % Documentation % % Calculates the Relative Difference Measure (RDM) for a given analytical % lead field La and a numerically produced Lfem. % % Inputs: % % - La: the analytical lead field (or other matrix) % % - Lfem: the numerical matrix we are comparing to La. % % Output % % - rdm: t...
d82e8dee54fecea3b2d963f4fbc6f8c2f8f8144c0c68b2373c1f627204d1c24c
MATLAB
630
15
function plot_parameter_space_parameter_estimation(app) newcolors = app.newcolors; plambda_seq = app.params.p_lambda_sequence; num_plambda = [1:app.params.p_lambda_count]; app.parameter_space_parameter_estimation.ColorOrder = newcolors; app.parameter_space_parameter_estimation.NextPlot = 'replacechildren'; area(ap...
27814da178b5f3860e96c1246133c7fb1adace8af100b485f6a424e6dd25c67e
MATLAB
632
22
function [p,chi2stat] = chi2test(mat2x2) %UNTITLED Summary of this function goes here % Detailed explanation goes here % Observed data n1 = mat2x2(1,1); N1 = mat2x2(1,2); n2 = mat2x2(2,1); N2 = mat2x2(2,2); % Pooled estimate of proportion p0 = (n1+n2) / (N1+N2); ...
c37dea9c2755ce8dc312cff759d3b745201a06eaf5615bb81d6e32fdbcb24009
MATLAB
632
33
% from Means of Hermitian positive-definite matrices based on the log-determinant α-divergence function % Zeineb Chebbi , Maher Moakher. function A = logdet_mean(B) K = size(B,3); % Nombre de matrices A = mean(B,3); tol = 10^-3; imp = tol + 1; while imp>tol fc = zeros(size(B,1)); for i=1:K fc = fc +...
1ae9b0ea43e1f06563694bd4111e599fd77c0d91a2f4324db59b6193bd9ed289
MATLAB
633
24
function zef_PlotSourceButton_Callback(~, ~) try treeObj = evalin('base','zef.h_source_tree.SourceTree'); catch error('PlotSourceButton: treeObj not found in base workspace.'); end try h_axes = evalin('base','zef.h_axes1'); catch error('PlotSourceButton: zef.h_axes1 not found in base workspace.'); end ...
8c0b8a0f3f5a2b2be7ff8c9211ce2b84b80cc69bcac65727c05eba2eb13ddf6f
MATLAB
633
23
function MaxProj = projectMaxAnalysis( stackY1, stackY2a, stackY2b ) % max projection, sd projection? tic MaxProj = max( stackY1, [], 3 ); %MaxProj2 = histeq( MaxProj ); df = figure; % target for data plot imgf = figure; mp = imshow( MaxProj ); clim( 'auto' ); dcm = datacursormode; % use cursor to id pixel for plot dc...
cc2f84c4fad2cc6c148dd1a4d20eaacd4d05be4d3f74547fef999ba24473c822
MATLAB
633
25
function Hn = harmonicnumber(n,intForceType) %harmonicnumber n'th harmonic number % Hn = harmonicnumber(n) if ~exist('intForceType','var') || isempty(intForceType) intForceType = 0; end indApprox = intForceType == 1 | (n > (10^8)) & intForceType ~= 2; Hn = zeros(size(n)); for intRunType=1:2 if intRunType...
d6c841b30859359e01c133faf916088ed48238a60a217c5891e693c76a93c237
MATLAB
633
29
function ETO_DeleteFcn %UNTITLED Summary of this function goes here % Detailed explanation goes here %globals global sFigETO; global sETO; %close sFigETO.IsRunning = false; %save config to ini strPathFile = mfilename('fullpath'); cellDirs = strsplit(strPathFile,filesep); strPath = strjoin(cellDirs(1:...
3d34481afc89364d041757087b83111a55921d6f395339c2588d38730ad3c053
MATLAB
634
21
function [ordered_maps,map_similarity,order] = align_maps2template(maps,templates,modality,keep_polarity) simfun = microstate.functions.map_similarity_funhandle(modality,keep_polarity) ; for iter = 1:size(templates,2) R = simfun(maps',templates') ; [j,i] = find(R == max(R(:))) ; order(j) = i ; ord...
673e8c777f11ade5bc5f132cfe28481da7d713c3aa1bfe0741d59f141eb6054c
MATLAB
634
32
function prec = ssor ( A, kwargs ) % % prec = ssor ( A, kwargs ) % % Computes the SSOR preconditioner for the matrix A of a system Ax = b. % % kwargs: % % - coeff = 1 % % The preconditioner constant used in the computation. The default value of 1 % corresponds to the Gauss--Seidel preconditioner. % arguments ...
d104cef80ae4c058698b1035acb4cb575b7c0b63abe349ece14ac9c139a76523
MATLAB
634
24
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [void] = zef_switch_color(tag_str_1,tag_str_2,variable_name) void = []; mlapp_flag = evalin('base','zef.mlapp'); if mlapp_flag == 1 color_str = 'fontcolor'; else color_str = 'foregro...