sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a8c0cdcbcaa5480a538291d237d86caf8da5425cc50da344aac2ca4aa23d4e5f
MATLAB
2,473
65
function ff = fixfocus(msg) %FIXFOCUS Properly open a selection dialog box in presence of a 'uifigure'. % FIXFOCUS provides a workaround to an annoying, long-running MATLAB bug % that opens a selection dialog box (such as a file selection dialog box % called with 'uigetfile') *behind* an app or 'uifigure' window ...
ed60dcfa85e6de4995d6f37acaa294028778b0ef2bd1d081728d264e39e5dcb8
MATLAB
2,479
92
function [W_est Ms crit]=wedge(M,H,W_est0,maxnumit) % % Weighted Exhaustive Diagonalization using Gauss itEration (WEDGE) % % Coded by Petr Tichavsky, March 2008 % % Please cite % % P. Tichavsky, A. Yeredor and J. Nielsen, % "A Fast Approximate Joint Diagonalization Algorithm % Using a Criterion with a Block ...
a9f013a9b16ddc21a5187f6e32a923df262720ce2c22b60cde75b5ea0f085da3
MATLAB
2,482
60
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function h_source = zef_plot_source(source_type) if source_type == 1 h_axes1 = evalin('base','zef.h_axes1'); if isfield(evalin('base','zef'),'h_synth_source') h_synth_source = evalin('...
fddcdf463d46e6002323532407d20cabf519a2bce250871598719313ee43f817
MATLAB
2,482
70
%% 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...
f3680d058439f9c2464ac68980a3e560949a1c5ada2a4ebe0a2be1fc93dae01f
MATLAB
2,487
67
function s=semblance(t,y1,y2,nscales) % SEMBLANCE(t,y1,y2,nscales) % Produces a cross-correlation plot between two timeseries as a function of % both time and wavelength % *** Requires Matlab wavelet toolbox % Type semblance; for demo with synthetic data % Inputs; % t Time axis % y1,y2 Datasets to...
b0c68e4b36f3726e09dc5b6668752dc5aa680b5944f95efefcf936e2c6b74178
MATLAB
2,488
57
function Fun_ExportRawData(Path, Subject, NumberOfFilesPerSubject,... FileNamesForSubjects, NumberOfEpochs, NumberOfSpectrumValues,... Spectra, Scorings, Frequencies, ExportRawCSV) %% Written and updated by M. Nollet (Aug 2023) % % Function to be used to export raw EEG data for each file % % Requires F...
acca47c6410bcf8015f0a61b8b1616c192b1614ffbb9dea1f13e8b46bfbd6e80
MATLAB
2,492
59
function [omega,omega_t] = tudaomega(tuda,Gamma_mean) % Given a precomputed TUDA model, it returns the precision matrix of the % noise (the inverse of the covariance matrix of the residuals) % % INPUT % tuda: Estimated TUDA model, using tudatrain % Gamma_mean: (Optional) if time-resolved coefficients are desired, % ...
7db1f5f59a23f78219d9674b1cbd116a6888c189c21cbb0e2e5525819809a16d
MATLAB
2,493
78
clear all;close all;clc % Set the directory containing the text files dir_path = 'C:\lbs\TMS2021\mauscript\codes_for_dataprocess\Exp2_RT'; % Get a list of all files in the directory % dir_contents = dir(fullfile(dir_path, '*cTBS*.csv')); dir_contents = dir(fullfile(dir_path, '*iTBS*.csv')); dir_contents2=dir_co...
ad3e9c14cadbfec515388afac9ba84ec26985f4d0d5c73dd03d9c2538509cc3f
MATLAB
2,494
67
clear all close all addpath('utility/') addpath('hatime_func/') addpath('hb_func/') %% config simulation parameter sim_parm.fs_raw = 20000; % raw sampling rate [Hz] sim_parm.fs = 50; % acquired sampling rate [Hz] sim_parm.p = 1; % nonlinearity parameter: 1-'linear', ...
b8a9617e3935c7077617ae7d9f6890a5b29c0dc5b07ae89687d26276456e8096
MATLAB
2,494
61
function matFilteredSignal = imfiltreflectpad(matSignal,matFilter) %buildConvolutedMatrix applies 2D convolution of matFilter to matSignal %with edge-reflected copies of the signal matrix % matFilteredSignal = imfiltreflectpad(matSignal,matFilter) % % Version history: % 2.0 - July 20 2015 % Created by Jorrit M...
a4d5ccd42f21f7438e067c8d28741cd44c36b5a28ee36c82d205062ee7801f84
MATLAB
2,498
54
function [vecPseudoOri,matWhitePseudoData,matPseudoData] = buildPseudoData(cellLabels,cellData,intUseReps) %buildPseudoData Builds pseudo data %[vecPseudoOri,matWhitePseudoData,matPseudoData] = buildPseudoData(cellLabels,cellData,intMinRep) % %Input: %-cellLabel{i} is a vector with trial labels (e.g., stim orienta...
2444c1eccdbedbd0e5837e7102956cc32db1591e6fdd9447685993eff4964457
MATLAB
2,501
69
%% 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...
ae68f1566cdc6bf21ad94489c904e4f57e43a498692791ad6f0efd19def3a776
MATLAB
2,504
79
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface zef.lf_item_selected = get(zef.h_lf_item_list,'value'); zef.aux_field = get(zef.h_source_interpolation_on,'value'); for zef_i = 1:length(zef.lf_bank_storage) if ismember(zef.lf_item_list{zef_i},...
6f6d3bf7e99fd9a1d7139e9d74939535e0e1594a9cc91fc9e8feef79e4812016
MATLAB
2,506
107
% zef_mpo_system % % A function for generating a matrix of interpolation coefficients via mean % position and orientation- or MPO-optimization. % % Input: % % - arg_locs % % An N × 3 dipole location matrix needed in interpolation. % % - arg_dirs % % An N × 3 dipole direction matrix needed in interpolation. % % - ar...
b1255f882cd89aa1e15c8f97c3762eb2963006ef5022eec96c668790a5daf32e
MATLAB
2,515
73
function dblDeltaPrime = getDeltaPrime(vecResp,vecAngles,boolBiasCorrection) %getDeltaPrime Calculates the orientation selectivity metric \(delta)' % dblDeltaPrime = getDeltaPrime(varResp,vecOri) % %Inputs: % - vecResp; [1 x Trial] response vector % - vecAngles; [1 x Trial] stimulus orientation vector [in radian...
0ebea107e110ab457cddca8e1f669a089e74b2fdce6fdf94f9acbb9210b0cd02
MATLAB
2,521
89
function [X,XX,Y,T] = loadfile(file,T,options) % load the file and does some optional preprocessing if iscell(file) % T needs to be cell too T = cell2mat(T); for j = 1:length(file) if ischar(file{j}) fsub = file{j}; loadfile_sub; else X = file{j}; end...
194f470f68d95830298f4b29295bdd2545a05caffabf0ce878bd5d2a37f649b0
MATLAB
2,521
90
clear path = '../../CommonExperiment'; p = genpath(path); addpath(p); path = '../Stim_Dev'; p = genpath(path); addpath(p) diotic = 0; folder_loc = '/media/ravinderjit/Data_Drive/Data/Stimuli_WavMat/FMphi/'; folder_loc = '/home/ravinderjit/Documents/OnlineStim_WavFiles/FMphi/'; if diotic folder_loc = '/home/rav...
14c43c3a6427f2b1ea15bf3d42b4db95af4df5ea7eaf491be678a589cd0fa331
MATLAB
2,529
69
%% 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...
61fe09a7198f1447f0bb368ce759277e57ca5d86ae822dd05a0c633397c48694
MATLAB
2,542
78
function S = getStartFinish_StateVisits (vp,T,options) % Decomposes a Viterbi path into a list of visits, each characterised by % start time point and finish time point. % % S is a (N x K) cell, where N is the number of data time series % (length of T) and K is the number of states; each element of S contains % a m...
9c11f953cb36f434c9f1a3dcfb078162dc9ee6436e59d38be1a9e4076437aa50
MATLAB
2,544
82
% Code used in Vidaurre et al. (2017) PNAS % % 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/diegov/MATL...
a1aa99dcb2e94bc3f2098c43e9f0d9bca7a453fe567e5d526a85bf7d804f5ee3
MATLAB
2,544
65
function [X,flips] = aligntotask(X,T,events,window) % Assuming that the sign ambiguity across channels has been resolved using % findflip/flipdata.m, we might need to go one step further, under % the condition that we have a task or a stimulus to lock to. % If our interest is for example to get the stimulus-locked ave...
6ad5f78a0adba3bb9778abe99369a9b0288fe588b744b93adca365fd8add6d0a
MATLAB
2,550
74
%Copyright © 2021- Sampsa Pursiainen & GPU-ToRRe-3D Development Team %See: https://github.com/sampsapursiainen/GPU-Torre-3D function [I] = tetra_in_compartment(reuna_p,reuna_t,nodes,compartment_info) max_x = max(reuna_p(:,1)); min_x = min(reuna_p(:,1)); max_y = max(reuna_p(:,2)); min_y = min(reuna_p(:,2)); max_z = ma...
5a7b2558111bc1069290a6c5fa1c092034c93eb92deddcedef2282aab695e06a
MATLAB
2,557
75
function [evokedGamma,t] = evokedStateProbability(stimulus,T,Gamma,window,options) % Gets the evoked state relative to a stimulus % % INPUT % stim A (time x 1 = sum(T) x 1) boolean indicating when the stimulus occurs % T Length of series % Gamma State time course % window Window len...
5ff1099a3c5f2e0272631272dc31273c7a3e3285068955ef81f1b88a4774dbe4
MATLAB
2,557
78
function [log_likelihoods_each_frame, model_performance] = assess_decoding(params, best_model) % returns both ll & perf so we can do other things if we want model_performance = struct(); true_udf_labels = params.udf'; num_original_nodes = size(params.data, 2); num_udf = size(true_udf_labels,1); total_frames = siz...
30a09322323052499149d59de264875fc2ce2eab801b1f4b58ac413a89bc9217
MATLAB
2,570
72
function gamma = mymcs_gamma_lutkenhoner ( 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 Con...
5ad3c3738481874b3f46ccc7f86b7da920b06adb7af22af9ef1beadfc6e584fc
MATLAB
2,575
95
function pvalues = hmmtest_epoched(Gamma,T,Y,Nperm) % Statistical testing on how the probability of the states is modulated % by a stimulus, time point by time point. % For statistical testing on differences between groups of % the average time spent on the different states, % or how quickly state switching happens, ...
f00c6e5e875c1af5c103a55ba2edab0907927e8edca3c091504b4bf6c010e5d7
MATLAB
2,575
74
function egrad = getPartialEuclideanGradient(problem, x, I, storedb, key) % Computes the Euclidean gradient of a subset of terms in cost function. % % function egrad = getPartialEuclideanGradient(problem, x, I) % function egrad = getPartialEuclideanGradient(problem, x, I, storedb) % function egrad = getPartialEuclidean...
2d94b3f150949855038e07339b069f323406a0b2922d176c5e07058e9ddffaf5
MATLAB
2,578
72
function [data, udf] = secondary_validation_dataset_balance(udf, data) % rule of thumb is to consider 1 - 10 positive-negative probability as sufficiently imbalanced % however if num udf is greater than 10 we'll make an exception in this such that all classes ought to be no % less than (1 - num_udf) / 2 num_samples...
706327aa1520a3e0abe5adca741cbd7508db3cc2a2e25ad02d142ac221600986
MATLAB
2,581
92
function pg = pulsogram(eeg, pulseon, sniplen, pperiod) %% Calculate Pulsogram for eeg % pg = pulsogram(eeg, pulseon, sniplen) % eeg - tdt stream data (with fs and data) % pulseon - Pulse onset timestamps (sec) % sniplen - length in milliseconds relative to each pulse to snip if ~exist('sniplen','var') ||isem...
45c60d41c9aef880f63ed1778b1b09535d385b8d77c6c6b797a21fe37bc51206
MATLAB
2,582
70
function [domain_labels, subcompartment_labeling_priority_vec, compartment_labeling_priority_vec] = zef_choose_domain_labels(zef, label_array, use_labeling_priority, ordinal_index) if nargin < 3 priority_mode = 1; end if nargin < 4 ordinal_index = 1; end domain_labels = []; submesh_vec = cell2mat(zef.reun...
a33612200f19a918961ce53be4127d879ad97222a5da07fa0c6b3a066065c758
MATLAB
2,586
103
function [g, dg1, dg2] = spike_func_evaluate(tau, data) % spike_func_evaluate % --- % [g, dg1, dg2] = spike_func_evaluate(tau, data) % --- data in spike window % data.y(k,:) : y(k,t) : observed data in k-th window (Nwin x Nt) % data.Dt{k} : spike onset in k-th window [sec] (1 x Nspike) % data.dt ...
2e0cb927c0cc5349a482c68ccca170984307e1b4bb7cff3de6f76d006a8e8a68
MATLAB
2,594
68
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_init_ias(zef) zef = zef_ias_map_estimation_window(zef); set(zef.h_ias_map_estimation,'Position',[ 0.5764 0.2944 0.15 0.40]); set(zef.h_ias_map_estimation,'Name','ZEFFIRO ...
fab9fdd1534e4d442842d784557f2590392951b48f345d138e0496dc845222b0
MATLAB
2,597
69
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [multires_dec, multires_ind, multires_count] = zef_make_multires_dec(varargin) if not(isempty(varargin)) n_decompositions = varargin{1}; n_levels = varargin{2}; multires_sparsity ...
7635d33819f475ca4ea28d9d2aedfd23c5ff42db456038e5119b44f3631d9761
MATLAB
2,600
76
function zef = zef_update_fss_ROI(zef) %the number of entries in x coord defines our number of sources %if there is eg only one radius, that will be applied for all source coords size_1 = size(str2num(get(zef.h_synth_source_ROI_x,'string')), 2); % Define all fields and whether they should be repeated (true) or reshap...
d8ea00491498f59102b5920f6e0a2e486a38a2ae0457f3c1586a077ebc5588e2
MATLAB
2,603
39
% %adds the leadfield and data in the aux field to the bank % % zef.LeadFieldProcessingTool.bank{zef.LeadFieldProcessingTool.bankPosition}.source_interpolation_ind = zef.LeadFieldProcessingTool.auxData.source_interpolation_ind; % zef.LeadFieldProcessingTool.bank{zef.LeadFieldProcessingTool.bankPosition}.parcellation_i...
33b3160dee24f27eb526874f0f09998780a8a7757ac71a457875e9b581c991d0
MATLAB
2,605
78
function params = create_params_struct(regime_type, durtn, outdirpath) switch regime_type case 'AI' params.outdirname = fullfile(outdirpath,'AI'); params.KBuff{1} = 3.5; params.O2Buff{1} = 32; ICfilename = './ICs/AI_IC.mat'; ca...
5a745d72403924835e21eb183210be90d59ffe775356e828e9ae343b3b97580f
MATLAB
2,608
60
function [ptrPanelParent,ptrSlider,ptrPanel,sPointers] = ETO_genQuadSliders(ptrMainGUI,vecLocation,strName) %error 'add description of entries (vertical?), add tracking parameter button+gui, and add "run all" button' %% set constants %unpack location vector dblPanelX = vecLocation(1); dblPanelY = vecLocation(2...
e9af536b658cdea5e2224055a0b54bfd3add3e365927efc8a98e6289a8d5e008
MATLAB
2,608
90
function [dat,opt] = sw_load_scoring (dat, opt) % beta version use with caution! some hardcoded params in here! % function to add sleep scoring to sleepwalker dat structure % sleep scoring come in many formats, this will likely to be customised % this function can only import sleepsign scoring (rodents) for now if is...
ef2b4997630be3c622138ab4c23e58ab20bee280b5ee02e839c00d69eb8f19d2
MATLAB
2,612
75
% tuto2_FFT_filter_Process.m % ------------------------------- % Author : Laurent Bonnet (INRIA) % Date : 25 May 2012 % function box_out = tuto2_FFT_filter_Process(box_in) for i = 1: OV_getNbPendingInputChunk(box_in,1) if(~box_in.user_data.is_headerset) % The output is the input + noise, only on fir...
007259faabff92019a8768310a9476b21496a3249c21e74fc922d5400e3e4bbb
MATLAB
2,613
82
function [XX,Y] = formautoregr(X,T,orders,maxorder,zeromean,single_format,B,V) % % form regressor and response for the autoregression; % residuals are assumed to have size T(in)-order in each trial % % Author: Diego Vidaurre, OHBA, University of Oxford N = length(T); ndim = size(X,2); if nargin<5, zeromean = 1; end...
c288f5462821e48fdc318cb670dbafcfef0f207ae2fce826fbb83e52ebee13c4
MATLAB
2,613
68
zef.aux_field_1 = zef.h_sensors_name_table.Data; zef.aux_field_2 = []; zef.aux_field_3 = []; for zef_i = 1 : size(zef.aux_field_1,1) if not(isnan(zef.aux_field_1{zef_i,1})) zef.aux_field_2 = [zef.aux_field_2 zef_i]; zef.aux_field_3 = [zef.aux_field_3 zef.aux_field_1{zef_i,1}]; end end [~, ze...
4324c2c76139a00a577666803646696213b3bf686f5e28cdf59acb5581020a49
MATLAB
2,615
68
function [log_likelihood_ratio] = calculate_log_likelihood_neuronal(params, best_model) %% set up num_original_nodes = params.num_neurons; num_udf_nodes = params.num_udf; num_nodes = num_original_nodes + num_udf_nodes; x_train = params.x_train; x_test = params.x_test; x_valid = params.x_valid; dataset = [x_train; x_v...
76adb7b8b58eb6977b1c66f3d427d3a670a802090c56ed137e23d5e37f8d56e2
MATLAB
2,619
68
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function zef = zef_init_sl1(zef) zef = zef_sl1_map_estimation_window(zef); set(zef.h_sl1_map_estimation,'Position',[ 0.5764 0.2944 0.15 0.40]); set(zef.h_sl1_map_estimation,'Name','ZEFFIRO ...
fd98e596d7578ba8eacd9508bdb1a4416b75d0155cd141a20f123190cb571748
MATLAB
2,625
83
function Gamma = simgamma_ltd(T,P,Pi,rate,L,refractory_period,grouping) % % Simulate state time courses with longer-than-markov time dependencies % % INPUTS: % % T Number of time points for each time series % P Transition probability matrix (K by K) % Pi Initia...
2dec9fa6c14f2c6eb420aafec6f0f948e15719f049af163e1e4a989c386e95e0
MATLAB
2,630
81
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function [c_table,c_points] = zef_parcellation_default(zef) c_table = cell(0); c_points = cell(0); c_ind = 0; submesh_ind = eval('zef.submesh_ind'); if isempty(submesh_ind) submesh_ind = ones(siz...
9ae7dd069cce44ce50d803a5c0c47ded81ae8e34fbbdea6f91e962086254e4f8
MATLAB
2,630
72
function [vecParams,matFit,resnorm,residual,exitflag] = getFitGauss2D(matDataGrid,vecParam0) %% getFitGauss2D Fit a 2D gaussian to data % Syntax: [vecParams,resnorm,residual,exitflag,matFit] = getFitGauss2D(matDataGrid,x0) % % Inputs: % matDataGrid: 2D data matrix % vecParam0 = [z0, gain, x0, x-width, y0, y-w...
5a6b89e1a1b409bd0f0b65d222fc7faa4f2de9f27c69529b2faf1b4650547b95
MATLAB
2,631
48
function hmm = states_supdate(hmm,hmm_noisy,rho,update) % update==1, W; update==2, Omega; update==3, sigma; update==4, alpha K = length(hmm_noisy.state); Sind = hmm.train.Sind==1; regressed = sum((hmm.train.S==1),1)>0; for k = 1:K if update==1 && isfield(hmm_noisy.state(1),'W') && ~isempty(hmm_noisy.state(1).W.Mu_...
fa879fe93d2aca16a0562149a42a62f48a9c5279ac3bc5b928450fe3cc6b97b1
MATLAB
2,631
57
%-------------------------------------------------------------------------------- % fig3_figure_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 Iso...
1528e93c5d3b0fcdfd3f34baff7f74d54af856e6f11f6b930bcd4ba7da293d8f
MATLAB
2,632
100
function h_arrow_vec = zef_plot_3D_arrow(x,y,z,u,v,w,varargin) h_axes = gca; hold_state = ishold(h_axes); 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 not(isempty(varargin)) arrow_scale = varargin{1}; if length...
25db4c1eb332d0998c3edaddbd8c1593809e944bf458cabf3f7d4f9095322b64
MATLAB
2,637
90
function [stensil, signs, source_moments, source_directions, source_locations, n_of_adj_nodes] = zef_ew_dipoles( ... nodes ... , ... tetrahedra ... , ... brain_ind ... ) % zef_ew_dipoles: generates the vectors related to edgewise dipoles in the % tetrahedral...
cde5a649d3909a772d4eb85921fe9ccecca71c6d496f873b5a80962b78214339
MATLAB
2,643
88
function [G, dipole_locations] = zef_lead_field_interpolation( ... p_nodes, ... p_tetrahedra, ... p_brain_inds, ... p_source_model, ... p_intended_source_inds, ... p_nearest_neighbour_inds, ... p_optimization_system_type, ... p_regparam ... ) % Chooses the interpolation method base...
b51069e3e995cfd9b1a3e3be11b68188f6acfd4c28135bdd151b73a92ff2fe69
MATLAB
2,644
83
function hmm = hmmhsinit(hmm,GammaInit,T) % Initialise variables related to the Markov chain % % hmm hmm data structure % % OUTPUT % hmm hmm structure % % Author: Diego Vidaurre, OHBA, University of Oxford % if isfield(hmm.train,'grouping') % Q = length(unique(hmm.train.grouping)); % else % Q = 1; %...
215a3b33a9602e15d0b40bce9daece36ebd08191062da05d5e990ef2750f3205
MATLAB
2,646
60
% Load NIfTI toolbox addpath('/Users/....'); % List your input NIfTI files input_files = { '/Volumes/Data/Data2/MRI/fMRI/projects/marmoset_awake_bruker/Vocalization_Azadeh/1.MYPAPER/SingleSubjects/SingleSubject_m1_Vocal_vs_Nonvocal_Tstat.nii'; '/Volumes/Data/Data2/MRI/fMRI/projects/marmoset_awake_bruker/Vocal...
cf9b78b889e83709719e38c626adc3643f66a9a8f046fd0fae3fa8f26eef03bb
MATLAB
2,646
77
function subgrad = getSubgradient(problem, x, tol, storedb, key) % Computes a subgradient of the cost function at x, up to a tolerance % % function subgrad = getSubgradient(problem, x) % function subgrad = getSubgradient(problem, x, tol) % function subgrad = getSubgradient(problem, x, tol, storedb) % function subgrad =...
fd3f03a0fd988571581880fd6e51b10e2b774fde012c3f8c968ea571cc19c474
MATLAB
2,648
84
function [y,ty,x,tx] = ode_LL(P,M,U) % Performs integration using Local Linearization for a system of the % form: % % df/dx = f(x,u,P,M) % y = g(integral(f)) + e % % Inputs: % P - model parameters [Np x 1] % M.x - starting values for hidden states ...
b4fadfbfac3485a0a8d49d729bdaa1c2957f6bc661d9cd881b023a5bb10d5eed
MATLAB
2,653
76
function [sr, sc] = zef_ES_objective_function(varargin) %% Check for zef switch nargin case {0, 1, 2} if nargin == 0 zef = evalin('base','zef'); warning('ZI: No zef were called as an input argument.') else zef = varargin{1}; end obj1 = zef.ES_ob...
97d0a9e2b97e2158ca82e7872d486644d53266beb03901d7d18b72cfc187ac00
MATLAB
2,655
61
function plot_pcn_coordinates_style_2(app) v = app.Stimulus_PCN.Value; ROI_contours = app.rois; num_rois = size(ROI_contours.xpix,1); newcolors = app.newcolors; udf_label = app.params.udf_labels{v}; app.pattern_completion_coordinates.Title.String = strcat(udf_label, ': Pattern Completion Neuron Coordinates'); pcn_...
e0ed4606fc4e2f4d78cb79f2ed1fe64ce3226afb4be0499b28c8819e670866c3
MATLAB
2,655
52
function [relax_preconditioner, relax_preconditioner_permutation] = zef_relax_find_preconditioner relax_multires_sparsity = evalin('base','zef.relax_multires_sparsity'); relax_multires_n_decompositions = evalin('base','zef.relax_multires_n_decompositions'); relax_multires_n_levels = evalin('base','zef.relax_multires_n...
4ff2c55cad2f78411bfce8d641799186e93a51f04d5063fa42f172084994e4a6
MATLAB
2,656
66
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface if not(isfield(zef,'relax_preconditioner')); zef.relax_multires_precondtioner = []; end; if not(isfield(zef,'relax_multires_n_decompositions')); zef.relax_multires_n_decompositions = 1; end; if...
3e90992ae60ed04e3913da0d93b1d4b43c35da453b493a61763619892a54e1a8
MATLAB
2,657
91
function [vecOptimParams,dblEdgeHardness,imPupil] = getCircleFitWrapper(matIn,vecApproxCentroid,dblApproxRadius,imIgnore,imBW) %getCircleFitWrapper Optimizes a circular or ellipsoid fit on an input image (range: 0-1) % [vecOptimParams,dblEdgeHardness,imPupil] = getCircleFitWrapper(matIn,vecApproxCentroid,dblApproxRad...
95841973d636ebc532e5281fcc2d63b3cc3452f5ece809250106f9013aa77e07
MATLAB
2,659
84
function [p_vec_window,relative_size] = zef_change_size_function(object_handle, current_size, varargin) relative_size = []; exclude_type = cell(0); scale_positions = 1; if not(isempty(varargin)) if length(varargin) > 0 %#ok<ISMT> relative_size = varargin{1}; end if length(varargin) > 1 excl...
ac97db738b4cc77a6f188ff5a86c80af688d24e3014510394ff8fdfb6dedb837
MATLAB
2,664
101
classdef VirtualKeyCode < uint32 % https://msdn.microsoft.com/de-de/library/windows/desktop/dd375731(v=vs.85).aspx enumeration VK_LBUTTON (1) % Left mouse button VK_RBUTTON (2) % Right mouse button VK_CANCEL (3) % Control-break processing VK_MBUTTON (4) ...
43e168220971b232d79a33601299fce6d6d0703d8904ab00cd5f5ab049eea9bb
MATLAB
2,667
116
function [maxsl,maxsli]=max_slope(cscf,ts,startind,flag) %simple numerical slope estimation from selected parts of the wave % 2 slopes: positive (DOWN>UP) and negative (UP>DOWN) with in each wave % each slope type has two types % a type: from superthreshold peak to superthreshold peak % b type: from superthreshold to ...
0230672a734b1de57f9860c395e83994f4de8a36677fe62b929647d6f2b012d5
MATLAB
2,668
98
function h=plot_parameters(Ep,Cp,gP,xlabels) % Plots the estimated parameters of a model, optionally in a grouped % bar plot with the parameters used to generate the data. % % Ep - vector of expected values of estimated parameters % Cp - covariance matrix of estimated parameters % gP ...
8d1d71570f305b9520dacd70e65d221212c7a2483e4ad67cca43373eb1b4efc0
MATLAB
2,670
96
function train_info = train_information(data, parm) % train_information of spike data % train_info = train_information(data, parm) % % --- train_info % train_info.spike_num(n) = spike number of n-th window % train_info.spike_time{n} = spike peak time % of n-th window [sec] % ...
24f10fed8eefef708dc4d3b04cf1cd5e4cd079b36dd5b211e64b8aee7c4ae228
MATLAB
2,674
27
zef_data = zef_segmentation_profile; zef_assign_data; zef.h_segmentation_profile_table.Data = readcell([zef.program_path '/profile/' zef.profile_name '/zeffiro_segmentation.ini'],'filetype','text','delimiter',','); set(zef.h_segmentation_profile_table,'CellSelectionCallback',@zef_segmentation_profile_table_selection)...
2bac7ee039d4335c85ca777c80a6661a411329b5d1df893718087cfdcba1435b
MATLAB
2,676
110
function spike_time = generate_poisson_spike(parm) % ----- Poisson spike generation % spike_time = generate_poisson_spike(parm) % % spike_time = time of spike firing [sec] (Nspike x 1) % ----- Poisson spike generation setting % parm.Nspike = number of spikes % parm.fs_spike = spike freq [Hz] % ----- mult...
7cd3758f3bf456862cfd00f3148d39d8d81997c57363a7ec631711e04d4ac855
MATLAB
2,682
83
function avLL = GammaavLL(hmm,Gamma,Xi,T) % average loglikelihood for state time course % if isfield(hmm.train,'grouping') % DEPRECATED % Q = length(unique(hmm.train.grouping)); % else % Q = 1; % end Q = 1; N = length(T); order = (sum(T) - size(Gamma,1))/N; avLL = 0; K = size(Gamma,2); do_clustering = isfield(...
c2c11b780f1e2edb0e0a7090adeff973cd693bacda4d4113809d6b0840fa2135
MATLAB
2,683
68
function [log_likelihood_ratio] = calculate_log_likelihood_udf_only(params, best_model) %% set up num_original_nodes = params.num_neurons; num_udf_nodes = params.num_udf; num_nodes = num_original_nodes + num_udf_nodes; x_train = params.x_train; x_test = params.x_test; x_valid = params.x_valid; dataset = [x_train; x_va...
db94b794555365a6aa8fcf347bcbde6e2934ac6929dbdec43954a2370944aa0d
MATLAB
2,698
69
%% 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...
6362525c695076af64f3755230229ccee8726567e75711ce02dd69abd0c62c14
MATLAB
2,711
96
/* Magma code to randomly generate 150000 weights corresponding to terminal weighted projective space, in dimensions 1..10. The resulting weights are written to the files "rank_1_dim_N.txt", where N is the dimension. */ // Returns true iff PP(wts) is terminal. Assumes that the weights wts are // well-formed. // "Bound...
11a064543d5d290e59ba8aefae6d63936d92774c188e50d7cf3c1167b20cc13f
MATLAB
2,713
81
function grad = getPartialGradient(problem, x, I, storedb, key) % Computes the gradient of a subset of terms in the cost function at x. % % function grad = getPartialGradient(problem, x, I) % function grad = getPartialGradient(problem, x, I, storedb) % function grad = getPartialGradient(problem, x, I, storedb, key) % %...
598c4526ba0a1f6e4c59b9e34492b4dc581aefd099ff7041935891fec9ced0c2
MATLAB
2,713
72
function [vecCounts,vecMeans,vecSDs,cellVals,cellIDs] = makeBins(vecIdx,vecVals,vecBins) %makeBins Bins an indexed vector and returns the mean/sd/etc per bin % syntax: [vecCounts,vecMeans,vecSDs,cellVals,cellIDs] = makeBins(vecIdx,vecVals,vecBins) % description: bins using vecIdx and returns % the number (vecCoun...
705dc3ff32f9c1ea0a91b2f3305c1946f53b968edecdaa3caf1c3b5539bad00a
MATLAB
2,714
60
function [ptrPanel,ptrSliderLeftTop,ptrSliderRightTop,ptrSliderLeftBot,ptrSliderRightBot] = ETP_genQuadSliders(ptrMainGUI,vecLocation,strName) %ETP_genQuadSliders Generates quad sliders % [ptrPanel,ptrSliderLeftTop,ptrSliderRightTop,ptrSliderLeftBot,ptrSliderRightBot] = ETP_genQuadSliders(ptrMainGUI,vecLocation,str...
421323e2dd1eccdb4a6ee63062cae86c54e564f3be3951c40a0a1032cbf5a687
MATLAB
2,716
114
%% VL Scheme - Single exponential example % define model % ------------------------------------------------------------------------- M = struct(); f = @(x,u,P,M) -exp(P) * x; % Exponential decay of variable x g = @(x,u,P,M) x; % Observation model (x is fully observed) M.f = f; M.g = g; M.x = 1; ...
199e6fcd1f4e86b7abf6cb20607bc7ea3a7b1b0029bb813dee354a5af3d84b4a
MATLAB
2,719
72
function N = tangentspacefactory(M, x) % Returns a manifold structure representing the tangent space to M at x. % % N = tangentspacefactory(M, x) % % N defines a (linear) manifold that is the tangent space to M at x. Points % are represented as tangent vectors to M at x. Tangent vectors are also % represented as tangen...
a99e45607be8e1e4b08888e113dd4ebcdd732c68839feaa95187d16f344ba592
MATLAB
2,721
76
function [seed, Nmax]=SetRandState(OldSeed) % SetRandState - set random generator in arbitrary but reproducible state % seed = SetRandState; % sets the MatLab random generator of RAND and RANDN in % an arbitrary but reproducible state. % % The state of the random generator is reproduced by calling % ...
0efe0edcbac28dfd3975a848877f1571a7c5a1537e30b72fc0173262fd2b6499
MATLAB
2,723
100
function [a,b] = update_spike_amplitude(tau, data) % update_spike_amplitude & bias for spike model % --- % [a,b] = update_spike_amplitude(tau, data); % --- data in spike window % data.y(k,:) : y(k,t) : observed data in k-th window % data.Dt{k} : spike onset in k-th window [sec] (1 x Nspike) % data.d...
fe41d87706cd6b9eabb8d2bd407fecb990176b95233f87cdca18e99f6f0b2194
MATLAB
2,730
79
function gamma = mymcs_gamma_yao2003_err ( 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 Con...
9c2deb75b1aa155eec32534fc72ec4a9867bcf0d9d9accbfa359196110f2a657
MATLAB
2,735
92
function [posOri, magnetometerLabel, gradiometerLabel, tra] = getMagnetometerPositions(MEGdata, OptionalName, OptionalPlace, OptionalSave1or0) %getMagnetometerPositions extracts the important information about the MEG %gradiometers of fieldtrip processed MEGdata. %It extracts the postion and orientations of the magneto...
a3ca46f184c8f6afd3122044899d5ee12e14c2c592beb34bfd52f607b9d7a894
MATLAB
2,735
84
clear all close all clc addpath('./tools/') %% test for network size, training length, % reset time and noise level % please record the rmse and running time % network_set = round(exp(linspace(log(20), log(270), 10))); % training_length_set = round(exp(linspace(log(2000), log(150000), 10))); reset_t_set = round(li...
e11babd58ed4365b6e3d52f07c546eaa57c545e487467a360916e361129f958a
MATLAB
2,736
92
function hPanelDatimex = ETP_genDataPanel(ptrMainGUI,vecLocation) %get globals global sETP; global sFigETP; %% set constants %nr of frames to import sETP.intImportPoints = 25; sETP.intImportStretch = 100; %unpack location vector vecX = [0.01 0.3 0.55 0.8]; dblButtonWidth = 0.2; dblTextW = 0.13; dblEdi...
8b3b837554fafc4936b75ab2524b97857e2db2f2ab47daaf655ffd4165a36c02
MATLAB
2,738
89
function sp_fit = spectbands(sp_fit,bands) % % From a multitaper or MAR estimation of the states spectra, % it decomposes the spectral information (which is given by frequency bin) % into a set of frequency bands in order to facilitate interpretation % and visualisation % % INPUTS: % % sp_fit The ou...
1e5700df1a409e8f6cea453c0bfe863d55299de8323ba58dad30787bee28a118
MATLAB
2,739
102
function sp_fit = relspect(sp_fit,standardise) % % Computes the relative spectra for a number of states' estimations. % This is done by substracting, for each frequency bin (or frequency % component, as returned by spectdecompose) and region, the mean of the % estimation across states. % % % INPUTS: % % sp_fit ...
cce5e3ab8a7f179132af769653db984810915a0176005a22755d141ecc6cfefd
MATLAB
2,739
58
function zef = zef_axes_popup(zef) if nargin == 0 zef = evalin('base','zef'); end zef.h_figure_aux = gcf; zef.h_zeffiro_axes_popup = figure(... 'PaperUnits',get(0,'defaultfigurePaperUnits'),... 'Units','normalized',... 'Position',[zef.h_zeffiro.Position(1)+zef.h_zeffiro.Position(3) zef.h_zeffiro.Posit...
e2ad4a4ee96addd3f67bff384e7661dd6085de714bb8042f8ee8552d4924aae3
MATLAB
2,749
83
%% Nat Comms Ictogenesis Figure 3 clear CONFIG = struct(); CONFIG.SZID = 'SZ_OP141_D210415-1211_T0600'; CONFIG.offset_adjust__ms = 7; CONFIG.pre_pulse__ms = 20; %% Calculate pulsogram and spectrogram szdat = load(CONFIG.SZID); % Pulsogram eegdat = struct('data',szdat.EEG.EEG_filt,...
4bcccaa6a8144812b7ed9d62c84a87fbc5898abaf047f2b70aca60dfe4cba3bb
MATLAB
2,754
110
classdef DipoleScanInverter < inverse.CommonInverseParameters & handle % % DipoleScanInverter % % A class which defines the properties needed by the Dipole Scan inversion method, % and the method itself. % properties % %The inverse algorithm used. The options are currently...
94c7281d28abc457b6ac7f1baad181a78a9a4120a06c58a63921862d7b365bf8
MATLAB
2,755
97
function M = shapefitfactory(VJt) % Linear manifold structure for optimization over the ShapeFit search space % % function M = shapefitfactory(VJt) % % Input: VJt is a matrix of size dxn, such that VJt * ones(n, 1) = 0. % % Returns M, a structure describing the Euclidean space of d-by-n matrices % equipped with the sta...
4f9f2698c2a6d51e6c11f037659b750a9f161c01df1298fd375383eb18941aaa
MATLAB
2,763
118
function [labels, colors] = read_ascii_label_file ( fname ) % % read_ascii_label_file ( fname ) % % Reads a given FreeSurfer-generated ASCII label file. % % Inputs: % % - fname % % The ASCII label file. % % Outputs: % % - labels % % The labels as a column vector of integers. % % - colors % % The RGB color values ...
150cbb323b2855384f316b4633ba4ab6d92c26d90abb8557580c3091ae1d9712
MATLAB
2,771
51
%This is the startup script for KF app. One must add this as launch %script to zeffiro_plugins file: %Beamformer, inverse_tools, zef_KF_start zef.KF = zef_kf_app; %_ Initial values _ zef.KF.inv_snr.Value = '30'; zef.KF.inv_sampling_frequency.Value = '1025'; zef.KF.inv_low_cut_frequency.Value = '7'; zef.KF.inv_high_cu...
52434ab55e081ed285ae2f17edac8fc078bd3f6d6b96670ecb17aeca81244132
MATLAB
2,776
103
function M = euclideanfactory(m, n) % Returns a manifold struct to optimize over real matrices. % % function M = euclideanfactory(m) % function M = euclideanfactory(m, n) % function M = euclideanfactory([n1, n2, ...]) % % Returns M, a structure describing the Euclidean space of real matrices, % equipped with the standa...
5ab46b7fd3116ce80e6068605200c1995e0b28a66ba3b6d0737c0a4c27808402
MATLAB
2,780
77
%% Nat Comms Ictogenesis Figure S7 clear % Uncomment the mouse to plot % % load('20230715_ExampleSeizures_OP141.mat'); % % load('20230715_ExampleSeizures_OP138.mat'); load('20230715_ExampleSeizures_OP126.mat'); CONFIG = struct(); CONFIG.smooth_eeg__ms = 2; CONFIG.smooth_pulso__sec = 0.2; CONFIG.offset...
7f2857ad5da29b6f0fb4cc05a5cda5a073a1d1bbdb04ea3afa56a4243194ae2d
MATLAB
2,783
75
classdef SingleModel %SingleModel On single model (generated by one combination of %regularization parameters and density). properties % training and test sets x_train, x_test; x_valid; % struct with % F (2xnode_count matrix with node weights) % ...
7f3f3ed1b09562bfda7d9f7614be2479e9cceb1f262e038847927c33589bf9ec
MATLAB
2,788
73
%Copyright © 2018- Sampsa Pursiainen & ZI Development Team %See: https://github.com/sampsapursiainen/zeffiro_interface function h_source = zef_plot_source(zef, 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 ...
eecc444cea1768a2be66874aa20db784c631cffd9c18c9ceaa656b4fddf3ad8d
MATLAB
2,789
54
%-------------------------------------------------------------------------------- % 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 %---------------...
853c6fb79ccc9328afbfec10129985f442441a25d6c4b6919a2204e247b5b453
MATLAB
2,791
62
function y = fun_generate_connRange_pdf2(ind_connRange,ind_pdf,edge,convergence_range) switch ind_connRange case 1 % rand ( = all range ) switch ind_pdf case 1 % uniform x = edge; pd = makedist('Uniform','Lower',x(1),'Upper',x(end))...
d136c806fc5f6cc088509187bd4e0e7ec1c11417e61b7fead40334788906078d
MATLAB
2,795
99
function M = euclideancomplexfactory(m, n) % Returns a manifold struct to optimize over complex matrices. % % function M = euclideancomplexfactory(m) % function M = euclideancomplexfactory(m, n) % function M = euclideancomplexfactory([n1, n2, ...]) % % Returns M, a structure describing the vector space of complex matri...
1943f989c5bcef6582341880d396281cde5249cac41e52ba16edceec7ac7848c
MATLAB
2,804
69
function zef_load_GMM(struct) if evalin('base','isfield(zef,''GMM'')') GMM = evalin('base','zef.GMM'); if strcmp(GMM.parameters.Tags{end},'saved') n_params = 36; else n_params = 35; end else if isfield(struct,'parameters') GMM_Tags ={'clustnum','MaxIter','covtype','covident'...
27b3a794eab6f034cc8c42dfe8a7b32053a1e634ca0c5092e5cbb43175310e6d
MATLAB
2,804
78
function [obj,additionalout] = cluster_global(obj,k,varargin) % Perform group level microstate clustering options = microstate.functions.make_options(varargin) ; % default options defaults = {'clustermethod','kmeans'; % kmeans, aahc, pca, ica, hmm 'kmeans_maxiter',100 ; ...
6d332ccf15bb617388efac3dfede44a9f01df52c8486f71de7e9a88f850431e0
MATLAB
2,804
92
function boolAddedEpoch = ETC_SetBlinkEpoch(hObject,eventdata,strType) %globals global sFigETC; %get temporary epoch sEpoch = sFigETC.sEpochTemp; %get modifier boolControlPressed = getAsyncKeyState(VirtualKeyCode.VK_CONTROL); boolAltPressed = getAsyncKeyState(VirtualKeyCode.VK_MENU); %if not new, create new...