sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a38e3d9c4ea9823ce2f7948d258e0267e367037d479e1b0351c454aca471c1b0
MATLAB
772
27
function [model_collection, params] = import_temp_models(model_collection, params) my_files = dir(fullfile(strcat(params.experiment_directory,'/tmp'),'*.mat')); for temp_model_idx = 1:size(my_files, 1) if ~any(strcmp(params.temp_model_paths, my_files(temp_model_idx).name)) model = load(fullfile(my_file...
5d1457c24d21b4701ddf73d619b3db8fd4973255051df7361096e74d7e40a2eb
MATLAB
775
28
% crop in x-y plane: get crop from max/sd projection, crop stack function [ cstack ] = cropStackRect( stack, rectin ) % cstack is the cropped stack % rect, rectout are the coordinates selected by the user maxpro = projectMax( stack ); maxpro = histeq( maxpro ); rect = round(rectin); height = rect(4); % size( series1{1...
2acfc31abb3ce59649fb1fb651929d4ac012d629372511e9df73ba053778a5c7
MATLAB
776
28
function [name_cell, variable_cell] = zef_get_profile_parameters(zef,varargin) parameter_index = []; if not(isempty(varargin)) parameter_index = varargin{1}; end parameter_profile = eval('zef.parameter_profile'); zef_n = 0; for zef_k = 1 : size(parameter_profile,1) if ismember(parameter_profile{zef_k,8},...
6258efb1b98078464a5463cc550b849aae872a3702181a5d986c838671a50a70
MATLAB
776
19
function [connection_w0_rewire,connection_lateral_rewire] = fun_delFF_rewireLRC(connection_w0_ori,length_matrix,... p_lateral,convergence_range,edge,ind_connRange,ind_pdf) %% add lateral connection p_rewiring = floor(p_lateral*length(find(connection_w0_ori))); y = fun_generate_connRange_pdf2(ind_connRange,ind...
8fba5523c228c380ecfcd2f75442cf44a4d22ae86fca74da0e55b3561cdf5ce1
MATLAB
777
37
function result = parforprogress(TODO, lambda, message, debug) %PARFORPROGRESS parfor with a progress bar if nargin<3 message = 'Please wait ...'; end if nargin<4 debug = false; end h = waitbar(0, message); ndone = 1; result = zeros(TODO,1); function nUpdateWaitb...
e5ec62a8a1b1feb6d980d62b152121eca277f3c533d25cd27c126bc02e33a738
MATLAB
777
31
function [X, I, L] = feature_extraction(data, spk_model, parm) % linear matching score l_score = matching_score(data, spk_model); %l_score = [0 diff(data.y)]; % nonlinear matching score ref_sig = l_score; svm_threshold = mean(ref_sig)+std(ref_sig)*parm.threshold; flag_refrac = 0; cand_idx = []; cand_value = [...
8d2f715b3da23b4313052ee1fe9508a2a8588d2cd329893949e71480df2e1f78
MATLAB
778
12
function zef_forward_simulation_table_selection(hObject,eventdata,handles) forward_simulation_selected = eventdata.Indices(:,1); forward_simulation_column_selected = eventdata.Indices(1,2); forward_simulation_selected = unique(forward_simulation_selected); forward_simulation_selected = forward_simulation_selected(:)';...
d3ae07b75aae71e90c604c1149d6274355be8665b7705702f2525589fe39f94e
MATLAB
778
29
function vecMahal=getMahal2(matThisData,vecMu,matThisCov) %UNTITLED8 Summary of this function goes here % Detailed explanation goes here %get number of trials intTrials=size(matThisData,1); %loop is faster.... vecMahal=nan(1,intTrials); for intTrial = 1:intTrials %can be used as parfor vecXY = (matThis...
311f96511650e077d17e9051072211d1ba3cfbb4c69ac986de244c701fc649eb
MATLAB
779
18
function update_node_press(app, value) switch app.TabGroup.SelectedTab.Title case 'Evaluate Model' current_value = app.HighlightedNode.Value; if current_value + value <= app.HighlightedNode.Limits(2) && current_value + value >= app.HighlightedNode.Limits(1) app.HighlightedNode.Valu...
79b8f75aabd19aeaaed102781de167dd985c5ed298041177bcdaa832419e0754
MATLAB
779
36
function PSD = project_PSD(hmm,Gamma,X,T,A,bands,options) % Projects a spectral estimation for the hmm from PCA space to original space % % Author: Diego Vidaurre, University of Oxford (2016) ndim = size(A,1); nbands = size(bands,1); K = length(hmm.state); if isfield(hmm.state(1),'f') fit = hmm; else fit = h...
6183f9bca1fed3e363bd8bfdef8da33af57536cbd631a5a0c3252780e9609d6a
MATLAB
780
21
function ell_idx = zef_ES_plot_4x1 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 ell_idx = zef_ES_4x1_sensors; axes(evalin('base','zef.h_axes1')); hold on quiver3(source_po...
24f6da1077d7e15dd57f4ac7f628244080374fe1729cfa14f4a3018ba7058aaa
MATLAB
781
26
function [relative_size] = zef_get_relative_size(object_handle) set(object_handle,'units','pixels') object_size = get(object_handle,'position'); object_children = findall(object_handle,'-property','Position'); object_children = setdiff(object_children,object_handle); relative_size_aux = get(object_children,'Position')...
e7059dedfdf1558a0e5180d041c17437d253c8ba7ccc551d251c54532ec02ddd
MATLAB
782
23
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [eit_ind,eit_count] = make_eit_dec(nodes,tetrahedra,brain_ind,source_ind) h = zef_waitbar(0,1,'Field decomposition'); center_points = (nodes(tetrahedra(:,1),:) + nodes(tetrahedra(:,2),:) + n...
c117deb225ae6120b2f66a7159ed1b64283290a71906796bf139c98a21869aca
MATLAB
783
33
function slider_value_new = zef_update_transparency_additional(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_fi...
135cec04ae29a2ba4c0ba352934b9c25f52ae0b941b8dfc11d49ec138735cf59
MATLAB
784
17
function generate_parameter_space_parameter_estimation(app) app.parameter_space_parameter_estimation = axes('Parent', app.ParameterSpacePanel_PE, 'Units', 'pixels',... 'OuterPosition', [15 9 235 200], 'InnerPosition', [36.7333 33.7333 205.7667 164.9667],... 'Box', 'on'); ...
8ac97fde02653a91e726f430a1a81a7443dde70c79eb337afe3c109914b86b59
MATLAB
784
21
function ell_idx = zef_ES_plot_4x1_fun 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 ell_idx = zef_ES_4x1_sensors; axes(evalin('base','zef.h_axes1')); hold on quiver3(sourc...
2a619f5cee9cccc038467802d2b4023082bd46f3af4eaf77213cdf282916c61a
MATLAB
785
36
function [y, dy] = zef_nse_balloon_model_solver(time_vec, blood_flow_signal_decay_rate, flow_dependent_elimination_constant, neural_activity_impulse, relative_mollification,t_min, t_max) if nargin < 5 relative_mollification = 0; end if nargin < 6 t_min = time_vec(1); t_max = time_vec(end); end f = 1; df = 0; if r...
3947d982792346091eeb6e3b63d27d800c23377764a11ad878df0c97833b4c90
MATLAB
786
33
function [m, P, K, D] = kf_sL_update_approx(m,P,y,H,R,standardization_exponent) % Approximating the inverse of square root matrix N = 5; M = 1; Z = eye(length(m)); Y = P; invY = Z; invZ = Z; for n = 1:N for k = 1:M invY = 2*invY-invY*Y*invY; invZ = 2*invZ-invZ...
059e7f590d264da723fa1791d6d12d01958d4143c14a869b17fd4bb84004bf13
MATLAB
787
35
function save_dats(out_dir) arguments out_dir (1,1) string { mustBeFolder } end dir_name = fullfile(out_dir); a = dlmread(fullfile(dir_name, 'lh_labels_76.asc'),' ', 2, 0); a = a(:,[1,3,5,7]); save(fullfile(dir_name, 'lh_points_76.dat'), '-ascii', 'a'); a = dlmread(fullfile(d...
0cb84ff2854268d0e39367c764edb1c09bd7bf516c569aab42b347cb356c1105
MATLAB
787
43
function h_surf = zef_plot_ellipsoid(position,a,b,c,z,color) h_axes = gca; hold_state = ishold(h_axes); if not(hold_state) hold on; end %make sure z is column vector z = z(:)/norm(z); if isequal(abs(z),[0 0 1]') x = [1 0 0]'; else x = 1/sqrt(z(1)^2+z(2)^2)* [z(2) -z(1) 0]'; end y = cross(z,x); %ro...
2f826ba62d58fe0ee119fb0bbb7689e6c28ab903dc86ee44120cb9fe9a122c41
MATLAB
787
31
function [stim] = IACsinAFC3(dur,fs,fm,BPfilt) %Oscillating IAC 3 AFC %this function will return a stim containing 2 noises with a correlation of %0 and one with a sinusoidally oscilliating correlation at frequency fm %Ramping and scaling will have to be done outside this function % dur in seconds, fm in Hz nbn1 = ran...
58301933fd84ff27da92c90f88fdd639bf03a8c4a8c449c43a3ba40062c166df
MATLAB
787
35
% myobj = SpikeGL() % myobj = SpikeGL( host ) % myobj = SpikeGL( host, port ) % % Construct a new @SpikeGL instance and immediately attempt % a network connection. If omitted, the defaults for host and % port are {'localhost, 4142}. % function [s] = SpikeGL( varargin ) host = 'localhost'; port = 41...
a5ad91946153d4e887ee76cd842ef8f1646beae460b2a5871f7054c4d4574fd1
MATLAB
787
34
function zef = zef_dataBank_getHashForTableMenu(zef) if nargin == 0 zef = evalin('base','zef') end if isempty(zef.dataBank.app.DataTable.Selection) %either no selected or no node in tree, either way start on first level disp('please select nodes'); return; else if size(zef.dataBank.app.DataTable.Sel...
2f4a91a042237008c76f6699be526f082a09fd2bb0517ce686f96cfa3c4380a9
MATLAB
790
15
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D function [u_data_mat_complex, f_data_mat_complex, rec_data_complex_receiver] = load_jacobian_data_complex(path_data, data_name, torre_dir) load([torre_dir '/' data_name '/point_' int2str(path_d...
1f299f45fd3752f60fa2581037adf5e13f20b3e9e51276e708adfd4ccb729819
MATLAB
791
20
function [L, measurements] = zef_lead_field_whitening(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: Lead field whitening via noise data ...
24ca3b8cb80b499e56eeedd3a67035a7410ebda85a6ba621f6ef1cbab2e555e3
MATLAB
791
16
function zef_compartment_table_selection(hObject,eventdata,handles) compartment_selected = eventdata.Indices(1); compartment_tags = evalin('base','zef.compartment_tags'); compartment_tag_ind = evalin('base','length(zef.compartment_tags)') - compartment_selected + 1; evalin('base', ['zef.current_compartment = ''' comp...
abbc6f116b9f47403945939c8a6b579bc5850e78755a3013547dfa99e852dbd1
MATLAB
791
31
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D parameters; if not(exist('gpu_id')) gpu_id = default_gpu_id; end max_plot_val = 0; gpuDevice(gpu_id); if compute_in_pieces == 1 time_series_id_vec = [time_series_id]; else time_se...
6246bbf0ef9fa9c99033fefff8536bc91f7a1debcde1edfd5b55d4ae865f0d33
MATLAB
792
34
function isstable = checkhmmmar(hmm) % Checks for stability, which implies stationarity % Needs the Econometrics Toolbox % % INPUTS: % % hmm hmm structure % % OUTPUTS % stability vector indicating stability for each MAR (K x 1) % % Author: Diego Vidaurre, OHBA, University of Oxford K = length(hmm.s...
038e3d2fd398c01fa9cd5f2e72a55dff8cfdc07f9dc7a966fcb658abd6c3d47c
MATLAB
794
19
function [processed_data] = zef_exclude_channels(f, exclude_channels) %Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface %This function processes the N-by-M data array f for N channels and M time %steps. The other arguments can be controlled via the ZI...
8099784ef234e460a3b4b0398314f2131c7e9d31f70af3c03d0b99e618e3e3f0
MATLAB
794
36
% gamma_spike_generator %’èí‰ß’öACv‚ƃVƒFƒCƒvƒpƒ‰ƒ[ƒ^ƒÈ‚ÌŠÖŒW‚́A %Cv=1/sqrt(ƒÈ) : ƒÈ= 1/Cv^2 DEBUG = 1; fs = 100; % sampling rate [Hz] Nspike = 100; % # of spikes firing_rate = 100; % mean firing rate [Hz] Cv = 0.5; shape_parm = 1/Cv^2; % shape parameter of gamma process ISI = rand(Nspike-1,1); I...
d7c4ed06e9cf31c379edb56d5881081b8cf3be445cf279bc95ee1fb8bbb56cad
MATLAB
795
27
% Run configCluster on command window before running %% c = parcluster; c.AdditionalProperties.AccountName = 'project_2002680'; % MemUsage to memory per core (in MB) c.AdditionalProperties.MemUsage = '1024'; % 5 hour walltime c.AdditionalProperties.WallTime = '48:00:00'; c.AdditionalProperties.EmailAddress = 'paavo.ron...
d2d8de518f33c2bab192eca9f3ec27488d013e2af04f8dbf34285537294dbc72
MATLAB
796
27
function s = getBehAssociation(Gamma,y,T,synch) % Returns, for each time point, how well the state time courses predict % the variable y across trials, which must have dimension (trials by 1) % % Author: Diego Vidaurre, OHBA, University of Oxford (2018) if ~all(T(1)==T) error('Synchronisity can only be measured if...
6d3f662725430e33d808a3a0e45b7bba6b3f5bd4ca09e60dacfa609ac589f3ea
MATLAB
797
13
if not(isequal(zef.file,0)) [zef.aux_points,zef.aux_triangles,zef.aux_submesh_ind] = zef_get_mesh(zef,[zef.file_path zef.file],zef.current_compartment,zef.surface_mesh_type,'full'); eval(['zef.' zef.current_compartment '_points = zef.aux_points;']); eval(['zef.' zef.current_compartment '_triangles = zef.au...
ecf0cf08dae0029149b61da593105ec605fe7d4f0fc3a486e08eccf3b6612f1d
MATLAB
797
37
function [stats_avg,conditions] = average_stats_across_conditions(stats,conditions) if nargin < 2 conditions = {1:length(stats)} ; end if ~iscell(conditions) conditions = {conditions(:)} ; end stats_avg = struct ; for i = 1:length(conditions) if i == 1 stats_avg = avgstruct(stats(conditio...
47bfa76adbe9fcfc42735f7863a3038d16b7cb36ca389bd8a9495e7590b36c1a
MATLAB
799
19
function node_ind = zef_point_in_cluster(reuna_p,reuna_t,nodes,threshold_value) aux_vec_1 = (1/3)*(reuna_p(reuna_t(:,1),:) + reuna_p(reuna_t(:,2),:) + reuna_p(reuna_t(:,3),:))'; aux_vec_2 = reuna_p(reuna_t(:,2),:)'-reuna_p(reuna_t(:,1),:)'; aux_vec_3 = reuna_p(reuna_t(:,3),:)'-reuna_p(reuna_t(:,1),:)'; aux_vec_4 = cro...
4ddb6c761a091e41936333f1961563156bcbf9aeb8cd39dd96c9a988aef968a5
MATLAB
800
21
% OV_MATLAB toolkit % OV_setSignalOutputHeader.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 box_out = OV_setSignalOutputHeader(box_in, output_index, nb_channel, nb_samples_per_buf...
81c334acb02fcff3cc5bc40a4455c249b468790bbf30ff490c8357fa67765327
MATLAB
801
42
function s_o = zef_minmax_svd_ori(s_roi,minmax,L,varargin) radialRef = []; if nargin>3 radialRef = varargin{1}; end if strcmp(minmax,'max') svd_max = true; elseif strcmp(minmax,'min') svd_max = false; else error('Argument must be "min" or "max"'); end ori_all = zeros(size(s_roi,1),3,2)...
e55ecd18069811b23b8dbc0e187fdfdb127aba27fadd1c547bb030b6bf830400
MATLAB
802
25
function [spontRate, drivenRate, spontSTD, drivenSTD] = SpontaneousRate(spikes,stim_time,period) %Designed for output from NEL %spikes = 2 columns, first column is trial#, second is spike times %stim_time = time stimulus is on %period = stim_time + off time Trials = max(spikes(:,1)); stim_time = stim_time/1000; perio...
81f0bc8fd55ef1e2c0e0617e7ccddd79403cc2fba69c466c17ce2b95622cfb47
MATLAB
803
24
% openvibe toolbox for Matlab % OV_getStreamedMatrixOutputHeader.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_dimensions, dimension_sizes, dimension_labels] = OV_getStr...
403759622dfb1e156cc6bb11171705f7cc578c11f4dd81497fe929119cf4edbc
MATLAB
805
40
function [value] = func_limits(value, limit_type) %% limitations qdt_lim = [-0.05, 0.05]; q2dt_lim = [-0.3, 0.3]; % limit type: % 1 : dq/dt % 2 : d2q/dt2 if limit_type == 1 if value(1) > qdt_lim(2) value(1) = qdt_lim(2); end if value(1) < qdt_lim(1) value(1) = qdt_lim(1...
d002f9ee58ae4055be7a5c70040d1352ba688201a862962ee0450a88a71d21bc
MATLAB
805
39
function [tetra,labels_tetra] = zef_hexa_to_tetra(hexa,varargin) labels_hexa = []; h = zef_waitbar(0,1,'Mesh conversion.'); if not(isempty(varargin)) labels_hexa = varargin{1}; end n_cubes = size(hexa,1); ind_mat_1 = [ 3 4 1 7 ; 2 3 1 7 ; 1 2 7 6 ; 7 1 ...
078df4a538190fa72233d9f1687ba4399dfcdca2c9341b13b0e5daa8facbeb28
MATLAB
806
23
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [gravity_ind,gravity_count] = zef_make_gravity_dec(nodes,tetrahedra,brain_ind,source_ind) h = zef_waitbar(0,1,'Field decomposition'); center_points = (nodes(tetrahedra(:,1),:) + nodes(tetrah...
e2ae3f5e46ba62b36c2128208c7c9778515a0b9d776781a8a588f8019383b7c3
MATLAB
807
18
function zef_meshing_example_thalamus_refinement project_struct = zeffiro_interface('start_mode','nodisplay','import_to_existing_project','scripts/scripts_for_importing/multicompartment_head_project/import_segmentation.zef'); project_struct.mesh_smoothing_on = 1; project_struct.refinement_on = 1; project_struct.refin...
26ceca4a22cd320a0d8ca1b72a26a5a440f8beb5ff21c19b2bf296735a6ae103
MATLAB
809
21
% from bst_scout_value.m get the PCA function function [F, explained] = PcaFirstMode_fromBST(F) % Remove average over time for each row Fmean = mean(F,2); F = bst_bsxfun(@minus, F, Fmean); % Signal decomposition [U,S,V] = svd(F, 'econ'); S = diag(S); explained = S(1) / sum(S); %Find wher...
d9664c1671f62de179276265a42e368922c7b958450bf962b3b693f6ed3fac8f
MATLAB
809
26
function valid_dims = computeValidDimensions(data,options) % Evaluate a matrix of connections S and return which elements are to be % analysed for variance and standardisation. S = options.S; if ~isfield(options,'distribution') || strcmp(options.distribution,'Gaussian') if all(S(:)==1) valid_dims = [1:leng...
da4335b51e25b5778698efe8a90a007443fd2df72efba86e1591e12077ca1c4e
MATLAB
812
42
function hcb = nancolorbar(varargin) %nancolorbar Create color bar with nan values, hiding nan entry % hcb = nancolorbar(matIn,[minVal,maxVal],colmap,nancol) matIn = varargin{1}; if nargin > 1 && numel(varargin{2}) == 2 cMin = varargin{2}(1); cMax = varargin{2}(end); else cMin = min(matIn(:)); cMax = m...
50efdb78b4b4d594677b730b33b6a1905b66b86e932de3f3b50b0c1b29d7f91b
MATLAB
813
19
function ETO_updateMonitor(sFigETOM,sPupil,sPupil1,dblT,dblTotDurSecs) %update time sFigETOM.ptrTextCurT.String = sprintf('Now at: t=%.3f s / %.3f s',dblT,dblTotDurSecs); %axes 1 scatter(sFigETOM.ptrAxesPlot1,dblT,sPupil.dblEdgeHardness,[],[1 0 0],'.'); scatter(sFigETOM.ptrAxesPlot1,dblT,sPupil.dblSyncLum,[],[...
84f71fedb8b82a5f28e267d65bbd7d026745de53e7fe6ddce92fccedc8578004
MATLAB
813
30
% distance between ROIs function [ goodROIs, Z, row, col, indices ] = goodROIs( hROI, minDistance ) indices=[]; goodROIs=[]; row=[]; col=[]; thresh=minDistance; % units are microns, the size of one pixel is 1.3 microns % thresh=13 is about a cell body distance nROIs = length(hROI.combo); index=1; for ii=1:nROIs % fo...
6d99998685888cfa7c13ab7ef19e458aa34fd43e72812640d551352257136881
MATLAB
814
12
zef_n = 0; for zef_k = 1 : size(zef.parameter_profile,1) if isequal(zef.parameter_profile{zef_k,8},'Segmentation') && isequal(zef.parameter_profile{zef_k,6},'On') && isequal(zef.parameter_profile{zef_k,7},'On') zef_n = zef_n + 1; zef.h_compartment_table.ColumnName{zef_n+zef.compartment_table_size}...
789dc921e89948d8bb08ea82d23271276e59ea041139272805a2d5e82895c872
MATLAB
814
27
function [P_store,z_inverse] = kalman_filter(m,P,A,Q,L,R, timeSteps ,number_of_frames, smoothing, q_given) P_store = cell(0); z_inverse = cell(0); if not(q_given) q_values = Q; end h = zef_waitbar(0, 'Filtering'); for f_ind = 1: number_of_frames zef_waitbar(f_ind/number_of_frames,h,... ['Filtering ' int...
084235eee4357b672e947b521fd3d9d3c4aa6070cb9884870529caacd7e2c0a3
MATLAB
816
44
function out_L = zef_set_lead_field_zero_potential( ... in_L, ... in_electrodes ... ) % Documentation % % Sets the zero potential level of a given lead field based on a given set % of electrodes. % % Input: % % - in_L: % % The lead field matrix whose zero potential level we are adjusting. % % - in_electr...
9ba2d89756d0c62fb5193668a5eda7b65eda1e86ec832004d9dcb38972168f4d
MATLAB
816
29
function subcompartment_ind = zef_compartment_to_subcompartment(zef,compartment_ind) if isempty(zef) zef = evalin('base','zef'); end compartment_tags = eval('zef.compartment_tags'); subcompartment_ind = []; compartment_counter = 0; subcompartment_counter = 0; for i = 1 : length(compartment_tags) on_val = ...
9e4ebeb6911f6437458a321740a5cc14a8d2356f6f7b908a22b5b684c4b33f1f
MATLAB
816
32
function [Ytest d C] = clustercov(Ctest,Ctrain,Nclass,varargin) if isempty(varargin) method_mean = 'riemann'; method_dist = 'riemann'; method_clust = 'complete'; else method_mean = varargin{1}; method_dist = varargin{2}; if length(varargin)<=2 method_...
120b7d17947df8bb8ac64bfb28594f47158f8f7a8bd1f66f5e47203ee9d31881
MATLAB
820
17
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if isempty(zef.plugin_cell) zef.plugin_cell = readcell([zef.program_path '/profile/' zef.profile_name '/zeffiro_plugins.ini'],'filetype','text','delimiter',','); end for zef_i = 1 : size(zef.plugi...
71b8987bbf597d6a8ba4b189dc6569311d42d543a1dc64ebf9c3dbd03c29f65b
MATLAB
820
31
function [binned_events] = bin_events(event_matrix, bin_size, bin_function) % Reviewed Darik A ONeil 04-16-2023 % % I don't know of a generator type return for matlab, so I guess we have to do it this way? % % samples = size(event_matrix, 1); edges = 1:bin_size:(size(event_matrix,1)); num_features = size(event_matrix...
b6f981c3bdcd023c39ef023993638ea549926e26b14f41b614ceb4bbb68c5110
MATLAB
820
30
function obj = select_time(obj,time) switch class(obj) case 'microstate.cohort' for i = 1:length(obj.individual) obj.individual(i) = microstate.functions.select_time(obj.individual(i),time) ; end case 'microstate.individual' idx = (obj.ti...
e2cb2f14d818887c64bc7acc059a70232785515a41bea20e21287bb9f16cec61
MATLAB
820
30
function ratemap = kde(n,k,sigma) %{ Estimate rate using Gaussian KDE smoothing. This is better than estimating the rate using a binned histogram, but worse than a Gaussian-Process estimator. Parameters ---------- n: 2D np.array Number of visits to each location k: 2D np....
e49a0959166610305b6fdf2762c90ae7bc0c93e7add39e64d4f99027c60fbad3
MATLAB
820
24
%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_data.file zef_data.file_path] = uigetfile('*.mat','Load filter',zef.filter_save_file_path); else [zef_data.file zef_data.fi...
0f42b29e7b00462341fd2450b7e8c3f9b33bebdfdb5700dc243e58710cab7592
MATLAB
821
25
function [A cf] = thirdoct(fs, N_fft, numBands, mn) f = linspace(0, fs, N_fft+1); f = f(1:(N_fft/2+1)); k = 0:(numBands-1); cf = 2.^(k/3)*mn; fl = sqrt((2.^(k/3)*mn).*2.^((k-1)/3)*mn); fr = sqrt((2.^(k/3)*mn).*2.^((k+1)/3)*mn); A ...
df557f8b5047fa550a538ed4e7e5fcc40f59ec3b86a2307fe859ad14565d4035
MATLAB
823
24
function h_source = zef_plot_dipoles_in_ROI(zef,roi_source_pos,s_o,dip_amp) %since we are not outputting zef, we can safely change some fields %used by the FindSytheticSourceLegacy plugin and then just use the zef_plot_source function zef.inv_synth_source = zeros(size(roi_source_pos,1), 10); %le...
4aebf6e9ded3f679c107365e94efc5fe480eb3b7ceaee443104e79618aa6b0f3
MATLAB
824
22
function zef_source_tree_addnode_pushed(~, ~, ~) %ZEF_SOURCE_TREE_ADDNODE_PUSHED Add a child to currently selected tree node % and update zef.source_tree accordingly. zef = evalin('base','zef'); selected_node = zef_source_tree_get_selected(zef.h_source_tree.SourceTree); if isempty(selected_node) uialer...
4b22c874c063bea02c72a4c764af9d6afc865692759a74202a9e1c5ea6c366aa
MATLAB
825
28
function obj = stats_gfp_peaksfreq(obj) % Calculate number of GFP peaks per second if isempty(obj.gfp) obj = obj.calculate_gfp ; end % Check inputs if isempty(obj.time) error('To calculation gfp peaks per second, time is required') end if length(obj.time) ~= length(ob...
92571ca39d0fbeb1cd5cbca609d3ee6c770a6ed710effd742eb17ecea2d1a77b
MATLAB
825
24
function zef_source_tree_reset_pushed(zef, ~, ~) %ZEF_SOURCE_TREE_RESET_PUSHED Reset the entire source tree and related data. zef = evalin('base','zef'); % Delete all nodes from the UI tree delete(zef.h_source_tree.SourceTree.Children); % Remove stored source tree data if isfield(zef,'source_tree') ...
25340abe38df844f9fe6abdbd44ab29c39b4826d9f2a3684284e5f724911ff44
MATLAB
826
27
function perf = eval_performance(spike_time, est_spike_time, constraint_interval, cost) if nargin < 3, constraint_interval = 0.05; end if nargin < 4, cost = 1; end perf.spike_time = spike_time; perf.est_spike_time = est_spike_time; perf.spk_distance = spkd(spike_time, est_spike_time, cost); % detection rate [hit, mi...
59a3e5dd3bbae01313fb7be25b289eb439007f7137f4cdc21dc658b7cbe95f64
MATLAB
826
26
function zef_filter_plot_data f = evalin('base','zef.processed_data'); sampling_freq = evalin('base','zef.filter_sampling_rate'); if size(f,2) > 1 t_vec = double([1:size(f,2)]-1)./sampling_freq; end axes(evalin('base','zef.h_axes1')); cla(evalin('base','zef.h_axes1')); hold(evalin('base','zef.h_axes1'),'off'); ...
6c100fb88d26b3976c6aa5dd473d35e4f199a53e6968dd6a3fccd89c14f1fb66
MATLAB
828
25
function zef = zef_mne_tool_start(zef) if nargin == 0 zef = evalin('base','zef'); end zef = zef_mne_tool_window(zef); set(zef.h_zef_mne_tool,'Name','ZEFFIRO Interface: Minimum norm estimate tool'); set(findobj(zef.h_zef_mne_tool.Children,'-property','FontUnits'),'FontUnits','pixels') set(findobj(zef.h_zef_mne_too...
d225842d646234a7357d913437e2f2f6842bd387403823f09fcbd9c7dd3f139e
MATLAB
828
36
function [P,Pi] = computePandPi(Dir_alpha,Dir2d_alpha) K = size(Dir2d_alpha,2); if length(size(Dir2d_alpha))==3 Q = length(size(Dir2d_alpha)); else Q = 1; end P = zeros(K,K,Q); if Q==1, Pi = zeros(1,K); else, Pi = zeros(K,Q); end for i = 1:Q for j = 1:K PsiSum = psi(sum(Dir2d_alpha(j,:,i))); ...
8a2f6fcf65e00d3c489eb7a18c09b3ff6fccd11220dc041be646ad2555eae8e3
MATLAB
832
22
function [dblCosSim,dblAngSim] = cossim(vec1,vec2) %cossim Cosine similarity between to vectors (range: [-1 1]) % [dblCosSim,dblAngSim] = cossim(vec1,vec2) % %where the outputs are defined as: %dblCosSim = dot(vec1,vec2)/(norm(vec1)*norm(vec2)); %dblAngSim = 1-2*acos(dblCosSim)/pi; % %...
ee0fd59b83bdf40fd74da3d2a9b7f085a408ec6d9fbf7cb750506293e4fe3956
MATLAB
833
23
function score=bsliang_getCLEARACC(m,isdim2) if isdim2==1 % ÕâÊǵڶþ¸öά¶ÈÒ²ÇåÎúµÄËã·¨£¨¾ÍûÓеڶþά¶ÈµÄ¸ÉÈÅ£¬µ«ÊÇtrialÊýºÜÉÙ£© dim1=logical(double(m(:,1)==1)+double(m(:,1)==5)); dim2=logical(double(m(:,4)==1)+double(m(:,4)==5)); dim=logical(dim1.*dim2); elseif isdim2==2 ...
2ee906ae61bd299f1880e75c0abb580c5a48225447238a564cfc5d2620fe0dcc
MATLAB
834
20
function [L, measurements] = zef_lead_field_whitening_diagonal_identity(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: Lead field whiteni...
7a4ea3c9248038349877e6b2f63ab1c70ad7c03fa1819844c587adacaf3307e8
MATLAB
835
27
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface % These are parameters from the initialization file. if isfield(zef_data,'matlab_release') zef_data = rmfield(zef_data,'matlab_release'); end if isfield(zef_data,'code_path') zef_data = rmfi...
eed36e602c1726e74389f963bc0696d6d3d578cf86967ed6335d3dac7cf47392
MATLAB
835
29
function D = dirichlet_kl(alpha_q,alpha_p) % Computes D(q||p) = | q(x)*log(q(x)/p(x)) dx % between two k-dimensional Dirichlet probability densities, with pdf % % Gamma(sum_{i=1}^k alpha_i) alpha_1-1 alpha_k-1 % p(x)= --------------------------- x_1 .... x_k % prod_{i=1}^...
8b0fbea8535c62bd3d2406df2c4c2741081054a740030be29d89c14cb97df2b9
MATLAB
836
26
function [P_store,z_inverse] = kalman_filter_sLORETA_EVO_DIAG_WEIGHT(m,P,A,Q,L,R, timeSteps ,number_of_frames, smoothing) P_store = cell(0); z_inverse = cell(0); h = zef_waitbar(0,1, 'Filtering'); c_val = 0.05; diag_Q = diag(Q); for f_ind = 1: number_of_frames zef_waitbar(f_ind,number_of_frames,h,... ['Filt...
a2ac914fb37e489f92d87870082db533327328e985e9cab275e0f2fd082b30ed
MATLAB
836
32
function [m, P, K, D] = kf_sL_update(m,P,y,H,R) % Resolution matrix method = '1'; if(method == '1') P_sqrtm = sqrtm(P); B = H * P_sqrtm; G = B' / (B * B' + R); w_t = 1 ./ sqrt(sum(G.' .* B, 1))'; D = w_t .* inv(P_sqrtm); elseif(method == '2') [Ur,Sr,Vr] = svd(P); Sr = diag(Sr...
b7557218c7ceefe63d2e9ddad95381061dd43a3579140dc28f706b50b1b9fd37
MATLAB
836
22
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef_tile_figs(varargin) n_tiles = 20; h_aux = evalin('base','findall(groot, ''Type'',''figure'',''Name'',''ZEFFIRO Interface: Figure tool'')'); tile_mat = [1 : n_tiles]; tile_mat = tile_mat'*...
e0a7ae3b42718321a8aaf4d03df141edc97650423481ac752b5a2fb1823a18b0
MATLAB
836
37
function [Stop] = update_smbo_views(results, state, all_struct_handle, all_model_learned_handle, s_handle, p_handle) vals = table2array(results.XTrace); if size(vals, 1) == 1 s_vals = vals(1); p_vals = vals(2); else s_vals = vals(:, 1); p_vals = vals(:, 2); end us_vals = unique(s_vals); up_vals = un...
0ea7dd0cafa22ca1111d7ed996e3c350adbfeaa4029e007932dd19a49f1611a1
MATLAB
839
33
function m = getMean(hmm,k) % Get the mean activity for state k from the estimated model hmm % This function should primarily be used when the state model is a Gaussian % distribution (i.e. order=0) % % Diego Vidaurre, OHBA, University of Oxford (2016) if hmm.train.zeromean error('The states are not modelled by t...
139edcdc415c7d902faa30823b7825afc4e629a37614b2f952846f365c5fe57a
MATLAB
839
24
function Segment = find_isolated_spike(data, parm) N = numel(data.y); isi_pre = [0; diff(sort(data.spike_time))]; isi_post = [diff(sort(data.spike_time)); 0]; ix = isi_pre > parm.MinISI & isi_post > parm.MinISI; single_spike_time = data.spike_time(ix); Nsegment = numel(single_spike...
3566375e840b668e18bb51dc51d96660279dd62957ea17aea93820ad70499c3e
MATLAB
839
28
function [A] = connectivity_matrix(source_positions, K, weighted_avg) % Connectivity matrix %SMOOTHING_MATRIX Summary of this function goes here % Detailed explanation goes here % TODO: weighted avg if nargin < 3 weighted_avg = false; end MdlKDT = KDTreeSearcher(source_positions); [IDX, D] = knnsearch(MdlKDT, so...
98a7146f571ec7287425a91b7f74639239af5cbac8c96cdfca5f28d5045403e0
MATLAB
839
30
function idiff = vb_setdiff2(inew,iold) % Fast calculation of set difference 'setdiff' for interger index % idiff = vb_setdiff2(inew,iold) % --- Input % inew , iold : Integer index array % --- Output % idiff : index in 'inew' which is not included in 'iold' % % inew ¤ÎÍ×ÁÇ¤Ç iold ¤ÎÍ×ÁǤǤʤ¤Ãͤò idiff ¤Ë½ÐÎÏ % inew , ...
dff4742082ef095bce95f086aea43357dd8629f453d0612eb3a67bc5a9daac42
MATLAB
839
62
clear all close all clc addpath('./tools/') load('./save_file/all_traj_06282022.mat') % choose the reference trajectory % traj_type = 'lorenz'; traj_type = 'circle'; % traj_type = 'mg17'; % traj_type = 'infty'; % traj_type = 'fermat'; % traj_type = 'astroid'; % traj_type = 'heart'; % traj_type = 'epitrochoid'; % tra...
8e763d253621461dc6ef95d5518f71adffa56b2902cccafc0328bbbefdc3ad8d
MATLAB
840
25
number_of_points = 10; 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 = [1:floor(length(nodes_ind_aux)/(number_of_points-1)):length(nodes_ind_aux)]'; distance_vec = zeros(length(nodes_ind_aux),1); ...
98e2173dca3e88302b811942c9277825fb37bf440458245e2be816063348f0aa
MATLAB
840
48
function [tree, newText] = zef_dataBank_sortTree(tree) %sorts the tree with the numbers of the hashes, so that e.g. node_11>node_7 %this is needed to build the tree easily if isstruct(tree) text=fieldnames(tree); else text=properties(tree); for i=1:length(text) if strcmp(text{i}, 'Properties') ...
9ff2ecfed8fa2fb5232018e7c8b3671e44ef5dd8884c18c0b1651c41a73526c2
MATLAB
840
36
function matDiff = vec2diffmat(vecVals,sParams) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here %check input if ndims(vecVals) > 2 || (size(vecVals,1) > 1 && size(vecVals,2) > 1) error([mfilename ':NotAVector'],'Input is not a vector'); end if ~exist('sParams','var'), sParams ...
fde4411311ec4c2558bd6112fe7ea82ae4626606b160995ecd915c381c2721d8
MATLAB
843
37
function [brain_ind, brain_compartments] = zef_find_active_compartment_ind(zef,domain_labels) if nargin < 2 domain_labels = zef.domain_labels; end aux_compartment_ind = zeros(length(zef.compartment_tags),1); i = 0; for k = 1 : length(zef.compartment_tags) on_val = zef.([zef.compartment_tags{k} '_on']); ...
5824d167f3504cf7f8d2ec51ded7ee82e6863d2e2a9e39c2acde635abb8bbf35
MATLAB
844
27
%get target directory function runDesktopStateBackup strDir = prefdir(); strBackupDir = strcat(strDir,filesep,'DesktopBackups'); if ~exist(strBackupDir,'dir') mkdir(strBackupDir); end %get current files sFiles = dir(strBackupDir); %remove old files (>1 week old) vecDaysAgo = datediff(getDate,{sFiles(:).da...
18ba5e76b5fc5c7b1c8a7a5550f9a3434b6f3c1ce772a77f34db94ee25ae75a7
MATLAB
845
23
% get the number of frames from original metadata function numframes = metadataNFrames( metadata ) % metadata is the original metadata obtained from the vsi/ets % bioformats import in matlab, see openETSuiProbe key = 'External file volume'; % why this works is unimportant? value = metadata.get(key); % this should be a...
c06e884f847db07ad484c310aba80761de0030b8eb2f2d81a486580c8a11ce66
MATLAB
847
16
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_find_synthetic_source_legacy_window(zef) zef_find_synthetic_source_legacy_app; set(zef.h_find_synthetic_source_legacy,'Name','ZEFFIRO Interface: Find synthetic source'); set(findob...
3d5da237fb719f4cd93dba89af26226d6ee12ff198fdd563d74fd5402a084968
MATLAB
849
59
function M = zef_averaging_matrix(nodes,tetra,I) if nargin < 3 I = []; end if not(isempty(I)) [F,~] = find(ismember(tetra,I)); tetra = tetra(F,:); end M = spalloc(size(nodes,1),size(nodes,1),0); dist_aux = zeros(size(tetra,1),4,4); for i = 1 : 4 for j = i + 1 : 4 dist_aux(:,i,j) = sqrt(...
83af4149dc14d35ebb066111d3cc4025b24c3a763113a6a812b9e67797dd5684
MATLAB
850
29
function SpectraTC = Fun_ComputeSpectraTC(Spectra, NumberOfEpochs, ... EpochLength, TimeBin) %% Written and updated by M. Nollet (Aug 2023) % % Function to be used to re-organise EEG spectrum data into time bins for % time-course analysis % % INPUTS: EEG spectrum data and other variables % % OUTPUT: Sp...
64eeaa08e7469cb81e0f10cebaa6f1836be5d06fe02d00b3d7d9716635c572be
MATLAB
851
21
% myobj = SetNextFileName( myobj, 'name' ) % % If a run is in progress, set the full path and run name % for the next file set. For example, "Y:/mydir/../myrun." % To that, SpikeGLX appends the stream and extension, for % example, "Y:/mydir/../myrun.imec0.ap.bin." SpikeGLX will % not create any fold...
dd31e6fd9ce6cdd3f47f660e57e5dac38e039e21650fe0f192e90a50f968b60e
MATLAB
851
30
% load minimum of data to allow ROI selection function S = loadFlatStackOpt(m,field) % m = matfile(fullpath2file); % m is the result of a call to matfile % not loading stack from flat file, too slow %S.stack = single(m.stack); S.timing = m.timing; % convert to sec S.interval = m.interval; % co...
b1db25bc22e7a0e5a13954017e937bd4a6c0a953ace6ebfb92725157903fbab5
MATLAB
854
26
function vecVals = getValByIdx(matVals,matSelection) %getMatVals Description % % SYNTAX % vecVals = getMatVals(matVals,matSelection) % % INPUT % matVals: data matrix % matSelection: selection matrix of integers (same size as matVals) % % OUTPUT % vecVals: vector with values corresponding to selec...
4b8d130dcf7df6cdb3f60bbef07bc04c45da2b0ffd32fdad306cf0e5f9ad5064
MATLAB
855
10
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.h_tools_aux = findall(groot, 'Type','figure','-regexp','Name','ZEFFIRO Interface:*'); zef.h_tools_aux = setdiff(zef.h_tools_aux, findall(groot, 'Type','figure','-regexp','Name','ZEFFIRO Interface: ...
4d482edb31d504e65e635139c55bcfd05789537bbe620617b8a5e094439fb04d
MATLAB
855
28
function plot_rois_masks(app) roi_contours = app.rois; % don't know why this sometimes turns off but let's do it again set_common_plot_settings(app.roi_preview); set_no_tick(app.roi_preview); app.roi_preview.Color = [1 1 1]; % Make Colors C = jet(length(roi_contours.xpix)); C = flipud(C); % Plot them (One first to ...
bdc34bfe54f5488a9d2004215cecf9aadb4200125d1ef2caab8b85525cc7b0c1
MATLAB
855
30
function Y = shufflewins(X,W,R) % function Y = shufflewins(X,W,R) % X is a waveform, which is chopped into W-point windows % which are then hanning-windowed and 50%-overlapped. These % windows are shuffled over a radius of R points and % ovelap-added to construct Y, a version of X with approximately % ...
367d845af04e663c81b370dc9eb160cb5b59095c9570008c5d82a70357a95b0c
MATLAB
856
29
function ScoringTC = Fun_ComputeScoringTC(Scorings, NumberOfEpochs,... EpochLength, TimeBin) %% Written and updated by M. Nollet (Aug 2023) % % Function to be used to re-organise scoring data into time bins for % time-course analysis % % INPUTS: scoring data and other variables % % OUTPUT: ScoringTC ma...
4f2c44428c06d493aba5520959dc8e426d540e95de441f79e1d783e233eaecd6
MATLAB
857
33
classdef Unpooling < dagnn.Filter properties ID = -1; end methods function outputs = forward(self, inputs, params) [outputs{1}] = vl_nnunpool(inputs{1}, inputs{2}, inputs{3}); end function [derInputs, derParams] = backward(self, inputs, params, derOutputs) derInputs{1} = vl_nnunpool...
38a74183b684122cab049f692f56ac06b07254ae28a3d377844201462a2b9e28
MATLAB
858
27
function y = pinknoise1(dim) ; % Get same size T = dim(1) ; N = dim(2) ; % Make a pink filter [b,a] = makePinkFilter ; % You can plot the filter response by uncommenting below: % freqz(b,a) % Generate some noise and filter y = 2*rand(T,N)-1 ; y = filter(b,a,y) ; function [b,a] = makePin...
32a80aeb76ab663012ff4a8aa2f3e304a0d8ba5ec25fba574568e73dadd27e14
MATLAB
859
28
function [xNode, xEdge, eBelow] = solveQPBO(gNode, gEdge, edges) % gEdge(2:3,:) = gEdge([3 2],:); % Coerce edges %if ~isa(edges, 'int32') edges = int32(edges); % end %fprintf(class(gNode)); %fprintf(class(gEdge)); %fprintf(class(edges)); % Dispatch %if...