sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
78ef6ff2339fc458276ba7f58e4c9b6f857def443b53feb9ad219c497da4b307
MATLAB
4,291
102
function ORDERnum=bsliang_gainORDERnum(PARnum) % Ô­±¾°²ÅŵÄÊÇ48¸ö±»ÊÔ£¬Òò´Ë±»ÊÔʵÑé˳ÐòµÄƽºâÒ²Êǰ´×ÅÕâ¸öÀ´µÄ¡£ %µ«ÊÇÊÂʵÉϱ»ÊÔ¿ÉÄÜ»ò¶à»òÉÙ£¬Òò´ËÕæÕýʵÑéµÄʱºòÿ¸ö±»ÊÔ¶¼ÓÐÒ»¸ö×Ô¼ºµÄ±»ÊÔ±àºÅ %£¨¸úµÚÒ»´ÎʵÑéÒ»Ñù£©£¬Í¬Ê±ÓÐÒ»¸öORDER±àºÅÓÃÀ´È·¶¨±»ÊÔ×öʵÑéµÄblock˳Ðò¡£ORDER±àºÅÊÇ¿ÉÒÔÖØ¸´µÄ¡£ % tranMAT=[1:47;2:48]'; t...
7d1826ac640bc43168bdc028166fd0399ea45e30cba47b8251c304f475fcb5dc
MATLAB
4,308
122
function plot_structured_prediction_visual(app) %we gotta do this for this one idk why Darik 5/9/2022 cla(app.model_evaluation); v=app.StimulusEM.Value; params = app.params; LL = app.log_likelihood_by_frame(size(params.data,2)+v,:); %grab framewise likelihood Thresh = app.model_performance.full_performance.thr{v}; %gr...
f8d30f5fd7c758af5fd86d4ec5499a06dd14265bf235188db7799e8d61a39ffb
MATLAB
4,315
111
function [M_U,err] = contCon2LaggedCovProjected(C,s,symmetric,maxi,tol,verbose) % % This code computes the projected lagged covariance matrix for the contimous-time % Ornstein-Uhlenbeck case after time s, assuming starting from no % correlation at time 0. % The code converts con2lcov from ncomp from Barnett et al to ha...
d0de07392e74060f54ec41b32c9e0879a212b5bbe45deca4de9ca0fae1ca2faf
MATLAB
4,324
118
function [X,T,Gamma] = simhmmmar(T,hmm,Gamma,nrep,sim_state_tcs_only,grouping) % % Simulate data from the HMM-MAR % % INPUTS: % % T Number of time points for each time series % hmm hmm structure with options specified in hmm.train % Gamma State courses - leave these...
330d4b280e16f0e809dc0eab14a7bc0571a57cb20e078973df627a4cd061c0ff
MATLAB
4,335
79
function zef = zef_set_figure_tool_sliders(zef, varargin) set_mode = 1; if not(isempty(varargin)) set_mode = varargin{1}; end if eval('isfield(zef,''h_axes1'');') if isvalid(eval('zef.h_axes1')) if set_mode == 0 eval('zef.h_update_colormap.Value = zef.inv_colormap;'); eval('...
0a885ae10297564b613ab628f4aa91c8c2beeb89ca7a16341072092dc259fccc
MATLAB
4,338
138
function [FrEn,avLL] = evalfreeenergylogistic(T,Gamma,Xi,hmm,residuals,XX,todo) % Computes the Free Energy of an HMM depending on observation model % % INPUT % X observations % T length of series % Gamma probability of states conditioned on data % Xi joint probability of past and ...
5bc5bece0373c75e6cc8ec427e598ef9133f753cdb112911a767bc166cb3bff9
MATLAB
4,345
169
function [nodes, faces] = read_ascii_segmentation_file ( fname ) % % read_ascii_segmentation_file ( fname ) % % Reads in a segmentation file line by line and extracts the information from % within it. Throws an exception if the given file does not conform to the % expected format. % % Inputs: % % - fname % % The fil...
59a4cb43011dfb7ec43e6bf5fb0beca317381c347d69879916b781887383bb7b
MATLAB
4,354
124
function obj = stats_complexity(obj,Ntransitions) % Calculate microstate transition complexity % 2nd input (Ntransitions): % -1: use full sequence instead of transitioning sequence % 0: use all transitions % integer > 0: use this number of transitions % Check 2nd input if nargin <...
484a652d3c4bf3f46fdddb0e8687c806f76ca58e20d8ac41fa0722e8ae924087
MATLAB
4,364
157
function [X, meta] = nrrdread(filename) %NRRDREAD Import NRRD imagery and metadata. % [X, META] = NRRDREAD(FILENAME) reads the image volume and associated % metadata from the NRRD-format file specified by FILENAME. % % Current limitations/caveats: % * "Block" datatype is not supported. % * Only tested...
b3799ad473a09d500544426583a5485f9ae83a7aead9fa861084ce45db609e50
MATLAB
4,369
134
function [b_coord, det] = zef_volume_barycentric(nodes,tetra,p_ind,det) % % zef_volume_barycentric % % TODO: Sampsa should document this. % % Inputs: % % - nodes % % TODO: explanation. % % - tetra % % TODO: explanation. % % - p_ind % % TODO: explanation. % % - det % % TODO: explanation. % % Outputs: % % - b_coo...
356a9d99ead0b4d3e0b94deedfb17369220021273c2cd486cfdd8f5f1875b536
MATLAB
4,391
152
% script to illustrate data import for animal EEG files % exampel uses edf files genrated by SleepSign software % data has multiple channels per file clearvars; % set directories data_dir = 'mydatadir'; write_dir = 'myresultsdir'; channel_labels = {'F', 'P'}; % F = frontal, P = parietal fn0 =dir([data_dir '*....
c3e5721cc8e91203e2e06907baaad2dd55c6e755349419bffc7ea4e771b4aba6
MATLAB
4,394
106
function [inmat_s_rm_sp_rlr,inmat_s_rm,GEN_subj]=bsliang_norm_lr_out(TDATA,inmat,LT_ind,GEN_ind,outTag,is_rmsd,is_abs,is_norm) % is_rmsd: ÊÇ·ñÈ¥³ý3SD % ±ê×¼»¯£¨¡÷TMS=(rTMS-Sham)/|Sham|£©£¬·ÖlarynxºÍtongue£¬Êä³öSPSS¸ñʽ % inmat£º block(4)*turn(5)*subj(197) % LT_ind£ºLarynx Tongue index % outTag£ºÊä³öÓÃÓÚSPSS...
f1ffc05a5b047a4debb537df3a443554edf763dff1cf722f00598a9d46bde779
MATLAB
4,397
124
function D = hmm_kl (hmm_p,hmm_q) % Computes Kullback-Leibler divergence between two Hidden Markov Model % distributions, through an approximation (an upper bound) as proposed in % M. Do (2003). IEEE Signal Processing Letters 10 % % Author: Diego Vidaurre, OHBA, University of Oxford (2018) K = length(hmm_p.Pi); if K~=...
c065a8a3a6c9d70d99040a6f885c4c4f4252a9130f41419096fdc7c599715eb6
MATLAB
4,399
134
%% % % RUN CONVERT TO INDIE after dFoF0! aCa4a_convert2indie % % choose a file or 0 for all files in directory path=uigetdir("C:\Users\defazio\Documents\data\processed\individual"); %path="C:\Users\defazio\Documents\data\processed\individual"; %path="\\umms-smoenter-win.turbo.storage.umich.edu\umms-smoenter\defazio tu...
a8d9ac655dd125e6bfb422a617d46b130077bd9802ead6f53591bcca4aa59742
MATLAB
4,408
94
function hmm = updateSigma(hmm) K = length(hmm.state); ndim = hmm.train.ndim; if isfield(hmm.train,'B'), Q = size(hmm.train.B,2); else Q = ndim; end if Q==1, return; end setstateoptions; for k=1:K if ~hmm.train.active(k), continue; end if isempty(orders) || train.uniqueAR || ~isempty(train.prior), continue; e...
b8ffda4c09fe83f40ed453538d7f4c9b3d78686502bbdb1ad179f0aad39cdeca
MATLAB
4,412
122
function sFigETOM = ETO_genMonitor(sTrPar,dblMaxT,intMaxF) %check inputs if ~exist('dblMaxT','var') || isempty(dblMaxT) dblMaxT = sTrPar.dblTotDurSecs; end if ~exist('intMaxF','var') || isempty(intMaxF) intMaxF = sTrPar.intAllFrames; end %set size dblHeight = 600; dblWidth = 1000; vecMainColor = [0.97 ...
934cb5c9f8133553971e321f7d1cadf1cabaca9393428b2490cf9c353e6c3b82
MATLAB
4,437
139
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [johtavuus,brain_ind,non_source_ind,nodes,tetra,johtavuus_prisms,prisms,submesh_ind] = zef_sigma(void) tetra = []; prisms = []; johtavuus_prisms = []; non_source_ind = []; optimizer_flag = 1...
489cd53bdf54fdd109e616cec65a8d4db62ff062787a7e73a6d908642061fd10
MATLAB
4,439
209
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'streamline_draw')) zef.streamline_draw = 0; end if not(isfield(zef,'streamline_linestyle')); zef.streamline_linestyle = '-'; end if not(isfield(zef,'smoothing_steps_ele')...
53b1f5e7ec0a3b2a9e0bf045b6fbcb45b6b87458c910bf865d82cba57f8b9b8c
MATLAB
4,445
143
function plot_hmmspectra (spectra,err,coh,figure_number,colmap,channels) % Plot PSD and Coherence or PDC for all states % % INPUT % spectra: estimation from hmmspectramt or hmmspectramar % err: whether or not to show confidence intervals (only if they were computed) % coh: show coherence or PDC (latter only if it were ...
2b6ddb0a046e6c2a5ffe79bb2148f304c8189e1127cbf1478c786a58f9066973
MATLAB
4,464
155
function h_surf = zef_plot_disk(position,radius,width,ori,k,color) h_axes = gca; hold_state = ishold(h_axes); if not(hold_state) hold on; end %make sure ori is column vector z = ori(:)/norm(ori); if isequal(abs(z),[0 0 1]') x = [1 0 0]'; else x = 1/sqrt(z(1)^2+z(2)^2)* [z(2) -z(1)...
4c61604a6428d635b86a31ad4298c1b2ec83820f63362a4771241c051e5aafc0
MATLAB
4,480
124
%-------------------------------------------------------------------------------- % fig3_video_output.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 Isom...
a396cc25694545d7da10cbdc1c6b48d0bd8ac3389e5eabea8fff401bdb93bf4b
MATLAB
4,482
135
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef_import_project(file_name, folder_name) void = []; if nargin < 2 [file_name folder_name] = uigetfile({'*.zef'},'Project ASCII data file and folder',evalin('base','zef.save_file_path')...
c9cfa634a1a50f4372053b4ce82850871173e14d547ef374ddce2baed0ceefd3
MATLAB
4,484
106
function [IMAGE,LABEL] = fun_generate_grayCIFAR10(redim,numTrain) %% load cifar IMAGE = cell(1,3); LABEL = cell(1,3); array_num_train = [numTrain]; %========================================================================= imsetTrain = imageSet('DATASET_ori\CIFAR10\cifar10Train','recursive'); x_dim = 32; y_...
3dc474daa9e36c11d1ba19aa8ad07826e7c4c2a6187e413cad83e2d6e59a8e53
MATLAB
4,497
154
function post_info = estimate_posterior_state(... state,spike_state,overlap,Data) % --- spike estimation based on posterior for overlap window % post_info = estimated_post_state(state,spike_state,overlap,Data) % --- Estimated spike info for overlap window % post_info.spike_num(n) = estimated spike number of...
d2d940bad061d2909ff946ffaee5830bff5171156dd3c4039e9092dc7569cf8d
MATLAB
4,502
139
function [L,n_interp, procFile] = zef_processLeadfields(zef) %zef_processLeadfields processes the leadfield in zef and applies all %visibility options. %L is the leadfield, the procFile has all information needed for the %postProcessing step, but should not be needed in the inverse method source_direction_mode = []; if...
5e9c678f4b77ef4dc4fa8d3d370dd3dbae01cec8ee5f86d8886d079d34477eb5
MATLAB
4,514
177
function [Model, train_info] = train_shape(data, parm) % training shape parameter using training data % [Model] = train_shape(data, parm) % % data.y = observed spike data with noise % data.t = sample time [sec] % data.fs = sampling rate for observed data [Hz] % data.spike_time = time of spike onset [sec]...
6fc41ddb45718b9d22aba61bb219090e964865929621cea0fc0c2ef86975f752
MATLAB
4,520
126
function trls = define_trials(obj,varargin) ; % Segment a single dataset into trials based on either a fixed length or stimulus times. % Useage: % ms = ms.define_trials(epoch_length) ; % splits into trials of length % epoch_length with no overlap % % ms = ms.define_trials(epoch_length,overlap) ; % splits into trial...
2da78d4dbd17f37defd5b06e0cb356d60332c48720cf55e76ad859be37e19a8c
MATLAB
4,525
131
% This is a template script that specifies the usual options for a handful % of data modalities, runs the HMM-MAR, and obtains some basic information % from the estimation (mainly, the spectral information of the states). % % This script is just a starting point, and does not guarantee to be the best % configuration f...
b68b40503a7fbe30f4bde2d90ca08e6423114498262d80250f26cdc5e1c3c762
MATLAB
4,535
121
function egrad = getEuclideanGradient(problem, x, storedb, key) % Computes the Euclidean gradient of the cost function at x. % % function egrad = getEuclideanGradient(problem, x) % function egrad = getEuclideanGradient(problem, x, storedb) % function egrad = getEuclideanGradient(problem, x, storedb, key) % % Returns th...
bd163006f9882c8f3275706076ddf32bf8ec1b62e52763c869ed577a49b2b7da
MATLAB
4,536
122
%Script for updating edit field of GMM system. zef_n=0; if isfield(zef.GMM,'apps') if isvalid(zef.GMM.apps.main) %_ Main app _ zef_props = properties(zef.GMM.apps.main); for zef_i = 2:length(zef_props) if strcmp(zef.GMM.apps.main.(zef_props{zef_i-1}).Type,'uilabel') zef_n=zef_n+1; if ~isempty(ze...
a0ff6ad43ec629c164fa2895533e9221151632f17eaf5d760882dd4ea0632ab1
MATLAB
4,539
92
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function h_source = zef_plot_source(source_type) arrow_scale = 1; arrow_type = 1; arrow_color = 0.5*[1 1 1]; arrow_shape = 10; arrow_length = 1; arrow_head_size = 2; arrow_n_polygons = 100; if source...
88d7d6e18e9318deda4b17eb21b864a70f672f4b38bfd0f013d125ef8cc3a0cf
MATLAB
4,544
162
function post_info = estimate_posterior_prob(... state,spike_state,overlap,Data) % --- spike estimation based on posterior for overlap window % post_info = estimated_post_state(state,spike_state,overlap,Data) % --- Estimated spike info for overlap window % post_info.Pspike(ns,n) = P(ns | yk) of n-th overlap ...
cabb2f17b2dea0551d3924ceaff0a6641c0bee3bf2a858acf67aee5fdad914a1
MATLAB
4,546
149
clcl files={''};% limtrials=5; converts=[2 3 5 4 1 8 6 7]; % this is 0degrees to 155 in steps for file=1:size(files,1); load(strcat('CA_workspace_SORTED_',files{file}),'dfofanalyse','stimvistypeMAIN','phases'); dat=dfofanalyse(:,phases==1); stim=stimvistypeMAIN(:,phases==1); dat=dat(:,12...
bb64f845fa7d268c5d2be8e561a89b602480d7359fa68e3e25245d270ad0cf90
MATLAB
4,567
107
function [UcovarianceU,err] = contCon2CovProjected(C,useSymmetricForm,maxi,tol,verbose) % % This code computes the projected covariance matrix for the contimous-time % Ornstein-Uhlenbeck case. % The code converts con2cov from ncomp from Barnett et al to handle % the projection of the covariance matrix orthogonal to th...
40f6c34b6513c30ecca0c00b699c910597f0ce1e11ecefb9efb4d236464b2d0f
MATLAB
4,581
168
function zef_rebuild_source_tree(treeObj, treeStruct) %ZEF_REBUILD_CHECKBOXTREE Rebuild a uitree / checkboxtree from a struct. % If treeObj supports CheckedNodes (checkboxtree), restores CheckedNodes % from UserData.CheckedIndex/IsChecked. % Otherwise, if treeObj supports SelectedNodes (plain uitree), restores % ...
69ea0e313c58578bbdbc03d5eedfed10f80d83f194c9a1bd0bdf6c6d4f0b5a33
MATLAB
4,610
138
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_load(zef,file_name,path_name) if nargin == 0 zef = evalin('base','zef'); end zef_data = struct; if nargin < 3 if not(isempty(zef.save_file_path)) && not(isequal(zef.save_f...
6f4c096b894c80c90d62a4f01e1e3df0301770335996a8e46e29129afdea1c7b
MATLAB
4,610
67
zef_data = zef_eit_sensitivity_tool; if not(isfield(zef,'eit_sensitivity_tool_file')) zef.eit_sensitivity_tool_file = ''; end if not(isfield(zef,'eit_sensitivity_tool_file_2')) zef.eit_sensitivity_tool_file_2 = ''; end if not(isfield(zef,'eit_sensitivity_tool_active')) zef.eit_sensitivity_tool_active = 0...
1091224074b14e35ed8f5ab05081662f010fb24764c0b97ff95257201740a823
MATLAB
4,613
128
function [Spindles] = detect_spindles_Walker(signals,OPTIONS) % signals.data is a Ntrials x Ntime % signas.fs is the sampling rate % OPTIONS_SLEEP contains the parameters for the SSW detection % output: % marker------------ .delimiters : table N1(start) N2(end) fprintf('\n\n\tSpindle detector (Walker)'); fs = sig...
c83763f4075a8b506a4b19eda1e5d51991a32e5f524c55c575bb47a3e6314c08
MATLAB
4,617
120
%% Nat Comms Ictogenesis Figure S2 clear load('20230710_StimPower'); %% Plot 5/1020/Hz recording sequence by days from injection HZ = [5 10 20]; % Create matrix Mouse x Day maxDay = max(rectable_full.DaysFromInjection); HzMatrix = zeros(numel(MOUSE),maxDay+7); for mm = 1:numel(MOUSE) for hh = 1:n...
371b051b4d90ed3689214dba4b090800ffd204b7ef5fc12e21adc53806e4b25f
MATLAB
4,656
111
function [UcovarianceU,err] = discreteCon2CovProjected(C,useSymmetricForm,maxi,tol,verbose) % % This code computes the projected covariance matrix for the discrete-time % case. % The code converts con2cov from ncomp from Barnett et al to the discrete case % and for the projection. % See reference for the Barnett code...
9ff9e02716d461abec958cf4d691e8e9011c0f2ab22fa88e59c0f3e14b0acc62
MATLAB
4,658
131
function [compartment_settings, surface_meshes, zef] = zef_bst_create_compartment_data(settings_file_name, zef_bst, zef) mesh_file_ind = 0; compartment_types = cell(0); A = diag(4); if isfield(zef_bst,'subject_struct') if length(fieldnames(zef_bst.subject_struct)) > 0 subject_struct = zef_bst.subject_stru...
c86ed589ee44f073ba92810b29aa244880c38a23001cebec1b7ce427880bc01f
MATLAB
4,658
125
function events = custardWrapper3( timing, fluo_matrix, params_in, run_params_fields, detailed ) % version 3 adapted for multiple runs on the same data % expects params in seconds, converts to points based on timing % params_in contains multiple sets of custard parameters % all inputs in real units, converted to poi...
89652595b70aa18924dc56f4a01fb70c8a371512f7246ee6fcc1a227dbaf587c
MATLAB
4,674
143
function result = makegridcellkernel(L,P,kv,opt) % MAKEGRIDCELLKERNEL Initialize a low-rank spatial frequency space kernel % for gric cells. % result = MAKEGRIDCELLKERNEL(L,P,V,OPT) Will prepare a periodic % grid-cell Gaussian-process kernel for an L×L size grid, with period P % (in pixels) and prior marginal v...
35324b7f7f0d989bd96b35aa969c38a007f498913c0d59866561f77c961bde8d
MATLAB
4,698
171
function [z, info] = zef_find_mne_reconstruction(zef,data_mode) if nargin < 2 data_mode = 'filtered'; end inverse_gamma_ind = [1:4]; gamma_ind = [5:10]; h = zef_waitbar(0,1,['MNE Reconstruction.']); [procFile.s_ind_1] = unique(eval('zef.source_interpolation_ind{1}')); n_interp = length(procFile.s_ind_1); pm_val ...
cfed587ce1cc7f72924354fb3139227d479bd369de5ea2c33325fcc4f25c0789
MATLAB
4,701
151
function [pvals,pvalsFWE,pvalmat] = permtestmass_NPC(Yin,Xin,Nperm,Perms,conf,... groupingYin,groupingXin,verbose) % % It tests each replication (column) of Yin vs each variable (column) of Xin, % combining the tests across replications such that we have an aggregated % final p-value as well as specific p-value...
e8ec3a77b7011d5ae047b32a7095593af640b928cc19027c5ba6966fee7ff542
MATLAB
4,705
121
function fcoefs=MakeERBFilters(fs,numChannels,lowFreq,width) % function [fcoefs]=MakeERBFilters(fs,numChannels,lowFreq) % This function computes the filter coefficients for a bank of % Gammatone filters. These filters were defined by Patterson and % Holdworth for simulating the cochlea. % % The result is returned...
5a5ff01683f93b866cfab942d38a740692371f40899cda0b66d400d81cb87323
MATLAB
4,712
135
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [z,reconstruction_information] = zef_sl1_iteration(zef) inverse_gamma_ind = [1:4]; gamma_ind = [5:10]; h = zef_waitbar(0,1,['Standardized L1 MAP iteration.']); [s_ind_1] = unique(eval('zef.so...
cf891a24625a07b88d8f785d7ad4ab689dac1a098539c1321faeebed800ab110
MATLAB
4,718
111
%% Sample script to set up the parameters object. % You can not only assign values here, but have differential processing % (e.g. to do different things on your desktop or cluster). % Required members are described as they appear below. % %% Linear Sync Toolkit (linsync) % Copyright (C) 2023 Joseph T. Lizier % Distribu...
207f6e6d777e93a16e1f4db48f61a5af0bf90a4439922d0a6376bece7c7b6ae1
MATLAB
4,720
108
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_init_ias_roi(zef) zef = zef_ias_map_estimation_roi_window(zef); set(zef.h_iasroi_map_estimation,'Position',[ 0.5764 0.2944 0.15 0.50]); set(zef.h_iasroi_map_estimation,'N...
8ea9b7f059bcaba946d47ca07fb30d5d8644425d9444a36cb80d35eed94b6f5c
MATLAB
4,724
51
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D function [mh_vec, d_mh_vec, d_2_mh_vec] = mh_window(t, T, carrier_cycles_per_pulse_cycle,carrier_mode) ones_vec = ones(size(t)); T_ind = find(t>T); ones_vec(T_ind) = 0; T_ind = find(t<0); ones_...
b795d8be22ee79628b0ad45ac2429b0d0ab47fcbe46361292daaa99b20fecfb0
MATLAB
4,725
142
function [plv,powercorr] = hmmplv(data, T, Gamma, options) % Computes the state-wise Phase Locking Value (PLV) for (time X numChannels) data % % Input parameters: % data is a numTimePoints x numChannels x numTimePoints data matrix % options must contain % .Fs is the sampling rate % .fpass specifies the ...
4d979f9744081032df3369dcad3d4ad9333558af63864d5938bd228c2e7074dd
MATLAB
4,732
161
function [p,confusionmat,nets] = networks_wpli(obj,frq,keepstates,epochlength,staticflag) ; % 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 isempty(obj.l...
c26d16e2bcaa08d9190dd5185d5b59d22ca96991dd60c6f22dba115fc1927949
MATLAB
4,738
120
%% zef = zef_KalmanDemo_create_measurement(); %% zef = zef_KalmanDemo_runKalman(zef); %% %zef = zef_KalmanDemo_save(zef); %% Visualization %(!!!) Under maintenance (!!!) %zef = zef_Kalman_visualization(project_struct); %% function project_struct = zef_KalmanDemo_runKalman(project_struct) % How to use kalman withou...
df961ae34dc8710c2fae2a08fd7500716b0395ec6786c5d244beb18bd2670fe2
MATLAB
4,747
178
function [UI,Q,iter_outer,iter_inner] = admUI_accn(Psy, Psz, accu, g) % admUI_accn adds acceleration capabilities to the original admUI for the I-projection step. % Currently the default acceleration is tested only for the case when S and either Y or Z is binary-valued. % The plain admUI is obtained for gamma=1, eps =...
b36345ea4d6e229970be4baeae7141e0ec4468eea39c4ab86d11abfbed114aa5
MATLAB
4,749
224
load('postprandial_somnolence_fEI_ratio_beta.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_l...
ce60d800590a71c842a6b6334a3efc98a7f758db9e66266ce7649f2bcb436d7b
MATLAB
4,757
129
function [vertices, label, colortable] = Read_Brain_Annotation(filename) % [vertices, label, colortable] = Read_Brain_Annotation(annotfilename.annot) % % vertices expected to be simply from 0 to number of vertices - 1; % label is the vector of annotation % % colortable is empty struct if not embedded in .annot. Else, i...
c51ca75c054c0ca9f72caea1df57e88bcfea0d3a86a9f0f926c7c8ff0dce8618
MATLAB
4,758
102
classdef SolverSGDM_conv3 < nnet.internal.cnn.solver.Solver % ==================================================== % dir = C:\Program Files\MATLAB\R2019a\toolbox\nnet\cnn\+nnet\+internal\+cnn\+solver % ==================================================== % SolverSGDM Stochastic gradien...
c986f9f3d8dc16c953d892080ea90f420099b415a00dd06a9dc6e1b7ef54ee60
MATLAB
4,758
102
classdef SolverSGDM_conv3 < nnet.internal.cnn.solver.Solver % ==================================================== % dir = C:\Program Files\MATLAB\R2019b\toolbox\nnet\cnn\+nnet\+internal\+cnn\+solver % ==================================================== % SolverSGDM Stochastic gradien...
75243083ffa5521fa49d6340f2749772a5b917dadc74ced75423085974891c8f
MATLAB
4,761
176
function I=mi(A,B,varargin) %MI Determines the mutual information of two images or signals % % I=mi(A,B) Mutual information of A and B, using 256 bins for % histograms % I=mi(A,B,L) Mutual information of A and B, using L bins for histograms % % Assumption: 0*log(0)=0 % % See also ENTROPY. % j...
46d263c568434d3b6ec13f8900b8e75f8c9bf62d561217544d4953f255f8b802
MATLAB
4,774
138
function [sEyeFig,sET] = ET_initialize(sEyeFig,sET) %OT_initialize initializes all fields when data paths are set global objCam %% initialize camera %set parameters intTriggerType = 1; %get devices sDevices = imaqhwinfo; %establish connection sCams = imaqhwinfo(sDevices.InstalledAdaptors{1}); if isempty(s...
b1cd245e2c5de4a06b3dd4dbb9d0e0318f9fc384a7460d3f7f2c786075f9dfd6
MATLAB
4,797
96
function zef = zef_nse_tool_update(zef) zef.nse_field.use_gpu = zef.nse_field.h_use_gpu.Value; zef.nse_field.pcg_tol = zef.nse_field.h_pcg_tol.Value; zef.nse_field.pcg_maxit = zef.nse_field.h_pcg_maxit.Value; zef.nse_field.rho = zef.nse_field.h_rho.Value; zef.nse_field.mu = zef.nse_field.h_mu.Value; zef.nse_field.vis...
fcfc404b937c5ffe91a1a34fc957b08b06606fee81fe7eb6bd60f65c109d0724
MATLAB
4,800
142
function M = positivefactory(m, n) % Manifold of m-by-n matrices with positive entries; scale invariant metric % % function M = positivefactory(m) % function M = positivefactory(m, n) % % A point X on the manifold M is represented as a matrix X of size mxn with % all individual entries real, strictly positive. By defau...
add34a5c4d4ce19642ca6c1e5e30437df73385f9628cd1972aa8d0fcc67f498d
MATLAB
4,823
190
function [pred_info, ypred] = ... estimate_posterior_spike(... data, post_info, Model, fs_est) % --- spike estimation based on posterior for overlap window % pred_info = estimate_posterior_spike(... % data, post_info, Model, fs_est) % ----- Output % pred_info.spike_num(n) = estimated spike number ...
143d1ff63ad94e7bbee20254a0fe613a21c0a82e71c5fe1eea1e4732d3e45671
MATLAB
4,826
143
function [obj,mapsim] = cluster_alignmaps(obj,usepeaks,varargin) ; % Assign a microstate class to each time point, building a discrete microstate time series. % % Given a set of template maps c, a set of maps at global field potential % peaks X, and some way to map the peak maps onto the data v, we can % calcula...
388240fb32d1df8199f270eee7c1c9d901c67cf0f2badacdc693350d5d5c5c1c
MATLAB
4,832
195
function spike_state = multiple_spike_state(... parm, print_mode) % multiple_spike_state % spike_state = multiple_spike_state(parm) % % spike_state.Nstate(nspike) = number of states % for (# of spike) = nspike % spike_state.Tspike{nspike} = spike time onset list % ...
2a5f0e913ac2dbd0c0ea8b66f42cf923a9610eeaad1e6955428a5d64cce29513
MATLAB
4,835
150
function M = spectrahedronfactory(n, k) % Manifold of n-by-n symmetric positive semidefinite matrices of rank k % with trace (sum of diagonal elements) equal to 1. % % function M = spectrahedronfactory(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 symmetri...
39c25ba617f8ee59a3d07733b2030d51d77a18b51a14cf6f13257160ab613d47
MATLAB
4,838
87
%Copyright (c) 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function project_struct = zef_meshing_example ( kwargs ) % % examples.zef_meshing_example ( kwargs ) % % This is a code snip to serve as an example for generating the % multi-compartment head model a...
dfc9cf3dbc6f109a497e48ad4046b036350e3406b195c4bc7a31c9e7f25bbd32
MATLAB
4,841
188
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [mesh_data_1,mesh_data_2,submesh_data] = zef_get_mesh(zef,file_str,field_id,file_type,varargin) output_mode = 1; if not(isempty(varargin)) output_mode = varargin{1}; end mesh_data_1 = []...
6d6792f7b1eded56a0e665f717e609ee560744576f8719d67b866202053510d1
MATLAB
4,856
141
function M = symfixedrankYYcomplexfactory(n, k) % Manifold of n x n complex Hermitian pos. semidefinite matrices of rank k. % % function M = symfixedrankYYcomplexfactory(n, k) % % Manifold of n-by-n complex Hermitian positive semidefinite matrices of % fixed rank k. This follows the quotient geometry described ...
e4af5188829ee97de6e3259579187ae19bdbfa782f51d3cff731716cede490d5
MATLAB
4,856
162
function [A,B,e,e_subj] = highdim_pca(X,T,d,embeddedlags,... standardise,onpower,varimax,detrend,filter,leakagecorr,Fs,As) % pca for potentially loads of subjects % % if X is a cell of things, uses SVD % if X is a matrix, uses Matlab's PCA % % d indicates how many PCA components to take, and can be specified % in...
9cc8b37ff3af68b6739062fa9ff8f5e74591e98dd22966726d9192eef495cc88
MATLAB
4,870
84
%-------------------------------------------------------------------------------- % 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 %---------------...
35a6e8dd5ffcb8c3bbb26127f1b11207d2fe5d6674012e9af004162c5130b96a
MATLAB
4,883
139
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [z,reconstruction_information] = zef_relax_iteration(void) h = zef_waitbar(0,1,['Relaxation iteration.']); n_multires = evalin('base','zef.relax_multires_n_levels'); sparsity_factor = evalin(...
afd21d9b9648cf8139c6e4d93740a1ffaa2d972b6220f7f130e417c8ab12eb04
MATLAB
4,901
126
function Fun_ExportTimeSpent(Path, Subject, ScoringPerFile,... ScoringMappingForVS, SleepFrag, EpochLength, NumberOfFilesPerSubject,... FileNamesForSubjects) %% Written and updated by M. Nollet (Aug 2023) % % Function to be used to export sleep architecture and sleep fragmen- % tation/consolidation data...
7707d0e4113cf82388fde0890433c7e2e3f0b2d94781ea0cfaa0ec029511bb4c
MATLAB
4,904
169
function p = stats_TANOVA(obj,design,maps,varargin) % Perform TANOVA analysis on clustered maps %% Check inputs % Check multiple conditions appear in the data if length(obj.conditionlabels) == 1 error('The cohort structure must contain multiple conditions'); end % Get pairs of conditions - check if spec...
4b0799759cd9a8c5e47c0109016e1ed43f31d472dbfd24c17a0c6289db836eae
MATLAB
4,910
160
function h = swarmchart(varargin) %SWARMCHART Swarm chart. % SWARMCHART(x,y) displays a scatter plot where points are jittered in % the x dimension based on an estimate of the kernel density in the y % dimension for each unique x. Swarm charts provide a visualization for % discrete x data that captures th...
1c7d1baa490d9041a6af93d574a150cd58cf7ee326b9be0f3bfc0038475ba96f
MATLAB
4,920
126
%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....
7892685a82403b375ac2ef710f7eb0961552322379a95fa5cf244a787d0f05ab
MATLAB
4,922
177
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 Dipole Scanning method. % % Inputs: % % - self % % An instance of DipoleScanInve...
d8d92ff8879df2d0b8f2077a22f552f271144c5db274d70e374247d657f150b4
MATLAB
4,926
145
function [opt,delta,stats,fh] = sw_run_delta_LFP(varargin) % [rip] = run_ripple_LFP(dat, opt) % top level function to perform slow wave and spindle detection on the same % file % inputs: % 1) dat - data input which can be either % a) string dat='C:/eegdata/rec001.edf' or % b) data s...
71142c6e2910a7c1c8b6a1a4ff6ae26c8b4f25afb77fe6f2495c7024ba800f0a
MATLAB
4,928
129
function events = custardWrapper3( timing, fluo_matrix, params_in, run_params_fields, detailed ) % version 3 adapted for multiple runs on the same data % expects params in seconds, converts to points based on timing % params_in contains multiple sets of custard parameters % all inputs in real units, converted to poi...
9a973f9a65fdb689edc00314a0da022ab7720417a0afda9f08a385358baaa501
MATLAB
4,934
146
function [UI,Q] = admUIg(Psy, Psz, T, innerstop, accu, maxiter) %function [UI,Q] = admUIg(Psy, Psz, conf) %#codegen % 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 % T = 1; % freq test stop cr...
ee1449ebb7eb808acfbb1e0b1e3b9a819c9859ff6f7b1dd4a2c4ea6096125554
MATLAB
4,937
111
function strip_struct = zef_electrode_strip(position, orientation) orientation = 1/norm(orientation)*orientation; center_point = position + 4*orientation; dir_vec = 1/norm(orientation)*orientation; strip_struct = struct; strip_struct.center_point = center_point; strip_struct.radius = 0.635; strip_struct.dir_vec = dir...
f42466ecf7a9938c186c3469fa7bd447ad35d4b8c6357229d8ff1281ee792e5a
MATLAB
4,941
145
% ------------------------------------------------------- % % synthesize_P_QRST_singleBeat.m - This script synthesizes a simulated % P wave and a QRST segment to a full hearbeat % % Ver. 1.0.0 % % Created: Claudia Nagel (13.10.2022) % Last modified: Claudia Nagel (13.10.2022) % % Instit...
37cd63fc14e8faf2c9a4af822f59279ecd1ec4b1a1282f18728a4f441bb80ade
MATLAB
4,963
137
function [centers, metric] = chcenters(varargin) %CHCENTERS Find circle center locations from the Circular Hough Transform accumulator array % CENTERS = CHCENTERS(H, SUPRESSIONTHRESH, SIGMA) finds all the potential % circle center locations from the accumulator array H. CENTERS is a % P-by-2 matrix, where P is t...
54f1faa1796daaa06d61da23cd6137361bd7ffd82f574b43f1379f424edc5156
MATLAB
4,982
171
%================================================ % Some of the setting might already applied to the % saved project. % % This script: % 1. Set noise of the measurement % 2. Selects the leadfield % 3. creates a measurement data % 4. runs kalman % 5. saves measurement and reconstruction to % data bank % 6. crea...
243924a577c86de20ee6058c93e177fb3799116605d97506a4297e37ca7fc867
MATLAB
4,988
191
% BIASFIELDCOR Simple slice-wise bias-field correction of a 3D NIfTI image % [ha,ac,a] = biasfieldcor(file) % biasfieldcor(file,fileout) % Performs a simple bias-field correction on a 3D NIfTI volume. The correction is performed independently % for each axial slice using a local intensity-based bias-field estimati...
6459099f46a68b323c8f3f8f0cd96dc1227daf6d3cdcdc8fe2b6edeb0797b649
MATLAB
4,989
201
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'smoothing_steps_ele')); zef.smoothing_steps_ele = 100; end if not(isfield(zef,'lead_field_filter_quantile')); zef.lead_field_filter_quantile = 0.995; end if not(isfield(z...
87e1bebe5ed2261ba7f5da305368b31759a7c2c27d2b0aca36219c1b2f9e19bb
MATLAB
4,990
77
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_update_fss(zef) if nargin == 0 zef = evalin('base','zef'); end if ~zef.synth_source_updated_true if str2num(zef.find_synth_source.h_plot_switch.Value) == 1 selected_s...
14cc9edc5ae965440206f095ca6a5696fc409afd06f0598c61ae0d3fe31120b1
MATLAB
5,009
134
function [zef] = zef_tool_start(zef,tool_script,relative_size,scale_positions) if nargin < 3 relative_size = 1/2; else relative_size = 2*relative_size; end if isempty(relative_size) relative_size = 1/2; end if nargin < 4 scale_positions = 1; end h_tool = findall(groot,'ZefTool',tool_script); screen_...
ccee7e189e5a653953a627bd22f37de14dcfe5c78423dae58b260cbd85b66f04
MATLAB
5,020
143
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_import_figure(zef,varargin) if isempty(zef) zef = evalin('base','zef'); end file_name = []; folder_name = []; if not(isempty(varargin)) file_name = varargin{1}; folder...
36f4f1197f46c46661504d9cc2ccd08c108c6d61d7f23e8e8a15438d6fda6ced
MATLAB
5,024
104
classdef SolverSGDM_conv4 < nnet.internal.cnn.solver.Solver % ==================================================== % dir = C:\Program Files\MATLAB\R2019b\toolbox\nnet\cnn\+nnet\+internal\+cnn\+solver % ==================================================== % SolverSGDM Stochastic gradien...
dcb33412314cff37862ecabe9c6692c24f354f5e4c99b3b29235d04a0f4314aa
MATLAB
5,024
104
classdef SolverSGDM_conv4 < nnet.internal.cnn.solver.Solver % ==================================================== % dir = C:\Program Files\MATLAB\R2019a\toolbox\nnet\cnn\+nnet\+internal\+cnn\+solver % ==================================================== % SolverSGDM Stochastic gradien...
72e2ec74221d22a29e2d05c3fc47ef7537139aab9523af3e6339b6750e0bb9f8
MATLAB
5,036
143
function zef = zef_ES_plot_distance_curves(zef) if nargin == 0 zef = evalin('base','zef'); end h_f = figure('Name','ZEFFIRO Interface: ES distance curves','NumberTitle','off', ... 'ToolBar','figure','MenuBar','none'); distance_window = 10; n_distances = 2000; max_distance = 100; quantile_val = 0.90; smoo...
7b904cd360db8de42308aca3f693097ba8b1e91bfa66b4c5f1b80cc6aca53cb0
MATLAB
5,046
136
function zef = zef_bst_create_project(settings_file_name, project_file_name, run_type, input_mode, zef_bst, zef) if nargin < 6 zef = struct; end if nargin < 5 zef_bst = struct; end if nargin < 4 input_mode = 1; end if nargin < 3 run_type = 1; end if nargin < 2 project_file_name = ''; end zef_b...
aae03a829049de2ab019928ec5ffa33fad2074adc0d814d5d726b2fb40fbd885
MATLAB
5,050
184
function [p,info] = erp_clusterperm_gfp(obj,design,varargin) % Perform cluster permutation analysis on GFPs %% Check inputs % Check multiple conditions appear in the data if length(obj.conditionlabels) == 1 error('The cohort structure must contain multiple conditions'); end % Get pairs of conditions - c...
4ac29e62326d62eb5a06e89ec20f8075dfcb4018d171af325f2b16c92441a1e7
MATLAB
5,059
138
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_source_interpolation(zef) if nargin == 0 zef = evalin('base','zef'); end if eval('isequal(size(zef.L,2),size(zef.source_directions,1))') eval('zef.source_directions=zef.so...
d80c7a9cbe7b2162da76d544e448330d42f01b6ba8da9fbb9f600e86639277f2
MATLAB
5,060
129
function [tetra, flag_val, nodes_ind] = zef_tetra_turn(zef, nodes, tetra, thresh_val) if isempty(zef) zef = evalin('base','zef'); end flag_val = 1; h = zef_waitbar(0,1,'Mesh optimization.'); ind_m = [1 4 7; 2 5 8 ; 3 6 9]; tetra_ind = 0; iter_ind_aux_0 = 0; [condition_number, tilavuus] = zef_condition_number(...
69e3faa7f49e1bc2d6837583dbd743e2c151f2a2d82eb2b45c96f484c1755346
MATLAB
5,064
179
function M = complexcirclefactory(n, m, gpuflag) % Returns a manifold struct to optimize over unit-modulus complex numbers. % % function M = complexcirclefactory() % function M = complexcirclefactory(n) % function M = complexcirclefactory(n, m) % function M = complexcirclefactory(n, m, gpuflag) % % Description of matri...
5adba34ee2a672dee706c673bb27617aa931ef6bf4c3f47d68f12795bc782f4f
MATLAB
5,095
149
function grad = getGradient(problem, x, storedb, key) % Computes the gradient of the cost function at x. % % function grad = getGradient(problem, x) % function grad = getGradient(problem, x, storedb) % function grad = getGradient(problem, x, storedb, key) % % Returns the gradient at x of the cost function described in ...
829e4ca1488f41602b6727a554696dc79690a5df7ed3ca46dd865c2237dff20a
MATLAB
5,095
158
function [zef,MethodClassObj] = zef_process_inversion(zef,MethodClassObj) % % zef_process_inversion % % A function that processes a given inverter, calling its inverse method % for a number of frames and producing a set of reconstructions. The % inverse methods require the following inputs: ...
c9b1673162bd1b893efe5b9ccd1f7d8c319ccfd86101f6b4fbcca260af9a00f5
MATLAB
5,101
181
function lint_mfiles(folder, kwargs) % % lint_mfiles % % Runs a linter on all .m files in the given folder and its subfolders. Throws % and error at the end, if unacceptable linter messages were discovered in the % process. % % Inputs: % % - folder (1,1) string { mustBeFolder } % % The folder whose .m files will be l...