sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 17k | content stringlengths 1 200k |
|---|---|---|---|---|
3221b16411b39d06216878c41f469d065ef4aadd1aa2fb9c4a33e1d08abe80d7 | MATLAB | 1,946 | 64 | %% Load file
% Loading PD-L1.tif
[PDL1_file, PDL1_path] = uigetfile('*.tif'); % PD-L1_1.tif
tiffread(PDL1_file)
PDL1 = ans.data;
clear ans
% Loading masking file
[neuron_file, neuron_path] = uigetfile('*.tif'); % Neuron_2.tif
tiffread(neuron_file)
neuron = ans.data;
clear ans
[astrocyte_file, astrocyte_... |
7250053cda46bc1ee45a427b6ce95dbc010e833113a9dcf6db451be278bcec87 | MATLAB | 1,949 | 42 | %% change - where membrane mrcs are stored
memb_dir = "/g/scb/mahamid/Dorothy/For_Sharing/20230606_organized_data/membranes/mrc/";
cd (memb_dir)
%% change - list of tomograms to analyze
tomo_list = ["control_box046_09"];
%% change - where to output csv
output_dir = "/g/scb/mahamid/Dorothy/Pipeline_after_CNN/20230906... |
8d3e402f1202a09c56c28129db63c2ba2ed4ea50fa87ba09ddfb5573785723b1 | MATLAB | 1,953 | 84 | function T=path_transitivity(W,transform)
% PATH_TRANSITIVITY Transitivity based on shortest paths
%
% T = path_transitivity(W,transform)
%
% This function computes the density of local detours (triangles) that
% are available along the shortest-paths between all pairs of nodes.
%
% Inputs:
%
% ... |
1023659c7680f6aa1c278285a44b4e45af3ce8645dda445d35fcf2d193b8bb4d | MATLAB | 1,962 | 69 | %% Fig 3B - Plot activation raster from saved data
SHUFFLE = true; % true = shuffle within groups
if ~exist('DATA_ROOT','var'), run(fullfile(pwd, 'matlab', 'config.m')); end
load(fullfile(DATA_ROOT, 'fig3b_raster.mat'));
nROI = size(binROIRaster, 1);
fSums = sum(binROIRaster, 2);
if SHUFFLE
% Sort by first appe... |
d28f76715869a6bdadbbde8678099a48c50cfb118cd8ce5766afeeeeb99ed826 | MATLAB | 1,965 | 48 | function [data_filter_above,data_filter_below] = loc_list_clusters_filter_no_of_locs(data)
answer = inputdlg({'Enter Minimum Number of Points per Cluster:'},'Input',[1 50],{'5'});
if isempty(answer)~=1
min_N = str2double(answer{1});
f = waitbar(0,'Filtering Based on Number of Locs...');
for i=1:length(... |
d809b8e8795bd9d31c3200f05e295cab1a3a62ff0f9efe11afcd3d981bf115d5 | MATLAB | 1,968 | 57 | classdef OrdinaryLeastSquares < nla.inputField.SandwichEstimator
%This class will act nearly identically to the SandwichEstimator input,
%with the only difference being that it will startup the sandwich
%estimator input GUI with an extra flag indicating that we will force
%the standard error calculation... |
c30a57d206c9b062a30608b16e3dd52550351ab4007d4d4405a94adb29f0fff0 | MATLAB | 1,970 | 98 | clear
% maindir = [path_ludisc '\common\DATA\MIPCART pilot\Pilot MRI\'];
% fnl = fix_findFiles(maindir, '*MAGNITUDE_dn_mc_pa.nii.gz');
load('mipp_fnl_MAGNITUDE_dn_mc_pa.mat'); fnl_pa = fnl(1:2:end);
load('mipp_fnl_roi_dMRI.mat'); fnl_roi = fnl;
% PA data order LTEz PTEyz STE LTEx
lstr = {'LTE_2', 'PTE_{23}', 'STE', '... |
4a4b81b37697f93d1df4526c267f04556ae04ded4b6b5c9382c913de95978ffa | MATLAB | 1,976 | 59 | function s = SurfStatVol2Surf( vol, surf );
%Interpolates a volume to each surface, then averages.
%
% Usage: s = SurfStatVol2Surf( vol, surfs );
%
% vol.data = nx x ny x nz volume aligned to the surface data.
% vol.origin = [x,y,z] location of vol.data(1,1,1) in mm.
% vol.vox = [x,y,z] voxel size in mm.... |
7419644a7f41c546723e1838f68fc7ed8a373d1886efb376fccc23804c39a958 | MATLAB | 1,981 | 45 | function contrast_mask = tc_make_contrast_mask(model_dir, mask_config)
%% contrast_mask = tc_make_contrast_mask(model_dir, crit, data_labels_to_include, and_or_ors)
load([model_dir filesep 'SPM.mat'], 'SPM')
% extract contrast names from SPM file
contrast_names = {SPM.xCon.name};
% match contrast names to select resp... |
fa4319b5b6af95fc0679c45b3ba3d091f4a904f7973d7a37215e0c80470c3921 | MATLAB | 1,982 | 49 | function [data_filtered,data_noise] = loc_list_remove_noise(data)
answer = inputdlg({'Enter k-value for KNN Search (Including the point itself):','Cutoff Percentile:'},'Enter k-value for KNN Search (Including the point itself):',[1 50],{'5','95'});
if isempty(answer)~=1
k = str2double(answer{1});
cutoff... |
af20e9979516c9a25b75239028573b29c64db0b854c17af980d578fc1777e492 | MATLAB | 1,984 | 40 | function plot_grouphists_motion_by_characteristic(var1subs,var2subs,FDparams,outDir,varname1,varname2)
% assumed order - change if not correct
motion_dirs = [1:6]
motion_directions = {'x','y','z','pitch','yaw','roll'};
for i = motion_dirs
motion_dir = motion_dirs(i);
% HF pwr
tmpvals.(varname1) ... |
fc53cc22c6f7909cab013c9a6d6bc5b6b210b109fee71ad5434ba86f85bbd1d5 | MATLAB | 1,986 | 49 | function FunctionBasedPlotExample(inArg)
% inArg will be a struct with 2 fields:
% net_result is the net_result object selected by the user in the
% NLA_Result window
% test_method is the type of test (no_permutations, full_connectome, within_network_pair)
% net pair) of the selected test.
... |
214c881af016de201b957b5e580aba3947945ce27146175e97f8e4b30b6a1388 | MATLAB | 1,990 | 33 | % Function to extract centroids of a cortical parcellation on the
% Freesurfer sphere, for subsequent input to code for the performance of a
% spherical permutation. Runs on individual hemispheres.
%
% Requires read_surf.m and read_annotation.m functions, distributed with Freesurfer (Applications > freesurfer > mat... |
6ead9aa841e991efc1a0376efd2b29e7d4910ea348ecc3749d5df7813adfaf6b | MATLAB | 1,990 | 70 | classdef String < nla.inputField.InputField
properties
name
disp_name
default
end
properties (Access = protected)
label = false
field = false
end
methods
function obj = String(name, disp_name, default)
obj.name = name;
... |
c8fbe56abf6557d181fadd569501decb03a5ebcfa99b0ff9d544a2b9bbdb3e82 | MATLAB | 1,990 | 49 | function events_tpz = nst_make_event_toeplitz_mtx(events, time_ref, nb_coeffs)
% NST_MAKE_EVENT_TOEPLITZ_MTX build binary toeplitz matrices from given events,
% ready for convolution.
%
% EVENTS_TPZ = NST_MAKE_EVENT_TOEPLITZ_MTX(EVENTS, DT, NB_SAMPLES, NB_COEFFS)
%
% EVENTS (struct array):
% events a... |
dc0974d52c6a5ab44c50bd5d743a64684bb88e430e3d999f081b4c5ad3757a51 | MATLAB | 1,994 | 59 | function dataVC = eegVirtualChannels(parameterSettingsVC, dataTL)
%% dataVC = eegVirtualChannels(parameterSettingsVC, dataTL)
tc_struct2ws('caller', parameterSettingsVC)
% load all relevant anatomical / structural data
load(sensFile) % sensors as obtained e.g. by janus3D (Clausner et al., 2017)
load(leadfieldFile) % ... |
2349ddd7beedb95980a47dcac71703e5c4fe5d491933eee13b7e19a797c9b6d4 | MATLAB | 2,006 | 60 | function loc_list_save_png(data,map,c_lim)
path = uigetdir(pwd);
if path~=0
answer = inputdlg({'Pixel Size:','Resolution:'},'Input',[1 50],{'116','20'});
if isempty(answer)~=1
pixel_size = str2double(answer{1});
resolution = str2double(answer{2});
f=waitbar(0,'Saving Image...');
... |
4bca67fd7635bd9f1b06bf3a4235f36693c80e217e9cdc9e7988b29a1e597231 | MATLAB | 2,013 | 64 | function StreamIndices = Which_StreamIndices_ThisMCmodule(Modules, m, format)
% FUNCTION StreamIndices = Which_StreamIndices_ThisMCmodule(Modules, N)
% This function takes as input: i) a vector Modules of size N^2 - N, giving
% the module label associated to a MC row (from a module structure extracted
% from a MC matr... |
da4e84368e6d376aa8733df94a3e5e8445c967e6e8cd56c389ba763639f66915 | MATLAB | 2,019 | 76 | %% JARQUE-BERA TEST FOR GAUSSIANITY [from Luetkepohl 2005, New introduction to multiple time series analysis, pag 175]
% null hypothesis: joint gaussianity
% if ptot<alpha, reject -> non gaussian
function [ptot,ps,pk,lambdas,lambdak,crittresh,stringout,stringflag]=test_gaussianity(U,alpha);
% %%% input:
% u: m... |
88030d13297f5eaa187619b79004169e17047387189a68f165a4f2056a1ba85e | MATLAB | 2,021 | 71 | function mr = redmod( m, meanorvariance );
%Reduces a linear mixed effects model by removing redundant variables.
%
% Usage: mr = redmod( m [,meanorvariance] );
%
% m = model, either term or random or anything that can be so converted.
% meanorvariance = 'm' to reduce just the mean, 'v' to reduce just the
% ... |
e685d761d70dfc70e9cb18bd47b83e1a6f1aff5afd1925e741b66a7a3013e03d | MATLAB | 2,021 | 57 | function r = pagerank_centrality(A, d, falff)
%PAGERANK_CENTRALITY PageRank centrality
%
% r = pagerank_centrality(A, d, falff)
%
% The PageRank centrality is a variant of eigenvector centrality. This
% function computes the PageRank centrality of each vertex in a graph.
%
% Formally, PageRank is defined ... |
c01dc4814f712fc83ed5b1afbda4becd7f13288d030cefb0760ce1e74ffdca0e | MATLAB | 2,024 | 60 | function [mapSNRr,mapSNRdb,allSNRr,allSNRdb]=SNRs(images,mask,before,after,tfilt);
% Function for calculating SNR from amplitude and s/d of noise .
% Chris O'Shea and Ting Yue Yu, University of Birmingham
% Maintained by Chris O'Shea - Email CXO531@bham.ac.uk for any queries
% Release Date -
% For licence inf... |
23a01ae4164094721ce73025582797e6e25855f83708a677c8d5940689ace59c | MATLAB | 2,027 | 49 | function [R,Nk,Ek] = rich_club_bu(CIJ,varargin)
%RICH_CLUB_BU Rich club coefficients (binary undirected graph)
%
% R = rich_club_bu(CIJ)
% [R,Nk,Ek] = rich_club_bu(CIJ,klevel)
%
% The rich club coefficient, R, at level k is the fraction of edges that
% connect nodes of degree k or higher out of the maxim... |
74005efdb06b3b752efb4cc6464ba00f3b215887a9e52f17557d7b0d0b61d08e | MATLAB | 2,044 | 64 | function [ PDn, PDnchan ] = Extract_MEGSensor_Information_LBPD_D( stats )
% It extracts information about the clusters of the provided MEG sensors clusters.
% To be used in connection with 'MEG_sensors_MonteCarlosim_LBPD_D' (provide
% its output as input to the current function).
% INPUT: -stats: : file o... |
00f095a86da8d9c2faf134b672ba5f6c90861fdd5c580ba39acea5d0ed148a27 | MATLAB | 2,051 | 65 | function [A, A1, po]=mkfilt_lcmv(L,C,alpha)
% [A, A1, po]=mkfilt_lcmv(L,C,alpha)
%
% Calculates the power over all grid points using lcmv
% This is a vector beamformer. For each voxel the dipole direction is chosen, which maximizes power.
%
% Input:
% L: Lead field matrix, NxMx3 matrix for N channels, M voxel... |
0f5f670dcf62f74b3165459ed0c899bd77ad1745fd4c43300a479bd56c4552bf | MATLAB | 2,051 | 50 | function [X,Y,T,vx,vy,v,fitxyt]=master_vel(XYT,MINt,MAXt,MINV,MAXV,winsize,wint);
% function [X,Y,T,vx,vy,v,fitxyt]=master_vel(XYT,MINt,MAXt);
% Velocity computation script
% To run: in matlab type: [X,Y,T,vx,vy,v,fitxyt]=master_vel(XYT,MINt,MAXt);
% INPUTS:
% XYT: a matrix with rows consisting of the x,y,t l... |
3701ed941763e1d67148c528b7c43491161ffbc52636f0279e4a6f0ab941cb7c | MATLAB | 2,052 | 61 | %% IDENTIFICATION OF EXTENDED MVAR MODEL: Y(n)=B(0)Y(n)+B(1)Y(n-1)+...+B(p)Y(n-p)+W(n)
% MAKES USE OF PRIOR KNOWLEDGE ABOUT DIRECTION OF INSTANTANEOUS EFFECTS
%%% input:
% Y, M*N matrix of time series (each time series is in a row)
% p, model order
% ki, row vector of causal ordering
% idMode, determines strcit... |
6b15a4e4c45f49d41b8eb54dbc25726990d6fc558025f1ba20f77b01e441703b | MATLAB | 2,053 | 64 | function [h pi] = fdr(p, q);
% FDR false discovery rate
%
% Use as
% h = fdr(p, q)
%
% This implements
% Genovese CR, Lazar NA, Nichols T.
% Thresholding of statistical maps in functional neuroimaging using the false discovery rate.
% Neuroimage. 2002 Apr;15(4):870-8.
% Copyright (C) 2005, Robert ... |
3d5e958feca38f7e870f7b1225aee9bbb8e0971435cc264973d198f48fc5da72 | MATLAB | 2,063 | 68 | function [R,D] = reachdist(CIJ)
%REACHDIST Reachability and distance matrices
%
% [R,D] = reachdist(CIJ);
%
% The binary reachability matrix describes reachability between all pairs
% of nodes. An entry (u,v)=1 means that there exists a path from node u
% to node v; alternatively (u,v)=0.
%
% T... |
427294598188d97899e3c5a1d03fc7271e87f72b4e8a3ad0e7c67b91c59dc648 | MATLAB | 2,063 | 72 | function [Rw] = rich_club_wu(CIJ,varargin)
%RICH_CLUB_WU Rich club coefficients curve (weighted undirected graph)
%
% Rw = rich_club_wu(CIJ,varargin) % rich club curve for weighted graph
%
% The weighted rich club coefficient, Rw, at level k is the fraction of
% edge weights that connect nodes of degree k or h... |
211599ade605e3958cd1ea766349bd6927ba3c0fbb3029ea506efcf4a23da0f4 | MATLAB | 2,067 | 75 | function [Rw] = rich_club_wd(CIJ,varargin)
%RICH_CLUB_WD Rich club coefficients curve (weighted directed graph)
%
% Rw = rich_club_wd(CIJ,varargin)
%
% The weighted rich club coefficient, Rw, at level k is the fraction of
% edge weights that connect nodes of degree k or higher out of the
% maximum edge weight... |
50738ae6bf9c2ab1b4d0554c85dba427ca8d5818e3b200f9e5b0c927322c46a1 | MATLAB | 2,067 | 41 | %numRuns=length(dir('S*.nii'));
clear;
% current working directory needs to be /path/to/scripts
mainpath = pwd;
addpath([mainpath filesep 'toolboxes' filesep 'spm12'])
files=dir([mainpath '/../subjectData/S49/1_realignment/test0.nii']);
allFiles=[]; allFiles_a=[];allFiles_b=[];allFiles_c=[];
for runs=1:1
base=[fil... |
acba824b40bb5b984855ebb5ab927f93fc4bacc1f6ef1ecf79b6d2d073b74885 | MATLAB | 2,067 | 61 | function Plot_K_vector_numbered(data_dir,save_dir,selectedK)
%
% Plot the centroids in vector format with the number of each area.
%
% INPUT:
% data_dir directory where LEiDA results are stored
% save_dir directory to save results for selected optimal K
% selectedK K defined by the user
%
% OUTPUT:
% .fig... |
29a8871e3855e7fc92b7fd1804dd92890667e5bc3e0bd67a337d0f0de1d4621d | MATLAB | 2,071 | 65 | %% Generation of CFTf surrogates - useful to test the DC - VERSION FOR STRICTLY CAUSAL MVAR MODEL
%%% ABSENCE OF FULL (direct&indirect) CAUSALITY FROM yj TO yi - Aim and Amj coefficients are forced to zero
% Note: the length of the series should be not be odd
%%% input:
% Y, M*N matrix of time series (each time s... |
d824f5de5eec5c33288565f02171738725e2cb55b6bf78122b474b4465291ce4 | MATLAB | 2,076 | 61 | function DownloadImageSeries(outdir, expid, varargin)
% download Allen sample brain using the Allen API
%
% function DownloadImageSeries(outdir, expid, varargin)
%
%
% Inputs [required]
% outdir - where to put the JPEGs
% expid - [numerical scalar] experiment ID assigned by Allen
%
% Inputs [optional]
% 'd... |
542caba7fa22a53d4c07abcc69d445614e0e2e3629151610a8ca0c09e2e22347 | MATLAB | 2,079 | 74 | hist(score)
hist(score,[100])
hist(score(score(:,1)>0),[100])
hist(score(log(score(:,1)>0)),[100])
hist(log(score(score(:,1)>0)),[100])
hist(mw(mw(:,1)<500),[40])
hist(mw(mw(:,1)<500),[50])
hist(mw(mw(:,1)<500),[200])
hist(mw(mw(:,1)<500),[100])
xlabel('Molecular Weight')
ylabel('# of proteins')
hist(log10(a... |
75cee194011bc24e3b47afcd0fd4829179099af9c314feec6e863765ed6173c1 | MATLAB | 2,082 | 54 | classdef EdgeTestsTest < matlab.unittest.TestCase
properties
variables
end
methods (TestClassSetup)
function loadTestData(testCase)
testCase.variables = load("edgeTestInputStruct.mat");
end
end
methods (TestClassTeardown)
function clearTestData(... |
0aefa7a68db24027ebfc46aa2096def5d7cdb4442a41ab25ca2a308bcf068c31 | MATLAB | 2,086 | 59 | function fh = copyfig(fh)
%COPYFIG Create a copy of a figure, without changing the figure
%
% Examples:
% fh_new = copyfig(fh_old)
%
% This function will create a copy of a figure, but not change the figure,
% as copyobj sometimes does, e.g. by changing legends.
%
% IN:
% fh_old - The handle of the figur... |
7d92e2a25123dc8c33946c608bc60239dfa2e573a4075beb7fbe2d41dea8af46 | MATLAB | 2,091 | 66 | function sFile = utest_import_nirs_in_bst(nirs_fn, clean, raw_importation)
% RAW=1 -> import as link to raw file
% RAW=0 -> import data into brainstorm DB.
if nargin < 2
clean = 1; % always clean by default
end
if nargin < 3
raw_importation = 1;
end
ProtocolName = 'nst_utest';
%% Clean nst_utest protocol i... |
a81eefe72011522cdc1042faba9ccba7aee777673f2db0cd71fd6f9ce401a1ba | MATLAB | 2,093 | 70 | function [R,eff]=randmio_dir(R, ITER)
%RANDMIO_DIR Random graph with preserved in/out degree distribution
%
% R = randmio_dir(W, ITER);
% [R eff] = randmio_dir(W, ITER);
%
% This function randomizes a directed network, while preserving the in-
% and out-degree distributions. In weighted networks, the ... |
4ff7b3d1b5a9b1dd690de2941fb78bf08631927dd04d99f0ad25dd76127ba0c2 | MATLAB | 2,095 | 55 | function [labeled,nROI] = label_2photons(detected,minSiz)
% This function labels the detect ROIs (cells) and remove the ROIs smaller
% than minSiz pixels it is called in the cellDetectFun function to label.
% ----------------------------------------------------------------------- %
% *** Inputs ***
% * detected * is a ... |
24920307af3accc2d5f01019c8e8bec8111a713d917aef1f8ad95162648b8548 | MATLAB | 2,097 | 56 | function [f,F]=motif3struct_bin(A)
%MOTIF3STRUCT_BIN Frequency of structural class-3 motifs
%
% [f,F] = motif3struct_bin(A);
%
% Structural motifs are patterns of local connectivity in complex
% networks. Such patterns are particularly diverse in directed networks.
% The motif frequency of occurren... |
9ebe88b6267dca10ce7f062aa0a275c4b4f932ef57de918f701bfe379bfcd651 | MATLAB | 2,098 | 45 | function [GlobalEventsVal,GlobalEventsTime,evNumVec] = globalEvSeg(dechNorm,varList,filtWndw,minDepth)
% This function detects the local minima in the average signal (over all
% ROIs) to segment it into 'global' events
% ----------------------------------------------------------------------- %
% *** Inputs ***
% * dech... |
ae4d87f2b60b867c714d6ceac237e11b755649137600e923474218da3322e2e1 | MATLAB | 2,100 | 52 | function deglitch_example()
%% Generate signal with glitches
nb_samples = 500;
nb_glitches = 10;
nb_draws = 2;
signal = randn(nb_samples, nb_draws);
gen_spikes = [ones(1, nb_draws) ; randi([3,nb_samples-2], nb_glitches-2, nb_draws) ; zeros(1, nb_draws) + nb_samples];
for idraw=1:nb_draws
signal(gen_spikes(:, idraw)... |
54927126b4479f48a551f322c06c40d286ce06374d5cf03a07d780fe01d1eab6 | MATLAB | 2,112 | 71 | function [threshold,AUC,density_1] = get_transition_threshold(comm_sim,TR,plot_density)
nwin = size(comm_sim,1);
nsub = size(comm_sim,3);
% Keep only similarity values for windows more than 30 seconds apart
comm_sim_1 = zeros(nwin,nwin,nsub);
for i=1:nwin
for j=1:nwin
if abs(j-i)<=(60/TR)
... |
614fd3fde15259acbd9113e6ad707de7afb5ee0e319d80a7c381bdaf775dcb4f | MATLAB | 2,112 | 55 | function [resp_W] = GetW()
%GETW Extracts respiration phase for W-trials only for the new dataset.
%
% This function processes EEG data files for 17 participants. For each participant,
% it:
% - Loads raw EEG data,
% - Downsamples the signal to 512 Hz,
% - Filters and extracts the respiration phase using the Hilbert... |
f3ebbf84955b75a472fe5deafde425b99260f2592fd77290b9cdf0de145da85e | MATLAB | 2,114 | 56 | function [resp_M] = GetM()
%GETM Extracts respiration phase for M-trials only for the new dataset.
%
% This function processes EEG data files for 17 participants. For each participant,
% it:
% - Loads raw EEG data,
% - Downsamples the signal to 512 Hz,
% - Filters and extracts the respiration phase using the Hilbert... |
038253173dbd83e1dc7bac6c698e6c21b78c24d206a9932ae7cd2ce467bfd0f6 | MATLAB | 2,116 | 78 | function [result, tmap, out_data] = cluster_perm_fieldtrip(all_res, freq, dtype, toi, foi, percentile, tail, ROI)
%%
data = get_eegfmri_all_subject_data(all_res, freq, dtype, 1, ROI);
data = cumsum(data, 5)./cumsum(ones(size(data)), 5);
data = data(:, :, :, :, percentile);
switch freq
case 'alpha'
freq = ... |
cfca1d8e0cc2c3f5a5335fb65993abb6d68917e37a2fbb11f003faf4cc6e39c0 | MATLAB | 2,119 | 54 | function spt_plot_all_tracks(data)
figure(10568)
set(gcf,'name','All Tracks Plot','NumberTitle','off','color','w','units','normalized','position',[0.2 0.3 0.6 0.6],'menubar','none','toolbar','figure')
if length(data)>1
slider_step=[1/(length(data)-1),1];
slider = uicontrol('style','slider','units','norma... |
112c585b0e0fb50c699bd6a1eaa0a3e9fe3784c68436dd8861250cadd16f39b5 | MATLAB | 2,132 | 59 | function varargout = process_nst_glm_fit1( varargin )
% process_compute_glm: compute the glm : find B such as Y = XB +e with X
%
% OlS_fit use an ordinary least square algorithm to find B : B= ( X^{T}X)^{-1} X^{T} Y
% AR-IRLS : Details about AR-IRLS algorithm can be found here :
% http://www.ncbi.nlm.nih.gov/pmc/ar... |
8812ab43220ac0cbc30a9a22d182d780e4ebe687d18347ae2d5450ff8ceeaaf8 | MATLAB | 2,132 | 73 | function BCCT_WTA_GUI
D.fig = figure('Name','Brain Covariance Connectivity Cor2SubCor&Winner Take All',...
'units','normalized',...
'menubar','none',...
'numbertitle','off',...
'color',[0.95 0.95 0.95],...
'position',[0.3 0.3 0.4 0.4]);
movegui(D.fig,'center');
D.t... |
fdafc678a8e3c1e9f2ccb820e2159322878709ead18160fb70ac086a701850e2 | MATLAB | 2,132 | 61 | function s = SurfStatVol2Surf( vol, surf );
%Interpolates a volume to each surface, then averages.
%
% Usage: s = SurfStatVol2Surf( vol, surfs );
%
% vol.data = nx x ny x nz volume aligned to the surface data.
% vol.origin = [x,y,z] location of vol.data(1,1,1) in mm.
% vol.vox = [x,y,z] voxel size in mm.... |
e237f6e10b0f022181facdd8ad2b2e5d91aafaa2c2c7320ab58d48b4b7a60331 | MATLAB | 2,133 | 80 | function [Min,Mout,Mall] = matching_ind(CIJ)
%MATCHING_IND Matching index
%
% [Min,Mout,Mall] = matching_ind(CIJ);
%
% For any two nodes u and v, the matching index computes the amount of
% overlap in the connection patterns of u and v. Self-connections and
% u-v connections are ignored. The matching inde... |
9bfb4f33435dbfbb24f7bc7f14a860f8179c8bf49abe7eaceaa4692d28d2a86a | MATLAB | 2,134 | 67 | function [k_matrix, Maxwell_index, g2t] = now_maxwell_coeff(optimization)
% function [k_matrix, Maxwell_index, g2t] = now_maxwell_coeff(optimization)
%
% Calculation of Maxwell term and Maxwell index
%
% If you use asymmetric waveforms with Maxwell compensation, please
% cite the following abstract (or later paper):
% ... |
c85cf380abd055a5ee99538a53b47233588032a4014cb5ffcb5ccedc536a446a | MATLAB | 2,136 | 57 | function loc_list_two_channel(data,scatter_size,scatter_num)
global Int
if length(data)~=2
msgbox('Number of files selected should be equal to 2')
else
figure()
set(gcf,'name','Montage Plot','NumberTitle','off','color',[0.1,0.1,0.1],'units','normalized','position',[0.15 0.2 0.7 0.6],'menubar','non... |
e3603cf4b14657f869899ae5abd1a798088e81192b5976879d8a106ada867049 | MATLAB | 2,141 | 56 | function loc_list_three_channel_Rotated(data,scatter_size,scatter_num)
global Int
if length(data)~=3
msgbox('Number of files selected should be equal to 3')
else
figure()
set(gcf,'name','Montage Plot','NumberTitle','off','color',[0.1,0.1,0.1],'units','normalized','position',[0.15 0.2 0.7 0.6],'men... |
afe5490f23eb390c46e354f6e42a497903ae0da0993ddb179b88a6f4a6fec6e8 | MATLAB | 2,142 | 47 | function spt_motion_classification__distance_callback(data)
input_values = inputdlg({'distance threshold:'},'',1,{'0.5'});
if isempty(input_values)==1
return
else
distance_threshold = str2double(input_values{1});
above_threshold = cell(1,length(data));
below_threshold = cell(1,length(da... |
b710cb91b1e0c329c4fa1bd549ea97858b7ce44b37f899f32c6dea1b8db0eb59 | MATLAB | 2,146 | 62 | function jds_phasicTonicRippleRate(animalprefixlist)
%JDS_PHASICTONICRIPPLERATE Cortical ripple rate in phasic vs tonic REM.
% jds_phasicTonicRippleRate(animalprefixlist) compares the rate of
% cortical REM ripples within phasic (high-theta) REM bouts vs the
% remaining (tonic) REM time (sign-rank, boxplot).
%
% ... |
b915a354be93d18be705a6e3fd59b83f48bbbb1a81e3a31dde64cd72f8a5812a | MATLAB | 2,146 | 55 | function [data_clustered,data_not_clustered] = loc_list_dbscan_regular(data)
answer = inputdlg({'Enter Minimum Number of Points:','Search Radius (epsilon):'},'Input',[1 50],{'5','0.5'});
if isempty(answer)~=1
db_points = str2double(answer{1});
epsilon = str2double(answer{2});
for i=1:length(data)
... |
8ff02e0b671958cfcc31ad0db8cde5075c02489c556fa3b04fe5362fba7814b4 | MATLAB | 2,150 | 66 | Subject = subjID;
if(ispc)
% Current code is configured based on PC environment,
% Please change the MainPath to where the folder 'STSI_Codes' is located.
MainPath = 'E:\STSI_CodesAndNotes\STSI_Codes\';
% These toolboxes needs to be in the \ToolBox_External folder
% FieldTrip
cd(fullfile(MainPath, '... |
9a911146e635733ab139fec7865dc1ac2dec9e796d1dd822750437df5fe68358 | MATLAB | 2,153 | 87 | function [x,y,z,w,h,q,l,p,si_mixed,th,PCA_features]=delta_specs(si,timeasleep,print_hist)
% Computes main features of events detected
PCA_features=[];
if ~isempty(si)
%% Instantaneous frequency.
x=cellfun(@(equis) mean(instfreq(equis,1000)) ,si,'UniformOutput',false);
x=cell2mat(x);
... |
9f68b2e3376861a7abd3f7f46474da26e7f4179e2d773fc79c2b5c310d500093 | MATLAB | 2,172 | 70 | function SurfStatDelete( varargin );
%Deletes variables including memory mapped files.
%
% Usage: SurfStatDelete( variable_list [, qualifiers] );
%
% variable_list = comma-delimited list of quoted strings: 'var1', 'var2',
% ..., 'varN'. You can use the wildcard character * to delete variables
% that match a pa... |
a5b289413c7c2e329510a5fd078d1feaa1f0ed756f52900f1a794d098f5b9334 | MATLAB | 2,175 | 62 | function r = assortativity_wei(CIJ,flag)
% ASSORTATIVITY_WEI Assortativity coefficient
%
% r = assortativity_wei(CIJ,flag);
%
% The assortativity coefficient is a correlation coefficient between the
% strengths (weighted degrees) of all nodes on two opposite ends of a link.
% A positive assortativity coe... |
5ae94b5096fc662236efe273bd14c91c79c9b9ab0ad5118081acea58a940eff3 | MATLAB | 2,177 | 53 | function [R,Nk,Ek] = rich_club_bd(CIJ,varargin)
%RICH_CLUB_BD Rich club coefficients (binary directed graph)
%
% R = rich_club_bd(CIJ)
% [R,Nk,Ek] = rich_club_bd(CIJ,klevel)
%
% The rich club coefficient, R, at level k is the fraction of edges that
% connect nodes of degree k or higher out of the maximum... |
6a78c13ff151f5fe3d9790d21e3396f1980a195fddf2f3e31df8883214c309e7 | MATLAB | 2,178 | 73 | classdef Number < nla.inputField.InputField
properties
name
disp_name
min
default
max
label = false
field = false
end
methods
function obj = Number(name, disp_name, min, default, max)
obj.name = name;
obj.disp_name ... |
cf1f424d573e8da6e8489c94e76fe68fefc4be600df7527bb02f4bb308b4a890 | MATLAB | 2,181 | 96 | clear;clc;
load('trait_score.mat')
load distance_beta.mat
%%
result_permuation=zeros(85,1001,4,2);
for condition=1:4
for i=1:1001
for time=1:85
a11=squeeze(distance_beta(:,time,i,condition));
[r,p] = corr(a11,trait_score);
result_permuation(time,i,condition,1)=p;
result... |
6c43f15acc70e1f1f8c7416c71991ef124f8252d11aa84d64c915cd0803a1de0 | MATLAB | 2,188 | 71 | function [IDs,names] = getInjectionIDfromExperiment(expIDs)
% Download structure ID of the primary injection structure from an Allen experiment
%
% function IDs = getInjectionIDfromExperiment(expIDs)
%
% Purpose
% Make an API query that downloads the structure id of the primary injection
% structure of each e... |
0165ffbc1e30266f2fa570422d02b0fec2288271b08cbf58b492132ba773ea3a | MATLAB | 2,189 | 55 | function BCCT_VIEWmain
Hsize = get(0,'screensize');
msize = min(Hsize(3:4))*0.8;
Hasview.fig = figure('pos',[Hsize(3)/2-msize/4,Hsize(4)/2-msize/8,msize/2,msize/4],'name','BCCT Viewer V1.0');
Hasview.FC = uicontrol('parent',Hasview.fig,'units','norm','pos',[0.025 0.6 0.3 0.3],'style','pushbutton','string','Map(SCN&... |
38ec7b25a754333b390439fead4ddf622ecf85d000458b7121c24920dc37c6b2 | MATLAB | 2,195 | 82 | function [names,acronyms,ARA_LIST]=structureID2name(structIDs,ARA_LIST,quiet)
% convert a list of ARA (Allen Reference Atlas) structure IDs to a cell array of names
%
% function [names,acronyms,ARA_LIST]=structureID2name(structIDs,ARA_LIST,quiet)
%
% Purpose
% Each Allen Reference Atlas (ARA) brain area is associ... |
61f936e4574543de26ac723554dd18560a78676205d2116ae9e4e4add7dc91d3 | MATLAB | 2,195 | 66 | function dpi = computedPI(avgSC_FIX)
% COMPUTEDPI Compute depth Preference Index (dPI) from matrix or vector
%
% dpi = COMPUTEDPI(avgSC_FIX)
% Computes the directional Population Index (dPI) as a measure of directional
% selectivity in neural population responses.
%
% Syntax
% ------
% dpi = compu... |
887eb988763929c1924bc17c58d3941ef66c2c7c292ae5fa1f7ce5598beeb3a6 | MATLAB | 2,200 | 86 | function[freqmap] = domfreq(mask,imagestack,framerate,minf,maxf,fbin,winopt,tfilt)
% Function for creating DF map from an image stack.
% Chris O'Shea and Ting Yue Yu, University of Birmingham
% Maintained by Chris O'Shea - Email CXO531@bham.ac.uk for any queries
% Release Date -
% For licence information, p... |
ffa43119bf744e897d457576c879b27155f9edb4fba014289b77379ff2ebe528 | MATLAB | 2,202 | 85 | function Y = SurfStatSmooth( Y, surf, FWHM );
%Smooths surface data by repeatedly averaging over edges.
%
% Usage: Y = SurfStatSmooth( Y, sv, FWHM );
%
% Y = n x v or n x v x k matrix of surface data, v=#vertices;
% n=#observations; k=#variates, or memory map of same.
% surf.tri = t x 3 matr... |
927a9022fc98e0d1e414f06acc71c450c4db3fb6a0ca8757b6a61b9c144bf811 | MATLAB | 2,203 | 64 | function [CIJtree,CIJclus] = backbone_wu(CIJ,avgdeg)
%BACKBONE_WU Backbone
%
% [CIJtree,CIJclus] = backbone_wu(CIJ,avgdeg)
%
% The network backbone contains the dominant connections in the network
% and may be used to aid network visualization. This function computes
% the backbone of a given weighted a... |
fb2dfeae79dbc20c7530f404d4b7ee91985b1352c2f234c65cabcb758c4a6945 | MATLAB | 2,203 | 71 | % This function is only used to save Analyze or NIfTI header that is
% ended with .hdr and loaded by load_untouch_header_only.m. If you
% have NIfTI file that is ended with .nii and you want to change its
% header only, you can use load_untouch_nii / save_untouch_nii pair.
%
% Usage: save_untouch_header_on... |
985af091285725677c623bfe3d80a75f47602625599c910724b99c7a563bbd22 | MATLAB | 2,209 | 78 | function [lmse,msd,e_vecs,lambdas] = run_LFA_with_DMD(data_ts,n_lag, exp_var_lim,delta_t)
% RUN_LFA Summary of this function goes here
% Detailed explanation goes here
%
%
% Input:
% data_ts = 3d matrix(double); variable x time x subj/trial/run
%
% n_lag = Number of future timepoints to predict (scalar int)
%
% ... |
be9ae98f18d1a478c0fcf064af163a706b78aa0f744302d32e2458fa62d8d6ea | MATLAB | 2,211 | 64 | function r = assortativity_bin(CIJ,flag)
% ASSORTATIVITY_BIN Assortativity coefficient
%
% r = assortativity(CIJ,flag);
%
% The assortativity coefficient is a correlation coefficient between the
% degrees of all nodes on two opposite ends of a link. A positive
% assortativity coefficient indicates that n... |
73ccc6be62ca76323d71117552fcdf6e9d4ee38bb761c1424c1b880da046103e | MATLAB | 2,219 | 66 | function outY = wildBootstrap(inY, inX, inContrasts, origBeta, origResidual)
%Inputs
%inY - [n x m] matrix (n observations, m outputs per observation)
%inX - [n x p] matrix (n observations, p covariates)
%inContrasts - 1 x p matrix indicating which covariates we care about,
%and which are noise... |
137273e60579bebd7cc12a35b0c68c6fe37d1c2a600b679687f3b2cc7d49ef11 | MATLAB | 2,222 | 67 | function pi = computePI(avgSC_FIX)
% COMPUTEPI Compute Preference Index (PI) from matrix or vector
%
% pi = computePI(avgSC_FIX)
% Computes the Population Index (PI) as a measure of population favorability.
%
% Syntax
% ------
% pi = computePI(avgSC_FIX)
%
% Inputs
% ------
% avgSC_FIX : nu... |
27613b9fd757972107079b105c74e6dc65adef93611b22e97dad43620ec28f1a | MATLAB | 2,224 | 62 | function O = RSA_APR2020_All( S )
O = [];
% Aggregating RSAs for all comparisons of tones (Old and New)
% INPUT: S.l: 1 = all together (but not same tones)
% 2 = same tones
% 3 = properly all together
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
f1a8080368e5cd6b5cf2b3c84615417f2fe07ceda091e2faa0f1bc9340eda0c7 | MATLAB | 2,237 | 70 | function dimsiz = getdimsiz(data, field)
% GETDIMSIZ
%
% Use as
% dimsiz = getdimsiz(data, field)
%
% If the length of the vector that is returned is smaller than the
% number of dimensions that you would expect from GETDIMORD, you
% should assume that it has trailing singleton dimensions.
%
% Example use
% dimord... |
5492b5d946c8e7332cf26ec7d754ef7a8bbe6aa7ac34a9b088d3da35a35ed2d8 | MATLAB | 2,238 | 68 | function [fig_h, h] = plotVoronoiMCdat(Histograms, thresh, signif)
%% plot Voronoi area graph output from VoronoiMonteCarlo_JO
fig_h = figure('Name','Voronoi Clustering Threshold');
hold on
box on
mxfactor = 1.05;
countCols = [2,size(Histograms,2)];
ylimTop = ceil(mxfactor*max(...
[Histograms(:,countCol... |
ccb38cd1fbd48ef755943895b23d64a02fd024fa5491335223f105161b2a17cc | MATLAB | 2,239 | 94 | %BIPOLAR returns an M-by-3 matrix containing a blue-red colormap, in
% in which red stands for positive, blue stands for negative,
% and white stands for 0.
%
% Usage: cmap = bipolar(M, lo, hi, contrast); or cmap = bipolar;
%
% cmap: output M-by-3 matrix for BIPOLAR colormap.
% M: number of shades in th... |
43eb701b4b8eb6eccc32035b7f461611bc93f3d446723be9240c87e33a824baf | MATLAB | 2,251 | 66 | function [Aerr, werr]=arconf(A, C, w, th)
%ARCONF Confidence intervals for AR coefficients.
%
% For an AR(p) model that has been fitted with ARFIT,
% [Aerr,werr]=ARCONF(A,C,w,th) computes the margins of error Aerr and
% werr such that (A +/- Aerr) and (w +/- werr) are approximate 95%
% confidence intervals for the ... |
c4075f8c8ca41e0e1cc967cb10bac00c29a29cbea6dca8a83086f6ee4dcff917 | MATLAB | 2,255 | 67 | function [final_directory,final_SD_Folder_name]=find_dict_rat(Rat_Number_Input,SD_Number_Input,keyword)
% Throughout the project, there was a need to load specific files (sleep scoring files or slow wave data) based on the ID of the neuron.
% Because of the complex and nested organization of data, this function was us... |
541ce78cccfabe84508b22abfa09b3036e7e919bdc9d82caae924dd78d26257f | MATLAB | 2,256 | 77 | function plot_correlations_motion_by_characteristic(var,FDparams,outDir,varname,varargin)
% varargin = indexing for original matrix of subjects to use
if length(varargin) > 0
goodsubs = logical(~isnan(var).*varargin{1});
titleendstr = '_selectedsubs';
else
goodsubs = ~isnan(var);
titleendstr = '';
end
... |
05a1c335a482199896406d4a032b939f4dcc59816b89cce674fadd93965cbb1f | MATLAB | 2,258 | 77 | function Ip = get_vertices_xyz(D,xyz,rad,Nm,Pflag,remove_vert_thr,mods);
if nargin < 6
remove_vert_thr = 0;
elseif nargin == 6
error('Need to pass modalities if pass remove_vert_thr')
end
Np = size(xyz,2);
vert = D.inv{D.val}.mesh.tess_mni.vert;
%% Get source vertices
Ip = cell(1,Np);
for p = 1:Np
Dp ... |
78449b534ace56f0bf288ce4c1d9f6136a5b0802a4cdceff99df3a2548741fd3 | MATLAB | 2,264 | 68 | %% main input data
net_atlas_folder = fullfile(nla.findRootPath(),'support_files');
net_atlas = nla.NetworkAtlas(fullfile(net_atlas_folder, 'Gordon_13nets_333parcels_on_MNI.mat'));
fc_data = rand(333,333,10); %Random FC data
behavior = round(rand(10,1));
%% run settings
edge_input = struct();
edge_input.... |
f7b8d7dc886e3d95a6c2d68ed1ccfd2dfb9c0d4a29595f2d7cf30b128737eda8 | MATLAB | 2,269 | 65 | function nst_glm_display_model(model,mode)
n_regressor=size(model.X,2);
if strcmp(mode,'matrix')
Tag='DesignModelMatrix';
else
Tag='DesignModelTime';
end
hFig = findobj(0, 'Type', 'Figure', 'Tag', Tag);
if isempty(hFig)
hFig = figure(...
'MenuBar', 'none',... |
2bf46a14bd149c1e6346ba8b2341a033dbdff7c2689d4897b217cce23c115ae9 | MATLAB | 2,272 | 60 | function [resp_75] = Get75()
%GET75 Extracts respiration phase for W-trials only for the new dataset.
%
% This function processes EEG data files for 17 participants. For each participant,
% it:
% - Loads raw EEG data,
% - Downsamples the signal to 512 Hz,
% - Filters and extracts the respiration phase using the Hilb... |
c3b4f748bb844604c0586c88143b15994419e222e4ace30bc0bfabd3c8299b6e | MATLAB | 2,281 | 68 | function plotter(obj)
% Workhorse of plot hemispheres. Relies exclusively on properties of the
% plot_hemispheres class and should never be called directly.
%
% For more information, please consult our <a
% href="https://brainspace.readthedocs.io/en/latest/pages/matlab_doc/visualization/plot_hemispheres.html">ReadTh... |
d74bc340472c7544512a212464ae91145ccc7406553a3d2a89356394b81ed133 | MATLAB | 2,282 | 67 | classdef MultiContrastResult < matlab.mixin.Copyable
%Class for holding multiple result objects for multiple named contrasts
%
% Builds and accesses a containers.Map object of named objects
% objects, one per contrast
properties
contrastNames %cell array of names of each contrast
... |
0623bdad5096d052b8a5e0a453afe4aab2018311bff7407644b94edc2e9b5ed9 | MATLAB | 2,296 | 55 | function [func_conn_residual, behavior_residual] = partialVariance(func_conn, behavior, covariates, type)
%PARTIALVARIANCE Perform partial variance, removing specified
% covariates and returning residuals
% func_conn: NroisxNroisxNsubs functional connectivity matrix
% behavior: Nsubsx1 behavioral ... |
5acd8a38ef88d55052a275b6693f475541180bc2669908e406f2a11f1fcd9367 | MATLAB | 2,300 | 92 | % rri_xhair: create a pair of full_cross_hair at point [x y] in
% axes h_ax, and return xhair struct
%
% Usage: xhair = rri_xhair([x y], xhair, h_ax);
%
% If omit xhair, rri_xhair will create a pair of xhair; otherwise,
% rri_xhair will update the xhair. If omit h_ax, current axes will
% b... |
310fa84398dbaba898bb4de342b38911e0842085ee412e1fecce555825591180 | MATLAB | 2,317 | 68 | function [EBC,BC]=edge_betweenness_bin(G)
%EDGE_BETWEENNESS_BIN Edge betweenness centrality
%
% EBC = edge_betweenness_bin(A);
% [EBC BC] = edge_betweenness_bin(A);
%
% Edge betweenness centrality is the fraction of all shortest paths in
% the network that contain a given edge. Edges with high values... |
3dde51d05a1fe2e78146e13338de5c7a45e72a3cb367cafd005b7270424da8ac | MATLAB | 2,317 | 57 | classdef diffusion_mapping_tests < matlab.unittest.TestCase
% Regression tests for matlab/analysis_code/diffusion_mapping.m
% Covers issues #98 (complex eigenvalues) and #94 (sqrt(N) component cap).
methods(Test)
function test_real_eigenvalues_on_cosine_similarity(testCase)
% Issue #98:... |
ddcd669df9d42cfb01e986ce5d0b9b2dacacf69971b0c358122ebb2b8286ad87 | MATLAB | 2,317 | 54 | function [durationFirstPartActual, durationZeroGradientActual, durationSecondPartActual, totalTimeActual, zeroGradientAtIndex] = ...
getActualTimings(durationFirstPartRequested, durationZeroGradientRequested, durationSecondPartRequested, discretizationSteps, forceSymmetry)
if forceSymmetry
durBothRequested = m... |
4aad49c2612fe993b025cf291e628046c5d0d158845de025f867f6ed47c4f218 | MATLAB | 2,319 | 54 | function [data_filter_above,data_filter_below] = loc_list_clusters_filter_aspect_ratio(data)
answer = inputdlg({'Major Axis to Minor Axis Aspect Ratio Threshold:'},'Input',[1 50],{'1.5'});
if isempty(answer)~=1
min_aspect_ratio = str2double(answer{1});
f = waitbar(0,'Filtering Based On Aspect Ratio...');... |
f3e9df2892cbb673a25d3c3129d2dd19f3f417f6b1b1ef6f7d26ac134d85de2f | MATLAB | 2,322 | 79 | function paramval = pl_inputparser(parseobj,paramname,default,validator)
%
% Parses input data for consistency
% if default == [], then parameter is required
% This function is part of the permutationlab software:
% Author: Dimitrios Pantazis
% The code is currently under development, please do not share
%... |
64ce0368e9935f9a36320fef2a9361b3844b06df3a5be8294d60696de82a4a1d | MATLAB | 2,340 | 71 | function cvx_optval = norms( x, p, dim )
%NORMS Computation of multiple vector norms.
% NORMS( X ) provides a means to compute the norms of multiple vectors
% packed into a matrix or N-D array. This is useful for performing
% max-of-norms or sum-of-norms calculations.
%
% All of the vector norms, including t... |
3c1bb4114c982b7075aa227ede057f171b7d0d3c898f85714f71b114debc273c | MATLAB | 2,342 | 49 | classdef Precalculated < nla.edge.BaseTest
%SIMULATED Load previous simulated data
properties (Constant)
name = "Precalculated data"
coeff_name = "Precalculated coeff"
end
methods
function obj = Precalculated()
obj@nla.edge.BaseTest();
end
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.