sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
edb6ff59ae5a56f27f91eeaa78a3ee178a6be8b0555a4df499fa73631d9f79ce | MATLAB | 2,625 | 79 | %% RESULTS & PLOTS 1 (Fig5A)
%% --- TIME Comparison Plot ---
% Data
tags1 = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024];
total_algo_time = [1.0000, 1.3068, 1.6061, 1.9107, 2.0151, 2.3796, 3.0920, 3.3442, 3.4095, 3.1655, 3.8246];
dict_update_time = [1.0000, 1.7115, 2.7543, 4.1121, 5.3198, 6.1427, 8.2053, 10.0607, 8.9... |
09d5c3faa0a70f113325a6870889c3b7e83d7a50f8fb119162f19fcea620955c | MATLAB | 2,628 | 72 | % ajouter une bande de fréquence dans la config, avec toutes les fréquences
% voulues de 0 à 50
% retirer du script le moment où on moyenne les fréquences de la bande de
% fréquence. Cela permet de garder l'information fréquence par fréquence,
% nécessaire pour le plot TFR.
% -> Ca ne change rien au reste du script... |
e067981dacd40ae81c47c6bf5ec077f886765b216b099ea06e5686daf7da0be2 | MATLAB | 2,628 | 60 | function recon_data = read_recon_data_and_separated_density_weights(socket)
recon_data = gadgetron.types.ReconData(read_recon_bits(socket));
end
function recon_bits = read_recon_bits(socket)
n_recon_bits = read(socket, 1, 'uint64');
recon_bits = arrayfun(@(~) read_recon_bit(socket), 1:n_recon_bits);
end
f... |
b861498f82b07a9673f10dd5cc0de6edc79951823f03015d7e60a58e7eb3ecb3 | MATLAB | 2,634 | 75 | function dictionary_initial = initialize_dictionary(varargin)
% dictionary_initial = initialize_dictionary(varargin)
%
% Function to generate a random initial dictionary, or to load a dictionary
% from a file.
%
% Use:
% - initialize_dictionary(n_elem, v_size) creates a radom matrix with
% zero mean an... |
b983947ff96d902eae08057ef6e6b54b19ed3c11b36307b3ff6fbe140ecc366b | MATLAB | 2,635 | 93 | function y = spm_prf_summarise(PRF,xY,method,noplot)
% Summarises and optionally plots a pRF receptive field within an ROI
%
% PRF - PRF file or mat
% xY - mask image
% method - 'sum' or 'BPA' (default: sum)
% noplot - if true, disables plotting (default: false)
%
% y - matrix representation of the recepti... |
e0903b9dd98c470dee94075012794526f3c31e8b8c018a6825c601073c69d500 | MATLAB | 2,638 | 55 | % Mathematical Model of MePD with Periodic UCN3 input + GABA stimulation
function xdot=MePDU(t,x,par)
% initialise the system
xdot=zeros(3,1);
% PARAMETERS
dl = par.dl; % Time Scaling Constant Glut
di = par.di; % Time Scaling Constant GABA int
de = par.de; % Time Scaling Constant GABA eff
cll = par.cll; % Gl self-exc... |
60f500ece1543b309e911e2de2762f960c0107d2957a3d171375cfa6baa74bef | MATLAB | 2,645 | 84 | function [meantheta,R,sigma,confangle,kappa]=anglemean(theta);
% calculates the mean of angles
%
% [meantheta,anglestrength,sigma,confangle,kappa]=anglemean(theta);
%
% anglestrength: can be thought of as the inverse variance. [varies between 0 and one]
% sigma: circular standard deviation
% confangle: a 95% confide... |
be6f5dccbd9269a1feb5755ec45a0c0291b1d59400822da39ade40826f5ec90f | MATLAB | 2,647 | 101 | function y = sgamma(x,g,n)
% OUTPICT = SGAMMA(INPICT,P,{N})
% Gamma adjustment function designed to be symmetric about y = 1-x (the unit antidiagonal).
%
% The concept is similar to grabbing the center of the curve and dragging it
% diagonally, as one might do in GIMP, etc. Compared to a normal power function,
% this ... |
5f16b876ba07dc9d4832c57f440ca6f9e8504f97b219187f532f138234f9503c | MATLAB | 2,648 | 84 | function [dA,dL,dB]=find_angles_sub(Xt,Yt,Zt,maxk,mode)
%% Calculating PF lengths
J=length(maxk);
%calculate the length along each PF
dXt=(diff(Xt));
if mode == 1
dYt=(diff(Yt));
end
dZt=(diff(Zt));
if mode == 1
dL=sqrt(dXt.^2+dYt.^2+dZt.^2);
else
dL=sqrt(dXt.^2+dZt.^2);
end
% remove f... |
fec376a509af6c9b93fd1a591be14464de58e9cc33eaa2f8201516f67e70d09d | MATLAB | 2,648 | 95 | function h = phaseplot(x,y,phase,sz,varargin)
% Plots arrows indicating the phase on current axis.
%
% [h,yy,zz] = PhasePlot(x,y,phase,sz[,ArrowParameters])
%
%
%
% Note: Arrows will get skewed if you resize the axis.
%
% (c) Aslak Grinsted 2003-2014
% http://www.glaciology.net/wavelet-coherence
% --------------------... |
98f3a3cad3b46bdf84a11214243af851d7341f1f21808da65c75791685b3f795 | MATLAB | 2,651 | 95 | %
% memInfo = getMemoryInfo(unit)
%
% Description:
% get system memory information
%
% Input:
% unit - unit of Byte
%
% Output:
% memInfo - memory information structure
%
% Copyright:
% 2017-2018 (c) USC Biomedical Imaging Group (BigLab)
% Author:
% Jian (Andrew) Li
% Revision:
% 1.2.0
% Dat... |
8c3b7818c89c8a120f414430087c88fb4306e5190175cb583322727969bde855 | MATLAB | 2,656 | 82 | function [results_col] = compute_colocalisation(mask_1, mask_2, biom_1, biom_2, biom_set_folder, fname, repeat, results_folder)
close_figs = 1;
coloc_per_cell = 1;
%% Load image
% fpath = fullfile(files(idx).folder, files(idx).name);
% biom_ch_1 = find_channel_img(biom_1);
% % [img_1] = load_channel_images(fpath, bio... |
42c065fd317e4b9129a1e5b27a51023118654709bc28a8b67990fe9dd2c484f0 | MATLAB | 2,661 | 87 | function [ax] = subplot_er(m,n,p,Listener)
%SUBPLOT_ER Creates subplot axes similar to the subplot function, but
%minimizes the white space between the different axes. The white space
%removal is performed when the figure's 'SizeChangedFcn' callback is
%executed. Initiates after first figure resize or first time figure... |
b1f41c7da5e7efb711748a74773a677b52a7b0d7ce6cd6efe529c359a8491bf4 | MATLAB | 2,661 | 99 | function xf = bandpassFilter(x,Fs,Fp1,Fp2)
% function xf = bandpassFilter(X,FS,FP1,FP2)
%
% Bandpass filter for the signal x. An acausal fft
% algorithm is applied (i.e. no phase shift). The filter functions is
% constructed from a Hamming window (default window used in "fir2" Matlab function).
% to avoid r... |
87e934d13e2432ab1aa49dea8fe3bf791b5e0cb08b5294d4a850a328ef067ab4 | MATLAB | 2,666 | 96 | function outpict = mergedown(inpict,varargin)
% MERGEDOWN(INPICT, OPACITY, BLENDMODE, {...})
% MERGEDOWN(INPICT, ICP)
% performs image blending on dim 4 of a 4-D imageset
% output is a single-frame image
%
% INPICT is a 4-D image set of any type supported by IMBLEND
% Remaining arguments (OPACITY... |
d6fe0acbd152e7180f155be77a982c87cd1791a2a542ec0ce174f13554d2996f | MATLAB | 2,667 | 62 | function [graph] = plot_rm_anova_results_OPS(x,ranovatblb,Mrm1,rm,trials,y_final,error_final,group_name)
% [graph] = plot_rm_anova_results_OPS(x,ranovatblb,Mrm1,rm,trials,y_final,error_final,group_name)
% plot rm ANOVA results for OPS data
%
% inputs:
% x - x axis positions
% ranovatblb - rm ANOVA results table
... |
f0c81ba8332a59f0e061ea159e67678f1b4f473170b8fe1ed602d79e736dfe6e | MATLAB | 2,669 | 65 | classdef ConnectomeGenePairDataSet
properties
% Core data
SourceIDs (:,1) {mustBeInteger} % [#Connection,1] Source region index
TargetIDs (:,1) {mustBeInteger} % [#Connection,1] Target region index
SourceExpressions (:,:) {mustBeNumeric} % [#Connection,#Expression]... |
14a29279f3b048107fbf4cab2d37252a7bac3b304a9ed993a77b81c7f66ba677 | MATLAB | 2,671 | 83 |
% Load parametric maps for all subjects and correlate with MD maps
clear, clc, close all
%% Paths / data
path_batches = 'D:\Projects\2023_multib\MK_multi_b\Scripts';
cd(path_batches)
load('Table_297_subjs_demographics_biomarkers_2024_05_03.mat')
n_subjects = size(T_subjects,1);
path_stats_grp = 'D:\P... |
bb029420ba0bc10cb49b3634a5d99b52439fa17ee7894e57d931d91773f6eb27 | MATLAB | 2,672 | 57 | function mov = denoiseCIinSpace(mov, varargin)
% denoiseCIinSpace(fuObj, varargin)
%
% Function to denoise calcium imaging data in space using wavelet
% denoising. To avoid the missing data problem, error frames from burst
% errors are filled in using cubic spline interpolation.
%
% 2020 - Adam Charles
%%%%%%%%%%%%... |
23431ef219cf536c1839c15f44f3037952621f2391d726f8eed5082d014d3649 | MATLAB | 2,676 | 79 | function [processed_BS, processed_phone, BS] = prepare_features(EEG, feature)
%% Prepare data for training.
% Does the following steps: pre-process BS, align using decision tree,
% extract features from BS, extract idle sequences from both
% BS and Phone taps, normalize BS, change the sequence precision of Phone
% ta... |
9279181a6c23bc0adf914019cc239b7bac3683f36a752af5ac18b73dff2e2450 | MATLAB | 2,679 | 64 | %% PROPTEST2 z-test for whether the proportions of two categorical populations are from the same distribution.
% See https://onlinecourses.science.psu.edu/stat414/node/268
%
% Inputs
% ========
% selected1 : Number of items out of total1 that pass selections, i.e. the proportion to be
% ... |
a854039f1b7ba937e7692609f81a5054184d58fb29dbd1973cc8cb0129aaa855 | MATLAB | 2,679 | 83 | fig = figure;
set(fig,'position', get(0,'ScreenSize'));
set(fig, 'PaperPositionMode', 'auto');
ncol = max(SpikeTrials_timelocked{ipatient}{1}.ES.trialinfo.idir);
for idir = unique(SpikeTrials_timelocked{ipatient}{1}.ES.trialinfo.idir)'
cfgtemp = [];
cfgtemp.trials = LFP{ipatient}{1}.ES.trialinfo.idir == ... |
ed0fb4c582e334aca6575460fcd59bc4d77e755a5ee23db89e112557eef2c1bd | MATLAB | 2,683 | 109 | %
% BDP BrainSuite Diffusion Pipeline
%
% Copyright (C) 2019 The Regents of the University of California and
% the University of Southern California
%
% Created by Chitresh Bhushan, Divya Varadarajan, Justin P. Haldar, Anand A. Joshi,
% David W. Shattuck, and Richard M. Leahy
%
% This program is free sof... |
27edd4aad7ec708ace2230709e65d9e86cf884bfdfe82a4e54c2887bc26d501a | MATLAB | 2,684 | 65 | % Generate an n-by-d matrix R of random numbers sampled from a multivariate normal distribution,
% which will have the desired empirical mean and covariance, i.e.:
% mean(R,1) == mu
% cov(R) == sigma a d-by-d matrix
% and are orthogonal to the subspace spanned by columns of A.
%
% If nSamples is sp... |
d85a2e5faf5c27fbb41f1deb212879c2094ca7d1ebb1140687927a47d0b2d53a | MATLAB | 2,684 | 75 | function [vol_nii, Tnew] = affine_transform_nii(v1, F, origin_loc, outFile)
% Applies affine transform to nifti volume. As the location of voxels in nifti files are explicitly
% defined by an affine matrix (sform), any affine transform can be completely applied just by
% transforming the header affine matrix (without c... |
2910d9281085a1250c3551831b271835a5558b2d47bf1c5cec05b1cf13c4b260 | MATLAB | 2,692 | 69 | function gen_brainordinates(BSTDir, bfp_out, subid, sessionid,BFP_outfile)
%sub_mri = '/ImagePTE1/ajoshi/usc_music/bfp_out/sub-01/anat/sub-01_T1w.bfc.nii.gz';
%subfmri = '/ImagePTE1/ajoshi/usc_music/bfp_out/sub-01/func/sub-01_task-sadln.bold.res2standard.nii.gz';
%map_file = '/ImagePTE1/ajoshi/usc_music/bfp_out/sub-01/... |
58afe588338785d3ab29ec0c899a8784d5090affb371fba33ddd79ef78dc2700 | MATLAB | 2,694 | 76 | function checkPriors(data,options)
% this runs a short test whether the provided priors are functional
%function checkPriors(data,options)
% concretely the priors are evaluated for a 25 values on each dimension and
% a warning is issued for zeros and a error for nan and infs and negative
% values
if options.logspace
... |
9d23c3e5a85dfa6a8f572d4507ddf2fb53afc4495904c621a65a93d33d7735f9 | MATLAB | 2,694 | 110 | %Simulate the MePD circuit during UCN3 optogenetic stimulation &
% restraint stress
clc; clearvars
% set up parameters
dt=0.01;
par.tspan = 0:dt:150;
par.opts = odeset('RelTol',1e-6,'AbsTol',1e-8);
% see MePDU.m and MePD_stress.m for details
n=3;
par.dl= n;
par.di= n;
par.de= n;
par.cll= 16;
par.cil= 0;
par.cli= 0;
pa... |
d1eac3ef230e5089ab7667fada24c9379f984e4f8f4abca410a15d712ba3d63b | MATLAB | 2,698 | 104 | %% Composite entropy–based fitness function (Permutation Entropy / Mutual Information)
function [ff] = compositeEntropyCost(c, data)
X = data;
alpha = fix(c(1)); % Penalty factor (moderate bandwidth constraint)
K = fix(c(2)); % Number of modes (IMFs) for VMD decomposition
%--------------- Run VMD decompos... |
470882af1ee5668bec23477fde2bd155e2e00df0a4f07355e49ceff877da9f29 | MATLAB | 2,701 | 85 | function varargout = selectPanel(pan, index, shape, axis)
%------------------------------------------------------------------------
% Compile list of subplots to configure
%------------------------------------------------------------------------
% In case the user did not provide a shape, assume they ... |
6e348de8aefb48365f51fce4c88a621d015cf7a4720f292b92299cb6a030ba86 | MATLAB | 2,702 | 95 | classdef simParams
% Parameters passed to a dsim function
% 'default' values:
properties
g_ca_lts = 0.75; %gca of .75 with leak of .1 is good;
g_nat = 60.5;
g_kd = 60;
g_nap = 0;
g_kt = 5;
g_k2 = .5;
g_ar = 0.025;
g_L = 0.1;
g_GtACR... |
77e96f8157a037499fd12a6b6dc22c14e9e120a0affd0221009a7e08c00056c4 | MATLAB | 2,719 | 85 | function get_alff_gord(config, fmribase,anatbase)
GordSize=96854;
setenv('PATH', [getenv('PATH'),':',config.FSLPATH,':',config.FSLPATH,'/bin']);
setenv('FSLDIR', config.FSLPATH);
setenv('FSLOUTPUTTYPE',config.FSLOUTPUTTYPE);
% some newer afni versions throw warnings for non-float data
% creating parsing errors. This t... |
a097ea7531e3fe9f9d6fcc8ef687491b7c3bf8a3cb16b792c232769620bbef59 | MATLAB | 2,727 | 85 | function [y] = spm_prf_gx(x,u,P,M)
% Simulated BOLD response to input
% FORMAT [y] = gx_hdm (x,u,P,M)
% y - BOLD response (%)
% x - state vector (see my_fx_hdm)
% P - Parameter vector
% M - model specification structure (see spm_nlsi)
%___________________________________________... |
f529cbf87d31f0d2cfd044b18813ef618d4de3d1048d0e165c3e9985ea30f54a | MATLAB | 2,733 | 86 | function outpict = hitmiss(inpict,varargin)
% OUTPICT=HITMISS(INPICT,SE1,{SE2})
% Apply a hit or miss filter to an image.
%
% This is a passthrough to the IPT function bwhitmiss(), with internal fallback implementations
% to help remove the dependency of MIMT tools on the Image Processing Toolbox. As with ot... |
7a4682fb7f9a599b0b50d033b6cb5ad0bb8f96276cd0efe76adc66f7c2bbecfb | MATLAB | 2,736 | 74 | %
% BDP BrainSuite Diffusion Pipeline
%
% Copyright (C) 2019 The Regents of the University of California and
% the University of Southern California
%
% Created by Chitresh Bhushan, Divya Varadarajan, Justin P. Haldar, Anand A. Joshi,
% David W. Shattuck, and Richard M. Leahy
%
% This program is free sof... |
47fc56777832dd66d18ac7613cc10298d7709892d887985637e66bb057e87712 | MATLAB | 2,738 | 49 |
function ReconBSS(connection)
disp("Matlab B1 BSS recon launched...")
recon_type = 'MORSE' ; % 'MORSE' or 'ESPIRiT', 'ESPIRiT' recquires installation of the Berkeley Advanced Reconstruction Toolbox (BART) toolbox
% Hard-coded reconstruction parameters:
global onlineROFT scaleKsp gadNoiseDir scaleNoi... |
be7143b5cadf8d34e84b8f182b41378274d0ea2d04db8be0f1b858b20d9843a2 | MATLAB | 2,738 | 68 | %% script to visualize HPC volume in the lesion experiment. Gergely Tarcsay, 2024 Ewell lab
close all
tbl = readtable("G:\HPC lesion\Lesion scoring\AreaSummary.xlsx");
%% calculate volume from distance and summed area
for i = 1:length(tbl.distance_um_)
tbl.CA1Volume(i) = (tbl.CA1Area_um2_(i)*tbl.distance_um_... |
28b45ce9bf4dc9100f839dcafe34a7e77ceda270c92220c19798b47b3b18d4a6 | MATLAB | 2,740 | 99 | function inpict = lineshifter(inpict,mask,amt,order)
% LINESHIFTER(INPICT, MASK, SHIFTAMOUNT, {ORDER});
% returns a copy of the input image, with pixels circularly shifted
% proportional to the row and column means of a specified mask
%
% INPICT is an I/RGB image of any standard image class
% MASK is... |
640a11753fd5ab5855eb1336c886ce1486e428c624afa6005afa44aadbe11e33 | MATLAB | 2,740 | 61 | function [dat_micro] = readMicroFs_alldata(cfg,MuseStruct_micro)
fname = fullfile(cfg.datasavedir,[cfg.prefix,'data_raw_microFs_.mat']);
if exist(fname,'file') && cfg.force == false
fprintf('Loading precomputed data: %s \n',fname);
load(fname,'dat_micro');
else
hasmarker = zeros(length(MuseStruct_micro... |
8c709a203d4aae440f7f13f3ae6af3d50fa7fc701aac279ae9042901cc04110f | MATLAB | 2,740 | 104 | %Script to estimate the beta coefficients in A * beta = b
function S06_layer_x_estimate(subject, game, DQN, reg_parameter)
root_path = 'YOUR_DATA_PATH';
main_dir = strcat(subject, '/', game) ;
sess_no = 5;
GLM_name = 'GLMs_Layer_x';
lambda_seq = reg_parameter;
load(strcat(root_path, main_dir, '/GLMs/GLM_empty/SPM... |
965d8917a8cde35a060e9287d9f2ee1c51bf4dacf07cc7aba00c16314fc6badd | MATLAB | 2,742 | 72 | function powerLFP(suffix)
% LFP POWER - Compute LFP power for given time and frequency values.
%
% Read parameters
Params = read_params(suffix);
freq = Params.freq_start_1 : Params.freq_step_1 : Params.freq_end_1;
time_window = Params.time_1;
time_step = time_window / 4;
TW = Params.fr... |
34cbb1510215f60a0147a3a0a486529179637d20e62b9569ed0abaa65b32e70d | MATLAB | 2,744 | 60 | function clean = dh_cleanartifact_interp(data,trigTimes,prebuffer,postbuffer,useSIGNI)
% DH_CLEANARTIFACT_INTERP removes large artifacts by using z-value artifact
% detection followed by SIGNIS interpolation
%
% Author: Danny Huang, adapted into function by Jeffrey B. Wang
%
% Inputs:
% data: Original EEG,... |
0834ab2028e34432d52a753c2c9c6126635b2d9da2c035aa6efd3b059978fc7a | MATLAB | 2,751 | 74 | % gradient examples
% This file exploits CELL MODE operation and is meant to be run one section at a time.
% Don't try running the whole file straight; it'll just clobber its own output.
% Pick a section to run, use ctrl-enter or click "Run Section" from the Editor toolbar
%% ease curves for gradient functions %%%%%... |
5b4eb7919ad6a2bae2af42167e90c24fb606e388e14b817c4fb8b036db46e2ff | MATLAB | 2,761 | 100 | function [M,y,score,proportion]=nt_sca(x,ncomp)
%[M,y]=nt_sca(x,ncomp) - shared component analysis
if nargin<1; error('!'); end
if nargin<2 ||isempty(2); ncomp=size(x,2); end
if iscell(x)
xx=[];
for iTrial=1:numel(x)
xx=[xx;x{iTrial}];
end
x=xx; clear xx;
end
x=nt_demean(x);
THRESH=10^-12;
%... |
0296f83b3e22565d44744352154efc447b65d8a652e801d710f797a3c5e87af5 | MATLAB | 2,763 | 89 | function U = prepare_inputs_polar_samsrf(ApFrm,TR, nmicrotime, stim_duration, stim_diameter, varargin)
% Produces the input structure needed for spm_prf_analyse() given a 3D
% stimuli matrix with dimensions [x,y,t].
%
% Inputs:
%
% ApFrm - [x,y,t] binary matrix indiciating which pixel locations
% ... |
077e8571f506f5ea9360dc811594044c7fbae37ad1dd1e6bd6e3cc0883f7032a | MATLAB | 2,764 | 83 | % Split the HC data for a null model
% Result: Freedman–Lane maxT (after site filtering): T=4.3362, p=0.429
all_conn_matrices = load('.../FC_filtered.mat');
average_conn_matrix = squeeze(mean(all_conn_matrices.FCE, 1));
load('.../kCycleVect.mat');
load('.../Alpha.mat');
demographics = readtable('.../DemTable.xlsx');... |
20d8bc68b1e13da09f91059c1a5c16005561f4cb69e4f70c71ba9f0691f8051c | MATLAB | 2,766 | 73 | function [session,condition,onset,duration] = specif_model_saccadeslents(rootdir, sub)
%Returns paradigm details (about events to be modelled) from subject for
% whose directory is 'rootdir'.
%
% This function is being called by lcogn_single_firstlevel.m during
% 'model specification' or 'contrasts specification'.
%
%... |
6e12e9c49e114ce29e9c7e0a638f6278c134eb1b21fca588c5d3ae08b6477e02 | MATLAB | 2,771 | 101 | function training(name, trigger, stim_set, num_runs, task_num, start_run)
% Executes training protocol for IBC version of functional localizer experiment
% used to define regions in high-level visual cortex
% selective to faces, places, bodies, and printed characters.
%
% Inputs :
% 1) name -- subject number
% 2) ... |
6d732a6b6032c2d994ca969a4d414501e1e12bd21e25270f64ef081b905f96f6 | MATLAB | 2,772 | 88 | function [AA,BB,RR,iBest]=nt_cca_crossvalidate(xx,yy,shifts,ncomp,A0,B0)
%[AA,BB,RR,iBest]=nt_cca_crossvalidate(xx,yy,shifts,ncomp,A0,B0) - CCA with cross-validation
%
% AA, BB: cell arrays of transform matrices
% RR: r scores (3D) for all components, shifts and trials
% iBest: index of best shift
%
% xx,yy: cell a... |
7c5cdbf85a5a61b64b7beaef82a2fb320fe168e60811cdea08d254d388a05d0e | MATLAB | 2,773 | 86 | %%
% I have no idea why MatLab cannot reopen figures without messing up
% their titles.
function [hFigures] = fixplots(hAxes)
%----- Get axis handles
if nargin < 1
hAxes = findobj('Type', 'Axes');
else
hAxes = findobj(hAxes, 'Type', 'Axes');
end
%----- Loop throug... |
592a26f7a92cd140c8ea24caf4adc28a7cd225f2085c84807c5d62046f8afd8f | MATLAB | 2,775 | 83 | function [combo] = concatenate(varargin)
% CONCATENATE Concatenate inputs along the smallest available dimension.
%
% Calls cat() on the provided inputs, by packing them into the smallest
% number of dimensions possible. The concatenated dimension is the first
% available singleton.
%
% In the case wher... |
6e5e368907772def7b76d9dc86bb22b5bea8625339c2b85158ccacb50f7037e6 | MATLAB | 2,780 | 75 | function cohSpikeLFP(suffix)
% WAVELET ANALYSIS
% Determine phase consistency between LFP and spikes over the frequency
% spectrum. LFPs are decomposed with the wavelet transform.
%
% Read parameters
Params = read_params(suffix);
freq = Params.freq_start_1 : Params.freq_step_1 : Params.freq_end_1;
... |
fe975ef5b10b65895a813ce0ce20eeca4906b0b25c7a9ff8e13fc810775fc08a | MATLAB | 2,781 | 65 | cd \\lexport\iss01.charpier\analyses\stephen.whitmarsh\EpiCode\projects\hspike
hspike_setpaths;
% set all parameters
config = hspike_setparams;
% replace data pointer to temporary data
config{2}.rawdir = '\\lexport\iss01.epimicro\patients\shared\tmp\test\pat_02718_1201\eeg';
config{2}.directorylist{1} = {'0... |
326dc403c8000ae76d0c6415faa6043d97df5d3535a25c3d2ffab8284c2060d7 | MATLAB | 2,783 | 102 |
close all
%
load([pwd '/init_data/var_combos.mat'],'var_combos');
numPerBlock = 1000;
[lpp, ~] = size(var_combos);
maxNumBlocks = ceil(lpp/numPerBlock);
%
Sim_results = [];
for i = 1:maxNumBlocks
resultsi = load([pwd '/result/Sim_results' num2str(i) '.mat']).Sim_results;
Sim_results = [Sim_results, results... |
4bfab492d8bc491459fcdbcd6e45494db3d1d63f113eca20512d4dd601088ea5 | MATLAB | 2,783 | 102 |
close all
%
load([pwd '/init_data/var_combos.mat'],'var_combos');
numPerBlock = 1000;
[lpp, ~] = size(var_combos);
maxNumBlocks = ceil(lpp/numPerBlock);
Sim_results = [];
for i = 1:maxNumBlocks
resultsi = load([pwd '/result/Sim_results' num2str(i) '.mat']).Sim_results;
Sim_results = [Sim_results, resultsi... |
3f7b6509d38df6947ca801af77134d5540909a30f7df14cea392c629942e8b6b | MATLAB | 2,786 | 93 | function [varargout] = eig2nifti(varargin)
%EIG2NIFTI convertes .eig.nii.gz files (as saved by BDP - BrainSuite Diffusion Pipeline) to standard
% NIfTI-1 format.
%
% Usage:
% eig2nifti <infname.eig.nii.gz> <outputfilebase>
% eig2nifti(input_eig_file, output_base)
%
if nargin ~= 2
msg = '';
... |
14376ae4af6c40c844b05ad2847aabfdf7eb1f705e644380ccac01ed0e35e4f1 | MATLAB | 2,787 | 102 |
close all
%
load([pwd '/init_data/var_combos.mat'],'var_combos');
numPerBlock = 1000;
[lpp, ~] = size(var_combos);
maxNumBlocks = ceil(lpp/numPerBlock);
%
Sim_results = [];
for i = 1:maxNumBlocks
resultsi = load([pwd '/result/Sim_results' num2str(i) '.mat']).Sim_results;
Sim_results = [Sim_results, results... |
8844a91cf40a4f9fa3938def7b1c1d1c63719800429af625eed0a47bf6f64a4e | MATLAB | 2,787 | 111 | function p = factor2(innum,varargin)
% P = FACTOR2(N,{OPTIONS})
% Find the factor pairs of an integer. This is useful for finding
% the 2D geometries into which a given vector can be arranged,
% for instance, when devectorizing images of unknown geometry.
%
% N is a positive scalar integer (not necessarily i... |
9c93c6b1266771ab478b95b8d2a12db0a7ef8763259a71f052e23dbb2bcbae28 | MATLAB | 2,787 | 71 | function [U] = cpm_set_constraints(U, parameter, grid_constraints)
% (Re)setting parameter constraints, using the initial constraints saved in
% U.
% U - Stimulus estimates for the subject
% parameter - The parameter for which constraints have to be set.
% grid_constraints - List of length 2 ... |
a1dd31a9d73ba25bba266638fed5c5b58dc2ae9bab294bcbdb6a4b94d331769d | MATLAB | 2,790 | 85 | fig = figure;
set(fig,'position', get(0,'ScreenSize'));
set(fig, 'PaperPositionMode', 'auto');
markername = "combined1";
ncol = max(SpikeTrials_timelocked{ipatient}{1}.(markername).trialinfo.idir);
for idir = unique(SpikeTrials_timelocked{ipatient}{1}.(markername).trialinfo.idir)'
cfgtemp = [];
cfgtemp.... |
ac3a905c4ddadf06f4d199bad7db0b4fa20ec57cd06571b631e3261a1f76a0a3 | MATLAB | 2,792 | 82 | function [rgbimage] = overlayColorOnGrayscale(colorimage, grayimage, colorrange, grayrange)
% overlayColorOnGrayscale: overlay false-coloring (eg activity) on a grayscale image (eg baseline fluorescence)
% colorimage and grayimage are 3d matrices
% usage:
% rgbimage = overlayColorOnGrayscale(colorimage, grayimage, colo... |
c063f5e12059980b334bd40aaf36e0234829e5a3e368b35538dc233d2c950345 | MATLAB | 2,792 | 65 | function [trials, wealth, onsets, stimulus_id] = cpm_events_to_trials(input_file, ...
maxtime, ...
fileOptions)
% estimate_sd_for_snr Estimates the SD for white noise, that add... |
c58041365ec68a9a8acbb770dbfabab7436748df40b3e32a82b535b61abc4af1 | MATLAB | 2,797 | 85 | function ChC = ChC_FFT_convolutions_3D(X, varargin)
% Function that directly calculates the matrix C'*C using an FFT-based
% approach.
%
% Input parameters:
% --X: N1 x N2 x N3 x Nc Nyquist-sampled k-space data, where N1,
% N2, and N3 are the data dimensions, and Nc is the number
% ... |
f71359a810245f2aa80f61a5bbb6435bf5036b5cc54da9a31e7e5a3dcf1ba027 | MATLAB | 2,797 | 52 | function [spike_matrix, clusters] = getSpikeMatrix(animal_name, resultsKlusta, save_data, repeatCalc, output_folder)
% by Mattia 19.02
% computes sparse spike_matrix starting from the output of sorted Klusta
% file. doesn't cuts periods of silence (> 500 ms of no spikes across all channels)
% input: animal_name (str... |
6e26dc143ebf7d79fbdf83fe9c91df8442e173ad0c5a6e966e8435c057b1a82c | MATLAB | 2,803 | 54 | %% function for reconstruction analysis based on Sarel et al. An additional criteria for directional tuning.
function [placeHD_idx, error_HD, error_RateMap] = ReconstructionAnalysis_Sarel2017(States, binned_HDir, HDir_Rate, BinnedXY, RateMap)
% 1. get frames of interests for each context
framesToUse = cell(2,... |
c84b11b61775d3f60051bc52f42525c6cc49c11d2b9c4a98d5656949be0c48ee | MATLAB | 2,805 | 80 | % Compute the positive-definite square root of a given symmetric, positive-definite matrix A. The
% square root matrix is the unique positive-definite solution to A = Ahalf^2, and optionally
% this function also returns Ainv = AhalfInv^2.
%
% If the optional argument asymmetric is set to true (default false), then ... |
f244c780adfc8c2fdba51b7859b73afecaf76cbed331fa86d698f0a2ef7b025b | MATLAB | 2,806 | 107 | function biasAna(data1,data2,options)
% function biasAna(data1,data2,options)
% runs a short analysis to see whether two 2AFC datasets have a bias and
% whether it can be explained with a "finger bias"-> a bias in guessing
options.expType = 'YesNo'; % must be set this way to fit gamma & lambda
if ~isfield(options,'pr... |
d8a32136d2c834fa65f4e82144711bf27b3ccaeefb4470abeb5795098a43ff50 | MATLAB | 2,812 | 59 | % 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... |
4d6f4bf60237fd48e03c6bd17dd008889145ef50fe91307a3e080f3bdc157fbb | MATLAB | 2,825 | 97 | function [] = modelDiagnostics(mixed_folder, file_name,Y, lme)
close_figs = 1;
calcium = 1;
diag_folder = fullfile(mixed_folder, 'Diagnostics');
if ~exist(diag_folder)
mkdir(diag_folder);
end
% model fit
model_fit = lme.ModelCriterion
save(fullfile(diag_folder,strcat(f... |
e8907474ba81acc740a7937029d90c7dff2d6e08b21d9534cccb3495f8dd0d2c | MATLAB | 2,827 | 78 | classdef GeneExpressionLevels < handle
% GeneExpressionLevels (PCA-specialized)
% Manages brain region gene expression levels and their PCA representation.
properties
ExpressionMatrix double % [N_regions x N_genes] original expression matrix
AnnotationIndices double % [N_re... |
ba73b2f5ccd8ceaa9c08126480417527fcd157a4bc0bb5dd9e1ac4dfd91a8605 | MATLAB | 2,829 | 84 | function K_neighbors = CBIG_SPGrad_find_neighbors(neighbors,K)
% K_neighbors = CBIG_SPGrad_find_neighbors(neighbors,K)
%
% This script find the K nearest neighbors for a given neighborhood structure
%
% Input:
% - neighbors:
% the #vertice x 6 neighborhood of a mesh structure
%
% - K:
% the number... |
d8c83897fce2cdf18e553f8f5bdcceba0f03a0334bcbc2bd3e0400aa0a445aaf | MATLAB | 2,829 | 112 | function outpict = imsharpenFB(inpict,varargin)
% OUTPICT=IMSHARPENFB(INPICT,{OPTIONS})
% Sharpen an image by unsharp masking
%
% This is a passthrough to the IPT function imsharpen(), with internal fallback implementations to
% help remove the dependency of MIMT tools on the Image Processing Toolbox. As with ... |
ae74eb78d8625e163daa2169fb4fb012cda21cd991b67c9d723adc1d451daf17 | MATLAB | 2,831 | 129 | function I = mi_gg_vec(x, y, biascorrect, demeaned)
% MI_GG Vectorized MI calculation between multiple Gaussian x variables and a
% common Gaussian y variable in bits
% I = mi_gg_vec(x,y) returns the MI between two (possibly multidimensional)
% Gassian variables, x and y, with bias correction.
% size(x) = [Ntr... |
8b6399efe456e85f8bf55b1a115ae1e44523c653438f98ab3d9324bc874ec772 | MATLAB | 2,837 | 125 | function outpict = xwline(imagesize,X,Y)
% XWLINE(SIZE,X,Y)
% draw antialiased line segments for use in image composition
% this is based on Sachin Abeywardana's Matlab implementation at
% https://github.com/sachinruk/xiaolinwu
%
% SIZE is a 2-element vector describing the output image dimensions ... |
c2a54b3cf92bc61705b8a6bd332db4f1f9cdcbd4012284cd027ccd08e01fa0d2 | MATLAB | 2,841 | 76 | function [y] = spm_prf_fx(x,u,P,M)
% State equation for Neuro- and Hemo-dynamics
% FORMAT [y] = fx_hdm (x,u,P,M)
% x - state vector
% u(i) - drive to ith population
%
% x(1) - vasodilatory signal s
% x(2) - rCBF ln(f)
% x(3) - venous volume ... |
1858208f3f727503292d2757eb3e984ba6ba839ec57cbd9ddb73ffe26b0effc0 | MATLAB | 2,842 | 79 | %% demo_003 fields of the results struct - Which information is contained in the result of Psignifit
% to have some data we use the data from demo_001
data = [...
0.0010, 45.0000, 90.0000;...
0.0015, 50.0000, 90.0000;...
0.0020, 44.0000, 90.0000;...
0.0025, 44.0000, 90.0000;...
0... |
9fa39bc657b5f26469f31259c7e75f6bc3233ca7f07fe9708d937460b0287a23 | MATLAB | 2,842 | 81 | classdef PlotDynamicDetail < handle
%------- Public data
properties
opt % Options
repPixels % Minimum number of pixels for each representation
rep % Detail representations
data % Plot data
hListen... |
228801612bbc2caed5a9c40699f5bcaab9b91f4ed981b1cf882ad6281c1c9077 | MATLAB | 2,845 | 108 | function h = plot2D(result,par1,par2,plotOptions)
%% function h = plot2D(result,par1,par2,plotOptions)
% This function constructs a 2 dimensional marginal plot of the posterior
% density. This is the same plot as it is displayed in plotBayes in an
% unmodifyable way.
%
% The result struct is passed as result.
% par1 an... |
3e94fb1435a716cba4aedf1926da290371fbe1f970f5752379bea61f961ff936 | MATLAB | 2,845 | 85 | function [unwrapped, B0] = ROMEO(phase, parameters)
romeo_name = 'romeo';
output_dir = pwd();
if isfield(parameters, 'output_dir')
output_dir = parameters.output_dir;
end
% Input Files
fn_phase = fullfile(output_dir, 'Phase.nii');
fn_mask = fullfile(output_dir, 'Mask.n... |
336f20fa6b5f7f51980207dd06ad0cf6f0075db83948ec927de86012d725b930 | MATLAB | 2,847 | 91 | function [AA,BB,RR,iBest]=nt_cca_crossvalidate(xx,yy,shifts,ncomp,A0,B0,K)
%[AA,BB,RR,iBest]=nt_cca_crossvalidate(xx,yy,shifts,ncomp,A0,B0) - CCA with cross-validation
%
% AA, BB: cell arrays of transform matrices
% RR: r scores (3D) for all components, shifts and trials
% iBest: index of best shift
%
% xx,yy: cell... |
89c4df06631528c51aec366ff1ea7396e458f581b51ad42f42a25f5de8ef24a3 | MATLAB | 2,859 | 93 | function outpict = edgemap(inpict,varargin)
% OUTPICT=EDGEMAP(INPICT,{FILTERTYPE},{OPTIONS})
% Filter an image to reveal edge information.
% Unlike the IPT tool edge(), no thresholding is performed.
%
% INPICT is an I/IA/RGB/RGBA/RGBAAA image of any standard image class.
% FILTERTYPE is one of the foll... |
6320a5cb5b1f75200b0443d7d5c07667db206f4862d1210dca87d914cd61a8e8 | MATLAB | 2,860 | 79 | function data_format = get_data_format2(cfg)
% get_data_format2 returns the name of the data format found in the data files
% indicated in cfg.rawdir and cfg.directorylist.
% It can be neuralynx (.ncs files), ced (.smr or .smrx files), brainvision
% (.eeg files), or micromed (.TRC files). An error occur if there is... |
6d7231af5523eb4388b8fe1d1f277f0300e3c6167f2899cf32fd0c1d346f73bb | MATLAB | 2,860 | 95 | function [y,ind]=nt_xprod(x,flag,dsratio,normrow_flag)
%[y,ind]=nt_xprod(x,flag,dsratio,normrow_flag) - form all crossproducts
%
% y: crossproducts
% ind: linear index of cross-products
%
% x: data (time*channels*trials)
% flag: 'lower','nodiag','full' [default: 'lower']
% dsratio: ratio by which to downsample ... |
bb3829ab05dcee9e7aa2098f204767d4548dca485e773a3a9c9f5adad9aa8bb0 | MATLAB | 2,864 | 104 | function protocol(name, trigger, stim_set, num_runs, task_num, start_run)
% Executes IBC version of functional localizer experiment
% used to define regions in high-level visual cortex
% selective to faces, places, bodies, and printed characters.
%
% Inputs :
% 1) name -- subject number
% 2) flip_or -- 1-back imag... |
2da2959084ac4f45ce737b620d3c91a18835b3eb5fa38573a8302ff57abcb7d7 | MATLAB | 2,865 | 94 | function outpict = imcurves(inpict,varargin)
% OUTPICT = IMCURVES(INPICT,{IN},{OUT},{INTERPMODE},{CHANNELS})
% Adjust the intensity distribution of an image using an arbitrary curve.
% This is generally more flexible than imlnc().
%
% INPICT is an image of any standard image class. Multichannel and multiframe ... |
8f1ef14d256f2c988de63f092ef1989af8d4725dc442ed816eb56dd61b79953c | MATLAB | 2,866 | 111 | function [varargout] = ESPIRiT(cmd, varargin)
% BART Call ESPIRiT command from Matlab.
% [A, B] = ESPIRiT('command', X, Y) call command with inputs X Y and outputs A B
%
% 2014-2016 Martin Uecker <uecker@med.uni-goettingen.de>
% Edited for WSL, by Soumick Chatterjee <soumick.chatterjee@ovgu.de>
if nargin==0 || all(... |
12dd57a7cfa40dddb615bdee9f6a6566aad1f2772962cfdef1174e18f754c240 | MATLAB | 2,873 | 102 | % SVReg: Surface-Constrained Volumetric Registration
% Copyright (C) 2017 The Regents of the University of California and the University of Southern California
% Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy
%
% This program is free software; you can redistribute it and/or
% modify ... |
b9c1218f140fec9a208c99cd1016cdbdc5f15f8e9a6f6a7f1ffcf17d63a772ab | MATLAB | 2,879 | 54 | function [spike_matrix, clusters] = getSpikeMatrix(animal_name, resultsKlusta, save_data, repeatCalc, output_folder)
% by Mattia 19.02
% computes sparse spike_matrix starting from the output of sorted Klusta
% file. doesn't cuts periods of silence (> 500 ms of no spikes across all channels)
% this is the version for t... |
cfa2a806d6fccc4a876e13d2a2f47525a5a57a093081618a309e6fb91a67bf5c | MATLAB | 2,880 | 83 | function spotspotcheck()
fig = uifigure('Name', 'spotspotcheck', 'position', [360 198 260 100]);
launchButton = uibutton(fig, 'push', 'position', [30 20 200 20], 'Text', 'Start');
countCheck = uicheckbox(fig, 'position', [30 70 200 20], 'Text', 'Get Cell Counts', 'Value', 0);
launchButton.ButtonPu... |
ef7cdbbe619179eb8509c7a278d3fb1b3b6ab30b30d1648152692037e8d6640e | MATLAB | 2,882 | 113 | function [a, varargout] = rwLCA(x, phi, thrtype, eta, gamma_val, maxIters, relTol, varargin)
% test for number of required parametres
if (nargin-length(varargin)) ~= 7
error('Wrong number of required parameters');
end
% set the defaults for the optional parameters
compute_mse = 0;
% read the optional parameters
a... |
dd2b34775fb565bc5a237d3c67d63109175cb1d178afb0e60163289aac6c5d63 | MATLAB | 2,883 | 102 | clc,clear all;close all;
% Load the mode from one sample subject for reconstructing spectrogram
load("mode_wake.mat");
load("mode_sleep.mat");
% Wavelet parameter
wavelet_name = 'cmor1-1.5';
fs = 100;
central_freq = centfrq(wavelet_name);
freq_start = 0.5;
freq_end = 20;
num_bin = 200;
w = linspace(freq_start,freq_en... |
86974cdab9d5feb6809448eb04dc50d487a8c93abe2183fe46b87eb61d4f7939 | MATLAB | 2,884 | 108 | function I = mi_mixture_gd(x, y, Ym)
% MI_GD Mutual information (MI) between a Gaussian and a discrete
% variable in bits calculated from Gaussian mixture
% I = mi_gd(x,y,Ym) returns the MI between the (possibly multidimensional)
% Gaussian variable x and the discrete variable y.
% Rows of x correspond to... |
d2555beb9987e74a716eef92723466d610959515e5a51da76968fe9e596cc9e4 | MATLAB | 2,884 | 70 | function next = morse_calc_sens(input, PPIparams)
% FORMAT sens = morse_calc_sens(dat)
% ref - k-space [RO PE1 PE2 N_coils]
%% Reconstruction Parameters, Filenames and Switches
global scaleKsp w N_ref N_order onlineROFT
PAD = w*[0 0 0]; % Padding for smoothing
% Apply constraint: N_order... |
7cde7dd8e6f55661f5cbf8689bfed905ff665ab951ef4afc85e1bba9e17cfb12 | MATLAB | 2,886 | 94 | function lin = unwrap2(ang, kernelWidth, refAngle, debugPlots, tolerance)
if nargin < 3
refAngle = pi/2;
end
if nargin < 4
debugPlots = false;
end
if nargin < 5
tolerance = pi;
end
lin = ang;
hasData = isfinite(lin);
% lin(~hasData) = p... |
ab58de135f58eaaa1bce19a1a57bd2f12edbc38afec44b1a0dd7e211be42dec8 | MATLAB | 2,889 | 74 | % SVReg: Surface-Constrained Volumetric Registration
% Copyright (C) 2016 The Regents of the University of California and the University of Southern California
% Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy
%
% This program is free software; you can redistribute it and/or
% modify ... |
b20c27d99df6aa85d5c5e3132e46f3f8a37348dd2e5886e83f3a360ae4f2ab2a | MATLAB | 2,891 | 79 | function CBIG_AuthorTopic_ConvertBrainImagesToCVBData(dataDir, cvbDataFile)
% CBIG_AuthorTopic_ConvertBrainImagesToCVBData(dataDir, cvbDataFile)
%
% Convert binary-smoothed brain images of activation foci to data input
% for the Collapsed Variational Bayes (CVB) algorithm.
% The binary-smoothed brain images are produce... |
58268f94cbae6dcd5e0d4494e45b2d9b0595da04633b76e2fdd68d42167851de | MATLAB | 2,893 | 94 | %% FRACPLOT Plots a "progress bar" with a given fill fraction
%
% fracplot(fraction, x, y, width, height);
% fracplot(fraction, x, y, width, height, color, alpha);
% fracplot(ax, ...);
% fracplot([hBox,hFill], ...);
% fracplot(..., lineOptions = {...}, bandOptions = {...});
%
function [hBox, hFi... |
06b67c28f868589bccc017263033c86c788f920aca724242aa2d7e52f4e78ffa | MATLAB | 2,897 | 58 | %% main_demonstration
%% Startup
clear; clc;
startup_SPERRFY; % path setting
%% Load data
main_import_processed_data; % import data (.mat)
main_data_preparation;
%% Parameter setting
main_parameter_setting;
% small number of null connectome test
numNullTest = 10;
%% Mouse connectome data analysis
rng(1);
mouseConn... |
d6ec0d4b6f3e98cdd87a331400a8d93363b443cc991568d41032d9b9230ae143 | MATLAB | 2,899 | 69 | function preictal_launch_SpykingCircus(ipatient,analysis)
arguments
ipatient
analysis = ft_getopt([],'analysis','all');%all, extracting, converting
end
%find config script :
addpath(genpath('/network/lustre/iss01/charpier/analyses/louis.cousyn/Scripts/EpiCode/projects/preictal'));
config = preictal_setparams... |
ea685aebc491e1b942b8a1cad507fad4d326e3637e1043b63a565c8bce28e3ea | MATLAB | 2,901 | 124 | function index=structfind(a,field,value)
% StructFind, Find the index of a certain string or value in a struct
%
% index=structfind(a,field,value)
%
% inputs,
% a : A Matlab struct, for example a(1).name='red', a(2).name='blue';
% field : The name of the field which is searched, for example 'name'
% ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.