sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1c362bfea28ad30e81b16126df8467c6a6d3f3d7900852923f2d5d1167dd2b69
MATLAB
1,430
40
% PURPOSE: gets current pointer for ALLERP structure and its size % % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2009 %b8d3721ed219e65100184c6b95db209bb8d3721ed219e65100184c6b95db209b % % ERP...
2b629ce6b21dcc8d0e19351deef70bb74ad578950d1a3adbe79499f0c6120f45
MATLAB
1,430
55
function Dab = lap_spect_dist(aij,bij,nComps,minkp) % https://github.com/aiavenak/matlab_code/blob/master/f_lap_dist.m % calculate the edit distance between two graphs A and B % reference: Thomas Thorne and Michael P. H. Stumpf % evolution Graph spectral analysis of % protein interaction network ...
e22640ee28829a677d4f1bd2b02a671ae013d9ebf45f13d9d55543eb73119efd
MATLAB
1,431
39
function [values, oldmin, oldmax] = rescale(values, newmin, newmax); % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/09/2010 % % rescalde - Linearly rescales a data set between a min and max value % % Usage: % [values, oldmin, oldmax] = rescale(values, newmin, newmax) % % Description: % [VALUESOUT, O...
e22d371c07ba5e7e806c1c93b2400cb009ab21c73a6f79f27e70ca5c3df94001
MATLAB
1,431
51
function [k k0] = circ_kurtosis(alpha, w, dim) % [k k0] = circ_kurtosis(alpha,w,dim) % Calculates a measure of angular kurtosis. % % Input: % alpha sample of angles % [w weightings in case of binned angle data] % [dim statistic computed along this dimension, 1] % % If dim ...
0532bc6f3bedca4a589f1c223cc11ce33de918c69316f20743eed2e09b5fdf44
MATLAB
1,432
40
% PURPOSE: gets current pointer for ALLBEST structure and its size % % % *** This function is part of ERPLAB Toolbox *** % Author: Aaron Simmons % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2023 %b8d3721ed219e65100184c6b95db209bb8d3721ed219e65100184c6b95db209b % % ERPLAB Too...
823b423f61bc486f758f07a2fbba3a32f543c54f2387e9108a43d94b14a211f7
MATLAB
1,432
34
function t2_update addpath('../code'); % Here we go over how to update the adaptive procedure on a trial-by-trial basis. % 1. Create the Palamedes structure as shown in 01_setup params.whichStair = 1; params.alphaRange = linspace(0,45,1e2); params.fitBeta = 2; params.fitLambda = 0.0...
e53d7042656249c8e6afe210097b0923a8908c9b65969f4e28657d3e019becce
MATLAB
1,432
40
% PURPOSE: gets current pointer for ALLMVPC structure and its size % % % *** This function is part of ERPLAB Toolbox *** % Author: Aaron Simmons % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2023 %b8d3721ed219e65100184c6b95db209bb8d3721ed219e65100184c6b95db209b % % ERPLAB Too...
6a984d8c8adc3b319fe996df3010be25cafa5af02dc97cb4e12a54dca8970b86
MATLAB
1,435
40
function pval = lme_mass_LR(statsfull,statsred,q) % pval = lme_mass_LR(statsfull,statsred,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 % statsfull: Structure array containing stat...
40a5044a2e1731acc74e33df42bbd6466ac8e53985bdbe89757e1723eeb7140d
MATLAB
1,436
66
function [ verts, normals ] = CirclePatch( numPts, radius, axis ) %CIRCLEPATCH Return a Nx3 matrix defining a set of verticies around a %unit circle axis = axis ./ norm(axis); step = (2*pi) / numPts; verts = zeros(numPts,3); normals = zeros(numPts,3); for(theta = 0:step:(2*pi) - step)...
080144cb6357ebb6223c49797826598682db82a6ed9e5921b6882e2594319055
MATLAB
1,437
68
function run_simulation_Part2(wNa, Le) % Load solution Part 1 load(sprintf('mat/rest_Ly300nm_Li1000nm_Le%dnm.mat', Le)) % Simulation time if wNa == 2 Tstop = 5e-4; dx_end = 1; elseif wNa == 6 Tstop = 5e-4; dx_end = 2; elseif wNa == 14 Tstop = 5e-4; dx_end = 4; elseif wNa == 30 Tstop = 1e-4...
285a7ad75afc37235aaacd9be7d668de54c5798fb78375847c8c31581ba60f4d
MATLAB
1,438
51
function [ cosdiff, origcos ] = hub_cossim(mat,distmat,hubmethod,Nreps) % the probability that hubs remain after 100% rewire if nargin < 4 Nreps = 100 ; end % n = size(mat,1) ; % enfore und mat = (mat + mat') ./ 2 ; triunroll = @(x_) x_(logical(triu(ones(size(x_)),1))) ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
432ae36f207389163e046724a96e579d1d7a2a52c2c4837394928702d951271c
MATLAB
1,438
47
%% Read SPIKEs from Plexon file [plxfile,path2plx] = uigetfile({'*.plx','Plexon file (*.plx)'}, ... 'Locate Plexon File'); SPIKE = ft_read_spike(fullfile(path2plx,plxfile)); %% Read SPIKES directly from TDT Tank (with sort codes if available) cfg = []; cfg.tank = tank; cfg.block = block; cfg.blockroot = [t...
5705b6542b5be4d3dd887a5bc1abae135635e3861c8d05de69c7d0b6c6c3c53a
MATLAB
1,442
37
function [] = validateData(LOOPERData, validateData, validateInputs, validateOutputs) rawData = validateData; rawData = convertToCell(rawData); lastEnd = 0; for i = 1:length(rawData) trialData(lastEnd + (1:size(rawData{i}, 2))) = i; lastEnd = lastEnd + size(rawData{i}, 2); end ...
5cf8b1024dae3d1dde20c32440a5d80a027a06609fb7910903b95f6edb85c11c
MATLAB
1,443
38
function params=tpreadconfig( tpdirname ) %TPREADCONFIG read twophoton experiment config file % % % PARAMS. = % params.Main.Total_cycles (total number of cycles) % params.Main.Scanline_period__us_ (scanline period, in us) % params.Main.Dwell_time__us_ (pixel dwell time, in us) % params.Main.Frame_period__us_ (...
9820e25e07140cd8a7915c31bd5bc7a42709a075c0bdcaa75b41fee5d62f30c9
MATLAB
1,444
69
%% unit = getpref('DB_BROWSER_SELECTION','units'); st = DB_GetSpiketimes(unit); P = DB_GetParams(unit,'unit'); %% uRate = P.lists.Rate; fpidx = find(diff(P.VALS.Rate))+1; P.VALS = structfun(@(x) (x(fpidx)),P.VALS,'UniformOutput',false); clear opts opts.clustering_exponent = -2; opts.unoccupied_bins_strat...
fdda60c93e3149d83721d7232726baae5ae831c07671580cdfde9e8db8022eb7
MATLAB
1,447
80
clear all; %% Load data % Gives me: X (labels), Y (data), time, label tmp = load('../data/testdata_orientation.mat'); Y = tmp.Y; % Y: features x time x trials X = tmp.X'; time = tmp.time; label = tmp.label; numF = size(Y, 1); numN = size(Y, 3); %% Single time opint % Select time point sel_t = find(time...
b8ec1fd884ebf0ce8a8eef9047d7a6cf786f7ce27bcd3b1f3822bff9d05cc6bf
MATLAB
1,450
63
function pulse_ind = getDitheredPulseInd(zeta_freq,f_stim,n,n_stim,dt,n_phi,freqSet,n_same,rndCycling) %%% 11-02-21 adding toggling options %%% 29-11-21 removing negative i_p's %%% 28-06-21 first revision %%% might not be exact i = 1; i_p = i; if isempty(freqSet) while i <= n if zeta_freq == 0 ...
45c0d2c574c56b88a5c04f0911e88515520450fdef713b530f5632d9be867a3d
MATLAB
1,452
53
close all; clear all; gt_dir = '/home/zxi/refinenet/datasets/gtea/SegmentationClass/testset'; pred_dir = '/home/zxi/refinenet/cache_data/Multiscale_evaluation_refinenet/gtea/test/predict_result_mask'; im_dir = '/home/zxi/refinenet/datasets/gtea/JPEGImages/testset'; dir1 = dir(fullfile(pred_dir)); %remove '.' and ...
5eb545cf6495f740e0a3098dfd13191fed48ae8f109b6c83dec36b327238de03
MATLAB
1,454
45
function [ IOU, Precision, Recall,MCR ] = getIOU( pred_map,gt_map,get_other_scores) %this function computes IOU when given a prediction map and respective %ground truth map. Both pred_map and gt_map should be 2D binary maps. % INPUT: pred_map: a binary image prediction map % gt_map: a binay image ground tru...
9a6e108f4ca57d1a195770ac9d530486fb7c43e5e7c205b8e14ed504b4f3b247
MATLAB
1,454
46
function self = EvaluateConfidenceScorer(self) confScorer = self.ConfidenceScorer; if self.VerboseLevel > 1 fprintf(' - %s scorer\n', confScorer.Method); end tmpS = struct; tmpS.Properties.Method = confScorer.Method; if self.VerboseLevel > 1 fprintf(' - Training set\n'); end isSet = self.ClipTable.Set ...
3a260377105a61137438ac55c992fae266c4693021b4eb2b8cd4a4edb29e01e1
MATLAB
1,455
46
function h = mplot(t, matrix, varargin) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % mplot - Plot rows of a data matrix. % % Usage: % h = mplot(t, matrix, varargin) % % Description: % MPLOT(MATRIX) makes a line plot of the rows of an (M x N) matrix using % a single line object. ...
37cbaf8bc813f213e6f21b34f7edb1f0a9af3d5cbd8d198093515bcf55e2b9d5
MATLAB
1,461
23
function c0 = initial_conditions(x, y, z, G, c_idx) %c0 = initial_conditions(x, y, z, G, c_idx) c0 = (x < G.Li).*G.c0i(c_idx) + (x > G.Li+G.Lm).*(x < G.Li+G.Lm+G.Le).*G.c0e(c_idx) + ... (x > G.Li+G.Le+2*G.Lm).*G.c0i(c_idx) + ... (c_idx == 1).*(x >= G.Li).*(x <= G.Li+G.Lm).*... (y > G.Na_channel_start_y-G.dy...
3f031492683e48f93297d849f13ccb868c451e78e0e68cfca96a398fe46ba1c2
MATLAB
1,461
49
function demo() % demonstration file for SparseGDLibrary. % % This file illustrates how to use this library in case of "lasso" % problem. This demonstrates FISTA and ADMM algorithms. % % This file is part of SparseGDLibrary. % % Created by H.Kasai on Apr. 24, 2017 clc; clear; close all; %% prep...
bdc70d4d3297e1ce21da831e477b91d247f27d824feecf9bb3e25e3f25befa9a
MATLAB
1,461
50
function [p,U2_obs,U2_H0]=watsons_U2_perm_test(A1,A2,N) % % [p,U2_obs,U2_H0]=watsons_U2_perm_test(A1,A2,N) % % Computes the probability that two samples of circular data (angles) come % from the same distribution, or from distributions with the same direction % (null hypothesis), using a permutation test and Wats...
fcbbe3285559e44f4f72580a3816f9973e4883ae777cd9c87decded9ed6e2cd0
MATLAB
1,463
48
function visualPolar2(h,x,prop) persistent p p2 %Define the shape and colour of the dot based on elevation and target %heading if x(6) <= -1*prop(3) dotColour = 'b'; dotMarker = 'o'; elseif x(6) <= prop(3) if (x(5) > (prop(2,prop(1)) - prop(3))) && (x(5) < (prop(2,prop(1)) + prop(3))) dotColour = '...
a07151f354b7f8f62c56bc743c981c54a12317014d9db5fbf5270feac7b286ee
MATLAB
1,466
48
function visualPolar4(h,x,Target,Head,Tol) persistent p p2 %Define the shape and colour of the dot based on elevation and target %heading if x(6) <= -15 dotColour = 'b'; dotMarker = 'o'; elseif x(6) <= 15 if (x(5) > (Head(Target) - Tol(Target))) && (x(5) < (Head(Target) + Tol(Target))) dotColour = ...
dc5fec16317341a822bf465a765b56f9ee8769d7b086f8ae1709281f377c65ae
MATLAB
1,468
39
function TPPreviewImageFunctionListAddCache(filename, pvimg, params, parameters, dirname, tpfnameparameters, total_frames, dirnames, videoinfo) % TPPREVIEWIMAGEFUNCTIONLISTADDCACHE - Add preview image parameters to the cache % % TPPREVIEWIMAGEFUNCTIONLISTADDCACHE(FILENAME, PREVIEWIMAGE, PARAMS, PARAMETERS, ... % ...
f011de51f40f25cbf6d03eaf7b2b49038b23a8bdcec18e53e96d24e473a8a09c
MATLAB
1,468
63
%% MYDEMO: Demonstrate usage of mym utilities % Example: mydemo (Oh, the FEX code metrics..) %% List available functions lookfor mym %% Connect to MySQL myisopen myopen('localhost','root','fairfax') myisopen %% List available databases dblist %% Create database 'test2' dbadd('test2') %% Confirm th...
a93abaa5c62292fb4f48c34aa95d1ffde7ee0dd8648a1bc6128d78cbd63ab245
MATLAB
1,469
36
function [nerveModel, electrodeType, electrodePlacement, paramSet] = select_model() % TODO group all into a single modelSelection struct [modeList, electrodeTypeList, placementList, paramList] = get_models_list(); iSubject = listdlg('PromptString', {'Select Subject Id'}, ... 'SelectionMode', 'single', 'Lis...
3a0ba7717ed198bf2c08ebabd3e133541d15a15c1dd097f618c29059c85a54a9
MATLAB
1,470
41
function [ev,lb,ub,RPV] = ss_rpv_contamination( spikes, use ) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/09/2010 % % ss_rpv_contamination - wrapper for rpv_contamination.m % % Usage: % [lb,ub,ev] = ss_rpv_contamination(spikes,use) % % Description: % Estimates contamination of a cluster based on ...
a33e9bdba0d726123105af82c21b01a9be6b39a7b3cfae6b9ec0037f7efce1b3
MATLAB
1,470
50
close all; clear all; gt_dir = '/home/zxi/refinenet/datasets/ADE20K_hand_images/SegmentationClass/test'; pred_dir = '/home/zxi/refinenet/cache_data/Multiscale_evaluation_refinenet/ade_on_ade/test/predict_result_mask'; im_dir = '/home/zxi/refinenet/datasets/ADE20K_hand_images/JPEGImages/test'; dir1 = dir(fullfile(pre...
58415208dbb0048da10e6942e9f3902e0b11c2b6ff47463b5a9d5b9910a201c0
MATLAB
1,472
53
clc; clear; close all Fig4b=figure(); Ntrials_3=60000; %Ntrials_3: number of learning cycles to learn the background. %There is no embedded pattern in afferents. %(Note initial conditions in this step are from step 2) N_mu=500; %There are \mu independent embedded patterns, 500 simulations (number of simula...
8c5a6f076290264e3637c7ed76b4637718baeaba518d01f6bf8b66217dab35f6
MATLAB
1,474
50
function varargout = ep_LaunchPad(varargin) % ep_LaunchPad % % Buttons to launch the different GUIs associated with the ElectroPsych % toolbox. % % Daniel.Stolzberg@gmail.com 2015 % Copyright (C) 2016 Daniel Stolzberg, PhD % Edit the above text to modify the response to help ep_LaunchPad % Last Modified by GUIDE v2...
8c982b1bb741ffc97eeb983718409f03fcf34a857b2c86afc380f45eeea60d26
MATLAB
1,474
46
% *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2009 %b8d3721ed219e65100184c6b95db209bb8d3721ed219e65100184c6b95db209b % % ERPLAB Toolbox % Copyright © 2007 The Regents of the University of California % Creat...
308f0d6be7a2c517213b204388c2c6afacb71b4d0f622ec40274886e2709682a
MATLAB
1,478
46
function [lmatrix_new, complist] = bmf_fill_holes_patches(lmatrix, complist) % This function ensures that every patch is continuous within % lmatrix = a three-dimensional matrix with a mask for each patch % separately % complist = patch border information from the frequency segementation code % output % lmatr...
83f1b86c91d33caa2319cc2f17e037e6fa4494c90c0dcf044a3706c37d4ea71f
MATLAB
1,480
50
function model = dtip_pipe_SDPd(data,btensors,mask,nvox,ind,parallel,cvxsolver) % function model = qtip_pipe_SDPdc() % % reshape data and retain voxels within the mask siz = size(data); data = reshape(data, prod(siz(1:3)), siz(4))'; mask = reshape(mask, prod(siz(1:3)),1)'; si = find((mask>0).*(~all(data==0,1))); data...
a66022090359bc3476b85d436189d1f582b14d377d53b8c1eebef68504051aa1
MATLAB
1,480
56
function PlotDataRasters clear all close all clc % Created 22 April 2016 JDY %---FLAGS---% Behavior = 1; subject = '230115'; % subject = '235107'; session = 'CA'; Block = '126'; Path = '/Users/justinyao/Sanes Lab/Experiments/PROJECTS/AM RATE/Ephys/processed_data/'; DataFile = [Path subject '/' subject '_se...
11948acb8a337fc92a437bf7ac4fde275b50a01bb8a589d7757802846c10adc8
MATLAB
1,482
45
function json = readSettings(varargin) % Reads in from file, parses, and returns the JSON-formatted config file % (e.g. export and stimulus paths). % % You can run this without arguments if you use the default io.json in the config folder args = parseInputs(varargin); % try to open the settings....
a23300b989d9fc6ffefa985de7bbb10b6dd7c850918e79a2f3617a93523e60e7
MATLAB
1,482
46
% PURPOSE : To view the ERPLAB Toolbox User's manual % % FORMAT : % % pop_erphelp % % INPUTS : % % - No inputs necessary % % OUTPUTS : % % - Will open the ERPLAB Toolbox User's Manual in an html file % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon % Cent...
459ef3bf97a5d2b5038eb0cd3ca143c002b8f7704b52bb1fe7b06a244c39bacb
MATLAB
1,483
46
% PURPOSE : To view the ERPLAB Toolbox Tutorial % % FORMAT : % % pop_erphelptut % % INPUTS : % % - No inputs necessary % % OUTPUTS : % % - Will open the ERPLAB Toolbox Tutorial in an html file % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon % Center for ...
a4c80539d61416eba3602952b5aba52ab794fd18ddff4fecdd028f0f31f6c8e9
MATLAB
1,485
58
function [im] = tpquickmap(dirname,channel,resps,pixels,plotit,method,param1,param2) % TPQUICKMAP - Produces a colored map of responses % IM=TPQUICKMAP(DIRNAME,CHANNEL,RESPS,PIXELS,PLOTIT,METHOD,PARAM1,PARAM2) % % Generates a color map of neural responses. % % DIRNAME is the name of the directory. A preview im...
fa07996900311a5b8aedbbfc3689fe2698888fe4950b79580aa00f5117c77217
MATLAB
1,485
31
function writeplxchannelhdr(plx_id,ch,npw) % now the single PL_ChanHeader pad256(1:256) = uint8(0); % assume simple channel names DSPname = sprintf('DSP%03d',ch); SIGname = sprintf('SIG%03d',ch); fwrite(plx_id, DSPname, 'char'); fwrite(plx_id, pad256(1:32-length(DSPname))); fwrite(plx_id, SIGname, 'char'); fwrite(plx...
d2cf547aaf80e9adcc1363a2803b4f3ddf86a8bc60e8e979cb0a6e55d845cec0
MATLAB
1,489
35
%% Calculate x- and y-bounds for an OH/OHA/TOH/TOHA trial's workspace % Determine the minimum and maximum values in the x- and y-dimensions of % the workspace for an OH/OHA/TOH/TOHA task. % Copyright (C) 2022 Richard Hugh Moulton % % This program is free software: you can redistribute it and/or modify % it under ...
da908bd0e486585482ad4591f86341a4cb4e3f5ddc0bc881d712be499df8e049
MATLAB
1,489
49
function [linehandles, patchhandles] = errorarea(x,y,l,u) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % errorarea - Plot line with confidence region. % % Usage: % [linehandles, patchhandles] = errorarea(x,y,l,u) % % Description: % ERRORAREA(X,Y,L,U) is similar to ERRORBAR(X,Y,L,U), e...
77b05f8c06f934ff1c6664fec66433eaa89afcc0a775b14e03a020f68ecf1f98
MATLAB
1,490
63
function [stds, d_log_scales] = scaledGaussianComponent(ws, log_scales_0, grps, dU_0, stds) % i.i.d. multivariate zero-mean normal prior distribution over columns of ws with covariance matrix % defined in GMLMprior_dmcStimVar % % calculates prior and all derivatives compute_D1 = nargout > 1; precomputed_portion ...
9c860af8a64fd75a8643b76c6387f725c3ad1a5e39fb34c8e17660b00eab655c
MATLAB
1,490
48
function visualPolar3(h,x,Target,prop) persistent p p2 %Define the shape and colour of the dot based on elevation and target %heading if x(6) <= -15 dotColour = 'b'; dotMarker = 'o'; elseif x(6) <= 15 if (x(5) > (prop(2,prop(1)) - prop(3,prop(1)))) && (x(5) < (prop(2,prop(1)) + prop(3,prop(1)))) do...
4d9fa6c2031ff6492f82a9d634325c7e077b867ca982c39021068d0fa6a82383
MATLAB
1,492
41
function confusion = ss_gaussian_overlap( spikes, use1, use2 ) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % ss_gaussian_overlap - wrapper for gaussian_overlap.m % % Usage: % C = ss_gaussian_overlap( spikes, use1, use2 ) % % Description: % Estimates the overlap between 2 spike cluste...
93ca995d1c9c71ada94ef6d153da1741d82034f9d455a4dce609a54da0c9b8ac
MATLAB
1,492
57
clc; clear; close all Fig8c=figure(); r0_t = 2:1:9; %r_0 (desired number of spikes) N_mu=100; %There are \mu independent embedded patterns, 500 simulations (number of simulations) RESULTS=zeros(4,numel(r0_t)); for p1=1:numel(r0_t) SD=r0_t(p1); for p2=1:N_mu eval(['load Learning_B...
0e0159999fdbb55b40bffd4488b0e29280713d5ae6784abcaad3f73c2dd26272
MATLAB
1,493
60
function fx = filterSignal(x, fLow, fHigh, Fs, dim, hilbertFlag) % FILTERSIGNAL band-pass filters the signal X with the desired cutoff % frequencies FLOW and FHIGH, given the sampling frequency FS. Data will be % filtered along dimension DIM (default 1) and if boolean HILBERTFLAG is % true, FX will be the analytic sign...
72ae2acedcb276895c685bc3a7aeb839ca84ea8a8b9e38b2f47232a383203318
MATLAB
1,493
49
function [p,mu,stdev,n,x] = ss_undetected(spikes,use) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/201 % % ss_undetected - wrapper for undetected.m % % Usage: % [p,mu,stdev,criteria] = ss_undetected(spikes,use) % % Description: % Estimates how fraction of spikes associated with a given clus...
757804fa494e7ea96e4460d16c03b876ef1d8ecf0699742d5957196a0426da92
MATLAB
1,494
79
function [zp,Overlap] =assignment(z,type,Size) % [zp,Overlap] = assignment(z,type,Size); % % Input % z: nx2 or 2xn coordinates % type: if z is raw data or representing in Cartesian coordinates then % type = 'raw' % type: if z is representing Pixel Coordinates then % type = 'pixel' % % Size: is the frame ...
d780af23b0782b50fa2eefc665057e7433f48abec82cbf8d43030565601bb1d2
MATLAB
1,494
38
function baseline = compute_baseline(basetimes, baselinemethod, isidata, isitimes, isidatam, isitimesm, blankdata, blanktimes, blankdatam, blanktimesm) % COMPUTE_BASELINE - Compute baseline F for dF/F for two-photon data % % BASELINE = COMPUTE_BASELINE(BASETIMES, BASELINEMETHOD, ... % ISIDATA, ISITIM...
3029df4070ba8109accc857b3a968f1bdef61f897bcdbb6786390d9a8667069e
MATLAB
1,495
44
function activeArray = makeActivePatternsArray(patterns, npat, nt) %MAKEACTIVEPATTERNSARRAY converts pattern matrix to activity array. % This function takes the PATTERNS matrix output by FINDALLPATTERNS % giving the start and end of each pattern, and converts to a PxT matrix % giving the number of patterns of eac...
777be375d7c992d6fb6932da65f88592702e747e3b3a6dcf99ce5aa533dd2382
MATLAB
1,495
36
function [TmtxS,iFRs,usel_out]=SelTrialsCellsWholeTrial(fn,twin,minFR,critCvBW) % Select cells from PFC and HC data sets & cut out event periods (trial case) % outputs % Tmtxs {no. trials} time axes for selected trials % iFRs {no. brain areas}{no. trials}(timerange,no. neu...
e7e68373a2e814adddf460e743e0823fab2c643818274265aa6cf010a5c1c52d
MATLAB
1,498
67
function [C,X]=TrimMesh(C,Trim,X) % Trims mesh according to bounding box in Trim % INPUT: % trim=[xmin xmax ymin ymax zmin zmax] coordinates of trimmming box for mesh. NaN=no trimming. % OUTPUT: % C(e,:)=connectivity of element e % X(i,:)=(x,y,x) coordinates of node i % Select nodes on x nodesc=cell(6,1); for ...
9374f450465d240e2fa4dfbdd97cbdb085b6be0162b84427a18a4e3f0080466f
MATLAB
1,499
32
% Example 2: Feature selection of saved model % % In this Example, feature selection using class-activation maps (CAMs) is executed. % It is assumed that Example 1 has been run before running this Example. % Running Example 1 will save model files in Models/Run.. folder and also the % data file either Out1.mat (if no...
d1112f04fa73ed3140264a585b6adc0cc32fd1e88018eced68434a6349a26060
MATLAB
1,500
39
% defualt params and upper/lower bounds for the Liley model param.he_rest = -69.6952; param.hi_rest = -74.4255; param.Nee_beta = 2847.80; param.Nei_beta = 4422.60; param.Nie_beta = 744.01; param.Nii_beta = 173.86; param.Gamma_e = 1.9827; param.Gamma_i = 0.4169; param.gamma_e = 0.3030; param.gamma_i = 0.0486;...
e2bae9997101bf39fc5047b69af55fffafe5da874c607dcc53fa796cf1d5d8a2
MATLAB
1,500
60
%% plot vectors function [] = plotVectors(ax, dirs, colors, includeBoundary, markedDirection, arc) hold(ax, 'on'); %plot requested arcs if(nargin >= 6) for ii = 1:size(arc, 1) theta_1 = min(dirs(arc(ii,:))); theta_2 = max(dirs(arc(ii,:))); ...
4726e046fabf91aca11fe699a21d6a89346293cdb5ac33b5a7a304db69b789ab
MATLAB
1,505
72
function fit1 = fitness_moea45(A1, paramsvec, eegdata1, paramstoest, T1,tcut, fhz1) paramsinput = [paramsvec, zeros(1,10)]; paramsinput(paramstoest) = A1; % load in the data to fit against eegautocor = eegdata1{1}; eegdatadegdist = eegdata1{4}; z = eegdata1{2}; z2 = eegdata1{3}; a4=[]; fithvg=[]; parfor Run...
525f05299b32ca2d3f5126ce640e4ce641852307d17fd19653e82c277c300b63
MATLAB
1,505
28
function [crossEntropy,dev,yhat,beta] = GLM_logit_constantCV(features,y,CVfolds) % Performs unregularized regression using logistic link function on binary (logical) response data y from the features. % Uses stratified k-fold cross-validation using the pre-partitioning of the data y appearing in CVfolds, % and calculat...
ebcdf1518821cd1cd1422ca6290ae31556e9eba1b89b7d53e3e696abe89ceaa7
MATLAB
1,505
36
function [avgReversal, avgReversalRT] = ... behaviorReversal(filePath,dataFiles,reversalCritereon) %% calculate behavioral reversal % (=three consecutive correct trials after a block ended) for session=1:size(dataFiles,1) %for all sessions load(fullfile(filePath,dataFiles(session,:))) %sequence ident...
446fc5868d64bc61977ee8870075873dade5db1baf5fae5d6f30f5416a5c009a
MATLAB
1,506
30
%%% Although the code should be run on a supercomputer to get Arnold tongues with a %%% good resolution, this is a test call that can be used on a local machine. %%% The predefined parameters below will generate the data for a dithering level %%% zeta = 0.047 %%% 26-01-23 first commit clearvars close all fpath ...
38d00d2d3d5592e080e25bd18ad0e00dd7feb68bd242103e7d0eeee0e8c7d2b3
MATLAB
1,507
46
function cdf_validation(iSubject, rootDir) %PDF_VALIDATION Summary of this function goes here % cdf_validation(1, '..') [numFibersAtPercepThreshold, placements, percepThresholdsExp] = num_fibers_for_perception(iSubject, rootDir); qMaxnC = 120; % How to treat this missing data? percepThresholdsExp(isnan(pe...
f36472cbbb99a1261e5c82a626bb888cea2dcdf7dbcf04963d879f8c18257105
MATLAB
1,507
51
% Assigns the given value to the named property of an object or structure. % This function can deal with nested properties. % % Input arguments: % obj: % the structure, handle or value object the value should be assigned to % name: % a property name with dot (.) separating property names at % different...
c8a10f34c7d4a42173f70fe38e0409f0caaf7a9750a7d631b2a93043f662274f
MATLAB
1,508
49
function [param, ev, ssVal, model] = fitReduceEEG(EEG, velocity, retinalP, initCond, bd) param = []; model = []; ev = []; ssVal = []; vlb = bd(1,:); vub = bd(2,:); parfor i = 1:size(initCond,1) optObj = opti('fun', @(pSolve) sumLsqTSDAB(pSolve, EEG, velocity, retinalP), 'sense', 1, 'lb', vlb', 'ub...
16ac72bbe0564bad19c8dda5fa5768cba80d8bc59119271d5291ef56cce07e1e
MATLAB
1,510
59
function popup(ah,fh,varargin) % POPUP - copies a subplot into a full figure % POPUP(ah, fh) copies the object <ah> into the figure <fh> if this exists. % If it doesn't a new one is created. <fh> is optional. Instead of a handle % <fh> may be a name of a figure. % % Example: % fh = figure; % ah = gca; % ... % ...
21b6a23a7848d62a988a117fc9d39575990705942ce3e27faee821d2dd87cdc2
MATLAB
1,510
47
function plot_histograms2(parameter_set,subplot1,subplot2,color,parameters_to_plot,subplot,text) % This function plots hisotgrams of parameter locations FS1=7; paramnames= { 'h_{e}^{rest}' ,'h_{i}^{rest}','N_{ee}^{\beta}','N_{ei}^{\beta}','N_{ie}^{\beta}','N_{ii}^{\beta}','\Gamma_e',... '\Gamma_i','\gamma_e','...
4c0b70766ea190bfbe66817307b01da8c7c97b25c9138b48168b8cbbe270d9bd
MATLAB
1,511
46
function [hr,pval] = SStat_mass_HR(x1,x2,y1,y2,stats) % [hr,pval] = SStat_mass_HR(x1,x2,y1,y2,stats) % % Vertex/voxel-wise hazard ratio estimates for Cox models. % % Input % % x1: Row vector with the covariate values for the first group (1xp). % x2: Row vector with the covariate values for the second group (1xp) . % y...
bdc779a88fab1737a41634d1ae61716df212220c6e97af1b5acf04ae5a289658
MATLAB
1,513
46
% PURPOSE : To view the ERPLAB Toolbox Script Tutorial % % FORMAT : % % pop_erphelpscript % % INPUTS : % % - No inputs necessary % % OUTPUTS : % % - Will open the ERPLAB Toolbox Script Tutorial in an html file % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calder...
cb3d6373c5e12b48fddcea3a1dcb889369cbd14e8e07d51feb3d035d62b98c9b
MATLAB
1,513
54
function mni_coords = ccep_mni305linear(elecmatrix,FSdir) % % Convert electrodes in native space to MNI using linear transformation % % Input: % elecmatrix: nElec x 3 in the original T1 space (before freesurfer) % hemi: hemisphere to load for each electrode (l/r) % FSdir: subjects freesurfer director % % Example:...
20ddec992fd30a7df73f69b388681629b51cfdc2d11ec050779a96cb7526fce6
MATLAB
1,514
44
%this is a program that generates trial averages and forms clusters based %on that/Choose folder : DMDLBRDLCB_allbrainpoolPL. Created by Haleh Fotowat. close all clearvars path=uigetdir; cd(path) %read the pooled clustering data load('DMDLBRDLCB_082628_091112_HA.mat') RegData=csvread('DMDLBRDLCB_celltypes_registered...
13902b4501561b3997d5e7fd5bff59c238eff3a3dc21f9be4900e53faf098c44
MATLAB
1,516
55
function varargout = TDT_TankSelect(varargin) % [tanks,ok] = TDT_TankSelect(varargin) % % Optional Input Parameters: % 'SelectionMode' ... 'multiple' or 'single' (default) % 'Name' ... dialog title % 'OKString' % 'CancelString' % 'TankList' ... optional tank li...
6c10ba386616d9c1e19583f88695665c628688b417b131ce50c287af7230208f
MATLAB
1,517
55
function [chk, msgboxText] = f_ERP_chckbinandchan(ERP, binArray, chanArray,Bin_Chan_label) chk=[0 0]; msgboxText = ''; % if numel(Bin_Chan_label)==1 % Bin_label % % end if Bin_Chan_label==1 if isempty(binArray) msgboxText = 'You have not specified any bin'; chk(1) = 1; return ...
0c167a344c1ddeb2c3c56f11a8163fbf760f2d877eed2ab6503ed2171fc4bbd2
MATLAB
1,520
46
function KL = dist_KLdiv(P, Q, doWarning) % Compute the Kullback–Leibler divergence between probability distributions % P and Q. Note that KL is not symmetric. KL(Post, Prior) quantifies the % information gain when moving from the prior to the posterior. % % Usage: % KL = dist_KLdiv(P, Q, doWarning) % NB: doWarning: ...
3283c56334358c000d27b6ba99f5869614086cde512e49ca7ac6a99a2a3ae67b
MATLAB
1,520
67
function varargout = plot(varargin) % plot method for GIfTI objects %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: plot.m 5888 2014-02-19 19:54:12Z guillaume $ % if ishandle(varargin{1}) % ...
f973b0b44d255a110fceb0ad587827b9c12102d0f52205a199d15f00ffe58022
MATLAB
1,522
38
function [beta_out] = merge_into_large_tbl(beta_table) %MERGE_INTO_LARGE_TBL Create one large table from the beta_tables variable % taste strings from Variable names taste_strings = beta_table.Properties.VariableNames; % Create a copy for merging beta_out.merged = beta_table; beta_out.single = beta_table; for taste_i...
a0ffefdc19159adc27ac296da9769fade3ac8f8d7481180047f8b6ce8ba7f330
MATLAB
1,524
55
function [rou,diffu] = scaled_routing_n_diffusion_und(mat,reps,rwiter,transform) if nargin < 2 reps = 10 ; end if nargin < 3 rwiter = 1 ; end if nargin < 4 transform = 'inv' ; end % clean up mat gg = get_components(mat) ; ggmode = mode(gg) ; if any(gg~=ggmode(1)) warning('more than one component, wil...
f67a1f7a42b846f4dff1be23c7c1c0594edd96df16aaf276b07c912085ce437c
MATLAB
1,524
69
function TrialFcn_PumpControl(ID,rate) % TrialFcn_PumpControl % TrialFcn_PumpControl(ID) % TrialFcn_PumpControl(ID,rate) % % This function sets and controls the pump variables for the Aversive AM % Detection task. % % Optional: ID = inner diameter of the syringe % % Daniel.Stolzberg@gmail.com 2014. Edited by MLC 10/30/...
97817791afb889400ca4f1db5a4a038bd93be9d4bd126f01c56e62bd5de0ed80
MATLAB
1,525
64
function sandrine2vhlabtstack_dir(dirname) % SANDRINE2VHLABTSTACK_DIR - convert a whole directory of Sandrine experiments to vhlab t-stack format % % SANDRINE2VHLABTSTACK_DIR(DIRNAME) % % Coverts a whole directory of files in .lif format to vhlab t-stack format. % % Expects the name of the .lif files to be: % % YYYYMMD...
ce6e701ed9ea28c288c8dd05636799a30d0e75180be36adf648332c29eda6470
MATLAB
1,525
70
function TrialFcn_PumpControl(ID,rate) % TrialFcn_PumpControl % TrialFcn_PumpControl(ID) % TrialFcn_PumpControl(ID,rate) % % This function sets and controls the pump variables for the Aversive AM % Detection task. % % Optional: ID = inner diameter of the syringe % % Daniel.Stolzberg@gmail.com 2014. Edited by MLC 10/30/...
1f1942ecb51ca2bb4b25d87bf0802033cbda28192dc6f49c925b5d25e7bd7847
MATLAB
1,526
41
function fascIdsByAs = check_active_sites_ranges(endo, ... activeSitesCoord, asRange) % CHECK_ACTIVE_SITES_RANGES determines whether or not any point in a % fascicle is in reach of the electrodes' active sites % % fascIdsByAsPerElec = check_active_sites_ranges(endo, activeSites) % % Inputs: - endo % - acti...
03d33ba669f32693df66d89e489d522ba8497ebf16750c74ec95278dca35b269
MATLAB
1,529
70
function [roiid,m,idx] = do_barplot(pow_parcel,rois, nroi) figure, bar(pow_parcel); L = length(rois); set(gca,'Xtick', 1:L,'XtickLabel',1:L); box off set(gca,'color','none'); xlim([0,L+1]) xlabel('ROI'); ylabel('Source power'); set(gcf, 'Position', [1000 100 1200 500]); set(gca,'FontSize',10,'XTickLabelRotation'...
13af549dab67224bce5bfe642eacc5ebb0b40aee0d26ce3f9e1356fcf75cd75f
MATLAB
1,530
54
function sRGB = spectrumRGB(lambdaIn, varargin) %spectrumRGB Converts a spectral wavelength to RGB. % % sRGB = spectrumRGB(LAMBDA) converts the spectral color with wavelength % LAMBDA in the visible light spectrum to its RGB values in the sRGB % color space. % % sRGB = spectrumRGB(LAMBDA, MATCH) co...
4fa8dc7bfb3ce85a11213d75d35f9cc2a7990313a8e9140a65ed97693392f2e6
MATLAB
1,530
56
function [ y ] = modelfun_dHEC( beta, x ) %UNTITLED Summary of this function goes here % Detailed explanation goes here stim_az = x(:, 1); % stimulus azimuth FP_az = x(:, 2); % fixation point azimuth nof_AV_stims = x(:, 3); AV_data = x(:, 3+(1:(3*nof_AV_stims))); AV_data = reshape(AV_data, [nof_AV_stims 3...
e89347bb381fae394d9c9e88e3d4eb0d0932b3be82fa7c88dd18e8a0c32ff0a3
MATLAB
1,530
43
function F = ccep_fitpiecewiselinear(pp,Y,x) % fitting a piecewise linear function with 2 segments to ccep data % Copyright (C) 2020 D Hermes and D van Blooijs % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by %...
08786b04a9102d9f09017eb6fd02dcff3f1cc6f7da40c430edd7c80b6fdee105
MATLAB
1,531
65
%% Script to generate Figure 6 clear all close all runs = 10; epochs = 1000; hunits = {'2', '4', '8', '16', '32','64'}; runsstrings = {'Run1','Run2','Run3','Run4','Run5',... 'Run6', 'Run7','Run8','Run9','Run10'}; rmseGRUT = zeros(runs,epochs,length(hunits)); rmseGRUV = zeros(runs,epochs,length(hunits)); % All G...
21c7bdd41cdb2069c9c6c95f4206119c241a48ed40814458cbb67aba08ff08e7
MATLAB
1,531
48
function test_normality(iSubject, rootDir) %TEST_NORMALITY Summary of this function goes here % Detailed explanation goes here [numFibersAtPercepThreshold, ~, percepThresholds] = num_fibers_for_perception(iSubject, rootDir); % Filter values, 50 makes it more regular % percepThresholds = percepThresholds(perc...
073e7df0ddfb756fb8e9ef496e2a0d5965d8cebf6c36e4562f917fb01a51a009
MATLAB
1,532
66
%%This function is to display the summary of trial information % % FORMAT : % % pop_erp_ar_summary(ALLERP,ERPArray); % % ALLERP - structure array of EEG structures % ERPArray -index of erpsets %EEGNames -EEGset names % *** This function is part of ERPLAB Studio Toolbox *** % Author: Guanghui Zhan...
97973f847a7230dac60476490ab098a2e544b4363bfa68bcb3316012d7371b2a
MATLAB
1,532
73
% PURPOSE : function erplab_running_version(varargin) erpcom = ''; if nargin < 1 help erplab_running_version return end % % Parsing inputs % p = inputParser; p.FunctionName = mfilename; p.CaseSensitive = false; p.addParamValue('version', []); % erpset index or input file p.addParamValue('tooltype', ''); ...
28190e3bbf1dc48e329d5910af3bc6ff224a778c867a35973f21971d12f842aa
MATLAB
1,533
46
function [xc,lags_xc,w,lags_w] = getLags(db,P,lagP) %% Get the binned data [~,neurProj,motDat,baseIdx] = getDataBinnedToVideoFrames(db,P,lagP); for k = 1:P.nMice % Take only baseline neurProj{k}(~baseIdx{k},:) = nan; % Subselect only 1st component neurProjPC1{k} = neurProj...
9587c9b6b2bc8c80bf65239d1e30bb8417ce1a78653d57ee7efe1b47b75cfc06
MATLAB
1,535
53
function [tag,datatype] = ReadRPvdsTags(RPfile) % tag = ReadRPvdsTags(RPfile); % [tag,datatype] = ReadRPvdsTags(RPfile); % % Read parameter tags from an RPvds file. RPfile is the full path and % filename to an RCX file. % % Daniel.Stolzberg@gmail.com 2014 % Grab parameter tags from an existing RPvds file ...
2dddd732d2376956916ab89c5adf02d5dc12b00089878d8eb823572bc66dba23
MATLAB
1,536
26
function D = diffusion_coefficient(x, y, z, G, c_idx) %D = diffusion_coefficient(x, y, z, G, c_idx) if isfield(G, 'sodium_open') sodium_open = G.sodium_open; else sodium_open = [0,0]; end D = (x < G.Li-G.dx_min/2).*G.D(c_idx) + (x > G.Li+G.Lm+G.dx_min/2).*(x < G.Li+G.Lm+G.Le-G.dx_min/2).*G.D(c_idx) + ... ...
cba089f6907f026b44f6305bcfcb43a2a0c1cbbdd5c7c380c6923b29c02cc634
MATLAB
1,536
55
function plotMap_slopeBased(w,f0Vect,aVect,fpath,withMask,clab,xlims,ylims,clims,... adjustFt,tol_w,tol_dw,spanFact,method) %%% 26-01-23 first commit figure if strcmp(clab,'mean instantaneous frequency (Hz)') colormap(inferno(256)) elseif strcmp(clab,'PLV 1:1') || strcmp(clab,'PLV 1:2') || strcmp(clab,'P...
fb770b1f3026cc73c698897e0d423d23d9e41c763501d0bd070295f6208d546f
MATLAB
1,536
45
% PURPOSE: gets current ERPLAB GUI's background color % % FORMAT: % % bcolor = geterplabcolor; % % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2009 %b8d3721ed219e65100184c6b95db209bb8d3721ed219e65100184c6...
96af1f0858f5640bc3a7f4ece5a02b910e3842409ab5474970636a8beb3d480a
MATLAB
1,537
37
function h_mask = significance_FDR_corrected(p_values, alpha_level) % Indicates which null hypothesis are rejected based on the matrix of p % values p_values, with the FDR bound alpha_level in [0,1]. % NaN values in the matrix p_values are ignored (they are not considered as % hypotheses). % % Reference: Genove...
aecd82fe2b4bfc64d2e46af6bca1cc8389de6fcea73cd53b7018055baeb0e63e
MATLAB
1,538
52
function GenerateFrames(self, varargin) %GENERATEFRAMES Generates spatial/temporal frames % GENERATEFRAMES(SELF) generates frames for streams and cameras specified % in the config file % % GENERATEFRAMES(..., 'PARALLELIZE', TRUE) parallelizes the process (by % default, no parallelization is used) p = inputPar...
2e782f10982245149d3cbcee96eb187bd8510f0df7189b9312f93c593fb1bba8
MATLAB
1,540
68
% CALCULATEMVC - CALCULATE THE MAXIMUM VOLUNTARY CONTRACTION % % [MVCs,MVCs_per_trial] = calculateMVC(subject,toplot,parent,LR) % % MVCtype = 1 -> sensors 1-4 % % LR = 0 regular % = 1 Left % = 2 Right function [MVCs,MVCs_per_trial] = calculateMVC(subject,toplot,parent,LR) MVCtype = 1; if nargin...
c1276a500ce42cede1d47960ce6b35526daa55777b261d8a36a8800587c21c0c
MATLAB
1,540
48
function plot_histograms(parameter_set,subplot1,subplot2,row,color,Label,parameters_to_plot,subplot,FS1) % This function plots hisotgrams of parameter locations paramnames= { 'h_{e}^{rest}' ,'h_{i}^{rest}','N_{ee}^{\beta}','N_{ei}^{\beta}','N_{ie}^{\beta}','N_{ii}^{\beta}','\Gamma_e',... '\Gamma_i','\gamma_e','...
5da22198bcd634e8b940bb6956a253173109b8616a2d38908358fc70699c0c3e
MATLAB
1,544
50
function model = qtip_pipe_SDPdc(data,btensors,mask,nvox,ind,parallel,cvxsolver) % function model = qtip_pipe_SDPdc() % % reshape data and retain voxels within the mask siz = size(data); data = reshape(data, prod(siz(1:3)), siz(4))'; mask = reshape(mask, prod(siz(1:3)),1)'; si = find((mask>0).*(~all(data==0,1)...
035336342e1785853e7f2dcdff325e3220b0b872b405e3d405e3d34ea79b7326
MATLAB
1,545
75
function RunAMDiscrimination clear all close all clc Path = '/Volumes/JUSTIN EXHD/PROJECTS/AM Discrimination/Data/'; %-NH-% NH = [Path 'NH/']; nh = getfiles(NH); subplot(1,2,1) plotdata(nh,'NH') %-HL-% HL = [Path 'HL/']; hl = getfiles(HL); figure(1) subplot(1,2,2) plotdata(hl,'HL') %---Local...