sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b762731c0cc21292dea1b906893a65408fb69e78108de9941e508777c095fea9
MATLAB
3,459
117
function [D0,phisq0,st] = lme_fit_EMinit(X,Zcols,y,ni,e) % [phisq0,D0,st] = lme_fit_EMinit(X,Zcols,y,ni,e) % % Starting values for linear mixed-effects estimation.This function is % intended to be used to provide starting values for the lme_fit_NR and % lme_fit_FS functions by mean of some initial iterations of the ...
78ee124b3566215ad65130cc5b33d7724c752542d1a9c0ddf6c64a1d4636efdb
MATLAB
3,460
125
function createAnisotropicFibrosisProblem(filename, fibrosis_density, mesh_spacing, orientation) % This function creates tissue of a single consistent property, then fills % it with fibrotic occlusions of the requested density. The fibrotic % occlusions are arranged as barriers oriented either vertically or % horizonta...
cc72dedc8025b4e2caae71292627ab8829017439796f28802df35a54827a6c2d
MATLAB
3,461
99
function [wave, pattType] = generatePattern(gridSize, pattType, amp, ... freq, wavelength, loc, vel, gausswidth) % GENERATEPATTERN generates a custom wave pattern based on inputs % INPUTS: % - gridSize: 3 element vector [NX NY NT] giving the x, y, and time % dimensions of the grid underlying the wave patter...
e725b34974bf05e708a7e9b2c8f5c55835019681f63e909143044626fbbd31b8
MATLAB
3,464
99
function [rowcoords, colcoords, patType, jacobians] = classifyCrit(vx, vy, edgeDistance) % CLASSIFYCRIT finds and classifies the critical points in the vector field % defined by VX and VY. Outputs 2 1xN vectors (where N is the number of % critical points detected) expressing the row and column coordinates of % e...
80433877ac56c5ae39efadc9aac74f8d104148d7535b57d0b0d41f425bcf9542
MATLAB
3,465
92
% axcopy() - Copy a Matlab figure axis and its graphic objects to a new pop-up window % using the left mouse button. % % Usage: >> axcopy % >> axcopy(fig) % >> axcopy('noticks') % >> axcopy(fig, command) % % Notes: % 1) Clicking the left mouse button on a Matlab figure axis copies...
b82d814921fd81cde2d39384af88dd675d8335995be4f8ca22a4544a18664ea9
MATLAB
3,466
98
%==================== RetAngTuningDiagramFigure4.m ==================== % Plot Tuning diagrams for the mean response of neurons across 100ms Stim % windows % %========================================================================== close all clear all %================= SET PATHS AND LOAD DATA if ismac Pref...
6054a7b210c1510be09d3a02b6444070ab60fd12170b7a1b7e00851bb35844fe
MATLAB
3,467
79
function PrepareMasksAndCohort(CurrentPath,CreateNewMask,Subregions) % Creates explicit mask for image analysis. % This function creates an explicit mask if it's non-existent at the % location specified by CurrentPath or if CreateNewMask is set to 1 (e.g. % because a new demographic information file was created at ...
1ace7bbf26ad866c70bd12db4bb78df3896ab2b02b0d4156421732487afd8d39
MATLAB
3,470
92
%% Fit Myelinated Fiber Density on Sural Nerve load(fiber_distribution.builtin.data_path('jacobs1985.mat')); % Prepare data [xData, yData] = prepareCurveData( ... age_vs_densityPerSqmm_myelinated_sural(2:end,1), ... age_vs_densityPerSqmm_myelinated_sural(2:end,2)); % Set up fittype and options. ft = ...
b4c205efc145d313102eb66ecbfc842b7f640eafa1de13243ab85e4b8a14610a
MATLAB
3,476
110
function event = ft_read_event_tdt(tank,block,blockroot,eventname,eventvalue,Fs) % EVENT = ft_read_event_tdt % EVENT = ft_read_event_tdt(TANK) % EVENT = ft_read_event_tdt(TANK,BLOCK) % EVENT = ft_read_event_tdt(TANK,BLOCK,BLOCKROOT) % EVENT = ft_read_event_tdt(TANK,BLOCK,BLOCKROOT,EVENTNAME) % EVENT = ft_read_event_tdt...
5a45a195dc0e59ca67e10f4d954613c386448a7530a0f240453dfbbf32cb5517
MATLAB
3,480
119
function [data,time, t] = stimulate_TCS2(TCS2, volt_mat, ... use_foreground, add_beep) % % In: % TCS2 structure with params and initialized daq using % initialize_TCS2. % volt_mat \in (n_time_step, 8) % use_foreground binary variable indicating to acquire data in ...
cf49a85397fedaeba87212d898cf937b27f121d4f3a1b91978ff5a34c35b0b5b
MATLAB
3,484
112
%% Script to compare rinse and tastant trial beta values % Rinse betas indices all_beatas 31:2:59 util.clearAll; outdir = fullfile(util.get_paths().figs,'controls', 'rinse'); util.mkdir(outdir) load(fullfile(util.get_paths().data_versioned, 'betas', 'full_beta_tbl.mat')) % Find taste groups [G, TID] = findgroups(fina...
9b476368a0c0e3f42632d32bf60c2d9275e792826442d05aa6a26369f1351e5a
MATLAB
3,495
94
function [corrValues] = runCorrelations(corrBOLD_cat, paradigmNum, counter, dataDir) % This function calculates the pairwise correlation between % regions-of-interest (ROIs) as well as the partial correlations % % Compiler(s): Renee Hartig (renee.hartig@tuebingen.mpg.de) & Ali Karimi % (ali.karimi@brain.mpg.de) % % Inp...
cb9c43ee189c088b343284afde40c5db2fd93d94660c7f31402f7e2eb5463d8d
MATLAB
3,499
102
util.clearAll beta = util.load.beta_table(); outdir = fullfile(util.get_paths().figs,'controls', 'correlation_Viz'); %% Get the Table entries for Left PrCo, left and right PAGs to demonstrate % high and low correlations of beta series (0.92 vs 0.24) PRCO_L = beta(beta.region_name == 'PrCo' & beta.hemisphere == 'L',:);...
9248b9f159812495892f4436f766a47a8ff668bf5418e447db926dcd3d02a0de
MATLAB
3,502
53
function gamma_p = qtipm_get_gammap(c,l,D0) % % returns the 9x9 form of the matrix Gamma plus from the C 3x3x3x3 tensor % C is expected to have already the correct units % gij = eye(3); gij_1x6 = convert_3x3_to_1x6(gij); scale = 0.25 * (D0^2); d02gijgkl = scale * convert_1x21_to_3x3x3x3(convert_1x6_to_1x21(gij_1x6)); ...
e6461936c17b5f90ffba3577517384e694ced8839e8610bafc67f71a6312bb34
MATLAB
3,506
83
% % Define the tracts, sub-tracts their end-point ROIs using (one or more Destrieux labels) % [tracts] = ccep_categorizeAnatomicalRegions() % % Returns: % tracts = % % % Note: Tracts are based on the Yeh HCP YA842 tractography atlas, while their end-point areas were matched based on the Destrieux...
dbb301468f30284f4123b49f98b9f196995e79cb446ade47568ec4c0ec010f41
MATLAB
3,508
119
%% Script to calculate the phase-synchronization measures corrected with the surrogates %This script calculates phase synchronization measures to study brain %dynamics. The goal here is to describe the synchornization dynamics based %on phase statistics. The present script computes four basic measures; %integration, s...
f07d657e06a5700350f7fe678f135a76e568049be194c4a8bafb0df848479884
MATLAB
3,509
113
% Displays a dialog to give help information on an object. % % Examples: % helpdialog char % gives information of character arrays % helpdialog plot % gives help on the plot command % helpdialog(obj) % gives help on the MatLab object obj % % See also: helptext, msgbox % Copyright 2008-2010 Levente...
b42ba0a1aaad53a27deda4f4af37b70dad12db37a301aa6001ecd5554a25af11
MATLAB
3,511
123
function [ERP, erpcom] = pop_saveERPhistory(ERP, filename, varargin) erpcom = ''; if nargin < 1 help pop_saveERPhistory return end if nargin==1 if ~isfield(ERP, 'history') msgboxText = 'ERP.history was not found!'; title = 'ERPLAB: pop_saveERPhistory() error'; ...
970558ba8c54a01b1b4d5c5737948f338de25e5f2d2f9a36866bd420a5cf8750
MATLAB
3,515
119
function coords = bilinearIntersection(cell1, cell2, v) % BILINERINTERSECTION Finds the coordinates of the intersections of the % V-level contour lines of unit squares CELLA and CELLB, calculated using % bilinear interpolation. % % Inputs: % CELLA must be a matrix of size [2 2] giving the values at the 4 vertices % ...
a1d46db45d366046576b9a6f1e2c42ca8ef5fbd9e516c3153534079e5587972f
MATLAB
3,517
73
function [FSC,FSCbs,ciLld,ciHld,ciLsc,ciHsc]=BSci(TmtxS,SCM,fnA,twin) % Calculates bootstrapped confidence intervals on loading and activation of factor scores % % Core part of Factor analysis Assembly detection workflow % NB Run FAassem_.m on unit firing rate data via runFAassem_.m first. % % Original 2014 Daniel Durs...
929874d00d4f222fc9dd1b83e2b6144ba60784ce3a1a4ae4406d28ae2c0f7a8d
MATLAB
3,521
100
% DEPRECATED... % % % % EEG = lindetrend( EEG, interv); % % lindetrend():Removes the best straight-line fit from epoched EEG data. % Matlab: detrend() computes the least-squares fit of a straight % line to the data (whole epoch or interval) and subtracts the resulting function % from the data (whole epoch). %...
6c94c5d3ad8941266ffbb79b2aa2f6a82745c37864ca4a94b65bf1619512a64f
MATLAB
3,525
71
%% Processes a single OH/OHA/TOH/TOHA trial % This script converts a single trial into an event/state-based format, % records known decisions, sets aside relevant metadata, and saves all of % these for later analysis. % Copyright (C) 2022 Richard Hugh Moulton % % This program is free software: you can redistribu...
be1486b026df208bc3548da07dec4ec0a773702b8cee876a7a9bdf9d9cf2cd09
MATLAB
3,525
124
load(['../data/behaviorData.mat']); tmp = zeros(1,500); hori_p = [tmp repmat(16.003,1,700)]; hori_n = [tmp repmat(8, 1, 700)]; vert_p = [tmp repmat(0,1,700)]; vert_n = [tmp repmat(-13.86,1,700)]; for n = 1:14 n tDur = [1:1200]; tmp1 = cat(3, hori_p-Sub(n).dir(1).valid.hVel100, vert_p-Sub(n).dir(1).v...
26564a2a9a5ce9cf00b0e860870cfcc4200af506058888e361e49bc5468af0e1
MATLAB
3,526
127
function gr = lme_mass_RgGradient(X,Zcols,W,invH,L,phi,re,ni,invG,GDa,GDb) % gr = lme_mass_RgGradient(X,Zcols,W,invH,L,phi,re,ni,invG,GDa,GDb) % % Gradient vector of the restricted log-likelihood for a whole region. % % Input % X: Ordered design Matrix (according to time for each subject). % Zcols: Vector with the ind...
a3d7f69ad462387fd53fd1632a5762a34c4e3e938df4864e645f16809152a0f0
MATLAB
3,529
126
classdef polyregions properties G %node graph x %x coordinates y %y coordinates end methods function obj = polyregions(G,x,y) %Constructor s=G.Edges{:,1}(:,1); t=G.Edges{:,1}(:,2); w=sqrt((x(s)-x(t...
c1aa04759d67913e42ac6daa6853b9d679022890f1c0a1b2d81f57808302d98d
MATLAB
3,531
140
%function FM_sweep_testing() % close all; clear all clc %---FLAGS---% sub = 4; % Setup sound parameters AMrate = 4; AMdepth = 1; StimDur = 1000; %~~~~~~~~~~~~~~~~ AMphase = 0; %~~~~~~~~~~~~~~~~ dBSPL = 50; %~~~~~~~~~~~~~~~~ AMdelay = 500; % Def3ne RCX file % handles.RPfile = 'C:\gits\epsych\UserFiles\SanesLab\RPVdsCi...
e9fb6adc58139027152e5987a1add41f052a0712d6a46044259e69db54a4aba1
MATLAB
3,531
106
function val = artifactscantool_getopt(opt, key, default, emptymeaningful) % FT_GETOPT gets the value of a specified option from a configuration structure % or from a cell-array with key-value pairs. % % Use as % val = ft_getopt(s, key, default, emptymeaningful) % where the input values are % s = str...
755e56b8c0d0ad4cc1c88b427783b330cea2b20d1f2d8649c91796d5ad87c977
MATLAB
3,532
113
% pop_create_custom_template() - Create a custom electrode montage template % % Usage: % >> [STUDY, ALLEEG, com] = pop_visualareatemplate(varargin) % % Inputs: % STUDY - STUDY set structure containing (loaded) EEG dataset structures % ALLEEG - ALLEEG vector of EEG structures, else a single EEG datase...
e0f39d3489b7bed7b8a5e3b8eb5014018c439d6826a479dbb8d538c3445cd7c9
MATLAB
3,533
142
classdef o_ERPDAT < handle properties ALLERP ERP CURRENTERP Count_ERP ERP_chan ERP_bin Count_currentERP Process_messg erp_between_panels Reset_erp_paras_panel end events erpschange drawui_CB cer...
9a52ba9db6dad225790891a462585ac42889e9369f510b94add661d0c7ac0725
MATLAB
3,535
98
%% DEMO_001 basic useage % The Psignifit 101 %% save data in right format % First we need the data in the format (x | nCorrect | total) % As an example we use the following dataset from a 2AFC experiment with 90 % trials at each stimulus level. This dataset comes from a simple signal % detection experiment. data = ...
46233613edc62d09a75b2c4b9f61506be4f516c2c3732b7a24a5fb85624b26ea
MATLAB
3,536
86
%% This function calculates a subject's accuracy on a per-bin basis % Subject accurady is divided between the easy/at-limit phases and the % overwhelmed phase. Targets and distractors are considered separately. % Copyright (C) 2022 Richard Hugh Moulton % % This program is free software: you can redistribute it and...
ec486b9ebe08014e0d894e69aced66b14f5d58b658de83b74f278bb99429deea
MATLAB
3,537
121
% PURPOSE : encodes and retrieves ERPLAB's working memory % % FORMAT : % % output = erpworkingmemory(field, input2store) % % INPUTS : % % field - function name. e.g. 'pop_appenderp' % input2store - values to store (cell array) % % % OUTPUTS : % % output - stored values (cell array) % % % EXAMP...
dff6899efe539b677464f471898e1aeb415fb6db510b0190dc9d7a1cb5bad15b
MATLAB
3,538
98
function [ax1,ax2] = plot_stability( spikes, show) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % plot_stability - Plot amplitude and firing rate of a set of spikes over time % % Usage: % [ax1,ax2] = plot_stability( spikes, clus) % % Description: % Creates two axes in the same posit...
7135ec6ebf3a80277a9fa9e5592f6ed97516af3710fea09f15ccd478e1c7d4b0
MATLAB
3,541
72
function [samples_file_format, totalParams] = getSampleFileFormat(obj, TotalSamples, dataType_samples, paramStruct, scaled_WB, scaled_VT, saveUnscaled) samples_file_format = cell(0, 3); ctr = 1; totalParams = 0; samples_file_format{ctr, 1} = dataType_samples; samples_file_format{ctr, 2} = [numel(paramStruct.W) TotalS...
8061c4a1797102d097424d005520235dc39092783a7aff05ea754b0f4677e71f
MATLAB
3,542
83
clear Target = 'LONG'; if ispc pat = 'C:\Analysis\AssemblyAnalysis\raw'; else pat = '/Volumes/HDD2/DNMTP/raw'; end cd(pat) fileList=dir(sprintf('allTimestamps%s*%s*Events.mat',filesep,Target)); % reject_list={'IreneuszLONG1_Events.mat',... % 'NorbertMEDIUM1_Events.mat',... % ...
dd4dbdc7e64b6df85b5c6797c277c3d6d71f1404d008abe67b25b43153f4bb8e
MATLAB
3,542
98
function [rowcoords, colcoords, patType, jacobians] = classifyCrit(vx, vy, edgeDistance) % CLASSIFYCRIT finds and classifies the critical points in the vector field % defined by VX and VY. Outputs 2 1xN vectors (where N is the number of % critical points detected) expressing the row and column coordinates of % e...
57d79d38fef7ebdf8861ac918570cdf2c79ac4e325036647b9d49649291be2f1
MATLAB
3,546
121
function NextTrialID = TrialFcn_AMAversive_MasterHelper(TRIALS) % NextTrialID = TrialFcn_PumpControl(TRIALS) % % This is the default function for selecting the next trial and can be % overridden by specifying a custom function name in ep_ExperimentDesign. % The code in this function serves as a good template for custo...
b6331afa5988ef2b3c0a13351a10eb21aba5825b3acef14165909268a41509d9
MATLAB
3,547
133
clear all clc %% Selection of the peak folder start_folder = uigetdir(pwd, 'Select the PeakTrains_mat folder'); if isempty(strfind(start_folder, 'PeakTrains_mat')) f = errordlg('Folder not corrected', 'Folder Error'); return end disp(start_folder); cd(start_folder); phase_dir = dir; if length(phase_dir) == 2 ...
d98cee8f5e0e192bc275188bda2f6d21f76b3c5e7ca51afc62ddd2f7028aea7a
MATLAB
3,564
106
function iCross = plot_cross_section(model, ax, fascClickCallback) %LOAD_CROSS_SECTION Summary of this function goes here % Detailed explanation goes here if nargin < 3 fascClickCallback = @(~, ~) []; end % Choose z closest to the active site z = model.activeSites(model.iAS).coord(3); zs = cellfun(@(x) x(1,3), ...
fe685dc1cb4a4e1b0aa7a732e5889e4aae4fa5cd4b976144722fece6ede7c33d
MATLAB
3,566
112
function [] = scatter_sequence(all_trials, s,varargin) % Display the input sequence on the current axes. % Default plot parameters mSize = 16 ; % colors = [0,0,179; 255,67,46]./255 ; small_version = 1 ; % no labels for the 2 I cond_name = '' ; % ticklabels in smal...
7fabfdd28de04f723259c14af171f0b94ac821d4c854a9e8dc76c26a948f7422
MATLAB
3,571
143
function model = dtipm_data2fit_SDPdSL(signal,bten,varargin) % function model = dtipm_data2fit_SDPdSL() % % out_flag says which format to use for m : % out_flag = 1 -> [28*nvox,1] % out_flag = 0 -> [28, nvox] nmeas = size(bten,1); % r...
bc020a035f820ed82c6f1b2616a5c5ca2f65cde858c1e3559100481dbe143a73
MATLAB
3,571
107
function varargout = updateRUNTIME_SanesLab(varargin) %Custom function for SanesLab epsych % %This function updates the RUNTIME structure and parameters for next trial %delivery. % %Inputs: %varargin{1}: RUNTIME structure. If not passed as input, RUNTIME is called % as a global variable. %varargin{2}: han...
f5ccddf6f0d4aa8cb2550f3040d0944d43acf104163a0cc9cdf5cde5b2e08075
MATLAB
3,572
93
function [electrode, activeSites] = import_electrode_geom(direlec, felec, fFEM, cross_pl) % IMPORT_ELECTRODE_GEOM Imports the electrodes contour and active sites. % The code import the .STL files of the electrodes and convert the geometry % file in a 3D representation of the electrode corners and center of active...
2fbf95354cd5a9463224510d466f559ec1b6077af0185126de4ec131e5691697
MATLAB
3,573
156
% Philipp Berens % CircStat: A Matlab Toolbox for Circular Statistics % Submitted to Journal of Statistical Software % % Example 2 % An Application to Neuroscience % % % In this example, we assess the orientation tuning properties of three % neurons recorded from the primary visual cortex of awake macaques. th...
719ea279fffdc6f465c8104402305fb2537f8800bc28cd8ccd5d5f49768211b3
MATLAB
3,577
131
function Stim = pp_make_stim_struct( epData, block ) % % pp_make_stim_struct( epData, block ) % Sub-routine called by pp_prepare_format. % % Creates matlab struct with number of elements equal to number of % trials, and fields with stimulus information for each trial. % % This function should be ...
ab0b318f8fb5728ca84c671934f37024f80922c4cf8507457eb02706bd6e00a9
MATLAB
3,577
92
%% Additive Workload Serial System % A parallel-serial processing system where different tasks increase the % amount of work to be done by certain modules by an additive amount % % 3 December, 2021 function [finalRate,input_record,output_record] = AdditiveWorkloadSerialSystem(systemCapacities,taskModifiers,visualiz...
c6553ca901dafca971e2ba3191459c6d1ed1357ad8f7ec68a9dc7160ed8f1d98
MATLAB
3,579
92
%% Multiplicative Workload Serial System % A parallel-serial processing system where different tasks increase the % difficulty of certain modules' processes in an multiplicative manner. % % 3 December, 2021 function [finalRate,input_record,output_record] = MultiplicativeWorkloadSerialSystem(systemCapacities,taskMod...
173b8fe5c9d91c75a04816e3ebecf9a75817edfa24422d8bf2bf722239a26586
MATLAB
3,580
165
% PURPOSE: pop_suffixeeg.m % add suffix to ALLEEG names % % FORMAT: % [ALLEEG, erpcom] = pop_suffixeeg( ALLEEG, 'suffixstr',suffixstr,... % 'Saveas', 'off', 'History', 'gui'); % Inputs: % %ALLEEG -ALLEEG structure %suffixstr -strings for eegsets % *** This function is part of AL...
75b8fa4c86068ae32835aab517d15de7f9356dab3b99367a06217f72f3bcae12
MATLAB
3,585
104
% DEPRECATED...SORRY. % % % % PURPOSE : The purpose of this function is to allow multiple dataset loading, % while user is working on the EEGLAB GUI. Do not use this function % in scripting. Use pop_loadset() with a for loop instead. % % FORMAT : % % >> [ALLEEG EEG CURRENTSET] = pop_loadm...
784f5aa1f9d6275f799305d7ac475b62bd672d14fbf50929d12e0a01e4e92a62
MATLAB
3,589
130
function varargout = DB_NewSubjPrompt(varargin) % h = DB_NewSubjPrompt % h = DB_NewSubjPrompt(database) % % Create New Database Subject. If database name is not supplied as input % then a list dialog will prompt the user to select a database. % % DJS (c) 2010 % % Last Modified by GUIDE v2.5 10-May-2013 13:10:04 % ...
e1cb85f6126eefaecdee1a95605b12446b100d092d8a8894a51b639b5f16ce58
MATLAB
3,592
128
addpath('/useful functions/'); velocity= importdata('./kymo_ex_data/resultats.mat'); dxpix = 0.955; % Pixel size in um dttime = 5; % Time step in minutes vscale = (dxpix/dttime); xlag = velocity.XEul; ylag = velocity.YEul; ulag = vscale*velocity.UEul; vlag = vscale*veloc...
4d04afbdce39d43ab7efba0ef9510e227069b163c682605cfda5de926dcc8173
MATLAB
3,596
113
function X = expsmooth( X, fs, tau ) % EXPSMOOTH Exponential smoothing. % % Y=EXPSMOOTH(X,FS,TAU) for a given input sequence X sampled % at FS Hertz and for time constant TAU given in milliseconds % returns exponentially smoothed output sequence Y. % % Inputs % X input signal as a column vector, or...
b57a187c35d55dede05908f5a172acd5d622ec323ebd7e3cbed088e2944a0666
MATLAB
3,596
113
function [ims,channels] = tppreview_timethreshaverage(dirnames, tpparams, channellist, parameters, shortname, dirname) % TPPREVIEW_TIMETHRESHAVERAGE - Make a preview image based on thresholded temporal differences % % [IMS,CHANNELS] = TPPREVIEW_TIMETHRESHAVERAGE(DIRNAME,TPPARAMS,CHANNELLIST,PARAMETERS) % % Inputs: % ...
6a5bf0bf94a81773e2fdd73a3a6ca6706781cc3463b6f3129314cfae63a96185
MATLAB
3,600
156
function F = gan_img_detection_fea(IMG) %GAN_IMG_DETECTION_FEA Extract features for detecting GAN generated images. % % Input: % - IMG: An image array or a path to the image file. % % Output: % - F: The 588-D feature for GAN generated image detection. % % The algorithm is proposed in the following paper: % @article{DB...
32e9609ac9f207a77a8035ab941de454670126f1cb6765027fc8046337ab0ea8
MATLAB
3,601
104
% Intraparietal stimulation disrupts negative distractor effects in human multi-alternative decision-making % Kohl, C., Wong, M.X.M., Wong, J.J., Rushworth, M.F.S. & Chau, B.K.H. % eLife 2022 % Script to generate Figures 3d & 3e clear all; close all; clc; % Load betas generated from GLM3 (Figure 3abc) load(...
887f4a14bcd5096e0a6103552094242fde3f24838e7c24354aa8ed8c7783a0b2
MATLAB
3,601
90
function [swEsts, nswEsts, swLabels, nswLabels, bias_means, bias_stdevs] = simulateSwitchNoSwitch(nameValueArgs) arguments nameValueArgs.settings struct = readSettings(); nameValueArgs.sampleNums (:, 1) double = -1; % -1 means all nameValueArgs.runParallel logical = true; nameValueArgs.plot logi...
5aa7b25ce8a3ceba8d30c300ba1fe28694afe0f2b27a23b22591c012ceba4d3a
MATLAB
3,602
91
function [spikes, new_clust] = split_cluster(spikes, subclusters) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % split_cluster - split a cluster into two parts % % Usage: % [spikes, new_clust] = split_cluster(spikes, target) % % Description: % Breaks off the specified sub-tree from the...
0f8a9dc495cc6f4e4bd391ecbebcc85bc41e8e30d2afc1084f6602100fab3f0b
MATLAB
3,611
99
%==================== RetAngSDFFigure4.m ==================== % Plot the mean SDF for all neurons to examine time based responses % %========================================================================== close all clear all %================= SET PATHS AND LOAD DATA if ismac Prefix = '/Volumes/nifvault'; ...
6063ca3ee53db84b64fcd3d9e6b9484e7f7d2011dde75dcf4df4411b35bd4e43
MATLAB
3,612
83
function [FSC,FSCbs,ciLld,ciHld,ciLsc,ciHsc]=BSciSleep(TmtxS,SCM,fnA,twin) % Calculates bootstrapped confidence intervals on loading and activation of factor scores % % Deals with long time-series typical of sleep recordings rather than short single-trial behavioural data. % % Core part of Factor analysis Assembl...
1ec735e4f86af064e56b9da2beb631a297f2f740a53ae2d23a290573ba1eef45
MATLAB
3,613
104
function [qe,Ee,Se,Sev] = qeh8e(En,Ge,Ue,Sn,Set,Xe) %*************************************************** % Keh8E: % Creates the element elastic forcee vector for % hexahedra 8-node element. % Syntax: % Ke = qeh8e(Xe,Ge) % Input: % Xe : coordinates Xe = [x1 y1; x2 y2; x3 y3; x4 y4] % Ge : element ...
2d62798e86fb7e217e158be3070c84a534e12f5ddb5434550f71e4dcf6a690ce
MATLAB
3,614
52
function gamma_m = qtipm_get_gammam(c,l,D0) % % returns the 9x9 form of the matrix Gamma minus from the C 3x3x3x3 tensor % C is expected to have already the correct units % gij = eye(3); gij_1x6 = convert_3x3_to_1x6(gij); scale = 0.25 * (D0^2); d02gijgkl = scale * convert_1x21_to_3x3x3x3(convert_1x6_to_1x21(gij_1x6));...
144757e6bc11a15a83cd43a673494e425900ea594ada1f2d026405d163800f33
MATLAB
3,622
100
% Plot the L/R preference of each assembly. % % Aleksander PF Domanski PhD UoB 2015 % aleks.domanski@bristol.ac.uk % % Need data from runFAassem first. clear cd('C:\Analysis\AssemblyAnalysis\raw\KDE_bins\LONG') fn='JaroslawLONG2_iFR50_FSC.mat'; % fn='KrzesimirLONG2_iFR50_FSC.mat'; twin=10; % Time w...
62c9480e3a68acea2552a7266b7a97b8670bfa98a30adc076ee37185e25d3c5e
MATLAB
3,623
113
function masked_files = MySPM_BatchMasking(fmri_fns,mask_fn) % MySPM_BatchMasking % MySPM_BatchMasking(fmri_fns,mask_fn) % d = MySPM_BatchMasking(...) % % Use this script to apply a mask to one or more 3D or 4D NIfTI files. % % Input: fmri_fns ... cellstr array of 3D or 4D NIfTI files (optional) % m...
4170086eb75e21d3ea8c9f3a46d55a36d26f685d9531b3df7c032fa170a40a04
MATLAB
3,630
114
function [ transitionMatrix columnStates ] = getTransitionMatrix(markovChain,Norder) % Constructs the transition matrix of a markov chain, given the markovChain and the order, i.e., an integer greater or equal to 1. % % Inputs: % markovChain : the markov chain, in integers. % Norder : the order to be analyz...
5ef9a9af5ae72fde997baee029aba3c920728f8474aead52a18c9f6708ea3865
MATLAB
3,632
117
function AX = ReferencePhys_SanesLab(handles,AX) %ReferencePhys_SanesLab(handles) % %Custom function for SanesLab epsych % %This function performs the calculations necessary for the common signal %averaging for multi-channel recordings. % %Inputs: % handles: GUI handles structure % AX: handles to active X controls...
488d1f49f31362e809015778ad8d333734bc7fe58269503c5c3b8e96c0c721e6
MATLAB
3,635
122
clear subjfolder = dir('F:\fMRI_QC\fmri-open-qc-task_bias_corrected\sub*'); %figure('WindowState','maximized'); figure('position',[10 50 1500 500]); for subji = 1:length(subjfolder) fprintf('Processing subject %d ...',subji) % load the raw functional images and calculate the global mean and pairwise vari...
e87ebbc53549b66274ee8849481b1c8575686284d5f9c1b7fc14f870aaa49b32
MATLAB
3,638
95
function b = suite2ptifs2prairieview(suite2p_exper_dir, new_exper_dir, directory_mapping, channel_mapping, doit) % SUITE2PTIFS2PRAIRIEVIEW - convert a set of suite2p registrations back to PrairieView % % B = SUITE2PTIFS2PRAIRIEVIEW(SUITE2P_EXPER_DIR, NEW_EXPER_DIR, ... % DIRECTORY_MAPPING, CHANNELMAPPING, DO_...
2ca25d68d71714a821bc3cec6ea606f9933cd88f17381009045ab5a88e0b426e
MATLAB
3,646
120
% PURPOSE : encodes and retrieves ERPLAB's working memory % % FORMAT : % % output = estudioworkingmemory(field, input2store) % % INPUTS : % % field - function name. e.g. 'pop_appenderp' % input2store - values to store (cell array) % % % OUTPUTS : % % output - stored values (cell array) % % % E...
353c622f1f7bcb2c396d9a44fff4881da2cb8ecc3f96e78e772d097eb9601a4b
MATLAB
3,646
74
%% GMLM.computeMAPevidenceOptimization % optimizes the log-evidence (plus log hyperprior) of the GMLM using quasi-newton optimization & Laplace approximation for the evidence % % inputs: % params_init (OPTIONAL) :a param struct of the initial value of the optimization. If not given or empty, a random initiali...
29729488416b7785c6366160526a3a5b011759c36e4ff42eafdf177917270263
MATLAB
3,651
79
function [signal_data, data_legend, t] = createDataMatrix(raw_data, data_start, ... framerate, t_window, t_parameters) % createDataMatrix cleans up raw imported data and returns key variables % Implements any raw_data parameters from "Ca_Pipeline_Main.m" % and outputs a new matrix, legend, and time vector for t...
97bd6712edf8d8015515505f5f0fea42f85a721b9fabb8a228d15dbeca997c39
MATLAB
3,656
138
function model = qtip_data2fit_SDPdc(signal,bten,varargin) % function model = qtip_data2fit_SDPdc() % % out_flag says which format to use for m : % out_flag = 1 -> [28*nvox,1] % out_flag = 0 -> [28, nvox] nmeas = size(bten,1); ...
531ca2dfec07ef6d040b61833df5b0a1f9650d6b391fc6dddcb9ae54b252203b
MATLAB
3,664
102
function popupmore(fh,varargin) % SUBPLOT POPUP FUNCTION WITH ADDITIONAL ARGUMENTS % makes use of the function POPUP and PVPMOD % % EXAMPLES % popupmore(fh) => popup(gca); standard function % popupmore(fh,'lg',???) ...
2bc58b8fefdcdb4c6eb9804f9c2a0c36802ae5ad967b4d05245e34804406e42d
MATLAB
3,672
134
%% Script to generate Figure 4 clear all close all runs = 10; epochs = 1000; % folder1 = 'Experiment1'; % folder2 = ['RNN', 'LSTM', 'GRU']; % folder3RNN = ['16','64']; % folder3GRU = ['8','32']; runsstrings = {'Run1','Run2','Run3','Run4','Run5',... 'Run6', 'Run7','Run8','Run9','Run10'}; % RNN rmseRNN16T = zeros...
c6a9e603a701db0359e894f84482a2337f99eda6d7be0b901057aac436199d9b
MATLAB
3,674
81
function [FSC,FSCbs,ciLld,ciHld,ciLsc,ciHsc]=BSciTaskOnly(TmtxS,SCM,fnA,twin) % Calculates bootstrapped confidence intervals on loading and activation of factor scores % % Deals with long time-series typical of sleep recordings rather than short single-trial behavioural data. % % Core part of Factor analysis Assem...
969673b0109771d341240d4e71f2a52b1c4f6d819d2db5d2380ee74f2b91a02c
MATLAB
3,683
137
%------------------------------------------------------------------------------- % resample_eeg_files: resample all files % % Syntax: resample_eeg_files(eeg_dir, out_dir, fs_new, lpf_cutoff) % % Inputs: % eeg_dir - directory of EEG files (in CSV format); required % out_dir - empty directory for the dow...
c6c1a1ea7960c0a00c07d618a810bf1cfeceaad9420715bf55b75f96200af783
MATLAB
3,684
106
function eda_stat_boxplot(eda, fs, edr, conds) % EDA_STAT_BOXPLOT Plot EDA results % EDA_STAT_BOXPLOT(eda, fs, edr, conds) % % Required input arguments: % eda - 1-by-n vector of EDA samples % fs - sampling rate (Hz) % edr - structure array of electrodermal response (EDR) (see eda_edr.m) % cond...
7abdd771476f8b3170cd800718dcd8a1eb34a91bffaff3bb0a971a658dcee8f6
MATLAB
3,686
98
% PURPOSE: subroutine for pop_setcodebit.m % sets the bit(s) at position(s) "bitindex" in each EEG.event(i).type value to 0 (off). % "bitindex" must contain number(s) between 1 and 16. % % EEG = setcodebit(EEG, bitindex, newvalue) sets the bit(s) at position(s) "bitindex" to the value "newvalue", ...
87c7a5ffddc84c7e5b1e7be609cc5896367a61e4c3a639861b787ce04dc520d5
MATLAB
3,688
164
% PURPOSE: pop_suffixmvpc.m % add suffix to ALLMVPC names % % FORMAT: % [ALLMVPC, mvpcom] = pop_suffixmvpc( ALLMVPC, 'suffixstr',suffixstr,... % 'Saveas', 'off', 'History', 'gui'); % Inputs: % %ALLMVPC -ALLMVPC structure %suffixstr -strings for bestsets % *** This function is pa...
ade059dd5740bfb5d7103d67d33d20e52fbfd85cc6463501df88760f5d239816
MATLAB
3,688
119
function [Gw,Gs,Gss]=geombinsurr_partial(W,D,frac,nbins,bintype) % [Gw,Gs,Gss]=geombinsurr_partial(W,D,frac,nbins,[bintype]) % % Surrogate random graphs that approximately preserve the relationship % between weight and distance by first binning the edges by distance and % then shuffling within the bins. Randomizes...
d32d73d6190f751b8bbf065ca9229d343bbd3f3a1321ca0d51760c11d077cb1c
MATLAB
3,696
101
function [Ke,qe] = keh8e(Ee,Ge,Se,Xe,Set) %*************************************************** % Keh8E: % Creates the element stiffness matrix of viscoelastic % hexahedra 8-node element. % Allows elastic and viscoelastic behaviour with Kelvin-Voigt (parallel % elastic-dahspot) and Maxwell (in series). % ...
cad5f250ec76b2e47cda2f601112e4956e7bbc24c4d2c38d7164c474e416b090
MATLAB
3,698
97
function lrstats = lme_LR(lrmlfull,lrmlred,q) % lrstats = lme_LR(lrmlfull,lrmlred,q) % % Likelihood ratio test for the random effects. It can be used to test if a % model with q+1 random effects is significantly better than a model with q % random effects. % % Input % lrmlfull: Maximum value for the restricted log-like...
07938d7421a4af4ac736f5ea988bb38d92c8e530de2891aebfa487202b0d20aa
MATLAB
3,700
124
function NextTrialID = TrialFcn_AMAversive_MasterHelper_ROSEN(TRIALS) % NextTrialID = TrialFcn_PumpControl(TRIALS) % % This is the default function for selecting the next trial and can be % overridden by specifying a custom function name in ep_ExperimentDesign. % The code in this function serves as a good template for...
4d169aece7509e0963828d68fdec28525022c0ddadfc6db5534c02180e9612cc
MATLAB
3,702
110
% finalDynamicsStream % validationModel % validationEmission % returns likelihood (bootstrapped likelihood if size(validationEmission, 2) ~= size(finalDynamicsStream,2) disp(['Emission matrix must be STATES by CHANNELS (' num2str(size(validationModel,2)) ', ' num2str(size(finalDynamicsStream,2)) ')']); retur...
49689e84492c647635a5020c21526e71e604854668b469c7c340351f204a3cd5
MATLAB
3,704
140
function pp_prepare_format(BLOCKS,subject,session_label) % % pp_prepare_format( BLOCKS, subject, session_label ) % Creates data structures in the desired format for processing. Groups % together sequentially-recorded blocks, indicated in input argument, % and makes a structure with stimulus info by trial, ...
7b51fee7e59abcf6b14457e670625c25b43bc6a62dd8f813b53ece41c58a7334
MATLAB
3,705
105
function check_session_TCS2(NI_session, pulse_dur, temp_base,... temp_I1, temp_I2, active_zones, fn_check, subj_name, record_RT) % Check session: sequence of stimuli of 2 intensities, subject has to % evaluate the intensity received and RT is recorded. % Parameters %%%%%%%%%%%%%%%%%%%% p = [0.5,0....
33f7034aad9cd490935d73b0e6b2a8e2273f141288feb6e34f92f8298f228b28
MATLAB
3,707
95
%% Preamble, get file list clear all; close all set(0,'DefaultFigureWindowStyle','docked') flags.plotIndividualChanges = false; % pat{1} - % location of the processed assembly memberships % pat{2} - % location of raw spike times if ispc % pat{1} = 'C:\Analysis\AssemblyAnalysis\Sleep\Decoding vs flanki...
3bc1e13c60010c5f3466d29a278fda8d981c6950cbf17ba7bd63badd467bd1a5
MATLAB
3,708
158
function varargout = PumpControl_Tunings(varargin) % PUMPCONTROL_TUNINGS MATLAB code for PumpControl_Tunings.fig % Edit the above text to modify the response to help PumpControl_Tunings % Last Modified by GUIDE v2.5 23-Sep-2015 10:31:06 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct...
a1094fcd07ea2c1d20e8d8cf5591f494a085e054765793479b7ac2b27c371630
MATLAB
3,708
163
% PURPOSE: pop_suffixbest.m % add suffix to ALLBEST names % % FORMAT: % [ALLBEST, bestcom] = pop_suffixbest( ALLBEST, 'suffixstr',suffixstr,... % 'Saveas', 'off', 'History', 'gui'); % Inputs: % %ALLBEST -ALLBEST structure %suffixstr -strings for bestsets % *** This function is p...
4ce30a1d7cd48580e295ffa236ff893d16317757377d558183cf01c45df2c22c
MATLAB
3,713
143
function Problem = l1_linear_svm(x_train, y_train, x_test, y_test, lambda) % This file defines l1-regularized SVM problem % % Inputs: % x_train train data matrix of x of size dxn. % y_train train data vector of y of size 1xn. % x_test test data matrix of x of size dxn. % y_test ...
d6c423c60428d103bf1344b95aabbf8409a541571c657d5fe758803acc5e06ba
MATLAB
3,713
153
function FMdepth_detection() clear all; clc; close all; handles.RPfile = 'C:\gits\epsych\UserFiles\SanesLab\RPVdsCircuits\KP\FM_sweep_test.rcx'; %Load in speaker calibration file % [fn,pn,fidx] = uigetfile('C:\gits\epsych\UserFiles\SanesLab\SpeakerCalibrations\*.cal','Select speaker calibration file'); fidx=1; pn = ...
1efe051a355d568c16282da7e5349c8eb306728ff9a3439e7585869103fc6d75
MATLAB
3,715
137
% fresh start clearvars close all %% run config config_file='config_mammals_1.m'; addpath(strcat(pwd,'/config')) run(config_file); %% setup vars thr_vals = [ 0 0.05 0.1 0.15 ] ; ff = [ PROJ_DIR '/reports/lab_meeting/animal_colors.mat' ] ; load(ff) odir = [ PROJ_DIR '/reports/figures/netdist/' ] ; mkdir(odir) fo...
cb25cbd7eeb2496e8d7ec9212a2fc303e745faf48c8cfe7e893b5c2def707276
MATLAB
3,717
106
function [Vs, FEM] = load_pot_per_AS(model, fibersCompart, fascIdsByAs, activeSites, iActiveSite) % LOAD_POT Loads FEM computed stimulation potential for all the x,y points % of the fibers in the population. Values on the z axis are linearly spaced % until the maximum z point possible in order to perform interpolati...
4c072d04cf6432f1993ac0616980ba6add49dd1d460cab47bee91d89ebf05fe0
MATLAB
3,720
113
function [im] = tpcheckroidrift(dirname, channel, roirect, roiinds, roix,roiy,roiname, plotit) % TPCHECKROIDRIFTNAME - Checks twophoton drift correction performance % % IM = TPROIDRIFT(DIRNAME,CHANNEL,ROIRECT,ROIINDS,ROIX,ROIY,RIONAME, PLOTIT) % % Checks drift correction performance. Takes a rectangle (ROIRECT) as...
c2a02f119717a9fd511ebc6e65f5a4fc188bd3dc40b0c4244bc486c1a6b5a07e
MATLAB
3,721
76
function RunQUIQI(Subregions,Lambda,DataType,AnalType) % Main function enabling the insertion of a motion degradation index into % the analysis of MRI data. % % INPUTS: % - Subregions: cell array with the list of tissue types to be analysed % p1: grey matter % ...
4fbe836ff92edfdaaedb7f7ad6a5d68b07ce24562c5110319c84ba71b8146c4b
MATLAB
3,722
88
% Return java.lang.Class instance for MatLab type. % % Input arguments: % mtype: % the MatLab name of the type for which to return the java.lang.Class % instance % ndims: % the number of dimensions of the MatLab data type % % See also: class % Copyright 2009-2010 Levente Hunyadi function jclass = ...
3cfbf9b65b75659316766cd6125dfdf9fa24a1853c06ff0285f8e9f32684fb49
MATLAB
3,723
153
function updateTimeline_WE(width) % % Function used to continuously shift the timeline slightly ahead of the % current time every two seconds. % % width - time window in seconds in which show of events % global DA gf h fig = h.timelineF; ax = h.timelineA; % X axis xMax(2) = ceil(gf.sessionTime); % session tim...
5e11cb9e4f071b40d4ad0ea6daa045ce6e4ed446f9de4ed5392f412747c0a970
MATLAB
3,726
95
function effectSize = calculatePEV(tbl,value,repeated) %% %effectSize = calculatePEV(tbl,value) % % This function calculates the percent explained variance of a factor in a % one-way or two-way ANOVA (omega2 and partialomega2 respectively). % %INPUTS % * 'tbl' : ANOVA table (-> anovan) % * 'value' ...
0d94686681bdff03e3e205f0ad4635c766f83f4ee8e5e13328d6c11a4bc434fb
MATLAB
3,728
117
function createNozzleProblem(filename, channel_leftwidth, channel_rightwidth) % This function creates a nozzle shape, a channel of a varying width at % both ends. Emerging from the nozzle out into unobstructed tissue presents % a situation of source/sink mismatch that can possibly trigger conduction % block. % Define...
6be5b1ca35b48378152b3f2b721e447c4fcf73b5b205897b0f139bef01cb9a0b
MATLAB
3,738
85
function Noise = NoiseExtractFromImage(image,sigma,color,noZM, residual_dir, confidence) % ------------------------------------------------------------------------- % Copyright (c) 2012 DDE Lab, Binghamton University, NY. % All Rights Reserved. % ---------------------------------------------------------------------...
5be4a0e552e39ba89120b1c451e1436e0b17ffad20a00e82684151402ba58cb7
MATLAB
3,740
127
function f = calccod(x,y,dim,wantgain,wantmeansub) % function f = calccod(x,y,dim,wantgain,wantmeansub) % % <x>,<y> are matrices with the same dimensions % <dim> (optional) is the dimension of interest. % default to 2 if <x> is a (horizontal) vector and to 1 if not. % special case is 0 which means to calculate glo...