sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d5b1a96cead6383a766699f1f5b2c1d4d1d591589d9306928d693c3a41b02376 | MATLAB | 3,805 | 121 | function V = mha_read_volume(info)
% Function for reading the volume of a Insight Meta-Image (.mha, .mhd) file
%
% volume = tk_read_volume(file-header)
%
% examples:
% 1: info = mha_read_header()
% V = mha_read_volume(info);
% imshow(squeeze(V(:,:,round(end/2))),[]);
%
% 2: V = mha_read_volume('test.mha');
% If ... |
270fb38a8f2133340a89e975868d4b276b3b65dc9eed2e11a10d31ba61700311 | MATLAB | 3,806 | 168 | function [val] = read_asa(filename, elem, format, number, token)
% READ_ASA reads a specified element from an ASA file
%
% val = read_asa(filename, element, type, number)
%
% where the element is a string such as
% NumberSlices
% NumberPositions
% Rows
% Columns
% etc.
%
% and format specifies the datatype a... |
74c232a6b0cc9e87d956212122bb0952d908558411694a0bd101da3cbf3fad31 | MATLAB | 3,806 | 126 | % plot_bigSbigT_multipleSignals_decisionRT
for dim = dimms
i = i + 1;
switch dim
case 1
sl = sigSL.TinC*1000;
rl = sigRL.TinC*1000;
ylims = [0 30];
case 2
sl = sigSL.TinI;
rl = sigRL.TinI;
ylims = [0 20]... |
1e9ccee49eaa9f28294977fd8dffe59288c75968907bf62dbcc4e3f2408a5b05 | MATLAB | 3,807 | 116 | % Script for running Enrichment analyses between fc data and behavioral
% data.
% It is assumed that the fc data is organized as ROI-ROI-Subject and the
% behavioral data is a vector with the same order and number of subjects
% in the fc array.
outputdir = 'filepath to output directory/';
addpath(genpath('filep... |
76b82191f3015f43e8acb45bd0955d0c30d8bc47c5b9a6b2cb126bc371ca63c4 | MATLAB | 3,808 | 124 | function [normdata,intmean,intstd] = NormToInt(data,normtype,int,sf,varargin)
%NormToInt(data,normtype, int,sf) normalizes the data to a subset of time
%(int). Has options for multiple normalization types.
%
%INPUTS
% data [Nt x Ndim]
% normtype 'mean','median' 'Z', 'max', 'percentile', 'modZ' for modified Z-s... |
98ddaa99525cb668ab99c1b1349855ff7eac155b5b79903fa44efd33f5b4ae65 | MATLAB | 3,808 | 138 | function varargout = fdr(varargin)
% Computes the FDR-threshold for a vector of p-values.
%
% Usage:
% [pthr,pcor,padj] = fdr(pvals)
% fdr(pval,q)
% fdr(pval,q,cV)
%
% Inputs:
% pvals = Vector of p-values.
% q = Allowed proportion of false positives (q-value).
% Defa... |
b48587f8779eb40a9ad8579d504ecada4500c132813d35f86f4f918ea87b2d0a | MATLAB | 3,808 | 101 | function h = histc2( A, edges, wtMask )
% Multidimensional histogram count with weighted values.
%
% Creates a histogram h of the values in A [n x nd], with edges as
% specified. If nd==1, that is when A is a vector, the resulting histogram
% h is a vector of length nBins, where nBins=length(edges)-1. h(q) contains
% t... |
f6795765bb00923c9a8c0fccea2336c6959c5c5d106c1ae14b5df1bd359a568f | MATLAB | 3,808 | 115 | function [ferns,hsPr] = fernsClfChangeNFerns( data, hs, ferns, Mnew, varargin )
% Train random fern classifier.
%
% See "Fast Keypoint Recognition in Ten Lines of Code" by Mustafa Ozuysal,
% Pascal Fua and Vincent Lepetit, CVPR07.
%
% Dimensions:
% M - number ferns
% S - fern depth
% F - number features
% ... |
fb5ff0a6880d5c78421990981dcf31932b0d415d9d216deb73a64753e5f37937 | MATLAB | 3,808 | 80 | function [params]=BiophysModel(params)
% BiophysModel: Simulates the response of a photoreceptor to light stimuli.
%
% Inputs:
% params: A structure containing parameters for the photoreceptor model.
% - sigma: Decay rate of receptor activity (1/sec).
% - phi: Decay rate of phospho... |
508fa6120c67e564912a414b53570bb26e60b26fde829906ab264796fd39a961 | MATLAB | 3,809 | 98 | function [fm,B2]=momttfr(tfr,method,fbmin,fbmax,freqs);
%MOMTTFR Time moments of a time-frequency representation.
% [FM,B2]=MOMTTFR(TFR,METHOD,FBMIN,FBMAX,FREQS) computes the time
% moments of a time-frequency representation.
%
% TFR : time-frequency representation ([Nrow,Ncol]=size(TFR)).
% METHOD: chosen represent... |
fc19f222cb7e8ad4bcec9fadf17a023bf19cd8d59d341f817ea885a073a0a1b4 | MATLAB | 3,809 | 135 | % 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 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,... |
2629f2cf870982b7a42e932b63e45ece9c93bb88e85706609ebdd6b5733496c2 | MATLAB | 3,810 | 88 | function [ContrastLow,ContrastHigh]=ManualContrastAdjust(InputImage,ColorCode,ColorScalar)
Image=InputImage*ColorScalar;
TempContrastLow=0;
TempContrastHigh=max(Image(:));
cMap=UniversalColorMap(ColorCode,TempContrastLow,TempContrastHigh);
NewContrast=1;
... |
9ea8c86a6d0c730230326ffb624effa9baa6a0859969346f5139fac8e2a1b41c | MATLAB | 3,810 | 89 | function h=subaxis(varargin)
%SUBAXIS Create axes in tiled positions. (just like subplot)
% Usage:
% h=subaxis(rows,cols,cellno[,settings])
% h=subaxis(rows,cols,cellx,celly[,settings])
% h=subaxis(rows,cols,cellx,celly,spanx,spany[,settings])
%
% SETTINGS: Spacing,SpacingHoriz,SpacingVert
% ... |
3faca6d1bc60c52f01c8ff2571cce5768256445dcd2a129cc4562a52a9c8decf | MATLAB | 3,812 | 135 | %function tfrscalt
%TFRSCALT Unit test for the time-frequency representation TFRSCALO.
% O. Lemoine - June 1996.
% We test each property of the corresponding TFR :
N=128;
% Covariance by translation in time
t1=60; t2=70; f=0.3; W=0;
sig1=amgauss(N,t1).*fmconst(N,f,t1);
sig2=amgauss(N,t2).*fmconst(N,f,t2);
tfr1... |
58d76059fd0fe2f07b3c82ca92a5ac4759bcac0a377cc6eb03af81d33e4ee270 | MATLAB | 3,812 | 76 | function summary_data(folders,option)
% goes through each folder and gets info of interest, compiles into a table
switch option
case 'wcorr'
load('rate_remapping_analysis_TRACK_PAIRS_wcorr.mat');
case 'spearman'
load('rate_remapping_analysis_TRACK_PAIRS_spearman.mat');
end
load('.\Tables\decodin... |
3e18a89715dc16ce980972d11b347b96caa08926d229d7822239d931d49527ed | MATLAB | 3,813 | 107 | function [dsm] = ft_sysmat_openmeeg(pos, headmodel, sens, NAflag)
% FT_SYSMAT_OPENMEEG creates a volume conduction model of the
% head using the boundary element method (BEM). This function takes
% as input the triangulated surfaces that describe the boundaries and
% returns as output a volume conduction model which c... |
7d4e0adf1008d8aa0fc7fdada005c558494b07619f776282db01c146f376300f | MATLAB | 3,813 | 83 | function colorcorrection_3D_from_file(roundnum)
loadParameters;
if params.DO_DOWNSAMPLE
FILEROOT_NAME = sprintf('%s-downsample',params.FILE_BASENAME);
else
FILEROOT_NAME = sprintf('%s',params.FILE_BASENAME);
end
DIRECTORY = params.deconvolutionImagesDir;
OUTPUTDIR = params.colorCorrectionImagesDir;
%Load th... |
a67bbd63c372d34469f0c3779dbf32311b261bcaf26f1472f69f12d3a199f9e0 | MATLAB | 3,813 | 129 | %% Process named arguments to a function
%
% This allows you to pass in arguments using name, value pairs
% eg func(x, y, 'u', 0, 'v', 1)
% Or you can pass in a struct with named fields
% eg S.u = 0; S.v = 1; func(x, y, S)
%
% Usage: [var1, var2, ..., varn[, unused]] = ...
% process_options(args, ...
% ... |
a532a6858cf586371e3aa03228e8491264e8b11bd62d7d19dfb8e71afc915100 | MATLAB | 3,814 | 119 | function [pointst,pointsf]=ridges(tfr,hat,t,method,trace);
%RIDGES Extraction of ridges.
% [POINTST,POINTSF]=RIDGES(TFR,HAT,T,METHOD,TRACE) extracts the
% ridges of a time-frequency distribution. These ridges are some
% particular sets of curves deduced from the stationary points of
% their reassignment operators.
%
%... |
3eb86a04931c34467f7df811e61baf44c2e918b86891949a34a0ac1d37b89294 | MATLAB | 3,815 | 78 | % The Scatter-Tool displays scatterplots with up to several million points.
% It is especially useful as an embedding (e.g. t-SNE or UMAP) viewer.
%
% The scatter module can plot 2 labels against each other and a third as the marker color. Additionally,
% it can display a cursor, the current l... |
71f0795a0e43711fb786c5f78799362f377c509a13e0e58623f7309ee7863edd | MATLAB | 3,815 | 80 | function Multi_ColorBars(Channel_Labels,Channel_Colors,ColorScalar,YScalar,Contrast_Data,SaveDir,dc,ExportName)
MetricLabelFontSize=18;
MetricScaleFontSize=14;
figure
set(gcf,'position',[0,50,800,500])
for c=1:length(Channel_Labels)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
8d52745b211242b6beb02bca99ffa67b1208cee45ce1fe1bbb327f9f98ebeb19 | MATLAB | 3,815 | 115 | function M = symmetricfactory(n, k)
% Returns a manifold struct to optimize over k symmetric matrices of size n
%
% function M = symmetricfactory(n)
% function M = symmetricfactory(n, k)
%
% Returns M, a structure describing the Euclidean space of n-by-n symmetric
% matrices equipped with the standard Frobenius ... |
9826138af6299348e44bb29bf09864df95bd6dcfeada166a816c6d02b2aa7817 | MATLAB | 3,815 | 99 | function [interp, permutevec, flipflags, transform] = align_ijk2xyz(interp)
% ALIGN_IJK2XYZ flips and permutes the 3D volume data such that the
% voxel indices and the headcorodinates approximately correspond. The
% homogenous transformation matrix is modified accordingly, to ensure that
% the headcoordinates of each ... |
bbbce23b478243592442dac8fd0353b6d0a2558f4d827fbd2988c2e6b56b6ecd | MATLAB | 3,815 | 65 | function correlational_analysis_moutlier
%%The within and across task correlation code
subjects=[];
data_info='/gpfs51/dors2/gpc/JamesBooth/JBooth-Lab/BDL/jinwang/PlausGram_9-10/scripts/5mvpa/data_info.txt';
if isempty(subjects)
M=readtable(data_info);
subjects=M.participant_id;
end
root='/gpfs51/dors2/gpc/Jame... |
ec3afdc7d40a79dc336a959cf53304fc10c7b1613bfb32e302f94c54f5075d70 | MATLAB | 3,818 | 105 | % [data, hdr] = opensvl(filename)
%
% Reads a CTF SAM (.svl) file.
function [data, hdr] = read_ctf_svl(filename)
fid = fopen(filename, 'rb', 'ieee-be', 'ISO-8859-1');
if fid <= 0
ft_error('Could not open SAM file: %s\n', filename);
end
% -----------------------------------------------------------... |
5f835eb48e38e46f5ca85f288096a5b1f1a128c5c956c37c41429c2dc0ddee89 | MATLAB | 3,819 | 132 | function PlotPeakDistribution(spkDat,varargin)
h=figure('units','normalized','outerposition',[0 0 1 1]);
spkDat.waves = double(spkDat.waves);
maxScale = Inf;
refWave = [];
sameScale = false;
showMean = true;
convertToVolt = true;
quantiles = [];
minIsi = 1; % in milliseconds
nSampTarget = 500;
ra... |
e6cd107ad39b7c272f92784e3421bd41f5c59d7f6313d3d8e3db1c31fbd8ecff | MATLAB | 3,820 | 113 | % FitCircles.m
% Sarah West
% 6/14/22
% Adjusted from puplitrack.m, original author Justin Aronson 10/19
% Updated by Angela Nietz 6/13/2022.
% Uses functon CircleFitByPratt.m to fit the circles.
function [parameters] = FitCircles(parameters)
MessageToUser('Fitting ', parameters);
% Pull out of parameters... |
3e46b18399839db4cdb32644aec540d3957ec6676c4c6a84168b3542001da14b | MATLAB | 3,821 | 113 | % sph2topo() - Convert from a 3-column headplot file in spherical coordinates
% to 3-column topoplot() locs file in polar (not cylindrical) coords.
% Used for topoplot() and other 2-D topographic plotting programs.
% Assumes a spherical coordinate system in which horizontal angles... |
6b9872e8e2ccfc676797e885fdd99247e372d08bd575ae033ef912fce80c0214 | MATLAB | 3,821 | 124 | function [Cf, Cr, Pr, Ntrials, cfg] = prepare_freq_matrices(cfg, freq)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SUBFUNCTION that converts a freq structure into Cf, Cr and Pr
% this is used in sourecanalysis
%
% This function returns data matrices with a channel order that is con... |
a8db011be387736c439916b7e015e222be9ca1d478379f57f588a1d4e65442a9 | MATLAB | 3,823 | 86 | function ax = plot_prob_gradient_comparison(si_exp,si_th,nPanel_per_row,mouse_idx,use_grid_visits_as_color,force_cumulative_prob,plot_label_theory)
if (nargin < 3) || isempty(nPanel_per_row)
nPanel_per_row = 4;
end
if (nargin < 4) || isempty(mouse_idx)
mouse_idx = NaN;
end
if (nargin... |
d023b769acdfa8693bd4391453938e84c3539fcec00c0ff28fa50a15fabc8747 | MATLAB | 3,824 | 101 | % Five-point stencil on the unit square, Poisson equation.
%
% This example solves the Poisson equation on the unit square with Dirichlet
% boundary conditions. The system is discretized using the standard five-point
% stencil; the resulting matrix is square, real, and positive definite.
%
% This demo does the followin... |
33702e6e4252f1a7463677864d2fc6e721c02d236224df5fe149480a30e08666 | MATLAB | 3,825 | 82 | function plot_confusion_matrices
% currently plots the confusion matrices for the current folder
% needs to have run the bayesian_decoding_error code first, with leave one
% out and cross tracks
est_wt= load('estimated_position_leave_one_out.mat');
est_wt= est_wt.estimated_position_test;
est_ct= load('estimated_positio... |
c9eb54d2b2907c8b47427590f023e9793c7caa8cf68987e6ca620d14745c72ec | MATLAB | 3,826 | 95 | %% computeSDO_xtDataCell_new()
% Generates a data structure for time series data ('xtDataCell'),
% pre-populated with fields used in the SDO Analysis toolkit.
%
% PREREQUSITE: None
%
% INPUT PARAMETERS:
% N_TRIALS : A postive integer, corresponding to the number of
% independent recording trials/sessi... |
3b896265e0234f4a5255052e5418cf19e0e55b2e8388aaa9d2455a5039e99d68 | MATLAB | 3,828 | 150 | %% reposition subplots and switch off axes
function pp = spsjm(varargin)
%% args
gap=0.01;
top_gap=0;
left_gap=0;
right_gap=0;
bottom_gap=0;
axis_off=true;
auto=false;
for ii=1:length(varargin)
if strcmpi(varargin{ii},'gap')
gap = varargin{ii+1};
end
% ..
if strcmpi(varargin{i... |
a7bb3a5dbe957bcd397cb2a24e66d7679eeaf1779cc9af36a1e6e81fb6124241 | MATLAB | 3,832 | 125 | function [ fp fn tp matchtruth matchtest missingtruth missingtest ] = ...
wlFT_compareMatrixEventsVsTruth(truthmatrix, testmatrix, comparefunc, ...
bandlim, snrlim)
% function [ fp fn tp matchtruth matchtest missingtruth missingtest ] = ...
% wlFT_compareMatrixEventsVsTruth(truthmatrix, testmatrix, comparefunc, ... |
634b772c62561c7dec63cc21d5314327cfc1e96ba2b765cfb7a8834f65a2c32a | MATLAB | 3,833 | 130 | % plsmtsr1_TSRonly.m
% Sarah West
% 6/21/22
% Modified from plsmbtsr1.m by A. Folch-Fortuny and F. Arteaga, 2016 (see
% below license information). Original code from TSR_PLS package.
% Runs the trimmed square regression (TSR) method of imputing missing data
% values for partial least squares regression (PLSR). Origin... |
8dd7c2ade0eba5e785e4b1f183cb0f74f7e8f7478ca73f5c83f01b2fba273428 | MATLAB | 3,836 | 130 | function [h,g] = VBA_spm_dcm_graph(xY,A,ha)
% Region and anatomical graph display
% FORMAT spm_dcm_graph(xY,A)
% xY - cell of region structures (see spm_regions)
% A - connections of weighted directed graph
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome ... |
d576b0b662367ba53789276426a9e361d85acaeb1db7e433a2c4c56fbcc5eb60 | MATLAB | 3,836 | 102 | % Run an end-to-end ExSeq experiment in simulation
% Should take ~5-10 minutes of compute time with default settings.
% The many parameters are managed in these scripts, you are expected to get
% the settings correct
loadSimParams; %only used in the context of simulation
loadParameters; %Used throughout the ExSeqProce... |
f5a883682c096d495b88053dba1b8f014889566b4228ec661cb88d5b59a0dee0 | MATLAB | 3,836 | 132 | function Z = tenfun(fun,varargin)
%TENFUN Apply a function to each element in a tensor.
%
% TENFUN(F,X,...) applies the function specified by the function
% handle F to the given arguments. Either both arguments
% must be tensors, or one is a tensor and the other is a scalar/MDA.
%
% Examples
% Z = tenfun(@(... |
c247bbaa4b74d6f66be82c7a97d5319ec43cd2108f6f9e7314f5bb8b4ac12a27 | MATLAB | 3,839 | 124 | %% Create new projected electrotrode profiles based on Adtec clinic grids
% 4mm diameter surface electrodes
% Make three electrode profiles spread across the electrode
% Re-create LFP signal by averaging everything within 2mm
% diameter, then re-filter in gamma band.
mkdir([DIRresults, '/clinical_electrode/']);
the_y_... |
845ad7932078d63db5b30204f5c21743780bd4bba4625d21a8bbb0212de737df | MATLAB | 3,840 | 103 | %-----------------------------------------------------------------------------------------
% Script for behavioral analysis of the odor-rating and
% odor-identification task
%
% Kehl et al. 2024 (DOI:XX)
% Single-Neuron Representations of Odors in the Human Brain
% Figure 1f
% Author: Marcel Kehl
% License: MIT Lic... |
0b8e2f6218df9ac5405d3b827bd7c64970a6b5332795e57960f600f46dd634d2 | MATLAB | 3,841 | 109 |
%%% Scope: Reading preprocessed BOLD-signals, calculating FCs,
%%% calculating ICC between RL-phase and LR-phase scans
%%% Author: Jonas A. Thiele
%%% Date: 18.07.2023
%%% Uses function: Arash Salarian (2023).
%%% Intraclass Correlation Coefficient (ICC)
%%% (http... |
930d9027fbe000069c2d454d26d2ff652ba694231faa7bad24ebc834fda1df5e | MATLAB | 3,842 | 103 | function x = idwt2_gpu(a,h,v,d,varargin)
%IDWT2 Single-level inverse discrete 2-D wavelet transform.
% IDWT2 performs a single-level 2-D wavelet reconstruction
% with respect to either a particular wavelet
% ('wname', see WFILTERS for more information) or particular wavelet
% reconstruction filters (Lo_R and H... |
d717aff2e8226d0836e953431ace297eafae6a95d028013246814201c907e8a4 | MATLAB | 3,842 | 115 | function [tfr,t,f] = tfrmhs(x,t,N,g,h,trace);
%TFRMHS Margenau-Hill-Spectrogram time-frequency distribution.
% [TFR,T,F]=TFRMHS(X,T,N,G,H,TRACE) computes the Margenau-Hill-Spectrogram
% distribution of a discrete-time signal X, or the cross
% Margenau-Hill-Spectrogram representation between two signals.
%
% X : ... |
e46cd7097af09e51951381dc7abc4f7cd7738930dcfce2d928a396a84c92013e | MATLAB | 3,843 | 92 | function avg_seed = CBIG_AuthorTopicEM_ComputeMostTypicalSolution(root_dir, K, seeds, alpha, eta)
% avg_seed = CBIG_AuthorTopicEM_ComputeMostTypicalSolution(root_dir, K, ...
% seeds, alpha, eta)
%
% Return the index of the initialization (seed) of the Expectation-
% Maximization (EM) inference algorithm run that retu... |
08ba39e5d8343ebe6883e333f3798232e9d171710619c5501407e3df52156000 | MATLAB | 3,846 | 109 | addpath('../engines/bem_fmm_engine/');
%% Dipole location in mm
dip_center_pos = (strdipolePplus + strdipolePminus)/2;
X = dip_center_pos(1)*1000;
Y = dip_center_pos(2)*1000;
Z = dip_center_pos(3)*1000;
%% Load skin mesh
skin_file = fullfile(patient_path,'mesh_data',strcat(patno,'_skin_remesh.stl'));
TR_skin ... |
e8b48203c6ed4dbc14cd54d8ab2bcd7b59c7e228ed57159f852109cd866f5ba0 | MATLAB | 3,846 | 111 | function Results=PopAnal_FormatDecodeDynamic(AllTrialData,Phase,unit,timeWindow,opts)
%%
% timeWindow=[-1.5 -.5];
% Task related Firing Rate
disp(timeWindow)
%%
Conditions = {{'NancyPinchCheek','NancyPressCheek','NancyRubCheek','NancyTapCheek'},...
{'NancyPinchShoulder','NancyPressShoulder','NancyRubShoulder','Na... |
08b299af1115fcc5a8a9963852b1bbb63697c06ab49a963b6a56461a016e1caa | MATLAB | 3,847 | 98 | classdef DifferenceDetector < FeaturesDetector
properties
originalReporter
originalFeatureName
newReporter
newFeatureName
timeThreshold = 0.01
frequencyThreshold = 10
end
methods(Static)
function n = typeName()
... |
8fca8cf96e1c7be45a3c3a6be8e58ca4506b6dacd34ce7c4bf42ae3f4315fcac | MATLAB | 3,847 | 115 |
%%
%Plot the basic elements of a linear model that accounts for neural firing
%as a function of the subject's choice and the cued action. From this
%dataset it appears that there is no significant tuning prior to the action
%cue suggesting some type of heirarchical neural architecture where the
%high-level de... |
3c0c8fd30ec6104452f4ebd056c35ad41970f05190cda07c0fa229ada21938b1 | MATLAB | 3,848 | 202 | function [loc_phys,names]=locphys2locphys(loc_phys_in);
% Purpose: create 'physical' locations from neoroscan-data
%
% usage: [loc_phys,names]=loc2locphys(fn,ind_phys,loctype)
%
% output: loc_phys nX5 matrix; each row contains information
% about a physical electrode in the form
% ... |
a0207c70f1c333fb8358b3a15ef22c43bbb76c360dc02d4f1562fe5dea360aa1 | MATLAB | 3,848 | 116 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function calcCorrespondencesForFixed(fixed_run)
loadParameters;
if params.DO_DOWNSAMPLE
filename_root = sprintf('%s-downsample_',params.FILE_BASENAME);
else
filename_root = sprintf('%s_',params.FILE_BASENAME);
end
fprintf('Calc... |
aa4c5ae8f8251718023ace653f191e23a1997a63e836a68377c9eaa84976a777 | MATLAB | 3,848 | 143 | function a = circ_plot(alpha, format, formats, varargin)
%
% r = circ_plot(alpha, ...)
% Plotting routines for circular data.
%
% Input:
% alpha sample of angles in radians
% [format specifies style of plot
% pretty, histogram, density, []
% [formats standard matlab string for plot... |
4c1f047f2d3550d3442ffdb6112e30c62f26918ed121e8a9fc138b79e5531a71 | MATLAB | 3,849 | 99 | function sens = homer2opto(SD)
% HOMER2OPTO converts the Homer SD structure to a FieldTrip optode structure
%
% See also BTI2GRAD, CTF2GRAD, FIF2GRAD, ITAB2GRAD, MNE2GRAD, NETMEG2GRAD, YOKOGAWA2GRAD
% Copyright (C) 2004-2016, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% ... |
5048cd5db6a51c742c73c2ad1065685e93b196149fc344893c71ee7922798ca5 | MATLAB | 3,850 | 44 | function [input] = soundAnalysis(input, sample_rate)
for i = 1:length(input.Mouse_Name)
if strcmp(input.Sweep_Type(i), 'sound')
for qq = 1:7
if strcmp(input.Anesthetize(i),'AWAKE')
response = mean(input.TotalSound{i}{qq}(4401:4800,:),2); % response window is 20 - 40 ms after... |
56a73851f80f3f99a747601f823f3cf0452c7881bc7b969a271398860ef6c8dc | MATLAB | 3,851 | 102 | clear;clc;close
rdfile='Results_exp2.xlsx'; % File for reading data
rdsheet='Each participant'; % Sheet for reading data
t_range='E2:N2'; % Range for reading TSs
r_range={'E4:N19','E20:N35','E36:N51','E52:N67'}; % Range for reading individual mTRs {non-CVR_tr1-320, non-CVR_tr321-640, CVR_tr1-320, CVR_tr321-640}
... |
c53ae771d0eef93dc80853dc4847687cbb8c05062d4bfb4f9ca9f3ab05e0b644 | MATLAB | 3,851 | 102 | clear;clc;close
rdfile='Results_exp1.xlsx'; % File for reading data
rdsheet='Each participant'; % Sheet for reading data
t_range='E2:N2'; % Range for reading TSs
r_range={'E4:N19','E20:N35','E36:N51','E52:N67'}; % Range for reading individual mTRs {non-CMR_tr1-320, non-CMR_tr321-640, CMR_tr1-320, CMR_tr321-640}
... |
0111918c5468a8f32bcafad73175a5c7f20eb3d6a9a530f19302a47639eda7ba | MATLAB | 3,852 | 110 | function h = histcImLoc( I, edges, parMask, wtMask, multCh )
% Creates a series of locally position dependent histograms.
%
% Inspired by David Lowe's SIFT descriptor. Takes I, divides it into a
% number of regions, and creates a histogram for each region. I is divided
% into approximately equally sized hyper-rectangu... |
e0d77960553dbdbfb8c5a4cf437d6974653391b494ddbe736bc2c858da3188be | MATLAB | 3,852 | 117 | function M = playMovie( I, fps, loop, prm )
% Shows/makes an/several movie(s) from an image sequence.
%
% To play a matlab movie file, as an alternative to movie, use:
% playMovie(movieToImages(M));
% The images to display are stacked in a higher dimensional array.
% MxNxCxTxRxS, where:
% M - height
% N - width
% C... |
8e2d5baaf0dbd33a22d962f21adf5c2f49616f748b0b652b2e058fc165e37461 | MATLAB | 3,854 | 124 | function [responseClass,bars,delayedOnsetFlag,inhibFlag,onsetFlag,onsetSusFlag,multiPeakedFlag] = analyzePSTH(PSTH,ZScores,binSize,PW,ISI,numPulses,onset,ZThresh,spontTimes,numBarsTrials)
onsetThresh = 50; %If less than this thresh (ms) then onset class
onsetThreshBin = round(onsetThresh/binSize);
peakSusRatio... |
c4f9b34ea4ab90c2b3eddcccee5ef934fa6f87bdf685410c8b35ad5a2204b35a | MATLAB | 3,856 | 110 | % PlotMiceStrideOverlays.m
% Sarah West
% 7/18/23
% For a given behavior period plots the average, resampled stride
% (normalized to be 10 data points long) of each mouse onto the same
% figure. Each line has the standard error of the mean as error bars.
% Runs with RunAnalysis
function [parameters] = PlotMiceStride... |
cbfe0d5f18834e15210e674026f9454bcd24901030db3d08d5820bc76e53c3fa | MATLAB | 3,860 | 102 | function vol = ft_datatype_vol(vol, varargin)
% FT_DATATYPE_SOURCE describes the FieldTrip MATLAB structure for volume data
%
% The vol data structure represents data on a regular volumetric 3-D grid, like
% an anatomical MRI, a functional MRI, etc. It can also represent a source
% reconstructed estimate of the activi... |
48099736b45dfad9ec01e7cee3929c147e6fe2aa2267454750d0a873cf8f3b09 | MATLAB | 3,862 | 98 | function [KW_Result]=KW_Post_Hoc(DataStructure,KWPostHoc_alpha,DisplayChoice,DisplayTables,ExportTables,TestName,SaveDir)
%Kruskal-Wallis Tests
if length(DataStructure)>1
%first find largest DataSet
MaxNumEntries=0;
for i=1:length(DataStructure)
if strcmp(DisplayTables,'on... |
d378f3b8b52ddcaafc6ccf24582e0087b7676f83129747c5818dd5130bdcc4ed | MATLAB | 3,863 | 143 | function [EUi,Ui,Z,d2Uidx2,d2UidP2,Vy] = VBA_evalAL2(Xt,P,beta,ut,yt,options)
% smart wrapper for unnormalized log-likelihoods
% function [Eui,Ui,Zi,d2Uidx2,d2UidP2] = VBA_evalAL2(Xt,P,beta,ut,yt,options)
%
% This function evaluates the re-normalized log-likelihood at the observed
% data point. This is done by computin... |
f7348eeac9a6afbec9f99076e271203b21303f8aae06441a49c6a2390773d57c | MATLAB | 3,863 | 124 | function LAN = lan_chanbit_2_RT(LAN,cfg) %
% <*LAN)<]
% v.0.3
%
% Extract channels with cuadratic pulse to event in the RT structure
%
% cfg.channels = [ch1 ch2 ...]
% channles sorting following bit information
% the firt bit (ch1) 0^2 ,
... |
46168718223fe71406e2ac4a299857e197492c67a567136018b418bafeb58a94 | MATLAB | 3,864 | 111 | %% Script for segmenting (unsigned) with TomoSegMemTV all tomograms with microsomes
% Author: Antonio Martinez-Sanchez
%% Clear workspace
close all
clear all
%% Add TomoSegMemTV path
addpath '../../../../pyseg-sys/tomosegmemtv/tomosegmemtv/source'
addpath '../../../../pyseg-sys/tomosegmemtv/tomosegmemtv/source/mex'
... |
b731421cebea55f659bf0b775c298e4ba83429ddd2bc58ddd1baf516c9a1c269 | MATLAB | 3,866 | 140 | function wlPlot_plotAllMatrixEvents(cfg, evmatrix, figtitle, figlabel, ...
plotsperband, trialstride, channelstride)
% function wlPlot_plotAllMatrixEvents(cfg, evmatrix, figtitle, figlabel, ...
% plotsperband, trialstride, channelstride)
%
% This function plots all or some of the events in an "event matrix", such
... |
2ac81039a03a67dab47c8273b3206b70d5b14db1f3c3b3c73ed277c41cd4d9c1 | MATLAB | 3,867 | 105 | function PFScore = calculate_linfieldsScore(linfields, modelParam, network, varargin)
% calculate_linfieldsScore
%
% Calculates the PF objective score, lower is better.
%
% Inputs:
% - linfields: linear place field cell array matching Jadhav lab
% structure
% - modelParam: the model parameter structure
% - ... |
645d9b3582f70c4bd8cd62c28b4494c0247df4b535bd7fc35e01d03a08e0dba8 | MATLAB | 3,867 | 122 | function [genotype,background_all] = processData(genotypeName,params,extensions,directory,folders)
%allEdges,bodyPartXYZ,bodyPartUV_side,bodyPartUV_bot,bodyEucDist
d_side = directory{1};
d_bot = directory{2};
id_side = extensions{1};
id_bot = extensions{2};
boxFold = folders.boxFolder;
sideFold = folders.sideFolder;
... |
98816bd22fa68e80ce8364abf51d579180d8d2e84bbaea8c1f9ed141e47b1a2a | MATLAB | 3,867 | 96 | function CBIG_MSHBM_generate_ini_params(seed_mesh, targ_mesh, num_clusters, num_initialization, out_dir)
% CBIG_MSHBM_generate_ini_params(seed_mesh, targ_mesh, num_clusters, num_initialization, out_dir)
% This function will be used to generate initialization parameters. We will
% apply Yeo2011 clustering algorithm on ... |
b8f37458e0147ccf5ff91fd6a837bf03519109bd355eb1c287873f3b540a43eb | MATLAB | 3,867 | 115 | function [tfr,t,f] = tfrzam(x,t,N,g,h,trace);
%TFRZAM Zao-Atlas-Marks time-frequency distribution.
% [TFR,T,F]=TFRZAM(X,T,N,G,H,TRACE) computes the Zao-Atlas-Marks
% distribution of a discrete-time signal X, or the
% cross Zao-Atlas-Marks representation between two signals.
%
% X : signal if auto-ZAM, or [X1,X2]... |
9fd5f2f752c50a3e8c17715f5774f3f5acf1cd3f76a7e0d1433e71ba1b2e157f | MATLAB | 3,872 | 103 | classdef FileRole < uint8
% apt.FileRole - Enumeration for file role classification in APT
%
% This enumeration categorizes files based on their purpose and storage
% location patterns, enabling appropriate path translation when moving
% between different execution contexts (native, WSL, remote backends).
%... |
b3e9062c138eb20df34a1a63f51e0238effd4f893625fcfb71b6ed0f4c4b18cd | MATLAB | 3,872 | 135 | %% Compare inference method speed w.r.t model size
%
%%
%PMTKslow
% This file is from pmtk3.googlecode.com
setSeed(2);
methods = {'libdaiJtree', 'jtree', 'varelim'};
names = {'libDAI jtree', 'PMTK jtree', 'PMTK varelim'};
ntrials = 5;
nnodes = 40;
maxFanIn = 3;
maxFanOut = 2;
sparsityFactor = 0.01;... |
2cccf7364b43dbea00966ede307bae100caeb73dd44364d2448084eff789066b | MATLAB | 3,873 | 122 | % plot_FigS9
load(fullfile(saveLoc, 'par_sess'))
load(fullfile(saveLoc, 'decoder_excl_SL'))
% Load: 'w_dec', 'pc_dec', 'se_dec', 'excl', 'exclName', 'winCenter','pc_whenC_sign_dec' % Calculated in calc_whatDecoder_fixed_time
load(fullfile(saveLoc, 'decoder_excluded_450'), 'pc450_dec', 'se450_dec') % Calcula... |
49d9ba65195ab950739ff188b82709d346128039359a8d6151403802235f6fda | MATLAB | 3,873 | 80 | % Author: Birgit Nierula
% nierula@cbs.mpg.de
function get_detection_statsTable(conditions, srmr_nr)
for icondition = conditions
%% set variables
savepath_ga = getenv('GADIR');
% get condition info
[cond_info] = get_conditionInfo(icondition, srmr_nr);
cond_name = cond_info.cond_name;
ner... |
0f25de94154023551b261694fcf51699a8681a78c5732aa087c7b4432d3a579c | MATLAB | 3,874 | 91 | clear;
clc;
% Data from the table (methods)
methods = {
'VAE', 'GAN', 'CNN', 'AlexNet', 'VGGNet', 'CNN', 'SegNet', 'U-Net', 'Inception', ...
'VGG-16', 'ResNet-50', 'Inception-v3', 'CNN', 'LSTM', 'Graph Attention', ...
'CNN', 'MobileNetV2', 'VGG16', 'CNN', 'YOLOv7', ...
'FESAE', 'Residual U-Net'... |
99ea9b5d8b8fce650f9e28f17fecae21834757a97525d446d2b51ca16c7d11d3 | MATLAB | 3,874 | 107 | function lf = eeg_leadfield1(R, elc, vol)
% EEG_LEADFIELD1 electric leadfield for a dipole in a single sphere
%
% [lf] = eeg_leadfield1(R, elc, vol)
%
% with input arguments
% R position dipole (vector of length 3)
% elc position electrodes
% and vol being a structure with the elements
% vol.r ... |
3add2e06da39872d047df488ff9fc85ee99a44a3cb2d4b6bace27c7be2b9a585 | MATLAB | 3,875 | 112 | function [handles] = plotResults(y,xi,eta,F,theta,K_opt,options)
% display clustering results on 2D data eigenspace
% function [handles] = plotResults(y,xi,eta,F,theta,K_opt,options)
% This function projects the MoG components onto the first two
% eigencomponents of the data. This 2D eigenspace is then tesselated
% acc... |
076520667892831d1c879c75727f114c9203911969b535bfcc32b6f579954f09 | MATLAB | 3,877 | 96 | %% WRAPPER for analyzing multi-ExR synapses data %%
% Accompanies the manuscript by Kang*, Schroeder* et al., 2023
% Last modified by Margaret Schroeder on 12/14/2022
% Image processing up to this point:
% - background subtraction in Fiji and
% - registration using modified ExSeq pipeline
% - manual ROI identificat... |
123e6877c17f085b7fce00c927f9b8b3b50165c0429e5d998c6ca3bdd6bc02d9 | MATLAB | 3,878 | 102 | function [Features] = ASLR_Feature_extraction_kSVD(Train_Data,Dictionary,fs,config)
% [Features] = ASLR_Feature_extraction_kSVD(pool,Dictionary,config)
if nargin==3
config.NoA = [6,3,3];
config.shifts = [4,4,4];
config.sdRemoved = [6,8,4];
config.methodology = {'OMP','OMP','OMP'};
elseif nargi... |
326cfd4c74981580e9df6c1b34174dd3a2fa7b8ad0428402737ca15effa337a8 | MATLAB | 3,878 | 92 | function koren
legend_version = 1;
background_color = [255/255, 204/255, 153/255];
%background_color = 'w';
%% ========================================================================
% data
plain = [19910800, 0.9094, 40, 22000000, 0.9094;
29866200, 0.9072, 60, 33000000, 0.9072... |
a3b456916e5993e58eae3f4c9d8360e395666d224bef89b7f92eb5fff94ef662 | MATLAB | 3,878 | 110 | function [cmap]=buildcmap(colors)
% [cmap]=buildcmap(colors)
%
% This function can be used to build your own custom colormaps. Imagine if
% you want to display rainfall distribution map. You want a colormap which
% ideally brings rainfall in mind, which is not achiveved by colormaps such
% as winter, cool or jet ... |
a75dd098b927dce053685dc4e0763931ca7b4494999cb71f7da693fe9ddc1550 | MATLAB | 3,878 | 96 | function makeMontageForChannelsAcrossRounds(channels,yamlfile,saveNonDownsampled)
if nargin<3
saveNonDownsampled = false;
end
%Use a YAML file to load the parameters for a large experiment
yamlspecs = ReadYaml(yamlfile);
%The YAML files might have extra quotes so remove them
EXPERIMENT_NAME = strrep(yamlspecs.bas... |
c784a30ae642533db15dac1b9d126114afe810341468923ee4b599df3a29ba5f | MATLAB | 3,878 | 117 | % Author: Birgit Nierula
% nierula@cbs.mpg.de
function check_ica_plots_allBlocks(subject, chan_name, srmr_nr, display_time)
subject_id = sprintf('SRMR%01i_S%02i', srmr_nr, subject);
analysis_path = [getenv('ANADIR') subject_id '/eeg/prepro/'];
load([getenv('CFGDIR') 'cfg.mat'], 'srate_ica')
% load ICA info
fname =... |
9c7abeb6360a553cee02ec781d5841ce75791ac24ad0ca1299a196dc271e7523 | MATLAB | 3,879 | 184 | % Demonstrate group lasso
% Needs the SpaRSA code from http://www.lx.it.pt/~mtf/SpaRSA
% This is based on demo_group_L2 and demo_group_Linf
%PMTKauthor Mario Figueiredo
%PMTKmodified Kevin Murphy
for signal_type = 0:1
setSeed(1);
% n is the original signal length
n = 2^12;
% k is number of observations to make
k ... |
b1b56994001ba3beb23683ed67846aad2dc5f8db711ce5f4a1be32cdfd5ad922 | MATLAB | 3,880 | 109 | function [ferns,hsPr] = fernsClfTrain( data, hs, varargin )
% Train random fern classifier.
%
% See "Fast Keypoint Recognition in Ten Lines of Code" by Mustafa Ozuysal,
% Pascal Fua and Vincent Lepetit, CVPR07.
%
% Dimensions:
% M - number ferns
% S - fern depth
% F - number features
% N - number input ve... |
a7f5c13db23af7722f8371cdd8c1c8ba8934702d11e81bde309626257af3e39a | MATLAB | 3,883 | 107 | function demo_modelComparison ()
% // VBA toolbox //////////////////////////////////////////////////////////
%
% demo_modelComparison ()
% demo of random-effect group-level bayesian model selection in the context
% of nested linear models.
%
% /////////////////////////////////////////////////////////////////////////
... |
cead63a8039bf1cf565541c57838001350acc74b56be17c0e0e576de64cd532d | MATLAB | 3,884 | 100 | % Seven-point stencil on the unit cube, Poisson equation.
%
% This is basically the 3D analogue of FD_SQUARE.
%
% Inputs (defaults are used if not provided or set empty):
%
% - N: number of discretization points in each dimension (default: N = 32)
% - OCC: tree occupancy parameter (default: OCC = 64)
% - RANK_OR_... |
a3271d065118534fab9484ccfb7244b36ce1a531e76d9a895a7c7cad6f4f98f9 | MATLAB | 3,886 | 129 |
% Calculate power spectral density (PSD) of LFP
% Calculate PSD for each of segmented epochs from the state to analyze
% (whole session, freezing or non-freezing) and take average over all epochs
clc; clear;
% --- Parameter list ---
csc = 'BLA'; % CA1, ACC or BLA
state = 'exp'; % state to analyze: 'whole', 'f... |
283f66df94c8bcdea37189f3af282d0e2f558eee25cf046df933e861ff0e1700 | MATLAB | 3,889 | 109 | function F = VBA_spm_Tcdf(x,v)
% Cumulative Distribution Function (CDF) of Students t distribution
% FORMAT p = spm_Tcdf(x,v)
%
% x - T-variate (Student's t has range (-Inf,Inf)
% v - degrees of freedom (v>0, non-integer d.f. accepted)
% F - CDF of Student's t-distribution with v degrees of freedom at points x
%_______... |
73b9d456fa0f08a1412e62e8560ee4498ea7c3a53cb7d5ffb9486bc9a9fddcdf | MATLAB | 3,889 | 114 | function [vSUB_PET] = vSUB_PET_atlas(PET_scan,MRI_atlas)
save_imgs = 0;
%% Slices
% Column 1 - left
regions = cell(5,2);
regions{1,1} = [78 33;85 33;83 39;78 38;76 38;73 37;73 34]; %slice=76
regions{2,1} = [74 33;79 32;85 32;83 39;79 39;74 38;71 36]; %slice=77
regions{3,1} = [70 37;73 33;79 32;86 33;90 37;88 43... |
8b82a4d5315c52b2ec6a8434a1ac0f06e918aa7c0cb7fc4b2663670254d3d449 | MATLAB | 3,889 | 127 | function [a,b,yfit] = Fseries(x,y,n,scale,sincos)
% FSERIES Computes real Fourier series approximation to a data set
%
% [A,B] = FSERIES(X,Y,N) fits an Nth order Fourier expansion of the form
% y = A_0/2 + Sum_k[ A_k cos(kx) + B_k sin(kx) ]
% to the data in the vectors X & Y, using a least-squares fit.
%
% [A,B,YFIT... |
270b7ab9dc82a6b7d57818e24dc8be27d08f631aa2e2708e9537ed2522358a5e | MATLAB | 3,890 | 158 | function M = spherecomplexfactory(n, m)
% Returns a manifold struct to optimize over unit-norm complex matrices.
%
% function M = spherecomplexfactory(n)
% function M = spherecomplexfactory(n, m)
%
% Manifold of n-by-m complex matrices of unit Frobenius norm.
% By default, m = 1, which corresponds to the unit sp... |
6b60336a4263d63022c9382a9224ccdb9f122e2a494e916622b65ab856de7ddf | MATLAB | 3,891 | 100 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script computes the global efficiency and participation coefficient%
% according to the Seitzman et al. (2020) atlases. %
% Make sure to compute the information for the group atlas first!!! %
% ... |
9a42ffc3579005312389fcd540c0ce6b79050469e0797f6a307b6a9b2cce95c7 | MATLAB | 3,891 | 93 | function res = run_nanocolumn_enrichment_refAlign(params,fov)
%update later with documentation
exp_factor = params.exp_factor; %expansion factor, adjust as needed
parentdir= params.parentdir;
targetdir = params.targetdir;
nChannels = params.nChannels;
rmax = params.rmax;
prepost=params.prepost; %assign pre or post-s... |
08497b7ade034ef3df62b1bde5666a804a8951cbd92b37e711fe733bc4967482 | MATLAB | 3,892 | 100 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script computes the global efficiency and participation coefficient%
% according to the Seitzman et al. (2020) atlases. %
% Make sure to compute the information for the group atlas first!!! %
% ... |
5d17a5759333b5aa73ac99a462255877f11f00a1247695a0b593490b615aabfc | MATLAB | 3,892 | 126 |
function is_same = compare_mat_files(srcDir, dstDir)
srcFiles = dir(fullfile(srcDir,'**','*.mat'));
dstFiles = dir(fullfile(dstDir,'**','*.mat'));
if length(srcFiles) ~= length(dstFiles)
disp('NG - # of files is different.');
srcFiles
dstFiles
is_same = false;
retu... |
819012160a404c1375da661b642b0f0188f428842f2061f84483311e6d7b145d | MATLAB | 3,892 | 112 | function [g,a,mu2]=ar1(x)
% AR1 - Allen and Smith AR(1) model estimation.
% Syntax: [g,a,mu2]=ar1(x);
%
% Input: x - time series (univariate).
%
% Output: g - estimate of the lag-one autocorrelation.
% a - estimate of the noise variance.[unbiased_var(x)~=a^2/(1-g^2)]
% mu2 - estimated square on the mea... |
96085e4df61474872f2896dea4ade2e0998f6d274e057f418c7bce22bf7c3261 | MATLAB | 3,893 | 83 | function p = checkForMissingTriggers( dataset , p)
%Check for missing triggers
%dataset = p.subj.subj_ds{ss};
% extract list of events from the MEG dataset
eventslist = ft_read_event(dataset);
% get list of possible event types
uniquetypes = unique({eventslist.type});
% assign index to events (instead of just strin... |
2e5a2cc324597649cef993eb1da6a301d66700d7acecef37af1987576bfa02af | MATLAB | 3,895 | 109 | % Second-kind integral equation on the unit cube, Laplace single-layer.
%
% This is basically the 3D analogue of IE_SQUARE2.
%
% Inputs (defaults are used if not provided or set empty):
%
% - N: number of discretization points in each dimension (default: N = 32)
% - OCC: tree occupancy parameter (default: OCC = 512... |
d8176cede856611c33b24cb58552122313164cb1bbbf5388d37123b1fe99cc91 | MATLAB | 3,896 | 94 | %% RMSEARCH demos
%% Find all zeros of besselj(2,x) betweeen x=0 and x=50.
% Note that x0 is actually ignored for the univariate
% optimizers fzero and fminbnd, as long as bounds are
% provided. Those bounds provide the information on where
% to search. Once the sample points are generated, rmsearch
% understands that... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.