sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
509da20783a32d26e3b350a2a3b7e50a63d48120d2c0e8b95ff1db129e790a20
MATLAB
958
51
function M1 = vox2ras_0to1(M0) % M1 = vox2ras_0to1(M0) % % Converts a 0-based vox2ras matrix to 1-based, ie, % Pxyz = M0*[c r s 1]' = M1*[(c+1) (r+1) (s+1) 1]' % % % vox2ras_0to1.m % % Original Author: Doug Greve % CVS Revision Info: % $Author: nicks $ % $Date: 2007/01/10 22:55:10 $ % $Revision: 8776 $ % % C...
8cec7b95e8c7ad646f543dae967146d1fcf527252673da08d495432e79dd6ba0
MATLAB
958
34
%% Author: Jiri van Bergen and Xu Li % Affiliation: Radiology @ JHU - Kirby Center % Contact via xuli@mri.jhu.edu % Open file [FileName,PathName,FilterIndex] = uigetfile(handles.Params.fileTypes, 'Select files (PAR/REC, DICOM, NIFTI)'); % Something? if(FileName ~= 0) % Get data tableData = get(han...
8cff45641281fc48366d38c5cf525f0dde682f6cca1afd45aed7b155810ac1ec
MATLAB
958
28
function stdout = system_from_list_with_error_handling(command_line_as_list) % Run the system command, but taking a list of tokens rather than a string. % Each element of command_line_as_list is escaped for bash, then composed into a % single string, then submitted to system_with_error_handling(). ...
f2f7c8b96ae1f8b7b5cfc324a8b7903af519a374783f5d49a89a5bed170c7b9b
MATLAB
958
34
function [h] = mlgp_plot_cumulative_similarity(obj, session) tmp = load( fullfile(session.getAnalysisDirectory(), 'best_fit_orientations', 'bfo_180_percell.mat') ); perCell = tmp.perCell; t = {'all', 'same' , 'different', 'context1', 'context2'}; h = figure; for it = 1:length(t) X = [perC...
39b87b58cdf0644ef797b51d948b1ff7199c352fedf8852eee7dcb9b31fc68b4
MATLAB
959
23
function [params, beta] = beta_global(params, state, denf) % Beta function for global spectral shift based on gaussian noise. % [s_new, params] = beta_global(params, state, s) % params Function specific modifiable parameters % state DSS algorithm state % denf Denoising function % beta Global ...
9f4f6a69abc85584a22df57789c506d6e6de18a0225bb0a2d7e2a200322cf6f5
MATLAB
959
34
function tifwriteblock(imData,imFilename,imHeader,dataType,blocksize) if length(size(imData)) ~= 3 error('image is not 2D or 3D') end if nargin<5 || isempty(blocksize) blocksize = 1000; end if nargin<4 || isempty(dataType) dataType = class(imData); else imData = eval([dataType '(imData)']); end if nargin...
b5b7a6ee1a4718378fe8c131e836cb5eaed30896713eaac02557894667e1988e
MATLAB
961
31
function format_string = format_generator(skip_keep_vector) % This function assumes 1 = remove or skip and 0 = keep. It also assumes % the pre-skip frame and 2 post-skip frames are already in the % skip_keep_vector. if isstr(skip_keep_vector) disp('You are silly, because you put a string, when I want a vector') ...
be94c3eb4c5d97e011797f93dc7f05e572ffb990f56f769e08d44ed4ef5689c6
MATLAB
961
47
function my_save_file(cache_file, data_obj, force_overide, be_quite) if nargin<3 force_overide=false; end if nargin<4 be_quite=false; end finished=false; while ~finished try if ~force_overide && exist(cache_file, 'file') disp('file exist, save to new name.'); ...
d21093b253118144f20033e9434ae00df8277448cac266d58f602351e77f08a7
MATLAB
961
29
function ml_mclust_convert_clusters_to_muzzis(mclustClusterFilename, muzzioClusterFilename) % Basically a direct copy from a .clusters file to a new .muzzis file. % We can't just use copyfile because the structures were renamed. % Load the MClust '.clusters' file data = load(mclustClusterFilename, '...
ef441198e7c4451dbaa894a0ced7514361881ffdecf1bb93891ed0a1d42b2c97
MATLAB
961
40
function[]= check_shift(redcell_vect,cell_stat,img,shift,img_brightness) % Function that plots masks over both the mean functional image and the % mean from the wavelength stack to make sure that the registration %% MAKE VARIABLES xshift=shift(1); yshift=shift(2); red_idx=1:length(cell_stat); red_idx=red_idx(re...
06b64302f13fcc1e8b198a3d49542b00d1832bdf03188be37324e7c7c5353c03
MATLAB
962
35
function artinis_license % ARTINIS_LICENSE prints the license only once upon the first call to % this function. If the user does a "clear all", the license will % again be shown. This function should be included in every artinis % function to ensure that the license is displayed at least once. % Copyright (C) 2009-2...
1cc51369f289f96441d03ad9448904d12f62bf654a464450412d3e4a7e338965
MATLAB
963
21
function [thinned_image_outline, thin_iteration] = find_possible_centerline_image(BW, best_thinning_iteration) %find the centerline image by removing best_thinning_iteration pixels %from the outside of the BW image and finding the outline %remove spurs spurless_BW = bwmorph(bwmorph(BW, 'close'), 'spur...
5e664c52e117dcbaf725d3475820b23ee76d572a35e650e6301343c7a9268bf6
MATLAB
963
31
function [ ] = bemf1_graphics_coil_CAD_3color(coil, flag) Gc = [0.11 0.93 0.1]; Rc = [1 0 0]; Bc = [0.01 0.01 0.98]; if flag == 1 % x coil Pfull = coil.P; p = patch('vertices', coil.PX, 'faces', coil.tX); p.FaceColor = Rc; % [0.72 0.45 0.2]; p.EdgeColor = ...
70ee04a24d4d04648ce3e84e84826c385212c07cb19ed5603a028d5239c14ca2
MATLAB
963
32
% % 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," Proceedings of the National Academy of Sciences (PNAS), 2019. % ...
f1263ef0eb3c9932bed68ca9064ff7f50b5cd6fd0e6c9a99eff14623f64426a3
MATLAB
963
22
function n_ch = powerlaw_range(xx) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % If you use this code, then please cite: % 1.- Ana P. Millan, et al. "Individualized epidemic spreading models % predict epilepsy surgery outcomes: a pseudo-prospective study." % medRxiv (2023): 2023-03. doi: https...
347591cac9a4065dbbcf358282c64b5fb5d06116d68e871057e052703f7c7cf0
MATLAB
964
36
function [centerOutAngle] = centerOutRadians(map) % from -180 to 180; boxSize = size(map); centerXY = [boxSize(2)/2, boxSize(1)/2]; % calculate center of mass M = map; k = prctile(M, 95, 'all'); if isnan(k) centerOutAngle = nan; return; end bw = zeros(size(M)); bw(M>=k) = M(M>=k); labeledImage = bwlabel(bw);...
51d7d62158e161c92969dc75c21a48c6f093104baf2057b8c06bd32f27d0cc78
MATLAB
965
28
function [params, result] = ortho_default(params, W, w) % Default DSS orthogonalization function % W = orthof(W) for symmetric dss % w = orthof(W, w) for deflation dss % W Matrix with projection vectors as rows. For deflation % algorithm only previously calculated projections are given. % w Curre...
6f72a12faa0581702421e7196071faa84573b5e1685f3b83d919862cb728339a
MATLAB
965
30
function [exportedFilename] = ml_limelight_export_video(limelightFilename, frameRate_hz) %frameRate_hz = 15; [filepath, name, ext] = fileparts(limelightFilename); if ~strcmp(ext, '.llii') error('Can only read FreezeFrame video that end in ".llii".\n'); end if ~isfile(limelightFilename)...
e1b99c92039013b016afd18a3f48042c9a3322b3c5590356e58cef691ad617c0
MATLAB
965
13
function LHS = bemf4_surface_field_lhs(c, Center, Area, contrast, normals, weight, EC) % Computes the left hand side of the charge equation for surface charges % % Copyright SNM 2017-2020 toc % LHS is the user-defined function of c equal to c - Z_times_c which is % exactly the left-hand side of t...
68d561ca0adf5dda3eb957b2c8380ecf85a317f5c98d984c1d2aee0764b1093f
MATLAB
966
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 %...
d5abd0f5ffd1eaab8afae222fa415d3f4b7871ea45b91781a2c71ae9d66bfc39
MATLAB
966
28
function PruneRecording(recordingParams) if ~exist(recordingParams.outputDirectory,'dir') mkdir(recordingParams.outputDirectory); end stable_time = recordingParams.stable_time; stable_channels = recordingParams.channels+1; if recordingParams.hasTriggerChannel num_of_raw_channels = 385; else num_of_raw_ch...
04c9ea4510d9347f53a0cf4836866a2ff1b46627fcdbff7ad1b4ec7c25cf202b
MATLAB
967
34
function [ data_cost, reg_cost ] = compute_costs( chi, phase, kernel ) % Calculates the costs associated with a TV regularization % Useful to build a L-curve plot %% % Parameters: % chi: calculated susceptibility map % phase: acquired phase or local phase map. % kernel: dipole kernel in the frequency space % % Output: ...
07bf055d4d835d4cd99a9b087edb390824674f443405591e5a4c1b1cb40f82b8
MATLAB
967
30
% Simplified FIM for GBM % Original Source: Marisa Eisenberg (marisae@umich.edu) function FIM = GBMMiniFisher(tspan,fixed,params,indexchooseparam,initialcondition,variablenum) delta = 0.001; %percent change we'll use, default 0.1% X = []; for j=1:length(params) params1 = params; params2 = params; params...
61b9955c70c41050d7c2bd8720cddf5874f828880417e7a3b05da2a9bf950a30
MATLAB
968
27
[filename, path] = uigetfile({'*'}, 'MultiSelect','on','Çë¶ÁÈ¡tdmsÎļþ'); if ischar(filename) file_num=1; full_file_path=fullfile(path,filename); [~,~,file_part]=fileparts(full_file_path); if strcmp(file_part,'.tdms') reading = TDMS_readTDMSFile(full_file_path); data=cat(1,reading.data{3...
7878d7f714be6401d5051021a780b5c63c945bf73fd66b8ff191014b75f5f0fe
MATLAB
968
27
function[out,hout]=SONRealToADC(in,header) % SONREALTOADC Converts floating point array to int16 % and returns a header with updated scale and offset % % Example: % [OUT,HOUT]=SONREALTOADC(IN, HIN) % The input data are scaled to fill the maximum range of the int16 % output array. Scale and offset in HOUT are updated in...
4e214ab6b9d97b1b88fcbdc445662428b061c9be230212da84afff46f666554a
MATLAB
969
52
% % Test which distributions fit the hop distribution. % % PARAMETERS % $network % % INPUT % dat/info.$network % dat/hopdistr.$network % % OUTPUT % dat/hopdistr_distrtest.$network.mat % .data.[distr-name] % the data of the fit as returned by % distrtest_plot() % network = getenv('network'); consts = konect_cons...
168c357237806bda1b1c6b8268bd3166f83f5dffa9ef451e21920e87070cecf0
MATLAB
970
38
function [p,dp,negCinv,logdetrm] = logprior_ridge(prvec,rho,iirdge,rhoNull) % [p,dp,negCinv,logdetrm] = logprior_ridge(prvec,rho,iirdge,rhoNull) % % Evaluate a Gaussian log-prior at parameter vector prvec. % % Inputs: % prvec [n x 1] - parameter vector (last element can be DC) % rho [1 x 1] - ridge parameter (pre...
4fec1757c8d6c5acbd3a6a6ee6028fb18903bc449c893c56eaa8344a8faa4a4b
MATLAB
970
27
function [params, s_new] = denoise_fica_skew(params, s, state) % FastICA skew nonlinearity as DSS denoising function % [params, s_new] = denoise_fica_skew(params, s, state) % params Function specific modifiable parameters % state DSS algorithm state % s Source signal estimate, matrix of row vecto...
d3e588423cce840aa55e3f4aa87f5382db912dcf6c9a7a44cfc60094869237b3
MATLAB
972
24
function subsample_coord = SubSampleTrack(coord, time, fps, interpolate) % not used in paper subsample_coord = zeros(floor(max(time)*fps),2); time_index = 2; for i = 1:length(subsample_coord) curr_time = i / fps; while time(time_index) < curr_time time_index = time_index + 1; ...
4e8a61fd3f3e6832be662fd0744850d18e272e113aab039fbb6a713344fb9d17
MATLAB
973
30
% mglSocketClose: Close a socket. % % $Id$ % usage: s = mglSocketClose(s) % by: justin gardner and ben heasly % date: 12/26/2019 % copyright: (c) 2021 Justin Gardner (GPL see mgl/COPYING) % purpose: Close a local/unix socket. % usage: s = mglSocketClose(s) % s -- a socket ...
4fdca5ebfcfe7b203869dc8135e6ee1d451f4603f394d7d63cd89b8a5c9a8cc5
MATLAB
973
37
% mglMoveWindow.m % % $Id$ % usage: mglMoveWindow(leftPos,topPos) % by: Christopher Broussard % date: 10/23/07 % purpose: Moves the current AGL window with the left edge of the window % at 'leftPos', the top edge at 'topPos'. % %mglOpen(0); %mglMoveWindow(100,100); function mglMoveWin...
3639276ca9c92b54f9a797fba7d71d4e6d1b232cb9c081b54c46233416c9e2bb
MATLAB
974
27
% Determine whether detections are atomic based on % a) body is large enough to belong to a single fly, or % b) body is the only (or largest) component within foreground. % function is_atomic = is_atomic_detection(det,params) n_obj = det.body_cc.NumObjects; is_atomic = zeros([n_obj 1]); mean_body_area = param...
68bbd30a6a3e5a610ae6f46db5700e5d6580d941333906ba143700e200e84aee
MATLAB
974
43
%wrap - Set radian angles in range [0,2pi] or [-pi,pi]. % % USAGE % % y = wrap(x,range) % % x angles in radians % range optional: 1 for [-pi,pi] (default) % 2 for [0,2pi] % % SEE ALSO % % See also isradians. % % Copyright (C) 2010-2011 by Michaël Zugaro...
240e9460410cb05f7aa42a391443757f4fd2879071525145e26b0818b49513f6
MATLAB
975
25
function frame = msReadFrame(ms,frameNum,columnCorrect, align, dFF) %UNTITLED Summary of this function goes here % Detailed explanation goes here vidNum = ms.vidNum(frameNum); vidFrameNum = ms.frameNum(frameNum); frame = double(ms.vidObj{vidNum}.read(vidFrameNum)); if (columnCorrect) ...
4be62b71c81f278a02c4be41f0c7b62d361284439e85d10d7865ed4402ab2e46
MATLAB
975
30
% get1stHalfStepPhase.m % % Helper function for getLegPhaseFromSteps() that takes in step start max % position and step mid min position to convert a vector of leg positions % between the two to leg phases between 0 and 180 degrees, with a linear % mapping. % For a linear mapping: phase = 180(pos - startPos)/(midPos...
7394ebd4bc79088cff013d8e061a058b05ea1ffbb31f2c26515ced808485070a
MATLAB
975
66
% % Plot the rating evolution, i.e. the mean rating of each item in % function of number of ratings. % % PARAMETERS % $network % % INPUT FILES % dat/data.$network.mat % % OUTPUT FILES % plot/rating_evolution.[ab].$network.eps % network = getenv('network'); data = load(sprintf('dat/data.%s.mat', network)); ids = u...
ec1fbd2a48526855bdb90ef58bdb6ee9da45d80e226446c658a409fb9ee6149d
MATLAB
976
44
function varargout = myparse(params,varargin) nin = length(varargin)/2; nout = nargout; if mod(2*nin,2)~=0 || mod(length(params),2)~=0, error('Odd number of parameters expected'); end; % set defaults varargout = varargin(2:2:2*nout); % parameter names names = varargin(1:2:end); % go through parameters for i = 1:2...
ec19ca76e0aec7d39e4ba6f9e59aa00b243f63952e09dd7f43b6d1d9f7b7acf0
MATLAB
977
36
function ml_cai_neurondataset_plot_sfp(neuronDataset, nidToShow) I = []; for nid = 1:neuronDataset.num_neurons sfp = neuronDataset.neuron(nid).spatial_footprint; J = bwperim(sfp); if isempty(I) I = J; else I = I + J; end end [sfpc, ri, ci...
ac056c85794ee7e916afc11db6f6a066d4135385dd2068b57a8e48d6e20ef57b
MATLAB
978
30
function [alpha, logLL, scale] = fwd_nolog(seq, pi, A, b, n_state) %% Forward algorithm %% authors: Stefano Diomedi %% date: 22nd February 2024 % Prepend a dummy value to the sequence seq = [9999, seq]; n_bin = length(seq); % Determine the length of the sequence % Initialize alpha matrix and scaling factor alpha = z...
b18ac32d0c6672a458d7b95cf739b1cab4205332af54739720a65a4c685f18da
MATLAB
978
26
function [ text ] = getSessionInformation( obj ) % Display information about session date. % % Syntax: % GETSESSIONINFORMATION( obj ); % % Input parameters: % * obj - object containg data % % Example: % GETSESSIONINFORMATION( ); % % Available at: https://github.com/NCN-Lab/DBScope % For referencing, please use: ...
5562f6ba8a8ef37cec369c17a4b12a32b68456ae126ed664dab61069c16ad509
MATLAB
980
31
function [task myscreen] = mglEyelinkCallbackSaveData(task, myscreen) % mglEyelinkCallbackSaveData - Assigns eye position to myscreen % % Usage: mglEyelinkCallbackSaveData(IP, conntype) % IP - the ip address of the eyelink eye tracker, defaults to 100.1.1.1 % conntype - the connection type: 0 opens a direct link, 1...
6aac7e0b8e726c96bfe7caa996f64b8788a993a900e3eb8762bb00236491e3eb
MATLAB
980
20
function camerasdat_create( obj, session, trial ) % Create the camera dat files (TEXT) [status, pDat] = ml_cai_daq_camerasdat_create(trial.getTrialDirectory(), 'outputFolder', trial.getAnalysisDirectory(), 'verbose', obj.isVerbose(), 'interactive', false); if status ~= 0 error('Error encountered in ...
e3c0459ca3756b7b58f9a40bb138235433f20962d217cdbc84318244affb4cf9
MATLAB
980
32
% mglMirrorFlushAll: Flush the primary and any mirrored windows. % % $Id$ % usage: results = mglMirrorFlushAll() % by: ben heasly % date: 09/07/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Flush the primary and any mirrored windows. % usage...
03962fa1d12ec3ea3a9280cfa50eb41a5aa70df1bc314d4053f1cfa9fb118400
MATLAB
981
38
function out=cellidentify(Y1,Y2,method,p) %out:1:yes;0:no; %y1,y2: m*n mat,m:time,n:trial %method:‘ranksum’;‘mean_mean';'mean_index1';'peak_index';; %p:if method is ranksum,p is p-value;for other method,p is thesthod; if method==1 y1=mean(Y1,1); y2=mean(Y2,1); [t,~,stat]=ranksum(y1,y2); if t<p && st...
878c631d66db7427bc839292f21a9c40e7f2d379c9ffdaeed69ab50a24bccf9e
MATLAB
981
37
% % Plot one BIDD curve. % % PARAMETERS % p (e*1) Node indexes % q (e*1) Multiplicities; [] to denote all ones % enable_normalization Enable division with degree sum % type % name % symbol % enable_axis Same semantics as in konect_plot_power_law() % function bidd_one(p, q, enable_normalization, type, name, symbol, ...
0af47103405688b20bdc711be3f1fa0fde9d48bf5b674f4ba918ded23ea2cf0a
MATLAB
982
44
function newdata=fmri_detrend(data,no_of_anchor_points) % Performs detrending using spline interpolation on 4D volume data. % % newdata=fmri_detrend(data,no_of_anchor_points) % % inputs: % DATA = fMRI data, vectorized or volume data % NO_OF_ANCHOR_POINTS = Number of anchor points; Default = 6 % % outputs: % N...
d9e5caf6d047e43e6a85a678dc5811299dc79facbd5f5c3eff980ed2085c4259
MATLAB
982
35
% function f_Matrix2ZScore.m % function m_ZScoreMat = ... f_Matrix2ZScore(... pm_InMatrix, ... ps_FirstIndRef, ... ps_LastIndRef) if nargin < 1 error('[f_Matrix2ZScore] - ERROR: bad number of parameters!') end m_ZScoreMat = pm_InMatrix; if ~exist('ps_FirstIndRef', 'var') ...
c1974d6db0742fc47df6cb9998913ffa215ac2578af203094d3ce5f54cd130ba
MATLAB
983
38
classdef NWBData < types.hdmf_common.Data & types.untyped.DatasetClass % NWBDATA An abstract data type for a dataset. methods function obj = NWBData(varargin) % NWBDATA Constructor for NWBData obj = obj@types.hdmf_common.Data(varargin{:}); p = inputParser; p.Keep...
f459a99c3ca2f75c97059c2c741f60e3d362c8cd164b049a69fa79340228e183
MATLAB
983
35
function cinew = fcn_relabel_partitions(ci) %FCN_RELABEL_PARTITIONS relabels partitions % % cinew = fcn_relabel_partitions(ci) takes as input an ensemble of % partitions, ci, of dimensions [nodes x partitions] and relabels % communities in the order in which each community is encountered. Note % that the re...
2a0d3941d90adf5b127949dc9fe8ad5ba0657cc07a36bd7044df56b633cab117
MATLAB
984
41
function [s] = SHproj(coef, dirs, lmax) ndirs = size(dirs,1); ncoef = (lmax+1)*(lmax+2)/2; for i = 1:ndirs; dirs(i, :) = dirs(i, :) / norm(dirs(i, :)); end el = acos(dirs(:,3)); az = atan2(dirs(:,2), dirs(:,1)); Y = zeros(ndirs, ncoef); for N=0:2:lmax ...
43c290ba4f585ee9d2976c786015fedf9355452427c96832f2b9d98b1a4edb57
MATLAB
984
27
clear file=dir('ACC*reverse*.mat'); k=1; for jj=1:length(file) load(file(jj).name) n=length(outcome); n1=fix(n*0.15); early=[find(outcome(1:n1,1)==3);find(outcome(1:n1,1)==4);];%early phase late=[find(outcome(n1+1:n,1)==3);find(outcome(n1+1:n,1)==4)]+n1;%late phase for i=1:Info.Cellnumb...
62700b777a10f815a13141e5ba5c518f07a19322f9b650d818204bef3eacf7e8
MATLAB
984
38
function D=distance_bin(G) %DISTANCE_BIN Distance matrix % % D = distance_bin(A); % % The distance matrix contains lengths of shortest paths between all % pairs of nodes. An entry (u,v) represents the length of shortest path % from node u to node v. The average shortest path length is the % characteri...
e1ec827ecbd432cd4569570103df881b9d01d249701ec211fef93f4c7d68c6c2
MATLAB
984
53
function M0 = vox2ras_1to0(M1) % M0 = vox2ras_1to0(M1) % % Converts a 1-based vox2ras matrix to 0-based, ie, % Pxyz = M0*[c r s 1]' = M1*[(c+1) (r+1) (s+1) 1]' % % See also: vox2ras_0to1 % % % vox2ras_1to0.m % % Original Author: Doug Greve % CVS Revision Info: % $Author: nicks $ % $Date: 2007/01/10 22:55:10 $ %...
df9afd2ff499fbcbfc75f0bb6a89802fe2bd37fb6ca3c478d961f4b965fac110
MATLAB
985
39
% Simulations for normally distributed data % It is expected that all methods perform well % with Pearson's being the best mkdir('normal_no_outlier') cd('normal_no_outlier') n = 20; p= 6; SIGMA = eye(p); SIGMA(SIGMA==1) = abs(randn(p,1)); tic [r_alpha,t_alpha,p_alpha,vr,vt,vp] = MC_corrpval(n,p,'Skipped Pearson'); ...
0eeaea127eb94c4fc886bda91a0e4a26df3cf2c05dbc7f1697872c807eddd0cd
MATLAB
986
43
function [s] = tostring(values) % convert parameter value to string % 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: tostring.m 8776 2013-11-14 09:04:48Z...
4ff9417ca891236fb2c94b7ad76836f92d4af4e122f862abf4097ed9b3cbef16
MATLAB
986
29
function [out] = fftn_c(in) % function [out] = fftn_c(in) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 2d & 3d centered Fourier transform %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Tatiana Latychevskaia and Hans-Werner Fink % "Practical algorithms ...
22c3fabc90c70b38a460047ce9e715b7cc944cff05df283c20f93787309fcbb8
MATLAB
988
33
function Q = M2Q(M) % Convert from rotation matrix to quaternion form % See: http://skal.planet-d.net/demo/matrixfaq.htm % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: M2Q.m 8776 2013-11-14 09:04:48Z roboos $ d = diag(M(1...
68221baac2eab34ecf1a90126c0caa0b0b1e5a95a7fe4e97a0ffa5e2a484b3a5
MATLAB
988
26
track_count = length(Tracks); Tracks(track_count).Centerlines = []; Tracks(track_count).UncertainTips = []; Tracks(track_count).OmegaTurnAnnotation = []; Tracks(track_count).PossibleHeadSwitch = []; Tracks(track_count).Length = []; Tracks(track_count).TotalScore = []; Tracks(track_count).ImageScore = []; Tracks(track_c...
6b3d5b5919ad311e7a1cf951e59be0edf5f44fee7814b622957028665cada8d0
MATLAB
988
42
function [coef, Y] = SHfit(s, dirs, lmax) ndirs = size(dirs,1); ncoef = (lmax+1)*(lmax+2)/2; for i = 1:ndirs; dirs(i, :) = dirs(i, :) / norm(dirs(i, :)); end el = acos(dirs(:,3)); az = atan2(dirs(:,2), dirs(:,1)); Y = zeros(ndirs, ncoef); for N=0:2:lmax ...
b8dfe3919075fc0851dccd13867f4b5c5562f9f1d1e063e75458f653483cd55d
MATLAB
988
35
function [section,param]=zPlane2section(zPlane,param) % Convert a z-plane index to a section and optical index % % Purpose % Identify which physical section and optical section a % z section comes from. % % Inputs % zPlane - a scalar defining the optical section we will search for. If a vector % we return an...
c8babe5256cc891263ecb1efc46bc0a18c453713af74c81e734a376b4333e54b
MATLAB
988
27
function om_checkombin % Check if OpenMEEG binaries are installed and work. % % Copyright (C) 2010, Alexandre Gramfort, INRIA % $Id: om_checkombin.m 8954 2013-12-04 10:50:09Z roboos $ % $LastChangedBy: alegra $ % $LastChangedDate: 2010-09-30 11:15:51 +0200 (Thu, 30 Sep 2010) $ % $Revision: 8954 $ [status,result] = sy...
ebecf32dccdfcf6147df9519c7a913d1982f828c1ed402761dc87967444928f3
MATLAB
988
36
function paramsOut = setParams(dParams, paramsIn) % paramsOut = setParams(dParams, paramsIn) % % paramsOut = setParams(dParams, paramsIn) % % The output params struct will include the fields of dParams and paramsIn. % If the same field exists in both of them, the value will be taken from 'paramsIn' % % %%%%%%%%%%%...
eac4da7417944307bbb799c1cd629a63e5fde06371e231f4bfdca6414b5f1850
MATLAB
989
45
% % Compute the hop plot of the largest connected component. We always % compute the undirected hop plot (and thus also the undirected % diameter). % % PARAMETERS % $NETWORK % % INPUT % dat/data.$NETWORK.mat % dat/info.$NETWORK % % OUTPUT % dat/hopdistr.$NETWORK % As integer, the number of hops (zero excluded) ...
5d61aa89c5aad4393c61bab0ccba1ad611c8ccc27a917fdefddd3b3733784c09
MATLAB
990
33
function [period_begin, period_finish] = getPeriod(r) % Input dimensions [nChannels, nTime, nCases] = size(r); % Filter parameters fs = 100000; % sampling rate fl = 20; % lower bound frequency fh = 40; % upper bound frequency % Initialize output period_begin = zeros(nChannels, nCases);...
b62900227a92158a1ca8f07790bc2d26adbf77ad5e724e122fa986156f8b7fe0
MATLAB
990
30
function target = Fig2SurfFnc(x_fig,targetonfig,tform_fig_inv,F_camera) %FIG2SURFFNC ‚±‚̊֐”‚ÌŠT—v‚ð‚±‚±‚É‹Lq % Ú×à–¾‚ð‚±‚±‚É‹Lq h = x_fig(1); theta = deg2rad(-x_fig(2)); u = deg2rad(-x_fig(3)); %w = deg2rad(-x_fig(4)); % % Figureã‚ł̍À•W(px)‚©‚çƒJƒƒ‰Ž‹“_‚ÌHexapodÀ•W(mm)‚ɕϊ· target = transform...
79b7ba6c39fc628f249849901282b4cdc9fbbb783cc7cd37c72e8f995b5a41c1
MATLAB
991
33
function [hh, xx] = myhist(Var, VarRange, Nbins, Mode) % remove VarNargins ([lower upper], plot hist if nargin<4, Mode = 'lin'; end; if nargin<3, Nbins = 20; end; if nargin<2, VarRange = [0,1]; end; if isempty(VarRange), VarRange = [0,1]; end if ~any(~isnan(Var)), hh=nan; xx=nan; return; end; Mode = 'lin';...
3b4103e6c359f121c6d192e304c2ca4879f52552aefd9744d1bbbc21b8d006a8
MATLAB
993
45
% % Get information about one dataset. % % DEPRECATED - instead, load individual statistics from dat/statistic.$STATISTIC.$NETWORK % % RESULT % A struct with the following fields % % n1,n2 Number of left/right nodes equal in % unipartite networks % n Total number of edges % lines Number of edges, but mot co...
46a0733002215c1ff33522b8f336a0c909e2d6a58e98b1e243208312ce0d482b
MATLAB
993
40
% % The means by nonnegative linear regression. % function [U,V] = means_regrn(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 ~=...
af5cb3dd3b8922630d9ea87716a1a8a4dbdac3f337d334cf309fd40aaf7b2a96
MATLAB
993
38
function [] = Fig02_Example_TimeCourse_OptStim_Song_pIP10L % Code for plotting the example trace during optogenetic activation of the pIP10 split-LexA in isolated male flies in Fig. 2b. TargetFileID = 11; load('Mic_20211103_01_4.mat') load('OptStim_20211103_01.mat') TargetTrial = 1; load('EthogramComb_pIP10L_Chr.mat'...
ed74dccc9adf4ab3696ee47a3758177546fb41c8caa2e5a1f977292769b9b9f6
MATLAB
993
39
function[final_red_vect,final_ident,final_intensities,final_silhouettes,excluded_cellids,final_iscell]=exclude_cells(exclude_redids,uncertain,final_red_vect,final_ident,final_intensities,final_silhouettes,Fall) iscell=Fall.iscell(:,1); %% function that will exclude cells from all variables used in procesing cell...
e1ac41335757fdd3353eba35e50f95bf3d1c49c64b9cf2b39bdf34c4093fc1c6
MATLAB
994
28
% netBurstDetection_trialCycle.m % Detects Network Bursts (NBs) from the collection of burst event % trains (trial per trial) function [NB, NBpattern] = netBurstDetection_trialCycle(BDfolder, IBeIThreshFolder, param) BDfiles = dirr(BDfolder); numTrials = length(BDfiles); NB = cell(1,1); NBpattern = cell(1,1); h = wait...
38facff76b4cc9e4affb0e96b75857c1e0bd49f291be35e39950040038e7cf28
MATLAB
995
28
function [out] = ifftn_c(in) % function [out] = ifftn_c(in) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 2d & 3d inverse centered Fourier transform %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Tatiana Latychevskaia and Hans-Werner Fink % "Practical a...
3ea75ef4d35914a093efc8692e9236f41358587e124276f0120f8e87477852b4
MATLAB
995
43
% mglTestPoints2c: an automated and/or interactive test for rendering. % % usage: mglTestPoints2c(isInteractive) % by: Benjamin Heasly % date: 03/10/2022 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Test rendering some points. % usage: % % ...
4bab243b2fc6b55838e8114ac4e3afc1208c270e6321466cf99b74c4e379dbfb
MATLAB
995
29
function [kspace,data,msg_out]=example_recon(kspace,Dat,hdr) % This is an example of a custom Bruker k-space reconstruction plugin. % If called without input arguments, return the pluse program names that % this code reconstructs (matched with hrd.acqp.PULPROG) if nargin==0 kspace = {'my_pulse_program1.ppg','my_puls...
9fc12b5ed514906b0c16af0c67a6b307728faeeb6dc40c029bc838734664f56f
MATLAB
995
27
function[out,hout]=SONRealToADC(in,header) % SONREALTOADC Converts floating point array to int16 % and returns a header with updated scale and offset % % Example: % [OUT,HOUT]=SONREALTOADC(IN, HIN) % The input data are scaled to fill the maximum range of the int16 % output array. Scale and offset in HOUT are upd...
6497de8bd2a4a1c134d591601b42827c10599eae8fab25f93b977f4a7f920eeb
MATLAB
996
24
function [ text ] = getStimStatus( obj ) % Display information about stimulation status. % % Syntax: % GETSTIMSTATUS( obj ); % % Input parameters: % * obj - object containg data % % Example: % GETSTIMSTATUS( ); % % Available at: https://github.com/NCN-Lab/DBScope % For referencing, please use: Andreia M. Oliveir...
64795d3eeb587df917781377dc91d8a4810ad7c59390a83420098f6d157c5de7
MATLAB
997
35
% determineLegPhase.m % % Function to determine phase of each leg, in degrees from -180 to 180. % Uses Hilbert transform. % % INPUTS: % legPos - matrix of leg positions, num frames x num tracked pts % legInd - indicies of leg tracked pts % % OUTPUTS: % legPhase - matrix of leg phases, from negative -180 to 180; n...
c838f5d0f5ad2f57208b9ad22ee379a68fea993022d54b44e8a80455b3125517
MATLAB
997
43
function [A xy] = wheel_graph(n) % WHEEL_GRAPH Construct a wheel graph of order n % % The wheel graph is a cycle graph of order n-1 along with an additional % vertex that connects all the remaining vertices. (Run the example and it % will be extremely clear if you are still confused.) % % [A xy] = wheel_graph(n) retu...
078f5b211d1ad27fbe5552762357c9f944e321b9aaf4fa0d98c6ff0927b93d2b
MATLAB
998
39
function [averLp, Lpi] = gretna_node_shortestpathlength(A) %========================================================================== % This function is used to calculate nodal shortest path length of a binary % graph or network G. Harmonic mean is used to address possible condition % of multiple components. % % % Sy...
fad53292e661e48906ca4d8dca0f5ae7d705e99daa77eba5f3181c0545f63f7d
MATLAB
998
27
function [params, s_new] = denoise_fica_kurtosis(params, s, state) % FastICA kurtosis nonlinearity as DSS denoising function % [params, s_new] = denoise_fica_kurtosis(params, s, state) % params Function specific modifiable parameters % state DSS algorithm state % s Source signal estimate, matrix ...
dab1a8bda06220d37ea0bc70a5b2c43c0e320529f81ddc222ad9ec1f5d699ec0
MATLAB
999
42
%% display data maxT = max(vertcat(cleanTracks.trackedFrames)); %create empty data container dispData = cell(1,max(vertcat(cleanTracks.id))); for i = 1:length(dispData) dispData{1,i} = nan(maxT,11); end for i = 1:length(dispData) trackedFrames = cleanTracks(i).trackedFrames; dispData{1,i}(trackedFrames,:) = c...
f3a2f07ed17939787fd454a21f810fe89e510df5117ffa587324fe57fa629616
MATLAB
999
35
% mglStencilSelect % % $Id$ % usage: results = mglStencilSelect(stencilNumber) % by: justin gardner and ben heasly % date: 05/26/2006 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Sets which stencil to use, 0 for no stencil % % e.g.: %mglOpen; ...
61a746b4fd3e6466e30b8b4d6c000fc205320221afef70970119976cedba090a
MATLAB
1,000
24
function add_ternary_paths %add_ternary_paths makes ternary_plots functions available to user % % This function adds sub-directories of ternary_plots to the path. This % means ternary_plots functions are normally unavailable until % "add_ternary_paths" is called in a script. This is done to avoid any % confl...
d53dbda3358cfdb57cb7bbc790a6a8d8a8f60c94fc27f5f958d3f546b8c5a73d
MATLAB
1,000
32
function [detrendedDataRuns, params] = simseq_detrendDataRuns(dataRuns,verbose) %% Inputs: % DataRuns array with time series in dimension order time x runs x voxels %% Outputs: % detrendedDataRuns %% Detrend data (see also detrendTSeries as an alternative) [nFrames,nRuns,nVox] = size(dataRuns); % Set detrending p...
dede4e2394f2fd1e170fc76c51ed2bc2dc424791389836c8f7c839c3950961b1
MATLAB
1,000
41
function vid = setupvideoTecknet(pos) imaqreset; % If there are any problems with video set up: imaqhwinfo('winvideo'); a=imaqhwinfo('winvideo',1); a.SupportedFormats'; vid(1) = videoinput('winvideo',1,'MJPG_1920x1080'); vid(2) = videoinput('winvideo',2,'MJPG_1920x1080'); %'YUY2_1920x1080' % Set up the camera set(...
295ae826928cb459594a79045c9f46bcc04292853f69a8df18791ef29a414d49
MATLAB
1,001
32
function level = getLevel(signal, tFrom, tTo) %GETLEVEL get the level of signal for each population under each condition % signal looks like [16, time, 5] level = zeros(16,6); for pop = 1:16 for i = 1:6 % 1 is before Stim, 2 is cond 1, 3 is cond 2... if i == 1 [pks,locs] = findpeaks(signal(pop,:,1)); ...
8f7eb0dc06ce3af4d728b24eeb3ef3f5b2794207aa542d9f8f1613b4b362a28e
MATLAB
1,001
33
function newpmap = fmri_cleanclusters(pmap,CL_SIZE_THRES,NN_THRES) % Removes small clusters from a thresholded map. % % newpmap = fmri_cleanclusters(pmap,CL_SIZE_THRES,NN_THRES); % % inputs: % CL_SIZE_THRES = threshold for minimum cluster size % NN_THRES = threshold for minimum number of nearest neighbors isvectorinpu...
8a8398c2712e1310866d34146b287d738e0324c81f3d0ef593a79712cb572601
MATLAB
1,002
39
% computeSpikeRate.m % % Function that takes in vector of indicies for when spikes occured and a % timing vector to compute spike rate as the inverse of the % inter-spike-interval % % INPUTS: % spikeInd - vector of indicies for when spikes occured % t - time at each index, in seconds % % OUTPUTS: % spikeRate - ...
f2125f8c75e9adc98c7989404d758af496caca4b9425e3b0e216f36a28462a83
MATLAB
1,002
27
function [params, s_new] = denoise_dct(params, s, state) % DCT filter function. % [s_new, params] = denoise_dct(params, s, state) % params.mask DCT filter mask % state DSS algorithm state (not used) % s Source signal, matrix of row vector signals % s_new Filtered signal ...
5a8d167d523ded84499c3f0f5ebe2f10ec76750addd57c3ba27d99405ae4ec50
MATLAB
1,004
33
% get2ndHalfStepPhase.m % % Helper function for getLegPhaseFromSteps() that takes in step mid min % position and step end max position to convert a vector of leg positions % between the two to leg phases between 180 and 360 degrees, with a linear % mapping. % For a linear mapping: % phase = 180(pos + endPos - 2(...
dbb16a7411e6b2ff700cd7c955f1cebde758319aa139d7ca481e1e9ea8966871
MATLAB
1,004
52
<<<<<<< HEAD function plotDET(FMR, FNMR, curAxes, typScale, optPlot) narginchk(2,5); % set the graphics handler if nargin == 2 curAxes = figure; end % number of bins for distributions plot if nargin <= 3 typScale = 'linear'; end % color and type of line if nargin <= 4 optPlot = 'b-'; end axes(curAxes); ...
e40bee2a83922d3800c2f206a2252d4637e97f7c8dc9dc0d84e0f03df36dbe0a
MATLAB
1,004
22
function [strcoil, Coil] = positioncoil(strcoil, Coil, theta, Nx, Ny, Nz, MoveX, MoveY, MoveZ) %% Define coil position: rotate and then tilt and move the entire coil as appropriate % Step 1 Rotate the coil about its axis as required (pi/2 - anterior; 0 - posterior) coilaxis = [0 0 1]; ...
6a2a04490f4da45807ed970eba5e3d0eda3260ec58b45b01529d51afd69c38b8
MATLAB
1,005
44
function [zeroX] = ev_zeroXings(SC, U, thresh) %ev_zeroXings Computes the zero crossings for all eigenvectors in SC % This computes the min-cut/max-flow of the graph. % Usage: min_cut = ev_zeroXings(SC, U, thresh) % nroi = length(SC); if ~exist('thresh','var') thresh = zeros(1,nro...
96f8babec9bd40949673e6c19f45b74d263bd406e871f4d954a9a7815a382528
MATLAB
1,006
32
function [ ] = bemf1_graphics_coil_CAD_3color(coil, flag) Gc = [0.11 0.93 0.1]; Rc = [1 0 0]; Bc = [0.01 0.01 0.98]; if flag == 1 % x coil Pfull = coil.P; p = patch('vertices', coil.PX, 'faces', coil.tX); p.FaceColor = Rc; % [0.72 0.45 0.2]; p.EdgeColor = ...
cc071b83c852df0bf14858ce4e295603ce352089a7b6504243321206984f65c0
MATLAB
1,006
44
clear; mu = [0,0,1]; k=35; N=1000; [RandWatson] = randWatson(N, mu, k); figure; scatter3(RandWatson(:,1), RandWatson(:,2), RandWatson(:,3),3, 'b', 'filled'), axis([-1 1 -1 1 -1 1]); clear; mu = [0,0,1]; k=500; N=1000; [RandWatson] = randWatson(N, mu, k); figure; scatter3(RandWatson(:,1), RandWatson(:,2), RandWatson...
0e3d1dc6d72f67e3f8c43a7123df6010f81e7253aababb269245f9fac729e67f
MATLAB
1,007
29
function [exportedFilename] = ml_freezeframe_export_video(freezeframeFilename, frameRate_hz, exportFolder) %frameRate_hz = 15; [filepath, name, ext] = fileparts(freezeframeFilename); if ~strcmp(ext, '.ffii') error('Can only read FreezeFrame video that end in ".ffii".\n'); end if ~isfil...
bb6a126fe74108999c69b318d2a2d2117e74da381886c38043ddf8847d871c4a
MATLAB
1,007
41
% % Generate 'slice' from a temporal statistic. % % PARAMETERS % $statistic Name of the statistic % $network Name of the network % $type % $K The slide ID, i.e., column number % % INPUT FILES % dat/statistic_time.$type.$statistic.$network % The temporal statistics: one timepoint per line, each % line contains mult...
313acb37e47634a791de3df4b69b264964df307bc0ee6d722ec84c88fc289d93
MATLAB
1,008
27
function balanced_anova(correct_1,incorrect_1,correct_later,incorrect_later,nsample) %% balanced_anova resamples the data so that all entries have the same % number of samples (nsample) nrep=50; correct=[ones(nsample,1);zeros(nsample,1);ones(nsample,1);zeros(nsample,1)]; first_later=[ones(nsample,1);ones(nsample,1);...
7a4f35c4667266eaa6b9491698a41b14b5e3fd3c1f87dd8154011f6d8d75fe41
MATLAB
1,008
30
function mglEyelinkEDFOpen(filename) % MGLEYELINKOPENEDF Opens an edf file on the Eyelink computer for writing % [] = MGLEYELINKOPENEDF(FILENAME) % % Opens a file on the Eyelink computer for writing data. The filename must % be a valid DOS filename % % Created by Eric DeWitt on 2010-03-25. % Copyri...
fdf7e10afeedc0e4c478b525942a7ef919c9d2f4150ac09640428b46227d5053
MATLAB
1,008
34
function [outermost, inside] = find_outermost_boundary(bnd) % FIND_OUTERMOST_BOUNDARY locates outermost compartment of a BEM model % by looking at the containment of the triangular meshes describing % the surface boundaries % % [outermost] = find_innermost_boundary(bnd) % % with the boundaries described by a struct a...