sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ceb34eccaa8750398a14ff7f0a4ca510aff9334ec47dc1c3f4a602103b3e7ecd
MATLAB
2,030
66
function [xgp,wt, ph] = generalized_phase_vector( x, Fs, lp ) % % GENERALIZED PHASE VECTOR calculate the generalized phase of input vector % % INPUT: % x - data column vector (t,1) % Fs - sampling rate (Hz) % lp - low-frequency data cutoff (Hz) % % OUTPUT: % xgp - output datacube % wt - instantaneous frequency estim...
363fab4bf3134e79ddc648621b21d8d8e8f88b53bf1319c838d7da04a68f8b4b
MATLAB
2,031
64
%% figure S9 % Theta and gamma band power dynamics across states. % (A) Awake state: z-scored theta and gamma power time courses % (B) Anesthetized state: same as (A) load('figureS9_data') addpath('functions'); set(0, 'DefaultAxesFontName', 'Arial'); set(0, 'DefaultTextFontName', 'Arial'); theta_col = [0.2 0.6 0.2...
451a43cf5546abd87babbff878f32236a64e24c007448959f194b604c86a5b49
MATLAB
2,031
67
function [phase,amplitude,unwrapped] = Phase(samples,times) %Phase - Compute instantaneous phase in signal. % % Compute instantaneous phase (wrapped and unwrapped) and amplitude % in signal. % % USAGE % % [phase,amplitude,unwrapped] = Phase(samples,times) % % samples signal, e.g. filtered local field pot...
f1ec58abe5f7946a75b0a630c0fe38c30163d1737490c9e94b15f4a986311476
MATLAB
2,031
52
%% %% Java Information Dynamics Toolkit (JIDT) %% Copyright (C) 2012, Joseph T. Lizier %% %% This program is free software: you can redistribute it and/or modify %% it under the terms of the GNU General Public License as published by %% the Free Software Foundation, either version 3 of the License, or %% (at yo...
9cbe9813ae448fd9f929c747d8742ff923f005afb6429883915e9c479dabe95a
MATLAB
2,032
71
function y = huber_pos( x, M, t ) %HUBER_POS Monotonic huber penalty function. % For a vector X, HUBER_POS(X) computes the monotonic Huber-style function % % 0 if 0>=X % HUBER_POS(X) = X^2 if 0<=X<=1 % 2*X-1 if X>=1 % % HUBER_POS(X,M) is the monotonic Hub...
e767fee3c541fafe943c1520464364efd6fbd52a7ab37fa0447a3acf58a47bb2
MATLAB
2,032
49
function [tfce_vec, dh_used] = tfce_one_fmri_dat( ... t_vec, removed_voxels, volInfo, H, E, conn, sidedness, tail, dh) % tfce_one_fmri_dat Single statistic-map TFCE transform (parfor-safe). % % [tfce_vec, dh_used] = tfce_one_fmri_dat(t_vec, removed_voxels, volInfo, ... % ...
a7837b043b06a66d182c76413efbb51af664f969ff5f7b7b448731bc4d16f24d
MATLAB
2,033
56
function dt = datatypes % Datatype % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: datatypes.m 4136 2010-12-09 22:22:28Z guillaume $ persistent dtype if isempty(dtype), t = true; f = false; table = {... ...
59eda98170893a370a90774777650c16c6689e415dc2994c47f4267a55c0b72d
MATLAB
2,034
39
function spikes = split_cluster(spikes, clustnum) % SPLIT_CLUSTERS Split a cluster after automatic hierarchical aggregation. % SPIKES = SPLIT_CLUSTERS(SPIKES, CLUSTER_NUMBER) takes and returns a spike- % sorting object SPIKES. SPIKES must have gone through a hierarchical % clustering aggregation (e.g., SS_AG...
83fd4136d7bc027d56815dc1ce50877ea43014ba872a080a96c28ccb50166c89
MATLAB
2,034
66
%%********************************************************************** %% HSDNTpred: Compute (dX,dy,dZ) for NT direction. %% %% compute SVD of Xchol*Zchol via eigenvalue decompostion of %% Zchol * X * Zchol' = V * diag(sv2) * V'. %% compute W satisfying W*Z*W = X. %% W = G'*G, where G = diag(sqrt(sv)) * (inv...
9e98ed6bad427d69cccf1cd5fc0d7cb64ba2fbbf78f70b3a646644a7b55f13c4
MATLAB
2,034
56
function thresh=ea_detthresh(atlases,atlas,img) % Function that will return the threshold according to user settings for a % specific region in the atlas. % % USAGE: % % thresh = ea_detthresh(atlases,atlas,img) % % INPUTS: % atlases: structure loaded from 'atlas_index.mat' under atlas folder % atlas: ...
f7ae0d69baf81abaef64c0c0c6adc2313ecdc63bcafc711fc1956e206ffe1c28
MATLAB
2,034
110
function [est cmap] = compMesoParams(hr); %% sz = size(hr.dataAy); ten = hr.user.bTensor/1000; for k = 1:size(ten,3), [U D] = eigs(ten(:,:,k)); scheme(:,k) = sqrt(D(1,1))*U(:,1); end; sigma = 1.75; ng = ceil(sigma*3); ng = ng + mod(ng,2) + 1; gau = fspecial('gaussian',[ng 1],sigma); [gx gy gz] = nd...
1ff27c274a3670af9ba1f0265d18419ac6f88c66e6cd52c47ed9af1300fd2d23
MATLAB
2,035
54
function R = CorrelateRateMaps(self, cel, obj2, cel2, supress_plot) % Calculates the pearson correlation coefficient between two ratemaps % % (1) Calculates rate maps for cell in cel = [t, c]; in current root, prompts % user to indicate another session object and cell to compare. If two cells % are selected, compares b...
d92e746d74e50ab547216a983269c04c17b4d84e74bd3e181109dd5a3e10db0d
MATLAB
2,035
76
function [m,boundaries] = CircularConfidenceIntervals(angles,alpha,nBootstrap) %CircularConfidenceIntervals - Compute circular mean and confidence intervals of circular data. % % Compute circular mean and confidence intervals of circular data (see NI Fisher, Analysis % of circular data, p. 88). If fewer than 25 angle ...
fc8cf6a3620bc46383147bac2b62fb62f08ecdeb7ac9eb7a29da64d0a8c9fcc9
MATLAB
2,036
60
function [S]=ea_sweetspot_importedModel2Efields(obj, filepath) %load the file S = load(filepath); disp('Need to put imported model to the same space as the Efields.'); outdir = fullfile(fileparts(obj.leadgroup), 'sweetspots', obj.ID, filesep); ea_mkdir(outdir); sidesuffices ...
83360231265e419e353858b01b4e6c4e8ee4965069e73ca9109348765dacc2a2
MATLAB
2,037
79
function t = circ_confmean(alpha, xi, w, d, dim) % % t = circ_mean(alpha, xi, w, d, dim) % Computes the confidence limits on the mean for circular data. % % Input: % alpha sample of angles in radians % [xi (1-xi)-confidence limits are computed, default 0.05] % [w number of incidences in case of binne...
9787ad9a3a06425178b1cc2471d4bfc07918a313abc57d5708a4d03c90f87be3
MATLAB
2,037
68
function input_struct = plugin_get_parcelwise_statistic_images(parcel_obj, input_struct) % output_struct = plugin_get_parcelwise_statistic_images(input_struct) % %parcel_obj = PARCELS.Shen.parcel_obj; % input_struct = y_helper_function_get_parcelwise_statistic_images(parcel_obj, input_struct ); % Create placeholder st...
a447328cd123f457f502b44d559539365521423f53e42ec9f9189437f55b64d8
MATLAB
2,037
51
%% Plot time detected in videos % last edited by David Wolf, 30.11.2023 % %% load dataset clear; times_detected = {}; for gr = 6:10 for day = 1:15 try T=readtable(['/zi-flstorage/data/Luise/NoSeMaze2023/DLC_output_windows/G',num2str(gr),'/D',num2str(day),'/p0.8_G',num2str(gr),'_D',num2st...
377ed07a13504a52eec64eac5c13334d711e8a48d7ad1b62c9a82aafddeb479c
MATLAB
2,038
85
function epochs = IntersectEpochs(root, epochs) % Returns list of epochs that are contained in both epochs lists { epochs1, epochs2 } % % INPUTS % epochs - cell array of epoch lists % % OUTPUTS % epochs - the common epochs between the two epochs % % arb sept 20 2011 (Ehren's is commented out below import CMBHOME.Ut...
46b7491c57eea3b2ebb7d598053b07a9b03441e85f6ab1d774626a6f323e73bc
MATLAB
2,038
61
function Pnew = palm_swapfmt(Pset) % Convert a set of permutation matrices to an array % of permutation indices and vice versa. % % Cell array <===> Shuffling indices % Shuffling indices <===> Cell array % % Pnew = palm_swapfmt(Pset) % % Pset : Set of permutations, sign-flips or both. % This can be su...
48f26bfd4201606a1a2c7e110cef4ac7f8ea6bbcfab59c50d66215338b6d9512
MATLAB
2,038
79
function [node,elem]=meshgrid6(varargin) % % [node,elem]=meshgrid6(v1,v2,v3,...) % % mesh an ND rectangular lattice by splitting % each hypercube into 6 tetrahedra % % author: John D'Errico % URL: http://www.mathworks.com/matlabcentral/newsreader/view_thread/107191 % modified by Qianqian Fang (fangq<at> nmr.m...
4ab47bf2512cb451bdb9485123f5b081093e1891678109e688387ae509e263cc
MATLAB
2,038
46
function RecordingSecondsToTimeSeconds(basepath) % Store correspondences between recoring (ie dat file) second timestamps % and clock time. 0.1sec resolution. % Can only be run after bz_DatFileMetadata.m and TimeFromLightCycleStart.m % Brendon Watson 2016 if ~exist('basepath','var') basepath = cd; end basename =...
7e23526b0e319e6c5e6e950a4f585a39fb46ca6b39236e32991bfd8e340a9711
MATLAB
2,038
63
function [adfreq, n, ts, fn, ad] = plx_ad_v(filename, channel) % plx_ad_v(filename, channel): read all a/d data for the specified channel from a .plx or .pl2 file % returns a/d values in millivolts % % [adfreq, n, ts, fn, ad] = plx_ad_v(filename, channel) % [adfreq, n, ts, fn, ad] = plx_ad_v(filename,...
e84a0f3b8734b28177bbc406a6db912b9b46bbad56baecd4ca540f8b470f5ea9
MATLAB
2,038
64
function clusterXT(spikes, useassigns, show, threed) % clusterXT temporary utility to show clusters % clusterXT(SPIKES, [USEASSIGNS], [SHOW], [THREE_D]); if (nargin < 2 || isempty(useassigns)), useassigns = spikes.overcluster.assigns; cmap = spikes.overcluster.colors; end; if (nargin < 3 || isempty(show))...
ad729163303f2d3383d7c0424298c09123f19d6a70f1302e62f9476a9fa3216e
MATLAB
2,039
60
function [p, Q]= chi2test(x) % Usage: [p, Q]= chi2test(x) % % The chi-squared test. % % Given a number of samples this function tests the hypothesis that the samples are % independent. If Q > chi2(p, nu), the hypothesis is rejected. % % Each column represents a variables, each row a sample. % % If you find any...
107086746eb7fc4771534e2634bf7a5b884a969a075ec02cafa229d8050741e3
MATLAB
2,040
68
function [ basePaths,baseNames ] = bz_FindBasePaths(topPath,varargin) %basePaths = bz_FindBasePaths(topPath) finds all buzcode basePaths in any %directory within topPath and returns them. % %INPUT % topPath a top-level directory with multiple basePaths in it. % (options) % 'select' prompt the user with...
3883963eb3e927f04da715421b3f5e18e08f33b6a110a35807d457a80b924d64
MATLAB
2,040
57
function [mlnS, mlnSneuman, mlnSnp, bardelta, b] = my_murdaycotts(Delta,delta,r,D0,bb) % % [mlnS, mlnSneuman, mlnSnp, bardelta] = murdaycotts(Delta,delta,r,D0,g) % % calculates diffusion attenuation, mlnS = - ln(S/S0), % inside a perfectly reflecting sphere of radius r, free diffusion % coefficient D0, bvalue b ...
4edc8fcb7022ce578f846980acaadfef77d68f0b3a60ff7efa1ad111dc4318bb
MATLAB
2,042
65
function [res, errStr]= ftrstruct_write(ftrStruct, fileName) % % function [res, errStr]= ftrstruct_write(ftrStruct, fileName) % % writes a ftrStruct to the harddisk % % ftrStruct: should contain a valid ftrStruct % fileName: should contain the path and file name. if it is empty or undefined, a file selection dia...
5be30bd8c8b20aef6acea1f9f4a9a6f53cc06cf389f188181bfca9df71dab3b3
MATLAB
2,042
68
function[sortednames,data]=cleantrials(data,fileexpnum,filelist,imskip,expskip) %this function returns the mapping between imaging and experimental trials %normally this would be that imaging trials are one behind exp trials %because one has 0 indexing and the other starts with 1 %sometimes the case that you will nee...
d307315a117a6ad57350e369bc05b35844be868c35cd2d0c3eb0e808a4982372
MATLAB
2,043
71
%%******************************************************* %% gpp: pgraph partitioning problem. %% %% (primal problem) min Tr C*X %% s.t. Tr(ee'*X) = alpha, %% diag(X) = e, %% %% C = -(diag(B*e)-B). %% %% (dual problem) max alpha*y1 + e'*y %...
e788791b950a7ce373825a025399e92448ae11f2a3b7a5ca9b8027e547419acc
MATLAB
2,043
78
function ea_discfibers2trk(discfiber, fiberset, outputName, LPS) % Convert discriminitive fibertracts to trk file % % If the trk is going to be visualized in Surf-Ice, LPS should be set to 1 % to fix the orientation. arguments discfiber {mustBeTextScalar} fiberset {mustBeMember(fiberset, {'both', 'pos', 'posit...
e38d1fb6e637569a86b267f747f4e992ee0f7cea1a4a7b4b67ddaa9de698b8b3
MATLAB
2,044
53
function [Theta_low,A,Theta_high,Theta_indicator] = estInteractMatrixFromSamples(Theta_samples,ci) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome time-series datasets, and % predicts biologically relevant behavio...
904d63a69eb9efd70a839933d273359c49d6bd7b3f66683418b162b97a3bb73c
MATLAB
2,047
61
function FilterOnly_P_notch(animal, filtertype, numchans, filt_dir) %Generates LFP files filtered for a given frequency range. %Inputs/Requirements: Animal ID, filtertype, number of channels in probe setup, LFP1000 files for each channel in LFP1000 folder with LFPvoltage_notch variable %filt_dir = folder where...
25306fdd2eb2f61a75ce13123a551c8e3487ad9734553587e888f320e43c52dd
MATLAB
2,048
53
function CBIG_ASDf_clusterKmeans_wrapper(outputDir) % CBIG_ASDf_clusterKmeans_wrapper(outputDir) % % Wrapper function to run k-means clustering on ASD participants' z-normalized RSFC. % % Input: % - outputDir: % Output directory to save the results. % % Example: % CBIG_ASDf_clusterKmeans('~/output/ste...
efdb58a4bd15cfeec04d9451b6667ac1304c2dbfaa3e2fb864913094e8fd4710
MATLAB
2,049
69
function variable = Recall(name,varargin) %Recall - Recall variable from memory to avoid redundant computations. % % This function is useful in the following scenario. When processing data % in batches, a function is called repeatedly with different parameters. % Because not all parameters change every time, some c...
44f35e4362d86fff1ff1aac9ad69bbe37b20bb66ee20369c034a9d6d6df872d7
MATLAB
2,050
84
function [ fields ] = bz_getPlaceFields(varargin) % USAGE % % % INPUTS % % ratemap MxNxD matrix where M is the number of cells, N is the number % of trials, and D is the number of spatial bins % % % OUTPUTS % % fields struct with field data for each cell % % % % HELP % This function tries to identify...
726c9f5533f41f6bc519e1583f65440c856a9017473acd342e239ab04b20d4e2
MATLAB
2,050
58
function [H] = rigidbody(f); % RIGIDBODY creates the homogenous spatial transformation matrix % for a 6 parameter rigid-body transformation % % Use as % [H] = rigidbody(f) % % The transformation vector f should contain the % x-shift % y-shift % z-shift % followed by the % pitch (rotation around x-axis) % ...
e17113d034b180f0a3bbccc8f87f4086b9db4eff9ed6c33b7fadd6807e185b8f
MATLAB
2,051
60
function ea_gensurfice_temps disp('Generating surfaces of template space (left/right hemisphere)'); cmd = [ea_getExec([ea_getearoot,'ext_libs',filesep,'fsl',filesep,'bet2'], escapePath = 1) ' ' ea_space 't1.nii ' ea_space 't1b.nii']; ea_dispt('Skullstripping T1'); ea_runcmd(cmd, env='FSLOUTPUTTYPE=NIFTI'); ea_dispt('S...
12a837564ae3d9149969889721eae3ba63ef7c5149af4512ca910b939e83f4b6
MATLAB
2,052
83
% plot theta phase deviations, coherence, spikes for a few seconds of data % for confirming probe placement function PlotChannelsToGetLayers(t0, t1) %Select data file to use for this animal %%%%%%% This needs to be updated for your computer load('ECHIP512.mat'); % load data read_Intan_RHD2000_file ampDat...
4eede5082e1478f0bad1b031df4c29bb5f7a7b2e7a25fe877b3e7e950bce7d31
MATLAB
2,052
64
% getchanlist() - Obtain indices of specified channel types. % % Usage: % >> chanlist = getchanlist(chanlocs, type) % % Inputs: % chanlocs - EEGLAB channel location structure % type - [string] select channel of specified type % can enter a cell array to select several channel types % %...
4af7a42b3a58cee81585f8d1911b551615a18c9b36b132771d4891d8c315c916
MATLAB
2,053
55
% Shows underlying SDT model and relationship to multinomial probabilities % for fitted type 2 data % % Requires fit, nR_S1 and nR_S2 objects from either subject-level HMM or MLE meta-d fit to be in the % workspace % % SF 2014 figure; set(gcf, 'Units', 'normalized'); set(gcf, 'Position', [0.2 0.2 0.5 0.3]); base = lin...
8f5809fa62f1f3885acdbef02e75ec60dfe7caa0e5005d556a22514466546aa1
MATLAB
2,053
64
load ../graphs/bfs_example.mat [i,j,val] = find(A); % assign a randon number to each edge in the graph edge_rand = rand(num_edges(A),1); Av = sparse(i,j,edge_rand, size(A,1), size(A,2)); ee = @(ei,u,v) fprintf('examine_edge %2i, %1i, %1i, %4f, %4f\n', ... ei, u, v, edge_rand(ei), Av(u,v)); ...
c567d7df41a10436e6c42d74beaed412ea76d0b4ffb8b2c1c9afb85c94f4f2e7
MATLAB
2,053
81
function a=tile3d(b,minmax,bar_flag,transp_flag,dim_flag,axis_flag) % Usage ... a=tile3d(b,minmax,bar_flag,transp_flag,dim_flag,axis_flag) if ~exist('dim_flag','var'), dim_flag=[]; end; if ~exist('minmax','var'), minmax=[]; end; if ~exist('bar_flag','var'), bar_flag=[]; end; if ~exist('transp_flag','var'), transp_flag...
ca0d6471d8f5770df05a3b2ce9c808aae1e02a6108042a063a0a723fa025b175
MATLAB
2,053
75
function sem=SEM_calc(vect, CI) % SEM_calc - standard error of the mean, confidence interval % % function sem=SEM_calc(vect, CI) % % Purpose % Calculate the standard error the mean to a given confidence % interval (CI). Note that nans do not contribute to the % calculation of the sample size and are ignored for the SD...
3c6f6aea0fbc557c159ebd416653b211cc488723f5ed29bab6351fc180bc9c8e
MATLAB
2,054
74
function [node,face,centroids]=latticegrid(varargin) % % [node,face,centroids]=latticegrid(xrange,yrange,zrange,...) % % generate a 3D lattice % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % xrange, yrange, zrange ...: 1D vectors specifying the range of each % dimension of the lattice % % output:...
9c7f43b60f72bef8785c2c85a4e0b7575c1d4166aced3e6d2fc0310366b185fb
MATLAB
2,054
83
%% a02_EphyReplot_acrossSU_SM_plot3D.m % Need to run "a01_EphyRepolot_acrossSU_SM_plot" first % Plotting single mouse data and plot %%%%% Version History % v1: 02/15/2025 % - read NEV file and plot all units together in each single trial % Liang-Yin clear all; close all; %% Data path and parameters path2raw = ...
0bd76ac5bc0024b8b3535eb35529b4745578e0d8d94a1338eb7b1f91394085f6
MATLAB
2,057
58
function tifFiles = moCorRawF2tifList(tifFiles,moCorrImgNonRigid,moCorROI,rawCatImg) %gets roiF from corrected and uncorrected tif stacks and adds to tifFiles %structure moCorRawFroi = cell(length(tifFiles),1); if nargin==4 rawFroi = cell(length(tifFiles),1); end endFrame = 0; for fileNo = 1:length(tifFil...
29a1b5246048cdd2ac7f190d3ee47fae9395e53a0ce3cd88a287d5b95405a195
MATLAB
2,057
80
function g = palm_randg(a,siz) % Generate random Gamma variables. % % g = palm_randg(a,siz) % % a : Parameter A (= k) of the Gamma distribution. The shape % (or rate) parameter is fixed at 1. % siz : A vector indicating the size of the array to be created. % g : Gamma-distributed variables. % % Reference: % *...
50ee6fc82e1ae3e3c06b86a7d1cc988be3b6cae27a89d0fda63c3773330352ae
MATLAB
2,057
54
function ea_checkspm if ~isdeployed try ver = spm('version'); catch ea_error('SPM seems not installed. Please install SPM and add it to the MATLAB path before using Lead-DBS.'); end if startsWith(ver, 'SPM12') verNumber = regexp(ver, '(?<=SPM12 \()(\d+)(?=\))', 'match', 'once')...
f59a2663258316e64006123e9c3e9f0341adf8c63b2d050716fef319a430e48d
MATLAB
2,057
66
function [l c] = path_histogram(G,varargin) % PATH_HISTOGRAM Compute a histogram of all shortest paths in graph G % % [l c] = path_histogram(G) computes all shortest paths in A one at a time % and forms the histogram of the shortest distances between all vertices. % % [l c] = path_histogram(G,struct('sample',N)) uses...
155ecedfe2be6f32f65aef114d7311a8be35d28a0dee013c89cbfd0954f84511
MATLAB
2,058
68
function [p,boundaries] = MultinomialConfidenceIntervals(samples,alpha) %MultinomialConfidenceIntervals - Simultaneous multinomial confidence intervals. % % Confidence intervals computed simultaneously on all cells using the method of % Fitzpatrick and Scott (1987). This provides better estimates of the confidence % i...
03b073dab7287f755044cc12d5311e5cf68df1c7d4446640af92ab001edc80ae
MATLAB
2,060
61
addpath('funcs') %% Data import % import your localization data here %% data rendering pps0 = 5; % projected pixel size of 10 nanometers fov = 12000; % FOV of 12um % render the localization data matrix as a bilinear histogram % data should have the size [N,2] and be in the range [0,fov] im = smlmHist(data,pp...
998f42ddcac12d192469b21dcb56b685fb74630e875608ed67c0f1292d3c2636
MATLAB
2,061
43
% Conversion to SeDuMi. % Conversion routines for reading in problems from SDPPack, SDPA % or MPS formats. Some routines require SDPPACK and/or LIPSOL to % be installed as MATLAB Toolboxes, or need SDPPACK and SDPLIB % environment variables. % % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romank...
e8c558d2b335a2b755a0296fb67457c1e86b493b7c9e8f90a996cfd4ec3b285a
MATLAB
2,061
60
function write_tsv(id,tsvfile,varargin) % write_tsv write a tsv (tabulated-separated) file % if tsvfile already exists, replace value at the line defined % by an id (first column) or add a new line % % write_tsv(id,tsvfile,varargin) % Example: % write_tsv('Pierre','stats.tsv','age',5...
67f6d0cbd7ba983cacbabe283f152bb383d490fe116fabc1f9aa2c8b171b0f7f
MATLAB
2,062
73
function [t,u,v,idx,xnode]=raysurf(p0,v0,node,face) % % [t,u,v,idx,xnode]=raysurf(p,v,node,face) % % perform a Havel-styled ray tracing for a triangular surface % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % p0: list of starting points of the rays % v0: directional vector of the rays, % node: a list...
2bed6b3a27580a46235a7d6976da94f462886b182e4fc453b288a739925317b7
MATLAB
2,063
80
function y = nanstd(x,dim,flag) % FORMAT: Y = NANSTD(X,DIM,FLAG) % % Standard deviation ignoring NaNs % % This function enhances the functionality of NANSTD as distributed in % the MATLAB Statistics Toolbox and is meant as a replacement (hence the % identical name). % % NANSTD(X,DIM) calculates the st...
44649e6d6741efc30bb90833bfaaef66633c7eb57c063a5a70a3260ae3a8c6dd
MATLAB
2,063
48
function Apart = extractA(At,Ajc,blk0,blk1,blkstart,blkstart2) %#ok % Apart = extractA(At,Ajc,blk0,blk1,blkstart[,blkstart2]) % % EXTRACTA Fast alternative to % Apart = At(blkstart(1):blkstart(2)-1,:). % Instead of blkstart(2), it takes "blkstart2" (if supplied) or % size(At,1)+1 (if neither blkstart(2) nor blkstar...
dcdf57a0f9d53d29ead378dfb8cb9627c1c3179a1449336bdc2aa363b953400c
MATLAB
2,063
63
function [betas, stats] = CBIG_fitGLM_2t(subInfoFile, GMICVFile, q) % [betas, stats] = CBIG_fitGLM_2t(subInfoFile, GMICVFile, q) % What is the subtype order? % Offset by 1, the RID column % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md COR_COL = 1+1; fprintf('\n\n\n'...
048fb8d5e0803734c02f76dcc5d2a8d1998a49c87a7f0834651fbb9dc251bd08
MATLAB
2,064
90
function [pval med P] = circ_cmtest(varargin) % % [pval, med, P] = circ_cmtest(alpha, idx) % [pval, med, P] = circ_cmtest(alpha1, alpha2) % Non parametric multi-sample test for equal medians. Similar to a % Kruskal-Wallis test for linear data. % % H0: the s populations have equal medians % HA: the s populations...
8da38436058027d00a6c508ade298c295794e300460a3be73c2127ba1f9cc4c7
MATLAB
2,064
72
function mz3_write(M,filename,fmt) % Write MZ3-formatted data from disk % FORMAT mz3_write(M,filename,fmt) % % M - data structure % filename - MZ3 output filename [Default: 'untitled'] % fmt - compress data [Default: false] %__________________________________________________________________________ % % MZ3...
022ef3efdb2a9022978feca2a0240a13d39c22424722e3a433806212af00ac58
MATLAB
2,065
40
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
050cf7ab1a224d296c5f2b57cd1f6c3e129f7a52fc6da9bd019817d88aa8595f
MATLAB
2,065
77
function [pval v] = circ_vtest(alpha, dir, w, d) % % [pval, v] = circ_vtest(alpha, dir, w, d) % Computes V test for non-uniformity of circular data with a specified % mean direction dir. % H0: the population is uniformly distributed around the circle % HA: the population is not distributed uniformly arou...
69f4ca0735baf07385c99f4ac0d33b558502d400d08e52d417a37ca98499d1f0
MATLAB
2,065
40
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
18fe8c4c615026d7aed25dff2c38afb989ba003e2a097c5d34878104b0c5590e
MATLAB
2,066
76
function y = meddisHairCell(data,sampleRate,subtractSpont) % Calculate Ray Meddis' hair cell model for a number of channels. % % y = iosr.auditory.meddisHairCell(data,sampleRate) % % This function calculates Ray Meddis' hair cell model for a % number of channels. Data is arrayed as one channel per % row. All...
ca69f24ae8f904a29815564bcba2052759b7d100dee3255ddc4c27e7893319ff
MATLAB
2,067
65
function res = A_response_de(params,inputs,initcond) % This function generates a vector of intensity values over time for one % half of the PB innervated by PFNa, to a sequence of single-modality % experience (either AF or OF). % Setup with arguments. % inputs are sensory info thetavec = inputs(1,:); % radia...
2afa8a1f73d1f5da9219be45217233e1fa4eadcdad3d69a8d764f4d66998fb7f
MATLAB
2,069
60
function varargout = subsref(this,subs) % Subscript referencing for GIfTI objects %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillaume Flandin % $Id: subsref.m 6345 2015-02-20 12:25:50Z guillaume $ if length(this) >...
64499dd20daf2c5f8ccf428e4482a5a65353698522578a97920de442f3371af5
MATLAB
2,069
46
% compute_ERSP_times() - computes the widest possible ERSP/ITC time window, % which depends on requested ERSP/ITC parameters such as epoch limits, % frequency range, wavelet parameters, sampling rate and frequency % resolution that are used by timef(). % This helper function is called ...
ab0298dc9e19b88888a768269238181e57f81c461629153cd97415145af100c4
MATLAB
2,069
83
function cvx_optval = quad_over_lin( x, y, dim ) %QUAD_OVER_LIN Internal cvx version. narginchk(2,3); sx = size( x ); sy = size( y ); nx = length( sx ); ny = length( sy ); nd = max( nx, ny ); if nargin < 3 || isempty( dim ), dim = [ find( sx ~= 1 ), 1 ]; dim = dim( 1 ); elseif ~isnumeric( dim ) || dim < 0 |...
adab3cc821fe57ffe6c200d8aa0a2ef35ad0a7ed238c7371710d048bbeacce2d
MATLAB
2,069
71
function [IIM, JJM, deltaI, Iabs, Imap] = ... pointfeature_detect2(im, sigma, quant, plot_flag, pointmode) % a function of particle detection. Use Delaunay triangulation to % estimate local background intensity and t-test to determine true particles. % Inputs: % im: an image, % rect: an region contains no particl...
30294045f5bf0c7eacdeb44a92e6a2b7821700b5188cee3f3835788c994e4c27
MATLAB
2,070
65
function res = D_response_de(params,inputs,initcond) % This function generates a vector of intensity values over time for one % half of the PB innervated by PFNd, to a sequence of single-modality % experience (either AF or OF). % Setup with arguments. % inputs are sensory info thetavec = inputs(1,:); % radia...
5da9e218eb255bb9a97368f8b1c5a93403f15fbd6b76769b3db1e8b32345e1cc
MATLAB
2,070
67
function codeKeeper = syncPatternDetectNSx(data) % syncPatternDetectNSx % % Finds the code for the SYNC pattern on the SYNC output of Blackrock % Microsystems Neural Signal Processor (NSP) recorded by analog input % channel 16 and outputs the unique code and its related timestamp. % % INPUT % % data: The da...
cbbb185874b48da06492bc77a330d377408d1a809097ace32f72095c35c2adaa
MATLAB
2,070
51
ccc; % RAWDATAPATHs = dir("..\MAT Data\pre (granger)\single\**\*Active\**\PE Data_*.mat"); RAWDATAPATHs = dir("..\MAT Data\pre (granger)\single\**\*Passive\**\PE Data_*.mat"); MATNAMEs = {RAWDATAPATHs.name}'; AREAs = cellfun(@(x) x(strfind(x, '_') + 1:end - 4), MATNAMEs, "UniformOutput", false); RAWDATAPATHs = arrayfu...
e62fec53c5ff5550248290422b2175e3e1e5454d68047e3d9cd860a5ed857144
MATLAB
2,070
60
function Serr=specerr(S,J,err,trialave,numsp) % Function to compute lower and upper confidence intervals on the spectrum % Usage: Serr=specerr(S,J,err,trialave,numsp) % Outputs: Serr (Serr(1,...) - lower confidence level, Serr(2,...) upper confidence level) % % Inputs: % S - spectrum % J - tapered fourier transforms ...
9cb8af85bfe644e963806b030de25f41cd03f5262d9f726ec6c920f3b5d7eb3e
MATLAB
2,071
87
function [y,dimage,header]=readOIS(fname,im) % Usage ... y=readOIS(fname,im) % % If a range of images is selected, a 3D set is returned verbose_flag=0; fid=fopen(fname,'rb','l'); if (fid<3), error('Could not open file!'); end; if (fname(end-5:end)=='oldraw'), verinfo=' '; dateinfo=' ...
01e8032ac1036322fcca9173afaa422e0271c613c6ddc9285d5edbf21b475945
MATLAB
2,072
61
function make_reference() %MAKE_REFERENCE Record MATLAB's answers on the shared fixtures. % % matlab -batch "addpath('tests/matlab'); make_reference" % % Writes tests/fixtures/matlab_reference.json, which IS COMMITTED. The % Python suite compares against this file, so cross-language equivalence is % checked in ...
bfb874a5956488c9ec89e25e7d0493bcf571f7838521ae7b47db7ea823e3864b
MATLAB
2,072
55
function traceplot22(handles) if ~isempty(handles.dend_shaft) && ~isempty(handles.spineROI) M = 2; elseif ~isempty(handles.dend_shaft) && isempty(handles.spineROI) M = 1; elseif isempty(handles.dend_shaft) && ~isempty(handles.spineROI) M = 1; else M = 0; end if M > 0 scrsz = handles.scrsz; ...
dd8a2ecef8b2b6ef97761cc18e3ab0edb3a55a74c939742e1b987c75019b51b8
MATLAB
2,073
48
%% PaCER/EXAMPLE_3.m - Plan/Outcome Comparisions % % Andreas Husch % Centre Hospitalier de Luxembourg (CHL) / Luxembourg Centre for Systems % Biomedicine (LCSB), University of Luxembourg % mail@andreashusch.de / husch.andreas@chl.lu % 2017 % %% Make sure all PaCER files (including subdirectories) are in your MATLAB pat...
1db818cff65bb513945f24cfe082b7497c82823a78e114a1eef9aeb09e31aeec
MATLAB
2,074
83
function newobj( prob, dir, x ) narginchk(3,3); persistent remap_min remap_max remap if isempty( remap_max ), remap_min = cvx_remap( 'convex', 'log-convex' ); remap_max = cvx_remap( 'concave', 'log-concave' ); remap = cvx_remap( 'log-valid' ) & ~cvx_remap( 'constant' ); end % % Check problem % if ~isa( p...
3057e89cd2405834747617a9ea1445641830a1f4653be0d69ba04ec94df0ff9a
MATLAB
2,074
65
function [node,face,elem]=meshanellip(c0,rr,tsize,maxvol) % % [node,face,elem]=meshanellip(c0,rr,opt) % % create the surface and tetrahedral mesh of an ellipsoid % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % c0: center coordinates (x0,y0,z0) of the ellipsoid % rr: radii of an ellipsoid, % i...
a9d67f957bcf442696eb0a2b8230a1228aa394ed7f5941ee84dcd9f0ce349098
MATLAB
2,074
49
function [Lden,Ld] = dpr1fact(x, d, Lsym, smult, maxu) %#ok % [Lden,L.d] = dpr1fact(x, d, Lsym, smult, maxu) % % DPR1FACT Factor d[iag] p[lus] r[ank] 1: % [Lden,L.d] = dpr1fact(x, d, Lsym, smult, maxu) % Computes fi and d such that % diag(d_IN) + x*diag(smult)*x' = %(PI_{i=1}^n L(p_OUT^i,beta_i)) * diag(d_...
0a597643c7d4b2e53d17ad7ff7eff0e763adb157f33c1034aeb0ef93f7cfac90
MATLAB
2,075
58
function [ newints,mergedidx ] = MergeSeparatedInts( ints,minseparation ) %[ ints ] = MergeSeparatedInts( ints,minseparation ) merges close or %overlapping intervals with a minimum separation. % %INPUT % ints (n_ints x 2) matrix of interval start and end times % minseparation merge ints separated by le...
bd78f6df8c8b0afee861dac74ae66ca7875c74de3ceb0bc65dcd5161e44c1f9b
MATLAB
2,075
43
classdef CBIG_ArealMSHBM_unit_test < matlab.unittest.TestCase % Written by Ru(by) Kong and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md methods (Test) function test_example(testCase) % create output folder CBIG_CODE_DIR = getenv('CBIG_CODE_DIR'...
f61c700ad7f69e32eacdaa74e5d3b23f6391cd81b57a69a605dc3f1544228a0d
MATLAB
2,075
51
ccc; % RAWDATAPATHs = dir("..\MAT Data\pre (granger)\single\**\*Active\**\Prediction Data_*.mat"); RAWDATAPATHs = dir("..\MAT Data\pre (granger)\single\**\*Passive\**\Prediction Data_*.mat"); MATNAMEs = {RAWDATAPATHs.name}'; AREAs = cellfun(@(x) x(strfind(x, '_') + 1:end - 4), MATNAMEs, "UniformOutput", false); RAWDAT...
21c9d17a208204a1957d22782ca4d077dc802b227b88d038593045e78ed4a412
MATLAB
2,076
62
function [val] = filetype_check_extension(filename, ext) % FILETYPE_CHECK_EXTENSION helper function to determine the file type % by performing a case insensitive string comparison of the extension. % Copyright (C) 2003-2012 Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % fo...
5409ee76a11a31971038d99dee1d3e2b6a845d97a30644797e6fa8fe78aa048c
MATLAB
2,077
71
function [inputNames, outputNames] = get_arg_names(filePath) %http://stackoverflow.com/questions/10431577/how-do-i-retrieve-the-names-of-function-parameters-in-matlab %# Open the file: fid = fopen(filePath); %# Skip leading comments and empty lines: defLine = ''; while all(isspace(defLine)) ...
61edf3ea91aa8432f2427bb2e4c64f933fdfecde43ca3c845590c781bc94dd86
MATLAB
2,077
73
function [res, errStr, fName]= ftrstruct_read(fNameIn) % %function [res, errStr, fName]= ftrstruct_read(fName) % % Opens a ftrStruct from the filesystem % % fName: should contain the path and file name. if it is empty or undefined, a file selection dialog will appear % % return values: % res: contain...
de88810e3ae27b58a4a6e9972a7204d20c49c4ed81d8ff9a4951625bf29f6296
MATLAB
2,077
63
% hist2() - draw superimposed histograms % % Usage: % >> hist2(data1, data2, bins); % % Inputs: % data1 - data to plot first process % data2 - data to plot second process % % Optional inputs: % bins - vector of bin center % % Author: Arnaud Delorme (SCCN, UCSD) % Copyright (C) 2003 Arnaud Delorme, Salk ...
f4b6ee4e2f970e7f064290dcf866ea3e3f08928ea20537a72818b2856bf89c4a
MATLAB
2,077
48
function [numTrack, numAdditionalTrack] = countTotalNumTrackletsFrDiffAnalysisRes(transDiffAnalysisResCrop) %COUNTTOTALNUMTRACKLETS look at output of DC-MSS and count how many tracklets there are in total % %INPUT: transDiffAnalysisResCrop (cell array) output of %basicTransientDiffusionAnalysisv1.m % %OUTPUT: ...
7bfcaf1c5dea11068781cbeb4198d269286e2db6bc22c49989562ff7da2210a7
MATLAB
2,078
97
function y=calcRadius4(anatim,maskim,rotangle,mii) % Usage ... y=calcRadius4(anatim,maskim,angle,mii) [i1,i2]=find(maskim); cropim=anatim(min(i1):max(i1),min(i2):max(i2)); cropmsk=maskim(min(i1):max(i1),min(i2):max(i2)); if (rotangle~=0), rotim=imrotate(cropim.*cropmsk,rotangle,'bilinear'); else, rotim=cropim; e...
c5b9c5ab5bf4dc270d665352af5b40017b273325a32159b6af3a65ef4ba369c1
MATLAB
2,078
60
function tests = ea_explorer_statlist(varargin) % first input can be the variable, if applied, will only return the correct % tests (e.g. binary / continuous). if nargin outcomein = varargin{1}; if iscell(outcomein) outcomein = outcomein{1}; end outcomein(isnan(outcomein)) = 0; %convert NaN in ...
d62a4c9b9332ac844b3d2b9fb2cd0bd73c6c522e08ae80ffece85eaa85be789d
MATLAB
2,078
55
function [dat] = bz_scrubTracking(dat) % USAGE % [dat] = bz_scrubTracking(dat) % % INPUTS % dat - struct created by calling dat = importdata(file.csv) on a csv % file exported from a .tak file % % OUTPUTS % dat - the same struct 1) outliers removed % 2) median filtering % ...
c79b31f3d84784e8bd1849fd7e055739a7a7f5d6e149d74033a13709e80599e9
MATLAB
2,079
76
function auto_corr_rm = plot_rate_map_ac(self, cel, rate_map, xs, ys) % Plots the autocorrelation of the ratemap import CMBHOME.Utils.* if ~exist('rate_map', 'var'), rate_map=[]; end if ~isempty(rate_map) %&& exist('sx', 'var') && exist('ys', 'var') %rate_map = rate_ma...
744bfb72548ebf3be1d84e529761531dcba0d651dfa935d98c3cd9d7be469421
MATLAB
2,080
64
function is_sldrawing = is_straight_line_drawing(A,X,varargin) % IS_STRAIGHT_LINE_DRAWING Test if coordinates are a straight line drawing % % is_sldrawing = is_straight_line_drawing(A,X) determines if the % coordinates of each vertex in X allow the graph A to be drawn with % straight lines and no edges crossings. is_s...
661bb0c70915b630dc508b13048f41fdc3c18174e64c37510127afdc2f76c75d
MATLAB
2,084
66
function makeimagingplots(headpath,tuningfilename,savemode,examples,fileexpnum) %select a tuning file. Make the timecourses, tuning curves, and ROI %figures. Save them. Also select examples for particular experiments or %ROIs to look at averages %examples is a flag if you want to run it %fileexpnum is only relevant i...
b1e4cb18ffd958c8e533ec5fc5faa04866e131841d176bfef6e17ad98d518876
MATLAB
2,084
68
%%********************************************************************** %% blktrace: compute <X1,Z1> + ... + <Xp,Zp> %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%********************************************************************** function tr...
c873e0ad6de2b477b20abede05c1f7b6e878e14083cb6baace631108c3eff0de
MATLAB
2,084
71
function bz_database = bz_database_load(database_name,filters) % Loading the Buzsakilab metadata-database % % v1.3 % % INPUTS % load_database : % Which database to load. Default: 'buzsakid_metadata' % % filters : % Filters by column names can be applied according to mySQL standards: % Conditions: AND, OR % Operators:...
36903d0449759d1cd23e43248ddea98944aa1a7c190de1bbc35db51a2918d640
MATLAB
2,085
38
function [score, state] = CBIG_MMLDA_get_amyloid(UPENNBIOMK_file, ... UCBERKELEYAV45_file, amyloid_phase, phase, rid, viscode) % [score, state] = CBIG_MMLDA_get_amyloid(UPENNBIOMK_file, UCBERKELEYAV45_file, amyloid_phase, phase, rid, viscode) % % Get amyloid score and state from UPENNBIOMK and UCBERKELEYAV45 spread...
c5a93447fa442d50045d8103e41144a7ea2e5a11c3f166efbcd630b70d079993
MATLAB
2,085
60
function [handles] = callsmoothfilt_master(handles, dataID, w) if nargin<2 dataID = 1; end handles = loadtrace(handles, dataID); if ~isempty(handles.spineROI) spID = handles.spine_title; spineROI = handles.spineROI; trace_stamp = handles.spine_dff; tc2 = []; for i = 1:length(spID) tc2(:,...
d0e8a6cfcbbc85ddd26a472500ceefbdbc90ccd92c5a8409eeb44642a5ab9e62
MATLAB
2,085
53
function [a_array1, b_array1] = generate_connectome_richclub(a_array,b_array, lambda, topology, hub_centres, hublength) %GENERATE_CONNECTOME_EDR Summary of this function goes here % Detailed explanation goes here if ~all(size(a_array) == size(b_array)) error('a_array and b_array must be same size'); ...
dceb757695002394458c9ef6e4be5ce954d63e25a931edceb98f41b858c377c5
MATLAB
2,085
62
% NOTES: % - standard folders and variable names are created by this script % % - extracted fmri_data objects are saved in DATA_OBJ variables % % meta-data saved in image_names_and_setup.mat % image data saved in data_objects.mat % % - you only need to run the prep_ scripts once. After that, use % canlab_simple...
7764573b8fa2e5c789fa26508fe2647c298fd9d89028a0dedf604e88a1b7d7fb
MATLAB
2,086
57
function [] = ADP_Motion_Correction3(inFolder, outFolder, rigid) if(nargin<3) rigid = true; end fprintf('\nFolder %s\n',inFolder); % outFolder = strrep(inFolder,'RawData','MotionCorrected'); fprintf('\nLoading...'); [Y, Yred] = makeStacks3(inFolder, 10); fprintf('Do...