sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f6da75de171d42fd0dbbb5456aa6a33f3034d06e1cdc50e42d7d85e8966a188f
MATLAB
4,399
140
function M = tpmovie(dirname, channel, trials, thestims, sorted, diffnc, fps, filename) % TPMOVIE - Movie of Prairieview two-photon data % % MOVIE=TPMOVIE(DIRNAME, CHANNEL, TRIALS, STIMS, SORT, DIFF, FPS, FILENAME) % % Computes a movie for two-photon data that is linked to the % stimulus presentation. DIRNAME i...
5c3775e5eeb09b0cf491ea520d1369c4ec6345b4384c66e46f3a53449ae3ac32
MATLAB
4,400
135
function results = staircase_TCS2(NI_session, pulse_dur, temp_base, ... active_zones, record_RT, fn_thresh) % Staircase procedure to find the Adelta threshold with the TCS2 (NI). % % The subject has to use the response button to indicate the detection of a % stimulus. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% us...
74238b017a7fdcb85645890a8d473a9c3ccbdeab67a518bbd0707d23e2f4683f
MATLAB
4,401
151
function [varargout] = rdir(rootdir,varargin) % Lists the files in a directory and its sub directories. % % function [D] = rdir(ROOT,TEST) % % Recursive directory listing. % % ROOT is the directory starting point and includes the % wildcard specification. % The function returns a structure D similar to the one % re...
dfcce0464fcf8391910a1b518d4bea36d405fe7589fcfafd5415d3d3a6c71643
MATLAB
4,404
153
function subPlot_Gen_2016(x,y) %Creates a 4x4 grid of subplots and graphs each angle separately, followed %by graphing all of them on a single subplot. x2 = x((x(:,2)==1),:); figure('Name','Trial-By-Trial Accuracy') colorArray = jet(13); for i = 1:length(y) if y(i,5) x3 = x2((x2(:,1)==i),:); swit...
12bc5bd9ffd10748468ae8f9dc558fc7669b1cbe80284736b35ea9ce96e39b8b
MATLAB
4,405
101
% % Extract and reconstruct part of a 3D object to make up the new object % % [vertexMatrix, facesMatrix, vertexConversion] = extract3DByFaces(inputGifti, extractFaceIndices) % [vertexMatrix, facesMatrix, vertexConversion] = extract3DByFaces(vertices, faces, extractFaceIndices) % % inputGifti =...
f73295d86f134963718ae6183e35eb3b643439f580685c3c2c0a435f6d3d7e0d
MATLAB
4,405
114
function [resultsStruct] = GLMprior_allFilters(paramStruct, resultsStruct, stimPrior_setup, levPrior_setup, spkHistPrior_setup) %this prior is setup assuming I pieces together the GLM design matrix in a particular way - the only real flexibility is that I can include spk hist or not %% pulls out hyperparameters H = do...
8e87ba2cb1d4e92b5c8f6c7c5a4a2f9c0b30231de040cd9b06e8b91a82587e3a
MATLAB
4,413
145
tb = -5:0.05:21; times_ = num2cell(0:0.5:16); bw = 0.05; % sigma = 5; % kernel standard deviation (s) - single value sigma = max([1:0.05:3.2;fliplr(1:0.05:3.2)],[],1);% kernel standard deviation (s) - sweep shoulder = 2; % Time ranges to draw kernel over (sigmas) plotYN = true; templates = makeDecodingTemp...
069dd6d945c313c24637401526f0b99da5e2400ce1add94ed814270763513211
MATLAB
4,414
107
%==================== ModelFitHistogram.m ==================== % Calculating model preference for retinal angle compared to size % and plots model preference histogram featured in Figure 3 %========================================================================== clear all close all %================= SET PATH...
7c24310a93625d57adde93cae4871a1ec44cdb2d0184e3e4b4b6918ea303c176
MATLAB
4,415
122
function [nassem,FL,FSC,LL,AIC,BIC,Pr,Chi2,prBS,LLbs,Chi2bs,psix,FLbs,FSCbs,psixBS,perm]=FAassem_(SCM,kmax,Nbs,alpha) % Factor analysis assembly detection algorithm % % Original 2014 Daniel Durstewitz, Bernstein Center for Computational Neuroscience, CIMH/ Heidelberg University % Updates by Aleksander PF Domanski PhD U...
26cf54b9b72d214185452096c96a03af6075a799dc65b8ef51c30b4675fd74b3
MATLAB
4,417
129
%% clear all close all run(['..' filesep 'def_local']) addpath(path_fieldtrip) ft_defaults if ~exist(preproc_path, 'dir') mkdir(preproc_path) end %% manualRej = 0; % set flag to 1 in order to perform manual artefact rejection if manualRej ~=1 fprintf('Manual artifact rejection switched off, loading bad...
cf01b2ac0f73156ecea6341ade24c2a6be4201b5a8745515037ff5edf03778cc
MATLAB
4,421
187
% 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') ; %% load centoid data from previosly % filename = [ D...
af1e50d5ffa17c38653b7f186a044efdc4181d5d2350596dd2eb54b058b4a207
MATLAB
4,422
170
% Figure 5_a % Code to generate spiking example traces from V1 and V6 data %% laod raw data addpath data load('Fig5_a_data.mat') % start end end time when data was recorded sessionStartT = 298; sessionEndT = 939; %% define which channels to plot % for V1 plot chp_V1 = [14:25]; % plot these channels from the sha...
79ae326726a33f863449c56d9e0cb40f73eeb21a8a94c3897835c8efa59c5765
MATLAB
4,424
163
function [w, infos] = admm_robust_pca(problem, options) % The alternating direction method of multipliers (ADMM) algorithm for robust PCA problem. % % Inputs: % problem function (cost) % options options % Output: % w solution of w % infos information % % This file is part...
80806b2a15298ce5fc842b4a247dfcbda9b3ac94fa6eeda2de9026b1e8027c5e
MATLAB
4,426
145
% PURPOSE: loads channel location information into an erpset % % FORMAT: % % ERP = erpchanedit(ERP, filename); % % % See also borrowchanloc.m % % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon && Johanna Kreither % Center for Mind and Brain % University of California, Davis, % Davis, ...
5afc5b03a0fc638b53b75313830a8b45fb519eb42eeead88ff33a7e0af154f68
MATLAB
4,427
132
% PURPOSE: converts miliseconds into samples % % FORMAT: % % [p1 p2 checkw xlimc] = window2sample(ERPLAB, testwindow, fs, criteria) % % INPUT: % % ERPLAB - ERP or EEG structure % testwindow - window in miliseconds. e.g [-200 150] % fs - sample rate % criteria - 'rigid' (pre...
9a435582a54b4c270b9f67cc8e87e91aff59c273fc131ae006b86e68eed3c96f
MATLAB
4,431
146
function [Theta0,Re0] = lme_mass_fit_EMinit(X,Zcols,Y,ni,maskvtx,nit,prs) % [Theta0,Re0] = lme_mass_fit_EMinit(X,Zcols,Y,ni,maskvtx,nit,prs) % % Starting values at each location for the linear mixed-effects iterative % estimation. These starting values are based on the ordinary least squares % estimators plus some fa...
5a428e5855faf3e288f369d3645b745863f233fde22c7bf851832031ac094e0d
MATLAB
4,432
118
function b=addtotpdatabase(ds,nameref,listofcells,listofcellnames,varargin) % ADDTOTPDATABASE - Add cells to experiment database % % B=ADDTOTPDATABSE(MYDIRSTRUCT,NAMEREF,LISTOFCELLS,... % LISTOFCELLNAMES,VARARGIN) % % Adds cells to database; % datestr = getpathname(ds); if datestr(end)==filesep, datestr =...
c3881268bef909b6c256fcc309c584c6007eabc24e588c1c4b46cf1311d7aca0
MATLAB
4,448
97
function [ trainPerformance,testPerformance,validationPerformance, trainrmse, testrmse,validationrmse ] = ANN_Net (Input,Target,hiddenLayerSize,Inds,trial) trainrmse= cell(1,size (Inds,1)); % cell array for saving the RMSE values for train set validationrmse= cell(1,size (Inds,1)); % cell array for saving th...
9b730a33f571a0ab5f2d402989ecc4e71950129424d73d9111a221352fd5b2bb
MATLAB
4,456
118
function [mskNrn, msknum, MASK ]= Func_SegmentationOrganoids(im_stack) figure(5);clf; i_eq = im_stack ; level = 0.45 ; min_size = 10 ; max_size = 100 ; %extract ROIs % if method == 1 %WATERSHED % set(handles.text1,'String', 'Measuring ROIS (wate...
497546d0b516c437f2ac03e294babd34c0fb3e15e4e80e1e2eacd63ab151065c
MATLAB
4,465
206
function varargout = ep_AddSubject(varargin) % S = ep_AddSubject(S,boxids) % % Optionally input a structure S with fields already populated. % % Output/Input(optional) structure: % S.BoxID % S.Name % S.Weight % S.Sex % S.Species % S.Notes % % A second optional input can be used to specify Box IDs. % BoxIds = [3 4 6...
57944055e09c3b0a08b283c1cb65d530c81cc5058db8eb3015e8cef61b8e0d95
MATLAB
4,470
155
function NextTrialID = TwoChoice_GellermannRand(TRIALS) % NextTrialID = TwoChoice_GellermannRand(TRIALS) % % Use Gellermann's rules for two alternative choice task trial sequences % (Gllermann, 1933). % % DJS (c) 2011 % Converted for Epsych 6/2015 persistent GSEQ GSEQseed schidx global AX RUNTIME try if isem...
7d330142c588692214795236923fa349116ec6e51681e64b37fccff9ce513416
MATLAB
4,477
127
function [P, hw, Fc, Fb] = my_sub_sep_cwt(x, f, option, f0, Fb, fs, plot_cwt) % this sub-function is used to estimate PSD using wavelet transform (the % wavelet basis is selected as the type proposed By Tognola) % 'P' is used for illustration, and 'phi' is used for signal reconstruction % option: 'normal' means sl...
207669dca36e563a404f05f8d7ca879437a0d6ef039b8029d3508a90e397b059
MATLAB
4,481
85
% test_str2html - test script to run a simple and more complex tests % % 1st test will create a GUI which has 2 uicontrols with HTML format text % in this test each line has the same format % % 2nd test will create a GUI with 3 uicontrols, where each line can have % a combination of html formatting...
eaae044bbbfced35de3faafaa3ad1ac65b9205bb08edcb8441e089d5da92eb43
MATLAB
4,481
189
% PURPOSE: pop_renameeg.m % rename ALLEEGset % % FORMAT: % [ALLEEG, erpcom] = pop_renameeg( ALLEEG, 'eegnames',eegnames,... % 'Saveas', 'off', 'History', 'gui'); % Inputs: % %ALLEEG -ALLEEG structure %eegnames -strings for erpsets % *** This function is part of ALLEEGLAB Studio **...
1c58a8d734a9564ba01070a3b946e1dc63f8a6506363b70949ec1872e482f695
MATLAB
4,483
153
% PURPOSE: subroutine for pop_savemyerp.m % % FORMAT: % % [ERP serror]= saveERP(ERP, erpnamex, filenamex) % % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon & Steven Luck % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2009 %b8d3721ed219e65100184c6b95db20...
44b4cf95e42feca85ce544dfc38dbd7fe3349f138463181cc20f8cda879a9536
MATLAB
4,483
133
%% Parametmers % % Set 'datadir' to the path where your tank(s) exist or your computer. This is not the tank name, but the directory just above it. % % Set 'sevevnt' as the name of the streamed data macro that was set in your RPvds circuit. It will be 4 characters long. % % 'trodes' is a cell array of electrode group...
783ef32b94cdcb11da58668d1d71acd7860ad0be22fbe04ac08f1581b28e069f
MATLAB
4,484
157
function plot_w_vs_tau_info_motoneuron % Simulate zebrafish embryonic motoneurons' calcium transients % with empirically observed statistics of the data % % Compute the directional preference W_{IR} and W_{RC} as a function of % information propagation time scale tau_{info} % % Fix tau_ca = 2.5s, tau_sampling = 0.25s, ...
92678f8db02730d9a8e94b49cde929cf05a0aedc79b33dca893537884de8ab7a
MATLAB
4,487
126
% PURPOSE: Adds ERPLAB buttons to figure toolbar % % % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2012 %b8d3721ed219e65100184c6b95db209bb8d3721ed219e65100184c6b95db209b % % ERPLAB Toolbox % Copyright © 2...
03d127887a34f638a776bdcd080f3bb11b39be3165602457289dea4019b9abf3
MATLAB
4,489
93
%% clear all close all run(['..' filesep 'def_local']) addpath(path_fieldtrip) ft_defaults %% allfiles={'405','406','407','408','409','410','411','412','413','414','415','416','417','418','419','420','421','422','423'}; try badEpochs = readtable([SWS 'EEGpreproc' filesep 'wsws_badEpochs.csv']); badEpochs ...
58d8085f5b81973c72672cd11e6d6868258ba02d1a5f5ecc23869588534640f4
MATLAB
4,500
152
% Fig 2 - proportion of units in assemblies % Delays_ = {'Short','Medium','Long'}; Areas = {'HP','PFC'}; pat = 'C:\Analysis\AssemblyAnalysis\raw\KDE_binsTaskonly\LONGTaskonly\'; cd(pat) %%%%% fileList=dir('*_FSC.mat'); %% for iFile =1:length(fileList) %%%%% % fname=strtok(fileList(iFile).name,'_')...
88ad37778a7f533c5b67afd65893b4a82b39e0480accefc50016ac9daeb659ff
MATLAB
4,500
162
function sandrine2vhlabtstack(source, destination) % SANDRINE2VHLAB - Convert from Sandrine's format to VHLAB-style tiff stacks % % SANDRINE2VHLAB(SOURCEFILE, DESTINATION) % % SOURCEFILE and DESTINATION should have full paths % % Example: % % sandrine2vhlabtstack('C:\mydataorig\myfile.lif','C:\myvhdata\2012-0...
e49e0192883137d7049873236d24589694a3f39b51e9a338746648fee153b848
MATLAB
4,504
166
function varargout = DB_PlotPSTH(unit_id,varargin) % varargout = DB_PlotPSTH(unit_id,varargin) % defaults binsize = 0.001; shapefunc = 'mean'; win = [-0.05 0.1]; kernel = 5; convolve = false; fh = []; resamp = 1; kstype = 'unequal'; ksalpha = 0.05; ParseVarargin({'fh','rwin','...
9de3db83abcf85bc6ac5aafde38b22094b2c32e9d575c0472567ff1fbff413ae
MATLAB
4,512
156
function [] = cr_coherence_all(data, Pxx, CBF) % A function to calculate the coherence of all pairwise pixel coherences in that video. %% Define variables nfreqs = CBF.nfft/2+1; iw_min=1+round(CBF.w_min/CBF.Fs*CBF.n); %% Calculate both the pairwise cross-spectrum and pairwise mscoherence % Subsample ma...
6d89956cb3b54b7c0e522c6cbb46b4af79305f243cc21cf38ed79c8316a8453b
MATLAB
4,517
158
%===================================================== % FileName: motion_correction_1000.m % Designer: Zhe % Modified: 05/29/2021 % Describe: Extract 1000 frames of image from TIFF and store in image.bin % Perform matlab simulation of motion correction for 1000 frames. %======================================...
4681b2086ad566004d176c76510f6755dc992ba57cf1d5bec152618963d38753
MATLAB
4,521
128
% PURPOSE: reads message to be displayed at pop functions' completion statement % % FORMAT: % % [msg2show msgori mcolor] = readmsg2end(textin); % % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2009 %b8d37...
be008fc078396388f77493585996b858497457643ea439a6206dfd2b708c896b
MATLAB
4,529
138
function [] = setupComputeStructuresHost(obj, reset, order) if(nargin < 2) reset = false; end if(~isempty(obj.LL_info) && ~reset) return; end if(nargin < 3 || isempty(order)) if(obj.isSimultaneousPopulation) order = 1:numel(obj.trials); else [neuronIdx,order] = sort(obj.neuronIdx); ...
d1e770a5f4130564901222dd9c74df4cd75baf9709d2f3b4462fce412b5b70ee
MATLAB
4,530
103
%%%%%%%% %%%% Blink detection using the 'validity' measure from the Tobii system %%%% Will be detected as a blink, episods with eye-closed of a certain %%%% durations %%%% %%%% Inputs: %%%% - data (2D or 3D matrix with validity of eye-recordings for both eyes %%%% for continous (samples*eye) data or epoched (trial*sa...
687135e7f9d6b021ac96409cc8116b05bf6a4db04b76e9dc8b13c4095704c4c9
MATLAB
4,535
141
function [results_group] = scaleDerivatives(results_group, params_group, prior_setup, addPriorForVT, precomputedPortion) H = double(params_group.H(:)); D = numel(params_group.T) + 1; % order R = size(params_group.V,2); % rank compute_dH = isfield(results_group, 'dH') && ~isempty(results_group.dH); if(prior_setup.i...
58ca5a8d708d40f37102710cd2b99266101b44226d588b30ad53cb70cfa37149
MATLAB
4,537
130
%% Master Analysis file % All analysis performed on light transmission recordings of ciliary beating in the zebrafish nose % It is possible to run the analysis on aligned data. % Assumes that the input file is a .mat file, and only contains one variable with the recording %% Step 0: Select the recording % Sel...
fc9ff24dff4952672453fe55fa61b71f531f33dfdea7d41899fdde65241503e2
MATLAB
4,537
194
function [lp, dlp_w, dlp_log_scales, dlp_h, D, Q] = scaledGaussianComponent(ws, mu, log_scales_0, H_c, comp_prior_setup) % 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 if(isempty(H_c) && ise...
02a0500091bbba47da32333a6df4d1b6950acefb63d8fee602aa2dfbf3dfae52
MATLAB
4,539
172
%% Triple Correlation Script - Figure 2 clearvars clc close all C=150; % columns R=150; % rows %define the frequency f = 0.08; % deterministic component t=0:C-1; s=1*sin(2*pi*f*t); S=zeros(R,C); for ch=1:R ph=0; S(ch,:)=1*(((sin(2*pi*f*t+ph)+1)/2)); end %addition of noise y=rand(R,C)...
e22cb57437aee5a3d0202e8ca94f1ae9d689236fd20f74df0d9828194f8286d0
MATLAB
4,543
77
function ExclusionAnalysis(Subregions,FolderPaths) % Compares the results from WLS analyses with OLS analyses conducted using a range of exclusion threshold. % INPUTS: % - Subregions: 'p1' and/or 'p2' depending on the tissue class of % interest. Initialized in RunQUIQI % - FolderPaths: structure containing th...
3d7bdcabc09d211a9d91feffe8496ffb7ec04eb44da85a2ba0327da1a8c0cc49
MATLAB
4,546
157
function varargout = f_EEG_update_gui(varargin) % F_EEG_UPDATE_GUI MATLAB code for f_EEG_update_gui.fig % F_EEG_UPDATE_GUI, by itself, creates a new F_EEG_UPDATE_GUI or raises the existing % singleton*. % % H = F_EEG_UPDATE_GUI returns the handle to a new F_EEG_UPDATE_GUI or the handle to % the exis...
b49c228a8efb50a9416bfb8cbfbcd1cfbdbf5aa59acd8029847057c58029802a
MATLAB
4,546
165
% PURPOSE : Exports ERP to text (readable by ERPSS) % % FORMAT : % % pop_erp2asc( ERP, filename ) % % INPUTS : % % ERP - input dataset % Filename - file output % % % OUTPUTS % % - outputted text file 'filename.txt' of ERP data, readable by ERPSS % % EXAMPLE : % % pop_erp2asc( ERP, 'S1_EEG_ERPs.erp'...
f7ce5aaa0d4a9b9f5768807f890012fca71dcfc12aa098bbc0c34bd940a446bb
MATLAB
4,546
76
function segmentedFiber = get_long_fib_struct(MRG, fibDiam, nodalIndex) % GET_LONG_FIB_STRUCT calculates the longitudinal structure of the fiber's % part of interest, i.e. the part of the fiber for which the potentials are % to be extracted %% parameters % number of sections between the nodes of Ranvier nSecti...
2a72f61bbda8edb6892701b989b09c528f4a19ae0b2b5a38a014c6788b6e4218
MATLAB
4,547
160
% pop_visualareatemplate() - Fit data with area templates % % 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 dataset. % % Outputs: %...
b5970e87d859eff421db786d4d54c00e76e8d8eb4a15860eefdb83ae6c415788
MATLAB
4,551
124
%% creates basis functions for modeling the DMC task % % % Uses modified cardinal splines from % Sarmashghi, M., Jadhav, S. P., & Eden, U. (2021). Efficient Spline Regression for Neural Spiking Data. bioRxiv. % % function [bases] = setupBasis_spline(binSize_ms, stimLength_ms, delayPeriod_ms, highResPostStim_on_ms,...
2b42e081354bca333d454f593a2545702c9b0b757c8e47559fa6edae479b8eae
MATLAB
4,553
126
%% FINAL - Plot all activations on continuous timesale with units overlaid - one example assembly showing non-member units SF = 1.2; SF_Ass = 5; bounds_ = 10; Offset = 4; plotNonMembers = false; tExtreme = [5240 5490]; % tExtreme = [5000 8000]; shading_ = [0.3 0.3]; TrialSkip = 2; tlims_ = [... t.Sh...
2eec7ef70932c6376fcf4a07916b450f461b1215bbaaa6f054269e6ca809c02b
MATLAB
4,554
120
% Root class for composite user controls. % Copyright 2008-2009 Levente Hunyadi classdef UIControl < hgsetget properties (Abstract, Dependent) % The graphics handle that represents the entire user control. % This handle is used in setting the parent, position, measurement % unit, etc...
6456981aecfd02e5507e67fca8e703bf93a141012f29a581821b97f93554a00e
MATLAB
4,555
101
function acc = getDecoding(db,P,decP) % looping parameters focusOnL = decP.focusOnL; Pspk = P; % really suboptimal Pspk.reductionMethod = 'SVD'; Pspk.pc2Keep = decP.pc2KeepSpk; Pmot = P; Pmot.reductionMethod = 'none'; Pmot.pc2Keep = decP.pc2KeepMot; Pmot.zscore = 0; ...
fa4c2b051e4bbc29c64794e2b0a9383db78d004c83c9c1ceeb34c909f3009ee4
MATLAB
4,558
133
function KM_rotationNumber(fpath,simPar,modPar) %%% 26-01-23 first commit f_stim = modPar.f_stim; PRCfName = modPar.PRCfName; Delta_f_0 = modPar.Delta_f_0; k = modPar.k; theta_0_mean = modPar.theta_0_mean; theta_0_std = modPar.theta_0_std; xi = modPar.xi; N ...
ffde63376ad55bf105b35bc11f80e672cbf7666a72b17ff3de62921ca2ace825
MATLAB
4,574
139
function CreateLabeledClips(self, varargin) p = inputParser; p.KeepUnmatched=true; addOptional(p, 'PlaybackSpeed', 1); addOptional(p, 'Scale', 1); addOptional(p, 'FontSize', 16); addOptional(p, 'ColorScheme', 'dark') parse(p,varargin{:}); playbackSpeed = p.Results.PlaybackSpeed; scale = p.Results.Scale; fontSize = p....
9e7eb1d7307ec3c96df54ce67447c60361b12365a16432d501033d3653800057
MATLAB
4,580
166
projectFolder = '/Users/harriscaw/Documents/Behavior classification/Projects/JuangDemo'; project = DeepActionProject(projectFolder); % project.CreateProject() demoDataFolder = '/Users/harriscaw/Documents/Behavior classification/DeepAction datasets/demo_data' demoVideoFolder = fullfile(demoDataFolder, 'videos'); demo...
8446d31e53c5e0b770c5b11d510071a1a66bc645c8eabf7b6f75ceeb6716f8d8
MATLAB
4,585
135
function [Ke,qe] = keq4e(Ee,Ge,Se,Xe,Set) %*************************************************** % KeQ4E: % Creates the element stiffness matrix of elastic % quadrilateral 4-node element in plane stress or % plane strain. % If Xe contains 8 node coordinate set the stiff- % ness matrix of 8-node element with qua...
68174aaaaee30db944e7a84442b9a5d7a7e1eb76310a51d3277aaa805a7939ee
MATLAB
4,593
135
function NextTrialID = TrialFcn_AversiveAnimalTrig(TRIALS) % NextTrialID = TrialFcn_AversiveAnimalTrig(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 cus...
fc2dd8cf29d991af02ce28bb9580d5ef971d953c20e83cb048e78063fe521b1d
MATLAB
4,607
122
function [n1_peak_amplitude_check, n1_peak_sample_check ] = ccep_visualcheck_n1peak_ECoG(average_ccep, ccep,average_ccep_names,channel_names,tt,n1_peak_amplitude,n1_peak_sample) % % function ccep_visualcheck_n1peak_ECoG(average_ccep, average_ccep_names,... % ccep,tt,n1_peak_amplitude,n1_peak_sample) % % Function plo...
b92dc8f071f19ac1ab7055e82e190e7c6b387ca2438af73c0660e9cc2553c722
MATLAB
4,608
210
function PlotBehaviorResults %---Script that analyzes behavior data from AM Rate Discrimination Task. %Created 09/08/2017 JDY. %1) Click Run ("Play" button) clear all close all clc %---Load Data---% [f,p] = uigetfile; file = [p f]; load(file) D = extractfields(Data); %---Organize Data---% DATA = GetData(D,Info)...
53ffb2b845805ccf2300289e8f9be30d430ab40b4e13368a25eb4b8625dbe44e
MATLAB
4,611
123
function [CVE,... Score,... Score_Shuffled,... Score_ShuffledCIL,... Score_ShuffledCIH,... CVE_shuffledHL] ... = RunDecodeGroups( unitIds , nReps , Ltrials_ , Rtrials_ , TrialsSubsample , InfoCriteria , timeRange) % Wrapper function for Decod...
6ff826f563152c51aaa269ca5006656764d7289e9c79b7462e29273d4290cf8c
MATLAB
4,617
141
function [HITind,MISSind,CRind,FAind,GOind,NOGOind,REMINDind,reminders,... variables,TrialTypeInd,TrialType,waterupdate,handles,bits,varargout] = ... update_params_runtime_SanesLab(waterupdate,ntrials,handles,bits) %[HITind,MISSind,CRind,FAind,GOind,NOGOind,REMINDind,reminders,variables,... % TrialTypeInd,Tri...
045c967b5f6697e9f4b710780a15affb6f043b69b086401173fdc08ce2f0a06e
MATLAB
4,619
116
function [model, model_SDPdcSL] = qtipm_pipe_SDPdcSL_SDPdcmSL(data,btensors,D0,mask,nvox,mcheckflag,ind,parallel,cvxsolver) % function qtip_pipe_SDPdc_SDPdcm() % % % utility to not have to reshape the data between fits % reshape data and retain voxels within the mask siz = size(data); data = reshape(data, prod(siz(1:...
2a2ea4412442221dd55636af72da038ffa7dd6437e03a320fcf3398693353b51
MATLAB
4,623
77
function [ mappOut ] = getMappingV1V6( mappNameIn ,type, sessionID) %GETMAPPINGV1V6 get channel mapping for individual shanks in V1 and V6 % Call the function like this: getMappingV1V6('V1_1B','raw',321) and it will return % a vector of channel numbers in the order of superficial->deep % if mappNameIn is 'all', t...
3f01a1e9ec50a64ca2d4a776025f09e2f983eb2dca1a9f8f200a25d41e23f7df
MATLAB
4,629
147
% Explore single unit vs. assembly performance in decoding behaviour clear all; close all target = 'LONG'; pat = 'C:\Analysis\AssemblyAnalysis\raw\KDE_bins'; % A=dir([pat '*PFC_iFR50*.mat']); A=dir([pat filesep '*' target '*', '*PFC_iFR50*.mat']); for i=1:length(A) k=findstr(A(i).name,'_'); r=findstr(A(i).name,'....
75d5e8a174cdb73a3f8c11919fda7338fe9ea3f9eeb78d5ff6a6101cfddbacb8
MATLAB
4,631
143
function [pval,rho] = SStat_mass_PHTest(X,d,t,Y,stats_PH,maskvtx) % [pval,rho] = SStat_mass_PHTest(X,d,t,Y,stats_PH,maskvtx) % % Vertex/voxel-wise Schoenfeld residuals test for the proportional hazards % assumption. % % Input % X: Design Matrix with the time-independent covariates. (mxp, m # of % subjects, p # of cova...
2778f49c8b5f80ce5bcab32e2167152242003b7bdacb93316c31758e89bde8cc
MATLAB
4,635
171
function model = qtipm_data2fit_SDPdcSL(signal,bten,varargin) % function model = qtipm_data2fit_SDPdcSL() % % out_flag says which format to use for m : % out_flag = 1 -> [28*nvox,1] % out_flag = 0 -> [28, nvox] nmeas = size(bten,1); %...
04a07711907407cc597dc12fd8619b80c4c895188e877e2676ccdd75f8698447
MATLAB
4,637
148
function DisplayProgress(currIdx, endIdx, varargin) p = inputParser; addOptional(p, 'SimpleOutput', false); addOptional(p, 'CurrentName', []); addOptional(p, 'ShowAllOutput', true); addOptional(p, 'TotalUpdates', 1000); parse(p, varargin{:}); showAllOutput = p.Results.ShowAllOutput; if p.Results.SimpleOutput == true...
56a52716f823ee3ae150baf4c4d967234b242624b17841a02cb11e7b90660725
MATLAB
4,637
89
% This script estimates single-level GLM parameters % during Stroop and Swimmy tasks (Okayasu et al. 2023) % and works on SPM12 (https://www.fil.ion.ucl.ac.uk/spm/). function singleGLM tic; nsub=32; %strool vocal: 32; stroop manual: 31; swimmy vocal: 27; swimmy manual: 28. See Fig 1g. for i=1:nsub ...
c0ed62344c7123f2de67e9b3f4260da872ada5df87a780dbc970cc034bdb54a0
MATLAB
4,639
189
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...
f02ce0346df69a3f6c14e507653147b3ad7bfbc3383e3baa81af5334e980ab60
MATLAB
4,639
160
%% expt = 'MAIZE'; DB_Connect; mym('use','ds_a1_modulates_mgb'); %% prot = 'RIF'; sortparams = {'Levl'}; win = [-0.1 0.1]; binsize = 0.001; gw = gausswin(3); mstr = sprintf(['SELECT b.id AS block, u.id AS unit FROM blocks b ', ... 'JOIN tanks t ON t.id = b.tank_id ', ... 'JOIN channels c ON b.id = c.blo...
653dd06d550c9dd1afbcf3239d9a87b98cca5205d204229e470c9395a59b4fcf
MATLAB
4,644
158
function fx_calculate_temporal_sta_randomized_spikes(index, tb, llfp_type,... clip_length, downsample_factor) file_id = tb.file_id{index} seizure_onset = tb.seizure_onset(index) seizure_end = tb.seizure_end(index) % load appropriate LLFP file (whitened vs. unwhitened) if strcmp(llfp_type, 'unw...
989350451beb642faa1a8cd70162eecf6bf58a61e7efc21960ae28eb9fb254c3
MATLAB
4,645
194
% PURPOSE: pop_renamerp.m % rename ALLERPset % % FORMAT: % [ALLERP, erpcom] = pop_renamerp( ALLERP, 'erpnames',erpnames,... % 'Saveas', 'off', 'History', 'gui'); % Inputs: % %ALLERP -ALLERP structure %erpnames -strings for erpsets % *** This function is part of ALLERPLAB Studio **...
f4954393395ac1de81697b5af4034bd44d8200557dc62f7cf9497ebd38d7cb63
MATLAB
4,650
133
%% finite difference tool for all GMLM parameters % can check with stochastic gradients by giving a "numberOfTrialsForSGrun" (weights per trial will be random) function [results_est, results_all, ll_host, params, opts_all] = checkDerivatives(gmlm, params, numberOfTrialsForSGrun, perNeuronWeights, use_posterior) if(nar...
b62d582b704e4a462e7895e6862798ba18e8ecaadfdaed4795b2c192b32b0b87
MATLAB
4,653
152
classdef FrameReader properties Path % path of the input video ImageType % Reader - Reader for .seq and standard video formats Reader CurrentIndex % current frame index NumFrames Dimensions FrameRate ...
882c8cd54c503866279853e19a5c2ac8fd77a8f0f5addb5d7361657b3001e4f9
MATLAB
4,659
191
hFig = figure('Renderer', 'zbuffer'); hAxes = axes; lightangle(0,90); numPts = 4; Center = [ 0 0 0]; Circle = CirclePatch(numPts,1, [0 0 1]); Verts = [Center; Circle]; T = ones(numPts,3); for(i = 1:numPts-1) T(i,:) = [1 i+1 i+2]; end T(numPts,:) = [1 numPts+1 2]; A = [0 1 0]; B = [5 0 0]; ...
d6b7391644516977c80a29920da3016d4778cc6d5c49c6abc60585f794fa5163
MATLAB
4,659
130
function [Pxx, val] = cr_coherence_ref(data, CBF) % A function to calculate the coherence of one reference pixel with all other pixels % in that video. % The code is largely based on the mscohere() function in Matlab, but % slightly optimized for speed. % https://se.mathworks.com/help/signal/ref/mscohere.html...
6784e0691416669d6f238fe14b3f2ab7f2c208235850d2397ca6fa5a590b92c5
MATLAB
4,661
169
function [Problem] = l1_logistic_regression(x_train, y_train, x_test, y_test, varargin) % This file defines logistic regression (binary classifier) problem with l1-norm. % % Inputs: % x_train train data matrix of x of size dxn. % y_train train data vector of y of size 1xn. % x_test test d...
4c548275c98be6d5ba1819846d28166aaab421da30313f5a7c0acf6248c19dea
MATLAB
4,662
162
function [thresh, reject] = calculate_thresholds( Phys, segment_length_s, Threshold, win, fs ) % [thresh, reject] = calculate_thresholds( Phys, trial_length_s ) % Called by pp_sort_session. Launches a gui in which a random trial is % selected and filtered Phys data is displayed for 4 channels at a time. % Wai...
86adc3ed240276508fd24a4e4108d1b8f19477197bdffbab0b956c28ca0f149d
MATLAB
4,664
133
function data_pupil=get_Tobii_cleanpupil(rawdata_pupil,SR,data_time,rawblinks) data_pupil=rawdata_pupil; % data_pupil(data_pupil<100)=NaN; % blinks=EL_events.Blinks; blinks.start=rawblinks(:,2); blinks.end=rawblinks(:,3); blinks.duration=blinks.end-blinks.start; fprintf('... ... cleaning blinks (linear interpolation)\...
10b0af4d98d790ece6db799bc8710cc20cac3b14e16226d2f9b1d89f22c4caad
MATLAB
4,665
136
function u = ridge_loo_optimisation(YY,XX,lambda,throw_away,opt_stats_dir) % Uses data from multiple subjects and calculates the average % prediction error across the subjects for the particular lambda. The % prediction error is calculated using leave-one-subject-out % cross-validation. % % Inputs: % % YY ...
fdb72234688d3a17b60257e2a73c89ad0a5e3e654c0d683b3b2a7dc531beaf43
MATLAB
4,670
117
%% 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...
f2e039333f6bbfd1b45445426c4848517cb42a88cb54ba96251e4b60b0f15586
MATLAB
4,673
154
function [stats,st] = lme_fit_FS(X,Zcols,y,ni,e) % [stats,st] = lme_fit_FS(X,Zcols,y,ni,e) % % Linear mixed-effects estimation by the Fisher scoring algorithm. % % Input % X: Ordered design Matrix (according to time for each subject). % Zcols: Vector with the indices of the colums of X that will be considered % as rand...
4c9492266fd2500f295cea612c08501ff9daf5f16dfb9c92f45f02b78ba69ee8
MATLAB
4,680
133
% Script for potentials extraction in MPH files for boundaries condition % The script cycle on the number of boundaries condition (number of saline % cylinders) and the number of testing condition (points of stimulation); % for each combination of those the potentials in the endoneuriua are % computed extracted. ...
f5a1af0ec80dda1bfe02c8ce093125f7e86a8b36f2acd349ecafe47320495bbc
MATLAB
4,685
100
function A = DEKF(y,p) %Dual Extended Klman Filter (DEKF) for MVAR parameter estimation % % Arguments: % A: Estimated time-varying parameters, A = [A1 A2 ... Ar] % y: (CH x LEN) data matrix % p: Model order % % % References: % [1] E. A. Wan, and A. T. Nelson, Neural dual extended Kalman filtering: applicati...
c83a0b2fc05865e12cef5adddce35fd1764614b686716353e4ff7d73f8f0c02f
MATLAB
4,687
153
function [ Faces ] = BuildFacesForBifurcatedTriangle( VO, VA, VB, iLineVerts, OverlappingVerts, InternalVerts ) %BuildFacesForBifurcatedTriangle VO, VA, VB defines a triangle which has %had a line drawn through the vertex at VO %iAddedVerts contains a sorted list of all indicies that lie on the line %through the tria...
e5bc50de91ef89b97e190a34e2822c67482b7448259cafee2c3df891da845b73
MATLAB
4,687
171
function [ ] = WriteVTK( C,E,Set,S,Sv,x,u,uExp,utot,t) %% WriteVTK writes resuls in vtk format % INPUT: % C(e,:) connectivity of hexahedral element e % E(e,:) = strains of element e: Exx,Eyy, Eyy, Exy,Exy,Exz,Eyz % S(e,:) = Elastic stress of element e: Sxx,Syy, Syy,Sxy,Sxy,Sxz,Syz % Sv(e,:) = viscous stress of elem...
37538d43c0bfdc8e7a036c54c02608ec1d5cafbfa80c7965ed6dc18894027667
MATLAB
4,690
159
fmax=12; fmin=0.5; p=0; cd( '\\158.182.15.58\test2\Junhao'); % % File name fileName = ['result_of_p' num2str(p) '_trial1']; load(fileName); data=VolE; % Sampling frequency (in Hz) Fs = 100; % Scale by which to downsample spatially mouseResize = 1; % Flag to use mask located in meta.traceMask useMask = 0; % Spatial sel...
e25714b2e6173ac650d6dd29e08daf9479aaa06204f56575e24a691ecf7058d5
MATLAB
4,696
158
function newdata = chunkwiseDeline(data,sr,freqs,freqrange,chunksize,showOutput) % newdata = chunkwiseDeline(data,sr,freqs,chunksize) % Removes line noise from a signal in small chunks of data. % data - an n x 1 vector containing continuous data % sr - scalar, the sampling rate of the signal % freqs - a vector of frequ...
4f4a7dee299405ca0305c520d59e19dcd3c68ba1193935b306651a119c5f8d56
MATLAB
4,699
88
%% fitPeakAndCoupledArtifacts.m % % part of https://github.com/LudgerS/MRSartifactRemoval % % Fits the sum of three complex Voigt peaks to spectrum of which two are % coupled regarding their amplitude. % Bayesian priors are placed on the peak locations, widths, Voigt mixing % ratios, the ratio between the coup...
f21e10a33f8bdd67670e25725ed80d1980e5f1017a70ea9532a3694d89308c01
MATLAB
4,704
218
function PlotBehaviorResults %---Script that analyzes behavior data from AM Rate Discrimination Task. %Created 09/08/2017 JDY. %1) Click Run ("Play" button) % clear all % close all % clc %---Load Data---% [f,p] = uigetfile; file = [p f]; load(file) D = extractfields(Data); %---Organize Data---% DATA = GetData(D...
ed9b2cbdeb6f5787ca8ce598a595bd6536d989dcfc9f38c692a36e6935684020
MATLAB
4,706
167
function pp_plot_rasters(subject, session, channel, clu) % % pp_plot_rasters(subject, session, channel, clu) % Plots a raster and psth for each unique stimulus. Clu is the label % given by UMS (not an index), found in Spikes.sorted.labels. % % KP, 2016-04; last updated 2016-04 % set(0,'DefaultAxesFontSize',...
ae7863e1476e2b38bf4d571edc6324d45125ca58cf763783d7415cbb56042847
MATLAB
4,710
203
function plot_TSlew(unit_id) % plot_TSlew(unit_id) % % Plot and analyze temporal slewing experiment % % Daniel.Stolzberg@gmail.com 2014 if nargin == 0 || isempty(unit_id) unit_id = getpref('DB_BROWSER_SELECTION','units'); end f = findobj('tag','plot_TSlew'); if isempty(f) f = figure('Color',[0.98...
a21b4627021887dde25187b6d1a15b226ce0fecf2c576e1998b929c5cf7658f8
MATLAB
4,726
160
fmax=12; fmin=0.5; p=0; trial=1; cd( '\\158.182.15.58\test2\Junhao'); % % File name fileName = ['result_of_p' num2str(p) '_trial' num2str(trial)]; load(fileName); data=VolE; % Sampling frequency (in Hz) Fs = 100; % Scale by which to downsample spatially mouseResize = 1; % Flag to use mask located in meta.traceMask use...
61ffafda439f63ff6a76bb3305877f52594b31415d2ea1cb6f0831b86a142a1e
MATLAB
4,727
190
function varargout = BasicClassifier2(D,nReps,func,par) % R = BasicClassifier2(D) % R = BasicClassifier2(D,nReps) % R = BasicClassifier2(D,nReps,func) % R = BasicClassifier2(D,nReps,func,par) % [R,Rshuff] = BasicClassifier2(D,...) % % D is an MxNxP data matrix with M samples from N observations in P % categories. % % O...
d14b080e6044dbbb3ba754153a0b0141ee8cdb94b1d152b857743c82a61463ac
MATLAB
4,732
178
% PURPOSE: pop_duplicatbest.m % duplicate BESTsets % % FORMAT: % [ALLBEST, bestcom] = pop_duplicatbest( ALLBEST, 'BESTArray',BESTArray,... % 'Saveas', 'off', 'History', 'gui'); % Inputs: % %ALLBEST -ALLBEST structure %BESTArray -index(es) of BESTArray % *** This function is part of ERPLAB ...
a07e18ea84727f22c3b8b644b5efb68688e8352a4ac3c376f2f581289830fea4
MATLAB
4,734
90
function [val, formulaArray] = f_chan_testsyntaxtype(FormulaArrayIn, whocall) val = 1; formulaArray = FormulaArrayIn; if isempty(formulaArray) return else formulaArray = strtrim(cellstr(formulaArray)); end nformulas = length(formulaArray); [expspliter parts] = regexp(formulaArray, '=','match','split')...
63f81a0aa418947d903d907647cb91f8a8dbbfd924a8063d4a01925796172d1f
MATLAB
4,735
99
function forward_projection(psf, poisson_noise, gaussian_noise, gaussian_sigma, brightness_adjust, gpu, source_path, save_path, bitdepth) % FORWARD_PROJECTION projects the HR data into synthetic light field raw % image % forward_projection(psf, poisson_noise, gaussian_noise, gaussian_sigma,... % ...
be4086cb632846e8412f15047cc69ca77a4d42a2fb4eb7afa6647d82b99b0ba4
MATLAB
4,739
162
%% clear all close all run(['..' filesep 'def_local']) addpath(path_fieldtrip) ft_defaults %% allfiles={'405','406','407','408','409','410','411','412','413','414','415','416','417','418','419','420','421','422','423'}; timwin = [0.5, 3]; % time-window for analysis nc=0; for n=1:length(allfiles) %%% Loading data...
247d2622c298625786e89552027b965e6aaabb9aebfc3d18df679745a4ccdaf4
MATLAB
4,746
163
%% Coherent moving dots % % Daniel.Stolzberg@gmail.com 2016 sca num_coh_dots = 50; % number of coherently moving dots dir_coh_dots = 0:20:340; % direction of coherently moving dots (clockwise starting from left in degrees) num_dots = 50; % number of randomly moving dots dot_size = 1; % degrees dot_color = ...
e289e01d1892ded60085a5bb1de589c398b2d04a2f572b545a81363ebc6b05ba
MATLAB
4,747
103
function [p_beta_CP, p_beta_CP_max] = compute_cluster_pv(all_t_beta, all_p_beta, ... perm_cluster_t, criticals, all_names, n_perm, n_betas, n_chan, nF_data, nT_data, alpha) % Compute the distribution of the cluster-level statistics based on % shuffled data. % % Inputs % all_t_beta: (n_betas, n_chan, nF_d...
303316e1b8ea45c9b7fb942a35613aa4d7e5caa4006803551345c20f43356225
MATLAB
4,748
160
function [] = cr_coherence_all_patch(data, Pxx, CBF, patch_no) % A function to calculate the coherence of all pairwise pixel coherences in that video. %% Define variables nfreqs = CBF.nfft/2+1; iw_min=1+round(CBF.w_min/CBF.Fs*CBF.n); %% Calculate both the pairwise cross-spectrum and pairwise mscoherence ...
e1cce3b259d8a3ee6ac58b7a6df009483a0d32c03570b0ec91f43b6be1bfe0df
MATLAB
4,749
96
function compartCoords = compartmentalize_fiber(fibers, fibId, MRG) % COMPARTMENTALIZE_FIBER calculates the coordinates of the fiber nodes and % compartments between by placing them on a spline fitted to the fiber % coordinates, also applying a random longitudinal shift (deltaZ) % compartCoords = COMPARTMENTALIZ...