sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
8a3c84fe7df6ca939bba8661ada4c512a2fc4e9f98a2773df1247cd123274eb4 | MATLAB | 674 | 31 | function output = cmi(X,Y,Z)
%function output = cmi(X,Y,Z)
%X, Y & Z can be matrices which are converted into a joint variable
%before computation
%
%expects variables to be column-wise
%
%returns the mutual information between X and Y conditioned on Z, I(X;Y|Z)
if nargin == 3
if (size(X,2)>1)
mergedFirst = MIToo... |
fd6e58b402d0fa0aa15db88597471a06db9848deba52194a0d57ea274e1ec052 | MATLAB | 674 | 15 | function out = getAllEigengroupIdx(inp)
%% GETALLEIGENGROUPIDX Return cell array of the indices making up each eigengroup in input
% input: either (i) number of modes; or (ii) nVerts * nModes matrix (nModes is dimension 2)
% output: cell array of indices making up each group, with the last element
% truncated if the n... |
75ff089fa9c33c0f331e33f3d033781e1d593dc5f72515adf8087828c6dd8ac6 | MATLAB | 676 | 30 | function [n,gains] = plx_adchan_gains(filename)
% plx_adchan_gains(filename): read analog channel gains from .plx or .pl2 file
%
% [n,gains] = plx_adchan_gains(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
%
% OUTPUT:
% gains - array of total gains
% n - number of channels
if nargin ... |
9e02019c13bd49b977eb5835091f11db1b4779fb2da3660987771b1755eef3f3 | MATLAB | 678 | 30 | function MClust
% MClust
%
% This version is packaged and uses object-oriented classes to provide
% safer code.
%
% ADR 1998
%
% Status: PROMOTED (Release version)
% See documentation for copyright (owned by original authors) and warranties (none!).
% This code released as part of MClust 3.5.
% Version control M4.0... |
2b167bb0fb778d6395b766ab93be5fe60808527dffb9ff489b6680a379f1e75a | MATLAB | 680 | 28 | function C=clustering_coef_bu(G)
%CLUSTERING_COEF_BU Clustering coefficient
%
% C = clustering_coef_bu(A);
%
% The clustering coefficient is the fraction of triangles around a node
% (equiv. the fraction of node's neighbors that are neighbors of each other).
%
% Input: A, binary undirected connect... |
f0a9d27ac0b40ca5ac14da54f34e642507af21620c77293d35bd0bf418766997 | MATLAB | 681 | 21 | function [res] = getMeasures(PTE, YTE )
%GETMEASURES Summary of this function goes here
% Detailed explanation goes here
if sum(isnan(PTE))>0
disp('there are some nan value in predictions')
end
if sum(isnan(YTE))>0
disp('there are some nan value in the labels')
end
idx = ... |
7ab454a97b91f737809f2962f832d4d1d56d76600a9fc52ce8be287d0f495e7f | MATLAB | 684 | 30 | function leftoverV = process_varargin_class(self, varargin)
% leftoverV = process_varargin(self, varargin)
%
% INPUTS
% V - varargin cell array
%
% OUTPUTS
% leftoverV - varargins not processed
%
% expects varargin to consist of sequences of 'variable', value
% sets variable to value for each pair.
% c... |
13dd351a2aee66cfda5c16b38a11c48cf747d0dfc40238e117f8d9f7b1cbc74c | MATLAB | 685 | 25 | function [ res ] = ECE( labels, predictions )
% Expected calibration error
% Check
labels(labels==2)=0;
labels(labels==-1)=0;
ordered = sortrows([predictions,labels]);
N = size(ordered,1);
rest = mod(N,10);
S = 0;
B = min(N,10);
for i = 1 : B
if (i <= rest)
group... |
2083301435e572a3759334086f9748e15344bacc847bf0871318a2543b8834db | MATLAB | 685 | 24 | function map = coolhot3(siz)
% Create a colormap that goes in this order:
% Cyan - Blue - White - Red - Yellow
%
% Usage:
% coolhot3(SIZ)
%
% - SIZ = Size of the colorbar. To ensure symmetry,
% an even number is recommended.
%
% _____________________________________
% Anderson M. Winkler
% Yale University / In... |
6fc76cc743913d5a1a69958a859f3b34b604e501811a935fd19f26f91759183c | MATLAB | 687 | 38 | function NEWDIR = popdir(all);
% NEWDIR = popdir
% NEWDIR = popdir 'all'
%
% Pops the top directory off the current stack.
% cds to it.
% ADR 1998
% version L4.1
% status PROMOTED
% allows popdir all now
global DIRSTACK
switch nargin
case 1
if strcmp(all, 'all')
if ~isempty(DIRSTACK)
NEWDIR = DIR... |
d3da33af6ff69ab34715bb29753ce4be0fc4ea4d608fc5392599c8816b7fc6f2 | MATLAB | 692 | 25 | % pnopt_stop
%
% $Revision: 0.8.0 $ $Date: 2012/12/01 $
%
if optim <= optim_tol
flag = FLAG_OPTIM;
message = MESSAGE_OPTIM;
loop = 0;
elseif norm( x - x_old, 'inf' ) / max( 1, norm( x_old, 'inf' ) ) <= xtol
flag = FLAG_XTOL;
message = MESSAGE_XTOL;
loop = ... |
f1080a00c8282c40db6e6e741d110ddf5156eef27e2d65b3d08d69e63c52e976 | MATLAB | 692 | 25 | function map = coolhot7(siz)
% Create a colormap that goes in this order:
% Cyan - Blue - Black - Red - Yellow
%
% Usage:
% coolhot7(SIZ)
%
% - SIZ = Size of the colorbar. To ensure symmetry,
% an even number is recommended.
%
% _____________________________________
% Anderson M. Winkler
% Yale University / In... |
ce2a1e3019583661e0cb96759e3477177a20c2bb10ba6c9c28c89a0edcf9381c | MATLAB | 693 | 20 | function load_selCVoocv(handles)
popupstr{1} = 'Training/CV data';
fnd=false;
if isfield(handles,'OOCVinfo') && isfield(handles.OOCVinfo,'AnalVec') && ismember(handles.curranal, handles.OOCVinfo.AnalVec)
handles.selCVoocv.Enable = 'on';
fI = find(handles.OOCVinfo.AnalVec==handles.curranal); cnt=2;
if hand... |
f9c09ba06695c44cb3cfdcd1c952666a14f87a400b6f15bbac538273d7679468 | MATLAB | 694 | 23 | function [ IO, mess ] = RetrieveImageInfo(IO, datasource, mess)
if ~isfield(IO,'V') || isempty(IO.V); return; end
if ~exist('mess','var'), mess=[]; end
%Extract filenames
if iscell(IO.PP), PP = char(IO.PP); else, PP = IO.PP; end
IO.F = spm_str_manip(PP,'t');
switch datasource
case {'spm','nifti'}
if isfie... |
a923dda315e6c446eaedc172ef9023bcecd37117116659d4fbbd045f1e5844d9 | MATLAB | 695 | 23 | function vol = hollowVol(vol)
% If not counting inner voxels, need to empty out the volume.
% 20151025 CRM
dim = size(vol);
% compare with adjacent voxels to see
% if we are inside a filled region or not
vol_edge = vol;
for i = 1:dim(1); for j = 1:dim(2); for k = 1:dim(3);
if vol(i,j,k) == 1
range_i = [ma... |
c779534cfa730441744c26cb510b2a3a3c908d7a3d48267b28208c2acfa21c00 | MATLAB | 695 | 18 | % =========================================================================
% FORMAT param = NPV(expected, predicted)
% =========================================================================
% Compute Negative Predictive Value of classification: TN / (TN + FN);
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
215b7d49baa944702787618e1dab16f373c4838ce87c3830ae7692395aad0fa6 | MATLAB | 696 | 32 | function [n,gains] = plx_chan_gains(filename)
% plx_chan_gains(filename): read channel gains from .plx or .pl2 file
%
% [gains] = plx_chan_gains(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
%
% OUTPUT:
% gains - array of total gains
% n - number of channels
if nargin ~= 1
error... |
03f3a57a1279b91ee2e395b68e9e057e978a6a7412f644bfda29bb000271d994 | MATLAB | 699 | 26 | % stats %
% 2-way repeated measures anova: for PA, RT, FP, d', and criterion measures
% load 'Reaction Time.mat';
% Y=cat_mask_RT(:);
load 'Performance Accuracy.mat';
%cat_mask_RT = cat_mask_RT(1:end-1,:);
Y=cat_mask(:);
% load 'FP.mat';
% %y = sub_cat_mask_TN;
% Y = sub_cat_mask_FP(:);
% load 'Specifici... |
d96fac9fe8f4af21d636f0a6cb8213dfa5ba68022a0435f6f2b10df1e1904b65 | MATLAB | 699 | 31 | function OK = EraseTfiles(self)
% OK = EraseTfiles(MCD)
% also erases matching WV and CQ files
MCD = self;
MCS = MClust.GetSettings();
nClust = length(MCD.Clusters);
fc = FindFiles([MCD.TTfn '_*.t*'], 'StartingDirectory', MCD.TTdn, 'CheckSubdirs', 0);
fc = cat(1, fc, FindFiles([MCD.TTfn '_*._t*'], 'StartingDirector... |
83db7d422e2f378e6c515b5f4afb3bb3a89d90d53c0c22c1851a7c055a8983da | MATLAB | 702 | 19 | % =========================================================================
% FORMAT param = FPR(expected, predicted)
% =========================================================================
% Compute false positive rate of classification:
% False Positive Rate = 1 - TN / (TN + FP);
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
c1c3fc2fc20cf5a4f6ccd7616b9e71895905dc885eff0842cf3f7dd71bb3e218 | MATLAB | 702 | 32 | function R = nk_CountUniques(Y, PercThresh)
N = isfinite(Y);
U = zeros(size(Y,2),1); UX = cell(size(Y,2),1); UP = cell(size(Y,2),1);
for i=1:size(Y,2),
Yi = Y(N(:,i),i);
UX{i} = unique(Yi);
UN{i}= zeros(size(UX{i}));
UP{i}= zeros(size(UX{i}));
for j=1:numel(UX{i})
UN{i}(j) = sum(Yi==UX{i}... |
076e41714d4e783700b8e0196da821a020078f2cfd69aaee3ed6c58fc8354f3b | MATLAB | 704 | 20 | function f2 = subrange(self,idxs)
% Return a feather that corresponds to a subset/extraction of the
% input feather
if ischar(self.plot_data{idxs(1)})
f2 = bt.feather(self.model,self.fit_data(idxs(1)),fullfile(self.path_prefix,self.plot_data{idxs(1)}),self.time(idxs(1)));
else
f2 = bt.feather(self.model,self.f... |
325911a20c73d6ea1eca05aae3530a1a3c193c6e81780ee2f4e06ec0f4b6f179 | MATLAB | 706 | 35 | function CutterOption_RecolorClusters(self)
% RecolorClusters(self)
%
%
% INPUTS
%
% OUTPUTS
%
% NONE
MCD = MClust.GetData();
nColors = max(100, MCD.maxClusters);
colormaps = {'hsv', 'jet', 'copper', 'bone', 'colorcube'};
[Selection, OK] = listdlg('PromptString', 'Select color map to use', ...
'ListString', colorm... |
33dfb38c0b06600211455036a13a3914f0ca502d167f83f0e1fcd755958bc532 | MATLAB | 706 | 26 | function [nch, npoints, freq, d] = ddt_v(filename)
% ddt_v(filename) Read data from a .ddt file returning samples in mV
%
% [nch, npoints, freq, d] = ddt_v(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
%
% OUTPUT:
% nch - number of channels
% npoints - number of data points for each... |
cb972ee337beee6acf2b3e7a128c2fb49c3119dfddf5dffa6234092dd3dc12e2 | MATLAB | 708 | 22 | function [CritGain, ExamFreq, PercThreshU, PercThreshL, AbsThreshU, AbsThreshL] = EvalSeqOpt(Models)
[ix, jx, nclass] = size(Models);
ExamFreq = cell(ix,jx,nclass);
CritGain = ExamFreq;
PercThreshU = ExamFreq;
PercThreshL = ExamFreq;
AbsThreshU = ExamFreq;
AbsThreshL = ExamFreq;
for h=1:nclass
for k = 1:ix
... |
680b0ec0dc67be0efc59eae920c029f203cabe5e1b46f9b21047cb7ca5ac1429 | MATLAB | 710 | 25 | function [ inp ] = nk_ApplyLabelTransform( PREPROC, MODEFL, inp )
global MULTILABEL
if MULTILABEL.flag
if isfield(MULTILABEL,'sel')
lb=MULTILABEL.sel(inp.curlabel);
else
lb=inp.curlabel;
end
else
lb = 1;
end
[ inp.label, inp.targscale, inp.minLbCV, inp.maxLbCV, ~, inp.PolyFact ] = nk_La... |
b0790f40de7eaf914d310e1ab80c3cf33abfe9d583c87cb0edfa9a9230f407b1 | MATLAB | 710 | 31 | % function to identify WT and HOM genotypes from a list
function out = idGeno(in,varargin)
p = inputParser;
p.addRequired('in',@iscellstr);
p.parse(in,varargin{:});
inputs = p.Results;
out.wt = [];
out.hom = [];
% wt
idx = cellfun(@numel,regexpi(in,'wt')) + cellfun(@numel,regexpi(in,'+'));
idx = find(max(idx) == idx)... |
dda54e1039b5d1b964b2fb965343eb21bb69a3583be271be989ac3580eb59eed | MATLAB | 710 | 22 | function output = joint(X,arities)
%function output = joint(X,arities)
%returns the joint random variable of the matrix X
%assuming the variables are in columns
%
%if passed a vector of the arities then it produces a correct
%joint variable, otherwise it may not include all states
%
%if the joint variable is only compa... |
3c3f8d92933bc9d06ab7b74558481dc9cb52822fe4d427a5f0a368c891413dc4 | MATLAB | 713 | 30 | % Add folders to path.
addpath(pwd);
cd solver/;
addpath(genpath(pwd));
cd ..;
cd auxiliary/;
addpath(genpath(pwd));
cd ..;
cd plotter/;
addpath(genpath(pwd));
cd ..;
cd data/;
addpath(genpath(pwd));
cd ..;
[version, release_date] = nmflibrary_version();
fprintf('#################################################... |
68ef7de71df50e7456affa11267e61ce448419815c689e218ddc14cd844c8f00 | MATLAB | 715 | 19 | % authors: Ioannis Psorakis psorakis@gmail.com, Theodoros Damoulas
% theo@dcs.gla.ac.uk
% Copyright NCR, 2009
%
% Use of this code is subject to the Terms and Conditions of the Research License Agreement,
% agreed to when this code was downloaded, and a copy of which is available at
% http://www.dcs.gla.a... |
c965f4a1319cd9d104720a159d6c74b20f76fa3bc54fae35c0dc58d2ccdacd3d | MATLAB | 715 | 19 | % =========================================================================
% FORMAT param = SENSITIVITY(expected, predicted)
% =========================================================================
% Compute classification specificity:
% Specificity = TP / (TP + FN)
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
6b1caf0092b5139a285ea5efb84d710673d741f96c342656176a0c7c001e6a29 | MATLAB | 717 | 24 | function Redraw(self)
%
% MClustMainWindow: redraw
MCD = MClust.GetData();
MCS = MClust.GetSettings();
set(self.LoadingEnginePulldown, 'String', self.LoadingEngines, 'Value', self.LoadingEngineValue);
self.FeatureListBoxes.SetLeftList(setdiff(MCS.FeaturesAvailable, MCS.FeaturesToUse));
self.FeatureListBoxes.SetRight... |
d2cd2cc917fd0613fa3d831567f2cbb682b1858f42f12c75feed076c20a57cd6 | MATLAB | 717 | 28 | function extras = write_extras(fname,extras)
% Write extra bits of information
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging
%
% $Id: write_extras.m 7147 2017-08-03 14:07:01Z spm $
if ~isstruct(extras) || isempty(fieldname... |
6557a15af9972e4a8c3935f6f43776226d5bd7dcf0f524c2f8d68e5495ba7e4a | MATLAB | 718 | 25 | function output = load_kaggle_data(set_type,set_number)
if nargin == 0
set_type = 'preictal';
set_number = 1;
end
window_length = 30;
fft_length = 4;
fname = sprintf('~/Desktop/psg_data/kaggle/patient_1_%s_%d.mat',set_type,set_number);
fdata = load(fname);
t = (0:(length(f... |
28e105bdad4480684eb02325e12177ef363e7991310bee5a042a35a4751cc26f | MATLAB | 719 | 19 | % =========================================================================
% FORMAT param = SPECIFICITY(expected, predicted)
% =========================================================================
% Compute classification specificity:
% Specificity = TN / (TN + FP)
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
0f3ef675826e74a6e3cb8e12731588f8da5285391217ab44910462b0dd6e93d9 | MATLAB | 720 | 20 | % =========================================================================
% FORMAT param = AUC(expected, predicted)
% =========================================================================
% Compute Area-Under-the-Curve for binary classification problems
% Based on the code of Chih-Jen Lin
% %%%%%%%%%%%%%%%%%%%%%%... |
3b600d1a38a61613269391407b4feb75f0276a7f454b83812947dc0e945f1fb8 | MATLAB | 720 | 26 | function [ res ] = getECE( Y, P )
%RMSE Summary of this function goes here
% Detailed explanation goes here
predictions = P;
labels = Y;
ordered = sortrows([predictions,labels]);
N = size(ordered,1);
rest = mod(N,10);
S = 0;
B = min(N,10);
for i = 1 : B
if (i <= rest)
... |
d8a8029336ee9758414820395451192b777426e9c705a3064d19977f199bd648 | MATLAB | 724 | 36 | %=========================================================
%
%This is a prog in the MutualInfo 0.9 package written by
% Hanchuan Peng.
%
%Disclaimer: The author of program is Hanchuan Peng
% at <penghanchuan@yahoo.com> and <phc@cbmv.jhu.edu>.
%
%The CopyRight is reserved by the author.
%
%Last modification: April... |
92e1ac3bef0567208c1820ea8332fd7c113d95e27542bcb93130f0e53128db26 | MATLAB | 725 | 20 | % =========================================================================
% FORMAT param = CC(expected, predicted)
% =========================================================================
% Compute Correlation Coefficient
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Nikolaos Ko... |
6279a93855e51fc7dc0f292e403568beaad3097294f7b02f7aab46cc9b7d6570 | MATLAB | 727 | 28 | % NDM with Source
%
% Evaluate NDM predictions [y] at desired time stamps.
%
% Input:
% x0 = Initial Condition
% time_stamps = provided in units given by experiment
% C = connectivity matrix
% beta = diffusivity parameter
% alpha1 = linear growth/clearance... |
a0a4c0ac978f83505b3e254ca9e0a48cbc94db73642e0aa31baee7dc607e41fe | MATLAB | 731 | 20 | % =========================================================================
% FORMAT param = PPV(expected, predicted)
% =========================================================================
% Compute false posotive rate of classification:
% Positive Predictive Value = TP / (TP + FP);
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
37792b6dd65a639bf7a3c4d467706dcd4d0d52925035dcfdd751e258a99e1944 | MATLAB | 732 | 25 | clc;clear;close all;
Param_Mercury=cell2mat(struct2cell(load('Parameters_Mercury.mat')));
Param_Jupiter=cell2mat(struct2cell(load('Parameters_Jupiter.mat')));
list_Mercury=cell2mat(struct2cell(load('FinalList_Mercury.mat')));
list_Jupiter=cell2mat(struct2cell(load('FinalList_Jupiter.mat')));
A=Param_Mercury(list... |
9bb239a9f314f1b8a7d6d54d9058a60a49857d911b9fdad618f5ec0b2b982427 | MATLAB | 733 | 26 | classdef reduced_chisqweight < bt.model.reduced
% This model is set up to fit t0 keeping the prior fixed if the alpha peak is not present
% Note that prepare_for_fit must be used before spectrum() can be used
% Uniform priors and DB initial fit
% Note that this does sum over k
properties
end
methods
functio... |
7a5dae0037141699f4342af8734773017e7f9a8f0cc7bdf2f0a71f73b0407b63 | MATLAB | 738 | 28 | function OK = WriteCQfiles(self)
% OK = WriteWVfiles(MCD)
% no longer writing SNR
MCD = self;
MCS = MClust.GetSettings();
nClust = length(MCD.Clusters);
for iC = 1:nClust
tSpikes = MCD.Clusters{iC}.GetSpikes;
if ~isempty(tSpikes)
CluSep.L_Ratio = MCD.Clusters{iC}.CalculateLRatio();
CluSep.Is... |
df46e567e6f88e30a84967a1e47d65212f60ce212116f9cf45d38f00648b648b | MATLAB | 739 | 24 | clear
%% sample fig to show amount of activity pre/post trials
load('ProcessedData\InputParameters.mat');
load('ProcessedData\TrialTraces.mat');
% get z-scored trace data for one trial from one animal
pull = TrialTrace_Table(strcmp('REC286239',TrialTrace_Table.Animal) == true &...
TrialTrace_Table.Day == ... |
6759db9296b1f90b517bfab0a354a6c90b15e53b3c49359c8a1a75748e847996 | MATLAB | 742 | 28 | function h_out = scatter_statecolored(varargin)
% Plot a single quantity using state_str for the colours
f = varargin{1};
varargin = varargin(2:end);
if ishandle(varargin{1})
parent_axis = varargin{1};
varargin = varargin(2:end);
else
parent_axis = gca;
end
if length(varargin) == 3
z = varargin{3};
end
... |
ca0bf76f021dc5eb80454aee8a4cfecb7252ac4a930f51d3c2f2acb6108168ff | MATLAB | 742 | 19 | % 20190921 CRM
addpath('../calcFD')
sample = 'IXI';
subjectpath = sprintf('~/path/to/data/%s/surf/',sample);
subjects = {'.'};
options.alg = 'dilate';
options.countFilled = 1;
options.aparc = 'Dest_aparc';
options.input = 'lobeLat';
options.output = sprintf('c... |
947c284a7b237d46b161220749a63cd9fffeb68d2703611996da352035f7d6d3 | MATLAB | 744 | 36 | function [Dummy, Dummynum, Fu] = nk_MakeDummyVariables(V,vec,mode)
if ~exist('mode','var'), mode = 'stable'; end
[m, n] = size(V);
if m > 1 && n > 1, error('Only vector operations are supported!'); end
if exist('vec','var') && ~isempty(vec)
Fu = vec; nFu = numel(vec);
else
Fu = unique(rmmissing(V),mode); nFu =... |
34f1b44aa30885859d9c3b7669fe1b766e20b6c7b1bd362fdab71108f3631fe3 | MATLAB | 746 | 32 | function output = condh(X,Y)
%function output = condh(X,Y)
%X & Y can be matrices which are converted into a joint variable
%before computation
%
%expects variables to be column-wise
%
%returns the conditional entropy of X given Y, H(X|Y)
if nargin == 2
if (~isa(X,'double') || ~isa(Y,'double'))
error('Error, inp... |
75add67690a02b4f5e56a996108149361ca6a3e56a112cc8d2d164d20f0425c7 | MATLAB | 748 | 32 | function [sig,mixedsig]=demosig();
%
% function [sig,mixedsig]=demosig();
%
% Returns artificially generated test signals, sig, and mixed
% signals, mixedsig. Signals are row vectors of
% matrices. Input mixedsig to FastICA to see how it works.
% @(#)$Id: demosig.m,v 1.2 2003/04/05 14:23:57 jarmo Exp $
%create sourc... |
8b4b8a49161761f842711cb90ad6c4a6bb831bba1d6e67ca2d3ab45f9926f328 | MATLAB | 751 | 32 | function [n, freqs] = plx_adchan_freqs(filename)
% plx_adchan_freq(filename): read the per-channel frequencies for analog channels from a .plx or .pl2 file
%
% [n, freqs] = plx_adchan_freq(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
%
% OUTPUT:
% freqs - array of frequencies
% n -... |
c8acd40eda4dadb03785685bab454e6c529f02a1a8d7b7e1bc13ab82290a8ab0 | MATLAB | 751 | 24 | clear; clc;
path_to_pdollar = '/media/liuyun/data/Code/edges';
path_to_input = '../../data/HED-BSDS/test-fcn';
path_to_output = '../../data/HED-BSDS/test-fcn-nms';
addpath(genpath(path_to_pdollar));
mkdir(path_to_output);
iids = dir(fullfile(path_to_input, '*_fuse.png'));
for i = 1:length(iids)
edge = imread(ful... |
9fd7815a7031015f680bafaabfd0e04d2058c9f4829228093a5dcba88075166b | MATLAB | 752 | 30 | function [P,T,L,r,centerX,cX]=classSVD(x)
%CLASSSVD performs the singular value decomposition of a matrix with more
% rows than columns (uses svd.m)
%
% Required input:
% x : data matrix of size n by p where n>p
%
% This function is part of LIBRA: the Matlab Library for Robust Analysis,
% available at:
% ... |
ef6ebef5857b9085154226fd681e52a3878675518800f9603ba19a4dd56be5d2 | MATLAB | 754 | 23 | % MutualInformation: returns mutual information (in bits) of the 'X' and 'Y'
% by Will Dwinnell
%
% I = MutualInformation(X,Y);
%
% I = calculated mutual information (in bits)
% X = variable(s) to be analyzed (column vector)
% Y = variable to be analyzed (column vector)
%
% Note: Multiple variables may be handled jo... |
a20ed2410458bddae557c30499f5c24a076ece2f146dea675488a14b85e6a39f | MATLAB | 756 | 31 | function ClusterFunc_SplitSpikesByCvxHull(self)
% PreCut Clusters - ClusterFunction_SplitSpikesByConvexHull
%
% Adds ability to Creates a new cluster from those within the convex hull, leaves the rest
MCC = self.getAssociatedCutter();
MCC.StoreUndo('Limit Spikes by Convex hull');
[xg,yg] = DrawPolygonOnAxes(MCC, tr... |
19dd99b5046a8cdc4f1fe1c41a7d30a840bd89635a586949b2c53fe64430928f | MATLAB | 757 | 31 | function ClusterFunc_SplitSpikesByPolygon(self)
% PreCut Clusters - ClusterFunction_SplitSpikesByConvexHull
%
% Adds ability to Creates a new cluster from those within the convex hull, leaves the rest
MCC = self.getAssociatedCutter();
MCC.StoreUndo('Limit Spikes by Convex hull');
[xg,yg] = DrawPolygonOnAxes(MCC, fa... |
8b541b8f6b6ef330ddeefccd1baf914f3d8c7acd3e69604132414b45779a1272 | MATLAB | 760 | 33 | function scores = elmPredict( X, inW, bias, outW )
% FUNCTION predicts the labels of some testing data using a trained Extreme
% Learning Machine.
%
% scores = elmPredict( X, inW, bias, outW );
%
% INPUT :
% X - data patterns (column vectors)
% inW - input weights vector (trained model)
% bias - bias vector (tr... |
14fb7f4f97ef4b9f688ca7b0966d02f0255d047f7663e0f658e78830861663c7 | MATLAB | 761 | 40 | function h = entropy(vec1)
%=========================================================
%
%This is a prog in the MutualInfo 0.9 package written by
% Hanchuan Peng.
%
%Disclaimer: The author of program is Hanchuan Peng
% at <penghanchuan@yahoo.com> and <phc@cbmv.jhu.edu>.
%
%The CopyRight is reserved by the author.
... |
0b714d36e843cb2a96cc1c41998bc1b6ef6d6e45d8ea246f9099c962e8118027 | MATLAB | 763 | 18 | % =========================================================================
% FORMAT param = NETBEN(expected, predicted, pt)
% =========================================================================
% Compute net benefit based on probability threshold
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
23dd5defbeceda9b15d3e932813f5d036f703822bbe0b719557e5befd1990ae9 | MATLAB | 764 | 19 | function init(fname, nbytes, opts)
% Initialise binary file on disk
% FORMAT init(fname, nbytes[, opts])
% fname - filename
% nbytes - data size {bytes}
% opts - optional structure with fields:
% .offset - file offset {bytes} [default: 0]
% .wipe - overwrite exisiting values with 0 [default: false]
% ... |
6c4b2b3471d3fad1b2b774fbe897130bad6c75c202438a28d63ec079b2be51c2 | MATLAB | 764 | 17 | function [res, FusionType] = nk_Fusion_config(res, varind)
if exist('varind','var') && numel(varind) > 1
FusionType = nk_input('Select multimodal fusion strategy',0,'m', ...
['Early fusion -> Modality concatenation BEFORE feature preprocessing|' ...
'Intermediate fusion -> Modality concate... |
9f9e292173ae119c72303cf046083a8b5024b432955d10136766c69f657cfcd7 | MATLAB | 765 | 31 | function [PeakData, PeakNames,PeakPars] = feature_Peak(V, ttChannelValidity, ~)
% MClust
% [PeakData, PeakNames] = feature_Peak(V, ttChannelValidity)
% Calculate peak feature max value for each channel
%
% INPUTS
% V = TT tsd
% ttChannelValidity = nCh x 1 of booleans
%
% OUTPUTS
% Data - nSpikes x nCh peak va... |
65d15ef031ad5637298746bb48b28bdd206f507ec34e7afa324031a20287b6dd | MATLAB | 768 | 19 | function vol = calcFD_volCrop(vol,pad)
% Crop the volume to make the calculations faster.
% Leave padding voxels around the bounding box so countFilled=0 will work
% properly.
% 20151025 CRM
% determine boundaries of voxels that have contents
dim = size(vol);
range_x = find(max(max(vol,[],2),[],3));
range_y = find(max... |
f91d10ee94bd4dfca3dc0f330e08666f7c1d8b1a4ccfd8a5878aee47684bf647 | MATLAB | 768 | 33 | function len = strlen(str)
% len = strlen(str)
% compute the # of characters in str (ignoring 0s at the end)
%
% strlen.m
%
% Original Author: Bruce Fischl
% CVS Revision Info:
% $Author: nicks $
% $Date: 2011/03/02 00:04:13 $
% $Revision: 1.3 $
%
% Copyright © 2011 The General Hospital Corporation (Boston,... |
22e6bd1db2cdd0daaf3b9cddc713c26381c31ee7c30f8c75c652df2744d3a55c | MATLAB | 769 | 23 | % =========================================================================
% FORMAT param = GMEAN(expected, predicted)
% =========================================================================
% Compute GMEAN of classification
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Nikolaos... |
8852568492c6787f410baa012fa7bc09ad4aaa45e7764c57789ea5d83f8a9f2e | MATLAB | 771 | 30 | function [ optparam, optind , optfound, optmodel] = GA(Y, label, Ynew, labelnew, Ps, FullFeat, FullParam, ActStr, N, max_Iter, CR, MR)
global TRAINFUNC VERBOSE
optfound = false;
r = rfe_algo_settings(Y, label, Ynew, labelnew, Ps, FullFeat, FullParam, ActStr);
% Parameter setting
if nargin<3
N = 10;
max... |
72eea2a17d2205dc4bd5d217534c0e65dbe3c2a13d6a4dc4764a9640da259929 | MATLAB | 775 | 28 | function msSaveVideo(ms,frameLimit, downSample, columnCorrect, align, dFF, outFile)
%MSSAVEVIDEO Summary of this function goes here
% Detailed explanation goes here
mindFF = 0.1;
maxdFF = 0.7;
if isempty(frameLimit)
frameLimit = [1 ms.numFrames];
end
writerObj = VideoWriter([outFile ... |
01bbd5e0b3dda7185beb9edd5fae7aac9f0a3d3c664c03d627044bb02fc2a484 | MATLAB | 776 | 30 | function [n, samplecounts] = plx_adchan_samplecounts(filename)
% plx_adchan_samplecounts(filename): read the per-channel sample counts for analog channels from a .plx or .pl2 file
%
% [n, samplecounts] = plx_adchan_samplecounts(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
%
% OUTPUT:
%... |
087eab7f0c3f62e310a8ffac4187d331ae99245a5797bc7d03526e62ef98bbca | MATLAB | 777 | 32 | function [n,thresholds] = plx_chan_thresholds(filename)
% plx_chan_thresholds(filename): read channel thresholds from a .plx or .pl2 file
%
% [n,thresholds] = plx_chan_thresholds(filename)
%
% INPUT:
% filename - if empty string, will use File Open dialog
%
% OUTPUT:
% thresholds - array of tresholds, expressed in ... |
4584073bb4a805ad4a595d0f80e0e6130bb55d015498cb5707d21c4f11edda65 | MATLAB | 777 | 33 | function RedrawClusters(self)
% Redraw clusters within panel
nClustersInPanel = 30;
uicHeight = 1/nClustersInPanel;
panel = self.clusterPanel;
% clear old display
if ~isempty(get(panel, 'children'))
delete(get(panel, 'children'));
end
% clusters to show?
C = self.getClusters();
if length(C) < nClustersInPanel;... |
dff5f993a2c96e75a8004b903956b57f68c5c3cf3aae18a6a9342a521a857d9b | MATLAB | 777 | 27 | function K = WL_with_prior_sparsity_thresholding(Y1, Y2, sp, param1) % in case of test kernel, Y1 should be Ytest
if ~isequal(Y1,Y2)
test = 1;
Y = vertcat(Y1,Y2);
else
test = 0;
Y = Y1;
end
gList = [];
for i = 1:size(Y,1)
% apply sparsity threshold
sp... |
1be4a3bd1a1392e6d5919f83e302fb12d7c53bcdf1e04548b24f0a1c12f01cb9 | MATLAB | 779 | 25 | function K = GraphKernel_matrixInput(Y1, Y2, kernelf, param1) % in case of test kernel, Y1 should be Ytest
if ~isequal(Y1,Y2)
test = 1;
Y = vertcat(Y1,Y2);
else
test = 0;
Y = Y1;
end
gList = [];
for i = 1:size(Y,1)
% apply sparsity threshold
% spArray... |
4093caa04ec9030356fc20291fe2c964611d725de0ed9f6a6ff90af4d01ce85e | MATLAB | 781 | 27 | function [f,df]=hill_obj(x,dims,ii,dd,pars);
%
% computes the objective function and gradient of the non-convex formulation of MVU.
%
% copyright by Kilian Q. Weinberger, 2006
%
%
%
% This file is part of the Matlab Toolbox for Dimensionality Reduction.
% The toolbox can be obtained from http://homepage.tudelft.nl/1... |
1c53956945469c9dc13b87c55c9f9adade02981e91403e7a2416ee81e22e0896 | MATLAB | 782 | 29 | function h = runningFilters(h)
ly = h.iroi{1}(4);
lx = h.iroi{1}(3);
[ys, xs] = ndgrid(1:ly, 1:lx);
ys = abs(ys - mean(ys(:)));
xs = abs(xs - mean(xs(:)));
maskSlope = 8; % slope on taper mask preapplied to image
mY = max(ys(:)) - maskSlope;
mX = max(xs(:)) - maskSlope;
% SD pixels of gaussian smoothin... |
924b9c29a78369a80a3a3f08ba0acb3d96be39c78188f8311c3bc1260526dc80 | MATLAB | 782 | 43 | function [U,S,V] = svdecon(X)
% Input:
% X : m x n matrix
%
% Output:
% X = U*S*V'
%
% Description:
% Does equivalent to svd(X,'econ') but faster
%
% Vipin Vijayan (2014)
%X = bsxfun(@minus,X,mean(X,2));
[m,n] = size(X);
if m <= n
C = X*X';
[U,D] = eig(C);
clear C;
[d,ix] = sort(abs(diag(D)),'de... |
dbdbd7e8d49542e5d9a64ead014b927d539419985185b7802cbf45a34bf4e483 | MATLAB | 783 | 33 | function extras = read_extras(fname)
% Read extra bits of information
%__________________________________________________________________________
% Copyright (C) 2005-2018 Wellcome Trust Centre for Neuroimaging
%
% $Id: read_extras.m 7370 2018-07-09 10:44:51Z guillaume $
extras = struct;
[pth,nam,ext] = fileparts(fn... |
439f5243e1ee5438b022a5b110be6517452dbdca036ceba888d6b2d3a6f516d5 | MATLAB | 788 | 19 | % 20160209 CRM
addpath('../calcFD')
sample = 'IXI';
subjectpath = sprintf('~/path/to/data/%s/surf/',sample);
subjects = {'.'};
options.alg = 'dilate';
options.countFilled = 1;
options.aparc = 'Ribbon';
options.labelfile = 'none' ;
options.output = sprintf('calcFD_... |
6c578fd78188b0b1c0caec8ffe160ee0e23ebbdb99dfef9751aa3ce1bedf8462 | MATLAB | 788 | 15 | function condSequence = carryoverCounterbalance(numConds, cbOrder, reps, omitSelfAdjacencies)
%> @fn carryoverCounterbalance
%> @brief Compatibility wrapper for taskSequence.carryoverCounterbalance.
%>
%> Uses the Brooks/Kandel Euler-circuit method. For academic use cite:
%> Brooks, J.L. (2012). Counterbalancing for se... |
34c0f23589444011b521905aa8f184cf02e91b4e1d3e498398f72f9810807443 | MATLAB | 789 | 35 | function C = dwt_decompose(y, wname, level)
%DWT_DECOMPOSE Wavelet expansion into approximation + detail components.
% C = dwt_decompose(y, wname, level)
%
% Inputs:
% y : 1 x T or T x 1 signal
% wname : wavelet name, e.g. 'sym4'
% level : decomposition level
%
% Output:
% C : K x T component matrix,... |
ea6d2c81912b0e09b79bce9d23237410041dc144ad8ee1d35f2680d30f8f2c87 | MATLAB | 789 | 31 | function [PeakData, PeakNames,PeakPars] = feature_PeakIndex(V, ttChannelValidity, ~)
% MClust
% [PeakData, PeakNames] = feature_PeakIndex(V, ttChannelValidity)
% Calculate location of peak feature max value for each channel
%
% INPUTS
% V = TT tsd
% ttChannelValidity = nCh x 1 of booleans
%
% OUTPUTS
% Data -... |
19b0d361b614e830405770cd99060663dafab9844b107b88b8a8396402b52b83 | MATLAB | 790 | 24 | function [opt_F, opt_hE, opt_E, opt_D, opt_Fcat, opt_mPred] = nk_BuildEnsemble(C, L, EnsStrat, Classes, Groups)
%
% This is the main interface function for building ensembles of predictors
%
% Inputs:
% C = Ensemble of base learners' decisions
% L = Labels
% F = Feature selection mask (base lear... |
93ee4bd918847dda2d9065575a38c0ee897bd06f3cbf238ceced92b8570eeaea | MATLAB | 790 | 22 | function C = clusttriang(A)
% CLUSTTRIANG computes clustering coefficient based on number of triangles
% C = CLUSTTRIANG(A) compute the clustering coefficient C of the
% adjacency matrix A, based on the ratio (number of triangles)/(number of triples).
%
% Notes:
% (1)This is a subtly different definition th... |
9593e92ce01863224af0c9e64d10f86c7be292f9c9ad2fe2f019aa1923de3ebe | MATLAB | 791 | 31 | function voted_label=vote(predicted_labels)
% vote by the majority rule
% predicted_labels: matrix, rows are samples, columns are committee members
% voted_label, column vector
% Contact Information:
% Yifeng Li
% University of Windsor
% li11112c@uwindsor.ca; yifeng.li.cn@gmail.com
% May 26, 2011
[numSample,numCom]=si... |
71d9c2a20aceb74f5665ece8cb7a48dda2bd3d6c563cf260f818a0f6b7575eed | MATLAB | 795 | 40 | % authors: Ioannis Psorakis psorakis@gmail.com, Theodoros Damoulas
% theo@dcs.gla.ac.uk
% Copyright NCR, 2009
%
% Use of this code is subject to the Terms and Conditions of the Research License Agreement,
% agreed to when this code was downloaded, and a copy of which is available at
% http://www.dcs.gla.a... |
11c30c76eec8e0d97dff8fbbf5d7cd37cc541fbfc0f0e8fef2b32db1ff0114d7 | MATLAB | 796 | 23 | function [hEPerf, hE, hSim] = nk_MultiEnsPerf(E, sE, L, C, G)
% E : Prediction scores
% sE : Sign(E)
% L : Labels
% C : Classifiers
global MULTI RAND
hSim = []; ProbComp=[];
if isfield(MULTI,'ProbComp'), ProbComp=MULTI.ProbComp; end
switch MULTI.method
case 1 % Simple One-Vs-One / One-vs-All
[hE, h... |
3d24621ea89210a2b40d6b1867a11b4c96eae383d7e59c1c8a453e4dee721862 | MATLAB | 796 | 31 | function [ValleyData, ValleyNames,ValleyPars] = feature_Valley(V, ttChannelValidity, ~)
% MClust
% [ValleyData, ValleyNames] = feature_Valley(V, ttChannelValidity)
% Calculate Valley feature max value for each channel
%
% INPUTS
% V = TT tsd
% ttChannelValidity = nCh x 1 of booleans
%
% OUTPUTS
% Data - nSpik... |
97ddd2d468438ac7c97ed2e0e7a0e82641636d03d387e08e79d195fbbb64a89f | MATLAB | 797 | 21 | % Load the real training data and labels
load('real_data.mat');
% Set the number of synthetic observations to generate
numSyntheticObservations = 1000;
% Perform principal component analysis on the real data
[coeff, score, latent] = pca(realData);
% Generate synthetic data and labels by sampling random values from a... |
259dd9519bbf6583f588440e8bc815d2de6847070bef8c1c2fb71ed37b3c7e69 | MATLAB | 798 | 29 | function CreateSpcCutterWindow(self)
% KKwikCutter.CreateCutterWindow
MCS = MClust.GetSettings();
MCD = MClust.GetData();
self.CreateCutterWindow@MClust.Cutter(); % call superclass to build initial window
%--------------------------------
% constants to make everything identical
uicHeight = self.uicHeight;
uicWidt... |
f8bad914fa8829907c01f71c253ad9ffef989b3069c5265a897eddf5cadce7e6 | MATLAB | 800 | 40 | function xls2txt(in,varargin)
p = inputParser;
p.addRequired('in',@(x) exist(x,'file'));
p.addParameter('delimiter','\t');
p.addParameter('out','',@ischar);
p.parse(in,varargin{:});
inputs = p.Results;
% load input
[~,~,txt] = xlsread(in);
% setup output
[fpath,fname] = fileparts(in);
if isempty(inputs.out)
inputs... |
0de5404d1c5d24d67224898ec772357cf603e3317b35445ce8060a8fb04ca28f | MATLAB | 801 | 25 | function [ Intensity ] = mp2rage_lookuptable( paramters, T1vector, B1vector )
%MP2RAGE_LOOKUPTABLE function will use mp2rage_solve_bloch to build the
%lookuptable between signal Intensity and the T1.
%
% This function is almost a copy-paste of https://github.com/JosePMarques/MP2RAGE-related-scripts/blob/master/func/MP2... |
8e375fdc13f7328db8cef12f0bfc14ad5fce0c79e4cffe2aeeb7cbcbbfedbe8a | MATLAB | 802 | 28 | function fdata = load_br_data(subject_id,electrode)
if nargin < 2 || isempty(electrode)
electrode = {'Cz'};
elseif ischar(electrode)
electrode = {electrode};
end
if nargin < 1 || isempty(subject_id)
subject_id = '10002687';
end
if strcmp(subject_id,'demo')
fdata = load('./braintrak/demo_spatial.mat');
... |
5b365c3928978911362352ccd15266c5205e6eae5429ff5f4366c7793226b02f | MATLAB | 804 | 24 | function [sY, IN] = cv_perfROImeans(Y, IN)%, PREPROC, prevP)
% =========================================================================
% =========================== WRAPPER FUNCTION ============================
if ~exist('IN','var'), IN = []; end
if iscell(Y)
sY = cell(1,numel(Y));
for i=1... |
fbabe4c1d500d83db732c3b64484a2743af92b69722200788c355fd677539ff8 | MATLAB | 806 | 28 | function CopyHulls(self, C0)
% Copy Convex hulls from C0 to self. Replace with current features using
% matched names.
MCD = MClust.GetData;
self.featuresX = {};
self.featuresY = {};
self.xg = {};
self.yg = {};
nL = length(C0.featuresX);
featureNames = cellfun(@(F) F.name, MCD.Features, 'UniformOutput', false);
... |
d2a0329c6d86bbbc978b8771caad5f5853b67823366bd703d3f2796c5d41b28d | MATLAB | 807 | 22 | % This make.m is for MATLAB and OCTAVE under Windows, Mac, and Unix
%try
Type = ver;
% This part is for OCTAVE
if(strcmp(Type(1).Name, 'Octave') == 1)
mex libsvmread312.c
mex libsvmwrite312.c
mex svmtrain312.c ../svm.cpp svm_model_matlab.c
mex svmpredict312.c ../svm.cpp svm_model_matlab.c
% This part is fo... |
5a32d462091ae820cfdf3d353c3baf6297dd007ba439ade28078e1972f843bbd | MATLAB | 808 | 41 | function I=mi(A,B,varargin)
%MI Determines the mutual information of two images or signals
%
% I=mi(A,B) Mutual information of A and B, using 256 bins for
% histograms
% I=mi(A,B,L) Mutual information of A and B, using L bins for histograms
%
% Assumption: 0*log(0)=0
%
% See also ENTROPY.
% jfd, 15-11-2... |
fa1dab668e19dbedd491a9634700437a939589cfc976fc1eb0b83b18d948d782 | MATLAB | 809 | 34 | function n=hist2(A,B,L)
%HIST2 Calculates the joint histogram of two images or signals
%
% n=hist2(A,B,L) is the joint histogram of matrices A and B, using L
% bins for each matrix.
%
% See also MI, HIST.
% jfd, 15-11-2006, working
% 27-11-2006, memory usage reduced (sub2ind)
% 22-10-2008, added... |
16673d2c4c1f2a030dddeb7aee1c575883cf9e6de7137c0a0b9831070c12d38c | MATLAB | 810 | 26 | % Objective function for NDM with Source with Microglia (NDMwSwM)
%
% param(1) = beta
% param(2) = x0_value
% param(3) = alpha1 = linear growth/clearance term in x
% param(4) = alpha2 = microglia reweighting for alpha1
function [f] = objfun_NDMwSwM(param,seed_location,pathology,time_stamps,C,u)
% Define Laplacian m... |
ba3cf74f3409af61e5d0b35499fe9948bf91bed74fd0e98666c8a7ffc7a47b61 | MATLAB | 810 | 34 | function checkProperLossCalibration()
N = 1e6;
d = 3;
x = (1/sqrt(d))*rand(N, d);
%wTrue = rand(d,1);
%eta = 1./(1 + exp(-x * wTrue));
eta = sqrt(sum(x - x.^2, 2));
y = (rand(N,1) < eta);
yhat = [];
MODELS = {'linear' 'logistic'};
for model = MODELS
model = mode... |
a035f55184d8c52208351fd47533b1e4b8904ecffb452e984ef0db6b09f46d38 | MATLAB | 812 | 25 | function [NM,MLI] = make_default_MLI_struct(defaultfl, NM, nAnalysis)
% might be useful for older NM analyses; as the function adds it at the
% right location; perhaps we can somehow integrate it in the interface of
% NM too
if ~exist('defaultfl','var') || isempty(defaultfl) || defaultfl
MLI.method = 'medianflip'... |
8b5f1cca095ac56a62009d86a2661a5f891b71b880eec64168094b00e927b3f4 | MATLAB | 813 | 27 | function [errCode] = ddt_write_v(filename, nch, npoints, freq, d)
% ddt_write_v(filename, nch, npoints, freq, d) Write data to a .ddt file
%
% [errCode] = ddt_write_v(filename, nch, npoints, freq, d)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% nch - number of channels
% npoints - numbe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.