sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d3dbe9d6821233406f0f01c55a98ad4b0c7b9a2dd6467e18e80a223f80874103
MATLAB
733
27
function [t] = normalized(v) %% Normalize the input vector or matrix such that the rows sum up to 1. %% authors: Stefano Diomedi %% date: 22nd February 2024 % %% Input: % - v: Input vector or matrix to be normalized. if size(v, 1) == 1 % If v is a row vector k = length(v); su = 0; for i = ...
2e96ae83893b825bf3a829374401a34de416c56b4dfa471c4843392f050faebb
MATLAB
734
32
% mglMetalCleanup.m % % usage: mglMetalCleanup() % by: justin gardner % date: 09/29/2021 % purpose: Helper function to clean-up directories for digital % function mglMetalCleanup % get mgldir mgldir = mglGetParam('mgllibDir'); % change directory curdir = pwd; cd(mgldir); % get all recompiled fi...
ae92ab61112cd5451bedb86b679bef1a0895aa9dfaa9b81c1966d5a0cce00f8e
MATLAB
734
35
function varargout = scl_slope(varargin) % Format % For getting the value % dat = scl_slope(obj) % % For setting the value % obj = scl_slope(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: privatescl_slope.m 8776 20...
42dc322b75dd017c91d206fbee32a24e1d108848ebac103af45ee71998b47ef7
MATLAB
735
24
function [S] = smallworldness(mat) % This function calculates the small-worldness of a given connectivity % matrix. % Calculate C and L of original matrix len_mat=1./mat; % conection-length matrix d_mat= distance_wei(len_mat); C=mean(clustering_coef_wu(weight_conversion(mat, 'normalize'))); % clusterin...
97782e91ccd4d4dfff04479577e80799a01472314ac9609ed20e1932afd30555
MATLAB
735
31
function [fim] = fbRun(fb,im) % function [fim] = fbRun(fb,im) % % Run a filterbank on an image with reflected boundary conditions. % % See also fbCreate,padReflect. % % David R. Martin <dmartin@eecs.berkeley.edu> % March 2003 % find the max filter size maxsz = max(size(fb{1})); for i = 1:numel(fb), maxs...
b358e8ba369749676e375ed80029ef00b15a157c286bada80981168f03481d80
MATLAB
735
36
function varargout = scl_inter(varargin) % Format % For getting the value % dat = scl_inter(obj) % % For setting the value % obj = scl_inter(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: privatescl_inter.m 8776 20...
f70a627d8c61c73f236fba04b6b17d980f29c471566b975917b485ca66317107
MATLAB
735
35
function [video] = ml_cai_io_scopereadavi(filename) %v1 = VideoReader(filename, 'VideoFormat', 'Grayscale', 'BitsPerPixel', 8); %frames = zeros(v1.Height, v1.Width, 1); % v = VideoReader(filename); % % i = 1; % while hasFrame(v) % frames(:,:,i) = uint8(readFrame(v)); % i = i + 1; % end % i = i - 1; o = Vide...
00064b4cb153e9b0c1c1f3bbfab39aa2a1e8a16d296abf2009ab3c3f466d25db
MATLAB
736
23
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function T = calcium_compute_fraction_occupied(folder, useSmoothed) tmp = load(fullfile(folder ,'calcium_occupancy_maps.mat')); T = table2struct(tmp.OccupancyMaps); for iRow = 1:length(T) if useSmoothed ...
29530c2f7885a7f3ade12a3fa66f3d31aca7c77b4f94efee4fe6aff954e291e4
MATLAB
736
20
function flag=SONSave(fh, chan, sTime, bKeep) % SONSAVE sets the write state for a channel from a specified time % % FLAG=SONSAVE(FH, CHAN, STIME, BKEEP) % INPUTS: FH is the SON file handle % CHAN is a channel number (0-SONMaxChans()-1) or -1 for all % channels % STIME the time for this write...
33b28893d641f931becd982d7bf8e7cd1b6723a9537bb940640a6880aa660452
MATLAB
736
23
function handles = SelectFly(handles,fly) % change the selected fly to a specified one % splintered from fixerrorsgui 6/23/12 JAB if ismember(fly,handles.selected), % set the current fly as unselected fix_SetFlySelected(handles,fly,false); i = find(handles.selected==fly,1); handles.selected(i) = []; else % s...
0f50d72bf4ca3db1e2777f02f81808b3fc9fdd9d460c38662e96d6e9621cdec2
MATLAB
738
19
function [edges_s,edge_type,myosin2,P] = remove_myosin2(edges_s,edge_type,myosin2,P) % randomly remove one myosin rod aux = find(edge_type == 4); if ~isempty(aux) aux_e = randi(length(aux)); aux_r1 = find(myosin2 == edges_s(aux(aux_e),1)); if ~isempty(aux_r1) aux_r2 = find(m...
2362c91be0abc402641e5f1177ac013eb3ea24274d8f38e6edea2b64cd799b02
MATLAB
738
30
function lkh = calcLH4(data, kk, idx, chr) train = [chr(kk).distG, chr(kk).distP]; train = sortrows(train,1); %Region for normalization LG = 0-0.01; UG = chr(kk).length; LP = 0; UP = max(chr(kk).distP)+1; [distP_construct,distG_construct] = genomicAndPhysicalDist(data, [], [], []); for ii = 1:max(idx) %loop through...
4b4e719a37b5c6a0209d60bc5b7ea295028ad7367508763e6d8d903746c86ce1
MATLAB
738
28
function f = zeromean(m,dim) % function f = zeromean(m,dim) % % <m> is a matrix % <dim> (optional) is the dimension of interest. % if supplied, subtract off the mean of each case oriented along <dim>. % if [] or not supplied, subtract off the global mean. % % subtract off the mean of <m>, either of individual case...
6b4aa7560f22de1c39764e1de2dd9a92d9ee1bf8eb4bd79cbbc445af1c5217aa
MATLAB
738
23
function Protated = qRotatePoint( P, Qrotation ) % qRotatePoint: rotate a point according to rotation quaternion % Protated = qRotatePoint( P, Qrotation ) % IN: % P - point which is rotated % Qrotation - quaternion describing the rotation (axis and angle) % % OUT: % Protated - rotated point % %...
256562ace20b73afbd4e2bd4b9968c69f939b34850fe6455c25d28847ccc07a0
MATLAB
739
26
function F = isfield(tree,uid,parameter) % XMLTREE/ISFIELD Is parameter a field of tree{uid} ? % FORMAT F = isfield(tree,uid,parameter) % % tree - a tree % uid - uid of the element % parameter - a field of the root tree % F - 1 if present, 0 otherwise %________________________________________________...
2635dbabfc0f6aee7504c5d9d4340e13cdb76eaea36b456637ea048489b4dd17
MATLAB
739
18
function [informationRate, informationPerSpike] = ml_placefield_informationcontent(meanFiringRate, meanFiringRateMap, positionProbMap) % Compute the information rate (bits per second) % Find the non-zero entries of the position probability [nzi, nzj] = find( positionProbMap > 0 ); informationRate = 0; ...
941d627c049100bc9c11317156603eec18c70458df2fbbca7d6d1715167a195a
MATLAB
739
26
function filename_censored_data = make_filename_censored_data(handles) ix=find(handles.mc.motions); mc_method=char(handles.mc.methods{ix}); fd=num2str(handles.mc.FD_th,'%4.2f'); fd(fd=='.')='_'; min_frames=num2str(handles.mc.min_frames); skip=num2str(handles.mc.skip); tr=num2str(handles.mc.TR,'%4.2f'); tr(tr=='.')='_...
ff30db35b07ea4858ffdf7da4d970a271b70c2998ff3ef31199166ded383e5d6
MATLAB
739
25
% Calculate the critical value and p-value function [HRT, HRTpvalue] = ml_stats_hermansrassonp(sample) n = length(sample); m = 1000; rt = nan(1,m); for i = 1:m rsample = ml_stats_gen_uniform_samples(n, 0, 2*pi); rt(i) = HermansRassonT(rsample); % from random samples end HRT = Her...
2036eeca729af95ce0511a599c7d13a26d8c9c64bb50db4b58383e7e9c9fe5af
MATLAB
740
28
% mglSocketReadString.m % % usage: s = mglSocketReadString(socketInfo) % by: justin gardner % date: 01/26/23 % purpose: Reads a string from the socket % function s = mglSocketReadString(socketInfo) % get scoket if nargin < 1 || isempty(socketInfo) ...
2442ebba55a76e92380af281a066803d076b689b7da07344d311116c55f7fed8
MATLAB
740
19
function [clusterFiles] = ml_nlx_mclust_dir_clusters(folder) % Returns a 'dir' result for MClust cluster files that have the standard % names like TT4.clusters. This is used so that we can filter out odd names % like TT4hull_maybe.clusters. % Get all of the regular cluster files. Do not keep autosave.clusters or ...
753e5ed8c0a6810d3bb3c87789934ae8c8af2339d6ff8f43491026b8436a5f28
MATLAB
740
23
function rate=SONIdealRate(fh, chan, newrate) % SONIDEALRATE gets or sets the ideal sampling rate on a channel % % RATE=SONIDEALRATE(FH, CHAN) % returns the current rate on channel CHAN in file FH % % RATE=SONIDEALRATE(FH, CHAN, NEWRATE) % returns the rate at the time of the call an sets a new rate if NEWRATE>0 % Cauti...
1d96fd00dd4ad119cf70e82640e6a43cbdcef5a94b3ecfd39056d89830fe3b31
MATLAB
741
24
function fh=SONOpenOldFile(filename, iMode) % SONOPENOLDFILE opens an existing a SON file and returns a handle % from SON32.DLL. Note that this is not a MATLAB handle. % FH=SONOPENOLDFILE(filename, iMode) % filename is a string % iMode = 0 for Read/Write % ...
648be76746a02108a26db7fbfb62577858e4d242d89abf7db4a3bac2328f7596
MATLAB
741
35
function varargout = offset(varargin) % Format % For getting the value % dat = offset(obj) % % For setting the value % obj = offset(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: offset.m 8776 2013-11-14 09:04:48Z ...
9b97a45b8034f964333fa45d7557ccff55d99dcfb0720fe4b8a6e1c840c43a40
MATLAB
741
20
function bemf2_graphics_vol_field(temp, th1, th2, levels, a, b) % Volume field graphics: plot a field quantity temp in the observation % plane using a planar contour plot. Revision 071318 % % temp - quantity to plot % th1, th2 - two threshold levels introduced manually % levels - number of levels in the cont...
5416e37784afae808aa037527307f5a5312aa26e10bc50cd35afd6a05eed3bdd
MATLAB
742
32
function [beta, intercept, R2, MSE] = my_linreg(X, y) if length(X) ~= length(y) error('X and y must have the same number of elements.'); end X = [ones(length(X),1) X(:)]; beta = X \ y(:); intercept = beta(1); y_pred = X * beta; RSS = sum((y - y_pred).^2...
7c930d92f46e80985c20ad07f8cb0c3f0418c29e71fdcc27bfff22c40e6df423
MATLAB
742
34
% % Computer effective diameter. % % PARAMETERS % $network % $percentile (between 01 and 99) % % INPUT FILES % dat/hopdistr.$network % % OUTPUT FILES % dat/statistic.diameff$percentile.$network % network = getenv('network'); percentile_text = getenv('percentile'); percentile = str2double(percentile_text); if ...
97746315c5fa72bb090e99282b68e319d090770882674a69b0aea4da774670b6
MATLAB
742
23
function newRect = CenterRectOnPoint(rect,x,y) % newRect = CenterRectOnPoint(rect,x,y) % % CenterRectOnPoint offsets the rect to center it around an x and y position. % The center of the rect is reported by RectCenter. % % See also PsychRects, RectCenter % 9/13/99 Allen Ingling wrote it % 10/6/99 dgp With permis...
4920d0d7aca0ff9aee7420f80ef06d828c07616518acd251d2238b84da65e985
MATLAB
743
33
function om_save_full(data,filename,format) % OM_SAVE_FULL Save full Matrix % % Save full Matrix % % SYNTAX % OM_SAVE_FULL(DATA,FILENAME,FORMAT) % % FORMAT : can be 'ascii' or 'binary' (default) % % Created by Alexandre Gramfort on 2007-11-27. % Copyright (c) 2007 Alexandre Gramfort. All rights r...
a40649db1a340a87e6941e4ad00ca6676fac0e92ba0db49271e80ad73e7c7093
MATLAB
744
44
function varargout = myparse_nocheck(params,varargin) nout = nargout; % set defaults ncopy = min(nout,floor(length(varargin)/2)); doreturnleftovers = ncopy < nout; % parameter names names = varargin(1:2:end); varargout = varargin(2:2:2*ncopy); % go through parameters i = 1; leftovers = {}; while true, if i > le...
ce61cefac1ca5447843d5fa9342feebe26325e9c27c972b61d12b41d73324e81
MATLAB
744
16
clear; close all; clc; % Get the metadata for a dataset from the HDF5 file h5disp('data_motor_unit.h5','/') % We can see that the dataframe is organized in two 'groups' (FDI and TA) % and inside each group there are two 'datasets' (PRE and POST). Each % 'member' within a dataset is the data of one participan...
3c7d04fe7007e6987081e45da6b48e898c655cc1416bf75ed468a79ad5cb4ad6
MATLAB
745
23
function state=SONExtMarkAlign(fh, n) % SONEXTMARKALIGN gets and sets the alignment state for marker channels % This is a feature of V7 of the SON filing system % Using aligned markers improves cross-platform portability of SON files % STATE=SONEXTMARKALIGN(FH,N) % FH= SON file handle % N = -2, Check ch...
55431f41b4092eade26cdf563e37c95d1f9895b0fe9e7b2e98c1c27176799269
MATLAB
745
32
function [sig,mixedsig]=demosig(); % % function [sig,mixedsig]=demosig(); % % Returns artificially generated test signals, sig, and mixed % signals, mixedsig. Signals are row vectors of % matrices. Input mixedsig to FastICA to see how it works. % @(#)$Id: demosig.m 8776 2013-11-14 09:04:48Z roboos $ %create source s...
7322eda5c1a1a0c4ed6cf7a2b254bc32fabb096825f47c43a40004b8f01ec6da
MATLAB
745
26
function [p,t,pix]=meshfix(p,t,ptol) %MESHFIX Remove duplicated/unused nodes and fix element orientation. % [P,T]=MESHFIX(P,T) % Copyright (C) 2004-2012 Per-Olof Persson. (See DISTMESH/FIXMESH) if nargin<3, ptol=1024*eps; end if nargin>=2 & (isempty(p) | isempty(t)), pix=1:size(p,1); return; end ...
26ef4bb3d339bc14e5303694233e3be1dacccb7a0459bc5dc27a8042b84a949e
MATLAB
746
24
function [slice] = ml_util_timeseries_split_into_slices( ts_ms, x, slice_separation_threshold_ms ) % Check that the inputs are fine if slice_separation_threshold_ms <= 0 error('The slice separation threshold must be >= 0, but is (%d).', slice_separation_threshold_ms); end inds = ml_uti...
1cff2a3a018ef1dfdbbbb7d0d7d6de62a18dadd6cad1dbefa289941e78dd497e
MATLAB
747
32
% mglHFlip.m % % $Id$ % usage: mglHFlip() % by: justin gardner % date: 09/06/06 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: flips coordinate frame horizontally, useful for when % the display is viewed through a mirror % e.g.: % %mg...
42fc819d01120c93d8f356dfd91698c9bd166b90acf76399058985545af631fa
MATLAB
747
44
% % Read metadata from a data file. % % RETURN VALUE % A struct where field names are the keys and the values are % strings. In key names, '-' is replaced with '_'. % % PARAMETERS % network Network name % function ret = read_meta(network) filename = sprintf('uni/meta.%s', network); FILE = fopen(filename, 'r'); ...
43bffa0b78dcb85da76bb8fbf08747339d5f2ab242650df443fc024e30cd526a
MATLAB
747
20
function quoted = shellQuote(text) % Quote text as one word for the POSIX shell that MATLAB's system() uses on unix % % function quoted = shellQuote(text) % % Purpose % Private to +webupload. Inside single quotes the shell reads nothing specially, so only % a ' in the text needs care: it is ...
5b5cc96f444c80ba0e130714647116716dc295a61cee8f42ecc64efa26aed3f4
MATLAB
747
25
% sankey demo2 % ----------------------- % @author : slandarer % 公众号 : slandarer随笔 % 知乎 : slandarer figure('Name','sankey demo2','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',...
7de67f01b3eac0b8db305f4e036a516126ddfb4670b65cb3b48349591594827e
MATLAB
747
32
function f_SaveF64File(pv_Data, pstr_FileName, ... ps_FirstIndex, ps_LastIndex, ps_Append) if nargin < 2 return; end s_FirstIndex = 1; s_LastIndex = length(pv_Data); s_Append = 0; if nargin >= 3 && ~isempty(ps_FirstIndex) s_FirstIndex = ps_FirstIndex; end if...
51c25b635f033f841fb325f266b2f1f318c8487d052ace0b65d13688e0d6ea33
MATLAB
748
29
function sTracks = storeTracks(tracks,sTracks,counter,del_ids) if counter == 1 % create an empty array of tracks sTracks = struct(... 'id', {}, ... 'data',{},... 'trackedFrames', 1); else ids = vertcat(tracks.id); for i = 1:length(ids) IDpos = ids(i); sTrack...
85483f93a61db5402bf10930ab52e62b9762d2efed9a3166512cc83d324f2417
MATLAB
748
28
function newStack = preprocessImages(stack, pos, enchanceContrast) % Upsample image for better detection of CR newStack = imresize(stack,2); % Gaussian Filter newStack = imfilter(newStack, fspecial('gaussian',3,.5)); % Enhance Image Contrast % (cannot be done to stack, must loop) if encha...
8e6c695d06d3545b5863a663c59d76621435ec3b2344fe73fd087bb2535fcdf1
MATLAB
748
35
function varargout = offset(varargin) % Format % For getting the value % dat = offset(obj) % % For setting the value % obj = offset(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: privateoffset.m 8776 2013-11-14 09:...
b58a746f02bfb27327ec28bbc23ee3ff41fcffbc0ca195c1df7d4725bf0836cb
MATLAB
748
25
function repforce = repel(P, cd, mu) %find the self repel forces between each point to each other nPoints = size(P,1); force = zeros(size(P)); for i = 1:nPoints for j = 1:nPoints if j >= i break; elseif i-j == 1 %there is no repel forc...
1417596a73876f41d3f6914c6e28eda038017acbd0d57d3ac1bbf681e7a9bbda
MATLAB
749
29
% initTempProbe.m % % Function to initalize National Instruments USB-TC01 device (thermocouple % temperature probe) % % Input: % settings - struct from twoPhotonSettings() containing all DAQ settings % % Output: % tempDAQ - handle to temperature DAQ % tcCh - handle to thermocouple analog acquisition channel % % ...
20bcbf207bbfd045a631267113c6906e223a098a78c73da118632657528903e1
MATLAB
749
48
%{ Arifact @ ~3183.5Hz %} %% load cd Z:\1_Maxwell_Gagnon\ProjectData_Sriram\Granule_cell_recording\NR2_F_10_S1 load('testData.mat') tv = amplifier_data(2,:); samplerate = 30000; %% BANDPASS FILTER N = 3; fc = [7 200]; [bb,aa] = butter(N, fc/samplerate, 'bandpass'); tv_filt = filtfilt(bb,aa,tv); %% LOW PASS FILTE...
90e4d7410ca49c3fc37d3c4554fa3567d6d96cfbfda311dc27e6d6b9044cfefc
MATLAB
749
26
function [medianFrame] = ml_cai_behavcam_median_frame_compute(video) I1 = zeros(size(video.mov(1).cdata,1), size(video.mov(1).cdata,2)); I2 = zeros(size(video.mov(1).cdata,1), size(video.mov(1).cdata,2)); I3 = zeros(size(video.mov(1).cdata,1), size(video.mov(1).cdata,2)); for n = 1:length(video.mov) ...
e31de4ffad34447f76b8d6b1129c08c7f94e9f2d07ef0c47a2e869167e23a71b
MATLAB
749
25
function [blobs, na, nb] = SegmentIndices2Blobs(indIm, boxes, neighbours) % This function converts a segmentation index image to blobs % Note that this is made by mexFelzenSegmentIndex % % indIm: index image in range 1:n, each int denotes segment label % boxes: Bounding boxes of the segments % neigh...
ea285c5f9fab77a5e8a9f26f0fba01a9f79e9b8ffc6870fcfaeb63455c15fd5b
MATLAB
749
33
function [stats] = ml_cai_spatialfootprint_stats_compact(sfp) %sfp = ml_core_remove_zero_padding(sfp); % SFP must aleady be compact X = sfp; p = prctile(X(X ~= 0), 50); % M1 BW = bwperim(X>0, 8); P = sum(BW == 1, 'all'); A = sum(X>0, 'all'); M1 = 4 * pi * A / P.^2; CC ...
0b30a278c47425df8935ed786d1b44998c19a8b57c32b2c2e86f8e88a83bf0d1
MATLAB
751
24
function makeprettyfigures() % general graphics, this will apply to any figure you open % (groot is the default figure object). set(groot, ... 'DefaultFigureColor', 'w', ... 'DefaultAxesLineWidth', 0.5, ... 'DefaultAxesXColor', 'k', ... 'DefaultAxesYColor', 'k', ... 'DefaultAxesFontSize', 15, ... 'DefaultAxesFontName'...
33e8567a658f897894f408cb0c6dbfb94c06abe4d83a8833bc63d2bc151604dd
MATLAB
751
27
function [HistSpl] = getSplines(method,lag,c_pt,s) % calls functions from %https://github.com/MehradSm/Modified-Spline-Regression % ref: %Sarmashghi, M., Jadhav, S. P., & Eden, U. (2021). %Efficient spline regression for neural spiking data. %Plos one, 16(10), e0258321. switch method case 'modcard' if nu...
8ab773d12ae937e0d9d345fe9938191609d05f05042b6b5140d316b5e830b6d7
MATLAB
751
17
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [M] = get_match_table_by_sessions(TableA, TableB) % Get matching sessions between the two tables matchingRows = ml_util_find_row_matches([TableA.animalName, TableA.sessionName], [TableB.animalName, TableB.sessionNam...
a3f610d45d4c2db92c1399fa92e7c3230463f0a2803e8619dbe8027f567ac1a3
MATLAB
751
18
function spring_force = spring(P, l0, nu) %calculates the spring force forcing the centerline to be a preferred %length displacement = P(1:end-1,:) - P(2:end,:); distance = sqrt(sum(displacement.^2,2)); direction = [displacement(:,1)./distance, displacement(:,2)./distance]; %caculate a vect...
ccc150aaf6644d721fb046da188eff8dfb19109587e59f6e5af5f8290715451b
MATLAB
751
35
% VL_DEMO_SIFT_EDGE Demo: SIFT: edge treshold randn('state',0) ; rand('state',0) ; I = zeros(100,500) ; for i=[10 20 30 40 50 60 70 80 90] d = round(i/3) ; I(50-d:50+d,i*5) = 1 ; end I = 2*pi*8^2 * vl_imsmooth(I,8) ; I = single(255 * I) ; figure(1) ; clf ; imagesc(I) ; colormap gray ; axis equal ; axis off ; a...
e7889549c28155ac4eda6a0bdad6f47c8f7b827e37a56d3a000cbf9c8038cebb
MATLAB
751
18
% VL_SAMPLINTHIST Sample integral histogram % HISTS = VL_SAMPLINTHIST(INTHIST, BOXES) samples the integral % histogram INTHIST to obtain the histograms of the specified % BOXES. % % INTHIST is a MxNxK array, where M x N are ``spatial'' dimensions, % and K is the number of histogram bins. INTHIST may be of cl...
509665011c2e4ac6ab421d16971c82bad821a30b4f1e28a62b014e1c7642cc90
MATLAB
752
27
%VL_DEMO_PLOTS_RANK Demonstates VL_ROC, VL_DET, VL_PR randn('state',0) ; numPos = 20 ; numNeg = 100 ; labels = [ones(1, numPos) -ones(1,numNeg)] ; scores = randn(size(labels)) + labels ; figure(1) ; clf ; vl_roc(labels,scores) ; vl_demo_print(1,'plots_rank_roc', 0.5) ; figure(2) ; clf ; subplot(2,2,1) ; vl_roc(labe...
af38b5e1be7d3b7cda08d8cd5410a79c5b83d948c8d06b9404db04a2eb30792a
MATLAB
752
25
function [cinew,idx] = fcn_sort_communities(ci) %FCN_SORT_COMMUNITIES reorder community labels by size % % [cinew,idx] = fcn_sort_communities(ci) takes a partition, ci, and % relabels its communities so that the largest community is labeled 1, % next largest labeled 2, next largest 3, and so on. % % Inputs: %...
02fbca3f646fe738db544ff982b36f684de27a28f6b2b3735f3b3e29f67be289
MATLAB
753
22
function areaErrorbar(x,data,i) %20151130 modified areaErrorBar X = [x,fliplr(x)]; %colorOrder = [0,0,0;0,0.447,0.741;0.850,0.325,0.098;0.929,0.694,0.125;0.494,0.184,0.556;0.466,0.674,0.188;0.301,0.745,0.933;0.635,0.078,0.184]; %colorOrder = [0,0,1;0,0.5,0;1,0,0;0,0.75,0.75;0.75,0,0.75;0.,0.75,0;0.25,0.25,0.25]; cColor...
3308e54528023539d1a8789d2dcdad916f1c17a9f7ff7af26b7eae79f6788ecd
MATLAB
753
29
function Uout = applyZernike(Uin,X,Y,k,abb) % Uout = applyZernike(Uin,X,Y,k,abb) % % Applies the Zernike aberration given an input field, position and % aberrations. The inputs are: % % - Uin - Input scalar field % - X - X field positions % - Y - Y field positions % - k ...
4a1312b514ea555da262688585bd1bd5446d3f86ba12121edd7a298733fc8a12
MATLAB
753
20
function aug_names = feat_augment_names(names) [logfeat, normfeat] = feat_augment_log_and_norm() ; % update names to match their augmentation simple_aug_names = cell(1,0) ; diff_aug_names = cell(1,0) ; for i=1:numel(names) name = names{i} ; if ismember(names{i},normfeat) ...
6cbb4b7430d94cc92cc7fcd542a2689e7245f022e5c881ec3b1a53c7e3da62b6
MATLAB
753
21
function compute_sfp_celllike( obj, session, trial ) % % Trained on session 1, trial 1 of CMG169_CA1 % tmp = load('trainedModel.mat', 'trainedModel'); % trainedModel = tmp.trainedModel; % clear tmp if isempty(obj.SpatialFootprintTrainedModel) warning('Can not compute if spatial footprints ...
1928a272462e087a54252102743da427917d5b62ec7bdd1e520a1b191f07a301
MATLAB
754
16
% Author: Zachary Chiang, Buenrostro Lab, Harvard University % Crops an image in 3D using a rectangle (x_start, y_start, z_start, x_len, % y_len. z_len) regardless of the number of dimensions function[cropped_img] = imcrop_xyz(img, rect_3d) if ndims(img) == 3 cropped_img = img(rect_3d(2):rect_3d(2)+rect_3...
75ac956ce2bf8960cd3ccb47026d06d57a06c7dfa74100f49e7baac5b9c1bf6b
MATLAB
754
19
function [INsummary, summary] = TRAP_Remove_INs(summary) %This code removes the interneurons (INs) from the summary struct. INs are %identified using Plexon Offline Sorter, comparing their average waveform %to previous characterizations of PV and ACh striatal interneurons (Barnes et %al., 2005). %Created by Mi...
8bf286a3305571c1ab1ee531701f42abdda8a72004105a2a8a11c1083017e6c1
MATLAB
754
21
function [params, beta] = beta_pow3(params, state, denf) % Local spectral shift function for denoise_tanh denoising function. % [s_new, params] = beta_pow3(params, state, s) % params Function specific modifiable parameters % state DSS algorithm state % denf Tanh denoising function % beta Deno...
8cbe636622a1e020d5ad2bfb20af131bf6ba91a4483bafbba64422812b006e6e
MATLAB
754
21
function [comment]=SONGetChanComment(fh, chan) % SONGETCHANCOMMENT returns the comment string for the specified channel % % COMMENT=SONGETCHANCOMMENT(FH, CHAN) % FH SON file handle % CHAN Channel number (0 to SONMAXCHANS-1) % Returns the channel comment as a string....
8e5aa258fa0a1ace6fc57d6d5418e68d4fe20e5f93208b518e272362adb4b326
MATLAB
754
34
function [simulation_voxels_axDKI_table] = simulation_load_paper_synth_datasets() MA(1,1)=1.557; % Dpara MA(2,1)=1.048; % Dperp MA(3,1)=0.396; % Wpara MA(4,1)=0.708; % Wperp MA(5,1)=0.330; % Wmean LA(1,1)=0.457; LA(2,1)=0.408; LA(3,1)=2.901; LA(4,1)=2.702; LA(5,1)=2...
c25d0a4989f95f26e742f68a078b478efaca2908f4539cf13b6f85b10cfb9cf9
MATLAB
754
34
function [LL, sse] = indepGaussEval(X, params) % % [LL, sse] = indepGaussEval(X, params) % % Evaluate log likelihood and sum-of-squared prediction error given % an independent Gaussian model % % xDim: data dimensionality % N: number of data points % % INPUT: % % X - data matrix (xDim x N) % params - parame...
26508e14889501fbba1de546a0773dbe39bf234b9bfa79725fa9635514d03961
MATLAB
755
20
function flag=SONSave(fh, chan, sTime, bKeep) % SONSAVE sets the write state for a channel from a specified time % % FLAG=SONSAVE(FH, CHAN, STIME, BKEEP) % INPUTS: FH is the SON file handle % CHAN is a channel number (0-SONMaxChans()-1) or -1 for all % channels % STIME the time for thi...
2d47cce492fa717b2a7e6c1b208085c8c50742148e9d6293aec4a7d6a6d34457
MATLAB
755
31
% lowPassFiler.m % % LOWPASSFILTER Filters the data using a lowpass butterworth filter of % specified cut out % % INPUTS: % data - trace to be filtered % lowPassCutOff - value (Hz) that will be the top limit of the filter % sampleRate - rate data is sampled at to allow correct conversion in to % Hz. % %...
6181b07c15acb50cb11da2c3d350dca6cae9ba8a7e28612799f6125752ceb9a1
MATLAB
755
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 % channels...
a12a4fd46b3cfcf43112f205aeda60bd10488c79fd3213a00a0b8a462ee42154
MATLAB
755
26
function CC = largeBWConnComp(x,minLength,vals,minVal) %returns a structure containing only 1d connceted components above a given %size (output structure is identical to bwconncomp) CC = bwconncomp(x); lengths = zeros(CC.NumObjects,1); for i=1:CC.NumObjects lengths(i) = length(CC.PixelIdxList{i...
bdbd99d9a63ad9a00726ca801e20caf62248e0420e658ca0d10dbd66c04115bd
MATLAB
755
22
function [y,varname]=xml2struct(filename_or_xml_string) %XML2STRUCT reads non-MbML compliant xmlfile into matlab structure % % Syntax: [y,varname]=xml2struct(filename_or_xml_string) % % Description: % 1. Convert any non-MbML xml into MbML compliant string % 2. Stores consecutive structures in the a dimensional str...
d6d0351538804a409c252b61e373f9d33cb65faf9a1d0b8275370080b37f7c98
MATLAB
755
24
% Get header of the trigger event % [ Yokogawa MEG Reader toolbox for MATLAB ] % % brief: % This function retrieves information about trigger event in the specified file. % % usage: % event = getYkgwHdrEvent(filepath) % % arguments: % filepath : file path % % return values: % event : structure array of...
12b911357eb9a4a1e2f89cda1a44b129962830e5fb69c5dc30e6bbdd260519de
MATLAB
756
24
function [BW] = segmentImage5(X, erode, sens) %segmentImage Segment image using auto-generated code from imageSegmenter app % [BW,MASKEDIMAGE] = segmentImage(X) segments image X using auto-generated % code from the imageSegmenter app. The final segmentation is returned in % BW, and a masked image is returned in MASK...
1b23044edc512d471281d6ecc16756314a1d4b5204644aa1ff165b651895617f
MATLAB
756
36
%savesmall %save small structures clear all; %close all; base_folder = 'T:bnehud\data'; %Session = 'pom36'; %Session = 'pom31'; Session = 'vpm28'; Lsessionfolder = [base_folder '\LargeStructs\' Session]; Files = getFiles(Lsessionfolder); Nmovies = length(Files); mms=1:Nmovies; %matlab bug in cell ac...
99dae4c035f7d8d57926fa97a5dbbcd18f526b766b5f8afe6eb9aad2d661d129
MATLAB
756
37
function paramFile = getRecipeFileName(supressWarning) % Look for a the acquisition system's parameter file in the current directory and return its name % % function mosaicFile = getRecipeFileName(supressWarning) % % Purpose % Return the recipe file name. % % % Inputs % supressWarning - optionally supress warning abou...
ea3a18e5c3ea7aab5ef8f4968f397d44e6165bd22cefe9722bfec5f3023b2e5f
MATLAB
757
20
function wrapped = inBinSh(cmd) % Command line that runs cmd under /bin/sh whatever shell MATLAB's system() uses % % function wrapped = inBinSh(cmd) % % Purpose % Private to +webupload. On unix MATLAB's system() hands the line to $MATLAB_SHELL or % $SHELL, which can be csh or tcsh, where syn...
fd5b219c4cff7e858d3a1a4b81b7db1c99b48f373fd77836970f3f3941b8115f
MATLAB
757
17
% Author: Zachary Chiang, Buenrostro Lab, Harvard University % Crops an image in 2D using a rectangle (x_start, y_start, x_len, y_len) % regardless of the number of dimensions function[cropped_img] = imcrop_xy(img, rect_2d) if ndims(img) == 3 cropped_img = img(rect_2d(2):rect_2d(2)+rect_2d(4)-1, rect_2d(...
f6a29869b1eb9e5b195ef85a0629b385e7bf252266706c77ae5e021023bfb357
MATLAB
758
27
function Q = qGetRotQuaternion( teta, rotationVector ) % qCreateRotQuaternion: outputs a quaternion which is used to perform % rotation % Q = qGetRotQuaternion( teta, rotationVector ) % IN: % teta - rotation angle % rotationVector - vector around which the rotation will be performed % % OUT: % Q ...
2b81ab786db84d35a9de8339d1968e7e5dd969c312058eaff5d05f3d9fb8e191
MATLAB
759
20
function [UniqueIDConversion, MatchTable] = AssignUniqueID(SaveDir) disp('Loading match table to assign Unique IDs...') tmpfile = dir(fullfile(SaveDir,'UnitMatch.mat')); load(fullfile(tmpfile.folder,tmpfile.name)) if exist('TmpFile', 'var') UniqueIDConversion = TmpFile.UniqueIDConversion; MatchTable = TmpFile.M...
491ef11135f285ac2706db8ab85f4ffb58784e43b80e24b1871fe98b9a5cb9b5
MATLAB
760
22
function [map, C] = vl_flatmap(map) % VL_FLATMAP Flatten a tree, assigning the label of the root to each node % [LABELS CLUSTERS] = VL_FLATMAP(MAP) labels each tree of the forest contained % in MAP. LABELS contains the linear index of the root node in MAP, CLUSTERS % instead contains a label between 1 and the num...
5c483d7f69cf5746cbdbfc0fa96090a04d4017a4ff2fc6d6bee9e72a580fa384
MATLAB
760
38
% plotFreqSpec.m % % Function that takes in time series and its sampling rate and plots the % one-sided frequency spectrum % % INPUTS: % in - time series to get frequency spectrum of % sampRate - sampling rate of time series % % OUTPUTS: % none, but generates frequency spectrum plot % % CREATED: 8/27/19 - HHY % ...
5fb827abb7e3f9527df24837a6720f68acf5761b152f655157222044e9cbecaa
MATLAB
760
36
function om_write_cond(condfile,c,names) % OM_WRITE_COND % [] = OM_WRITE_COND(CONDFILE,C) % % Write conductivity file for OpenMEEG % % Authors: Alexandre Gramfort alexandre.gramfort@inria.fr ndomains = length(c); if nargin < 3 names = {}; for k=1:ndomains names{k} = ['domain', num2str(k)];...
0666853169223ca7896507178416554f635a915e325801c0a2d9f2bef8b99e07
MATLAB
762
34
function [S1,f] = runWelch(delta_mat_T,nfft,noverlap,FS,wintype) %runWelch.m 6/6/22 % note delta_mat assumes time down *rows*, windows in columns if ~exist('wintype','var') wintype = 'hamm'; end switch wintype case 'hamm' winarg = nfft; case 'rect' winarg = ones(nfft,1); end data1 = delta...
2acdc2c308e77183e97c722600fe9be233efd01a751b8982e223aa70b9be9b7a
MATLAB
762
17
function [stimWidthPx, stimHeightPx] = convertDVAToPixels(stimWidthDVA, stimHeightDVA, screenWidthPx, screenWidthcm, distanceFromScreen) % Convert screen dimensions from cm to mm screenWidthmm = screenWidthcm * 10; % Calculate the pixel density (pixels per mm) pxPerMmX = screenWidthPx / screenWidthmm;...
66e4e1c21d129ae183e4212bb34baa96d91f533ddf4f709011fe409e8ad996db
MATLAB
762
23
function rate=SONIdealRate(fh, chan, newrate) % SONIDEALRATE gets or sets the ideal sampling rate on a channel % % RATE=SONIDEALRATE(FH, CHAN) % returns the current rate on channel CHAN in file FH % % RATE=SONIDEALRATE(FH, CHAN, NEWRATE) % returns the rate at the time of the call an sets a new rate if NEWRATE>0 ...
3551c4383c3090031b890ad486289acee1a64e786026c53dcc4a0eef29845911
MATLAB
763
17
function success = video_transcode(input_video_file) output_video_file = [input_video_file(1:end-4), '.mkv']; if strcmp(computer, 'PCWIN64') %windows %ffmpeg -r 30 -i TestCameraFrames\Frame_%06d.tif -c:v hevc_nvenc -rc:v vbr_hq -preset:v slow CameraFrames.mp4 system([fileparts(mfilename(...
e8a6128c1c686b4642a44b7ab5f165b200f56e04fca7b18bc41153f72f9873e1
MATLAB
763
25
% basic_example.m This script shows a bare-bones example of creating and % plotting ternary data % (1) Add paths % add_ternary_paths FIG = figure(); % (2) Create Basic Ternary Axes (Sides Ranging from 0-1) handle_base = ternary_axes; % (3) Get a set of A,B,C Test points, assuming 20 points along ea...
059e71d9afb4bb9e90b5240890b1696005b3574fb2d0bf2476b825a0e8912299
MATLAB
764
24
% plotFreeWalkReviewerResponseFig.m % % Quick script to plot reviewer response figure for free walking bouts % Distribution of change in forward velocity for turning bouts fullFilePath = '/Users/hyang/Dropbox (HMS)/FreeWalkLegAnalysis-Helen/AnalyzedData/condBouts_allDFwd_240526/angVel50-150_iFwdVel10-15_allDFwdVel.mat...
1129620bd870683526f83fce6ae7058003cda0d8ec1a71016b51b1a3b7378099
MATLAB
764
24
function fh=SONOpenOldFile(filename, iMode) % SONOPENOLDFILE opens an existing a SON file and returns a handle % from SON32.DLL. Note that this is not a MATLAB handle. % FH=SONOPENOLDFILE(filename, iMode) % filename is a string % iMode = 0 for Read/Write % ...
3cbcd18e7f44472393f9ff954065dc60eadb8a0127c88c083ecfe4fe22ccf277
MATLAB
764
25
function [entropyXY] = ml_it_entropy_joint(x,y, binMethod) if length(x) ~= length(y) error('x and y should be the same length.'); end if strcmpi(binMethod, 'uniformly_spaced') [edgesX, edgesY] = ml_it_edges_xy_uniformly_spaced(x,y); elseif strcmpi(binMethod, 'uniform_density') ...
5c092dadd89dcaf17c17ee81d0f3646ac067a0bbcfb355887dbce9897acc6336
MATLAB
764
24
% this script create a 3-D scatter plot showing different pattern of the % dynamics, including ON-ON, OFF-ON, OFF-OFF and ON-OFF % 3 dimensions are: DeltaE (x), DeltaI (y), and Isens(z) rootFolder = "figure_Iattn_0.02_2d/"; % ON-ON data = readFilename(rootFolder+"asAllCriteria/*_*_*_*.png",'%f_%f_%f_%f'); data( all(~da...
6e8a766e4176f9c00b512b17976a535fa9029d61b99526bd853194f66881a119
MATLAB
764
33
function [textons] = unitex(fb,k) % function [textons] = unitex(fb,k) % % Compute universal textons from the training images. iids = imgList('train'); n = 100000; nper = round(n/numel(iids)); n = nper * numel(iids); d = numel(fb); data = zeros(d,n); c = 0; for i = 1:numel(iids), iid = iids(i); ...
816b36a91c798b4214ba57f07954579c52586c531acb65f34037524659e7eb1c
MATLAB
764
29
function B = randomize_symmetric_matrix(A) % RANDOMIZE_SYMMETRIC_MATRIX shuffles the upper triangular part of a % symmetric matrix and returns a new symmetric matrix with the shuffled % values. % % Input: % - A: a symmetric matrix % % Output: % - B: a new symmetric matrix with the upper triangular part of A % ran...
c7b9076502075129d78c5bd689843a6806dcb07bed6373fe3598f1afaadb376b
MATLAB
764
28
function [y]=VMFMeanDirDensity(x, k, p) % This is the tangent direction density of VMF distribution. See the % SphereDistributionsRand.pdf file for detail description and formulas. % % Usage: % [y]=VMFMeanDirDensity(x, k, p); % % Inputs: % x: The tangent direction value. should be in [-1 1]. % % k: The kappa par...
d751ef8359ade88664e495854d0586b086d1ba79d1e5fd4a8a300ff69859d5bb
MATLAB
764
20
function [edges_s,edge_type,myosin,P] = remove_small_myosin(r_s,edges_s,edge_type,myosin,P) % check the length of the myosin linkers aux = find(edge_type == 3); d = r_s(edges_s(aux,1),:) - r_s(edges_s(aux,2),:); d = sqrt(dot(d,d,2)); aux_r = find(d < P.min_r); % remove those myosin linkers that ...
c965dd86622575395853ec1bcd29cefed8087e08ad546ae494ce20611a973230
MATLAB
765
21
function job_ID = get_job_ID(folder_name, script_name) % get the SLURM job ID so we can update our log try % update the logs on cluster log_name = [folder_name,filesep,'status.csv']; [~, last_log_line] = system(['tail -n 1 ', log_name]); if isstrprop(last_log_line(end), 'cntrl'), la...
c100d8aeaaa559530f802f1d08d8bc68c48c274a7a1452f30b290724ee012528
MATLAB
766
35
function Play(handles,hObject) % play through a sequence % splintered from fixerrorsgui 6/23/12 JAB handles.isplaying = true; set(handles.playstopbutton,'string','Stop','backgroundcolor',[.5,0,0]); guidata(hObject,handles); f0 = max(1,handles.seq.frames(1)-10); f1 = min(handles.nframes,handles.seq.frames(end)+10); fo...
1b40c22abb18ca9a46b44be93fcde9fb37df4e3b464f19e9abd29696da29b210
MATLAB
767
42
% % Minimal and maximal numbers, cutting the extreme points. % function [min_w, max_w] = map_minmax(ww) % cut ALPHA points from each side enable_cut = 1; % use the L1 deviation instead of the standard deviation enable_l1 = 0; % amount of points to cut alpha = .06; % number of st...
db34389a9cf85dd10595d70e563d230c476adcaf0b4cd426fce4b718eb1220d6
MATLAB
767
33
function C = ROY_BIG_BL(N) % ROY-BIG-BL, extracted from Washington-University/workbench. roy_big_bl = [ 0 1 1 0 1 0 0 0.784313725490196 0 0.294117647058824 0.490196078431373 0 0.490196078431373 0 0.627450980392157 0.294117647058824 0 0.490196078431373 0 0 0.666666666666667 0 0 0.313725490196078...
28e77c85378b659f4111eb5ceb51b074b14f1eb04e3a3a256d646ba5a6f253c8
MATLAB
768
23
function state=SONExtMarkAlign(fh, n) % SONEXTMARKALIGN gets and sets the alignment state for marker channels % This is a feature of V7 of the SON filing system % Using aligned markers improves cross-platform portability of SON files % STATE=SONEXTMARKALIGN(FH,N) % FH= SON file handle % N = -2, Ch...