sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
62aa46881788f18ca2aa856e7e33b4c06b6bdef4760282ab24ae3e148c32caf5
MATLAB
859
25
function data_table = zef_dpq_delete(zef) if nargin == 0 zef = evalin('base','zef'); end data_table = eval('zef.h_dynamical_plot_queue_table.Data'); selected_ind = eval('zef.dpq_selected'); aux_ind = setdiff([1 : size(data_table,1)]', selected_ind); data_table = data_table(aux_ind,:); if size(data_table,1) >= ...
d50e0771c600b2f2e2302a363dd4346a9aac1fae9d2206f3268a05bf40a4db6b
MATLAB
859
32
function [dblAIC,dblAICc,LL] = aicfromr2(dblR2,k,n) %aicfromr2 Calculate AIC from R^2 % [dblAIC,dblAICc,LL] = aicfromr2(dblR2,k,n) %Inputs: %dblR2: R^2 %k=degrees of freedom/number of model parameters %n=number of samples % %Outputs: %dblAIC: Akaike's information criterion %dblAICc: corrected Akaike's infor...
41c27541a93e48b14cc19d4f65f39140a3aacb2d4e6bb7e6165e0eb9f2172e36
MATLAB
860
25
clear all; [d,sr] = audioread('Directory'); audiowrite('Vocal4.m4a', d,sr); %fcoefs = MakeERBFilters(sr,64,50,1.5); fcoefs = MakeERBFilters(sr,64,50,3); % Break the speech into subbands using the filters % Each row of dsub is one of the 64 band-passed signals dsub = ERBFilterBank(d,fcoefs); % Pass each subband signa...
ec8450b9a181ac59bb07e4dc3d408b3095594187b77ed1c94e428904a95187d6
MATLAB
860
33
function [out, Amax] = findOutliersMAX( A, factor ) % factor = 5 seems to work at first tic Amax = projectMax(A); Amax = im2single(Amax); %sx = size( Amax, 1 ); %sy = size( Amax, 2 ); %sz = size( A, 3 ); % out = zeros( sx, sy, 'logical' ); maxmean = mean( Amax, 'all' ); maxstd = std(...
f42f718c360fd1b2d9cb95ead70deb62bc008a1bc9dc528ffcffd3460b14f5a6
MATLAB
860
26
function images = loadMNISTImages(filename) %loadMNISTImages returns a 28x28x[number of MNIST images] matrix containing %the raw MNIST images fp = fopen(filename, 'rb'); assert(fp ~= -1, ['Could not open ', filename, '']); magic = fread(fp, 1, 'int32', 0, 'ieee-be'); assert(magic == 2051, ['Bad magic number in ', fil...
542e14e705e6bd9067e24c2a2d91a7f9d1603ff11b2974dda0b18167c10589c3
MATLAB
863
36
% THIS FUNCTION IS PRIVATE AND SHOULD NOT BE CALLED BY OUTSIDE CODE! % %Edited by Jorrit: added identifier to connection failure to catch error % function [sm] = ChkConn( sm ) if( sm.in_chkconn ) return; end sWarn = warning('off'); sm.in_chkconn = 1; if( sm.handle == -1 ) sm.handle = CalinsNetMex( 'crea...
0e59f24367e57cdee143ec3dc3077141301f6b2acb74deb51793c2c4cb4bec53
MATLAB
864
28
function hmm = hmmrotatepca(hmm,Gamma,XXGXX) for k = 1:length(hmm.state) % Orthogonalize W to the standard PCA subspace W = hmm.state(k).W.Mu_W; %[W,~] = svd(hmm.state(k).W.Mu_W,'econ'); % % Enforce a sign convention on the coefficients: % % the largest element in each column will have a posi...
35bfc91cbb0c16c24353e87617cc3913049ccd5c5e04d8f3ce03e50ad403d551
MATLAB
864
37
function [intTrough,dblTrough] = findtrough(vecV,intLoc,intDirection) %findtrough Finds nearest trough in leftward (-1) or rightward (+1) direction % [intTrough,dblTrough] = findtrough(vecV,intLoc,intDirection) if intDirection == -1 %left intTrough = nan; while isnan(intTrough) && intLoc > 2 dblDist = vec...
413a156b6189483aab2ff06c257d64d8aae6cc28a2ad58033fdc35a3f02db59d
MATLAB
865
26
function export2igorAPP( BS, timing, fname ) % fname is a full path name, or saves to current folder % custom function to store processed ROIs % to be read by Igor (or MATLAB) % S is the structure returned by roi2stats3D and processROIs % sometimes called "baseStats" ncells = size(BS.ROI,2); npoints = size( BS.ROI(1...
c3078a3a156c48944669c5c1513cf84e483c577ebd806eee78ad74c22f9a29c6
MATLAB
865
38
function slider_value_new = zef_update_colorscale_min(varargin) if isequal(evalin('caller','exist(''zef'')'),1) zef = evalin('caller','zef'); else zef = evalin('base','zef'); end if not(isempty(varargin)) h_figure = varargin{1}; else h_figure = eval('zef.h_zeffiro'); end h = findobj(get(h_figure,'Chi...
d21a03d7625bbca579e0d59c0f7bdf8631d39b6930828c5b8eb1cbdb48246852
MATLAB
867
25
function [surface_triangles] = zef_get_surface_triangles(tetra,labels,compartment_ind) I = find(labels==compartment_ind); tetra = tetra(I,:); ind_m = [ 2 4 3 ; 1 3 4 ; 1 4 2 ; 1 2 3 ]; tetra_sort = [tetra(:,[2 4 3]) ones(size(tetra,1),1) [1:size(tetra,1)]'; tetra(:,[1 3 4]) 2*ones(size(tetra,1),1) [1...
f9607462e72d665e42fc51a3abf7080f4d96575108287a37e7f821864dce0230
MATLAB
869
32
full_address = 'exportImage'; file_name = 'butterfly_plot_auditory'; f1 = gcf; f2 = figure(); copyobj(findobj(f1.Children, 'tag','axes1'), f2); f2.Children.Position(2) = 40; f2.Children.Box = 0; % f2.Children.XTick = [0.1210 0.1220 0.1230 0.1240 0.1250 0.1260 0.1270 0.1280 0.1290 0.1300]; ...
5ef4df5b3b9768f56540dab370530e47d8cd9a8803d0c66be9138d34c848b69f
MATLAB
870
23
function zef_plot_SESAME_dipoles %A dynamic plot of dipoles reconstructed by SESAME zef = evalin('base','zef'); h_axes_image = evalin('caller','h_axes_image'); f_ind = evalin('caller','f_ind'); rec_vec_init = [0 0 0 0 0 0 0 str2num(zef.SESAME_App.h_inv_rec_source_8.Value) str2num(zef.SESAME_App.h_inv_rec_source_9.V...
62f142a2e80c125c1032f014365af981b7f78ef284716c024b190071795608e3
MATLAB
875
30
function [tabPoints tabSegments tabRidgenessSphericalnessCyclideness] = ridgesravines2(filein) % Copyright Jean Dumoncel fid = fopen(filein,'r'); NombreDePoints = sscanf(fgetl(fid),'%d'); NombreDeSegments = sscanf(fgetl(fid),'%d'); NombreDeLignes = sscanf(fgetl(fid),'%d'); tabPoints = fscanf(fid,'%f %f %f %d\n',[4,N...
0d75037cff7e46d76175fee050afb504d52021c6f436a88bbb2af3abc05745bf
MATLAB
876
29
function data = data2struct(data,T,options) if length(options.embeddedlags)>1 L = -min(options.embeddedlags) + max(options.embeddedlags); else L = options.maxorder; end if ~isstruct(data), data = struct('X',data); end if ~isfield(data,'C') if options.K>1, data.C = NaN(size(data.X,1)-L*length(T),options.K)...
2349292a39caaa1a0377b0ff8645850e77d4187807e702b498940a161870b1ca
MATLAB
876
26
function data = estimate_hyperacuity_spike_time(data, model, parm) % acquiring data class_label = data.class_label; % classified label by SVM % select spikes detected by SVM str_index = data.index(class_label==1); t = data.t; y = data.y; if strcmp(parm.sort_dir, 'ascend') || strcmp(parm.sort_dir, 'descend')...
73a68b9efa8771aa3eb83c877d146ea7cbcaee340284f95d3be290c89fd76a4b
MATLAB
878
22
% OV_MATLAB toolkit % OV_setSpectrumHeader.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % Set the header information on a Spectrum input. function box_out = OV_setSpectrumInputHeader(box_in, input_index, nb_channels, channel_names, nb_abscissas, abscissas_names, abscissa...
d6ed3e17a17be2cdbc7068232c6eab17dede5aa3c62face2e39d31d2627a0684
MATLAB
878
43
function distance_vec = zef_distance_to_mesh(p,nodes,triangles) c = nodes(triangles(:,1),:)'; p = p'; v_1 = nodes(triangles(:,2),:)'-nodes(triangles(:,1),:)'; v_2 = nodes(triangles(:,3),:)'-nodes(triangles(:,1),:)'; v_3 = cross(v_1,v_2); v_3 = v_3./repmat(sqrt(sum(v_3.^2)),3,1); distance_vec = zeros(1,size(p,2)); f...
14d4b85c5c2a8a7f0334e9c5c39c1d33310b090bc0ea4d5c43b28faac26ec1ae
MATLAB
880
31
function opts = generate_default_opts() opts.expDir = ''; opts.continue = true ; opts.batchSize = 256 ; opts.numSubBatches = 1 ; opts.train = [] ; opts.val = [] ; opts.gpus = [2] ; opts.prefetch = false ; opts.numEpochs = 300 ; opts.learningRate = 0.001 ; opts.weightDecay = 0.0005 ; opts.momentum = 0.9 ; o...
e10a96a6f0eb21ba40ab73eb38db7d0a5081312758f8285f42118a07367c44d7
MATLAB
881
27
function [f, df] = zef_nse_mollifier(r,t,t_min,t_max) if nargin < 3 t_min = t(1); t_max = t(end); end I1 = find(t < t_min + 0.5*r*(t_max - t_min)); I2 = find(t < t_max - 0.5*r*(t_max - t_min)); I3 = find(t >= t_max - 0.5*r*(t_max - t_min)); I3 = setdiff(I3,I2); I2 = setdiff(I2,I1); f = zeros(size(t)); f(I1) = exp(1...
418165974be5700d8e0c392022bbfb2cebf00284746bcfd606e94eeb95664524
MATLAB
882
57
function intDay = date2day(varargin) %UNTITLED Summary of this function goes here % Supported formats: % 'YYYMMDD' (str) % YYYYMMDD (dbl) % 'MMDD' % MMDD % 'Y', 'M', 'D' % Y, M, D % 'M', 'D' % M, D %assign vals to year, month, day if nargin == 1 date=varargin{1}; if ~ischar(date) date = num2str(d...
d5a2f18944c22f9d3b67f76f58be22ae600332df2adc1490701359a30fff7815
MATLAB
882
48
function zef_plot_strip(strip_struct) hold on if nargin == 0; strip_struct = evalin('caller','zef.strip_struct'); end for i = 1:size(strip_struct.electrode,1) if i == 1 || i == 8 r = 0.75; else r = 0.35; end [x y z] = sphere(20); x = r*x; y = r*y; z = r*z; h_s = surf(strip_...
f90992cc7263495362917e12461513035f9cbbe2b885f6427d44493b1697ff3a
MATLAB
882
22
function [coefficients] = learn_structures(params,s_lambda) node_count = params.num_udf + params.num_neurons; coefficients = zeros(node_count); for label_node = 1:node_count feature_nodes = params.neighborhoods{label_node}; Coef = glmnetCoef(params.glm_array{label_node},s_l...
cfd5dd82b21f3cbfe868e26260754066cd0314c0844df9bd34e5225ad0ae8ba5
MATLAB
885
20
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [meas_data] = find_source(zef) source_positions = eval('zef.source_positions'); noise_level = eval('zef.inv_synth_source(1,8)'); s_p = eval('zef.inv_synth_source(:,1:3)'); s_o = eval('zef.inv_...
7b609f25c7fa4bdf04ba607ad8fd04ed9e245f54006e591338dbedd92bcafc57
MATLAB
886
34
function [P_s_store, m_s_store, G_store] = RTS_smoother(P_store, z_inverse, A, Q, number_of_frames) P_s_store = cell(0); m_s_store = cell(0); G_store = cell(0); h = zef_waitbar(0,'Smoothing'); for f_ind = number_of_frames:-1:1 zef_waitbar(1 - f_ind/number_of_frames,h, ['Smoothing ' int2str(number_of_frames -f_ind) ...
79d18cd819759edddab1c68da9467c3eb3455c96f84a7ee7d29afc82b8374b6b
MATLAB
887
41
function s = structinit(varargin) %STRUCTINIT Initialize a structure with no field, or with same fields as a model %--- % function s = structinit([model,][siz]) % function s = structinit([model,][s1,s2,...]) %--- % Initializes a structure with no fields (or with same fields as a model) % and of size siz. % If size is a...
937a20e733762fd2bc6ad810fbef779badaf2434781b65df4ac47167ef8fdb54
MATLAB
887
38
function slider_value_new = zef_update_transparency_reconstruction(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(...
881ac85fc1a3dcf8ffcea26e8a290377e041e6638375de2a62723d9975f933d8
MATLAB
889
21
%Copyright © 2018- Joonas Lahtinen, Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface %This script checks if the core script of SESAME, 'inverse_SESAME.m', is %already downloaded. If not, it write a .m script based on the raw form %from the FGitHub link: %https://raw.g...
80401a2671105b2f5c0925896b501ef7b26d76c6bd09bf35cb716aa4a02d23ac
MATLAB
890
34
function [hit, miss, false_alarm, spike_time_err, spike_time, est_spike_time] = measure_perf(spike_time, est_spike_time, constraint_interval) %% MAIN hit = 0; Nspike = length(spike_time); Nest_spike = length(est_spike_time); if Nest_spike>0 [ste1] = findClosest(est_spike_time', spike_time'); [ste2] = findClos...
0994089f58f5684c9323ad9df1a551ab5c4dcd54ad709055e29ebe18669411f1
MATLAB
892
29
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [s_field_vec] = zef_smooth_field(triangulation, field_vec, n_nodes, n_iter) if or(isempty(n_nodes),isequal(n_nodes,0)) n_nodes = max(triangulation,[],'all'); end for i = 1 : n_iter c...
67842db2e57e625b20ea9fc6dcc390da721f9ef84fe732a13bb0d62c89f2ffb1
MATLAB
893
30
function d=spkd(tli,tlj,cost) % % d=spkd(tli,tlj,cost) calculates the "spike time" distance % (Victor & Purpura 1996) for a single cost % % tli: vector of spike times for first spike train % tlj: vector of spike times for second spike train % cost: cost per unit time to move a spike % % Copyright (c) 1999 by Danie...
0a6d33a99f362edbc32ad9f77800ccdaccbffacc83fa317232606b6899627655
MATLAB
895
17
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if ismac zef.h_find_synthetic_source = open('zef_find_synthetic_eit_data.fig'); elseif ispc zef.h_find_synthetic_source = open('zef_find_synthetic_eit_data.fig'); else zef.h_find_synthetic_...
1eac6a5cc55220e7116e10522500ce6e4b12302c7e89221f3a18240428f4c4b3
MATLAB
895
29
% OV_MATLAB toolkit % OV_popInputBuffer.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 13 Jan. 2012 % Pops the first signal chunk on an input % ------------------------------- % output = matrix data (matlab format) % ------------------------------- % MEANT TO BE USED IN USER SCRIPT ...
a123eede88b03e363d10b8aea558e15e7bd2aece4f2b3c63707f22158076bd55
MATLAB
895
34
function [orders,order] = formorders(order,orderoffset,timelag,exptimelag) % % get vector of lags to look for the MAR % % Author: Diego Vidaurre, OHBA, University of Oxford if nargin<2, orderoffset = 0; end if nargin<3, timelag = 1; end if nargin<4, exptimelag = 1; end if order > 0 if exptimelag>1 orders...
e1e197e1e72203a58814cd28ffb6156f7d8c2e9a67abb33d0a86416974a5c085
MATLAB
897
38
function ET_setGamma(dblGamma,boolRetry) %ET_setGamma Set camera Gamma %get globals global sET; global sEyeFig; %get input if ~exist('dblGamma','var') || isempty(dblGamma) dblGamma = sET.dblGamma; end if ~exist('boolRetry','var') || isempty(boolRetry) boolRetry = true; end %set properties & suppress...
41c624358322397798b857b117d5e2f0ecd48838cc552d96a8892c9ba3456518
MATLAB
898
16
function srsc = zef_ES_centralize_recursive_search_window(adapt_window, original_window, param_aux, s_opt) if adapt_window < length(param_aux) if any(s_opt + (-floor(adapt_window/2):floor(adapt_window/2)) >= length(param_aux)) %&& ~any(s_opt + (-floor(adapt_window/2):floor(adapt_window/2)) >= original_window) ...
7048b5f60803560d732d12a87fe4daf8ad4043a8798477f375403734f1b69c7f
MATLAB
898
27
function [params] = convert_paths_to_absolute(params) root_dir = pwd; params.experiment_directory = strcat(root_dir, filesep, params.experiment_directory); if isfolder(strcat(root_dir, filesep, params.data_directory)) params.data_directory = strcat(root_dir, filesep, params.data_directory); filename ...
ee4a0268740f70f7e0a1c281ecc98f11df03ac161cbe183d839ef3b5ce1380de
MATLAB
898
24
function ell_idx = zef_ES_4x1_fun separation_angle = evalin('base','zef.ES_separation_angle'); sensors = evalin('base','zef.sensors(:,1:3)'); source_pos = evalin('base','zef.inv_synth_source(1,1:3)'); % Position source_ori = evalin('base','zef.inv_synth_source(1,4:6)'); % Orientation 'moi' ell_idx = zef_ES_4x1_sens...
72267a73619bf520dc6b98ece6dc6501ab713a5c3f8d91408cd4cf0a337d127a
MATLAB
901
32
function [data,T] = embeddata(data,T,embeddedlags) tp_less = max(embeddedlags) + max(-embeddedlags); if isstruct(data) ndim = size(data.X,2); shrinkC = ~(size(data.C,1)==sum(T-tp_less)); if shrinkC, C = zeros(sum(T-tp_less),size(data.C,2)); end else % just a matrix ndim = size(data,2); end X = zeros(sum...
7ec03a2dba8519e31c83dcb594660e5cf983586616d35758e0b2397a2be86d5f
MATLAB
901
35
% calculate dF over F0 function [dFoverF0,minBF] = deltaFoverFzero( stack, t1, t2, t4 ) %, minBarF ) % bar F "smoothing" disp('starting BarFofT'); BarF = BarFofTs2( stack, t1 ); % s version uses single precision disp('starting minBarF. Prepare to wait a long while...'); minBF = minBarF2( BarF, t2, t4 ); % F0 is minB...
ebb207395fe2666398ddec5678ac5a91cffd894785ddef48f0bd3ff55efb3244
MATLAB
901
25
function [ind]=find_intervals(intervals, events) % [ind]=find_intervals(intervals, process) % function to find intervals (eg sleep epochs) % that contain events (eg event timestamps) % % inputs : % intervals - matrix of pairs defining edges (start/stop) of intervals % eg: intervals = [ 1...
0873478a5262803b08944edb98fdfd03f94869d3f2cc16bc845ec27553ed4a17
MATLAB
902
12
zef.create_dipolar_pair_x = zef.h_create_dipolar_pair_table.Data{1,2}; zef.create_dipolar_pair_y = zef.h_create_dipolar_pair_table.Data{2,2}; zef.create_dipolar_pair_z = zef.h_create_dipolar_pair_table.Data{3,2}; zef.create_dipolar_pair_ori_x = zef.h_create_dipolar_pair_table.Data{4,2}; zef.create_dipolar_pair_ori_y = ...
44c592d49d2922d9f9adf43925cc0b24773ec670bbf88ad5bfe7c600985f526b
MATLAB
902
41
function [app] = test_panel_1(dataset_id) app = pat_map(); default_path = pwd; aa_path = strcat(default_path, strcat('\example_datasets\', dataset_id)); % set files app.file_data = strcat(aa_path, '\data.mat'); app.file_udf = strcat(aa_path, '\udf.mat'); app.file_rois = strcat(aa_path, '\rois.mat'); app.file_params ...
1a9459cb9a3fc320eeea30bf5697c3d1b628a902272fc3139a83bba31e6df133
MATLAB
903
56
function v = zef_surface_scalar_vector_F(nodes, tetra, scalar_field) % % zef_surface_scalar_vector_F % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - scalar_field % % TODO: explanation. % % Outputs: % % - v % % TODO: explanation. % i...
6f8a18f3edb73438c39ce7a33e20408e9f39626878a13e73ee41eff054eedac7
MATLAB
904
23
% OV_MATLAB toolkit % OV_setSpectrumOutputHeader.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 28/07/2011 % Set the header information on a Spectrum input. function box_out = OV_setSpectrumOutputHeader(box_in, output_index, nb_channels, channel_names, nb_abscissas, abscissas_names, ...
abdfdf80cc292cd0680ab7609ef3587d3bd9aa8002a2f2bf348a66f80d83648d
MATLAB
906
33
% scatter 3D of the manifold for a 2x2 covariance matrices set % function manifold_plot(COV,label,boundary) Nt = size(COV,3); if nargin<2, label = ones(Nt,1); end if nargin<3, boundary = 0; end class_label = unique(label); N_label = length(class_label); clrs = hsv(N_label); color ...
ff6b057d1cfebd90b4c5b48767f164cee886f715add693d7bc804e0130800e3f
MATLAB
908
68
function M = zef_volume_scalar_matrix_D(nodes, tetra, g_i_ind, scalar_field, weighting) % % zef_volume_scalar_matrix_D % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - g_i_ind % % TODO: explanation. % % - scalar_field % % TODO: explan...
ea7af550f9279c4c33d6efc59c8f5f6209c7782cc4a955ac592b24777d4131cc
MATLAB
909
30
function [tree] = zef_dataBank_importNode(tree, savePath, saveFile, parentHash, dataBank) if ~iscell(saveFile) node=load(strcat(savePath, saveFile)); [tree, hash]=zef_dataBank_add(tree, parentHash, node.data); tree.(hash).name=node.name; if strcmp(dataBank.save2disk, 'On') folderName=strcat(da...
0e5ea9650c16c51b2879c2b15075c870f4415ef812b801978732d87ac5b2c764
MATLAB
910
36
%-------------------------------------------------------------------------------- % param_norm.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 (...
8356fc05d58483f14904a01ed4fe730cfb4409aba0b40677244463b183a5a0e1
MATLAB
910
32
function hmm = obsinference(data,T,Gamma,hmm,residuals,XX) N = length(T); K = length(hmm.state); order = hmm.train.maxorder; if ~isstruct(data) data = struct('X',data); data.C = NaN(size(data.X,1)-order*length(T),K); end % Compute residuals if nargin < 5 || isempty(residuals) ndim = size(data.X,2); i...
790199e7d73bcb73ff98f0764cf4f75e5e360191e409a1618ae084612ce51517
MATLAB
911
37
function zef = zef_merge_surface_mesh(zef,compartment_tag,triangles,points,varargin) if isempty(zef) zef = evalin('base','zef',zef); end if not(isempty(varargin)) merge = varargin{1}; else merge = eval(['zef.' compartment_tag '_merge;']); end triangles_0 = eval(['zef.' compartment_tag '_triangles;']); po...
a704548f1ceadff093e07c2faecc1cb95c942c3efabb035ba456854182b98596
MATLAB
911
33
function preview_passed_structures_button_pushed(app) %needs models = app.models; numModels = length(models); %collect stats on passed structures % find the unique structures sLambdas = nan(1,numModels); for i = 1:length(models) sLambdas(i) = models{i}.s_lambda; end %[uval,uidx] = sort(unique(sLambdas), 'ascend');...
6d8b3b06214928caf4a992354624144f5c1a587faf3ab75e35081cd7d6640ffb
MATLAB
912
35
function [lead_field_id,lead_field_id_max] = zef_update_lead_field_id(lead_field_id,lead_field_id_max,varargin) lead_field_event = 'create'; %'' would be better, or lead_field_event instead of varargin if not(isempty(varargin)) lead_field_event = varargin{1}; end switch lead_field_event case 'bank_replace' ...
a036275e9c0059426802cd60d88ead20a87b25335d8bccf1e1f537e9842bb874
MATLAB
912
20
function y = zef_nse_signal_pulse(t,nse_field) hgmm_conversion = 101325/760; function bh_val = bh_fun(t, cycle_length) bh_val = 0.35875 - 0.48829*cos(2*pi*t/cycle_length) + 0.14128*cos(4*pi*t/cycle_length) - 0.01168*cos(6*pi*t/cycle_length); bh_val(t <= 0) = 0; bh_val(t > cycle_length) = 0...
b1c94f99cdc9e1d1303ee4b04480526768a5c08dbd12a3be578402285b99afbf
MATLAB
913
28
function zef_set_menu_size(zef,status) if isequal(status,'expanded') if isequal(zef.h_zeffiro_menu.Position(4),0) zef.h_menu_logo.ImageClickedFcn = 'zef_set_menu_size(zef,''minimized'');'; zef.h_zeffiro_menu.Position(4) = zef.menu_expanded_size; zef.h_zeffiro_menu.Position(2) = zef.h_zeff...
84dcb25fa83ef851c7baab907b13ac805eeb9423e374c1bef2427647c6efdc1f
MATLAB
915
42
function ET_setGain(dblGain,boolRetry) %ET_setGain Set camera gain %get globals global sET; global sEyeFig; %get input if ~exist('dblGain','var') || isempty(dblGain) dblGain = sET.dblGain; end if ~exist('boolRetry','var') || isempty(boolRetry) boolRetry = true; end %set properties & suppress warning...
896ad0438ece6d029696e68301e147973818c7592e0e309c1f1b874ce52e5ea7
MATLAB
916
26
% 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_channels, nb_samples_per_buffer, channel_names, sampling_rate] = O...
6f8c6151b0c351642a7e1fb4ee46e638c8e34a14623d7f752c5660f07204c544
MATLAB
920
34
function [P_s_store, m_s_store, G_store] = RTS_smoother_nonstandardized(P_store, z_inverse, A, Q, number_of_frames) P_s_store = cell(0); m_s_store = cell(0); G_store = cell(0); h = zef_waitbar(0,'Smoothing'); for f_ind = number_of_frames:-1:1 zef_waitbar(1 - f_ind/number_of_frames,h, ['Smoothing (non-standardized)'...
746ce92badf882a6da555c1bbadd8b692bc9d102d1ad59fd5939ebf8d392e6ff
MATLAB
920
36
function zef_source_tree_add_child(treeObj, childText) if nargin ~= 2 error('zef_cbtreenode_add_child:InvalidInput', ... 'Provide (CheckBoxTree, childText).'); end if ~(ischar(childText) || (isstring(childText) && isscalar(childText))) error('zef_cbtreenode_add_child:InvalidIn...
ea47d9a26e9e8002a130f6b10967720c4841d72f18096b73e70a70b14cd545ec
MATLAB
922
23
function [spk_cond] = ExtractConditions(datai) %This function will extract conditions based on the length of attens so #of %conditions should be = to length(attens). Data assumed to be in NEL format %and all conditions are run before they are repeated %datai = structrue in NEL format %spk_cond = cell array with each ce...
f0b43db5b5b5bea3a104c7becd7c50954193edec57ee4615c423d45bdde411c3
MATLAB
925
22
function OPTIONS = set_up_general(OPTIONS) % set-up of the detectors % SSW %%%%% Parameters (a priori, not to be changed) %%%%%%%%%%%%%% OPTIONS.Sleep.SSW.method = 'Carrier016_4'; % can be Molle OPTIONS.Sleep.SSW.Carrier.fmin_max = [0.16 4]; % Hz OPTIONS.Sleep.SSW.Carrier.duree_min_max_Neg = [125 1500]; % m...
25dc6d790e5571fa0f4c7f9cf5dff514bd5c7ce4c061af59cf3718cea080d3f5
MATLAB
926
30
function J = nanjet(m) %JET Variant of HSV % JET(M), a variant of HSV(M), is an M-by-3 matrix containing % the default colormap used by CONTOUR, SURF and PCOLOR. % The colors begin with dark blue, range through shades of % blue, cyan, green, yellow and red, and end with dark red. % JET, by itself, is the s...
d0a555a8226ae60ed5012d8f4fce59ea287413557bcb5e472473805212957ba2
MATLAB
926
26
function zef_plot_outPub(outPub, pass, nodeFilter) if nargin < 2, pass = 1; end if nargin < 3, nodeFilter = ""; end zef = evalin('base','zef'); axes(zef.h_axes1); cla; hold on; grid on; labels = {}; y_aux = []; for k = 1:numel(outPub.nodes) path = string(outPub.nodes(k).path); if...
0d0aef0fd5f16ec9f9d54cd15b30f8bac13f3f45bc7896fb76dd337c930ce949
MATLAB
932
32
function obj = preprocess_resample(obj,fsample_new) % Resample data % get size of data [m,n] = size(obj.data) ; % get sampling frequency fsample_old = 1/mean(diff(obj.time)) ; if fsample_old == fsample_new return end % remove mean mx = mean(obj.data) ; ...
716bde4b6eb51d3e729f809a80372c448ee0242399823c0df2a0639b17f9d0a2
MATLAB
932
66
function M = zef_volume_scalar_matrix_GCC(nodes, tetra, g_i_ind, scalar_field, weighting) % % zef_volume_scalar_GCC % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - g_i_ind % % TODO: explanation. % % - scalar_field % % TODO: explanati...
f8712cdfb8c2df0851dd98b28bf884b52f07111883d8aae17ed942c818ec44bb
MATLAB
934
21
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_butterfly_plot_start(zef) zef_butterfly_plot_app; set(zef.h_butterfly_plot,'Name','ZEFFIRO Interface: Butterfly plot'); set(findobj(zef.h_butterfly_plot.Children,'-property','FontU...
ae1ce99c0c98f83286bb1661a92d0edaeb6897886d2884c329fc36e4b9139603
MATLAB
935
11
for zef_j = 1 : size(zef.parameter_profile,1) if isequal(zef.parameter_profile{zef_j,8},'Sensors') && isequal(zef.parameter_profile{zef_j,6},'On') && isequal(zef.parameter_profile{zef_j,7},'On') if not(isequal(evalin('base', ['size(zef.' zef.current_sensors '_points,1)']),evalin('base', ['size(zef.' zef.cur...
28144edc6c0fad3d4c171295f5ac883e18424b4b64f141240005f73f2a1c4930
MATLAB
940
22
number_of_points = 10000; grey_matter_ind = 15; surface_triangles = zef_get_surface_triangles(zef.tetra,zef.sigma(:,2),grey_matter_ind); nodes_ind_aux = unique(surface_triangles); nodes_ind_aux = nodes_ind_aux([1:floor(length(nodes_ind_aux)/(number_of_points-1)):length(nodes_ind_aux)],:); distance_vec = zeros(length(...
6942124d13cae4eda7e5adf7f207edf2b2a3bf0ea60fa2de5a093685bb4defde
MATLAB
940
55
function lf_tag = lf_tag_from_lf_type( lf_type ) % % lf_tag_from_lf_type % % Converts a given lead field type integer into a human-readable lead field % tag. This is used by the plugins in the plugins/ folder, which is why this is % located here. % % Inputs: % % - lf_type (1,1) double { mustBemember ( [1,2,3,4,5] ) } %...
c53b7186ed56f044d2c497fb8eb13434b0e2704485f74af820a8faae8c9b99c7
MATLAB
941
27
function export2igorAPP( S, fname ) % fname is a full path name, or saves to current folder % custom function to store processed ROIs % to be read by Igor (or MATLAB) % S is the structure returned by roi2stats3D and processROIs % sometimes called "baseStats" ncells = size(S.baseStats.ROI,2); npoints = size( S.baseSt...
978cd52f6ed25161710b660f36f23b2c724352833d9dbb2b3e59f3c8f2345671
MATLAB
942
36
classdef CmdLineProgressBar < handle % class for command-line progress-bar notification. % Use example: % pb = CmdLineProgressBar('Doing stuff...'); % for k = 1 : 10 % pb.print(k,10) % % do stuff % end % % Author: Itamar Katz, itakatz@gmail.com properties last_msg_len = 0; end met...
d6e9f12c6514fa714937446d452fb6ef6983a8bbb51ce1e2791773da44fa28af
MATLAB
942
31
function vecValues = getCircFitPenalty(vecOptimParams,matXY) %getCircFit Returns values in the range 0-1 depending on x-y location % within (1) or outside (0) circle defined by vecParams (x, y, r) %Syntax: vecValues = getCircFit(vecParams,matXY) %get penalty matrix global vecP; %get distance vecValues = get...
54c940d9c4b645a58eb87d773a63cc3876b631859116076808514efa6d842f0b
MATLAB
943
40
function self = initialize(self,L,f_data) % % initialization function % % Initialize recursively updated variables before the computation of % the first time step. % % Inputs: % % - self % % An instance of BeamformerInverter with the method-specific parameters. % % ...
84e6008335b08276e1990ae97d68ccdcf9f3abc2679b1ef1669360faf45eaa20
MATLAB
943
32
function bsliang_processrawsham(in_mat) %% preprocess in_mat(in_mat==bsliang_numNAN)=nan; %% get data S_CT=in_mat(:,10); S_CP=in_mat(:,11); S_NT=in_mat(:,20); S_NP=in_mat(:,21); %% remove outliers [S_CT_rm]=bsliang_rmoutlier3sd_rawsham(S_CT); [S_CP_rm]=bsliang_rmoutlier3sd_rawsham(S_CP); [S_NT_rm]=bslian...
2154ac4beb0ad3d664cbf1ebe964461a5568cb03b7e83af6afa09f820d3a17ae
MATLAB
947
22
function [electrode_struct] = zef_electrode_struct(sensors_attached_volume) electrode_struct = []; if size(sensors_attached_volume,2) == 4 for i = 1 : max(sensors_attached_volume(:,1)) sensor_triangles = sensors_attached_volume(find(sensors_attached_volume(:,1)==i),2:4); sensor_edges_aux = [sens...
16313f8ee6711dda21799542cdd911616e87aab995525e00fd01482b852dc048
MATLAB
948
40
function [X, I, L] = do_sampling(data, score, index, Npre, Npoint) Npost = Npoint-Npre-1; N = length(data.y); spike_time = data.spike_time; Nspike = numel(spike_time); t = data.t; dt = data.dt; spk_flg = zeros(Nspike,1); index( (index>=N-Npoint) | (index<=Npre) ) = []; Nsegment = length(index); X = zeros(Nsegme...
82da2bf288a674eb12ae2b2bafc707edc42a907ecf957c604c63ffb3789828f5
MATLAB
950
38
function [data_new,T_new] = downsampledata(data,T,fs_new,fs_data) if fs_new == fs_data data_new = data; T_new = T; return end T_new = ceil((fs_new/fs_data) * T); if isstruct(data) ndim = size(data.X,2); data_new = struct(); data_new.X = zeros(sum(T_new),ndim); if isfield(data,'C') K = si...
79d54771ca7297d669e83fd9d34b8b912329c420fad740683bfd05a4610497a5
MATLAB
952
32
function [m, P, K, D] = kf_sL_update(m,P,y,H,R,standardization_exponent) % Resolution matrix method = '1'; if(method == '1') P_sqrtm = sqrtm(P); B = H * P_sqrtm; G = B' / (B * B' + R); w_t = 1 ./ ((sum(G.' .* B, 1))').^standardization_exponent; %w_t = 1 ./ ((sum(G.' .* B, 1))'); D = w_...
aa06a0d51590db7b8dd299e8620ca830a0913cff86f05f57eb4a1164151198ae
MATLAB
953
14
%Copyright © 2018- Joonas Lahtinen, Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.SESAME_snr=str2double(zef.SESAME_App.h_SESAME_snr.Value); zef.SESAME_n_sampler = str2double(zef.SESAME_App.h_SESAME_n_sampler.Value); zef.inv_sampling_frequency = str2double(zef.S...
9ae23139402378971a3fb4afadfe098412ebace51a1f8e90b0a4b8492cea1451
MATLAB
955
46
if not(isfield(zef,'streamline_draw')) zef.streamline_draw = 0; end if not(isfield(zef,'streamline_linestyle')); zef.streamline_linestyle = '-'; end if not(isfield(zef,'cone_alpha')); zef.cone_alpha = 1; end; if not(isfield(zef,'contour_n_smoothing')); zef.contour_n_smoothing = 2; end; if not(isfiel...
fd5cb46663df412eaac2320ef8154976811768273b4380b14bb4263793c40a27
MATLAB
955
31
% Installer for the Covariance toolbox HOME = pwd; if isunix path([HOME,'/lib'],path); path([HOME,'/lib/distance'],path); path([HOME,'/lib/geodesic'],path); path([HOME,'/lib/riemann'],path); path([HOME,'/lib/visu'],path); path([HOME,'/lib/estimation'],path); path([HOME,'/lib/mean'],path);...
a37cab60fec18d2fed71839121ad206b999495ec7791d8355270cdb18ef0cfaa
MATLAB
958
25
function ETO_redraw(sFigETOM,sIms,sPupil,matVid) %% redraw image, boxes & detection %redraw image if nargin > 3 cla(sFigETOM.ptrAxesMainVid); sFigETOM.ptrCurFrame=imshow(matVid,'Parent', sFigETOM.ptrAxesMainVid); hold(sFigETOM.ptrAxesMainVid,'on'); end %closed cla(sFigETOM.ptrAxesSubVid1); imshow(sIms....
f8bf13446f629981f6133eabbc82ab3aaacf78a492bbc2d7e96b70b072886df3
MATLAB
959
30
function A = multiscale(scale, A) % Multiplies the 2D slices in a 3D matrix by individual scalars. % % function A = multiscale(scale, A) % % Given a vector scale of length N and a 3-dimensional matrix A of size % n-by-m-by-N, returns a matrix A of same size such that % A(:, :, k) := scale(k) * A(:, :, k); % % See also:...
232d3e3b800960313c3ad20a9cb3b98d580f784611e1432f20c098ad92969f95
MATLAB
960
41
function bFofT = BarFofTs2( stack, t1 ) %t1 = 100; %bFofT = zeros( height, width, frames, 'double' ); bFofT = single(stack); % double( stack ); frames = size(stack, 3); %barFofT = smooth( cropstack(:,:,p), t1 ); %nframes = zeros( size(frames) - [0,0,1] ); ts = t1 / 2; te = frames - ts; tic %temp = ones( height, width,...
7064d2cfa14beaa1a11e4cf5c561359896c200277b6d7326c2033c8198ea2917
MATLAB
961
33
function complex_stiefel_test() % Minimize the complex Brockett function % Generate the problem data. n = 100; p = 10; A = randn(n)+1i*randn(n); A = .5*(A+A'); N = diag(p:-1:1); % Create the problem structure. manifold = stiefelcomplexfactory(n, p); problem....
2af2e3165d66e446c7812590d4eba452d865137bc679d9b085513c2a862f7593
MATLAB
962
39
function [z_inverse] = ext_sL(timeSteps,P_store,L,R, number_of_frames, smoothing, sL,standardization_exponent) h = zef_waitbar(0,1, 'Filtering'); z_inverse = cell(0); L_zero=zeros(size(L,1),size(L,2)); L2=cell2mat({L,L_zero}); L3=cell2mat({L,L_zero,L_zero}); I1=eye(size(L,2),size(L,2)*sL); for f_ind = 1: number_of...
8da4273bf2f62a275e79721924833cf75de9f21bd552c6f4ebd6d581b5fdac63
MATLAB
962
37
function matError = gnmnonlinfunc(vecLinCoeffs) %gnmnonlinfunc Wrapper for lsqnonlin() % matError = gnmnonlinfunc(vecLinCoeffs); % %matError is the individual error per observation n and predictor p as %an [n x p] error matrix between Y and Y_hat(p) %% get globals global gMatX; global gVecY; matX = gMatX; ...
041c23820e8d12ccf817aee20b822a2b2cd76f868376ed8dcb126af51a8f948d
MATLAB
963
40
function data = filterdata(data,T,Fs,freqbands) % Filters the data using a Butterworth filter % Author: Diego Vidaurre (2017) Fn = Fs/2; % Nyquist frequency filterorder = 6; [B, A] = buttfilter(filterorder,freqbands,Fn); for n = 1:length(T) fo = filterorder; Bn = B; An = A; ind = sum(T(1:n-1))+ (1:T(n)); ...
f5b34756c770071f21bac2bf4e5147483b8957dbd20ed6ddb042c2af9bab67c0
MATLAB
963
28
function [matX,matY,matV] = idx2mat(vecX,vecY,vecV) %idx2mat Transforms a vector into a triple of indexed vectors; one % vector containing x-locations; one vector containing y-locations; % and one vector containing the value so that v(i) corresponds the % original value of the input matrix at y-location y(i) and %...
0d495c36e1a5df2d7a8447ac63b073597498aa11737d1203a0c12c3c8ebc0cd3
MATLAB
964
28
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D function [boundary_triangles, boundary_tetra_ind] = free_boundary(tetra) ind_m = [ 2 4 3 ; 1 3 4 ; 1 4 2 ; 1 2 3 ]; tetra_sort = [tetra(:,[2 4 3]) ones(size(tetra,1),1) [1:size(tet...
c1d97ddfc0dd156936076980fe4626a57bff5526b267c44068f65e9b3da8902a
MATLAB
964
27
function bsliang_processrawsham(in_mat,AMB) %% preprocess in_mat(in_mat==bsliang_numNAN)=nan; %% get data S_CT=in_mat(:,6); S_CP=in_mat(:,7); S_NT=in_mat(:,12); S_NP=in_mat(:,13); %% remove outliers [S_CT_rm]=bsliang_rmoutlier3sd_rawsham(S_CT); [S_CP_rm]=bsliang_rmoutlier3sd_rawsham(S_CP); [S_NT_rm]=bsli...
d44bb8890ffb946b526e1adb25c27aedd8ca50a14413618cd25ce26d796936be
MATLAB
967
29
function D = gamma_kl (shape_q,shape_p,rate_q,rate_p) % Computes D(q||p) = | q(x)*log(q(x)/p(x)) dx % between two Gamma probability densities % % Author: Diego Vidaurre, OHBA, University of Oxford (2016) if nargin<4 error('Incorrect number of input arguments'); end % scale_p = 1 / rate_p; % scale_q = 1 / rate_q;% D...
c7e999265645f2f58be2aaf77a1477ee2d615858e3fec0bdc39c174ce81bdb80
MATLAB
968
43
function zef_nse_plot_full(zef, nse_field, plot_vec, y_label, legend_text) h_axes = zef.h_axes1; axes(h_axes); c_map = lines(size(plot_vec,2)); c_map = c_map + 0.1; c_map = c_map/max(c_map(:)); n_time = length(plot_vec); time_step_length_aux = (nse_field.time_length - nse_field.start_time)/(n_time-1); plot_data_ti...
67f23b754fa343e4192a5ebef4fe54f6139c396f10a4d437990ba5a79a0a4679
MATLAB
969
18
zef.LeadFieldProcessingTool.app.currentLeadfield.Data={zef.lf_tag, zef.imaging_method_cell{zef.imaging_method}, size(zef.sensors, 1), size(zef.source_positions, 1), zef.lead_field_id}; if zef.LeadFieldProcessingTool.bankSize>=1 for zef_LeadfieldProcessingTool_startIndex=1:zef.LeadFieldProcessingTool.bankSize ...
8a1c2892cd35c9e505019f4ca1ecfe0985f855821d9910c9d4de1abe507cf6c9
MATLAB
969
32
load('sleep_deprivation_branching_parameter') st=std(wakefulness_ratio_new-drowsiness_ratio_new); m=mean(wakefulness_ratio_new-drowsiness_ratio_new); figure for t=1:6 r=normrnd(0,0.1); plot([1.2,1.8],[wakefulness_ratio_new',drowsiness_ratio_new'],'--o','linewidth',3,'color',[r+0.7,r+0.7,r+0.7],'Ma...
c0e7af8e438b9ead0d017a04f0110c441d7feb68794bcc329f1cdbffe9ef92a3
MATLAB
969
30
function spike_time = generate_poisson_spike(parm) % ----- Poisson spike generation % spike_time = generate_poisson_spike(parm) % % spike_time = time of spike firing [sec] (Nspike x 1) % ----- Poisson spike generation setting % parm.Nspike = number of spikes % parm.fs_spike = spike freq [Hz] %ƒ|ƒAƒ\ƒ“‰...
0878c9904d8da49a4b57e8d29592526878b99947e7bda17606f541bec6bd5565
MATLAB
971
29
function zef = zef_dataBank_add_data_item(zef,data_type,parent_node_name,node_name) zef = zef_dataBank_refreshTree(zef); h_tree = zef.dataBank.app.Tree; hash_list = zef.dataBank.hashList; h_tree.SelectedNodes = zef_dataBank_treeSearch(h_tree, parent_node_name); if ischar(data_type) if eval(['ismember(''' data_typ...
b04609edacb55251dc2564e785bd1da64af60abf275c031ca92cef04e7e0ee80
MATLAB
971
45
function ETO_ROICallback(hObject,eventdata,strLocation) %get globals global sETO; %check which slider dblVal = get(hObject,'Value'); if strcmp(strLocation,'LT') %start x intType = 1; elseif strcmp(strLocation,'RT') %stop x intType = 13; elseif strcmp(strLocation,'LB') %start y intType = 2; elsei...
d154edfdf4066d6a0b4c9497dcf1b06be6d1e8d5371b3d834b767be6c50a0a05
MATLAB
971
40
% estimate the center of the ROI and the theeshold given a set of % covariances matrices. function [C th dist] = potato_estimation_iterativ(COV,method_mean,method_th,method_distance,args) if nargin <2 method_mean = 'riemann'; method_th = 'median'; method_distance = 'riemann'; end if ...
280d1f077b5fff18377f3b6483c67b1473b0679cb267189a321ee8c082de9b93
MATLAB
972
24
function [istart,istop]=sw_local_threshold(env, istart0, istop0, threshwin, threshold) %$ function to return local threshold crossing for if istart0> threshold %min n samples from start k1=find( env(istart0- threshold : istart0-1)<threshold & env(istart0- threshold+1 : istart0)>threshold, ...