sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8d6f66f376e611f75f224da1c48e01ca484579494877f8d5dc3c676efc4eb247
MATLAB
6,044
161
function save_color_tables(in_dir, out_dir) arguments in_dir (1,1) string { mustBeFolder } out_dir (1,1) string { mustBeFolder } end in_dir = fullfile(in_dir); [vertices,label,colortable] = read_annotation(fullfile(in_dir, 'label', 'lh.aparc.a2009s.annot')); save(fullfile(out_...
fb0d6e8c8f8a5c95d128b0222bc71c9b7da3852957835b164ce6d64212f98c2b
MATLAB
6,050
140
%% 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...
cb00f25c6bb74a933f15c1a7ddb41088ad0e04631a5945f6c7404d1f1de0ca2f
MATLAB
6,059
186
function [matPeakDomain,indKeepPeaks] = mergepeaks(vecT,vecV,vecP) %mergepeaks Merge peaks based on prominence % [matPeakDomain,indKeepPeaks] = mergepeaks(vecT,vecV,vecP) % %Inputs: % - vecT: timestamp vector % - vecV: value vector % - vecP: peak locations % %Outputs: % - matPeakDomain: [P x 3] matrix, % ...
a69fc3a7839793a8bee4fafc28c4210a1ecb88a86702cd1d26632b81c2654c36
MATLAB
6,077
224
function [dist_vec, angle_vec, mag_vec, dispersion_vec] = zef_rec_diff( ... zef, ... inverse_method, ... noise_db, ... diff_type, ... dispersion_radius ... ) arguments zef (1,1) struct inverse_method (1,1) function_handle noise_db (1,1) double { mustBeNonpositive } = ...
48930de5fb7c3b5b10787bfcd80e92bdeda46298b448dbc6a1ce7e7cbe3b9da3
MATLAB
6,080
149
%% 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...
9cca7c9537137d4eecc6959da6d1073e6c7d88a02b68106c17a830fdff566620
MATLAB
6,084
180
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [z,reconstruction_information] = zef_ias_iteration(zef) inverse_gamma_ind = [1:4]; gamma_ind = [5:10]; h = zef_waitbar(0,1,['IAS MAP iteration.']); [s_ind_1] = unique(eval('zef.source_interpo...
4586bd94683432ef8ba964c8ffb7272712e2479a54a19619f5d4bddec96e31e5
MATLAB
6,089
113
function zef = zef_Abbott_infinity_strip_multiple_probe(zef) zef.strip_struct.dir_vec(1,:) = 1/norm(zef.strip_struct.dir_vec(1,:))*zef.strip_struct.dir_vec(1,:); zef.strip_struct.dir_vec(2,:) = 1/norm(zef.strip_struct.dir_vec(2,:))*zef.strip_struct.dir_vec(2,:); strip_struct.probe_num = zef.strip_struct.probe_num; st...
eca4f2b9554654b06bd07e74f0162d7805a3e99ef5f60f9d43e930418293610f
MATLAB
6,100
216
function zef_source_tree_cell_edited(~, tbl, event, whichTable) if nargin < 4 || isempty(whichTable) error('Provide whichTable = "SourceParameters" or "SignalParameters".'); end whichTable = lower(char(string(whichTable))); % === 0) Always work on the latest zef from base (prevents reverting t...
c8f9afbf8d58a2e98b78ad98c378b8cd4f2b318004c134a2ee1a6680d17b87ab
MATLAB
6,118
112
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_update_parcellation(zef) if nargin==0 zef = evalin('base','zef'); end set(zef.h_parcellation_name,'string',zef.parcellation_name); set(zef.h_parcellation_tolerance,'string',num...
21d6fecaacb9f4f8176726294609211743b13ee24abd7cc9d3ab3d03c3c3b5c8
MATLAB
6,141
138
function Smoco = td_moco2( Yraw, bound, grid_size, maxShift, binWidth, rigid, n_iter, shifts_method, saveY ) % modified from normCorr demo.m % | Parameter name | Description | % |----------------|-------------| % | ```d1,d2,d3``` | dimensions of field of view | % | ```grid_size``` | size of non-overlapping portion...
23ebc6c01279a40d5c3777e3749327163b7f3785b756dc2d817d1dd7bb5afa8a
MATLAB
6,164
148
function [domain_labels, distance_vec, label_vec] = zef_mesh_relabeling(zef, tetra, nodes, domain_labels, distance_vec, use_labeling_priority, h) if nargin < 5 priority_mode = zef.priority_mode; end if nargin < 6 h = zef_waitbar(0,'Mesh re-labeling.') close_waitbar = true; else close_waitbar = false; end I = ...
fe8e5ba68ede7fdca8baead10d19f14aabab9df2c9d468cf8331ef6388bf5e86
MATLAB
6,171
224
function [ignore,dat]=sw_ignore_data(dat,opt) % %sleepwalker help--------------------------------------------------------- % sw_ignore_data to ignore parts of the data (e.g. ignore A,W,R) % sleepwalker ignore data i.e. to NOT be include in detections % % inputs: dat = data structure % opt.ignore = options ...
3a089a7cccd45b09271f1e75eb16f740ab60a5aa1e5104e24360903695d96ca4
MATLAB
6,172
148
function combineSyncResults(parameters) % % Combine the sync results for randomly generated networks as specified in the % parameters object (or file) % % Inputs: % - parameters - an object containing the expected properties, or a string % describing the filename to run load this object in. % Importantly, the ...
2360ca302c99ba5f98967bee90a642b887f7df89a10bc9be4587d4a350cb9572
MATLAB
6,173
182
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [z, reconstruction_information] = zef_dipoleScan(zef) invMethod=eval( 'zef.dipole_app.InversionmethodDropDown.Value'); regType=eval( 'zef.dipole_app.regType.Value'); inv_leadfield_lambda=eval...
2a78233ea2639490afee9a098297d918184cfd2dc307182b58053c9a52c7db67
MATLAB
6,186
161
function [intResultFlag,sRP] = RP_ExportFile(sFile,sRP) %get synthesized data sSynthesis = sFile.sSynthesis; sLoad = load(fullpath(sSynthesis.folder,sSynthesis.name)); sSynthData = sLoad.sSynthData; sMetaVar = sRP.sMetaVar; sProbeCoords = sFile.sProbeCoords; fprintf('Exporting %s ... [%s]\n',sSynthesis.name,ge...
288795c85e828bcd00bb8eba9ff29eb7a7a99961d5f88fec5a364f6d5960cf1f
MATLAB
6,200
190
function h = zef_plot_selected_source_to_axes_stem(treeObj, h_axes, varargin) %ZEF_PLOT_SELECTED_SOURCE_TO_AXES_STEM Plot selected UI-tree node as a 3D stem/arrow (zef_plot_3D_arrow). % % Reads selection from treeObj (uitree) and uses nodeUI.NodeData fields: % NodeData.SourcePosition.Value (1x3) % NodeData.Sou...
ed8140b9728f08769fc2bd7fcf94057a9fb55eae63befc7abb9921f3e356d5e6
MATLAB
6,202
122
function [coupling] = extract_voxel_based_structure_function_coupling(subject, dataset, part) % The goal of this script is to calculate the structure-function coupling % across each voxel. It assumes that the voxel-based (thresholded) structural % and functional connectivity matrices for that subject have been generat...
7f55cd7e1ab099638de81639a77248179536a0a9338d9c9e45594e2ed010476d
MATLAB
6,217
228
function CBH = cbhandle(varargin) %CBHANDLE Gets the handle of current colorbar or its peer axes. % % SYNTAX: % CBH = cbhandle; % CBH = cbhandle(H,...); % CBH = cbhandle(...,'force'); % CBH = cbhandle(...,'unhide'); % PAH = cbhandle(...,'peer'); % % INPUTS: % 'force' - Forces to create co...
115b0b4ef8e1d1f446a36619d5a990cd0de823488df65ed529cae9628fb893c8
MATLAB
6,220
159
% Example of motor imagery classification % File data/MotorImagery.mat contain preprocessed data from the subject A09 % from the BCI competition IV, dataset IIa. % Applied preprocessing step are : % % - frequency filtering between 8 and 30 Hz (5-th order butterworth) % - time based epoching between 3.5 to 5.5 s a...
1eb13f79b3fcf44460035735d8a15679afe9530ace8af8877b499461e37b917c
MATLAB
6,251
190
function h = cline(varargin) %cline Draw colored lines. Syntax: % h = cline([hAx],vecX, vecY, vecZ, vecC, boolPatch) % %The original cline() function works with patch objects, which cannot %be exported to a vector image (e.g., pdf or eps). I therefore built %this function that has an identical syntax, but instead...
29f47be69a37eb53baea207cfeb4d9ecdec7dd88c7848e41e1edeba1ea935160
MATLAB
6,251
193
function [flips,scorepath,covmats_unflipped] = findflip(data,T,options) % Finds an optimal permutation of the channels, where goodness is measured % as the mean lagged partial cross-correlation across pair of channels and lags. % In other words, it finds a permutation where the signs of the lagged % partial correlatio...
fcee4c6264b131f9a2695e1e70539c82092add7a0bdde1c635c691ace6609d99
MATLAB
6,253
159
%Copyright © 2018- Joonas Lahtinen, Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface %Plot estimated amplitudes as a bar plot function zef_plot_GMM_amplitudes %check if the amplitudes exists if ~evalin('base','isfield(zef.GMM,''amplitudes'')') error('Amplitudes a...
5d7550045ecf5ba9e17f44aa6d5780d8db643f4528d07ae0774e7904c366616d
MATLAB
6,254
196
function OT_redraw(varargin) %DC_redraw Sets and redraws windows % DC_redraw([redrawImage=true]) %get structures global sOT; global sFig; %check whether to plot in new figure intNewFigure = get(sFig.ptrButtonNewFig,'Value'); %check if data has been loaded if isempty(sOT) || isempty(sFig) return; els...
d4f86ebdd58c64f2baea99d9d30cdc6f8dcac2095768dfe2359e02d947ff5eaf
MATLAB
6,260
211
function nbins = calcnbins(x, method, minimum, maximum) % Calculate the "ideal" number of bins to use in a histogram, using a % choice of methods. % % NBINS = CALCNBINS(X, METHOD) calculates the "ideal" number of bins to use % in a histogram, using a choice of methods. The type of return value % depends upon the meth...
54fb7f45263a1b76ef63c653e017ed9dec21551de5477246ac72a85beb915dd4
MATLAB
6,287
253
function Data = extract_spike_window(parm, y, print_mode) % extract_spike_window % Data = extract_spike_window(parm, y) % ----- parameters for window extraction % parm.fs = sampling rate for observed data [Hz] % parm.Twin = time window length [sec] % parm.Tpre = time period before peak ons...
bf93ef0e5747f13c3c6dcfbaaae46fb180d6268ad8a3b4a5614a5dd29a27666b
MATLAB
6,331
282
function [mag_fig, rdm_fig] = eccentricity_diff_fig_fn( ... source_points, ... mags, ... rdms, ... legend_labels, ... n_intervals, ... x_scale, ... min_ecc, ... mag_handle_num, ... rdm_handle_num ... ) % eccentricity_diff_fig_fn % % A function that generates two figures comparin...
b5322a6a92c0501d76e36c55eeafd43bdf9db43c5379cef990cc8cde9e5afd02
MATLAB
6,337
123
% script to test sleepwalker functions %% data file location: path_file='data/csc_PrL_rest.ncs'; % global settings opt.signaltype= 'lfp'; %detect sleep events in lfp; opt.noisewin =1; %% delta detection % settings optd=[]; optd=opt; optd.detect= 'delta'; % detect slow wave/delt...
10a690a6b89d08f2e46705f1c36fb09c0f1e3d181d8b1d7693639b0a5881eb94
MATLAB
6,340
240
function tree = zef_build_source_tree(parentObj) %ZEF_BUILD_SOURCE_TREE Build a struct "tree" from a UI tree / checkbox tree. % Works with both checkboxtree (CheckedNodes exists) and plain tree % (no CheckedNodes). In the plain tree case, "IsChecked" is inferred from % SelectedNodes (if available) or node.Checked...
959813211efa12ac76ca1ae9ad99ea6e18c28bdb2d2e80f836f7eba4187efa2b
MATLAB
6,342
167
classdef (Abstract) dirichletdiags % Utilities to compute and test values for dirichletdiags % % COMMON TASKS % % 1. Given an expected state lifetime, what dirichletdiags should I use? % % dirichletdiags.get(0.2,100,11) <- 0.2s expected lifetime, 100Hz sampling rate, K=11 % % 2. Given a value for dirichletdiags, wh...
f3f133cf6dd33834ff93eb83faf64b702d0a7c6fa03bcfc156966f1271a42bc7
MATLAB
6,376
255
function spike_info = spike_information(data, data_win, parm) % spike_information of extracted window data % spike_info = spike_information(data, data_win, parm) % % --- spike info for extracted window % spike_info.spike_num(n) = spike number of n-th window % spike_info.spike_time{n} = spike onset time of n-th...
c44273919adb6a467d93b0229c20306f32ef708405e754f4af7192876d2a137c
MATLAB
6,381
155
%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 '/system_data/system_data_1.mat']); load([torre_dir '/system_data/nodes_1....
e6eb6f8724c62dbe159974d3479195fd3f79879bdb055e7b124c3b9d11ed3908
MATLAB
6,394
110
function [ensemble_performance] = calculate_ensemble_performance_with_threshold(params, ensemble_nodes, log_likelihood_by_frame, data_index, threshold_reference) num_udf = params.num_udf; dataset = [params.x_train; params.x_valid; params.x_test]; true_labels = dataset(data_index, end-num_udf+1:end)'; % hardcode beca...
593a16f7cbaf164880ba1ac3bde737c100cd4925fa843afe28032f1c032e9cf9
MATLAB
6,410
149
%% Result 1 : Long-Range Connections Enhance Object Recognition in Shallow Networks (Figure 2) %% Generate dataset if ~exist('IMAGE_mod') tic disp('generating modified MNIST ...(~ 30 sec)') [IMAGE_mod,LABEL_mod] = fun_generate_mMNIST(numTrain_mod); toc end %% Show dataset ind_img = 3; di...
1e1f40e1b342808c3089043357e550e96277370749e87fdf7b920c4fa4c49506
MATLAB
6,431
133
%% Result 1 : Long-Range Connections Enhance Object Recognition in Shallow Networks (Figure 2) % ============================================================================================================ %% Add LRC vs Add Layers (Figure 2g) disp('================================================================='...
56fd1bb723b1efd2d2b10960b41e8deb78153b471884def23f76cc6c3cd2ac8b
MATLAB
6,439
185
function [I,dist_vec] = zef_point_in_compartment(zef,reuna_p,reuna_t,nodes,varargin) if isempty(zef) zef = evalin('base','zef'); end if eval('exist(''zef'')') if eval('isfield(zef,''meshing_threshold'')') meshing_threshold = eval('zef.meshing_threshold'); else meshing_threshold = 0.5; ...
29b0ccb49d4cd67751b056a5e33079fef7c35038e3849b3b2902fed712bb220d
MATLAB
6,446
155
function A = generateNewRandomRingMatrix(N, d, gamma, includeSelf, undirected, allowSelf, ensureConnected) %% Generate a new ring network, which is rewired subject to a given probability % % Inputs % - N - network size % - d - in-degree % - gamma - probability of rewiring each link after the regular network is co...
bd355c5e8607fe67dbeeba806b6398eb5fafa645e601255559e4f1f93ff6804a
MATLAB
6,456
210
function [meas_data,roi_source_pos,dip_ori,amp_all,n_multiple_sources,roi_specs] = zef_find_source_ROI(zef,varargin) allow_overlapping_ROIs = true; if nargin>1 if islogical(varargin{1}) allow_overlapping_ROIs = varargin{1}; end end %get variables noise_level = zef.synth_source_ROI(1,17); s_p = zef.s...
1385b0b1ac2fbae5395b100df49025ff2253c158be8b30361ab20f4bf26640be
MATLAB
6,459
123
function zef = zef_exp_app_start(zef) if isfield(zef,'EXP') if isfield(zef.EXP,'app') return; end end zef.EXP.app = exp_app; if ~isfield(zef.EXP,'parameters') zef.EXP.parameters = []; end %Script piece for either loading values from zef structure or %substitute them there if the app is launched firs...
77331a58cab72642c1d6ec439d7453b9a70e01b1cb99e41e70351f78b41ff25e
MATLAB
6,478
117
%Copyright © 2018- Joonas Lahtinen, Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface %This is script for opening advanced GMM plot options. if isfield(zef.GMM.apps,'PlotOpt') if isvalid(zef.GMM.apps.PlotOpt) eval(zef.GMM.apps.PlotOpt.UIFigure.CloseRequest...
7805a9b28523e04e675150f5748ddbebecbab3d2afe69ba514b4b18b1b7542d9
MATLAB
6,495
205
function M = realphasefactory(n, z0, zmax) % Returns a manifold struct to optimize over phases of fft's of real signals % % function M = realphasefactory(n) % function M = realphasefactory(n, z0) % function M = realphasefactory(n, z0, zmax) % % If x is a real vector of length n, then y = fft(x) is a complex vector % wh...
88787e4e03ab43391c72df77fec93efa019d474b3fc541e1839c98e91b02d152
MATLAB
6,500
92
function zef = zef_open_dataBank(zef) zef.dataBank.app=zef_dataBank_app; zef = zef_dataBank_init(zef); %intitial values if ~isfield(zef.dataBank, 'folder') zef.dataBank.save2disk='Off'; else if ~isfield(zef.dataBank, 'save2disk') zef.dataBank.save2disk='Off'; end zef.dataBank.app.DataFolder....
8a3195fbc45b689835ee8c48d44fa50f822c186024bb131b995bc24b5b3ecece
MATLAB
6,511
189
function [control_infor, output_infor, time_infor, r_end] = func_reservoir_validate(traj_type, bridge_type, time_infor, ... input_infor, res_infor, start_info, properties, dim_in, dim_out, Wout, r_end, dt, plot_movie, save_rend, ... failure, blur, traj_frequency) %% read parameters % save_rend = 0 means, the robot ...
f55d4ddeaa20b12c462ca1abfde7bf4dbec37c66109cf2cba8a647e8b61b39f1
MATLAB
6,515
144
%-------------------------------------------------------------------------------- % adder.m % % This demo is included in % Triple equivalence for the emergence of biological intelligence % Takuya Isomura % % The MATLAB scripts are available at % https://github.com/takuyaisomura/reverse_engineering % % Copyright (C) 20...
b4256cd783e1850ffb5620d13ba48448801d246dce7eed60ebb72d641bacbd5a
MATLAB
6,519
211
function M = fixedrankfactory_2factors_subspace_projection(m, n, k) % Manifold of m-by-n matrices of rank k with two factor quotient geometry. % % function M = fixedrankfactory_2factors_subspace_projection(m, n, k) % % A point X on the manifold is represented as a structure with two % fields: L and R. The matrix L (mxk...
84e6633bb5d0da6ee6c335112ed6b8ff9f8801a085e1fbd2a8b3f47985d88f4e
MATLAB
6,533
195
classdef IASInverter < inverse.CommonInverseParameters & dynamicprops % % IASInverter % % A class which defines the properties needed by the IAS inversion method, % and the method itself. % properties % %This defines the post-hoc weighting used with the Bayesian model ...
d438179c133328a66145d8418b829a5dfd0d8366cad12f37137173761917815e
MATLAB
6,536
109
function process_files_cox(suffix, reg_exp, test) addpath(genpath('/home/mfromano/spm/spm12/')); BASE_DIR = ['/data2/MRI_PET_DATA/processed_images_final' suffix filesep]; if nargin > 2 && test MRI_folder_old = [BASE_DIR 'ADNI_MRI_NACC_recenter' suffix filesep]; else MRI_folder_old = [BASE_DIR 'ADNI_MRI_nii_rece...
e6fd812417dfa23c1346135317bcdca01a138c98693b21e82eb4298158b0b2e8
MATLAB
6,566
169
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [z,reconstruction_information] = exp_em_iteration(void) h = zef_waitbar(0,1,['EM MAP iteration.']); hyper_type = evalin('base','zef.exp_em_hyper_type'); n_ias_map_iter = evalin('base','zef.in...
212c842e1d036f6d852c1c55f79d6a78bb76e2894897003520597bb48686aaa5
MATLAB
6,580
208
function [z_vec, self] = invert(self, f, L, procFile, source_direction_mode, source_positions, opts) % % invert % % Builds a reconstruction of source dipoles from a given lead field with % the selected beamforming method. % % Inputs: % % - self % % An instance of Beamforme...
150e3dd7a31467d921e90be92f2c3cdc8dffbbbf8b90e3670fc812a520d834c9
MATLAB
6,603
216
function M = obliquecomplexfactory(n, m, transposed) % Returns a manifold struct defining complex matrices w/ unit-norm columns. % % function M = obliquecomplexfactory(n, m) % function M = obliquecomplexfactory(n, m, transposed) % % Oblique manifold: deals with complex matrices of size n x m such that % each column has...
25e189d1b007f952298950f09bbc587250e4a35d60d99571fc37053c0cbbdd8c
MATLAB
6,607
248
function run_VL_haemodynamic % VL scheme - DCM haemodynamic model example % % Hidden states (x): % 1. S - vasoactive signal % 2. logf - log rCBF % 3. logv - log venous blood volume % 4. logq - log dHb % % Parameters (P): % 1. log_transit - haemodynamic transit rate (Hz) % 2. log_decay - decay rate of vasoactive si...
f4176eea668a062e55dc99dfc53e600d0280f3f0bcb111879467513916c347a1
MATLAB
6,617
185
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [x, theta] = zef_gibbs_sampler_step(L, y, x, theta, theta0, beta, std_lhood, hypermodel, decay_val_hyperprior, nbins_hyperprior, source_direction_mode) %One-dimensional sampling resolution. i...
c53c3b50411b874560f57e37a867588fd399c16e7a89c0f066efdd79ab90ba42
MATLAB
6,664
210
% AUC Area under ROC % % [dblAUC,Aci,Ase,pAuc] = getAuc(vecTP,vecFP,alpha,flag,nboot,varargin); % % INPUTS % vecTP - True positive values % vecFP - True negative values % % OPTIONAL % alpha - level for confidence intervals (eg., enter 0.05 if you want 95% CIs) % fla...
892bd1a44506be567ad5d2683c9dd98d7a10d9d5288ea321079c67ae3a2af4a4
MATLAB
6,672
205
% clearvars -except SS function subject_struct=excel_parsing_personalized(filename) % filename = 'S01'; sheet = 1; xlRange = 'B2:G2'; demograph_xl = xlsread([filename],sheet,xlRange); demographics.Age=demograph_xl(1); %% sex if demograph_xl(2)==1 demographics.Gender='male'; elseif demograph_xl(2)==2 ...
c4714965440100868e42747193746b5d83df49b49ce04304e44025a9ea90bc3f
MATLAB
6,675
197
function [stensil, signs, source_moments, source_directions, source_locations, n_of_adj_tetra] = zef_fi_dipoles( ... nodes ... , ... tetrahedra ... , ... brain_ind ... ) % zef_fi_dipoles: generates the information related to face-intersecting % dipoles in the tet...
534cc774bd31d8074711af97a73aaf34a4f0f06a55d16685188490ecf7d33c68
MATLAB
6,687
114
function process_files_cox_unused(suffix, reg_exp) addpath(genpath('/home/mfromano/spm/spm12/')); BASE_DIR = ['/data2/MRI_PET_DATA/processed_images_final' suffix filesep]; MRI_folder_old = [BASE_DIR 'ADNI_MRI_nii_recenter' suffix filesep]; disp(MRI_folder_old) if nargin < 2 reg_exp = '^([0-9]+_mri_I[0-9]+).*\.nii$...
c232c25c6b1902c6c5d68cebdbb528bcac49e0aa66d009ffa845e3a43b91bea3
MATLAB
6,698
121
function [ensemble_performance] = calculate_ensemble_performance(params, ensemble_nodes, log_likelihood_by_frame, data_index) num_udf = params.num_udf; dataset = [params.x_train; params.x_valid; params.x_test]; true_labels = dataset(data_index, end-num_udf+1:end)'; log_likelihood_by_frame = log_likelihood_by_frame(:,...
f77e9a162ecb7edc967bc7a19734a0657878a75281646dd4ea67432480495274
MATLAB
6,700
220
function load_model(app) % function load model filename = app.file_model; update_log(app, 'Parsing the Model File'); % load params file first try params = load(filename,'params'); params = params.params; % ends up nested params = convert_paths_to_absolute(params); app.params = params; app.ParamsL...
a8a5ffd7466bb0b052e32681d165a4c3605e7beeb9aba975cb52e685eab1256b
MATLAB
6,703
207
% ------------------------------------------------------- % % synthesize_P_QRST_timeSeries.m - This script synthesizes a simulated % P wave and a QRST segment to a full hearbeat and extends it to a 10s % time series % % Ver. 1.0.0 % % Created: Claudia Nagel (13.10.2022) % Last modified: ...
1581bd10ea7dd33093b1e30bb4b687e9ac918b6500bcb46ffd2d0b0dc49729ab
MATLAB
6,723
290
function data = generate_spike_signal(parm, spike_time) % ----- Poisson spike signal generation % data = generate_spike_signal(parm, spike_time) % ----- Time of Poisson spike % spike_time = time of spike onset [sec] (Nspike x 1) % ----- spike generation setting % parm.tau = [onset time; decay time] [se...
09d7a639179c969850e74f41153ba8e7fde08a822f3cc85717b8468c4718e13a
MATLAB
6,724
198
function [z_vec, self] = invert(self, f, L, procFile, source_direction_mode, source_positions, opts) % % invert % % Builds a reconstruction of source dipoles from a given lead field with % the IAS RAMUS method. % % Inputs: % % - self % % An instance of RAMUSInverter with t...
4142c829b377db294299df8bc27a39b60602f9fa420c513d2f93786b342ea1d3
MATLAB
6,725
183
function [cellCoeffs,matX,cellFunctions,vecLinCoeffs,vecLinCoeffFunctions] = gnmfit(matX,vecY,cellCoeffs0,varargin) %gnmfit Fits a generalized non-linear model where predictors are % related to parameter values through non-linear functions. % %[cellCoeffs,matXwithBias,cellFunctions,vecLinCoeffs,vecLinCoeffFunction...
49761aa6fbd6ba4e6793a93f688665535b192cbb422c2328abb5975491c8a4d2
MATLAB
6,729
164
label_ind = uint32(label_ind); if isequal(labeling_flag,1) %*********************************************************** %Initialize labeling. %*********************************************************** [node_labels,distance_vec] = zef_solid_angle_labeling(zef, label_ind, nodes, h); I = find(sum...
6a94ba76256187c254eadf61cae743d89902b512c8aed7723c42be59ebfcf6ab
MATLAB
6,733
221
function clusters = ez_clusterstat_time(cond1,cond2,reps,t) %ez_clusterstat_time Cluster-based statistical test for paired data; Maris and Oostenveld (2007) %clusters = ez_clusterstat_time(cond1,cond2,reps,t) % %Inputs: %cond1 and cond2: 2d matrices with dimensions [trials, time] % Any missing data should be conv...
c4c564e38949902955c75ec6e398f0089196b4392be2c6e2aeb6363bd5bc0e72
MATLAB
6,736
183
function [matC, dblMSE, intRankT, sSuppOut] = doRdRankReg(matX, matY, varargin) %doRdRankReg Performed reduced rank multivariate regression. % [matC, dblMSE, intRankT, sSuppOut] = doRdRankReg(matX, matY) % Finds the reduced rank regression using a full rank assumption. X % is a n-by-r matrix, and Y is a n-by-...
35ba086eb66d6ebd5e5e1937d23af6c4067048092a7291e7284494182d74ccb4
MATLAB
6,754
249
function [Model,data] = estimate_multispike_step(... Model,Data,Spike_state) % Estimate multispike state % [Model,data] = estimate_multispike_step(... % Model,Data,Spike_state) % --- Model parameters (input: fixed parameter) % Model.tau % --- Model parameters (input/output: updated parameter) % Mo...
9c73713dac09ffcf4b179042aa46c642b13f0e79c4f0c1744bbea6fadc77648e
MATLAB
6,764
182
function [sPupil,imPupil,imReflection,imBW,imGrey] = getPupil(gMatVid,gMatFilt,sglReflT,sglPupilT,objSE,vecPrevLoc,vecPupilT,sET) %getPupil Detects pupil in image using GPU-accelerated image processing %syntax: [sPupil,imPupil,imReflection,imBW,imGrey] = getPupil(gMatVid,gMatFilt,sglReflT,sglPupilT,objSE,vecPrevLoc,v...
481d02486f3c6b1ffb28189cb2bc1f78dbd14dc1412a73194b1bd1ab36c17371
MATLAB
6,773
184
function tests = hmmtest (Gamma,T,Tsubject,Y,options,hmm) % Statistical testing to differenciate between groups according to how much % time they spend on the different states, or how quickly they switch between states. % For statistical testing on how the probability of the states is modulated % by a stimulus, time p...
9232b54baa40dc61216570be1f29654b5043217535f4497781f86b104ea8630d
MATLAB
6,793
195
function [opt, spindle, stats, fh] = sw_run_spindle_LFP(varargin) % [spindle] = sw_run_spindle_LFP(dat, opt) % top level function to perform event detection % inputs: % dat - data input which can be either % a) string with path/file.dat or % b) a data structure with the follo...
eb3c6d8fd3d1ae03f22f1ce701c77a36bbac9b836bafd1c74fdaeb4d6115e831
MATLAB
6,804
180
%% For all patient-specific VTAs function fingerprint_all_sessions(varargin) %path, pat, assessment % Reads and concatenates each HCP subjects session % computes the correlation between the mean activity of voxels included % in the each VTA and all the non-VTA voxels % averages and z transforms the results...
a324b7d268c55696f9fd99c61809c4052f04334773a425e330c1263c3d26e64d
MATLAB
6,807
140
function A = generateNewRandomMatrix(N, p, allowSelf, undirected, ensureConnected, ensureALinkForEachNode) %% % Generate a new Erdos-Renyi random matrix % % Inputs % - N - network size % - p - connection probability % - allowSelf - whether to allow self-connections % - undirected - whether to make the matrix ...
e654163e78b7ec553dda4a02bd504dd5ab957b328f1cfcbc66dfae315743091e
MATLAB
6,828
215
function result = lgcpregress(n,k,kernel) %{ LGCPREGRESS Log-Gaussian Cox Process regression RESULT = lgcpregress(N,K,KERNEL) infers log-rates from binned visit counts K and spike counts N using kernel KERNEL returned by MAKEGRIDCELLKERNEL(L,P,V), where L is the size of the L×L 2D spatial grid, P is the grid-...
7f74992bbaa9db48aaebd751e9c72720697167b4c36faae9afd76b37f0083cf0
MATLAB
6,844
191
function d = estoi(x, y, fs_signal) % d = estoi(x, y, fs_signal) returns the output of the extended short-time % objective intelligibility (ESTOI) predictor. % % Implementation of the Extended Short-Time Objective % Intelligibility (ESTOI) predictor, described in Jesper Jensen and % Cees H. Taal, "An Algorithm for ...
bff5dcbd01d12978fbeef290d8a9a504a619d6ba7107f4cb1aca31f252fae16a
MATLAB
6,850
191
function d = estoi(x, y, fs_signal) % d = estoi(x, y, fs_signal) returns the output of the extended short-time % objective intelligibility (ESTOI) predictor. % % Implementation of the Extended Short-Time Objective % Intelligibility (ESTOI) predictor, described in Jesper Jensen and % Cees H. Taal, "An Algorithm fo...
9f1794e5134a68fd9d9f610df21e0f1b0bfc9e3fafad679c0e9ad1a20243e445
MATLAB
6,853
260
% Collapse multiple single-scan NIFTI files into a multiple-scan NIFTI file % % Usage: collapse_nii_scan(scan_file_pattern, [collapsed_fileprefix], [scan_file_folder]) % % Here, scan_file_pattern should look like: 'myscan_0*.img' % If collapsed_fileprefix is omit, 'multi_scan' will be used % If scan_file_folder is...
5112a5dcb6f8b5d3cf793f7b4ebd9d0f298473e15e5d4beacf670aeef0daab4c
MATLAB
6,898
117
function zef = zef_downsample_surfaces(zef) if nargin == 0 zef = evalin('base','zef'); end zef.h = zef_waitbar(0,1,'Resampling surfaces.'); zef.temp_time = now; relative_resolution_vec = zef_find_relative_resolution(zef); zef.number_of_compartments = length(zef.compartment_tags); active_compartment_ind = 0; for ...
6e98a4fea5bcce6271c65cb4c7866c18d79d5dd30056211c9ddf8dd625e85f52
MATLAB
6,919
256
% % disturbance = 1.00; % measurement_noise = 0.00; % try for only the first one and then only the second one % then try them together % then try uncertainty time_today = datestr(now, 'mmddyyyy'); %% only disturbance measurement_noise = 0.00; % disturbance_set = exp(linspace(log(0.01), log(10), 20)); disturbance_se...
a26c638a0ae2e2e71b3bbe520c04b99bf3454d8339f6e96444af12e2eee8ea91
MATLAB
6,964
202
%% Nat Comms Ictogenesis Figure S5 clear load('20230127_PooledData.mat'); % Set up binning ranges ephistbins = 1:15; ephistedges = (1:16) - 0.5; rshistbins = 0:7; rshistedges = ([0:7, 9]) - 0.5; EXP5HZ = "B30_P5F5_"; EXP10HZ = "B30_P5F10_"; EXP20HZ = "B30_P5F20_"; sz = struct(); sz.stim...
a76d0ecdaf1848b58dc197585dcf1bd9cda3a899ac3157c8b43e0ffaa9114c28
MATLAB
6,965
215
function M = fixedrankfactory_2factors(m, n, k) % Manifold of m-by-n matrices of rank k with balanced quotient geometry. % % function M = fixedrankfactory_2factors(m, n, k) % % The first-order geometry follows the balanced quotient geometry described % in the paper, % "Linear regression under fixed-rank constraints: ...
afd337e3c64a70db1eda707c0c503085fbfa4dd5ec4c811ca7a7a401904e1e7d
MATLAB
6,966
307
function zef = zef_nse_tool_init(zef) if not(isfield(zef,'nse_field')) zef.nse_field = struct; end if not(isfield(zef,'inv_time_1')) zef.nse_field.inv_time_1 = 0; end if not(isfield(zef,'inv_time_2')) zef.nse_field.inv_time_2 = 0; end if not(isfield(zef,'inv_time_3')) zef.nse_field.inv_time_3 = 0; e...
04bd5c15e4c32c9c1480d9672242fd5c4ac9219b3fbed44b6d289f52265a3969
MATLAB
6,981
162
classdef ParModelCollection properties %Properties & Definitions models; % individual models in collection x_train; % training dataset x_valid; % validation dataset x_test; % test dataset end methods function self = ParModelCollection(models, param...
9e4f1274e7f3de19cb25341480fe7a6928d18fed728e666c6999d419f86b51fe
MATLAB
6,991
162
classdef SingleModelOptimization properties %Properties & Definitions models; % individual models in collection x_train; % training dataset x_valid; % validation dataset x_test; % test dataset end methods function self = SingleModelOptimization(mod...
35bac191da7d582fa7c26f0b57d0d50a66e1afd1929f1aabc40f6e6aff29fbe5
MATLAB
7,035
114
% NLX2MATTS Imports data from Neuralynx NTS files to Matlab variables. % % [TimeStamps, Header] = Nlx2MatTS( Filename, FieldSelection, ExtractHeader, % ExtractMode, ModeArray ); % % Version 6.0.0 % % Requires MATLAB R2012b (8.0) or newer % % % INPUT ARGUMENTS: % FileName: String...
16793ae38fb69ac3b00b184631fdbac8629f1725202bd4b33dc571ed366a3d59
MATLAB
7,043
150
function A = generateNewRandomFixedDMatrix(N, p, allowSelf, undirected, ensureConnected) %% Generate a new random matrix with a fixed indegree for each node % % Inputs % - N - network size % - p - connection probability % - allowSelf - whether to allow self-connections % - undirected - whether to make the matri...
59af0ee52413a631f5f0e8f59aed9d5d208fcf8c4bf358fadf37dd8ef9516701
MATLAB
7,053
116
%Copyright © 2018- Joonas Lahtinen, Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface %This is script for opening advanced GM modeling options. if isfield(zef.GMM.apps,'ModelingOpt') if isvalid(zef.GMM.apps.ModelingOpt) eval(zef.GMM.apps.ModelingOpt.UIFigu...
b2808c011b995de51f10344706b3f997ad1eca8481f40aef516b7e17ea340775
MATLAB
7,069
203
function [cv_acc,acc,meanGenPlot,AUC,LL] = standard_classification(X,Y,T,options,binsize) % Determine the cross validated accuracy of a classification type on brain % data X with mutually exclusive classes Y % % INPUT % X: Brain data, (total time by regions) or (time by trials by regions) % Y: Stimulus, (total time by ...
5cd133c9ba5b72bbdaeb4eb5249de97102d4178886aae088935c598367fd88b1
MATLAB
7,116
200
function M = multinomialdoublystochasticfactory(n) % Manifold of n-by-n doubly-stochastic matrices with positive entries. % % function M = multinomialdoublystochasticfactory(n) % % M is a Manopt manifold structure to optimize over the set of n-by-n % matrices with (strictly) positive entries and such that the entries o...
a59e37163e862a39d095e7a637fc34621db8c302f06756835bf714573d203e50
MATLAB
7,119
216
function M = elliptopefactory(n, k) % Manifold of n-by-n psd matrices of rank k with unit diagonal elements. % % function M = elliptopefactory(n, k) % % A point X on the manifold is parameterized as YY^T where Y is a matrix of % size nxk. As such, X is symmetric, positive semidefinite. We restrict to % full-rank Y's, s...
e77d8441e1b8679bc22504a87d4b955b4f49502b00948cd39883417314ebb1f7
MATLAB
7,120
127
function plot_ensemble_coordinates_structure_style_2(app) cla(app.ensemble_coordinates); app.ensemble_coordinates.NextPlot = 'replacechildren'; % 1 udf_id = app.StimulusEditField.Value; neuron_id = app.HighlightedEnsNode.Value; % 1 rois = app.rois; num_rois = size(rois.xpix, 1); best_model = app.best_model; edge_mat ...
49b05b7cb2b8d241a0c5abab8248c73ec620fdedda20ce72185874363417ed10
MATLAB
7,121
272
function [ ... surface_triangles, ... surface_nodes, ... tetra_ind, ... tetra_ind_global, ... tetra_ind_diff, ... node_ind, ... node_pair, ... face_ind] = zef_surface_mesh(tetra, nodes, I, gpu_mode) % TODO Documentation % % The basic idea is that this function returns the surface triang...
c8ebcd118a9d055af71673dd7c0dceb9d12957f13fcc4003c21ff1321c1758b2
MATLAB
7,124
258
% Copyright © 2018- Sampsa Pursiainen & ZI Development Team % See: https://github.com/sampsapursiainen/zeffiro_interface % % TODO Documentation % % This function decomposes a given set of nodes and tetrahedra (degrees of % freedom or DOF) into % % Input: % % - nodes % % The nodes that make up a finite element mesh. %...
9f21fe4ad33fdd21d1ae42523127f6ca82346601596fab800b2dd9044d1fda4a
MATLAB
7,160
187
function [vecSpikeCh,vecSpikeT,intTotT] = DP_DetectSpikesInBinaryFile(strFilename,sP,vecChanMap) %DP_DetectSpikesInBinaryFile Detect spike times in binary (SpikeGLX) file % [vecSpikeCh,vecSpikeT,intTotT] = DP_DetectSpikesInBinaryFile(strFile,sP,vecChanMap) % %Note: vecSpikeT is in sample numbers, not in seconds. ...
3f1f6dad5fdda0701ba78ddc927b5151a1f46e80dd3cc4f7a8d88059338ce72c
MATLAB
7,172
200
function [assignment,cost] = munkres(costMat) % MUNKRES Munkres (Hungarian) Algorithm for Linear Assignment Problem. % % [ASSIGN,COST] = munkres(COSTMAT) returns the optimal column indices, % ASSIGN assigned to each row and the minimum COST based on the assignment % problem represented by the COSTMAT, where the...
46a97f7366f8511c7c777e9980415f537a32ad801dea4fd84f5d1e8f0d52ad52
MATLAB
7,181
145
function [mu,sig,alpha,beta] = fit_eeg_distribution(X,min_clean_fraction,max_dropout_fraction,quants,step_sizes,beta) % Estimate the mean and standard deviation of clean EEG from contaminated data. % [Mu,Sigma,Alpha,Beta] = fit_eeg_distribution(X,MinCleanFraction,MaxDropoutFraction,FitQuantiles,StepSizes,ShapeRange) ...
a1645d7ba37eb123eddd04cee9c267ebac1cacde138697e8d637483ee5942a89
MATLAB
7,207
189
%% 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...
08e50754174a694e9e7fe784d933a5e21c34310cb6dcabfaf52328c7d600bb0b
MATLAB
7,220
232
%% Copyright © 2025- Joonas Lahtinen and Alexandra Koulouri classdef GroupLassoInverter < inverse.CommonInverseParameters & dynamicprops % % GroupLassoInverter % % A class which defines the properties needed by the GroupLasso inversion method, % and the method itself. % properties ...
3d66951b702c66ec7cdbb77948e654f1ad7f49e3704d3c311f8ddfe687563d9d
MATLAB
7,223
207
function wssize(varargin) % WSSIZE Display in the command window the size of the variables in the workspace using KB, MB and GB % % WSSIZE Display preserving the order of the workspace pane using mixed units % % WSSIZE arg or WSSIZE('arg') One argument syntax % WSSIZE arg1 arg2 or WSSIZE('arg1','arg2') Two ar...
66de83548588a77d3c38d25fc7d9a2b5f5cee43189c0bb4eaec1a88e64b5932b
MATLAB
7,241
143
function signal = clean_channels(signal,min_corr,ignored_quantile,window_len,max_broken_time,linenoise_aware) % Remove channels with abnormal data from a continuous data set. % Signal = clean_channels(Signal,MinCorrelation,IgnoredQuantile,WindowLength,MaxBrokenTime,LineNoiseAware) % % This is an automated artifact reje...
f93042796d740fe9abf19a5c02d164fb85a2293f10b0c7c3a3825e66304d8105
MATLAB
7,257
191
%% 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...
3fd3d8ac5700c542d0c0239d9155f0f27c4c31537849da28b553eabeeba22afa
MATLAB
7,277
122
function zef = find_synthetic_source(zef) if nargin == 0 zef = evalin('base', 'zef'); end zef.find_synth_source = find_synthetic_source_app; zef.synth_source_init = cell(16,2); %Initial names of the parameters: zef.synth_source_init{1,1} = 'x position'; zef.synth_source_init{2,1} = 'y position'; zef.synth_source_i...
1f6aabae292ed87eb06b79401109afe200e45582ea7fe804ac446f4b3214b9d5
MATLAB
7,298
240
function tests = specttest(sp_fit,Nperm,within_state,relative) % % From a multitaper or MAR estimation of the states spectra (per subject), % or from a spectral factorisation as returned by spectdecompose, % this function performs, for each state and frequency component (or bin), % statistical testing (via permutati...