sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d3de2176d6fcccc07471a48bae4080b7cfb71875ffbd7a343e2ab140d48c4762
MATLAB
424
17
function [tree] = zef_dataBank_loadTreeNodes(tree) %changes the data in the tree nodes from matFileObject to struct by loading %the files dbFieldNames=fieldnames(tree); folder=extractBefore(tree.(dbFieldNames{1}).data.Properties.Source, 'node_'); for i=1:length(dbFieldNames) tree.(dbFieldNames{i}).data=load(tre...
7e35f6f76336746d2ffde8fbfca1c0d97ddad9a4aa41cf510b87cf963b8c4044
MATLAB
425
19
function mag = mag_fn(La, Lfem) % Documentation % % Calculates the MAG difference measure 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: the N × 1 MA...
feb4dcb1f089b5b3d14705d625a8887f222e43fd0886308ce5874342e420e7e7
MATLAB
425
16
% OV_MATLAB toolkit % OV_setStimulationOutputHeader.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % Set the header information on a Stimulation input. function box_out = OV_setStimulationOutputHeader(box_in, output_index) box_in.outputs{output_index}.header.type ...
18d0af76062f5f68026cb946362cdf339744f17308d9ecbfafdd8beda38a177d
MATLAB
426
14
function colormap_vec = zef_colormap(inv_colormap) if isequal(evalin('caller','exist(''zef'')'),1) zef = evalin('caller','zef'); else zef = evalin('base','zef'); end colortune_param = eval('zef.colortune_param'); colormap_size = eval('zef.colormap_size'); colormap_cell = eval('zef.colormap_cell'); colormap_ve...
4cea34ca2c7e9e50c82ef3cf5852682404e9712b7ea7ce911cf3f694836914e9
MATLAB
426
12
% --- Simulate (delay-free, looped passes) --- zef.source_tree_simulated = zef_simulate_jr_tree( ... zef.source_tree, ... zef.source_tree_signal_parameters ); % --- Publish with delays (pure time translation only) --- zef.source_tree_published = zef_publish_jr_tree_delays( ... ...
559c7fa62b4833b0b008f2cc9ac4db0f4b6a68e6986e2c0ec85f905a91275240
MATLAB
426
16
% OV_MATLAB toolkit % OV_setChannelLocalizationInputHeader.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % Set the header information on a Stimulation input. function box_out = OV_setStimulationInputHeader(box_in, input_index) box_in.inputs{input_index}.header.ty...
5a637c807e9174639dc980c2afe0cbac68d3f22481a397666b1c1e995d41680e
MATLAB
426
16
% OV_MATLAB toolkit % OV_setStimulationOutputHeader.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % Set the header information on a Stimulation input. function box_out = OV_setStimulationsOutputHeader(box_in, output_index) box_in.outputs{output_index}.header.type...
d3138db432e3c64b71cb42f336cbceb65f272139e380fae83d62f7af5ea0d166
MATLAB
427
15
function boolEsc = CheckEsc() %CheckEsc Checks if escape button is pressed % boolEsc=any(strcmpi(KbName(keyCode),'escape')); %check if psychtoolbox is installed if exist('KbName','file') KbName('UnifyKeyNames'); [keyIsDown, secs, keyCode] = KbCheck(); boolEsc=any(strcmpi(KbName(keyCode),'escape')); else ...
f6b5907d8da2cc178c3a86080791aeb6db3d9a50f84ed884aaf099caed793ec0
MATLAB
427
16
% OV_MATLAB toolkit % OV_setChannelLocalizationInputHeader.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % Set the header information on a Stimulation input. function box_out = OV_setStimulationsInputHeader(box_in, input_index) box_in.inputs{input_index}.header.t...
9c5328d9b6995435e16e69e4282d2ed9ba87dd6883da61266a1a05d84a56a45a
MATLAB
428
20
ns = 3; ny = 3; nz = 3; N = ns*ny*nz; P = zeros(N); P = sort([0, rand(1,N-1), 1]); P = P(end:-1:2)-P(end-1:-1:1); P = P/sum(P); Pzys = reshape(P,nz,ny,ns); Psy = squeeze(sum(Pzys,1))'; Psz = squeeze(sum(Pzys,2))'; maxiter = 1000; T = 1; innerstop = 1; eps = 6; [UI,~]=admUIg(Psy, Psz, T, inne...
e7ecca4ec5e280775692c49a0f3f04d756b944065ee33381115a7ebb8aa0044a
MATLAB
428
17
%-------------------------------------------------------------------------------- % func.m % % Copyright (C) 2024 Takuya Isomura % (RIKEN Center for Brain Science) % % 2024-10-28 %-------------------------------------------------------------------------------- function y = func(f,x) y = cell2mat(cellfun(f, x, 'Unifo...
07f33f9368d00c0ee2505199a53211805e4044fd320d5149b32df4f442ce7732
MATLAB
430
14
function [d] = zef_determinant(a,b,c,varargin) det_dir = 2; if not(isempty(varargin)) det_dir = varargin{1}; end if det_dir == 1; d = a(1,:).*(b(2,:).*c(3,:) - c(2,:).*b(3,:)) - b(1,:).*(a(2,:).*c(3,:) - c(2,:).*a(3,:)) + c(1,:).*(a(2,:).*b(3,:) - b(2,:).*a(3,:)); else d = a(:,1).*(b(:,2).*c(:,3) - c(:,2...
0257dbf9a5481a84b65463944f1fb6d35e999388ed8b39de7c39ae253ef17418
MATLAB
432
16
function str = zef_string_from_source_model(input) % Converts a core.ZefSourceModel input into a character array. switch input case core.ZefSourceModel.Error str = 'Error'; case core.ZefSourceModel.Whitney str = 'Whitney'; case core.ZefSourceModel.Hdiv str = 'H(div)' otherwise ...
c9fa999118effe19df8d00ee6362ef040d0c9cabc7fd7165f78f9e4442531314
MATLAB
432
16
function zef_data = zef_get_fields(fieldnames_aux, zef) %zef_get_data gets the fields of struct zef and returns them %as the fields of struct zef_data. %Input: struct zef, cell fieldnames_aux (field names as 1xN cell) %Output: struct zef. if nargin == 1 zef = evalin('base','zef'); end zef_data = struct; for zef_i...
f7b52fa4c8e7d5e00f0187dee246075191a613589d8405c170d88cd1ec7c09c7
MATLAB
432
20
function data = nl2lin_transform(data, Model, range, thr) if nargin<3, range = [1.5 max(data.y)]; end if nargin<4, thr = max(data.y)*3; end if isempty(Model.nl_model) disp('No nonlinear model found!') return end ix = data.y>=range(1) & data.y<=range(2); % transform data ty = data.y; ty(ix) = real(feval(Model...
85eb0cc1a5914ac5b4181224e7aa03ca0ba73d68cbdcd1d103afbaf24f3cdbba
MATLAB
433
6
set(zef.h_inv_roi_sphere_1 ,'string',num2str(zef.inv_roi_sphere(:,1)')); set(zef.h_inv_roi_sphere_2 ,'string',num2str(zef.inv_roi_sphere(:,2)')); set(zef.h_inv_roi_sphere_3 ,'string',num2str(zef.inv_roi_sphere(:,3)')); set(zef.h_inv_roi_sphere_4 ,'string',num2str(zef.inv_roi_sphere(:,4)')); set(zef.h_inv_roi_perturbati...
9119606343d71a14b2d171f324e8bf5b4142473097039aa5d24b68c7a1bb1ae3
MATLAB
433
14
function s_points = zef_cem_electrode(zef,s_points) if isempty(s_points) s_points = []; else current_sensors = eval('zef.current_sensors'); s_points = [ ... s_points(:,1:3), ... eval(['zef.' current_sensors '_electrode_outer_radius(:)']), ... eval(['zef.' current_sensors '_electrode...
d5f35840d451f51f511ec446025cab83a4cf4cb940a914a94792ce9bbbced2ec
MATLAB
433
14
function [stim_descrps] = WhatStims(data) %This functions takes in data in cell array format where each cell is a NEL %picture and returns what stims were run in this set of data. stim_descrps = {}; for i = 1:length(data) data_i = data{i}; if isfield(data_i.Stimuli, 'short_description') stim_descrps{n...
61d041cea6ea6e720e64190e89d1a42bc7960aaf0411f64889172bdd7dcbef68
MATLAB
434
12
train = hmm.train; orders = train.orders; order = max(orders); if isempty(order), order = 0; end if ~isfield(train,'Sind') if isfield(hmm.train,'V') && ~isempty(hmm.train.V) train.Sind = ones(size(hmm.train.V,2),hmm.train.ndim); else train.Sind = formindexes(orders,train.S); end if ~tra...
f5ef674789c7ab36602abff593302b57afddce9cda003c88b8b59fba39642981
MATLAB
434
23
function clabel(varargin) %clabel Assigns label to color axis (colorbar) % clabel([handle],strTitle) %assert inputs assert(nargin <3); assert(nargin >0); any(cellfun(@ischar,varargin)) assert(any(cellfun(@ischar,varargin))); %get handle if nargin == 1 drawnow; hBar = cbhandle('force'); strTit = va...
a15a90bd1ada7b456b705927a8d9b875566eb9fef173f2d7d56d206241ecdc4f
MATLAB
436
16
function set_common_plot_settings(app_plot) % sets settings common to gui plots app_plot.Title.FontName = 'Arial'; app_plot.Title.FontSize = 12; app_plot.TitleFontWeight='bold'; app_plot.TitleFontSizeMultiplier=1; app_plot.LabelFontSizeMultiplier=1; app_plot.FontName='Arial'; app_plot.FontSize=12; disableDefaultIntera...
c9b9c87e2fa673422ea9883aff08bd47f30ac09526653afbb36ffcbb2dc5801c
MATLAB
439
23
% plot a pixel over time function plotpixels2fPRO( f, s1, s2, s3, x, y ) frames = size( s1, 3 ); xx = linspace(1,frames,frames); p1 = zeros( frames, 1 ); p1(:,1) = s1( x, y, : ); p2 = zeros( frames, 1 ); p2(:,1) = s2( x, y, : ); p3 = zeros( frames, 1 ); p3(:,1) = s3( x, y, : ); figure(f) yyaxis left plot(xx,p1) ylabe...
40cbfddc4ba400304e13e7021f620803e61402a55e2f26b436a720769baff38d
MATLAB
440
19
function zef = zef_check_curvature_range(zef) editBox = zef.h_synth_source_ROI_curvature; value = str2double(editBox.String); if isnan(value) value = 0; elseif value < -1 value = -1; warning('Curvature value was set to -1. Must be between -1 and 1.') elseif value > 1 value = 1; w...
66dbbb79f6912afb33011015e431d9de42e246065d55bf7feac785aad27b12d9
MATLAB
440
21
function [vec,I]=greatsort(x); %GREATSORT sorts the vector x in descending order. % % Required input arguments: % x : vector to be sorted % % Output arguments: % vec : sorted vector % I : index => x(I)=vec. % % I/O: [vec,I]=greatsort(x); % % This function is part of LIBRA: the Matlab Library for Robust Ana...
7e056e2218bfed8d2ba340d6299c8ec4f315ac90215071f65311f034841a2db2
MATLAB
440
6
zef.inv_roi_sphere(:,1) = str2num(get(zef.h_inv_roi_sphere_1,'string'))'; zef.inv_roi_sphere(:,2) = str2num(get(zef.h_inv_roi_sphere_2,'string'))'; zef.inv_roi_sphere(:,3) = str2num(get(zef.h_inv_roi_sphere_3,'string'))'; zef.inv_roi_sphere(:,4) = str2num(get(zef.h_inv_roi_sphere_4,'string'))'; zef.inv_roi_perturbation...
85c38fd47724dedf31c89f041cbbb6a9fe079e6c5e7495d00bd959bbebaa0aeb
MATLAB
440
18
function zef_delete_transform if not(evalin('base','zef.lock_transforms_on')) table_data = evalin('base','zef.h_transform_table.Data'); transforms_selected = evalin('base','zef.transforms_selected'); for i = 1 : length(transforms_selected) evalin('base',['zef.h_transform_table.Data{' num2str(tab...
35e57cbe49ed49d85ab37d8dc17a3dbd5271512c43f4354d3636348db52711ed
MATLAB
441
14
function [nodes_new, triangles_new, nodes_ind, triangles_ind] = zef_minimal_mesh(nodes, triangles) if size(triangles,1) >= 0.01*size(nodes,1) triangles_new = triangles; nodes_new = nodes; nodes_ind = [1:size(nodes,1)]'; triangles_ind = [1:size(triangles,1)]'; else [nodes_ind,~,triangles_ind] = uniq...
86925dd6720d9a815224f2822c698a586b42acb50f5dd4f7e9357389e806aa5e
MATLAB
441
14
function DDATA=bsliang_rejBLOCKdata(TDATA,rej_ind) % blockˮƽɾÊý¾Ý EMPTY.rawdata=[]; EMPTY.half_threshold=[]; EMPTY.threshold_boundaries=[]; for i=1:size(rej_ind,1) % rej_ind ¡ú ROW1: subj, ROW2: condition, ROW3: turn block_rej=rej_ind(i,2); turn_rej=rej_ind(i,3); ...
ec9b67873a5a5f8b9ff10581c91189bb2968a0342419a6918c846990f77ccbf0
MATLAB
441
16
function zef_delete_sensors if not(evalin('base','zef.lock_sensor_names_on')) table_data = evalin('base','zef.h_sensors_name_table.Data'); sensors_selected = evalin('base','zef.sensors_selected'); for i = 1 : length(sensors_selected) evalin('base',['zef.h_sensors_name_table.Data{' num2str(table_d...
76bfdcdceaea0a49c33dfb90b7d97ca950a84ec11e72670b43f86595fe21f353
MATLAB
442
20
function [COV P1] = covariances_p300(X,Y,method_cov,arg_cov) if nargin < 3 method_cov = 'scm'; arg_cov = {}; end if size(Y)~=size(X(:,:,1)) P1 = mean(X(:,:,Y==1),3); else P1 = Y; end X2 = zeros(size(X,1)+size(P1,1),size(X,2),size(X,3)); for i=1:size...
e72804eb79c1318a69b98ce332a5b4eabc12c6db1a347696afdd1621521cc130
MATLAB
443
18
function [Feat C] = Tangent_space(COV,C) NTrial = size(COV,3); N_elec = size(COV,1); Feat = zeros(N_elec*(N_elec+1)/2,NTrial); if nargin<2 C = riemann_mean(COV); end index = reshape(triu(ones(N_elec)),N_elec*N_elec,1)==1; P = C^-0.5; for i=1:NTrial %Tn = C^-0.5*RiemannLogMap(C,COV(:,:,i))*C^-0.5; Tn = l...
008736999b885923b01616b3a9485bff71535736d6a60217c775c54593e8e82d
MATLAB
444
19
function [rois] = quick_extract_rois(rois_data) f = fieldnames(rois_data); rois = struct(); rois.xpix = cell(length(f), 1); rois.ypix = cell(length(f), 1); rois.boundaryOutlines = cell(length(f), 1); for neuron = 1:length(f) rois.xpix{neuron} = double([rois_data.(f{neuron}).x]); rois.ypix{neuron} = double([r...
a6bb2ec4f16f5c6d15335ba906e35b32ca89b0cc3127b3f5c7b1fffe5b4b2f45
MATLAB
446
19
function obj = stats_all(obj) % Calculate all available statistics obj.stats = [] ; obj = obj.stats_duration ; obj = obj.stats_coverage ; obj = obj.stats_occurrence ; obj = obj.stats_hurst ; obj = obj.stats_complexity ; obj = obj.stats_autoinformation ; obj = obj.stats_m...
1d8df61bf4a8a20a4b7c56c994d5374fe29f8fb6cb4ddc48a1d05f68a865f240
MATLAB
447
13
zef.filter_epoch_points = []; zef.filter_save_file_path = './data'; zef.filter_save_file = ''; zef.filter_name_list = cell(0); zef.filter_file_list = cell(0); zef.filter_parameter_list = cell(0); zef.filter_list_selected = ''; zef.filter_sampling_rate = zef.inv_sampling_frequency; zef.filter_tag = 'Default tag'; zef.fi...
960dc92970badd4d11beac8f5a7a2c2c4ddc32d9050137c3bbc360f29cb8c5a2
MATLAB
447
18
[zef.file,zef.file_path] = uigetfile('*.dat'); if not(isequal(zef.file,0)) zef.h_aux = fopen([zef.file_path '/' zef.file]); zef.aux_field = textscan(zef.h_aux,'%s'); for zef_i = 1 : length(zef.aux_field{1}) evalin('base',['zef.' zef.current_sensors '_name_list{' num2str(zef_i) '} = ''' zef.aux_fi...
af5bc75b81f89d91b34770cdeeef3fdf346e021fae6b604fadd0cc9bf1567efb
MATLAB
447
26
function [workingHashes] = zef_dataBank_hashToWorkingSpace(newHash, workingHashes) if ~iscell(newHash) newHash={newHash}; end if ~iscell(workingHashes) workingHashes={workingHashes}; end for i=1:length(newHash) duplicate=0; for wh=1:length(workingHashes) if strcmp(newHash{i}, workingHashes{w...
ebcfedceb9421eb07105c3af07627ae3468f703e6bc7c912bef3453f4a4d555e
MATLAB
447
31
function M = zef_surface_scalar_matrix_FF(nodes,tetra,scalar_field) % % zef_surface_scalar_matrix_FF % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - scalar_field % % TODO: explanation. % % Outputs: % % - M % % TODO: explanation. % w...
fc7505e765a0fa9182445409b4c3af5d2d807e6b820663c071d99fcf08336216
MATLAB
447
23
function zef = zef_ES_update_plot_data(varargin) if nargin == 0 zef = evalin('base','zef'); else zef = varargin{1}; end switch zef.ES_plot_type case 1 [zef.h_current_ES, zef.h_current_coords] = zef_ES_plot_current_pattern; case 2 zef_ES_plot_barplot; case 3 zef_ES_plot_error...
225dd375e0a61aaa5de74780bf6f06259da5c563581acd000853f3de54743d3d
MATLAB
448
19
cellPaths = strsplit(path(),';'); %remove paths fprintf('Cleaning paths... [%s]\n',getTime); intRem = 0; cellRemove = {'backup','.git','.ignore','old'}; for intPath=1:numel(cellPaths) strPath = cellPaths{intPath}; cellFolders = strsplit(strPath,filesep); if any(ismember(cellFolders,cellRemove)) rmpath(strPath); ...
6a306d1ab05a12082435d8383841f09f549e806c70e8f577d1461c87978195b8
MATLAB
448
17
function c = circcol(m,chroma) %REDBLUEPURPLE if nargin < 1, m = size(get(gcf,'colormap'),1); end if nargin < 2,chroma = 45; end %38 theta = linspace(0, 2*pi, m)'; % hue a = chroma * cos(theta); b = chroma * sin(theta); L = (ones(1, m)*65)'; % lightness (65) Lab = [L, a, b]; c=colorspace('RGB<-Lab',Lab(end...
efd38bd88d47055be156def79e69f76c1983389b42916268b4688f512ea2e569
MATLAB
448
12
zef.source_direction_mode = 1; zef.inv_sampling_frequency = 2400; zef.inv_low_cut_frequency = 0; zef.inv_high_cut_frequency = 0; evalin('base',['zef.' zef.compartment_tags{1} '_sources = 3;']); evalin('base',['zef.' zef.compartment_tags{2} '_sources = 2;']); zef = zef_build_compartment_table(zef); zef_mesh_tool; zef = ...
1e2032476dcd350141fbbef5bc4e8cc9b8c9a395ac7c14d0da9579cf2c2c5e59
MATLAB
449
24
function zef_dpq_wireframe_plot w_t = evalin('base','zef.wireframe_triangles'); w_n = evalin('base','zef.wireframe_nodes'); h_a = evalin('base','zef.h_axes1'); hold on; %axes(h_a); h_t = trimesh(w_t,w_n(:,1),w_n(:,2),w_n(:,3)); h_t.EdgeColor = 'none'; h_t.FaceColor = 0.5*[1 1 1]; h_l = light; h_l.Position = [1 0 0]...
4b624e38439132f873525c9ce6ac3277a448c2f7eb9af8c3c517209b220b051f
MATLAB
450
19
function TP = getTransProbs (hmm) % Returns the transition probabilies from any state to any other state, % without considering the persistence probabilities (i.e. the probability % to remain in the same state) % % Author: Diego Vidaurre, University of Oxford (2017) TP = hmm.P; [K,~,Q] = size(TP); for j = 1:Q TPj =...
9910f5c3cafdd80b0ac82073fb7789b6894a4af3e598a62ad73288833d01dd87
MATLAB
451
14
function [data, udf, rois, nil_neurons, nil_frames] = secondary_validation(data, udf, rois) [data, udf, nil_neurons, nil_frames] = secondary_validation_dataset(data, udf); udf = secondary_validation_udf(udf); rois = secondary_validation_rois(rois, data); if ~isempty(nil_neurons) ...
0af2ae831c4d99d94fab9212dc201801573c369d2388133e8a70b74e827339b3
MATLAB
452
12
zef_data.fieldnames = fieldnames(zef_data); zef_data.remove_fieldnames = cell(0); zef_j = 0; for zef_i = 1 : length(zef_data.fieldnames) if isobject(eval(['zef_data.' zef_data.fieldnames{zef_i}])) zef_j = zef_j + 1; zef_data.remove_fieldnames{zef_j} = zef_data.fieldnames{zef_i}; end end zef_data...
5080fb6376fd85368159629296026c2b5029079a7e1e4b7e62892d85a3b9581e
MATLAB
452
16
%Create points after merging all l/RH labels load of each merged label; a = load ('lh_labels_76.asc'); c = a([3:end],[1:4]); save lh_point_76.dat c b = load ('rh_labels_76.asc'); d = b([3:end],[1:4]); save rh_point_76.dat d e = load ('lh_labels_36.asc'); f = e([3:end],[1:4]); save lh_point_36.dat f g = load ('lh_labels...
7e13dafb3b0c389fc2345862b8d630f6dd6cdd05fef9e376c44e36c558b70ff5
MATLAB
452
22
function [logp] = logmvnpdf(x,mu,Sigma) % outputs log likelihood array for observations x where x_n ~ N(mu,Sigma) % x is NxD, mu is 1xD, Sigma is DxD % Author : Benjamin Dichter [N,D] = size(x); const = -0.5 * D * log(2*pi); xc = bsxfun(@minus,x,mu); term1 = -0.5 * sum((xc / Sigma) .* xc, 2); % N x 1 term2 = const...
925f053e59a6f66de2be5e345c1ce6cac6560883ede902ba83f6cc1e9b452e46
MATLAB
452
17
[zef.file,zef.file_path] = uigetfile({'*.dat;*.mat'}); if not(isequal(zef.file,0)) zef.aux_field_1 = load([zef.file_path '/' zef.file]); zef.aux_field_2 = []; if isstruct(zef.aux_field_1) zef.aux_field_2 = fieldnames(zef.aux_field_1); zef.resection_points = zef.aux_field_1.(zef.aux_field_...
5ab883652d91142057de9741b18c8b59b877ff015476dcba68fb8defdae8b77b
MATLAB
454
13
function zef_sensors_name_table_selection(hObject,eventdata,handles) sensors_selected = eventdata.Indices(1); evalin('base', ['zef.current_sensor_name = ' num2str(sensors_selected) ';']); evalin('base','run(''zef_init_sensor_parameters'')'); sensors_selected = eventdata.Indices(:,1); sensors_selected = unique(sensor...
156055b66cf2dd5911c5141bb2b35ef0a178d013dd36a093e07ae7825c959fda
MATLAB
456
19
function [vecY] = getGamma(vecP,vecX) %getGamma Gamma function % [vecY] = getGamma(vecP,vecX) % %function: % vecY = vecUseP(5)+vecUseP(3)*gampdf(vecX*vecUseP(4),vecUseP(1),vecUseP(2)); %vecP(1): alpha %vecP(2): beta %vecP(3): y-scale %vecP(4): x-scale %vecP(5): y-offset %% assign input vecUseP = [1 1 1...
fdb6c8e73c6c282acff9c257df69508783d0cc108c4491207b95a18ee4ff3a24
MATLAB
456
19
function zef_histogram(parameter_vec) %Histogram axes(evalin('base','zef.h_axes1')); h_axes = evalin('base','zef.h_axes1'); cla(h_axes,'reset'); h_hist = histogram(log10(parameter_vec),200); h_hist.FaceColor = [0.5 0.5 0.5]; hist_y = (h_hist.Values); hist_x = 0.5*(h_hist.BinEdges(1:end-1)+h_hist.BinEdges(2:end)); s...
7f8d1b8ea7f27884462806082a78fbe8368042e534415283d6cd523f4030a097
MATLAB
457
18
function compute_power(params,bidsID) % Load EEG data data = load_preprocessed_data(params,bidsID); % Average power spectrum across epochs in the range 1-100 Hz cfg = []; cfg.foilim = [1 100]; cfg.method = 'mtmfft'; cfg.taper = params.Taper; cfg.tapsmofrq = params.Tapsmofrq; cfg.pad = 5; cfg.padtype = 'zero'; cfg.outp...
1ac9e448914573d063a1759d100144945490ff185bf75586c8bcb8846cf054d3
MATLAB
460
13
function zef_source_tree_addroot_pushed(~, ~, ~) %ZEF_SOURCE_TREE_ADDROOT_PUSHED Add a new root node to the source tree. zef = evalin('base','zef'); % Add child directly under the tree root zef_source_tree_add_child( ... zef.h_source_tree.SourceTree, 'NewNode'); zef.source_tree = zef_build_source...
e2b4a41899dfc1eb1965f71657d3b51cb0c8d3ab8a2a71f00369a1a7ab7bec98
MATLAB
460
13
function perform_parameter_estimation_button_pushed(app) app.params.stage = 3; estimate_parameters_implementation_specific_call(app); update_p_lambda_text(app); update_best_model_text(app); plot_potentials(app); update_learned_models(app); update_unlearned_models(app); wrap_seeds_into_op...
f93b33ff7aa0cdc405c0a864c1500ad146af960381b3a2c51a19c6aefd086cd0
MATLAB
460
20
function barycentra = zef_tetra_barycentra(nodes, tetrahedra) % Calculates the barycenters of the given tetrahedra (4-tuples of node % indices). arguments nodes (:,3) double {mustBeNonNan} tetrahedra (:,4) double {mustBeInteger, mustBePositive} end barycentra = 1 / 4 * ( ... nodes(tetrahedra(:,1),:) ... ...
17082a82e2b57bf092920514a951e6962229fc1de73eac5d17d0fc38c5839111
MATLAB
461
15
function [h_node_output, node_found] = zef_dataBank_treeSearch(h_node_input, node_name) node_found = 0; h_node_output = []; i = 0; while i < length(h_node_input.Children) && not(node_found) i = i + 1; if isequal(h_node_input.Children(i).Text, node_name) node_found = 1; h_node_output = h_node_in...
7d3be858c5395bfae4575cb0bb679dad27cbe6011231f95e5cbb7fdf6b7414e6
MATLAB
461
14
function vecP = contpoisspdf(vecRate,dblLambda) %contpoisspdf Continuous-support approximation of Poisson pdf % vecP = contpoisspdf(vecRate,dblLambda) % %Works in log-domain to avoid numerical issues, using the following formula: %vecP = exp(vecRate.*log(dblLambda) - dblLambda - gammaln(vecRate+1)); % %Version...
a4e43d0b2e3f1ffc316b36304151c030c7228da575a0905a31d30c71e764a2fc
MATLAB
461
8
function zef_dpq_selection(hObject,eventdata,handles) functions_selected = eventdata.Indices(:,1)'; evalin('base',['zef.dpq_selected = [' num2str(functions_selected) ']'';']); evalin('base',['zef.h_dynamical_plot_queue_script.Value=zef.h_dynamical_plot_queue_table.Data{' num2str(functions_selected(1)) ',1};']); evalin...
1bf079552a37c1927c2f1f8f7ab2e9e5d901616a57a63c5834097be97b306cd7
MATLAB
462
12
zef_update_filter_tool; zef.processed_data = zef.raw_data; if isstr(zef.filter_pipeline_selected) zef.filter_pipeline_selected = {zef.filter_pipeline_selected}; end for zef_j = 1 : length(zef.filter_pipeline_list) zef.aux_field = str2func(zef.filter_pipeline{zef_j}.file); zef.filter_parameters = zef.filter_...
547733328fb5e41c3b8f241d4c23cc37425e4552fb05386d9c9b9002888f9415
MATLAB
462
12
function txt = getDataTipsTDPRO(~, info, plane, stack1, stack2, stack3, ifig, dfig) %disp(info); %disp( append('testcallback: ', num2str(info.Position(1)), num2str(info.Position(2)) ) ); y = info.Position(1); x = info.Position(2); %info.target %img = getimage(info.target); z = plane(x, y); ...
666bd8dcc601e4da0982696142058081145d545ef13dfb863bae6d720986d6ae
MATLAB
462
15
% OV_MATLAB toolkit % OV_setSettings.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % This file is meant to be executed prior to any user defined script. % It construct the objects used by the other functions of the toolkit % MEANT TO BE USED BY OPENVIBE function box_out =...
e789c17a71ced34b807932828edb169cd5d5130d4402c13aef91126ea695fea7
MATLAB
464
18
% tuto1_signal_filter_Initialize.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 25 May 2012 % % The function tuto1_signal_filter_Initialize is called when pressing 'play' in the scenario. % function box_out = tuto1_signal_filter_Initialize(box_in) disp('Matlab initialize function ha...
7ba638554ca825482b8739ef80bfd32f3dbe23fb7d919cd4704448bd48a9d377
MATLAB
469
19
function [vecY] = getGammaWithXoffset(vecP,vecX) %getGamma Gamma function % [vecY] = getGamma(vecP,vecX) % %function: % vecY = vecUseP(5)+vecUseP(3)*gampdf(vecX*vecUseP(4),vecUseP(1),vecUseP(2)); %vecP(1): alpha %vecP(2): beta %vecP(3): y-scale %vecP(4): x-scale %vecP(5): x-offset %% assign input vecUs...
3b5d35a9c76133b3a91533bb0121aa005647150f2b6b5ab80ec5d96f3342224d
MATLAB
470
17
function [subdomain_ind] = zef_find_subdomain_ind(domain_labels, domain_labels_with_subdomains) unique_domain_labels = unique(domain_labels); subdomain_ind = zeros(length(domain_labels),1); for i = 1 : length(unique_domain_labels) I_1 = find(domain_labels==unique_domain_labels(i)); subdomain_aux = domain_labels_with...
a7133f6f597009fada482e3d778113b90c2c608b96a4faf3aef72dd647bfc9e6
MATLAB
470
30
function out = is_eof ( in ) % % is_eof % % Provides a human-readable one-liner for checking whether one of Matlab's % older file reading functions encountered an end of file marker, when reading % a file. % % Input: % % - in % % Either plain text, if not an EOF character, or an integer -1. % % Output: % % - out % % ...
a7b5d8015d456d88c4503a913534462d28356e0271c482208eeaa5963f2411cd
MATLAB
470
21
function mov = movieTime( stack, cropfactor ) % 8 bit conversion %[smin, smax] = minmax(stack); sz=size(stack); xs=cropfactor*sz(1); ys=cropfactor*sz(2); xe=sz(1)-xs; ye=sz(2)-ys; stack8b = dbl2uint8( stack(xs:xe,ys:ye,:) ); %[s8bmin, s8bmax] = minmax(stack8b); % convert to multiframe array MF8b = stack2MFarray( stack8...
7a5e12cd8370968c9644d6a754573ead936f8d4c3d61f7f4c52d833f7c32cdee
MATLAB
471
17
function s = logsumexp(X, dim) % Compute log(sum(exp(X),dim)) while avoiding numerical underflow. % By default dim = 1 (columns). % Written by Mo Chen (sth4nth@gmail.com). if nargin == 1, % Determine which dimension sum will use dim = find(size(X)~=1,1); if isempty(dim), dim = 1; end end % subtract the ...
94f574b4b9b2f53bb7a6bb3d5acc4e8f4381da9792269ad255bb0f2ad8e1562d
MATLAB
472
11
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if isvalid(zef.h_zeffiro) zef.h_zeffiro.DeleteFcn = ''; end zef.h_fig_aux = findall(groot, 'Type','figure','-regexp','Name','ZEFFIRO Interface: Figure tool*'); %zef.h_fig_aux = findall(groot, '-pro...
bbc27e1e6b3c31813f75629aa1486b871bbec5fc6bee8313ab20bf440846ae24
MATLAB
473
18
function Y = multiherm(X) % Returns the Hermitian parts of the matrices in the 3D matrix X % % function Y = multiherm(X) % % Y is a 3D matrix the same size as X. Each slice Y(:, :, i) is the % Hermitian part of the slice X(:, :, i). % % See also: multiprod multitransp multihconj multiscale multiskew % This file is par...
321e24eab8836787925509fca1c8e1147f4def85febe7e6e20ef09f21857c293
MATLAB
474
15
% myobj = SetTriggerOnBeep( myobj, hertz, millisec ) % % Set frequency and duration of Windows beep signalling % file creation. hertz=0 disables the beep. Command has % no effect if not currently running. % function [s] = SetTriggerOnBeep( s, hertz, millisec ) if( ~IsRunning( s ) ) warning( 'No...
a2a8407035b79330b554b481ac65f9a07235b8974a6b522cf111eda5923e3576
MATLAB
475
34
function is_int = float_is_int ( float ) % % float_is_int % % Checks whether a floating point number is an integer up to machine epsilon accuracy. % arguments float (:,:) double end is_int = true ; if any ( isnan ( float (:) ) ) is_int = false ; end if not ( all ( isfinit...
2280f3bf4d6d70d9450f15d8ab2886291f48043656ef39288e143ebd5e613e72
MATLAB
476
14
function [file_name] = zef_bst_get_project_file_name(h_parent) if nargin < 1 h_parent = get(gcbo,'Parent'); end settings_file_name = h_parent.settings_file_name; folder_name = h_parent.folder_name; subfolder_name = h_parent.project_subfolder_name; [settings_file_path, settings_file_name] = fileparts(settings_file_nam...
e48d99122988886884f782a78bc941969da7bac3cf6834ba7dcf16f84aa6a536
MATLAB
476
18
% myobj = SetAudioEnable( myobj, bool_flag ) % % Set audio output on/off. Note that this command has % no effect if not currently running. % function [s] = SetAudioEnable( s, b ) if( ~isnumeric( b ) ) error( 'SetAudioEnable arg 2 should be a Boolean value {0,1}.' ); end if( ~IsRunning( s )...
09e3af5603959c0449f0455bb0c03799b7ce14452394089fa657d283f05b61bf
MATLAB
477
15
% myobj = SetTriggerOffBeep( myobj, hertz, millisec ) % % Set frequency and duration of Windows beep signalling % file closure. hertz=0 disables the beep. Command has % no effect if not currently running. % function [s] = SetTriggerOffBeep( s, hertz, millisec ) if( ~IsRunning( s ) ) warning( 'N...
e9b24b3b4a152c97ce1338f775b7a86b921d8e6b97fb540f6577b9a8b2df986d
MATLAB
477
13
function zef_transform_table_selection(hObject,eventdata,handles) transform_selected = eventdata.Indices(1); evalin('base', ['zef.current_transform = ' num2str(transform_selected) ';']); evalin('base','run(''zef_init_transform_parameters'')'); transforms_selected = eventdata.Indices(:,1); transforms_selected = uniqu...
c10afb950d34dabbc389edb1c9aa64334910dc203d33dd7eb040695dfa458cf5
MATLAB
478
9
function merge_pdfs(fileNames, outputFile) % Benjamin Großmann (2023). Merge PDF-Documents (https://www.mathworks.com/matlabcentral/fileexchange/89127-merge-pdf-documents), % MATLAB Central File Exchange. Retrieved February 7, 2023. memSet = org.apache.pdfbox.io.MemoryUsageSetting.setupMainMemoryOnly(); merger = org.ap...
c44d8fa2b0e88ba13e5c42158cd1786c489b018c0277369fe8000a39e40c8264
MATLAB
480
24
function [V, COV2] = riemann_diag(COV,methodcov) if nargin <2 methodcov = 'cov'; end C = mean_covariances(COV,'riemann'); T = Tangent_space(COV,C); [V, ~] = eig(covariances(T,methodcov)); W = V(:,end)*inv(V(:,end)'*V(:,end))*V(:,end)'; T2 = W'*T; % T2 = V(:,end)'*T; % T2 = cat(1,zeros(size(T,1)-1,size(T,2)),T2);...
035c094b737c73c593ebf871a83e3323f18f6fdfbac8ffe3dede8b1cd49d10f1
MATLAB
481
18
function s = logsumexp(x, dim) % Compute log(sum(exp(x),dim)) while avoiding numerical underflow. % By default dim = 1 (columns). % Written by Michael Chen (sth4nth@gmail.com). if nargin == 1, % Determine which dimension sum will use dim = find(size(x)~=1,1); if isempty(dim), dim = 1; end end % subtract...
4492ead28016b26dfcf50d9db31c4b8a4ed1b75fcf2425366878f040f07ad9b1
MATLAB
481
20
function [model_stats] = collect_models(models) last_model = models{end}; % just grabbing the fields from the last one % grab all the names of the structure's fields fields = fieldnames(last_model); num_models = length(models); model_stats=struct(); for some_field = 1:length(fields) field = fields{some_field};...
5bb57671d5a39279b6254d1495d042732ff551c42d3674196054d247a5884040
MATLAB
482
14
function Ypred = continuous_prediction_2class(Y,Ypred) % Which one is the most likely class, out of a continuous estimation? [N,q] = size(Y); % N is time points L = length(unique(Y(:))); if q == 1 && L == 2 % class is -1 or +1 Ypred(Ypred<=0) = -1; Ypred(Ypred>0) = +1; elseif q > 1 && L == 2 % dummy variable r...
e10ad1a1984a358b4074f465cb72ae81baede8dbc11fd0e73f57ad4b75b346e3
MATLAB
482
13
function cellOut = groupby(varData,varGroups) %groupby Summary of this function goes here % cellOut = groupby(varData,vecGroups) if ndims(varGroups) ~= ndims(varData) || ~all(size(varData) == size(varGroups)) error([mfilename ':DimensionMismatch'],'Size of data and grouping variable are different'); end [vecGr...
62025f01dbd4a69c0fd3ce2c446ed446c949887109342f72193107fc94d87bd1
MATLAB
483
19
function generate_data_preview(app) app.data_preview = axes('Parent', app.IOModelPanel, 'Units', 'pixels',... 'OuterPosition', [351 23 512 256],... 'InnerPosition', [370.73 42.73 487.2667 216.9667],... 'Box', 'on'); set_common_plot_settings_white(app.data_preview); set_no_tick(app.data_preview); app.da...
97dabb408da1e0d2b4da5b33490dde7305d350f51c75cd1a71fd60f234b4b693
MATLAB
483
15
function generate_ensemble_graph(app) app.ensemble_graph = axes('Parent', app.EnsembleGraphStructure, 'Units', 'pixels',... 'OuterPosition', [61.4 58.4 299.1 234.3], 'InnerPosition', [22 23 347 289], 'Box', 'on'); set_common_plot_settings(app.ensemble_graph); set_no_tick(app.ensemble_graph); app.ensemble_graph....
10729053d2237a04ac4950605349c237cbe8d28582d55a2d45e6ea7db1ebf595
MATLAB
484
18
function Y = multiskewh(X) % Returns the skew-Hermitian parts of the matrices in the 3D matrix X. % % function Y = multiskewh(X) % % Y is a 3D matrix the same size as X. Each slice Y(:, :, i) is the % skew-Hermitian part of the slice X(:, :, i). % % See also: multiskew multiprod multitransp multiscale multisym % This ...
7ad9c9699d6455cfd84ad4a1dd91d19383397f831364c178926772b11c3628b4
MATLAB
484
15
% calculate mean frame F0 dFoF0 function gaussStack = spatGauss(stack,sigma,npixels) % assumes stack is height x width x frames tic height = size( stack, 1); width = size( stack, 2); frames = size( stack, 3); gaussStack = zeros( height, width, frames, class(stack) ); for f = 1 : frames frame = stack(:,:,f); gau...
5d4f44ca8fbf14cc72508d4b4ed677854bd2c60a5b246cdfa501086364bed6c6
MATLAB
485
21
function COV = UnTangent_space(T,C) NTrial = size(T,2); N_elec = (sqrt(1+8*size(T,1))-1)/2; COV = zeros(N_elec,N_elec,NTrial); if nargin<2 C = riemann_mean(COV); end index = reshape(triu(ones(N_elec)),N_elec*N_elec,1)==0; Out = zeros(N_elec*N_elec,NTrial); Out(not(index),:) = T; P = C^0.5; for i=1:NTrial tmp ...
e96560ab7a6f469d519ae6590d9ba826ee864df1df261b5fd4f37e88ebd09f37
MATLAB
485
11
function [L, measurements] = zef_lead_field_no_normalization(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: No normalization L = evalin(...
2e37198e187d0081ec0ca1901181e1722f28628e9845136e1920cd02180d3fb3
MATLAB
486
17
function [v_mag, v_dir, v_vec] = zef_nse_mean_velocity_roi(zef,nse_field) roi_ind = zef_nse_roi_ind(zef,nse_field); v_1 = 0; v_2 = 0; v_3 = 0; for i = 1 : length(zef.nse_field.bv_vessels_1) v_1 = v_1 + mean(zef.nse_field.bv_vessels_1{i}(roi_ind)); v_2 = v_2 + mean(zef.nse_field.bv_vessels_2{i}(roi_ind)); v_3 = v_3...
517f4917b2be45a73d3a180500474e41f725ebf9b2e12a96b2d7debd219043bb
MATLAB
486
18
%-------------------------------------------------------------------------------- % plotdist.m % % Copyright (C) 2025 Takuya Isomura % (RIKEN Center for Brain Science) % % 2025-06-20 %-------------------------------------------------------------------------------- function plotdist(x,data,col,wid) y = mean(data,'omi...
0313c6e4c8e469fbd162a12e02f2bcd1d4c7ca5416ec6629097e2dab661735fe
MATLAB
487
26
function zef_plot_dpq(type,zef) if nargin == 1 if evalin('base','exist(''zef'',''var'');') zef = evalin('caller','zef'); else zef = []; end end if not(isempty(zef)) dpq_table = eval('zef.dynamical_plot_queue_table'); for dpq_ind = 1 : size(dpq_table,1) if str2num(dpq_tab...
17de7be9523f7d1d9fe97ef7e180aefb7f3e923d6688f9dc479f79b4be947352
MATLAB
487
21
function ET_timer(varargin) %UNTITLED Summary of this function goes here % Detailed explanation goes here %Enable,'off' %check if windows machine %% get globals global sEyeFig %% set disk I/O if ispc [intFlagOut,strReturn]=system('typeperf -sc 0.1 -si 1 "\LogicalDisk(C:)\% Disk Time'); cellLines =s...
c343acf0a8b8c3a88c79a8cbba1260c3dbb4892bc08254e77c82acaef1d90da1
MATLAB
487
22
% A = LogaffineMeanCOV(B,epsilon,tol) % % Calcul de la moyenne des matrice de covariances selon la distance log affine. % A : médiane 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 = logeuclid_mean(B) K = size(B,3); % No...
340dcbefaba380d22f4f939af524f0b2b197f66fa911610a3f904f92ed0f3cf1
MATLAB
488
22
function zef = zef_delete_sensor_sets(zef) if nargin == 0 zef = evalin('base','zef'); end table_data = eval('zef.h_sensors_table.Data'); sensor_sets_selected = eval('zef.sensor_sets_selected'); for i = 1 : length(sensor_sets_selected) if not(table_data{sensor_sets_selected(i),4}) eval(['zef.h_sensors...
0037c8c4e69229124e8ac143589df1bd8dca5fd12a928372c1ad1cceab54423b
MATLAB
490
25
function [nlist]= select_list(tau_list,parm) % ----- grid search list for tau Nlist = length(tau_list); Nloop = fix(Nlist/parm.Ncpu); Nrest = Nlist - Nloop*parm.Ncpu; Nnum = zeros(1,parm.Ncpu); for n=1:parm.Ncpu if n <= Nrest Nnum(n) = Nloop + 1; else Nnum(n) = Nloop; end end nstart = sum(N...
32d76bf241a896fbe0e5a47ab8f4eab74647556ff48d260642a0090b24ea9092
MATLAB
491
9
function zef = zef_DBS_attach_electrodes(zef) eval(['zef.' zef.current_sensors '_points=zef.strip_struct.electrode_data;']); eval(['zef.' zef.current_sensors '_electrode_outer_radius=zef.strip_struct.electrode_data(:,4);']); eval(['zef.' zef.current_sensors '_electrode_inner_radius=zef.strip_struct.electrode_data(:,5)...
a6e0f49f8b0ea056416d4ed6b3ac339841a566b6d7cf7506eefccd7b7027e12d
MATLAB
491
21
function plot_data_preview(app) % pull out to make sure we don't manipulate during plotting data = app.data; xLimits = [1 size(data,1)]; yLimits = [1 size(data,2)]; app.data_preview.NextPlot = 'replacechildren'; app.data_preview.XLim = xLimits; app.data_preview.YLim = yLimits; colormap(app.data_preview, flipud(gray)...
0a2e153c7c715eee361ae954c3130df9a269a47067ca0383a690fad6aaa517d6
MATLAB
493
22
%-------------------------------------------------------------------------------- % sig.m % % This analysis is included in % Experimental validation of the free-energy principle with in vitro neural networks % Takuya Isomura, Kiyoshi Kotani, Yasuhiko Jimbo, Karl Friston % % Copyright (C) 2022 Takuya Isomura % (RIKEN C...
fb4972954e53be08446d17cd88d9b7d8f676fd258a933a046f5a5e9313ceced0
MATLAB
494
35
function M = zef_volume_scalar_matrix_FG(nodes,tetra,g_i_ind,scalar_field) % % zef_volume_scalar_matrix_FG % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - g_i_ind % % TODO: explanation. % % - scalar_field % % TODO: explanation. % % O...
3a978e1901c69d7e08d9998409184cba6de00f39a6d6f8ab6cb69bf81b67b36f
MATLAB
495
11
function [y_vals, plot_mode] = zef_time_series_plot(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...
fb80692f1e063d120418761b1a25642d84b55218f43de4a9b918f93c3e9dbe86
MATLAB
495
24
function [p,z,r1,r2,S] = corrtest2(x1,y1,x2,y2) %corrtest2 Tests difference between correlations r(x1,y1) and r(x2,y2) % [p,z,r1,r2,S] = corrtest2(x1,y1,x2,y2) %calc Pearson corr & n r1 = corr(x1(:),y1(:)); n1 = numel(x1); r2 = corr(x2(:),y2(:)); n2 = numel(x2); %sd S = sqrt((1/(n1-3))+(1/(n2-3))); %...