sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
bb281d565b69634e56b3002dd2f1dcb678af5f9283f027daacdb5895bc0f751d
MATLAB
1,186
46
function [x,error]=SolveMA57m(A,b) %% Calls solver function that uses MA57 subroutines % from Central Laboratory % of the Research Councils % ALL USE IS SUBJECT TO LICENCE. For full details of a UK ACADEMIC % Licence, see http://hsl.rl.ac.uk/acuk/cou.html % Uses matrices in sparse component format: ...
f0ce73f071699db2ca45da696b5861e7c3a9fa098e054da118151112d41f7547
MATLAB
1,187
45
function plot_potential_along_fascicle(model, iFasc, iAS) %PLOT_ACTIVATING_FUNCTION Summary of this function goes here % Detailed explanation goes here [~, ~, ~, fascIdsByAs, activeSites, ~, ~, cross_pl] = import_nerve(model, 'hide_plots'); assert(fascIdsByAs(iAS, iFasc), 'This fascicle is not reached by this...
bebbaf837ded83c0d8dfb146c8635f72e0d7386197cfc0cfde74f232e248ad2b
MATLAB
1,188
39
function self = TrainNetwork(self) isTrn = self.ClipTable.Set == categorical({'Train'}); trnSeqT = SplitClipDataIntoSequences(self, self.ClipTable(isTrn, :)); trainFeats = TransposeCellArrayElements(trnSeqT.Features); trnLabels = DeepActionProject.GetLabelsFromTable(trnSeqT); trainLabels = TransposeCellArrayElements...
ee4e19f14e7999e193da4404a656845ec019d9612a53e712286b5c5e73be8ec7
MATLAB
1,188
54
function calculatePitch % % This function selects the hold time from a range of possible times % % Required gf parameters: % pitchMin % pitchMax % pitchSteps % pInd % % Parameters generated: % pitch global gf if gf.pitchMin ~= gf.pitchMax, % Linerarly spaced array of times from min to max (dB) gf...
0a516a3f45ff070862055ec90350b2e5f20fd4c33f37eca36522a43cb6bb05da
MATLAB
1,189
38
function design = designMatrix_discriminant(cfg0, group) % [design] = designMatrix_dummy(cfg, G) % Returns a design matrix using discriminant coding for two groups. % % G Array of length N, where N is the number of trials, that contains the group each trial % belongs to, as identified by ...
50a867728bb67b9319edce931dc37bc171bb01439952a5c552f3f5c61226855f
MATLAB
1,189
37
function c = ss_censored( spikes, use ) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % ss_censored - wrapper for censored.m % % Usage: % c = ss_censored( spikes, use ) % % Description: % Estimates the percent of a cluster that is lost due to censoring. % See censored.m for mor...
6467f7261703c259befd13cc8603bd6f21cba765f10b329c5ad9aac3ff6e9d42
MATLAB
1,189
39
%% Get spike and stimulus onset vectors for use with NeuroExplorer % from block currently selected in DB_Browser ids = getpref('DB_BROWSER_SELECTION'); units = mym(['SELECT u.id,c.target,CONCAT(c.target,c.channel,p.class,u.id) AS name ', ... 'FROM units u ', ... 'INNER JOIN channels...
88d806754ebab14f7ed9648b65fc528c3736474604f751c0ccbac3c353a55ea5
MATLAB
1,190
24
function [ROIs] = chord_ROIs() %CHORD_ROIS ROIs used for the chord diagrams ROIs.beta = {'PFC', 'OFC', 'ACC_area24', 'agranularIns_bin', ... 'dAIC_custom_bin_agranTrim', 'Idys','Idfm_custom_bin', 'S2', 'S1',... 'thalamus_ohne_genicula', 'hypothalamus', 'amygdala', 'putamen', ... 'PAG', 'PBC'}; ROIs.regionIn...
6362deba06ae434eedcc440c2f0ebd9d7392fbba1836ab400a5d9792c9577046
MATLAB
1,193
47
function plot_potential_cross(model, iAS, plotArgs) arguments model Model iAS (1,1) plotArgs.?CrossPlotProps; plotArgs.LabelAS = true; plotArgs.clabel = 'Normalized Potential'; plotArgs.z = NaN; end [epi, endo, elec, fascIdsByAs, activeSites] = ... import_nerve(model, 'hide...
19e8abb6aa6c7c13f85efdbebd879827ef36a33845c3c652dfd64e29a7c5c5e6
MATLAB
1,194
49
clc; clear; close all; Fig8d=figure(); Ntrials=20000; %number of learning cycles xax=1:1:Ntrials; N_mu=500; %There are \mu independent embedded patterns, 500 simulations (number of simulations) Results1=zeros(N_mu,Ntrials); % total number of spikes Results2=zeros(N_mu,Ntrials); % ns1+ns2 ns1: pattern 1 ns2: ...
523050b88a69728438a77622edc6c3459fc5d03977bd547376b11c31b7d471c2
MATLAB
1,194
51
function motif_class = network_motif_classification_3D(x1, x2, y1, y2, t1, t2) vec1 = [x1,y1]; vec2 = [x2,y2]; vec0 = [0,0]; list_vec = [x1, x2, y1, y2, t1, t2]; if t1 < t2 x1_new = x1; x2_new = x2; y1_new = y1; y2_new = y2; t1_new = t1; ...
7194a8a500ae429de61e04cd1ee1600a45fcee8afe2ac41fe511abd9f1318392
MATLAB
1,196
38
function fnames = export_active_sites(model) [~, activeSites] = load_active_sites(model.paths); FEM = []; log = model.getLogger('electrode'); fnames = cell(1, numel(activeSites)); for iAS = 1:numel(activeSites) fnames{iAS} = fullfile(model.paths.elec, sprintf('AS%d.stl', iAS)); if isfile(fnames{iAS}) ...
9b5d252d514d1ee7b60c4a4b57c3d267c61dfb10e4889124f7299d240b8b8b9c
MATLAB
1,198
54
%% 2 Rotate all images into proper plane % Does not do any fine adjustments to individual brains % % DJS 11/28/2016 rootPath = 'D:\DataProcessing\'; cd(rootPath); addpath H:\DataProcessing\PREPROC P = getFiles; % P = P(cellfun(@isempty,strfind(P,'VOI'))); % hide directory %% % approximate transformations determi...
9cb6e2753acf6ba01832a4d78d06e2aa302f1dcb103ad515be899f0a8db87ec3
MATLAB
1,198
53
%% Response Latency RCode = NHP_decodeResponseCode([Data.ResponseCode]); Angle = [Data.Behavior_Speaker_Angle]; uAngle = unique(Angle); rl = cell(size(uAngle)); for i = 1:length(uAngle) ind = uAngle(i) == Angle; ind = ind & ~(RCode.Abort | RCode.NoResponse); rl{i} = [Data(ind).Behavior_RespLat...
cbfb3063501e6c1b78d2226682db2aec0d79b220ee2769e54a8fa43b5d7f1428
MATLAB
1,198
26
% GUI Layout Toolbox % Version 2.3.9 (R2024a) 05-Jul-2024 % % Panels % uix.Panel - arrange a single element inside a standard panel % uix.CardPanel - show one element from a list % uix.BoxPanel - arrange a single element inside a panel with a boxed title % uix.TabPanel - arrange...
1c7e39eefc39e4bfd415a2b7180ddc8a31ef9a084003a207f1462dcfc7bab110
MATLAB
1,199
68
function [CN,R] = f_CN_corr_aprox(CIJ,nterms) % Approximation of CN using Barnett et al. % FC is computed using Galan's linear model % References % L. Barnett, C. L. Buckley and S. Bullock (2009) % % R. F. Galan, plos one (2008) if nargin < 2 nterms = 5; end N = size(CIJ,1...
b61e1a22a4d6082e428e516b6ce0e1866d33a6b4363f748175d23b63ebcc22f8
MATLAB
1,200
37
% PURPOSE: pins figures to the light theme. % % FORMAT: % % erplab_lighttheme(fig) % % INPUT % % fig - figure handle, or array of figure handles % % % ERPLAB's windows are laid out for a light background and many of their % colours are set explicitly, so a dark desktop leaves dark text on dark % panels in some pl...
f9be377d2a352fca5f1e6fa87db8a916eb07c39bd27e9a17cee646e2fd2083cd
MATLAB
1,201
42
function BetaWeights_bin = f_decoding_betaweights(mdl,nDecoders,method,nBins) % ddd=0; % for iiii = 1:nDecoders % for j = iiii+1:nDecoders % ddd = ddd+1; % BetaWeights_bin(ddd,:) = mdl.Coeffs(iiii,j).Linear; % end % end if method==1%% SVM%%GH August 2025 if nBins > 2 ...
15fa1b8a82f5627d61d12b8913c1ffaaae7bd2ff5f843177c08c2c6b311206ee
MATLAB
1,202
48
function [scaled_expectation,expectation, p] = theoretical_expectation_2D(raster, neuron_window, time_window) motif_order = [ 1 2 3 2 3 2 3 3 3 3 3 3 3 ...
053bdad6041f3e927eb65a91fb7bf0bae804190495217688c59523adf0da2367
MATLAB
1,203
35
% part of https://github.com/LudgerS/MRSartifactRemoval % % modified from A. Weideman's code % http://appliedmaths.sun.ac.za/~weideman/research/cef.html % which is based on J.A.C. Weideman, "Computation of the Complex Error % Function", SIAM J. Numer. Anal., Vol. 31, pp. 1497-1518 (1994) % % computes w(z) = exp(-z^2...
1f56dd841cac40fdae5bc09f3e174c124323d06c1674b884743d3665cdd9385a
MATLAB
1,204
32
function PhotodiodeMarker(win,seton) % PhotodiodeMarker(win,seton) % % Simple helper function that sets up bottom-right corner of window (win) % to activate a photodiode. This function should be the last command % called just before 'flipping' so it is on top. % % If seton is true, then the bottom-right corner...
ec12f0a85155b3ddaad94ecfefc2fac16ad3a43b89076e608f7859eb12d749bd
MATLAB
1,205
37
function out=TPPreviewImageFunctionListGetCache(filename) % TPPREVIEWIMAGEFUNCTIONLISTGETCACHE - Get preview image parameters to the cache % % OUT=TPPREVIEWIMAGEFUNCTIONLISTGETCACHE(FILENAME) % % Gets the TPPreviewImageFunctionList data from the TPPreviewImageCache global variable for the % filename FILENAME. If tha...
9146ad502b4cc53c1e86a32e99792eca5e2f1e0e33228150310b1a802d281de9
MATLAB
1,206
38
function Xhat = decode_LDA(cfg0, decoder, Y) % [Xhat] = decode_LDA(cfg, decoder, Y) % Decodes data using a linear discriminant analysis decoder as obtained from % an appropriate training function, e.g. train_LDA. % % decoder The decoder as obtained from an appropriate training function. % % Y ...
7eb5f1307a745296ad8d045226b88bc6268b67667191e1896a33b84f38aa087d
MATLAB
1,209
33
% Package GMLM_dmc for dimensionality reduction of neural data. % % References % Kenneth Latimer & David Freeedman (2021). Low-dimensional encoding of % decisions in parietal cortex reflects long-term training history. % bioRxiv % % Copyright (c) 2021 Kenneth Latimer % % This software is distributed unde...
ee3d4bb420a5e8207c4ed8f62cc83a23b67131337e5be9b634082c78d75644a8
MATLAB
1,211
47
function r = DB_AddResearcher(conn) myms(['CREATE TABLE IF NOT EXISTS db_util.researchers (' ... 'initials VARCHAR(3) NOT NULL, ', ... 'researcher VARCHAR(45) NOT NULL, ', ... 'email VARCHAR(45) NULL, ', ... 'UNIQUE INDEX initials_UNIQUE (initials ASC), ', ... 'PRIMARY KEY (re...
78e431eb2f27166631c471c1a63ac96fc9744649a7f15b531d59a3eb8abba3dd
MATLAB
1,212
33
function [newtimes,frame2dirnum] = tpcorrecttptimes(params, dirname) % TPCORRECTTPTIMES - Corrects time for twophoton files % (This is the Generic version, so it just returns the 2P parameter times) % % [FRAMETIMES,FRAME2DIRNUM] = ... % TPCORRECTTPTIMES({PARAMSTRUCT}, DIRNAME) % % PARAMSTRUCT should be a cel...
9e58b2e8ccad742ed8813512f2989f4efa597c588cd03034de3505a6aaf5b606
MATLAB
1,212
35
% defualt params and upper/lower bounds for the Liley model param.he_rest = -70; param.hi_rest = -70; param.Nee_beta = 4000; param.Nei_beta = 3034; param.Nie_beta = 536; param.Nii_beta = 536; param.Gamma_e = 0.4; param.Gamma_i = 0.8; param.gamma_e = 0.3; param.gamma_i = 0.065; param.Tau_e = 10; param.Tau_i...
a3e6a70a276398272601bc55212893acfe02a1c6163776b7a81f11422dbcc5a4
MATLAB
1,212
39
function self = GenerateClipPredictions(self) % Generate predicted labels for each clip if self.VerboseLevel > 0 fprintf('Generating clip predictions... ') end mbSize = self.ConfigFile.GetParams('PredictionMiniBatchSize'); seqT = SplitClipDataIntoSequences(self, self.ClipTable); features = TransposeCellArrayElem...
c5a5f60feff3ef12725962cadde9a2513df21d25b6eb2f6d73f7f18e9fdf2caa
MATLAB
1,212
42
function [N_points,v,N_faces,f,c,c2,Tpsi,DTpsi]=readelmer(name) fileID = fopen(name,'r'); %Read number of points format='%s %f %s'; data = textscan(fileID,format,1,'HeaderLines',4,'Delimiter',' ','CollectOutput',1); N_points=data{1,2}; %save points format=' %f %f %f'; data= textscan(fileID,format,N_points,'...
0be568d4aed74109aecfb75d421ba61bf81331183000f0cb5d6404faf4089e7e
MATLAB
1,213
37
%% clear all close all run(['..' filesep 'def_local']) addpath(path_fieldtrip) ft_defaults %% load wsws_badComps_train allfiles = {'405','406','407','408','409','410','411','412','413','414',... '415','416','417','418','419','420','421','422','423'}; for n=1:length(allfiles) %%% load training data & compo...
dba83e5c3d1ca949ff23d9fc420b3440ae2fd3ba8fa257bcc2b9134785b607b3
MATLAB
1,213
52
% Weighted clustering coefficient % Source: Barrat, The architecture of complex weighted networks % INPUTS: weighted adjacency matrix % OUTPUTs: vector of node weighted clustering coefficients % Other routines used: degrees.m, kneighbors.m function wC=weighted_clust_coeff(adj) deg=sum(adj); n=size(adj,1); % number o...
8e4ac102ddfcc442c91cfd4b7d193eb33d75130c49272ea1bc8ddc1e91ce1ecb
MATLAB
1,218
36
function t = bids_tsv_nan2na(t) % % function t = bids_tsv_nan2na(t) % % function replaces NaN in a table with n/a % % Tables entried may have NaN for missing values, but should be written as % a n/a in the bids .tsv file. Therefore, this function replaces all NaNs % in a table with n/a. % % % Dora Hermes, 2017 % get ...
763a2acac11d4d0d12ac6c2595abafbce7e00c3b08107f16a8f5d6a87e70c458
MATLAB
1,220
74
clear close all clc tic %% Parameters definition alpha = 1; %1; sigma = 1; dt = 0.2; W = load('W.dat'); N = sqrt(size(W,1)); %% Numerical integration of the dynamical equations T = 20000; % number of time points x = zeros(N^2,T); x(:,1) = randn(N^2,1)*dt; noise = randn(N^2,T); fo...
8572dcf2884b061d3d5781daec12655c92d7a52072802e23fe520d0e39ef696d
MATLAB
1,220
39
function [class_contribution,class_count,contribution]= triple_correlation_class_contributions_2D_periodic(arr, neuron_window, time_window) class_contribution = zeros(1,14); class_count = zeros(1,14); max_time_lag = ceil((time_window / 2)); [N_neurons, N_times] = size(arr); for n1 = -floor((ne...
97734999668ffb40df78a151a9e2a57b63b67769095350b7597e0c98a2dd6a0c
MATLAB
1,220
35
% Find handle graphics object with user data check. % Retrieves those handle graphics objects (HGOs) that have the specified % Tag property and whose UserData property satisfies the given predicate. % % Input arguments: % fcn: % a predicate (a function that returns a logical value) to test against % the HG...
28fbf0a02af8e40bb54fae515e5c7d27d3df1a9108706ea0009cd77a5aa7a28c
MATLAB
1,221
41
function [ IDs ] = ReadIDsFromFile( filename, endpoint ) %READLOCATIONSFROMFILE Read locations from a tab-delimited text file IDs = []; if ~exist(filename, 'file') disp(['Input file does not exist: ' filename]); return; end fileID = fopen(filename); %Figure out the directory th...
b2fb3e7dd91817bce0cb2b2615a4a32baea6efbc855ac148a6425e684e78844b
MATLAB
1,225
22
function cr = emptycellrec % ANALYZETPSTACK_EMPTYCELLREC - Return an empty cell record % % Returns a structure with the following fields (each empty, ready for filling): % % DIRNAME : The dirname where the cell was first identified % pixelinds : The pixelinds of the cell within...
dfe64296b1082518f49c376c2bc4c92744fe75d75b62004c454c1be46a9bf45d
MATLAB
1,227
53
function BEST = combineBESTbins(BEST,new_bins,new_labels) n_bins = length(new_bins); BEST.nbin = n_bins; BEST.bindesc = new_labels; BEST.original_bin = {}; %erase due to new BEST being combined new_binwise_data = struct(); n_trials_per_bin = NaN(1,numel(new_bins)); %% combine bins for b = 1:n_bins se...
fb82aed140c6a44056de3448abf76be1924e3ded749cc68507f2e2605ba70987
MATLAB
1,228
38
% Downsample signal by given factor by taking average of factor # of % neighboring samples % % Last update: October 24, 2018 (SL) function signals_downsampled = downsample_by_average(signals, downsample_factor) n_signals = size(signals,1); % Number of signals fed in argument n_samples = size(signals,2); ...
e5fc3954674d7fd194ff3a614f4a9a9300798b66583f1e57e8a182f57dd0677c
MATLAB
1,229
46
function varargout = TDT_BlockSelect(tank,varargin) % varargout = TDT_BlockSelect(tank,varargin) % % Optional Input Parameters: % 'SelectionMode' ... 'multiple' or 'single' (default) % 'Name' ... dialog title % 'OKString' % 'CancelString' % 'TankList' ... option...
7721929df2f5723d78459998ccd63667585a992417ded94dbb4346ce2538ef9a
MATLAB
1,231
41
function SaturMap = Saturation(X,gray) % Determines saturated pixels as those having a peak value (must be over % 250) and a neighboring pixel of equal value % X grayscale or color image with pixels in range 0-255 % SaturMap binary matrix, 0 - saturated pixels % gray in case of 'gray' saturated pixels in...
004f48711c0bb3f26dcef110b7eef5297002c9adb1ed3f453a14e9bc3ea13b9f
MATLAB
1,233
46
function [p alpha] = circ_vmpdf(alpha, thetahat, kappa) % [p alpha] = circ_vmpdf(alpha, w, p) % Computes the circular von Mises pdf with preferred direction thetahat % and concentration kappa at each of the angles in alpha % % The vmpdf is given by f(phi) = % (1/(2pi*I0(kappa))*exp(kappa*cos(phi-thetahat) % %...
54de89708e7c2bf60b43a4c3bc05c4b18b2ace564b29376e18bff79e348382c9
MATLAB
1,238
45
function [ VOrigin, VOne, VTwo ] = FindIntersectingEdges( TriDistToPlane, Epsilon ) %Figure out if we have two points above or below the plane Above = TriDistToPlane - Epsilon > 0; Below = TriDistToPlane + Epsilon < 0; Zero = abs(TriDistToPlane) <= Epsilon; if(sum(Above) > 1) VOrigin = find(...
3b5ab5afbf10c0536298c835d3581766eb2beee97f6b82257b746ee2df572340
MATLAB
1,241
38
function [dr] = driftcorrectls(orig_imag, linescanpoints, linescandata, searchX, searchY, brightnesscorrect); % driftcorrect -- the correction of the original image % driftcorrect_ls -- the correction of the line scans usemse = 1; imsize = size(orig_imag); imscan = NaN(length(searchX)*length(searchY)...
69c71aee9c23427b25924b3ff4f9a852278ac74a64027e217f462cf44d1ae5ac
MATLAB
1,242
49
function SetTwoPhotonConfiguration(platform, synchronization) % SETTWOPHOTONCONFIGURATION - Sets configuration for TWOPHOTON analysis % % SETTWOPHOTONCONFIGURATION(PLATFORM, SYNCHRONIZATION) % % Sets the 2-photon configuration, so the system knows what % microscope and synchronization method the user is using. % % ...
55068dccf9e178294ee310f562562678965971a5c04baee216c7891ea83ed281
MATLAB
1,245
41
function fnames = load_stl(model, object) arguments model (1,1) Model object (1,:) char end switch object case 'epi' fnames = load_or_export(model, model.paths.epi, 'epineurium', false); case 'endo' fnames = load_or_export(model, model.paths.endo, 'endoneurium', true); case...
41df94b4f9a7eb12cb8ee13e20d32998950957a46f09919bb70d4388ef9d874d
MATLAB
1,246
47
function [delays,valAtDelay, valAt0] = plotCrossCorrelogram(xc,lags) nMice = numel(xc); % get the average across mice--interpolate in case not all the same time % bins? % take the first one as reference delays = nan(1,nMice); valAtDelay = nan(1,nMice); valAt0 = nan(1,nMice); lagsRef = ...
4dab6f6fdb12abf954d47813a6c5a6318666063cd3c75298e67b2712499740a0
MATLAB
1,247
54
function out = analyzetpstack_drift_devs_menu(command, uihandle, inputs) out = []; switch lower(command), case 'init', dd = analyzetpstack_drift_devices('Get'); ad = analyzetpstack_active_drift_devices('Get'); ud = {[] [] []}; str = {'Drift Correction','Update this list','-----'}; ud{end+1} = []; str...
249b706095b9b7971abebe6b46653ae812cae5cc5c73ac336fee72b7ddf8415d
MATLAB
1,248
46
%% Modify Atlas to place space between ROIs to avoid partial volume effects scaleFactor = 2; Patlas = 'D:\ownCloud\PROJECTS\MRI\TPM_Catlas_Slicer4\CombinedAreas.nii'; Vatlas = spm_vol(Patlas); Yatlas = uint8(spm_read_vols(Vatlas)); fprintf('Upsampling volume...') [Xq,Yq,Zq] = meshgrid(1:1/scaleFactor:size(Yatlas,1),...
4c0f9b2dd0e248b4acf7374be75fedba92f99016957af8eff682130a45a5f3d1
MATLAB
1,248
51
function [delayEmbeddedData, embeddedTime] = delayEmbed(data, numDelays, deltaT, useDerivatives, dontFlip) if ~exist('useDerivatives') || isempty(useDerivatives) useDerivatives = 1; end if ~exist('dontFlip') || isempty(dontFlip) dontFlip = 0; end if numDelays == 0 || deltaT...
cd4570c527f964048ceaf7d1af60ab8ea08e4358c99a59f16fe6b5b2929f76fc
MATLAB
1,248
52
function func_SaveModels(Parm) % Save model files to folder: DeepInsight3D_pkg/Models/... model = load('model.mat') netName = Parm.NetName; cd DeepResults net = load(model.fileName); cd ../ FileRun = Parm.FileRun; Stages = Parm.Stage; Ask = Parm.SaveModels; if strcmp(Parm.PATH{1}(end),'/')==0 Parm.PATH{1} = [...
12f58453b665a5cf15a1b1e37c9746aebbe560601031f20390d0403ed0d176f7
MATLAB
1,249
47
function embed = doDiffusionMap(W,n_template,n_components) fprintf('- diffusion map embedding\n') alpha = 0.5; diffusion_time = 1; n = size(W,1); fprintf('- normalize\n') d_alpha = spdiags(sum(W,2).^-alpha, 0, speye(n)); L_alpha = d_alpha * W * d_alpha; fprintf('- laplacian\n') d_alpha = spdiags(sum(L_...
296f1b861096b756a6293c865f0d9f4b38a039edf61a2084d160b7c953550cd2
MATLAB
1,249
27
function [Subject_Details_subset]=Select_cohort_subset(Subject_Details,AnalParams) % From a full cohort of data, selects a subset of data with the same number of datasets per age bin % % INPUTS: % - Subject_Details: structure of demographic information for the analysis cohort % - AnalParams: structure con...
8ddfa615f6546c1d9813b6bd6e3b803c62610d6776039142045c465ada3e3b1f
MATLAB
1,249
38
function data = ecog_notch(data,srate,notch_freq) % data = ecog_notch(data,srate) % notch filter data around 60Hz, 120Hz and 180Hz % data is time X electrodes % % DH 2018 if notch_freq==60 % 5th order butterworth notch filter, [low/(samplerate/2) high/(samplerate/2)] [n1_b, n1_a]=butter(5,2*[59 61]/srate,'st...
ac460d27cb0b3f17a78766b81fd5562d19e764413c750c81413e269108813268
MATLAB
1,252
42
function [ scale ] = FetchScale(Server, Port, Database) %FetchData - Collect scale from a database. Returns struct % with XScale, XUnits, ..., ZUnits fields javaaddpath('.\sqljdbc4.jar'); ConnString = ['jdbc:sqlserver://' Server ':' num2str(Port) ';database=' Database]; disp(['Connection string: ' C...
4833303fd14a277eb442fe2d2524099761acbb1a58b1f2c37571216be1e9dcc6
MATLAB
1,253
31
function [pe_results] = create_peInput(input_data, timestamps, input_window, framerate) % Reformats input_data data to make compatible with pe_Plot class (object) handle % Splits up full traces into peri-event sweeps. Each sweep contains the % flourescence values within the given time-window (-window through +windo...
6550522fdffeb9e8f69bd055ff22ef50ff47b5c2b147e7bbeff0aedb4ecdf657
MATLAB
1,253
54
function celllist = analyzetpstack_draw_devs_menu(command, uihandle, inputs) celllist = []; switch lower(command), case 'init', dd = analyzetpstack_draw_devices('Get'); ad = analyzetpstack_active_draw_devices('Get'); ud = {[] [] []}; str = {'Autodraw/import cells','Update this list','-----'}; ud{end+1}...
f7f67972d25001c987bd3a56a2250b9af261b4aadb947059954637cd68f7be8e
MATLAB
1,254
41
function [ algs ] = solver_list(category) % Return list of solvers. % % Inputs: % category category to be returned. % Output: % algs list of solvers in the category % % This file is part of SparseGDLibrary. % % Created by H.Kasai on Apr. 25, 2017 % supported algorithms by SparseGDLibrary ...
d3b7ee36f2b13fb3f75a4c87acec7181acf9490ed708b5d73d13e5fc65467e99
MATLAB
1,255
42
function tpexper2text(expername) % TPEXPER2TEXT - Convert raw output of 2-photon experiment to text % % TPEXPER2TEXT(EXPERNAME) % % Convert all analzed raw data to text format, where EXPERNAME is the % name of the experiment directory to be converted. % % The data must first have been analyzed with analyzetpstack...
489890f4fd1ef47f1cc85dd83d29879a2a69ae733149d1f4d9c8c22822bf47fb
MATLAB
1,256
51
%% 4A Clean up mask P = spm_select(1,'image','Select T1...'); if isempty(P), return; end Pm = spm_select(1,'image','Select Mask...',{},fullfile(fileparts(P),'VOI')); Po = MySPM_BatchMasking2(P,Pm); % Try to do some additional cleanup on the mask V = spm_vol(char(Po)); Y = spm_read_vols(V); Yf = logical(entropyfilt(...
cc1467e225be99654c8feff2dc9d87ea3de0d10b2361fe85a6dfd940280d63da
MATLAB
1,256
41
function [hr,pval,CI] = SStat_HR(x1,x2,stats) % [hr,pval,CI] = SStat_HR(x1,x2,stats) % % Hazard ratio estimate for Cox models. % % Input % % x1: Row vector with the covariate values for the first group. % x2: Row vector with the covariate values for the second group. % stats: Structure containing statistiscs obtained w...
3e03435a0b48c3fd157c0ac3fa753496d8c48efd3eb81a765611e8858d77d05a
MATLAB
1,261
40
function [ hubresil, hubresilarea, resiljac, resilvar, orighub ] = ... hub_resilience(mat,distmat,hubmethod,Nreps) % the probability that hubs remain after 100% rewire n = size(mat,1) ; % enfore und mat = (mat + mat') ./ 2 ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % original h...
dae004ea89f5181f22af5627945b459b4d1c1cb58b8693a4d73b3fc5591f53ec
MATLAB
1,261
48
% 5. Use Coregistration of masked T1 to Template brain to finish reorientation P = spm_select(1,'image','Select masked T1...',{},pwd,'^m.*'); fprintf(2,'***** ENSURE THE ORIGIN OF THE IMAGE IS NEAR ANTERIOR COMMISURE **********\n') fprintf(2,'***** IF THE T1 NEEDS ADJUSTMENT, THEN BE SURE TO APPLY REORIENTATION T...
e6f14f2ce4b990ea9d0e961aac95520b854ebb0c2f94a40a4c3634d9e491357c
MATLAB
1,261
38
function Spikes = pp_save_manual_sort(Pname,subject,session,Spikes,channel,spikes ) % % pp_save_manual_sort( subject, session, Spikes, channel, spikes ) % Incorporates the manual changes from splitmerge tool into the Spikes % struct, changes flag to indicate channel has been sorted, and saves % the updated f...
9c74c5478da934c736031b78de56a410e281cdf9651387229a20b92f5f002a93
MATLAB
1,263
51
%% Extract LFP signal % Filter continuously sampled data for low-frequency LFPs and downsample % % Filter properties: Bandpass [1 200] Hz % Downsample from raw data rate (~25 kHz) to ~1000 Hz % % DJS 5/2016 tank = 'D:\Data Tanks\CHRONIC_EPHYS_TANKS\HANSOLO_20160426'; blocks = TDT2mat(tank); plxdir = 'D:\DataProcessi...
c906e8940f9289d28271c4f6cd1d745e7d40a940500152d9808b2521d6118a02
MATLAB
1,263
50
function [Exist,ExistIndex] = f_existvector(TotalVector,SmallVector) Exist = 0;%%1.There exists some elements in SmallVector which donot belong to TotalVector. ExistIndex = []; if nargin < 1 help f_existvector return; end if nargin < 2 msgboxText = ['There should be two inputs']; error('prog:inpu...
0c5b14e8f36749ffad1c387952214d62c56f1221499957f58bb86d892e23aecf
MATLAB
1,267
25
function [x,y] = findintersection(L1,L2) % findintersection is a function for finding the intersection point of two lines (vectors) % Inputs into this function are coordinates of two lines (vectors) % Line1 = [(x11,y11);(x12,y12)] and line2=[(x21,y21);(x22,y22)] % Example1 [xintersect yintersect] = findintersecti...
bd065108e32b209bf6a3ffb641467773bda9563f9368b36e16f99ea714e620d4
MATLAB
1,267
67
classdef visedconfig_obj properties %vised options pop_gui='on' data_type='' chan_index=[] event_type={} winrej_marks_labels={} quick_evtmk='' quick_evtrm='off' quick_chanflag='off' chan_marks_struct=[] ...
687515770d977f3c76bde3aeefee66f2f9ce45fca20829d29520381a7cf81539
MATLAB
1,271
34
function [results] = scaleDWB3(results, params, couplingGroup, precomputedPortion) % i.i.d non-mean Gaussian over spike history coefficients & constant K = size(params.B,1); if(~isempty(results.dW) && isfield(results, "dH") && ~isempty(results.dH)) w_mu_idx = 1; dW = double(results.dW); results.dH(w_m...
7262af8dbc0eacba5865c5e5b9a81f60515cc3526e056feeab5ac1dbf02f782a
MATLAB
1,271
39
%this is a program that generates trial averages and forms clusters based %on that/Select folder TwoEyeAnalysis/ISI20/LXLXCXCX. Created by Haleh Fotowat. close all clearvars path=uigetdir; cd(path) %read the pooled clustering data load('LXLXCXCX_HA.mat') stim_type_cnt=4; repse=10; per2p=1.06295; ISI=20; f0=round(ISI/(...
d753f96661fc623fd6200da77de4e51cd505fea38a24b5aa4ce0b2afe322b6c7
MATLAB
1,271
49
function estudio_warning(Messagestr,titleName) if nargin<1 help estudio_warning return end if nargin<2 titleName = ''; end if isempty(Messagestr) help estudio_warning return end FontSizeDefault = f_get_default_fontsize(); try [version reldate,ColorB_def,ColorF_def,errorColorF_def] = geter...
4c73688b88a98a3a0f33f4862571ba22e5af781f96a9d4d9daa90064e2136264
MATLAB
1,272
73
%% Noise-Flash Temporal Slewing % % Daniel.Stolzberg@gmail.com 2016 sca FlashDur = 0.1; % flash duration (seconds) ITI = 2; % inter-trigger interval (seconds) FlashOnColor = 1; % flash intensity [0 1] FlashOffColor = 0; % flash intensity [0 1] NFlashes = 425; % number of flashes FlashDelay ...
43fcbdaafe9053c191bcd9cc40a8a9d7a1a7825560d20f7c83b3aef506f63991
MATLAB
1,273
36
function reassignments = sort_assignments(assignments) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/08/2010 % % sort_assignments - renumber cluster identities based on size of cluster % % Usage: % reassignments = sort_assignments(assignments) % % Description: % Takes a list of assignment numbers an...
1448d3b28cc1f5240ebf5ef6968859e108e52a7af744603108e4450a5dd6d6d9
MATLAB
1,275
56
function calculateHoldTimes % % This function selects the hold time from a range of possible times % % Required gf parameters: % holdMin % holdMax % holdSteps % holdIndii % % Parameters generated: % holdRange % holdInd % holdTime % holdSamples global gf % Linerarly spaced array of times from min to m...
dff8e0ae6fd7209855eda8781d2dfad4bc1dde9de34da5c10d6d8862a4883fd3
MATLAB
1,275
53
% STRAIGHT LINE DEVIATION function sld = straightLineDeviation(subject,trial,dataType) if dataType==0 global blacklist filtered time MVCs; elseif dataType==1 global blacklistLeft filteredLeft timeLeft MVCsLeft; blacklist = blacklistLeft; filtered = filteredLeft; time = timeLeft; MVCs = MVCsLeft...
74db380b67e993fef95a69897ba6e371f6c0c515fdcd9353b68640e6ddeacc87
MATLAB
1,276
40
function DA = TDT_SetupDA(varargin) % DA = TDT_SetupDA(tank); % DA = TDT_SetupDA(tank,server); % % The TDT TDevAcc activex control is used to interface with running OpenEx % % Initialize TDT TDevAcc activex control in invisible window and return % handle to control (DA), registered tanks, and a handle to the i...
2370c4dfe62b9e10a27f449f052b891f67b3703d47d0a8c5f84bab6999b40f1d
MATLAB
1,277
37
classdef CrossEntropyRegression < nnet.layer.RegressionLayer properties % Vector of weights corresponding to the classes in the training % data ClassWeights end methods function layer = CrossEntropyRegression(name, classWeights) layer.Name = name...
3018546cf7ef9163dd14ee9dc695e13b8b4fbe9636f3d86cf35ad8309a7bd010
MATLAB
1,277
70
% FORMAT: % % sampval = sample_to_ms(timesam, fs,EpochStart, rounding) % % INPUTS: % % timesam - time value in time samples % fs - sampling rate (in Hz) % % % Optional inputs: % % rounding - 1 means round the result {default}, 0 means do not round % EpochStart - the left interval of epoch/...
961ddc6915e60de77a11c4563ebd83572b10024d90a254b9b6868b38d4d39229
MATLAB
1,277
39
function fs_write_fstats(fstats,mri,fname,data_type) % fs_write_fstats(fstats,mri,fname,data_type) % % Writes F-statistic or p-value or Freesurfer significance maps to Freesurfer's % .mgh or .mgz data file. This can be useful for visualization and post-processing % in Freesurfer. % % Input % fstats: Structure obtai...
bea50f73e8647c8285e56fcfdba3e17b88784865817743532782edbb14de9794
MATLAB
1,277
52
%% Update Bits# mode s1 = serial('COM5'); fopen(s1); fprintf(s1,['#monoPlusPlus' 13]); fclose(s1); delete(s1); clear s1 %% PsychImaging('PrepareConfiguration'); PsychImaging('AddTask', 'General', 'FloatPoint32BitIfPossible'); PsychImaging('AddTask', 'General', 'EnableBits++Mono++Output'); % PsychImaging('AddTask', ...
a20607fc1d27a129350ee6e74f385aff4203ee7bba7d60b1215dd327ae103525
MATLAB
1,279
42
function Q = StructureMeasure(prediction,GT) % StructureMeasure computes the similarity between the foreground map and % ground truth(as proposed in "Structure-measure: A new way to evaluate % foreground maps" [Deng-Ping Fan et. al - ICCV 2017]) % Usage: % Q = StructureMeasure(prediction,GT) % Input: % prediction -...
c45e80afc5981cd30d59be232704d685e5661c811415c78ef874c94f4fdb15ee
MATLAB
1,280
48
function m = dist_mean(val, pgrid, doWarning) % Compute the mean (m) of a probability distribution (val) over a discrete % grid (pgrid). % % Usage: % m = dist_mean(val, pgrid, doWarning) % % NB: doWarning: 1 allow a warning message on whether the distribution is % normalized to sum to 1 (default: 0) % % Copyright ...
df96419603bf25c33a0fb8f4f66eb71fa9cb4eb5e2ce29d92fe661c675c04739
MATLAB
1,282
45
function annotT = BehaviorArrayToCategorical(annotT) % If input is a single array if any(strcmpi('Frame', annotT.Properties.VariableNames)) annotT = SingleArrayToCategorical(annotT); % If input is a table of clips else initCatBehav = cell(size(annotT, 1), 1); if any(strcmp('Labels', annotT.Properties....
2774bc4ebbd078b51b370cb84a5333b07a95047160eb0ec7014a217cb0a1b6c0
MATLAB
1,284
52
%===================================================== % FileName: extract_bin_image.m % Designby: Zhe % Modified: 11/4/2021 % Describe: Extract all frames of images from TIFF and store in image.bin %========================================================================== clear variables; file_path = "/media/blairl...
50a39e2de78ecf9d6604cc78cd1b1180f78aed2227478b4f8ce59030225ee015
MATLAB
1,284
50
function [Q]= original_WFb(FG,GT) % WFb Compute the Weighted F-beta measure (as proposed in "How to Evaluate % Foreground Maps?" [Margolin et. al - CVPR'14]) % Usage: % Q = FbW(FG,GT) % Input: % FG - Binary/Non binary foreground map with values in the range [0 1]. Type: double. % GT - Binary ground truth. Type: log...
e9f3d9aa0d2d943ad327f0e3fd51ce9c4764a0bf0362ec28e5d7394bb74d4a87
MATLAB
1,285
45
%% Master Script for Vector Strength plots clear all clc root = 'C:\Data\Daniela\ACV_Water\PCF_Males_TP2\'; dirAnaly = 'C:\Data\Daniela\ACV_Water\PCF_Males_TP2\angHeadCircAnaly\'; % where to save the analyzed data dirAng = [root 'vid_Angles\']; % Select and parse video files [files, dirAng] = uig...
f960e2f2dcc484238bb0f4be349294005df909712d633dc13ac58612423731c2
MATLAB
1,287
36
function params=tpreadconfig( tpdirname ) %TPREADCONFIG read twophoton experiment config file % % PARAMS = TPREADCONFIG(TPDIRNAME) % % Reads the parameters from the 2-photon data directory % TPDIRNAME. TPDIRNAME should be a full path to the 2-photon directory. % % Output: % PARAMS.Main.Total_cycles (total number of ...
43ba6a46013589dedbf26895befe50e6697f431c4454adb904378f1bb007e0b1
MATLAB
1,288
47
function [c,p] = plotVersus(acc1,acc2,sideTrans,chancelevel,pltMdl,l,inSbplt) if ~exist('pltMdl','var') pltMdl = 0; end if ~exist('l','var') l = [5 max(ceil(max([acc1(:); acc2(:)])/5)*5,30)]; end if ~exist('inSbplt','var') inSbplt = 0; end if ~inSbplt ...
89a643fc066bd15ae431a4d8913d0f36581445e00cccdd617f4998effa5ad94e
MATLAB
1,289
58
function JS = f_JS_discr(aij,bij,nbins) % https://github.com/aiavenak/matlab_code/blob/master/f_JS_discr.m [d1,d2] = size(aij); [b1,b2] = size(bij); if (d1 == d2) && (b1 == b2) % aij, bij are adyacency matrices % get laplacian and eigenvalues vaij = f_get_spectrum_lap(aij); vbij = f_get_spectrum_lap(bi...
b5c65d7afbe9c6200ff1fde361706d197019339bf9049ca5214654a178dcefeb
MATLAB
1,289
43
function [fitresult, gof] = createFit_fcsc_LAR(sc_avg_vec_sort, fc_avg_vec_sort, is_figures) %NOTE: Power2. Levenbrg algorithm. LAR %CREATEFIT(SC_AVG_VEC_SORT,FC_AVG_VEC_SORT) % Create a fit. % % Data for 'untitled fit 1' fit: % X Input : sc_avg_vec_sort % Y Output: fc_avg_vec_sort % Output: % fitre...
87d8484cd2f210af1330acbcee521ce6f4700df62d07caa7d4a02d885a4059c0
MATLAB
1,290
61
%% Open DB_Browser GUI to retrieve selected database ids DB_Browser; %% Returns structure with database IDs currently selected in DB_Browser GUI ids = getpref('DB_BROWSER_SELECTION'); %% Retrieve raw spike times from onset of recording block spiketimes = DB_GetSpiketimes(ids.units); %% R...
aac2d010af57765e239f8fa66b6e8fa6112dedc85c0d4dab7362c1587828bb84
MATLAB
1,291
63
% fresh start clearvars close all %% run config config_file='config_mammals_1.m'; addpath(strcat(pwd,'/config')) run(config_file); %% load up filename = [ DD_PROC '/MamiNum_corrected_proc.txt' ] ; ssheet = readtable(filename,'Delimiter','\t') ; %% species_names = readtable([ DD_RAW '/mami_species_names_v1.csv'],...
c838c44208c686a9231f339837c29978a6e17ac1a7766f39947261772bdd4782
MATLAB
1,291
49
function [tanks,islegacy] = CheckForTanks(parentdir) % tanks = CheckForTanks(parentdir) % [tanks,islegacy] = CheckForTanks(parentdir) % % Check some directory (parentdir) for TDT tanks % % islegacy can be returned as a logical vector the same size as tanks % indicating whether or not the tank is actually a lega...
5fcf697003b7c7d321ae63038f0d003997739507e288981218e6618114c59164
MATLAB
1,292
40
classdef CrossPlotProps < matlab.mixin.SetGet properties logScale logical = false; mode char = 'scatter'; % scatter, trisurf, griddata, or circles shading char = 'interp'; % flat or interp, used only for trisurf resolution (1,1) double = 10; % [um], only for griddata mode ...
1544815f18ca105eeb7f0fff9674ba141107c74049b28e2a135b67bb3988ee0c
MATLAB
1,294
47
function lme_timePlot(time,y,ni,subjs) % lme_timePlot(time,y,ni,subjs) % % Spaghetti time plot of longitudinal data. % % Input % time: Time covariate. % y: Ordered data vector (according to time for each subject). % ni: Vector whose entries are the number of repeated measures for each % subject in the study (ordered ac...
9e9b6ba15bbe2bedcf38bd197613e996dc78fa163bd7a92f0c6156e003136b30
MATLAB
1,295
68
function [t,n,b]=frame(x,y,z,vec) % FRAME Calculate a Frenet-like frame for a polygonal space curve % [t,n,b]=frame(x,y,z,v) returns the tangent unit vector, a normal % and a binormal of the space curve x,y,z. The curve may be a row or % column vector, the frame vectors are each row vectors. % % This function calcula...
00aedd5dc9a7b36c7a643c11aa37a45296bcb62dd424da0b9bd9756166961d2f
MATLAB
1,297
35
function plotPerformance_SpatialMask_SNR_cdf [dataDir, options, c, d] = import_settings() % For each ferret files = dir( fullfile(dataDir,'*.mat')); for i = 1 : numel(files) [COctrl, COcool, SPctrl, SPcool, SOctrl, SOcool] = import_data(dataDir, files(i).name); sp = create_figure...
6739d50ea748904e37ba305a4461faaf16c315db3512353bd5d4341eb49c0fa8
MATLAB
1,301
47
clc; clear; close all Fig3b = figure(); Ntrials_2 = 10000; %Ntrials_2: number of learning cycles to learn the background containing the embedded pattern (step 2). xax=(1:1:Ntrials_2); N_mu=500; %There are \mu independent embedded patterns, 500 simulations (number of simulations) %%%%%%%%%%%%%%%%%%%%%%%%%...
713d08c652605dfd2e17016cb7f7a77d2fbf4a7d30887843f2b5630b680f6651
MATLAB
1,301
59
function [outVec, outVec2] = parcellate_lab(dat,labVec,labs,funcopt) if length(dat) ~= length(labVec) error('data and label need to be same length') end if nargin < 3 labs = unique(labVec) ; end if nargin < 4 funcopt = 'mean' ; end % ensure column if ~iscolumn(dat) || ~iscolumn(labVec) || ~iscolumn(la...
8fe239c3fd2a9725292279ff0475d807c6706b2a225f0f9190dd448e40cdd559
MATLAB
1,306
49
function clipT = CollapseSequencesIntoClips(seqT) clipNos = unique(seqT.ClipNumber); clipT = table; for i = 1:length(clipNos) currClipNo = clipNos(i); currSeqT = seqT(seqT.ClipNumber == currClipNo,:); varNames = currSeqT.Properties.VariableNames; currClipT = table; for j = 1:length(varNa...