sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4eec8771625774a94d4e00b51ca3b5c1b4f704c67984d071c5162eb391ed40ec
MATLAB
2,376
78
function updatePerformance(x) % Used to update horizontal bar chart of task performance % Requires input based on the type of response given % 1. Incorrect response to right % 2. Correct response to right % 3. Abort trial - no peripheral response within response window % 4. Correct response to left % 5. Inco...
d9bdc7dda0170a60116471db1f6803f63243216588ee1e068daecd76c25a4362
MATLAB
2,380
75
function plotsModelfit(res) %function plotsModelfit(res) % plots some standard plots, meant to help you judge whether there are % systematic deviations from the model. % % These are the same plots as presented in psignifit 2 for this purpose. % stimRange = [min(res.data(:,1)),max(res.data(:,1))]; stimRange = [1.1*stim...
dd2475a9c09e45e203a141c96ad7e705134295132a063ba5945bf06fcb16a3e7
MATLAB
2,381
75
% SAVE2PDF Saves a figure as a properly cropped pdf % % save2pdf(pdfFileName,handle,dpi) % % - pdfFileName: Destination to write the pdf to. % - handle: (optional) Handle of the figure to write to a pdf. If % omitted, the current figure is used. Note that handles % are typicall...
bf550cd421d5b16dda8f9e0ade50409fb27558a9ab0df9e49d718dc85ba85b9e
MATLAB
2,383
80
function findRovedPARAMS_SanesLab(TRIALS,remind_row) %findRovedPARAMS_SanesLab(TRIALS,remind_row) % %Custom function for SanesLab epsych % %This function identifies the indices of the roved parameters % %Inputs: % TRIALS: RUNTIME.TRIALS structure % remind_row: row index in TRIALS.trials of the reminder trial % %N...
f6da063d69840984128e76d10e5adea133175923f82630058a9864f9e3400291
MATLAB
2,386
81
function [hubcostf, feedercostf, peripcostf,hubedged] = ... hub_rewiring_cost(mat,distmat,costmat,hubmethod,Nreps,prop_rand) if nargin < 4 hubmethod = 'gollo2018' ; end if nargin < 5 Nreps = 1000 ; end if nargin < 6 prop_rand = [ 0 ((5:5:100) ./ 100) ] ; % proprotion of randomizations end if prop_ra...
baf8c6d526cab26a04580cf86c1ddb172b9e2cd0a5ef9fb6b0c374ce6940b673
MATLAB
2,387
62
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright 2017 Johns Hopkins University (Author: Aswin Shanmugam Subramanian) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function stoi_estoi_sdr(nj,enhancement_method,destination_directory,set) ...
df406116ca1752a8f326186cf5b6ba39abf24b56389baff0f33228a7c648ab1a
MATLAB
2,388
82
function [im,params]= tppreview(dirname, numFrames, firstFrames, channel) % TPPREVIEW - Preview PrairieView image data % % IM = TPPREVIEW(DIRNAME, NUMFRAMES, FIRSTFRAMES,CHANNEL) % % Read a few frames to create a preview image. DIRNAME is the % directory name to be opened, and NUMFRAMES is the number of % fram...
923c424039b3c8b9ec2a1144c1d65fd1a5e4400e0596becd92c879b1e6d435de
MATLAB
2,393
77
function [results] = spkHistPrior3(params, results, spkHistPrior_setup, addDPriorForWB) % i.i.d non-mean Gaussian over spike history coefficients & constant K = size(params.B,1); w_mu_idx = 1; w_sig_idx = 2; H = double(params.H); w_mu = H(w_mu_idx); log_w_sig = H(w_sig_idx); if(K > 0) b_mu_idx = 2 + (1:K); ...
6f1b94ddf3bcc0b0f64ec66a20b1d5c034e4ae5a98f3f67a687673430227a129
MATLAB
2,395
80
function [GMLMstructure, trials] = constructGMLMPopforTests( factor_idx_0, isShared, isSharedEye, dim_A) dim_R_max = 4; if(nargin < 4) dim_A = 2; end [~,~,factor_idx] = unique(factor_idx_0(:)); dim_S = numel(factor_idx); dim_T = randi(20,[dim_S 1]); dim_D = max(factor_idx); dim_F = nan(dim_D,1); for ff = 1:dim_D...
c16a86a760a96f28142e8bd0ee55237c6b3226be43d6a3eedb26a163fbb56550
MATLAB
2,397
70
function [hObject,handles] = select_change_SanesLab(hObject,handles) %[hObject,handles] = select_change_SanesLab(hObject,handles) % %Custom function for SanesLab epsych % %This function updates the dropdown menu color and enables the APPLY button %when the user selects a new dropdown menu option. % %Input: % hObject:...
bb9435bd2d6e1e6ddb3098bb6c81040231e56b5ed6f35c62a7a81807e1062dfe
MATLAB
2,398
58
function [stim_response_doc] = stackresp2ndiresponsedoc(S, tdir, resp_struct, stim_presentation, control_stim_presentation, nde_id, stimulator_id, srp_id) % % STIM_RESP_DOC = STACKRESP2NDIRESPONSEDOC(RESP_STRUCT) % stim_response_doc = []; responses = struct('stimid',[], 'response_real',[], 'response_imaginary',[],......
03e70f64f0500b0dd32df0602b095b1dd4ec888caea5e871399cbd167e2e7d3d
MATLAB
2,401
72
function motif_class = two_neuron_motif_classification_3D(x1, x2, y1, y2, t1, t2); % Two neurons are the same (two distinct neurons involved) % Assume t1 <= t2 vec = [0,t1,t2]; n_distinct_times = length(unique(vec)); if n_distinct_times == 1 % Two neurons are th...
a09b17f9bd57ee675e1d89b28207bea259d2ff6733cc8bc1ba52415f0aeb2b3c
MATLAB
2,404
103
function [Problem] = robust_pca(X, mask, lambda) % This file defines the robust PCA problem. % % Inputs: % X dictionary matrix of size mxn. % mask missing data matrix of size mxn. % lambda l1-regularized parameter. % Output: % Problem problem instance. % % % The prob...
3e965c558c3a88d0c3dd0594c1d1a9369075464817e2061b7822e6f64b61d415
MATLAB
2,405
74
function x=Solve(A,b) % See ichol, pcg and minres: % https://es.mathworks.com/help/matlab/ref/ichol.html % https://es.mathworks.com/help/matlab/ref/minres.html % https://es.mathworks.com/help/matlab/ref/pcg.html % MUMPS, PETSc n=size(A,1); mIter=ceil(size(A,1)/5); Tol=1e-12; fl=0; if n<30000 x=A\b; else...
dd4397514b5861f080b801b211c2fdf3ec1d6d7c85e203119bc3f60dc6065ae9
MATLAB
2,410
48
function p = driftcorrectbycorrelation_defaultp % DRIFTCORRECTBYCORRELATION_DEFAULTP - Return defaults parameters for DRIFTCORRECTBYCORRELATION method % % P = DRIFTCORRECTBYCORRELATION_DEFAULTP(...) % % Returns default parameters for the DRIFTCORRECTIONBYCORRELATION method % % The user can override these values by ...
14e1be0ca27e6ed00647db1d0655c604935e4abeebd7fc0d52a8b1eb0b672136
MATLAB
2,411
57
function pPost = decode_probClass(cfg0, decoder, Y) % pPost = decode_beamformer(cfg, decoder, Y) % Apply probabilistic multiclass decoder, obtained from an appropriate training function. It % returns the posterior probabilities of a the trial belonging to a class, given the data. At % this moment the inclusi...
be1738230df376f97332adb25b2e082a3e2ae7323e2eaa18fdec453d68df5a99
MATLAB
2,411
53
function [YAPS, param_list] = read_meas_prot__struct(varargin) %READ_MEAS_PROT__STRUCT % % [YAPS, param_list] = read_meas_prot__struct(varargin) % jonathan polimeni <jonp@nmr.mgh.harvard.edu>, 2007/nov/18 % $Id: read_meas_prot__struct.m,v 1.1 2008/05/21 19:00:46 greve Exp $ %************************************...
b1605b4240abd668131a72405e7176ee944827c2509798fad66fd8baaa82956e
MATLAB
2,415
75
function sc_stats_for_R % % Function to prepare data for processing in R % % Fran Hancock % July 2021 % fran.hancock@kcl.ac.uk % % PROJECT = '/Users/HDF/Dropbox/Fran/Academics/PhD/matlab/projects/HCPEP_COMPARE/'; Rmax=4; CondMax=3; con_subj=53; pap_subj=30; nap_subj=82; n_subs=con_subj+nap_subj; MODE=4; % Subcortica...
99945065e18e1f741fc4ba28460a9a827f3963815049d812b169f51dbaac5ebb
MATLAB
2,416
54
function [freq, q, qLo, qUp, effRecrMean, effRecrLo, ... effRecrUp, collRecrMean, collRecrLo, collRecrUp] = ... linearFrequency_stim(t, var_in, var_in_min, var_in_max, ... freq_min, freq_max, q_stim, recrNormIa, recrNormIb, recrNormAlpha, ... recrNormII, recrNormTouch, Q) % INPUT: % - t ...
7ebd4f05570990d803e04e41e5979c6a98ebbedf440e1e383bb49319c18bf4b9
MATLAB
2,418
99
function [X,Y,Z,V]=tubeplot(x,y,z,varargin) % TUBEPLOT - plots a tube r along the space curve x,y,z. % % tubeplot(x,y,z) plots the basic tube with radius 1 % tubeplot(x,y,z,r) plots the basic tube with variable radius r (either a vector or a value) % tubeplot(x,y,z,r,v) plots the basic tube with coloring dependent o...
7230bde0eb6f2b3e2d3198e08da450de7691d43317e81c268aa85d4e0cb65c14
MATLAB
2,419
86
function [wfa, wfb] = dib_wf_ste() % function [wfa, wfb] = dib_wf_ste() % % By Filip Szczepankiewicz % % Spherical tensor encoding (STE) % for the "data in brief 2019" project. %% STE wfa = [ 0 0 0 -0.2005 0.9334 0.3029 -0.2050 0.9324 0.3031 -0.2146 0.9302 0.3032 ...
0daed0943de866c0f15bd27a090f83fa5c7e65c46eb9e9a834b3be05b2500f25
MATLAB
2,420
67
function [axonalSelPerFiber, axonalSelPerFasc] = axonal_selectivity(model, options) arguments model (1,1) Model options.GroupByFascicle (1,1) logical = false; options.iAS {mustBeNumeric} = []; options.iElec {mustBeNumeric} = []; options.fiberActiveAll = [] end % 1 x nFasc groupByFascicle ...
be7f678041a53deb692f0684f80be8bd3423984ef1cf99833199481a46442d3c
MATLAB
2,423
56
%% %% %% %% %% %% MASTER SCRIPT FOR RUNNING ALGORITHMS %% %% %% %% %% %% %%% % % % % GLOBAL NONLINEAR APPAOCH FOR MAPPING PARAMETERS OF NEURAL MASS MODELS % % ...
d0244388152f88b5220ab4343cf1c8c5363d49bf87d332386e2f4646207ae0dc
MATLAB
2,424
92
function run_boundariescondition(model, radii) % Main script for the calculation of boundaries condition % % By Andrea Cimolato, Federico Ciotti NeuroEngineering Lab, July 2020 % radii = [20, 30, 60, 120]; %% Run boundary condition simulations solutions = simulation_boundariesCondition(model, radii); % Set ...
4b5780004c09bdb353557fecb880deec17d2e8df547a86a26a4cfee0fa4ecfc8
MATLAB
2,425
75
clc; clear; close all Fig6b=figure(); N_mu=500; %There are \mu independent embedded patterns, 500 simulations (number of simulations) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %R=1 yline(1,'--k','Linewidth',2) hold on %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
193ffea964ea22d1790e304e3ca3022ccebf2df97d9f783589bdcc8c523447e1
MATLAB
2,429
74
function Cov_comp = getCompCov_interactions(X,code,P) %%% A bit different from the classic audio/video component. %%% Would have needed a different architecture to homogeneize. P.focusOn = 'video'; % force it here dataA = getOrgData(X,code,P); if P.zscore sigma = nanstd(dataA,[],[1 2 3...
8c80baa968856af3909893579883387b13cd69e1b4f05998ad7895550ee8b79a
MATLAB
2,429
105
function [Problem] = tv_l1_problem(y, lambda) % This file defines the TV (Total Variation) problem with L1 norm. % % Inputs: % A dictionary matrix of size dxn. % b observation vector of size dx1. % lambda l1-regularized parameter. % Output: % Problem problem instan...
83efb37643817d9ede0c724ffdbf7b2a6f94d7a1e0cd698d7733a69ded04a99b
MATLAB
2,431
86
[d2, d2ir, spectrumri, spectrumii, dataFreq] = readpipe_2Di('../build/kras.ft2'); % do_level; % % figure(1); % contour(d2,level(3:end)); ndx=98; % ndx=136; % ndx=211; signal=d2rr(ndx,:); x = 1:length(signal); [pos_signal, neg_signal, region_mask]=run_flatt(signal,17,5e4); [fitted_trend, cleaned_signal] = run_flatt_...
71eef4fcc040e226fd6ccb287f30cba478c284707a2dc99f159c21be7e5cfd25
MATLAB
2,434
82
function [GMLMstructure, trials] = constructGMLMforTests( factor_idx_0, isShared, isSharedEye, dim_A) dim_R_max = 4; if(nargin < 4) dim_A = 2; end [~,~,factor_idx] = unique(factor_idx_0(:)); dim_S = numel(factor_idx); dim_T = randi(20,[dim_S 1]); dim_D = max(factor_idx); dim_F = nan(dim_D,1); for ff = 1:dim_D ...
aaf14c392d02b499f25ab0c7d96f8bc0bdd02cd65098f5483880e6bbb81deacb
MATLAB
2,434
80
function [gg] = setup_sim(params) % [gg] = setup_sim(params) % Set up coupling matrix and filters according to model parameters wc = params.wc; frame_dur = params.frame_dur; steps_per_frame = params.steps_per_frame; ex_sigma = params.ex_sigma; in_sigma = params.in_sigma; ex_tau...
b082526d8c02746df020e711662e054c9937c28171b426f0791ec18901be0ca4
MATLAB
2,436
96
function dinfo = TDT_GetDeviceInfo(DA,echo) % dinfo = TDT_GetDeviceInfo(DA) % dinfo = TDT_GetDeviceInfo(DA,echo) % % Get Device Names, RCX files, and Sampling rates from OpenEx % % DA is a handle to the OpenDeveloper ActiveX control after a conneciton % has already been established. % % If echo == true (def...
cbd30e00082ab3e2444827b1b2f1ce828a2406fb61b7d2b1f5fef69e5be7d96f
MATLAB
2,436
83
% Script to load neural recording for processing in the toolbox. This % script is customised for use specifically for Rory Townsend, future users % will need to write appropriate methods for their own data format. %% Data file parameters useMouseCortex = false; mouseResize = 0.2; useEvoked = true; if useEvoked fi...
05a7c76ef5e5507619560ccc4106ff4bdf54e43aa004d607b79cc68e8e2dc057
MATLAB
2,438
55
% Demonstrate use of Bits# digital output lines using PTB-3 % whichScreen=max(Screen('Screens')); PsychImaging('PrepareConfiguration'); PsychImaging('AddTask', 'General', 'FloatingPoint32Bit'); PsychImaging('AddTask', 'FinalFormatting', 'DisplayColorCorrection', 'ClampOnly'); PsychImaging('AddTask', 'General', 'Enable...
84be6f2822c9d788f79b645fd9a1454264e8b72562cb5202cc1004f6a3108b62
MATLAB
2,438
73
% PURPOSE: installs a listener that pins ERPLAB's figures to the light theme. % % FORMAT: % % erplab_lighttheme_listener(erplabpath) % % INPUT % % erplabpath - full path to the ERPLAB folder, used to tell ERPLAB's figures % apart from everyone else's % % % ERPLAB creates figures from well over a hundred ...
bb2f8a5bdb6bc0f2dcfab7bc3691410408e181dc92c7c2fb6da44882021c0e3c
MATLAB
2,439
63
function [results_group] = GMLMprior_stim(params, results, groupNum, stimPrior_setup) if(isempty(params)) results_group = 1; return; end params_group = params.Groups(groupNum); results_group = results.Groups(groupNum); %modified from computeGLMPrior %% i.i.d. unit normal prior on loading matrix (no hyperparam...
632e720a02724878822b38a16cb9bf39a1400d72a1457d65fa832913a1b2d322
MATLAB
2,440
66
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% COX-STUART TEST %%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function[H,p_value]=Cox_Stuart(V,alpha) %%%%%%%%%%%%%%%%% %%% Performs Cox-Stuart test of the null hypothesis of trend %%% absence in the vector V, against the alternative of trend. ...
de64789c8ed0180dcaac29ea6886949dc92d02609aeb9847c8f299719e9b8905
MATLAB
2,442
81
function [ims,channels] = tppreview_maxprojection(dirnames, tpparams, channellist, parameters, shortname, dirname) channels = []; fnameparameters = {}; % lets find parameter files, get the file name prefix pattern for j=1:length(channellist), good = 0; try, myfnameparameters=tpfnameparams(dirnames{1},channellist...
12c61cf8c2c792b6d8c6524bbb2957fd2d527a7b7c8f571d799470f020aa0c76
MATLAB
2,443
54
function [theta, xfield, yfield] = determine_theta(phase, kernel_sigma) % This function determines the direction angles THETA of gradients determined % from a phase map. It takes care of the circular nature of phases and % allows for a spatial smoothing before determining the gradients using a % Gaussian 3x3 kernel...
48e50ccc357c03bbd5f263b38a8727b30a9bb9bea3a31fc316cb3c16991e5b3e
MATLAB
2,443
50
function t1_setup addpath('../code'); % Here we go over how to set up the Palamedes structure and also highlight % the parameters that control the adaptive procedure's behavior during your experiment. %%%%%%%%%%%%%%%%%%%% %%%%%% SETUP %%%%%% %%%%%%%%%%%%%%%%%%%% % 1. Create the 'params' structure. If a paramete...
91d2bd38def63e1bb4f0f68441ea787dc900adfe4b907ddb2ef802dc8517caa9
MATLAB
2,445
66
function [tdTom_pos_centroids,tdTom_neg_centroids]=find_tdTomcells(tdTom_image,fura_image,pixel_size_per_cell) % [tdTom_pos_centroids,tdTom_neg_centroids]=find_tdTomcells(tdTom_image,fura_image,pixel_size_per_cell) % calculates centroids for tdTomato positive cells % Input % tdTom_image % fura_image % pixel...
48fb919120d4102d922497048069c6720992bf6ef2463eea404f5090469954ed
MATLAB
2,446
64
% This function aggregate all the data from various participants and trials with an specific surface-foot % combination to a single file. % This function gets 3 inputs including Data cell array, SF array which % indicates Surface-Foot combination for each cell in the "DataL" cell array, % and an specific surface-fo...
bdd3c7db6ea9bea7e976f0b3364bf0608f0cf8414493235a8f7318701de24423
MATLAB
2,447
97
function [BEST, serror, filenamex] = saveBEST(BEST,filenamex,modegui,warnop) serror = 0; if nargin < 1 help saveBEST return end if nargin<4 warnop = 0 ; % no warning for overwriting a file end if nargin<3 modegui = 0; % no uiputfile end % Save MVPA file (save as) BESTaux = BEST; name...
2948b6a4805d8351e9d6fe875cd04e5abb59754703b278afe41608ad4a6928e1
MATLAB
2,448
79
function [ims,channels] = tppreview_frameaverage(dirnames, tpparams, channellist, parameters, shortname, dirname) channels = []; fnameparameters = {}; % lets find parameter files, get the file name prefix pattern for j=1:length(channellist), good = 0; try, myfnameparameters=tpfnameparams(dirnames{1},channellist(...
e2b163843f42f08d81551ad0d822894762afd55a64f4214888c6211675abea90
MATLAB
2,448
93
function biasAna(data1,data2,options) % function biasAna(data1,data2,options) % runs a short analysis to see whether two 2AFC datasets have a bias and % whether it can be explained with a "finger bias"-> a bias in guessing options.priors = cell(5,1); options.borders = nan(5,2); options.expType = 'YesNo'; options.pri...
888f065d240b60d4ad6e89473c9f89dcf3b243fce15094429dc74e77c5e6e111
MATLAB
2,453
88
function [params_group, precomputedPortion] = scaleParams(params_group, prior_setup) H = double(params_group.H(:)); D = numel(params_group.T) + 1; % order R = size(params_group.V,2); % rank if(prior_setup.include_rank_constant) nd = sum([prior_setup.T(:).on]) + prior_setup.V.on; rank_scale = -log(R)/nd; % ...
506effa472c8bb11a458421aa5f69fbdb70cd6531e36173ae1041359512e905a
MATLAB
2,455
90
load(['../data/behaviorData.mat']); for n = 1:14 n tDur = [1:1200]; valid_u = cat(3, Sub(n).dir(1).valid.hPos100, Sub(n).dir(1).valid.vPos100); valid_d = cat(3, Sub(n).dir(2).valid.hPos100, Sub(n).dir(2).valid.vPos100); l1 = size(valid_u,1); l2 = size(valid_d,1); minL = min([l1 l...
a86951365f58c916ca8e8a1ea1f967a76d08b7196905f6dd9a680cd7834634bb
MATLAB
2,455
72
% PURPOSE: erases ERPLAB's memory (values are those last used. Default ones are reloaded) % % FORMAT % % erplabamnesia(warningop) % % INPUT: % % warningop - display warning message. 1 yes; 0 no % % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon & Johanna Kreither % Center for ...
e850f88a166d4a470501ae0e24410b4eee6658c2f4a423109248ce73688b598f
MATLAB
2,455
90
load(['../data/behaviorData.mat']); for n = 1:14 n tDur = [1:1200]; valid_u = cat(3, Sub(n).dir(1).valid.hVel100, Sub(n).dir(1).valid.vVel100); valid_d = cat(3, Sub(n).dir(2).valid.hVel100, Sub(n).dir(2).valid.vVel100); l1 = size(valid_u,1); l2 = size(valid_d,1); minL = min([l1 l...
2b7400538c2d506aa7140319ee7e5ac59b988f65ca93d037074cdc678a08bc03
MATLAB
2,458
76
% DEPRECATED... % % % Modify EVENTLIST only % % 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 Californ...
9b79168f5200646c44632f815008e20e962b028ff50234860debfe5cc91dd296
MATLAB
2,460
66
function rgb = vals2colormap(vals, colormap, crange) %% This function has been adopted and edited from a Github repository. The original function is freely avalibale at the following: "https://github.com/vistalab/vistateach". % Take in a vector of N values and return and return a Nx3 matrix of RGB % values a...
08929425bb455038c2d9b7d3309517b88fda01d463db15cb020c0d625608a460
MATLAB
2,462
104
% fresh start clearvars close all %% run config config_file='config_mammals_1.m'; addpath(strcat(pwd,'/config')) run(config_file); %% inital read % opts = detectImportOptions('./data/raw/MamiNum.xlsx'); orig_xls = readtable('./data/raw/MamiNum.xlsx') ; animal_names = orig_xls.AnimalName ; % cleanup animal_names ...
7dffea6e1073b03e00ffab311c24e9fc487891e70ff7b25ea4d3c1b0e3853590
MATLAB
2,462
94
function valve(bit, time_on, pulseN, var) % % This script allows you to control the solenoids for any length of time % and number of pulses. It's designed with the ACME 2000 in mind, but may % be suitable for expansion in the future. % % bit - bit number for required solenoid (e.g. left = 4; right = i; cente...
6f28c2001e27e0a53e2e69b90ed91e2d9de8c849ed1a9dd5f2c6c1da77e7d11a
MATLAB
2,466
63
function [nrg,images,transform,masked_transform,filtered] = video_spatialEnergy(videofile,radius) % Function calculated the Fourier transform for each frame of the video and a % mask is used to filter unwanted frequecies. Spatial energy is then calculated as the mean of the % Fourier filtered images. % % INPUT % ...
7badfb4f07f9f46feb3255fcfa35b2e1b69e25d1cda526d549fa0361e29ab9f4
MATLAB
2,466
105
function [Problem] = lasso_problem(A, b, lambda) % This file defines the lasso (least absolute shrinkage and selection operator) problem for L1 norm. % % Inputs: % A dictionary matrix of size dxn. % b observation vector of size dx1. % lambda l1-regularized parameter. % Outpu...
a4c3d4a62a37ee3b6075cea32e4d9940c4f2d952361fd64bd3a18d68bf8d64c3
MATLAB
2,468
102
function TwoPhoton_Photodiode_SGS(dirname, sitename, photooff) % recently measured offset between rise time of photodiode potential and spike detection on spike2: -2e-4 % that is, spike detection proceeds photodiode potential rise photodiodeoffset = -2e-4; tp_offset = 3.488-3.333; [path,thedirname] = fileparts(...
d6847e9eef278e33eca5c96d4c00d8d996807c1ff2a4bf4c45145d3018514c01
MATLAB
2,468
109
function [N_points,v,N_faces,f,c,c2,Tpsi,DTpsi,LabVent]=read_vtk(name2) %Read vtk mesh with fibers (labels in points) %N_points:number of vertex %v: vertex coordinates %N_faces: number of elements %f: elements %c: cell types % %name2='Fibers_0_0_20_kira32.vtk'; fileID = fopen(name2,'r'); %Read number...
bcb0422b4006976d21e33934215b5f687b52f4962f694c159c8914cf36165324
MATLAB
2,471
96
function plot_spike_raster(S,P,param,cfg) % plot_spike_raster(S,P,param,cfg) % % For use with DB_QuickPlot % % DJS 2013 nrows = cfg.nrows; ncols = cfg.ncols; win = [cfg.win_on cfg.win_off] / 1000; % ms -> s % Organize by stimulus onsets ons = P.VALS.onset; TS = cell(size(ons)); for i = 1:length(on...
8ca69db609fb727f5196de5a3ac3941e5d598a9260cf0c94138b7bc58c5ecd54
MATLAB
2,477
76
%% Check single cell responses for k = 1:P.nMice P.focusOn = 'video'; % so that order is unchanged dataA = getOrgData(db(k).spikeData,db(k).audiovisuoCode,P); % will recenter the data by removing the common response %%% note that this is not specific to each unimportant stim dataA = dataA - nanme...
aef3f3c314f2d7cca20f971b695fa1cd3df75add8b08f96c671a21173d096ff6
MATLAB
2,479
79
p=3; trial=9 fmin=0.5; fmax=12; % cd( '\\158.182.15.58\test2\Junhao'); % % File name fileName = ['result_of_p' num2str(p) '_trial' num2str(trial)]; load(fileName); mask=ones(50,50); ratioSequence=VolE(1:50,1:50,:); T=1:size(ratioSequence,3); for surroN=3:4 %% Phase randomized surrogate %% fft %fft ...
71bf537e419a61e388525516171ff38c85823c6720edd06639c818fe8bcabdbf
MATLAB
2,480
93
function G = model_parameters(Li, Lm, Le, w_K_channel, w_Na_channel, Ly, ... Lz, dx_min, dy_min, dz_min, Tstop, dt) %G = model_parameters(Li, Lm, Le, w_K_channel, w_Na_channel Ly, Lz, ... % dx_min, dy_min, dz_min, Tstop, dt) G.Li = Li; G.Lm = Lm; G.Le = Le; G.Lx = 2*Li+2*Lm+Le; G.w_K_channel = w_K_channel; G.w_Na_chan...
7589a5b8d6456daec15d3962acc27e73ea8c70602d0a64211b5ad79d2e532a52
MATLAB
2,491
103
function [Problem] = elastic_net(A, b, lambda1, lambda2) % This file defines the Elastic Net problem. % % Inputs: % A dictionary matrix of size dxn. % b observation vector of size dx1. % lambda1 l1-regularized parameter. % lambda2 l2-regularized parameter. % Output...
227580686f39049b3824e86889813a5bc06134ba1c788a7915dd872f5da22fe5
MATLAB
2,496
87
% PURPOSE: sets ERPLAB's GUIs' font % % FORMAT: % % handles = setfonterplab(handles, fontsize, fontunits); % % INPUT % % handles - GUI's handles stucture % fontsize - font size % fontunits - font units ('pixels', 'points') % % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon...
5f40083c56c4295cfae3cee9f9c18ca05dafb02ef43f4a313b62c5cc7749cdf3
MATLAB
2,497
73
function [dist, nbFibersMm] = diam_distr(age, nerve, dmin, dmax, plotdata) % DIAM_DISTR Computes fiber diameter distribution pdf with exeperimental % data. Data gives diameter distribution in a mm square fascicle surface of % a sciatic nerve. % % [dist, nbFibersMm, dmin, dmax] = diam_distr(dirdist, age, nerve,plot...
ee4a77b256cd7f48548a76163f15d700abd99bf8d95585f3e8b2bbff28397773
MATLAB
2,497
97
function obj = Empty( varargin ) %uix.Empty Create an empty space % % obj = uix.Empty() creates an empty space that can be used to add gaps % between elements in layouts. % % obj = uix.Empty(param,value,...) also sets one or more property % values. % % See the <a href="matlab:doc uix.Empty">document...
75914d748e5c0642ce222bf0696df09ec5ee0e023160f50f7070a629f1270249
MATLAB
2,500
93
function [] = test_trace_norm_mc() clc; clear; close all; rng('default'); %% Set algorithms if 0 algorithms = gd_solver_list('ALL'); else %algorithms = {'PG-BKT', 'PG-TFOCS-BKT', 'APG-BKT', 'APG-TFOCS-BKT', 'L-BFGS-BKT'}; algorithms = {'APG-BK...
860686a0bca2f1e2dfe86162c7c7855034a0b1d08e2eea8a99ac6f0e201668e8
MATLAB
2,503
116
function ConvertTimestampToFrame(tsPath, vidPath, outPath) %CONVERTTIIMESTAMPTOFRAME Convert time-stamped annotaations to frame index if iscell(tsPath) for i = 1:length(tsPath) ConvertSingleSheet(tsPath{i}, vidPath{i}, outPath) end else ConvertSingleSheet(tsPath, vidPath, outPath) end end functi...
c86ddbe0f14bd226b97d9beeb327e555564de1f7e6820c37bc592351fd5d5c3f
MATLAB
2,503
85
% Write data quality summary to Matlab Command Window % axs April 2022, ERPLAB function ERP_summary = f_dq_summary(ERP,dq_subfield_name) % Check and populate missing args if exist('ERP','var') == 0 || isempty(ERP) ERP = evalin('base','ERP'); end if exist('dq_subfield_name','var') == 0 || isempty(dq_subfield_nam...
f0e3201af26a4bc178af8706ad7e18f858d1747408cfc23594fe7193fb7a301c
MATLAB
2,504
66
function [TmtxS,FSCs,EvtLs,EvtTs]=SelTrialsFSCs(fn,twin,trials) % Select Assemblies from PFC/HC/Joint PFC~HP data sets & cut out event periods (trial case) % % Aleksander PF Domanski PhD UoB 2015 % aleks.domanski@bristol.ac.uk % % Cuts up time series into equal length epochs for use in downstream bootstrapping ...
cbfd10f7bb7f56022d9d9077f0b162d31574ad6b088cfc8998f700287fa50d18
MATLAB
2,505
85
function P = DB_GetUnitProps2(unit_id,group_id,regexp,conn) % P = DB_GetUnitProps2(unit_id) % P = DB_GetUnitProps2(unit_id,group_id) % P = DB_GetUnitProps2(unit_id,group_id,regexp) % P = DB_GetUnitProps2(unit_id,...,conn) % % Retrieve and sort unit properties. % % This function is updated and provides a bette...
2bd1a4c93df0b1b0355c02bb267bc18eeb41496f5704ce0bafa680f6e2091b4e
MATLAB
2,506
89
function [] = plotGLMFit(paramStruct, R_sample_stim, R_sample_stim_dirOnly, bases, TaskInfo, figNum, titleStr) % all filter coefficients are in paramStruct.W - this takes them out in the correct order if(nargin < 7 || isempty(titleStr)) titleStr = ''; else titleStr = sprintf('%s\n', titleStr); end %% get stim...
b9cabe7b1c1595bcc2d38b4d3bd14401b0b98f3d53a6185ccab4b66654276748
MATLAB
2,506
60
%% automaticPhaseCorrection_voigt.m % % part of https://github.com/LudgerS/MRSartifactRemoval % % Fits complex Voigt peaks to the spectrum starting from multiple different % phase values. The best fitting peak's phase is used to correct the data. % % All input variables should use the same units: % specAxi...
582a80702be6f11ba59d919044c2f6ad7c7a59d7145a3b9fa068681dab720089
MATLAB
2,508
62
function [r,r_shuff] = getEigenSpectra(db,P,compDimP) focusOnList = compDimP.focusOnList; doitOn = compDimP.doitOn; pcL = compDimP.pcL; shuff = compDimP.shuff; r.Cov_comp = nan(numel(pcL),2,P.nMice,numel(focusOnList)); r_shuff.Cov_comp = nan(numel(pcL),2,P.nMice,numel(focusOnList),shuf...
de75b8ae2cdcf1a708371324198b2510c30d138d8b6e74754ab186c88115a81a
MATLAB
2,509
96
function CircleCapture( hFig, hAxes ) %CircleCapture: Spin the target in a circle taking pictures FrameNumber = 0; tilt = 0; angle = 0; step = 1; %Figure out where the camera should be when circling the target view(0,0); drawnow XYva = camva; view(0,90); drawnow...
37a2d6b690f91d7845a4319a51643a29f833539eadc4fe03881aea1dd872f91b
MATLAB
2,510
115
function [names,onsets,durations] = mrk_maker(data, subjID, chID, chEV, fs) % Force bit channel to be binary dataAux = zeros(size(data)); for i = [chID chEV] zmark = zscore(data(i,:)); zmark(zmark<=0) = 0; zmark(zmark>0) = 1; dataAux(i,:) = zmark; end % Subject of interest's mask subjmas...
46911e07a10938a4c737813fcf8eb80dcb1629f054a8926025e0861e932a3e98
MATLAB
2,510
73
% Sample object to test data persistence functions and user controls. % Copyright 2008-2009 Levente Hunyadi classdef SampleObject properties % A scalar of the standard MatLab type. RealDoubleScalar = pi; % A matrix of the standard MatLab type. RealDoubleMatrix = [1.5,2.5;3.5...
3519b4fef9c35b45f0568ffd8acd9c0e9e6470649fd03975d036bc0cc2b55ddd
MATLAB
2,513
68
function theta = getStandardParameters(theta,type,widthalpha) % this function transforms a parameter given in threshold, width to a % standard parameterization for comparison purposes %function theta = getStandardParameters(theta,type,[widthalpha]) % theta = parameter % type = Name of the Sigmoid % % if you changed th...
6d059e852e944733810c5d3693a47ba89e53ca2fd35821a7f6cfb47ddf423ded
MATLAB
2,513
97
ssstrialList=vertcat([1,2,4], [1,2,2], [1,3,4], [1,3,3],... [2,1,3], [2,1,1], [2,4,3], [2,4,4],... [3,1,2], [3,1,1], [3,4,2], [3,4,4],... [4,3,1], [4,3,3], [4,2,1],[4,2,2]); trialList = trialList(1:4,:); numReps = 10; %number of times to repeat each trial type results = repmat(horzcat(trialList, zeros(size...
78c984343864709911ef1bfc3d516b44e3024eecee2009b8c1342bbaa4f529cf
MATLAB
2,516
80
function P = DB_GetUnitProps(unit_id,group_id) % P = DB_GetUnitProps(unit_id) % P = DB_GetUnitProps(unit_id,group_id) % % Retrieve and sort unit properties. % % group_id should be a string and is used in the database query to narrow % what is returned from the database. The actual search query uses 'REGEXP' %...
a9369b8ed04dedb040389ca8f94b6cd1179661372fe6a9e692fde2b1e02573f5
MATLAB
2,519
71
%% define local paths % raw and preprocessed data -- direct to directory containing data from OSF dat_path = 'D:\SWS_NVS\data\'; if ~exist(dat_path, 'dir') dat_path = '/Users/thandrillon/Data/SWS/'; if ~exist(dat_path, 'dir') warning('Unable to locate Data directory... need to update path in `def_local...
d45edee1c5a06d519d47f0108fd28e3102712a14727d82a4f6bdb2c51f995216
MATLAB
2,519
129
% fresh start clearvars close all %% run config config_file='config_mammals_1.m'; addpath(strcat(pwd,'/config')) run(config_file); %% read in proc spreadsheet filename = [ DD_PROC '/MamiNum_corrected_proc.txt' ] ; ssheet = readtable(filename,'Delimiter','\t') ; data_dir = [ DD_RAW '/xkperm/' ] ; %% n_animal = si...
a9abc1af309ad4c41624e07c07bb5644222942779ef64a9d35172e23b4c3a5ad
MATLAB
2,525
91
function data = ft_read_spikes_tdt(cfg) % data = ft_read_spikes_tdt(cfg) % % Read continuous (LFP) data from TDT Tank and convert for use with % FieldTrip toolbox % % cfg.tank ... Full path to tank and tank name is required if tank is % not registered. If tank is registered, then just the % ...
59ecdb5af36e0c7a991122907543ed98c06c99eaaadc9fa8b23d4c35e8c0966d
MATLAB
2,528
70
function templates = makeDecodingTemplates(tb,times,bw,sigma,shoulder,plotYN) if nargin<5 sigma = 4; % kernel standard deviation (s) shoulder = 2; % Time ranges to draw kernel over (sigmas) plotYN = false; end vector = zeros(length(times),length(tb)); templates.kernel = cell(length(t...
0faab17754a6d53cf74fe7cda1ccc082dc0e0f439cc8d4d2a0df2a617e187488
MATLAB
2,533
70
% eegplugin_visualareatemplate() - EEGLAB plugin for fitting data using % visual area templates % % Usage: % >> eegplugin_visualareatemplate(fig, trystrs, catchstrs); % % Inputs: % fig - [integer] EEGLAB figure % trystrs - [struct] "try" strings for menu callbacks. % ...
9217be7debf464877d7c00a4506cdd0d93922459ecc48257d6f6aa9a747a97de
MATLAB
2,534
80
clear Targets = {'SHORT','MEDIUM','LONG'}; Delays_ = {'Short','Medium','Long'}; bw=0.05; warning ('off') pat = 'C:\Analysis\AssemblyAnalysis\raw'; cd(pat) fileList=dir('allTimestamps\*.mat'); Areas = {'HP','PFC'}; %%%%% iFile =1%:length(fileList) iArea =1% 1:length(Areas) %%%%% %% Load an exam...
87813b805c26e2e0ba07d3004ac2bca738e0266deda4db4a244b11866e703d94
MATLAB
2,536
73
%% setupHMCparams returns default setup for HMC % inputs (optional): % nWarmup (default = 25000) : number of warmup samples (to be discarded later) % nSamples (default = 50000) : number of samples to take post warmup % debugSettings (default = false) : if true, changes settings for a debug run (fe...
e6d2b50a82fb6ec56d650f678120bb2c833cffe6a978960972e29d0fc43af689
MATLAB
2,539
88
clc; clear; close all Fig7b=figure(); N_mu=500; %There are \mu independent embedded patterns, 500 simulations (number of simulations) Ntrials=5000; %number of learning cycles %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %R=1 yline(1,'--','LineWidth',2,'HandleVisibility','off'); ho...
1a1693b0074e1958324e0eeb4fa07ced53157141e11e1fa71d642db9e99fd1bc
MATLAB
2,540
69
%% Setup util.clearAll; outdir = fullfile(util.get_paths().figs,'chord_modularity'); util.mkdir(outdir) region_names = util.str.chord_ROIs().modules_tbl; colors = util.plot.colors_modules(); %% Setup graph % Read beta values and calculate their correlation beta_tables_taste = util.load.all_taste_betas(); % Work wit the...
6ae0f423aec697506fed1d05fcec5f98062f2af0cc2adae0464e404bf0dc5b18
MATLAB
2,540
76
function [] = cosmeticsSave(fh,ax,x_width,y_width,outputFolderLocal,fileName,... xtickMinor,ytickMinor,removeDashedLinesForBoxplot) % cosmeticsSave prepares and saves the figure panel. This is done by % setting figure and axes properties % INPUT: fh: The figure handle object % ax: axes handle object % ...
3342e25d6c760e772b7c7945e47d3aa334ad21672e02478bbcf7fd32c4245ff7
MATLAB
2,548
74
function im = previewprairieview(dirname, numFrames, firstFrames, channel) % PREVIEWPRAIRIEVIEW - Preview PrairieView image data % % IM = PREVIEWPRAIRIEVIEW(DIRNAME, NUMFRAMES, FIRSTFRAMES,CHANNEL) % % Read a few frames to create a preview image. DIRNAME is the % directory name to be opened, and NUMFRAMES is th...
6ab57113ee8d80d71f6593c40e6c4bb593ed6e0897dc8a322034ee6e94dbcdb9
MATLAB
2,549
88
function compare_extruded_all_AS() modelExtr = select_and_load_model(); modelBranch = select_and_load_model(); nAsPerLayer = 5; nLayerUpDown = 3; nAS = (nLayerUpDown*2+1)*nAsPerLayer; %nAS = 25; % manual to select only the first % 4 for subj1 branch 1-35 % [5, 6] for subj1 extr 1-35 % 8 for subj1 branch...
8cf5a50fad8f52e831b9ead572d1a87d6e2f16443d14fdf4079ac2c24eb68cfa
MATLAB
2,550
71
function params=tpreadconfig( tpdirname ) %TPREADCONFIG read twophoton experiment config file - Inscopix % % % 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_per...
5b7729c836f9d87a42e14e5c97eed08a1336e5d24f0e94c9c7927aba627783cc
MATLAB
2,551
76
function [tok] = tokenize(str, sep, rep) % TOKENIZE cuts a string into pieces, returning the pieces in a cell array % % Use as % t = tokenize(str) % t = tokenize(str, sep) % t = tokenize(str, sep, rep) % where % str = the string that you want to cut into pieces % sep = the separator at which to cut...
49ae0679559cd976cbf80734e62c6bf775d5287e603d23020775d0c1ab49c3db
MATLAB
2,553
86
function [EEG,m_neigbr_r,chandist,y,chan_win_sd]=chan_neighbour_r(EEG,nneigbr,method,varargin) g=struct(varargin{:}); try g.chan_inds; catch, g.chan_inds=1:EEG.nbchan; end; try g.epoch_inds; catch, g.epoch_inds=1:EEG.pnts; end; try g.plot_figs; catch, g.plot_figs='off'; end; tmp.chanlocs = EEG.chanlocs(g.cha...
d7abc142e55c7489ad41d8f25ceaa1db4fc37d98916cd32799536eee65dd1194
MATLAB
2,554
74
function img = flowToColor(flow, varargin) % flowToColor(flow, maxFlow) flowToColor color codes flow field, normalize % based on specified value, % % flowToColor(flow) flowToColor color codes flow field, normalize % based on maximum flow present otherwise % According to the c++ source code of Daniel Scharstein...
d7487f6c60764b3ab074f2bac40b27ccae5c2aee37575b5b4d0e26134ab2e7b1
MATLAB
2,556
56
% Quality control Q2 % Plot the segmented images in MNI space and plot the MNI template as a % reference % Xin Di, July 13, 2022 clear subjfolder = dir('F:\fMRI_QC\fmri-open-qc-rest_bias_corrected\sub*'); for subji = 1:length(subjfolder) imgs = char(['F:\fMRI_QC\fmri-open-qc-rest_bias_corrected\' subjfolder(subj...
fcf5ebb814bc7717e38ff01325602ababf867b53bebbed475380422901aee2c3
MATLAB
2,559
64
function [freq, q, qLo, qUp, effRecrMean, effRecrLo, ... effRecrUp, collRecrMean, collRecrLo, collRecrUp] = ... sinusoidalPW_stim(t, var_in, var_in_min, var_in_max, pw_min, ... pw_max, q_max, freq_stim, recrNormIa, recrNormIb, recrNormAlpha, ... recrNormII, recrNormTouch, Q) % INPUT: % -...
88b4377807633e78b6b104e336591cfca4eac82aef8c4dd868cdd66ed75b64f9
MATLAB
2,560
86
function Eigenvalues % Script recreates figure 8 from the manuscript. This compares the % distribution of mean real part of the dominant eigenvalue for each subject % across algoritms. sims = 100; subjects = 20; FS1 = 7; % fontsize % load eigenvalue results load('Eigenvalues_domiant_real_part.mat') moea20 ...
94225f51f18a0765e3f89cd8134b5fba5c194a06f02c50aeb6d612cefc20a2cc
MATLAB
2,560
70
% Collect interim single cell data from KDE convert code into HP and PFC archives % % Aleksander PF Domanski PhD UoB 2015 % aleks.domanski@bristol.ac.uk % % You need to run this after big batch jobs on Blue Crystal to gather all % individually saved single unit files into one population .MAT file. %% Collate HP cells ...
8c39626d13339c387677071e03e8eddc1ad0529a9bbfb9e886d118634d051bf9
MATLAB
2,574
94
% Find mainmovement2 - find when they are actively controlling the force % sensors function [starttime,endtime] = findmainmovement2(subject,trial,toplot,dataType,filtered,forcerate) if nargin<3 || isempty(toplot) toplot = 0; end if nargin<5 || isempty(filtered) if dataType==0 global filtered forcerate...
58c07d7c47d6249fd9140aedc98ceab22e54048d89e563c5195b939faad1956c
MATLAB
2,575
124
function varargout = PlotDensity(raster,values,varargin) % PlotDensity(raster,values) % PlotDensity(raster,values,'Parameter',value) % D = PlotDensity(raster,values,...) % [D,h] = PlotDensity(raster,values,...) % % Takes raster input (see PlotRaster) and creates a surface plot of a % 2D histogram from the data. % % ...