sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
85d8901e23e69235b685207c169c60313b4ab8f0cab9d00573e464a2d48e9ef0 | MATLAB | 1,609 | 57 | function [train_data,inds] = select_training_set(hsi_data,cos_angle_thresh,mask)
%function [train_data,inds] = select_training_set(hsi_data,cos_angle_thresh,mask)
%
% subsample the input data by adding data points to the training set only if
% they are have a cosine magnitude of less than cos_angle_thresh from all othe... |
9823f34744fd68feb20a7af9ec858255e2cfd54d5c5d3e8c4c2f893519a23e05 | MATLAB | 1,610 | 62 |
% Reproduce topoplot crash with Brainstorm-like chanlocs
% Create 270 channels with valid X Y Z (Brainstorm format)
num_chans = 270;
for i = 1:num_chans
chanlocs(i).labels = sprintf('MEG%03d', i);
% Random positions on a sphere approximately
theta = 2*pi*rand;
phi = pi*rand - pi/2;
r = 100; % mm
... |
c9f0fa99226a0f21165713f04880f88e269abe67b04d44be6c039cf6871b1145 | MATLAB | 1,610 | 74 | function frst=show_progress(cnt,ttl,frst);
persistent hit
%Initialise hit only when it is first declared as an empty array
if frst==0
hit=zeros(20,1);
fprintf('10%% 20%% 30%% 40%% 50%% 60%% 70%% 80%% 90%% 100%%\n');
end
prp=cnt/ttl;
if prp>=0.05 & hit(1)==0
fprintf('||');
hit(1)=1;
else... |
032c12d667eff179010847a7d64a0a07ddc1bb84235c7963e51ba451db92ed86 | MATLAB | 1,611 | 49 | function c = tapas_gaussian_obs_config
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Contains the configuration for the Gaussian noise observation model for continuous responses
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
3b2a351e42f8f9b836783520aa22e85bb7f4d9f190d50278c2b3d47bacc47c39 | MATLAB | 1,611 | 55 | % Script for comparing speed an accuracy of original TQLB, optimized TQLB
% and builtin EIG command.
% Rasmus Munk Larsen, DAIMI, 1998.
n=1000;
% Use 2. order difference matrix as testproblem.
e = ones(n,1);
T = spdiags([-e 2*e -e], -1:1, n, n);
true = 4*cos(pi/2*[n:-1:1]'./(n+1)).^2;
alpha = 2*ones(n,1);
beta = -o... |
c59f6fc5ab27f18fa72ced7acdcd867942bcafb77eb39a6db3ef851d9ed1a637 | MATLAB | 1,612 | 52 | %{
pre.ManualSegment (imported) # manual 2d cell segmentation$
-> pre.AlignMotion
---
mask : longblob # binary 4-connected mask image segmenting the aligned image
segment_ts=CURRENT_TIMESTAMP: timestamp # automatic
%}
classdef ManualSegment < dj.Relvar ... |
2023c74bb88822815e7d80160f7401d24bc90ac20c813fab8205fdb7ff29e131 | MATLAB | 1,613 | 39 | function bids_add_json_to_dot_set(folder)
fcontent = dir(folder);
for iFile = 1:length(fcontent)
if ~isequal(fcontent(iFile).name(1), '.')
if fcontent(iFile).isdir
bids_add_json_to_dot_set(fullfile(folder, fcontent(iFile).name))
elseif length(fcontent(iFile).name) > 4 && isequal(fconte... |
2f0e5e4188d6876daf6058bdf50e8b69a27fda734110996f60a9fa59d6e55e62 | MATLAB | 1,613 | 46 | function [SkullDepth, idx_nearest_skull, idx_farthest_skull] = CalculateSkullDepth(EmitSensor, Target, Brain)
%Sensor Location
x1 = EmitSensor(1); y1 = EmitSensor(2); z1 = EmitSensor(3);
x2 = Target(1); y2 = Target(2); z2 = Target(3);
%%Formula, the Target can not be higher than the EmitSensor
IdxSkull = find(Brain == ... |
c8ef4a66d66b72ed68b0bbe1b17e14af850b4087666ad9f500b30613b4091722 | MATLAB | 1,614 | 61 | function Meta_Chisq(DB,whfield,levels,varargin)
% Meta_Chisq(DB,whfield,[add empty contrasts])
%
%DB.PP % list of image names
%
%DB.XYZmm % mm coords for each study
%DB.maskV % mask mapped volume
%DB.radius % in voxels
% -----------------------------------------------------
% across all density images, ... |
068a4a1686b3b52f70f8d70e4747e0632abff05f3f6d3f56590ff8a68048bb46 | MATLAB | 1,615 | 34 | %{
# master table with general data about the scans
-> experiment.Scan
-> reso.Version
---
nfields : tinyint # number of slices
nchannels : tinyint # number of recorded channels
nframes : int ... |
20765ea6c467de04c41c8bf24d72a92407abe00fc8b4994f74a86c14b9af98cd | MATLAB | 1,615 | 44 | % ZG_rprod
%
% row product
%
% Machine Learning Toolbox
% Version 1.0 01-Apr-96
% Copyright (c) by Zoubin Ghahramani
% http://mlg.eng.cam.ac.uk/zoubin/software.html
%
% ------------------------------------------------------------------------------
% The MIT License (MIT)
%
% Copyright (c) 1996, Zoubin Ghahramani
% ... |
8f1bed8159404cc2283396bf77b76e6821ba307227d73ed9d2be64ebc384b21b | MATLAB | 1,615 | 58 | function [z,z2] = findNodeDegEdgeWeight(adjM, edge_thresh, exclude_zeros)
% Calculates mean node degree and mean edge weight from adjacency matrix
% Parameters
% ----------
% adjM : (matrix)
% adjacency matrix of the network
% edge_thresh : (float or vector)
% this is a vector (list) of thresholds (between 0 ... |
a2b1b646d134d9944372214fca057f54ff7d35577a8fdde525a0025563f73739 | MATLAB | 1,615 | 46 | function [logp, yhat, res] = tapas_unitsq_sgm_mu3(r, infStates, ptrans)
% Calculates the log-probability of response y=1 under the unit-square sigmoid model
%
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ
... |
1fcb833a65dce3ac7331e49a41777496bfd54ba5ae57abd871250b411c55cb4d | MATLAB | 1,616 | 54 | %% This script loads the statistical output for the reference map (HD-EEG, 256 channels, Cohen's d)
% and subtracts the results for the other channel densities
root_dir = '/home/uni10/nmri/projects/GoeEpiLongterm/nfocke/AllGGE_redux/results/';
% load maps for respective channel density and subtract from reference ma... |
5d0d132ac9b63dd8b3bde633372f3421c3fed25ef58fb4182f367a659e672b1f | MATLAB | 1,618 | 42 | function TABLE = PunctaPlot_RNAscope(experiment)
%Input: experiment (eg, 'RNAscope_shEsr1validation')
%Set data path
datadir = ['Z:\histology\Carla\Confocal\' experiment ...
'\Zstacks\compiled\Spot_data'];
%Get files to analyze
fileinfo = struct2table(dir(datadir));
fileinfo = fileinfo(3:end, :);
filenames = uniq... |
54af4e7b6177203bf9022df3ef99bc66b9141a57f0e397fec01689c90ed14e2b | MATLAB | 1,619 | 51 | function [t123idx,sRow,sCol,concT123,rspT123] = prep_ds_data()
%% Load the raw dose response data and initial guesses from least squares fitting
addpath(genpath(pwd));
fileName = which('Data S1.csv');
dataT = readtable(fileName); % load Excel file
[input.Odor, ~, input.indOdor] = unique(dataT.Odor, 'stable'); %O... |
9eec4ef1efabfaea01d6f9a59e48d3d5a2005b4c295c026f2d474d01446da958 | MATLAB | 1,619 | 49 | % kaiserbeta() - Estimate maximum passband deviation/ripple for Kaiser beta
%
% Usage:
% >> dev = invkaiserbeta( beta );
%
% Input:
% beta - scalar Kaiser window beta
%
% Output:
% dev - scalar maximum passband deviation/ripple
%
% References:
% [1] Proakis, J. G., & Manolakis, D. G. (1996). Digital ... |
ca9f5537d37bb1b7378dfe04c9dfff5104963d8063a4ec796b5725001ddb7d10 | MATLAB | 1,619 | 40 | function b = multitransp(a, dim)
% Transposing arrays of matrices.
%
% B = MULTITRANSP(A) is equivalent to B = MULTITRANSP(A, DIM), where
% DIM = 1.
%
% B = MULTITRANSP(A, DIM) is equivalent to
% B = PERMUTE(A, [1:DIM-1, DIM+1, DIM, DIM+2:NDIMS(A)]), where A is an
% array containing N P-by-Q matrices al... |
17bfcd4721441f0f1fa40d586fef61a2f42c444161e2d1792e9ab95ec173c2d4 | MATLAB | 1,620 | 44 | function [success] = SetupPlotting(fontsize)
%[success] = SetupPlotting(fontsize)
%success = 1: all good
%success = 0: something went wrong
if nargin <1
fontsize = 12;
end
try
% get the matlab version to identify the appropriate name for the
% root figure object
matlabversion = version('-release');
... |
243ffb858f0210f5389c110df51cea25053c452d122dfc6048deb2a35b92095e | MATLAB | 1,621 | 46 | function results = assembly_activity(AssemblyTemplates,SpikeCount)
% Activities = assembly_activity(Patterns,Activitymatrix): computes the
% time course of the activity of assembly patterns defined in Patterns in
% the spike matrix Activitymatrix with single bin resolution.
%
% Description of inputs:
% Activityma... |
5a35f2da4c5e39337982a9e84b34936c754b5734f5f5b562c382af0bb2236bb5 | MATLAB | 1,621 | 71 | function [X,Y,polygon] = UISelect
%UISelect - Interactively select polygon zone in an existing plot.
%
% USAGE
%
% [X,Y,p] = UISelect
%
% X,Y polygon coordinates
% p handle for polygon object in figure
%
% SEE
%
% See also UIInPolygon
%
% Copyright (C) 2009-2011 by Michaël Zugaro... |
828d918bb8b74f95c7fe3e4036350c1789b3e39e9d825e19617fbe4116fb277e | MATLAB | 1,621 | 77 | %% TE = readTEfromText(filename)
%
% Input
% --------------
% filename : text file fullname
%
% Output
% --------------
% TE : echo times
%
% Description:
%
% Kwok-shing Chan @ DCCN
% k.chan@donders.ru.nl
% Date created: 22 April 2018
% Date last modified: 25 May 2018
%
%
function [TE,TR,FA,voxelSize] =... |
12f081d1dfd349b6b6e37a37364096def7215fdf54eb802d7cb06746df5929e5 | MATLAB | 1,622 | 41 | function haveNewerRelease = tapas_compare_versions(online_version,offline_version)
%% Check if online_version is higher.
%
% Input
% online_version -- Online version as string of numbers separated
% by dots, i.e. '3.3.0'
% offline_version -- Onl... |
b62a49da0c14c9ec4e0b83a79d1905312ca4753a83785f6f592e0d577718f7cd | MATLAB | 1,622 | 53 | function plot_fig6b(datadir)
% Plot latency to peak in dopamine and acetylcholine after the side LED
% turns on (left) and when rats opt out (right) on contralateral trials,
% averaged across rats. N = 10 DA rats, N = 10 ACh rats.
%
% INPUTS
% datadir: file path of data downloaded from Zenodo. Link to download can
% be... |
de7796a974b5c23b8729b91a145d8db2ff8097591ba3655021b5334c11e734af | MATLAB | 1,622 | 71 | function [units, trace,boundbox]=getUnitsROI(h5Path,Fs,varargin)
% to extract time traces based on ROI without loading the full movie
% [units, trace]=getUnitsROI(h5Path,Fs)
% Step1: load 1st second and generate the average frame to crop from
% Step2: get the average pixel trace from the h5 file
% drawcircle
% imcrop
... |
e2615aa457c4c901744606138ef25c7f35d272b0cc7b0ca69cb469fd66e70b7c | MATLAB | 1,622 | 36 | % Compute infEP part of a likelihood function based on the infLaplace part using
% Gaussian-Hermite quadrature.
%
% The function is used in GLM likelihoods such as likPoisson, likGamma, likBeta
% and likInvGauss.
%
% Copyright (c) by Hannes Nickisch, 2013-10-16.
function varargout = lik_epquad(lik,hyp,y,mu,s2)
n = m... |
0c2392732e5d95935357179e2d3fb573d3740c5de7f485233ebf80d535322066 | MATLAB | 1,623 | 56 | classdef MrImageSpm4D < MrImage
% 4D Image class that interfaces image processing operations of SPM
%( e.g. realign, coreg, smooth, normalization, segmentation, temporal filter)
%
% NOTE:
% will convert into real-valued
%
% IN
% dataMatrix [nVoxelX, nVoxelY, nSlices, nVolumes]
... |
46cacf7b1d56252c5921018a2b6eab492b9d4bc5151516a6278fce3e998e619a | MATLAB | 1,624 | 50 | function obj = report(obj)
% Print accuracy report for a meta_nbc object
% obj = report(obj)
%
% You should have already trained and tested the object using train and
% test with a meta_dataset data object and possibly test data.
%
% The report method uses the last error values stored from either the test or
% cv meth... |
9c4b8b751e68d3d12852f010df106deecac07a1a26e109ebf93e1c6f15cfb27a | MATLAB | 1,624 | 61 | %isiscalar - Test if parameter is a scalar (integer) satisfying an optional list of tests.
%
% USAGE
%
% test = isiscalar(x,test1,test2,...)
%
% x parameter to test
% test1... optional list of additional tests
%
% EXAMPLES
%
% % Test if x is a scalar (double)
% isiscalar(x)
%
% % ... |
f49c020cf365190c37b24747911860a17856f04e88f03dbdc06225b0ad5c318b | MATLAB | 1,624 | 42 | function localVersion = getVersion(HomeDir, app)
localVersion = importdata(fullfile(HomeDir, 'version.txt'));
localVersion = localVersion{1};
localVersion = strtrim(localVersion);
% app.MEANAPStatusTextArea.Value = ...
% [app.MEANAPStatusTextArea.Value; ...
% sprintf('You are using version %s... |
147a2883a477fcbfeb580240d24389b3ff614284a2b78ef75f2d12f69ca62413 | MATLAB | 1,625 | 87 | function alpha = circ_vmrnd(theta, kappa, n)
% alpha = circ_vmrnd(theta, kappa, n)
% Simulates n random angles from a von Mises distribution, with preferred
% direction thetahat and concentration parameter kappa.
%
% Input:
% [theta preferred direction, default is 0]
% [kappa width, default is 1]
... |
0e969aba7c65db6903e908d0a4412e2aacaaeef25d11cd173ab650258c35c5e7 | MATLAB | 1,626 | 47 | % This function calculates the probability flow (PF) base on the TD and
% Peak correlation according to Mitra et al (2020).
%
% The function uses the TD and peak correlation estimated generated
% in time delay computation by Ryan's code (https://github.com/ryraut/lag-code).
% Qunjun Liang 2022/01/15
function [prob... |
16181ed351431589a8df16f994a5aada4d401f1becdc2d2489f67cdcb6e2770b | MATLAB | 1,626 | 52 | function plot(timeStream,cfg,varargin)
% Plot the contents of a McsTimeStampStream object.
%
% function plot(timeStream,cfg,varargin)
%
% Produces a plot in which the time stamp of each event is shown as a line
% on a time scale.
%
% Input:
%
% timeStream - A McsTimeStampStream object
%
% cfg ... |
bc0e43fd0e317f32b89d90febd3d3eb5aff6be19b11427130372ea3b1ebdc9cf | MATLAB | 1,626 | 47 | function propvalArray = tapas_uniqc_struct2propval(propvalStruct, doRemoveEmptyProps)
% Converts structure variable with property/values to cell of name/value
% pairs
%
% propvalArray = tapas_uniqc_struct2propval(propvalStruct)
%
% IN
% propvalStruct struct of the form
% propvalStruct.prop1 = va... |
d39fe4153c555bcbcd213c31c86da384d72de50b3c0ac0fe3eccef6cbbd0a1b7 | MATLAB | 1,626 | 48 | function W = design_kaiser(lo,hi,atten,odd)
% Design a Kaiser window for a low-pass FIR filter
%
% In:
% Lo : normalized lower frequency of transition band
%
% Hi : normalized upper frequency of transition band
%
% Attenuation : stop-band attenuation in dB (-20log10(ratio))
%
% OddLength : whether the length sh... |
a998ff36fb4eefc21778432a629591c622f077d58c832edc47ebf434bf5f7911 | MATLAB | 1,627 | 73 | function [err,Word] = GetWord (S,n,D)
%
% [err,Word] = GetWord (S,n,D)
% or Word = GetWord (S,n,D)
%Purpose:
% Extracts the nth word from S using one of the characters in
% D as a delimiter.
%
%
%Input Parameters:
% S : String such as 'Hello Jim | Munch', trailing blanks are removed
% n : the word number. if ... |
dc4fa74e41a0f182905ce37f8c0072dfdf75a80c2f67996ba723527721af8a51 | MATLAB | 1,628 | 44 | %{
pre.AlignRaster (computed) # raster alignment for bidirectional tuning
-> pre.ScanInfo
---
raster_phase : float # shift of odd vs even raster lines
%}
classdef AlignRaster < dj.Relvar & dj.AutoPopulate
properties
popRel = pre.ScanInfo & (pre.ScanCheck & 'chann... |
e18d8cb875e507161e8951a4e404b1f48878bf9b83070ead7155160e484aabd5 | MATLAB | 1,628 | 65 | function [linehandle dothandle cfg] = plotDotsWithErrors(y,x,dotcolor,cfg)
%[linehandle dothandle cfg] = plotDotsWithErrors(y,dotcolor,cfg)
nsubs = size(y,1);
ncond = size(y,2);
if ndims(y) > 2
error('plotDotsWithErrors: Input Data Matrix has too many dimensions!');
end
if nargin < 4
cfg = [];
end
... |
595260c88429212ac693c63e75bb0b368c7293cd6b9364fb464fceff80dcfc4e | MATLAB | 1,629 | 51 | function task_GA_gaitERSP_clean(sii, PATH, fieldName)
% Load and average subject-specific ERSPs and save as group average.
% with subject specific gait ERSPs stored as file_in at PATHIN
%
% INPUT
% - sii: vector of subject IDs to be processed
% - PATH: structure with all paths leading to diff processing steps
... |
2d4b2082e232b2b4721aefaede6df5b767517d938f0639279ae48572f26daaa9 | MATLAB | 1,630 | 36 | function params = preprocNormalize_GetMetaParams(argNum)
% Usage: params = preprocNormalize_GetMetaParams(argNum)
%
% Get meta-parameters for preprocNormalize
%
% ML 2013.03.21
params.class = 'preprocNormalize';
switch argNum
case 1
% Original arguments recmomended by SN
params.valid_w_index = []... |
699e543d53ebb9888c5ad7edf9bcf324b85e3f49c0b73492224f83b149bf1a67 | MATLAB | 1,630 | 48 | function [logp, yhat, res] = tapas_condhalluc_obs2(r, infStates, ptrans)
% Calculates the log-probability of response y=1 under the unit-square sigmoid model
%
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2016 Christoph Mathys, TNU, UZH & ETHZ
%
% ... |
a2705969353d489a72e7c1262388d7c87d9870182d529acbd89b0f8bba47b5a6 | MATLAB | 1,630 | 39 | % GIfTI Class for MATLAB
%
% Geometry format under the Neuroimaging Informatics Technology Initiative
% (NIfTI):
% http://www.nitrc.org/projects/gifti/
% http://nifti.nimh.nih.gov/
%
% This MATLAB class is part of SPM:
% http://www.fil.ion.ucl.ac.uk/spm/
%
% It reli... |
072e10bced9792919f5f12bcdff5d574cefe04a9a7232366684c58d5db89175d | MATLAB | 1,632 | 74 | function [rhmf_out] = rhmf_detector(hsi_img,tgt_sig,mask)
%
%function [rhmf_out] = rhmf_detector(hsi_img,tgt_sig,mask)
%
% Robust High Order Matched Filter
% linear filter with minimized high order statistics
%
% ref: Robust high-order matched filter for hyperspectral target detection
% Shi, Z. and Yang, S., Electron... |
07d9bcd34bda73eb49a07fcaf0bbf14498a3957243e24d72f02cbefb93473d9c | MATLAB | 1,632 | 72 | function [Status, Prefix, View] = PrefixStatus (Prefix)
%
% [Status, Prefix, View] = PrefixStatus (Name)
%
%Purpose:
% Determines if the name chosen is a valid for an AFNI Brick
% If you pass a name containing prefix only and no view then
% View is assumed to be +orig
%
%
%Input Parameters:
% Name: a string c... |
33495ef0753ce3b18bb91a6204b803839c834235a009d7f97dcd502b3972ebd2 | MATLAB | 1,632 | 74 | function c_list = perform_curve_extraction(M, t, options)
% perform_curve_extraction - extract level set curves from an image.
%
% c_list = perform_curve_extraction(M, t, options)
%
% 'M' is the image.
% 't' is the level.
% 'c_list' is a cell array of 2D curves.
% 'options' is an optional structure with fiel... |
3589eda45a344178d828f1faf0f226474de30cf7e43d5ebe0a116c8c2dcae315 | MATLAB | 1,632 | 45 | function [ v, ff ] = tapas_ceode_update_euler( v, u, P, M, xtau, dt)
% [ v, ff ] = tapas_ceode_update_euler( v, u, P, M, xtau, dt)
%
% Computes an euler update step for the delayed euler integrator, i.e.
%
% x(t + dt) = x(t) + dt * f(t-tau)
%
% INPUT
% v mat vectorized state value x(t) at time ... |
a8082891372a80b93c008f7603d0fe692050579630f276e8fae42d5cd6dcf309 | MATLAB | 1,632 | 64 | function [ccmf_out] = ccmf_max_detector(hsi_img,tgt_sigs,mask,n_comp)
%
%function [ccmf_out] = ccmf_max_detector(hsi_img,tgt_sigs,mask,n_comp)
%
% Class Conditional Matched Filters, max over targets
%
% inputs:
% hsi_image - n_row x n_col x n_band hyperspectral image
% tgt_sig - target signature (n_band x 1 - column ... |
317dfc2f8f4943124ab3d2aaced66f053049975b43624050a6e1ece4198848b3 | MATLAB | 1,633 | 50 | % addphase1.m
% Jamie Near, McGill University 2014.
%
% USAGE:
% PhasedSpecs=addphase1(specs,ppm,timeShift,ppm0,B0);
%
% DESCRIPTION:
% Add first order phase to a spectrum (added phase is linearly dependent on
% frequency). This function operates on a vector (fid or spectrum), not on
% a FID-A data structure. For ... |
486264fa3d4ff236155d320c3b3a4e158c8e92eda5519f018ba78e8f55034720 | MATLAB | 1,633 | 44 | function [cluster1_id,cluster2_id] = cluster_search(bifur_node, linkage_mat)
cluster1_id = [];
cluster2_id = [];
cluster1_node = bifur_node(1);
cluster2_node = bifur_node(2);
num_nodes = size(linkage_mat, 1) + 1;
if cluster1_node <= num_nodes
cluster1_id = [cluster1_id, cluster1_... |
4e7d7b4f84cc1d187dca9b4f1c46c274ab567b584a75305f4dc5be82fc12f11c | MATLAB | 1,633 | 60 | function varargout = PlotHVLines(positions,direction,varargin)
%PlotHVLines - Plot vertical (resp. horizontal) lines at listed x (resp. y).
%
% USAGE
%
% p = PlotHVLines(positions,direction,options)
%
% positions list of abscissae/ordinates
% direction optional direction: 'h' or 'v' (default = 'v')... |
0ba6e3db867a0052c78ba86ad51ba0c393726adf5d024a9610c1680cfc7c7796 | MATLAB | 1,634 | 82 | function h = fillsteplot(dat,linewid,linez,condnames,xrange,colorcycle)
% function h = fillsteplot(dat,linewid,linez,condnames,xrange,colorcycle)
%
% Plots a mean vector (mean of each column of dat)
% surrounded by a fill with standard err bars
%
% If dat has 3 dimensions, then
% the diff between dat(:,:,1) and dat(:,... |
6102853ba66544bb112371b14c1bb6363bcc3b8041a5937178edfe400edb71be | MATLAB | 1,634 | 58 | function tapas_validate_inference(inference)
%% Check whether the input is complient with the interface.
%
% aponteeduardo@gmail.com
% copyright (C) 2016
%
if ~isstruct(inference)
error('tapas:validate:mcmc:inference', ...
'inference is not a structure');
end
isfunc = @(x) isa(x, 'function_handle');
val... |
a1a885ec22065dd716399d4a6364b0bb899d7a7fce8457ea701e9b39fbbf5ca3 | MATLAB | 1,634 | 82 | function h = fillsteplot(dat,linewid,linez,condnames,xrange,colorcycle)
% function h = fillsteplot(dat,linewid,linez,condnames,xrange,colorcycle)
%
% Plots a mean vector (mean of each column of dat)
% surrounded by a fill with standard err bars
%
% If dat has 3 dimensions, then
% the diff between dat(:,:,1) and dat(:,... |
ece73ef142030148df249884efb74a3bfd6c84a897379001396c9cbb82385642 | MATLAB | 1,634 | 82 | function h = fillsteplot(dat,linewid,linez,condnames,xrange,colorcycle)
% function h = fillsteplot(dat,linewid,linez,condnames,xrange,colorcycle)
%
% Plots a mean vector (mean of each column of dat)
% surrounded by a fill with standard err bars
%
% If dat has 3 dimensions, then
% the diff between dat(:,:,1) and dat(:,... |
0add5b98d44b11d656335a9e0678cd551b1a3c07580415af8fe16a688064aea4 | MATLAB | 1,635 | 75 | %% [r2s,t2s,m0] = R2star_trapezoidal(img,te,m0mode)
%
% Input
% --------------
% img : multiecho images, time in last dimension
% te : echo times (in s)
% m0mode : method to compute m0, 'default','weighted','average'
%
% Output
% --------------
% r2s : R2* map
% t2s : T2*... |
c397dadfc57813696bfecd390714b6307ed85a419f76c55a82ac98bb1b46666c | MATLAB | 1,635 | 42 | function hFill = drawFill(hA, data, config, hFill)
% data is arranged in a 3D array with the first dimension being the number
% of fills to plot, the second being the dimensions (XY or XYZ), and the
% third being the number of vertices
dataSize = size(data);
% Initialize arrays of object handles
if nargin < 4
hFi... |
1709c2a52148b4ae796c0302a63d9d0f953bcd49b7efabb8f4755d670200e10d | MATLAB | 1,636 | 56 | function [dprime,sig,dvar] = dprimespecifyvol(goods,all_SU,all_S,all_index,win,ind,V1,V2,plotit,event)
%% d' of 40/80
datpath = 'C:\Users\mld9131\Documents\GitHub\Papers\MLD\Figure2\Data';
load(fullfile(datpath,'TriColor.mat'))
for i = 1:length(goods)
S = all_S{all_index{goods(i),4}};
S.RewardAmount = convertreward(S.... |
72cb996deae5bc953e4ac109c8cf8d7662f808f63d77eaa144a3f3d28d26333a | MATLAB | 1,636 | 40 | function [rez] = recompute(rez,DATA)
%recalculate waveforms, projections and autocorrelogram
%Calculate waveforms
cluster = unique(rez.st(:,end));
M_clust = length(unique(rez.st(:,end)));
for j=1:M_clust
spike_id = find(rez.st(:,end)==cluster(j));
rez.st(spike_id,end) = j;
end
%************************... |
22dc9b74f568c89a9f1b10f73d3408c8a83d49ca218073b9b1de114807da8154 | MATLAB | 1,637 | 62 |
function [fields,snaptimes,vels,CL ] = loadSnapshotFVM(filename)
%% load FVM snapshot data
% also returns a "cell object" structure that can be used for
% processing
% later as if it was experimental data
% data = dlmread(filename);
%% updated to use readtable instead of dlmread
data = readt... |
49fab62a08a5afc5e172454a8f0275a1476c114e9125f84d53bcec08b43f0143 | MATLAB | 1,637 | 63 | function [initcond, bestfit, mse] = fit_exp_decay(x, y, iters, varargin)
%uses fmincon to fit exponential to data specified by 'x' and 'y'.
%inputs: x = vector of x values.
% y = vector of y values.
% iter = iterations of random initializations.
if isempty(varargin)
lower_bound = [-50 -50];
upper... |
9a75c1f61e73f28ee5af8195771964e21abe5f2711394feb47d427ee3c82ab2c | MATLAB | 1,637 | 61 | % # (JM) MODIFIED FROM ORIGINAL FUNCTION 'SVDStateBinary'
function [state_raster,state_pks,fac_cut] = SVDStateBinary(S,state_cut)
% Find SVD states.
% Shuting Han, 2018
p = 0.025; %significant states need to appear at least 5% of the time to be considered LCR
% do SVD on binarized similarity matrix
sz = size(S,1);
[... |
d27a69ebf783b32ae82cc42efa595d8e7e002448595063bd47699768164d6bb5 | MATLAB | 1,637 | 40 | function out = ST_Length(y)
% ST_Length Length of an input data vector.
%
% ---INPUT:
% y, data vector
%
% ---OUTPUT: the length of the time series
% ------------------------------------------------------------------------------
% Copyright (C) 2013-2026, Ben D. Fulcher <ben.d.fulcher@gmail.com>,
% <http://www.ben... |
3e025303c03ab612685d5dfbcfc2ec8ba91971204792aeedea70c8531e5d1b37 | MATLAB | 1,639 | 66 | function hm=plottetra(node,elem,varargin)
%
% hm=plottetra(node,elem,opt)
%
% plot 3D surface meshes
%
% author: Qianqian Fang <fangq at nmr.mgh.harvard.edu>
%
% input:
% node: a node coordinate list, 3 columns for x/y/z; if node has a
% 4th column, it will be used to set the color at each node.
% ... |
91b1754e1f12be7f09bf96400720b9b4434327ee7f9a4fe77f061d9fa2165098 | MATLAB | 1,639 | 61 | SphereSurf=cell(2,1);
SphereSurf{1}='Q1-Q6_RelatedParcellation210.L.sphere.32k_fs_LR.surf.gii';
SphereSurf{2}='Q1-Q6_RelatedParcellation210.R.sphere.32k_fs_LR.surf.gii';
lhgii=['/HeLabData2/ztd/0~8/Myatlas/Par_500_fslr-lh.gii'];
rhgii=['/HeLabData2/ztd/0~8/Myatlas/Par_500_fslr-rh.gii'];
%The above dir should be re... |
24511b8ed6d9e51c9c3a629f08b1b4670009317f97789b2e2756928a6b03c8ac | MATLAB | 1,640 | 45 | start_time = tic();
% Add search paths
paths = addPaths();
% Set flags
runAnalyses = false; % if false, loads pre-computed results from paths.outputs
testRun = true; % use quick-run configs (low sample sizes)
saveFigures = true; % save generated plots
% Run all analyses, if requested
if runAnalyses
% Do n... |
e64d61dde08a30501a6e4bf86cfb3a69a6b7ad80fe5d58cfcb790882eeadf91a | MATLAB | 1,641 | 63 | classdef Reshape < dagnn.ElementWise
properties
size = [0 0 0]
end
properties (Transient)
inputSizes = {}
end
methods
function outputs = forward(obj, inputs, params)
outputs{1} = vl_nnreshape(inputs{1}, obj.size) ;
% obj.inputSizes = cellfun(@size, inputs, 'UniformOutput', false) ;
... |
8c269830b115d2c7309bb39c32ce01df3c7ffc3aec2a8a89823ee0b5d2cd6511 | MATLAB | 1,642 | 37 | function plot_I_V_F_relationships(plotStructs, plotColors, figure_save, saveLocation, ...
x_param, y_param, x_axis_lim, x_axis_label, y_axis_label, x_axis_ticks, y_axis_ticks, ...
pulse_width, optional_outline_color)
fig = figure;
hold on
for iPlotStruct = 1:length(plotStructs)
plotS... |
deeee26c511a4cc6acca990298b7790a66c1a9ed10d8786bfc6155e807673efc | MATLAB | 1,642 | 69 | function [ftmf_out] = ftmf_detector(hsi_img,tgt_sig,gamma)
%
%function [ftmf_out] = ftmf_detector(hsi_img,tgt_sig,gamma)
%
% Finite Target Matched Filter
%
% inputs:
% hsi_image - n_row x n_col x n_band hyperspectral image
% tgt_sig - target signature (n_band x 1 - column vector)
% gamma - scale factor of background... |
a92a51e0a34ccd49fa18cc31bc08d26454b0287d47d72c4858dbb491c31220b4 | MATLAB | 1,643 | 59 | classdef ROIPooling < dagnn.Layer
% DAGNN.ROIPOOLING Region of interest pooling layer
% Copyright (C) 2016 Hakan Bilen.
% All rights reserved.
%
% This file is part of the VLFeat library and is made available under
% the terms of the BSD license (see the COPYING file).
properties
method = 'max'
... |
965a7401ae6c170908f1c506cfee68c583fe82d596c7bd0b27cbe331f7b3d78d | MATLAB | 1,644 | 55 |
neuralData = WholeTestResult(:, 3:end);
% Load Position Data
positionData = WholeTestResult(:, 1:2);
% Number of visits per point
numPoints = zeros(apparatus.height, apparatus.width);
for datapoint = 1 : size(positionData,1)
numPoints(round(positionData(datapoint,1)), round(positionData(datapoint,2))) = ...
... |
98566b31f20a92c1ffe116bcc2fc6f42f1c933fd9eb348764f25fd552897ad00 | MATLAB | 1,644 | 40 | function [m,dm] = meanProd(mean, hyp, x)
% meanProd - compose a mean function as the product of other mean functions.
% This function doesn't actually compute very much on its own, it merely does
% some bookkeeping, and calls other mean functions to do the actual work.
%
% m(x) = \prod_i m_i(x)
%
% Copyright (c) by Ca... |
ee38cdeb4e7c2a14801c0b818e42513787d967d27d5401e436e02ef2f2a437ae | MATLAB | 1,645 | 48 | function map = PhaseMap(positions,phases,varargin)
%PhaseMap - Compute spatial phase map.
%
% Compute phase map (e.g. for a place cell), as well as occupancy and count maps.
%
% USAGE
%
% map = PhaseMap(positions,phases,<options>)
%
% positions position <a href="matlab:help samples">samples</a>
% phase... |
f926cd83698a56522c3ddef6425a0ba1985050abd3a4f3c339baec21b0c428b4 | MATLAB | 1,645 | 65 | function img_mrtrix=tensor_model_2(gx,gy,gz)
% This script convert vector file to tensor visulization in MRtrix
% vectorFile='Average_Vn2_VectorFile.mat';
%Select eignvector
%Gradient 1, 2 or 3
%1 is eigenvector 2, 2 is eigenvector 3, 3 is eigenvector 4
%Scale factor for all values in the tensor
%Affects a... |
58a6b3b0d0d8b9f1a49683c92d71f64ffad06daa3e01125f433564de61db3d16 | MATLAB | 1,646 | 59 | classdef ROIPooling < dagnn_bc.Layer
% DAGNN.ROIPOOLING Region of interest pooling layer
% Copyright (C) 2016 Hakan Bilen.
% All rights reserved.
%
% This file is part of the VLFeat library and is made available under
% the terms of the BSD license (see the COPYING file).
properties
method = 'max'
... |
6b72b7f06ca95548370d88f717cdc1ead6bdca902e1391ba01ecf1fc21b6d399 | MATLAB | 1,646 | 56 | function [K,dK] = covCos(hyp, x, z)
% Stationary covariance function for a sinusoid with period p in 1d:
%
% k(x,z) = sf^2*cos(2*pi*(x-z)/p)
%
% where the hyperparameters are:
%
% hyp = [ log(p)
% log(sf) ]
%
% Note that covPeriodicNoDC converges to covCos as ell goes to infinity.
%
% Copyright (c) by James Ro... |
759cc07af736f24ca74caf25135a3a44b45e5e76b4c4cd1a083eda04bafd92a4 | MATLAB | 1,646 | 55 | function TIFFgenerator(folderPC,fname,frames,Idx,model,Clim,unitC)
Filename = fullfile(folderPC, [fname, '.mat']);
load(Filename);
IMname = fullfile(folderPC, [fname, '_']);
Mz=size(Data, 3);
Clim = Clim * convertToSIunit(unitC);
Clim
f = round(linspace(Idx(1), Idx(2), frames)... |
7711726595c6b43eda54128396748ad9e41b2e2b42fb5ec86772f4a70c1b8046 | MATLAB | 1,646 | 49 | function [logp, yhat, res] = tapas_condhalluc_obs(r, infStates, ptrans)
% Calculates the log-probability of response y=1 under the unit-square sigmoid model
%
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2015-2016 Christoph Mathys, TNU, UZH & ETHZ
... |
446a043d961b8e681f802908ba8c46304600121587af17ca4ae442e861ed961d | MATLAB | 1,647 | 43 | function convert_nii_to_gz(srcNii, dstNiiGz)
assert(exist(srcNii, 'file')==2, 'Source NIfTI not found: %s', srcNii);
% Ensure destination folder exists
[dstFolder, ~, ~] = fileparts(dstNiiGz);
if ~isempty(dstFolder) && ~exist(dstFolder, 'dir')
mkdir(dstFolder);
end
% Normalize... |
5102239728ddffe6e1175f26cf95b8aaa8b76e5c6d2d1fae3726a0a7139b04fe | MATLAB | 1,648 | 48 | function [postshort, postlong, pval] = wt_vs_prevDelay(A, prevrew)
% Get wait time for mixed block 20uL by whether the previous trial reward
% was delivered after a long vs short delay (bottom vs top tercile)
% rew: conditioning on previous reward volume (1,2,3,4,5); default is all
%convert rewards to ordinal (log) sc... |
6d3659bae1f63ef15c4af248c3aa8fe995fbe5122ab0b52176abe1ba1f2d658a | MATLAB | 1,648 | 44 | function getTriggers_fieldName_fieldVals(params)
% determines trials which contained the selected keyword (in params.thisCategory)
% MUST match trials 'tr' with the same keyword in trials(tr).stim_type
% saves result into respective column of 'trials_events' in each sessionCacheFile
% - rows = trials
% - values = z... |
740fc7d6b263752af1e925b48cf9a4211dd6703ce6aaf8dfc9da113cbecf55b6 | MATLAB | 1,648 | 58 | function save_simulation_results(filename, s2, s1, results, params, options)
% SAVE_SIMULATION_RESULTS - Save simulation output to file
%
% H1 Line: Save simulation data and results to MAT file
%
% Syntax:
% save_simulation_results(filename, s2, results, params, options)
%
% Description:
% Saves spike data, analysi... |
95a16dd0be4ea41da3397796a6724fe80a28553c020b7fbbcb2c036d22d1aced | MATLAB | 1,648 | 51 | function covStruct = getRespCovariance(dataStructDir, cacheFile, signalType, chPos)
% loads corresponding response data
% computes their autocovariance
% (c) Jiri, Feb12
%% load params from cache file -> used sessions
assert(exist(cacheFile,'file') == 2);
load(cacheFile, 'params');
assert(exist('params','var') == 1);... |
6e75caed77b2dfe4d31265b3007eb9126353f7a2720108369213c2dd17cf398f | MATLAB | 1,649 | 62 | function GlobalPower = compute_gfp(thedata,type)
% Update: 01.2020
% =========================================================================
%
% Calculates the Global Field Power (GFP) or Global Power Spectra (GPS) of
% a data set
%
%
% INPUTS
% - 'thedata' 2D or 3D numeric array with
% - dimension one:... |
c78c03f788b116c48ed31297f4b3887a2c221e357ef766a48c4b0d765dbcad59 | MATLAB | 1,649 | 49 | function [ output_args ] = ciftisavereset(cifti,filename,wbcommand,verbose)
% CIFTISAVERESET(CIFTI,FILENAME,WBCOMMAND,VERBOSE)
%
% Save a CIFTI file as a GIFTI external binary and then convert it to CIFTI
% with appropriate "reset" option (determined from file extension)
% applied during the conversion.
%
% CIFTI is t... |
d151ac8ea17f4e42a57df44d50c23c82ed5924f02b2555438c2de6fcebf12e6d | MATLAB | 1,649 | 63 | %% [r2s,t2s,m0] = R2sMacro(magnitude,TE,algorParam,mask,headerAndExtraData)
%
% Input
% --------------
% magnitude : multi-echo data
% TE : echo time
% algorParam : structure contains fields with algorithm-specific parameter(s)
% mask : (optional) signal mask
% headerAndExtraData : structure ... |
30dc590b8f12964bf8742f19bc6d2006e345b77736bf0f8ad099664a355123df | MATLAB | 1,650 | 58 | %{
preprocess.BehaviorSync (imported) #
-> experiment.Scan
---
frame_times=null : longblob # times of frames and slices on behavior clock
behavior_sync_ts=CURRENT_TIMESTAMP : timestamp # automatic
%}
classdef BehaviorSync < dj.Relvar & dj.AutoPopulate
... |
790e9fbbc32f4033ba28823f175d5e08375815ec6af1c96bdad1c8e0f2acd860 | MATLAB | 1,650 | 40 | function [col,patching,plotstyle] = colours_and_patches(borders,sizing)
% COLOURS_AND_PATCHES
%
% This function is used to define custom colours and consistent plot
% styles. It takes borders and sizing to define the regions of the domain
% as patches for spatial plotting
%% Custom colours
col.BBB = (1/25... |
7c71541288ff924d071a8831ce110f534dac7ff912a1b6211e33bac1349280a6 | MATLAB | 1,650 | 47 | %{
# directional tuning
-> tuning.DirectionalResponse
-> preprocess.SpikesRateTrace
-----
von_r2 : float # r-squared explaned by vonMises fit
von_pref : float # preferred directions
von_base : float # von mises base value
von_amp1 : float # amplitude of first peak
von_amp2 : float # amplitude of se... |
a2807952d26630c344d20898e146a09df76310fce53e7d920b2a7c14f1f13227 | MATLAB | 1,650 | 51 | function [img, clipVals] = mrAnatHistogramClip(img, lowerClip, upperClip, rescaleFlag)
%
% [img, clipVals] = mrAnatHistogramClip(img, ...
% [lowerClipLevel=0.4], [upperClipLevel=0.99], [rescaleFlag=true])
%
% Clips the input array values (img) so that the range of values will be
% between the pixel-count proporti... |
b6e25e69b37bff6ca9f6a274b2b6998cf7ff9b38f612547555397c593a92d253 | MATLAB | 1,650 | 39 | function AFQplot(g1,g2,fbms,bundlename)
% function PlotShadow (RangScost,Scost,Net,g1,g2,g3)
if nargin<4
bundlename= {'Left Thalmic Radiation','Right Thalmic Radiation'...
'Left Corticospinal','Right Corticospinal', ...
'Left Cingulum Cingulate','Right Cingulum Cingulate', ...
'Left Cingulum Hippocampus'... |
5c98d503ad452708bb7147e5ce7c9af7330a2e3212fd4ac32cb3fb1e2cbb22b4 | MATLAB | 1,651 | 51 | function [bestPops] = get_best_populations()
% Returns a structure with the best population for each evolved
% combination of ctype-env-criterion.
%
% Returns:
% --------
% bestPops (struct): populations.(Ctype).(Env).(criterion)
%
% load all evolved populations
% struct: populations.(Ctype).(Env).(optimisedFor = {'... |
5dbf9d083f4b4117e5b3af0a99d379f9be28301c4ec8562c58c899900510c29c | MATLAB | 1,651 | 47 | function opts = getGlobalDefaults()
% Returns a structure with default option values for Manopt.
%
% function opts = getGlobalDefaults()
%
% Returns a structure opts containing the global default options such as
% verbosity level etc. Typically, global defaults are overwritten by solver
% defaults, which are in turn ov... |
6578d822f468e20977c1f7010a987d62a36fb8f6ef971cda37689a186e8d2446 | MATLAB | 1,651 | 47 | function tpl = template(root,unknowns)
%TEMPLATE HTML Template Toolbox Constructor
% TPL = TEMPLATE returns a template object using default values for the
% root path of the template files ('.') and for the way of handling unknown
% replacement fields (default is 'remove').
% TPL = TEMPLATE(ROOT) allows to specify ... |
a79a9ab21ad17d084a701cf9dbbf000bd04a5f4f73fde27a39e7143fbc5e72f3 | MATLAB | 1,651 | 62 | %% h = sepia_handle_panel_qsm_Star(hParent,h,position)
%
% Input
% --------------
% hParent : parent handle of this panel
% h : global structure contains all handles
% position : position of this panel
%
% Output
% --------------
% h : global structure contains all new and other handl... |
ba228984b4f1155ab93cde2f4d199790a90ada8e195dc9725f089a3f05b67c78 | MATLAB | 1,651 | 47 | function Pipeline_master()
% This function serves as the master controller for the processing pipeline
addpath(genpath(fullfile('C:\Users\Person\Documents\analysis_code_directory'))); % Analysis code directory
rootDir = 'C:\Users\Person\Documents'; % Image file working directory
params.pth = fullfile(rootDir, 'Exper... |
294754f258b20746f9a1d8134348d925ec896a04615a321a8aa5029a7bb97abc | MATLAB | 1,652 | 56 | function cData = loadData(file, path)
% LOADDATA Loads data for NBSPredict. Supports .csv, .txt, and .mat files.
%
% Arguments:
% file - File name (with extension).
% path - File path (optional). If omitted, 'file' is treated as the full
% path.
%
% Output:
% cData - Loaded data as a numeric matrix (doub... |
a591619d50e2ffeb43141872920155cddf09276a714740837de4b1025f7dae6a | MATLAB | 1,652 | 49 | % Perform hierarchical clustering and color X labels according to specified groups (for Phoneme)
function F = my_dendrogram_plot(distance_matrix, myOrder, dendroLabelL, Color_val)
% Convert the distance matrix to a distance vector (upper triangular elements only)
dist_vec = squareform(distance_matrix); % 1×(n... |
efed10d6075c956170fd75ae9b74154e5a9b33af8a83b70b9d3ccdbe048e7844 | MATLAB | 1,652 | 48 | function nodal_stats(NodalStr,Age_gender,Brainsz,Pathnewxsl,opthub,Pathnewplot,Scalev1,Nname,netname,indall_select,betainitial,plotornot,fdrbon);
% %sort
Strsort=[];indstr=[];indstrre=[];re=[];
roi_num=size(NodalStr,2);
indminNodalStr=[];
indminNodalStrmdall=[];
for i=1:roi_num%60
%for i=187
Nodal=NodalSt... |
112b0888b1adaf426b8f575878add4e7b1fcfc22b8e0d9f5b4ca677891ca4d80 | MATLAB | 1,653 | 41 | %% =============================
% PALM Analysis: Acquisition CS
% =============================
% --- Locate repo root (relative to this script)
thisfile = mfilename('fullpath');
[scriptdir, ~, ~] = fileparts(thisfile);
cd(scriptdir); % Ensure consistent working dir
% Navigate up to FEARTUS root
repo_root = fullfi... |
14f47d52562aeedc7b5d43d45b8bf6d0707db821e2dbdef55439bfed48b3a927 | MATLAB | 1,653 | 56 | function [ output_args ] = CORE_ASSEMBLY_DETECTION( SPIKE_PROBABILITY_RASTER_file )
%CORE_ASSEMBLY_DETECTION( SPIKE_PROBABILITY_RASTER_file )
%
%
% === Jan Moelter, The University of Queensland, 2018 ===================
%
narginchk(1,1);
fprintf( 1 , [ '\n' ] );
timerVal = tic;
%% > PRINT FUNCTION-CALL
if( isdepl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.