sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0f4b730458f0b02aed1c2589106cbea7fc117e1e534bc7a5d7a80b679b87740c
MATLAB
508
29
function [L] = labelPeaks(m,dim) % labelPeaks.m 10/8/22 % binary output pks or not assert(dim > 0 && dim < 3,'dim > 2 not yet supported'); if dim == 1 mT = m'; % find peaks w/n rows, undo below else mT = m; end sz = size(mT); n = sz(1); LT = zeros(sz); for r = 1:n ...
27d89f30811ff8aa0e0223483e82a0833fce7706f8d556cc9226b70942041446
MATLAB
509
24
function [dir_names, file_infos]=my_list_dir(ds_dir) file_infos=dir(ds_dir); dir_names=cell(0, 1); valid_sel=false(length(file_infos), 1); for dir_idx=1:length(file_infos) one_dir_name=file_infos(dir_idx).name; if strcmp(one_dir_name, '.') || strcmp(one_dir_name, '..') continue; end if ~file_...
2084172ebd9bfd8ced6e9bbff8a1f68e2bde5b7bc831b6412ecc16cecc97b11e
MATLAB
510
21
function [lDivide]=SONChanDivide(fh, chan) % SONCHANDIVIDE returns the clock ticks per ADC value from the specified % channel % LDIVIDE=SONCHANDIVIDE(FH, CHAN) % FH SON file handle % CHAN Channel number % % See also SONGETUSPERTIME % % Author:Malcolm Lidierth % Ma...
33c3876fcffdd000653d43d15f9c6d94c2322b1e8cc7a3e9711e2fb13b6f0b2d
MATLAB
510
11
% mglCreateFrameBufferObject.m % % $Id: mglCreateFrameBufferObject.m cgb $ % usage: mglCreateFrameBufferObject(width, height) % by: Christopher Broussard % date: 09/07/10 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Creates a OpenGL frame buffer obje...
3e587e791776250489456ecf247a60f9245101347b792e6a33161b6df32e8033
MATLAB
510
18
function SONSetADCUnits(fh, chan, units) % SONSETADCUNITS sets the units string for a channel % % SONADCUNITS(FH, CHAN, UNITS) % where FH is the SON file handle, CHAN is the channel number and UNITS is % the string to be written to the file. % % No return value % % Author:Malcolm Lidierth % Matlab SON library: % Cop...
7493af00d5790b2600e031b0b582465931b49f438010410f828eea35cde9c683
MATLAB
510
18
% clearForNewCell.m % % Function to clear persistent and global variables used in runEphysExpt() % so that a new cell starts fresh % % CREATED: 3/11/20 - HHY % % UPDATED: % 3/11/20 - HHY % 3/22/20 - HHY added global variable firstLegVidTrial function clearForNewCell() clear runEphysExpt % has persistent var...
cb4c7175979ca9836b8e407dd54468c9f2739d21a8b6222fca29045675606f8c
MATLAB
510
10
function [boxes_c, boxes_s] = getSurroundings2(grid_x, grid_y, imh, imw, patch_size, surrWidth) xc_lo = grid_x; xc_hi = grid_x + patch_size(1) - 1; yc_lo = grid_y; yc_hi = grid_y + patch_size(2) - 1; boxes_c = uint32([yc_lo, xc_lo, yc_hi, xc_hi]'); xs_lo = max(1, grid_x - surrWidth + 1); ys_lo = max(1, grid_y - s...
d7c295472946e0f87393ebb869fe2ba87918addc579dfd02572d18a2d272f092
MATLAB
510
11
function [meanFiringRateMap] = ml_placefield_meanfiringratemap_smoothbeforedivision(spikeCountMap, dwellTimeMap, kernel) % Compute the mean firing rate map, lambda(x,y) %meanFiringRateMap = imgaussfilt(spikeCountMap,4)./ imgaussfilt(dwellTimeMap,8); meanFiringRateMap = imfilter(spikeCountMap, kernel) ./ im...
07696a07a369c3208526659a24e6b4b3063c8474666590b4a6ffd958f66afd5a
MATLAB
511
16
function [ data ] = ml_cai_scope_h5_read_timeseries( filename ) % Reads a 'scope.hdf5' file specified by the filename given in filename h5Fields = {'frame_quality', 'framenum_local', 'framenum_global', 'timestamp_ms', 'videonum' }; matFields = h5Fields; numFields = length(h5Fields); for iF = 1:numFields fieldName...
b9c7fa211934ae0457a0af87f50ac5523b6f472795bca4e954bb62c249a2d202
MATLAB
511
16
function [ data ] = ml_cai_behav_h5_read_timeseries( filename ) % Reads a 'behav.hdf5' file specified by the filename given in filename h5Fields = {'frame_quality', 'framenum_local', 'framenum_global', 'timestamp_ms', 'videonum' }; matFields = h5Fields; numFields = length(h5Fields); for iF = 1:numFields fieldName...
07286b5b64deed2a575538a79924346f08a4e2403b7410fd2d9ffc88af952d11
MATLAB
512
14
% Prepares DSS calculation environment. Currently only compiles the % testkeypress MEX function. % Copyright (C) 2004, 2005 DSS MATLAB package team (dss@cis.hut.fi). % Distributed by Laboratory of Computer and Information Science, % Helsinki University of Technology. http://www.cis.hut.fi/projects/dss/. % $Id: prepare...
1a8803d8234e8d49a32eda066f63adecc658459d5ccc71f3754c5ebc0bd1ad59
MATLAB
512
15
function [trialFolders] = ml_dir_trial_folders(containerFolder) % Get all of the trial folders. files = dir(fullfile(containerFolder, '*')); keep = zeros(1, length(files)); for i = 1:length(files) if regexp(files(i).name, '^(trial_)\d+$') & files(i).isdir == 1 keep(i) = 1; el...
4d5c4919e94da474c9ba95cc3008b546d661f724c1ccdd1192ef2f70ad5c2f61
MATLAB
513
18
function v_SumHMS = f_AddTimeHMS(pv_HMS1,pv_HMS2) v_SumHMS = [0 0 0]; for kk=1:3 v_SumHMS(kk) = pv_HMS1(kk) + pv_HMS2(kk); if kk==2 && (pv_HMS1(2)+pv_HMS2(2)) >= 60 v_SumHMS(1) = v_SumHMS(1)+1; %This adds 1 hour v_SumHMS(2) = v_SumHMS(2)-60; %this gives the correct minutes end ...
6d0dd1368074bac59b4e5858f535debda9f268221815217ced1032e61a83bc71
MATLAB
514
29
function lpp_plot_break_yaxis(xdata,ydata) % xdata: % ydata: ax = gca(); set(ax,'XLimMode','manual'); patch( ... 'Parent',ax, ... 'XData',xdata, ... 'YData',ydata, ... 'FaceColor','w', ... 'EdgeColor','none', ... 'Clipping','off'); line_xdata = [xdata(1:2) NaN xdata(3:end)]; line_ydata ...
afe5ad725b3e5cb5e3261c7beb40d9f43a19696fea62e8847bd12ff0fa3aa92e
MATLAB
514
17
%% Update Assigned Tracks function [tracks] = updateAssignment2(tracks,assignments,DT) if ~isempty(assignments) numAssignedTracks = size(assignments, 1); for i = 1:numAssignedTracks detectionIdx = assignments(i, 1); trackIdx = assignments(i, 2); % Replace data with matches tracks(trackIdx).data = DT(d...
b016f018e48ba532aca8767434d79ed38b93f45edf58fe92a21f94c9867c2ea5
MATLAB
514
28
% % Average between subject, object and global mean. % % PARAMETERS % T (r*3) Subject ID, object ID, rating % m,n subject count, object count % % RESULT % U,V (m*1,n*1) Vectors such that U 1 + 1 V' is an approximation % function [U,V] = means_euv(T, m, n) A = konect_spconvert(T, m, n); A_mask = (A ~= 0); e = .1...
b5bc2505794e8dae76fd5f89a32993587980cdcb6efa3aca06c65dd22578dc49
MATLAB
514
20
function y = vl_rcos(r,x) % VL_RCOS RCOS function % Y = VL_RCOS(R,X) computes the RCOS function with roll-off R. % % See also: VL_HELP(). % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. % All rights reserved. % % This file is part of the VLFeat library and is made available under % the terms of the BSD...
b9d3ec1e933f5b3077c512bba1933d45d8a5e7ccf863c78cbe38c448ff530c29
MATLAB
514
18
function results = vl_test_imwbackward(varargin) % VL_TEST_IMWBACKWARD vl_test_init ; function s = setup() s.I = im2double(imread(fullfile(vl_root,'data','spots.jpg'))) ; function test_identity(s) xr = 1:size(s.I,2) ; yr = 1:size(s.I,1) ; [x,y] = meshgrid(xr,yr) ; vl_assert_almost_equal(s.I, vl_imwbackward(xr,yr,s.I,...
4ba0ac0e92d8077c826161e75e9d5aadbdac9a4d679abcb5aebd5634545ee985
MATLAB
515
25
% % Plot one BETA curve. % % PARAMETERS % p (e*1) Node indexes % q (e*1) Multiplicities; [] to denote all ones % enable_normalization Enable division with degree sum % type % function beta_one(p, q, type) colors = konect_colors_letter(); font_size = 24; if length(q) == 0, q = 1; end degrees = full(sparse(p, 1, q...
82dd4c333a6cb91bc746df3f7703a15ff5e0eb045c00288542da175b9fb72b07
MATLAB
516
21
%% function img = load_nii_img_only(filename) % % Description: Load images data only % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 9 October 2016 % Date modified: 11 September 2018 % Date modified: 26 June 2020 (v0.8.0) % % cleaned up X.L. function img = load_nii_img_only(filename) ...
bd68939dd7d96a4680b8ea2604cc93bf24c945f3aaf7cd8292f835950d1111c7
MATLAB
518
15
function [SC,OPT_S] = had_add_reps(SC,OPT_S) %this functions asks the user if he wants to add iterations, and sets accordingly. ind_it = OPT_S.ind_it; SC = laser_off(SC); new_reps_num = input('how many more masks? '); ind_val = floor(ind_it/OPT_S.val_interval); OPT_S.total_reps = OPT_S.total_reps+new_reps_num; i...
1886b2b27a1b042c2746fbfe96c372f530718aa910b06c648002b51ee4b8c46c
MATLAB
519
22
function L = encapsulate_watershed_matrix(L) %This function superfically changes the label matrix so that the edges of %it are surrounded by borders empty_watershed = max(L(:)); temp = L(1,:); temp(temp ~= empty_watershed) = 0; L(1,:) = temp; temp = L(end,:); temp(temp ~= empty_watershed) ...
349b7d8c0d1d4ffb3b8d1eb4b61fd77bab0731dd7ad1de537e8ec9371936d922
MATLAB
519
24
function isPloted = rvSpace(r,v,pop,cond,state) %RVSPACE plot a (r,v) phase plane % Detailed explanation goes here if state == "all" startFrom = 1; endTo = length(r(pop,:,cond)); elseif state == "before" startFrom = 1; endTo = 100000; elseif state == "after" startFrom = 100001; en...
789d997eb82b88a25a725ba6399d29f9a1b7b029ea3ac2d914da0cd8043d3db4
MATLAB
519
21
function fim = fftconv2(im,f) % function fim = fftconv2(im,f) % % Convolution using FFT. % % David R. Martin <dmartin@eecs.berkeley.edu> % March 2003 % wrap the filter around the origin and pad with zeros padf = zeros(size(im)); r = floor(size(f,1)/2); padf(1:r+1,1:r+1) = f(r+1:end,r+1:end); padf(1:r,end-...
1e9447eaf4bd4feb7d344dbe995ffe2094e6aa2d59a5758f713d458967308224
MATLAB
520
27
clc; fprintf('Step 1: ') dispstat('','init') length = 10000; for i = 1:length dispstat(sprintf('%i%%', floor(i / length * 100)), 'timestamp') end dispstat('DONE', 'timestamp',z 'keepthis') fprintf('Step 2: ') for i = 1:length dispstat(sprintf('%i%%', floor(i / length * 100)), 'timestamp') end d...
39ecf29607a91642035c1c38697e82c6e329616324ecb2b5416c4b41ee62f389
MATLAB
520
21
function output = convCutn(tc, impulse, nTerms) % Function similar to convCut.m, but now for matrices % convCut2(input, impulse, nTerms) % % INPUTS ----------------------------------------------------- % tc : (double) a 2D flattened time course % impulse : an impulse response function % nTerms : number o...
74eb2a6267f554c8fbdd3d820c1fcc6a15848673edaa76d25bee3e01e21ffc86
MATLAB
520
19
% Example of constrained problem. % This example corresponds to MEIGO toolbox example: ex2.m % http://gingproc.iim.csic.es/meigo.html function [y g R] = matlabCost(x) g = []; R = []; % specific function code begins y=-x(1)-x(2) g(1)=x(2)-2*x(1).^4+8*x(1).^3-8*x(1).^2; g(2)=x(2)-4*x(1).^4+32*x(1).^3-88*x(1...
796a22977a37e48161755ee18c55813e091ff115c15093fc3c36f14716cd7b78
MATLAB
520
18
% SONAPPID sets or gets the creator lable from a SON file % % Implemented through SONAppID.dll % % LABLE=SONAPPID(FH) % returns the creator lable % LABLE2=SONAPPID(FH, LABLE2) % sets the lable to LABLE2 then reads it back to LABLE1 % % FH is the SON file handle % LABLE, LABLE1 etc are M...
73965b6803f3806000aa060af0ed72b330f6b8ecb130c15d138cadd1dc013f57
MATLAB
522
28
[pref]= get_event_preference(outcomes,ds_events,2) %% somcount=0; nullcount=0; pvcount=0; for d = 1:length(pref) cur_sig=pref(d).sompv_sig; for i =1: size(cur_sig,2) if cur_sig(1,i)==0 nullcount=nullcount+1; else if cur_sig(2,i)>0 somcount=somcount+...
189d752034538a601abb633838dc74d72c7efee73dfbfd71262de36deb7e3cc2
MATLAB
524
18
%% fun load('unrelated_sub_matrix_fun.mat') sub_mean_fun = mean(sub_matrix,3); sub_cell_fun = cell(size(sub_matrix,3),1); for i_sub = 1:length(sub_cell_fun) sub_cell_fun{i_sub} = sub_matrix(:,:,i_sub); end Gt_fun = GradientMaps('kernel','cosine','approach','dm'); Gt_fun = Gt_fun.fit(sub_mean_fun); Gs_fun = Gradi...
a764ee8db55705ba791ee6bdce03462bf6e16e22eb914d364331c55af2d22410
MATLAB
524
22
function result=scverLessThan(toolboxstr, verstr) % scverLessThan is needed for MATLAB versions without the verLessThan function try result=verLessThan(toolboxstr, verstr); catch toolboxver = ver(toolboxstr); toolboxParts = getParts(toolboxver(1).Version); verParts = getParts(verstr); ...
591990a7448cd9286fda5e252bd1fd7a3fe778cbb96faec1fe3085388ce7334a
MATLAB
525
21
function vl_assert_exception(func, errorId, errorMessage) % VL_ASSERT_EXCEPTION try func() ; catch e = lasterror ; if nargin >= 2 assert(isequal(e.identifier, errorId), ... 'Exception ID ''%s'' is not ''%s''.', ... e.identifier, errorId) ; end if nargin >= 3 assert(isequal(e.mes...
b3da5c0125752ee479d114363af79ecc955ec71eef9d479b3a7e548e0e953269
MATLAB
525
18
function nblocks=SONBlocks(fh,chan) % SONBLOCKS returns the number of blocks written to disk for the channel % [NBLOCKS]=SONBLOCKS(FH,CHAN) % FH SON file handle % CHAN is the channel number from 0 to SONMAXCHANS-1 % Returns 0 or the number of blocks; % % Author:Malcolm Lidi...
f00d62d4051658088b44ecbed824dfdc4e29f060313bd728af048fa991ffc6b2
MATLAB
525
17
function X = randlap(n,N); % RANDLAP Laplace distributed random numbers. % s = RANDLAP(n, M) % n dimension % N sample size % Copyright (C) 2004, 2005 DSS MATLAB package team (dss@cis.hut.fi). % Distributed by Laboratory of Computer and Information Science, % Helsinki University of Technology. http://www....
12e8757ba1c771d89a0db925642a2d7875dfc54b1a00ced7f58c78cf249efac1
MATLAB
526
15
function kind=SONChanKind(fh, chan) % SONCHANKIND Returns the channel type % KIND=SONCHANKIND(FH, CHAN) where FH is the file handle % CHAN is the channel number (0 to % SONMAXCHANS-1) % Returns kind as an enumerated string - see CED documentation for val...
6435b6cd91c3218c085c46a92333e01ae82f0f093522579a129ce8806f216ab9
MATLAB
526
21
function out = isnan(fa) % Convert to numeric form % FORMAT isnan(fa) % fa - a file_array % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: isnan.m 8776 2013-11-14 09:04:48Z roboos $ bs = 10240; m = size(fa); fa = reshape...
8dde8e6f7715eba08d0765989e05242b6bcf34154fd5be62e3ec4baeae298fd4
MATLAB
526
29
function makePlotPrettyNow(fontsize,fontflag,linenum) if nargin<1 fontsize = 25; end if nargin<2 fontflag = false; end if nargin<3 linenum = 2; end if fontflag fontname = 'Times'; else fontname = 'Helvetica'; end %makes the plot pretty... now. set(gcf,'color','w'); set(gca,'FontName',fontname...
37724a4874ae7ca1bcc551a4c56d43dd4dd82393d32d96f637255d05e25cd525
MATLAB
527
20
function c = ForwProbV1Cons(x,ynn_v,tv,no,msteam_st_v,mfg_st_v,Tsteam_in_st_v,Tfg_in_st_v,cpfg_st_v,cpsteam_st_v) ynn_v_r = x(1:tv*no); ynn_v_r = reshape(ynn_v_r,size(ynn_v)); ynn1_v_p = ynn_v_r'; Tsteam_out_st_NN_r = ynn1_v_p(:,1); Tfg_out_st_NN_r = ynn1_v_p(:,2); c1 = [ynn1_v_p(:,1);ynn1_v_p(:,2)]; Q...
430c7e47438f5df2e4c2eaff02f9970f18fde3c22d3a9a574327e120801c1b8e
MATLAB
527
15
%% mff_micros2Sample.m % Matlab File % author Colin Davey % date 3/2/2012 % Copyright 2012, 2013 EGI. All rights reserved. % Support routine for MFF Matlab code. Not intended to be called directly. % % Converts from microseconds to samples, given the sampling rate. %% function [sampleNum, remainder] = mff_micros...
daeb4bdf6097072b5690e5b32799c6d85419581387a736e6047750f4d15deb89
MATLAB
527
18
function SONSetADCUnits(fh, chan, units) % SONSETADCUNITS sets the units string for a channel % % SONADCUNITS(FH, CHAN, UNITS) % where FH is the SON file handle, CHAN is the channel number and UNITS is % the string to be written to the file. % % No return value % % Author:Malcolm Lidierth % Matlab SON libr...
11b50b06a8123158b394b46ea663f7ceb60b5bf39d45c26d684b5f15212dcdb8
MATLAB
528
16
% VL_IHASHFIND Find labels in an integer hash table % SEL = VL_IHASHFIND(ID, NEXT, K, X) returns a vector SEL of the % entires in the hash table ID,NEXT,K corresponding to the labels % stored as columns of X. % % The format is the same as for the functino VL_IHASHSUM(). % % See also: VL_IHASHSUM(). % Author...
1fa20a80f48b3600ab3824b814eaa66054f8a8cca3f60a24f43caeeaccc5877a
MATLAB
528
19
function [nose, theta] = removeFramesExplicit(nose, theta, irmv) LL = length(nose.t); noseFields = fieldnames(nose); for fname = noseFields', if length(eval(sprintf('nose.%s',cell2mat(fname)))) == LL, eval(sprintf('nose.%s(irmv)=nan;',cell2mat(fname))); end end noseFields = fieldnames(theta);...
55b04a66fb5d51fb04baace8b8018db761c36e9aea2d0c8a3600b3e6d4557d04
MATLAB
528
15
function h = vl_ikmeanshist(K,asgn) % VL_IKMEANSHIST Compute histogram of quantized data % H = VL_IKMEANSHIST(K,ASGN) computes the histogram of the IKM clusters % activated by cluster assignments ASGN. % % See also: VL_IKMEANS(), VL_IKMEANSPUSH(), VL_HELP(). % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkers...
90bc2fdeba7bc0f4069b9a3dce55bb3f443cffa97762b531306c0c8f71acfb35
MATLAB
528
23
function estParams = indepGaussFit(X) % % estParams = indepGaussFit(X) % % Fit parameters of an independent Gaussian model % % xDim: data dimensionality % N: number of data points % % INPUT: % % X - data matrix (xDim x N) % % OUTPUTS: % % estParams.d - mean of each observed dimension (xDim x 1) % estParams...
aa12c39d4e3d7e5c0e3fa3603b091f4d86ac9ffc54408a3b58e46ec41400b839
MATLAB
528
14
function [predicted_behavior_rate] = PredictLNP(LEDPower, linear_kernel, modeled_fit, bin_size) %Predicts the behavioral rate based on LNP model parameters; not used in paper if nargin < 4 %no bin size specified bin_size = 1; end filtered_signal = padded_conv(LEDPower, linear_kernel); ...
4cf702580aa17d243be60bceb7b1f1f18f8d27241e1c7172efe9da9f438bfa67
MATLAB
529
20
function [had_mat,row_i,col_j]= hadamard_matrix(M,rads) had_mat=hadamard(M); diffs=diff(had_mat); diffs=sum(abs(diffs),1); [~,is]=sort(diffs); had_mat=had_mat(is,:); num_rads = length(rads); row_i = []; col_j = []; for i_rad=1:num_rads this_rad = min(rads(i_rad),M); [X,Y] = meshgrid(0:this_rad-1); [~,r] = c...
99b62d2947647d762812b2f9a5eeb9da4bbbf288a8e6bae3de645a2d275fed63
MATLAB
529
19
% % Please cite this paper if you use any component of this software: % S. Soltanian-Zadeh, K. Sahingur, S. Blau, Y. Gong, and S. Farsiu, "Fast % and robust active neuron segmentation in two-photon calcium imaging using % spatio-temporal deep learning," Submitted to PNAS. % % Released under a GPL v2 license. functio...
c1a0407e47485b0f5a55a0ff738079d62dd675dc741603492f2cfccd85d20d21
MATLAB
529
18
function SONSetFileComment(fh, which, comment) % SONSETFILECOMMENT sets one of the five file comment fields % % SONSETFILECOMMENT(FH, WHICH, COMMENT) % FH is the SON file handle % WHICH selects the comment (0 - 4) % COMMENT is a string % % No return value % % Author:Malcolm Lidierth % Matlab S...
b8fb39ca84e8b27c156c842831c5d1000f93cdac7d0eac99821e9e49270ae37a
MATLAB
530
28
function dir_names=get_sub_dir_names(root_dir) file_infos=dir(root_dir); dir_names=[]; dir_dates=[]; for f_idx=1:length(file_infos) one_f_info=file_infos(f_idx); if one_f_info.isdir dir_name=one_f_info.name; if ~strcmp(dir_name(1), '.') dir_names=cat(1, dir_names, {d...
288ea41a2e5f3a0931aba99be0856876d9ac5dfdaabb6d54e606853213b15256
MATLAB
531
22
function [distP,distG] = genomicAndPhysicalDist(data, jj, kk, ll) if ~isempty(jj) & ~isempty(kk) & ~isempty(ll) celljj_chrkk_clusterll = (data.cell == jj) & (data.hg38_chr == kk) & (data.cluster == ll); data_jj_kk_ll = data(celljj_chrkk_clusterll,:); else data_jj_kk_ll = data; end distP = d...
9a103978abd7f6a52a153ad8a9e3349fd027d594597a0adcdcd3d0b88dbac6a2
MATLAB
531
15
function result = load_anonymous(file_name) % Loads the unique variable in file_name, in a way that is transparent to the % caller. s = load(file_name, '-mat') ; variable_names = fieldnames(s) ; variable_count = length(variable_names) ; if variable_count == 0 , error('File %s has no vari...
b92b19473edda9828f2304bc2a1e62c022214f6658bb663d88b9797dd04d5860
MATLAB
531
13
function [x_bin_inds] = ml_alg_chist_bin_inds(x_deg, center_bins_deg) % The bins are assumed to be equally sized/spaced % computed from ml_alg_chist_center_bins dtheta_deg = median(diff(center_bins_deg)); right_bins_deg = center_bins_deg + dtheta_deg / 2.0; % Get the bin indices of the head di...
ddf3da872de76dcb45a004c1d5519fa672288575c8a0744e146d2d06d1939fa0
MATLAB
531
21
function [lDivide]=SONChanDivide(fh, chan) % SONCHANDIVIDE returns the clock ticks per ADC value from the specified % channel % LDIVIDE=SONCHANDIVIDE(FH, CHAN) % FH SON file handle % CHAN Channel number % % See also SONGETUSPERTIME % % Author:Malcolm Lidi...
f148e0c27652dfd1ba4e83ce331878fa3b8e51e4c23267af83a60bd7878f6960
MATLAB
531
20
% mglEyelinkEDFPrintF.m % % $Id$ % usage: mglEyelinkEDFPrintF(message) % by: eric dewitt & eli merriam % date: % purpose: send a message to the eyelink eyetracker to be stored in the edf data file % mglEyelinkEDFPrintF(sprintf('trial %i', trialnum)); % function [] = mglEyelink...
35bcf734a3514712a1035d1a7727229d7bd6a8dec974040a7e761a32bd0d7f44
MATLAB
532
15
function M = moving_maximum(A,k,use_absolute_max) %calculates the moving max for A with sliding window k k_half = floor(k/2); M = zeros(size(A)); for i = 1:size(A,2) if use_absolute_max [M(:,i), max_indecies] = max(abs(A(max(i-k_half,1):min(i+k_half,size(A,2)))),[],2); signs = s...
636a07fd2cc19c4ea0731bc8d598450dabf3d503fb913eda50128767ee62ce55
MATLAB
532
20
ROpos = Device.qPOS('x y z'); steps = linspace(-4,4,91); xdata = nan(length(steps),1); ddata = nan(length(steps),1); for i = 1:length(steps) Device.MOV('x',ROpos(1)+steps(i)); Device.WAIT() Device.DRC(1,'x',2); Device.DRC(4,'1',17); Device.DRT ( 2, 1, '0' ); Device.DRT ( 2, 4, '0' ); pause(1...
f900b8f932a4ea138f4a6b40b46986d21be822cd9210ac59e4b287c9df6d511f
MATLAB
532
16
function names = fieldnames(this) % Fieldnames method for GIfTI objects % FORMAT names = fieldnames(this) % this - GIfTI object % names - field names %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: f...
30fdd9bb767285932cafb279bd4f89db4c7c7029e4c440f11cfe36b229bc96e0
MATLAB
533
16
% mglGetKeys.m % % $Id$ % usage: mglGetKeys() % by: justin gardner % date: 09/12/06 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: returns the status of the keyboard (regardless % of whether the focuse is on the mgl window) % if...
7302312325e29bc9d090c622ab54d513b4953fe2f5e1ddd2bee6b88336631a6a
MATLAB
533
14
function string=SONGetFileComment(fh, n) % SONGETFILECOMMENT returns the file comment % % STRING=SONGETFILE(FH, N) % where FH is the file handle and N is the comment number (0-4); % % Author:Malcolm Lidierth % Matlab SON library: % Copyright © The Author & King's College London 2005-2006 % Modified 26.07.09 to preve...
5d473a66ba3b282d5c041b4b85aee70a9b31cfed790c48d97b6f6bbdc691e7c5
MATLAB
534
25
function lab= convertLab(lab,nlab) for i=1:nlab ilab=lab(i,:); if iscell(ilab) ilab=ilab{:}; end ilab(ilab=='_')=[]; ind= strfind(ilab,'VOL'); ilab(ind:ind+2)=[]; ind= strfind(ilab,'norm'); ilab(ind:ind+3)=[]; ind= strfind(ilab,'DMN'); ilab(ind:ind+2)=[]; ind= s...
7029717c0099cb191cedae29723e49ce2cca817b6f5df1238871532569e22ae1
MATLAB
534
30
% % Compute preferential attachment prediction. % % PARAMETERS % a Adjacency/biadjacency matrix % at (e*2) Vertex pairs for which to compute predictions % format % weights % % RESULT % predictions Struct by submethod name of (e*1) Predictions % function [predictions] = prediction_local_compute_pref(a, at, format, we...
fb41dcfa8169784daae70d126ee16254261eab947291af1606adc5ec65ace6d2
MATLAB
534
13
function result = get_maximum_core_count() % Like feature('numcores'), but gives the right answer on an LSF worker % node. LSF_core_count_as_string_maybe = getenv('LSB_MAX_NUM_PROCESSORS') ; if isempty(LSF_core_count_as_string_maybe) , physical_core_count = feature('numcores') ; resu...
0b6ef3fafb0029ce72fdcd5ebc2484140d2781f10007586346607e38fddeb9ec
MATLAB
535
13
function CoD = computeCoD(data,prediction) % Function to compute coefficient of determination (also known are R2) % We define CoD as the RESIDUAL sum of squares / TOTAL sum of squares. % % One could also use the ordinary R2 (which does not care about predicting % the mean correctly): % defined as 1 - (var(data - pre...
f66412f71fed11332e1a9cc2c318c2ebcfe155aace55a650400c98718d0b45d5
MATLAB
535
23
% % Estimate a power law when only the largest values are known. % % Don't use this for degrees. For degrees, not all values are necessarily known and power_law_*() should be used. % % PARAMETERS % values Values. Nonpositive values are ignored. % % RESULT % alpha Negative slope, .a.k.a. the power law exponent ...
cb6b4fefdd76be0b9f3df47b4b351a3f6d2f703167060b746e60da42a4e056e0
MATLAB
536
18
function txt = ternary_datatip(~,event_obj,Zdata,wlimits) %surf_data_cursor CustomDataTip for Surf Ternary Plot % % Get the Index of the point I = get(event_obj, 'DataIndex'); % Get Coordinates pos = get(event_obj,'Position'); [A,B,C] = cart2tern( pos(1),pos(2),wlimits ); % Get a...
cbb6590abdd2a7e4a6aedc9ffd0ccecba179815dcc550e6f36016e815a9ae8e1
MATLAB
537
20
function tsim = textonsim(fb,tex) % function tsim = textonsim(fb,tex) % % Compute texton dis-similarity matrix. The dis-similarity between % two textons is given by their L1 difference run through an % exponential. % % David R. Martin <dmartin@eecs.berkeley.edu> % April 2003 tim = visTextons(tex,fb); ntex = ...
fd2223ee718186972d751c62c8efef0303140533f42076203e838c49c3bc7417
MATLAB
537
18
% SONAPPID sets or gets the creator lable from a SON file % % Implemented through SONAppID.dll % % LABLE=SONAPPID(FH) % returns the creator lable % LABLE2=SONAPPID(FH, LABLE2) % sets the lable to LABLE2 then reads it back to LABLE1 % % FH is the SON file handle % LABLE, LABLE1...
111486414d7c89810c201ed6f4b7b32df0a8026ff3e7586e059f815ee8b62485
MATLAB
538
20
function [width,pl,pr] = widthestimate(vector,fraction) %calculates fwhm if fraction is 0.5, fw 1/e for 1/e, etc., uses linear %interpolation if nargin<2 fraction = 0.5; end vector = vector/max(vector(:)); greater = vector>fraction; flip = find(diff(greater)); s1 = (vector(flip(1)+1)-fraction)/(vector(flip(1)+1)-ve...
dc0e61d6ba845eac23285c8853ef09b03d8cdecdb93cc03f1d6ab6880edcac72
MATLAB
539
18
function reducedA = getActiveAdj(active, adjmat, Ncell) %get adjmat of only the active elements % for i = 1:length(active) % pix = active(i); % neighbours = find(adjmat(pix, :) == 1); % activeNeighs = intersect(active, neighbours); % [~,idx] = intersect(active,activeNeighs,'stable'); % re...
150aa24a69f88a8d6f706db3a08133a5394e28faebe7b818b51c2b25f77e5db6
MATLAB
540
30
function [err,msg] = vl_demo_cmd(name, args) % DEMO_CMD: Demo: Command line utility ext = '' ; switch mexext case 'mexmac' arch = 'mac' ; case 'mexmaci' arch = 'maci' ; case 'mexmaci64' arch = 'maci64'; case 'mexglx' arch = 'glnx86' ; case 'mexa64' arch = 'glnxa64' ; case 'dll' arch = 'win32' ; ext = '.e...
2328feb2a7ee4bdc5d281dfd9224de3b78c68cdfa8f1d8f7c0fc29f3a7f702ca
MATLAB
540
16
function [xlim,ylim] = match_aspect_ratio(xlim,ylim,handles) % zoom in on a set of limits as much as possible without changing aspect ratio % splintered from fixerrorsgui 6/21/12 JAB aspectratiocurr = diff(xlim)/diff(ylim); if aspectratiocurr < handles.mainaxesaspectratio, % make x limits bigger to match xmu = mea...
8a8cbd9ad5e66eb2256b75a8517378d06db0df4886718b84d2e21555007e9730
MATLAB
540
19
curdataset=1; %% expdata(curdataset).tag=[mouse,':',date]; expdata(curdataset).identities=identities; expdata(curdataset).all_centroids=centroids; expdata(curdataset).sumds=sumds; expdata(curdataset).all_silhouettes=all_silhouettes; expdata(curdataset).mean_silhouettes=mean_silhouettes; expdata(curdataset).combinati...
dd73905cf2a53875ed39d8037cf6c167556ef136bfb978c0530f3f033603e60b
MATLAB
540
23
function [vari_mean,vari_err] = semErr(vari, dim_1) %exludes NANs %previous version uploaded to Zenodo in error % Get the size of the input data dataSize = size(vari); % Initialize arrays to store the standard deviation and count of non-NaN elements stdDev = nanstd(vari, 0, dim_1); % Standard deviation exc...
0b37aa5461454bedaa56d047f1bc3acb84c7326d095fa8b3bc1414584f3cd531
MATLAB
541
23
function [ video ] = ml_cai_io_behavreadavi( behavFilename ) o = VideoReader( behavFilename ); vidWidth = o.Width; vidHeight = o.Height; mov = struct('cdata', zeros(vidHeight, vidWidth,3,'uint8'), 'colormap', []); k = 0; while hasFrame(o) k = k + 1; mov(k).cdata = readFrame(o); end if k == 0 error('No fram...
55cd107384b5bbd9c04ac06406277781675e14085e340a262f67a04c6ee4a0ab
MATLAB
541
15
function checkDataIntegrity( obj, session, trial ) trialFolder = trial.getTrialDirectory(); status = ml_cai_miniscope_recording_status( trialFolder ); if status.isValid fprintf('No problems detected.\n') else fprintf('Integrity is compromised!\n'); if ~status.settingsAndNotes.isV...
5d272b1b5de7d2165f5398aeaacc28c8c5af13dc34a552be29a468a72ed158c6
MATLAB
541
15
function kind=SONChanKind(fh, chan) % SONCHANKIND Returns the channel type % KIND=SONCHANKIND(FH, CHAN) where FH is the file handle % CHAN is the channel number (0 to % SONMAXCHANS-1) % Returns kind as an enumerated string - see CED documentation fo...
e4cad0c4b67b3b8db9d6010e693ad552619e169caedff9bf352f1138d60a81a6
MATLAB
541
26
function t = fieldnames(obj) % Fieldnames of a NIFTI-1 object % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: fieldnames.m 8776 2013-11-14 09:04:48Z roboos $ if isfield(obj.hdr,'magic') t = {... 'dat' '...
a74d0b2ed7ceaff053a47c6bd424f86247810f5e591c1b92dcab10a34882b0c2
MATLAB
542
20
function T=transitivity_wu(W) %TRANSITIVITY_WU Transitivity % % T = transitivity_wu(W); % % Transitivity is the ratio of 'triangles to triplets' in the network. % (A classical version of the clustering coefficient). % % Input: W weighted undirected connection matrix % % Output: T trans...
192e15b17c525211ae22dbefa2e25bef625825fab9cb9dbe41cbfd9dfaf6a3af
MATLAB
543
18
% Define contribution of each node to correlation between EEG and fMRI % Formula 13 from Colcough 2016 NeuroImage % % Jonathan Wirsich 22-11-2019 function contrib_vec = getSpatialContribution(meanVec1, meanVec2) spatialMean1 = mean(meanVec1); spatialMean2 = mean(meanVec2); denominator = sqrt(sum((meanVec...
712246911542447d07b169139a3412f448897f1b7a86a4bd2327ca2a4306e19d
MATLAB
543
13
figure(); plot(timeax,r_cond1,'Color','#0072BD'); hold on plot(timeax,r_cond2,'Color','#D95319'); plot(timeax,r_cond3,'Color','#EDB120'); plot(timeax,r_cond4,'Color','#7E2F8E'); plot(timeax,r_cond5,'Color','#77AC30'); xlim([0 2000]); % axis([0 2000 0 0.2]); title("\Delta_{E} = " + nu...
e25a82ba19d7545c19cff29929a9212861b9ee4c666b3f13b79958a2810ed379
MATLAB
543
17
%% Author: Jiri van Bergen % Affiliation: Radiology @ JHU - Kirby Center % Contact via xuli@mri.jhu.edu % IF USER PRESSES THE X BUTTON % ALL THE STOPPING STUFF if(hasCanceled) % Close it all multiWaitbar('CloseAll'); % Enable buttons set([handles.ButtonEditEchoes handles.VarFSLThres...
30acc35c73c2809e03125755723c405d169217f9eb499b2fb855cf83bcf2cf3d
MATLAB
544
19
function activate_func(SC,f,mat_flag,py_flag,flag_nearest) %activate f on SLMs, depending on the flags if(~exist('mat_flag','var')) mat_flag=1; end if(~exist('py_flag','var')) py_flag=1; end if(~exist('flag_nearest','var')) flag_nearest=0; end f_mat=rot90(f,2); %to align correctly f_py...
6b6b4b2af2bd4fc141daacdd9de1d36bdbad0c80feb4c467225c70183f63da65
MATLAB
544
25
function btab = btabgen(gdir,bval,t,root) Nt = size(t,1); Nb = numel(bval); Ng = size(gdir,1); btab = []; for i = 1:Nt ti = t(i,:); btab = cat(1,btab,[0 0 0 0 ti]); for j = 1:Nb bj = bval(j); % gvalj = sqrt(bj/ti(2)^2/(ti(1)-ti(2)/3)); for k = 1:Ng gdirk = gdir(k,:); ...
3f79b276185cc363794f7008651be89375b08ec7b2591c8f4dc3dc1446540169
MATLAB
545
19
% f_GetHFOIntervals.m [As a part of HFO Detection Project] % Written by: % Miguel G. Navarrete Mejia % Electrical Engineering MS candidate % UNIVERSIDAD DE LOS ANDES % Colombia, 2012 % mnavarretem@gmail.com function v_Intervals = f_GetHFOIntervals(pstr_SignalPath,ps_SignalIdx,pm_Lims) load(pstr_SignalPa...
583d18d776bf191cc4a95bb9f9a3d5b249185caea26b03104f754a5e1f48d24d
MATLAB
545
15
% mglFlush.m % % $Id$ % usage: mglFlush() % by: justin gardner; X support by Jonas Larsson % date: 04/10/06 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: swap front and back buffer (waits for one frame tick) % % Warning: if using mglFlush to keep t...
cc2d2a43fdf171e0b6464b1160d140536dd3eadcaf63a88e3c1d9179cc2e2da0
MATLAB
545
24
%% Set up clear;clc; close all; fclose('all'); expmtDataFolder = 'D:\My Drive\Expmt Data\Max\Climbing Fiber Project\Initial Data for testing'; Files = dir([expmtDataFolder '\**\*']); %% Filters Files(~contains({Files.name}, {'behavior.mat'})) = []; for i = 1:length(Files) filename = fullfile(Files(i).folde...
261c8fa623c5c1ed9ded8a5594bd35f08e0e7a4ca87164ff43c65eb8a6e79244
MATLAB
546
26
function class_info=gen_class_info_sunrgbd() class_info=[]; class_names=load('./sunrgbd_class_names.mat'); class_names=class_names.seg37list; class_num_org=length(class_names); class_names = cat(1, {'void'}, class_names'); class_info.class_names=class_names; class_label_values=uint8([0 1:class_num_org]); class_...
7e2a1ec12b7753c80dd62bdd553506d764be6f6b9ef4f45713222dcc919369a3
MATLAB
546
15
function [report_data] = report_objective(report_data, state) % % Copyright (C) 2004, 2005 DSS MATLAB package team (dss@cis.hut.fi). % Distributed by Laboratory of Computer and Information Science, % Helsinki University of Technology. http://www.cis.hut.fi/projects/dss/. % $Id: report_objective.m 8776 2013-11-14 09:04...
8c696d8d634c439f956e1f26052702a3322a26b734d6263bad3c37f3e6cfdb1a
MATLAB
546
15
function x = fill_binary_holes(x, hole_size) %this function removes all holes (ex [1 0 1] and [0 1 0]) up to hole_size for current_hole_size = 1:hole_size pattern = [1, zeros(1,current_hole_size), 1]; idx = strfind(x,pattern); if ~isempty(idx) x(bsxfun(@plus,idx,(0:current_hol...
980779051f66b5d63d43ff6dcabbe27183589866a20f8ec8b3fe39ad6b291548
MATLAB
546
14
function string=SONGetFileComment(fh, n) % SONGETFILECOMMENT returns the file comment % % STRING=SONGETFILE(FH, N) % where FH is the file handle and N is the comment number (0-4); % % Author:Malcolm Lidierth % Matlab SON library: % Copyright © The Author & King's College London 2005-2006 % Modified 26.07.0...
bff22db93691dc352c112d78221e46dfa34abb1e2896293631167bb0f4608f25
MATLAB
546
22
% pDataDir.m % % Function that returns the full path to the pData directory. % % INPUTS: % none % % OUTPUTS: % pdDir - full path to pData directory % % CREATED: % 9/8/20 - HHY % % UPDATED: % 9/8/20 - HHY % function pdDir = pDataDir() % pdDir = '/Users/hyang/Dropbox (HMS)/EphysAnalysis-Helen/pData'; % pd...
dbb3b11056f817a36e53026a3811be7fbf266383aff61f12fc322c06760c9b25
MATLAB
546
22
function[allMarkers] = combineMarkers (file1,file2,file3); %% % file: combineMarkers.m % purpose: combine vglut1, vglut2 and gad information from a dendrite into % one matrix load(file1); first = synMat; load(file2); second = synMat; if (exist('file3', 'var'))==0; allMarkers = [first; second]; elsei...
39ec6b00da51280b12f19d0842e61bb8e3b6bc08800b2605e21a1c8ab4cf5e5e
MATLAB
547
18
function SONSetFileComment(fh, which, comment) % SONSETFILECOMMENT sets one of the five file comment fields % % SONSETFILECOMMENT(FH, WHICH, COMMENT) % FH is the SON file handle % WHICH selects the comment (0 - 4) % COMMENT is a string % % No return value % % Author:Malcolm Lidierth ...
13ae934fc2bf100573b4114e00ba3c64ff64e218c8b337a6a989c66aad086e6b
MATLAB
548
17
function [Coil_arr] = Coil_pos_array(lx,ly) xu = [1 0 0];yu = [0 1 0];zu = [0 0 1]; r_s = 0.095;a = ly + 2; b = lx - 2; XY = [-a a;-a b;-a -b;-a -a;-b a; -b b;-b -b;-b -a;b a;b b;b -b;b -a;a a;a b;a -b;a -a]*1e-2; Z = sqrt(r_s^2-sum((XY.^2),2)); MovXYZ(:,1:2) = XY; MovXYZ(:,3) = Z; for i = 1:16 ang= [atan2(norm(cros...
b1f55259092e20e2ac29e31aac1f741203e37e285cde33fc69f4686dda071067
MATLAB
548
21
function input_info=my_init_input_info(input_info) if input_info.is_group_data input_info_child_groups=input_info.data_child_groups; child_num=length(input_info_child_groups); for c_idx=1:child_num input_info_child_groups{c_idx}=my_init_input_info(input_info_child_groups{c_idx}); end input_info.d...
2ccab591b6be2ce095ea6bd244ccf46d481f6984b23f52b8c9cc03d8e9ae9060
MATLAB
549
19
function handles = fix_RemoveBirthEvent(handles,fly) % removes a birth event for a fly % splintered from fixerrorsgui 6/21/12 JAB (as a no-op) %if handles.trx(fly).firstframe > 1, % for i = 1:length(handles.seqs) % if strcmpi(handles.seqs(i).type,'birth'), % if fly ~= handles.seqs(i).flies, % continue;...
328d67d67d8c27afed7b8b009ee75969c87c9fe742a4db9d1e8a70f357924d36
MATLAB
549
21
function [results] = SNR_ERP(ALLEEG,event) id = {}; base = []; peak = []; for n=1:length(ALLEEG) EEG = ALLEEG(n); epochnums = find([EEG.event.type]==event); for epochn=1:length(epochnums) thisepoch = EEG.data(:,:,epochn); % calc SNR as peak(ERP)/std(baseline) id{length(id)+1} = EE...
70c2e917ed8204cf3c9a7d682188634180d1987a4245905f08104f77fd29115d
MATLAB
549
23
function results = vl_test_phow(varargin) % VL_TEST_PHOPW vl_test_init ; function s = setup() s.I = im2double(imread(fullfile(vl_root,'data','spots.jpg'))) ; s.I = single(s.I) ; function test_gray(s) [f,d] = vl_phow(s.I, 'color', 'gray') ; assert(size(d,1) == 128) ; function test_rgb(s) [f,d] = vl_phow(s.I, 'color',...
792139aa4b5c8ecbd9d672c85f01d37e66f776f99fca17d9d7c695e759194590
MATLAB
549
16
function tree = setfilename(tree,filename) % XMLTREE/SETFILENAME Set filename method % FORMAT tree = setfilename(tree,filename) % % tree - XMLTree object % filename - XML filename %__________________________________________________________________________ % % Set the filename linked to the XML tree as filename. %_...
e202919809f0794b20562bdf4db5119aad3af17b9512dd33b1142ab7d51f0524
MATLAB
549
12
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [jointEntropy] = ml_alg_joint_entropy_images(Ia, Ib) % Ia and Ib must be discrete valued indrow = double(Ia(:)) + 1; indcol = double(Ib(:)) + 1; %// Should be the same size as indrow jointHistogram = accumar...