sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
46fa3caf350b85955e64df11fa215a01020f30c5cbbd623ebd6640e7ce2d3f38
MATLAB
1,745
52
function preview_all_structures_button_pushed(app) %% First find structures for all sLambda tempParams = app.params; numSLambda = length(tempParams.s_lambda_sequence_glm); wb = CmdLineProgressBar('Learning All Structures'); %feedback fprintf('\n'); tempParams.raw_coef = cell(1,numSLambda); tempParams.learned_struc...
5d2f6131c15b9c78f3fef64112b511bbae77b1ce3a5b95e1a8aebdafc1e21a1b
MATLAB
1,747
27
%% Result 1 : Long-Range Connections Enhance Object Recognition in Shallow Networks (Figure 2) % ============================================================================================================ %% Add LRC vs Add Local & Fully-connected networks (Figure 2d) disp('======================================...
31415ee6e9efb73dc659a6d6789a2613fb43f611f7f9f59eea479474923f7c15
MATLAB
1,751
71
function unlock_buttons(app, stage) if nargin == 1 stage = app.params.stage; end if stage >= 2 % current tab app.PreviewPassedStructuresButton.Enable='on'; app.PreviewAllStructuresButton.Enable='on'; % next tab app.PerformParameterEstimationButton.Enable = 'on'; app.OptimizeButton.Enable=...
e1b67fda9c46ad97df72538184099059344ac30beeec1a67daffa0b820d77c67
MATLAB
1,751
56
function [sensor_positions, sensor_orientations, sensor_ind, sensor_tag_cell] = zef_bst_2_zef_sensors(varargin) sensor_counter = 0; sensor_num = 0; istudy = []; sensor_type = []; sensor_positions = []; sensor_orientations = []; sensor_ind = []; sensor_tag_cell = cell(0); scaling_constant = 1000; if not(isempty(vararg...
1e6183e992c32e4a850aac92ff64ad8e113ba712e08730746b46b871ef19f7d6
MATLAB
1,754
39
function [decomposition_ind, decomposition_count, dof_positions] = zef_decompose_soure_space(source_count, center_points) min_x = min(center_points(:,1)); max_x = max(center_points(:,1)); min_y = min(center_points(:,2)); max_y = max(center_points(:,2)); min_z = min(center_points(:,3)); max_z = max(center_points(:,3));...
b0c828a8ad0e7cf4ed977f8bb760563a5d7d3c1ba01957f1d69a5ef635a646a8
MATLAB
1,755
58
function [stim, noiseRMS,total_dur] = IACtSquare_ToneDetect(fs, BPfilt,WindowSize,SNRdes,StaticIAC) %stim is 3AFC with the 3rd one being correct %SNR in dB %StaticIAC should be empty, 1, or 0 for this experiment %window size in seconds if isempty(StaticIAC) total_dur = 0.8+WindowSize; % 400 ms of uncorrelated no...
5de49026ae64fd168fa2d966f0ea7e44b705ad9891dfff2bf28405869063a2ac
MATLAB
1,758
29
function zef = zef_ES_optimizer_properties(zef) if nargin == 0 zef = evalin('base','zef'); end zef_data = zef_ES_optimizer_properties_app; zef.h_ES_optimizer_properties_copy_all = zef_data.h_ES_optimizer_properties_copy_all; zef.h_ES_optimizer_properties = zef_data.h_ES_optimizer_properties; zef.h_ES_o...
e83cfcd657bac1b2c84e4a406c8322c79f9f04da4a9d00b3121c323df79ee41f
MATLAB
1,759
51
function zef = zef_ES_optimizer_properties_show(zef) if nargin == 0 zef = evalin('base','zef'); end zef = zef_ES_optimizer_properties(zef); vec = zef_ES_table(zef.y_ES_interval); [sr, sc] = zef_ES_objective_function(zef); for i_aux = 1:width(vec)-1 % Last one are the ES channels. zef.h_ES_optimizer_proper...
48654c865544ac615fc9d45949766484d9daf234de9fee94395c5bde537ebec7
MATLAB
1,761
45
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D load([torre_dir '/system_data/signal_configuration.mat']); load([torre_dir '/system_data/mesh_1.mat']); load([torre_dir '/signal_data/simulated_data_1.mat']) system_setting_index = 1; paramete...
62e4b084a3d928af341a5aefbc240dd0572171629099584c58b196a3013d549d
MATLAB
1,762
40
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if zef.mlapp == 1 zef.mesh_smoothing_on = zef.h_checkbox_mesh_smoothing_on.Value; zef.refinement_on = zef.h_refinement_on.Value; zef.source_interpolation_on = zef.h_source_interpolation_o...
d68dcd960f3c80d30ba5e3f57196369159247465c4ba8ef2a17b2fe8bee265bd
MATLAB
1,763
76
% [] = XXXX() % % -----------------------------Definition---------------------------------% % % description % % usage : % % -----------------------------Input--------------------------------------% % % XX : description + dimension % % -----------------------------Output-------------------------------------% % % XX : d...
21c5131111422cb69b2ff8d5fdb45449f31164fccc68658b62d36e8906c87f53
MATLAB
1,764
65
function [p,acc,confusionmat] = networks_mvpa(nets) ; % If multiple participtants, append if size(nets,1)>1 for i = 1:size(nets,2) if isempty(nets{1,i}) j = 1 ; while isempty(nets{j,i}) j=j+1 ; end nets{1,i} = nets{j,i} ; nets{j,i}...
ee3462d8aed60f09413670b6d41d6f17113327df6528e099575993f4ce1cb8cc
MATLAB
1,769
48
nodes_old = zef.nodes; nodes = zef.nodes; N = size(nodes,1); taubin_lambda = 1; taubin_mu = -1; smoothing_param = 0.25; [zef.sensors_attached_volume] = zef_attach_sensors_volume(zef,zef.sensors); L = zef_electrode_struct; if not(isempty(L)) C = []; for electrode_ind = 1 : length(L) C_sparse = sparse(...
257b9dc8df419bb42c616cfc3c329b133831922de736f0c35b4e396dabb7ce88
MATLAB
1,773
37
function zef = zef_strip_tool_add_contacts(zef) points_1 = zef.([zef.current_sensors '_points']); impedance_1 = zef.([zef.current_sensors '_electrode_impedance']); inner_radius_1 = zef.([zef.current_sensors '_electrode_inner_radius']); outer_radius_1 = zef.([zef.current_sensors '_electrode_outer_radius']); strip_stru...
59eb6267ed22b4e22f6a5a446419c5367c31607334cdde57115ba729d09aadf8
MATLAB
1,773
63
% For the real data experiments in: % Vidaurre et al (2018). Temporally unconstrained decoding reveals consistent % but time-varying stages of stimulus processing. Cerebral Cortex % check: % https://github.com/vidaurre/CC2018 %% Example for a continuous response that varies across time addpath(genpath('.'))...
3b0190343a07f2de8f2c0b05e2fe9e14ce8c37dca4c2a000f39d85f6ffdd4d8d
MATLAB
1,780
52
function covmats_unflipped = getAllCovMats(data,T,options) if ~isfield(options,'maxlag'), options.maxlag = 10; end if ~isfield(options,'partial'), options.partial = 0; end if ~isfield(options,'standardise'), options.standardise = 1; end N = length(T); if iscell(data) for j = 1:N if ischar(data{j}) ...
d60f3308989be57177ecdb2ebe4611b4631ac9a1df4eb34b52831497ebc18a7a
MATLAB
1,780
63
function [P_store, z_inverse] = triple_kf_sL(m,P,A,Q,L,R,timeSteps, number_of_frames, smoothing, sL,standardization_exponent,burn_in) P_store = cell(0); z_inverse = cell(0); h = zef_waitbar(0,1, 'Filtering'); zero_m=zeros(size(A,1)); A=cell2mat({A,(1/number_of_frames)*A,(1/2)*((1/number_of_frames)^2)*A;zero_m,A,(1/nu...
93b92566b1134f7b891f6531ad237607c8a17844efba33d505ba155adb19e983
MATLAB
1,781
55
function [z_inverse] = EnKF(m, A, P, Q, L, R, timeSteps, number_of_frames, n_ensembles) %ENKF Summary of this function goes here %x_ensemble = mvnrnd(zeros(size(m)), 100* ones(size(m,1)), n_ensembles)'; x_ensemble = mvnrnd(zeros(size(m)), P, n_ensembles)'; z_inverse = cell(0); h = zef_waitbar(0,1, 'EnKF Filtering'); fo...
184b56aea208b8864e9d33dcd7ac17ce66af5a83991b21f2aa2901fc4cb1a137
MATLAB
1,782
58
function rids = realign_all_niftis_nacc(outputfolder, suffix) %% main if nargin < 1 outputfolder = '/data2/MRI_PET_DATA/processed_images_final'; end if nargin < 2 suffix = ''; end MRI_folder_init = '/data2/MRI_PET_DATA/raw_data/NACC_MRI'; fnames = dir(MRI_folder_init); fnames = {fnames.name}; rids = arrayfun(@...
63921fca237e650edf17a9bfb003e48472c26fe9d15a9f8c08b74670fcf0e0d6
MATLAB
1,782
39
%% Result 2 : Long-Range Connections Integrate Global Features (Figure 3) %% Classification performance for each dataset with a variation of the LRC ratio (Figure 3c) disp('=================================================================') disp('Result2 : Accuracy for ''Shape'',''Position'',''Shape Position''')...
1b1f65f24f098efaf445ef6c697921a1f6a97f7bc430f0336532c087e70adf09
MATLAB
1,784
90
function [vertex,face] = read_vtk(filename, verbose) % read_vtk - read data from VTK file. % % [vertex,face] = read_vtk(filename, verbose); % % 'vertex' is a 'nb.vert x 3' array specifying the position of the vertices. % 'face' is a 'nb.face x 3' array specifying the connectivity of the mesh. % % Copy...
ca598a062093afc1f47a5716f481b3b076d3530bd23397b857560fd8913d968b
MATLAB
1,784
60
function [vecTime,vecIdx,vecDuration,vecEnergy,vecSlope] = findsustainedpeaks(vecData,vecT,intMaxPeaks,dblCutOffZ) %findsustainedpeaks Returns the left-hand onset time of sustained peaks. Syntax: % [vecTime,vecIdx,vecDurations,vecEnergy,vecSlope] = findsustainedpeaks(vecData,vecT,intMaxPeaks,dblCutOffZ) % %Requi...
96e0c56e20385fe7dec3942477a6bfdf9f7e847e722e566d9c8c83acc96028de
MATLAB
1,786
62
function [D] = wishart_kl (arg1,arg2,arg3,arg4) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % [D] = wishart_kl (B_q,B_p,alpha_q,alpha_p) % % computes the divergence % / % D(q||p) = | q(x)*log(q(x)/p(x)) dx % / % between two k-dimensional Wishart propability densi...
ac40f4630a43a5605186e20ba5b43ada3441931b4af4da206c783b94acb85d3e
MATLAB
1,787
46
function [model_collection, params] = estimate_parameters_parallel_implementation(params, models) fprintf('\n'); fprintf('Parameter Estimation...\n'); num_models = length(models); pbar = parwaitbar(num_models,'WaitMessage','Estimating Parameters','FinalMessage','Parameter Estimation Learning Complete'); parfor singl...
69eb93814e9c588c1eeb9528cfd7a70081ca0b5d469c7112899cdd1ad7aee7c0
MATLAB
1,793
34
if zef.nse_field.solver_type == 1 zef = zef_nse_tool_update(zef); zef.nse_field.microcirculation_model = 0; zef.nse_field = zef_nse_poisson(zef.nse_field,zef.nodes,zef.tetra,zef.domain_labels,zef.mvd_length); elseif zef.nse_field.solver_type == 2 zef = zef_nse_tool_update(zef); zef.nse_field.microci...
adf05207480694b90d8bbda80bc7b4226607749601493145b3e27451d60c95e7
MATLAB
1,794
40
function [Pss_single,Pss_compare]=bsliang_getPvalues(Pstructure) Pss_single=nan(4,4); Pss_compare=nan(4,2); % left_clear Pss_single(1,:) = [Pstructure.left_clear.tone_iTBS ... Pstructure.left_clear.tone_cTBS ... Pstructure.left_clear.phon_iTBS ...
a1e2dd4875221e65544e037d8040d0f9b84374645a8e7ce207ab36247af2e694
MATLAB
1,795
75
function x = EM_Lasso(L,sigma,y,gamma,x0) %MAP estimate using EM algorithm %L1 norm minimization problem (LASSO): %0.5|1/sigma(Lx-y)\|_2^2+0.5*\sum_i [gamma_i |x_i|] % L : lead field matrix % sigma: noise variance % y: measurements %for gamma->0 we have less sparse solutions... %Output: x: dipole amplitude %This co...
0bdcbc5975a79504fecc1a4ee406ad9e9d7426d7609ad2ec271031cd633ab0b5
MATLAB
1,799
61
function mess = CheckRealNumber(x, Bounds, MaxSize) % CheckRealNumber - checks if the arg is a real number of correct size and value % SYNTAX: % mess = CheckRealNumber(x, Bounds, MaxSize); % where x is the value to be tested; % Bounds = [lowerBound, higherBound] % (single value-> [0 Bounds]; not s...
33e37130c86c9a8ac430824d86afdcbe73dd2a881f27ababb0b3a64cf8082af4
MATLAB
1,799
62
loop_indx = 1; ms_after_stimulus = [14 16 20 22 30]; for frame = [21 31 51 61 101] frame = num2str(frame); ms = num2str(ms_after_stimulus(loop_indx)); full_address = 'exportImage'; file_name = ['mneSL' ms 'ms']; file_full = fullfile(full_address, file_name); %% zef.h_reconstruction_type.Va...
4e5d95c0a30fbc41086494010a192dc5bb724611a27c17d4beef898a612874a7
MATLAB
1,805
62
function output = ERBFilterBank(x, fcoefs) % function output = ERBFilterBank(x, fcoefs) % Process an input waveform with a gammatone filter bank. This function % takes a single sound vector, and returns an array of filter outputs, one % channel per row. % % The fcoefs parameter, which completely specifies the Gammato...
97f34df2c7552ff4baad78cf579dd0c5ec742e5019cabbe5ef9fe5059de13ad4
MATLAB
1,805
55
function [hmm] = updatePsi(hmm,Gamma,X,Y) % Computes the parameter psi for tuning the approximation to the % logistic function. [T,ndim]=size(X); % Gamma = hmm.Gamma; % warning: this is not guaranteed to be the updated Gamma! K = hmm.train.K; if length(unique(Y(:)))<3 binomial=true; else binomial=false; end f...
01843912bf435b5a060de123951c1923939867b93421d5bff59a6903003dde3a
MATLAB
1,807
38
zef_init_gaussian_prior_options; zef_data = zef_gaussian_prior_options; zef.fieldnames = fieldnames(zef_data); for zef_i = 1:length(zef.fieldnames) zef.(zef.fieldnames{zef_i}) = zef_data.(zef.fieldnames{zef_i}); if find(ismember(properties(zef.(zef.fieldnames{zef_i})),'ValueChangedFcn')) zef.(zef.fiel...
2902784fb609df5efa9ccaaff6866548deb318b16d14499953ffc10ce5b41130
MATLAB
1,807
72
%-------------------------------------------------------------------------------- % qd_matrix.m % % This demo is included in % Canonical neural networks perform active inference % Takuya Isomura, Hideaki Shimazaki, Karl J. Friston % % The MATLAB scripts are available at % https://github.com/takuyaisomura/reverse_engin...
b6201a8ada28def903c56612b2cc390070fd651c36f1a3292f86540b4d2eb858
MATLAB
1,809
52
function [z,mu,sigma] = zscore(x,mask,sigma,dim) %ZSCORE Standardized z score. % altered to accept external SD for rectified csc/EEG, % UB 10/11/2014 % Z = ZSCORE(X) returns a centered, scaled version of X, the same size as X. % For vector input X, Z is the vector of z-scores (X-MEAN(X)) ./ STD(X). For % ma...
cb701ca783b2351b72d1628524d1c386ae24c4b3bd042af73ab42883ee10188c
MATLAB
1,809
51
% import data from *_Igor.mat files (contains ROI data) % returns penumbra subtracted dF/F0! function ROIdataStruct = loadROIdata2( path ) % use full path now! localpath ) % get the list of file names %upath = userpath; % default user directory "MATLAB" contains data directory "ROI data" if ismac ext = '*_Igor*.ma...
ac67bc9cfc31526c885bdcec72e9ba681bb7c103021e7f8ca0f717ba8053c157
MATLAB
1,810
61
function [node_performance] = calculate_node_performance(params, log_likelihood_by_frame, best_model, include_testing_in_identify) if nargin <4 include_testing_in_identify = 1; end [~, num_udf] = size(params.udf); num_node = size(best_model.structure,1);%graph to structure if include_testing_in_identify == 1 ...
2c6a1579e1ba0ab57d71a54fb2bdcb85937350bbcece2943b84c01449506bdaa
MATLAB
1,812
63
function sensitivity_map = zef_sensitivity_map_mne( ... project_struct, ... weighting_type, ... n_reconstructions, ... noise_level, ... diff_type, ... dispersion_radius ... ) arguments project_struct (1,1) struct weighting_type (1,:) char { mustBeMember(weighting_type, ['...
321c543d45f986b48c7a40a1f0cb05c89c649790c48c19d620c3ed841d459ae4
MATLAB
1,812
66
function obj = stats_autoinformation(obj,maxlag) % Calculate autoinformation of microstate sequence % Check inputs if isempty(obj.label) error('To calculation microstate autoinformation, property label is required') end if nargin < 2 maxlag = 500 ; % 500 samples end if m...
5b9f18c28939ce20e1f2c362a45f83b65f609ab5c56d2106e528bf395eec6c9f
MATLAB
1,815
52
function zef_set_sliders_print(mode,h_axes_image) h_figure = h_axes_image.Parent; if mode == 1 h_axes_image.Colormap = zef_colormap(evalin('base','zef.h_update_colormap.Value')); zef_update_ambience(h_figure); zef_update_diffusion(h_figure); zef_update_specular(h_figure); zef_update_colorscale(h...
26605d34e07a1263e0779235b38281a09e60c6621397bcd19193ebafb6768319
MATLAB
1,816
66
function [bcR, p, T, df] = bcdistcorr(x, y) % BCDISTCORR computes the bias corrected distance correlation % % [BCR,P,T,DF] = BCDISTCORR(X,Y), where X (size n-by-p) and Y (size % n-by-q) are n random samples of observation. The function returns the % bias corrected distance correlation BCR and the correspond...
08fba1b23324b51f099a0da112af35c856abeb0e8f913ac4eb49563ee3ecc8cc
MATLAB
1,817
27
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'synth_source_ROI')); zef.synth_source_ROI = [1 0 0 0 1 1 0 0 0 0 0 1 1 0 0 10 0 1 1 3]; end set(zef.h_synth_source_ROI_style,'value',zef.synth_source_ROI(1,1)); set(zef.h_...
540bb794f9fd2e88deeb77c4e293160576b3a8ee23e3aee2b33172f09e49c154
MATLAB
1,825
70
% Generate the (1) UI and (2) wall-clock computation time vectors for comparing four different methods: % adm, fmincon with gradient and Hessian, fimincon with gradient only, and fmincon blackbox. % The admUI_mex executable is to be generated using Matlab 2017a. % Data for Fig. 2 (top panel) clear all; addpath(genpa...
c79aa0af6898a75fe1a21d02ae9867106d2c522ee2e1b34a1c0d7f1ae3ef9033
MATLAB
1,825
68
function ETC_KeyPress(hMain,eventdata) %dummy for testing global sFigETC; if ~exist('eventdata','var') eventdata = struct; eventdata.Key = 'r'; eventdata.Modifier = []; end % Get guidata if toc(sFigETC.lastPress) < 0.1;return;end sFigETC.lastPress = tic; if strcmp(eventdata.Key,'rightarrow') || strc...
55c528a5ab000511c3ab10c43245b99b2c99f760306a6f982d75559182d228ff
MATLAB
1,826
72
% Generate the (1) UI and (2) wall-clock computation time vectors for comparing four different methods: % adm, fmincon with gradient and Hessian, fimincon with gradient only, and fmincon blackbox. % The admUI_mex executable is to be generated using Matlab 2017a. % Data for Fig. 2 (middle panel) clear all; addpath(ge...
8f998bd48bc9fae87764a5ea001d773ec34d3865141b008313d7e70b8462a2f3
MATLAB
1,827
60
function stats = extract_stats_segmentation(net, stats) sel = find(cellfun(@(x) isa(x,'dagnn.LossSemantic'), {net.layers.block})) ; obj = net.vars(net.layers(sel).outputIndexes(1)).value; predictions = net.vars(net.layers(sel).inputIndexes(1)).value; labels = net.vars(net.layers(sel).inputIndexes(2)).value; L ...
4d1f4da804415e61c56fe1b7dc5d1187122519e00d53cc38eb21c927ccc74697
MATLAB
1,829
53
function Y = vl_nnlossDice(in, out, weights, dzdy) % VL_NNLOSS CNN log-loss % Y = VL_NNLOSS(X, C) applies the the logistic loss to the data % X. X has dimension H x W x D x N, packing N arrays of W x H % D-dimensional vectors. % % C contains the class labels, which should be integers in the range % 1 to...
b736ae9e162c07ba9f73c14f882b75059d3499ab73ab50e0909f357272462033
MATLAB
1,829
47
function h = structuredROIax( x, y, im, fax, r, deadzone, penumbra, expand ) % x, y position of click, im is an image (usually max projection), % fax is the target axes for drawing polygons, % r is radius, offset the gap between ROI and deadzone, and deadzone and % penumbra % expand (pixels) expands/shrinks the F...
f3a92e4ba63c0cbf108893ad3d403160a2b1b53030884c0d6b2725b133e86c1f
MATLAB
1,829
56
function zef = zef_create_sensors(zef,sensor_tag,field_cell_update) if isequal(sensor_tag,'s') || isequal(sensor_tag,'s1') eval(['zef.current_sensors =''' sensor_tag ''';']); end zef_struct_name = 'zef'; if nargin == 2 field_cell_update = cell(0); end field_cell_default = {{'on', '1'} {'color', '[0.1 0.1...
465717de08904429aaf3b4a51acfef8aa3a3fcba17169728d5aa3a7dd63f828f
MATLAB
1,832
71
% Generate the (1) UI and (2) wall-clock computation time vectors for comparing four different methods: % adm, fmincon with gradient and Hessian, fimincon with gradient only, and fmincon blackbox. % The admUI_mex executable is to be generated using Matlab 2017a. % Data for Fig. 2 (bottom panel) % ns=ny=nz clear all; ...
9410255cec98dd79891f5279760f141bb9a57b3eb646f085a87c81293b90d780
MATLAB
1,834
18
zef_create_dipolar_pair_update_struct; zef.aux_field = sqrt(zef.create_dipolar_pair_ori_x.^2 + zef.create_dipolar_pair_ori_y.^2 + zef.create_dipolar_pair_ori_z.^2); zef.create_dipolar_pair_ori_x = zef.create_dipolar_pair_ori_x/zef.aux_field; zef.create_dipolar_pair_ori_y = zef.create_dipolar_pair_ori_y/zef.aux_field;...
5cd4db3825324c99a6be5b87a7bbd2519e0111b7aa67aa89b32cbfbfee97aa08
MATLAB
1,836
42
function nd = zef_init_jr_nodedata() %ZEF_INIT_JR_NODEDATA Default NodeData for Jansen–Rit node (descriptive names). nd = struct(); nd.Model = struct('Name','Model','Value','JansenRit'); nd.OutputGain = struct('Name','Position','Value',0); nd.SourcePosition = struct('Name','Position','Value',[0 0 0...
a2e66d662caf49e3521a270ad19f12e0ab17d10fff075182109978bb3e4eb745
MATLAB
1,837
71
function [sl_indices, sl_dists, sl_lengths] = zef_dti_nearest_streamlines(points, dti_streamlines, roi_radius) n_points = size(points,1); n_streams = numel(dti_streamlines); total_pts = 0; for s = 1:n_streams sl = dti_streamlines{s}; if ~isempty(sl) total_pts = total_pts +...
14f74aea2fc7155ed7bc34ae89f54fa76243d254b0bf14435774ee5e7fa4b6b0
MATLAB
1,843
66
function g = spike_func_evaluate2(tau, data) % spike_func_evaluate % --- % % --- data in spike window % data.y : y(t) (1 x Nt) % data.Dt : spike onset (# of pattarn) x (# of spike) : (Nconf x Ns) % data.dt : sampling time step [sec] % --- time constant of spike response % tau = [Ą1; Ą2] ...
af6e2cd50265dac441bd965d9551a00c71667f9e6411e62e3ae93c1eff657df8
MATLAB
1,843
79
function hmm = versCompatibilityFix(hmm) if ~isfield(hmm.train,'orders') hmm.train.orders = formorders(hmm.train.order,hmm.train.orderoffset,... hmm.train.timelag,hmm.train.exptimelag); end if isfield(hmm,'cache') hmm = rmfield(hmm,'cache'); end if isfield(hmm.train,'state') hmm.train = rmfield(h...
037fea713a6d94ead312f2d5874b12c417af9b0e3676106582691295e5cdcae9
MATLAB
1,844
51
function [binary_structure] = process_structure(coefficients, density, absolute, mode, neighborhoods) num_nodes = size(coefficients, 1); if absolute AbsMat = abs(coefficients+coefficients'); else AbsMat = coefficients+coefficients'; end possible_edges = zeros(num_nodes...
bfbc059fd59a627ebec392fda56b5ae5f15a884286c6ca09bef6296ae26a5dc9
MATLAB
1,846
56
function vecReorder = sortmat(matIn,intMaxIter) %sortmat Sort [n x p] matIn matrix % vecReorder = sortmat(matIn,[intMaxIter=100]) % %matIn must be [n x p] and contain more observations (n) than predictors (p) %uses 2nd PC as initial global ordering, then refines by swapping entries to maximize %inter-neighbor c...
6d695cdd23d158b90664d401131a28c0d76292fc7f834458999dc1d1f1c97b20
MATLAB
1,852
78
function C = centerOfMass(A,intDim) % CENTEROFMASS finds the center of mass of the N-dimensional input array % % CENTEROFMASS(A) finds the gray-level-weighted center of mass of the % N-dimensional numerical array A. A must be real and finite. A warning % is issued if A contains any negative values. Any NaN elemen...
d2b56bf3812927f127d8614dd515cf34f7bbd1d13a95b183c1852bec1fa0ff61
MATLAB
1,853
42
function plot_ensemble_eval_coordinates_style_2(app) v = app.StimulusEV.Value; ROI_contours = app.rois; %ROI_bounds = ROI_contours.bounds; num_rois = size(ROI_contours.xpix,1); %xrange = ROI_contours.xrange; %yrange = ROI_contours.yrange; %ensemble_colors = jet(numel(app.ensemble_nodes{v})); newcolors = app.newcolors...
342307779495f2fe3a746cbf5927d36a9347618a04e6b0d36c9f37c50c53b4c6
MATLAB
1,854
35
if not(evalin('base','zef.lock_sensor_names_on')) if ismember(evalin('base',['size(zef.' zef.current_sensors '_points,2)']),[6,0]) evalin('base',['zef.' zef.current_sensors '_points = [zef.' zef.current_sensors '_points; [0 0 0 0 1 ' num2str(evalin('base','zef.default_impedance_value')) ' ]];']); else ...
99b5a7e5c4ac07336459224cea3a53141e397845e5e5d04f93117792ddfa401f
MATLAB
1,854
84
clear all close all clc addpath('./tools/') bias_set = linspace(0, 3, 7); time_today = datestr(now, 'mmddyyyy'); reset_t = 80; noise_level = 2.0 * 10 ^ (-2); n=200; train_t = 150000; iteration = 10; rmse_set_lorenz = zeros(length(bias_set), iteration); rmse_set_circle = zeros(length(bias_set), i...
acfd5511090af17dd82464118031362332c2912b54503099995fa65b8f5fe91d
MATLAB
1,855
75
function [pxy,info] = normalizeposition(xy,margin) %NORMALIZEPOSITION Rescale an NPOINTS×2 array of (X,Y) points to [0,1)² % [PXY,INFO] = NORMALIZEPOSITION(XY,MARGIN) Expects an NPOINTS×2 array of % (X,Y) point data as input, and rescales all points to lie in [0,1)² % with padding fraction MARGIN (If MARGIN is ...
9080c7f0616d7d5a9b97195244a14d0d9e96ac518cb1120512a6295e44934383
MATLAB
1,856
57
function [multigrid_dec, multigrid_ind, multigrid_perm] = zef_make_multigrid_dec(center_points,n_subset,n_decs,n_levels) multigrid_dec = cell(0); multigrid_ind = cell(0); c_ind = [1 : size(center_points,1)]'; multigrid_perm_1 = zeros(size(center_points,1),1); multigrid_perm_2 = zeros(n_decs*n_levels*n_subset,1); ind_c...
1c9bdb379969fd0be27df626eddb2e276205381af0ad0c585c7551371678f9ec
MATLAB
1,857
56
function [ hex ] = rgb2hex(rgb) % rgb2hex converts rgb color values to hex color format. % % This function assumes rgb values are in [r g b] format on the 0 to 1 % scale. If, however, any value r, g, or b exceed 1, the function assumes % [r g b] are scaled between 0 and 255. % % * * * * * * * * * * * * * * ...
20ecc76419409d326946f77120e9b42c24f5ca62b6674233b994bfb20ea3cfc0
MATLAB
1,857
33
function h2 = drawROI( h, axe ) % h is a handle structure containing AT LEAST .ROI, .deadzone and .penumbra % these contain coordinates of the actual ROI, deadzone and penumbra % (NOT THE POLYGON HANDLES!) % axe is axes handle msize = 0.1; lsize = 0.1; nROIs = size(h,2); for i = 1:nROIs h2(i)....
eb4bc041459c1ce371286f9f2542f2cb2d8d7fadb2fa4eba4663799cb27aad38
MATLAB
1,857
26
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.ramus_multires_n_levels = str2num(get(zef.h_ramus_multires_n_levels,'string')); zef.ramus_multires_sparsity = str2num(get(zef.h_ramus_multires_sparsity,'string')); zef.ramus_multires_n_decompositio...
57deb556dc11273dd51600ede1be52314e6c25cf5ae954d710b8f2fbb416d2f4
MATLAB
1,858
65
%-------------------------------------------------------------------------------- % number_to_hand_digit.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 % % C...
30c15a1275d4c46717bf2fb2b20339b38f0f40414787e709b653573a062194bb
MATLAB
1,861
64
%function [vecMuFit,vecSigmaFit,resnorm,residual,exitflag,matFit] = getFitGaussMV(matDataGrid,vecMu0,matSigma0,boolUniform) %getFitGaussMV Fits multivariate Gaussian to input matrix. Syntax: % [vecMuFit,vecSigmaFit,resnorm,residual,exitflag,matFit] = getFitGaussMV(matDataGrid,vecMu0,matSigma0,boolUniform) % %When...
07b91e03176cdda30bbbb1d407980de9876a7455ce73355cd07f008e55920125
MATLAB
1,864
42
function zef = zef_strip_tool_embed(zef) cell_aux = zef.([zef.current_sensors '_strip_cell']); strip_struct = zef_get_strip_parameters(cell_aux{zef.strip_tool.current_strip}); [strip_struct] = zef_create_strip(strip_struct); points = zef_strip_coordinate_transform(strip_struct,'forward'); strip_struct.compartment_ta...
1b7338f19fbb94c7efd41582784207d1f4d6b6821624a961f4300eec5d3b3373
MATLAB
1,864
67
%Generating IAC(t) & ITD(t) stim for EEG clear all fs = 48828.125; %load('Mseq_IAC_ITD.mat'); %loads Mseq load('Mseq_9bit.mat') load('Seed16.mat'); %load s rng(s); M_dur = .050;%50 ms M_samps = round(M_dur*fs); %number of samples for each point in Mseq flow = 200; fhigh =1.5e3; Trials = 300; %windw = hann(round(M_...
7e254fd8bef3ce6c3b17a1be84c491d205f1273b67e8f93b33d4dc1d62045a1a
MATLAB
1,864
57
%% initialize clear; clc; currentPath = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives pathDeriv = pwd; cd(pathDeriv); cd('spm-preproc'); % For saving preprocessed file from SPM pathPrepFile = pwd; prepSubjFolders = dir('sub*'); cd(pathDeriv); cd('behavior'); pathBehav = pwd; load('be...
9bac43a9133d054f197b6de04b3851845c05e6d2870bf9361bd0335fad3b17e2
MATLAB
1,864
52
function S = zef_hdiv_stencil(tetrahedra,sub_ind,varargin) K = length(sub_ind); K2 = size(tetrahedra,1); if not(isempty(varargin)) value_vec = varargin{1}; else value_vec = ones(K2,1); end %An auxiliary matrix for picking up the correct nodes from tetrahedra ind_m = [ 2 3 4 ; 3 4 1 ; 4 1 2 ; 1 2...
731fccd6978aa3a83ef2512e497be6aa1cd73e172002e36c418f0e5d8cd8ed04
MATLAB
1,866
58
%% initialize clear; clc; currentPath = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives pathDeriv = pwd; cd(pathDeriv); cd('spm-preproc'); % For saving preprocessed file from SPM pathPrepFile = pwd; prepSubjFolders = dir('sub*'); cd(pathDeriv); cd('behavior'); pathBehav = pwd; load('be...
873c984c2bb20e1ee7bd97ae01bf49b0c0e01a666cb2a7c489a2895364077e83
MATLAB
1,867
67
%function [] = AnalyzeNerveMseq(date) clear all addpath('../../Neuron Analysis Functions') addpath('StimFuncs') data_date = '10.12.18'; load(['AN_' data_date '.mat']); %loads 'data' if strcmp(data_date,'10.01.18') data{35} = []; %garbage tuning curve, getting rid of on front end for now data{37} = []; %also ...
a453505a3fa6ec61485d2d157cbf2e1b5360514f69548afce1ed365ef4aec35b
MATLAB
1,867
44
function estimate_parameters_implementation_specific_call(app) %sort models so the faster ones are first [app.models] = sort_models(app.models); app.params.stage=3; %parameter estimation in progress update_log(app, 'Beginning Parameter Estimation'); % match to the appropriate function switch app.params.implementatio...
c4b598b945c8ea070898cc941ebe173701b0b84d52b04e2c8e6060c04979fef3
MATLAB
1,867
79
load data/ary_model/ary_model.mat; %% 1 load zeffiro_projects/pallomalli_pem.mat; [mag_v_1, rdm_v_1, La, Lfem] = mag_rdm_fn(ary_model, zef_data); s_p_1 = zef_data.source_positions; % %% 2 % % load zeffiro_projects/pallomalli_pem.mat; % % [mag_v_2, rdm_v_2, La, Lfem] = mag_rdm_fn(ary_model, zef_data); % s_p_2 = zef_...
d641b8315949781d605e028b29c1a0da65805b7c903ab02c916a41b0a7394671
MATLAB
1,868
57
%% initialize clear; clc; currentPath = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives pathDeriv = pwd; cd(pathDeriv); cd('spm-preproc'); % For saving preprocessed file from SPM pathPrepFile = pwd; prepSubjFolders = dir('sub*'); cd(pathDeriv); cd('behavior'); pathBehav = pwd; load('be...
48383305c225a1dd419c338ea11d975cc10cc8a1810f181b8666fb5271968f22
MATLAB
1,870
57
%% initialize clear; clc; currentPath = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives pathDeriv = pwd; cd(pathDeriv); cd('spm-preproc'); % For saving preprocessed file from SPM pathPrepFile = pwd; prepSubjFolders = dir('sub*'); cd(pathDeriv); cd('behavior'); pathBehav = pwd; load('be...
1513128af5078bf2654e95be85f5f8f644e26f5977dfe0e28d5c0c49679b7973
MATLAB
1,871
57
%% initialize clear; clc; currentPath = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives pathDeriv = pwd; cd(pathDeriv); cd('spm-preproc'); % For saving preprocessed file from SPM pathPrepFile = pwd; prepSubjFolders = dir('sub*'); cd(pathDeriv); cd('behavior'); pathBehav = pwd; load('be...
cda385b5db526d6ceaa692efd09a407cafa514327a2a94d8ade8e9185c4558d5
MATLAB
1,875
52
function varZ = get2DGauss(vecParams,matGridXY) %% get2DGauss build 2D Gaussian based on X and Y coordinates % Syntax: varZ = get2DGauss(vecParams,matGridXY) % Rotation matrix is given by Mrot = [cos(phi) -sin(phi); sin(phi) cos(phi)] % % Inputs: % vecParams = [z-const, Amp, x0, wx, y0, wy, phi] % (phi is optional fo...
cfc19b49fc6c93af8ddd2c0a53fb27f08ebcb2836f0e46826b0c48862ad53de5
MATLAB
1,875
57
%% initialize clear; clc; currentPath = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives pathDeriv = pwd; cd(pathDeriv); cd('spm-preproc'); % For saving preprocessed file from SPM pathPrepFile = pwd; prepSubjFolders = dir('sub*'); cd(pathDeriv); cd('behavior'); pathBehav = pwd; load('be...
41444df947481d11377d5cb44a2933866131bf84129ff0e6a02f135f384609f5
MATLAB
1,877
57
%% initialize clear; clc; currentPath = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives pathDeriv = pwd; cd(pathDeriv); cd('spm-preproc'); % For saving preprocessed file from SPM pathPrepFile = pwd; prepSubjFolders = dir('sub*'); cd(pathDeriv); cd('behavior'); pathBehav = pwd; load('be...
db264c0f4c3c0b8f70fb2764995ec33b64be0381ea5b01930241052d4151b865
MATLAB
1,877
65
function [] = func_plot_movie(start_step, movie_step, time_all, q1, q2, properties, line_prop) l1=properties(3); l2=properties(4); value_x_test=l1*cos(q1)+l2*cos(q1+q2); value_y_test=l1*sin(q1)+l2*sin(q1+q2); value_x1=l1*cos(q1); value_y1=l1*sin(q1); if strcmp(line_prop, 'solid') == 1 line_property ...
f08727acb0a6cf1a25628b56ce9f0b7e194582b0eefa83755139755985463245
MATLAB
1,878
57
%% initialize clear; clc; currentPath = pwd; cd ../temp load('tempFileForAnalysis.mat'); cd(pathBIDS); cd derivatives pathDeriv = pwd; cd(pathDeriv); cd('spm-preproc'); % For saving preprocessed file from SPM pathPrepFile = pwd; prepSubjFolders = dir('sub*'); cd(pathDeriv); cd('behavior'); pathBehav = pwd; load('be...
a8e054dc3c0253e83ab89c8bbf3b3eb99dd18f35a2a8737e480de2b086669867
MATLAB
1,879
61
function [z_inverse] = EnKF(m, A, P, Q, L, R, timeSteps, number_of_frames, n_ensembles, q_given) %ENKF Summary of this function goes here %x_ensemble = mvnrnd(zeros(size(m)), 100* ones(size(m,1)), n_ensembles)'; x_ensemble = mvnrnd(zeros(size(m)), P, n_ensembles)'; z_inverse = cell(0); if not(q_given) q_values = Q;...
f14cef82c651ae290f998c491d9449f729d2d59be31b42a1524f6446a7489ba1
MATLAB
1,880
76
% zef_pbo_system % % A function for generating a matrix of interpolation coefficients via % position-based optimization or PBO. % % Input: % % - arg_locs % % An N × 3 dipole location matrix needed in interpolation. % % - arg_dirs % % An N × 3 dipole direction matrix needed in interpolation. % % - arg_interp_locs % ...
f26a4f6f2385b961f1dd3dad615c93061653138913c9e8ae77d62cda419793da
MATLAB
1,880
57
function encmodel = standard_encoding(X,Y,T,options,binsize) % Compute maps representing the "encoding" model for each % time point (or window, see below) in the trial (i.e. a GML). % The reported statistic is the explained variance from % regressing Y on the data at this sensor/voxel. % % INPUT % X: Brain data, (time...
00989133be93909ea77dbd8ba6a5d5bb2b94d93d430a46e1d0c7e0d89e535c66
MATLAB
1,882
67
function save_firing_rates(params) zzz = 1; xx = load(fullfile(params.outdirname, [params.N1spiketimes_fn{zzz}, '.mat'])); st_and_nn1_full = xx.mat; xx = load(fullfile(params.outdirname, [params.N2spiketimes_fn{zzz}, '.mat'])); st_and_nn2_full = xx.mat; st = 0; ed = params.durtn; binSz = 2; % 1 ms [N1_totfr, N1...
c2c3f4ee682310c82f31790b4b918cf5328349c30c72597ab9ac59362d64cfd4
MATLAB
1,883
50
function hmm_out = logisticMarginaliseHMM(hmm_in,iY) % This function takes a multiple logistic strcuture HMM and returns the % equivalent HMM with only the marginalised component iY of the % logisticYdim components. Xfulldim = hmm_in.train.ndim; Xdim = Xfulldim - hmm_in.train.logisticYdim; Xfulldim_new=Xdim+1; select_...
cb960e9d9e80db611cd716d49b648de4e5e0435af82390ffad48feece7609900
MATLAB
1,885
44
function [temporal_FC] = concatenate_voxel_based_temporal_functional_connectivity(subject,part) % The goal of this script it to concatenate the information from the % temporally-contiguous functional connectivity matrices into one 3d matrix % corresponding to each part (parts defined as in the case of the static % vo...
94f084e1732c2032c1783f096c4acd5177b5614521e330d4257243c06085a35c
MATLAB
1,886
86
function [Points, Tri, Normals, Scalars, LUT] = VTKPolyLineReader(filename) % Usage: % [Points, Tri, Normals. Scalars, LUT] = VTKPolyDataReader(filename) % Copyright modified by Jean Dumoncel fid = fopen(filename, 'r'); if(fid==-1) error('Error: file descriptor not valid, check the file name.\n'); return; end...
99ddafa258d0dfc4056c2f70a5da6db38fde9740c5c8017d6ac6d56c8ff790d4
MATLAB
1,893
50
%-------------------------------------------------------------------------------- % mdp_vfe.m % % This demo is included in % Canonical neural networks perform active inference % Takuya Isomura, Hideaki Shimazaki, Karl J. Friston % % The MATLAB scripts are available at % https://github.com/takuyaisomura/reverse_enginee...
fd2a1668ac2e73e5c0a8273a8f182b9bedaf298cf10f9f344edf268bbdbb7cd8
MATLAB
1,893
71
function [post_info, spike_info] = evaluate_post_prob( ... data, Model, parm, post_sw) % evaluate_performance % % [post_info, spike_info, ypred] = evaluate_performance(data, Model, parm) % % post_info.Pspike(ns,n) = P(ns | yk) of n-th overlap window % post_info.twin{n} = time index of n-th overlap window % ...
b6ccff874ec82433be0a1b27c3feb72a5f4d28238a7c98afcb81e6aeaad2e812
MATLAB
1,898
53
function ETP_redraw() %get globals global sETP; global sFigETP; %% redraw image, boxes & detection %redraw image cla(sFigETP.ptrAxesMainVid); sFigETP.ptrCurFrame=imshow(sFigETP.matMain,'Parent', sFigETP.ptrAxesMainVid); hold(sFigETP.ptrAxesMainVid,'on'); %redraw boxes vecRectSyncPix = [sETP.vecRectSync(...
057656d447480d75e85c654cbb0dee19356b18f28d754291478f1560b0d9b04d
MATLAB
1,900
55
function [tpeak, gpeak, tdecay] = ... spike_func_peak(tau, decayRate) % peak of double exponential spike function % [tpeak, gpeak, tdecay] = spike_func_peak(tau,decayRate) % % --- time constant of spike response % tau = [Ą1; Ą2] or [Ą1; Ą2; Ą3] (T2 < T3) % g : (Nconf x Nt) or (Nconf x Nt...
66969c30e5011f47d5815ba858ff917243fe46ede9033a8af8c0cc93efdb84a7
MATLAB
1,900
71
function [W,covm,pred,residuals,fracerr] = mlmar (X,T,Sind,maxorder,order,orderoffset,timelag,exptimelag,zeromean,W,Gamma) % % Estimates maximum-likelihood (ML) MAR model % % INPUT % X observations % T length of series % order,orderoffset,timelag,exptimelag,zeromean - check documentation % W ...
98d97fae1cbc7557ac2c7b56bfea7299594d394f3171bf95d22479098256ede8
MATLAB
1,901
59
function sET = ET_populateStructure(sET) %ET_populateStructure Prepares EyeTracker parameters by loading ini file, % or creates one with default values %check for ini file strPath = ET_getIniPath(); strIni = strcat(strPath,filesep,'config.ini'); %get defaults sDET = ET_defaultValues(); %load ini if ...
f91dde99701970c8d93e1bdd5368554c4e8511c6926ee13af7ee04247b58da75
MATLAB
1,901
75
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [scale_param, snr_vec] = zef_find_gaussian_prior(snr_val, varargin) L = []; source_space_size = 1; normalize_data = 'maximum'; balance_snr = 1; w_param = 0.5; balance_param = 0; if length(v...
289737f6a16354f44f7719d1a1285517cc20a521ec653dc6ac42987f3e015715
MATLAB
1,902
57
function skew_correct_one(TiffFolder, SaveFolder, RunName, InfoFile) %Open a dataset with volume Avg TifName=strcat(TiffFolder,'/', RunName); %On ouvre les fichiers .tiff Infos=imfinfo(TifName); NLines=Infos.Height; NCol=Infos.Width; NPlanes=size(Infos,1); ...
939cce8558c6c0a2bbbf9ccdbef85fd10029d6878512214a01bb68a7979c4c57
MATLAB
1,902
79
%-------------------------------------------------------------------------------- % figure_output.m % % This demo is included in % Canonical neural networks perform active inference % Takuya Isomura, Hideaki Shimazaki, Karl J. Friston % % The MATLAB scripts are available at % https://github.com/takuyaisomura/reverse_e...
45bcb704256d334692cf9de4dfea25e3520d7c7aaab5f1487432e3339b95c0cc
MATLAB
1,903
57
function gradients = zef_volume_gradient(nodes, tetrahedra, node_index) % Calculates all of the ∇𝑉 of tetrahedra in the generated finite element mesh % as a triple product a ⋅ (b × c). See https://math.stackexchange.com/q/797845 % for the general idea. % % input: % % - nodes: a matrix that contains the 3D coordinates ...