sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ffa1dcdf5c064e929137ef2da29ceeb48af4bdb269d914445065014feb0d4c0d | MATLAB | 1,928 | 61 | function Meta_Multivariate(MC_Setup,DB,imgname)
% -----------------------------------------------------------------------
% Prepare data matrix
% Needs: MC_Setup.unweighted_study_data, 'Activation_FWE_all.img' in
% current directory
% -----------------------------------------------------------------------
disp('Prep... |
379059e41052cc572c18d9100c8f08b27a0140680a1c94e1f7ef6db8b6ff9632 | MATLAB | 1,929 | 49 | function [ClasScor sensi speci accur auc] = TMSGFCClass(CCmatrix,NumG1)
left_mat2 = CCmatrix ; % it is a 'coefficient' by 'subj number' matix
NumG1 ; % it is the number of group1, usually the control group
for leftout =1 : size(left_mat2,2)
% fprintf('\n Leaving out subj # %6.3f',leftout);
% leave ... |
8e08e33c3c069b8bf3fdc765f1b503d0d6b7d354842dead08a7213d3a609cb55 | MATLAB | 1,929 | 50 | function [SpikePhase,PhaseMean,MeanLength,PVal,PhaseLock] = LFP_PhaseLock(LFPData,SpikeLoc,WavFreq,Wav)
%% Calculate LFP phase for each spike using each of the supplied wavelets
%
% Inputs
% LFPData -- local field potential data for a single channel
% SpikeLoc -- corresponding locations of the spike... |
9d24aa57d9d5123b9d1670372243921dc4e1b5591c963d5125a35f998793a4c0 | MATLAB | 1,929 | 48 | function [lp,dlp] = priorLaplaceMulti(mu,s2,x)
% Multivariate Laplace hyperparameter prior distribution.
% Compute log-likelihood and its derivative or draw a random sample.
% The prior distribution is parameterized as:
%
% p(x) = exp(-sqrt(2)*sqrt(r2))/sqrt(det(2*s2)),
% where r2(x) = (x-mu)'*inv(s2)*(x-mu... |
faa16dbbca3bde22ad5737cd8b796a7589fa90b6b851b5cd032770ab25203d0d | MATLAB | 1,930 | 62 | function tests = test_jsonwrite
% Unit Tests for jsonwrite
% $Id: test_jsonwrite.m 7526 2019-02-06 14:33:18Z guillaume $
tests = functiontests(localfunctions);
function test_jsonwrite_array(testCase)
exp = {'one';'two';'three'};
act = jsonread(jsonwrite(exp));
testCase.verifyTrue(isequal(exp, act));
exp = 2;
act =... |
12cf8efece48af90b52c08e3fad1afe15132e59e8e82231da84292fd9ce9771f | MATLAB | 1,931 | 50 | % CELLTOMAT - convert cell array to matrix
%
% Usage: >> M = celltomat( C );
%
% Author: Arnaud Delorme, CNL / Salk Institute, Jan 25 2002
%
% Note: This function overloads the neuralnet toolbox function CELLTOMAT,
% but does not have all its capacities. Delete this version if you have
% the toolbox.
% Copyright (C) ... |
53affc4d1478bd06b96ebe0f997147b02e114622048a62ee3bf073ee47040f06 | MATLAB | 1,931 | 73 | function [top_int, bot_int,X] = regression_line_ci(alpha,beta,x,y,varargin)
%[TOP_INT, BOT_INT] = REGRESSION_LINE_CI(ALPHA,BETA,X,Y)
%creates two curves marking the 1 - ALPHA confidence interval for the
%regression line, given BETA coefficience (BETA(1) = intercept, BETA(2) =
%slope). This is the format of STAT... |
78b2ed4d5f375578bcf09e988ce7a91ce00d861614c89abfb6f0b5762e82f56d | MATLAB | 1,931 | 51 | function [data] = GetDetails(data) % by Julia Becker, 01/04/2020
%GETDETAILS Tries to retrieve animal number, setpoint, speed, orientation
% from the path
for i = 1:height(data)
pathparts = strsplit(data.folder{i}, filesep);
pathparts = pathparts(1, end-2:end-1);
pathparts = strjoin(pathparts, '_');
... |
a45527f5370e5a4a480f526fa11b3bc759689335e0c2bd950095411763e7b70c | MATLAB | 1,931 | 62 | function [output,options]=bpAssistMoco(input,varargin)
% perform motion correction in 2 steps, with a band-pass spatial filtering
% first. User can input as a variable arguemnt a computed shift
options.findBestBP=false;
options.vectorBandPassFilter=[2 20];
options.applyshit=[];
options.windowSize=1000;
options.spatial... |
41f5a0855ce37a44694f938462e8b92564f63c589db97dd77c1a31f6fdeac1ad | MATLAB | 1,932 | 60 | function g=gaussian_nk(FWHM, nSamples, x, mu, mass)
% USAGE
% g=gaussian_nk(FWHM[, nSamples, x, mu, mass])
%
% FUNCTION
% returns a row-vector gaussian of full width at half maximum FWHM.
% nSamples is chosen automatically unless it is passed as an
% argument. if the other params are unspecified... |
b34abad3a2cc210910d1107ae4cb0b6f94b623e2d018e975ecce98bde4826485 | MATLAB | 1,932 | 51 | function [cpred,Sw,L,K] = classify_lda_KclassesQuicker(xtrain, ctrain, xtest,regularization)
% Multi-class classification using linear discriminant analysis
% without prior!!!!
% INPUT:
% xtrain : training set, p*ctr matrix with c datapoints in p dimensions
% ctrain : 1*ctr vector with class labels corresponding t... |
b377617c717cfd30cef3b1332b4e9e3a6628e75ac7f84f5c21ccc67dc649ad06 | MATLAB | 1,932 | 59 | %% [h_text,h_edit] = sepia_construct_text_edit(parent,fieldString,defaultValue,pos,subratio)
%
% Input
% --------------
% parent : parent of the constructs
% fieldString : text to be displayed in the 'text' field
% defaultValue : default value in the 'edit' field
% buttonDisp : string or image displayed in... |
23f8133cb952578d1faa9c2692ecc6e0c2a26dbe08a0d0da06ac3a77c8ee3701 | MATLAB | 1,934 | 102 | function [theta, ptheta] = tapas_sem_trapp_init_parameters(n_nodes)
%% Generate the matrices neccessary for the model.
%
% Input
% n_nodes -- Number of nodes
%
%
% Output
%
% aponteeduardo@gmail.com
% copyright (C) 2017
%
DT = 1.0; % One millisecond
% Input
T_FIX_OFF = 200;
T_EX_ON = 500;
T_EX... |
348f2f7a7edaac2fbb6b77a2b29a8df4bf6755ba2c4d78a340e840078cf317f4 | MATLAB | 1,934 | 46 | % eventalign - function called by POP_IMPORTEVENT to find the best
% sampling rate ratio to align 2 arrays of data events.
%
% Author: Arnaud Delorme, SCCN/INC/UCSD, Dec 2003
% Copyright (C) Arnaud Delorme, CNL / Salk Institute, 9 Feb 2002, arno@salk.edu
%
% This file is part of EEGLAB, see http://www.eeg... |
cecb79be2bba0e475d73f86281d9e51d2c3a46fb6acdfc77a131fedf9a882fdf | MATLAB | 1,934 | 63 | function [ epsilon ] = bold_gen( obj, theta, data, inputs, hemo, R, L, idx )
% Generate predicted fMRI BOLD time series..
%
% This is a protected method of the tapas_Huge class. It cannot be called
% from outside the class.
%
% Author: Yu Yao (yao@biomed.ee.ethz.ch)
% Copyright (C) 2019 Translational Neuromodeling U... |
edc6f66b6ea5539dc9f1652dab0724946c18be211e8db67ab375741653ff16ce | MATLAB | 1,935 | 81 | function DBRemoveVariables(query)
%DBRemoveVariables - Remove all variables that match given criteria.
%
% Actual removal will require confirmation from the user.
%
% USAGE
%
% DBRemoveVariables(query)
%
% query optional figure list query (WHERE clause; see Example)
%
% SEE
%
% See also DBAddVaria... |
0e36828deb4cf1dbcf391914bdea3c16937116db8620927ddf1462dc862b98e6 | MATLAB | 1,936 | 69 | function plot_fig2f(datadir)
% Plot average event-aligned dopamine release split by reward port side.
% Signals are z-scored and baseline corrected before pooling across rats (N = 10).
%
% INPUTS
% datadir: file path of data downloaded from Zenodo. Link to download can
% be found in README.
basedir = fullfile(datadir,... |
3b6e5a2f615788a23483999b55dfea20b52f3f3735b1aac82b7bbf09ba159665 | MATLAB | 1,936 | 71 | function [det_out,varargout] = img_det(detector_fn,hsi_img,tgt_sig,mask,varargin)
%
%function [det_out,varargout] = img_det(detector_fn,hsi_img,tgt_sig,mask,varargin)
%
% wrapper to use array based detector as a image based detector with the given mask
%
% Taylor C. Glenn - tcg@cise.ufl.edu
if ~exist('mask','var'); ma... |
6db1454d6dee421f5744e0e1a708dc499a40caef8c94297e64b67ac7245df70b | MATLAB | 1,936 | 49 | function [pval, beta, goods, Y] = screen_perf(S)
%input: S struct, obtained from mysql.
%outputs:
%p-value of slope coefficient for regression model relating wait time to
% reward volume, for each session.
% beta is slope coefficient.
% goods is a vector the sessions in which the animal's performance
% surpassed... |
7f3aec7e0fc17eec5acac4fa76e2b20cec69faa05a235438f3d58672fdfa2ddf | MATLAB | 1,936 | 62 | function BrainNet_GenCoord(filename,outputfilename, regions)
% BrainNet Viewer, a graph-based brain network mapping tool, by Mingrui Xia
% Function to generate node file from voxel-based template
%-----------------------------------------------------------
% Copyright(c) 2015
% State Key Laboratory of Cognitive Ne... |
af62b01dee550bce0d4212943b01ddc834a7983db981a3d09a2da6df878a5f66 | MATLAB | 1,936 | 64 | function previousPaths = init_processing_step(this, method, otherImages)
% Saves nii-files used by matlabbatches for SPM for different processing
% steps
%
% NOTE: as a side effect, the paths of all given images will be temporarily
% set to the sub-folder 'raw' of the calling MrImage path
% (this will be undone by fini... |
9e60f10371c85f8f3b7289c2391970f9ede83d3e5cf70b3af478ca19ffd4fb61 | MATLAB | 1,937 | 47 | function iszscored = BF_iszscored(x)
% BF_iszscored Crude check for whether a data vector is z-scored.
%
% (~eps-close to being) z-scored.
% Used for displaying warning messages for functions that require z-scored inputs.
%
%---INPUT:
% x, the input time series (or any vector)
%
%---OUTPUT:
% iszscored, a logical with... |
dda5b539f9ea26cfa79d262ef3f6a1b91d9e65b606340f49e0fdc6208a3048bf | MATLAB | 1,937 | 76 | function freesurfer_asc_save(fn, v, f)
% Saves a surface to freesurfer ASCII format
%
% FREESURFER_ASC_SAVE(FN,V,F)
% INPUTS:
% FN: Filename to save surface to
% V: 3xP (or Px3) vertex coordinates
% F: 3xQ (or Qx3) indices of faces referring to vertex coordinates
% (F can be either base0 or bas... |
848c259eb65d3d6d492cb339836990978bb55bc48f82fe742e58e89d73b09a17 | MATLAB | 1,938 | 94 | function fn_par = sero_srr_nii2fit_voxel(nii_fn, xps_fn, mask_fn, reg_str, do_t1, mode, new_nii, opt)
%function fn_par = sero_srr_nii2fit_voxel(nii_fn, xps_fn, mask_fn, reg_str, do_t1, mode, new_nii, opt)
if isempty(xps_fn) || nargin < 2
xps_fn = mdm_fn_nii2xps(nii_fn);
end
if isempty(mask_fn) || nargin < 3
... |
84e7b636cfd04d090dc76408d57cde0602daf66652faa47bd0eaa224de3fc1e5 | MATLAB | 1,938 | 45 | %% Creating imrpoved hybrid image (T1w+QSM) by matching DGM contrast accurately to the hybrid atlas
% Dependencies: (1) SEPIA v1.2.2.4
% Data: (1) ABRIM dataset (https://doi.org/10.34973/7q0a-vj19) (2) MuSus-100 (https://doi.org/10.1007/s00429-022-02547-1)
% Created by Kwok-Shing Chan
% Date created: 16 June 2025
%
fun... |
db7d7412a134c27b9d9873a282515a978737e1c3d7a9c71d75cbdc5322ecfb83 | MATLAB | 1,938 | 64 | clear; clc;
addpath(genpath('utilities'));
disp(['begin reading file...']);
folder = './';
% filename = '200217-504B-20xpAceR(P40)-F02-01-10s-spon-50_pwr.tif';
% filename = '200721-433B-pAce-F01-01-1x5s-VIN.tif';
filename = '200623-085C-2pAce-F04-02-1x5s-EtA_CS+.tif';
data = aux_stackread([folder filename]);
% Den... |
31a9442a778485c5e21e2f5dc19f167943b83ef1b941eddffe60e33131f276c7 | MATLAB | 1,940 | 91 | function [TTL]=sh_TTLextraction(Swave,Fs)
[b,a] = butter(3,band/(0.5*Fs),'bandpass');
A=filtfilt(b,a,arrayBL(:,:,Nch));
B=filtfilt(b,a,arrayOB(:,:,Nch));
wnd=0.5*Fs; % window of 0.5 sec
ovl=0.90; % 90% overlap
bpwOB=[];
bpwBL=[];
for k=1:1000 % should be large enough
if (round(k*wnd-(k-1)*wnd*ovl,0)>=size(arrayB... |
2de0d34f8c9911dc98a3113c466501e31d1545ba10deeb03e30e34efdccb652d | MATLAB | 1,942 | 58 | function obj = get_error(obj, test_class)
% obj = get_error(obj, test_class)
%
% This function returns three kinds of error rate.
% b_err is the balanced misclassification rate.
% t_err is the total (overall) misclassification rate.
% p_err is the class probability err
%
% Misclassification rates
% -------------... |
98674a614217847c7b097dee1c9da910fe7d1683230cbef137ce0e37cf1a663f | MATLAB | 1,942 | 47 | % GETHASHCODE - get hash code for input array
%
% Usage:
% >> md5code = gethashcode(array);
%
% Inputs:
% array - array of number. gets converted to double.
%
% Output:
% md5code - MD5 output code
%
% Author: Arnaud Delorme, 2015-
% Copyright (C) Arnaud Delorme, arno@salk.edu
%
% This file is part of ... |
c395e452340a0db262bb4c064e6cafd4df4120d6144a68864e8a839ca52e20f5 | MATLAB | 1,942 | 57 | function ni = niftiRead(fileName, volumesToLoad)
% Matlab wrapper to call the mex readFileNifti
%
% niftiImage = niftiRead(fileName,volumesToLoad)
%
% Reads a NIFTI image and populates a structure that should be the
% NIFTI 1 standard
%
% If volumesToLoad is not included in the arguments, all the data
% are returned.... |
c8fe57defc9fbd822a38edd888fd4356438200fcae0c66d49398ee2f32a7f651 | MATLAB | 1,942 | 77 | function prob=pca_dim(lambda,N)
% PCA_DIM Automatic choice of dimensionality for PCA
%
% Laplace approximation and subsequernt simplifications to the
% posterior probability of the Data being generated from hidden var's
% of dimensionality k
% Methods described in
% Thomas Minka:
% Automatic ch... |
f52a293613f6ba53b3133517eccaf5d91a2ed69f3ff7bbba6ada9ba132bec106 | MATLAB | 1,942 | 58 | function fh = tapas_physio_plot_raw_physdata_siemens(dataPhysio)
% plots cardiac data as extracted from Siemens log file
%
% fh = tapas_physio_plot_raw_physdata_siemens(dataCardiac)
%
% IN
% dataPhysio output struct from tapas_physio_siemens_table2cardiac
% OUT
%
% EXAMPLE
% tapas_physio_plot_raw_physdata_sie... |
6176b81549604d023f6d0077c7cf31997bddbd8bf5ad35a537fab80f65cca6e1 | MATLAB | 1,944 | 43 | function [nirs, qualityMatrices, windowInfo] = pruneChannels(nirs, params)
% Master function for pruning low-quality channels from the NIRS data.
% Detects motion artifacts, applies initial channel pruning using Homer,
% then either applies QT-NIRS or coefficient of variation (CV) pruning
% methods based on the spe... |
94c49d36a6cc5ccd11e4496564cd4310fc82b0e1da0f694a509d274782510040 | MATLAB | 1,944 | 66 | function [ox, otheta, ollh, olpp, v] = tapas_ti_step_mh(y, u, ox, otheta, ...
ollh, olpp, ptheta, htheta, pars)
%% Estimates the posterior probability of the parameters using MCMC combined
% with path sampling.
%
% Input
% y Saccade data.
% u Experimental input.
% ptheta Priors of the model
% h... |
c0874f5ac8f8fbcf46cf3cbd838dfdc530dfb9ea3dd7c307f93de1eed22fe14d | MATLAB | 1,944 | 54 | function Dat = removeOptOut(Dat)
%function to remove optouts easily from data, keeping indices of the S
%struct and handles consistent
%not exhaustive for masking Dat data. currently only converts what is
%needed for GLM fits and parsing stimuli
%find hits
[~, ~, hits, ~] = parse_choices(Dat.S);
prev_hits = [nan;hits... |
2cec98ebdde94ccd8adbdceca02566ec5ed3d190d799343d8465020e06955aea | MATLAB | 1,945 | 72 | %% Generate Figure 6A
% This script visualizes the 3D structure of macro- and microstructural
% parameters in the superior temporal sulcus (STS).
% Example data for one participant is located in the data/Figure_6a folder.
% NOTE: This script assumes the repository is located at ~/Downloads/infant_sulcalmorphology
... |
6a74c06edb84c8c1adc669bfdf6e7ea8cfe47af3402793ce973e2f9949c871cf | MATLAB | 1,945 | 67 | function plot_fig2ab_xcorr(datadir)
% Plot cross-correlation of rat-averaged dopamine and acetylcholine
% signals at the offer cue on 40, 80uL trials in mixed block (left) and at
% the reward cue on different reward delay quartiles (right).
% N = 10 DA rats, N = 10 ACh rats
%
% INPUTS
% datadir: file path of data down... |
cb1c107f83731c09aa10f2e9e6caacd37f9de8ede7a7c3b8dd33cf3036a09dec | MATLAB | 1,945 | 54 | function soa_allCh = ch2roi_soa_trialsData(params)
% TBD (now=Oct23)
% returns significance of activations (soa) from trialsData
% at selected frequency bands for all channels
% (c) Jiri, Nov22
%% list of frequency bands -> list_FB
list_FB = params.soa.selFB;
%% cache file
if ~isfield(params.soa, 'outDir')
cach... |
f1a77e0c5d68611b95b988c4381e352a40412d2a1d3f35a1b5fa48e7afb83803 | MATLAB | 1,945 | 69 | %% weights = sepia_utils_compute_weights_v1(fieldmapSD,mask)
%
% Input
% --------------
% fieldmapSD : standard deviation of fieldmap
% mask : signal mask
%
% Output
% --------------
% weights : weighting map
%
% Description: Weights for QSM inversion, median
%
% Kwok-shing Chan @ DCCN
% kwokshing.cha... |
55e84b4759b6e9136398d1a50800d33a46f088e71c11781161f049fe4a1a7353 | MATLAB | 1,947 | 62 | function [funcs] = tapas_sem_get_model_functions(model, param)
%% Return the functions associated with a model.
%
% Input
% model -- String. Either seria or prosa
% param -- String. The name of a parametric distribution.
% Output
% funcs -- Struct. A structure of function handles.
%
... |
f410a29731718efc14b1bf41c10e6912d90afad83d801786756fc6d2e3d8dfee | MATLAB | 1,947 | 58 |
% modulation index
mypath = '/Users/bo/Documents/data_liujia_lab/manuscript_gridcell3hz/analysis_liuP1_greeble';
timeFile = fopen([mypath, '/MRI_result_sinusoid/mean_orientation_para3_subj_sub1_35_Vector_Mean.txt'],'rt');
table_time = textscan(timeFile,'%s %s %s');
fclose(timeFile);
data_fhpc = zeros(length(table_t... |
f9b3f85060e7a3088597ea898608e80d1190d39e2d81e45ae3ec8465f5ce4390 | MATLAB | 1,947 | 92 | function [err,Loc] = FindChar (C, cfnd)
%
% [err,Loc] = FindChar (C, cfnd)
%
%Purpose:
% find certain characters in an array of characters, or a string
%
%
%Input Parameters:
% C : an array of characters or a string
% cfnd : the character you'r looking for like 'f'
% pass the following for special characters... |
4e7b049485803544a716589d1d47808143323077c1179136734eec484e02038c | MATLAB | 1,948 | 48 | function worked = tapas_test_in_environment(logfile,toolbox)
% TAPAS_TEST_IN_ENVIRONMENT run test in separate environment
%
% IN
% logfile [character]
% Logfile to print output to.
% toolbox [character]
% Toolbox to test. If empty, all toolboxes will be tested.
%
% Authors: Matthias Müller-Schrader & ... |
5fb1e7084b832ab5c201e33e9bd370602fdf3163e00d3c59d87d65035e841cb3 | MATLAB | 1,948 | 55 | %{
pre.MaskCoordinates (computed) # mask center of mass of a segmented cell
-> pre.SegmentMask
-----
xloc : double # x location in micro meters relative to the frame start
yloc : double # y location in micro meters relative to the frame start
zloc : double # z location in... |
b7b364dc98ebe0558e1613164c6bc0782c112cdecac5e41fbf243a8ccbc80a17 | MATLAB | 1,948 | 65 | function img = fillAllHoles(img, dilationSize, dims)
%FILLALLHOLES Fill all holes in a binary image.
%
% DESCRIPTION:
% fillAllHoles fills all holes in a binary image using the following
% approach:
% 1. Dilating the image by dilationSize
% 2. Filling holes by sweeping over 2D planes in the dire... |
1028680b35b2afe8409401cbc1069d5c9d563eac7ef2b1f1171ae74c378d2aaf | MATLAB | 1,949 | 62 | % findboundaries() - Find boundaries (data discontinuities) in event
% structure of continuous EEG dataset
%
% Usage:
% >> boundaries = findboundaries(EEG.event);
%
% Inputs:
% EEG.event - EEGLAB EEG event structure
%
% Outputs:
% boundaries - scalar or vector of boundary event latencies... |
3eb62d504a201603c026c1b92e3b2804adf0405c4912c6c6255a73e3b4d244b9 | MATLAB | 1,949 | 47 | function out = SC_FastDFA(y)
% SC_FastDFA Matlab wrapper for Max Little's ML_fastdfa code
%
% Measures the scaling exponent of the time series using a fast implementation
% of detrended fluctuation analysis (DFA).
%
% ---INPUT:
% y, the input time series, is fed straight into the fastdfa script.
% The original fastd... |
ad9b3560da3ad30641a49c3be50b7c5b920320208f83b464f3745a9dfa1e02da | MATLAB | 1,949 | 54 | function hMarkers = drawMarkers(hA, data, config, hMarkers)
% data is arranged in a 3D array with the first dimension being the number
% of unique skeletons to plot the second being the XY or XYZ values,
% and the third being the number of markers to create the skeleton out of
% If the third dimension has only two ind... |
c99b326d78a3476720d091b65e30e832e534467a8605c062ca1f4f1c8bf12d43 | MATLAB | 1,950 | 43 | function [fit, FitQuality] = summarize_results(fit, gof, output, sz, Model)
%summarize_results(fit 'struct', gof 'struct', output 'struct', sz 'double')
%'double', Model 'string')
% extract quality paramters for final fit and summarize them in FitQuality
% also calculates missing fraction from fitted ones
%
% fit ... |
19371e19096587a1dd4908903069c0708e881e23719bddc17bf1f2cb2696ac1d | MATLAB | 1,951 | 64 | function varargout = ft_info(varargin)
% FT_INFO prints an info message on screen, depending on the verbosity
% settings of the calling high-level FieldTrip function.
%
% Use as
% ft_info(...)
% with arguments similar to fprintf, or
% ft_info(msgId, ...)
% with arguments similar to warning.
%
% You can switch of ... |
1340db06d45dae76c93581d21d9de14e07b81d8dc9bf000e413b982c2c0c49f9 | MATLAB | 1,952 | 60 | %% mask_r2s_morph = refine_brain_mask_using_r2s(r2s,mask,voxelSize,min_open,min_close)
%
% Input
% --------------
% r2s : R2* map
% mask : brain mask
% voxelSize : spatial resolution of the input data
% min_open : minium radius for imopen operation
% max_close : minium radius for imclose... |
66411a7954db4d5f080284c0ac80ab42ef34d7417554e1476b13e72e2053ecc2 | MATLAB | 1,952 | 53 | function overlap_table(OUT)
% function overlap_table(OUT)
%
% prints table from output of cluster_overlap_npm.m
% tor wager
fprintf(1,'\nMonte Carlo test on spatial overlap of clusters\n')
fprintf(1,'Omnibus: \tobs = %3.0f voxels\t, exp = %3.2f voxels\t, p = %3.4f\t\n', ...
OUT.obs_o1, mean(OUT.o1), sum(OUT.o1 >... |
c60c42f03534a9e874d0e8304cf4f818ed71de4dc5fb14f376a314e8c52963fe | MATLAB | 1,952 | 47 | % Plugin support function to remove plugin
% Copyright (C) 2012- Arnaud Delorme
%
% This file is part of EEGLAB, see http://www.eeglab.org
% for the documentation and details.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are... |
615b02938445d82e8a63df5c84adea38e70f4934d0282d2fca30fecbebdc7247 | MATLAB | 1,953 | 75 | function [data_dtr]=runPhotoBleachingRemoval(data,varargin)
% temporal detrending of fluorescence movie using lowpass method by default. Sampling Rate must be pass through
% [data_dtr]=runPhotoBleachingRemoval(data,'samplingRate',Fs)
% All options arguments:
% options.methods='lowpass'; %could be exp or spline
% optio... |
c60a97340fd8a74b323062ee44ff427fba9fef32cc065aec8b8fd4443aa9a689 | MATLAB | 1,954 | 48 | function y_buffer = BF_MakeBuffer(y,bufferSize)
% BF_MakeBuffer Make a buffered version of a time series
%
% y_buffer contains segments (rows) of length bufferSize (columns) corresponding
% to consecutive, non-overlapping segments of the series of length bufferSize
% ------------------------------------------------... |
da6beabd015182bcf1167abe945ab74699f7a214203767e6d2b85cb62f9f5839 | MATLAB | 1,954 | 54 | function B = design_fir(N,F,A,nfft,W)
% B = design_fir(N,F,A,nFFT,W)
% Design an FIR filter using the frequency-sampling method.
%
% The frequency response is interpolated cubically between the specified
% frequency points.
%
% In:
% N : order of the filter
%
% F : vector of frequencies at which amplitudes shall be... |
4303bc295219b1bbf8a5c43525ccc4daf32da2050a0f588d6e637389423eb9b7 | MATLAB | 1,955 | 52 | function E = dynamicMiniEnergyDisruptOrder(A,B,delta_t,x0,xf,r_time)
% Calculate the minimum dynamic control energy before and after disrupt
% the snapshort order
% Wm = \int_{0}^{T} e^{A_m t}BB^Te^{A_m^T t}dt
% W = diag(W1, W2, ..., WM)
% S = (\prod_{i=M}^{2}e^{A_i\Dleta t},...,
% \prod_{i=M}^{t+1}e^{A... |
ba258444d661ec8310daa9adfff55c66abd374ba23d96ec02d751cc2900adb91 | MATLAB | 1,955 | 71 | % This example shows different cases of tensor maps forming shapes
% Author: Aina Frau-Pascual
imx = 19;
imy = imx;
%%
% Input image isotropic
im = zeros(imx, imy, 2, 2);
im(:,:,1,1) = 0.2;
im(:,:,2,2) = 0.2;
fa = sum(sum(im,4),3);
% Compute
[meshstruct, D, M, RHSbc] = computeDiffusionMatrix2D(im, [imx, imy]);
[pote... |
f57d4582d80f2e024b76906caa8d254371d21f94b4b8230ef9d6d647c7ae8f39 | MATLAB | 1,955 | 61 | function outputImage = remove_dims(this, iDim)
% removes dimension(s) specified (by names or index)
%
% Y = MrDataNd()
% Y.remove_dims(iDim)
%
% This is a method of class MrDataNd.
%
% Use cases are the selection of single values from one dimensions to lose
% all information on the specified dimension
%
% IN
% iD... |
212ceb37d9bff4f3dd9d8dcdf481903497c82ec143bc6309334d05eaa64f3c30 | MATLAB | 1,956 | 59 | function [C] = iem_trialwise_pca(data,angs,angspace,foldvar,npcs)
% [C] = iem_trialwise_pca(data,angs,angspace,foldvar,npcs)
nChan = length(angspace);
ntime = size(data,3);
nsens = size(data,2);
ntrl = size(data,1);
% set up reverse encoding model parameters (i.e., design matrix)
cosfun = @(th... |
56377162f619976707d6839c2dad3cf27d00216e72bacda33ea698d4a5bedb2b | MATLAB | 1,956 | 64 | function y = tapas_logrt_linear_binary_sim(r, infStates, p)
% Simulates logRTs with Gaussian noise
%
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2016 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released und... |
dc451beb183a55188ac26fec79d10a96a0b7282d4d2d7920a29f7159afd501fb | MATLAB | 1,956 | 42 | % Undistorting single images from resonant scanning
function Undistorted = undistort(Distorted,zoom)
X = double(Distorted);
imwidth = size(X,2);
f_res = 7.91e3; % resonant scanning frequency
dutyCycle = 12.5e-9*4096/(1/2/f_res); % percentage spent acquiring
t_end = (1/2/f_res);
tx_start = (t... |
6cfe7bb8a655ba0522b96dee6ef7e3affe24318cc4c3b4a51ec4452ce0e9e1b4 | MATLAB | 1,957 | 55 | function r = funceval(f, varargin)
%FUNCEVAL calculates the value of the function f at the face variable phi
% f must be able to accept matrices
% f: function handle
% phi: input to the function f
% r: output of the function f
% f can handle 3 input phi variables, but they should all be of the same
% class
%
% SYNOPSIS... |
1a77b7e1d127b98973fd68d6eaec6ac329f38924bffdd036e892e923a2141ae6 | MATLAB | 1,958 | 73 | function xs = surrogate_data(x,shuffle,smoothspect)
% function surrogate_data - produces random data with a specific auto-correlation
%
% syntax: xs = surrogate_data(x)
% xs = surrogate_data(x,shuffle,smoothspect)
%
% Input:
% x: template data
% xs: surrogate data, produced by phase-shuffling in x, which has ... |
513210b48d6eea48bf2d67c3c4ffe86024b0f1315a78aae9c754f1c1ab949ab5 | MATLAB | 1,958 | 61 | %% [r2s,t2s,m0] = Wrapper_R2s_Trapezoidal(magn,mask,matrixSize,voxelSize,algorParam,headerAndExtraData)
%
% Input
% --------------
% localField : local field map (tissue fields), in Hz
% mask : signal mask
% matrixSize : size of the input image
% voxelSize : spatial resolution of each dimension of th... |
7ca9eb75f2982eb5fc61d8bb98bf134888e2dfe06772658d0487120342de3f08 | MATLAB | 1,958 | 63 | %isdmatrix - Test if parameter is a matrix of doubles (>= 2 columns).
%
% USAGE
%
% test = isdmatrix(x,test1,test2,...)
%
% x parameter to test
% test1... optional list of additional tests
%
% EXAMPLES
%
% % Test if x is a matrix of doubles
% isdmatrix(x)
%
% % Test if x is a matr... |
2f0db7986948654bccad07a857028b6aa9a69cada6101847444a0465a21f3dd5 | MATLAB | 1,959 | 64 | function [CC,NN] = covm_simplified(X,Y)
% COVM generates covariance matrix
% X and Y can contain missing values encoded with NaN.
% NaN's are skipped, NaN do not result in a NaN output.
% The output gives NaN only if there are insufficient input data
%
% COVM(X);
% calculates the (auto-)correlation matrix of X
% ... |
0657c48a94447e1029c54915f6bb8299d035932b54a153bb9b34ee831f8b0c3a | MATLAB | 1,961 | 48 | %% This document shows the manual drawing of a "nsdgeneral" ROI on the fsaverage surface.
%% This atlas ROI is saved as lh and rh .mgz files to the fsaverage/label directory.
% NOTE: this relies on the creation of *.b3R2.mgz which is done by junk/examples_funcviz.m
%% Plot R2 values
% Load surface-based R2 data (c... |
b6e91f844e66dd7d8d2a55816d65874842cc895c898d4a0c149ca2e292191324 | MATLAB | 1,961 | 48 | %% function unwrappedField = UnwrapPhase_3DBestPath(wrappedField,mask,matrixSize)
%
% Input
% ----------------
% wrappedField : wrapped field map
% mask : brain mask
% matrixSize : images matrix size
%
% Output
% ----------------
% unwrappedField : unwrapped field
%
% Descrip... |
d54b7abd0b1d9b90f55bb1b19e9fd65024c8b788deb6c913073586095ac6bb1e | MATLAB | 1,961 | 59 | function A = splitData(A, nsess)
% Pulls out specific trials from behavior structs
sessions = 1:nsess;
totalT = sum(A.ntrials(1:nsess));
bad = 1:find(A.trainingstage(1:totalT) < 9, 1, 'last'); %remove trials from early training stages before blocks are introduced; only happens in the first session
ns = cumsum([1; A.nt... |
4108a3a56b6e90f3757cec67e356aa4b69c2298f8c89e260d4713797d6954f0d | MATLAB | 1,962 | 51 | function mapHandler(src, evt)
% function mouseHandlerHeatMap(src, evt)
%
% Is triggered when the mouse is clicked in the HeatMap figure. Reads
% the current mouse position, translates it to a sensor ID and plots
% (if matches unit in sta data) its SpikeSorterUnit plot into a separate
% figure
%% PARAMETERS
... |
59253dbd20b49e1638ef4b7cef8466cd2901fe75534b7012ff1a49f53e5432ca | MATLAB | 1,962 | 60 | function [rez]=Remove_S(rez,Threshold)
%Variable initialization
SF = rez.ops.fs; %sampling frequency to convert from sampling rate to second
Nclusters = length(unique(rez.st(:,end))); %Number of initial clusters from kilosort
NG_clus = Nclusters; %Number of clusters
nt0... |
91bd58eb5773f6f92257ab7b5659dcfe464555717ab4d9e578e47fa2b8265a16 | MATLAB | 1,962 | 63 | % inherit from analysis_drawrois_facesandwords.m
% these images are our final inspections and quality assessments
%%%%% first, go back to _part02.m and do some manual ones:
do the following:
angle (4), q
ecc (5), o,
kastner (3), q
eccroi (9), q
filenames:
subj01_prf-visualrois_on_angle.png
subj01_prf-eccrois_on_ec... |
ef7523009e6d1cb31c54571f255decbdb4581897fbd8161ddb7f2be8d2762cea | MATLAB | 1,962 | 52 | function BF_RecolorDendrogram(h_dend);
% BF_RecolorDendrogram Recolor a dendrogram using hctsa default colors
% ------------------------------------------------------------------------------
% Copyright (C) 2013-2026, Ben D. Fulcher <ben.d.fulcher@gmail.com>,
% <http://www.benfulcher.com>
%
% If you use this code f... |
4e65068b01d62d5da56a821a282e534b65dc3b07068c8e35393ced980b28b59e | MATLAB | 1,963 | 63 | function [Q, R] = orthogonalize(M, x, A)
% Orthonormalizes a basis of tangent vectors in the Manopt framework.
%
% function [orthobasis, R] = orthogonalize(M, x, basis)
%
% M is a Manopt manifold structure obtained from a factory.
% x is a point on the manifold M.
% basis is a cell containing n linearly independent tan... |
dfaa49e4dae226d3b0ab215c20a44d12bd9ca58dbb46406a8123c3aafcaff5b4 | MATLAB | 1,963 | 63 | function [results,errors] = hlp_endschedule(sched,varargin)
% Wait for completion of a scheduling operation and return results and errors.
% [Results, Errors] = hlp_endschedule(Id, Options...)
%
% In:
% Id : scheduler id, obtained from hlp_beginschedule
%
% Out:
% Results : cell array of results of the scheduled co... |
21f50eef1979184a7a88cad754b51fee4536d6f4eb78c58d3d5d883dddd059a2 | MATLAB | 1,964 | 70 | %% LOAD DATABASE
clear all
t1 = tic;
load('/Users/tor/Documents/Tor_Documents/Presentations/2010/Columbia_fMRI_Prediction_Workshop_2010/NBC/full_data.mat', 'MC_Setup')
volInfo = MC_Setup.volInfo;
MC_Setup.cl = [];
MC_Setup.unweighted_study_data = logical(MC_Setup.unweighted_study_data);
fprintf('Loaded in %3.0f sec\... |
30c106fc6775b2fbbccf73c22aabd96620802e68cf4e873710a0c86aff3af40a | MATLAB | 1,964 | 75 | function ops = convertOpenEphysToRawBInary(ops)
fname = fullfile(sprintf('%s', ops.fbinary)) ;
fidout = fopen(fname, 'w');
%
clear fs
for j = 1:ops.Nchan
fs{j} = dir(fullfile(ops.root, sprintf('100_CH%d.continuous', j) ));% should be j
end
nblocks = cellfun(@(x) numel(x), fs);
if numel(unique(nblocks))>... |
4623cdcaaffd9fa6d386d0cad0c36ebd42048f6e7f45b4eb7a40d54d65f7f2d1 | MATLAB | 1,964 | 60 | %% get_set_bfr_lbv(h,mode,input)
%
% Input
% --------------
% h : structure contains all handles of SEPIA
% mode : 'set' - extract information from GUI to config file
% 'get' - extract information from config file to GUI
% input : if mode is 'set' then input should be fid
% ... |
538d83de00a494c4d08030fbc7b992a7d7c3beb1dfd5cd750ffee02e7f3832ff | MATLAB | 1,964 | 64 | function varargout = ft_debug(varargin)
% FT_DEBUG prints a debug message on screen, depending on the verbosity
% settings of the calling high-level FieldTrip function.
%
% Use as
% ft_debug(...)
% with arguments similar to fprintf, or
% ft_debug(msgId, ...)
% with arguments similar to warning.
%
% You can switch... |
64b9e988601c07f3f003e5d2a065308f03a0c79bcad43cbd0f870d79e3470197 | MATLAB | 1,964 | 54 | % Script demo_image_operations
% Examples of image operation methods of MrImage.
%
% demo_image_operations
%
%
% See also
% Author: Saskia Bollmann & Lars Kasper
% Created: 2019-11-22
% Copyright (C) 2019 Institute for Biomedical Engineering
% University of Zurich and ETH Zurich
%
% This file... |
d4f7be93bbfdbc5177d301be3e1b7adbedaea4de3b0b96b15373637cec935beb | MATLAB | 1,964 | 92 | function E = read_buffer_offline_events(eventfile, hdr)
% function E = read_buffer_offline_events(eventfile, header)
%
% This function reads FCDC buffer-type events from a binary file.
% (C) 2010 S. Klanke
type = {
'char'
'uint8'
'uint16'
'uint32'
'uint64'
'int8'
'int16'
'int32'
'int64'
'single'
... |
0661408b343c183c649e01218c09b6ed9a73fde2d3d0b27632a6d7e9a83f7ff7 | MATLAB | 1,966 | 66 | % op_mergesubspec.m
% Helge Zoellner, Johns Hopkins University 2021.
%
% USAGE:
% out=op_mergesubspec(varargin);
%
% DESCRIPTION:
% Merges input structs into the subspectra dimension
%
% INPUTS:
% varargin = input data in matlab structure format.
%
% OUTPUTS:
% out = Output dataset with merged subspectra
fun... |
ceeddac7e6dff1020be683bd25434db26874e8988ea0655bcdce7c0f22618221 | MATLAB | 1,966 | 44 | function [extIdx] = extractComponentIdx(lenNodes,edgeIdx,cEdgesIdx)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% extractComponentIdx returns indices of features found in the biggest component.
% Such process takes place in two steps. First, features selected are used
% to constract a ne... |
8303ebfb9f601ae11275befac1de6d0239e4e51cc9c13661eaf5871c70d1ed4b | MATLAB | 1,967 | 50 | % sq_dist - a function to compute a matrix of all pairwise squared distances
% between two sets of vectors, stored in the columns of the two matrices, a
% (of size D by n) and b (of size D by m). If only a single argument is given
% or the second matrix is empty, the missing matrix is taken to be identical
% to the fir... |
95ddc36efb68b23457dcd25c3423c6d65580db3f26743b69b3f619f462c1c03d | MATLAB | 1,967 | 79 | function Test_fixedrank_elliptope()
% Test_fixedrank_spectahedron()
% The problem being considered here is the fixed-rank Maxcut
% All intputs are optional.
%
% This file is part of Manopt: www.manopt.org.
% Original author: Bamdev Mishra, July 11, 2013.
% Contributors: Nicolas Boumal
% Change log:
clear all;... |
a047f3d42c6d7b5c28eed52b8f0cd3371db5b68c78d65ea0b2588a94506b8115 | MATLAB | 1,967 | 67 | %% isUpdated = update_toolbox_directory_entry(SEPIA_HOME, varName, newPath)
%
% Input
% --------------
% SEPIA_HOME : SEPIA root directory (contains SpecifyToolboxesDirectory.m)
% varName : name of the toolbox directory variable, e.g. 'FANSI_HOME'
% newPath : full path to the toolbox directory
%
% Output... |
b92489a063269bf6405fc0858442bf131166db4077c69fb05cb8d733713974b6 | MATLAB | 1,967 | 52 | %% triggering on phase locked maxima
timeStep = 0.02; % in [s]
paramsEcog;
% params.trigResp = struct(...
% 'signalType', 'EcogGrid', ...
% 'selectedChnls', {{'all'}}, ... % 'all','prefrontal','broca','premotor','primsensory','ipcPF','ipcPFm'
% 'excludedChnls', [], ...
% 'dataProcessing', {{'car','bp_h... |
195ed163ca0e89ca9b08ff6a8882378d2cd3b64c1ba50d44797257e5a0e36cdc | MATLAB | 1,969 | 64 | function res = group_regions(input_file, atlas)
% GROUP_REGIONS(...) computes region-wise mean values from a voxel-wise
% brain map.
%
% INPUT
% input_file -- input brain map (.nii file) that has been co-registered
% to the same space as './src/atlas/brain.nii.gz' (i.e., MNI152 brain)
%
% OPTIONAL:
% atl... |
60769525fb82ad9afcf06b914704a72d4aa78f446a32c5e56458813f3197e9ff | MATLAB | 1,970 | 61 | function obj = update_residual_precision(obj)
if isfinite(obj.nl0)
% ---------------------------------------------------------------------
% Maximum likelihood (nl0 == 0) or Variational posterior (nl0 > 0)
% ---------------------------------------------------------------------
% -------------... |
096582075615be929a4f8db7f4b98c308d811c95086f99010846baa078aa3cff | MATLAB | 1,971 | 55 | %% function [dipoleKernel,dKComponents] = DipoleKernel(matrixSize,voxelSize,b0dir)
%
% Description: Create dipole kernel in k-space with input matrix dimensions
% and spatial resolution
% Input
% _____
% matrixSize : image matrix size
% voxelSize : spatial resolution of image
% b0dir ... |
d90e2ac293574789376a918ba7381f52fda77cd4e1eaa1f743b53227d88feeb9 | MATLAB | 1,971 | 66 | function cfg = getMockConfig(isMT)
% fixture
%
% cfg = getMockConfig(isMT)
%
% REMINDER: If `cfg.design.nbRepetitions` and `cfg.design.nbEventsPerBlock` values are changed
% this may make the tests on GitHub fail, so be careful.
%
%
% (C) Copyright 2020 CPP visual motion lo... |
6cdac775cc65b542c4c3087e5fab047857c959ce452586a08ec9d7b63565e3e4 | MATLAB | 1,972 | 63 | function [betasPos, betasNeg, rpe_by_sess, auc_by_sess,...
statsPos, statsNeg] =...
DA_CPInByRPE_Regression(bdataMdl, AUC, RPE, usethese, rpe_bnd)
% DA_CPInByRPE_Regression - Regress DA AUC against model RPE. Regresses
% separately for positive and negative RPEs in each session
% INPUTS:
% bdataMdl - Behavorial data ... |
bd2530829072137ecedf72c1fd9cfde3fddcebc41c66608daecaaabb30f6d2e0 | MATLAB | 1,972 | 51 | % NAN_STD - std, not considering NaN values
%
% Usage: std across the first dimension
% Author: Arnaud Delorme, CNL / Salk Institute, Sept 2003
% Copyright (C) 2003 Arnaud Delorme, Salk Institute, arno@salk.edu
%
% This file is part of EEGLAB, see http://www.eeglab.org
% for the documentation and details.
%
% Redistr... |
799c5b0a63f6155300cadb9cc3f2ddc390a527b72269a4d0060aed611b12abe0 | MATLAB | 1,973 | 52 | function [n_LR,n_winloss, n_prewinloss, n_safeRisky, p_LR,p_winloss, p_prewinloss, p_safeRisky ] = ofc_Ttests(A)
%ofc_Ttest: a wrapper for selectiveNeuronCalc to tests a neurons
%selectivity, for all neurons
%
%input: A. concatednated data, e.g. concatdata_ofc_start.mat
%
%
%ouput:
% number code for selectivity and p v... |
d5f74d132afe1340cdf44ae08611219fe7c639aa7293be26220ec7af25dead8c | MATLAB | 1,973 | 40 | function [PrincipalCurvatures,PrincipalDir1,PrincipalDir2,FaceCMatrix,VertexCMatrix,Cmagnitude] = GetCurvaturesAndDerivatives( FV,toggleDerivatives )
%% Summary
%Author: Itzik Ben Shabat
%Last Update: July 2014
%Implemented according to "Estimating Curvatures and Their Derivatives on Triangle Meshes" by Szymon Rus... |
f2f04ed4f00a80cbeac3510ced1498a9ba411f97c56e85e3d13c982ead6e4ecc | MATLAB | 1,973 | 85 | function y = digamma(x)
%DIGAMMA Digamma function.
% DIGAMMA(X) returns digamma(x) = d log(gamma(x)) / dx
% If X is a matrix, returns the digamma function evaluated at each element.
% Reference:
%
% J Bernardo,
% Psi ( Digamma ) Function,
% Algorithm AS 103,
% Applied Statistics,
% Volume 25, Number 3... |
5b30e7126df2d88c069c463f966a5d98aa8afba0841fad10611fc4ecd4291fd7 | MATLAB | 1,974 | 67 | function [A,AStd,n,nStd,noiseStd,functionVal,outputInfo] = ...
FitMLE_global(r, conc, A0,AStd0,x0Vec0,x0StdVec0,n0,nStd0,noiseStd0)
% r (neuron response) should be a 3d array, rows should be concentration, columns should be
% trials, 3rd dimension is odor-ORN pairs.
% AVec and other vectors are n-by-1 vector, n is... |
7bda748651138bdc51936ead4373a320fa434618e48c690b9337fd9651fced60 | MATLAB | 1,975 | 115 | function [nRows, nCols] = getSubplotLayout(nCh)
% designs "optimal" layout for subplots (covers whole figure)
% up to 300 subplots (more makes no sense anyways)
% (c) Jiri, Mar16
if nCh == 1
nRows = 1;
nCols = 1;
elseif nCh == 2
nRows = 1;
nCols = 2;
elseif nCh == 3
nRows = 1;
nCols = 3;
elsei... |
da51cd166fd533d3b329bce90b8e4caf10ed56f38e64adcbaf6823b28f16b1d2 | MATLAB | 1,975 | 55 | classdef MinMaxScaler < baseScaler
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MinMaxScaler transforms features by scaling each feature to a range
% between 0 and 1.
%
% Parameters:
% data: Data to be scaled.
% featureRange: Range into which features wil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.