sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
af650ac1e668d1f643f9089f3dccf8957fbd7ef4ff7f3449d68155d0418b4f66 | MATLAB | 2,309 | 64 | % Script with default initial conditions
% Adapted from Troost et al., 2023
function y0 = SOP_InitialConditions_rho_adapted_weighted(model, params, k)
% Initializes each variable (Delta, d_A, Notch, E, Activator) for every cell.
% INPUTS:
% model - string specifying model type (e.g. 'Gaussian-like proneural gen... |
b3efb0063d97c1c425b305c9ac0d3192fb234b529858ba6d2c4d4b6dac421ef0 | MATLAB | 2,309 | 72 | function xxx = plugin_svm_contrasts_get_results_per_subject(DAT, svm_stats_results, DATA_OBJ)
%
% c2_SVM_contrasts runs SVMs for sets of images coded as 1 or -1
% within-person, across conditions. This may involve multiple images coded
% with 1 or -1 per person, in which case the svm_stats_results stats
% structures w... |
bca7317b6238accde7747d8870414e505cecfd983ced868227a70b95ea826c61 | MATLAB | 2,309 | 67 | % eeglab_options() - handle EEGLAB options. This script (not function)
% set the various options in the eeg_options() file.
%
% Usage:
% eeglab_options;
%
% Author: Arnaud Delorme, SCCN, INC, UCSD, 2006-
% Copyright (C) Arnaud Delorme, SCCN, INC, UCSD, 2006-
%
% This program is free software; you ... |
509a91fc2ffabe255562abccc95121d16ee8782a217f882764b594ec3d587221 | MATLAB | 2,310 | 52 | % 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... |
ead0590ae71559ebe4c01323aa2259f8cc5517fae1dca5d3ef4c4b6e92d2a8cb | MATLAB | 2,310 | 52 | function [BAPremoval_coef, trace_BAPremoval] = ...
BAPupdate_CMD(dff_all, BAPremoval_coef, trace_BAPremoval, BAP_current, scrsz, titlename, spID)
prompt1 = 'Accept BAP subtracted trace Y/N [y/n]: ';
prompt2 = 'Input new coef: ';
pos_BAPremove = round([50 scrsz(4)*0.4 min(scrsz(3)/2,550) min(scrsz(4)/2, 400)]);
minF... |
774b54e9eee99780871994bae293816b71d815d2cf1cc21a9ea6c06c4295ec05 | MATLAB | 2,312 | 57 | function [lh_output_file,rh_output_file,dim]=CBIG_gwMRF_build_prod_matrix(lh_input_filename,rh_input_filename,output_path,lh_output_filename,rh_output_filename)
% This function precomputes the products of timeseries data.
% The time series data can be created with alex_build_time_matrix
%
% Input
%... |
2968394419b3b7fa181c027448954ca6a36a6b4d5f357bcbc5e580ef8f4925bc | MATLAB | 2,314 | 53 | % 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... |
406ea215f69c665bc21202e496c79491ba634772b826ac7b0a2e83ac41503b95 | MATLAB | 2,315 | 67 | % realproba() - compute the effective probability of the value
% in the sample.
%
% Usage:
% >> [probaMap, probaDist ] = realproba( data, discret);
%
% Inputs:
% data - the data onto which compute the probability
% discret - discretisation factor (default: (size of data)/5)
% ... |
bab7520ef2f4a18cc04cb1e04f897fdaef7e5b7d62c7e7d83ff7d8ea9363e95f | MATLAB | 2,315 | 69 | % pop_kaiserbeta() - Estimate Kaiser window beta
%
% Usage:
% >> [beta, dev] = pop_kaiserbeta; % pop-up window mode
% >> beta = pop_kaiserbeta(dev);
%
% Inputs:
% dev - scalar maximum passband deviation/ripple
%
% Output:
% beta - scalar Kaiser window beta
% dev - scalar maximum passband devi... |
7e18c04e84cfebfd80853c8faa2ea02dbe120fda9878881aacc099fa33b1c63f | MATLAB | 2,317 | 90 | msgid='matlab_bgl:test_trivial';
%% Test functions on empty or trivial input
% The goal of these tests is to make sure we get error messages or
% reasonable output (i.e. it doesn't crash) on somewhat malformed or
% trivial input.
% test functions on empty matrices
try
d = bfs(sparse([]),0);
error(msgid, 'bfs... |
41bbb1e272a95a1a22af6416f8640813dc879bd439cb06ab7ff7e9851a9792fb | MATLAB | 2,318 | 42 | function X = cell2mat_ov_sum(I,xx_s,xx_f,yy_s,yy_f,zz_s,zz_f,overlap,sz,Bs)
% converts a cell array to a matrix when the cell elements overlap
% INPUTS:
% I: cell array
% grid_size: true size of each element
% overlap: amount of overlap in each direction
% d1: number of rows of matr... |
7d167f46a809a0981a336663cc879552661f5fc6a8404fed72174f8b511eafcf | MATLAB | 2,318 | 68 | ccc;
%% Path
SINGLEPATHs = dir("..\MAT Data\granger result raw\PE\**\single\**\*.mat");
SINGLEPATHs = unique({SINGLEPATHs.folder})';
SINGLEPATHs(contains(SINGLEPATHs, '\dev\')) = [];
SAVEPATHs = cellfun(@(x) strrep(x, '\granger result raw\', '\granger result minus base\'), SINGLEPATHs, "UniformOutput", false);
cellfun... |
cb83f95b72db3860dc14a220771bb84765c63a4663da0501f79febb252bfa69e | MATLAB | 2,319 | 83 | function kernel = create_kernel(kernel_type, pars, nMax, lb, ub, bound_pars)
%% create convolution kernel
%% inputs:
% kernel_type: string, convolution kernel type. now support {'exp',
% 'exp2', 'vector'}
% pars: parameters for the selected kernel type
% nMax: length of the kernel
% lb: lower bound fo... |
894daf2fcfd1b21ac2107e7b4dc0980999f76425814ccc3390c7d0cd89b54150 | MATLAB | 2,320 | 50 | % 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... |
0d37763fbf6df8ad53d48070d6280a28ef86ef00ab21d4b5423aeaecfac3bc96 | MATLAB | 2,322 | 64 | function [warped]= sn2individual(P, input)
% SN2INDIVIDUAL warps the input coordinates (defined as Nx3 matrix) from
% normalised MNI coordinates to individual headspace coordinates, using the
% warp parameters defined in the structure spmparams.
%
% this is modified from code from nutmeg: nut_mni2mri, which was itself... |
5ad21d2ee817dec247cb5efb23a6fd232545c6b14a9d4a55828178b1aa77aab3 | MATLAB | 2,322 | 63 | function fileExt = bfGetFileExtensions
% bfGetFileExtensions list all extensions supported by Bio-Formats
%
% Synopsis: fileExt = bfGetExtensions()
%
% Input
% none
%
% Output
% fileExt: a cell array of dimensions n x2 where the first colum
% gives the extension and the second the name of the correspond... |
6a05223f2a14659c14c335b31c871c294a44f8532f91efa5c87d46dcacea25fe | MATLAB | 2,322 | 82 | function [dm, dmVectors] = distMat2(A,B,metric)
%DISTMAT2 computes the distance matrix of two point sets
%
% SYNOPSIS dm = distMat2(A,B,metric);
%
% INPUT: A, B: Arrays containg rowA, rowB points with nCol dimensions.
% metric (optional): weight of the dimensions
%
% OUTPUT: dm: rowA-by-rowB array of d... |
0cac7a8eeb9183553e909ff3f82560baada4abf1b389d2327e827ea61f103864 | MATLAB | 2,323 | 85 | function vol = read_hdr(fname)
% Get a variety of information from a NIFTI header
% FORMAT vol = read_hdr(fname)
% fname - filename of image
% vol - various bits of information
%__________________________________________________________________________
% Copyright (C) 2005-2012 Wellcome Trust Centre for Neu... |
71d95f09da20644e70f770fba6fd7579871a89df46bb77c3429452a7c334caf1 | MATLAB | 2,323 | 102 | clear all % just clearing workspace
% define mean firing rate
Network_opts.meanspikebin = 1;
% define number of neurons
Network_opts.nneurons = 20 ;
% define number of bins
Network_opts.nbins = 10000;
% above define assembly membership
% line below sets neurons 1,2,3 and 4 to be in assembly 1
Assembl... |
11912cad5d69be45576ff9937ba356d3559a2e71b2d11be5c2f10ac50162902c | MATLAB | 2,325 | 64 | function handles = call_manualspine(handles)
scrsz = handles.scrsz;
im_norm = handles.im_norm;
[d1,d2] = size(im_norm);
r = min(scrsz(3)/3*2/d2, (scrsz(4)-100)/d1);
pos_spine = round([scrsz(3)/3 20 r*d2 r*d1]);
if isempty(findobj('type','figure','number',15))
pos = pos_spine;
else
h1_handles = get(figure(1... |
77201c7f731d88e3b020f0210dd453f50a0b376de59b0338d5c1522b1c73372f | MATLAB | 2,325 | 63 | % Load and characterize Hansen PET maps with MDS/clustering
% Load Hansen maps
petmaps = load_image_set('hansen22');
[~, ~, pet_condf] = string2indicator(petmaps.metadata_table.target);
plot_correlation_matrix(petmaps.dat, 'var_names', petmaps.metadata_table.target, 'partitions', pet_condf);
% Multidimensional scali... |
b0405aa837e076048475892619b5003a615598dcba552219bc6dba26a4c19a97 | MATLAB | 2,325 | 67 | function [w_itd,w_ild] = dupWeight(f)
%DUPWEIGHT Calculate duplex weighting coefficients for ITD and ILD
%
% [W_ITD,W_ILD] = IOSR.AUDITORY.DUPWEIGHT(F) returns the weighting
% coefficients for ITD W_ITD and ILD W_ILD for frequency F (Hz).
%
% The function is derived from Ben Supper's thesis "An onset-guided
% ... |
ebe5e72260f8a5df2c9ebf9c8edbdd8700dae519785877cc16ae983dfadbafa5 | MATLAB | 2,326 | 57 | function [corr, avgCorr] = CBIG_ASDf_corrTwoRuns(inputDir_best, inputDir, K, r_best, r)
% [corr, avgCorr] = CBIG_ASDf_corrTwoRuns(inputDir_best, inputDir, K, r_best, r)
%
% This function uses Hungarian matching algorithm to match factors between
% two runs (random initializations), and computes the pairwise correlation... |
22026ccea65eaf68a02acf535937253f34431e07901d7df961167a748f271d42 | MATLAB | 2,327 | 67 | %%% collect MUA temp files - THINGS
% v.2-Gemini
% 2022 P. Papale fecit
clear all
addpath(genpath('\_code\code_utils_v2\'));
% constants
% monkey = 'monkeyF';
monkey = 'monkeyN';
datadir_gen = '\';
temp_folder = '\_temps\';
trial_length = .3;
pre_trial = .1;
if monkey == 'monkeyN'
dates = {'2022011... |
4967b0ae674fe899ac82da72c5a4ca2e895727f941595581327e6fd58b90a5d8 | MATLAB | 2,327 | 73 | function get_sEEG_field_in_MNI_from_csv(field_in_csv, file2save, phi_field, anchor_img, transform, zipIt)
% Get nifti of field
% By Butenko, konstantinmgtu@gmail.com
arguments
field_in_csv % where the csv file with field components is stored
file2save % path for niftis to save
phi_field %... |
58564f0908c27807c05090295b8cb07be3b6d202e3e59131f878dcbf5f5daae4 | MATLAB | 2,329 | 54 | function myPLS_table_loadings(var_type,var_PLS_type,vars_PLS,vars_std,...
vars_lB,vars_uB,save_opts,var_names,signif_LC)
% This function writes a .csv file containing a table reporting the
% loadings & their standard error (standard deviation/confidence intervals)
%
% Inputs:
% - var_type : string, type of ... |
f1c8c683eb4e646a384eb5672b53c509ceb8fcf1b879b1dadbf216194aa7cc3b | MATLAB | 2,330 | 78 | function stats = CBIG_fitLME_3t(subInfoFile, GMICVFile, q)
% stats = CBIG_fitLME_3t(subInfoFile, GMICVFile, q)
% What is the subtype order?
% Offset by 1, the RID column
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
SUB_COL = 1+3;
COR_COL = 1+1;
fprintf('\n\n\n');
... |
f49f0a44ad6a00ffa4275acba14429e17e60eb78ecb6642262678d716ccdf539 | MATLAB | 2,330 | 54 | % 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... |
d6aec1ed8bc00ff6e94e0482469dd79aabe40d62eb4e08dc3a547f4c2807ccf8 | MATLAB | 2,331 | 94 | function y=twop_imfilt(x,mfp,smp,hcf)
% Usage ... y=twop_imfilt(x,mfp,smp,hcf)
if ~exist('mfp','var'), mfp=[]; end;
if ~exist('smp','var'), smp=[]; end;
if ~exist('hcf','var'), hcf=-1; end;
if isempty(mfp), mfp=0; end;
if isempty(smp), smp=0; end;
xdim=size(x);
if length(mfp)==1; mfp=[mfp mfp]; end;
if nargout==0,
... |
0ba37f49aab63e8bfb365dbdfbc27ca6466aca3e5fe415aaf0da9b4aeb97c6b3 | MATLAB | 2,336 | 73 | %% Convert the map to fsaverage
clear all; clc;
% Set environment
setenv('FREESURFER_HOME','/tools/freesurfer');
% Setup paths
p.Home = '/egor2/egor/MovieProject2';
p.FS_subDIR = fullfile(p.Home, 'bids_data', 'derivatives', 'freesurfer');
p.SamSrf = '/egor2/egor/MovieProject2/utils/SamSrf_V7.13';
addpath(genpath(p.Sa... |
b08bdcb988e25d06bd5144b776378e1022cc487804b618d17cf2b6c96779d4cb | MATLAB | 2,336 | 78 | % gauss2d() - generate a 2-dimensional gaussian matrix
%
% Usage:
% >> [ gaussmatrix ] = gauss2d( rows, columns, ...
% sigmaR, sigmaC, peakR, peakC, mask)
%
% Example:
% >> imagesc(gauss2d(50, 50)); % image a size (50,50) 2-D gaussian matrix
%
% Inputs:
% rows - number of rows in m... |
bf7ebaf7fde253761aadcf9b5814c6fd589004089b536631caf34354fa177ffc | MATLAB | 2,336 | 73 | function v = cvx( s, b, d, clean )
%CVX The CVX disciplined convex programming system.
% CVX is a modeling framework for building, constructing, and solving
% disciplined convex programs. CVX has online help for many functions and
% operations, divided into several subsection:
% cvx/commands - Top-level... |
c6e46c92a3b1e536ff3b1e279cc1c71e38e3a97576bb6a502cda45b1586c9b49 | MATLAB | 2,336 | 52 | function GCO_SetDataCost(Handle,DataCost,Label)
% GCO_SetDataCost Set the data cost of individual sites.
% GCO_SetDataCost(Handle,DataCost) accepts a NumLabels-by-NumSites
% int32 matrix where DataCost(k,i) is the cost of assigning
% label k to site i. Unfortunately, in MATLAB 2014a the mxCreateReferenc... |
d68fe78e09a52fbe68c8a278757618413f46c47027cc019ac88edbd1ee8aae3a | MATLAB | 2,336 | 77 | close all;clear;clc
% Set default parameters
fs = 1000;
bin = 0.1;
pre = 10;
post = 20;
% Select the folders to be analyzed
FolderList = uipickfiles;
%% Analysis
mice_odor_power = [];
for i = 1:size(FolderList,2)
% Determine the current subfolder name
selected_path = FolderList{i};
... |
49dc9032e163877f429d4eb4e36071619add3e9701a45c5a47184504202bdb0a | MATLAB | 2,337 | 99 | function x=editmask2(x,im)
% Usage ... x=editmask2(x,im)
%
% same as editmask but will let you edit labeled images
% by selection
wait_flag=0;
if exist('im','var'),
if iscell(im),
im_overlay4(im{1},x,256);
elseif size(im,3)>1,
im_overlay4(im(:,:,1),x,256);
else,
im_overlay4(im,x,256);
... |
c445ec723c4f5030276fcb44a2a4b74442c3ffefb599c245d6f2baa86d6e6328 | MATLAB | 2,337 | 80 | function NSx = openNSxSync(varargin)
% openNSxSync
%
% Opens a synced NSx file and removed the extra bit of data from the file.
%
% INPUT
%
% filename: The name of the file to be opened.
% DEFAULT: The program will prompt the user to select a file.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
cd71e2e350a163a9ab143e7eddfae251ead37b455d4b22d63476b878fddb87e6 | MATLAB | 2,337 | 60 | function [timePts, xslope] = getWaveformCriticalPoints(avWaves, fs)
% GETWAVEFORMCRITICALPOINTS returns the time points for which the first and
% second derivatives of the signal equals zero for the minima and/or maxima
% and the inflection points for a matrix NxM where N is the numbe of
% samples and M the number of s... |
f8b0f91a3ace684ed3af8473cb759d46560976e8a6a905dd5aa31519cc27e32c | MATLAB | 2,338 | 87 | function result = cvcoxnet(object, lambda, x, y, weights, offset, foldid, ...
type, grouped, keep)
% Internal glmnet function. See also cvglmnet.
if nargin < 10 || isempty(keep)
keep = false;
end
typenames = struct('deviance','Partial Likelihood Deviance');
if strcmp(type, 'default')
type = 'deviance';
e... |
53962d324bd386b1bc2bc3cf1327190831f6b0a61e5d59ae2165ddf6504609a7 | MATLAB | 2,340 | 59 | function p_pairwise = CBIG_MMLDA_glmfit_hypotest_forestplot(k, X, y, dependency, out_dir, out_name, compare_factor_names, CI_scale, p_thresh)
% CBIG_MMLDA_glmfit_hypotest_forestplot(k, X, y, dependency, out_dir, out_name, compare_factor_names, CI_scale, p_thresh)
%
% This function will do glmfit, hypothesis tests and f... |
b864d9d549b7eeba4d399e2f7f776e0bd8e5e3cfecef716d341faa8841c38891 | MATLAB | 2,341 | 53 | %% Replay estimatimation using ordered probability matrix
% This section quantifies replay by comparing forward vs reverse
% transition probabilities between neuron pairs.
% → positive: forward sequence, → negative: reverse sequence
x2_p = x2_pMat_glm;
x_p_replay_pair = [];
for i_ne = 1:n_ne_sync_e-1
x_... |
5015ae40dd73138a3f887fe134445dc2d2abf646c1ff5f44a2207928ca053689 | MATLAB | 2,342 | 57 | % pop_dipfit_batch() - interactively do batch scan of all ICA components
% with a single dipole
% Function deprecated. Use pop_dipfit_gridsearch()
% instead
%
% Usage:
% >> OUTEEG = pop_dipfit_batch( INEEG ); % pop up interactive window
% >> OUTEEG = pop... |
fb35edb4f833f01a2f3e6cc858ea6d9ff88b8f7c08688e5730131884bc3dab80 | MATLAB | 2,345 | 57 | function [matchstrs,inds] = strmatchre(pattern, strs)
%STRMATCHRE Select strings that match a regular expression.
% MATCHSTRS = STRMATCHRE(PATTERN, STRS) returns the rows of the character
% array or elements of the cell array of strings STRS that match the
% regular expression PATTERN (see REGEXP for the s... |
87ed2b9c24943b66202ed4a96e839d62a5879b3d36f3257436ae092f41265ac3 | MATLAB | 2,346 | 80 | % Polynomial discrimination
% Section 8.6.2, Boyd & Vandenberghe "Convex Optimization"
% Original by Lieven Vandenberghe
% Adapted for CVX by Joelle Skaf - 10/23/05
% (a figure is generated)
%
% The goal is to find the polynomial of degree 4 on R^n that separates
% two sets of points {x_1,...,x_N} and {y_1,...,y_N}. We... |
16ff3f1dfecfc7c4a94e875f2b2157a510deb2607ece0d273d5bcb868a2e55d4 | MATLAB | 2,347 | 51 | % 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... |
a2684e301d2991b4040b757c3f16461647a6d4c201b65733f4ff9dd9d79fa1df | MATLAB | 2,347 | 70 | % runpca() - perform principal component analysis (PCA) using singular value
% decomposition (SVD) using Matlab svd() or svds()
% >> inv(eigvec)*data = pc;
% Usage:
% >> [pc,eigvec,sv] = runpca(data);
% >> [pc,eigvec,sv] = runpca(data,num,norm)
%
% Inputs:
% data - input d... |
ab004f65dd27833b131c66ab1dd8d9dba5fd5a94a947934f246e4a521cbac473 | MATLAB | 2,348 | 62 | function [group, groupnames, groupcolors] = plugin_get_group_names_colors(DAT, mygroupnamefield, i)
%
% Helper function to get the grouping variable from the DAT structure that
% is specific to the condition/contrast of interest, indexed by
% mygroupnamefield = 'condition' or 'contrast', and i indexes
% contrast/cond... |
1a98ff6e5edc2f74976b48d642e7eb411dbe8920adf6d93e4c7285bb1fb0a067 | MATLAB | 2,351 | 60 | function [H_abs_ROI, H_abs, theta_map, px, py] = lineSegment(im, line_width)
filter_sigma = line_width/3^0.5;
filter_size = 6*floor(line_width)+1;
% filter_size = line_width;
g_x_sigma_x_y = zeros(filter_size*2+1);
g_y_sigma_x_y = zeros(filter_size*2+1);
g_xx_sigma_x_y = zeros(filter_size*2+1);
g_xy_sigma_x_y = zeros... |
3cd20bcd7f1063e8e971d3fde29e71b8227297af9f4ba3028d8a0aa232280538 | MATLAB | 2,351 | 38 | function settings = ea_elshift_oss(settings,side,first_active,last_active)
% By Butenko, konstantinmgtu@gmail.com
% OSS assumes straight electrodes building them from the first
% contact. So if active contacts are too distal, we need to
% imitate electrode shift.
% IMPORTANT: this trick only works if the active contact... |
30344af917c5f447b178317eb7f1fbf2859d203bce704f3d11b39e51fd76e31f | MATLAB | 2,352 | 77 | function [el_render, el_label, elSide] = ea_renderelstruct(options,resultfig,elstruct,pt,el_render,el_label)
% Wrapper function to render lead trajectories based on elstruct
if ~exist('elstruct','var')
[coords_mm,trajectory,markers] = ea_load_reconstruction(options);
elstruct(1).coords_mm = coords_mm;
elstr... |
6081e00e6a812999351e33adfac046e216fbaf94812164908e6fa829dfa3da8f | MATLAB | 2,352 | 60 | %% PaCER/EXAMPLE_5_1.m - Electrode reconstruction in **native** space with subsequent **transformation of the electrode
% objects to T1 space** (see example_1_2). The subcortical atlas from example 4 is now nonlinearly
% transformed and plotted with electrodes in T1 space.... |
99a93187af469745cd158b5afbc531f203bf030aa86d69d07028f84b46de2ba0 | MATLAB | 2,352 | 66 | function hdelta = getHDeltaData(allflies,trialtypes,flies,datatype,roi_idx)
% See end of code for more notes.
c = min(trialtypes)-1;
d = min(flies)-1;
r = length(flies);
for i = trialtypes
fb = [];
for k = 1:r
B = allflies(([allflies.trtype]==i) & ([allflies.flyID]==flies(k)));
% ... |
e9f3455ac59e5188cc272c045b9a189211c733af8674b38ad6bd672dd785ffb1 | MATLAB | 2,352 | 61 | % x = sdpavec(E,K)
% Takes an SDPA type sparse data description E, i.e.
% E(1,:) = block, E(2,:) = row, E(3,:) = column, E(4,:) = entry,
% and transforms it into a "long" vector, with vectorized matrices for
% each block stacked under each other. The size of each matrix block
% is given in the field K.s.
% **********... |
94c2ea4f5c9e1ea84dca8d5f491f2ac1bcf8bdb5303eb115acbb467e528e348d | MATLAB | 2,353 | 38 | function cifti_write_from_template(ciftitemplate, data, filename, varargin)
%function cifti_write_from_template(ciftitemplate, newdata, filename, ...)
% Use a template cifti struct with a dense or parcels diminfo and a new data
% matrix to write a new cifti file. The file extension is used to figure ou... |
a93339b031bd7f9c3dd3a36f507688b4db5519e03bd5a06181d0c3276daddac4 | MATLAB | 2,353 | 68 | % eeg_chantype() - Returns the channel indices of the desired channel type(s).
%
% Usage:
% >> indices = eeg_chantype(struct, types )
%
% Inputs:
% struct - EEG.chanlocs data structure returned by readlocs() containing
% channel location, type and gain information.
%
% Optional input
% types ... |
e4be390955eb8c0fee069b33063192a89140fb479a532203891f7362f3d77883 | MATLAB | 2,353 | 69 | function [Xc,Z]= airPLS(X,lambda,order,wep,p,itermax)
% Baseline correction using adaptive iteratively reweighted Penalized Least Squares;
% Input
% X:row matrix of spectra or chromatogram (size m*n, m is sample and n is variable)
% lambda: lambda is an adjustable parameter, it can be adjusted ... |
47994fb0a882ed12a1ed71c189052bed8ac8ec9ccec2c048edf87dbcf9159db4 | MATLAB | 2,354 | 65 | % Create a normal distribution with mean=0, std=0.26
pd = makedist('Normal','mu',0,'sigma',0.26);
% Draw 1000 random samples from the distribution
r = random(pd,[1000 1]);
% Plot histogram of the samples to visualize distribution
hist(r);
% Perform paired t-test between two columns of behav data
[h,p] = ttest(behav(... |
602b6ba9dee6ea6c6f2f0bc7dd6adbf906d6ab561ce630ba1b62a08b2785a23d | MATLAB | 2,354 | 77 | function varargout = cvx_run_solver( sfunc, varargin )
global cvx___
settings_arg = varargin{end};
settings = varargin{end-1};
inputs = varargin(1:end-nargout-2);
dumpfile = '';
custom_on = false;
if isstruct( settings ),
for f = fieldnames( settings )',
sval = settings.(f{1});
if isequal(... |
962eafe92a861b256d70b2276fb6610916fcf41c7d7cb51a67dc260672f7daa5 | MATLAB | 2,354 | 100 | function cvx_optval = rel_entr( x, y )
%REL_ENTR Internal cvx version.
cvx_expert_check( 'rel_entr', x, y );
persistent remap_x remap_y remap_z
narginchk(2,2);
sx = size( x ); xs = all( sx == 1 );
sy = size( y ); ys = all( sy == 1 );
if xs,
sz = sy; %#ok
elseif ys,
sz = sx; %#ok
elseif ~isequal( sx, sy ),
... |
35fcc584918d5efa00c5db4fb05cb31a4588eb973628ae9148f9542f637bb676 | MATLAB | 2,358 | 83 | %%*******************************************************************
%% combine_blk: combine small SDP blocks together,
%% combine all SOCP blocks together, etc
%%
%% [blk2,At2,C2,blkinfo] = combine_blk(blk,At,C);
%%
%%
%% SDPT3: version 3.1
%% Copyright (c) 1997 by
%% K.C. Toh, M.J. Todd, R.H. Tutuncu
%%... |
6f4abfd20063e97b80098c965f1eca80635a14ece8f51b71f689d5e9b1e3bf16 | MATLAB | 2,358 | 65 | % this script tests the import routines
% IT IS NOT USEFUL IN GENERAL, as it makes assumptions about what data is
% in the plx file.
disp('This sample .m script requires customization to work properly!');
% Open a plx file
% this will bring up the file-open dialog
%StartingFileName = '';
StartingFileName = 'C:... |
a8352de5ac40bbf1cd1cecf6c6d3816376024b4578010fcd323f5b3c3420f33a | MATLAB | 2,358 | 46 | function spikes = merge_clusters(spikes, to, from)
% MERGE_CLUSTERS Merge two clusters after automatic hierarchical aggregation.
% SPIKES = MERGE_CLUSTERS(SPIKES, TO, FROM) takes and returns a spike-
% sorting object SPIKES. SPIKES must have gone through a hierarchical
% clustering aggregation (e.g., SS_AGGR... |
13242b394730b1864f76301c7448691867ae39c9386c92532def48b2b5b4585d | MATLAB | 2,359 | 52 | %% Function GibbsSamplerHMMLDA
%
%%
% Runs the Gibbs sampler for the HMM-LDA model
%
%%
% |[WP,DP,MP,Z,X]=GibbsSamplerHMMLDA(WS,DS,T,NS,N,ALPHA,BETA,GAMMA,SEED,OUT
% PUT)| will run the Gibbs sampler for the HMM-LDA model on a sequence of
% word indices |WS| and document indices |DS|, both of size |1| x |n| whe... |
f8f8925ae76ed30cbadd7bedac766aa23893a220847cc333b909d30751dc7b73 | MATLAB | 2,360 | 82 | % loadelec() - Load electrode names file for eegplot()
%
% Usage: >> labelmatrix = loadelec('elec_file');
%
% Author: Colin Humprhies, CNL / Salk Institute, 1996
%
% See also: eegplot()
% Copyright (C) Colin Humphries, CNL / Salk Institute, Aug, 1996
%
% This program is free software; you can redistribute it and/or m... |
403e4a78c2ba642fe1d36cd3ca6fa6816b23a5a5fd5ffc1acb4b8de7003f8cdb | MATLAB | 2,361 | 79 | function [sel1, sel2] = match_str(a, b);
% MATCH_STR looks for matching labels in two listst of strings
% and returns the indices into both the 1st and 2nd list of the matches.
% They will be ordered according to the first input argument.
%
% [sel1, sel2] = match_str(strlist1, strlist2)
%
% The strings can be stored... |
73665167a0544f152cf8760bf96d77d1b99c2ca05f7a6764dd94540ed3ac51d8 | MATLAB | 2,361 | 90 | % Behavioral analyses
% unpack variables
names = DAT.BETWEENPERSON.between_subject_design.Properties.VariableNames;
for i = 1:length(names)
eval([names{i} ' = DAT.BETWEENPERSON.between_subject_design.' names{i} ';'])
end
disp(names)
% Groups
wh1 = DAT.BETWEENPERSON.group > 0; % Patients
wh2 = DAT.BETWEENPERSON.g... |
a590a553b5e9d34bc4ec387cfae572568e453fe6e8b73bc096d6132e52f7fc11 | MATLAB | 2,361 | 86 | function plotrawtrace(handles)
scrsz = handles.scrsz;
M = 0;
if ~isempty(handles.spine_trace)
M = M+2;
end
if ~isempty(handles.shaft_trace)
M = M+2;
end
if ~isempty(handles.dend_trace)
M = M+1;
end
if M>3
M2 = 2;
M1 = ceil(M/M2);
else
M2 = 1;
M1 = M;
end
pos_trace = round([20 30 800 500]);
... |
aec11b7adeefc22b5fb82da0368093c2462925409995b122eae66e01b773ba82 | MATLAB | 2,362 | 80 | function handles = featuredetect_batch_init(handles, batchini)
close(figure(7)) % cross-session registration
if batchini
para_default = defaultparameter;
handles.savingflag = 0;
% handles.defaultvalue = 0.6;
% handles.thresh = handles.defaultvalue;
handles.linewidth = para_default.linewidth;
h... |
9b409bb50fd4159b2a4eef375570d67ae9778e86600af8ff40775a8263751a6b | MATLAB | 2,363 | 73 | % firfiltsplit() - Split data at discontinuities and forward to dc padded
% filter function
%
% Usage:
% >> EEG = firfiltsplit(EEG, b);
%
% Inputs:
% EEG - EEGLAB EEG structure
% b - vector of filter coefficients
% causal - scalar boolean perform causal filtering {d... |
4766b97d0107a3f6215127a4fdeb71b220a2b97347b5cb6c34ab639c2be0f733 | MATLAB | 2,364 | 72 | function sout = cvx_quiet( flag )
%CVX_QUIET CVX output control.
% CVX_QUIET(TRUE) suppresses all text output from CVX (except for error and
% warning messages). Specifically, solver progress is not printed.
%
% CVX_QUIET(FALSE) restores full text output.
%
% If CVX_QUIET(TF) is called within a model---that... |
5bbe157749fef634ba43b37ac3bb1796a2de84b6c583e1712764a7294f779cd9 | MATLAB | 2,364 | 64 | function y = cvx_subs2str( x, mask, fieldalt )
if nargin < 2,
mask = [ 1, 1, 1 ];
end
if nargin < 3,
fieldalt = 0;
end
if ~isstruct( x ),
error( 'First arugment must be a structure.' );
end
y = '';
needfield = fieldalt ~= 0;
for k = 1 : length( x ),
try
tp = x(k).type;
catch %#ok
err... |
09ae874517bc9ac3b0f9f8169b0db1326058c2379d3e14637b042f7fbf8ebe04 | MATLAB | 2,365 | 79 | % laplac2d() - generate a 2 dimensional gaussian matrice
%
% Usage :
% >> [ gaussmatrix ] = laplac2d( rows, columns, sigma, ...
% meanR, meanC, cut)
%
% Example :
% >> laplac2d( 5, 5)
%
% Inputs:
% rows - number of rows
% columns - number of columns
% sigma - stan... |
46fa5cdfb7e617b05cc877abcc200f501e72767ce7e1390494fe21eaa44f8bc3 | MATLAB | 2,365 | 99 | function y = abs( x )
%Disciplined convex/geometric programming information for ABS:
% ABS(X) is convex and nonmonotonic in X. Therefore, when used in
% DCPs, X must be affine. ABS(X) is not useful in DGPs, since all
% log-convex and log-concave expressions are already positive.
%
% Determine the expression typ... |
095f2b3849bccce43354be874d44bfac99fe1a06b9c737b2efe69c74ccd96207 | MATLAB | 2,366 | 41 | %% Categorization and average
% required vars:
% channelcmb,
% grangerspctrm,
% chs2AvgAC, chs2AvgPFC
% nChAC, nChPFC
nChAC = length(unique(channelcmb(contains(channelcmb(:, 1), "AC"), 1)));
nChPFC = length(unique(channelcmb(contains(channelcmb(:, 1), "PFC"), 1)));
% AC as source
grangerspctrm_sour... |
814fccd18d37b67f1a8094cbfe795af456f162d0312759beb1ffe25b4e88e442 | MATLAB | 2,366 | 62 | function [C_calc] = LCN_calc2_model_2T4k_Vb(params,midscantimes,frameduration,CA_FINETIMES,CA_WB_FINETIMES,FINETIMES,calc_option,STEP)
%
% calculates the output value for the model_2T4k_Vb (with parameters params)
% FORMAT C_calc = LCN_calc_model_2T4k_Vb(params, midscantimes, frameduration, calc_option)
%
% params: val... |
d661d71ef2828bc035d2f14c480a37b010977d23de44184fe69e755aba18ac0e | MATLAB | 2,366 | 78 | % seemovie() - see an EEG movie produced by eegmovie()
%
% Usage: >> seemovie(Movie,ntimes,Colormap)
%
% Inputs:
% Movie = Movie matrix returned by eegmovie()
% ntimes = Number of times to display {0 -> -10}
% If ntimes < 0, movie will play forward|backward
% Colormap = C... |
85f69959f3c9a64293a2f18450b1096be6defb21377da928747598b4ee62d619 | MATLAB | 2,367 | 64 | function id=ea_method2methodid(obj,efm)
obj.compat_statmetric; % old compatibility for old statmetric notation (used to be stored as integers).
obj=ea_discfibers_compat_statmetrics2statsettings(obj);
if ~exist('efm','var')
efm=obj.statsettings.efieldmetric;
end
switch obj.connectivity_type
case 2 % PAM
... |
e179c9e5bb3116cfb2ef11e576ea17eee16e0f46cf387efd41b6d6d8c99ebe57 | MATLAB | 2,367 | 70 | % std_chaninds() - look up channel indices in a EEG structure
%
% Usage:
% >> inds = std_chaninds(EEG, channames);
% Inputs:
% EEG - EEG structure containing a chanlocs substructure.
% the chanlocs structure may also be used as input.
% channames - [cell] channel names. May also be... |
38f468c58791687566a5f66e04a4953e4cdb1c9143ef5cb7cc2d6a7d76de635d | MATLAB | 2,370 | 62 | function y = qinvjmul(labx,frmx,b,K)
% y = qinvjmul(labx,frmx,b,K)
%
% QINVJMUL Inverse of Jordan multiply for Lorentz blocks
%
% ********** INTERNAL FUNCTION OF SEDUMI **********
%
% See also sedumi
% This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko
% Copyright (C) 2005 McMaster University, Hamil... |
465f5a3bb55f0e0a7ef18b20ba647e9d924b2073c6735a94272f35d589e66504 | MATLAB | 2,371 | 59 | ccc;
RAWDATAPATHs = dir("..\MAT Data\pre (granger ext)\single\**\*Active\**\Prediction Data_*.mat");
MATNAMEs = {RAWDATAPATHs.name}';
AREAs = cellfun(@(x) x(strfind(x, '_') + 1:end - 4), MATNAMEs, "UniformOutput", false);
RAWDATAPATHs = arrayfun(@(x) string(fullfile(x.folder, x.name)), RAWDATAPATHs);
%% Parmas
fRange... |
578e1a560ee14dcfd99b736719f8a42f2f70bd9fc45812009f87af1d4f600ebe | MATLAB | 2,371 | 46 | function Obj=SOFAconvertARI2SOFA(hM,meta,stimPar)
% OBJ=SOFAconvertARI2SOFA(hM,meta,stimPar) converts the HRTFs described in hM, meta, and
% stimPar (see ARI HRTF format) to a SOFA object.
%
% Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences;
% Licensed under the EUPL, Version ... |
fe1d4eff4a2faf1e7ef7f98ff480f4c6b1a799adeb16a85cac03995449cc8bcd | MATLAB | 2,372 | 69 | function [dN,t]=binspikes(data,Fs,t)
% bin spikes at a specified frequency sampling i.e. sampling rate 1/sampling
% eg: 1ms accuracy use sampling = 1000
% Usage: [dN,t]=binspikes(data,Fs,t)
% Inputs:
% data (data as a structure array of spike times; or as a single
% vector of spike times)
% Fs (binn... |
8e4037456cc8260242bbe3ce0ac0f2a35d7cef2e4983f417388621991f93ad72 | MATLAB | 2,375 | 63 | % written by Yiyuan Han, Essex BCI-NE Lab, 03/03/2020
% Use ISPCs to measure the cross-frequency coupling
% getISPCCFC: Calculating the CFC measures with the ISPCs
% Input:
% - data: The input data for analysis, which is channel-by-time-by-trial
% - bin: the length of each bin for calculating the CFC across bins i... |
b0b7c78e0024edc8f90dd54e6476421732f80e8dafae3b497651f89692e06f34 | MATLAB | 2,375 | 61 | function tree = xmltree(varargin)
% XMLTREE/XMLTREE Constructor of the XMLTree class
% FORMAT tree = xmltree(varargin)
%
% varargin - XML filename or XML string
% tree - XMLTree Object
%
% tree = xmltree; % creates a minimal XML tree: '<tag/>'
% tree = xmltree('foo.xml'); % creates a tree from... |
d4376c11282c522d6e86580ead5a4b123c792a1c46bc1f730192fcbf4bfa4787 | MATLAB | 2,376 | 38 | function cifti_write_from_template(ciftitemplate, data, filename, varargin)
%function cifti_write_from_template(ciftitemplate, newdata, filename, ...)
% Use a template cifti struct with a dense or parcels diminfo and a new data
% matrix to write a new cifti file. The file extension is used to figure ou... |
d7feb864180869a78eeec3971d735a55b88fa46d170dda74129446f766673859 | MATLAB | 2,377 | 75 | function splitNEVNTrode
% splitNEVNTrode
%
% Opens and splits an NEV file based on its NTrode groups. It depends on
% openCCF file.
%
% Use splitNEVNTrode
%
% This function does not take any inputs.
%
% Example 1:
% splitNEVNTrode;
%
% In the example above, the user will be prompted to select a CCF file
% f... |
21d9404e2e81638b7ecaf9781c80fc76ce75b54d4866aee7ca20399333d13ff4 | MATLAB | 2,378 | 78 | function [X, levels, catvec] = LaBGAScore_dummy_code(v, varargin)
% Dummy-code a phenotype column into k-1 indicator columns.
%
% *USAGE*
%
% X = LaBGAScore_dummy_code(v)
% [X, levels, catvec] = LaBGAScore_dummy_code(v, 'reference', 'KUL')
%
% *WHY*
%
% A k-level factor needs k-1 columns. Coding thr... |
78938095f219bed23648cdd7a453ab277eb3e0db67de6af2e61d75412f6af711 | MATLAB | 2,378 | 104 | function lfplot(varargin)
% Plot (for one or two dimensions) a locfit() fit.
%
% Usage:
% fit = locfit(x,y);
% lfplot(fit);
%
% Plot the fitted smooth curve, and add a scatterplot of the data.
%
% Required argument:
% fit (produced by locfit()).
%
% Optional arguments:
% 'nodata' - don't add d... |
faf4b1e2ab3a7107eec91d2c789d061df1bfaa9d8933a1b2889cf0ceb761eb74 | MATLAB | 2,379 | 62 | function h = linec(x,y,z,c)
%LINEC Plots a line with color varying along its length.
% LINEC(X,Y,C) draws the parametric plot Y(k) versus vector X(k) for
% k = 1:length(X) with colors at each vertex given by the vector C
% (scaled into the figure colormap). The color between vertices is
% interpola... |
fca3f61035dabc70bdd9510a90d3cb261df06a92b878c97818aef9cda4338aaa | MATLAB | 2,379 | 58 | function ea_normalize(options)
% Entry function to run normalization
if ~ea_reglocked(options, options.subj.preopAnat.(options.subj.AnchorModality).norm)
% Setup log
if options.prefs.diary
ea_mkdir(fileparts(options.subj.norm.log.logBaseName));
diary([options.subj.norm.log.logBaseName, datestr(... |
687a92da6da95af96656d0b77d374856a8da0799e8a6dd937c073ae9e9ef133c | MATLAB | 2,384 | 104 | function [correlation,signif] = ScatterWithLinFit( x,y,varargin )
%[correlation,signif] = ScatterWithLinFit( x,y,color,varargin )
%
%'sig' 'pO','conf',or 'none'
%'corrtype' 'spearman' or 'pearson'
%'color'
%
%% Options/Defaults
p = inputParser;
addParameter(p,'sig','p0');
addParameter(p,'corrtype','spearman');
addPa... |
a27a58d133f9f78d6277ae05b860183bd58919865d62efd0959e968a617f0dae | MATLAB | 2,384 | 73 | % this script is a brief tutorial for mapping the firing rates of neurons
% onto the behavioral positions occupied by an animal
%
% This script assumes that you are currently in the
% /buzcode/tutorials/exampleDataStructs/20170505_396um_0um_merge folder,
% it will not work otherwise!
path = strsplit(pwd,filesep);
if ... |
82eb0f7643c03ad52538a752979254861e5b180b9c479836da65dac3602f7c5a | MATLAB | 2,386 | 63 | function [f,f_high,f_low,df_dt,df_dt_high,df_dt_low] = estOTUTrajDerivFromSplineSamples(phi_sample,T,B,BD,intervene_matrix,scaleFactor)
% This file is a part of the MDSINE program.
%
% MDSINE: Microbial Dynamical Systems INference Engine
% Infers dynamical systems models from microbiome time-series datasets, and
% p... |
ffc394130e2f8df7c30567c2c88ff6960011bb4491b3fa0aece32727c6e75a79 | MATLAB | 2,386 | 76 | function data = AFOFdata_struct3(inputdata, filenames)
% USE THIS FOR EXP3 (CEM)
% how it works:
% fly = AFOFdata_struct(data,filenames) where data and filenames are
% outputs from rotoball_importer()
for e = 1:length(inputdata)
for t = 1:length(inputdata{e}{1})
trial.filename = filenames{e};
... |
23ef18780d75aa69ce235972d08be9c140a21202bd18fb97051fa69f0a3f6bb7 | MATLAB | 2,387 | 54 | function settings = ea_updatePAM_parameter(options,settings,outputPaths,sample_i)
% Update one PAM parameter that is subjected to uncertainty (set in the GUI)
% By Butenko, Rajamani and Li, konstantinmgtu@gmail.com
arguments
options % Lead-DBS options for electrode reconstruction and stimulation
settings ... |
4b74cf249cd5c61151142e1032363468c1b56c85411467337bbddd8f5924ddbf | MATLAB | 2,387 | 78 | function [v_perp v_proj]=perpVector(point1,e_1,point2)
%finds the perpendicular vector v connecting the straight line defined by
%point1 and e_1 with point2
%
%SYNOPSIS v_perp=perpVector(point1,e_1,point2)
%
%INPUT point1, e_1 : point and UNIT vector defining the straight line
% point2: point from which the... |
bd15803748c3e1d6e772512dd27fb05ed7a5de14a8bc33d36de42aa58161d14b | MATLAB | 2,387 | 78 | function [IIM, JJM, deltaI, Iabs, Imap] = ...
Auto_points(handles, rect, sigma, quant, plot_flag, pointmode, ifbg)
% a function of particle detection. Use Delaunay triangulation to
% estimate local background intensity and t-test to determine true particles.
% Inputs:
% im: an image,
% rect: an region contains no... |
56893458223e65976437af703375d1f139c25a6afe06489548c488523e70ab52 | MATLAB | 2,388 | 64 | %% Figure 6 main
% Run fig6_analysis, then return here
YOURDATAPATH = '';
% Reload, given that classifier takes many hours, we reload everything
fileList = searchFilesRecursive(YOURDATAPATH, 'allROIs.mat');
load(fullfile(fileList.folder, fileList.name))
fileList = searchFilesRecursive([YOURDATAPATH 'featureBorders'], ... |
c7df6c8b505339286bd010bb768914de21c4adb8d215ca29acce418018327f20 | MATLAB | 2,389 | 76 | function panel = Subpanel(m,n,p,varargin)
%Subpanel - Add an (invisible) panel container to a figure.
%
% USAGE
%
% h = Subpanel(m,n,p,<options>)
%
% m,n,p panel position as in <a href="matlab:help subplot">subplot</a>
% <options> optional list of property-value pairs (see table below)
%
% =... |
735d65bc4946415827404506ee108123140e81ceafa6975653fc8630c1b8d773 | MATLAB | 2,391 | 95 | function gmsh_mesh1d_write ( gmsh_filename, m, node_num, node_x, ...
element_order, element_num, element_node )
%*****************************************************************************80
%
%% GMSH_MESH1D_WRITE writes 1D mesh data as a Gmsh mesh file.
%
% Licensing:
%
% This code is distributed under the GN... |
cf0080843d82c534643c6aeb3598b5530a16a854a066e7d93bd8fede1171880f | MATLAB | 2,392 | 63 | function [C_calc] = LCN_calc_model_2T4k_vasc1k(params,midscantimes,frameduration,CA_FINETIMES,CA_WB_FINETIMES,FINETIMES,calc_option,STEP)
%
% calculates the output value for the LCN_calc_model_2TCM_K1.m (with parameters params)
% FORMAT C_calc = LCN_calc_model_2TCM_K1(params, midscantimes, frameduration, calc_option)
%... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.