sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b59f76b4f7314f620318891953b3ff48c0d3693e576f1af22032ffb583160be7
MATLAB
768
29
function Z=module_degree_zscore(A,Ci) %MODULE_DEGREE_ZSCORE Within-module degree z-score % % Z=module_degree_zscore(A,Ci); % % The within-module degree z-score is a within-module version of degree % centrality. % % Inputs: A, binary/weighted, directed/undirected connection matrix % ...
2a123bda243bea847442b7ec6fede808171b09977150330baa03eb47bb1b44ff
MATLAB
769
32
function [imuData] = ml_inscopix_imu_read_csv(fn) if ~isfile(fn) error('The file (%s) does not exist.', fn); end % Read the header fid = fopen(fn, 'r'); header = fgetl(fid); fclose(fid); columnNames = split(header, ','); % Remove the unfilled entries columnNames(8:end) ...
c954ff73bd4d2d240c994da2b5e69654b0421f73c327eb059c517a65b7ee9333
MATLAB
769
25
function [ ginfo, gids ] = ml_util_group_points_ginfo(x) % x should be an array of numbers. Whenever numbers are not the same as % their neighbours a new group will be created to represent them. % % Can be called on an array that has been thresholded resulting in an % array of zeros and ones. ...
d0650ad53cd3c5a7d62199812976838ccccdce249da9f0a774d9edacaece2af4
MATLAB
769
21
function [task myscreen] = mglEyelinkCallbackStartBlock(task, myscreen) % mglEyelinkCallbackStartBlock - Assigns eye position to myscreen % % Usage: mglEyelinkCallbackStartBlock(task, myscreen) % program: mglEyelinkCallbackStartBlock.m % by: eric dewitt % date: 04/03/06 % copyright: (c) 2009,2006 ...
46ff451992fed507e7f10d40f40145bc9fd9bdb7562571176b94039cd704226c
MATLAB
771
22
% mglQuad.m % % $Id$ % usage: mglQuad( vX, vY, rgbColor, [antiAliasFlag] ); % by: eli merriam, based on mglPoints.c by justin gardner & Jonas Larsson % date: 04/20/06 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: mex function to draw a quad in an OpenGL screen ...
5256e2ecf608cc5ce2db4ea443643afcc5335c25d800a1d107afbd993a5bef59
MATLAB
771
23
function points_modified = correctbregma(points,m,a,d,inv) %CORRECTBREGMA standard‚̍À•W‚ƁAbregmaÀ•W‚̐^‚̈ʒu‚©‚ç‚Ì‚¸‚ê‚ðŽó‚¯‚āA‚¸‚ê‚ðC³‚µ‚½standard‚̍À•W‚ð•Ô‚·B % standard : Šî€À•WBhexapodÀ•WŒn‚É‚¨‚¯‚é(x,y,z) % m : ML޲‚ÌbregmaÀ•W‚Ì‚¸‚ê % a : AP޲ % d : DP޲ % ML޲‚Ì‚¸‚ê‚ðC³‚·‚éB if ~exis...
0a117b2bb29d2bb4d1327ef9698bb5a535d141d3e13353087d9eae306a40d8da
MATLAB
772
26
function gaborResponses = computeGaborResponses(im, gabor, NumFilters) %init gaborResponses = zeros(size(im,1), size(im,2), NumFilters); for oriIndex = 1 : NumFilters filter = real(gabor(oriIndex).filter); %normalize %%%%%%%%%%%%%%%%%%%%% filter = filter ./ max(filter(:)); %%%%%%%%%%%%%%...
87ae4354c1d8faad4d656e36f65ffc238d8cf0b5535e9d75df1ab3db2ead2e8f
MATLAB
772
20
function S= makeStimRows(Stim, n) % S = makeStimRows(Stim, n, flag); not used in paper % % Converts raw stimulus to a matrix where each row is loaded with the full % space-time stimulus at a particular moment in time. The resulting % matrix has length equal to the number of time points and width equal to % the (n...
096c4a4125b06ce99a86901193641a1a9edd5b064c49b7c2e4763bb7976e3373
MATLAB
773
18
addpath(genpath('/groups/branson/home/bransonk/behavioranalysis/code/FlyDiscoAnalysis/FlyTracker')); expdir = '/groups/branson/home/bransonk/behavioranalysis/code/MABe2022/data/nochr_TrpA71G01_Unknown_RigA_20201216T153505'; intrxfile = fullfile(expdir,'movie_JAABA/trx.mat'); inflytrackerfile = fullfile(expdir,'movie-...
be4dba6f7ab898453d6a1a630279f5c1aa2c8273707656c94abd6528e629806c
MATLAB
773
33
%% Update Unassigned Tracks function [tracks,del_ids] = confusingtracks(tracks,unassignedTracks) for i = 1:length(unassignedTracks) ind = unassignedTracks(i); tracks(ind).consecutiveInvisibleCount = ... tracks(ind).consecutiveInvisibleCount + 1; tracks(ind).data = nan(1,11); end %delete invisib...
33124a1165ea606a7740fe1bc298cd1f3009b4e0804d37e396780d0a68ce0b8a
MATLAB
774
20
function flag=SONSaveRange(fh, chan, startTime, endTime) % SONSAVERANGE sets the write state to save for a channel in the given time range % % FLAG=SONSAVERANGE(FH, CHAN, STARTTIME, ENDTIME) % INPUTS: FH is the SON file handle % CHAN is a channel number (0-SONMaxChans()-1) or -1 for all % ch...
425eaf8c7966c54557a766f279202be46a10bd7d5af2b416f37b44235887ab13
MATLAB
774
28
function vl_demo_ikmeans() % VL_DEMO_IKMEANS numData = 10000 ; dimension = 2 ; data = uint8(255*rand(dimension,numData)) ; numClusters = 3^3 ; [centers, assignments] = vl_ikmeans(data, numClusters); figure(1) ; clf ; axis off ; plotClusters(data, centers, assignments) ; vl_demo_print('ikmeans_2d',0.6); [tree, assig...
7d15d3ba1e18822809d1d1eb9eb85bcab0f08fc5ee4bc21c02dbf1c3a482ceab
MATLAB
774
17
function [t_ms, x_px, y_px, theta_deg] = ml_nlx_nvt_get_raw_trial(iTrial, nvtFullFilename, CONFIG_NVT_FILE_TRIAL_SEPARATION_THRESHOLD_S) % Load the nvt file and split it into trials %nvtFullFilename = fullfile(pwd, 'VT1.nvt'); %CONFIG_NVT_FILE_TRIAL_SEPARATION_THRESHOLD_S = 100; nvtTrials = ml_nlx_nvt_...
9b54d822ebcf1ea4f9cb2c3176d1e32dedb5aaf1746dc31da160561c65ef7fd2
MATLAB
774
26
function [y]=WatsonMeanDirDensity(x, k, p) % This is the tangent direction density of Watson distribution. See the % SphereDistributionsRand.pdf file for detail description and formulas. % % Usage: % [y]=WatsonMeanDirDensity(x, k, p); % % Inputs: % x: The tangent direction value. should be in [-1 1]. % % k: The k...
b6129ce2053a9cc965df2fc5d8181d77257a6f4125314b2f5f958542fbdb2003
MATLAB
774
27
function parsave(fname, varargin) % Save variables to a file from within a parfor loop. A separate function % is needed for this because the save function cannot be called directly % from inside parfor loops % % INPUTS: % fname: the full path of the matlab file to be saved % varagin: paired list {varname1, var1, v...
2d6cf9811330f5d1cd03688d215344da4b86fee74a3390e1023377b8b9148be4
MATLAB
775
27
% Originally used in Buenrostro et al. NBT 2014 % Author: Jason Buenrostro, Greenleaf lab, Stanford University % Gaussian fit function function fitImage = Gauss(subFullFit,xMax,yMax,c) % generate empty grid fitImage = zeros(xMax, yMax); % loop through clusters and add to fit image for i = 1:size(subFullFit,1); am...
5e5a52090dac66e8c5b3b8c1cb5d6f5fcfe48c469b3f9d8222b4fd433c352736
MATLAB
775
27
function [sliceIndices] = ml_util_timeseries_find_slice_indices( ts_ms, slice_separation_threshold_ms) % This returns indices into the array ts_ms such that it can be split into % slices where the slices are separated by more than % slice_separation_threshold_s seconds. % Convert the threshold in second to millisecond...
b28e08610e628c7e91918aef244b58cc2e750eceec94f1037b851f4666b1e0bc
MATLAB
776
33
function [r] = fcn_get_in_out_similarity(mat) %FCN_GET_IN_OUT_SIMILARITY similarity of input/output weights % % [r] = fcn_get_in_out_similarity(mat) calculates the similarity of % input/output weights for a connectivity matrix, mat, as a correlation % coefficient. % % Inputs: % mat, [node...
c4589d04d7e28dea9e51fd4edee7ece8fb27b1c82ec6b6479dc63513760b79c5
MATLAB
776
25
% % Compute the reduced rank in function of decomposition type. % function r = get_rank_type(network, decomposition) [r_svd, r_lap] = get_rank(network); if strcmp(decomposition, 'svd' ), r = r_svd; elseif strcmp(decomposition, 'sym' ), r = r_svd; elseif strcmp(decomposition, 'diag' ), r = r_svd; elseif st...
67252f0d3b94f39e88dd4e65d5e5259152822aa61803278f43d375aa2208c812
MATLAB
777
27
function vars = PLOT_FramerateHistogram(app, vars) difft = diff(vars.vid.time); frametimes = 1./[difft]; %% Plot in app histogram(app.UIAxes4_5, frametimes, 200); vline(30) title(app.UIAxes4_5, 'Framerate Histogram') ylabel(app.UIAxes4_5, 'Frame Amount') xlabel(app.UIAxes4_5, 'Framerate') %% Plot in figure hFig = fi...
e2723b1fc29d8992c22932127ffe5f6afbd5445943a0134d5339ca7f410132c1
MATLAB
778
27
classdef Container < types.untyped.MetaClass & types.untyped.GroupClass % CONTAINER An abstract data type for a group storing collections of data and metadata. Base type for all data and metadata containers. methods function obj = Container(varargin) % CONTAINER Constructor for Container obj = ob...
2a17e7ba33a73a70aa6f0b76a1ab6b292ce47270a6e754c21a95ab09b3f9224a
MATLAB
779
22
function y = input_weights(num_columns,npp,N,num_VTA,gain,VTA_gain) %instantiation of weight matrix rho_1 = .7; rho_2 = .9; L_ij1 = zeros(N,N); ndd = npp; for i = 1:num_columns j = (i-1)*npp*2; l = (i-1)*ndd; L_ij1(j+1:j+npp,l+1:l+ndd) = gain*eye(npp); a = ones(num_VTA/npp,1); for ii = 1: npp -1 ...
657f63ecdf8b78454674ca45a8167180fe1d9d363b0194c8934fe06f7d6d08c7
MATLAB
779
33
function [tim,perm] = visTextons(textons,fb) % function [tim,perm] = visTextons(textons,fb) if size(textons,1) ~= numel(fb), error('size(textons,1) ~= numel(fb)'); end [d,k] = size(textons); % find the max filter size maxsz = max(size(fb{1})); for j = 1:d, maxsz = max(maxsz,max(size(fb{j}))); end ...
7608fb5ef8eabe19826d34770c603a73844ca75663c0fac4be7cf373f40a5710
MATLAB
779
15
for ii = 1:102 alpha_labels{ii,2} = sum(strncmp(alpha_labels{ii,1},right_sensors_planar,7))+1; %left = 1, righ = 2; if alpha_labels{ii,2}==1; alpha_labels{ii,3} = 'left'; elseif alpha_labels{ii,2}==2; alpha_labels{ii,3} = 'right'; end end % %this is just a reference for ordering sensors according to t...
9855269e5bb77c8f36862239d43ea89e57e9e7a7f9faf320fb6b5fe4a3c71f24
MATLAB
779
27
% This script takes all the sources and detectors of a probe designed in % MOCA and exports them as an .SD file for use in AtlasViewerGUI clear all % Create a layout % Design Parameters (module, roi, SD sep range) probe.module = createModule(4, 50); % nsides, mdimension probe.roi = createROI(100,100); % width and...
575d7af55132cdd3e462f787eb2ed44efb3a3326807dd9719e08e050612a5e9d
MATLAB
780
32
function X = convBasis(stim, bases, offset) % Convolve basis functions to the covariate matrix % % stim: [T x dx] - covariates over time % bases: Basis structure % offset: [1] optional - shift in time if nargin < 3 offset = 0; end [~, dx] = size(stim); % zero pad stim to account for the offset if offset < ...
f378550d8e8337d283615be3f11774c9a92c701a778f4661bf7aec831b2acb79
MATLAB
780
22
Frows=8; Fcols=8; ff=1; xfac=1; yfac=1; for fuu = 1:Npass, % if mod(fuu,Frows)==1 || Frows==1, % ff=ff+1; firstRow=1; % figure(tuneFig+ff); clf; % end; % if mod(fuu,Frows)==0, lastRow=1; end; ...
bf3aef1e82aa4de1f28bbc22f3da7c9d64b6f52811c97b2f72a7ca476aae2360
MATLAB
781
35
function vl_figaspect(a) % VL_FIGASPECT Set figure aspect ratio % VL_FIGASPECT(A) sets the current figure aspect ratio to A. It % leaves the length of the shortest side unaltered. Both the % screen and paper positions are affected. % % See also: VL_PRINTSIZE(), VL_HELP(). % Authors: Andrea Vedaldi % Copyrigh...
d8b7fc5be7ad29a0f2822ff7e7486812ea06ce5b329cf71f07ef5eeb49fdae98
MATLAB
781
32
function [psdx, freq] = powerspectraldensity(x, Fs, highpass, lowpass, display) %PSD Estimates a signal's whole-epoch power spectral density using FFT. % Detailed explanation goes here if ~exist('display','var') display=false; % defaults to not displaying plot end N = length(x); xdft = fft(x); xdft = xdft(1:N/2+...
70ce401c30e0a35ec5cd53af4b83519bd517f67afb34f1a90fff1cb72ac1b412
MATLAB
782
15
function sensitive_per_whisker %% if neuron i is more sensitive to whisker 1, then create a tuning curve for first and later touches just for that whisker [~,~,~,~,~,~,deltak,touch_idx,FR,~,~,whisker]=Tcurve_touches_dk(Data.touch,Data.touch_per_whisker,total_psth,Data.deltak_w1,Data.deltak_w2,do_extra_plot,NpointsTcur...
e17b9f538db07f8b6dde60967d19ce8e5e408239cb5d9a2bb7e7a43cb0f21796
MATLAB
782
22
function tree = move(tree,uida, uidb) % XMLTREE/MOVE Move (move a subtree inside a tree from A to B) % % tree - XMLTree object % uida - initial position of the subtree % uidb - parent of the final position of the subtree %__________________________________________________________________________ % % Move a subtr...
fb84d4afa564ce86c346e45cd991d110c0df3a5d45489e6831455b0791b083cb
MATLAB
782
19
function noisy_out = PoissonGaussNoiseModel_camera(clean_in, noise_params) % noise model for camera %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Input Parsing % noise_params = check_noise_params(noise_params); % Check the noise parameter struct for missing ...
0817312cf109992f9d9499e06c21692726cc56a1bfa9510241ccc30f0746ecf0
MATLAB
783
28
function conn = genconn(start,ends,weight,locs,misc) % conn = genconn(start,ends,weight,locs,misc) % % Function to generate a connection structure (piece of blood vessel; % edge between nodes) Connections are a structure array with fields: % % conn.start - start node % conn.ends - end node % conn.we...
ccded382d07ec40cd53787b0d188f0165a200b492862ad3474e075b7dcdff3a9
MATLAB
783
19
function [pos1, pos2, pupilStart1, pupilStart2] = convertPosition(pupilStart1large,pupilStart2large, radiiPupil, ROIpad, imgSize) roiwidth = mean(radiiPupil)*2+ROIpad(1); % [x] roiheight = mean(radiiPupil)*2+ROIpad(2); % [y] %% Select ROI pos1 = round([pupilStart1large 0 0] + [-roiwidth/2 -roiheight/2...
15a7e727ebf3ee317746b15ae51d0d1f1cc0db478d72d5b0847beeb535e7ef78
MATLAB
784
37
function [f] = csFilter(sigma,support) % function [f] = csFilter(sigma,support) % % Compute unit L1-norm zero-mean difference-of-Gaussians % center-surround filter. % % INPUTS % sigma 2-element vector of inner/outer sigma. % [support] Make filter +/- this many sigma. % % OUTPUTS % f Square filter. % % Dav...
4df9a245315089ebd580b75e0b7a2c7ae97b4c11bcaec1ca07b4633ee1e066fe
MATLAB
784
32
% swapLeftRightLegs.m % % Helper function to swap left and right leg indices % % INPUTS: % legInd - current index of leg % matchedLegInd - matrix matching legs, one column for left, one column % for right; same row is same leg % % OUTPUTS: % newLegInd - new leg index, swapping left and right % % CREATED: 6/...
f1d8b8ace154b07475c1dc13417145e311e125d8f895b0d9cba7dbbca5a5fa65
MATLAB
784
22
function create_csv_files(bias_threshold, std_threshold,AxTM,path_of_script,names) algo_names = {'standard DKI', 'AxDKI' , 'standard DKI RBC', 'AxDKI RBC'}; for i = 1:5 table = array2table(bias_threshold.(names{i})','RowNames',algo_names,'VariableNames',[AxTM,'Maximum']); table_name...
350532c998ac469c4f44c46f045eb15460bbb1ec794c27504eec6e1ce139e627
MATLAB
785
29
% mglGetErrorMessage.m % % usage: msg = mglGetErrorMessage() % by: justin gardner % date: 01/26/23 % purpose: Gets an error message from the mglMetal app % function [msg, results] = mglGetErrorMessage(socketInfo) if nargin < 1 || isempty(socketInfo) global mgl socketInfo = mgl.activeSocke...
6db1e0d800c038fb5f549c1c55772452edc477d73614e4c22f3a69a4b6b11768
MATLAB
785
27
close all clear all clc nSamples = 1000; % Generate random samples in [0, 2pi) sample = ml_stats_gen_uniform_samples(nSamples, 0, 2*pi); % Generate a uniform peak around 90 degrees peak = ml_stats_gen_uniform_samples(200, pi/2-pi/6, pi/2+pi/6); % Make a set of samples that have the peak added to it sampleWithPeak =...
e03d0e82f4200767e3480dd981aa7e65490e3362f32a586fa95bd872d98477be
MATLAB
785
35
% plot_err_patch_v2.m % % Function to plot trace (as line) with shading behind it for error values % % INPUT: % x - x values % y - y values for line % e - error values, plotted with shading as +/- that error value in y % dimension at corresponding x value % col1 - color of line % col2 - color of shading...
2a8524a5971bfe8b077cc4d1f66c23e43daa094ef0936e6587a6aecb12a35e73
MATLAB
786
38
function OutImg = Gabor_output(InImg, bestWavelets, NumFilters) %init ImgZ = length(InImg); OutImg = cell(NumFilters*ImgZ,1); %init gaborResponses = cell(ImgZ, 1); %loop on images for i = 1 : ImgZ %image img = InImg{i}; gaborResponses{i} = computeGaborResponses(img, bestWavelets, NumFilters); end %parfo...
669b66297c809743d6d685ab7d00af44409ecbfc64fb6a1f52f5f6922d852e12
MATLAB
786
27
function J = vl_imup(I) % VL_IMUP Upsample an image by two % J=VL_IMUP(I) doubles the resolution of the image I by using % bilinear interpolation. % % See also: VL_IMDOWN(), VL_HELP(). % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. % All rights reserved. % % This file is part of the VLFeat library a...
ec50e58738493bb5faefeab44549060ccad7ea4064d4238f2f34f150a41fd1e9
MATLAB
786
13
%evaluate the optimization in validation camera SC = laser_on(SC); OPT_S.las_SLM_flag = 1; OPT_S.cam_SLM_flag = 0; activate_func_had_fin(SC,OPT_S); %set final function on laser SLM %% fluorescence SC = set_PG_BP(SC); ...
20daa134cc2b80f025c5be997c449cfac51f8ffd50be077c8cdeb8d440a682db
MATLAB
787
39
function z = distSqr(x,y) % function z = distSqr(x,y) % % Return matrix of all-pairs squared distances between the vectors % in the columns of x and y. % % INPUTS % x dxn matrix of vectors % y dxm matrix of vectors % % OUTPUTS % z nxm matrix of squared distances % % This routine is faster when m<n th...
2a0f6df71f1765937f00e55a285c75c46e3ea936dd9ca2a82f6470fb7d801bf5
MATLAB
787
35
% VL_DEMO_SIFT_PEAK Demo: SIFT: peak treshold randn('state',0) ; rand('state',0) ; I = double(rand(100,500) <= .005) ; I = (ones(100,1) * linspace(0,1,500)) .* I ; I(:,1) = 0 ; I(:,end) = 0 ; I(1,:) = 0 ; I(end,:) = 0 ; I = 2*pi*4^2 * vl_imsmooth(I,4) ; I = single(255 * I) ; figure(1) ; clf ; imagesc(I) ; colormap ...
5401b94a861d99e1364be3d1fefdc395dd55fab1acc46be6838a2585c61a156b
MATLAB
787
25
function cmap = getColormapPRFModels(type) switch type case 0 % Dark gray LSS gray = [0.5 0.5 0.5]; % LSS orange = [255 140 0]./255; % CSS blue = [26 115 225]./255; % CST cmap = [gray;orange;blue]; case 1 % Light gray LSS gray = [0.7 0.7 0.7];...
c4e31565e96d72e9a27450c7e832d925648880bd690e3c1ebb2ffa0eb3fe5ef5
MATLAB
787
28
function [L, U, ev] = graph_laplacian(A, method) %graph_laplacian Computes the graph laplacian in addition to its %eigenvectors and eigenvalues. Also sorts the eigenvalues/eigenvectors as %ascending. % Function: % [L, U, ev] = graph_laplacian(A, method) % Input: % A - Adjacency Matrix % method - % ...
0760692fab18b038448b85e1e6b0db25371625b8542a02149e33241795862627
MATLAB
788
15
function [] = analysisProfiles(data,fg,name,ytitle,ylim,ytick,numnodes,units) h.tpfig = figure('name', 'My tract profile','color', 'w', 'visible', 'off'); tract_profile = plot(data,'color', [0.2 0.2 0.9],'linewidth',4) ylh = ylabel({ytitle;strcat('(',units,')')}); ylim = ylim; ytick = ytick; set(gca, 'fontsize',20, 'b...
86a83fc40fa897219127b019dbf0434d9809d24d6297eb7cc54298cf09dd5299
MATLAB
788
27
classdef NWBDataInterface < types.core.NWBContainer & types.untyped.GroupClass % NWBDATAINTERFACE An abstract data type for a generic container storing collections of data, as opposed to metadata. methods function obj = NWBDataInterface(varargin) % NWBDATAINTERFACE Constructor for NWBDataInterface ...
a3325faa3276a22544a151a3c482f380042c9712861887320d1e20d83f989426
MATLAB
788
17
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [plottingSettings] = plotting_settings_load(analysisSettings) plottingSettings = []; plottingSettings.NORMAL_BFO90_SHOW_EXCLUDED_COLUMN = false; plottingSettings.STABILITY_BFO90_SHOW_EXCLUDED_COLUMN = false; ...
155c682a7d5dad7581c745e476fa507d8136d6afa45f07b8fecd4d5cecef00bc
MATLAB
789
28
function ml_egomaps_draw_grid(RADIUS_CM) coordinatesRadii = 1:RADIUS_CM; coordinatesAngles = [0, 45, 90, 135, 180, 225, 270, 315]; % Draw the circles for i = 1:length(coordinatesRadii) h = ml_egomaps_draw_circle(0,0,coordinatesRadii(i)); set(h, 'linewidth', 1) end % Draw th...
863676e1d5515aaf8999de6b85ae86ebe8d2fad7c9dcc25e42613791b1edd71f
MATLAB
791
25
function [prob_states, logprob] = find_states(seq, pi, A, b, n_state) %% Compute the probabilities of hidden states given an observation sequence. %% authors: Stefano Diomedi %% date: 22nd February 2024 % %% Inputs: % - seq: Observation sequence. % - pi: Initial state probabilities. % - A: State transition mat...
0e0b4a3c1719dbbfbd6787d9d65b043db19c9baaadff81bb13170eaec0dc9473
MATLAB
792
32
function version = om_getgccversion % checks for gcc compiler version (works if superior to gcc3) % Copyright (C) 2010, Alexandre Gramfort, INRIA % $Id: om_getgccversion.m 8991 2013-12-09 10:45:52Z roboos $ % $LastChangedBy: alegra $ % $LastChangedDate: 2010-04-19 11:03:39 +0200 (Mon, 19 Apr 2010) $ % $Revision: 8991 ...
29743eb08690f69e7c79c3a99721ad673f0ee0de500944fd2d0cc502cb93eeda
MATLAB
793
29
function layers=gen_padding_keep_size(layers) for l_idx=1:length(layers) l=layers{l_idx}; if strcmp(l.type, 'conv') filter_size=size(l.filters); pad_size1=round((filter_size(1)-1)/2); pad_size2=round((filter_size(2)-1)/2); %To verify the order... ...
82f96e0175fd2112aac5e3d7050f98ab4b48b59c31144d33f7690371f77d6269
MATLAB
793
26
function [cleanTracks] = cleanSTracks2(sTracks,minVisibleFrames) %filter tracks less than minVisibleFrames cellLengths = (cellfun('size',{sTracks.data},1))'; killIdx = find(cellLengths < minVisibleFrames); cleanTracks = sTracks; cleanTracks(killIdx) = []; %filter tracks with all nans killIdx...
ab7c19531863b45f3de443b6dc4da44ef04736ce0815fb413d924866dfcfb3c4
MATLAB
793
29
function htprs = transformhprs(hprs,dir) % htprs = transformhprs(hprs,dir) % % Transform hyper-parameters of Bernoulli GLM to or from R^n for easier % optimization % % INPUTS: % hprs [m x 1] - hyperparameters (pre- or post-transform) % dir - "+1" => to R^n; "-1" => from R^n to natural range % % OUTPUTS: % htprs ...
e373bb57f3b1f65f10e3f3c6b8f966304a9804c1849af5e1ea72f4bebeb6a274
MATLAB
793
29
function [xj, yj] = ml_bs_discretize_xy(bs, x, y) if size(x,1) ~= 1 && size(x,2) ~= 1 error('Invalid size of x. Should be 1xN.'); end if size(y,1) ~= 1 && size(y,2) ~= 1 error('Invalid size of y. Should be 1xN'); end if size(x,1) ~= 1 x = reshape(x, 1, numel(x)); ...
a128d5c6cb2640f2dad7a6d413956d8c455f67f3bcb3efe2a87ec3dd3481d20f
MATLAB
794
27
function ml_util_corr_errorbar_groups(groupMean, groupStd) % Give each group a different color numGroups = size(groupMean,2); blue = linspace(0.5,1,numGroups); alpha = linspace(0.8, 0.2, numGroups); %hBar = bar(1, groupMean); hBar = bar(groupMean); for iGroup = 1:numGroups %...
7ff4f1473458fbcde00e2b7a77bc1c7fa957019dc8d9af673654c36b3fa00bc5
MATLAB
795
39
function results = vl_test_argparse(varargin) % VL_TEST_ARGPARSE vl_test_init ; function test_basic() opts.field1 = 1 ; opts.field2 = 2 ; opts.field3 = 3 ; opts_ = opts ; opts_.field1 = 3 ; opts_.field2 = 10 ; opts = vl_argparse(opts, {'field2', 10, 'field1', 3}) ; assert(isequal(opts, opts_)) ; opts_.field1 = 9 ; ...
929e16afe84bb4093d60fa603bcf438177b47ebbd5e6341f896d3a5c11ce3b41
MATLAB
795
9
% script to test for gamma table setting problem. The issue is that if you change resolution (either pixels or refresh rate) from the default settings of the monitor in mglEditScreenParams then mac will need to reset the monitor which takes a brief moment and the screen goes dark. initScreen then sets the gammaTable to...
c386cfbe66c1fc5f430a10fb643b7bc3f875d3417493b878953458f77344b7cd
MATLAB
795
38
function results = vl_test_imarray(varargin) % VL_TEST_IMARRAY vl_test_init ; function test_movie_rgb(s) A = rand(23,15,3,4) ; B = vl_imarray(A,'movie',true) ; function test_movie_indexed(s) cmap = get(0,'DefaultFigureColormap') ; A = uint8(size(cmap,1)*rand(23,15,4)) ; A = min(A,size(cmap,1)-1) ; B = vl_imarray(A,'m...
3023d473fb59ddd0e74d4bfcddba18d520a6f54cb61cc1078f745177a743b121
MATLAB
796
18
% mglSetMousePosition.m % % program: mglSetMousePosition.c % by: Christopher Broussard % date: 02/03/11 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Sets the position of the mouse cursor. The position is in % absolute screen pixel co...
65ce1555f68d0e39a394068cee321b94ecc3d7baf3eb8a82c519d9d7a25fd1ec
MATLAB
796
29
% get subnetwork labels for Desikan atlas % % 2023-10-13 Jonathan Wirsich function [masks, mask_labels] = init_subnetwork_masks() %only desikan for now regions = 68; intrahemi_left = zeros(regions); for r1 = 1:regions/2 for r2 = r1+1:regions/2 intrahemi_left(r1, r2) = 1; ...
646ff28fdd45a7c2a56f39478422688b7bd250d5f33e4b74814c0e3c55e93f05
MATLAB
797
18
function [randmat] = random_matrix(mat) % This function creates random matrix according to Humphries, M. D., & Gurney, K. (2008). Network ‘Small-World-Ness’: A Quantitative Method for Determining Canonical Network Equivalence. PLoS One, 3(4), e0002051. doi: 10.1371/journal.pone.0002051 % Basically it assigns each entry...
c214387377c1363eec68db83a19bf93dfffbd573087600c456e8995ca46f3a89
MATLAB
797
30
function b = NormalizeRows(a, n) % Normalizes the rows of a. Makes sure there is no division by zero: b will % not contain any NaN entries. % % a: data with row vectors % n: The rows will sum to n. By default n = 1 % % b: normalized data with row vecors. All rows sum to one exce...
5faa50f1a04a359ce4175f313f750a22680685884400e2eff23c2f35bdc9c80f
MATLAB
798
26
function [tiflink,tagStruct] = tifinitialize(filename,imsize) % [tiflink,tagStruct] = tifinitialize(filename,imsize) % % Function to write initialize saving appended tif to disk % % 2019 - Alex Song tagStruct.ImageLength = imsize(1); tagStruct.ImageWidth = imsize(2); tagStruct.Photometric = Tiff.Photometric.MinIsBlac...
a325ba40dcc3473f28dafc2eff645f506e454599755a00f068d629dcb31247ee
MATLAB
798
32
function [] = Fig05_AveSongComb() % Code for plotting the population averaged ΔF/F for the difference between pulse and sine song around song-type in Fig. 5c,e. %% parameters GT = 'fruD'; % Fig. 5c % GT = 'fru'; % Fig. 5e switch GT case 'fruD' DataFlag = [1,0,1,1,0,1,1,0,0,0,1]; crange = [-1 1]*.1...
697844748187ceaee4d5d18b365ec050e84e78be7ce034ccd306e7a275d1c072
MATLAB
799
20
function [P, E] = bemf4_surface_field_electric_plain(c, Center, Area) % Computes potential/continuous electric field on a surface facet due to % charges on ALL OTHER facets using plain FMM % Self-terms causing discontinuity may not be included % To obtain the true field, use E = E/eps0; % % Copyright SNM 2017...
1bbe3bcccaddcf447f80f17e7a29f68b781ed9bd4216c81dd484ce5aba87b4c4
MATLAB
800
35
% drawROIs.m % % Allows user to select ROIs from an image. Uses built-in Matlab function % that lets you draw polygons on figures. % % Inputs: % avgIm - 2D image array (i.e. average image of time series) % % Outputs: % roiMasks - cell array of logical array indicating pixels corresponding % to ROIs % funct...
a643da11869a9d3a6708141b526fd48619ce9ff13f593438aa87c32838daeac8
MATLAB
802
20
% SONLASTPOINTSTIME returns the time for which a read will terminate % % Implemented through SONLastPointsTime.dll % % TIME=SONGETADCDATA(FH, CHAN, ETIME, STIME, LPOINTS, BADC {, FILTERMASK}) % % INPUTS: FH SON File Handle % CHAN Channel number (1 to SONMaxChannels) % STIME Searches back from this...
dce3358764bd95c8c62626b8e1faf42f0e12ba63cf88b7e4e5efbda89bbb6492
MATLAB
802
24
function [folders, folder_count] = getfoldersGUI() %lets ute user select a master parent folder, recrusively map all %experiments inside by the tags, and allows the user to select a subgroup %of experimental folders [folders, folder_tags, ~] = catalog_tags(); while true %call the gui for resolution whi...
59ca5ab6701743e488f02ff41c0423850cbd591dd1f721dad5f3f11af40a2e55
MATLAB
803
37
function varargout = dim(varargin) % Format % For getting the value % dat = dim(obj) % % For setting the value % obj = dim(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: dim.m 8776 2013-11-14 09:04:48Z roboos $ i...
9cbbae3b8ceb945f388a287e9d0d7ef4a83f49b2b9b766cdd21b979a10919bbf
MATLAB
803
22
function y = L_ij_no_rand(num_columns,npp,N,num_VTA,l5_rec,l23_rec,l5_l23,l23_l5,l23_l23,l5_VTA,l_23_l_VTA) %instantiation of weight matrix without randomness L_ij1 = zeros(N,N); for i = 1:num_columns j = (i-1)*npp*2; l = (i-1)*npp; if i < num_columns L_ij1(j+npp+1:j+(2*npp),j+(2*npp)+1:j+npp...
e4ee6a2b4b1bb27832b75fbf6417e41999d30e526fb690f6e2171904218ebeda
MATLAB
803
27
function [smapMean, smapStd] = ml_bs_speed_xy(bs, x, y, speed) % This function discretizes the position values using the bin system. nel = length(x); if length(y) ~= nel || length(speed) ~= nel error('Invalid lengths. All must be the same.'); end %[trans, xj, yj] = ml_bs_transition...
3a9d20420873fe6b84a15a8b163b149885a4544d406c560182e074160eaa6e04
MATLAB
804
29
% function f_Matrix2Norm.m % function m_NormeMat = ... f_Matrix2Norm(... pm_InMatrix, ... ps_UseGlobalLims) if nargin < 1 error('[f_Matrix2Norm] - ERROR: bad number of parameters!') end if ~exist('ps_UseGlobalLims', 'var') || isempty(ps_UseGlobalLims) ps_UseGlobalLims = 0;...
79d405d454175bd97eba484fb00ff0691e1de3552c3c3724f858d612e40766d7
MATLAB
804
44
% % Draw a graph layout of one network. % % PARAMETERS % $network % % INPUT FILES % dat/data.$network.mat % % OUTPUT FILES % plot/layout.tmp.a.$network.png % network = getenv('network'); consts = konect_consts(); info = read_info(network); data = load(sprintf('dat/data.%s.mat', network)); A = sparse(data.T(:...
64f45d6a3c82b95b4aaaea9c96a1d9ab4b59e3a47ab38bbf9bc72f9a0a0317c7
MATLAB
805
34
function outputFiles = selectFile(inputfiles,filter,InputFileDelimit) % Function to select pRF model fit file (?) % % outputFiles = selectFile(inputfiles,filter,InputFileDelimit) % % INPUTS % inputfiles : (str) path to input files % filter : (str) name to search for in files % InputFileDelimit:...
df5ed626f208cc2b4d7dc39af65b67ef842312614c3cff41f28b015a74c06444
MATLAB
805
23
% COMPILE Script file to compile c-code sources and generate the DLLs % To compile the files, you will need copies of CED's machine.h and son.h. % These are proprietory and not included in the distribution. Contact CED. % mex -v SONGetADCData.c GetFilterMask.c mex -v SONGetRealData.c GetFilterMask.c mex -v SONGetMarkD...
f0cc002c524dcc7758187df9acc5ec2a2894f34562ab78d83b1adf4315a9ff3c
MATLAB
806
25
function [ beta ] = bwd_nolog(seq, A, b, s, n_state) %% Backward algorithm %% authors: Stefano Diomedi %% date: 22nd February 2024 % Prepend a dummy value to the sequence seq = [9999, seq]; n_bin = length(seq); % Determine the length of the sequence % Initialize the beta matrix with ones beta = ones(n_stat...
0e31a0d933c3aa5ce67b3d4104691c3f2cc724e59ad6b3c27447eb65ffd38dda
MATLAB
807
42
clearvars Range = 1; load('ZoneMaster.mat') load('ExperimentNames.mat') load('OutNames.mat') ExpList = ExperimentNames(Range); OutList = OutNames(Range); %ReferenceList = vertcat(ZoneMaster{:,1}); for i = 1:size(ExpList,1) ExpName1 = ExpList{i}; ExpName = strcat(ExpName1,'.mov'); OutName = OutList{i}; locator = Rang...
1a29b586d2db5af5054e9cb5fd3b44038f47801b661d71509b18b25b22111135
MATLAB
807
22
% To improve the nomenclature the trial_#_arenaroi.mat were renamed to % slice_#_arenaroi.mat because some slices are discarded trials, etc. % Set this to the outermost parent folder that contains subfolders the % trial_#_arenaroi.mat containerFolder = 'T:\Shamu_two_contexts_CA1\tetrodes\recordings'; s = '^(trial_)\d...
5b28e263b16e8ba1bede7660fc93c54c80beb70729c4de6fd5c8601e78e2db46
MATLAB
807
41
% % Compute the distribution of local clustering coefficients. The % values are computed for the underlying undirected, unweighted % network. % % ENVIRONMENT % $network Network name % % INPUT FILES % dat/data.$network.mat % dat/info.$network % % OUTPUT FILES % dat/cluscod.$network.mat % c_local Vector of node de...
69386d61264ce2f39732a2c4f9ead73a2f1e5e411b381169772190774ddaafbc
MATLAB
808
17
function [x_cm, y_cm, arena] = ml_core_compute_canon_coordinates(arenaRoi_x_px, arenaRoi_y_px, arenaLengthCm, x_px, y_px ) % Construct the appropriate arena. All the shapes have 4 control % points that serve as references. refP = reshape(arenaRoi_x_px, 1, 4); refQ = reshape(arenaRoi_y_px...
8a2bdcac6e382be8096aef39536214ed45932b1276a0b9d621b6714d1c6cf704
MATLAB
808
40
function [InputF,tMax] = TI_Data_Singular(n_inputs,waitT,emissionT, epsT, cycles, interpMode) % TI data Generator: % Input is a matrix whose raws represent the input channels % % time sequence over which interpolate data deltaT = [epsT, emissionT, epsT, waitT]; deltaT = repmat(deltaT, 1, cycles); deltaT = [0, wai...
aba78e868fba19f95459c1f6ba87bb3e0fc57b54f43a8dd5e1000f4da33228ad
MATLAB
808
32
function [] = Fig04_AveSongComb() % Code for plotting the population averaged ΔF/F for the difference between pulse and sine song around song-type in Fig. 4d,f. %% parameters GT = 'nsybD'; % Fig. 4d % GT = 'nsyb'; % Fig. 4f switch GT case 'nsybD' DataFlag = [1,1,1,1,1,0,1,1,1,1]; crange = [-1 1]*....
d8bcf27935ba1e4d14b563c6fd3cc9f213a82bd641288ec092d994fea460157a
MATLAB
808
28
function apc = getAPC(v,g) %PATHWAYCURRENT Summary of this function goes here % Detailed explanation goes here % get the pathway currents % from Y to X v_x = zeros(size(g)); v_y = zeros(size(g)); % mean membrane potential for i = 1:16 % iterate by column, copy same value of all populations v_x(:,i,:,:...
0659bd47ead0fcc3f42af033a991ffe9dbb60066900b7ed7137012cfd4ae6250
MATLAB
809
28
% loadTrkFile.m % % Function to load Animal Part Tracker (APT) .trk output file. Returns leg % X and Y coordinates, in pixels. % For current orientation of fly, X is the axis parallel to the long axis % of the fly. Y is axis perpendicular to long axis of fly. % % INPUT: % trkFilePath - full path to .trk file % % OU...
2b586087bd591c209de3fce69da72b625f942963fbde2acdbff08e2fd187715e
MATLAB
809
27
function [trans, xj, yj] = ml_bs_transitions_xy(bs, x, y) [xj, yj] = ml_bs_discretize_xy(bs, x, y); inds = sub2ind([bs.ny, bs.nx], yj, xj); gids = ml_util_group_points_v2(inds); trans = {}; uinds = unique(inds); for i = 1:length(uinds) ind = uinds(i); j = find(inds == ind); ...
8ad7d63273f5de854c012003dd69abc956654414008ab2c6033c56da7fa8c357
MATLAB
809
19
% VL_HIKMEANSPUSH Push data down an integer K-means tree % PATH = VL_HIKMEANSPUSH(TREE,X) quanizes the data X with the % hierachical integer K-means tree TREE. This is obtained by % calculating the path of each datum from the root of TREE down to a % leaf. Here X has a datum for each column and each column of...
907d7be0406333d5343ea3ba16bdc0073c8eb021a2cdbb24d574e32f833803ef
MATLAB
810
35
% fit2PiPerSine.m % % Helper function to fit sine of period 2 pi to the input data. Returns % fittype model. % Equation: a*sin(x+c) + d % % INPUTS: % x - x values for fit, in radians % y - y values for fit (independent variable) % startVals - start values for a, c, and d, as vector % % OUTPUTS: % fittedMdl - ...
f7da730d4a9dcc74f3ca483b6f1cf0878e3c435c5db3c8a26752acb3cd30ed60
MATLAB
810
37
function varargout = dim(varargin) % Format % For getting the value % dat = dim(obj) % % For setting the value % obj = dim(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: privatedim.m 8776 2013-11-14 09:04:48Z roboo...
ffc3eb152837a919b2c9df16b2741eaa9327d329853cc2fcae2f39f2d7e6cb87
MATLAB
810
42
clearvars Range = 1208; load('ZoneMaster.mat') load('ExperimentNames.mat') load('OutNames.mat') ExpList = ExperimentNames(Range); OutList = OutNames(Range); %ReferenceList = vertcat(ZoneMaster{:,1}); for i = 1:size(ExpList,1) ExpName1 = ExpList{i}; ExpName = strcat(ExpName1,'.mov'); OutName = OutList{i}; locator = R...
245a3d0e418be6cf2b03ea5a7c0cd78ec7f55d09c25f65b587e7f7f8f26e3f0a
MATLAB
811
24
% Get header of bookmark % [ Yokogawa MEG Reader toolbox for MATLAB ] % % brief: % This function retrieves information about bookmark in the specified file. % % usage: % bookmark = getYkgwHdrBookmark(filepath) % % arguments: % filepath : file path % % return values: % bookmark : structure ...
41b2c613f5ad73e2300cfbbfcb4371e739b084b53fd5816787245c16b3551a6c
MATLAB
811
33
function results = vl_test_inthist(varargin) % VL_TEST_INTHIST vl_test_init ; function s = setup() rand('state',0) ; s.labels = uint32(8*rand(123, 76, 3)) ; function test_basic(s) l = 10 ; hist = vl_inthist(s.labels, 'numlabels', l) ; hist_ = inthist_slow(s.labels, l) ; vl_assert_equal(double(hist),hist_) ; function...
a2e26d602c50ef7788df89ed6890a66ac117316e2fec288e609356540682f166
MATLAB
811
25
function n_cores_to_use = set_up_parpool_for_flytracker(options) n_cores_on_host = get_maximum_core_count() ; % works on LSF node n_cores_to_use = min(n_cores_on_host, options.num_cores) ; % open parallel pool if not already open if n_cores_to_use > 1 try open_pool = 1; ...
ec5a807f83eb626c6adf1cd905835d5c411df54e2e8c4e006a3e1cec3eb42b91
MATLAB
811
27
close all clear all clc nvtFilename = fullfile(pwd, 'VT1.nvt'); %[TimeStamps, ExtractedX, ExtractedY, ExtractedAngle, Targets, Points, Header] = Nlx2MatVT( nvtFilename, [1, 1, 1, 1, 1, 1], 1, 1, 1 ); [TimeStamps, ExtractedX, ExtractedY, ExtractedAngle, Targets, Points, Header] = ml_nlx_nvt_load( nvtFilename ); outp...
64ff25e4f5005c74d2ea16eb79e7859bac10b987cb156ad07afb7f99b232f041
MATLAB
812
29
function [streamlines,n_nodes] = load_streamlines(directory,pattern) % Load the streamlines given the pattern that represents the groups % Get a list of txt files in the directory fileList = dir(fullfile(directory, "*-"+pattern+"*.txt")); % Initialize the 3D matrix and the list of person numbers numFiles = numel(file...
65eb37999ae33d2ef2fabd7964307251d2960204569067ab55eae7ee7466e300
MATLAB
812
27
function [A,B,C] = cart2tern( X, Y, wlimits ) %cart2tern return ternary coordinates A,B,C from X-Y coordinates % % This assumes, X-Y are defined for A,B,C with wlimits. % First check if length is specified if (nargin<2) error('Too few Arguments') elseif (nargin<3) wlimits = ternary...
85879b11a147174482a5e19be61db2224eba2223856b67dcc3be88fa81795c33
MATLAB
812
37
% mglCameraCapture.m % % usage: cameraImage = mglCameraCapture; % by: justin gardner % date: 10/07/19 % purpose: Function to get an image from a connected FLIR cameras, if you % specify a number, you can get that many consecutive images % e.g.: image = mglCameraCapture % e...
e41aa3e457d9589e699e1b638687245a1676c4bf11bbe93a4f5bb7bd7f84b0c0
MATLAB
812
18
function handles = fix_SwapIdentities( handles, f, fly1, fly2, varargin ) % swaps the identites of two flies, from frame f until their ends % splintered from fixerrorsgui 6/21/12 JAB trk1 = fix_GetPartOfTrack(handles.trx(fly1),f,inf,varargin{:}); trk2 = fix_GetPartOfTrack(handles.trx(fly2),f,inf,varargin{:}); handles....