sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ef2c65983caec48f37119e59bcdc8da8d5bb0074149303f11eb785ee2fbdc14c | MATLAB | 1,941 | 64 | function varargout = ft_info(varargin)
% FT_INFO prints an info message on screen, depending on the verbosity
% settings of the calling high-level FieldTrip function.
%
% Use as
% ft_info(...)
% with arguments similar to fprintf, or
% ft_info(msgId, ...)
% with arguments similar to warning.
%
% You can switch of ... |
e8bed8eb7b73db7b02796c93731b0fa87a10d66638f993c319a831981c6bcb87 | MATLAB | 1,943 | 60 | function write_stl(filename, pnt, tri, nrm)
% WRITE_STL writes a triangulation to an ascii *.stl file, which is a file
% format native to the stereolithography CAD software created by 3D Systems.
%
% Use as
% write_stl(filename, pnt, tri, nrm)
% where nrm refers to the triangle normals.
%
% See also READ_STL
% Co... |
1251c2e2999df64b04e10f7d6ac6ed625734d6c153166e54bca929e2769313e2 | MATLAB | 1,944 | 81 | function varargout=loadbnm(fname)
% a compact binary matrix format.
%
% [M1,M2,M3,...]=loadbnm(fname);
%
% see savebnm
%
% Aslak Grinsted April 2004
% -------------------------------------------------------------------------
% Copyright (C) 2002-2004, Aslak Grinsted
% This software may be used, copied, or redistr... |
ed4ad222ef20d868c92b3eda009d6ef46dd618ead783d859ec6b3fb9b700dd73 | MATLAB | 1,944 | 43 | MovieName=' Raw vs Current Corrected First Images Record.avi'
TempDir='/Users/newmanza/Desktop/Temp Files/';
mkdir(TempDir)
clearvars -except NumSequences FramesPerSequence ParentDir TemplateDir Recording currentFolder dc TempDir MovieName
for RecordingNum=1:size(Recording,2)
cd([Recording(RecordingNum).dir]);
... |
67309f6c00a7eaf9c051d1d96d72f7a6b44d67cca2a7d6e876a82367e9204def | MATLAB | 1,946 | 65 | function ErrHist(cleanDat, varargin)
clustList = arrayfun(@(x) x.id, cleanDat);
clustListIn = clustList;
errRange = [0 3];
for i = 1:2:length(varargin)
switch lower(varargin{i})
case 'clust'
clustListIn = varargin{i+1};
case 'range'
errRange = varargin{i+1};
otherwi... |
ca195bd4c411a5226fcd13187c808ca5edccea244af68fe868ed735df75240c2 | MATLAB | 1,946 | 61 | function [model] = mrf2MkLatticeXrgb(Xrgb, y, method, methodArgs)
% Make a 2d lattice MRF suitable for denoising a particular image
% Based on http://www.cs.ubc.ca/~schmidtm/Software/UGM/alphaBeta.html
% This file is from pmtk3.googlecode.com
% y(i,j) in {1,2,3,4} is the true label
% Xrgb(i,j,:) is the noisy rgb ve... |
4f399df8b7862e9cf4ef3329b98940275d58b509941e6be23b6e44fa108068a0 | MATLAB | 1,947 | 52 | function rez = remove_spikes(rez,remove_idx,label,varargin)
if ~islogical(remove_idx)
error('remove_idx must be logical.');
end
if ~any(remove_idx)
return
end
fprintf('Removing %g spikes below cutoff from rez.\n',sum(remove_idx));
if ~isfield(rez,'removed')
[r... |
b04a72291dc445a95bef5de29198180ec66f124d20b4e775f8659ec659c57bea | MATLAB | 1,947 | 56 | resultsPath = 'E:\GAD67 results\Recordings\';
conditionType = 'belt';
conditionValue = 'uncued';
clear corr_pyr_int Raceprob
[Racesum,NRace] = extract_variables ('SCE',[],resultsPath, 'Racesum','NRace',conditionType,conditionValue);
%[Racesum] = extract_variables ('SCE',[],resultsPath, 'Racesum',[],conditionType,cond... |
04179f6dec802442a4f880e0ff19b3e48f74bd974dfc02899b7f30abed3d8f03 | MATLAB | 1,948 | 88 | function gibbsGauss2dDemo()
% Use Gibbs sampling to sample from a 2D Gaussian
% see also mcmcMvn2d
% This file is from pmtk3.googlecode.com
S = 5000;
mu = [1 1];
C = [2 1; 1 1];
model = gaussCreate(mu, C);
setSeed(1);
xinit = 20*rand(2,1); % initial state
samples = gibbsGauss(model, xinit, S);
burnin = 1000;
samples... |
7a6f793062ed3e5eb1219dbac4e58499188b44f257e0d50c7742278ec2a28c3b | MATLAB | 1,948 | 54 | function qvec = gen_sources(mesh)
% GEN_SOURCES Calculates FEM sources vector for those active in mesh.link.
%
% [QVEC] = GEN_SOURCES(MESH) MESH is NIRFAST mesh structure.
% QVEC is a sparse, complex matrix of size N by M of initial photon
% fluence rate at N nodes for M sources. Spatially integrated photon
% fl... |
e453428fbc64daf978a6ac2f18ac41070d4299e53fd67f30884be8b4220bf69b | MATLAB | 1,948 | 67 | %% Smooth support vector machine regression
% PMTKauthor Mark Schmidt
% PMTKurl http://people.cs.ubc.ca/~schmidtm/Software/minFunc/minFunc.html#11
%%
% This file is from pmtk3.googlecode.com
nVars = 1;
nInstances = 50;
setSeed(0);
[X,y] = makeData('regressionNonlinear',nInstances,nVars);
X = [ones(nInstances,1) X];
... |
137ed598cfe1989eb1c907aeb9972babbee24a6a283956d7e2da40ccd53821c9 | MATLAB | 1,949 | 63 | function loc = subdims(subd, t)
%SUBDIMS Compute the locations of subscripts within a subdimension.
%
% LOC = SUBDIMS(SUBD,T) finds the locations of the subscripts in T
% that are within the range specified by the cell array SUBD. For
% example, if SUBD = {1, [1,2], [1,2]}, then the locations of
% all elements of T... |
4bfc3a2a4a7422673228afd365a1d3117a2a9b4e5a025fd1de6274f79d8bacb8 | MATLAB | 1,949 | 49 | function [array] = interpolatePos(array, interDistThreshold)
% The script will linearly interpolate the flies' position between points
% as long as the fly doesn't move that much (interDistThreshold) between
% frames.
%iterate through datapoints for all four position columns
interpolationNumber = 0;
for dim = 2:2:siz... |
ee02734f39e74fe8ed235531e312f74efe7b5dc404f7d66ea039955d813036ba | MATLAB | 1,949 | 55 | function [H] = translate(f)
% TRANSLATE returns the homogenous coordinate transformation matrix
% corresponding to a translation along the x, y and z-axis
%
% Use as
% [H] = translate(T)
% where
% T [tx, ty, tz] translation along each of the axes
% H corresponding homogenous transformation matrix
% Copyrigh... |
37f41cfff2314282029ac21c3701c4c3171824ee934380f9ba026f97bc2b2b43 | MATLAB | 1,950 | 67 | function model = svmQPregFit(X, y, C, kernelParam, kernelFn, e)
% Support vector regression
% One norm epsilon insensitive loss funciton
% PMTKneedsOptimToolbox
% PMTKauthor Steve Gunn
% PMTKurl http://www.isis.ecs.soton.ac.uk/resources/svminfo/
% PMTKmodified Kevin Murphy
% This file is from pmtk3.googlecode.com
if... |
a566a5e8dfa53321f7429eba6eaf00711e2a3a3566232f3b158c712fd349244c | MATLAB | 1,950 | 61 | %% Apply L2 Logistic Regression to the XOR problem
% We show how RBF, and polynomial expansions of the features 'solve' it,
% while using raw features does not.
%%
% This file is from pmtk3.googlecode.com
function logregXorDemo()
[X, y] = createXORdata();
lambda = 1e-2;
%% Linear Features
if 1
model = logregFit(X, y,... |
d282844a787391653ae4350242bf8793d0a4b2b791965215eb8ac1fc89361baa | MATLAB | 1,950 | 50 | % RegisterStackWithDFT
% Sarah West
% 8/26/21
% Runs registration within stacks and across stacks within the same day to
% a representative image of that day. Uses dftregistration function.
function [all_tforms]=RegisterStackWithDFT(reference_image, stack_to_register, usfac)
% Inputs:
% reference_image -- ... |
eba13ee31e0ed71d9c91ee59bba6851dc82631421fa35efd0e5f8b81c59b4ee4 | MATLAB | 1,950 | 103 | function [ newdata trialmap ] = ...
wlStats_makePhaseSurrogateFT( olddata, replicount )
% function [ newdata trialmap ] = ...
% wlStats_makePhaseSurrogateFT( olddata, replicount )
%
% This generates a phase-scrambled surrogate of a Field Trip dataset.
%
% "olddata" is a Field Trip dataset to scramble.
% "replicoun... |
9e7d2c52559ab8b890ed86495fdaa1d8eefbfa6d6cbad12347d4150997ae26b1 | MATLAB | 1,951 | 60 | function debugVideo(binaryLabelArray, outputVideoName, framerate)
% This function creates a video from an array of regions created by the
% bwlabel command. The first two dimensions are the image itself, and the
% third is the series of images (if that makes sense).
% generate colors
maximum = max(binaryLabelArray(:)... |
d3a53c10098d28c34b1e24a577719cecc88cde5b14f7136b77bb9b3c1e5558ce | MATLAB | 1,951 | 50 | function [ContrastedImageColor]=...
Stack_Viewer_Adjust_Contrast_and_Color(InputImage,cMap_Contrasted,ContrastLow,ContrastHigh,ValueAdjust,ColorScalar)
if any(isnan(InputImage(:)))
InputImage(isnan(InputImage))=min(InputImage(:));
end
ContrastedImage=single(round((InputImage+ValueAdjust)*... |
6a35bf2c30214f2699a8ce7c9ff4f693f6be0154b351e78a365983f6e4f3e7ea | MATLAB | 1,952 | 71 | function data = PlotTrodeData(trodeFile, timeWin, varargin)
fig = [];
titleBase = '';
returnData = false;
makePlot = true;
dataType = 'int16';
hsdInfo = dir(trodeFile);
hsdHeader = getHsdHeader_ver4( trodeFile );
Fs = hsdHeader.sampling_rate;
dataOffset = hsdHeader.dataOffset;
numWires = hsdHeader.num_c... |
15c50d4bf137dfe8b2f50383e0fdae1c023636c1448d1cb010d4a358eddec6fe | MATLAB | 1,953 | 48 | function [rfunc_file,meanfunc_file,rp_file] = realignment_4d(func_files,out_path)
% Expand func filenames. A single 4D Nifti file is expected per run. An
% SPM-style list of volumes is returned.
func_vols=[];
for i=1:length(func_files)
[func_p,func_n,func_e] = fileparts(char(func_files{i}));
func_vols{i} =... |
24bee450432275596b6abbf4161de028147d856604de9e93deed23ec5b3008fe | MATLAB | 1,954 | 64 | function varargout = ft_debug(varargin)
% FT_DEBUG prints a debug message on screen, depending on the verbosity
% settings of the calling high-level FieldTrip function.
%
% Use as
% ft_debug(...)
% with arguments similar to fprintf, or
% ft_debug(msgId, ...)
% with arguments similar to warning.
%
% You can switch... |
59ceba21ac236fb996c971c24dd9eb71f0895f05f0bc8440b5fd2efa31a8a4cd | MATLAB | 1,954 | 83 | function CBIG_MFMem_rfMRI_run_1000_simulation_testGrp_resLow(save_dir_input)
%--------------------------------------------------------------------------
% CBIG_MFMem_rfMRI_run_1000_simulation_testGrp_resLow
%
% Input parameters:
% save_dir_input: Output file directory
%
% This function will run 1000 simluations ... |
ab1256c35f47912f5392a13a4203ec9b09c6bac2624d020e5f2cb3c845193b6a | MATLAB | 1,954 | 74 | function [frames, numFrames] = h5readframes(filepath, dataset, idx)
%H5READFRAMES Reads video frames from an HDF5 file.
% Usage:
% frames = h5readframes(filepath)
% frames = h5readframes(filepath, idx)
% frames = h5readframes(filepath, dataset)
% frames = h5readframes(filepath, dataset, idx)
% [frames, numFra... |
26c98c287001a0f8b6dca34cedfee881ace1a99bf1bea63f5325746c35b9a382 | MATLAB | 1,955 | 92 | function E = read_buffer_offline_events(eventfile, hdr)
% function E = read_buffer_offline_events(eventfile, header)
%
% This function reads FCDC buffer-type events from a binary file.
% (C) 2010 S. Klanke
type = {
'char'
'uint8'
'uint16'
'uint32'
'uint64'
'int8'
'int16'
'int32'
'int64'
'single'
... |
587c1799e3c5277bc7817963550395aef1296eddae5300a523be80c9a750c217 | MATLAB | 1,955 | 64 | function varargout = ft_debug(varargin)
% FT_DEBUG prints a debug message on screen, depending on the verbosity
% settings of the calling high-level FieldTrip function.
%
% Use as
% ft_debug(...)
% with arguments similar to fprintf, or
% ft_debug(msgId, ...)
% with arguments similar to warning.
%
% You can switch... |
510a926b7a78b7e70dc449bc9a9b6bf3589bae03170df8fccc3c13f0daf3c576 | MATLAB | 1,956 | 50 | function saveFloatTiff(im, filename)
% SAVEFLOATTIFF Save a floating point matrix to 32 bit tiff
% imwrite doesn't do this for some reason
% we convert to single in the process
%
% saveFloatTiff(im, filename)
%
% im: Image
% filename: Name of file
%----------------------------------... |
8785310c982b03694caf639eac5a967537d9e2ed2e96138d5c6b28c39da899ee | MATLAB | 1,956 | 62 | function [Rnodes,Lnodes]=Adjust_Brain_Pos_for_Vis(meshL,meshR,params,side,ctx)
%
% This function takes as inputs the meshes for the 2 hemispheres, along
% with the inflation and perspective information for plotting.
% The function positions the meshes for ideal visualizations.
%% Parameters and Initialization
i... |
bdc6f2703d5aea800548c57b1d1027673bef402599b629d68444ebb43a01ad8e | MATLAB | 1,956 | 77 | %% Illustration of Jensen's inequality
%
% This file is from pmtk3.googlecode.com
figure;
hold all;
domain = -2:0.01:5.5;
f = @(x)(x-1).^2;
plot([-1,4],[f(-1),f(4)],'-b','LineWidth',3);
plot(domain,f(domain),'-r','LineWidth',4);
plot([-1,-1],[-10,f(-1)],'--g','LineWidth',2);
plot([4,4],[-10,f(4)],'--g','LineWidth',2... |
d3bb8818f901cb873e5d07f76a91f1025d711b2a89a3f608c251d267d8c11ed3 | MATLAB | 1,956 | 67 | function write_neuralynx_nts(filename, nts)
% WRITE_NEURALYNX_NTS writes spike timestamps to a NTS file
%
% Use as
% write_neuralynx_nts(filename, nts)
%
% See also READ_NEURALYNX_NTS
% Copyright (C) 2007, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentat... |
5e1827085971ddf868900005ffa615b97b0caa0f4de669b9b4deb62366837a2f | MATLAB | 1,957 | 60 | function saveFigure(fh, figNames, figFormat, closeFig, figArgs, printFigResolution)
if (nargin < 4) || isempty(closeFig)
closeFig = true;
end
if (nargin < 5) || isempty(figArgs)
figArgs = {};
end
if (nargin < 6) || isempty(printFigResolution)
printFigResolution = false;
e... |
8bec9da039777e3962b02b247886bb37f7c5fb92be773e69182ff6a947068efc | MATLAB | 1,958 | 96 | %% All subsets regression
%
%%
% This file is from pmtk3.googlecode.com
setSeed(0);
%N = 20;
N = 10;
D = 10;
w = randn(D,1);
ndx = randperm(D);
w(ndx(1:5))=0;
keep = find(w ~= 0);
%X = randn(N,D);
Sigma = randpd(D);
mu = randn(D,1);
model = struct('mu', mu, 'Sigma', Sigma);
X = gaussSample(model, N);
sigma = 1;
y = ... |
068049e4e8bb54168cc44563c5edb4a690ab53c54be6f8b29446584a73711b04 | MATLAB | 1,959 | 64 | function varargout = ft_notice(varargin)
% FT_NOTICE prints a notice message on screen, depending on the verbosity
% settings of the calling high-level FieldTrip function.
%
% Use as
% ft_notice(...)
% with arguments similar to fprintf, or
% ft_notice(msgId, ...)
% with arguments similar to warning.
%
% You can s... |
4d297f4d6954d42940bd1d4fe1dccff9a772425ca2078003e20f95bf432b1740 | MATLAB | 1,959 | 76 | function [fx, dF_dX] = f_SHC (Xt, ~, ~, inF)
% stable heteroclinic channels evolution function
deltat = inF.deltat;
x = Xt;
if ~ isfield (inF, 'K')
inF.K = [1/2; 1/32];
end
if ~ isfield (inF, 'lambda')
inF.lambda = 0.3;
end
if ~ isfield (inF, 'G0')
inF.G0 = 50;
end
if ~ isfield (inF, 'beta')
inF.beta... |
64aa078cb4a5d998691af69d0dd5592fdcf162b5dd228d65a86c59712a48ab54 | MATLAB | 1,959 | 64 | function [xgp,wt] = generalized_phase_vector( x, Fs, lp )
%
% GENERALIZED PHASE VECTOR calculate the generalized phase of input vector
%
% INPUT:
% x - data column vector (t,1)
% Fs - sampling rate (Hz)
% lp - low-frequency data cutoff (Hz)
%
% OUTPUT:
% xgp - output datacube
% wt - instantaneous frequency estimate
... |
b1b00b891c815656fde60eca11580388e531eed0db75fd54587778f976b0e61e | MATLAB | 1,959 | 75 | function out = nearestInterp(imgw, map, maxhw )
% Description:
% Fill holes using nearest neighbor (median filter of neighbors) interpolation
%
% Inputs:
% imgw - input image
% map - Map of the canvas with 0 indicating holes and 1 indicating pixel
% maxhw - Max radius for nearest neighbor interpolation
%
% Out... |
c4d0737d10060bb60993c8cc61d4c0b61b465296c429b006797a81a5bc46cfb4 | MATLAB | 1,959 | 62 | function fg2 = factorGraphMakePairwise(fg)
%% Convert a factorGraph to an equivalent one with only pairwise edge pots
%
%
%%
% This file is from pmtk3.googlecode.com
if fg.isPairwise
fg2 = fg;
return;
end
nstates = fg.nstates;
%% construct megaNodes for each multiway factor
initFactors = colvec(fg.factors)... |
1021980443775431c646ed2e80ba203908b0141ce080768a10cac3db7023f3c3 | MATLAB | 1,960 | 53 | function [col1, col2, col3, col4] = read_neuromag_eve(filename)
% READ_NEUROMAG_EVE imports events from the *.eve marker file that can accompany a
% *.fif dataset.
%
% Use as
% [smp, tim, val3, val4] = read_neuromag_eve(filename)
%
% Column one is the sample number. Column two is the time. Column three is is most
% c... |
4723a2d45082b8b0184143a66f09e68db7d81210ad425b2059ece222aca74a20 | MATLAB | 1,960 | 67 | %% Time various pca methods w.r.t. n and d
%
%%
% This file is from pmtk3.googlecode.com
setSeed(0);
%Ns = 1*[10 50 100];
%Ds = [10 50 100];
Ns = 20:20:100;
Ds = 20:20:100;
K = 5;
nNs = length(Ns);
nDs = length(Ds);
ntrials = 10;
%methodNames = {'eig(X''X) d^3', 'eig(X X'') n^3', 'SVD(X) n d min(n,d)'};
methodNames =... |
c2594ced8a0b8e35591b93b5c3ddb0761fd0eb5fedd550f72ffcf431d99b2142 | MATLAB | 1,960 | 78 | function varargout = centerOfMass(A,varargin)
% CENTEROFMASS finds the center of mass of the N-dimensional input array
%
% CENTEROFMASS(A) finds the gray-level-weighted center of mass of the
% N-dimensional numerical array A. A must be real and finite. A warning
% is issued if A contains any negative values.... |
0659c3e0ca0eeaf3514491a272a5a6cd7f6bac29254150efa51da1dc078a77f9 | MATLAB | 1,961 | 69 | addpath('../generic/');
addpath('../analysis_reclassif/');
%%
n_datasets = 8;
auc_thres = 0.6;
fields = {'DinRFc','DinRFi','unitIdxLIP_Tin','unitIdxLIP_Tout'};
inside = {'minCells','minCells','',''};
for i=1:length(fields)
latency.(fields{i}) = [];
end
files = dir(fullfile(saveLoc_latency, 'data', '/*.mat'));
f... |
3fa59f1dd39fd9e5477ac7fa65062ede6a0ef451832092477b50095f1c87e423 | MATLAB | 1,961 | 83 | function CBIG_MFMem_rfMRI_run_1000_simulation_testGrp_resHigh(save_dir_input)
%--------------------------------------------------------------------------
% CBIG_MFMem_rfMRI_run_1000_simulation_testGrp_resHigh
%
% Input parameters:
% save_dir_input: Output file directory
%
% This function will run 1000 simluatio... |
36752773b655eeb4b01a0ffd34e0240f7c56f3ba9fac98424367c593ce5ee6c9 | MATLAB | 1,962 | 64 | function out = argout(n, fn, varargin)
% Given a function handle and its inputs, return its nth output
%
%% Inputs
% n - the number of the desired output argument, e.g. 2
% fn - a function handle or a string naming a valid function, e.g.
% @max or 'max'
% varargin - all additional args are pass... |
f271fe74728bcac5c42a3c4314f2d0294c4bf02c406782c9a0e11806c75a41f5 | MATLAB | 1,962 | 51 | function M = GetSurrogateRandomMatrix(A, mu, sigma, rescaleWeights)
% generates new weights based on the weight distribution of adjacency matrix A
% considering that A has Gaussian distributed weights
%
% 1) fits a Gaussian function to the distribution of weights P(A_ij) to estimate mean and std
% 2) generates numel(A~... |
97ffcd47828b0681b9dd42bfb1b348e1dbf674a371a732329aafa3610a29af93 | MATLAB | 1,963 | 55 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script breaks the BIOPAC full session into the number of runs/tasks%
% that it has. For example, if there have been two runs in one scanner %
% session. %
% ... |
0d3e4414a03c2a3b5b10e78f103c0db3aea3d13d272c5eb57aa442741f5d6e9e | MATLAB | 1,964 | 38 | % SOFA API - demo script
% Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences
% Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License")
% You may not use this work except in compliance with the ... |
31fc3db2ba6b85d8f353571911c3b68721d1be144460b9a88841ab740a436f70 | MATLAB | 1,964 | 39 | function [eventStartStop, eventPeakLocation, eventAmp, eventWidth] = fp_detect(Y, dt, minHeight)
% [eventStartStop, eventPeakLocation, eventAmp, eventWidth] = fp_detect(Y, dt, minHeight)
Y = zscore(Y);
startStopPositive = j_event_detect(Y, minHeight, 0.5);
startStopNegative = j_event_detect(-Y... |
4c9c50c24a62618dc91bbcd2533c300e726b2563905af1c7fd810c32299f7f6f | MATLAB | 1,964 | 54 | function [F, J] = funfitGaussModel(params, xvals, xorder)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
%==========================================================================
gamma = params.outparams(1);
alpha = params.outparams(2);
%===============================================... |
8451f38d207df0b89b8b3a039e15646d7150d14571b266d05538c497b474e8bd | MATLAB | 1,964 | 69 | %% Illustration of the Neyman-Pearson testing paradigm
%
%%
% This file is from pmtk3.googlecode.com
xmin = -4;xmax = 8;
ymin = 0;ymax = 0.3;
res = 0.01;
domain = xmin:res:xmax;
sigma = 1.5;
f1 = @(x)gaussProb(x,0,sigma^2)';
f2 = @(x)gaussProb(x,4,sigma^2)';
linesize = {'LineWidth',2.5};
plot(domain,f1(domain),'-b'... |
b0b3731f028063b23b5e9abc40410402aea46cc1ac571ac6017473199ebb0d54 | MATLAB | 1,964 | 57 | function loc_list_Multiple_channel(data,scatter_size,scatter_num)
global Int
Colours = {'m','c','y','w','g','b','r'};
if length(data)<=3
msgbox('Number of files selected should be more than 3')
else
figure()
set(gcf,'name','Montage Plot','NumberTitle','off','color',[0.1,0.1,0.1],'units','normaliz... |
e96b0b434b1f9396d250946a07e2cd7e397fdcd18d5e9769285c8076a34f7468 | MATLAB | 1,964 | 60 | function y = contract(x,i,j)
%CONTRACT Contract sparse tensor along two dimensions (array trace).
%
% Y = CONTRACT(X,I,J) contracts the entries of X along dimensions I
% and J. Contraction is a generalization of matrix trace. In other
% words, the trace is performed along the two-dimensional slices
% defined by... |
189da7cc7fc64e26eeb8c0b7c5c150420af969b341ed2214c5f4746d9c765a40 | MATLAB | 1,965 | 67 | function [model, loglikHist] = mixGaussFit(data, nmix, varargin)
%% Fit a mixture of Gaussians via MLE/MAP (using EM)
%
%
%% Inputs
%
% data - data(i, :) is the ith case, i.e. data is of size n-by-d
% nmix - the number of mixture components to use
%
% This file is from pmtk3.googlecode.com
[initParams, prior... |
0d5eb53796e9ced87ef0363d02cefcedbb4379dc1ee598bc29caaf71dbd3e207 | MATLAB | 1,966 | 75 | % AUTHORSHIP
% Primary Developer: Stephen Meehan <swmeehan@stanford.edu>
% Math/Statistics: Connor Meehan <connor.gw.meehan@gmail.com>
% Guenther Walther <gwalther@stanford.edu>
% Primary inventors: Wayne Moore <wmoore@stanford.edu>
% David Parks <drparks@stanford.edu... |
532100961190984040b534f1a405b5f238e5b44029eecaa91ad05683ff4c9da8 | MATLAB | 1,966 | 54 | function [x, y] = ft_select_box(handle, eventdata, varargin)
% FT_SELECT_BOX helper function for selecting a rectangular region
% in the current figure using the mouse.
%
% Use as
% [x, y] = ft_select_box(...)
%
% It returns a 2-element vector x and a 2-element vector y
% with the corners of the selected region.
%
%... |
c499f189b9e61288ebad1482b01fff05fe6eb59bffcea44b0b2e690f91dc491f | MATLAB | 1,967 | 40 | classdef lightCollector
%LIGHTCOLLECTOR This class contains all properties related to a
%light collector of an MCmatlab.model.
% This class defines the properties of a lightcollector to be used in
% monteCarloSimulation or fluorescenceMonteCarloSimulation.
properties
%% Input properties
x (1,1) d... |
1d4c15ea3b01d6ae4a644eb4484628b13a752255c48cd72a643cac5f94a87d32 | MATLAB | 1,968 | 64 | function varargout = ft_notice(varargin)
% FT_NOTICE prints a notice message on screen, depending on the verbosity
% settings of the calling high-level FieldTrip function.
%
% Use as
% ft_notice(...)
% with arguments similar to fprintf, or
% ft_notice(msgId, ...)
% with arguments similar to warning.
%
% You can s... |
8bec1a300f4bef7756db428f3b48e778e12024cbfe80cadd0544f3d11bb2a24e | MATLAB | 1,968 | 53 | function B = expand(A,S)
%EXPAND Replicate and tile each element of an array, similar to repmat.
% EXPAND(A,SZ), for array A and vector SZ replicates each element of A by
% SZ. The results are tiled into an array in the same order as the
% elements of A, so that the result is size: size(A).*SZ. Therefore the
%... |
dcfd2f5c86424fa9512f0e3cfeb9a80e9d6cd66097b21dc73368ef14439cff46 | MATLAB | 1,968 | 78 | function [X0,isYout] = VBA_spm_Xadjust(SPMfile,VOIfile,varthresh)
% gets the effects of no interest, wrt to which the data has been adjusted
% [X0,isYout] = spm_Xadjust(SPMfile,VOIfile,varthresh)
% IN:
% - SPMfile: name of the SPM file
% - VOIfile: name of the VOI file
% - varthresh: threshold for PCA on X0 (frac... |
fe20517d604e941b155f4a1e0510dfa3515deb66465d7d4746e50b00566e20f5 | MATLAB | 1,968 | 40 | function I = pmtkTagReport(root)
%% Gather info on all of the tags in the PMTK3 system.
% I is a struct with the following fields:
% files............a list of all of the PMTK3 files with at least one tag
% tags.............tags{i} are the tags for files{i}
% tagtext..........tagtext{i}{j} is the remaining text a... |
13a6df14fe2f068a6c02a27c5a927a499159166f7f594a49972eb272686000ab | MATLAB | 1,969 | 39 | % l1 = load('/home/mayank/work/poseEstimation/RomainLeg/Apr28AndJun22_onlyBottom.lbl','-mat');
l1 = load('/groups/branson/bransonlab/mayank/PoseTF/RomainLeg/Apr28AndJun22_onlyBottom.lbl','-mat');
lfiles1 = {'/localhome/kabram/Dropbox (HHMI)/MultiViewFlyLegTracking/sep1616/sep1616-1531Romain.lbl'
'/localhome/kabram//D... |
76232745e2d1436a8049531bc8d3a4a8eabdf814953eb8b07c386467950269af | MATLAB | 1,969 | 83 | function pscatter(X,varargin)
% Pairwise scatter plots of the columns of X
% Very similar to plotmatrix in statistics toolbox, but looks prettier
%
% X: n * d matrix of numeric data
% vnames: optional cell array of variable names (default {'1',...,'d'})
% plotsymbol: optional cell array of symbols for each class type,... |
5a0032217e61d70431d22ebac5a47d6e137fb702804e8863e5ba45c3444f9d2d | MATLAB | 1,970 | 57 | function [H] = scale(f)
% SCALE returns the homogenous coordinate transformation matrix
% corresponding to a scaling along the x, y and z-axis
%
% Use as
% [H] = translate(S)
% where
% S [sx, sy, sz] scaling along each of the axes
% H corresponding homogenous transformation matrix
% Copyright (C) 2000-... |
697eae8a9805df135f4348bae06e7cff6daceaec22fc44ff8ea6e6dbdb63a6ed | MATLAB | 1,970 | 63 | % Plot activity during signal viewing task
i = 0;
for d = 1 : length(plotSig)
dim = plotSig{d};
i = i + 1;
assignSignal_view
if sub0 == 1; ylims = ylims - diff(ylims)/2; end
% Average traces aligned to Motion onset
s_view = subplot(rows,colms,(i-1)*colms+pSL... |
bfce0ea61791efe4233f325370bf66534bd3587c35c5008027b848b46e55cfea | MATLAB | 1,970 | 56 | % This script simulates and inverts an "influence learner"
% This model is based upon [Hampton et al., 2008].
% Let p=P(o=1) be the agent's prediction of the other's next move, ie the
% probability that the other will pick the first alternative option. The
% "influence learning" rule can be written as follows:
% p <- p... |
66fcae5663e67b148ea9faf5eaa2aff7b4a78ae6f7675eadcfef4003613f217c | MATLAB | 1,971 | 56 | %% Plot various loss functions
%
%%
% This file is from pmtk3.googlecode.com
function lossFunctionFig
qvals = [0.2,1,2];
for i=1:length(qvals)
plotLoss(qvals(i));
end
%hingeLoss(0.5);
function plotLoss(q)
figure;
fs = 14;
%Here x = y-a
loss = @(x) abs(x).^q;
x = -2:... |
d72e6c38fd7f9e2b9c518037f4467d617ad87c107d4b66206b4821310e47cf85 | MATLAB | 1,971 | 54 | function varargout=continuousabove(data,baseline,abovethresh,mintime,maxtime);
% function varargout=continuousabove(data,baseline,abovethresh,mintime,maxtime);
%
% Finds periods in a linear trace that are above some baseline by some
% minimum amount (abovethresh) for between some minimum amount of time
% (mintime) and ... |
f36a1fe145695022c7111eebe4679336aaeafc5a76c6c0ba56e0226c866ce5da | MATLAB | 1,971 | 56 | function [y,am]=anaask(N,Ncomp,f0);
%ANAASK Amplitude Shift Keying (ASK) signal.
% [Y,AM]=ANAASK(N,NCOMP,F0) returns a complex amplitude
% modulated signal of normalized frequency F0, with a uniformly
% distributed random amplitude.
% Such signal is only 'quasi'-analytic.
%
% N : number of points
% NCOMP : numb... |
39cf0078745a6d2f0db5f6096e3d12a7a46cea0ae7519fd134ae154b4b1bd495 | MATLAB | 1,972 | 57 | function mdlparams = gfFitGaussMonotonic(mdlparams, xvals, yy)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
%==========================================================================
mdlfit = mdlparams;
rmax = mdlparams.rmax/2;
%====================================================... |
4850b5cfca68f71a9c92b3439303f16d441d16cc6f025076b5536b3ca91332dd | MATLAB | 1,973 | 79 | function Ximpute = mixGaussDiscreteImpute( model, X )
% Impute NaNs in a matrix of mixed cts/ discrete data
% See mixGaussDiscreteFitEm for details of the model
% This file is from pmtk3.googlecode.com
%PMTKauthor Hannes Bretschneider
labels = model.labels;
types = model.types;
C = size(model.beta,1);
iscont = (typ... |
7314ab65dfc2dcd29d4bcf34ae4cc9ad2d8ac60c68126514157b85e759775aef | MATLAB | 1,973 | 64 | function [mua, mus, kappa, E] = calc_mua_mus(mesh,wv_array)
% CALC_MUA_MUS Given a spectral mesh, and specific wavelengths, calculates
% optical properties at these wavelengths.
%
% SYNTAX:
% [MUA, MUS, KAPPA, E] = CALC_MUA_MUS(MESH)
% [MUA, MUS, KAPPA, E] = CALC_MUA_MUS(MESH, WV_ARRAY)
% [MUA, MUS, KAPPA] = CALC_... |
9c0a7ee5b47b12711508a0dcd45e33ef538cef6378ce387deca8b98358e842fa | MATLAB | 1,973 | 54 | function [bels, converged] = belPropSync(cg, varargin)
%% Belief propagation with a simple synchronous update schedule
% By synchronous we mean nodes are all updated at the same time.
% This is sometimes called a systolic update schedule since all of the
% nodes alternate between 'sending out' and 'sucking in'.
%
%... |
bf81425b401e33d75846bd51b29b32b951244c4cd9fa9b52f240a04d3dbf2a7b | MATLAB | 1,973 | 54 |
% Fix possible splitting of responses between two consecutive frames
function ImageArray_NoStim_CorrAmp_norm_2 = FixSplitting(ImageArray_NoStim_CorrAmp_norm, ImagesPerSequence)
ImageArray_NoStim_CorrAmp_norm_2 = zeros(size(ImageArray_NoStim_CorrAmp_norm));
NumOfSequences = size(ImageArray_NoStim_Corr... |
f997aff4c3e4c426160880141d3670ecfcb324d73064b69885ad218b56dfa187 | MATLAB | 1,973 | 76 | function mesh = fixpos(mesh, recurse)
% FIXPOS helper function to ensure that meshes are described properly
if nargin==1
recurse = 1;
end
if isa(mesh, 'delaunayTriangulation')
% convert to structure, otherwise the code below won't work properly
ws = warning('off', 'MATLAB:structOnObject');
mesh = struct(mesh... |
85ac30be385088ee4544f63da4dd5db0a8c7d51e9e0674803592662594641fad | MATLAB | 1,974 | 77 | %% Bayesian linear regression with an uninformative prior
% PMTKneedsStatsToolbox regress, ridge
%%
% This file is from pmtk3.googlecode.com
requireStatsToolbox
X = loadData('caterpillar'); % from http://www.ceremade.dauphine.fr/~xian/BCS/caterpillar
y = log(X(:,11)); % log number of nests
X = X(:,1:10);
[n,d] = siz... |
a1c5c1f7c96b1c1063fc04ccd890c5e072c1e95cfb938e2c76b874ebf03ae547 | MATLAB | 1,974 | 63 | function clrs = uniqueColors( m, n, show, offset )
% Generate m*n visually distinct RGB colors suitable for display.
%
% Useful when more than the 6 standard 'rgbcym' colors are needed for
% display. Generate m*n colors by sampling at constant intervals in HSV in
% the H and S channels (while keeping V fixed at 1). In ... |
a943acd228cad8a097fa3c105c1ec17b3b6f4419c1e3c2a4eac8b7df974296e1 | MATLAB | 1,974 | 43 | function fixedClassName = tryToInferProperClassNameFromTCICellArray(ca)
% Called when loading an MA project with a TCI cell array that has ca{1} of
% 'DeepTracker'.
% In theory this should not happen, but there was once a buggy version of APT
% that sometimes used this className for MA projects.
% The result is the inf... |
168d4c5e1a30f0090a1320ab901d1f4f19b87f59d1b25454bf2a266bc5348c83 | MATLAB | 1,975 | 69 | % MATLAB code provided by Seyed Mohammad Ali Rahmati
% Affiliation: Biomechanics and Motor Control Lab, Department of Biological Sciences, Georgia Institute of Technology, Atlanta, GA.
%
% Description:
% This script performs an optimization to minimize muscle fatigue for 40 muscles by applying the Cost_Function.
% The ... |
6dd8fc953a9c51a9f58262737bf7ced2564d52554fb190a132f5e269a8ac9455 | MATLAB | 1,975 | 82 | function NNaddAllUncertainSpikes(self, ~, ~)
if self.verbosity > 9
disp(mfilename)
end
channel = self.channel_to_work_with;
% find closest identified point
[spiketimes, labels] = self.getLabelledSpikes;
uncertain_spikes = round(self.handles.ax.uncertain_spikes(channel).XData/self.dt);
if isempty(uncertain_spik... |
c8b73b73136551bec59362bfc863b947e616a671d82d1a38844cf999679397cc | MATLAB | 1,975 | 66 |
function WriteStarFileStruct(s,dataName,fileName,activeFlags)
% function WriteStarFileStruct(s,dataName,fileName,activeFlags)
% function WriteStarFileStruct(s,FID)
% Write a STAR file from the fields of the struct s. These fields are
% assumed to be numeric or cell arrays (of strings). The arrays must all
% have the... |
3294aeb6c1fa7f5fb5462fc6e36c3d786b363f26c0779673949ac4f6f70d32cc | MATLAB | 1,976 | 63 | %% Script for processing all tomograms in a directory with tomosegmemtv
% Author: Antonio Martinez-Sanchez
%% Clear workspace
close all
clear all
%% Input/Output directories
din = '/path/to/input/tomograms';
dout = '/path/to/output/tomogrmas';
%% Input parameters
s = 15; % Scale factor
t = 1; % Membrane thickness ... |
789d1f8316aac32949da4fee96023d8fa2401fb887efbf3dce6d797f86673b5a | MATLAB | 1,976 | 65 | function [xyz,rmse] = dlt_reconstruct(c,camPts)
% function [xyz,rmse] = dlt_reconstruct(c,camPts)
%
% This function reconstructs the 3D position of a coordinate based on a set
% of DLT coefficients and [u,v] pixel coordinates from 2 or more cameras
%
% Inputs:
% c - 11 DLT coefficients for all n cameras, [11,n]... |
cd6544c89b0fac55da1dc3c3931e6c33d990f034f6e2f76d0b8e65268f0746f3 | MATLAB | 1,977 | 92 | % Read in Reg Willson's data file, and convert it into my data format:
if exist('calib_file'),
if exist(calib_file)~=2,
ask = 1;
else
ask = 0;
end;
else
ask = 1;
end;
while ask,
calib_file = input('Reg Willson calibration file name to convert: ','s');
if ~isempty(calib_file),
... |
f880e9786f2dd887c589ead2af9ef827aa90245e6732948c8221d49a56f3a4c3 | MATLAB | 1,977 | 44 | function vol = signed_tetrahedron_vol(TET,X,Y,Z)
% function vol = signed_tetrahedron_vol(TET, X, Y, Z);
%
% Fully vetorized to compute the signed volume of tetrahedral (TET4)
% elements. TET (nX4) specifies node connectivity, X,Y,Z (all are nX1) are
% node coordinates. An element in TET matrix (e.g., TET(m,n)=9;)
% ... |
955d14dcc673cf0235c3442df841f8e827f76098b5113b8e85058bebdd55f526 | MATLAB | 1,978 | 75 | function X=ms_whiten(X)
%MS_WHITEN - Channel-whiten an array of raw or preprocessed data
%
%Consider using mscmd_whiten
%
% Syntax: [Y] = ms_whiten(X)
%
% Inputs:
% X - MxN array of raw or pre-processed data
%
% Outputs:
% Y - MxN array of channel-whitened data
%
% Without arguments, runs self test including com... |
3c0da7212da1d9c907e093180849babed755ae9800faf3ca768b578330c244bc | MATLAB | 1,979 | 67 | function im_out = getData(data_tag,data_tind,chi_tind)
%this function loads the data images and chi images with no processing or interpolation
%last modified: 03/04/2023 by Xinan Chen
%addpath('../../Visualization/MATLAB_MRI_display/NIfTI_analyze/');
if nargin < 1
data_tag = 'gauss';
data_tind = 1;
elseif nar... |
a5508f54085eb21d6db51bcb1b6dbf5dd93568d9f9fbdea65944d1ebd999b8d1 | MATLAB | 1,979 | 68 |
%% Global Default Options
GlobalOpts.Subject='p1';%'p1','p3';
GlobalOpts.TaskName='FaceScratch3'; % used for folders and file names
GlobalOpts.TaskFileName='FaceScratch3'; % To use with LoadConvertedData
% Analyses phases and windows for trial response and temporally resovled
% response (TR)
GlobalOpts.Pha... |
b28e84241ff3d9ed750843b54ed9f941ca5beaf715e1e92e12853def3cf698e9 | MATLAB | 1,979 | 49 | function score = transition_betweeness(mapper_path, tr_names)
% Basically, compute the distance between nodes of states low and up.
% First on the graph without transition_plus nodes and then on the graph
% without the transition_minus nodes. The minimum distances are
% subtracted for a final score
... |
568adce09f3b9e0ed2f144cc25a225e703c31a81727bb754f815eb28d78dde4e | MATLAB | 1,980 | 64 | function [sX,sY,ni,ssID] = sortData(X,tcol,Y,sID)
% [sX,sy,ni,ssID] = sortData(X,tcol,y,sID)
%
% This function sorts the design matrix X and the data Y according to
% subject's ID (sID) and according to time within each subject.
%
% Input
% X: Design Matrix (nmxp, nm total # of measurements, p #of fixed effects).
% ... |
da57e867da06c00c66c02a26b5604448f6225c764a815c9004998f50ff115368 | MATLAB | 1,980 | 62 | function [order, Gchordal] = minWeightElimOrder(G, nodeWeights)
% Greedily find an elimination order which induces the lightest clique.
% Break ties by minimizing the number of fill-in edges.
% So if nodeWeights = zeros(1,d), this is just minfill heuristic.
%
% For details, see
% - Kjaerulff, "Triangulation of graphs -... |
5217c83df97f6c4a915556d7e309f586d7fb5d9e7f3bd36b7a51c7a2c82e2871 | MATLAB | 1,982 | 92 | function [hh pval] = freq_bootstrapping(freq,bl,alpha)
%
% Calcula significacia por medio de test boostrapping de cartas de
% tiempo/frecuencia en realcion a linea de base.
% Test muy exigetes, solo usar con linea de base,
% sino no tiene mucho sentidos
%
%
% fre=[fq_elec_time_s]
% Carta tiempo frec... |
972f194640266c964c41eef1afa1f25eef1e38568315b98f216842795d14dd6a | MATLAB | 1,982 | 75 | %% Bayesian linear regression with an uninformative prior
% PMTKneedsStatsToolbox regress, ridge
%%
% This file is from pmtk3.googlecode.com
% Boston housing data taken from here
%http://www.kellogg.northwestern.edu/faculty/weber/emba/_session_3/boston.htm
requireStatsToolbox
%fname = '/Users/kpmurphy/github/pmtkda... |
f4d09f1e64dd8f745dc8c572d55dd55c2f9707f12a1e9302d4de7514f5554062 | MATLAB | 1,982 | 83 | function CBIG_MFMem_rfMRI_run_1000_simulation_testGrp_resLow_only4p(save_dir_input)
%--------------------------------------------------------------------------
% CBIG_mfm_rfMRI_run_1000_simulation_testGrp_resLow
%
% Input parameters:
% save_dir_input: Output file directory
%
% This function will run 1000 simluat... |
14fca8c1a9f91f6718ebf13a204a6758cb3f03ce8853f1a52aed3fbda729e8c6 | MATLAB | 1,983 | 56 | function dt = datatypes
% Datatype
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id$
persistent dtype
if isempty(dtype),
t = true;
f = false;
table = {...
0 ,'UNKNOWN' ,'uint8' ,@uint8 ,1,1 ,t,t,f... |
3e15704b7b8d106cbba852442ce52dbc46573fd53b9d5dfe49a3ed1f1d1e3a84 | MATLAB | 1,983 | 60 | function SpikeSortHsd(datDir, varargin)
verbose = true;
saveDir = datDir;
preprocessRange = [0 600];
timeRange = [0 Inf];
lfp = true;
lowpass = -1;
for i = 1:2:length(varargin)
switch lower(varargin{i})
case 'verbose'
verbose = varargin{i+1};
case 'savedir'
saveDir = varar... |
c816a6d35e3370cf26b4240203778a7513d1eab7fe33f7889fe2b66873349e5a | MATLAB | 1,983 | 53 | function mdlparams = fitGaussModel(mdlparams, stiminfo, stimorder, yy)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
%==========================================================================
mdlfit = mdlparams;
rmax = mdlparams.rmax/2;
%============================================... |
113e11282b8fa421485b6feb3e64e27fc427f90abbb42a08eaea6b00696d6aa3 | MATLAB | 1,984 | 63 | % [edges,centers] = SelectHistEdges(nbins,lim,binmode)
% It selects edges between bounds set by LIM according to BINMODE,
% which is either 'linear', 'log' (log binning), or 'logabs'
% (log binning in both directions from zero).
function [edges,centers] = SelectHistEdges(nbins,lim,binmode)
switch lower(binmode),
... |
748deb5db48e35d17fa46b460eb3b919f94d3a99ca10296932181db26152c6d8 | MATLAB | 1,984 | 57 | function out = loaddatastruct(animaldir, animalprefix, datatype, days)
% out = loaddatastruct(animaldir, animalprefix, datatype)
% out = loaddatastruct(animaldir, animalprefix, datatype, days)
%
% Load the components of a data cell array of combines then into one
% variable. Datatype is a string with the base name of... |
ce8225d9e36a13f9978a2dc40c36da61f1e3553d515be548445324829c0078ee | MATLAB | 1,984 | 63 | % Example of nonrigid registration using steepest gradient optimizer
%
% Example is written by D.Kroon University of Twente (October 2008)
% clean
clear all;
close all;
% Add all function paths
addpaths
% Read two greyscale images of Lena
I1=im2double(imread('lenag1.png'));
I2=im2double(imread('lenag2... |
119dc8e5046db3aa3a6d22db941aff846f3659e1520d67fcc81f98d9cb6ffee7 | MATLAB | 1,985 | 59 | % UseThisMouse.m
% Sarah West
% 11/14/23
function [parameters] = UseThisMouse(parameters)
data = parameters.data;
% Find the location & value of the comparison iterator in
% parameters.values
iterator_location = strcmp(parameters.keywords, 'comparison_iterator');
comparison_iterator = parame... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.