sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
3dba98a035a287dea4fcbe0d23cb832ebe18baae8fec07040b5e24fd90338464 | MATLAB | 2,372 | 74 | %% script to test different ftypes in msdf on real and simulated psths
clear all,close all
% determine whether to use real data (1) or simulated data (0)
realSpikes = 1;
% specify w for each ftype
w_boxcar = 100; % note that if mod(w_boxcar,2)=0, msdf (but not smooth.m) will make w -> w+1
w_Gauss = 100;
w_exp... |
d6bb4fe900f30e875916666faa9652c143b6bcd5157923a31bb773e778752d69 | MATLAB | 2,381 | 91 | %%*******************************************************%%
%%% General linear model built with every acquired echoes
%%% Coil combination required beforehand
%%% Inputs: Complex data of dimension: [nx,ny,nz,nEchoes,nSets] (nSets=2)
%%% TE vector of Echo times of all the echoes in sec
%%% NbEchoes: Numb... |
200d70df7fa0eafaeab12077bc40dd1c9da879dd3c1381009ef989d94a9ba663 | MATLAB | 2,383 | 74 | function [A, x_out, y_out, z_out] = my_imresize3d(V, scale, tsize, ntype)
% This function resizes a 3D image volume to new dimensions. More accurate computation of image grid
% for output image.
% V: The input image volume
% scale: scalar scaling factor - could be a scalar or vector of size 3; when used set tsize ... |
b0feb954773a91c35bed921a45211b29c76a509adba5c93cc7ba693a0b339c0f | MATLAB | 2,383 | 80 | function plotPosteriorScatter(result, dims, minP)
% plotPosteriorScatter(result, [dims], [minP])
% where 'dims' is a subset of 1:5 with 2 or three elements
% marginalizes over all other dims and makes either a 2d or 3d scatter plot
% of the resulting marginal posterior grid, ignoring data with posterior
% probability... |
43f6dacd117416c5523e7e397fde7b04bb143a910460b4edb9f55cd7656073d9 | MATLAB | 2,387 | 68 |
% The purpose of this file is to generate a file that gives a vector of
% grayordinate labels, its id lookup tables
clc;clear all;close all;restoredefaultpath;
addpath(genpath('/ImagePTE1/ajoshi/code_farm/bfp/dev/gifti-1.6'));
addpath(genpath('/ImagePTE1/ajoshi/code_farm/bfp/src'));
%addpath(genpath('/ImagePTE1/ajoshi... |
db0bc640785fb444ed7b3d446fcea69288f2590c0233b6e698321a3ea4493d8f | MATLAB | 2,389 | 46 | % 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... |
0a0d6d60567eb9017d182eafb62974ffb0c11c7e96a08efbacbadd695504c619 | MATLAB | 2,390 | 65 | function bitpix = datatype2bitpix (datatype)
% Returns bitpix for the input datatype according to following table:
%
% 0 None (Unknown bit per voxel) % DT_NONE, DT_UNKNOWN
% 1 Binary (ubit1, bitpix=1) % DT_BINARY
% 2 Unsigned char (uchar or uint8, bitp... |
937ba6d5e88efa66a13a1a52e16e5d3c931f83f2be4c9b30f8d65e959a8455d1 | MATLAB | 2,391 | 51 | config = hspike_setparams;
old_name = 'Hspike2';
new_name = 'Hspike';
for ipatient = [1, 2]
% backup markerfiles
for ipart = 1 : 1
for idir = 1 : size(config{ipatient}.directorylist{ipart},2)
fname_mrk = fullfile(config{ipatient}.rawdir, config{ipatient}.directoryli... |
b8e22efc62b45cc9a93a5e36d59d7e9b132f08f144a2b6e02827d210bddb1500 | MATLAB | 2,392 | 71 | function data = remove_artefacted_trials(cfg, data)
% Use as
% data = remove_artefacted_trials(cfg, data)
%
% Remove artefacted trials in raw and spike data, based on trialinfo.BAD_sec.
%
% Input :
% - cfg.minbadtime.(markername) : minimum duration, in second, of artefacts in
% ... |
f895e10733f930323e207afcf36cd8d410a50381f92575fc95ea27d5f0e09849 | MATLAB | 2,393 | 74 |
%% Fata morgana algorithm .Qi A
function [gBestScore,bestPos,cg_curve]=FATA(N,MAXITER,lb,ub,dim,fobj)
% initialize position
worstInte=0; %Parameters of Eq.(4)
bestInte=Inf;%Parameters of Eq.(4)
noP=N;
arf=0.2;%Eq. (15) reflectance=0.2
gBest=zeros(1,dim);
cg_curve=[];
gBestScore=inf;%change this to -inf for maximiza... |
829d3350413e1758cd5c2294c51124b09ab1838a77d643f3f460f62af69e3eb2 | MATLAB | 2,394 | 84 | function [BPA,xY,XYZmm] = spm_prf_bpa_within_subject(PRF,xY,nocond)
% Bayesian Parameter Averaging over voxels.
%
% PRF - subject's estimated pRF model
% xY - Optional ROI definition for performing averaging
% (see spm_regions.m) or vector of voxel indices
% nocond - If true, disables conditional depen... |
5cb44d35cd2caf7379503bc0c8f9c4205b7fe732b50ec17d4a126b52395ced58 | MATLAB | 2,397 | 74 | function [outputFiles] = powerNorm(Analysis,output)
% NORM POWER
% Analyze the mean power for and across LFP sites. Analyses include mean
% spectrograms, mean spectra, and mean power traces.
%
%%%%%%%%
% PREP %
%%%%%%%%
% Make output
prepOutput(output);
% Save Analysis Params
save([output,'/AnalysisParams.mat']... |
e4c37681e068879134e4b0ee50939ecdfc9b849d7bf2926f973a1441df2c54f5 | MATLAB | 2,397 | 52 | % This file is a helper function. It takes grayordinates for the volume
% part from one sample cifti file. They grayordinates are specified in 2mm
% MNI space. They are transferred to the BCI space. For this purpose, first
% we coregistred BrainSuiteAtlas1 to BCI atlas and then used the svreg map.
clear all;close all;c... |
0c7a199b2e28783dc810086cbb5aa6ed6cfbb5db30c7fe62b7bcb6b57f812652 | MATLAB | 2,403 | 75 | % This file resamples fmri to surface
% subbasename is for the structural T1 image
%fmri is the file name of the fmri
%
function resample2surf(subbasename,fmri,fmri2surfFile, MultiThreading)
% Tells the compiler that parallel processing is required
%#function gcp
subpath=fileparts(subbasename);
v=load_nii_BIG_Lab... |
ea25bc8c8ee3586fc12db9b106170d3f6e726b9d86d84e43e5a3affc123409bb | MATLAB | 2,408 | 84 |
%%
function [gbestFitness,gbestPosition,conv]=SSOA(N,T,LB,UB,Dim,F_obj)
% Parameters
w = 0.7; % Inertia weight 0.7;
c1 = 2; % Personal best coefficient 2
c2 = 2; % Global best coefficient 2
k = 0.5; % Inertia weight reduction constant 0.5;
t=1;
% Initialize swarm
X... |
2234fd43af2c62bf7e963574b55ce1fe4b07686bde5392caba903f447dd83f4c | MATLAB | 2,410 | 54 | function data = preictal_gather_data(cfg, force, MuseStruct, LFP, FFT, waveformstats, spikestats, spiketrials)
fname = fullfile(cfg.datasavedir, 'data_gathered', sprintf('%sall_data.mat', cfg.prefix));
%% load precomputed data if required
if nargin <= 2 && exist(fname, 'file')
fprintf('Reading %s\n', fname);
... |
94ae89c6bfb9317fb3645618f4818e10d5c18a1d87ba06726ede15d231b0a11f | MATLAB | 2,415 | 72 | function [psth, bins] = get_psth(spike_times, trial_begin_times, varargin)
%
% psth_gdf(datarun,cell_specification,trigger,varargin)
%
%
% Reverted to Martin's original. My changes now living in rasterphli.m
%
% optional parameters
% start 0 if you want to start plot at time other than
% ... |
ce98d086133b6869edf1a1cf5af18e23ed738fbff2c1736377a19031dc6b698b | MATLAB | 2,417 | 64 | function writer = write_acquisition()
writer.accepts = @(item) isa(item, 'gadgetron.types.Acquisition');
writer.write = @write_acquisition_header_and_data;
end
function write_acquisition_header_and_data(socket, acquisition)
write(socket, gadgetron.Constants.ACQUISITION);
write_header(socket, acquisitio... |
e796ca2c24701e11f7c09f2963a8cae9fa2a5f1f788dd92e696e708670521946 | MATLAB | 2,417 | 60 | classdef HoldoutAnalysisUnit
% HoldoutAnalysisUnit
% A class that represents one round of holdout analysis, including
% the train model and the evaluation metrics on the test data.
properties
TrainModel PairDataCCAAnalysisModel
TestMetrics HoldoutTestMetrics
SplitInfo H... |
710dfe6956fda0515321d0a3c7ab660d62c5e2a471172fe464af3c8876dbe41f | MATLAB | 2,419 | 55 | function coef_vals = gen_multi_infer(dictionary_n, x_im, infer_hand, opts)
% coef_vals = multi_l1ls(dictionary_n, x_im, infer_type, opts)
%
% Function to perform inference on a multitude of test vectors. The
% inference algorithm given by infer_type is run on each column of x_im
% with repect to dictionary_n.
%
% Inp... |
8640f48fa883c620667f2630c44d44de2e75e40e50baf844274b83db56ff1e54 | MATLAB | 2,419 | 78 | function addedPaths = setup_gcmi(varargin)
%SETUP_GCMI Add the GCMI MATLAB package to the MATLAB path.
% setup_gcmi adds the matlab/ directory from this repository to the path.
% If a matching native C++ MEX runtime exists under matlab/cpp_mex/bin/,
% setup_gcmi also adds that directory automatically.
% setup_g... |
54d1e3a9ee1a190151d7167cfb16cc09c6c7dad18e95227ad12642047bcc6c1b | MATLAB | 2,422 | 50 | function [pvalue, withinSample, KSdiv, meanWithin] = MonteCarloKS2test(data, sim)
% [pvalue, withinSample, KSdiv, meanWithin] = MonteCarloKS2test(data, sim)
% data is N x M
% sim is N x T x M
% N is the sample size
% T is how many trials were used to simulate data to compare the real data
% to
% M is the number of meas... |
8b2acb654c06d1c87d34eba1e82557e93a2148eb96fae183be69f13fe83e860a | MATLAB | 2,423 | 52 | % Aggregate data (default: by averaging) into bins as specified by the bin index.
%
% bin should be an n-by-m matrix where n = size(data,dim) and m = numel(numBins). Each of the m
% columns of bin is assumed to be one indexing dimension. The output will thus replace the dim
% dimension of data with an m-dimensional... |
41940bf646ac19cf541944b56752f7609826a449369ae2221fd7df799e412143 | MATLAB | 2,424 | 66 | function [surf_data, data_struct, data_size] = CBIG_ReadSurfaceData(input_file)
% [surf_data, data_struct, data_size] = CBIG_ReadSurfaceData(input_file)
%
% This function reads the content of surface data, including NIFTI and
% GIFTI format. For NIFTI file, the data in 'vol' can be either 3D or 4D.
% If it is 3D (x,y,... |
718c4f96090f37d465a384bbe3b2655dac81d54b92c05faaa168abe654095205 | MATLAB | 2,428 | 117 | function plot_images(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O)
path = 'D:\Proyectos\Automatizacion\GenericSeqMon\images\';
figure
tiledlayout(3,5,'Padding','compact','TileSpacing','compact');
nexttile(1)
imagesc(A)
axis image off
set(gca,'Color',[0.95 0.95 0.95])
set(gcf,'Color','w') % fondo blanco
title('Frame H... |
9668c60464743a404613d647d2ac3ba62a707d1778a3cb28f2dd18e2ef241cc3 | MATLAB | 2,428 | 94 | function [tosquares,quads,D]=nt_qpca0(x,npcs,nsmooth,nquads)
%[tosquares,quads,D]=nt_qpca0(x,npcs,nsmooth,nquads) - quadratic PCA
%
% tosquares: matrix to linear components closest to largest quadradric component
% quads: largest quadratic component(s)
% D: eigenvalues sorted by absolute value
%
% x: data (time*cha... |
47e9548a1a218b6d181fa4e1948e6edbd80aa192e347c7f36bfab8150dfa120e | MATLAB | 2,429 | 79 | function walkerdots = mdComputePositions(md2D, markers, tw, speed, xcenterw, ycenterw, fr, invert, jitter);
%walkerdots = mdComputePositions(md2D, markers, tw, speed, xcenterw, ycenterw, fr)
%
%Computes the array of dots to draw as the current frame of the walker.
%Loops walker when we get to the end of the md data se... |
8e2dc64daccf125eb09978b96b2e67f101d8326ecb20ec0afd9e2582fc5ad3db | MATLAB | 2,429 | 59 | function PET_plot_LFP_aligned(cfg, ipart, markername)
MuseStruct = readMuseMarkers(cfg, true);
M.non_aligned = MuseStruct;
M.aligned_xcorr = alignMuseMarkersXcorr(cfg, MuseStruct, false);
close all
fig1 = figure;
sgtitle(sprintf('%s : %s', cfg.prefix(1:end-1), markername), 'interpreter', 'none');
fig2 = figure... |
0c76afbcc0bb381c0eb6a3403516f1d64e7b99cb52edc31816fb6ee304106a8e | MATLAB | 2,430 | 63 | function [output_val] = windowed_coherence(input_data, fs, winLen, winDisp)
% On-Demand Seizures Facilitate Rapid Screening of Therapeutics for Epilepsy
% Authors: Yuzhang Chen, Brian Litt, Flavia Vitale, Hajime Takano
% DOI: https://doi.org/10.7554/eLife.101859
% Function Purpose: Calculate average coherence across ... |
4056625bf5e2556e6899851b49a8ca3de91e9949e9a2eb0f6d1ed759846876f6 | MATLAB | 2,431 | 90 | function CBIG_AvgMatlabMatrices(varargin_text, input_var_name, output_file, output_var_name, dimcount, exit_flag)
% Average one variable of all mat files in one text file.
%
% CBIG_AvgMatlabMatrices(varargin_text, input_var_name, output_file, output_var_name, dimcount)
% Input:
% varargin_text : text fi... |
7d5db14a352b83fb0705ceb00e9c3f1e85ca1adece38b53fd7399d65349893f7 | MATLAB | 2,435 | 83 | %
% 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... |
16eacc8a36bf1ee5a7b8da13869b6cb8c33eaa624a95725dea4b8ef312870db1 | MATLAB | 2,439 | 54 | function CBIG_AuthorTopic_GenerateCVBDataFromText(textDataPath, ...
dataDir, cvbDataFileName, binarySmoothKernelDim)
% CBIG_AuthorTopic_GenerateCVBDataFromText(textDataPath, ...
% dataDir, cvbDataFileName, binarySmoothKernelDim)
%
% Generate input data for Collapsed Variational Bayes (CVB) algorithm
% using coord... |
18339da111f451780110990747570cc2e7695bed95283ed95fd29e6e6c6623ea | MATLAB | 2,445 | 60 | function data = remove_too_short_trials(cfg, data)
% Use as :
% data = remove_too_short_trials(cfg, data)
% Remove all trials which are too short.
%
% Input :
% - cfg.min_trial_length.(markername) : duration, in second, below which trials
% are considered too short and... |
6f824acee88aa7eee1bba691ce0674759cff122070423f7063b1d2f9c73f7d82 | MATLAB | 2,449 | 77 | % Compute one-shot classification error for
% Modified Hausdorff Distance baseline.
%
% Running this code should lead to a result of 38.8 percent errors.
%
% M.-P. Dubuisson, A. K. Jain (1994). A modified hausdorff distance for object matching.
% International Conference on Pattern Recognition, pp. 566-568.
%
% ... |
cccf5c95570a23a3f0de711d48c6dfb05435c392860b126377355435a25c1d5f | MATLAB | 2,451 | 74 | function ChC = ChC_FFT_convolutions_2D(X, varargin)
% Function that directly calculates the matrix C'*C using an FFT-based
% approach.
%
% Input parameters:
% --X: N1 x N2 x Nc Nyquist-sampled k-space data, where N1 and
% N2 are the data dimensions, and Nc is the number of
% ... |
ac9b0febd36d86091c7de89d449f824b0e3d673f942a59c3bb71e39b53e7f459 | MATLAB | 2,456 | 98 | function K = constructKernel(fea_a,fea_b,options)
% function K = constructKernel(fea_a,fea_b,options)
% Usage:
% K = constructKernel(fea_a,[],options)
%
% K = constructKernel(fea_a,fea_b,options)
%
% fea_a, fea_b : Rows of vectors of data points.
%
% options : Struct value in Matlab. The fields in options t... |
175d1072a9d5d4c04dcffc001c9f8b39fca3318539924c672e7209eff945711e | MATLAB | 2,458 | 75 | %load normalized data from csv as table GTEx version 8
S = 1;
%choose either male or female
if S == 1
T= readtable('norm-gtexm.csv','ReadRowNames',true, 'VariableNamingRule', 'preserve');
elseif S==2
T= readtable('norm-gtexf.csv','ReadRowNames',true, 'VariableNamingRule', 'preserve');
end
%%
genes = T.Prope... |
f65712793a3d8a3789d32b9de64d3122df89e13390d333f8195d58ea85d4cb87 | MATLAB | 2,461 | 61 | function hZoom = zoomExtended(fig, axs)
% Zoom service
pan(fig, 'off');
hZoom = zoom(fig);
set(hZoom, 'Enable', 'off');
% Menu layout
hMenu = uicontextmenu;
hItem = uimenu( 'Parent' , hMenu ...
, 'Label' , 'End ... |
dd85f18f9388699322bf0bf2ed4c9e9b4486dcd9a3f035a93e21b36eb2623d21 | MATLAB | 2,462 | 68 | % Compute C = A' * B for all slices (3rd and higher dimensions) of A and B, i.e. all pairwise dot
% products of columns of A and B. Alternatively if rowProducts = true is specified (false by
% default), computes C = A * B' which are pairwise dot products of rows of A and B.
%
% If the optional argument symmetrize =... |
90e194de6ccece2bfed92a5934b27bdc0485bd3d6d3a656fe82e39471d8b701e | MATLAB | 2,463 | 71 | % 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 ... |
f298639bd80ec1e965fe25ab1934137a9681263cf5c05179b34f083685643edb | MATLAB | 2,465 | 61 | function [marginal, x, weight] = marginalize(result, dimension)
% get the marginal posterior distributions from your result
%function [marginal,x,weight]=marginalize(result,dimension)
% this function gets the marginal distribution for result
% It returns 3 variables:
%
% marginal - the values of the marginal posterio... |
0ce9fa1db1696f1e0d7e765639199a76219d65656df5380bb368c915fb1e7c88 | MATLAB | 2,466 | 43 | % 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
%modific... |
9577b02fb667a74bed25e0c1fb3fa255a283187568b7d2ff9623f2d56a535c8c | MATLAB | 2,467 | 48 | function corr_kern = mkDataEmbedding(data_obj, configParams)
% corr_kern = mkDataEmbedding(configParams)
%
% Make an embedding matrix (rename eventually to "mkDataGraph"
%
% 2019 - Adam Charles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Input parsing
if nargin < 2 || isempty(con... |
bd98a1d6a1279e77e3f84db7544fac145044a4209338ec143f8aa45fa001c323 | MATLAB | 2,468 | 69 | function [isNeuralynx, isMicromed, isBrainvision] = get_data_format(cfg)
% get_data_format returns 1 in the respective variable if the format corresponds
% Otherwise returns 0.
% Use as
% [isNeuralynx, isMicromed, isBrainvision] = get_data_format(cfg)
%
% Format used : Neuralynx (.ncs), Micromed (.TRC), Brainvision ... |
8f130c230ece422c5ee0408bb0179651645922f8c543d966e5c20f60835a0d06 | MATLAB | 2,481 | 78 | function [senseMaps, eigenValues] = PISCO_bart(input, output,FFT_interpolation)
%% Loading data
addpath(fullfile(getenv('BART_TOOLBOX_PATH'), 'matlab'));
maxNumCompThreads(1);
setenv('OMP_NUM_THREADS', '1');
setenv('MKL_NUM_THREADS', '1');
setenv('OPENBLAS_NUM_THREADS', '1');
setenv('BLAS_NUM_THREADS', '1');
setenv('... |
5eb88b8a84c9737038636509edd33946a28f9351ff4d243aaac4712cd53169c2 | MATLAB | 2,485 | 61 | function [dat, tbl] = readRippleLab(fname)
% This file is part of EpiCode, see
% http://www.github.com/stephenwhitmarsh/EpiCode for documentation and details.
%
% EpiCode is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Soft... |
7fd4cb47bb12aa6c8f8e4e451d4ef19944f95d17b82d9658daaf4d68f44a716a | MATLAB | 2,486 | 46 | % test_main_script.m
%% Startup
clear; clc;
startup_SPERRFY; % path setting
%% Load data
main_import_processed_data; % import data (.mat)
main_data_preparation;
main_parameter_setting;
%% Run main data analysis
mainDataAnalysis = ConnectomeAnalysisRunner(connectomeMatrix, geneExprLevels,crossInfo, ...
pairData... |
73456c9ca548e7356ddbbb8ada441187bd8962afa87f8bcb8e04a588ecc679a8 | MATLAB | 2,487 | 89 | function [boxedX,Bx,By]=boxpdf(X)
% Forces the pdf of data to have a boxed distribution using a data adaptive lookup table.
%
% [boxedX,Bx,By]=boxpdf(X)
%
% boxedX=N(X) where N is an data adaptive monotonically increasing function.
% boxedX vary between zero and one.
%
% Bx,By describes the lookup table
%
% (c) Aslak G... |
ab2c684a73f44bd846900b4f8b2264dc7296a4829290344702883c11f70969ed | MATLAB | 2,487 | 73 | %% Wrapping function for spatial remap analysis
function [All, Cohort, Individual] = Wrap_Remap_Spatial(workdir,discrimination)
All.Remap = [];
All.Rate = [];
All.Stability = [];
All.StackedMap = {[]; []};
All.ID = [];
Cohort.Remap = {[]; []};
Cohort.Stability = {[]; []};
Cohort.StackedMap = {[] []; [... |
e5a28eb36a005df1ef82c5d3251cb7c003b5b4b31ac2bca7aae7eca5b352d423 | MATLAB | 2,491 | 67 | function plotTimingPolar(config, MuseStruct)
config.plot.label = {'template1', 'template2', 'template3', 'template4', 'template5', 'template6'};
t = table;
for ipart = 1 : size(MuseStruct, 2)
for idir = 1 : size(MuseStruct{ipart}, 2)
for marker = string(config.plot.label)
if isfield(MuseStruct... |
72d0e6a061a242dde6f0f7cc9d07a0966cd1171c5ab56d9ff247060cb62a8614 | MATLAB | 2,497 | 92 | function outpict = fdblend(inpict,varargin)
% OUTPICT=FDBLEND(INPICT,{OPTIONS})
% This is the permutation/blending routine used by the original FD style
% image mangling routines. This is intended to be used in conjunction with
% IMCONTFDX, though it can otherwise be used on any 4D image stack. Th... |
a6b66784c2b48ee3ed7e85856b5d96594b259a4bb2ae8a62dfdc11383a162a40 | MATLAB | 2,499 | 67 | function [streeng] = fit2str(fitobj, maxCharsPerLine, precision)
% FIT2STR Returns a nice representation of the given fit object,
% including parameter values.
if nargin < 2
maxCharsPerLine = inf;
end
if nargin < 3
precision = 3;
end
if isstruct(fitobj)
if isf... |
68067d9a7b492fb7c5ff7368ec38ef355f3e8d5caa56e55dcac860248d75320a | MATLAB | 2,502 | 98 |
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... |
ea8e6f1cee70494cf89ddb9c8cf8035a5950bbdab1702aed1d75e75673b9293d | MATLAB | 2,503 | 52 | function neurons_table = summarized_neurons_table(cfg, ipart, force, SpikeStats_windowed, SpikeDensity_timelocked, SpikeWaveforms_stats)
fname = fullfile(cfg.datasavedir,'..',[cfg.prefix, 'p', num2str(ipart), '-neurons_table.xlsx']);
if exist(fname, 'file') && force == false
fprintf('Reading %s\n', fname);
ne... |
274165016d7b26db1439b2ebfc6fe7145684fad761ffb5a90cd911f40d13412f | MATLAB | 2,506 | 72 | function MBmodel = buildMBmodel(nKCs, nPNs ,isVar_Nclaws, isVar_weights, ...
isVar_Theta, varargin)
p = inputParser;
addRequired(p,'nKCs', @isnumeric);
addRequired(p,'nPNs', @isnumeric);
addRequired(p,'isVar_Nclaws');
addParameter(p,'Nclaw_mean', 6, @isnumeric);
addParameter(p,'Ncl... |
1dc143b7c042496dae95b7db0d70bb14c84bef7c0bfd6e127afd820eed1bb233 | MATLAB | 2,511 | 73 | function [txt, labels] = colorLegend(colors, labels, delimiter, values, compact)
%% Default arguments
if ~exist('delimiter', 'var')
delimiter = [];
end
if ~exist('values', 'var') || isempty(values)
values = [];
end
if ~exist('compact', 'var') || isempty(compact)
compa... |
1bcdb048fd7ae4ca6b0ba986cb6199690685e32f9667c5f4dc5d0ee045552c61 | MATLAB | 2,514 | 76 | % Formats the given axis to have color map on a symmetric negative/positive scale
function varargout = tempscale(axs, colorRange, showColorbar, palette, varargin)
%% Default arguments
if ~exist('axs', 'var') || isempty(axs)
axs = gca;
elseif nargin < 4 && isnumeric(axs) && numel(axs) > 0 && n... |
822e100167509454905eb84fba9d0b0ef61259db4e01821eb45c77b62a66df60 | MATLAB | 2,515 | 69 | % CROSSVALMAHALANOBISDISTANCE Computes the Mahalanobis distance between the sample X and data in X
% itself, using a cross-validation concept. Also optionally returns the Mahalanobis distance between
% sample X and any other reference data provided via varargin (assumed to be independent from X).
%
% Inputs
% ==... |
327f32685f800932200b29e551b42b633685cd262d94183e8d6962333c5ea2ee | MATLAB | 2,516 | 59 | function writeSpykingCircusParameters(cfg)
for ipart = 1 : size(cfg,2)
fname_prb = fullfile(cfg.datasavedir,[cfg.prefix(1:end-1)],['p',num2str(ipart)],[cfg.prefix,'SpykingCircus.prb']);
fname_params_default = 'SpykingCircusDefaultSettings.params';
[~, name, ~] = fileparts(cfg.fnames_n... |
2d3944ace3dec110223beeb98d1dd0272e8b9f2dee9ede1bab5eac8c737646d5 | MATLAB | 2,518 | 87 | function [answer] = ask(prompt, accept, varargin)
% ASK Obtains user input and returns the matching index in the answer list.
%
% If validate is set to true, then the prompt will be repeated until the
% user replies in the form of an acceptable answer.
%
% Instead of a list of acceptable replies, it is al... |
b69c670e8a89ef78c3172d67a3d369b3f052908229ccb0a1df1a79385fe4e330 | MATLAB | 2,518 | 104 | %%
% plog('x')
% plog('x', 'y', 'z')
% plog('-x')
% plog('all')
% plog('none')
% plog('toggle') or plog()
%
function [varargout] = plog(varargin)
%----- Parse input
handles = [];
iOption = 1;
% For handles there is a specific type check
if iOption <= numel(varar... |
193a450f372cc9ea9f1351e89f203409f5cdf9510eb76f56ee3e6a6237cb391a | MATLAB | 2,520 | 93 | function I = cmi_ggg(x, y, z, biascorrect, demeaned)
% CMI_GGG Conditional Mutual information (CMI) between two Gaussian variables
% conditioned on a third
%
% I = cmi_ggg(x,y,z) returns the CMI between two (possibly multidimensional)
% Gassian variables, x and y, conditioned on a third, z, with bias correct... |
b446d282452b64a033e87aa2000c9138a64d2df7ee20b0000d5bc987e7615668 | MATLAB | 2,522 | 94 | function outpict = amedfilt(inpict,rmax,exos)
% OUTPICT = AMEDFILT(INPICT,{RMAX},{EXOS})
% Apply adaptive median noise removal filter. This is useful for
% removing impulse (salt & pepper) noise from an image.
%
% INPICT is an array of any standard image class. Multipage images
% are supported. Multipage im... |
89e3ec69b97bdef3b2a9430030b12c14735b00792d84d3f9deeffdc75df634ec | MATLAB | 2,528 | 79 | function outpict = solarize(inpict,varargin)
% OUTPICT = SOLARIZE(INPICT,{OPTIONS})
% Apply a solarization-like effect to an image.
%
% INPICT is an image of any standard image class. Multichannel and multiframe
% images are supported.
% OPTIONS include the following keys and key-value pairs:
% 'default' ... |
b793f27c1053f3dcf491bf29797e0c2b69301ab943e92580b83c09bcccf8e333 | MATLAB | 2,528 | 36 | function hspike_setpaths
restoredefaultpath
if isunix
addpath /network/lustre/iss02/charpier/analyses/stephen.whitmarsh/git/fieldtrip
addpath /network/lustre/iss02/charpier/analyses/stephen.whitmarsh/EpiCode/projects/hspike/
addpath /network/lustre/iss02/charpier/analyses/stephen.whitmarsh/EpiCode/shared/... |
56146c3eef9cfdd09deb03e221582d17aa0f35336d6039d18831604ad48e6c9e | MATLAB | 2,535 | 51 | function pooledData = poolData(data,options)
% pools the data
%function data = poolData(data, options)
% data must be a nx3 matrix of the form [stim.Level|#correct|#total]
%
% This function will pool trials together which differ at maximum poolxTol
% from the first one it finds, are separated by maximally poolMaxGap
%... |
2c7f085bc13ab015a734a88895e16c40f1d1aae521b5091293e46aa2b9f046c5 | MATLAB | 2,536 | 71 | function cohgramSpikeLFP(suffix)
% COHERENCE TIME FREQUENCY PLOT
% Uses chronux.
%
addpath(genpath(['/data/code/grab/2018/_macros/lfp/chronux_2_12/', ...
'spectral_analysis']))
% Load parameters
Params = read_params(suffix);
freq_bounds = [Params.freq_start_1, Params.freq_end_1... |
56ab5cdef32af37e1342db50d30382849b80e87c6818b080825bd1dc8d8e967a | MATLAB | 2,536 | 63 | function M = CBIG_uniform_rand_rotation(num_rotations, seed)
% M = CBIG_uniform_rand_rotation(num_rotations, seed)
%
% This function is used to compute a uniformly distributed rotation matrix
% (UDRM). To compute the UDRM, and from a macro/big-picture view, the
% function performs the fast random rotation matrix metho... |
848f16bfec115ae8a7ae8809c8e264d95df48cc052c7ca32d13d43602d56762b | MATLAB | 2,536 | 68 | function longTable = tableWide2long(wideTable, groups, groupNames, groupLevels, levelVar)
%% Convert table from wide format to long format by grouping selected variables
% If 1st argument is a file path, the table is imported from there.
%
% SYNTAX
% tableLong = tableWide2long(tableWide, groups, groupNames, groupLeve... |
0e820c3d71890fa32768c0719e1a399e121de51e373e41631253f62f2c51c785 | MATLAB | 2,540 | 65 | function OUTEEG = gettechnicallycleanEEG(INEEG, bandpass_upper_range,bandpass_lower_range)
% OUTEEG = gettechnincallycleanEEG(INEEG,bandpass_upper_range)
%
% Input(s):
% - INEEG: EEG struct to process
% - bandpass_upper_range: Upper range for bandpass filtering of EEG data
%
% Assume 1.ICA performed, 2. B... |
47b5fb6df0e913979b72492d3405edea25059262f8bcc800e09451d437740453 | MATLAB | 2,542 | 98 | clear
clc
% Generate adjacent matrix Adj (Note: ensure the file path and file name is valid)
LSmat='LS.txt';
MLmat='ML_matrix.txt';
MSmat='MS.txt';
LS=load(LSmat);
MS=load(MSmat);
ML=load(MLmat);
Adj=[LS,ML';ML,MS];
% Generate known lncRNA-miRNA interaction index
index=zeros(262,3150);
for i=1:262
... |
e6e098f1848a4b06c0901229f68df4203711517ee9ede73109d11f476d357c32 | MATLAB | 2,543 | 75 | function im2spectrogram(inpict,outpath,alteraspect,padbar,volume,blursize)
% IM2SPECTROGRAM(INPICT, OUTPATH, {ALTERASPECT}, {PADBAR}, {VOLUME}, {BLURSIZE})
% use inverse short-time Fourier transform to encode an image in audio spectra
% Output is 44100 Hz 16-bit WAV
%
% INPICT is a 2-D image. If an RGB... |
5c4e810c7a742bba47394f1712dbd18271a5c4024a3b3584b6b25f1511d7b74b | MATLAB | 2,549 | 63 | classdef DistanceDistributionBins
properties
BinWidth (1,1) {mustBeInteger}
BinNumber (1,1) {mustBeInteger}
Bins (:,1) DistributionBinContents
BinQuantityList (:,1) {mustBeInteger}
DistanceMatrixSize (1,2) {mustBeInteger}
end
methods
function obj = DistanceDi... |
290936b0d4d6d0df898a0ab914574cacf1449d343cd513455987e9e704567ea0 | MATLAB | 2,554 | 118 | function f = squaresize(x0,varargin)
% GEOMETRY = SQUARESIZE(N,{OPTIONS})
% Given a vector length N, find a 2D geometry which will allow
% the vector to be reshaped into an approximately-square 2D array,
% provided it is allowed for the vector length to be trimmed/padded.
%
% This can be convenient if you want ... |
b1400e32bf431a57d8c64cb06b9efbd0d0bc01f4cbce68d22fb97d3fbcc1f332 | MATLAB | 2,557 | 100 | function varargout = bwdistFB(inpict)
% DISTMAP=BWDISTFB(INPICT)
% [DISTMAP NEIGHBORMAP]=BWDISTFB(INPICT)
% Euclidean distance transform for binary images. Optional output syntax also provides the nearest-
% neighbor map (i.e. Voronoi diagram).
%
% This is a passthrough to the IPT function bwdist(), with an ... |
99252f00fa7c26ae51c06916fd0ed6f41f39168cfc048d843614813f6669d010 | MATLAB | 2,563 | 66 | classdef testConsistency < matlab.unittest.TestCase
properties (TestParameter)
sigmoidName = {'norm','gumbel','rgumbel','logistic','tdist','Weibull','logn'};
expType = {'2AFC','YesNo','eA'};
end
methods (Test)
function testC(testCase, sigmoidName, expType)
test_consistenc... |
5d5bf65552a45016331daf5b8c48f7c975e451802118a0017b4ef9eb9f77ef51 | MATLAB | 2,564 | 86 | %% Sample entropy–based fitness function
function [ff] = SampleEntropyCost(c, data)
X = data;
alpha = fix(c(1)); % Penalty factor (moderate bandwidth constraint)
K = fix(c(2)); % Number of modes (IMFs) for decomposition
%--------------- Perform VMD decomposition on the input signal --------------
[u, ... |
90908cbbb00858a6f463134c9f61c29e75bf82b6a289da9a344dd4111ea9cefa | MATLAB | 2,564 | 102 | function outpict = permutechannels(inpict,order,mode)
% PERMUTECHANNELS(INPICT, ORDER, MODE)
% permutes the channels of an rgb image
%
% INPICT is an RGB image or 4-D array
% can also be a triplet or colortable (see imtweak())
% white value of INPICT must correspond to its class
% e.g. th... |
2f5f4095000ce17da9169e08173b04a1aced5b7ac730790550aa20425f48cb85 | MATLAB | 2,566 | 58 | %% %%%%%%%%%%%%%%%%%%%%%%%% LOAD DATA %%%%%%%%%%%%%%%%%%%%%%%%
clear all
load('Data.mat'); % Data.mat contains a set of simulated parallel spike trains
% containing 5 cell assemblies of 5 units each embedded in a set of 50
% units. Assembly time scales and activity patterns are described in Russo
% and Durstew... |
c35d491842eb833ee56f5ae20336c29d501476a2deef2d5803db74211f6c5b6b | MATLAB | 2,566 | 70 | %% function to assess whether true Pearson's is statistically significant
function PlaceCell_tbl = GetPlaceCells(all_cell, cellID, Fishers_shuffled, Fishers_true, Pearsons_true, Pearsons, CaMatrix, IsDrifting, thresh, framerate)
IsSignificant = nan(all_cell,4);
IsSignificant(cellID,:) = 0;
%% Calculate %ile... |
e700b6a2ea6d209cf8bd4ef034ceaf51fa92ebc0acce70247e2bc4097ab2b38b | MATLAB | 2,568 | 94 |
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... |
43208884d231bdfc8ca3af6ccb002fda5970f3cc7499d15b4b835a8654367c54 | MATLAB | 2,569 | 61 | function maskdots = mmComputePositions_randmask(wmask, nd, mperiods, mphases, t, mspeed, xcenter, ycenter,invert);
%DC: added input parameter "invert". If invert == 5, 6, switch x and z
%maskdots = mmComputePositions_randmask(wmask, nd, mperiods, mphases, t, mspeed, xcenter, ycenter);
%
%Computes the array of dots t... |
cb39555167624e4c23df9a5072731dd04e0551fd2d278f85cfad2e6ebed52fe4 | MATLAB | 2,569 | 83 | %%
% Draw a histogram the sane way.
% histogram(xEdges, binWeights)
% histogram(xEdges, binWeights, binErrors, ...)
% histogram(xEdges, binWeights, binErrors, 'fill', ...)
% histogram({units,xUnit,yUnit}, ...)
%
function [histo] = histw(varargin)
% Parse input
narginchk(1, inf);
if i... |
09fc2520eecc0ce44ec8e38250162ade782bc265c86a0b28b4c84a1da15ba017 | MATLAB | 2,573 | 63 | function surface_normals = CBIG_ComputeNormalVectorsCaret(mesh, avg_neighbor_bool)
% surface_normals = CBIG_ComputeNormalVectorsCaret(mesh, avg_neighbor_bool)
% This function is used to compute normal vectors for each vertex in mesh.
% surface_normals = 3 x # vertices
% assumes input mesh is a "regular" subdivided ic... |
47d2e14e0da9227066e0e7f9c36261823bbb62f5cdadc97f3fe724ad05c5c7f1 | MATLAB | 2,579 | 93 | %% clear workspace, close figures, and clear command window
clearvars; close all; clc
%% load and process stimulation data
data = readtable('G16stim.csv', 'TextType', 'string');
time = data.Var1; % extract time column
% define time window for stimulation analysis
t.start = 1202;
t.end = 2403;
time_stim = time(t.start... |
39abb0636125fcfe22d051521354b7cdcfbd3ce2a99196ba92df6467a78f5efe | MATLAB | 2,580 | 102 | function B = learn_basis(X, S, l2norm, Binit)
% Learning basis using Lagrange dual (with basis normalization)
%
% This code solves the following problem:
%
% minimize_B 0.5*||X - B*S||^2
% subject to ||B(:,j)||_2 <= l2norm, forall j=1...size(S,1)
%
% The detail of the algorithm is described in the following... |
75b8115a1f587a016b67a164663c12c5136a5558c20e55d155b06a7b2f912db1 | MATLAB | 2,580 | 89 | function y=nt_sns(x,nneighbors,skip,w)
% y=nt_sns(x,nneigbors,skip,w) - sensor noise suppression
%
% y: denoised matrix
%
% x: matrix to denoise
% nneighbors: number of channels to use in projection
% skip: number of closest neighbors to skip (default: 0)
% w : weights (default: all ones)
%
% If w=='auto', ... |
8d91dca029a5e9a3c38e97efecb9295cf6294af47d872530cde5ff8aa4159dcb | MATLAB | 2,588 | 89 | function [gbestfitness,gbestx,cuver]=AE(N,MAXITR,lb,ub,D,Func)
% Algorithm Name: Alpha Evolution Algorithm (AE).
% gbestx: The global best solution ( gbestx = [x1,x2,...,xD]).
% gbestfitness: Record the fitness value of global best individual.
% gbesthistory: Record the history of changes in the global optimal fitn... |
28e2eb0153b20c96b4c0f63d28cd1a986e1216439bff84a2028302a66b0c7c9e | MATLAB | 2,589 | 84 | function outpict = tonemap(inpict,varargin)
% TONEMAP(INPICT, {'PARAMETER', VALUE, ...})
% This is a basic tone-mapping function similar to the standard
% 'tonemap' plugin for GIMP.
%
% INPICT is an I/IA/RGB/RGBA image of any standard image class
%
% Additional parameters can be set via name-value p... |
9ff5e6568d6ca25445b81799e6d7b3f628998587bd58ac452625efd1ebd97c09 | MATLAB | 2,598 | 68 |
%% load experiment info and set a few variables for analysis
clear
% load experiments and generic stuff
experiments = get_experiment_redux;
repeatCalc = 0;
save_data = 1;
% the number of CPU cores to use to load signal. Unless you are doing
% nothing else on your computer, do not use all of them. Otherwise you will
%... |
a23f2d215c293ab83478c09b2a0c99c5cc0da365c3b083aaa300d7fe192c2ce8 | MATLAB | 2,598 | 94 |
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... |
c5026021fa09e63960229f880ca5f322fa7df4e894f4bd1b7a95d0679c3af030 | MATLAB | 2,604 | 61 | %RESTOREDEFAULTPATH Restores the MATLAB search path to installed products.
% RESTOREDEFAULTPATH restores the MATLAB search path to its factory-
% installed state. RESTOREDEFAULTPATH is only intended for situations
% when the search path is corrupted and MATLAB is experiencing problems
% during startup.
%
% RE... |
bdafa934da6b172dcaf91e0e78b75679e31a550bb96e667b2a5391e0abd70f73 | MATLAB | 2,605 | 92 | function [todss,pwr0,pwr1,todssX,dX,d]=nt_dss1(x,w,keep1,keep2)
%[todss,pwr0,pwr1]=nt_dss1(x,w,keep1,keep2) - evoked-biased DSS denoising
%
% todss: denoising matrix
% pwr0: power per component (raw)
% pwr1: power per component (averaged)
% todssX: denoising matrix - crossvalidated
% dX: distance of each trial fro... |
1846378935895d4175d68fe5bc73cec1fff3303559b7a016595ef50154df3371 | MATLAB | 2,608 | 88 | %% function to get maps of fields at different distances
% wrapping function analyze rate overlap
workdir = "D:\Grouping First\M314\Training_Separation_D5\";
load(strcat(workdir,"\processedData\FieldTbl.mat"))
load(strcat(workdir,"\processedData\FieldClustering.mat"))
load(strcat(workdir,"\processedData\Plac... |
67521452348548abc97dac7983162e8c3160a877a4110863e5058162828ba51d | MATLAB | 2,608 | 94 |
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... |
0298b58ce38fa9bb1afc0d0b2ff7f59790b98ab2f573d0882ce6efc51811bb7c | MATLAB | 2,612 | 96 | function matcharray = multimask(inpict,mode,bound,compmode)
% MULTIMASK(INPICT, MODE, COLORS, {COMPMODE})
% returns a 2-D logical map of all pixels in INPICT specified via
% corner colors and using relational and boolean operations.
%
% INPICT is an RGB image of any standard image class
% if INPIC... |
4e1392430a34b17e9d41480232960879af5f20cc29c249299feeab10a51af64d | MATLAB | 2,612 | 104 | %
% res = parpoolOperator(mode, numReqCores, isVerbose)
%
% Description:
% a helper function to operate parpool
%
% Input:
% mode - open, forceopen, reopendiff, close or isopen
% numReqCores - number of requested cores
% isVerbose - whether display verbose message
%
% Output:
% res - for isopen m... |
6ede77f7d0ecc4634bdff3e8df4f787bc533aafaf356c1246bba9787259a5f1e | MATLAB | 2,612 | 92 | function [idx,score_vector,todss]=nt_split_jd(x,thresh,depth);
%[idx,score_vector,todss]=nt_split_dss(x,thresh,depth) - segmentation based on joint diagonalization
%
% idx: index at which to split
% score_vector: from nt_split
% todss: DSS matrix
%
% x: data
% thresh: truncation threshold for PCA
% depth: recursi... |
2f5cd77a5146362f5fcaeb441fd41527407325bb20e767dea1b693a02cae23d5 | MATLAB | 2,620 | 63 | function [interictalPeaks,normalizedSquaredSignal,start,stop] = interictalDetection(OriginalSignal,filteredInterIctalActivity,threshold)
% USAGE
%
% [interictalPeaks,normalizedSquaredSignal,start,stop] = interictalDetection(OriginalSignal,filteredInterIctalActivity,threshold)
%
% Detect the interictal pea... |
7ca7251b23d5ff557d4143d40bdf5641013d5b62143e77e7926b47af53380816 | MATLAB | 2,622 | 56 | restoredefaultpath
if ispc
addpath (genpath('\\l2export\iss02.charpier\analyses\vn_preictal\scripts\EpiCode\shared'))
addpath (genpath('\\l2export\iss02.charpier\analyses\vn_preictal\scripts\EpiCode\external'))
addpath (genpath('\\l2export\iss02.charpier\analyses\vn_preictal\scripts\EpiCode\templates'))
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.