sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1cfb9238c356586b34bc4cda5c630e10afee7961fa50f2af03bbc1797ca4cf7c
MATLAB
3,205
70
function [matCounts,matValMeans,matValSDs,cellVals,cellIDs] = makeBins2(vecValsX,vecValsY,vecValsZ,vecEdgesX,vecEdgesY) %makeBins2 Builds 2D binned matrix of vector Z by edges in vectors X and Y % syntax: [matCounts,matValMeans,matValSDs,cellVals,cellIDs] = ... % makeBins2(vecValsX,vecValsY,vecValsZ,vecEdgesX,v...
73e8bad4694e574e3d230d4e1ab107be9586fba2a58daf118a2b883bfeb5060b
MATLAB
3,211
114
function zef_nse_plot_epoched(zef, nse_field, plot_vec, y_label, plot_vec_ref) h_axes = zef.h_axes1; axes(h_axes); perform_shift = true; if nargin < 5 plot_vec_ref = []; elseif isempty(plot_vec_ref) perform_shift = false; end plot_colors = {'c', 'c'}; plot_quantiles = [ 0.0 0.5 1]; plot_linestyle = {'--','-'...
f597d7ea28507922fc720470d5cd7d73c2f76239ac8d68c39a827a6dce0e32e4
MATLAB
3,211
69
%-------------------------------------------------------------------------------- % compute_baseline_excitability.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...
eb32211232fdf8a7ea27040a0c80ea9d02317632d48ced188d770d6a905d8329
MATLAB
3,213
88
ROI_radius = 10; %radius of the spherical region of interest, initial 2 cm diameter load('AuditorySlowEP.mat') measurements = measurements(1:1); measurements{1} = empty; activity = nan(size(positions,1),zef.number_of_frames,length(measurements)); K = size(positions,1); %for q_value = logspace(-3,-13,11) for k = 1...
6e89d24512529afaffa5c175624f0361ad0801c098dd44b8d571cde7615dbcf3
MATLAB
3,214
95
function [xpeak,peaks,peak2sample] = cluster_get_gfppeaks(obj,nsample) % Extract GFP peaks of the data. % % Useage: % Inputs: % - x: M/EEG data. TxP, where T is the number of time points and P is the % number of channels. % Outputs: % - xpk: Maps at peaks. NxP, where N is the number of peak maps. %...
2435961d0796834b8e689461acca4893fd951b61c91636f9176cfc7fe9d3e50a
MATLAB
3,215
102
%% jansen_rit_445.m % Implements system (4.45) from Cook et al. (2022) / arXiv:2103.10554: % % Vp'' = A*a*f(Vpe - Vpi) - 2*a*Vp' - a^2*Vp % Vpe'' = A*a*(cp_e*f(nu_e_p*Vp) + qp_e(t)) - 2*a*Vpe' - a^2*Vpe % Vpi'' = B*b*(cp_i*f(nu_i_p*Vp)) - 2*b*Vpi' - b^2*Vpi % % State choice: x = ...
b081e5515a8c626fd59422039da4e7d8c78b4272b29783b972133e035b977139
MATLAB
3,215
107
function zeffiro_downloader( kwargs ) % % zeffiro_downloader ( kwargs ) % % This function downloads Zeffiro Interface in a given folder and sets it % to be a local repository of the remote origin at % % https://github.com/sampsapursiainen/zeffiro_interface % % After downloading, the local repository will be updated i...
9f31641d0008300b16aaa0d071882349222c890333bd8a8b6f8c92051405c973
MATLAB
3,225
98
function bsliang_rawplot_conds(IDraw_G,subj_ind) % subj_ind: Ñ¡Ôñ±»ÊԵıàºÅ % ¸ù¾ÝÌõ¼þ»­³örawÇúÏßµÄͼ£¨¾ùÖµºÍ±ê×¼Î󣩣¬Ö±¹Û½øÐбȽϣ¬Í¬Ê±Ò²ÊÇΪÁËÑé֤ģÐÍÄâºÏµÄ½á¹û % IDraw_G % step(5)*block(4)*turn(3)*subjs % turn£º % stimSITE NUMBER % Left iTBS 1 % Left cTBS 2 % Right iTBS 3 % Right cT...
b771aec5fa7f0c1837daf72c96e3b75993d199dcd1527c8879f02e8c8220e16a
MATLAB
3,229
138
function [Model] = estimate_shape_update(... data, parm, Model) % training shape parameter % % data.y = observed spike data with noise % data.t = sample time [sec] % data.fs = sampling rate for observed data [Hz] % % parm.fs = 100; % sampling rate for observed data [Hz] % parm.fs_est = 10...
ea8180c622cf750bc5402d4d9653e835b0ab2bf24a1d047fac27501a23f65a71
MATLAB
3,236
68
%Copyright © 2018- Joonas Lahtinen, Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface %Script for plotting dipoles that SESAME estimates. if size(zef.SESAME_time_serie,2) == 1 d_est = zef.SESAME_time_serie{1}.estimated_dipoles; zef.inv_rec_source = repmat(zef....
929bc4f9f6988368d623021c6e0c5911cdcda40a7084cda611f6573173e553c7
MATLAB
3,238
73
function [Stop] = plot_optimization_model(plot_axis, results, state) Stop = false; % for compatibility reasons switch state case 'initial' cla(plot_axis); plot_axis.Color=[0.94 0.94 0.94]; plot_axis.XTickMode='auto'; plot_axis.YTickMode='auto'; plot_axis.ZTickMode='auto'; ...
175a572d937afd69580db8f9a4e89589da3aeed73daea1c5aabe798a24820d43
MATLAB
3,242
115
function [X,options] = simmar(data,T,Tnew,options) % % Simulate data from one single MAR state, which parameters will be % estimated from the data % % INPUTS: % % data observations, a matrix containing the time series % T Number of time points for each time series % Tnew ...
976df7a60a701cff72ccdf7cd4b9569468fdf27009284666a2298d2aa552c958
MATLAB
3,245
145
function [] = func_double_arm() rng('shuffle') time_today = datestr(now, 'mmddyyyy'); dt=0.01; input_infor={'xy', 'qdt'}; % in-out dimension dim_in=length(input_infor) * 4; dim_out=2; % double robot arm properties m1=1;m2=1; l1=0.5;l2=0.5; lc1=0.25;lc2=0.25; I1=0.03;I2=0.03; properties=[m1, m2, l1, l2, lc1, lc2, I...
cdaae2589761804b3ea20325a6083d555a0d9493827a1fe06d0d84eee7e00231
MATLAB
3,245
110
function vec = zef_ES_table(data_aux) %% Pre-allocate table and properties var_names = {... 'Residual', ... 'Maximum current', ... 'Sparsity (2-norm/1-norm) ratio',... 'Focused current density', ... 'Nuisance current density', ... 'Angle error', ... 'Relative...
5eb5124ac2db903394d06cb3bbb584ea0783bf58695ef436fc0d4e18e7e0c5c3
MATLAB
3,247
89
function [optN, C, N] = sshist(x,N) % [optN, C, N] = sshist(x,N) % % Function `sshist' returns the optimal number of bins in a histogram % used for density estimation. % Optimization principle is to minimize expected L2 loss function between % the histogram and an unknown underlying density function. % An assump...
2fa5bd8f96b0199ee7a1b498cc351085bb771a17511cab4b6a605810c8e8cdc8
MATLAB
3,251
65
function [] = convert_h5_voxel_based_structural_connectivity_to_mat(subject,dataset,h5_file_ID) % The purpose of this script is to look into the sub-*_edge_weights_n*.h5 % files generated for each subject (i.e., the voxel-based structural % connectivity matrices) and generate the .mat files corresponding to the % varia...
94474a2df35ad83a9d0932dd7e0f2bf0a66c0608dddc4fee29c6c2ab0ed69af4
MATLAB
3,252
72
%-------------------------------------------------------------------------------- % adder_init.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 (...
c951ec391135d50040f949e5d4258fb9a2398b77ecf65222b602f14865cb95b8
MATLAB
3,255
90
function gamma = mymcs_gamma_yao2001 ( headmodel, order ) % Returns the Gamma series expansion for EEG leadfields. % % Use as: % Gamma = mymcs_gamma ( headmodel, order ); % % where: % headmodel FieldTrip concentric spheres definition: % headmodel.r Radius of the spheres. % headmodel.cond Conduct...
a3af1045685795f784037153a216a89a755c2eef8cfcd7e7fdb8f948a8b06d89
MATLAB
3,259
88
function bsliang_saveDDMform(TDATA,group_indx,save_path) % ¶ÁÈ¡ºÍת»»Êý¾Ýµ½´¦ÀíÊý¾ÝµÄ¸ñʽ % ================================ % DATA structure: % turn£º % stimSITE NUMBER % Left iTBS 1 % Left cTBS 2 % Right iTBS 3 % Right cTBS 4 % Sham ...
a1cf825a2fce3a03704f6b49147b667fba807f333f59d161173e89fa6c790854
MATLAB
3,262
118
function [handle,matX_final,matY_final,matZ_final,matC] = plotTube3D(vecX,vecY,vecZ,vecR,vecC,intPointsPerRadius,boolConnectEnds) %plotTube3D Plots 3D tube with specified color-range and width %Syntax: handle = plotTube3D(vecX,vecY,vecZ,vecR,vecC,intPointsPerRadius) %plot 3D tube %{ vecX = [-1 -0.8 -0.3 -0.1 0.0...
706b8cf8208172a9dbeae52426eef115c75ad717d4d8b2956efe248d7d6873e6
MATLAB
3,263
67
% The purpose of this script is to concatenate the thresholded 1000x1 % structure-function coupling .mat files into one file, for each subject % Requirements: % 1. The script extract_voxel_based_structure_function_coupling.m has been run. % % Output: % One .mat file per subject containing the subject's voxel-based st...
50216852808e39d783df8b90542fd98d23e8107bca56d98d2d7b5ffd6f247a1e
MATLAB
3,267
70
function [inmat_s_rm_sp_rlr,inmat_s_rm]=bsliang_tmssham_lr_out(TDATA,inmat,LR_ind,outTag,is_rmsd) % is_rmsd: ÊÇ·ñÈ¥³ý3SD % ±ê×¼»¯£¨¡÷TMS=(rTMS-Sham)/Sham£©£¬·Ö×óÓÒÄÔ£¬Êä³öSPSS¸ñʽ % inmat£º block(4)*turn(3)*subj(197) % LR_ind£º×óÓÒÄÔindex % outTag£ºÊä³öÓÃÓÚSPSS·ÖÎöµÄmatÎļþÃû % Êä³ö£ºinmat_s_rm_sp_rlr...
79263b5b5c045b3ad7bd4e11b04524a43137dc3417fed3a3523c266ea65de4f1
MATLAB
3,272
111
%% Copyright © 2025- Joonas Lahtinen classdef CSMInverter < inverse.CommonInverseParameters & handle % % CSMInverter % % A class which defines the properties needed by the Classical Sparse inversion methods (CSM), % and the method itself. % The inverter consist four inversion methods: % - d...
68a2dabd765bfc65b45ce7b02b5198b93cf771abcf039d0f13be823ee835a325
MATLAB
3,278
95
function [matW, dblMSE, intRankT, sSuppOut] = doRdRankReg(matX, matY, intRank) %doRdRankReg Performed reduced rank multivariate regression. % [matW, dblMSE, intRankT, sSuppOut] = doRdRankReg(matX, matY, intRank) % Finds the reduced rank regression using a full rank assumption. X % is a n-by-r matrix, and Y is...
6d1290ea53b43935762cc378770ef72dd691b5783f656cb26d7a1747ea9ad03d
MATLAB
3,283
74
function [performance] = calculate_performance(log_likelihood_by_frame, node, true_labels, data_index) % prune ll log_likelihood = log_likelihood_by_frame(node, data_index); % prune labels true_labels = true_labels(data_index); [fpr, tpr, threshold, AUC, operating_point] = perfcurve(true_labels,log_likelihood,1); [tr...
b6d48b5e20bcd214c4a73cdab219b9c5a0ed7cf43e710435dfc9def6fa237a94
MATLAB
3,296
97
clc clear close all % Defines the paramaters for the simulation. order = 100; nrep = 1e6; % Generates the standard head model. headmodel = []; headmodel.type = 'concentricspheres'; headmodel.o = [ 0.0000 0.0000 0.0000 ]; headmodel.r = [ 0.8700 0.9200 1.0000 ]; headmodel.cond = [ 1.0...
a84805c2834c50acc13cbaaee7fff78450d2f5832d361986a71b1eab9f0e4f17
MATLAB
3,297
89
zef.show_contour = zef.h_show_contour.Value; zef.show_contour_text = zef.h_show_contour_text.Value; zef.contour_set_text = zef.h_contour_set_text.Value; zef.contour_set = str2num(zef.contour_set_text); zef.attach_electrodes = zef.h_checkbox14.Value; zef.axes_visible = zef.h_checkbox15.Value; zef.azimuth = zef.h_edit80....
3716183152c203705cf72d8976a7431a145f6a58c4b8dded7756b4ecb02bf9c9
MATLAB
3,306
114
function [UI,Q] = admUI(Psy, Psz) %#codegen % This the simplest version of the admUI algorithm with a very basic stopping criteria % that works well in practice. This file is used to generate the MEX for the tests in Fig. 2. % In contrast, the function admUIg supports a more rigorous set of stopping criterias for...
240ad910f0207662d379c03285041b3b9d309935d9369383e46b0bce79db0fee
MATLAB
3,307
140
function plt = networks_plot(nets,layout,varargin) if nargin<2 layout = [] ; end % ensure plotting functions are on path mspath = microstate.functions.toolbox_path ; % Decide layout for plot m = 1 ; n = 1 ; k = numel(nets) ; while m*n < k n=n+1 ; if m*n < k m=m+1 ; end end % Check for ba...
d6b42c5ba9fd74c69a4098fabdec3fb8ef1bbfcf0e971388da90552eca86a1c2
MATLAB
3,310
91
function [dblStartHiDefT,dblUserStartT,dblFinalStartHiDefT,dblUserFinalT] = askUserForSyncTimes(vecPupilSyncLum,vecPupilTime,intBlock) %askUserForSyncTimes Request user input to synchronize on/offsets % [dblStartHiDefT,dblUserStartT,dblFinalStartHiDefT,dblUserFinalT] = askUserForSyncTimes(vecPupilSyncLum,vecPupilTi...
6dfb68506b51bb1332ca3f12d5214e6b476c4e41c8fb9105a36fd0802203c502
MATLAB
3,313
120
function [post_info, spike_info, ypred] = ... evaluate_performance( ... data, Model, parm, post_sw) % evaluate_performance % % [post_info, spike_info, ypred] = ... % evaluate_performance(data, Model, parm) % % post_info.spike_num(n) = estimated spike number % of n-th overlap...
8260778ff274e07461dcc4337b959b8f45909cf10670fb343cf63cdc5f206389
MATLAB
3,317
85
function obj = simulate_seq_markov(obj,varargin) % Simulate a Markov chain microstate sequence % check inputs options = microstate.functions.make_options(varargin) ; % default options defaults = {'Nsample',[] ; 'PriorProb',[]} ; options = microstate.functions.add_opti...
a2b6b78dd3f86538551ec8c1d7d066294e10c23bd511a5aa03cbd3ce6cd2c56c
MATLAB
3,320
97
function vecDistance = strdist(s1,s2,varargin) %strdist Finds the Edit Distance between strings s1 and s2. The Edit Distance % is defined as the minimum number of single-character edit operations % (deletions, insertions, and/or replacements) that would convert % s1 into s2 or vice-versa. Us...
cf321a5f8c03bf5424ef6d39ef8ec1b516256ca689a152a71498cb3865cdaabc
MATLAB
3,320
159
function threshold_max = test_threshold(... data, Model, spike_mode, plot_mode) % if nargin < 3, spike_mode = 2; end; if nargin < 4, plot_mode = 0; end; print_mode = 0; % test_threshold % ---- Extract spike window changing threshold % Model tau = Model.tau; a = Model.a; % spike waveform amplitud...
d5367402df2c6a5302e146760cf518ad5b467c8742b5a08a74505aebbf02599a
MATLAB
3,330
55
%Copyright © 2018- Joonas Lahtinen, Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.SESAME_App = SESAME_App; zef_init_SESAME; %Substitute values from zef to the app zef_fields = fields(zef); for zef_i = 1:length(zef_fields) if isprop(zef.SESAME_App,strcat('h_'...
d5a88b8bed3c6489eec4bb2e11779c74731946b39704f8eb110b540634626646
MATLAB
3,333
82
% function to load base and roi info from user selected complete.mat file function S = loadComplete3( complete ) % complete is the full path to the file % converts to single! % does not completely load complete! see specific variables loaded below % [file,path] = uigetfile('*complete.mat'); % if isequal(file,0...
ca7514f8aa6539aae861c5f50298bce0b0067ad298658f3c8e6e56603ea6ec83
MATLAB
3,338
70
%reconstructionTool_start zef.reconstructionTool.app = zef_reconstructionTool_app; if ~isfield(zef.reconstructionTool, 'current') zef.reconstructionTool.current=[]; end %set initial values if ~isfield(zef, 'reconstruction_information') zef.reconstruction_information=[]; end if ~isfield(zef.reconstructionT...
a8c617ec2e391c7ccd0eec9d16ab7d61b18b2824bc27cb8307362f21c76f6c0d
MATLAB
3,339
124
function [post_info, spike_info, ypred] = ... evaluate_performance_train( ... data, Model, parm, post_sw) % evaluate_performance % % [post_info, spike_info, ypred] = ... % evaluate_performance(data, Model, parm) % % post_info.spike_num(n) = estimated spike number % of n-th ov...
cee345267474bdf08bf7883bf7f68d9fd62ecbd5d2eae3f36c92a35f58505c06
MATLAB
3,340
100
function [ eightPairs, vprofs ] = ringCoordFromXY2( im, X0, Y0, r ) % returns 8 pairs of coordinates based on the % Full Width Half delta (=max-min) of fluorescence peak % roughly centered on the coordinates R0,C0 % : im is image % : R0, C0 row and column coords from mouse click % note that something is not ...
5a22e1dbb0aa53573bf9dd5070419f375e44519f9e2fbea8351a9e88365967e5
MATLAB
3,343
83
%% 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...
2bf0c029266ed953170e9e98361ffa81c80e12c967a04800ef985dd6e2bd67d5
MATLAB
3,346
81
% lognormal fit to data function [log_plot, gof_stats, coeff, logfit, xa, yaf] = logfitting(spinea, binsize, mulow, silow, muup, siup) % fit all spines from all cells into lognormal fit % start_analysis = min(spinea); start_analysis = 0.001; end_analysis = max(spinea); % the endpoint...
67621123a490c4cb0ed3a4fa1860db642e7c93e94a2319e6e7f1991ae08d1f97
MATLAB
3,346
82
function reading_permutations(varargin) p = inputParser; pathExists = @(x) exist(x,'dir'); positiveInteger = @(x) (mod(x,1)==0 & x >0 ); positiveFloatLessOne = @(x) (x>0 & x<1 & isfloat(x)); addRequired(p,'n_iterations', positiveInteger); addRequired(p, 'alpha_val', positiveFloatLessOne); ...
0011ce6bbd1dc5fda1e168192062bb1f78f8e8f283d5eb992ae921ed8e4c11f4
MATLAB
3,349
83
function obj = stats_hurst(obj) % Calculate Hurst exponent of microstate sequences % Check inputs if isempty(obj.label) error('To calculation microstate coverage, property label is required') end %% Convert microstate sequence to random walk % Assign states values of +1, -...
a9fda604ae1caa1f12f003d3e1c540fcecdfe077291f5884d563aa9b66f00e26
MATLAB
3,364
108
function s = structmerge(s,varargin) % function s = structmerge(s,s1[,'skip|strict'][,'recursive'][,'type'][,'i']) %--- % set or replace values in s from those in s1, where s and s1 are % structures of the same size % - if 'skip', or 'strict' flag is specified: does not add new field in % structure s (generates error...
5e3ae5f405429b3dc250e962587a4fdf8ae6f115c86e0781fa8d631facbd0538
MATLAB
3,371
78
%% 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...
ed461974c2ac84fd28de37b53d083379e6ad1fdf2a9993ef7dd178cd92713e72
MATLAB
3,373
92
function [vecPredY_CV,cellMeanCoeffs,matX,cellFunctions,cellFoldCoeffs,cellFoldTestObs] = gnmkfold(intFoldK,vecRepetitionIdx,matX,vecY,cellCoeffs0,varargin) %gnmkfold Uses K-fold cross-validation on gnmfit() % %[vecPredY_CV,cellMeanCoeffs,matOutX,cellFunctions,cellFoldCoeffs,cellFoldTestObs] = % gnmkfold(intFoldK,...
c047f91dccb93f29e492a92dfb3a5b7c4edc8ba59f08cc579a8d7e0560dfbdd7
MATLAB
3,374
88
function exp_struct = if2_load_exp_timing(slice_id) %if2_load_exp_timing Load exp timing from the authoritative exp_timing spreadsheet. % % exp_struct = if2_load_exp_timing(slice_id) % % Reads the exp_timing sheet from indiegroups_db4.xlsx (via if2_paths), % finds the row matching experiment_id == slice_id, and ...
938b2feef74c6f5861c5e28fb30b2d469da7d3ff2b36c92d414cd61bb21676f2
MATLAB
3,376
78
function [LWaveform,RWaveform] = ... MakeGaussNoiseBand(fLow, fHigh, dur, Fsample, Chan, Rho, ITD, IPD, RandSeed,ContraChan) % MAKEGAUSSNOISEBAND - generates gaussian bandpass noise % inputs: % fLow: lowest frequency in passband (in Hz) % fHigh: highest frequency in passband (in Hz) % dur: duration (in millise...
7124fecba45d0ab9a06066b38a7309d890a41f4dea10684efb23f6260946b8a9
MATLAB
3,377
139
function dblH = getEntropy( input ) %UNTITLED Summary of this function goes here % Detailed explanation goes here %Uniform distribution, range 1-10 uni1=randi(10,1,10000); edges=1:10; p_uni1=histc(uni1,edges); p_uni1=p_uni1/sum(p_uni1); subplot(2,2,1),bar(edges,p_uni1); h_uni1=-sum(p_uni1.*log2(p_uni1)); title([...
90e51ffab2dbc97cd3d0ab1dc2639b17710b2bafff6f6b5809588e30919b764b
MATLAB
3,380
93
function hess = getHessian(problem, x, d, storedb, key) % Computes the Hessian of the cost function at x along d. % % function hess = getHessian(problem, x, d) % function hess = getHessian(problem, x, d, storedb) % function hess = getHessian(problem, x, d, storedb, key) % % Returns the Hessian at x along d of the cost ...
9e1474cbd23b8f3d09d9ea0fc70dcb0f8b24b437cc273c345c463781df21e1c6
MATLAB
3,381
112
function vecValues = getCircFit(vecOptimParams,matXY) %getCircFit Returns values in the range 0-1 depending on x-y location % within (1) or outside (0) fitted area defined by vecParams (x, y, r) for a circle or % (x, y, r1, r2, a) for an ellipse %Syntax: vecValues = getCircFit(vecParams,matXY) if numel(vecOptimP...
1fce68da1e6d17d5558b08349f72fa5d66139589ee0fc53b4b110c096e72e6e6
MATLAB
3,383
101
function gamma = mymcs_gamma_naess_old ( headmodel, order ) % Returns the Gamma series expansion for EEG leadfields. % % Use as: % Gamma = mymcs_gamma ( headmodel, order ); % % where: % headmodel FieldTrip concentric spheres definition: % headmodel.r Radius of the spheres. % headmodel.cond Condu...
cb7f7cd4d45607d47fb314184b950290ae026cad83a969615ce7c79b153b15d9
MATLAB
3,393
98
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'inv_multires_dec')); zef.inv_multires_dec = []; end; if not(isfield(zef,'inv_multires_n_decompositions')); zef.inv_multires_n_decompositions = [20]; end; if not(isfield(zef,...
506f51033dcd1dc031efa9b0ce59dc5f526790e67f2fb1dc775d66cd19785615
MATLAB
3,401
75
function bsliang_permutation_anl() addpath('E:\eeglab2021\functions\statistics') % getting fdr function from eeglab % analysis for permutation load ..\data\org_result Morg=squeeze(M); clear M load ..\data\permutation M=squeeze(M); % indexs={'slp_nonorm','slp_norm','pse_norm','pse_nonorm'}; indexs={'slp_nonor...
718952ec884f7bc43c2bcfa18eb5da962e2618f40edf8ebf0e6866d7c0e6738b
MATLAB
3,412
88
function [vecAlignedTime,vecRefinedT,vecError,sSyncStruct] = SC_syncSignals(vecReferenceT,vecNoisyHighResT,sUserVars) %SC_syncSignals Synchronize signals % [vecAlignedTime,vecRefinedT,vecError,sSyncStruct] = SC_syncSignals(vecReferenceT,vecNoisyHighResT,sUserVars) %optional input: sUserVars %optional output: sSyn...
b35254959ec36aaa77b5f9f185e835984340459c9d610215d496e5aa369df66c
MATLAB
3,425
82
function [] = compute_voxel_based_hurst_exponent(subject,part) % The purpose of this script is to compute the Hurst exponent of the Penn % sample's diffusion voxel-based functional timeseries, using the nonfractal toolbox: % https://github.com/wonsang/nonfractal as descrived in the paper: % https://www.ncbi.nlm.nih.go...
71ed38fd359b772b818c91f4a3ed59cbb856e9e1c1f43715854c558297ec4c49
MATLAB
3,426
108
function fit = hmmspectratde(hmm,options) % Get spectral estimates from a time-delay embedded model % % INPUT % % hmm An hmm-mar structure % % OUTPUT % fit is a list with K elements, each of which contains: % fit.state(k).psd (Nf x ndim x ndim) Power Spectral Density matrix % fit.state(k).ipsd (Nf x...
b805124db541d36f572e12994140ed44c65031ba98a09c662f971c2985ad8bef
MATLAB
3,426
211
function y = mls(n,flag) %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. % %optional flag is: % % 1 f...
7be1473d877226fec0aab1bd032f7eb0a601b6190b7e8086ab9206900cb59ffb
MATLAB
3,428
66
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface 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...
199a2090687386f515cd5e4a2bf1c94474b0b2981220831356886428c0ed9223
MATLAB
3,435
97
function zef_get_reconstruction_field(reconstruction, s_i_ind, intersect_ind); reconstruction = reconstruction(:); reconstruction = reshape(reconstruction,3,length(reconstruction)/3); if ismember(type,[1 7]) reconstruction = sqrt(sum(reconstruction.^2))'; elseif type == 6 reconstruction = (1/sqrt(3))*sum(rec...
a5444c6ce5b3e3a5c30e31d75c9a1e5594091834698a858b171fd6245f3e34ed
MATLAB
3,440
77
function [BOLD] = extract_voxel_based_BOLD_signal(subject,dataset,atlas_path) % The purpose of this script is to extract the BOLD timeseries from each TR % as designated by the prepare_functional_data.sh script, for each of the % subject's cortical voxels. % Requirements: % 1. Download the gifti and cifti-matlab tool...
b8b6456d459adf1d417e2611cb61f7e1e9914c1344294aabe0c50615afbf360f
MATLAB
3,444
127
function sLabels = ETP_GetImLabels(matAllIm) %% set(0,'units','pixels') vecScreenRect = get(0,'screensize'); h=figure('Name','Image labeler','Position',round(vecScreenRect/2)); drawnow; movegui(h,'center'); %global hAxis hAxis = axes(); axis(hAxis,'equal'); drawnow; set (h, 'WindowButtonMotionFcn', @(h,e) ...
37240dc78e0431a7d538c390b071c12ee7a3766158719be942dbef75cbf157e6
MATLAB
3,452
42
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef_data= zeffiro_interface_filter_tool; zef.fieldnames = fieldnames(zef_data); for zef_i = 1:length(zef.fieldnames) zef.(zef.fieldnames{zef_i}) = zef_data.(zef.fieldnames{zef_i}); end set(zef.h_ze...
adb476cb242a6ed29eb089a08ffd285cc7ba4bbd1a358c60e6f646bb0c479543
MATLAB
3,459
211
function y = mls(n,flag,s) %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. % %optional flag is: % % 1...
1f96c05e600f234a4468d0508c6846069018974627d24547c018ef2f5b595685
MATLAB
3,470
52
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_dpq_window(zef) zef_data=zeffiro_interface_dynamical_plot_queue_app; zef.fieldnames = fieldnames(zef_data); for zef_i = 1:length(zef.fieldnames) zef.(zef.fieldnames{zef_i}) = ze...
a78895eaf03cf8dd874980f8e7e11740a323dc148c7991384c38e5d7a7763879
MATLAB
3,472
94
function [H, basis] = hessianmatrix(problem, x, basis) % Computes a matrix which represents the Hessian in some tangent basis. % % [H, basis] = hessianmatrix(problem, x) % [H, basis] = hessianmatrix(problem, x, basis) % % problem is a Manopt problem structure with a manifold and cost function. % x is a point on the man...
a63bd7d896d7f6376823c8940bafa0c68c639de299a968ae927752e038e2d26c
MATLAB
3,475
88
% uses hardcoded solution to extracting frame timing % this could fail if acq accessories change function [ time, interval ] = bfTime( metadata ) % input is the original metadata from stack read! % return an array containing the time values for each frame % OLD - returns interval in seconds from olympus ETS/VSI files ...
bcf823105fbe8875c462e2604390d60949d63bd154a6851e4cbc82c66084bb23
MATLAB
3,479
120
function [Gamma,Xi,L] = fb_Gamma_inference(XX,K,hmm,residuals,slicepoints,constraint) % inference using normal forward backward propagation %p = hmm.train.lowrank; do_HMM_pca = (p > 0); % % if ~do_HMM_pca && (nargin<4 || isempty(residuals)) % ndim = size(data.X,2); % if ~isfield(hmm.train,'Sind') % ord...
c2bf6b58eb1bafa2533e76039cbbd20832f408a33a5352dc50227bce24141d09
MATLAB
3,484
139
function messages = copy_dependencies_to_folder ( file, target_folder, kwargs ) % % utilities.copy_dependencies_to_folder ( file, target_folder, kwargs ) % % Reads the dependencies that are not Matlab built-ins of the given file using % % matlab.codetools.requiredFilesAndProducts % % and tranfers them to a target fol...
2c8b931f7c3d5f6b7a8b8367bcce4d609f105890df4b68ed75dbbf194f909272
MATLAB
3,488
115
function gamma = mymcs_gamma_bruna ( headmodel, order ) % Returns the Gamma series expansion for EEG leadfields. % % Use as: % Gamma = mymcs_gamma ( headmodel, order ); % % where: % headmodel FieldTrip concentric spheres definition: % headmodel.r Radius of the spheres. % headmodel.cond Conductiv...
da4b8c3451ab4c853e7d0251b689c33b91415fb49d511cd35cc07c5659b5c30a
MATLAB
3,495
110
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [I] = zef_tetra_in_compartment(reuna_p,reuna_t,nodes,varargin) if evalin('base','exist(''zef'')') if evalin('base','isfield(zef,''meshing_threshold'')') meshing_threshold = evalin...
fc2ee465f0cc42e378b78b6dcdc714b111bc0ee0a2c11f73b34a971cec15b7f4
MATLAB
3,495
130
function [dat,opt ]= sw_get_env(dat,opt) % [env ]= detect_get_env(dat,opt) %-------------------------------------------------------------------------- % function to filter and calculate the envelope (~power) from signal % % inputs: 1) structure with fields % dat.csc : continuoulsy sampled channel...
0f7efce4a164a72bca28309b87b792e0787d5a4ab83d34157082b7340d314cce
MATLAB
3,501
66
function TDATA=bsliang_Trandata(DATA) % ¶ÁÈ¡ºÍת»»Êý¾Ýµ½´¦ÀíÊý¾ÝµÄ¸ñʽ % ================================ % DATA structure: % turn£º % stimSITE NUMBER % Left iTBS 1 % Left cTBS 2 % Right iTBS 3 % Right cTBS 4 % Sham 5 %...
a974c9313c4f3089c3f5ff9ecfe66e20311cbb89a551c344ac179d0db203e41d
MATLAB
3,502
151
function M = spheresymmetricfactory(n) % Returns a manifold struct to optimize over unit-norm symmetric matrices. % % function M = spheresymmetricfactory(n) % % Manifold of n-by-n real symmetric matrices of unit Frobenius norm. % The metric is such that the sphere is a Riemannian submanifold of the % space of nxn symme...
c6049bfa80ac13d5c727bf51aa6bd2faf3b26aae13512af7716d12679d2fbf6b
MATLAB
3,502
131
function [Y,Nsum] = moving_average(X,F,DIM) %MOVING_AVERAGE Smooths a vector through the moving average method. % % Syntax: % [Y,Nsum] = moving_average(X,F,DIM); % % Input: % X - Vector or matrix of finite elements. % F - Window semi-length. A positive scalar (default 0). % DIM - If D...
5323cb65b5b6613b8f34c46dd185197ff0404d47445c41c687f5ca2a758535cb
MATLAB
3,505
109
clear all data_path = '/media/ravinderjit/Data_Drive/Data/BehaviorData/IACbehavior/'; %Fig_path = '../../../../Figures/DynBin/'; Fig_path = '/media/ravinderjit/Data_Drive/Data/Figures/DynBin/'; %OL_path = '../../../../../Apps/Overleaf/Binaural Bash 2019/Figures/'; addpath(data_path) Subjects = [{'S211'}, {'S001'}, {'S...
586307764ae21554bc6619cdee20c98c5c0c033632bba06f60f3caf27cefe6f6
MATLAB
3,509
132
function submodule_structs = read_gitmodules ( gitmodules_file, kwargs ) % % read_gitmodules ( gitmodules_file, fields ) % % Reads the absolute and relative Git submodule paths from a given .gitmodules % file. The outputs will of course be empty, if the given file was not a valid % .gitmodules file. % % Inputs: % % - g...
82707ef3e168286a34fbf8da91721ddd01e21a14cffa0b694106cb9eab5b8e11
MATLAB
3,510
63
function d_EEG2CSV(EEGpath) % function to convert ANT EEProbe files to (zipped) csv format % uses an EEGlab plugin to read the files, so EEGlab must be installed and on the path % input is the directory containing raw EEG files - it is critical that the entire path is given, the EEGlab functions do not understand ...
0d24820e25e1ccde9cb3c59c1eee483af73f4669d59a7cdc7e543307a61cd966
MATLAB
3,520
82
function [myelin_content] = average_myelin_data_schaefer_atlas(subject) % The purpose of this script is to compute the average intracortical myelin % content on a provided Human Connectome Project (HCP) subject using the % Schaefer atlas-defined brain regions. % % Requirements: % 1. The publicly available 100 unrelat...
d0da00e6426d9610fa5c2ad6eb4a0832e1e87678a709fdf1bdc616d43e504771
MATLAB
3,520
83
function plot_ICs(params,EEG) etc = {EEG.etc}; if range([EEG.nbchan]) ~= 0 % Check that all recordings have the same number of channels error('Different number of total channels in at least one recording') end nChans = length(EEG(1).urchanlocs); nRec = length(EEG); recmask = cellfun(@(x) isfield(x, 'clean_channel...
0762c3c54d1beaf4d5c6f451f8fbce009c6017c464eba22eacc07d97ff2aab21
MATLAB
3,524
116
function [vecR2_CV, sSuppOut,intOutputFlag] = doRidge_CV(matX, matY, intFoldK, dblLambda) %doRidge_CV Performs CV ridge regression. % [vecR2_CV, sSuppOut] = doRidge_CV(matX, matY, intFoldK, dblLambda) % Make sure matrices are the same length assert(size(matX,1)==size(matY,1), 'X and Y must have the same numbe...
4dce5e49ddd2a0ca708f68dc1a87078ceda3017028d47b0507a6fae800a57050
MATLAB
3,533
122
function L = obslikelogistic (X,hmm,residuals,XX,slicepoints) % % Evaluate likelihood of data given observation model, for one continuous trial % % INPUT % X N by ndim data matrix % hmm hmm data structure % Y for now, Y is stored in last column of XX. % XX alternatively to X (which in thi...
65b23f0e57a5355d119422b4fd130c1cd66b62b9901cfb835f729d9ab92fe5ff
MATLAB
3,542
142
%% VL Scheme - General linear model example % define model % ------------------------------------------------------------------------- M = struct(); g = @(P,M,U) M.X*P; M.g = g; % set priors % ------------------------------------------------------------------------- M.pE = [0; 0]; % prior expectation M.pC = eye...
ef1b94d39791d94094b12fd8288eddadb0862b6d7fe60d3a6592de5edec99102
MATLAB
3,551
96
function sPupil = ETC_SaveEpochs(intSelectEpoch) %get globals global sETC; global sFigETC; %get file sPupil = sFigETC.sPupil; if isfield(sPupil,'sEpochs') && ~isempty(sPupil.sEpochs) %message ptrMsg = dialog('Position',[600 400 250 50],'Name','Applying epoch data'); ptrText = uicontrol('Parent',ptrMsg,....
8a69750408812a9a7cc4f9fa60c000ebdc6b8384958562e286f27626ec51766a
MATLAB
3,566
135
function varargout=tubeplot(curve,r,vecC,intPointsPerRadius,ct) % Usage: [x,y,z]=tubeplot(curve,r,vecC,n,ct) % % Tubeplot constructs a tube, or warped cylinder, along % any 3D curve, much like the build in cylinder function. % If no output are requested, the tube is plotted. % Otherwise, you can plot by using sur...
1268d86044b2d88ca8c8b95d3358d5185bdeadb587b256d114d6f1634e7a79a0
MATLAB
3,573
86
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [exp_multires_dec, exp_multires_ind, exp_multires_count] = exp_make_multires_dec n_decompositions = evalin('base','zef.exp_multires_n_decompositions'); [n_levels] = evalin('base','zef.exp_mul...
aa1f33fe5439d7b70fdbf9225e40ecb3b8df3817265e7cd31ebac18d99982665
MATLAB
3,579
84
%-------------------------------------------------------------------------------- % pomdp_bss.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 Takuya Isomura % (R...
7ef3ae0294f1dd8fadf065e0eef394f3b8e3c20ec3f9e6fa463384b54d5d08f9
MATLAB
3,585
150
function colorbar_from_figtool_fn(figtool, filename_without_suffix, filetypes, kwargs) % % colorbar_from_figtool_fn % % Takes in a handle to a Zeffiro Interface Figure tool (possibly saved to a % Matlab .fig file), extracts the colobar from it and saves it to files with % given set of suffixes. % % Inputs: % % - figtoo...
f3d5380567a2a2baa78f64d0522b5d645dcc49e03293a7e78aa0cbe82c93cd42
MATLAB
3,585
110
function [nodes,flag_val] = zef_fix_negatives(zef, nodes, tetra) if isempty(zef) zef = evalin('base','zef'); end threshold_value = zef.meshing_threshold; fix_n_max = eval('zef.mesh_optimization_repetitions'); fix_param = 0.5; fix_it = 0; c = find(zef_condition_number(nodes,tetra)<0); fix_length = length(c); %c...
1c22d599681eba90cdcae93dc36dbc5273a54b689585267c3cceaa62c6c583d0
MATLAB
3,587
108
function [Aout,AB,dur_real,IACt] = MakeOSCORNoiseStim(OSCORtype,fLow,fHigh,dur,Fsample,RandSeed,ITD,fm,N,Seq_Step_Duration,ContraChan) % fLow: lowest frequency component (Hz) % fHigh: Highest frequency component (Hz) % dur: duration of the sound (ms) % Fsample: sampling frequency (Hz) % RandSeed: random seed for...
953a0b570098a3bd0e31f26a3d4a67c0b423b9d1c64a6d712dd388ec3f47acc0
MATLAB
3,603
91
function hessfd = getHessianFD(problem, x, d, storedb, key) % Computes an approx. of the Hessian w/ finite differences of the gradient. % % function hessfd = getHessianFD(problem, x, d) % function hessfd = getHessianFD(problem, x, d, storedb) % function hessfd = getHessianFD(problem, x, d, storedb, key) % % Returns a f...
c891eadab6cb9fd1911a9518255d1c8d0c530e41f390606e261d2161c6ceb70e
MATLAB
3,615
91
function [params] = structural_learning(params) % for structural learning % % Reviewed Darik A O'Neil 04-15-2023 % % Purpose: Consolidated function for structural learning % % To accomplish this we do steps % (1, Initialize Potential Neighborhoods) % (2, Learn Neighborhoods) % (3, Learn Structures) % (4, Save Model P...
2fb7dcb7d7b91465b11aab2599f3ce7c796377d0f7ea5694c98fe795397caf3e
MATLAB
3,617
107
%% Nat Comms Ictogenesis Figure 7 clear % Load data load('20230612_KA103_SponPulso'); %% Plot figure tiledlayout(2,4,'tilespacing','tight'); cmap = lines(7); % KA103 MOUSE = "KA103"; SZID_ = "SZ_KA103_D201027_1632_T062781"; Sp_ = SpPulso.(SZID_); nexttile(1,[1 2]) yl = [-48 48]; plot(Sp_.eegtt...
4614a04e8a599ad377f20ed55bc99909f24783ada1c179d680c81fb94122f6f3
MATLAB
3,617
90
function [Spectra] = Fun_ReadRawFileAndDoFFT(Path, FileNames,... NumRowInEpoch, SamplingFrequency,FrequencyRange,... ExpectedResolutionInSpectrum) %% Written and updated by M. Nollet (Aug 2023) % Adapted a script written by R. Winsky-Sommerer (DE_RWS Jan 2103) % % Function to be used to compute Power Sp...
dc0c453beff4a21083b0b1909eff7bed79d95c347cb4ee1dc0bc1e72ad40ceae
MATLAB
3,631
69
zef_data = zef_additional_options_app; zef.fieldnames = fieldnames(zef_data); for zef_i = 1:length(zef.fieldnames) zef.(zef.fieldnames{zef_i}) = zef_data.(zef.fieldnames{zef_i}); if find(ismember(properties(zef.(zef.fieldnames{zef_i})),'ValueChangedFcn')) zef.(zef.fieldnames{zef_i}).ValueChangedFcn = '...
948e5f54d0a83dbef7053f3596077505206df599716d587acb76d3e11e6b6775
MATLAB
3,632
113
function [vecRho,vecP] = getTuningRho(vecResp,vecAngles,boolPlot) %getTuningRho Calculates the tuning curve smoothness metric rho % [vecRho,vecP] = getTuningRho(vecResp,vecAngles) % %Inputs: % - vecResp; [1 x Trial] response vector % - vecAngles; [1 x Trial] stimulus orientation vector [in radians] % %Note: yo...
4b7a8ba17152ef61aa803f701cbd9431b91d727f0250d9beba8e6434355270dc
MATLAB
3,655
123
function [h,p,sigPairs] = ttest_bonf(x,pairs,alpha,tail) %TTEST_BONF Hypothesis test: Isolate differences in % Repeated-Measures Analysis of Variance. % % [H,P,SIGPAIRS] = TTEST_BONF(X,PAIRS,ALPHA,TAIL) performs a % set of Bonferroni corrected t-tests to determine which pairs of % treatments could have the same...
05b04361d18b71bd99b905703da0a4c22f01d8b4b2efb2fe776a92e75088f484
MATLAB
3,673
84
%% 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...
e679d1fe9c5be3ee846cde147ec700b7246ffb449bbe484cf60db0f5367acb7d
MATLAB
3,682
94
function checkgradient(problem, x, d) % Checks the consistency of the cost function and the gradient. % % function checkgradient(problem) % function checkgradient(problem, x) % function checkgradient(problem, x, d) % % checkgradient performs a numerical test to check that the gradient % defined in the problem structure...
ceb0cd1781a2ecfb82f43e72ed68746daf5ce85f609ca76e30d715a358489c59
MATLAB
3,691
75
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [meas_data] = zef_find_source(zef) if nargin == 0 zef = evalin('base', 'zef'); end source_positions = eval( 'zef.source_positions'); noise_level = 10^(eval( 'zef.inv_synth_source(1,8)')/20...