sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8d7afd9dbaff6aac3194d8788cffdd8422ca89a9a0d43f4fac166520f4f07a86
MATLAB
642
27
function [Dmat] = JaccardDist_2(M1,M2) N1 = size(M1,2); N2 = size(M2,2); % M1 = sparse(reshape(M1,[],N1)); % M2 = sparse(reshape(M2,[],N2)); % A1 = M1'*M1; a1 = repmat(diag(A1),1,N2); % A2 = M2'*M2; a2 = repmat(diag(A2)',N1,1); a1=repmat(sum(M1,1)',1,N2); a2=repmat(sum(M2,1),N1,1); intersectMat = M1'*M2; unionMat =...
b7e25a257cca93e9dd104604c6dcd80f6d5c353e50d426d393f352f4be304c6f
MATLAB
642
26
function [] = om_save_tri(filename,points,faces,nrmls) % OM_SAVE_TRI Save .tri file % % SYNTAX % [] = OM_SAVE_TRI(FILENAME,POINTS,FACES,NORMALS) % % Created by Alexandre Gramfort on 2008-03-09. % Copyright (c) 2007 Alexandre Gramfort. All rights reserved. if nargin<4 || isempty(nrmls) nrmls = om_nor...
e615a8614c6f2939ad912440ae7dc6cdd765d95369d169fa60d9f5c05aa19136
MATLAB
642
17
function [task myscreen] = mglEyelinkCallbackStartSegment(task, myscreen) % mglEyelinkCallbackStartSegment - % % Usage: mglEyelinkCallbackStartSegment(task, myscreen) % program: mglEyelinkCallbackStartSegment.m % by: eric dewitt % date: 04/03/06 % copyright: (c) 2009,2006 Eric DeWitt, Justin Gard...
a98fd3f0a8bcf83ca64fcaddbdcf2baefaeb2762c43d01dea07400b02c17b908
MATLAB
643
26
function mask_data=load_mask_from_ds_info(mask_data_info, img_idx) mask_file=mask_data_info.mask_files{img_idx}; assert(~isempty(mask_file)); one_data_dir_idx=mask_data_info.data_dir_idxes_mask(img_idx); one_data_dir=mask_data_info.data_dirs{one_data_dir_idx}; full_mask_file=fullfile(o...
40cb655b4d6ca9e6829dfadd74b01c4435f2534a11d368f99b69baf0094526ca
MATLAB
645
15
% mglEyelinkIsConnected - Checks the connection to the EyeLink computer. % % program: mglEyelinkIsConnected.m % by: Christopher Broussard % date: 01/22/10 % copyright: (c) 2009,2006 Eric DeWitt, Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Checks the connection to the EyeLink ...
872b3829b004eefc21a487c227f749a7ba2d72468b96310030f25bff1e65f91e
MATLAB
645
22
function [finalImage, infoImage] = tifread(fileTif,subImages) %Tifread - FileTif is a string specifying file location, %subimages is len2 vector specifying start and end images (default all) infoImage=imfinfo(fileTif); mImage=infoImage(1).Width; nImage=infoImage(1).Height; if nargin < 2 subImages = [1 length(infoIm...
8a0ea1540e76caec6e2a7a34aadd2ee9e96cd538e61f8f54cc67a690e6a4927a
MATLAB
645
21
function [ROI] = createROI(roi_width, roi_height) %CREATEROI Generates a Nx2 matrix of perimeter points of the ROI % This function facilitates making a rectangular ROI. Bottom left corner % of ROI is 0,0. If only one input is provided, then a square ROI is % generated. Values are in mm. switch nargin case ...
a43bb7ffc8d122a072ec89dae8818f5a7846e51dfcd8e134234152c9fee43052
MATLAB
645
15
function [cellRegisteredStruct] = ml_cai_io_load_cellregisteredstruct(cellRegFolder) % This loads a file starting with 'cellRegistered' that is created by % the CellReg MATLAB code. If there is more than one such file in the % folder, an error is created. fileList = dir(fullfile(cellRegFolder, 'cel...
751a9b68141a10f119904d92d4aaa1c690de987e50b1773c7a3a6945db3fa9ff
MATLAB
647
16
function filterdata=filter_param(data,low,high,sampleRate,filterorder) % Filter data % Input£º % data the raw EEG data to be filtered % low High pass filtering parameter settings % high Low pass filtering parameter settings % sampleRate the sampling f...
40fd516263e264b1709168aa1f0f87dfb736cb7cacc35790bd7a29b1b6931569
MATLAB
648
29
function totFreq = computeFrequencyGaborArray(gaborBank, plotta) %init gb_ex = gaborBank(end).even; totFreq = zeros(size(gb_ex,1), size(gb_ex,2)); %compute spectrum of each filter %all frequencies covered by fixed gabor bank for v = 1 : numel(gaborBank) gbResize = imresize(gaborBank(v).even, [size(gb_ex,1) s...
52b93e9632f7d91a561b108180a3da918c84a03cd9aa2e915b3a458e4d7089a4
MATLAB
648
29
function [goodCycles, goodCS, z] = t2t_NOcsNOcs(csTimes, cycleMat_cs, z) %% Find Good Cycles/Trials % Condition 1: NO cs in 0-1000ms z.csWindow_bad = 1:(z.sr_e * 1); conds(:,1) = ~any(cycleMat_cs(:,z.csWindow_bad),2); % Condition 2: NO cs in 0-1000ms of next cycle conds(:,2) = [conds(2:end,1); 0]; disp(find(~any(~c...
56bcb33a9c1e84338108a0d1ad0d2b94b46f1b348ebf6e865cfa7c50301d40a5
MATLAB
648
27
% % Compute the Kolmogorov--Smirnov distance between a given sample and % a given continuous distribution. % % PARAMETERS % x (n*1) The sample % F @(x)(P(<=x)) The cumulative distribution function; % this function must take as input a vector of values, % and return a vector of the same size containing, for % each x...
a61e3e5973ecc7c751e2a2c0c41b4c408a53b8249b8f98d35794c5059b5b91c9
MATLAB
648
16
function [ ] = bemf1_graphics_coil_wire(strcoil, color) % Coil 2D/3D plot with several options % type = 0 for a 3D plot % type = 1 for a planar plot in the coronal plane (XZ) % type = 2 for a planar plot in the sagittal plane(YZ) % type = 3 for a planar plot in the transverse plane(XY) % color = 'g': ...
b48d7ad67cf6ff0b9c91a1b30b0592152ebebf30f23dfa93c4d6e1e0aac74515
MATLAB
648
22
function sorted_path=sort_RS_GUI_environments(defined_path) path_contents=dir(defined_path); nn=size(path_contents,1); ix_ls=zeros(nn,1); sorted_path=cell(nn,1); for ii=1:nn % filename=[path_contents(ii).folder filesep path_contents(ii).name]; filename=[path_contents(ii).name]; [restnumstarts,restnumends]...
3ca383a3b9d99a0bad3b8b5be473e0495408887a35c5711a23ae0d0bc1e0decf
MATLAB
649
11
function [personal_feat, enviro_feat, relative_feat, personal_units, enviro_units, relative_units] = flytracker_jaaba_features_and_units() % names of features to be computed personal_feat = {'vel','ang_vel','min_wing_ang','max_wing_ang',... 'mean_wing_length','axis_ratio','fg_body_ratio','c...
46acfc86fae7ed92bcf18a17cfe74d1b3b361e9eb0efa3e71a2302752d5d00be
MATLAB
649
20
%set the filename identifier Identifiers = {'AAzst1avir.N02.*.HEAD', 'AAzst1avir.N05.*.HEAD'}; %Modify here [err, ErrMessage, List] = zglobb (Identifiers); %loop across all Bricks found Nel = length(List); for (i=1:1:Nel), Input = List(i).name; fprintf(1,'\nNow processing: %s ...', Input); [ans, I_Prefix, View] = ...
6b3027da21a0a3776f98d9370b5276454194d1d05b9c2d7838d1bd13e3560218
MATLAB
650
18
function s = char(tree) % XMLTREE/CHAR Converter function from XMLTree to a description string % FORMAT s = char(tree) % % tree - XMLTree object % s - a description string of an XMLTree %__________________________________________________________________________ % % Return a string describing the XMLTree: % ...
b9f82e0833567a9655dbeb114eaf56c15e247bf114cb44a740063c7b0fee9915
MATLAB
650
22
function I = vl_imreadgray(file,varargin) % VL_IMREADGRAY Reads an image as gray-scale % I=VL_IMREADGRAY(FILE) reads the image from file FILE and converts the % result to a gray scale image (DOUBLE storage class ranging in % [0,1]). % % VL_IMREADGRAY(FILE,FMT) specifies the file format FMT (see IMREAD()). % % ...
f7575e39c31e5a9888b727329d6fed7354f2a3b27dd8956fcc3471e3eb20a9ab
MATLAB
650
20
function [task myscreen] = mglEyelinkCallbackTrialEnd(task, myscreen) % mglEyelinkCallbackTrialEnd - % % Usage: mglEyelinkCallbackTrialEnd(task, myscreen) % program: mglEyelinkCallbackTrialEnd.m % by: eric dewitt % date: 04/03/06 % copyright: (c) 2009,2006 Eric DeWitt, Justin Gardner, Jonas Larss...
390e50d6bb74334cf8528cac738f1a7b16c72051fdb0d966673f7a2258444fba
MATLAB
651
36
D = dir; numtests = 0; results = []; for di = 1:length(D) f = D(di); if f.isdir continue; end [pathstr,name,ext] = fileparts(f.name); if ~strcmp(ext,'.m') continue end; if strcmp('rtest_all.m', f.name) continue; end if strmatch('rtest',f.name) ...
8018151234b600f1881331c8962c89a141eaccbf61776183b80ec6b6783ba9b6
MATLAB
651
26
function [svec,dshuff,rpIx,isi] = shuffle_isi_delta(dvec) % shuffles the delta vec % zero regions pre-first/post-final spike left as is % 6/6/22 updating to < 2 (either 0 or 1 spk would crash otherwise) if nnz(dvec) < 2 svec = dvec; warning('< 2 spikes in delta vec, not shuffling') return; end ixSpk = fin...
2f655b9961d4a45b015cd6d4f6cf2d876866811eb7bd3760f8b048e41211f284
MATLAB
652
24
function [pth,nam,ext,num] = spm_fileparts(fname) % Like fileparts, but separates off a comma separated list at the end % FORMAT [pth,nam,ext,num] = spm_fileparts(fname) % fname - original filename % pth - path % nam - filename % ext - extension % num - comma separated list of values % %________________________...
9e1ed70f227df97f4d4a072775b2a62108cb46ebcd7dbc16ed1dafd8b7307d61
MATLAB
652
33
% % Analyse runtime. % % OUTPUT % dat/runtime % plot/runtime.eps % % INPUT % tmp.runtime % a = load('tmp.runtime') % regression c = [-log(a(:,1))] d = [ones(size(a,1),1) log(a(:,2) + a(:,3)) log(a(:,4)) log(a(:,2) .* a(:,3))] x = pinv(d) * c kp = exp(- d * x); [a(:,1) kp] % curve fitting b = [a(:,1) ((a(...
e2c5312a3f92f039250b7aff2d1b8afff21e3fed51a4e6041131f350934f449b
MATLAB
652
25
function Fimgdisp_all = computeAverageSpectrum(imagesCellTrain, plotta) %freq Fimgdisp_all = zeros(size(imagesCellTrain{1})); for l = 1 : numel(imagesCellTrain) img = imagesCellTrain{l}; % figure % imshow(img,[]); % title('Palm') Fimg = fft2...
486afb5c52222da7b8ab9b7d08f1f7a3634fa2fc37568b38e6a8a7827e6e56f0
MATLAB
653
26
function class_info=gen_class_info_cityscapes() class_info=[]; class_info.class_names={'road', 'sidewalk', 'building', 'wall', 'fence', 'pole', 'trafficlight',... 'trafficsign', 'vegetation', 'terrain', 'sky', 'person', 'rider', 'car', ... 'truck', 'bus', 'train', 'motorcycle', 'bicycle', 'void'}; class...
841a3ea6f5e1a14e19c6957def919732264e003687153cd2766b56f9b265b4d1
MATLAB
653
28
function diag_hist(X,max_val) a=max_val*sqrt(2)/2; b=a/sqrt(2)+0.005; % rotation matrix phi = -pi/4; R = [cos(phi),-sin(phi);sin(phi),cos(phi)]; h=histogram(X,-a:0.001:a,'Normalization','probability','Visible','off'); % rotate and traslate datapoints scaley=0.01; tmpy=reshape([h.Values*scaley;h.Values*scaley],[],1)...
cef55c5b125c26bf3dcfb84cbcd23e5a4e1f9163a9825828d39c497446caf745
MATLAB
653
47
clear; N=1000; k=35; p=4; xx = linspace(-1,1,100); yy = VMFMeanDirDensity(xx,k,p); yy = yy/sum(yy(:)); [t] = randVMFMeanDir(N, k, p); h=hist(t, xx); h = h/sum(h(:)); figure; plot(xx, h, 'b'); hold on; plot(xx,yy, 'r'); N=1000; k=5; p=4; xx = linspace(-1,1,100); yy = VMFMeanDirDensity(xx,k,p); yy = yy/sum(yy(:)); [...
67307ff2b20cdc574b751fd506ed2e57b7c6b1ada6b4a5c6f4dd42b66291eaaa
MATLAB
654
24
function fimg = smvfilter(img, radius) % spherical mean filter averaging on img, with % %% Author: Xu Li % Affiliation: Radiology @ JHU % Email address: xuli@mri.jhu.edu N = size(img); % spherical kernel kernelsize = 2*radius + 1; [x, y, z] = meshgrid(-radius:radius, -radius:radius, -radius:radius); kernel = sqrt((...
b2ab8a0a1a3824887302d980c369761167c97f3eb3625e9d926e457deec3e618
MATLAB
654
30
clear; mu = [0,0,1]; k=35; N=1000; [RandVMF] = randVMF(N, mu, k); figure; scatter3(RandVMF(:,1), RandVMF(:,2), RandVMF(:,3),3, 'b', 'filled'), axis([-1 1 -1 1 -1 1]); mu = [0,0,1]; k=500; N=1000; [RandVMF] = randVMF(N, mu, k); figure; scatter3(RandVMF(:,1), RandVMF(:,2), RandVMF(:,3),3, 'b', 'filled'), axis([-1 1 -1...
5fb7146bbdadf6bedd01a4c49a52db913a3895c4e33e3bb000eddebbc5b40aed
MATLAB
655
32
function b = subsref(ipd,index) % INPLACE/SUBSREF Support Matlab subscript references. % % This function supports subscript references just like Matlab matrices. % % Example: % ipa = inplace(cumsum(ones(5,1))); % ipa([2 4]) % ipa(3:end) if (length(index) > 1) error('Indexing operation not supported');...
df5fa34402869adbbe26b36f754592cf31a8747e7f12a27409bb8d88b27b0ef2
MATLAB
655
23
function code_name = problem_code_lookup(code) % looks up the problem given code switch code case 0 code_name = 'no error'; case 1 code_name = 'head/tail flip'; case 2 code_name = 'image score low'; case 3 code_name = 'centerline ou...
30f88c4b6159b0f26d3fb7ea053d80c4e2942059da981348ccd0dd6e28e36d84
MATLAB
656
15
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [T] = add_registered_cell_names_to_table(T, CellRegTable) % Add the registered cell names to each of the cells registeredCellNames = cell(size(T,1),1); for iRow = 1:size(T,1) cellName = T.cellName{iRow}; ...
52ceef31dd59d2b23214d178d56a263d39bcb347ef32a270160e6a3a36b5ea41
MATLAB
656
19
% mglDrawImage % % $Id: mglDrawImage.m % usage: mglDrawImage(pixelData, centerPx) % by: Christopher Broussard % date: 06/08/2008 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Mex function to take draw an RGB image. % % pixelData: A MxNx3 RGB m...
72f470cf069b8017f49d4aade5549e4dfaab296da6c98779e4eeacb76bbd57c8
MATLAB
656
23
% In this function, you can define like a global variable Matlab data % If you define global variables, remember declaring these variables in the corresponding % matlab objective function. function [e]=initParametersPE(E) global texp yexp texp= [0 1230 3060 4920 7800 10680 15030 22620 36420]; % Distribution of spe...
8d1b9e2a3c9dfd4900aa6d24ce0437ef14828c084622893bce3ec0c86a261f38
MATLAB
656
26
function ml_plot_matrix_traces(x, traceMatrix) % Each row of the traceMatrix should be the trace of a single cell. numNeurons = size(traceMatrix,1); numTimeSamples = size(traceMatrix,2); for iNeuron = 1:numNeurons %x = 1:numTimeSamples; y = traceMatrix(iNeuron,:); %av_neuron = av{iNeuron}; % y = zeros...
afbf105a15dcbc1a5db2500471ef2d2fb3dd8fd397e4b4cd7b12ae029cdaf6c8
MATLAB
657
18
function fh=SONCreateFile(filename, nChan, extra) % SONCREATEFILE creates a new SON file % FH=SONCREATEFILE(FILNAME, NCHANS, EXTRA) % FILENAME = string wiht file and path % NCHAN = number of channels 32 to 256 % EXTRA = number of bytes to reserve for user specified data % a...
0dcdc795aa588925c3652ec8eb6f21a4950250b2a7f1dc14cb65d365dbc41710
MATLAB
658
28
function h = vl_cf(h0) % VL_CF Creates a copy of a figure % VL_CF() creates a copy of the current figure and returns VL_CF(H0) % creates a copy of the figure(s) whose handle is H0. H = % VL_CF(...) returns the handles of the copies. % % See also: VL_HELP(). % Authors: Andrea Vedaldi % Copyright (C) 2007-12 A...
1224a4669dcd1300a7174fa1965de4bb9e0e1654b633c5cfe4931262013d5b23
MATLAB
658
42
function [] = matchYLims(goArr,scfrac,minfix,maxfix) %matchYLims 3/4/21 sz = size(goArr); if sz(2) > sz(1) goArr = goArr'; end ylArr = cell2mat(arrayfun(@(x) x.YLim,goArr,'UniformOutput',false)); if isempty(minfix) ymin = min(ylArr(:,1)); else ymin = minfix; end if isempty(maxfix) ymax = max(ylArr(...
83ba8bde3b766df84ce51c5bbfe7bbc59639a3dd4f9ec10026e78db7720172f8
MATLAB
658
29
% function f_IIRBiFilter.m % function v_FiltSig = ... f_IIRBiFilter( ... pv_Sig, ... pv_H1, ... pv_H2) if nargin < 2 error('[f_IIRBiFilter] - ERROR: bad parameters!') end if size(pv_Sig, 1) == 1 pv_Sig = pv_Sig(:); end v_FiltSig = filter(pv_H1, pv_Sig); v_...
e6486c8c1aca28c7c313e1698081f027c8f62404a32f08f1e096f8884492fde7
MATLAB
658
22
function display(tree) % XMLTREE/DISPLAY Command window display of an XMLTree % FORMAT display(tree) % % tree - XMLTree object %__________________________________________________________________________ % % This method is called when the semicolon is not used to terminate a % statement which returns an XMLTree. %_____...
793f61047015e8451f180b4771b98bdfecf53204de9e2780acc8f482cd417796
MATLAB
659
22
% % Please cite this paper if you use any component of this software: % S. Soltanian-Zadeh, K. Sahingur, S. Blau, Y. Gong, and S. Farsiu, "Fast % and robust active neuron segmentation in two-photon calcium imaging using % spatio-temporal deep learning," Submitted to PNAS. % % Released under a GPL v2 license. functio...
9b7974987120f279f8ee7af17ec1f4f4fe0dc7df338584da07143f11b6e1660a
MATLAB
659
26
function h=vis_brainsurf(facesl,vertsl,facesr,vertsr,yl,ttstr,meshsmooth) if meshsmooth==1 vertsl=sms(vertsl,facesl,5,0.5); vertsr=sms(vertsr,facesr,5,0.5); end h=figure('Position', [10 10 900 900]) trisurf(facesl,vertsl(:,2),vertsl(:,1),vertsl(:,3),'FaceColor',[0.85 0.8 0.75],'EdgeColor',[0.1 0.1 0.1],'Edge...
f64076e1a94853eb10890c3ba8074f402ef75c4983822092523d106a2ae3a754
MATLAB
659
27
% eyeCalib9.m % % $Id$ % usage: eyeCalib9.m() % by: justin gardner % date: 02/24/05 % copyright: (c) 2006 Justin Gardner (GPL see mgl/COPYING) % function retval = eyeCalib9(bkcolor) if ~exist('bkcolor','var'),bkcolor = 'gray',end % init the screen myscreen.background = bkcolor; myscreen = i...
0c12daf792d3915a2caa0d2d267d9eae73c1b3f90cb8ca25bb7b897f41b9e9d3
MATLAB
660
18
function handles = UpdateTable(handles, statustext ) %% Author: Jiri van Bergen % Affiliation: Radiology @ JHU - Kirby Center % Contact via xuli@mri.jhu.edu % updated 2021-06-24, cluster version % Update table with new status for this dataset if isfield(handles.Params, 'cluster') ...
82a28c0c2e950bb352840e6b59e30aa6a87e607001c93e5fafcc2fabc00f3090
MATLAB
660
26
<<<<<<< HEAD function [EER, index, eer_threshold] = computeEER_classic_minDiffFprFnr(fpr_mean, fnr_mean, scores) diffV = abs(fpr_mean-fnr_mean); index = find(diffV == min(diffV)); index = index(1); EER = (fpr_mean(index) + fnr_mean(index) ) / 2; if nargin > 2 eer_threshold = scores(index); ======= function [EER...
02087daf94cb1591d2683f35ee074b6a8a8dde211b4d239418a00b21c9d01731
MATLAB
661
19
function meanLickProportion = lick_proportion(lick_vectors_cells_sound,lick_vectors_cells_No_sound) for ii=1:size(lick_vectors_cells_sound,1) Lick_Sound = nonzeros(lick_vectors_cells_sound(ii,:)); LickPercentSound(ii)=100*(length(Lick_Sound)/size(lick_vectors_cells_sound,2)); Lick_NoSound =...
0a5114573fe3b7db51aee65d8cb79e27496a99c9304f8e85ee1846918fd77d25
MATLAB
661
23
function plot_timeframe(data, name) %PLOT_TIMEFRAME Summary of this function goes here % Detailed explanation goes here figure('Name', name); hold on; ylim([0, 1]); ylabel 'absolute score of aoi' xlabel 'time of frame in seconds' leg = {}; colors = {'m', 'c', 'g', 'b', 'r', 'k'}; for i...
644f07943a4084be5fce3c176d6519d33ed417d5ba0d44b63638b12b8105fcf5
MATLAB
661
13
function [traceFilt, spikes, deconv_options] = ml_cai_deconvolve_cnmfe_raw_trace(deconv_options, traceRaw) % traceRaw is supposed to be a single "RawTraces" from cnmfe. % These were parameters that fit the data well for both % the GCamp6f transfected mouse, and the transgenic mouse. % deconv_option...
764387efe3682b0770ed6b2f3ee513dc2728a351fa65ba706213b162dc1d2e4d
MATLAB
662
21
% Augment features to be better suited for learning problems. % % To augment features, use: % % feat = feat_augment(feat) % % where: % % feat - feature structure, obtained from feat_compute % (stored as *-feat.mat) % % Takes log of features that are lognormally distributed % Normalizes features t...
8524dc777995a13a0dda7507e417b61cfafacbf3cf7f44d7dfe6740885d17a65
MATLAB
662
27
function [element_len, len_v] = perm_len(v) %perm_len outputs a vector that is the element-wise permutation length of %the input, v, assuming the input is a permutation of 1:length(v). % [element_len, len_v] = perm_len(v) % Input: % v: an Nx1 vector describing the permutation 1:N -> v % Output: % elem...
74aca45db32b3cf07fc76265560fc870ec420479d5be3dd47d438db2f7135c8b
MATLAB
663
20
% getSamplesNumber.m function [samples] = getSamplesNumber(folder) % created by Luca Leonardo Bologna (Summer 2006) % modified by Valentina Pasquale (October 2007) % getSamplesNumber looks for a .mat file into the input folder, opens it % and extracts the number of samples of a peak train. % Inputs: folder - generall...
d4ccc878e0f23f6c2d9eda10c3752f6b3efaf198ec666e6b3f7594c422d21fbd
MATLAB
663
44
DEPRECATED::: % % Compute the size statistic of a network. % % PARAMETERS % $network % % INPUT % dat/info.$network % % OUTPUT % dat/statistic.size.$network % network = getenv('network'); info = read_info(network); consts = konect_consts(); if info.format == consts.BIP values = [ info.n1 + info.n2 ; info....
f507b4b8002035b3a320a117a9d625c10a1a4644f0d5107d927e014fa7eab50f
MATLAB
663
16
function handles = fix_SwapEvents(handles,fly1,fly2,f0,f1) % swap fly1 for fly2 in all suspicous sequences involving only one of them % from frames f0 to f1 % splintered from fixerrorsgui 6/21/12 JAB for i = 1:length(handles.seqs) if min(handles.seqs(i).frames) < f0 || max(handles.seqs(i).frames) > f1, continue;...
f5e47beb959e623b2de377d60f4e97231d9402ca5c7e28d22123665cdb0ba7fc
MATLAB
663
28
function y=spcharout(x) %SPCHAROUT replaces special character codes by their values % %Syntax y=spcharout(x) % %Description % x is a character or 2D cell array of characters % y is the corresponding version with special character codes % '%ascii;' replaced by their values % %See also: spcharin % % Jonas Almei...
4ddd4a7dd6fd1aecc3ec62c37e0409aac379328a4f5f1c58a2f28c493865c9e9
MATLAB
664
22
function NS_RecordDisplay(app, displayH) Group = app.Experiment.Groups(app.IDs.Group).Group; Record = Group.Records(app.IDs.Record).Record; IG = Record.Data.Source; % if ~isempty(Param) % BW = zeros(size(IG)); % BW(IG>=Param.MinIntensity) = 1; % imagesc(BW, 'parent', displayH); % else imagesc(IG, 'pa...
3388adb1cd9357aa2d7e6415ca83aef164262d2dc3d6a116a44cd878f856e466
MATLAB
666
11
function [ behavior_timeseries ] = behavioral_space_to_behavior(behavioral_space_timeseries, watershed_labels, xx) %This function annotates a time series in 2D behavioral space using the %watershed map watershed_xy_indecies = SpaceMapping(behavioral_space_timeseries,xx); % use linear indexing watershed_line...
456912768547ffec8999acea4b7df3089a3c381fff01c358ee415178dada4fd7
MATLAB
666
24
function vl_assert_almost_equal(x, y, varargin) epsilon = 1e-6 ; if length(varargin) > 0 if isnumeric(varargin{1}) epsilon = varargin{1} ; varargin(1) = [] ; end end assert(isequal(class(x), class(y)), varargin{:}) ; assert(isequal(size(x), size(y)), varargin{:}) ; if isstruct(x) fx ...
8ac5ee5efc19989c209625890e903f13bbbd83de3e3e1b2b7b4caee72bddb241
MATLAB
666
29
% mglReplaceTilde.m % % $Id:$ % usage: filename = mglReplaceTilde(filename) % by: justin gardner % date: 12/07/11 % purpose: If filename starts with a tilde, will replace with % fully qualified path (e.g. ~/uhm will become /Users/justin/uhm) % function filename = mglReplaceTil...
cb65ce67068d51700cb08e539049c42c22e6225ece1d31b1cf1daf7af68d8b4f
MATLAB
666
21
function RealignRecordingUsingDredgeAndKilosort2point5(basepath,config_version,dredgeParams) cd(basepath) %% Config File disp(['Running Kilosort with user specific settings ' config_version]); config_string = str2func(['Kilosort25Configuration_' config_version]); ops = config_string(dredgeParams); %% GPU gpuDeviceNum...
024b6cfa07d90200e8ab3deae253bc6005980a609c3961f70d9b8bfe607a7207
MATLAB
667
17
function outputArray = normTo1(inputArray, dim) % normalize and add up to 1 along a specified dimension % Ensure the input is a numeric array assert(isnumeric(inputArray), 'Input must be a numeric array'); % Check if 'dim' argument was provided, if not, default to 1 if nargin < 2 dim = 1; ...
130f46e4fda5c0e9615069f66ed5a68c8231e4058e3f3b74e951cf6f1be5931a
MATLAB
667
24
function [goodCycles, csLocs, z] = t2tAnalysis_csNOcs(z, p, cycleMat_cs, chunkLen) % 300ms window z.ssWindow_e = .3 * z.sr_e; conds = []; %% Condition 1: 1 cs in 200-1000ms z.csWindow_good = (z.sr_e * .201):(z.cycleLen_e/2); conds(:,1) = sum(cycleMat_cs(:,z.csWindow_good),2); conds(:,1) = conds(:,1) == 1; %% Condit...
795b2c78f49dd877c80b93e7f2b91370024318c447d4b15300119b25b5737927
MATLAB
668
32
% plotVarExpl.m % % function plotVarExpl(kernels) % get all fields in kernels struct (which kernels computed) kernelFields = fieldnames(kernels); numFields = length(kernelFields); numROIs = length(kernels); numElm = length(kernelFields)*length(kernels); ind = 1:numElm; ...
c706fa9693c711e784491040b79798a6b2633c96ef623414ee85a430a1254a3f
MATLAB
668
9
function tracker_job_features(output_feature_file_path, output_jaaba_folder_path, output_features_csv_folder_path, ... input_video_file_name, input_tracking_file_name, calibration_file_name, ... options) % Recompute the features file, csv feature files, an...
2b356bcd075d439371c394f393b4164a33bddd604e06bb598846b730c45457ab
MATLAB
670
34
% conclusions %1. flat - plots the values of the bins, ignores the last % interp - includes all bins, interpolate values %xmat(isnan(xmat))=0; xmat=[1 2 3 4; 1 2 3 4; 1 2 4 4; 4 3 2 1; 4 nan 2 1] figure(2) [LLy LLx]=size(xmat) h=surf(xmat); view(0,-90); colormap('jet'); colorbar('Eas...
94fa35095c1064cf8e722e3fd09bb175b50b8bd640b79ee1ebd0902faf20f8bb
MATLAB
670
20
close all clear all clc folder = 'T:\Shamu_two_contexts_CA1\tetrodes\recordings\feature_poor\HGY1_CA1\s1'; nvtFullFilename = fullfile(folder, 'VT1.nvt'); %tFilename = fullfile(folder, 'TT5_6.t'); numBits = -1; tFiles = dir(fullfile(folder, 'TT*.t')); for iFile = 1:length(tFiles) tFilename = fullfile(tFiles(iFile)...
3d5d7befdb79d3ab265b79d8e615eeac78b6fb144aaf9136115a50bd04a35802
MATLAB
671
27
function QualData = readQuality(Quality,CSCs) % read Quality and generate QualData array MAX_UNITS = 10; % per channel MAX_ELECS = 16; % per channel for ii=1:MAX_ELECS+2, %2 header rows for jj=1:MAX_UNITS, Qual(ii,jj) = {[]}; end end letters = ['ABCDEFGHIJKLMNOP']; for jj=1:length(letters...
2bf8dd56bd85020b2f68873c5eb430f477107e30928013c01de3006c41cd6634
MATLAB
672
28
% convertBoutsToInd.m % % Helper function that takes in start and end times of bouts and a time % vector and returns all indices of times that occur during that bout % % INPUTS: % bouts - n by 2 matrix of start and end times of bouts (n bouts), 1st % column is start time, 2nd is end time % t - time vector fo...
8204ba193de642f7274e816862438c7e26892ab697630ad9197b20a273d0ec24
MATLAB
673
47
clear; N=1000; k=35; p=4; xx = linspace(-1,1,100); yy = WatsonMeanDirDensity(xx,k,p); yy = yy/sum(yy(:)); [t] = randWatsonMeanDir(N, k, p); h=hist(t, xx); h = h/sum(h(:)); figure; plot(xx, h, 'b'); hold on; plot(xx,yy, 'r'); N=1000; k=5; p=4; xx = linspace(-1,1,100); yy = WatsonMeanDirDensity(xx,k,p); yy = yy/sum(...
a4ad53929dc6a499ef69b5f686c9810d8061eaad033fb7ce46eaa4475a8acc41
MATLAB
673
23
function images = findAllImagesInFolders(folderName,fileType,frontConstraint) %finds all images within 'folderName' (recursively) whose names end in %'fileType' and start with 'frontConstraint if nargin==1 fileType = '.tiff'; end if nargin < 3 || isempty(frontConstraint) == 1 frontCon...
67ef87353f0a65ea9cd66bc5c10686eec6e13fff12867c805685f1eea7399271
MATLAB
674
17
function blobs = BlobAddTextureHists(blobs, textureSpace, numBins, min, max) % blobs = BlobAddWHists(blobs, textureSpace, numBins, min, max) % adds textureHist fields to each blob % % blobs is a struct with blobs % textureSpace is the image representation in texture. % It is common to have an invariant texture...
c7d744770b6f6dfcc893318275bebd1f929868585ccf6fc7f50310f1698cc44c
MATLAB
674
28
function [run_config, runner_info] = refinenet_initialization(refinenetOpt) warning('off', 'MATLAB:namelengthmaxexceeded'); rng('shuffle'); run_config=[]; if refinenetOpt.gpus, run_config.use_gpu=true; else run_config.use_gpu=false; end % run_config.use_gpu=false; run_config.gpu_idx=refinenetOpt.gpus; run_config...
d0e4fcd96dcdebedcc93cbfa110062ed546de38ae81c36d81ab414234eb350da
MATLAB
674
20
function class_info=process_class_info(class_info) class_label_values=class_info.class_label_values; assert(isa(class_label_values, 'uint8')); assert(isa(class_info.background_label_value, 'uint8')); assert(isa(class_info.void_label_values, 'uint8')); [~, ~, class_value_idxes]=unique(class_label_values); class_info...
304950fcc26d441e0b9b3118ee2ba1a152160f331123092ffa1d0a589f83342c
MATLAB
675
27
function extras = read_extras(fname) % Read extra bits of information %_______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: read_extras.m 8776 2013-11-14 09:04:48Z roboos $ extras = struct; [pth,nam,ext] = fileparts(fname); switc...
6e9366bb99ff738d55dbfdb2f3b24712e28f52856b035db35c26861259803f47
MATLAB
675
19
file_path = ''; % 图像文件夹路径 img_path_list = dir(strcat(file_path)); % dir 列出当前文件夹中的文件信息 img_num = length(img_path_list); % 获取图像总数量 fprintf('正在读取的图像为:\n'); for j= 1:img_num-1 % 逐一读取图像 if img_path_list(j).isdir==0 img_name = [file_path,'/',int2str(j),'.tif']; pitch=imread(img_name); % [im1]=rotate(j,pitch)...
30f0d247b83ec051effb8430a7be1b4e5562037255a7628d1f8cce6643234a0f
MATLAB
676
23
function [scores index] = BoxBestOverlap(gtBoxes, testBoxes) % [scores index] = BoxBestOverlap(gtBox, testBoxes) % % Get overlap scores (Pascal-wise) for testBoxes bounding boxes % % gtBoxes: Ground truth bounding boxes % testBoxes: Test bounding boxes % % scores: ...
95da41c55e3b55ca1a6b8ac2de6bec1dc5bf5afb7fd459fd4af8d01f42c41896
MATLAB
676
29
function [im2,bb] = autocrop(im,bg) %autocrops zeros from image if nargin < 2 bg = 0; end try imbin = (im>bg); box = regionprops(imbin,'BoundingBox'); bb = round(box(1).BoundingBox); bb(3) = bb(1)+bb(3); bb(4) = bb(2)+bb(4); if length(box)>=2 for i = 2:length(box) bounds = round(box(i).Bounding...
c22c7ac244357d3577286f3a3d2063ce1e5ae26578675a5cb265cd9d66e9c991
MATLAB
676
25
function display(this) % Display method for GIfTI objects % FORMAT display(this) % this - GIfTI object %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: display.m 8776 2013-11-14 09:04:48Z roboos $ disp...
b8bec696402665f03f8bec685b03b5eeee078f5620df7b1f1c5d30a1f7e40261
MATLAB
677
19
function df = effdf(ts1,ts2); % This function calculates the effective degrees of freedom (df) based on the autocorrelation of two time series (ts1 and ts2). % It implements the formula provided in the Pyper and Peterman (1998) paper. ts1=ts1-mean(ts1); ts2=ts2-mean(ts2); N=length(ts1); ac1=xcorr(ts1); ac1=ac1/max...
c9b7d9302116b1ccc64131680795d74147065cbbc31165f0daf0893d4df8c3f4
MATLAB
677
16
function ml_cai_pipeline_execute_trial_tasks(pipeline_config_filename, experimentParentFolder, analysisParentFolder, tasks_filename, iSession, iTrial) cfg = jsondecode(fileread(pipeline_config_filename)); tasks = jsondecode(fileread(tasks_filename)); %pipe = MLCalciumImagingPipeline(cfg, experimentParentFolder, analy...
ec67703cdcbe65a1840fed02f33b61c4b3c4d6622faa6ea29a6500e0811c297f
MATLAB
677
28
function plot_allChanOverview(recData, segInfo, z) figure('Position', [1 41 1920 1083]); ephysPlot = tight_subplot(length(recData),1,[.03 .03],[.03 .03],[.03 .03]); for j = 1:length(recData) try z.cycleLen_e = (recData(j).samplerate) * 1/expmtFreq; z.startpt_e = 1; [cycleMat, cycleMean...
8211ea6d75c855145844bec415d36c77e4dcd567ece2c52c9c61c5ddafd4e05d
MATLAB
678
27
function open_in_imtool(DATA,ROI,AddInfo) % % This Aedes plugin opens the current slice in the imtool that comes with % Matlab Image Processing Toolbox. % if AddInfo.isDataMixed imdata = DATA{AddInfo.CurrentSlice}.FTDATA; else dt_ind = AddInfo.CurrentSlice; if AddInfo.AxView==0 || AddInfo.AxView==1 imdata = DATA...
8d77ba753672d74665b7d14aaea707ff2343b2e0d13a62a834d2d5c4ec457d0c
MATLAB
678
28
function C=clustering_coef_bu(G) %CLUSTERING_COEF_BU Clustering coefficient % % C = clustering_coef_bu(A); % % The clustering coefficient is the fraction of triangles around a node % (equiv. the fraction of node’s neighbors that neighbors of each other). % % Input: A, binary undirected connection ...
f9c69b3de5ba6582d2e40bfb75b430a1deb050845f682c498233eba923058082
MATLAB
678
28
function [raster] = interevent_raster(spk_t, start_event_t, end_event_t, start_offset, end_offset) %interevent_raster.m inbd = @(d,l,u) d(d>=l & d<u); n_events = length(start_event_t); assert(n_events == length(end_event_t),... 'start and end event vector lengths should match'); start_t = start_event_t + start_o...
34f57feff3d7a155cc868ab25714fc1a03c41a95e83c4db59160624f322362ee
MATLAB
679
30
<<<<<<< HEAD function [zeroFMR, zeroFNMR, iFMR , iFNMR] = computeZeroFMRFNMR(FMR, FNMR) [zeroFMR, iFMR] = min(FNMR(find(FMR == 0))); [zeroFNMR, iFNMR] = min(FMR(find(FNMR == 0))); % correction on indexes if isempty(zeroFMR) zeroFMR = 1; iFMR = 0; end if isempty(zeroFNMR) zeroFNMR = 0; iFNMR = 0; ====...
7ca6c4dd1efa9b7d4345562e12ba34846ac4eacaed27068b856368c764258eb0
MATLAB
679
12
function MSE = compare_predicted_and_actual_rates_MSE(predicted_rates, observed_events) %computes the MSE to see how predictive our model is against the actual %observed rates using poisson distribution; not used in paper fps = 14; dt = 1/(fps*60); %observed_rates = double(observed_rates)*fps*60; % put it i...
8984dabb0d76cb9b5234aaa6dfa4baeb98b03688a13adf28b3096a6627e9ad47
MATLAB
679
35
function X = simdata_fa(params, N) % % X = simdata_fa(params, N) % % Generate fake data using FA model % % xDim: data dimensionality % zDim: latent dimensionality % % INPUTS: % % params - structure containing FA parameters % L (xDim x zDim) % Ph (xDim x 1) % mu (xDim x 1) % N ...
412c30d82629b2a331b0e43f25f0d6c6ce66a9ad388a76afa1068031d30656c6
MATLAB
680
22
function class_info=gen_class_info_voc() class_info=[]; class_info.class_names = { 'background', 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus',... 'car', 'cat', 'chair', 'cow', 'diningtable','dog', 'horse',... 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonit...
572a3f392f36cbb6f524baaa41fb4bce400ca100bc1594866acd30a7755205a4
MATLAB
680
22
function [ neuron, numNeurons, numTimesamples ] = ml_cai_neuron_h5_read_timeseries(ndf) % Reads a 'neuron.hdf5' file specified by the filename given in ndf numNeurons = h5readatt(ndf, '/', 'num_neurons'); numTimesamples = h5readatt(ndf, '/', 'num_time_samples'); ndfFields = {'spatial_footprint', 'spikes', 'trace_filt...
aca99752c0d87cd21db4253b0e43c3381fa8d45aa5765df6d5b3abb7bbebc591
MATLAB
680
18
function cnmfe_to_neuron( obj, session, trial ) %Remove any previous results otherwise it requires user interaction neuronFilename = fullfile(trial.getAnalysisDirectory(), 'neuron.hdf5'); if isfile(neuronFilename) delete(neuronFilename); if obj.isVerbose() fprintf('Deleted file: %s\...
c103578d3925e0ba1b5c14ba501808b7d09a2f2817ac00e988cc55c4ae055c91
MATLAB
680
23
function nChan = getChanNumber(params) % Function to get number of unique spatiotemporal channels (CST pRF model) % % nChan = getChanNumber(params) % % INPUTS % params : (struct) pRF parameter struct, requires the field: % params.analysis.combineNeuralChan % if set to [1 2...
0938b955ea71709a1bc8d8292b35ca9c6922251aa6b618b57bbe48d13ee322c4
MATLAB
681
26
classdef MLSessionInterface < handle % MLSessionInterface Interface for a session % An interface for an experiment session methods (Abstract) getSessionRecord(obj); getName(obj) getDate(obj) getNumTrials(obj) % Return the ...
8571325f0ef555fe694cce964e43d3a7392c0f2c19833e63e3fe0a442a85855f
MATLAB
681
37
function td = FlyTrackerClassifySex(trxfile,varargin) [fracmale,dosave] = ... myparse(varargin,... 'fracmale',.5,'dosave',true); td = load(trxfile); nflies = numel(td.trx); nmale = round(fracmale*nflies); nfemale = nflies - nmale; if nmale == 0, for i = 1:nflies, td.trx(i).sex = 'F'; end elseif nfemale ...
be18b6b8a9d6059a9e6869fe43dd080ce016a7c958ad9c991470a8be4282d676
MATLAB
681
27
function im = im2col_mean_removal(varargin) % NumInput = length(varargin); InImg = varargin{1}; patchsize12 = varargin{2}; z = size(InImg,3); im = cell(z,1); if NumInput == 2 for i = 1:z iim = im2colstep(InImg(:,:,i),patchsize12); im{i} = bsxfun(@minus, iim, mean(iim))'; % iim = bsxfun(...
96f216f455cb65c108a252d5c57c79461eed1a67cd4d3283458bffff73b1eb36
MATLAB
682
27
function extras = read_extras(fname) % Read extra bits of information %_______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: privateread_extras.m 8776 2013-11-14 09:04:48Z roboos $ extras = struct; [pth,nam,ext] = fileparts(fname)...
cf3d84fd285e5d80fa40987eaf6601b01189d8d60b0d87257fc891018f7b30cc
MATLAB
682
31
function [data] = om_load_full(filename,format) % LOAD_BIN Load full Matrix % % Load full Matrix % % SYNTAX % [DATA] = OM_LOAD_FULL(FILENAME,FORMAT) % % FORMAT : can be 'ascii' or 'binary' (default) % % Created by Alexandre Gramfort on 2007-11-27. % Copyright (c) 2007 Alexandre Gramfort. All righ...
6393478656d8487752f9a6f22057f6e9a08b3c24260fbffe011110237db48fdb
MATLAB
683
27
classdef LabMetaData < types.core.NWBContainer & types.untyped.GroupClass % LABMETADATA Lab-specific meta-data. methods function obj = LabMetaData(varargin) % LABMETADATA Constructor for LabMetaData obj = obj@types.core.NWBContainer(varargin{:}); if strcmp(class(obj), 'types.core.LabMetaD...
b8f1b849b5237470f8d764ab586e446c4b6eb8de8974bde565928b901e4f0780
MATLAB
683
24
function volume = embeddIntoFOV(data, validPixels, FOVsize, varargin) %takes 2D array of Npixels x Time (e.g., a raster) and embedds in a 3d %array of X x Y x Time %input - the 2D array Npixels x Time % - validPixels Npixels x 1 - list of pixels that correspond to the % cortical area in XY space %...
d4414b5057052659c12493c910b408087eb6b95b19b8dfbfdc57b172e26fa6ae
MATLAB
684
24
function d = vl_numder(func, x, varargin) % VL_NUMDER Numerical derivative % D = VL_NUMDER(FUNC, X) computes the numerical derivative of the % function FUNC at point X. X is a real array and is passed as first % argument of FUNC. % % D = VL_NUMDER(FUNC, X, ARG1, ARG2, ...) passes ARG1, ARG2, ... as % additi...
d17bc23d9e2adb37db92ca8ba58499f727a71ec4bc8320b72b68d9382184a258
MATLAB
685
23
function [cscFiles, numCscFiles] = ml_nlx_get_csc_filenames(recordingFolder) files = dir( fullfile(recordingFolder, '*.ncs') ); numCscFiles = length(files); cscFiles = []; for iFile = 1:numCscFiles cscFiles(iFile).full_filename = fullfile( files(iFile).folder, files(iFile).name ); ...
f836f35cbcdfdd0cd8fd3051d4204ad1764b8b7aef2dea13df3c4229e0d3b6ac
MATLAB
685
24
% Inputs: % spike_counts (n by m matrix with n number of pyramidal cells and m time bins in sleep) % tbins (vector containing time bins in sleep) % frametimes (cells containing beginning and end of sleep frames) % Outputs: % frame pair correlations for the population vector across sleep frame pairs rate_vec=[]; %po...