sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ca8601b1a4c2fc1592d1f378e0a8b99fd11eda288678f26be4c6904293ab725e
MATLAB
1,510
64
function [dat_rs]=sw_dsample_lfp(dat,reFs) % resample_eeg changes the the sampling rate of a csc trace and generates % new timestamps % Example [re_csc,re_cts,reFs2]=sw_dsample_lfp(dat,reFs) % inputs: csc = csc samples vector as loaded with load_eeg % cts = originals timestamps vector % cFs = ori...
e4269adac4642d99696091c271611fd3ee4ab5691d25d259e3c5dab60ca28a60
MATLAB
1,512
51
function [data] = zef_dataBank_getData(zef, type) data=[]; data.type=type; switch type case 'data' data.measurements=zef.measurements; case 'noisedata' data.noisedata=zef.noise_data; case 'reconstruction' if iscell(zef.reconstruction) data.reconstruction=zef.reconstr...
2aca36d5e308a9ce263e218a30854a82d4ba171c5550d45fc412e578d2da5674
MATLAB
1,515
24
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef_data = zef_relax; zef.fieldnames = fieldnames(zef_data); for zef_i = 1:length(zef.fieldnames) zef.(zef.fieldnames{zef_i}) = zef_data.(zef.fieldnames{zef_i}); end clear zef_data; set(zef.h_rel...
dbb10e64f3c5b64f4a6c5c5189d841406b1316651a449677f1e3b866baf88ebd
MATLAB
1,516
51
function [z] = zef_postProcessInverseClassObj(z_inverse, procFile) %zef_postProcessInverse reorders the inverse output z_inverse to fit the %visibility options. The procFile is given by zef_processLeadfield source_direction_mode=procFile.source_direction_mode; source_directions=procFile.source_directions; s_ind_1=trans...
66f886e340b44893b27a35c4052dff368305496ad4666b43af9c52bf7228fb5c
MATLAB
1,518
43
% Add options function old_options = add_options(old_options,new_options,overwrite) % Check whether to overwrite if nargin < 3 overwrite = false ; end validateattributes(overwrite,{'logical'},{'scalar'}) % new options can be in one of three formats if isstruct(new_options) ...
7068e42d60dc1046c4df444fc88df956c395dc46e16bf69352c0f16c1f5ec158
MATLAB
1,519
41
%Copyright © 2018, Sampsa Pursiainen function [inv_roi_sphere,h_roi_sphere] = zef_plot_gravity_roi h_inv_roi_sphere_1 = evalin('base','zef.h_inv_roi_sphere_1'); h_inv_roi_sphere_2 = evalin('base','zef.h_inv_roi_sphere_2'); h_inv_roi_sphere_3 = evalin('base','zef.h_inv_roi_sphere_3'); h_inv_roi_sphere_4 = evalin('base',...
6c427749669c8b24530a41c14c6539c895bb98645b150edb49893e6473ee375c
MATLAB
1,523
59
function [vertices, faces, surface_data, surface] = zef_bst_2_zef_surface(varargin) surface_data = struct; surface_ind_aux = []; vertices = []; faces = []; surface = []; subject = []; surface_properties = []; scaling_constant = 1000; if not(isempty(varargin)) subject = varargin{1}; if length(varargin)>1 ...
019e2df88bab10dbbab3065844a77dcfd234d7db0d783ea668ffe5ea9bfe2ac8
MATLAB
1,524
46
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef_make_butterfly_plot(zef,h_axes_image) if nargin < 2 if evalin('caller','exist(''h_axes_image'',''var'')') h_axes_image = evalin('caller','h_axes_image'); else h_ax...
4693a903b4e7b68c68d25190571c34b1782bcd3472e9cebf6faa24130214096a
MATLAB
1,526
30
function DataOut = arrayResize(DataIn,bin) % Function to downsample an image stack based on averaging through a symmetric box filter. % Usage: DataOut = arrayResize(DataIn,bin) % DataIn = x*y matrix to be downsampled. Additional dimensions won't be affected. % bin = size of the box filter. Downsampled image will consis...
825906676557b590b1c3e98e75da1f221a368821990c8218c4005f950bc40592
MATLAB
1,526
54
% params = GetParams( myobj ) % % Get the most recently used run parameters. % These are a struct of name/value pairs. % function ret = GetParams( s ) ret = struct(); res = DoGetResultsCmd( s, 'GETPARAMS' ); % res is a cell array, each cell containing a string of form % '<parameter name> =...
f017806476e975c1529fd073d48f67ee4d8edd25e7a0e43f0c4695a07483a954
MATLAB
1,530
45
function [cv_acc_perm,acc_perm,genplot_perm] = standard_decoding_permutations(X,Y,T,options,binsize,nperms) % This function computes a null distribution for decoding by randomly % permuting the labels nperms times. This code is designed to be run % immediately following a call to standard_decoding, such that the data a...
47664c3b3518b0bcbefd193a619d1f556b7895f0bbb31ee7fa90fdfbd2ac2c83
MATLAB
1,536
65
function M = constantfactory(A) % Returns a manifold struct representing the singleton. % % function M = constantfactory(A) % % Given an array A, returns M: a structure describing the singleton {A} as % a zero-dimensional manifold suitable for Manopt. The only point on M is % the array A, and the only tangent vector at...
87cee99c85d9be7f26524c916cf690d60fbc00000604128fb383a3abcafaf2c3
MATLAB
1,536
43
function [list] = zef_insideGMM(GMM, points, numberOfModels) %evaluates whether the points (p*3) are inside the elipsoid(s) of the GMM. If %there are N elipsoids, numberOfModels (1-N) decides how many of those are %evaluated. The Evaluation will be sorted according to the maximum power %inside? %the return value is a l...
dbdcf8c79caa4edb1068ad5c89f6331d0779af56ee860157b832bd40a4404680
MATLAB
1,536
53
function [I, distance_vec, label_vec] = zef_solid_angle_labeling(zef, tetra, nodes, h) if nargin < 4 h = zef_waitbar(0,'Mesh labeling.') close_waitbar = true; else close_waitbar = false; end I = zeros(size(nodes,1), 1); distance_vec = zeros(size(nodes,1), 1); I_2 = [1 : length(I)]'; compartment_counter =...
903096cb05e1a7abb02d30cdb5bed40d762426f7c83fa1e22bae2cef1d9c4d2a
MATLAB
1,539
58
function Gamma = initGamma_random(T,K,D,Pstructure,Pistructure) % Return a Gamma timecourse corresponding to random transitions with a given % dirichletdiag (i.e. the transition probability prior) % % Author: Romesh Abeysuriya, University of Oxford (2017) rng('default') rng('shuffle') % make this "truly" random % For...
4a9ebfb44d258f108a0ee24d4146f88b35a3d960709b35fed4dcc7205d754ec4
MATLAB
1,546
56
TiffFolder='/network/lustre/iss01/wyart/rawdata/mathilde.lapoix/SCAPE/tiff_stacks/220210/F2_run5subset_for_volumeavg/'; SaveFolder='/network/lustre/iss01/wyart/analyses/mathilde.lapoix/SCAPE/Illustrations/Volume_Avg/'; cd(TiffFolder) %Find all tif files in the initial directory. list=dir('*/pla*.tiff'); NPlanes=...
676f64bb18258adc37c9dcfcf41c2e9f2ab3c1ed786793d8b5071b96355523e3
MATLAB
1,546
68
function zef_nse_plot_histogram(zef, plot_vec, x_label, legend_text) if nargin < 4 legend_text = cell(0); end p = [0.8 0.5]; p_legend = {'IDR','IQR'}; alpha = 0.5; legend_cell = cell(0); h_axes = zef.h_axes1; axes(h_axes); hold off; c_map = lines(size(plot_vec,2)); c_map = c_map + 0.1; c_map = c_map/max(c_m...
8a64f7dedc0ba3e141a8e6c555e7371718d391e9cc4b61dc985ebd626e2feb2d
MATLAB
1,549
44
addpath('scripts'); % Examples tuned to save the simulations in the AI, Iso, BS, and SZ regimes % AI regime_type = 'AI'; % select either AI/Iso/BS/SZ durtn = 1; % provide the duration of the simulation outdirpath = './output_dir'; % provide the output directory to save the simulation output; tic; % for getting ru...
9551da93c0b3efe18a113d67ba467aad0855e93f878c05e6d26860f74b15d47c
MATLAB
1,552
52
function realign_all_niftis_unused(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/MRI_nii' suffix filesep]; MRI_folder_new = [outputfolder '/ADNI_MRI_nii_recenter' suffi...
37c148eaa527ab5fb46e3fc55229f1343924abdac4b3cdc7cd3da225e6a2d084
MATLAB
1,553
33
function [vecProjectedLocation,matProjectedPoints,vecProjLocDimNorm] = getProjOnLine(matPoints,vecRef) %getProjOnLine Summary of this function goes here % [vecProjectedLocation,matProjectedPoints,vecProjLocDimNorm] = getProjOnLine(matPoints,vecRef) % %vecProjectedLocation: norm of projected points along reference...
b9425b2d6ad80273af32ebdd8fe6ce02500e9e4431760f2b462ab955dbff60dc
MATLAB
1,553
42
if not(isfield(zef,'strip_struct')) zef.strip_struct = struct; end if not(isfield(zef.strip_struct,'center_point')) zef.strip_struct.center_point = [0 0 0;0 0 0]; end if not(isfield(zef.strip_struct,'dir_vec')) zef.strip_struct.dir_vec = [0 0 1; 0 0 1]; end if not(isfield(zef.strip_struct,'strip_type')) zef.strip_...
43d1395db548e868d35e03a0825cb55617dbdd24c86323cec1b3f2b228610ad1
MATLAB
1,556
53
function [f,t] = zef_getTimeStep(f_data, f_ind, zef) %zef_getTimeStep gets the time windows and segments of f_data that are %specified in the zef.inv_time* parameters. f_ind gives the number of the given window (first, second, third ...) % if there is only one time step, f_data is returned. %Should the specified time s...
d8c394656072e9c43e1c533243e07f4e23d338c5687d3cdeebeab59f818b7950
MATLAB
1,556
39
%-------------------------------------------------------------------------------- % behavior_analysis.m % % Copyright (C) 2024 Takuya Isomura % (RIKEN Center for Brain Science) % % 2024-10-28 %-------------------------------------------------------------------------------- function bhv = behavior_analysis(data,Ttrial...
6ac789dbaccac512e41192fc8211d34f5797b4e407d2d1ec8d37e000d1bd227c
MATLAB
1,558
41
function [log_likelihood_ratio] = calculate_log_likelihood_neuronal_blockwise(params, best_model, blocks) %% set up num_original_nodes = params.num_neurons; num_udf_nodes = params.num_udf; num_nodes = num_original_nodes + num_udf_nodes; x_train = params.x_train; x_test = params.x_test; x_valid = params.x_valid; datase...
77484d7596f498353973fe9ed1cd3c48abe9693c11b27ddbc17087c60b4a0d1a
MATLAB
1,564
49
function S = openETSui2() % open dataset %ets = '/Users/defazio/Documents/ciatah/TDciatah/data/_20220210a_04_/stack1/frame_t_0.ets'; %name = '20220210_a_m0_kiss.h5'; [file,path] = uigetfile('*.ets'); if isequal(file,0) disp('User selected Cancel'); return; else disp(['U...
1396ac8ba310a68a5ac295524b99dcd7251d2fcdafba498c3ec617527c384e9b
MATLAB
1,567
49
function obj = preprocess_ampenv(obj,varargin) % Calculate amplitude envelope of data % check inputs options = microstate.functions.make_options(varargin) ; % default options defaults = {'bpfilter',[] ; 'resample',[]} ; options = microstate.functions.add_options(opt...
7db8707d170b05f11b9c42f0c99243ca03675f8f58ee034b56a5942353af96cf
MATLAB
1,570
57
function [w,ITDt,dur_real] = MakeMSeqMovingNoiseStim(dur,Fsample,RandSeed,mseq_ITDstart,mseq_ITDend,Rho,Seq_Step_Duration,N,ContraChan) %Generate an MLS 2^N-1 long mseq = mls_mark(N,0,RandSeed); %The number of samples for each ITD token SegSamps = round(Seq_Step_Duration*1e-3*Fsample); ChunkSamps = SegSamps*...
c2c828c4fe54e050df1841fe40fb85269c4c54147b490396ec8e971e00d077a9
MATLAB
1,575
66
function s = num2str(x,varargin) %NUM2STR Convert numeric to char, unless input is already char!, can return a cell array %--- % function s = num2str(x[,'cell'][,'quotestrings'][,'format']) %--- % convert numerical value x into a string representation... unless s is % already a character array! % % use the 'cell' flag...
b3df3d95236f03512f3409eefde48ee4a8fcb60e5c0ef4b9cdae575eb3aae89b
MATLAB
1,578
42
function generate_components(app) % Generate the following array of components components = { @generate_roi_preview,... @generate_data_preview,... @generate_max_degree_structural_learning,... @generate_mean_degree_structural_learning,... @generate_median_degree_structural_learning,... @generate...
fee12cc5776d69769daf83350a6455fb5f326025a11b231a487ac3405674c224
MATLAB
1,578
46
function data = standardisedata(data,T,standardise,valid_dims) N = length(T); if standardise for i = 1:N t = (1:T(i)) + sum(T(1:i-1)); if isstruct(data) data.X(t,:) = bsxfun(@minus,data.X(t,:),mean(data.X(t,:))); sdx = std(data.X(t,:)); if any(sdx==0) ...
a7af2fbf27d187a10588450eb8f82364146f14e5df92f74a6cb09b979aa34429
MATLAB
1,579
38
zef.reconstruction = cell(0); z_max_points = zeros(length(z_inverse_results),3); z_cluster_centres = zeros(length(z_inverse_results),3); z_max_deviations = zeros(length(z_inverse_results),1); z_mean_deviations = zeros(length(z_inverse_results),1); for k = 1 : length(z_inverse_results) z_max_points(k,:) = example...
f15b7df0693f5d3bdaaae958fb93158c33fb54bd930a1779048a17d2dd76569b
MATLAB
1,581
37
function kl = symm_kl_div(m1,m2,Sind,covtype) % symmetric kullback leibler divergence between MVN m1.W and m2.W fullcovtype = strcmp(covtype,'full') || strcmp(covtype,'uniquefull'); if isfield(m1,'W') && ~isempty(m1.W.Mu_W) [nprec,ndim] = size(m1.W.Mu_W); kl = 0; for n=1:ndim if fullcovtype || ndi...
17e32eb3c3fea182339bc60edd4f461204dcb06251726a7ad7b91c7b79302de2
MATLAB
1,583
46
function [matMean,matStd,cellVals] = getMatrixBlockMeans(matIn,vecIdentities) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here %create selection vectors vecIDTypes = unique(double(vecIdentities)); intNumIDs = length(vecIDTypes); vecFirstVal = ones(1,length(vecIDTypes)); vecLastV...
d7439a7c4c0f81448ba81efcb19d6d8ac23ce4ffc06a5b99a44fc031e3c66202
MATLAB
1,587
45
function [M, multigrid_perm_output] = zef_block_diagonal_preconditioner_uniform_prior(L, multigrid_dec, multigrid_perm) multigrid_perm_output = cell(0); n_sources_aux = length(multigrid_perm{1}); n_system_aux = length(multigrid_perm{2}); n_system = 3*n_system_aux; M = sparse(n_system, n_system, 0); snr_val = evalin...
bf67de1cbeaf5ace7a5d17470b0ac6db5c82a8447fa39b526222deae79b7865d
MATLAB
1,590
99
clear all close all clc %% change the frequency of infty symbol addpath('./tools/') time_today = datestr(now, 'mmddyyyy'); % traj_frequency_set = round(exp(linspace(log(1), log(500), 10))); traj_frequency_set = round(linspace(1, 400, 20)); iteration = 50; val_length_all = 300000; disturbance = 0.00; measurement_n...
7b75b9c36a2270ffaa20b8e74a10d11dae26538e70e7fff09ceb1193eaf6d22f
MATLAB
1,591
41
function ROIstats = processDFoF0(ROIstats, t1, t2, t4 ) %, minminBF) % based on processROIs2! % note all functions within are using frames not time! % t1 = 50; % t2 = inf; % t4 = 2000; % dt is time step "interval" %n = size( ROIstats, 2 ); % number of ROIs nROIs = ROIstats.nROIs; % ROIsta...
1218401f67da079d1f8a4e627d64edbe53a0816622c8747e3245d7a97f0cfd28
MATLAB
1,593
42
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [inv_roi_sphere,h_roi_sphere] = zef_plot_roi h_inv_roi_sphere_1 = evalin('base','zef.h_inv_roi_sphere_1'); h_inv_roi_sphere_2 = evalin('base','zef.h_inv_roi_sphere_2'); h_inv_roi_sphere_3 = ev...
09caf62703633f48d468b5ea633ad7964ad1a305a5cf6030e4bf51c6da2c614d
MATLAB
1,597
45
%training_data_file_name = 'training_dataset_p1_10dB.mat'; %credibility_data_file_name = 'credibility_dataset_p1_10dB.mat'; examples.studies.decision_making.zef_parameters_focal_epilepsy load(training_data_file_name); if not(exist('zef','var')) zef = zeffiro_interface('start_mode','nodisplay','open_project',proje...
db6c903a37a6e48ff6a078a616c5dae8059c9494ea12fdebc189538a0b88d748
MATLAB
1,603
28
function zef_set_sliders_plot(mode) if mode == 1 evalin('base','zef.h_axes1.Colormap = zef_colormap(zef.h_update_colormap.Value);'); evalin('base','zef_update_colorscale;'); evalin('base','zef_update_ambience;'); evalin('base','zef_update_diffusion;'); evalin('base','zef_update_specular;'); ev...
a4b1cb999ee28385f736e35f8698d983011bbc9d4dcf4d7f0a27d061ba14a6b8
MATLAB
1,604
63
function [indexList,indexLow,indexHigh] = getOutliers(data,stdCutOff) %getOutliers Get indices of values outside specified bounds %syntax: [indexList,indexLow,indexHigh] = getOutliers(data[,stdCutOff]) % input: % - data: vector containing values % - stdCutOff: number of standard deviations from mean that is % co...
b0112fc252716641b3d7fd16556536bf4a8d28efdcea2558dc5ae5e01a211163
MATLAB
1,606
45
function hmm = updatePCAparam (hmm,Gammasum,XXGXX,Tfactor) K = length(hmm.state); ndim = hmm.train.ndim; if nargin<5, Tfactor = 1; end p = hmm.train.lowrank; for k = 1:K % unlike Bishop's mixture of PCA, we don't have a mean vector per state here v = hmm.Omega.Gam_rate / hmm.Omega.Gam_shape; W = hmm...
ccdaa21eaee2e8bb813075df7a7aeb967188dd48423d3aedd7a6398fe4ab07de
MATLAB
1,608
39
zef.h_compartment_table.Data = []; zef.compartment_tags = cell(0); zef.compartment_transform_name = cell(0); zef.compartment_structure_aux = cell(0); if not(zef.new_empty_project) zef.segmentation_profile_aux = readcell([zef.program_path '/profile/' zef.profile_name '/zeffiro_segmentation.ini'],'filetype','text...
f2125d5eae931e1fcde6f9fc865b9401cf2574a452f8aa4dfc78baf1fc58f444
MATLAB
1,608
40
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [nodes,tetrahedra,sigma,brain_ind,surface_triangles] = zef_import(void) if not(isempty(evalin('base','zef.save_file_path'))) & not(evalin('base','zef.save_file_path')==0) [file file_path]...
3074690e619c507d0e3948640c2f636a4bd4849871601af5fd073ff5b7907dd7
MATLAB
1,614
40
% RemoveSubplotWhiteArea: È¥³ýsubplotÖÜΧµÄ¿Õ°×²¿·Ö % RemoveSubplotWhiteArea(gca, sub_row, sub_col, current_row, current_col) % ÊäÈë % gca :axes¾ä±ú % sub_row :subplotµÄÐÐÊý % sub_col :subplotµÄÁÐÊý % current_row :µ±Ç°ÁÐÊý % current_col :µ±Ç°ÐÐÊý % % ×¢Òâ:ʹÓÃÈçÏÂÓï¾ä,print±£´æÍ¼Æ¬µÄʱºòʹÆä°´ÕÕÉèÖÃ...
f914b6d253eb086b41271318c330dc6182cc412005f7cebe3328bf437040ea7d
MATLAB
1,616
57
function FileNamesForSubjects = Fun_ReadSubjectsToFileNamesMapping(Path,... InputFileName) %% Written and updated by M. Nollet (Aug 2023) % Adapted from a script written by R. Winsky-Sommerer (DE_Jan2013) % % Read information in Input file listing for each subject (listed as a % number) the raw files % %...
87afe980241bbe1d4dd3d236db4fc5b214e21c415db387a3320fd63593067573
MATLAB
1,621
62
function h = slice3(vol, I2X, slicedim, sliceidx, handle) % Display a slice from a volume in 3-D % h = slice3(vol, I2X, slicedim, sliceidx, handle) % % Vol is either a scalar or RGB volume, e.g. N x M x K or N x M x K x 3. % I2X is a transformation matrix from volume coordinates to xyz 3-D world % coordinates, similar...
c7de04f6d76e3d941a53afc44c287c33c584595d7a6f2657bc5df3cbd9671cac
MATLAB
1,623
40
function features = extractFeaturesMultiChsWaveAMI( signalSet, Fs ) % % extractFeaturesMultiChs % % Calculate auto-mutual information (AMI). % % Author: Ian Daly, 2013 % % License: % % This program is free software; you can redistribute it and/or modify it under %...
1efd533572a7f57a9bf30e39800abb25370ba07b81ccde4cd1457406c1cdf8dd
MATLAB
1,625
37
function gd = zef_init_signal_general_data() %ZEF_INIT_SIGNAL_GENERAL_DATA Default global signal parameters (new naming). gd = struct(); %% -------------------------------------------------------------------- %% General signal parameters gd.samplingRate_Hz = nv('samplingRate_Hz', 1000); gd.gau...
9530ea0d99185a8abc5334c26a59a702781c6c0857e7bc328f989fe723e640de
MATLAB
1,625
54
function zef = zef_remove_object_handles(zef, node_name, h_list) skip_class_list = {'matlab.io.MatFile'}; if nargin < 2 node_name = 'zef'; end if isempty(node_name) node_name = 'zef'; end if nargin < 3 h_list = []; end fields = fieldnames(eval(node_name)); for i = 1 : length(fields) aux_string = [n...
f3280b9ad23f4bfebb6757284e4cd064e7385f87c99e5d51e907ecb5174d0fae
MATLAB
1,630
58
function [aux_compartment_ind, aux_brain_ind, property_compartment, property_brain] = zef_get_active_compartments(zef,varargin) property_name = cell(0); property_compartment = cell(0); property_brain = []; if not(isempty(varargin)) property_name = varargin{1}; end compartment_tags = eval('zef.compartment_tags');...
38ff497de46069954e16a91edb6e6853a25094881034c566d8fa5b2503800200
MATLAB
1,632
67
% Compare original admUI with admUI with acceleration; % Generate data for Fig. 4 in paper clear all; addpath(genpath('../')) % pregenerated 300 distributions load('../../data/dataPy.mat') ns = 2; nz = 2 ; ny = 2; % read only a part of the full set of distributions ndist=250; neps = linspace(1,12,12); eps = 10....
685a08dc482a3cbab9a1cde76ed9dca267bac5654f88fb3e409844f7dd55597b
MATLAB
1,634
44
classdef PoolingInd < dagnn.Filter properties method = 'max' poolSize = [2 2] opts = {'cuDNN'} kernel = parallel.gpu.CUDAKernel('kernel_pooling.ptx','kernel_pooling.cu','my_poolingIndices'); lastIndices = []; end methods function outputs = forward(self, inputs, params) % kernel set...
ee240a053ede7b2248ff917470afab386bd1558be08a1ddb23649de2b651b274
MATLAB
1,636
53
function [X, Y, Z, pml_ind] = zef_pml_mesh(inner_radius,outer_radius,lattice_size,max_size) growth_param = 1 + 1e-15; convergence_value = Inf; while convergence_value > 1e-5 extra_layers = round(log(((outer_radius-inner_radius)*(growth_param - 1))/(lattice_size*growth_param) + 1)/log(growth_param)); growth...
aaeb8cfd10cc62d25055042365a0a1dded1f1a32e3f28081b8f2a9224c93e417
MATLAB
1,641
46
% tuto3_sinus_generator_Process.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 25 May 2012 % function box_out = tuto3_sinus_generator_Process(box_in) channel_count = box_in.settings(1).value; samples_per_buffer = box_in.settings(2).value; amplitude = box_in.settings(3).v...
a15dfd2ea4d3c1c5f65a204136156a308432b2e5068d3e34b9f037911a498a6d
MATLAB
1,644
44
function [ data, feature ] = ha_time_test( data, classifier, model, parm ) % Descriptions for the ha_time_test % + Input % - data: test data % - data.t [1 x Nt]: sampling time vector % - data.y [1 x Nt]: observed Ca response % - classifier: the trained classifier % - model: the estimated Ca ...
d49fa384a08940834739e965740c545a9cb29faf7aa2e8636bcbd9239ce0f2b1
MATLAB
1,647
50
function twoPairs = localFWHdelta1D2( xprofile, yprofile, profile, r ) twoPairs = zeros(2,2); % each pair is based on FWHdelta, full width at half delta % where delta = max - min of image subregion % defined by win and location of click % img is a 2d image array; note smoothing in preprocessing % xx, yy is the locati...
0a47e6f7832f32e1f5fd5996059e31e92f1d7646091c4772b59c30b732c304e8
MATLAB
1,649
21
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.exp_multires_n_levels = str2num(get(zef.h_exp_em_multires_n_levels,'string')); zef.exp_multires_sparsity = str2num(get(zef.h_exp_em_multires_sparsity,'string')); zef.exp_multires_n_decompositions =...
ed28bda0a60d5a77b2d6ed65d1f4a5e43578b9dac33091dbe8b3e3bbc561fc4d
MATLAB
1,652
63
function [matW, dblMSE, intRank, sSuppOut] = doRidgeRRR(matX,matY,intRank,dblLambda) % Y = X*matW subject to Ridge regularisation %% initialize % Make sure matrices are the same length assert(size(matX,1)==size(matY,1), 'X and Y must have the same number of observations.') % Define prima facie constants. intR...
57457b9c13b2f0b1dee857437dd474035db2ddac863634a2b34211e985030dde
MATLAB
1,653
54
tic; if zef.source_direction_mode == 1 zef.lf_param.direction_mode = 'cartesian'; end if zef.source_direction_mode == 2 zef.lf_param.direction_mode = 'normal'; end if zef.source_direction_mode == 3 zef.lf_param.direction_mode = 'basis'; end if isfield(zef,'preconditioner') if zef.preconditioner == 1 ...
1671071932e3916e8976787002820af7e3388b3281c7ee6d9454594845b6dde4
MATLAB
1,654
82
function dti_tensor = zef_dti_tensor(data_dir, bvec_file, bval_file, scale_value) if nargin < 4 scale_value = 1; end bvec_file = fullfile(data_dir, bvec_file); bval_file = fullfile(data_dir, bval_file); bvals = dlmread(bval_file); bvals = bvals(:); bvecs = dlmread(bvec_file); if size(bvecs,1)==3 G = bvec...
3a0773008787da01beeb6bc04995bcfc74ef0f2cff899931c2611005dc3afceb
MATLAB
1,656
47
function sCat = catfields(sIn,cellFields,boolRemNans) %catfields Concatenates fields in structure % Syntax: sCat = catfields(sIn,cellFields,boolRemNans) %get fieldnames to run if nargin < 2 || isempty(cellFields) cellFields = fieldnames(sIn); end if nargin < 3 || isempty(boolRemNans) boolRemNans = true; ...
4c05cbe49b64a1c8da3153509b41e0504321a64c5d80795e5fb0274fce5b0f25
MATLAB
1,661
44
function [nbn] = makeNBNfft_binaural_V2(flow,fhigh,dur,fs,rho,ITD) %flow,fhigh, and fs in Hz %dur in secs %implement later maybe: adjust samples via pow2 to increase computational speed ... if flow <0 || fhigh > fs/2 error('flow || fhigh is not cool') end if abs(rho) ~=1 error('Currently rho can onl...
33540433fa1372f69365ff567200fb1d0407840305f684ae3c8aa5032157d099
MATLAB
1,664
57
function zef_strip_tool_plot(zef) strip_struct = zef.([zef.current_sensors '_strip_cell']){zef.strip_tool.current_strip}; [strip_struct] = zef_create_strip(strip_struct); points = zef_strip_coordinate_transform(strip_struct,'forward'); axes(zef.h_axes1) h_strip = findobj(zef.h_axes1.Children,'Tag','additional: strip...
b984e5e2399d4c001ab65d0f4bd15b8e6be0a8c5f3167bce2d86cbbac831b4a9
MATLAB
1,665
39
z_inverse_info = [z_inverse_info repmat({'Maximum point'},size(z_inverse_info,1),1); z_inverse_info repmat({'Cluster centre'},size(z_inverse_info,1),1) ]; z_inverse_results = [z_inverse_results z_inverse_results]; z_mean_deviations = [zeros(size(z_max_deviations)); z_mean_deviations]; z_max_deviations = [zeros(size(z_m...
29e2d05558ed73a28f5c843a4d45eefb0ae51afce795735a608eedaac98fbd53
MATLAB
1,668
67
function str = strcat(c,varargin) %STRCAT Concatenate strings and numbers into a single string, with optional separator sequence %--- % function str = strcat(c) % function str = strcat(c,sep) % function str = strcat(c,left,sep,right) %--- % Concatenate strings in cell array c, adding the separator sep between % each el...
40623180dfb630c5c2cf6144e9cc1d56dfaacb8201838f1dbe788a5c4eb65908
MATLAB
1,669
99
function M = zef_surface_scalar_matrix_Dn(nodes, tetra, g_i_ind, n_ind, scalar_field, weighting) % % zef_surface_scalar_matrix_Dn % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - g_i_ind % % TODO: explanation. % % - n_ind % % TODO: ex...
9cc4767c39192965e33c20006272ffcb2b1a2771d1c84a6400888b43da77a780
MATLAB
1,672
21
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.exp_multires_n_levels = str2num(get(zef.h_exp_ias_multires_n_levels,'string')); zef.exp_multires_sparsity = str2num(get(zef.h_exp_ias_multires_sparsity,'string')); zef.exp_multires_n_decompositions...
bd0c547b2e292567e11da3db07dc2515e053500c20f3ab06d278f20945f29f31
MATLAB
1,680
35
%reads the current data into the aux field and adds it to the bank zef.LeadFieldProcessingTool.auxData.source_interpolation_ind = zef.source_interpolation_ind; zef.LeadFieldProcessingTool.auxData.parcellation_interp_ind = zef.parcellation_interp_ind; zef.LeadFieldProcessingTool.auxData.source_positions = zef.source_po...
a9f9a088e30d15fe6bc585ecee980ccd0d26b9f53c4a7d0f1debf03c03d8d162
MATLAB
1,682
69
function [P_store, z_inverse] = double_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)); L_zero=zeros(size(L,1),size(L,2)); A=cell2mat({A,(1/number_of_frames)*A;zero_m,A})...
d3315e96a2efdbdde99ff353a512cfadb51c3bad3233a110ff17efcb7a30a71a
MATLAB
1,683
25
zef.h_create_dipolar_pair_table.Data = cell(0); zef.h_create_dipolar_pair_table.Data{1,1} = 'x coordinate'; zef.h_create_dipolar_pair_table.Data{2,1} = 'y coordinate'; zef.h_create_dipolar_pair_table.Data{3,1} = 'z coordinate'; zef.h_create_dipolar_pair_table.Data{1,2} = zef.create_dipolar_pair_x; zef.h_create_dipolar_...
bd016470e90cc13dd0aae10523bdfac21dc45dbc1b6a560d8cd63329e53c63f1
MATLAB
1,684
106
% clear all % close all % clc addpath('./tools/') %% load('./save_file/all_traj_06282022.mat') time_today = datestr(now, 'mmddyyyy'); plot_val_and_update = 0; blur.blur = 0; plot_movie = 0; traj_type = 'infty'; if exist('traj_type','var') == 0 traj_type = 'infty'; end traj_type = 'infty'; failure.type = 'a...
d2bb4d361a543597cc174adcd94fd7aeb0a6f5eeeb5876e3516046bf22899347
MATLAB
1,684
29
function update_decoding_text(app) v = app.StimulusEM.Value; dataset = app.ViewPerfButtonGroup.SelectedObject.Text; if strcmp(dataset, 'FULL') dataset = 'full_performance'; elseif strcmp(dataset, 'TEST') dataset = 'test_performance'; elseif strcmp(dataset, 'TRAIN') dataset = 'training_perform...
d29a27a6e318ae50691707be86f625e84efd75cb58ab9d3ffc7c13fa583f2374
MATLAB
1,685
27
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if ismac zef.h_exp_em_map_estimation_multires = open('exp_em_map_estimation_multires.fig'); elseif ispc zef.h_exp_em_map_estimation_multires = open('exp_em_map_estimation_multires.fig'); else ...
29d6e871963695d5621a285be3e109887fcb1f7ad69ee3da824e161b7f156edd
MATLAB
1,686
53
function vecFilledData = fillfromtrough(vecData) %fillfromtrough Fills valleys bidirectionally outward from lowest trough % vecFilledData = fillfromtrough(vecData) % %This function will return a u-curve shaped output with a unique %minimum and strictly non-decreasing values outward from the trough. In %essence,...
1f668bf92beaea69fbbbc176bd5cf21c30d4d12f3e3d2a370290ee4d30158bad
MATLAB
1,687
45
%Copyright © 2018- Joonas Lahtinen, Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [amp] = GMM2amplitude(dipoles,ind,frame,type) amp = ones(size(dipoles,1),1); L = evalin('base','zef.L'); f = zef_getFilteredData; f=zef_getTimeStep(f, frame); n_interp = leng...
452231ed03f7dde427fa8ebd3ea1ab92fbe2874d161179c8bc4540105c9b387a
MATLAB
1,689
47
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [iasroi_roi_sphere,h_roi_sphere] = zef_iasroi_plot_roi(zef) if nargin == 0 zef = eval('base','zef'); end h_iasroi_roi_sphere_1 = eval('zef.h_iasroi_roi_sphere_1'); h_iasroi_roi_sphere_2 ...
9c5b777de9550cbe6cd30a6551579551789bdb406713a1c2a4ad91d550820844
MATLAB
1,690
43
function [acc,acc_star,Ypred,Ypred_star,Gammapred,acc_Gamma,AUC,expLL] = tucacv(X,Y,T,options) % Wrapper function to perform temporally unconstrained classification % Analysis (TUCA). This function is now merely a wrapper function with core % functionality maintained in tudacv. if ~isfield(options,'classifier') opt...
cc8e17da1ea51ad3ee8508c11be6ee3dec3742315307220f8d4d6a804deb1606
MATLAB
1,690
36
function zef = zef_start_log(zef) if zef.use_log if not(exist([zef.program_path filesep 'data' filesep 'log'],'dir')) mkdir([zef.program_path filesep 'data' filesep 'log']); end zef.current_log_file = [zef.program_path filesep 'data' filesep 'log' filesep zef.zeffiro_log_file_name '_' num2str(leng...
6c8dd4d58c607e6746e460cfe8ee14af46346da25ccdd097d2e8cf7f022f796b
MATLAB
1,691
57
function ETP_ImportFrames(handles,dummy,boolInit) %get globals global sETP; global sFigETP; %get import # sETP.intImportPoints = str2double(sFigETP.ptrEditImportPoints.String); sETP.intImportStretch = str2double(sFigETP.ptrEditImportStretch.String); % message ptrMsg = dialog('Position',[600 400 250 50],'N...
c7bb4753469e51e613bbdf87c91742449e1f3b6729bcb7c1c83435d22917393f
MATLAB
1,694
39
function zef_sensors_table_selection(hObject,eventdata,handles) sensors_selected = eventdata.Indices(1); sensor_tags = evalin('base','zef.sensor_tags'); imaging_method_cell = evalin('base', ['zef.imaging_method_cell']); imaging_method_name = evalin('base', ['zef.' sensor_tags{sensors_selected} '_imaging_method_name'...
8d580d81dc3394df8238bc4333699b671a4427d554bec8e64761054f42735168
MATLAB
1,695
47
%-------------------------------------------------------------------------------- % param_norm.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_engi...
fd55cf5d7c8ed14065975e5f84dad38fee456bf876e06ea7e18f6800400d6d10
MATLAB
1,697
58
function obj = stats_gev(obj,addprocess) ; % Calculate GEV of microstates % check we have GFP, maps, and labels if isempty(obj.gfp) obj = obj.calculate_gfp ; end if isempty(obj.maps) error('Maps are required to calculate GEV') end if isempty(obj.label) obj = o...
c6dda3331dcaafc19b221156ac3e2b97d4d4c66b3f9390f35f328956dd2e80f8
MATLAB
1,700
42
%% Format the data into a microstate cohort % For a within-individual design, each participant and each condition is an % individual. Importantly for within-individual design, in the cohort you % MUST make sure to upload one of each condition for each participant *in % the same order for all conditions*, e.g. if th...
71f250548aab80937752150b7d8286c012d7063e45e17c106adfd97e45f9ccf8
MATLAB
1,701
65
function plotTube( mat3Resp ) %UNTITLED Summary of this function goes here % Detailed explanation goes here % %mat3Resp: [intNeuron x intType x intRep] mat3Mean = xmean(mat3Resp,3); vecW = xstd(mat3Resp,3)/2; vecX = mat3Mean(1,:); vecY = mat3Mean(2,:); vecZ = mat3Mean(3,:); %plot wide tube %clo...
c4ce55920fcc460bf02fd5b1f96c85160cfd07dfb981cf8e1bf8525eb97b5452
MATLAB
1,707
52
function [ind]=next_peak(csc_part,ind0,flag) % next_peak finds the closest local maximum or minimum to the end or % begining in a csc trace part switch flag case 'maxback' [~,k]=findpeaks( csc_part ); %max if ~isempty(k) ind=ind0-(length(csc_part)-max(k)); %closes...
c14d1ffa10b58eb0e2795c786f10abd8cd042d5b0a7c06cefb5e1194309e7298
MATLAB
1,712
50
function zef_store_cdata(varargin) data_status = 1; cdata_info.frame_start = evalin('base','zef.frame_start'); cdata_info.frame_stop = evalin('base','zef.frame_stop'); cdata_info.frame_step = evalin('base','zef.frame_step'); if not(isempty(varargin)) data_status = varargin{1}; if length(varargin)>1 cd...
64a2516df4a9f36956de8b7ef91e639f5d8fbc5844219c01ffc8988c81533b85
MATLAB
1,714
48
function [M, multigrid_perm_output] = zef_diagonal_preconditioner_uniform_prior(L, multigrid_dec, multigrid_perm) multigrid_perm_output = cell(0); n_sources_aux = length(multigrid_perm{1}); n_system_aux = length(multigrid_perm{2}); n_system = 3*n_system_aux; M = sparse(n_system, n_system, 0); snr_val = evalin('base...
70c3eb472b1306f34843b9a55844468bbdf23463d8fc55e3ca095c48f4556866
MATLAB
1,715
42
function hmm_out = logisticMergeHMM(hmm_marg,hmm_full,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_full.train.ndim; Xdim = Xfulldim - hmm_full.train.logisticYdim; Xfulldim_new=Xdim+1...
661789284f89328a8229885cda67a22895867555813384c3fee2325e803bbab8
MATLAB
1,716
45
function [processed_data] = zef_manual_epoching(f, epoch_points, start_time, end_time, sampling_frequency) %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 a...
819dd308cb9fcf94132c0aef48fc2d32199fd5f90b791495d9d0a578e20f7833
MATLAB
1,717
27
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if ismac zef.h_exp_ias_map_estimation_multires = open('exp_ias_map_estimation_multires.fig'); elseif ispc zef.h_exp_ias_map_estimation_multires = open('exp_ias_map_estimation_multires.fig'); e...
0762331d37470970063c6963b5b8968219d98d0a692ff69abcefe3e9ece08c8e
MATLAB
1,719
41
zef_ES_update_parameter_values; zef.ES_opt_solver = zef.h_ES_opt_solver.Value; zef.ES_opt_method = zef.h_ES_opt_method.Value; zef.ES_opt_algorithm = lower(zef.ES_opt_algorithm_list{zef.h_ES_opt_algorithm.Value}); zef.ES_obj_fun = zef.h_ES_obj_fun.Value; zef.ES_o...
7e6f50939c75d9095e63773bf1d1f838b4f84a8196ba4eacbe5a6e551ebe3ccc
MATLAB
1,719
54
function S = openETSui2() % open dataset %ets = '/Users/defazio/Documents/ciatah/TDciatah/data/_20220210a_04_/stack1/frame_t_0.ets'; %name = '20220210_a_m0_kiss.h5'; % fig = uifigure; % d = uiprogressdlg( fig, 'Title','reading ETS','Indeterminate', 'on'); % drawnow [file,path] = uigetfile('*.ets'); ...
3685f03a6408e9a75c373cdc8276c281237bc2915b12b7ac947c4c6912523524
MATLAB
1,721
57
function zef = zef_apply_system_settings(zef) if nargin == 0 zef = evalin('base','zef'); end zef.ini_cell = readcell([zef.program_path '/profile/zeffiro_interface.ini'],'FileType','text'); for zef_i = 1 : size(zef.ini_cell,1) if isequal(zef.ini_cell{zef_i,4},'number') if not(isnumeric(zef.ini_cell{z...
fa40b81e92b0fa1a5034f8a20d3f143861d93739d9210e39c19a9bf74faa2ecb
MATLAB
1,723
58
function zef = zef_plot_source_ROI(zef) %easiest way to get all information, but overkill if we just want to plot a %sphere [~,roi_source_pos,s_o,dip_amp,n_multiple_sources,roi_specs_all] = zef_find_source_ROI(zef); h_axes1 = zef.h_axes1; hold(h_axes1,'on'); axes(h_axes1) %using the same handle as regular so...
471cd41f93ceffbb751e745431ad2e4bd470ee8a4890cc897f9d0e8db7fcc6c4
MATLAB
1,725
77
function [p,Dxy] = paired_tanova(X,Y,modality,Nperm) % Check this is paired data if size(X,2) ~= size(Y,2) error('paired_tanova can only be used for paired data') end if nargin < 4 Nperm = 5000 ; end switch modality case 'eeg' X = X-mean(X) ; % re-reference to average Y = Y-mean(Y) ; ...
a003c165b92f4cbafb2bfd466891fd9e37c569f926f2d7784c9d714f8cb44841
MATLAB
1,726
62
function save_all(app, varargin) % matlab recommends not to do this because matlab thinks extensibility is % lame and hardcoding rulez - doing it anyway DAO 04/4/2023 update_log(app, 'Saving... Please Wait'); absolute_params = app.params; % hotfix for relative paths app.params = convert_paths_to_relative(app.param...
2e9e21bacd5bc902c2259d1bcb8576cee7b68e66a1828bd401ab913831b19579
MATLAB
1,727
47
function [vecMeanX,vecSemX,vecMeanY,vecSemY,vecQuantileAssignment,cellValsX,cellValsY]=getQuantiles(vecX,vecY,intQuantileNum) %getQuantiles Split X and Y data into equal quantiles of X % [vecMeanX,vecSemX,vecMeanY,vecSemY,vecQuantileAssignment,cellValsX,cellValsY]=getQuantiles(vecX,vecY,intQuantileNum) %default nu...
abad70490ddc9d3ac790f22da2982e60760417beb04f0fad449dc0b929eb2681
MATLAB
1,730
47
function [SamePics, SameStim, SameUnit] = FindSamePics(data) % this function will find data (pics) takn on the same fiber with the same % stimulus. sometimes one may run a certain stimuli on a fiber and then % stop, run a different stimuli and come back and run the other stimuli. To % analyze all that data together, th...
1e4433c73b42a98b97038ad2bc8686645259efb45eea5d7cc50df8fab478bbbf
MATLAB
1,734
49
if isfield(zef,'source_positions_original_field') if isempty(zef.source_positions_original_field) zef.source_positions_original_field = zef.source_positions; zef.source_directions_original_field = zef.source_directions; zef.L_original_field = zef.L; zef.source_interpolation_ind_ori...
d2f355f1d5d530a54819cc9eff429619f423e4791582b0b6bdbf593f987da5a9
MATLAB
1,735
51
function dblR = calcVectorOfAssociation(matData,vecY,vecZ) %calcVectorOfAssociation Measure of correlation for binned grid data % dblR = calcVectorOfAssociation(matData) if nargin == 1 && all(size(matData) > 2) %compute grid-based VoA %get center of mass vecCoM = calcCenterOfMass(matData); %calculate ve...