sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
9200ad5087b54fcabc4152e809ca5d322c1d2d85a9b8d399ded11ee548dc2af4 | MATLAB | 5,504 | 182 | % eeg_eventtypes() - return a list of event or urevent types in a dataset and
% the respective number of events of each type. Ouput event
% types are sorted in reverse order of their number. If no
% outputs, print this list on the commandline instead.
%
% ... |
27601c88a2312bec4d162b62cb84726d28dcbfb1e86df8148af71e76e73591a3 | MATLAB | 5,505 | 110 | function [fmri_dat, region_obj, region_table] = thresholded_fmri_data_from_statistic_image (p_stat_img, stat_vec, atlas_obj, p, stat_type, thr_type, k)
% thresholded_fmri_data_from_statistic_image Thresholded map and region table
% for a non-standard statistic, from an in-memory p-value statistic_image.
%
% USAGE
%
% ... |
6ad7920b90f2f5bfe7fce7f0ff323d97bee0b26522de85f232d7d4f00c1359c7 | MATLAB | 5,505 | 161 | % Minimize sidelobe level of an FIR broadband far-field antenna array
% "Antenna array pattern synthesis via convex optimization"
% by H. Lebret and S. Boyd
% (figures are generated)
%
% Designs a broadband antenna array with the far-field wave model such that:
% - it minimizes sidelobe level outside the beamwidth of t... |
11734913fb68fcd8315953de0b8add05e99b3d9baa5e07e6b463b678fce34eb5 | MATLAB | 5,508 | 164 | function P = palm_quicksave(X,flg,opts,plm,y,m,c,filename)
% An intermediate function to be used many times in palm.m,
% which chooses an adequate mask, then places back the data
% into the points defined by this mask, and save.
%
% Usage:
% P = palm_quicksave(X,flg,opts,plm,y,c,filename)
%
% Inputs:
% X : Data ... |
38eca2ad8ed7fec523f1c7e79a41948e8b86871b03a27b637c9f3a8ee80e1938 | MATLAB | 5,508 | 152 | %To combine vessel diameter along pericytes across animals
stimAllTrials=[];
allnames={
'Tser4954b_res_cfr.mat'
'Tser4954c_res_cfr.mat'
'Tser5199_res_cfr.mat'
'Tser5072_res_cfr.mat'
'Tser5215_res_cfr.mat'
};
groupname='stimAllTrials';
all_rr1a_microns=[];
all_rr1aSEM_microns=[];
all_rr1a_percent=[];
all_rr1aSEM_per... |
a286cb62d742b6bf0f10405840377266b9022d067ca2458467b1028ace25fdcd | MATLAB | 5,509 | 130 | % Name: Robert Kim
% Date: 12-26-2023
% Email: robert.f.kim@gmail.com
% two_layer_connection_timeconstant.m
% Description: Compare module-wise synaptic strengths and effective
% synaptic decay time constants in the two-layer, one-modality (instr) RNNs.
% This script reproduces the two-module RNN summaries in Fig. 5d-g:... |
12d66621e63f38fa3d73fc19e8026d14eb6ae81296128ea64b3c2a340d7ef7e5 | MATLAB | 5,511 | 168 | function M = mvtk_read(filename)
% Read VTK formatted data from disk
% FORMAT M = mvtk_read(filename)
%
% filename - VTK-formatted file name
% M - data structure
%__________________________________________________________________________
%
% VTK File Formats Specifications:
% http://www.vtk.org/VTK/img/file-for... |
6583ffb864f777cf0a0cfa0ba418fa871aae62517e67777a9cee6a944e7106b9 | MATLAB | 5,512 | 150 | function pos = subfigrid(nrows,ncols,offset,scale)
%SUBFIGRID Create axis positions for subfigures
%
% The spacing of axes using the subplot command can be quite large, and
% manipulating axis positions after plotting can be tricky. For
% publication quality graphics, it is better to specify the subplot
% posi... |
05e1ed10cb2477776bccbc5cb4325e00c5348a31379a008d06b165935d3b8141 | MATLAB | 5,513 | 156 | function paramEP = ephysPropValues(ephysMetaDir, rawFile, ephysKilosortPath, gain_to_uV)
%
% JF, Load a parameter structure defining extraction and
% classification parameters
% ------
% Inputs
% ------
%
% ------
% Outputs
% ------
% paramEP: matlab structure defining ephys properties extraction and
% classificatio... |
d7c93290014f497ce6ddbff8590b3ab6cde0dce635108f1698aa20344c22c84c | MATLAB | 5,515 | 150 | function [ sortedData, fs ] = ...
importPhyFiles(pathToData, outputName, removeNoise)
%IMPORTPHYFILES reads the files created by both Kilosort and Phy or Phy2
%and, depending on the flag configurations, it saves a .mat file. The
%contents of this file are constructed with the output files (.tsv, .npy).
% ... |
226e69138a4624faafdbc92da95a4c01564e0f1579841fe41e533034474d37ba | MATLAB | 5,517 | 213 | % readegi() - read EGI Simple Binary datafile (versions 2,3,4,5,6,7).
% Return header info, EEG data, and any event data.
% Usage:
% >> [head, TrialData, EventData, CatIndex] = readegi(filename, dataChunks, forceversion)
%
% Required Input:
% filename = EGI data filename
%
% Optional Input:
% dataChunks = v... |
2a231b7721467bbe7100b532ba0b9f697a920817365e696c0cbc3f23c1862c6f | MATLAB | 5,517 | 129 | function OUT = run_glm_beta_resampling(S, baseline_sec, block_sec, iter_blocks, n_iter, bad_channels, concat_baseline_sec)
%RUN_GLM_BETA_RESAMPLING Resample GLM betas from raw SNIRF via preprocessing.
%
% OUT = RUN_GLM_BETA_RESAMPLING(S, baseline_sec, block_sec, iter_blocks, n_iter, bad_channels, concat_baseline_s... |
7e02fe9e2f9033bcc35c1bd1199324a11b956a9dadb406984451987c0b5e2539 | MATLAB | 5,517 | 164 | function whl = Find_RB_LED(file)
% This code tests an approximate median filter for separating out the red
% and blue leds mounted on top of the subjects head
% I was using the DataMax system, which was synced using a red LED. Hence,
% I am tracking the x,y position of the animal as well as when the sync
% light... |
0966336a20fec26e8d1223a9a624453bfdff25cff49cffc8a5cea37ab8c71ded | MATLAB | 5,519 | 153 | function [header,tracks] = ea_trk_read(filePath)
%TRK_READ - Load TrackVis .trk files
%TrackVis displays and saves .trk files in LPS orientation. After import, this
%function attempts to reorient the fibers to match the orientation of the
%original volume data.
%
% Syntax: [header,tracks] = trk_read(filePath)
%
% Input... |
083682753a430262be626da7bf98251654a6a1ea61bac970a91dc98008c7636d | MATLAB | 5,524 | 182 | function [y, info] = sprott_series(sys, n, opts)
%SPROTT_SERIES Scalar observable from a Sprott Appendix A system.
%
% [y, info] = nonantest.sprott_series(sys, n)
% sys is one element of nonantest.sprott_catalog().
%
% Returns an n-by-1 scalar observable and a struct of what was done:
% info.fs samples... |
2f89aba5100218bdefa5f8fb90b323f837999aa801bfdbeecd6650fdc9c146f1 | MATLAB | 5,524 | 166 | % gradplot() - Compute the gradient of EEG scalp map(s) on a square grid
%
% Usage:
% >> [gradX, gradY] = gradplot(maps,eloc_file,draw)
% Inputs:
% maps - Activity levels, size (nelectrodes,nmaps)
% eloc_file - Electrode location filename (.loc file) containing electrode
% - coordinat... |
8119b069a852d793902ed476555899663015f3170d5b92eb66b3565b62b1da95 | MATLAB | 5,524 | 124 | function [masksDirOut, maskFolders] = getActinMask(qfsmPackPaths, maskLoc)
%GETACTINMASK: return directory of actual hand-drawn or automated masks that was used for QFSM analysis
%
%INPUT: qfsmPackPaths : (n x 1 cell) paths leading to QFSM Package results.
%
% maskLoc : (n x 1 vector of integer) flag indi... |
3ffedb560f11d816dfbec817b451c79da8561a17475077ae9ae4df00d5ee5f00 | MATLAB | 5,527 | 128 | % Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions
%
%=========================================================================
%
% Copyright (c) 2008 Thomas Yeo and Mert Sabuncu
% All rights reserved.
%
%Redistribution and use in source and binary forms, with or without
%modification, a... |
5d51930af0928f28a46a6124bf4b2ba0261d5c75cabffa26071ef79af289137c | MATLAB | 5,532 | 150 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Generate Whole-Brain GMV Weight Maps for CCA Modes
% Author: Yuan Zhang
% Date: 2025-07-25
%
% Description:
% This script generates whole-brain NIfTI brain maps for both math- and
% reading-related modes, across both CMI and Stanford cohorts.
%... |
0eeb50d409cf649c0d0fe84e0b0dbe33dafd8ea9f5b2709887cd0512cd5d18a3 | MATLAB | 5,536 | 195 | function [o,count,SSQ] = sumskipnan(x, DIM, W)
% SUMSKIPNAN adds all non-NaN values.
%
% All NaN's are skipped; NaN's are considered as missing values.
% SUMSKIPNAN of NaN's only gives O; and the number of valid elements is return.
% SUMSKIPNAN is also the elementary function for calculating
% various statistics (... |
9f9fa2a040c5e94bdc07155f1d8881d77381125aedf78b850ec1d30594f874c8 | MATLAB | 5,537 | 163 | % test_main Test freezeColors / unfreezeColors
%
% JRI 4/2007
% Author:
% John Iversen
% john_iversen@post.harvard.edu
disp(' ')
disp('==================================================')
disp('==freezeColors / unfreezeColors interactive test==')
disp('==================================================')
dis... |
ccfcd879dcd01289813281fce49947f98c5547dcd66dced5ce260b1635ad6cf3 | MATLAB | 5,538 | 147 | % Script with default model parameters
% Adapted from Troost et al., 2023
function params = SOP_DefaultParams_rho_adapted_weighted(model)
%
% - NOTE: Perimeter-based weighting and many behaviors are implemented in
% SOP_multicell_LI_adapted_weighted (runtime), but this file prepares
% SOP indices and default para... |
322c42fedb10908dc680a556d2ed607e70023899a44184b5950604e4f202ba75 | MATLAB | 5,540 | 195 | function [Yc,Ycf]=homocor(vol,divmult)
% -----------------------------------------------------------
% to correct for image nonuniformity
% first fills in holes, then generates a low frequency
% background image and makes correction factor
% input image is stored in img, output is Iout
%
% homocor.m rev 0 ... |
1c380f5caaca72fa85cb7c1fb7428ee0683461c816ef2531e20138a7c61f56bf | MATLAB | 5,542 | 141 | function result = glmnetCoef(object, s, exact)
%--------------------------------------------------------------------------
% glmnetCoef computes coefficients from a "glmnet" object.
%--------------------------------------------------------------------------
%
% DESCRIPTION:
% This function extracts coefficients at ... |
5709197eaa9b2ec0260edcfd014eef6140d051746fffee92a54cd4e40a41dfd2 | MATLAB | 5,544 | 198 | function decline = CBIG_hypoTest_3t_withinFactorAcrossStages(stats)
% decline = CBIG_hypoTest_3t_withinFactorAcrossStages(stats)
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
beta = stats.Bhat;
betaCov = stats.CovBhat;
decline = zeros(9, 3);
fprintf('\n\n****... |
b77c70d2ad4c92234032d87afbf4c024609b82f56b4e3b15a9e2c90aebd59c50 | MATLAB | 5,549 | 187 | function [scat, ContourPatch] = kscontour(X, varargin)
% Kernel-density-smoothed 2D density plot.
%
% USAGE
% kscontour(X);
%
% OR
%
% kscontour(X, 'ArgName', ArgValue);
%
% OR
%
% H = kscontour(___);
%
% INPUTS
% X - Datapoints in 2D space (Npoints-by-2 matrix). If passed a cell
% array of Xs, ... |
3c5c90b7e5da5b3c0161c80fb62c2b211787700f42a50e9efa01a405099d9240 | MATLAB | 5,552 | 142 | function ea_save_reconstruction(coords_mm,trajectory,markers,elmodel,manually_corrected,options,outFilePath)
if ~exist('outfname', 'var')
outFilePath = options.subj.recon.recon;
end
ea_mkdir(fileparts(outFilePath));
for side=options.sides
reco.props(side).elmodel=elmodel;
reco.props(side).manually_correc... |
e49593e3f5f2307513284b2f3314bc28e710fc8302d204c17b5b625f7691d31e | MATLAB | 5,554 | 156 | %% LaBGAScore_prep_s2_smooth_multisess.m
%
%
% *USAGE*
%
% This script unzips fMRIprep output images, smooths them, zips the
% smoothed images, and deletes all the unzipped images again, for datasets
% with multiple sessions.
%
% Script should be run from the root directory of the superdataset, e.g.
% /data/proj_discov... |
7d18cc1e4e003f935119a73f8eb5badf32de259f3a8f3112c966f729a2e20c7c | MATLAB | 5,558 | 137 | %% Performs a group analysis within averages in 16 unique networks
% This primarily demonstrates the method fmri_data.ttest_table_and_lateralization_test
%
% 16 unique networks are derived from large-sampe resting-state fMRI. Networks are split by
% hemipshere and analyzed within L and R hemispheres. In addition,
% ... |
ade593d185825ef32a166f27b25303408334d399dd733d7c00f1ec59bcd635dc | MATLAB | 5,562 | 138 | % Minimize sidelobe level of a uniform linear array via spectral factorization
% "FIR Filter Design via Spectral Factorization and Convex Optimization" example
% by S.-P. Wu, S. Boyd, and L. Vandenberghe
% (figures are generated)
%
% Designs a uniform linear antenna array using spectral factorization method where:
% - ... |
d808eaf6f3cf9836993471d0c04782c19c0f4ae1ac32f95df26e64fb17358f7c | MATLAB | 5,566 | 146 | function handles = manual_dendrtictrace_v2(handles)
im_norm = handles.im_norm;
scrsz = handles.scrsz;
Mver = handles.Mver;
if isempty(handles.linewidth)
handles.linewidth = 6;
end
linewidthtmp = handles.linewidth;
[d1,d2] = size(handles.im_norm);
r = min(scrsz(3)/3*2/d2, (scrsz(4)-100)/d1);
pos_dend = round([scrsz... |
177e3889ef64a7a93eac75fa4a785bff2fc742086bcd24a0c6a1de9c16eb0d46 | MATLAB | 5,572 | 163 | % floatread() - Read matrix from float file ssuming four byte floating point number
% Can use fseek() to read an arbitary (continguous) submatrix.
%
% Usage: >> a = floatread(filename,size,'format',offset)
%
% Inputs:
% filename - name of the file
% size - determine the number of float ele... |
3c9cca0e6ea2354d9b683583fbab9cc04b84c2af072e753c521d5cf92e1ae102 | MATLAB | 5,573 | 149 | function s = convert(tree,uid)
% XMLTREE/CONVERT Converter an XML tree in a structure
%
% tree - XMLTree object
% uid - uid of the root of the subtree, if provided.
% Default is root
% s - converted structure
%__________________________________________________________________________
%
%... |
692ec5c433ae12e463abc5f1a30106a87422adbdc4e8942dce76c6776698c6a3 | MATLAB | 5,573 | 176 | function ea_unified_draw_volumetric(obj,vals,group,side,gradientLevel,voxcmap)
if strcmp(obj.drawTool,'sweetspotmapping')
% Plot voxels if any survived
res=obj.results.sweetspotmapping.space{side};
res.dt(1) = 16;
res.img(:)=nan;
elseif strcmp(obj.drawTool,'networkmapping')
if contains(obj.calcsetti... |
92d02b301275731e1c98481b871b65658c41540cb2d70e59fbe4d9b137be7f2c | MATLAB | 5,576 | 193 | function f = homogenous2traditional(H)
% HOMOGENOUS2TRADITIONAL estimates the traditional translation, rotation
% and scaling parameters from a homogenous transformation matrix. It will
% give an error if the homogenous matrix also describes a perspective
% transformation.
%
% Use as
% f = homogenous2traditional(H)
... |
7a48395a0df4ada2f49bab91f9845e1f115c8b534a384abeabe8aad9f0fb1483 | MATLAB | 5,579 | 172 |
function [ csd, lfpAvg ] = bz_eventCSD (lfp, events, varargin)
% [ CSD ] = bz_eventCSD (lfp, events, varargin)
% Calculates event-triggered (i.e. SWRs) CSD map from a linear array of LFPs
% INPUT
% lfp a buzcode structure with fields lfp.data,
% lfp.tim... |
077a210f4d62d2536db888943a388642f9119249ec04cd0b6ecbc22f54440060 | MATLAB | 5,582 | 97 | % std_specplot() - plot STUDY component cluster spectra, either mean spectra
% for all requested clusters in the same figure, with spectra
% for different conditions (if any) plotted in different colors,
% or spectra for each specified cluster in a separate figure
... |
5530b70370eadb0b46fbfd59ae736ef3d7a4baba246b676b33465bf683da7e12 | MATLAB | 5,582 | 150 | % std_topo() - uses topoplot() to get the interpolated Cartesian grid of the
% specified component topo maps. The topo map grids are saved
% into a (.icatopo) file and a pointer to the file is stored
% in the EEG structure. If such a file already exists,
% load... |
592676896455f7b9e0f90b2694ae39dc93d7d5754a4842c8c94c8c61e80b6639 | MATLAB | 5,584 | 96 | function [C,phi,S12,S1,S2,f,zerosp,confC,phistd,Cerr]=coherencysegpt(data1,data2,win,params,segave,fscorr)
% Multi-taper coherency computed by segmenting two univariate point processes into chunks
%
% Usage:
% [C,phi,S12,S1,S2,f,zerosp,confC,phistd,Cerr]=coherencysegpt(data1,data2,win,params,segave,fscorr)
% Input... |
6fd69e03b86d2d22a0eb0a055b1e7bcca88c7fde8e7df101dbea4334130fb3a6 | MATLAB | 5,585 | 144 | function [scales, fluctuation, alpha] = dfa(data, scales, order, plot)
% Perform Detrended Fluctuation Analysis on data
% Parameters:
% data (column vector): 1D numeric array containing time series data
% scales (numeric array): Array of scales to calculate fluctuations
% order (integer): Orde... |
293b74f61a699171b09be1397968af877da2459a5ae226956405aaa8466f23d6 | MATLAB | 5,590 | 181 | %%***************************************************************************
%% steplength: compute xstep such that X + xstep*dX >= 0.
%%
%% [xstep] = steplength(blk,X,dX,Xchol,invXchol);
%%
%% SDPT3: version 3.1
%% Copyright (c) 1997 by
%% K.C. Toh, M.J. Todd, R.H. Tutuncu
%% Last Modified: 16 Sep 2004
%%***********... |
b3d48f40a773a81e872875ab44928ae42b7e297a501f34a160ae67e7168d8c84 | MATLAB | 5,591 | 216 | function [vertices, edges, colors] = u3d_pre_quivergroup(ax)
%U3D_PRE_QUIVERGROUP Preprocess quiver output to u3d.
%
% usage
% [vertices, edges, colors] = U3D_PRE_QUIVERGROUP
% [vertices, edges, colors] = U3D_PRE_QUIVERGROUP(ax)
%
% optional input
% ax = axes object handle
%
% output
% vertices = ... |
ed007b8f6348ed72ba3257951263677f55f70bce58318d84c87c75aa93d353c3 | MATLAB | 5,598 | 181 | function [] = run_model_fitting_forGUI(SANDIinput, fig_axes)
% Main script to fit the SANDI model using Random
% Forest (RF) and/or multi-layers perceptron (MLP)
%
% Author:
% Dr. Marco Palombo
% Cardiff University Brain Research Imaging Centre (CUBRIC)
% Cardiff University, UK
% 8th December 2021
% Email: palombom@ca... |
1e9fc066a184709365547bd75292cfd9484931f7e978e8ada8daf9383ff5038e | MATLAB | 5,599 | 181 | function [] = run_model_fitting_with_dot_forGUI(SANDIinput,fig_axes)
% Main script to fit the SANDI model using Random
% Forest (RF) and/or multi-layers perceptron (MLP)
%
% Author:
% Dr. Marco Palombo
% Cardiff University Brain Research Imaging Centre (CUBRIC)
% Cardiff University, UK
% 8th December 2021
% Email: pal... |
7b89e05dfdbd425fd08ff056e18e4646687dbab521a92386f9412f1511409125 | MATLAB | 5,607 | 158 | classdef select_pvalue_significant_features_FP
% select_pvalue_significant_features_FP is a feature preprocessing (FP) object
% that uses an ANOVA to find the features with the lowest p-values using data
% from the training set. The algorithm uses all features that are less than a
% set p-value threshold.
%
%
%... |
2c765a2c60f362714cc0e78ef370621cd8bad50c7017f47027dbfe1e38610f78 | MATLAB | 5,612 | 138 | function [type] = ft_voltype(headmodel, desired)
% FT_VOLTYPE determines the type of volume conduction model of the head
%
% Use as
% [type] = ft_voltype(headmodel)
% to get a string describing the type, or
% [flag] = ft_voltype(headmodel, desired)
% to get a boolean value.
%
% For EEG the following volume conduct... |
3cdf7a38ae33eaa64e04c0d37309b59d615fe112799740f0bbb2e2f49dc1cdd9 | MATLAB | 5,612 | 169 | function Y = concat_blocks(E_blocks, baseline_samples, taper_samples)
%CONCAT_BLOCKS Concatenate epochs with default stitched-baseline alignment.
% Y = variance.concat_blocks(E_blocks, baseline_samples, taper_samples)
%
% Default behavior
% ----------------
% Prepare a continuous time series from multiple block e... |
d6c59c9e5a11343330eb69d94be6af5432b1964f873f78f07bc412f11bc09699 | MATLAB | 5,619 | 126 | function [label_structName_avgWinProb_tem, label_structName_avgWinProb_sub, label_structName_avgWinProb_cor] = CBIG_assignFactorsToStructures(tem_sub_cor)
% [label_structName_avgWinProb_tem, label_structName_avgWinProb_sub, label_structName_avgWinProb_cor] = CBIG_assignFactorsToStructures(tem_sub_cor)
%% aparc+aseg.mg... |
6576df11801a3f65fc3ce66bfe491f76e1c2f299ef43e805258dc0033c2b4762 | MATLAB | 5,621 | 132 | function ea_get_probab_axon_state(results_folder,plot_rates,settings,side)
% Estimate probability of axon activation based on a sweep of parameters
% (e.g. fiber diameters).
% By Butenko and Li, konstantinmgtu@gmail.com
arguments
results_folder % path to save the output
plot_rates {mustBeNumericO... |
109bc9eebdedae1c3c67e72d4a9b1aad04a3f6929cd2bd2eebf84bf25b98e95f | MATLAB | 5,622 | 131 | function [smoothdata,x_inds,y_inds,z_inds] = ...
histxyz(data_mtx, bins, smoothsd, levels, color, newfig)
%HISTXYZ 3-Dimensional Density Histogram.
% HISTXYZ(DATA_MTX), where DATA_MTX is an (M x 3) matrix, visualizes
% the density of a 3-D scatter plot. The rows generate a 3-D histogram
%... |
a086e814728a4bfdea1d9a0bbfd19b2d682b9a341f3f781e30a989d217709bdd | MATLAB | 5,622 | 136 | function vr = videoReader(url, varargin)
% videoReader class constructor
% Creates a object that reads video streams. We use a plugin
% architecture in the backend to do the actual reading. For example,
% on Windows, DirectShow will typically be used and on Linux, the
% ffmpeg library is often used.
%
% ... |
7a5f21fd103a0ab149e140a3013b0505866a6effe5fe07fb97fdbdef204a011d | MATLAB | 5,624 | 181 | function palm_miscwrite(varargin)
% Write various scalar data formats based on the struct X.
%
% palm_miscwrite(X);
%
% See 'palm_miscread.m' for a description of the contents of X.
%
% _____________________________________
% Anderson M. Winkler
% FMRIB / University of Oxford
% Aug/2013
% http://brainder.org
% - - -... |
ca4a0f8513d6c429aab76af041108f3079e48973b2f0ec8640820be7d3e18f61 | MATLAB | 5,625 | 175 | %% Set the working directory
clear
cd('C:\Users\perre\Cardin-Higley Lab Dropbox\Quentin Perrenoud\Partage-QP\Dryad'); %<--------- change to local path
addpath(genpath(pwd))
chFigDir = 'Figures'; %<--------- relative path to output figure directory
%% Load data
db2Mat = xlsread('Input_Matrix.xlsx', 'C2:AJ25'); % ... |
ca8b7f7259c8c233e43e6d61a127b2511a88f09430484cbf7b4552d5c1f8f005 | MATLAB | 5,627 | 195 | % Philipp Berens
% CircStat: A Matlab Toolbox for Circular Statistics
% Submitted to Journal of Statistical Software
%
% Example 1
%
% Demonstrate functionality of all functions of the CircStat toolbox using
% artifical data.
%% part1: generate data
alpha_deg = [13 15 21 26 28 30 35 36 41 60 92 103 165 199... |
ef774961aeefcface50318503f756787526f8c454731b234366d747f78d6f3e7 | MATLAB | 5,629 | 131 | function [Sc,Cmat,Ctot,Cvec,Cent,f]=CrossSpecMatpt(data,win,T,params)
%
%
% Multi-taper cross-spectral matrix - another routine, this one allows for multiple trials and channels
% but does not do confidence intervals. Also this routine always averages
% over trials - point process as times
%
% Usage:
%
% [Sc,... |
7aab7c5e3c386bde6dab43732a8de1adc4e03d60cb3678ccbe037f2e77932013 | MATLAB | 5,632 | 154 | function events = eeg_eventtable(EEG, varargin)
% eeg_eventtable() - returns all events contained in the EEG structure (and
% optionally exports them to a CSV file)
%
% Usage:
% >> events = eeg_eventtable(EEG);
%
% Inputs:
% EEG - EEG structure
%
% Optional inputs:
% 'unit' - Uni... |
3bfcf0497e47638723db3a3a3fb4c9080ef3466766025606e556484419a6f137 | MATLAB | 5,635 | 183 | % Sizing of clock meshes
% Section 4, L. Vandenberghe, S. Boyd, and A. El Gamal
% "Optimal Wire and Transistor Sizing for Circuits with Non-Tree Topology"
% Original by Lieven Vanderberghe
% Adapted to CVX by Argyris Zymnis - 12/04/05
% Modified by Michael Grant - 3/8/06
%
% We consider the problem of sizing a clock me... |
3c0616e76c9fcc30466ebd370a8cf353d80f65c8d5bd70ac424deea93abaeb01 | MATLAB | 5,641 | 165 | % ConvertBasler2pos - Convert Basler data to pos file format
%
% USAGE
%
% ConvertBasler2pos(filebasename,<options>)
%
% filebasename basename of the video file (should be filebasenmae.avi)
% <options> optional list of property-value pairs (see table below)
%
% ======================================... |
c53ae0647f64ffedf582dbf68518ff8c1d2a9b59e97fdf67ca912d2c1a1f6153 | MATLAB | 5,641 | 155 | function fh = isolate_axes(ah, vis)
%ISOLATE_AXES Isolate the specified axes in a figure on their own
%
% Examples:
% fh = isolate_axes(ah)
% fh = isolate_axes(ah, vis)
%
% This function will create a new figure containing the axes/uipanels
% specified, and also their associated legends and colorbars. The o... |
16fed285cb6f28f4a1c8f73e4bc97b89a0fb68fa7bef9205e7db56d687b42a49 | MATLAB | 5,652 | 102 | function CBIG_MMLDA_longitudinal_stability_wrapper(out_dir)
% CBIG_MMLDA_longitudinal_stability_wrapper(out_dir)
%
% Wrapper function to plot longitudinal stability of factors.
%
% Input:
% - out_dir : output directory
%
% Example:
% CBIG_MMLDA_longitudinal_stability_wrapper('~/example')
%
% Written by Nanbo Sun ... |
408f2c2f2a51a5d1ea61a422eaae870fb9cd3e1193a1f06542ce3c848813fe85 | MATLAB | 5,652 | 177 | tic
%needs LFP1-8
chspershank=64;
fpass1=0;
fpass2=200;
refchan=64;
numshanks=8;
shankLFP={LFP1 LFP2 LFP3 LFP4 LFP5 LFP6 LFP7 LFP8};
%%
shankCOH=cell(1,numshanks);
shankPHASE=cell(1,numshanks);
for shank=1:numshanks
LFP=shankLFP{shank};
% run_times=[1/1000 size(LFP,2)/1000];
... |
b53b49ec50fc51674cc99f43d83a63effb17a696508aecc36cf18991b62177db | MATLAB | 5,657 | 148 | % -------------------------------------------------------------------------
% Script: T1D_Estimation.m
% Authors: Zijian Gao,Weitian Chen
% Email: zijian.gao@link.cuhk.edu.hk
% Date: 2025-12-19
% Version: 1.0
%
% Copyright (c) 2025 Zijian Gao, Qianxue Shan, Weitian Chen. All right... |
55e83df83107f6ab80f786f54c8cdd1a3f0126ef51b53a62081d1c341405b5e9 | MATLAB | 5,659 | 152 | function h = image3(im,ij2xyz,handle)
% Display a 2-D image in Matlab xyz 3-D space
% h = image3(C, IJ2XYZ, handle)
%
% C is an image, encoded with scalars or rgb-values, i.e. the dimensions of
% C are either N x M or N x M x 3. Scalars correspond to indices in the
% current colormap and rgb-values should be within the... |
9710e3fe308682f5b05dc84e1c2106ec7d31755eef290d297efe433ef6c46aba | MATLAB | 5,663 | 124 | function qMetric = saveQMetrics(param, qMetric, forGUI, savePath, medianSpikeDepth, timeBins)
% JF, Reformat and save ephys properties
% ------
% Inputs
% ------
% paramEP: matlab structure defining extraction and classification parameters
% (see bc_ephysProperties Values for required fields
% and suggested starti... |
0129f2ca78a6ab8fa20a714cb756d348d648ac7033f05ff1a01f1e9445c203d1 | MATLAB | 5,665 | 159 | function ssgtest(spikes, assignments, show, mode)
% temporary script to translate the SSG_DATABROWSE functions into a GUI.
if (~ismember(mode, {'xy','xyz'})), error('Unknown mode.'); end;
if (isempty(assignments))
if (isfield(spikes, 'hierarchy') && isfield(spikes.hierarchy, 'assigns'))
assignments = spi... |
306390afb7cc0cba3bbefa62a65dbfa5e08555e0e28134d45f5e7ddd63a548ca | MATLAB | 5,665 | 148 | % dftfilt2() - discrete complex wavelet filters
%
% Usage:
% >> wavelet = dftfilt2( freqs, cycles, srate, cyclefact)
%
% Inputs:
% freqs - frequency array
% cycles - cycles array. If one value is given, all wavelets have
% the same number of cycles. If two values are given, the
% tw... |
6670f038e0a2eb7e730c85848698010ec56c909a996c4633b51ab235e79e0b81 | MATLAB | 5,673 | 127 | function [nWritten] = write_plx(filename, ch, freq, npw, n, ts, wave, units)
% write_plx: Write waveform data to a .plx file
%
% [nWritten] = write_plx(filename, ch, freq, npw, n, ts, wave, units)
%
% INPUT:
% filename - if empty string, will use File Save dialog
% ch - 1-based channel number that will be wr... |
a05d0d1ff93ea57c7a67eaf41daa59e97b39ff85bb1ec792ebae118ed7acaf0a | MATLAB | 5,674 | 154 | function oimg = loadtiff(path, sFrame, num2read)
% Copyright (c) 2012, YoonOh Tak
% All rights reserved.
% Modified by Eftychios Pnevmatikakis, 01/2017, 02/2018.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are
... |
561ebd0e238fd4357ac9941adbf974326f6575d2611b57ac18a98b14ce1d182a | MATLAB | 5,677 | 149 | function [vals,fibcell,usedidx] = ea_discfibers_loadModel_calcstats(obj,vals_connected)
% vals_connected are defined in the subspace of connected fiber for the
% particular lead-group loaded in Fiber Filtering Explorer
switch obj.multitractmode
case 'Split & Color By Group'
groups = unique(obj.M.patient.... |
706be2b0ac22206fcab4e8b3bc9dc529d1a19d557bf76d3083c10d8807febc3c | MATLAB | 5,689 | 312 | %first column = channel number on probe. Convention is ch. 1 is at top left of PCB
%and number wrap around in counter-clockwise fashion.
%second column = x coordinate, horizontal distance to reference electrode in microns. Convention is
%for reference electrode to be at bottom left corner of array when array
%p... |
76b87a12353a81ee549186aa249376b912ad559ad51e7b597fc58aac38de0180 | MATLAB | 5,693 | 179 | function [nearestID, dend_arcloc, dendloc] = nearestDendrite(roi_seed, dendriteROI, handles, ifhold)
if nargin < 4
ifhold = 1;
end
scrsz = handles.scrsz;
im_norm = handles.im_norm;
% assignin('base', 'handles', handles);
[d1,d2] = size(im_norm);
r = min(scrsz(3)/3*2/d2, (scrsz(4))/d1)/2;
pos_spine = round([100 100... |
c628bbbeeb246b148fc02091b400f3075db10e3213c21ce982e07f8163abfb2e | MATLAB | 5,696 | 165 | function [hc] = read_neuromag_hc(filename)
% READ_NEUROMAG_HC extracts the MEG headcoil marker positions from a neuromag
% fif file or from the fieldtrip buffer
%
% the definition of head coordinates is according to CTF standard:
% - Origin: Intersection of the line through LPA and RPA and a line orthogonal
% to L p... |
e3c4669eed8e1529e1a2411a46790fe0cd1f097bbcf65138b7108de553b48982 | MATLAB | 5,696 | 113 | function [spikeTimes_samples, spikeClusters, templateWaveforms, templateAmplitudes, ...
pcFeatures, pcFeatureIdx, channelPositions, channelMap] = loadEphysData(ephys_path, savePath, datasetidx)
% JF, Load ephys data (1-indexed)
% ------
% Inputs
% ------
% ephys_path: character array defining the path to your... |
f87bc7769ea186bb0c3b6c5c6fddccc1c3b22def61ba60f35d0e0918beafafe7 | MATLAB | 5,697 | 141 | function [maps,data,stats] = RippleStats(filtered,ripples,varargin)
%RippleStats - Compute descriptive stats for ripples (100~200Hz oscillations).
%
% USAGE
%
% [maps,data,stats] = RippleStats(filtered,ripples,<options>)
%
% filtered ripple-band filtered samples (one channel)
% ripples ripple ti... |
2bf21e59dc5092fd7eeff673ae2ba444183a7ecaea6fba7a64f0ed4b677436d4 | MATLAB | 5,698 | 128 | % Name: Robert Kim
% Date: 05-14-2023
% Email: robert.f.kim@gmail.com
% Script to quantify CEBRA-trajectory separation for attended vs. unattended
% modality in the 2-modality DMS RNN. Computes bootstrap-style Euclidean
% distances between condition centroids in each attention regime, then plots
% them side-by-side as ... |
33a1b9a8af2f13d43e17eb2a9c9068bed7b88eea16f2b5a8368c0c0c87dfaa73 | MATLAB | 5,698 | 130 | % correct_mc() - compute an upper limit for the number of independant
% time-frequency estimate in a given time-frequency image.
% This number can be used to correct for multiple comparisons.
%
% Usage:
% [ncorrect array] = correct_mc( EEG, cycles, maxfreq, timesout);
%
% Inputs:
% ... |
a934878d9f984e228e171de1b384f53d8d3b19a10be0fdefb2e391db7912b4a1 | MATLAB | 5,704 | 157 | function [w, A, C, sbc, fpe, th]=arfit(v, pmin, pmax, selector, no_const)
%ARFIT Stepwise least squares estimation of multivariate AR model.
%
% [w,A,C,SBC,FPE,th]=ARFIT(v,pmin,pmax) produces estimates of the
% parameters of a multivariate AR model of order p,
%
% v(k,:)' = w' + A1*v(k-1,:)' +...+ Ap*v(k-p,:)' +... |
25db1275081cc7120120ab1e71cef7d1b04badc8d2e6fa661baf8fae238cb479 | MATLAB | 5,705 | 167 | function [fitresult, figtitle, fmodel, xx, value_g] =...
FitstampResp(trace_stamp, framestamp, stampsel,...
fmodel_input, fmodel_Independent,fmodel_startpoint,...
funcsel, xvalue, handles, ttlabel, figiniID, datatitle)
N = size(trace_stamp,2);
t0 = [1; find(diff(framestamp)~=0)+1];
t1 = [find(diff(framesta... |
c153242f3b478d62eddc858c4a111a9bb5583deb938892bdde12c171ff6df612 | MATLAB | 5,707 | 153 | function threshold = chooseThreshold_stackview(img1,img2)
threshold = [];
showfun = @imshow;
if any(size(img1) ~= size(img2)) && any((2*size(img1)) ~= size(img2)),
errordlg('Data and Mask dimensions not consistent');
return;
end;
if all((2*size(img1)) == size(img2))
img.back = zeros(size(img1)*... |
d60859af911f4c8e676accc0e5ac026ed196c5b56207fd64cf11ac59241d7ed3 | MATLAB | 5,716 | 96 | function tractset = ea_unified_discfibers_compat_statmetrics2statsettings(tractset)
if isnan(tractset.statmetric)
return
end
switch tractset.statmetric
case {'Two-Sample T-Tests / VTAs (Baldermann 2019) / PAM (OSS-DBS)'}
tractset.statsettings.stimulationmodel = 'VTA';
tractset.statsettings.efi... |
e0874c8167fde96b41148a50e319605581ab832c2d02cce724e7281f977ddc64 | MATLAB | 5,720 | 166 | function [out1 out2 out3] = mst(A,varargin)
% MST Compute a minimum spanning tree for an undirected graph A.
%
% There are two ways to call MST.
% T = mst(A)
% [i j v] = mst(A)
% The first call returns the minimum spanning tree T of A.
% The second call returns the set of edges in the minimum spanning tree.
% The ... |
17b0d7fced1bd341dd1162dc0fc555c6daf82bdef39fb81510e5a123c94c0edf | MATLAB | 5,721 | 206 | function test_statistics
%%
msgid = 'matlab_bgl:test_statistics';
%% betweenness_centrality
n = 10;
A = cycle_graph(n);
% the centrality index of all vertices in a cycle is the same
bc = betweenness_centrality(A,struct('unweighted',1));
if any(bc-bc(1))
error(msgid, 'betweenness_centrality returned incorrect va... |
68a277ef64f798ee69f1bb9e099c3a6f4dd2a2af37aa8f8b2409800bdc72578b | MATLAB | 5,721 | 153 | function threshold = chooseThreshold_stackview(img1,img2)
threshold = [];
showfun = @imshow;
if any(size(img1) ~= size(img2)) && any((2*size(img1)) ~= size(img2)),
errordlg('Data and Mask dimensions not consistent');
return;
end;
if all((2*size(img1)) == size(img2))
img.back = zeros(size(img1)*... |
77ae1e8b0454c328d755dbcf7d5104adb1280fba57166faf9bd44a6b2def804c | MATLAB | 5,722 | 149 | function s = convert(tree,uid)
% XMLTREE/CONVERT Converter an XML tree in a structure
%
% tree - XMLTree object
% uid - uid of the root of the subtree, if provided.
% Default is root
% s - converted structure
%_______________________________________________________________________... |
bd401a81147ce51a5ad02d7c3bcfe26e8f5c51d2e6bc1521f02ac97d43688a41 | MATLAB | 5,723 | 107 | function [pnt, tri, srf] = read_bv_srf(filename);
% READ_BV_SRF reads a triangulated surface from a BrainVoyager *.srf file
%
% Use as
% [pnt, tri] = read_bv_srf(filename) or
% [pnt, tri, srf] = read_bv_srf(filename)
% Copyright (C) 2005, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldt... |
b15a0223870cf714e9c7dbd048364e024a8037cb30bcbe3f935399959d42422b | MATLAB | 5,741 | 126 | function param_complete = checkParameterFields(param)
% JF, Check input structure has all necessary fields + add them with
% default values if not. This is to ensure backcompatibility when any new
% paramaters are introduced. By default, any parameters not already present
% will be set so that the quality metrics are c... |
f204e6d8b25a44e64ffb259a515677a9f9afb776448f6f069d544bb9d05a65e1 | MATLAB | 5,744 | 169 | function [a,b,c] = Accumulate(variables,values,outputSize)
%Accumulate - Accumulate repeated observations.
%
% Accumulate repeated observations Y(i) = f(X1(i),X2(i),...,Xn(i)), where
% the Xj(i) are binned variables (i.e. they run from 1 to Nj). This
% is useful for instance to compute:
%
% * a PSTH, where Y(i) =... |
de0283a193c6b39be5491ff4c385a9395d44143477ba3af4bf51cbabb03bc115 | MATLAB | 5,747 | 183 | % Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions
%
%=========================================================================
%
% Copyright (c) 2008 Thomas Yeo and Mert Sabuncu
% All rights reserved.
%
%Redistribution and use in source and binary forms, with or without
%modification, a... |
d11ea787aeda04d9d1d445097cac6bb559d28088515feecafd332b1715b8aaa5 | MATLAB | 5,748 | 139 | %Script to find bad channels based on theta coherence matrices -
%loops through each animal, finds bad channels for each shank based on
%where coherence matrix shows an individual channel deviating from its
%neighbors by more than a certain threshold
%Inputs: currently set to expect 8 shanks and take LV's probe... |
8560e02d0f3e5b340e2c4a86d61aabac44059479bb2b024788ec5333b3ee1ccd | MATLAB | 5,749 | 132 | % std_topomovie - make movie in the frequency domain
%
% Usage:
% >> [STUDY] = std_movie(STUDY, ALLEEG, key1, val1, key2, val2, ...);
%
% Inputs:
% STUDY - STUDY structure comprising some or all of the EEG datasets in ALLEEG.
% ALLEEG - vector of EEG dataset structures for the dataset(s) in the STUD... |
a268a28729a74ddb02c5a41a28b25f1e121d620ce28a35dcbc10bf253bb54438 | MATLAB | 5,755 | 162 | function data = loadData_nii(dwifile,gradfile,maskfile,threshold)
data = [];
if not(exist('dwifile')),
[files path] = uigetfile({'*.nii;*.nii.gz;*.hdr', 'All accepted filetypes'},'Select nii containing DWI information','MultiSelect', 'on');
if not(iscell(files)),
... |
b34a9feb17d606eb390435070f12f15c567d10eeebd6b8b2b7ba68fa0fbdf4c9 | MATLAB | 5,756 | 152 | function colors = ea_distinguishable_colors(n_colors,bg,func)
% DISTINGUISHABLE_COLORS: pick colors that are maximally perceptually distinct
%
% When plotting a set of lines, you may want to distinguish them by color.
% By default, Matlab chooses a small set of colors and cycles among them,
% and so if you have more th... |
27baeb42fa4b1925c395eeaa54ea3d294d761eef62df86ba2c36a23aadcc3783 | MATLAB | 5,758 | 136 | function vr = videoReader(url, varargin)
% videoReader class constructor
% Creates a object that reads video streams. We use a plugin
% architecture in the backend to do the actual reading. For example,
% on Windows, DirectShow will typically be used and on Linux, the
% ffmpeg library is often used.
... |
34247a302ed227893e548543828120667ad52230313a5d6f7c32f2f407ebc7b4 | MATLAB | 5,758 | 153 | % std_readtopo() - returns the scalp map of a specified ICA component, assumed
% to have been saved in a Matlab file, [dataset_name].icatopo,
% in the same directory as the dataset file. If this file does
% not exist, use std_topo() to create it, else a pre-clusterin... |
cf1326c8817d3ffa6f134bda2f2dbd1655e8b1f06a9e101b7ac3a83a20dc6c22 | MATLAB | 5,759 | 142 | function varargout = impexp_run_msnames2ind(cmd, varargin)
% Template function to implement callbacks for an cfg_exbranch. The calling
% syntax is
% varargout = impexp_run_msnames2ind(cmd, varargin)
% where cmd is one of
% 'run' - out = impexp_run_msnames2ind('run', job)
% Run a job, and return its ou... |
e23c844d2d6c737f199a34c031ced456d9b495cb62952383cfa5721455fdde44 | MATLAB | 5,760 | 229 | function varargout = tracking( varargin )
%tracking Track anonymized usage data
%
% tracking(p,v,id) tracks usage to the property p for the product version
% v and identifier id. No personally identifiable information is tracked.
%
% r = tracking(...) returns the server response r, for debugging purposes.
%
% tra... |
db1fc4189ccf94e2a52c20007e743d5eabdf73357e269df3e19e5233ebaf4151 | MATLAB | 5,762 | 114 | %
% [NSx, NEV] = combineNSxNEV(filename1, filename2)
%
% This function loads two NSx and NEV files and it will combine them
% together into a sinlge NSx and NEV structure in MATLAB. To merge two
% NSx and NEV files into individual files see mergeNSxNEV. The time
% difference between the two sets of recordings... |
3968b4d358276463c536febbf9f98fd005d8082d2bb0212b4ef6f0f25e5be524 | MATLAB | 5,763 | 149 | function ea_explorer_visualizevoxels(obj)
sides={'right','left'};
%% Thresholding Part
if obj.thresholding.showsignificantonly
obj.recentmodel.voxels.sigvals=ea_explorer_corrsignan(obj.recentmodel.voxels.vals,obj.recentmodel.voxels.pvals,obj);
vals = obj.recentmodel.voxels.sigvals;
else
vals = obj.recentmod... |
6519ed985b9f80c9d1213bea81c10c6471b499802b317783795e691b8fd57862 | MATLAB | 5,763 | 154 | function [img,imHeader,frameRate,motorPos] = ...
readSCIMtif(tifFileName,varargin)
% readSCIMtif Load ScanImage .tif image data and header.
% [img,imHeader,frameRate,motorPos] = readSCIMtif(tifFileName)
% loads .tif. If multiple channels, img is a struct of size n channels with channel ID and
% image da... |
3aa6bd0a9687f584353e62b2b7e66ab5cbd933ee04eac99da4b7a95ac54d5423 | MATLAB | 5,768 | 164 | function headers = readPLXHeaders(filename)
% headers = readPLXHeaders(filename)
%
% This function reads the headers from 'filename', a .plx file. It is
% important for the CMBHOME.Import.PLX function because the plexon binaries
% do not return channel numbers of event strings. This is a major bug,
% since event string... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.