sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5191736a21c8c7a03115e7919dd4ab9bcec21e8d2a3570dc9953bfbc4e6ae2fc
MATLAB
496
16
function Y = prepStack4SingleGauss(Y) % remove baseline trend, normalize Y = single(Y); Y = subMinStack( Y ); Y = normStack( Y ); % gaussian filter below stolen from normCorr gSig = 3; %7; gSiz = 3*gSig; psf = fspecial('gaussian', round(2*gSiz), gSig); ind_nonzero = (psf(:)...
6d614fbe1074a89cb2236627e127ed8989e1bcc499819364af3f54899c777ece
MATLAB
496
35
function M = zef_volume_scalar_matrix_GFu(nodes,tetra,g_i_ind,scalar_field) % % zef_volume_scalar_matrix_Gfu % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - g_i_ind % % TODO: explanation. % % - scalar_field % % TODO: explanation. % %...
81046ba402f6278e1452a3becd90b9cef102df5df962361443619ad4c1f4ff91
MATLAB
496
22
%-------------------------------------------------------------------------------- % logit.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...
4097485eb0cde8942023c45f66b91ee477d42fa5ff0884bf9019d21767811c7f
MATLAB
497
17
function [d,ib] = findClosest(a,b) % for each element of vector a find the nearest element in vector b based % on absolute difference % a and b must be row vectors % d ... difference vector % id ... indices of the differences recorded in d m = size(a,2); n = size(b,2); [~,p] = sort([a,b]); q = 1:m+n; q(p) = q...
894a375749881913f318b465d6cbfe4334a615d8f5a80fdf8519ec41f0e1f4eb
MATLAB
499
35
function M = zef_volume_scalar_matrix_FF(nodes, tetra, scalar_field) % % zef_volume_scalar_matrix_FF % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - scalar_field % % TODO: explanation. % % Outputs: % % - M % % TODO: explanation. % i...
609c86e3035388620795f9a168d7319b0a63b3a2f40716ea765970c12070eb13
MATLAB
500
36
function M = zef_volume_scalar_matrix_FFG(nodes, tetra, g_i_ind, scalar_field) % % zef_volume_scalar_matrix_FFG % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - g_i_ind % % TODO: explanation. % % - scalar_field % % TODO: explanation. ...
7f92e6c24c9e0d72a6d8520e7f72c0200f53c89f6ab0bd23ed078396ac1c323e
MATLAB
500
18
% myobj = SetRecordingEnable( myobj, bool_flag ) % % Set triggering (file writing) on/off for current run. % This command has no effect if not running. % function [s] = SetRecordingEnable( s, b ) if( ~isnumeric( b ) ) error( 'SetRecordingEnable arg 2 should be a Boolean value {0,1}.' ); end ...
a275483bf882fa983ef2e952748843efd8a3db92f243c1b08a58083ef41a3805
MATLAB
500
11
function [y_vals, plot_mode] = zef_max_energy_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...
ee3e521a4fb2c609e96c52aa81aaf1a03fcaa55fd1d99fca4e41145d5456899d
MATLAB
500
9
function window_handle = zef_window_visible(zef,window_handle) window_handle.Position(1) = zef.h_zeffiro_menu.Position(1)+zef.h_zeffiro_menu.Position(3)-window_handle.Position(3); window_handle.Position(2) = zef.h_zeffiro_menu.Position(2)+zef.h_zeffiro_menu.Position(4)-window_handle.Position(4); window_handle.Visible ...
98657697992ad951df31a7d1606be160a180257def8d54c6f36d3e8707617cec
MATLAB
501
35
function M = zef_surface_scalar_matrix_FFn(nodes,tetra,n_ind,scalar_field) % % zef_surface_scalar_matrix_FFn % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - n_ind % % TODO: explanation. % % - scalar_field % % TODO: explanation. % % O...
bce0026a97c37a7a9b808bc127d143f0e0efe4e1889e0cd392197430567aee81
MATLAB
501
16
function connection_lrc = fun_add_Lateral_pdf(length_matrix,addNumLength) [s1,s2] = size(length_matrix); connection_lrc = zeros(s1,s2); for ii = 1:length(addNumLength) Num_length = addNumLength(ii); if Num_length == 0; continue; end ind_length = find(length_matrix == ii); ind_add_length...
33e7078ac7e438be2cb8ea7121d413c05b0e0fcac44b86648308de58aea4f86c
MATLAB
502
27
function S_mat = zef_simple_smoothing_matrix(tetra, nodes) n_nodes = size(nodes,1); c_ave = 1/size(tetra,2); S_mat = spalloc(n_nodes,n_nodes,0); for i = 1 : size(tetra,2) for j = i : size(tetra,2) S_part = sparse(tetra(:,i),tetra(:,j),ones(size(tetra,1),1),n_nodes,n_nodes); if i == j S_mat = S_mat + S_par...
821bc81ba0c6c7335f44058d99fa986c23e65bfba26d3fd6bcd4d70b54b9e831
MATLAB
502
19
function h_struct = zef_gather_object_handles(zef,window_name) if nargin == 1 window_name = 'ZEFFIRO Interface'; end h_groot = findall(groot,'-regexp','Name',window_name); h_struct = zef_find_object_handles(zef, h_groot); fields = fieldnames(h_struct); for i = 1 : length(fields) if ismember('Children',prope...
181527ea7e473d68e4b195feada36ec0f006d22da027f2abb876b4a6976d228b
MATLAB
503
18
function zef = zef_dataBank_saveFolderButtonPush(zef) if nargin == 0 zef = evalin('base','zef') end zef.dataBank.folder=uigetdir('', 'select folder for the databank'); zef.dataBank.folder=strcat(zef.dataBank.folder, filesep); zef.dataBank.folder(strfind(zef.dataBank.folder,'\'))='/'; %ubuntu system works in wind...
edc9c0750c5f536e250c1fc2288be30eed219ad313d5b93138a7000dfd86556c
MATLAB
503
29
function [stim] = OSCOR(dur,fs,fm,filt_struct,no_filt) %dur=duration of stim %fs=sampling rate %fm = frequency of OSCOR %filt_struct = filter structure %no_filt = boolean, if 1 then no filtering nn = randn(2,round(dur*3*fs)); t = 0:1/fs:size(nn,2)/fs-1/fs; A = cos(2*pi*fm.*t); B = sqrt(1-A.^2); nn(2,:) = A.*nn(1,:) ...
e0b172a812b0bb3ddb307702c33c4c6d15f2a58799aefab6d6a37ace14f5edff
MATLAB
504
17
function [data] = ExtractData(Pic_nums, Dataname,directory) %extracts pictures from nel data and turns it into cell structure called %data cd(directory) data = cell(1,Pic_nums(end)); for i = Pic_nums [pic fname] = loadPic2(i); if exist([fname '_ADdata.mat']) == 2 load([fname '_A...
109e6ff0f34a2e1df2f8d3bf8f8d1ce518bcac8321f5a6b7932f283bdec45c13
MATLAB
505
22
function vecV = getGaussMV(vecParams,matGrid) %getGaussMV Summary of this function goes here % vecV = getGaussMV(vecParams,matGrid) %transform parameter vector to mu/covar intDims = ndims(matGrid); [vecMu,matSigma] = getMuSigma(vecParams,intDims); %ensure S is positive definite dblMinVal = 10^-10; if d...
b733fd9c2bf1e2a7440085009695eb7bd1bdc52949156e4a8366aeca33871f5b
MATLAB
505
35
function M = zef_surface_scalar_matrix_FG(nodes,tetra,g_i_ind,scalar_field) % % zef_surface_scalar_matrix_FG % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - g_i_ind % % TODO: explanation. % % - scalar_field % % TODO: explanation. % %...
fa41dd2918416f88aa1fcc7ea4114b79243c2a7dc96762a2aa1c55a49a899e30
MATLAB
505
10
function obj = preprocess(obj) % Wrapper function for a default preprocessing pipeline. % The pipeline will filter 1-30 Hz, re-reference to average (EEG only), and % resample at 256 Hz (unless sampling rate is lower than this value). obj = obj.preprocess_filter(1,30) ; % filter 1-30 Hz obj = obj.preproc...
41eb958cf0953d0e79d59ccdc65067f98d55f181f6a7972137126b542c4e3d4c
MATLAB
506
17
app = pat_map(); dataset = 'example_datasets/drifting_gratings/visual_cortex_'; default_path = pwd; app.file_data = strcat(default_path, '/', dataset, 'data.mat'); app.file_udf = strcat(default_path, '/', dataset, 'udf.mat'); app.file_rois = strcat(default_path, '/', dataset, 'rois.mat'); app.file_params = strcat(de...
cc3cdb4138950dcc0c7c43fefcdb6f8346bfe57d9fa3b5e1ee8641cc9f5fb76b
MATLAB
506
14
function [colormap_vec] = zef_blue_brain_1_colormap(colortune_param, colormap_size) c_aux_1 = floor(colormap_size/2); colormap_vec = [[c_aux_1:-1:1]/c_aux_1 zeros(1,colormap_size-c_aux_1); ... [1:c_aux_1]/c_aux_1 [colormap_size-c_aux_1:-1:1]/(colormap_size-c_aux_1); ... zeros(1,c_aux_1) [1:colormap_size-c_aux...
f858a5aeb2df280bd08dd5faea3d64ed0b13ce85400f1facb27682f55beaeeba
MATLAB
506
15
function Xi = approximateXi(Gamma,T,hmm) [~,order] = formorders(hmm.train.order,hmm.train.orderoffset,... hmm.train.timelag,hmm.train.exptimelag); K = size(Gamma,2); Xi = zeros(sum(T-1-order),K,K); for j = 1:length(T) indG = (1:(T(j)-order)) + sum(T(1:j-1)) - (j-1)*order; indXi = (1:(T(j)-order-1)) + sum(T...
e60bf551aa10d0e1cca1221e0018427e18acaf782a4600e0db6207709505c998
MATLAB
507
19
function zef_logarithmic_distribution(parameter_vec) %Logarithmic 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)+...
8e80619dccf1f3589fd0ad8f9fdf02c60736d09b1bdb676e5f9be2d12f97d1c6
MATLAB
508
17
app = pat_map(); dataset = 'example_datasets/drifting_gratings/visual_cortex'; default_path = pwd; app.file_data = strcat(default_path, '/', dataset, '_data.mat'); app.file_udf = strcat(default_path, '/', dataset, '_udf.mat'); app.file_rois = strcat(default_path, '/', dataset, '_rois.mat'); app.file_params = strcat(...
b0bb1a2b3b3c96e4dadf918d57eccc9ad2d44d24233b87cd2341605883558a28
MATLAB
510
21
function [new_text] = add_timestamp(new_text) %% Documentation Contents % Darik O'Neil 1-11-2022 % Function to timestamp log text %% Function Contents %Make Pads %L = length(new_text); %spacing = round(L/2); %cntr = 118; %spacingLeft = blanks(cntr-spacing);%-offset); %spacingLeft = blanks(spacing-offset); %spacingRi...
c5ce41d9cfb536e7ec91b5d6287bfeb1002c75b036a3391e70ea6f6ced5374c5
MATLAB
510
22
function dblP = chiSquare(x,y) %UNTITLED Summary of this function goes here % Detailed explanation goes here %get unique values vecValTypes = getUniqueVals([getUniqueVals(x) getUniqueVals(y)]); k = length(vecValTypes); %transform to equal-length count M = length(x); N = length(y); m = histc(x,vecValTypes...
ac8df06f3bbfd1c7fa0ac6a7cfd89df19a6969349123deac32709519dcffd901
MATLAB
511
13
function maxFO = getMaxFractionalOccupancy(Gamma,T,options) % Finds the maximum fractional occupancy for each subject/trial. % This is a useful statistic to diagnose whether the HMM solution is % "mixing well" or states are assigned to describe entire subjects (in % which case the HMM is doing a poor job in finding the...
52cacc83d8b9b3014c833f9948ba636c835e6b34cfa68b7da8e8da2cd9e1e327
MATLAB
513
13
function [vecLinCoeffs,vecLinCoeffFunctions] = gnmcell2lin(cellCoeffs) %gnmcell2lin Transform cell-based coefficients to linear vectors % [vecLinCoeffs,vecLinCoeffFunctions] = gnmcell2lin(cellCoeffs) vecLinCoeffs = []; vecLinCoeffFunctions = []; for intPred = 1:numel(cellCoeffs) vecCoeffs = cellCoeffs{1,intPre...
de7e0dd588f77fefbdd1097e118be8db838287f0cb077627e3d72fb133821a94
MATLAB
517
29
function [data,T] = cleandata4hmm (data,T) if iscell(T) || iscell(data) error('X and T are expected to be matrices here. Run subject by subject.') end N = length(T); ind1 = true(size(data,1),1); ind2 = true(N,1); for j = 1:N t = (1:T(j)) + sum(T(1:j-1)); if isstruct(data) c = any(std(data.X(t,:))...
57989ef361c853d2bac841faff0294324410ef0cedc9fe1c555ecec71d8e5347
MATLAB
518
23
function zef_nse_plot_pulse(zef,nse_field,type) if nargin < 3 type = 'single_pulse'; end axes(zef.h_axes1); cla(zef.h_axes1); if isequal(type,'single_pulse') t = nse_field.cycle_length*[0:0.001:1]; elseif isequal(type,'full_data') t = [0:nse_field.time_step_length:nse_field.time_length]; end y = zef_nse_...
d98e671ab3dc857bede644139d6074753c214d10a1e26e8b55a58fa1ca7144f9
MATLAB
518
11
function [y_vals, plot_mode] = zef_time_series_plot_sqrt(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...
bafd37816d3dde828fc0decc2ca57eca55271e58ebf6feaf45905cf836554a2c
MATLAB
521
12
function [y_vals, plot_mode] = zef_corr_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 ...
51e3b67d4dd38282607c9e4f47006bc8a2ee64fe240ba53ca4c7ca7c932a55aa
MATLAB
522
17
function obj = preprocess_rereference(obj) ; % Re-reference data to average if isempty(obj.modality) return end switch obj.modality case 'eeg' obj.data = obj.data-mean(obj.data,2) ; msg = 'Re-referenced to average' ; case {'meg','source','ampenv'} ...
773ca0a9f5c2272b0180566a1ddba1e2d44c2885e4cd1c0b984fb260f3d471cd
MATLAB
522
33
function ENV_VARS = FREESURFER_ENV_VARS() % % FREESURFER_ENV_VARS % % A constant function, which returns a list of the environment variable names % needed by FreeSurfer. % % Inputs: % % - None. % % Outputs: % % - ENV_VARS % % The list of environment variable names. % arguments end ENV_VARS = [ "SUB...
c2fc644f4f2f34bd6918099708617723f76e04420b2ac568562c6c15b2b24063
MATLAB
522
7
zef.inv_hyperprior_weight = str2num(get(zef.h_inv_hyperprior_weight,'Value')); zef.inv_hyperprior = get(zef.h_inv_hyperprior,'Value'); zef.inv_hyperprior_tail_length_db = str2num(get(zef.h_inv_hyperprior_tail_length_db,'Value')); zef.inv_snr = str2num(get(zef.h_inv_snr,'Value')); zef.inv_prior_over_measurement_db = str...
b0009dbda81d85e929ac9d8342aa72c4aba21cdef6ace6592fb560286145f758
MATLAB
524
19
function hPlot = plotRect(varargin) %plotRect Plot rectangle box % hPlot = plotRect(handle,vecRect,vararg) if numel(varargin{1}) == 4 handle = gca; vecRect = varargin{1}; vararg = {varargin(2:end)}; else handle = varargin{1}; vecRect = varargin{2}; vararg = varargin(3:end); end vecX = [vecRect(1...
77145bc32175732bf62af1d0b4253856f4f179393939e4a50aea1f47b9eaface
MATLAB
525
23
% Example of artefact detection with the riemannian potato. % load data clear all; load('./data/Artefacts.mat'); Nt = size(data.data,1); window = 3*data.fs; % 3 second window overlap = 3*data.fs-data.fs/8; COV=eeg2cov(data.data',window,overlap); [C, th] = potato_estimation_iterativ(COV); [~,d] = potato_detection(CO...
d01181a7ed4642b59a65f8af01b1fe77f0770aba2e6cc754ab2c54fe8480781b
MATLAB
526
35
function M = zef_volume_scalar_diagonal_matrix_FF(nodes, tetra, scalar_field) % % zef_volume_scalar_diagonal_matrix_FF % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - scalar_field % % TODO: explanation. % % Outputs: % % - M % % TODO:...
82232a5e5ffb85d73188391e10553e69ec7da13b1784a31e40fa6f4bb3d1d4d9
MATLAB
528
21
if isvalid(zef.h_zeffiro_menu) set(zef.h_zeffiro_menu,'DeleteFcn',''); end zef.current_log_file = zef.h_zeffiro_menu.ZefCurrentLogFile; zef.zeffiro_task_id = zef.h_zeffiro_menu.ZefTaskId; zef.zeffiro_restart_time = zef.h_zeffiro_menu.ZefRestartTime; delete(zef.h_zeffiro_menu); zef_menu_tool; zef = zef_update(z...
14f7e27cb04b29d837138b94fd49df251334537c6caf3b9f8500b38c220dbc45
MATLAB
529
9
if isequal(zef.lock_transforms_on,0) zef.h_transform_table.ColumnEditable = logical(ones(1,size(zef.h_transform_table.Data,2))); zef.h_menu_lock_transforms_on.Text = 'Toggle ''On'' unlocked'; zef.h_menu_lock_transforms_on.ForegroundColor = [0 0 0]; elseif isequal(zef.lock_transforms_on,1) zef.h_transfor...
a926530bc41a31a31f2c885fdf58efab3ebb9ac189fa6fa94289a19c4a74488a
MATLAB
529
21
function generate_roi_preview(app) app.roi_preview = axes('Parent', app.IOModelPanel, 'Units', 'pixels',... 'OuterPosition', [51 23 256 256], 'InnerPosition', [56 28 246 231.7],... 'Box', 'on'); app.roi_preview.Title.String = 'ROI Coordinates'; app.roi_preview.Title.FontNa...
6e054d2a561510cf99a19314c50d17656486be8cbf50dd7e20ff0232b6da54db
MATLAB
530
21
function ES_active_electrodes = zef_ES_fix_active_electrodes(zef) if not(zef.h_ES_fixed_active_electrodes.Value) ES_active_electrodes = []; else try [sr, sc] = zef_ES_objective_function(zef); catch ES_active_electrodes = []; return end if isempty(sr) ES_active_e...
d0f0e032ffe0cfe5d3cf6429c0de621d322f099a3697b6bd4005ae62aa1681b4
MATLAB
530
16
clear; %h = waitbar(0, 'processing...'); root = './dvs-cifar10'; dirs = dir(root); for i = 1: length(dirs) data = dir([root, '/', dirs(i).name, '/*.aedat']); for j = 1: length(data) data(j).name str = [num2str((j+(i-4)*1000) / 1e+4), '%'] %waitbar(((i-4)*1000+j-3) / 1e+4, str); [...
6a54afdaaf4bbb21190be61b6115641aa2b6ec968d7a0d0ab45d34c9c9714f9f
MATLAB
531
11
function zef = zef_GMModel_update(zef) zef.GMModel.max_n_clusters = str2num(zef.GMModel.h_max_n_clusters.String); zef.GMModel.credibility = str2num(zef.GMModel.h_credibility.String); zef.GMModel.n_dynamic_levels = str2num(zef.GMModel.h_n_dynamic_levels.String); zef.GMModel.reg_param = str2num(zef.GMModel.h_reg_param.S...
0ec5038daf0f66f8eab22a7299d6fb1220421aa467fc7b5bf495a74add06b777
MATLAB
532
17
function h = imagesc3(varargin) % Display a 2-D image in Matlab xyz 3-D space and scale the colors. % % h = image3(C, IJ2XYZ, handle) % % Uses the whole colormap, similar to imagesc. The syntax is otherwise the % same as for image3. % % This function is provided for convenience, manipulation of the handle h % from the...
4092ca9cdd00c42a75f44fd4c13d39ea42e7b23b6d81f78a0acf987ed8d9524d
MATLAB
532
19
function zef_segmentation_tool_toggle(zef,h_button) if isequal(h_button.UserData,1) h_button.UserData = 0; position_vec = zef.h_zeffiro_window_main.Position; position_vec(3) = 0.505*position_vec(3); else h_button.UserData = 1; position_vec = zef.h_zeffiro_window_main.Position; position_vec(3) =...
a1172582cc1020c9fb5af2f83120154b145c92cd98526746b8a88ef3321510f8
MATLAB
533
12
function outmat=bsliang_getDDindex(inmat) % ¼ÆËãË«·ÖÀëÖ¸Êý£¬¼ÆËãµÄ·½Ê½Îª£º·Ö±ð¶ÔÓÚÇåÎúºÍÔëÉùÌõ¼þ£º % DD=(TONE_TONGUE_¦¤rTMS-TONE_LARYNX_¦¤rTMS)+(PHONEME_LARYNX_¦¤rTMS-PHONEME_TONGUE_¦¤rTMS) % (TT-LT)+(LP-TP)£¬ÖµÔ½´óË«·ÖÀëÔ½Ã÷ÏÔ % inmat - block(TC PC TN PN)*turn(L T)*subj(197) % outmat - block(C N)*subj(197) out...
913bb16d06cd206dfed54a9d0221a9ac3be328555fe8a38e550bf674ef88cff3
MATLAB
535
16
function c = cold(m) %COOL Shades of cyan and blue color map % COOL(M) returns an M-by-3 matrix containing a "cool" colormap. % COOL, by itself, is the same length as the current figure's % colormap. If no figure exists, MATLAB creates one. % % For example, to reset the colormap of the current figure: % % ...
96b8bc22998b7de97d5b064a0aeb4b59df9ac4dbe528163aa0546a57df31a02e
MATLAB
535
12
function [y_vals, plot_mode] = zef_cov_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 user...
a04504ea0ab9c36d5dd027fa31347c4f1038a8c28e68f272dbb61876df96f414
MATLAB
535
41
function M = zef_volume_scalar_matrix_CC(nodes, tetra, scalar_field) % % zef_volume_scalar_matrix_CC % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - scalar_field % % TODO: explanation. % % Outputs: % % - M % % TODO: explanation. % K...
edb805f5161c3fb2a20408ed6506b7d8eb7bc823e2aea7a462bc355e7e96bc06
MATLAB
536
12
function [y_vals, plot_mode] = zef_cov_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 ...
87388871dff50b39d7dfa1bc6e0385c72420ed5ac334076c1c1a0d6061db7602
MATLAB
537
23
function zef_export_fem_mesh_as(zef) if nargin == 0 zef = evalin('base','zef'); end if eval('zef.use_display') [file path] = uiputfile('*.mat','Export FEM mesh as...',eval('zef.save_file_path')); else file = eval('zef.file'); path = eval('zef.file_path'); end if not(isequal(file,0)) tetra = eval...
0d60ba64e608925082b573afb0118ff1887d8baf1ff836cbb9b2b0a84ff98b99
MATLAB
538
22
function [] = zef_dataBank_uiTreeDeleteHash(node, hashList) %deleting nodes in the uitree when the hash is known, but the nodes are not %selected. Moves through the tree and deletes when the hash(es) is(are) %found if isprop(node, 'NodeData') for i=1:length(hashList) if strcmp(node.NodeData, hashList{i}) ...
29764473bd50be4be558d706eb2ad6f0b66f306e28d2b3ccedff3fd4f25c11c5
MATLAB
539
19
function events = getEvents( data, locs, pre, post ) % data contains one traces % locs contains a list of indices of peaks in "Data" % pre and post are the durations in points before and after the loc nevents = size(locs,1); events = zeros(nevents,pre+post+1); for i = 1:nevents is = locs(i)-pre; ...
85be4790a35d1d67e4d910628086ad42211182ec7aafe6c9f51b6e890fb2a5a6
MATLAB
539
14
function update_best_model_text(app) best_model = app.best_model; app.sLambdaEM.Value = best_model.s_lambda; app.pLambdaEM.Value = best_model.p_lambda; app.TrainEM.Value = best_model.train_likelihood; app.TestEM.Value = best_model.test_likelihood; app.MaxEM.Value = best_model.max_degree; app.MeanEM.Value = best_model....
a90033160a5704f9f426579e5f2cffdfac8a2a2bcd66b1d98ba2c3d10d11526f
MATLAB
539
17
function [vicinity_set] = zef_boundary_vicinity(tetrahedra,nodes,sub_ind,vicinity_distance) tetrahedra = tetrahedra(sub_ind,:); [b_t, b_n] = zef_surface_mesh(tetrahedra,nodes); t_c = 0.25*(nodes(tetrahedra(:,1),:)+nodes(tetrahedra(:,2),:)+nodes(tetrahedra(:,3),:)+nodes(tetrahedra(:,4),:)); MdlKDT = KDTreeSearcher(b...
4f549b2d084dc179b5457375f688ae67f883e4ed425a40351f80ba1647cd31e9
MATLAB
540
25
function [nanx_ALL,X]=interpNANs(signal, time, method) if isempty(time) time=[1: length(signal)]; end if isempty(method) method='linear' end [nSensors nSamples]=size(signal) if nSensors>=nSamples signal=signal'; [nSensors nSamples]=size(signal) end for i_sensor=1:nSensors temp_s...
c760ae2ea34b9a95a3f64b5a0cd508e0707c11fc458943ba69cce02f90a31c8a
MATLAB
540
12
function [y_vals, plot_mode] = zef_mean_energy_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 Z...
c9610fbc2320072a363eca7a1e0a8715a7128569b9344c0e3a4033aa0fdcac2a
MATLAB
540
23
function dispErr(sME) %dispErr Shows error without cancelling script % dispErr(sME) strID = sME.identifier; strMsg = sME.message; %try error as warning try fprintf('%s: %s\n',strID,strMsg); catch end %show stack intStackLength = numel(sME.stack); for intDepth=1:intStackLength strFilePath = sME.stac...
217402fee9db965ca178d538c8aaf2b79ce6431ceab24d251316ffb7030c77cb
MATLAB
541
19
%% structure ROIs derived from previous ROIs function h = structureROIs( hROI, fax, im, r, offset, pen, bonus ) % hROI is a set of ROI handles % test first ROI %r=10; %offset = 4; if nargin<7 bonus = 0; end nROIs = size(hROI,2); for i=1:nROIs M = mean( hROI(i).ROI ); %hROI(i).handles.ROI.Position ...
3809024dfb7330164b30501950989870fe3438b5832f7291d4d84c7515e6f472
MATLAB
541
18
function [dblLambda,dblR2Optim] = getOptimRidgeLambda(matX1N,matY1N,intFoldK,dblInitLambda) %getOptimRidgeLambda Find optimal regularisation parameter for ridge regression % [dblLambda,dblR2Optim] = getOptimRidgeLambda(matX1N,matY1N,intFoldK,dblInitLambda) %set globals global gMatX; global gMatY; global gIntF...
4596cc5ff1e5255175b22c74b37bbaa9a670e69e4fadef7bb0ca7cd16ae97600
MATLAB
542
26
function load_udf(app) % function to load udf matrix udf_labels = []; try app.udf = load(app.file_udf,'udf'); app.udf = app.udf.udf; update_log(app, 'Retrieved UDFs'); catch update_log(app, 'Unable to Retrieve UDFs'); end try udf_labels = load(app.file_udf, 'udf_labels'); app.udf_labels = udf...
8ca1e21dc8aebcded16f69852b1f7c945ce1887a86ba647e3c68dc27adac9d54
MATLAB
542
28
function [S_C,orj] = zef_subspace_corr(A,B,chararcter) [U_A,S_A,V_A]=svd(A,'econ'); U_A = U_A(:,abs(diag(S_A))>0); V_A = V_A(:,abs(diag(S_A))>0); S_A = S_A(abs(diag(S_A))>0,abs(diag(S_A))>0); [U_B,S_B,V_B]=svd(B,'econ'); U_B = U_B(:,abs(diag(S_B))>0); V_B = V_B(:,abs(diag(S_B))>0); S_B = S_B(abs(diag(S_B))>0,abs(diag(...
a666610630e951859f82bf9f7dbf67ffb99bc92de516ee779a26e434567204bc
MATLAB
542
15
function generate_ensemble_coordinates(app) app.ensemble_coordinates = axes('Parent', app.EnsID_IDENS, 'Units', 'pixels',... 'OuterPosition', [21 19 860 670], 'InnerPosition', [ 60.4000 54.4000 812.1000 615.3000],... 'Box', 'on'); set_common_plot_settings(ap...
e09928b22b9f440e3638ee89ebf9b3072f6a3fae9a059327cb27e1d820b0235c
MATLAB
543
12
function [y_vals, plot_mode] = zef_mean_energy_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 ...
dad89e31e2f218e617eda00c7c4742efe9a73c4d35f1fdbb92517263620f4dfc
MATLAB
544
12
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...
1768800421176468fad5f0b0af66532ddd17bb3a8eb061fb452c04f938569e22
MATLAB
545
13
% get the ideal display range for an image function disp_range = cleanDisplayRange( image_array, crop_pixels ) % image_array is any bw image data set, m x n pixels % crop_pixels, number of pixels to ignore around edge of image cropped_image = image_array( crop_pixels:end-crop_pixels, crop_pixels:end-crop_pixels ); ...
18068c614fb8d09c98d1093fa88542c1bdfc985cc57b818c4b5aa11ca599b18e
MATLAB
545
18
function browse_udf(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 whatev...
38b2fb59c5c93961260298f5edf27fdb2b799c000965fc9ca1b788eecfeb0f94
MATLAB
546
39
function M = zef_volume_scalar_matrix_GG(nodes,tetra,g_i_ind,g_j_ind,scalar_field) % % zef_volume_scalar_matrix_GG % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - g_i_ind % % TODO: explanation. % % - g_j_ind % % TODO: explanation. % ...
436fda13e336eac0ddb5361c51b7d776146ca704ee14ad724ab5b90eff7c35a3
MATLAB
546
12
function [y_vals, plot_mode] = zef_mean_energy_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...
bc3147121a72ff001808d8265adf8154106002d72ef370d6675fcfc72ba43e8d
MATLAB
546
18
function browse_models(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 wha...
73d30f491f5bd59357634f9b8935783c2f879e361ad6a6687f408253142871b6
MATLAB
547
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] = uiputfile('*.mat','Save processed data as...',[zef.filter_save_file_path zef.filter_save_file]); else ...
e3b7808b94d98623d230818ea9942931904686459b33a1c1df00eefe0fad7c01
MATLAB
547
26
%-------------------------------------------------------------------------------- % softmax_a.m % % This demo is included in % Triple equivalence for the emergence of biological intelligence % Takuya Isomura % % The MATLAB scripts are available at % https://github.com/takuyaisomura/reverse_engineering % % Copyright (C...
501b715e84ba81f94a840a0a897577b10cb282d65ae183ff8d007bcd6dd05480
MATLAB
548
12
function [y_vals, plot_mode] = zef_std_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 user...
66fcf67ff8b543d46007c536372e27cb2fa23833fa68d59ac7553e04e3d094c9
MATLAB
548
12
function [y_vals, plot_mode] = zef_max_energy_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 ...
a5af5db906a62e13307418a42acb16a8e625d69992c6a779f013b5ae746155aa
MATLAB
548
14
function identify_ensembles_run_all_button_pushed(app) update_log(app, 'Initiating Identification of Ensembles'); evaluate_neuronal_contributions_button_pushed(app); app.params.stage = 6; evaluate_node_performance_button_pushed(app); compare_to_random_ensembles_button_pushed(app); recompare_ran...
b94cfe070a9e44e4cf157648fe2e658d5dd0742f2f918da31be30b0d3ede8678
MATLAB
548
24
function zef = zef_add_bounding_box(zef,name_str) if nargin == 0 zef = evalin('base','zef'); end if nargin < 2 name_str = 'Box'; end zef = zef_add_compartment(zef); zef.([zef.compartment_tags{1} '_name']) = name_str; zef.([zef.compartment_tags{1} '_sources']) = -1; zef.([zef.compartment_tags{1} '_visible']) ...
47425b16d03656c8755b01ee1a107ab6adb7103b7fce11d2d13e736e52dae6af
MATLAB
549
21
function zef_bst = zef_bst_get_settings(settings_file_name,zef_bst) if nargin < 2 zef_bst = struct; end zef_bst_aux = zef_bst; utilities.brainstorm2zef.m.zef_bst_init; [~, settings_file_name] = fileparts(settings_file_name); eval(['utilities.brainstorm2zef.settings.' settings_file_name]); fieldnames_aux = fieldnames...
832a8cebeecae0c52fdbbda1010eba9afc3f7f00a7fb28810ec025ad207e8303
MATLAB
550
6
if isfield(zef,'h_scroll_bar') delete(zef.h_scroll_bar); end zef.h_scroll_bar=uicontrol(zef.h_zeffiro,'style','slider','units',zef.h_axes1.Units,'position',[zef.h_axes1.Position(1:3) 0.05*zef.h_axes1.Position(4)]); zef.h_scroll_bar.Position(2) = zef.h_axes1.Position(2)-0.1*zef.h_axes1.Position(4); set(zef.h_scroll_...
a9656b6a10a8968daa9309d60dbe012601047dcd22ea7f4c64d651c74d42d6b8
MATLAB
551
12
function [y_vals, plot_mode] = zef_max_energy_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 Z...
16ed4b3f34307caa9947fd847d235d34b1de521575d58f194bd23bb2e605aab2
MATLAB
552
21
% subtract min value from each frame function [nst, Smin] = subMinStack( st ) % assumes 3rd %Smean = squeeze(mean(st, [1 2])); %Smin = squeeze( min( st, [], [1 2] ) ); sz = size( st ); Smin = squeeze(zeros(1,sz(3))); nst = zeros(sz); for i=1:sz(3) % frame = squeeze( st( :, :, i) ); Smin(i) = min( st( :, :, ...
8a7e936f416835d121836cc629346f85ea6786210fc926b6cf3ac1aadaf5b00f
MATLAB
552
17
function ET_lock(handles) %UNTITLED Summary of this function goes here % Detailed explanation goes here %Enable,'off' cellNames = fieldnames(handles); for intPtr=1:numel(cellNames) if (~isempty(strfind(cellNames{intPtr},'ptrButton')) || ... ~isempty(strfind(cellNames{intPtr},'ptrList')) || ... ~isemp...
109f0d31054eaeb3bfd2744a04adc7cf21b033b9672a69eda96a8148c4c2faa6
MATLAB
553
8
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface 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_ro...
ef484b94e4fb4c99c2819e31bc842ad844e63a8de95a50c55374b35f66640524
MATLAB
553
25
%-------------------------------------------------------------------------------- % binary_to_decimal.m % % This demo is included in % Triple equivalence for the emergence of biological intelligence % Takuya Isomura % % The MATLAB scripts are available at % https://github.com/takuyaisomura/reverse_engineering % % Copy...
3b8ea4fd03ad82a51800265673675a1a5d482f2eaf67caa43acc18338665c23c
MATLAB
554
17
function y = logisticfit0(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) = y0 (y-offset) [default 0] %define parameters if length(beta) < 1, L=1; else L = beta(1);end %asymptote ...
e682357ff08841cf9c167d57d5d7fe8651696bbda8211cbd29cf27c756b65ecb
MATLAB
554
18
function browse_params(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 wha...
57900833a3067b6b076c31f4c042330b1641a17615b7b85f95430f3b422646c3
MATLAB
555
14
function generate_ensemble_evaluation_coordinates(app) app.ensemble_evaluation_coordinates = axes('Parent', app.EnsembleCoordinates, 'Units', 'pixels',... 'OuterPosition', [61.4 58.4 299.1 234.3], 'InnerPosition', [22 23 347 289], 'Box', 'on'); set_common_plot_settings(app.ensemble_evaluation_coordinates); set_n...
5c761dc2c0a3cc8ad1f3b268be6ef303ea0cadfe31b25ccb8a2c6cc38b679e47
MATLAB
556
28
function zef_plot_strips(strip_struct) hold on if nargin == 0; strip_struct = evalin('caller','zef.strip_struct'); end haxes = evalin('caller','zef.h_axes1'); axes(haxes); hold on for i=1:strip_struct.probe_num tri1 = strip_struct.faces{i}; x1 = strip_struct.vertices{i}(:,1); y1 = strip_struc...
d9cbf1e5062d4fb61adb9daae6a56ca60c55d52964cad603cca0e52c5d433532
MATLAB
556
10
[vertices,label,colortable]=read_annotation([dir_name '/label/lh.aparc.a2009s.annot']); save color_table_lh_76.mat colortable label vertices; [vertices,label,colortable]=read_annotation([dir_name '/label/rh.aparc.a2009s.annot']); save color_table_rh_76.mat colortable label vertices; [vertices,label,colortable]=read_ann...
220ac5564361d1a54ab7435499569a4da8885d98fb88175240e643a60542fc9f
MATLAB
557
21
% Generate a set of covariance matrices according to a Wishart distrib. % Inputs : % N : the size of the matrices % I : the number of matrices % Df : the degee of freedom % Sig : the parameter of the wishart disrib % % Outputs : % COV : a set of I covariance matrices % Sig : the parameter of the wishart di...
320311abfdaea64a294783b3d1149f85462517bccd153f7158c975068126acac
MATLAB
557
16
function [BF, BC] = bimodalitycoeff(x) % check if x is vector and if it is - % represent it as a column-vector if isvector(x), x = x(:); end % determine the data size along its first dimension N = size(x, 1); % determine the data skewness (unbiased) S = skewness(x, 0); % determine the data kurtosis (unbiased) % (the n...
552b04c9b7f346cfa923e697e94d85985e039e1845bc59503e09122b66930288
MATLAB
557
36
function weighting = zef_barycentric_weighting(weighting_type) % % zef_barycentric_weighting % % TODO: Sampsa should document this. % % Inputs: % % - weighting_type % % TODO: explanation. % % Outputs: % % - weighting % % TODO: explanation. % switch weighting_type case 'FF' weighting = [1/10 1/20]; ...
5d44e12d9da9c04b447bc5fad26a13886d2fad6d31199659e8ead9dd6600d399
MATLAB
557
15
function find_pattern_completion(app) update_log(app, 'Finding Pattern Completion Neurons'); [app.pattern_completion_nodes, app.auc_threshold,app.node_threshold, app.node_scores] = identify_motifs(app.params, app.best_model, app.node_performance, app.random_ensemble_performance, app.ensemble_nodes, app.params.node_th...
0e10e6b06c078fef1e6e913a8cf5f77f0a8185450ed9bdf387b0a30c8b7c549e
MATLAB
558
39
function M = zef_surface_scalar_matrix_FGn(nodes,tetra,g_i_ind,n_ind,scalar_field) % % zef_surface_scalar_matrix_FGn % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - g_i_ind % % TODO: explanation. % % - n_ind % % TODO: explanation. % ...
9f2d3533254a323a21bc9423207aeb7b82b15ebdac23642f2e0587109078fbc0
MATLAB
558
18
function browse_rois(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...
f1f0e40122284365b7815746421cec160b99e4a18254b23193d45b6f0006f55a
MATLAB
558
18
function t = iseuclidean(D) % D is (1 by pairs) m = size(D,2); % make sure it's a valid dissimilarity matrix n = ceil(sqrt(2*m)); % (1+sqrt(1+8*m))/2, but works for large m if n*(n-1)/2 == m && all(D >= 0) D = squareform(D); else warning(message('stats:iseuclidean:NotDistanceMatrix')) t = false; return ...
405593200bf8df6eebb27c7d68d49d406a062c7f203a3d8a86062300b9ae51d0
MATLAB
560
8
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface 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_s...
9ef3afc4c4f4b926288eca67af5e975d6ab995c2ce51798402772d6c17c413e6
MATLAB
561
18
function ET_unlock(handles) %UNTITLED Summary of this function goes here % Detailed explanation goes here %Enable,'off' cellNames = fieldnames(handles); for intPtr=1:numel(cellNames) if ~isempty(strfind(cellNames{intPtr},'ptrButton')) ||... ~isempty(strfind(cellNames{intPtr},'ptrList')) ||... ~isempt...
f2b233805c4cf36726259e8d71049d34dab361f322b9e36a51ebc4ef651ef516
MATLAB
561
14
function angles_list = zef_ES_find_valid_separation_angle % Function that evaluates all possible separation angles in order to obtain % 5 different electrodes for a HD-TDCS 4+1 montage. % Returns a list in the form of a table. ell = zeros(360,6); for i = 0:359; ell(i+1) = i; ell(i+1,2:6) = zef_ES_4x1_sensors(i...
40009018186cbb7b82c3a2739314afcbcbaccda59867210683b526bf8a2c368c
MATLAB
562
22
function ETO_Scrollwheel(hObject,eventdata) global sFigETO; if ~isfield(sFigETO,'ptrSliderLibrary') || isempty(sFigETO.ptrSliderLibrary),return;end %calculate new position dblMove = eventdata.VerticalScrollCount*eventdata.VerticalScrollAmount; dblNewVal = sFigETO.ptrSliderLibrary.Value - dblMove/100; if dblNe...