sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
471ed40575f6236adf5218b50fbf0f20681a9faacb7e01986f0e0aa81488d213
MATLAB
3,698
116
function obj = preprocess_orthogonalize(obj,display) % Orthogonalize time courses % Colclough et al (2015), NeuroImage 117:439-448 % Input: % - obj.data: Original data. mobj.datan, where m is number of samples, n number of ROIs % - display: Display progress. Can be: % 'none', disp...
042916f982729f2106424f7227262470a1bdf6d11c3b8d4249284e9fc293288f
MATLAB
3,700
97
%-------------------------------------------------------------------------------- % fig2_simulated_response.m % % This analysis is included in % Experimental validation of the free-energy principle with in vitro neural networks % Takuya Isomura, Kiyoshi Kotani, Yasuhiko Jimbo, Karl Friston % % Copyright (C) 2022 Takuy...
73551947c1737450023ca60bd8e9dc7fbf2caa554533e816d0d02e518b324dd0
MATLAB
3,700
117
function d_EEGheader % function to create a generic meta-data file for an EEG experiment % contains electrode positions and trigger explanations % can contain other useful study information % DHB 30/9/18 load Waveguard.mat; outputfile = 'headerfile.csv'; % generate a filename for the output based on the ...
5ed77aa4d73627ed6ed83bc90ae9579179ae6b7075903cfb73977f0c6f83e566
MATLAB
3,705
136
function relative_resolution_vec = zef_find_relative_resolution(zef) [active_compartments, source_compartments] = zef_get_active_compartments(zef); source_compartments = find(ismember(active_compartments,source_compartments)); relative_resolution_vec = ones(size(active_compartments)); if zef.refinement_on if zef.r...
60148affd9d8db1f299c619c1e1e6b04d01951de6ad2add42296c0610339ebf9
MATLAB
3,706
212
function y = mls_mark(n,flag,RandSeed) %y = mls(n,{flag}); % %Generates a Maximum Length Sequence of n bits by utilizing a %linear feedback shift register with an XOR gate on the tap bits % %Function can accept bit lengths of between 2 and 24 % %y is a vector of 1's & -1's that is (2^n)-1 in length. % %o...
19f0ede5dcc02f2f4bf37da6179ce6beed9e0a4b07b894610521150c7c11f45e
MATLAB
3,707
99
function [acc_chance,p_cluster] = group_accuracy_significance(acc_true,acc_perms,nPerms,pthresh) % This function implements the cluster significance tests as outlined by % Stelzer 2013; unlike int he original publication this is inferred over % time rather than space. This allows for inference of temporal clusters in %...
a214571329a1ae9db6cb99818eeec3503a790cd1eb4bb05639bee9743306cd88
MATLAB
3,708
86
function [cellEpochList,sEpochs] = ETC_GenEpochList(ptrEpochList,sEpochs,vecPupilTime,sPupil) %vecPupilFixedCenterX(intBegin:intEnd) = sEpoch.CenterX; %vecPupilFixedCenterY(intBegin:intEnd) = sEpoch.CenterY; %vecPupilFixedRadius(intBegin:intEnd) = sEpoch.Radius; %vecPupilFixedBlinks(intBegin:intEnd) = sEpoch.Blinks...
fd8e48fd5ba9e3da17ddf6b303703cba938d468573201c6eac845706e50f3491
MATLAB
3,708
102
function [psderr,coherr,pcoherr,pdcerr,sdphase] = spectrerr(psdc,pdcc,coh,pcoh,pdc,options,mar) if nargin<7, mar = 0; end coherr = []; pcoherr = []; pdcerr = []; sdphase = []; Nf = options.Nf; ndim = size(psdc,2); jksamples = size(psdc,4); psd = mean(psdc,4); SA = zeros(Nf,ndim,ndim,jksamples); if options.to_do(1)==1...
b29966c848c24247e6c829c053f53c329f195f52ab2ba0313a32df60a0f093f8
MATLAB
3,717
99
function r_estimated = chradiiphcode(varargin) %CHRADIIPHCODE Estimate circle radius for Circular Hough Transform using the Phase-Coding method % R_ESTIMATED = CHRADIIPHCODE(CENTERS, H, R) takes a two-column array CENTERS, % which contains the x (first column) and y (second column) coordinates % of the center loc...
2c9d81e3596000d299056a5ae771598b90efc9aff18b2006671cb930035b0989
MATLAB
3,721
93
function [random_ensemble_performance, ensemble_nodes] = compare_random_ensembles(params, node_performance, best_model) data = params.data; udf = params.udf; num_controls=params.num_controls; merge=1; par_proc=params.par_proc; [~, num_udf] = size(udf); true_label = udf'; perf_curve_crit...
0019aebd54ae00262d70e577a8de174d965c4fa32cfc40cac3c5a0500f231dc3
MATLAB
3,723
131
zef.ES_opt_solver_list = {'Matlab','SDPT3','SeDuMi','MOSEK','Gurobi'}; zef.ES_opt_method_list = {'L1L1 optimization','L1L2 optimization','Least squares optimization','Backpropagation','L2L2 optimization'}; zef.ES_opt_algorithm_list = {'interior-point','interior-point-legacy','dual-simplex','primal-sim...
b61023620d0bcb6a430ddfc0b829359817ae21f740ddf860a0d5bb4f244859b5
MATLAB
3,732
158
function M = spherecomplexfactory(n, m) % Returns a manifold struct to optimize over unit-norm complex matrices. % % function M = spherecomplexfactory(n) % function M = spherecomplexfactory(n, m) % % Manifold of n-by-m complex matrices of unit Frobenius norm. % By default, m = 1, which corresponds to the unit sphere in...
e386f2a26ce6c12c8338f48af45c1b12060eb5430716fdc245f19c5aab5d828b
MATLAB
3,735
100
function layout = layout_creator(varargin) ; %UNTITLED2 Summary of this function goes here % Detailed explanation goes here narginchk(0,2) switch nargin case 0 microstate.functions.layout_creator_gui ; % call the GUI case 1 if ~strcmpi(varargin{1},'gui') error("Une...
b184f0c36a06206436bce49c1da1fd71e1775924751d47f95afdec2f2724019a
MATLAB
3,755
118
function [hPanelD,sHandles] = ETP_genDetectPanel(ptrMainGUI,vecLocation,strName,sET) %ETP_genQuadSliders Generates quad sliders % [hPanelD,hGain,hGamma,hTempAvg,hBlur,hMinRad,hReflLum,hPupLum] = ETP_genDetectPanel(ptrMainGUI,vecLocation,'Detection settings'); %% get parameters %get defaults & overwrite with sup...
0297d6a95d374b7bf22e24f25869b5adf8431c08dd3c1059b7df09d9aeec0a4a
MATLAB
3,756
151
function B = map(fun,A,varargin) %MAP Apply a given function to the elements, columns or rows of an array (more versatile than Matlab arrayfun) %--- % function B = map(fun,A[,'columns|rows'][,'array|cell|arraydirect'][,errorval]) % function B = map(A,fun,...) %--- % map function 'fun' to elements [default] / columns / ...
8645ae10ad699bba91a0ab14d85ce1ae01ad93b221061869018cc593d52f60de
MATLAB
3,761
133
function [p,confusionmat,nets] = networks_plv(obj,frq,keepstates,epochlength,orthogonalize,Nperms) ; % Calculate microstate segmented functional connectivity % check we have GFP, maps, and labels if isempty(obj.data) error('Data is required to calculate microstate networks') end if isem...
f9eedc42c4420fb64e8308d791924f99aba18b3e0b74a36a126a82b8f20ae118
MATLAB
3,764
108
function f_DA_pcn_struct(app) UDF_NUM = app.Stimulus_PCN.Value; cla(app.PC2); app.PC2.XAxis.LineWidth=1.5; app.PC2.YAxis.LineWidth=1.5; app.PC2.XTick=[]; app.PC2.XTickLabel=[]; app.PC2.XLabel.String=[]; app.PC2.YLabel.String=[]; app.PC2.YTick=[]; app.PC2.YTickLabel=[]; app.P...
4c772545595e76866ef18efd23d45a770aca30c934c9db486d677c1d349073be
MATLAB
3,766
87
%-------------------------------------------------------------------------------- % fig2_empirical_response.m % % This analysis is included in % Experimental validation of the free-energy principle with in vitro neural networks % Takuya Isomura, Kiyoshi Kotani, Yasuhiko Jimbo, Karl Friston % % Copyright (C) 2022 Takuy...
0f14451aeb8cbd2f2f704395c02f2172064e948b40364d49ae12ff19cd6192a6
MATLAB
3,778
102
function M = euclideansparsefactory(A) % Returns a manifold struct to optimize over real matrices with given sparsity pattern. % % function M = euclideansparsefactory(A) % % Returns M, a structure describing the Euclidean space of real matrices % with a fixed sparsity pattern. This linear manifold is equipped with % th...
0fdb260a4444efc6627e8f17a25dfec008a1571be829352612621e2fc60600af
MATLAB
3,779
76
function hmm = updateAlpha(hmm) K = length(hmm.state); ndim = hmm.train.ndim; if isfield(hmm.train,'B'), Q = size(hmm.train.B,2); else Q = ndim; end setstateoptions; for k=1:K if ~hmm.train.active(k), continue; end if isempty(orders) || ~isempty(train.prior), continue; end hmm.state(k).alpha.Gam_shape = h...
7eceef050520743a139e0b059bd1ddd232ed15a2f1793748d7e2aaeefc05b7a8
MATLAB
3,779
110
function [n, xout] = histx(varargin) % A wrapper for hist that picks the "ideal" number of bins to use if % unspecified. % % N = HISTX(Y) bins the elements of Y into M equally spaced containers and % returns the number of elements in each container. If Y is a matrix, HIST % works down the columns. The value of ...
2cb3943e87da2aa8220da2a4e3ac6c29b957d8eacdae7b8925ffeb95e90e33bf
MATLAB
3,784
170
function options = checkspelling (options) potential_options = { 'K';... 'onpower';... 'leida';... 'order';... 'maxorder';... 'covtype';... 'zeromean';... 'embeddedlags';... 'pca';... 'pca_spatial';... 'lowrank';... 'varimax';... 'maxFOth'; ... 'pcamar';... ...
a779a91ef96cda647d98b1d2fb772c80102ada957bbd943c27711e5d1b7292ea
MATLAB
3,790
79
function [omitted_voxel_IDs_list] = extract_omitted_voxel_IDs(subject,dataset) % The purpose of this script is to come up with a list of voxel IDs that % are being skipped over in the voxel-based structural connectivity % matrices, and then use that list to remove those rows from the % functional signal timeseries that...
616a5fbdbe17a5f00537b4ace6ee28ef03e94ff40bb02202abe3dd7a6677b116
MATLAB
3,797
114
function sOut = getClusterQuality(vecSpikeTimes,boolMakePlots) %getClusterQuality Calculates ISI violation index and non-stationarity index %syntax: sOut = getClusterQuality(vecSpikeTimes,boolMakePlots) % input: % - vecSpikes; spike times % - boolMakePlots; set to 0 to suppress plotting % %Version history: %1.0...
2b4fb63998e5d936baacc8b8bc32a84d9158009f0852dc4f19f931a211723bf5
MATLAB
3,803
121
% calculate dF over F0, checks minBarF for <= 0 function [dFoverF0,minBF] = deltaFoverFzeroEmbedded( stack, t1, t2, t4 ) %, minminBF ) % bar F "smoothing" %disp('starting BarFofT'); BarF = BarFofTse; function BarF = BarFofTse %( stack, t1 )%; % s version uses single precision %t1 = 100; %bFofT = ...
30f88370d0b43d9a4a5535a28b3aff5e8d2f482eeaa4336208e06ea665dfcd4b
MATLAB
3,843
78
%This is the startup script for MUSIC app. One must add this as launch %script to zeffiro_plugins file: %MUSIC, inverse_tools, MUSIC_app_start zef.MUSIC = MUSIC_app; %_ Names of methods that are included in app _ zef_MUSIC_names = {'Source projection', 'Noise out-projection' }; zef.MUSIC.MUSIC_type.Items = z...
aa9863375fad5ded440afd094afb38f4e06856bd3fdc21b103449043eb290f34
MATLAB
3,850
108
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef_arrange_windows(varargin) arrange_function = 'tile'; arrange_target = 'windows'; arrange_mode = 'on-screen'; if not(isempty(varargin)) arrange_function = varargin{1}; if length(...
c69829fe37d6d0d26fd7003d30896766b0cf6e832e5afbdab9fce753c3412b49
MATLAB
3,851
88
function [ET,labels] = segmentationLeaflet(MRK_stream, MOUSE_stream, MOUSE_position, ET_stream) IDX = find(contains(MRK_stream.time_series,'EOE')); MRK_stream.time_series=MRK_stream.time_series(1:IDX); MRK_stream.time_stamps=MRK_stream.time_stamps(1:IDX); Event_List = unique(MRK_stream.time_series); my_segments{6,24}=...
a12537ed1029298d28b1c593fc4e396a27f0a9122544f9b5106ed3abf3fdba7e
MATLAB
3,857
106
%Copyright © 2018, Sampsa Pursiainen %[zef.rho,zef.brain_ind] = zef_rho([]); 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 = 'f...
27b99481e9ae60bac116492e6d658bb0533abcc978e993f51747feae9d5b39f9
MATLAB
3,862
161
function overlap = find_ovelap_window(... data, Data, spike_state, print_mode) % find overlap window for post processing % overlap = find_ovelap_window(data, Data, spike_state) % % overlap.twin{n} = overlap time index % in n-th overlap window % overlap.nwin{n} = overlap window index ...
f36b035295be6d95b7830d2c4fb195f2377ba66af7c4bc45cdd313f6cf7ae08a
MATLAB
3,866
100
classdef AbstractFW < handle % AbstractFW % Base class for Frank-Wolfe algorithms. % Handles outer loop and convergence checks. properties algo_name objective duality_gap opts total_iter_time end methods (Abstract) % ...
68e9c2bfb1534ed38dbff9d47746ecdbad910d3c8f36dcd3d5174a68a2dfb24c
MATLAB
3,872
121
% Generates data for Table 1 in paper function copytest addpath(genpath('../')) UIv = []; Errorv = []; Elapased_Timev = []; c=0; % ---------------------------------------- % High dimensional COPY: UI(S;Y\Z) = I(S;Y) for ny=2:14 c = c+1 nz=ny; ns=ny*nz; ...
386c09e1a47d379ded45f042f73b0716327e47e44982ece0fcf1c481b036167c
MATLAB
3,873
83
function [ overcomplete_params ] = samples_to_overcomplete(samples, adjacency_matrix) %CONVERT_SAMPLES_TO_OVERCOMPLETE This functions uses the graph structure %and the samples in its simple format (one sample per row, one variable per %column), and converts the samples to the overcomplete parametrization %necessary to...
7a070cb28e2ced9da5f09fad6253871f588af5fc311f24b932e5a7cab255f5f0
MATLAB
3,873
132
/* Magma code to randomly generate 200000 weights corresponding to terminal Fano toric varieties of Picard rank two, in dimensions 2..10. The resulting weights are written to the files "rank_2_dim_N.txt", where N is the dimension. */ // Reorder the weights wts so that the columns are cyclically ordered. function cycli...
7d84365955fd39c1fd69a4504b4391967fdebe4a796d3782e61bcf84cff3d9eb
MATLAB
3,878
120
function cost = getCost(problem, x, storedb, key) % Computes the cost function at x. % % function cost = getCost(problem, x) % function cost = getCost(problem, x, storedb) % function cost = getCost(problem, x, storedb, key) % % Returns the value at x of the cost function described in the problem % structure. % % stored...
d9364df14aed0babec942c0635ae89afa54430d2c7773d32ffb48a51d1eb8305
MATLAB
3,885
177
function [post_spike, ypred] = post_spike_search(... data, ypred, Model, parm, plot_mode); if nargin < 5, plot_mode = 0; end tau = Model.tau; a = Model.a; % spike waveform amplitude b = Model.b; % bias if isfield(Model,'b0') b0 = Model.b0; % bias else b0 = b; end sx = Model.sx; % noise variance p...
0399ddee3cba862b8e72ad59e6d0e2d1b0c9ec4f4fa46bed692605b48c409041
MATLAB
3,895
102
function ridges_ravines_2vtk_v2(fileridges,fileravines,vtkfile) % License & disclaimer. % ------------------------------------------------------------------------------ % Copyright 2019 Dumoncel Jean % ------------------------------------------------------------------------------ % % IMPORTANT % If you use t...
23e82e1a904d415464b24c6ecf8415bf3dd7365c1c25a14f1425ad753e2047a4
MATLAB
3,905
90
% The purpose of this script is to estimate the intracortical myelin content for each % voxel of the Penn subjects, using the T1w/T2w method % Requirements: % 1. The scripts HCP_orig_to_b0.sh and register_T1w_T2w_files_to_b0_HCP.sh have been run. % % Output: % The voxel-based intracortical myelin estimates (within 1 ...
2c915778f260f30057a890c6080172d94b6aac2d3fcfe6acd2bdf7d7ecfab4b2
MATLAB
3,907
137
%% Copyright © 2025- Joonas Lahtinen function [reconstruction, self] = smoother(self, z_inverse, L) % % smoother % % Computes the desired smoother for Kalman filter solution % % Inputs: % % - self % % An instance of KalmanInverter with the method-specific parameters. % ...
f3575101e79adbd9d209e8bd2fffda911da1aad49e6ffc5b00fc628b14d770bc
MATLAB
3,916
108
%This is the startup function for KF app. %Beamformer, inverse_tools, zef_KF_start function zef = zef_kf_open_window(zef) if nargin == 0 zef = evalin('base','zef'); end zef.KF = zef_kf_app; %_ Initial values _ if isfield(zef,'inv_snr') zef.KF.inv_snr.Value = num2str(zef.inv_snr); else zef.KF.inv_snr.Value = '30...
c9415ca1786acea965b9e0528a143ce619dad7d2854da119e72e098f8944219c
MATLAB
3,917
133
function params = initialize_params(params) params.G_K = 25; params.G_Na = 30; G_L = 0.05; params.C = 1.0; params.g_l_k = G_L; params.g_l_na = 0.35*G_L; % 0.0175 params.g_l_cl = G_L; params.dslp =0.33; % K diffusion rate params.gmag=8; % this is G_glia in the eqs--- glia uptake strength of potassium params.ga...
0b0b2061473a8d48798c9d4d1473ca76fe23e32ae810e6103331c08da93225cf
MATLAB
3,918
103
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'exp_multires_dec')); zef.exp_multires_dec = []; end; if not(isfield(zef,'exp_multires_n_decompositions')); zef.exp_multires_n_decompositions = [20]; end; if not(isfield(zef,...
41ca6c27753056aca43360b8452a872f806970cfe7373fc0187c856605514f49
MATLAB
3,926
71
%This is script for opening advanced GMM plot options. zef.GMM_PlotOpt = GMMclustering_PlotOpt_app; %Set position besides GMM app zef.GMM_PlotOpt.UIFigure.Position(2) = zef.GMMclustering.UIFigure.Position(2); zef_temp_screen_size = get(0, 'ScreenSize'); if zef.GMMclustering.UIFigure.Position(3)+zef.GMM_PlotOpt.UIFigu...
d9dba562a06cd315fbcf7f0a46cfb6728747eb2029ce351c2422d78bacd230a3
MATLAB
3,927
84
% The purpose of this script is to compute the Hurst exponent of all of the % 100 unrelated HCP subjects' BOLD timeseries—-as a proxy of their % excitation-inhibition ratio--using the nonfractal toolbox: % https://github.com/wonsang/nonfractal % described in the paper: % https://www.ncbi.nlm.nih.gov/pmc/articles/PM...
e28fab23230c8fd5433f545c6ab4568bd06749414ab2b7bef443063b37c5606d
MATLAB
3,939
104
function checkmanifold(M) % Run a collection of tests on a manifold obtained from a manopt factory % % function checkmanifold(M) % % M should be a manifold structure obtained from a Manopt factory. This % tool runs a collection of tests on M to verify (to some extent) that M is % indeed a valid description of a Rieman...
00d512cd2adf0fc9db8ecfb41c950494fccd6942eac8339d0f8f406f27f6ea8e
MATLAB
3,941
94
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_update_fig_details(zef) if nargin == 0 zef = evalin('base','zef'); end zef.aux_field = cell(0); zef_j = 0; if isfield(zef,[zef.current_sensors '_points']) if size(eval(['ze...
457b42ee7ce7e5f1cbd19b6e4eb1d9b200c5acbd3933dd22c1f668a4897eb732
MATLAB
3,953
140
function A = zef_stiffness_matrix(nodes, tetrahedra, volume, tensor) % The stiffness matrix 𝐴 of a discretized scalar function 𝑢ₕ = ∑ᵢ𝑧ᵢψᵢ, with % each 𝑧ᵢ being a coordinate and ψᵢ a linear basis function, is defined by % % 𝐴[i,j] = ∫[Ω] ∇ψⱼ ⋅ (𝑇∇ψᵢ) d𝑉 , % % where Ω is the entire domain and d𝑉 is a finite v...
ec304423a0af0bb1756ba840753a2497d0683addeafbdf5c453da02ab26209e3
MATLAB
3,953
130
% Code used in Vidaurre et al. (2016) NeuroImage % % Detailed documentation and further examples can be found in: % https://github.com/OHBA-analysis/HMM-MAR % This pipeline must be adapted to your particular configuration of files. %%%%%%%%%%%%%%%%%%%%%%%%% %% SETUP THE MATLAB PATHS AND FILE NAMES mydir = '/home/diego...
b595460ff1e7c0d8f04d9a20d7e5aa1d3aaa3aa9b22087d97d0f8d47988542b2
MATLAB
3,955
103
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'exp_multires_dec')); zef.exp_multires_dec = []; end; if not(isfield(zef,'exp_multires_n_decompositions')); zef.exp_multires_n_decompositions = [20]; end; if not(isfield(zef,...
96ce1fe9307377c461bfbdc1f6db367bf091f7cb3c78a49f51a4d31f3c6e6f90
MATLAB
3,960
92
function cellPaths = getSubDirs(strMasterPath,intMaxDepth,cellExcludePathName) %getSubDirs Returns cell array of target directory and all its subfolders % Syntax: cellPaths = getSubDirs(strMasterPath,intMaxDepth,strExcludePathName) % %Default search depth (intMaxDepth) is set at [2] subfolders %Default folder ex...
48e251aa2ccf50bc1baad46321adb90c0e1331c40bd097c30a6d8c746bf35828
MATLAB
3,964
136
function [dblStartT,intFlagOut,vecTotErr] = SyncEvents(vecRefT,vecSignalT,boolUsePath,boolVerbose) %SyncEvents Syncs events %[dblStartT,intFlagOut,vecTotErr] = SyncEvents(vecRefT,vecSignalT,boolVerbose) % %inputs: %vecRefT: [1 x n] timestamp vector %vecSignalT: [1 x p] timestamp vector where p>n % %outputs: %v...
685f30449da5723cf855a2c61beeb72c7c1a1e67707ffccd0534d18494598303
MATLAB
3,966
89
function [P,Pi] = getMaskedTransProbMats (data,T,hmm,Masks,Gamma,Xi) % Obtain local Markov transitive probability matrices (LMTPM) for each of the % masks specified by the variable masks (see description of parameters). % The matrices include state persistency probabilities % (see getTransProbs.m to obtain just the t...
ef79dd67b743fd930b7343a09f24a728252943a5bb6c7f3957409f094663916a
MATLAB
3,967
96
%-------------------------------------------------------------------------------- % This demo is included in % Reverse engineering neural networks to characterise their cost functions % Takuya Isomura, Karl Friston % % Copyright (C) 2020 Takuya Isomura % (RIKEN Center for Brain Science) % % 2020-05-08 %---------------...
8977e332b215b062d24a8c307ea68eba5b740dcc487f2a31246ff1a0869020e6
MATLAB
3,974
103
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D parameters; if system_setting_index == 1 loop_constant = 2; else loop_constant = 1; end for k = 1 : loop_constant*n_r if exist(['./data_' int2str(folder_ind) '/point_' int2str(k) '...
db8aed854fb8d12770b878bedc2ff7ecdb724874f8156068e2ebe3275c71ba1a
MATLAB
3,974
128
function [FO,ntrials] = getFractionalOccupancy (Gamma,T,options,dim,alignment) % % Computes the fractional occupancy % - across trials if dim==1 (i.e. FO is time by no.states) % This is indicating how the fractional occupancy evolves as a function % of time across trials. % - across time if dim==2 (i.e. FO is no...
b4641f4c2bd99a5d174981f5b3d6df45b4c78698f0d57b71e67f3b314949820e
MATLAB
3,980
130
function [hmm,Gamma,vpath] = hmmdual(data,T,hmm,Gamma,Xi,residuals) % % Dual estimation of the HMM, first Gamma and then the HMM structure % % INPUTS: % % data observations - a struct with X (time series) and C (classes; optional) % T Number of time points for each time series % hmm hmm s...
ad8f1ed4de156cd6e7bff9f7fd080f010e33576a1733c15bf2ae14bd89f41fe3
MATLAB
3,990
87
%% 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...
212638ca0d814c5c44d6116b9e092af23a438d621a05bf41bf35a571c9379f44
MATLAB
3,999
94
function plot_pcn_scatter(app) udf = app.Stimulus_PCN.Value; cla(app.pattern_completion_scatter); app.pattern_completion_scatter.NextPlot='replacechildren'; % need num_original_neurons = size(app.params.data,2); pcn_neurons = app.pattern_completion_nodes{udf}; node_scores = app.node_scores(1:num_original_neurons, :)...
f4f9479060917085e75c01dab762162441359432f388233aaabff8b9b3334f6e
MATLAB
3,999
65
zef.LeadFieldProcessingTool.combineNew=true; zef.LeadFieldProcessingTool.combinePoints=zef.LeadFieldProcessingTool.app.NoisestartSpinner.Value:zef.LeadFieldProcessingTool.app.NoiseendSpinner.Value; zef.LeadFieldProcessingTool.combineData=[]; for zef_LeadFieldProcessingTool_index_combine=1:zef.LeadFieldProcessingTool.b...
5f35a1e5c19602a8f153a9a3545d6015e47eaafbfaaab09e84fb4752046d829a
MATLAB
4,004
155
function out = check_mar_spectra( data, T, order, sample_rate, to_plot ) %%function check_mar_spectra( data, T, order, sample_rate ) % % Function to explore the static fit for a MAR model as a sanity check % before fitting a HMM-MAR. % % % INPUT % % data observations; a matrix of dimension (nsamples x nchannel...
5947d713541458d3096b268c0b5528aca8b0628a3b9b9307db5a6cf2e7aafa4f
MATLAB
4,007
141
function lifetimes = getStateLifeTimes (Gamma,T,options,threshold,threshold_Gamma,do_concat) % Computes the state life times for the state time courses, in number of time points % % Gamma can be the probabilistic state time courses (time by states), % which can contain the probability of all states or a subset of th...
0086ee8a4cd6c8fc4ce1c2547c527b5952f3dfb181e49cf459190fe9ae4110f4
MATLAB
4,019
123
function spike_info = spike_overlap_info(... data, overlap, print_mode) % spike_information for overlap window % spike_info = spike_overlap_info(data, overlap) % % --- spike info for overlap window % spike_info.spike_num(n) = spike number of n-th overlap window % spike_info.spike_time{n} = spike onset ti...
6d3d355a5f9017ba6c6a0cdf5ef30e083cf42891db44876e461532cedc2b5679
MATLAB
4,019
79
function plot_ensemble_graph_structure_style_2(app) cla(app.ensemble_graph); app.ensemble_graph.NextPlot = 'replacechildren'; % 1 udf_id = app.StimulusEV.Value; % 1 rois = app.rois; num_rois = size(rois.xpix, 1); best_model = app.best_model; edge_mat = best_model.structure(1:length(rois.xpix), 1:length(rois.xpix)); ...
3df6ad626e9aa41f4773255b44702093a440cecbd5be536d37524d52fa0ffc74
MATLAB
4,024
76
%This is the startup script for dipole_app app. One must add this as launch %script to zeffiro_plugins file: %dipoleScan, inverse_tools, zef_dipole_start function zef = zef_dipole_window(zef) zef.dipole_app = dipole_app; appName='dipole_app'; zef.dipole_app.ZEFFIROInterfaceDipoleScanUIFigure.Name = 'ZEFFIRO Interface...
96e6e45c3b31f7308dbbe23fefe0e37e6ac371d8fe10498a708ccb4cd32df328
MATLAB
4,031
149
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 CSM method. % % Inputs: % % - self % % An instance of CSMInverter with the metho...
6a8035bfdf6b23ff0ff1e99436b7c48db38e4bc0547514881b4e6ceac806c334
MATLAB
4,033
124
function [e_group,e_subj] = explainedvar_PCA(data,T,options) % Performs preprocessing on the data, performs PCA, % and returns the explained variance for each PCA component. % This is useful to inspect the rank of the data and decide the number of % PC components to use in an informed way % % Author: Diego Vidaurre, ...
f7ac4cea2437f5c012863594714070dae270e3672aad6e33a7e52488171acb40
MATLAB
4,036
64
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.preconditioner = get(zef.h_as_opt_1,'Value'); zef.preconditioner_tolerance = str2num(get(zef.h_as_opt_2,'Value')); zef.smoothing_steps_surf = str2num(get(zef.h_as_opt_3,'Value')); zef.smoothing_ste...
c0f2b85db89dedc710370e5a09e5af71a011c65b6a6bad5ac58e1d6701292017
MATLAB
4,039
96
function [sortedLambdasCU, UcovarianceU, err] = covarianceUGaussianNet(C, discreteTime, maximumIterations, forcePowerSeriesForSymmetric, verbose, skipPowerSeriesConvergenceCheck) % % Computes the eigenvalues of C, and the projected covariance matrix (U^T \Omega U) for the given network. % % Inputs % - C - connectivity ...
2e5c2be6dcbc530874c2b28c4311f1a518b60a31bcb3261f4fcd648c209d0b84
MATLAB
4,045
105
function [IMAGE,LABEL]=fun_load_smnist_prep_backNoise_pos(train_num,valid_num,test_num,redim,max_Amp,pos_noise) %% parameter setting x_dim = 28; y_dim = 28; img_total_num = 60000; train_set_num = train_num; valid_set_num = valid_num; test_set_num = test_num; %% load image ...
346aaef42ee1340998f2f8c3310eae696b2767ccc4c1d4a52f1886751ab3541c
MATLAB
4,060
138
function intervals = getStateIntervalTimes (Gamma,T,options,threshold,threshold_Gamma,do_concat) % Computes the interval times for the state time courses % % Gamma can be the probabilistic state time courses (time by states), % which can contain the probability of all states or a subset of them, % or the Viterbi...
85a740dbc2243c718e0123af646d05f8ced2238816bd65c8551635d55328dc9e
MATLAB
4,060
118
function gradfun = approxgradientFD(problem, options) % Gradient approx. fnctn handle based on finite differences of the cost. % % function gradfun = approxgradientFD(problem) % function gradfun = approxgradientFD(problem, options) % % Input: % % A Manopt problem structure (already containing the manifold and enough % ...
2226115739f16ac23acb392824bf751fc8603e7cf5574ec36860e2bdf4b43c68
MATLAB
4,067
124
function zef_ES_plot_barplot(varargin) switch nargin case {0,1} if nargin == 0 zef = evalin('base','zef'); warning('ZI: No zef were called as an input argument.') else zef = varargin{1}; end try [sr, sc] = zef_ES_objective_function(zef)...
70df20004bd9f9e0bb25e599ddd066e4a6378ec354b99007244c2c6d0faffffd
MATLAB
4,076
140
function varargout = ghostscript(cmd) %GHOSTSCRIPT Calls a local GhostScript executable with the input command % % Example: % [status result] = ghostscript(cmd) % % Attempts to locate a ghostscript executable, finally asking the user to % specify the directory ghostcript was installed into. The resulting path % is s...
b061fd58fbc92ce290dd73fa5fefd0467a179128d330d79a74b1fe61cc21b091
MATLAB
4,088
84
function [inmat_s_rm_sp_rlr,inmat_s_rm,inmat_s_rm_sp_rlr_subj,GEN_subj]=bsliang_norm_lr_out(TDATA,inmat,LR_ind,GEN_ind,outTag,is_rmsd,is_norm) % is_rmsd: ÊÇ·ñÈ¥³ý3SD % ±ê×¼»¯£¨¡÷TMS=(rTMS-Sham)/Sham£©£¬·Ö×óÓÒÄÔ£¬Êä³öSPSS¸ñʽ % inmat£º block(4)*turn(3)*subj(197) % LR_ind£º×óÓÒÄÔindex % outTag£ºÊä³öÓÃÓÚSPSS·Ö...
005b1bcb1f5968ec40c922a7a58ed2ed456c417e7dfbe1826c995b027793660b
MATLAB
4,091
145
function [pdc, dtf] = subrutpdc(S,numIterations,tol) % obtains approximated pdc and dc from cross-spectral information Nf = size(S,1); N = size(S,2); % Wilson factorization H = wilsonfact(permute(S,[2 3 1]),numIterations,tol); % Computing the PDC G = zeros(size(H)); pdc = zeros(size(H)); dtf = zeros(size(H)); for f=1:...
a09d929bd46c3889b164896c2e583d6313910b4f5f3343e2e65c9c8e57923d66
MATLAB
4,098
120
function varargout = spk_autosigma(varargin) % function psig = spk_autosigma('par'[,presetflag]) % function sigmaest = spk_autosigma(calcium,dt[,psig|presetflag]) %--- % Estimation of the level of noise in the calcium signal. % % Input: % - calcium numerical vector or cell array thereof - calcium signal(s) % - dt ...
753f7f7dc26a44986a214e7289373477d47fd56f4fdef5f11f89322d4a75c42b
MATLAB
4,105
101
function creating_permutations(varargin) % performs permutation test to find voxels whose correlation to a good % outcome is statistically significant p = inputParser; pathExists = @(x) exist(x,'dir'); positiveInteger = @(x) (mod(x,1)==0 & x >0 ); addRequired(p,'assessmentFolder', path...
48379132d3042bde7661fed7936739d303002e0e18fdfc3eeddc68cbd7f51d82
MATLAB
4,127
76
zef = zef_update_transform(zef); for zef_i = 1 : length(zef.compartment_tags) if eval(['zef.' zef.compartment_tags{zef_i} '_on']) if eval(['isfield(zef,''' zef.compartment_tags{zef_i} '_points_original_surface_mesh'')']) eval(['zef.' zef.compartment_tags{zef_i} '_points' '= zef.' zef.compartme...
1c93cef2a7ded24678a2594a7b3641c17c68edd75e6a40c1feccf243436e904e
MATLAB
4,130
93
function atlas_surfaces = zef_bst_get_atlas_surfaces(zef,atlas_struct,n_inflation_steps,transform_cell,compartment_type, volume_extension_vec) if nargin < 4 transform_cell = cell(0); end if nargin < 5 compartment_type = ''; end if nargin < 6 volume_extension_vec = zeros(size(atlas_struct.Labels,1),1); end atlas_surface...
0e4e55d1036691f50f7533c08be0c9e95bcfc414e62fb85e80449f59a8008f30
MATLAB
4,140
139
function dblError = ETP_FitWrapper(vecX,boolRescale) %% get labels global ETP_sLabels; global sETP; global ETP_matAllIm; global ETP_matAllImOrig; global ETP_Fit; global sFigETP; if nargin < 2 || isempty(boolRescale) boolRescale = true; end %% get inputs if ~boolRescale vecX = vecX./ETP_Fit.vecOrigX; ...
2821f9883c60586fd961b1bdf52e61d7592fc36df126e57326a837bc0c3b5334
MATLAB
4,150
111
%% script to find rcp and calculate intensity over rcps % this version of the script relies on knowing the thresholds that you want % to set. this can easily be figured out with using the original version of % the script and testing it on some channel images. there is also work %being done on trying to best optimiz...
b06294b249ae6c09530168c491dc8e33c36909e8e16abd11fe6566504ae40aee
MATLAB
4,152
125
function ETP_DetectEdit(hObject,eventdata,strParam) %get globals global sETP; global sFigETP; %% ensure input conforms to format sHandles = sFigETP.sHandles; if exist('strParam','var') dblNewVal = str2double(sFigETP.sHandles.(strParam).String); if isempty(dblNewVal) || ~isnumeric(dblNewVal) dblNewVal =...
3d7faec3ab07b987b73f040ea3894259be328ff058550b138146d96d631d8ac1
MATLAB
4,153
108
n_intervals = 15; x_scale = 1.2; ecc_min = 0; n_s_p_1 = sqrt(sum(s_p_1.^2,2)); n_s_p_1 = repmat(n_s_p_1',3,1); n_s_p_1 = n_s_p_1(:); n_s_p_1 = n_s_p_1/max(n_s_p_1(:)); n_s_p_2 = sqrt(sum(s_p_2.^2,2)); n_s_p_2 = repmat(n_s_p_2',3,1); n_s_p_2 = n_s_p_2(:); n_s_p_2 = n_s_p_2/max(n_s_p_2(:)); n_s_p_3 = sqrt(sum(s_p_3.^...
eb328011432076b63b206dbede0707c13a0cdcac509519cc3531791ccf3f8d01
MATLAB
4,168
129
function [UI,Q] = admUIg(Psy, Psz, conf) % admUIg computes the Unique Information for the marginals P_SY and P_SZ % Inputs: Psy is a table of size S x Y and Psz is a table of size S x Z % Outputs: UI is the unique information (natural logarithm) and Q is the % minimizing distribution, which is a table of size S x Y x Z...
208eb3ab056f6270ef44d009a75ad3e7fddbc680446be8b63ea18e66b38ac7f9
MATLAB
4,169
118
function [samples,ts0,Fs,info] = load_csc(filename,mode,par) % load_csc imports Neuralynx *.ncs files into Matlab %% examples: % [csc,ts,Fs] = load_csc('csc4.Ncs','all'); % [csc,ts,Fs,info] = load_csc('E:\LA04-03\CSC4.Ncs','ts',[4500e6 6500e6]); % %% outputs: % samples: row vector of samples (uVolts) %...
2e6ea754eccb9f946c3adbff3f1912a9d58a4213c1a09bb796795ba7d6156ca4
MATLAB
4,174
107
n_intervals = 5; x_scale = 1.5; ecc_min = 0.95; n_s_p_1 = sqrt(sum(s_p_1.^2,2)); n_s_p_1 = repmat(n_s_p_1',3,1); n_s_p_1 = n_s_p_1(:); n_s_p_1 = n_s_p_1/max(n_s_p_1(:)); n_s_p_2 = sqrt(sum(s_p_2.^2,2)); n_s_p_2 = repmat(n_s_p_2',3,1); n_s_p_2 = n_s_p_2(:); n_s_p_2 = n_s_p_2/max(n_s_p_2(:)); n_s_p_3 = sqrt(sum(s_p_3....
652207a7b259428efef58db6f513e80de53abdf75dd608d933b0095b12cd262c
MATLAB
4,175
137
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef_switch_color('s_on','pushbutton16','s_points'); if zef.imaging_method==2 zef_switch_color('s_on','pushbutton17','s_directions'); end zef_switch_color('w_on','pushbutton1','w_points'); zef_col...
163b8cab69a7e58068ac3782f7ad317acab7e6f0154da3e5310f5440a4bae59d
MATLAB
4,179
188
%% %% %get the voxel to ras matrix with freeSurfer from orig.mri %% voxel-to-ras T=[-0.9995 -0.0280 -0.0112 133.3754 -0.0301 0.9302 0.3657 -142.3206 -0.0002 -0.3659 0.9306 -40.3920 0.0000 0.0000 0.0000 1.0000]; %% voxel-to-ras modified Trot=[-0.9995 -0.0280 -0.0112 0 -0.03...
643b35ffacff6a59ea99a386bcbf33ce201d4e714d9565a6bc3ba8f375f4ced6
MATLAB
4,184
109
function analytes = analyzeROIs2( ROIdata, roll, minwidth, ... Pfactor, prcthresh ) %fdataIIR = filter(iir,data); %fdataIIRff = filtfilt(iir,data); % P factor factor of 10th percentile rolling SD for prominence threshold % prcthresh=10; nFiles = size( ROIdata, 2 ); for iFile = 1 : nFiles name = ROIdata(iFile)...
9742f857cd1c377a268256f3097feaf30321bfc839a4c0c46f4edc032aaa9fde
MATLAB
4,198
69
zef.LeadFieldProcessingTool.combineNew=true; zef.LeadFieldProcessingTool.combinePoints=zef.LeadFieldProcessingTool.app.NoisestartSpinner.Value:zef.LeadFieldProcessingTool.app.NoiseendSpinner.Value; zef.LeadFieldProcessingTool.combineData=[]; for zef_LeadFieldProcessingTool_index_combine=1:zef.LeadFieldProcessingTool.b...
bd41dc5ee6686264a8ec855cbb3df3511bc99f6d46fad0ae7f76294c97f4d94a
MATLAB
4,227
121
function sFiles = ETO_CompileVideoLibrary(strMasterPath,cellExt,ptrText) %% compile library sFiles = []; for intExt=1:numel(cellExt) filelist = dir(fullfile(strMasterPath, '**',['*.' cellExt{intExt}])); sFiles = [sFiles,filelist]; end %remove mini vids if ~all(contains({sFiles.name},'MiniVid')) sFiles(con...
c387bd8acf2991e0c9cc6646611aa401b1743a7ba2d565117a7d6537238fe497
MATLAB
4,234
149
function [W Ms] = bgwedge(M,numiter,numiter2) % % Weighted Exhaustive Diagonalization using Gauss itEration (WEDGE) % with weights selected in order to minimize the Pham's log-likelihood % criterion % % Coded by Petr Tichavsky, March 2008. Updated July 2008. Revised June 2009. % % Please cite % % P. Tichavsky, A. Yere...
38b3d848362aa908e723cc2c6decd5587e837a43af354b24a359d1406065168e
MATLAB
4,241
105
% Compute <sigma^2>, it's low order approximations, and leading eigenvalues % for continuous-time Ornstein-Uhelnback process through a small-world % transition. % % This recreates the plots in Figure 4 of our paper. % %% Linear Sync Toolkit (linsync) % Copyright (C) 2023 Joseph T. Lizier % Distributed under GNU General...
515a7791ba3725ada7c733a7fe15899e08bf751edcd26e299f2cb7cda33ea263
MATLAB
4,250
116
function [Gamma,fehist] = hmmmar_init(data,T,options,Sind) % % Initialise the hidden Markov chain using HMM-MAR % % INPUT % data observations, a struct with X (time series) and C (classes, optional) % T length of observation sequence % options, structure with the training options % Sind % % OUTPUT % Gam...
a4277cf6247db60a2bfdd8efc39844b64d25078ad7f12042ca9ee77e6040d3cf
MATLAB
4,262
202
load('postprandial_somnolence_fEI_ratio_alpha.mat') load('EEG') new2old_index=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 29 20]; %EEG = pop...
860cafd34ac59aa599f6b9f176969be6f84c2063c684bc31c0ae598003bca16b
MATLAB
4,270
91
if isfield(zef,'h_zeffiro_window_main') if isvalid(zef.h_zeffiro_window_main) delete(zef.h_zeffiro_window_main) end end set(groot,'defaultFigureVisible','off') zef_data = zef_segmentation_tool_app_exported; %zef_data.h_zeffiro_window_main.Visible = zef.use_display; set(groot,'defaultFigureVisible','on...
0dc594a0ed8b636d60b5b32d19407a5829bafa738a6bb7ae89085ca04ef23984
MATLAB
4,272
70
for zef_i = 1 : length(zef.compartment_tags) if evalin('base',['zef.' zef.compartment_tags{zef_i} '_on']) if evalin('base',['isfield(zef,''' zef.compartment_tags{zef_i} '_points_original_surface_mesh'')']) evalin('base',['zef.' zef.compartment_tags{zef_i} '_points' '= zef.' zef.compartment_tags{...
b0cc3f06586184dd5d8c54d29ba069fd5499a65af7ac04a03940644ea4e5c752
MATLAB
4,273
114
function [responseY,responseR,Gamma,explained_var] = ... hmmpred(X,T,hmm,Gamma,residuals,actstates,grouping) % % Predictive distribution of the response and error on potentially unseen data % useful for cross-validation routines; that is, this function returns the % mean predicted signal according to the HMM observ...
369cf1c4c507e7997e30d97d44b1369318f1fb9abbaf502a21fc67418312c051
MATLAB
4,275
122
function [zef] = zef_KF(zef, q_value) % Optimal q_value as parameter %% Initial parameters snr_val = zef.inv_snr; pm_val = zef.inv_prior_over_measurement_db; amplitude_db = zef.inv_amplitude_db; pm_val = pm_val - amplitude_db; std_lhood = 10^(-snr_val/20); sampling_freq = zef.inv_sampling_frequency; high_pass = zef.inv...
108e82f426440abcd91e55ff58cd1c74b02e2841d749235aa9ecc2802ca2c379
MATLAB
4,286
120
function zef_3D_plot_specs(h) %Coordinate system's visualization parameters head2axes_ratio = 1.0255; %percentual empty space between surface and coordinate limits tick_number_limit = 8; %maximum number of ticks on visualization %compartment_tags = evalin('base','zef.compartment_tags'); compartment_tags = {'d1'...