sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ac12573df8c6389f85706ca010e9fb69f8ac58df55a6adf10a52fba93108ac81
MATLAB
911
22
function [matched_tips, unknown_tips, known_tips] = assign_tips(known_tips, unknown_tips, threshold_distance) %loop until all known or unknown are assigned, or until %threshold_distance is reached matched_tips = zeros(size(known_tips)); known_indecies = 1:size(known_tips,1); while ~isempty(kno...
b586526fcdd86311614b2c581e7ebc622c54c678f24455e76bec137387b9ea73
MATLAB
911
38
function error_area(X,Y,barlength,color,alpha,varargin) X = X(:); Y = Y(:); barlength = barlength(:); if nargin == 6 linestyle = varargin{1}; linewidth = 1; elseif nargin == 7 linestyle = varargin{1}; linewidth = varargin{2}; else linestyle = '-'; linewidth = 1; end Yab...
de376d646a0a7bd4b9da730ddc139ebecbdb0a476c714e399cd6c7178e1f6a53
MATLAB
911
29
function OPT_S = had_step(SC,OPT_S,HAD_S) ind_it=OPT_S.ind_it; OPT_S.las_SLM_flag = 1; OPT_S.cam_SLM_flag = 1; f_fin = OPT_S.f_fin; num_phases = OPT_S.num_phases; phases = OPT_S.phases; %% fit sinus ind_mask=mod(ind_it-1,HAD_S.total_its)+1; mask_f = had_get_mask(SC,HAD_S,ind_mask); for p=2:num_phases f0=f_fin.*(m...
007e90e96bfb50cc3b40f3444f0516e5e888b7a367f753bd2a941fb7fb3b4830
MATLAB
912
36
function saveSepFigures( fileType, location ) %% Save each open figure as the specified file type in a specified location % % % % Maxwell Gagnon 11/17/2017 % This returns the list of all open figures figHandles = findobj('Type', 'figure'); % Loop through each figure and save each for i = 1:length(figHandles) ...
010756beb23e2d545e0566441cda361aeb099458951a48fb1c1bb8dd9683ba3d
MATLAB
912
28
function bn = bacon_numbers(A,u) % BACON_NUMBERS Compute the Bacon numbers for a graph. % % bn = bacon_numbers(A,u) computes the Bacon numbers for all nodes in the % graph assuming that Kevin Bacon is node u. % allocate storage for the bacon numbers % the ipdouble call allocates storage that can be modified in place....
2eb8bda53a0b37b0b04e6475ec216640f32860cdeed4e5c2b4abd421ff704410
MATLAB
912
48
test = round(50*rand(50)); bg = mean2(test) test2 = test; for i = 1:(2+round(5*rand(1))) diameter = 3+round(3*rand(1)) blob = round(bg + (1+(5*rand(1)))*(25*rand(diameter))) x = 9+round(32*rand(1)); y = 9+round(32*rand(1)); test2(x:(x+diameter-1),y:(y+diameter-1)) = blob; end sd = stdfilt(test2); weight ...
a8d3f397caab41fb395aa444f790e154c21097cadb18e3b05a384d9c634e6679
MATLAB
912
31
function H = vl_histmarg(H, dims) % VL_HISTMARG Marginal of histogram % H = VL_HISTMARG(H, DIMS) marginalizes the historgram H w.r.t the % dimensions DIMS. This is done by summing out all dimensions not % listed in DIMS and deleting them. % % Remark:: % If DIMS lists only one dimension, the returned histog...
d6b736159fbd5031e027ce9b25b42c4a463384f430ebbf9a42c1d8e29103fe85
MATLAB
914
29
function bgtraces=generate_outtraces_from_masks_exclude(video,masks) % Generate background traces for each neuron from ground truth masks. % Background intensity is the median of the intensity in the nearby % region of the neuron, but excluding the neuron itself. [Lx,Ly,T]=size(video); [Lxm,Lym,ncells]=size(masks); [...
82f8000faa9f1c4b236ae712f56e6d375903bfe19769abc72c50cc59e84bdef4
MATLAB
915
30
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [hFig] = bfo90table_plot_all_prob(MeanTable, ErrorTable, showExcluded) colours4 = colour_matrix_blue_red_yellow_purple(); Y = MeanTable.all_prob; E = ErrorTable.all_prob; if showExcluded Y(:,5) ...
a24ba7b5aaeae64d125a209278aaa24102ee3606432f9aaeb5d79fbaa6d82377
MATLAB
915
27
% SONDATETIME gets or sets the creation data/time data in a SON file % The date/time are returned in standard MATLAB format % % Implemented through SONDateTime.dll % % DATEVECTOR = SONDATETIME(FH) % returns the creation date/time from the file % DATEVECTOR1 = SONDATETIME(FH, DATEVECTOR2) % set...
de00cc3a03f038d5f8525f1b79199828b63416df7f23dc6b354a93a57a0f654d
MATLAB
915
25
function scores = PascalOverlap(targetBox, testBoxes) % scores = PascalOverlap(targetBox, testBoxes) % % Function obtains the pascal overlap scores between the targetBox and % all testBoxes % % targetBox: 1 x 4 array containing target box % testBoxes: N x 4 array containing test boxes % %...
21962a3e97b0e11be037bce3db3dc1836baac15cf306de44f91e7651a27f4631
MATLAB
916
34
function y = Wfilt(x,f1, f2); % % filter signal at the Whisking range (1 - 50 Hz) % for now only the low-pass works... %Normalized (0 to 1), where 1 corresponds to the Nyquist frequency globals; if nargin < 3 f1 = 1; %Hz, whisking range filtering f2 = 50; %Hz, whisking range filtering end x=cast...
94bd50149370adbe64a0e52df711476d4d09a571b2fd88c3730776f10e1186fb
MATLAB
916
42
function a=cronbach(X) %Syntax: a=cronbach(X) %_____________________ % % Calculates the Cronbach's alpha of a data set X. % % a is the Cronbach's alpha. % X is the data set. % % % Reference: % Cronbach L J (1951): Coefficient alpha and the internal structure of % tests. Psychometrika 16:297-333 % % % Alexandros Leonti...
917aa65ed3768d479c4803119c7e6aafecfb9cdffba504bb4dea96bd43a31c4e
MATLAB
918
30
function [Spos Sneg vpos vneg] = strengths_und_sign(W) %STRENGTHS_UND_SIGN Strength and weight % % [Spos Sneg] = strengths_und_sign(W); % [Spos Sneg vpos vneg] = strengths_und_sign(W); % % Node strength is the sum of weights of links connected to the node. % % Inputs: W, undirected conne...
e2a632c78c468c96886d28cd8eda5718fa7648c7db6c487fe83a447354080741
MATLAB
918
37
function isArgEven = aedes_iseven(inarg) % AEDES_ISEVEN - Check if input is even % % % Synopsis: % % Description: % % Examples: % % See also: % % This function is a part of Aedes - A graphical tool for analyzing % medical images % % Copyright (C) 2006 Juha-Pekka Niskanen <Juha-Pekka.Niskanen@uku.fi> % % Departme...
11e69ba41260905ddb73a80bdcd8481a7da43804da3a3629ef39030b86933e1f
MATLAB
919
37
function [im, scale] = readImage(imagePath) % READIMAGE Read and standardize image % [IM, SCALE] = READIMAGE(IMAGEPATH) reads the specified image file, % converts the result to SINGLE class, and rescales the image % to have a maximum height of 480 pixels, returing the corresponding % scaling factor SCALE....
148e297d9f0a92e6a62ea003f8e4da0943b2849f4da422d9ebb907eaa059de34
MATLAB
919
36
function fun = InvProbV1(x,Imat_t,dsr_t,ni,nh,no,tn,delta,data) wh = reshape(x(1:ni*nh),[ni,nh]); wo = reshape(x(ni*nh+1:ni*nh+nh*no),[nh,no]); bh = (x(ni*nh+nh*no+1:ni*nh+nh*no+nh))'; bo = (x(ni*nh+nh*no+nh+1:ni*nh+nh*no+nh+no))'; y_r = reshape(x(ni*nh+nh*no+nh+no+1:ni*nh+nh*no+nh+no+no*tn),[tn,no]); bhmat =...
9c061ff4603317b4427203f13d0f3fc5032810771fee890237fd458f51d15dec
MATLAB
919
20
%% calculate the topological properties of morphological WM networks path = pwd; cd .. data_path = [pwd '\step0_network_construction']; cd(path) [Net_para, Node_para] = gretna_batch_networkanalysis_bin([data_path '\VBM_smooth'], 'JS', 0.09, 0.3, 0.02, 100, 'pos', 's'); save('VBM_Net_para_bin_smooth.mat','Net_para','No...
ced8f1440b2fdd62a94ed0bd56a5c3dade6951c263acf9fd8d31ead1cb925eb5
MATLAB
919
35
function [avercc, cci] = gretna_node_clustcoeff(A) %========================================================================== % This function is used to nodal clustering coefficient of a binary graph G. % % % Syntax: [avercc, cci] = gretna_clustcoeff(A) % % Input: % A: % The binary adjacency matrix of ...
50d3c56cacd89f25085c24c04560136e0cd4b763fe04b24e7eeabed174a6eeec
MATLAB
921
27
function [report_data] = report_print(report_data, state) % Example of iteration reporting function. % Prints some information about the component. % % Copyright (C) 2004, 2005 DSS MATLAB package team (dss@cis.hut.fi). % Distributed by Laboratory of Computer and Information Science, % Helsinki University of Technology...
6bd21f7bbb7364a6240ce8cd8a080df0ad8d059016735bbd1781b2173ab28077
MATLAB
921
41
function [ynn_t,nn_dyn,Xi,Ai] = TrainNLD(Imat_t,dsr_t,nh,no,tn) X = tonndata(Imat_t,true,false); T = tonndata(dsr_t,true,false); trainFcn = 'trainscg'; inputDelays = 0; feedbackDelays = 1; hiddenLayerSize = nh; netnarx_d = narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'closed',trainFcn); netnarx_...
0005b5d1ea698960563213b676a2aefeeb6230c1195fe0f63571d12e797df4ac
MATLAB
922
39
% Hannah Payne % raster.m % Makes a raster plot % 11/22/11 %{ raster(t) Plots vector of spike times t at a default height of 1. raster(t,y) Plots spike times t at height y. If y is a scalar, all spikes are plotted at same height. If y is a vector (must be same length as t) spikes are plotted at corresponding height. ...
476933faa8741d2ebca1fd8f90be36facc8255ecb6b2275c734f7e47fd3e353f
MATLAB
922
28
function [HistSpl] = OneModifiedCardinalSpline(lag,c_pt) %6/19/22 % adapting method from Sarmashghi et al. paper for one MC spline assert(numel(c_pt) == 2,'this function only handles two control points') HistSpl = zeros(lag,length(c_pt)); %for each 1 ms timepoint, calculate the corresponding row of the glm input matr...
5a75a580e0fd5ba8d620d7b70202952a4af59abd703a3e96b07f7147d81baeda
MATLAB
922
31
function [newList] = interpret_image_list(oldList) % takes an old stimulus list in cell-array form and returns an equivalent % list column with stimulus image file names in the new format nTrials = size(oldList,1); fprintf('List contains %d trials.\n',nTrials); newList = cell(nTrials,1); % loop over trials for i = 1:...
c03ddaf09d90284a14e5ebc997d96ff6e8b70f0edc3d0a66de3e4b1a47820f80
MATLAB
922
50
% % Preferential attachment tests. % % PARAMETERS % $network % % INPUT % dat/pa.$NETWORK.mat % dat/pa_data.$NETWORK.mat % dat/info.$NETWORK % % OUTPUT % plot/pa.[a][auv].$NETWORK.eps % network = getenv('network') consts = konect_consts(); info = read_info(network) pa = load(sprintf('dat/pa.%s.mat', network)); ...
41191af8807213c0c136dcac6a7f42420caf951b7810b01ed329975e95e1081b
MATLAB
923
20
function [filteredTracks, track_indecies_preserved] = FilterTracksByTime(Tracks, startFrame, endFrame, entire_duration_required) %Takes a list of tracks and filters them based on start and end frames. % Detailed explanation goes here %fps = 14; if nargin < 4 entire_duration_required = false; end ...
aae174389d7195f0b8179f294371d54918ecf3f9993ec3a941f5625df7a942a2
MATLAB
924
25
% mglLines2.m % % $Id$ % usage: mglLines(x0, y0, x1, y1,size,color,<anti-aliasing>) % by: justin gardner % date: 04/03/06 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: mex function to plot lines on an OpenGL screen opened with mglOpen. % ...
d119241dcfe93505b49732abcd8b2745cce0fd20053e65fcc03d8bda2e1afb59
MATLAB
924
29
function [CIJ] = maketoeplitzCIJ(N,K,s) %MAKETOEPLITZCIJ A synthetic directed network with Gaussian drop-off of % connectivity with distance % % CIJ = maketoeprandCIJ(N,K,s) % % This function generates a directed network with a Gaussian drop-off in % edge density with increasing distance fro...
13218dcad589fc2735e1fca724d45e05d57f46f3962181b9d145b1d2e718a058
MATLAB
925
33
%% Misc Calibration code clear;clc;close all expmtDataFolder = 'G:\My Drive\Expmt Data\Amin\LTD Project Final Raw Data'; allFiles = dir([expmtDataFolder, '\**\*.mat']); allFiles(contains({allFiles.name}, {'settings'})) = []; allFiles(contains({allFiles.name}, {'time'})) = []; allFiles(contains({allFiles.name}, {'vid...
7098dbcf98258ae1145c8707f89d0c6a525bdb5f75c19df9b42777e699f70614
MATLAB
925
25
function [ISI,LV,CV2] = getLV_CV2 (X) %%% Inter-spike intervals (ISI) & Co-efficient of Variation 2 (CV2) %%% - ISI are the inter-spike intervals %%% - LV and CV2 shows two metrics regarding the variation in spiking intrinsic to the neuron %%% Input: %%% X = spike times j = length(X); ISI = diff(X); fo...
f761dd6eb5c072b3c72075ecbbe61daf26415d3402aa7b3ca80a79c36e0fff88
MATLAB
925
31
function [units, points, preTrig]=SONGetExtMarkInfo(fh, chan) % SONGETEXTMARKINFO returns details about an extended marker channel % % [UNITS, POINTS, PRETRIG]=SONGETEXTMARKINFO(FH, CHAN) % % INPUTS: FH the SON file handle % CHAN channel number (0 - SONMaxChans()-1) % % OUTPUTS: UNITS a string with...
4339cc790c6476025943485caac07f6308472f304ca9c44b5db3c400cc9d64b2
MATLAB
926
26
function allFrames = ml_cai_io_scopereadavi_all(videoFolder, videoPrefix, videoSuffix) fileList = dir(fullfile(videoFolder, sprintf('%s*%s', videoPrefix, videoSuffix))); if isempty(fileList) error('No video files to process'); end numFiles = length(fileList); fprintf('Found %d files to proc...
324e7a147b1a18cf4cb959255add2bb098b5b610e7dc2729b30f4bf654fb3746
MATLAB
927
48
function [pnt, tri] = read_vtk(fn) % READ_VTK reads a triangulation from a VTK (Visualisation ToolKit) format file % Supported are triangles. % % Use as % [pnt, tri] = read_vtk(filename) % % See also WRITE_VTK % Copyright (C) 2002, Robert Oostenveld % % $Id: read_vtk.m 8962 2013-12-05 07:48:46Z roboos $ fid = fope...
05497121b075a07e85cb2c6f300e9f69b951063a50a6a761ba311955d39b4dff
MATLAB
928
62
function class_info=gen_class_info_nyud() class_info=[]; class_info.class_names={ 'wall' 'floor' 'cabinet' 'bed' 'chair' 'sofa' 'table' 'door' 'window' 'bookshelf' 'picture' 'counter' 'blinds' 'desk' 'shelves' 'curtain' 'dresser' 'pillow' 'm...
7075e7adf39d321215b623b50febf955f3edb9ed95f9b0739df72224c813857a
MATLAB
928
34
function simulation_create_directories(outdir, simulation_name, voxel_positions, snrs) folder_simulation_data = [outdir filesep 'simulation_data' ]; if ~exist(folder_simulation_data,'dir') status = mkdir(folder_simulation_data); end folder_simulation_name = [ folder_simulation_data filesep simulatio...
b430669a92ad3495bbb28068cd860c813fd23a1d780f3f983a91ec209c394d07
MATLAB
928
31
function mglEyelinkEDFGetFile(fileName, fileDestination) % program: mglPrivateEyelinkEDFGetFile.c % by: eric dewitt and eli merriam % date: 02/08/09 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Receives a data file from the EyeLink tracker PC. % usage: mglEyelinkEDFGetF...
ccac8c553696c08e669c17d3e50bcf86bde501244b33491674f64585a71b349f
MATLAB
929
34
function disp(obj) % Display a file_array object % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: disp.m 8776 2013-11-14 09:04:48Z roboos $ if numel(struct(obj))>1, fprintf(' %s object: ', class(obj)); sz = si...
93d9a37dd54c55bfde6e1d84613d5c6d0c6a40735f1c634bf73f6482d7d93306
MATLAB
930
25
function timepoints = getTimePointsTrialToAverage(selectionType, timeWindow, data) switch selectionType case 'simpleOnset' [~,timepoints] = intersect(timeWindow,[4:12]); timepoints = timepoints'; case 'variableOnset' [~,zeroIdx] = find(timeWindow==0); threshOnset = 0.1; ...
1fd3ddbdac729f359f88b1b0b6d3bc04a43b7e1b3c62bdb36bc950892cfd5996
MATLAB
932
28
function [] = plot_triangle(centers_x, centers_y, areas, colors, point_down) %plots any number of triangles number_of_triangles = length(centers_x); if nargin < 5 point_down = false(number_of_triangles,1); end hold on for triangle_index = 1:number_of_triangles base_length = sqrt(4*ar...
51f8740685dc494e83198cdb83cc5470518fdec50c84f407ddc439c99ba7a811
MATLAB
932
20
function mltp_compute_bfo_90_placey(obj, session) outputFolder = fullfile(session.getAnalysisDirectory(), obj.Config.best_fit_orientations_placey.outputFolder); rotDeg = 90; numContexts = obj.Experiment.getNumContexts(); mirrorContexts = zeros(1,numContexts); % Set entry to 1 to mirror the context...
6961ed1c969942a2c817f98f650cd543bc1130643cd00e4617e77ba09b2c318d
MATLAB
932
32
function plotresults(results) %% Plot raw data clf; alldata = [results.pupil1(:,1) results.cr1a(:,1:2)... results.pupil2(:,1) results.cr2b(:,1:2)]; ylims = [min(alldata(:)) max(alldata(:))]; %% Camera 1 h(1)=subplot(2,1,1); hp(3) = plot(results.time1, results.cr1a(:,2),'b-'); hold on; hp(1) = plot(results....
bf7fe03870527696f0c5f0a7c02036320ce9f57f357328e0ac1b04af4aedd003
MATLAB
932
21
function [mySquareKernel] = ml_util_compute_rect_compressed_kernel(arenaLengthRatio, smoothingKernelGaussianSize_cm, sigma_cm, cmperbin_square_smallest) % This compute an asymmetric gaussian kernel used for the compressed % rectangle % arenaLengthRatio is length_x / length_y in physical lengths. eg. 20 / 30...
353fac246dc2a2fc45d981b786d9fac8aa0ac642b89fe598cd69693ebf3cd544
MATLAB
933
41
function [ynn_t,nn_dyn,Xi,Ai] = TrainNLD4ParMCNN(Imat_t,dsr_t,nh,no,tn) X = tonndata(Imat_t,true,false); T = tonndata(dsr_t,true,false); trainFcn = 'trainbfg'; inputDelays = 0; feedbackDelays = 1; hiddenLayerSize = 2*nh; netnarx_d = narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'closed',trainFcn); ...
dc808d18b13435d5a627b841827e799b0e5e00af9b665cf6c4291fdf6fda7f27
MATLAB
933
42
% % Plot precisions for one network/method combination. % % PARAMETERS % $NETWORK % $METHOD % % INPUT % dat/precision.$METHOD.$NETWORK.mat % % OUTPUT % plot/precision.one.[a].$MEASURE.$METHOD.$NETWORK.eps % for all $MEASURE % network = getenv('NETWORK'); method = getenv('METHOD'); precision = load(sprintf('dat/p...
e16b7396536f26800ad523726b49b9480aba0452e52ec3c394229562f1683874
MATLAB
933
41
function [ynn_t,nn_dyn,Xi,Ai] = TrainNLD4ParECNN(Imat_t,dsr_t,nh,no,tn) X = tonndata(Imat_t,true,false); T = tonndata(dsr_t,true,false); trainFcn = 'trainbfg'; inputDelays = 0; feedbackDelays = 1; hiddenLayerSize = 2*nh; netnarx_d = narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'closed',trainFcn); ...
fdde5c6a0b37f1efc0ca655bfefeb9163d3e2eac26e7302cb5ec07eaf189be66
MATLAB
934
23
function h=plotCI(data_GA, channel, N, color, varargin) % Plots grand average data with confidence intervals % h = plotCI(data_GA, channel, N, color, varargin) % options: var=ft_getopt(varargin, 'variance'); % this provides the option to manually add the variance matrix if not available in data_GA chanidx=strcmp(data...
07a7bc2d33d19a68949fc7266106c75ccd4640cccfc04adb6aae39ac000586fc
MATLAB
936
32
function [] = Fig01_Example_RawTraces_WT % Fig01_Example_RawTraces_WT.m: Code for plotting the example song trace in Fig. 1a. load('Mic_20210923_02_1.mat') %% parameters RecDur = 1320; % 1320 s = 22 min DAQrate = 5000; %% Target_Range = [0:5000*6.15]+5757000; % 6.15 s figure('Position',[100,100,180,180]) hold on pl...
7c7c23943499aaf42c64a2526a0cee1feb6cb10086ee2e39ff42c46910126277
MATLAB
936
42
% mglTestLines: an automated and/or interactive test for rendering. % % usage: mglTestLines(isInteractive) % by: Benjamin Heasly % date: 03/10/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Test rendering some lines. % usage: % % You can...
8dc4a9ed517e5225008a7786a690e2aaead46418854061d4a3bdaa7764e33d33
MATLAB
936
33
%% how many points are within d and how many within d+d? load('markerCoordinates'); for r= [10 20 30 40 50]; %% smallRadius = r; bigRadius = 2*smallRadius; % gives same area for iSynapse= 1:size(vglut1XY,1); %% within small circle % circle center is iSynapse X and Y circleCenter = [vglut1...
eb0cddac0b8ea3e7de7afd740ead3b99fb4f7c5b936c9140fb884c626b97a58f
MATLAB
936
29
% clear; addpath(genpath('.')) addpath(genpath(fullfile('..','ANE'))) %% dir_video=fullfile('..','data','data_TENASPIS','added_refined_masks'); list_Exp_ID={'Mouse_1K', 'Mouse_2K', 'Mouse_3K', 'Mouse_4K', ... 'Mouse_1M', 'Mouse_2M', 'Mouse_3M', 'Mouse_4M'}; num_Exp = length(list_Exp_ID); eid = 1; Exp_ID = ...
df012f6336c1163f1e7226c09d8c0f18526e4b4131c7425da5d84c20d3daac4a
MATLAB
937
33
function B = internal_energy(alpha,beta,gamma,nPoints) %find the implicit relaxation matrix % Penta diagonal matrix, one row: b(1)=beta; b(2)=-(alpha + 4*beta); b(3)=(2*alpha + 6 *beta); b(4)=b(2); b(5)=b(1); % Make the penta matrix (for every contour point) A=b(1)*circshift(eye(nPoints),2); A=A+b(2)*circshift(eye(nP...
66bd0a4be0bfc69b687c1dd88c27795a8b56180b763bd5d69d4c8faf43ad42e5
MATLAB
938
39
function [x y]=ml_egomaps_bresenham(x1,y1,x2,y2) %Matlab optmized version of Bresenham line algorithm. No loops. %Format: % [x y]=bham(x1,y1,x2,y2) % %Input: % (x1,y1): Start position % (x2,y2): End position % %Output: % x y: the line coordinates from (x1,y1) to ...
74bcdca23e35555eb30b545c40a12c274f6a960a3a80fbdc39f3522a00388aff
MATLAB
938
29
function motion = motionfile_parse(prefix) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % VERSION: SPI April 10th 2014 % prefix is the directory and file name of the movement file for each run % EG: W:\NIGG\Anal...
aadddd94e1143e0fb86a8d6577ff45a7ffae49eade2e15ad589b79ff3eb21ca5
MATLAB
938
32
clear file=dir('ACC*stable*.mat'); k=1;lick_onset=[];neuron_oneset=[]; for jj=1:length(file) load(file(jj).name) totalevent=sort([Events.C1S3;Events.C1S5]); hit=find(outcome(:,1)==1); licktime=[]; for i=1:length(hit) cuetime=totalevent(hit(i),1); tp=find(Events.IN1>=cue...
ff7fbf3ef27187a6d54c82face3f13bdff379c76efde276ba6a7caf0f42301b3
MATLAB
939
39
function ret=SONChanDelete(varargin) % SONCHANDELETE deletes a channel from a SON file % RET=SONCHANDELETE(FH, CHAN {,QUERY}) % FH = file handle % CHAN = channel number 0 to SONMAXCHANS-1 % QUERY (if present) = 0 Do not query % <> 0 Query before deleting (de...
0dc055ae744a30e8a9bb2f3d8f68cfea5288e417d0328399b1bd2278da884277
MATLAB
940
40
function [pos]=bresenham(x1,y1,x2,y2) %Matlab optmized version of Bresenham line algorithm. No loops. %Format: % [x y]=bham(x1,y1,x2,y2) % %Input: % (x1,y1): Start position % (x2,y2): End position % %Output: % x y: the line coordinates from (x1,y1) to (x2,y2) % %...
813620af0631657242eca6840d9ec567c8723f9190c0e397ed73fdfdf1e8eb68
MATLAB
940
46
function [fCorr]=interp_f(F,Fneu,bad_frames) %INPUTS % bad_frames: 2 x #stims array. First column is first bad_frame, second % colummn is last bad_frame %OUTPUTS % fCorr: Neuropil corrected and interpolated F count= size(F,1); fCorr=F-Fneu*.7; intervals= zeros(size(bad_frames,1),2); intervals(:,1)=...
2546edc86711eb701d1d6500a6afe64623ebeccbc4bfc507c0528e15f2cf4b02
MATLAB
941
24
function [cut] = cut_timestamps(vector_stamps, vector_marker, m_t, p_t, n_marker) %% Function to cut timestamps based on a specified marker and time window %% authors: Stefano Diomedi %% date: 22nd February 2024 % %% Inputs: % vector_stamps: Vector of timestamps % vector_marker: Vector of markers % ...
fa30f445192eace264a2a2d337507d21511e856460080b78d576bdce87917509
MATLAB
941
37
function angles = ml_alg_center_out_angle_discrete_bias(nX, nY) % This computes the samples of center out angles when points are % picked uniformly at random from rectangular maps of size nX by nY if mod(nX,2) == 0 centerX = nX/2; else centerX = 1 + (nX-1)/2; end if mod(nY, 2) == 0 ...
20fab7577ee401812daa7db2fca98c5bb455881b8ef380ea5fd59c5df7e3bb22
MATLAB
942
28
function [A, W] = dss_fastica(Y, wM, dwM, params) % DSS with FastICA-like interface % [A, W] = dss_fastica(Y, wM, dwM, params) % Y Whitened data % wM Whitening matrix % dwM De-whitening matrix % params DSS algorithm parameters (optional) % A Mixing matrix (de-whitened) Y = A...
92f5e0644b7293cb69a7f4618c8a4032ebb6f467041edbbe89d0672a45ebd990
MATLAB
942
49
function [dirv] = ml_alg_placemap_dirvector(mapA) % Some maps can be all zeros or all nan or empty, so check if all(mapA == 0, 'all') || all(isnan(mapA), 'all') || isempty(mapA) dirv = []; return end nX = size(mapA,2); nY = size(mapA,1); if mod(nX,2) == 0 cent...
e21abfc1a43aa98f9ccacd80caa1ccd29da08e967b2ba2aa0cc275f229eba976
MATLAB
942
35
function [VelSineFit, amp, phase] = desaccadeAndSineFit(eye_pos_raw) %% PARAMETERS samplerate = 1000; presaccade = 50; postsaccade = 50; freq = 1; segLength = length(eye_pos_raw); segTime = (1:segLength)/samplerate; eyeVel = diff(eye_pos_raw); params.saccadeThresh = 10000; params.NoiseAnalysis = 0; %% REMOVE OBVIOU...
335b9558c892a394b4a62359a169038f3d7653b25644d896f5db75e1e584d34d
MATLAB
943
41
function files = checkMinNumSamplePerInd(files) %init indexrem = []; numSamplePerInd = zeros(numel(files), 1); %larger init to be sure %loop on files to compute num of samples for each ind for i = 1 : numel(files) filename = files(i).name; ind = str2double(getIndName(filename)); %IITD numSample...
abdafa72dc707f241df1da6de5d652fbebd0e19715914cef710c14596020842b
MATLAB
944
45
function output_info=cnn_layer_path_merge_forward(input_info, layer, work_info_batch) assert(input_info.is_group_data); input_info_child_groups=input_info.data_child_groups; child_num=length(input_info_child_groups); input_info_paths=cell(0); for g_idx=1:child_num one_input_info=input_info_child_groups{...
d35b832027f96429c0200e58ec0e324b4864cbd9ac5d98482da4bc148083baff
MATLAB
944
35
function output_info=move_output_info_gpu(output_info) if output_info.is_group_data data_child_groups=output_info.data_child_groups; output_valid_flags=output_info.child_valid_flags; data_child_groups=data_child_groups(output_valid_flags); child_num=length(data_child_groups); for g_idx=...
d75d89849871a809e97460f8ab41baf9db7eb422664be703912c5b8ea6857a71
MATLAB
944
49
function [d dt pred] = bfs_in_mbgl(A,u) % BFS_IN_MBGL Reimplement the BFS function with MatlabBGL visitors. % % [d dt pred] = bfs_in_mbgl(A,u) % % See BFS % % Example: % load ../graphs/bfs_example.mat % d = bfs_in_mbgl(A,1) ip_d = ipdouble(-ones(num_vertices(A),1)); ip_dt = ipdouble(-ones(num_vertices(A),1)); ...
dd431b368e09497961f8652f7a543d65da8b173d62903577a41952d23c0cfbbf
MATLAB
944
39
function points_new = Renum_from_center(points,center,width) %RENUM_FROM_CENTER % 詳細説明をここに記述 D = pdist2(center,points); figure; histogram(D); N = ceil(max(D/width)); points_new = zeros(size(points)); %id = D<width; %a = SolvingTSP(points(id,:)); id = D<width; b = points(id,:); a = SolvingTSP(b); point...
f5f0c601d24e7eb83a0c15efa967126b30dc24187839117dc2ea91095091c942
MATLAB
944
22
function [task myscreen] = mglEyelinkCallbackTrialStart(task, myscreen) % mglEyelinkCallbackTrialStart - % % Usage: mglEyelinkCallbackTrialStart(task, myscreen) % program: mglEyelinkCallbackTrialStart.m % by: eric dewitt % date: 04/03/06 % copyright: (c) 2009,2006 Eric DeWitt, Justin Gardner, Jon...
f8be8bc6a179e62014cc1b516841ea466d8fcc245543f7c438bd5e54189a7928
MATLAB
944
23
% SONFMODE creates a filter mask structure and/or % sets the mode for marker filtering % % Implemented though SONFMode.dll % % FILTERMASK=SONFMODE(MODE) % FILTERMASK=SONFMODE(FILTERMASK, MODE) % % INPUTS: FILTERMASK, if present, is a filter mask structure that will be % copied to the output % ...
88e1bc3e06fd9cb486c5c9f3b70afa91b7c8477f6b6ff92164bd2c28f165b5dd
MATLAB
945
35
function [] = ExtDataFig01_Example_TimeCourse_OptStim_Song_TN1A % TargetFileID = 2; load('../Data/Summary/Mic_20211129_02_3.mat') load('../Data/Summary/OptStim_20211129_02.mat') TargetTrial = 1; % 4-2, 3-1, 3-5 load('../Data/Summary/EthogramComb_dPR1_Chr.mat') %% parameters nStim = 6; RecDur = 1320; % 1320 s = 22 m...
ba4c1c7f270d0fc043c3028a02f6bada2bb026e6bae89025ddf852c1e72962f0
MATLAB
945
39
function [rotSeqRec, rotSeqVal] = ml_compute_best_map_rot_sequence(pmSet) nMaps = size(pmSet,3); R = nan(nMaps, nMaps); rho = nan(nMaps, nMaps); for iMap1 = 1:nMaps for iMap2 = 1:nMaps m1 = pmSet(:,:,iMap1); m2 = pmSet(:,:,iMap2); m2Rot = rot90(m2,2); ...
9943aa1ddea6cd6f088fb64c7276f011a840ba0f646c36aac77a809b43ae7938
MATLAB
946
19
classdef ContractPinTest < matlab.unittest.TestCase % The client's copy of the shared contract (upload_contract.json, from tests/web/ in the % server repo) must be the version pinned here. To change the contract, copy the new file % in, update the hash below, and update tests/web/upload_contract.sha256 in t...
d9cdc3f9aad7211457b603b366a8150901797d52c19a3e45a34516d9a6913175
MATLAB
946
41
function varargout = getarg( args, id, varargin ) if isstruct(id) || isobject(id) for f = fieldnames(id)' [args,val] = getarg(args,f{1}); if ~isempty(val) id.(f{1}) = val{1}; end end if nargout == 1 varargou...
e3083a9eb72136ba7505b68fc9f0d308249129089797afad75ddad6ebcc92700
MATLAB
946
37
function output_info=move_output_info_cpu(output_info) if output_info.is_group_data data_child_groups=output_info.data_child_groups; output_valid_flags=output_info.child_valid_flags; data_child_groups=data_child_groups(output_valid_flags); child_num=length(data_child_groups); for g_idx...
3aa508ea89ebada7cc7da55ece32da66c1735aa8a582ad3a3389048be3cb5a33
MATLAB
947
27
function tree = set(tree,uid, parameter, value) % XMLTREE/SET Method (set object properties) % FORMAT tree = set(tree,uid,parameter,value) % % tree - XMLTree object % uid - array (or cell) of uid's % parameter - property name % value - property value %____________________________________________________...
7718fa11614aa5df575851503423251af7442315824981dd4debc3feb8dd7752
MATLAB
947
29
function [eyevelOut, omitCenters] = desaccadeVel(eyevelIn, threshold, presaccade, postsaccade, ploton) %% Find saccades in eye movement and blank out an interval on either side %find regions of data outside threshold; omitCenters = abs(eyevelIn) > threshold; %remove points around omit centers as defined by pre- & p...
bab9b9df95d9fa7203e1f3eafe885f8732fe7ed0e620f068313f98a2cd206ae7
MATLAB
948
33
% smoLegPos.m % % Function that takes in shifted, rotated, and normalized leg position and % smooths it using Gaussian process smoothing. % % INPUTS: % srnLeg - shifted, rotated, normalized leg position matrix (output of % shiftRotateNormalizeLegPos()) % smoParams - parameters for Gaussian process smoothing % ...
c803484f18175b5b7e17949ce2078508a0d39d222f51fc6e139b915c6b0e63ca
MATLAB
948
32
function [traces]=generate_traces_from_masks_mm(mm,masks) % Generate background traces for each neuron from ground truth masks [Lx,Ly,ncells]=size(masks); T=mm.Format{2}(2); % [xx, yy] = meshgrid(1:Ly,1:Lx); % r_bg=sqrt(mean(sum(sum(masks)))/pi)*2.5; % if Lx==Lxm && Ly==Lym % video=reshape(video,[Lxm*Lym,T]); % ...
ecf136a0383e25e88b162b7e60efe20b3c6d140c5b9f95e24026e99d9749e880
MATLAB
949
29
function nii_deface_TRACE %dirs = dirVisible('/Users/chris/SOOP/bids/sub-*'); %dirs = dirVisible('/Volumes/SOOP/soup/sub-*'); dirs = dirVisible('/Users/chris/SOOP/sooper/sub-*'); dirs = dirVisible('/Users/chris/fx/bids/sub-*'); for i = 1 : length(dirs) folder = fullfile(dirs(i).folder, dirs(i).name, 'anat'); fl...
377e9492263a5e3b03c4b14cf7486b4b3e255d0c9cd2a0d6e7ccc22f5f9eb131
MATLAB
950
62
%% i=2;% participant j=3;% surviving frames k=[3 1 2]; % parcel='HCP_subcortical'; f=filesep; list=dir([parcel f 'fconn*']); load([pwd f parcel f list(k(j)).name]) load([pwd f parcel f 'raw_timecourses.mat']) % clc cellfun(@sum,mask) ix=find(mask{i,j}); x=raw_tc{i}; whos ix x R=corr(x(ix,:)); RR=fconn(:,:,i); c...
872bbe07e7e9108003716a2b99700685ede4b91f100f1a55794c93389fec91dc
MATLAB
950
27
function log_entry = update_logs(folder_name, script_name, status, job_ID, comment) % update the logs on cluster try master_log_name = '/tigress/LEIFER/Mochi/logs/masterlog.csv'; error_log_name = '/tigress/LEIFER/Mochi/logs/errorlog.csv'; log_name = [folder_name,filesep,'status.csv']; ...
28a95a3a6cf8cd376886ce1c34687e024bb260cc491b4531d0648183e4b7a8ce
MATLAB
952
24
function AI = calculate_atonia_index(n_MiniEpochs,Fs,toConsider,averageEMGMiniEpochs_corrected) %Help function to calculate the atonia index % Create a vector with the miniEpochs to consider include_miniEpochs = zeros(n_MiniEpochs,1); for i = 1:n_MiniEpochs theseSamples = (i-1)*Fs+1:i*Fs; if sum(toConsi...
383b3a5205464d03b027c54a5df0d2faaf936bc6800dfd66431b2ae655d9fcef
MATLAB
952
28
function [x_max y_max A]=crit_interp_p(y,x) %[x_max y_max A]=crit_interp_p(y,x) %fits a parabola to three points: y=[y(x(1)) y(x(2)) y(x(3))]. %Returns the position (x_max) and value (y_max) of the %interpolated critical point (peak or trough). %If x is omitted, it is assumed to be [-1 0 1] %y=A(1)*x.^2+A(2)*x+...
bde4b8d3a8f1357b221bbd71e01e10611ddb4a717ed273737783617f1d92ea57
MATLAB
952
34
% % Determine the median distance in the network, from the hop % distribution. % % In case the atcual median value would be a non-integer, because we are % averaging between two values, the result is rounded up, to always % result in an integer. There must always be one pair of nodes for each % possible distance betwe...
c5024da1a108b1e62e630bb5fc833db847b661078e60aa405bfbb79861c9082a
MATLAB
952
28
function [seq] = make_sequence(data_set) %% Function to generate emission sequence for a given trial across neurons %% authors: Stefano Diomedi %% date: 22nd February 2024 % %% Inputs: % data_set: Binned timestamps matrix (n_neu x n_bin) %% Outputs: % seq: Emission sequence generated for the trial ...
08e77fb41700362117a223e50d301d4b35cd64c0e889c6a1c79f866704476018
MATLAB
953
35
% sankey demo1 % ----------------------- % @author : slandarer % 公众号 : slandarer随笔 % 知乎 : slandarer figure('Name','sankey demo1','Units','normalized','Position',[.05,.2,.5,.56]) links={'a1','A',1.2;'a2','A',1;'a1','B',.6;'a3','A',1; 'a3','C',0.5; 'b1','B',.4; 'b2','B',1;'b3','B',1; 'c1','C',1; 'c2',...
2dab781ce142e99640b863b1bcdb4eeff961eadff25e960bb1687d34131be369
MATLAB
953
31
function [cnmfe, p] = ml_cai_cnmfe_compute( cnmfeOptions, alignedScopeFilenameFull, varargin ) p = inputParser; p.CaseSensitive = false; addRequired(p,'cnmfeOptions', @isstruct); addRequired(p,'alignedScopeFilenameFull', @isstr); addParameter(p,'verbose', false, @islogical); parse...
8623eaafcfe0d57081d035d5aae64bf05d7f0fd5b1a7a0011755f3bc864642e3
MATLAB
953
33
close all addpath("matlabPyrTools"); addpath("matlabPyrTools/MEX"); warning('off', 'Octave:possible-matlab-short-circuit-operator'); im0 = pgmRead('reptil_skin.pgm'); % im0 is a double float matrix! Nsc = 4; % Number of scales F: 4 Nor = 4; % Number of orientations F: 4 Na = 9; % Spatial neighborhood is ...
93df9436c1a755953fe769a7a38c731c130556b3916dce326d8dfb0727f406e4
MATLAB
954
36
function [AUC] = gretna_auc(Netpara,Delta) %========================================================================== % This function is used to calculate area under curve. % % % Syntax: function [AUC] = gretna_auc(Netpara,Delta) % % Inputs: % Netpara: % Network parameters (m*n, m = observ...
9f676cd814a87451654a6420402ea2faf16958442fcea895c73715eaa1ab2296
MATLAB
954
47
% % Return suitable values for the parameters of axis() given the % range. % % Given X axis values, it returns values of axis(1) and axis(2). % Given Y axis values, it returns values of axis(3) and axis(4). % % PARAMETERS % x (n*1) Values to be plotted % is_log (0/1) Whether a logarithmic axis is used % % RESULTS %...
f9d1938ec0bd6b63bc5ffb35b92bf559aff1d9d46f6a139d901003598134d535
MATLAB
954
28
% Ehud, you'll need to change the paths here. I've put all of the files % you'll need to run this up on the storWIS. files=dir(fullfile('D:\Tracking\Thalamus\Thalamus36\20150906Thalamus36\PhaseII','*.mat')); centerAll=importdata('C:\\Users\\bnoram\\Desktop\\Phase\\Center\\center_all.mat'); for ii=1:length(fil...
b0fecc78e642aafb7f932320cad35d293063dab97bfcda88e8bfe5f9b71f17c2
MATLAB
955
29
% % Whether statistics should go up or down according to the shrinking diversity hypothesis. % function [updown_statistic] = get_updown_statistic() updown_statistic.diameter = -1; updown_statistic.network_rank_sq = -1; updown_statistic.network_rank_norm4 = -1; updown_statistic.gini = +1; updown_statistic.cont...
38f2146e6abdc464220ca9e5fa3a91099a154fee58510af6e7ba17f214390e59
MATLAB
956
31
function [units, points, preTrig]=SONGetExtMarkInfo(fh, chan) % SONGETEXTMARKINFO returns details about an extended marker channel % % [UNITS, POINTS, PRETRIG]=SONGETEXTMARKINFO(FH, CHAN) % % INPUTS: FH the SON file handle % CHAN channel number (0 - SONMaxChans()-1) % % OUTPUTS: UNITS a str...
6725a1cec21d37b6ede3fec455fcc801025ef545dbea3efbc39c8355bf009080
MATLAB
956
37
function [s] = stderr(data, varargin) %stderr.m % history % 9/28/20 updated to add omitnan % 2nd optional arg is dim % 3rd option arg is nanflag % 10/23/20: noticed header line said se, changed to stderr % to match file name % 5/7/23 updating so default dim is largest input dim dropnan = false; if nargin >= 2 && ~...
a67f5075c08a83137229e0c9dc934560a8e1463e6300c59549110423dc513a46
MATLAB
956
38
function dxdt = GBMFuncidentifiable(t,x,fixed,params,indexchooseparam) % This is our model of treatment free glioblastoma-immune dynamics to % be used for practical identifiability analysis (GBM_identifiability_main.m). % The code allows certain parameters to be fixed while others are % varied in ord...
c4ac04777fd31e82da0a3f7f1a541896a422a0fde7b364668ba08dcc8c3f63bc
MATLAB
956
27
function [ns_RESULT, LastError] = ns_GetLastErrorMsg(); %ns_GetLastErrorMsg Retrieves the extended error message for the last %error % % Usage: % [ns_RESULT, LastError] = ns_GetLastErrorMsg % % Description: % Returns the last error message in text form to LastError. This % function should be cal...
e37d9885b30f98fc1bcd3859c4c03c780adac65c378a2bba381a6ee09de663d8
MATLAB
956
31
function [params,X,means,wX,wM,dwM] = pre_sphere(params, X, dim) % Spheres the data with the eigenvalue decomposition of the covariance matrix % [params,X,means,wX,wM,dwM] = pre_sphere(params, X, dim) % X Data to be sphered % dim Requested result data dimension % wX Sphered data % wM Sphering ...
026bb5634ca2773989d3d63a3dc6d6e88f5f546fae79fa4c5c162366afad1be2
MATLAB
957
30
function [params,X,means,wX,wM,dwM] = pre_sphere_symm(params, X, dim) % Spheres the data with covarianve matrix eigenvalue decomposition. % [params,X,means,wX,wM,dwM] = pre_sphere_symm(params, X, dim) % X Data to be sphered % dim Requested result data dimension % wX Sphered data % wM Sphering ...
020c81da66f2df4397c1fadbeafe1d0efdc4cdf167038f78c179c642d7c30431
MATLAB
958
40
% % The means by linear regression. % function [U,V] = means_regr(T, m, n) r = size(T, 1); s = round(r * .8); val = (1+s) : r; A_training = konect_spconvert(T(1:s, :), m, n); A_training_mask = (A_training ~= 0); A_testtraining = konect_spconvert(T, m, n); A_testtraining_mask = (A_testtraining ~= 0); meane ...
1609b3f7a6ee55e21006d5236179bc4690e2c4a2ba83024ecd9fbd0b353f8249
MATLAB
958
26
function [ text ] = getPatientInformation( obj ) % Display information about patient. % % Syntax: % GETPATIENTINFORMATION( obj ); % % Input parameters: % * obj - object containg data % % Example: % GETPATIENTINFORMATION( ); % % Available at: https://github.com/NCN-Lab/DBScope % For referencing, please use: Andre...