sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
08b4d157a60110a188117f3449c0c74c69383b4cd34ea66e4f20717bfd91b2cb | MATLAB | 393 | 20 | function [whl,t,GoodRanges] = LoadPosition(fbasename)
% Intermediate wrapper, should not be used directly
%
% USAGE
% [whl,t,GoodRanges,ep] = LoadPosition(fbasename)
%
% OUTPUT:
% whl: the position matrix
% t: time vector
% Good Ranges:
Fs = 1250/32;
whlt = dlmread([fbasename '.whl']);
[whl GoodRanges] = Cl... |
7093f00cd3a45363c2bec5480075e129a526954b2047269e2de93d77deb17181 | MATLAB | 393 | 22 |
function T=Triangle3D(r,xdim,ydim,zdim,midy,midx,midz)
T=zeros(xdim,ydim,zdim);
for i = 1:xdim
for j = 1:ydim
for k = 1:zdim
x=i-xdim/2-midx;
y=j-ydim/2-midy;
z=k-round(zdim/2)-midz;
R=sqrt((x^2+y^2+z^2));
%disk
if((x^2+y^2+(z*xdim/zdim*2.5)^2)<r^2)
... |
75b897e0e8bfc7904001bd19e05fcdd53a9158f2f7fb4352459014507fdd148a | MATLAB | 393 | 18 | function plot_zones(frame0,zones)
figure();
title('zones')
hold on
axis off
imagesc(frame0);
n_zones = max(size(zones));
colormap_ = colormap(lines(n_zones));
for i=1:n_zones
x = zones{i}.x;
y = zones{i}.y;
n = length(x);
for j=1:n-1
plot([x(j) x(j+1)],[y(j) y(j+1)],'color',colormap_(i,:));
... |
82d5327d3b30be97ebbfcb3413f751567340296f9d3682c572765fd4fc58c3c8 | MATLAB | 393 | 16 | function plot_explained_ratio(PCTVAR,dim,output_name)
plot(1:dim,100*PCTVAR(2,1:dim),'-o','LineWidth',2,'Color',[140/255,0,0]);
set(gca,'Fontsize',20);
set(gca,'LineWidth',2);
xlabel('Number of PLS components','FontSize',20);
ylabel('Explained ratio (%)','FontSize',20);
yticks([0:10:60])
grid off
box off
set(gcf,'pos... |
9c284f55622cb75111958911a54d0261f1b8ff2e37131dc86efa030a35abdfa1 | MATLAB | 393 | 23 | function index = binsearch(data, key)
start = 1;
ends = length(data);
while (start < (ends-1))
mid = floor((start + end)/2);
if ((key) == data(mid))
start = mid;
ends = mid;
if ((key) < data(mid))
ends = mid;
if ((key) > data(mid))
start = mid;
end
if(((key) - data(start)) > (da... |
1af3da97f52cbeaf962c0fff219bc49be05154ed8fd6fdff2de9f1fde3bdc994 | MATLAB | 397 | 21 | function shrink(f)
% Shrink window by fraction from default size
% shrink % defualt 50%
% shrink(f) % shink by f
% shrink([h v])
if ~exist('f','var')
f = [.5 .5];
end
if length(f)==1;
f = [f f];
end
tempUnits = get(gcf, 'Units');
set(gcf, 'Units', 'pixels');
a = get(gcf,'Position');
set(gcf,'Position',[a(1)... |
462ce54189784d3c924e71ec6f30e23c04e8e3e85fbdbcd2b0069be0bfca12a7 | MATLAB | 397 | 11 | function dominant_states = getDominantStateIdsSubject(temporal_evolution_of_states, max_nstates)
K = max_nstates;
n_subjs = length(temporal_evolution_of_states);
for subj=1:n_subjs
sc =zeros(1,K);
for j=1:K
sc(j) = sum(temporal_evolution_of_states{subj}==j);
end
counts_post = sc/sum... |
7641125773f49486e65bd06d7861408a383355aabf92c1119c4e2e4a50835e76 | MATLAB | 397 | 20 | function [m] = LogisticHv(v,w,X,y)
% v(feature,1) - vector that we will apply diagonal preconditioner to
% w(feature,1)
% X(instance,feature)
% y(instance,1)
sig = 1./(1+exp(-y.*(X*w)));
% Compute diagonals of Hessian
sig = sig.*(1-sig);
for i = 1:length(w)
h(i,1) = (sig.*X(:,i))'*X(:,i);
end
% Apply precondition... |
c45a2f711cc7061d1d80360026980902893d7adfc92716a8d14df63267a2ccbd | MATLAB | 398 | 10 | function UsedSets=GetUsedSets()
%UsedSets=[1:6 9:19 21:25 28:51 54 55 59:64 65 69 74:76 77 83 84 85 88 89 92 93:105 106 110 114 118 122 126:128];
%UsedSets=[1:6 9:19 21:25 28:51 55 59:64 65 69 74:76 77 83 84 85 89 92 93:105 106 110 114 118 122 126:128];
UsedSets=[1, 4, 9, 10, 11, 12, 13, 15, 23, 24, 29, 32, 33, 34, 4... |
49000a91614693cf92c023f68ca12f5cbb08c5c9bf7834a2bf8fc5aecac6f7d4 | MATLAB | 399 | 22 | function test_cellmean
% x as a 1xn cell-array
x = {rand(3,4) rand(3,4)};
m1 = mean(cat(1, x{:}));
m2 = mean(cat(2, x{:}),2);
m1c = cellmean(x, 1);
m2c = cellmean(x, 2);
assert(norm(m1-m1c)./norm(m1)<eps);
assert(norm(m2-m2c)./norm(m2)<eps);
% x as a nx1 cell-array
x = x(:);
m1c = cellmean(x, 1);
m2c = cellmean(x... |
60f08b02852b9ef07878fc6ac97116929174d4cf869b77d06adce6c02a2b352f | MATLAB | 399 | 16 | function y = rosen(x)
%ROSEN Calculate Rosenbrock's function.
%
% Description
% Y = ROSEN(X) computes the value of Rosenbrock's function at each row
% of X, which should have two columns.
%
% See also
% DEMOPT1, ROSEGRAD
%
% Copyright (c) Ian T Nabney (1996-2001)
% Calculate value of Rosenbrock's function: x should b... |
7a02b3430009482138c39ae3284950bf5b65dc7eecb4f90faea5e4db49eb72df | MATLAB | 399 | 20 | clc; clear all; close all;
d=importdata('Simul_90deg_rawdata.txt');
data_cropped=d;
maximum_intensity=max(max(data_cropped));
data_cropped(data_cropped<=maximum_intensity*0.05)=0;
N = nnz(data_cropped);
intensity_total=sum(sum(data_cropped));
intensity_averaged_by_pixel=intensity_total/N;
imagesc(... |
ad67a0703ad5ddc06bc2f4828afc45785ac491946fb42657948aaa8d78fb98d4 | MATLAB | 399 | 17 | function [estimates, model] = fitcurvedemo(xdata, ydata)
start_point = rand(1, 3);
model = @fitFct;
estimates = fminsearch(model, start_point);
function [sse, FittedCurve] = fitFct(params)
A = params(1);
B = params(2);
phi0 = params(3);
FittedCurve = A + B.*cos(xdata-phi0);
Error... |
cbdb3a96e574202f4d5789f8555a6807cd486701f5f70ee1a4d36cf3fa02003e | MATLAB | 400 | 10 | function [countList, angList] = AccumulateFlowAngles(vx, vy, mask, angRange, angStepSize)
angList = atan2(vy(mask(:) > 0), vx(mask(:) > 0));
if strcmp(angRange, '90')
binEdges = 0:angStepSize:90;
angList = asin(sin(acos(cos(angList))));
elseif strcmp(angRange, '360')
binEdges = 0:angStepSize:360;
end
angL... |
5bd7dea600396a862bcdad15df16ea2f31917978879ba7b4b0a300b58c00070e | MATLAB | 401 | 19 | function [C, neuronPos] = getLocCon(L, l)
N = L^2;
neuronPos = zeros(N, 2);
counter = 1;
for x = 1:L
for y = 1:L
neuronPos(counter, :) = [x y];
counter = counter + 1;
end
end
ll = (l-1)/2;
C = zeros(N, N);
xdist = squareform(pdist(neuronPos(:, 1)));
ydist = squareform(pdi... |
9dea6b83ea258e7aee11addb96226666bcbd2a131d95d58cca32a1a95cc8e878 | MATLAB | 401 | 17 | function [mask_coords] = convert_pat_idx_to_mask_coords(mask,pat_idx)
% [MASK_COORDS] = CONVERT_PAT_IDX_TO_MASK_COORDS(MASK,PAT_IDX)
%
% Inverse operation of CONVERT_MASK_COORDS_TO_PAT_IDX.
if ~exist('pat_idx','var')
incl_m_idx = find(mask);
pat_idx = 1:length(incl_m_idx);
end
mask_idx = convert_pat_to_mask_idx... |
ac2cdb4b01bd6d50c107ea3cb83abd8a5f4c9930cc87ab8a6ee79cfa04242e07 | MATLAB | 401 | 18 | function sz = size(O, varargin)
% Returns size of tsdArray (overlaod of size function)
%
% USAGE:
% sz = size(O) returns
% sz = size(O,i) returns size along the ith dimension
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
if ~isemp... |
bdd7779e5b59e7e40dde49fc334231ad08368460ea1f7b3bf8d79912c49e8f73 | MATLAB | 401 | 11 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function mchan = mchan(v, mpre, Dt, VTraub)
mchan = mpre + m_exp(v,Dt, VTraub) * (m_inf(v, VTraub) - mpre);
% dm = am(v, ... |
e1b8e70c8d6c4f208b044e245841e3422123ee49563b866cff6b66cbdcde36ab | MATLAB | 401 | 13 | function [Optm, Eval] = LinearNLCombine(L, NL, Sig)
L = L(:)/max(L);
NL = NL(:)/max(NL);
Sig = Sig(:);
Len = length(L);
nDiv = ceil(Len/1200);% 60 frames * Sampling 100 Hz / 5 Hz
% CostF = @(w) 1/corrchop(Sig, L+NL*w, nDiv).^2;
CostF = @(w) 1/abs(corrchop(Sig, (1-w)*L+w*NL, nDiv));
Optm = fmincon(CostF, 0.1, []... |
09b9beeeba82456aa1b53039b154887b5a0e93071a11f8a03e46d1de3acd4e4b | MATLAB | 402 | 20 | function w = glmpak(net)
%GLMPAK Combines weights and biases into one weights vector.
%
% Description
% W = GLMPAK(NET) takes a network data structure NET and combines them
% into a single row vector W.
%
% See also
% GLM, GLMUNPAK, GLMFWD, GLMERR, GLMGRAD
%
% Copyright (c) Ian T Nabney (1996-2001)
errstring = consi... |
c10f8de504b4077332b7b9c22d0f5ab6396eaea40247cfc54c68f651e25fb0f1 | MATLAB | 402 | 16 | function R = corrchop(a, b, ndiv)
nL = size(a, 1);
if nargin == 2
ndiv = ceil(nL/1200); % 60 Frame 5 Hz, 100 Sampling Hz
end
chopL = round(nL/ndiv);
for i = 1:ndiv
sP = (i-1)*chopL+1;
eP = min([i*chopL nL]);
if i == 1
dr = corr(a(sP:eP, :), b(sP:eP, :));
else
dr(:, :, end... |
5c282a305e3695dd4cc45d21a500620f3d3b09b01a155cb357819067221a5491 | MATLAB | 403 | 16 | function eye_ds = eye_downsample_data(eye, p)
% Get downsampling factor
ds_factor = p.eye.ds_factor;
% Downsample
eye_ds = zeros(size(eye,1), size(eye,2), size(eye,3), size(eye,4)/ds_factor);
for i = 1:size(eye,1)
for j = 1:size(eye,2)
for k = 1:size(eye,3)
d = eye(i,j,k,:);
d = do... |
6e043d595065e12bf5f79f73b69ee5d831df3fecf72aa18a360d7914a65e3145 | MATLAB | 404 | 13 | custom_colormap = load('neuron_space_colormap.mat');
%data = round( 2 * ( rand(20) - 0.5 ) );
data = 2 * ( rand(20) - 0.5 );
figure; hAxes = gca;
imagesc( hAxes, data );
colormap(custom_colormap.CustomColormap2);
%colormapeditor
%colormap( hAxes , [1 1 1; 1 0 0; 0 1 0] )
%colormap( hAxes , [1 1 1; .5 0 0; 1 0 0; 0 0 ... |
b2d4019f9c7ae4f00246fa7d5acbfe41b3c9eace049fbbef055feba84b64fed6 | MATLAB | 404 | 19 | function L = SpkTrainLogLikelihood(q,f)
% L = SpkTrainValuation(S,f,r)
%
% computes log-likelihood of spike train S with intensity function f.
% INPUTS:
% q: binned spike train
% f: predicted intensity function (in number of spikes)
%
% OUTPUT:
% L: log-likelihood
% Adrien Peyrache, 2014 (following Harr... |
a07a88a45b92aa056aeb36647ba17574e5c78e3421cebe74c8888bc26e785b8d | MATLAB | 406 | 13 | function mlAct = mlAct_Matrix2BinaryVector(mlAct0, ml)
N = max(size(ml,1), size(mlAct0,1));
mlAct = zeros(N,1);
for iCh = 1:N
if all(size(mlAct0) == size(ml))
k = find(mlAct0(:,1)==ml(iCh,1) & mlAct0(:,2)==ml(iCh,2) & mlAct0(:,4)==ml(iCh,4));
else
k = find(mlAct0(:,1)==ml(iCh,1) & mlAct0(:... |
d90fc5cb37b58e039113661619b9b3b58737f413b14455d8a2782c0392814735 | MATLAB | 406 | 19 | function r = PartialCorr(t1,t2,t3);
% USAGE
%
% r = PartialCorr(t1,t2,t3) computes the partial correlation r such as
% r = r(t1, t2 | t3). It is the squared root of the Explain Variance
%
% Adrien Peyrace 2007
r12 = corrcoef([t1 t2]);
r12 = r12(1,2);
r13 = corrcoef([t1 t3]);
r13 = r13(1,2);
r23 = co... |
fe5f75e6b932326581ee7442561b650ea197040e4f04e6a3cae25d507ae689b9 | MATLAB | 406 | 20 |
t = tcpip('localhost', ******, 'NetworkRole', 'server');
fopen(t);
disp('Server is ready.');
% 读取数据并处理
while true
if t.BytesAvailable > 0
data = fscanf(t, '%s');
fprintf('Received data: %s\n', data);
% 调用处理数据函数
processRealTimeData(str2num(data));
end
pause(0.1)... |
2235d741d3d86088ed3ffaf7906b8cf02ceeb3b461ec0acf36a702346fe4b15a | MATLAB | 407 | 15 | function out = GetFactorArray(polyTime,frameTime,numMeans)
mu = polyTime/frameTime;
sig = numMeans*mu;
pt = floor(mu + 4*sig);
out = zeros(1,pt);
for i = pt:-1:1
out(i) = min(normcdf(i,mu,sig),1 - normcdf(i,mu,sig));
end
out = out/sum(out(:));
if isempty(out)
... |
fd265c0e39a8af6495023bee01a5c5a0c32ad2ca1f4b42f2c803302d97c0349b | MATLAB | 407 | 16 | function beta=autocorrfit(t,y,beta0,betaL,betaU)
% beta=autocorrfit(t,y,beta0)
% f=(p(1)*(sin(2*pi*p(4)*x)+1)+p(2))*exp(-abs(x)/p(5))+p(3)*exp(-abs(x).^2/p(5)^2);
% theta index: p(1)/p(2)
% c.f. Royer et al., 2010
try
warning off
%beta=lsqnonlin(t,y,'autocorr_index',beta0);
beta = lsqnonlin(@(x) (autocor... |
6dfa2775115dd04732b954b3539ae41cd564a3165ffdb2fd337d7fca6502216b | MATLAB | 408 | 15 | %function [y b a]=ButFilter(x, n, wn, flag)
% x - signal, n - order, wn - freq.range of filter, flag - 'bandpass',
% 'low', or 'high' in normalized units: Hz/(SamplingRate/2)
function [y b a] =ButFilter(x, varargin)
[n, wn, flag] = DefaultArgs(varargin, {20, 50/625,'low'});
[b,a] = butter(n,wn,flag);
nCh = size(x,2);
%... |
e0d95df10f2118bab3302828103e6f30c7a7bc97ce5a71736cb33554bc6d0369 | MATLAB | 408 | 11 | % This script downloads dataset to local folder to be viewed by user
%% Inputs
imageResolution = '10x';
datasetTag = '';%'2020-08-15'; % What date this data set was created, leave empty for latest
outputDir = 'tmpDataset';
%% Gather dataset
datasetPath = s3GetPathToLatestDataset(imageResolution,datasetTag);
... |
82dd1a78ebc2907bfe9f28e514b027340081176b2853711387fb14a2cfef7c77 | MATLAB | 409 | 7 | addpath /comp_neuro/Software/Github/CMBHOME_github/
load('/media/nmsutton/StorageDrive7/comp_neuro/holger_data/191101_S1_lightVSdarkness_cell9');
root.cel=[2 12];
[spk_x, spk_y] = CMBHOME.Utils.ContinuizeEpochs(root.cel_x, root.cel_y);
rate_map_grid_score_custom
[HDgridScore,gridness3Score]=get_HDGridScore(root,root.ce... |
6c248681899063fc67a8fe6954151e56ba09e4e3717247c683bc678926ab6e32 | MATLAB | 410 | 22 | % trials is channels x time x trials
function [trials,varargout] = selectRS(trials,isSDNew,mlActAuto)
if isSDNew
ssIdx = [7,22,24,26,29,32];
else
ssIdx = [7,22,24,26,30,34,39,41];
end
trials(ssIdx,:,:) = [];
switch nargin
case 3
ssIdxML = [ssIdx ssIdx+36];
mlActAuto(ssIdxML,:) = ... |
bcce0043e3ba126dc29e53aa1ceb79953a2fdb1c0c1f9eb8dfa545762761a6fd | MATLAB | 410 | 11 | function ImportImage_GuvenPaperModified(importFolder, exportFolder, fileName)
load([importFolder, fileName]);
OriginalImage.Image = double(origImage);
OriginalImage.NumChannels = 1;
OriginalImage.NumFrames = size(origImage, 3);
OriginalImage.ActinChannel = 1;
try
save([exportFolder, 'OriginalImage.mat'], 'OriginalI... |
c9b2477bbfc4f969b41d46ce9ad162a242f5cfd3bc45437f90d50fef98feb9c1 | MATLAB | 410 | 12 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function fsynS = fsynS(t, tau1, tau2)
tpeak = (tau1*tau2*log(tau1/tau2))/(tau1-tau2);
a = 1/(exp(-tpeak... |
f6f662ebdfa10a101cbe5d030276475b153cd5408b1f275703e1ab823a924572 | MATLAB | 411 | 12 | % function [ranks,ind] = wget(labels_train,vectors_train,cfg)
%
% Feature selection subfunction using weights from SVM (currently only for
% libsvm!)
function [ranks,ind] = wget(labels_train,vectors_train,cfg)
model = svmtrain(labels_train,vectors_train,cfg.feature_selection.decoding.train.classification.mode... |
6d62a8a09bed5a1025d743cabf1fcd5513848b9027bed9b73eab5f2b0cc6966c | MATLAB | 413 | 17 | function createSFNIRS(sbjNum,fName,restFN,respFN,movieList,startT,endT)
rawDataDir = ['C:\Users\mn0mn\Documents\ResearchProjects\spatailAttentionProject\RawDatafNIRS\Experiment' num2str(sbjNum)];
s.name = sbjNum;
s.fName = fName; % rawDataFN
s.movieList = movieList;
s.restFN = restFN;
s.resp = respFN;
s.startT = star... |
92ac490b5c24a146a62b24f0fdcde6e55b4d583d83271f7c5dab679662e30d3e | MATLAB | 414 | 19 | function w = HarrisAssembly(Q,cellIx,sigma,dt)
N = size(Q,2);
peerIx = [1:N];
peerIx(ismember(peerIx,cellIx))=[];
t = [-200:200]';
gw = 1/sqrt(2*pi*sigma^2)*exp(-t.^2/(2*sigma^2));
Qs = convn(Q,gw,'same');
sa = Qs(:,peerIx);
n = Q(:,cellIx);
l = @(x) sum(-HarrisExp(sa*x)*dt+n.*log(HarrisExp(sa*x)*dt))-sum(x.^2)/4;
... |
d8dd0e897ffdb488377baa2ec5a7bfe502ab4921fdcb25e08be5bcf406bf0264 | MATLAB | 414 | 16 | function refreshCircadian(this, actigraphy)
% REFRESHCIRCADIAN Update circadian results from ACTIGRAPHY
%
% $Author: Peng Li
% $Date: Feb 20, 2026
%
ax = actigraphy.actiAxis;
ptH = actigraphy.Decoration.YAdjust;
delete(findobj(ax, 'Tag', 'Cosine'));
if ~isempty(this.Circadian)
hPrim = plot(ax,... |
be7bf102bbc8eed9abb2ad9a68dd432ee251b4aec5bc46dde3ea3ba98fc3a2c0 | MATLAB | 415 | 13 | function ab = termcross(a,b)
%TERMCROSS Multiply dummy variables for two terms to get interaction
% Copyright 1993-2002 The MathWorks, Inc.
% $Revision: 1.39 $ $Date: 2008/05/08 16:55:37 $
if (isempty(a)), ab = b; return, end
if (isempty(b)), ab = a; return, end
na = size(a,2);
nb = size(b,2);
acols = repmat((1... |
3bf3fffd1691470dd28cf6e702b9bff62106e3266fa067f6c91326068632f06c | MATLAB | 417 | 12 | function fit_ = fit_iso(iso, physio)
%% fit iso to fluo gcamp (fit sig1 to sig2)
N=1; % polynomial coef for linear
idx1 = find(isnan(iso)==1);
idx2 = find(isnan(physio)==1);
iso_tmp = iso;
physio_tmp = physio;
iso_tmp(union(idx1,idx2))=[];
physio_tmp(uni... |
e4c2c623ec7ccae37b169b192f4e0dbe575e18a865319d88b2eb519d78157d7b | MATLAB | 420 | 21 | function lat = latencyFromBaseline(baseline,response)
SD_THRESHOLD = 5;
baselineSD = std(baseline);
baselineAve = mean(baseline);
if baselineSD == 0
lat = nan;
return
end
bottomThresh = baselineAve - SD_THRESHOLD*baselineSD;
upperThresh = baselineAve + SD_THRESHOLD*baselineSD;
lat = find(response>upperThres... |
1fcdd17a26876dc39e1b71aae1cb698a706fd5817e524595d6175a7ae9f469f9 | MATLAB | 421 | 27 | function EnO = End(S0)
% Returns a vector containing the time of the last event of each tsd
%
% USAGE:
% eno = Start(tsa,is)
%
% INPUTS:
% tsa - a tsdArray
% is - an intervalSet
%
% OUTPUT:
% eno - an vector of time
% copyright (c) 2009 Adrien Peyrache adrien.peyrache@gmail.com
EnO = [];
fo... |
a62193ae786504eaf4a86788bcb4d0c86f6b7276f35083139ed614b6080fb6fb | MATLAB | 422 | 23 | function A = subset(O, ix)
% Returns subsets of an intervalSet
%
% USAGE:
% A = subset(A, ix)
%
% INPUTS:
% A - an intervalSet object
% ix - index of the subsets
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
if nargin <... |
b1add65a019f858614efce408b3fb0eb350b512924612ff6270e17543e445ebb | MATLAB | 422 | 13 | function [dff_synchronized, t_synchronized] = getSynchronizedDFF(s, debug_mode)
frame_times =s.dio3.raising_times;
photo_times = s.dein_signals.time;
frame_dff = interp1(photo_times,s.dff,frame_times);
t_synchronized = frame_times;
dff_synchronized = frame_dff;
if debug_mode
figure()
... |
80c3f27d455e491d075d7c9c03fc4ee1982335db36db57e692764040c1018250 | MATLAB | 423 | 23 | function O = update(O, A)
% D = update(D, A) updates all the items in D with corresponding items in A
%
% items non existing in D will be created anew.
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
if O.keysReadOnly
error('Key... |
d35f6369e28fb4455986391f78105a40f0e4eebe00f75159c1db403acaaf74b1 | MATLAB | 424 | 13 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function simplified_m= simplified_m(v, mpre, dt)
minf = 0.504*tanh(1.935+0.06631*v)+0.4966;
taum = 0.08938/cosh(1.3... |
32a84e982b320cab6c09f06a4bebed3c28929dbbe516c371713486a48e290b7e | MATLAB | 425 | 24 | function X = gaussFilt(X,N1)
% Xsm = rectFilt(X,N1,N2)
%
% 1-d rectangular filtering with border correction
% Input:
% X: vector (or column matrix) to smooth
% Output:
% Xsm: smoothed matrix
% Adrien Peyrache 2011
if length(size(X))>2
error('Too many dimensions!')
end
l1 = size(X,1);
X = [flipud(X);X;f... |
ca06f822df1bf5751e583795c21c35bc9f130bf8483b275565c48c59500925da | MATLAB | 425 | 8 | function tracksOut = RotateTracks(tracksIn, thetaInRadians, origSize, newSize)
oldCM = origSize([1, 2])/2;
newCM = newSize([1, 2])/2;
x = newCM(1) + cos(thetaInRadians)*(tracksIn(:, 2) - oldCM(1)) - sin(thetaInRadians)*(tracksIn(:, 1) - oldCM(2));
y = newCM(2) + sin(thetaInRadians)*(tracksIn(:, 2) - oldCM(1)) + cos(the... |
e94f5975cd3e1933b44d70ec901066876438b41359d60cfa8dd9f2748e03d1bd | MATLAB | 425 | 17 | function mix = gtmfwd(net)
%GTMFWD Forward propagation through GTM.
%
% Description
% MIX = GTMFWD(NET) takes a GTM structure NET, and forward propagates
% the latent data sample NET.X through the GTM to generate the
% structure MIX which represents the Gaussian mixture model in data
% space.
%
% See also
% GTM
%
% C... |
c1acb787589d11ad9a83b7cef8a1012a2fe498a354a45c5f2912c520359f916f | MATLAB | 426 | 12 | function [rep_idx,num_el_in_column]=number_samples_at_index_211116(binvec,histcount)
% feed in a matrix, calculates number of non zero elements in each column
% and matches them to a time, returns repmat of times with non zero
% elements in each column
rep_idx=[];
for i=1:length(binvec(1,:))
num_el_in_colum... |
1657a06aaa5131a9396c989333201e40e59ea9f4ce1547d95406b115f60326cd | MATLAB | 427 | 18 | function Ybar = data_arrange(data)
M = size(data{1},1);
noSubjs = length(data);
Ybar = cell(1,noSubjs);
for subj = 1:noSubjs
Ybar{subj}(:,:,1) = zeros(M,M^2);
for t = 1:size(data{subj},2)-1
Ybart = zeros(M,M^2);
st = 1;
for m = 1:M
yt_1 = data{subj}(:,t);
Ybart(m... |
919c082f1d4f9add6993a0cf54f92fe212f2fc34503f6e846f99c6b5ed526502 | MATLAB | 428 | 28 | function ix = key2idx(O, k);
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
% this waits to be rewritten in C
if ~isa(k, 'cell')
k = { k };
end
keys = O.keys;
ix = zeros(length(k), 1);
for i = 1:length(k... |
29cf5b8406e7037455ff696a85bb51e4111049bdbf0bb810016c39f2f8fa06e8 | MATLAB | 429 | 18 | %Initializing Script
clear
clc
cd 'D:\PT_EEG_Analysis\'% go to the folder that contains all the scripts current directory
%% Initialize all variables that are specific to this project
Individualized_Info_PT_EEG();
cd 'D:\PT_EEG_Analysis\'
addpath(genpath('D:\PT_EEG_Analysis\eeglab14_0_0b\eeglab14_0_0b'... |
9f219a17c4479df80714d70a4d6b9b081610e4f7ecfd936b82d898e9e08efd42 | MATLAB | 429 | 13 | function fid=openmvf(filename)
% OPENMVF: opens a movement-file and reads the first line("trial")
% Synopsis
% fid=openmvf(filename)
% Description
% filename: a string signifying the filename to be loaded
% fid: File-ID of the open file. Use loadtrial to get
% trial by trial into memory
fid=fopen(filename... |
710c87ff52e2e15250017f0fc56f78a4053d3c459fdc9c5fa77cb5e481a53aae | MATLAB | 430 | 15 |
load(fullfile('Analysis','SynCrossCorrs'));
binsize = median(diff(bins));
fprintf('Finding synaptic connections \n');
[synLat,synStrZ,synStrR,bounds,ccg_conv] = FindSynapse_Exc(ccg,'synWin',[0 2],'alpha',0.01,'bins',binsize,'convwin',41,'excSigWin',0.4);
SaveAnalysis(pwd,'SynPairs_P01',{pairs, ccg, bins, sy... |
738e49fe717a34d05a98a4eb32e38efb8f5567c3c47ce3c965adfa93ac49bfca | MATLAB | 432 | 14 | function varargout = read_header_spm8(varargin)
% read_header:
% input: name of volume (full path , 1 x n string)
% output: header of volume
try
varargout{1} = spm_vol(varargin{:});
catch %#ok<CTCH>
disp(lasterr)
error(['Cannot read header, probably due to incompatibility ',...
... |
fe263619938427fa3dc9e97af4022f7895881dd3abd012f02b16aba17631f05f | MATLAB | 432 | 14 | function varargout = read_header_spm5(varargin)
% read_header:
% input: name of volume (full path , 1 x n string)
% output: header of volume
try
varargout{1} = spm_vol(varargin{:});
catch %#ok<CTCH>
disp(lasterr)
error(['Cannot read header, probably due to incompatibility ',...
... |
1fba092d8a9df88bfefe1a454a967e6db88ebfaddd61c862875024de00531ade | MATLAB | 433 | 14 | function varargout = read_header_spm8b(varargin)
% read_header:
% input: name of volume (full path , 1 x n string)
% output: header of volume
try
varargout{1} = spm_vol(varargin{:});
catch %#ok<CTCH>
disp(lasterr)
error(['Cannot read header, probably due to incompatibility ',...
... |
594f3170fd66ca0af39f659186adcce971ad264efead4fb2374e96e7c8f0b91f | MATLAB | 433 | 15 | function [ LapBin] = activity_map(binActivity,id,lapseq)
%ACTIVITY_MAP ´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª
% Generate the activity map by laps for individual neurons
neuronBinLapS = binActivity.neuronBinLapS;
[n, nbin, lapnum] = size(neuronBinLapS);
if nargin < 3
lapseq = 1:lapnum;
end
BinLap=ne... |
5fa71bfea6ee6e06c802e15e1c6790bc5a12736d7b560132be6e16d93ec93985 | MATLAB | 433 | 14 | function varargout = read_header_spm12(varargin)
% read_header:
% input: name of volume (full path , 1 x n string)
% output: header of volume
try
varargout{1} = spm_vol(varargin{:});
catch %#ok<CTCH>
disp(lasterr)
error(['Cannot read header, probably due to incompatibility ',...
... |
6163657e70cb4d702f5f48e30fe44380ad7fa6a965f0570656b9bf7292372ff2 | MATLAB | 434 | 13 | function check_result_fits_cfg(results, cfg)
% check analysis type
if ~isequal(results.analysis, cfg.analysis)
error('results.analysis=%s not equal cfg.analysis=%s', results.analysis, cfg.analysis)
end
% check datainfo (input data dimensions and voxel size)
if ~isequal(results.datainfo, cfg.datainfo)
disp(res... |
f82e45d23141222bfd006c2e23aa837cb519921a0afc26609f5064aad72087ca | MATLAB | 434 | 14 | function varargout = read_header_spm12b(varargin)
% read_header:
% input: name of volume (full path , 1 x n string)
% output: header of volume
try
varargout{1} = spm_vol(varargin{:});
catch %#ok<CTCH>
disp(lasterr)
error(['Cannot read header, probably due to incompatibility ',...
... |
2ca2905f750ae5398489bb0aa50ddfecf83a4d288d3c87980ed1062c939fe551 | MATLAB | 435 | 16 | function varargout = read_voxels_spm5(varargin)
% read_voxels:
% inputs: header, coordinates (n x 3 (XYZ))
% output: 1 x n vector of voxel values
if nargin >= 3
error('Third input for subvolumes provided. SPM5 cannot deal with 4D data. Please change cfg.software')
end
hdr = varargin{1};
... |
9607aa56d58de3bbdd62b5cebf9d918c19465e332a5abd7796acea5c1161a252 | MATLAB | 435 | 24 | function [l]=minloglikDNP(par,y,G,C_v,alfa,sel)
N=size(G,1);
Nl=size(G,2);
l2=exp(par(1));beta=exp(par(2));o2=1;%exp(par(3));
C=G*exp([zeros(1,alfa) -beta*[1:(Nl-alfa)]])';
[C_z]=l2*creaC_z(Nl,alfa,beta);
E=G*C_z*G';
M=E+o2*C_v;
Mi=inv(M);
A=Mi*(eye(N)-(sel==1)*C*inv(C'*Mi*C)*C'*Mi);
try
Ec=real(chol(M));
... |
3967185431274bee90a234a8d6379209e72cdd55533d501e635a78c24a491e35 | MATLAB | 436 | 23 | function [deg] = degrees_und(CIJ)
%DEGREES_UND Degree
%
% deg = degrees_und(CIJ);
%
% Node degree is the number of links connected to the node.
%
% Input: CIJ, undirected (binary/weighted) connection matrix
%
% Output: deg, node degree
%
% Note: Weight information is discarded.
%
%
% O... |
d97ef8d19c78f1c5676713a75e6eb42386047372771420441b58adf6cd3b00d6 | MATLAB | 437 | 21 | N = 1000;
T = 100;
P = 0.001;
BIN_SIZE = 50+300*2;
K_FOLD = 10;
for ii = 1:N
labels = binornd(1,0.25,1,T);
raster = binornd(1,P,BIN_SIZE,T);
% raster = binornd(1,0.0001,size(raster));
N = size(raster,2);
cross_val_sets = getNonOverlappingPartions(1:N,K_FOLD);
accuracy(ii) = train... |
0332dee0f2d8a6083b22218699801d70aee91ba947aae2a3bf5eba0ae5858af4 | MATLAB | 438 | 13 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function simplified_h= simplified_h(v, hpre, dt)
hinf = -0.4991*tanh(4.146+0.1243*v)+ 0.5015;
tauh = (-0.2334*v -3.... |
51fbc405b442fb53aad2954784f308f979477dc6e32b6f8b079f4b9ac74b26f5 | MATLAB | 438 | 20 | function [output] = smoothBeta (cfg, input)
if ~isfield(cfg,'feedback')
cfg.feedback= 'no';
else end
output = input;
nTrials = size(input.trial,2);
smoothwin = input.fsample * cfg.smoothwin;
for iTrial= 1:nTrials
output.trial{1,iTrial}=movmean(input.trial{1,iTrial},smoothwin,2);
end
if strcmp(cfg.feedback, '... |
6f94d41c29eb4c077362ed10955f13589030e0e89ebdc605b8a71fa57346e470 | MATLAB | 438 | 22 | function tsp = timeSpan(is)
% Returns the minimum continuous interval that contains the intervalSet
%
% USAGE
% tsp = timeSpan(is)
%
% INPUTS:
% is - an interval set
%
% OUTPUTS:
% tsp - the time span intervalSet
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the... |
0d82f48480128fafff7391e7cbf889803826781f9c49302664ac92fdebc7cae2 | MATLAB | 439 | 21 | function awsMkDir(myDir, cleanUp)
%This function will make dir if it doesnt exist (either in AWS or locally)
%When cleanUp set to true (default) will delete dir content prior to
%creating folder
%% Input checks
if ~exist('cleanUp','var')
cleanUp = true;
end
%% Create dir
%Cleanup if required
if (cle... |
22b9544edb07d4dfb5f887e67337099589761f75b8f866e7d33ac40412aa0f1e | MATLAB | 439 | 16 | initOAT;
SR = SpikeReader('../results/spk_MEC_LII_Stellate.dat');
spikes = SR.readSpikes(1); X=[]; Y=[];
T=size(spikes,1); % time to plot
fn = 1; % first neuron to plot
N=49; % number of spikes to plot
%for y=1:T
%for y=1:30000
for y=2400:2600%30000
for x=fn:(fn+N)
if spikes(y,x+fn)==1 X=[X;x+fn]; Y=[Y;y]; end
end
e... |
498b0156a29b09000a6f80243aeeb46703354a6bcd125e1ffdf7d335332905a0 | MATLAB | 439 | 18 | function sliderMoving_tracks_s_3
global framenum
global slice
global text_timepoint
global text_slice
global text_spot_num
global I
global wholestack_s
global shown_fig
set(text_timepoint,'String',['time = ' num2str(framenum)])
set(text_slice,'String',['slice = ' num2str(slice)])
set(text_spot_num,'String'... |
7822a864b988b1632a40d34051afbc78ac6aa35bf05bb61aaf29c4782141a3ca | MATLAB | 439 | 12 |
for i = 1:length(tracks)
bbox = tracks(i).bbox;
% Predict the current location of the track.
predictedCentroid = predict(tracks(i).kalmanFilter);
% Shift the bounding box so that its center is at
% the predicted location.
predictedCentro... |
3742d206cf41d62ee94cc660f93c3ba3c75bd01266c56cf67b3c958058e043af | MATLAB | 440 | 19 | function w = rbfpak(net)
%RBFPAK Combines all the parameters in an RBF network into one weights vector.
%
% Description
% W = RBFPAK(NET) takes a network data structure NET and combines the
% component parameter matrices into a single row vector W.
%
% See also
% RBFUNPAK, RBF
%
% Copyright (c) Ian T Nabney (1996-2001... |
5d481a170836d0c52f3320e4e11dd99eae2654183db1bedc9804fba5fb270ccc | MATLAB | 441 | 17 | function varargout = read_voxels_spm2(varargin)
% read_voxels:
% inputs: header, coordinates (n x 3 (XYZ))
% output: 1 x n vector of voxel values
if nargin >= 3
error('Third input for subvolumes provided. SPM2 cannot deal with 4D data. Please change cfg.software')
end
hdr = varargi... |
a68e5909152498fa6acf535a76fb47da7086aa5f6989071568dc081c2a537a4f | MATLAB | 442 | 13 | function cutBounds = CutBounds(sz, bounds, buffer)
badBounds = [];
for i = 1:length(bounds)
currBound = bounds{i};
flag = double(currBound(:, 2) + buffer > sz(1)) + double(currBound(:, 1) + buffer > sz(2)) + ...
double(currBound(:, 2) - buffer < 1) + double(currBound(:, 1) - buffer < 1) > 0;
if sum(... |
cfeda310299565cbd31d920fd8008db8ed4b438f2ebe4cb9d85e59a43bba8762 | MATLAB | 443 | 18 | function ms = msCleandFFTraces(ms)
%MSCLEANDFFTRACES Summary of this function goes here
% Detailed explanation goes here
ms.originalTrace = ms.trace;
[bFilt,aFilt] = butter(2, 2/(30/2), 'low');
F = ms.trace - repmat(ms.dFFBaseline,1,ms.numSegments);
F = filtfilt(bFilt,aFilt,F);
F=detrend(F);
... |
c9580ad3a41e9cde43291319009fa3822ed87988418010f2910d054355decb06 | MATLAB | 445 | 22 | % compute the maximum likelihood estimate of global trend
% For testing
% load('intermediateOutputsCombined.mat');
% calcDWTMatrix(dc.dataTimeSeries);
function theta = calcMLETrend(Y,X)
theta = 1;
W = calcDWTMatrix(X,J0);
n0 = 2^(-J0+1)*N;
eyeN0 = eyes(n0);
bottomLeftA = zeros(N-n0,n0);
... |
962a3aa73622e0ac32e1487de9e86daf16b7cd3e406474b1fda969c0c90599f5 | MATLAB | 446 | 18 | function msAlignmentHistogram(ms,bins)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
if (isempty(bins))
bins = -20:20;
end
alignH2 = hist2(ms.hShift ,ms.wShift,bins,bins);
pcolorCentered(bins,bins,log10(alignH2));
colormap jet
% colorbar
xlabel('Hor... |
0af306a5c6cbc4323b71a91d386d95cfbd68b74360834758c98110021b38fbbf | MATLAB | 447 | 24 | function row = ShapeAsRow(sig)
% ShapeAsRow -- Make signal a row vector
% Usage
% row = ShapeAsRow(sig)
% Inputs
% sig a row or column vector
% Outputs
% row a row vector
%
% See Also
% ShapeLike
%
row = sig(:)';
%
% Part of Wavelab Version 850
% Built Tue Jan 3 13:20:43 ES... |
b62f36629249755bdaf6165636a2e721b90c1794d727c408b50523baa936a638 | MATLAB | 448 | 23 | function is = timeSpan(S)
% Returns interval spanning the duration of the tsdArray
%
% USAGE:
% is = timeSpan(tsa)
%
% OUTPUT:
% is - an intervalSet object
%
% copyright (c) 2009 Adrien Peyrache adrien.peyrache@gmail.com
T_start = inf;
T_end = -inf;
for iC = 1:length(S.C)
if ~isempty(Data(S.C{iC})... |
d31ae78f6b838b5301477e25081f08e111b417b2d19d39ac3c9fc7562c1a0503 | MATLAB | 448 | 13 | subj = init_subj('','');
subj = create_anatomical_regions( ...
subj, {}, ...
'/jukebox/osherson/mattheww/BA_briks_tlrc/', ...
'401_MPRAGE_r5_at+tlrc', ...
'401_mask_d2+orig', ...
'clean_up_briks', false);
subj = initset_object(subj,'mask','wholevol', ones(64,64,33) );
subj = load_afni_pattern(subj... |
4f0762bee45c121561c4107023bf23044b40b8cb7fdcf8a0f9936475cfc9cb33 | MATLAB | 449 | 19 | function w = mdnpak(net)
%MDNPAK Combines weights and biases into one weights vector.
%
% Description
% W = MDNPAK(NET) takes a mixture density network data structure NET
% and combines the network weights into a single row vector W.
%
% See also
% MDN, MDNUNPAK, MDNFWD, MDNERR, MDNGRAD
%
% Copyright (c) Ian T Nabney... |
116761cd90f8da8e3bb3e14606d7589fbd3f2ab9f8146bf65dcb724a3f42b8a3 | MATLAB | 450 | 13 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function simplified_p= simplified_p(v, ppre, dt, Vt)
pinf = 0.5*tanh(-0.9378+((2^-6)+(2^-5))*(x-(-55)))+0.5001;
taup ... |
4648182fb0364f0b61e26c71af6063885ef64e31c74ad66561d9101ea7478d87 | MATLAB | 450 | 13 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function simplified_q= simplified_q(v, qpre, dt)
inf = ((0.000297*v +0.5059)*tanh(3.749 + 0.1119*v))+0.4824;
tau = ... |
18ad1043441e3506aa3f224b827a86db95d040814606ca7423dd7a7a703316c8 | MATLAB | 451 | 17 | function awsRmDir(myDir)
%This function will remove dir if it exists (either in AWS or locally)
if isempty(myDir)
error('Cannot delete an empty dir');
end
if ~awsIsAWSPath(myDir)
myDir = awsModifyPathForCompetability(myDir);
if exist(myDir,'dir')
rmdir(myDir,'s');
end
else
aws... |
4c00d91e61ddf3937a4ef02580be5b876ef018087a562f2c8b740829933b1499 | MATLAB | 451 | 17 | function resetSubmodules(repo)
% The main use of resetSubmodules is a tool to quickly reset the state
% of libraries when debugging issues in syncSubmodules
if ~exist('repo','var') || isempty(repo)
repo = pwd;
end
repoFull = filesepStandard_startup(repo,'full');
submodules = parseGitSubmodulesFile(repoFull);
cd(re... |
65cacfb59de1359591b7866dcd51408b29928fa1a8cd758a305c400df0d2c8a4 | MATLAB | 451 | 14 | function ErrArea_Smooth(X,Y,ERR,LineColor)
err=fill([X;flipud(X)],[Y-ERR;flipud(Y+ERR)],LineColor(1:3),'linestyle','none');
% set(gco,'linestyle','none')
% Choose a number between 0 (invisible) and 1 (opaque) for facealpha.
if length(LineColor)==4
coloralpha=LineColor(4);
else
coloralpha=.2;
end
se... |
6e9c25ed32aedf50e6cb069c73610f270d7f9457e68abb9a1c312d14034df742 | MATLAB | 451 | 18 | function Edges = findedges(X, nk, distancetype)
if nargin == 1
nk = 3;
distancetype = 'correlation';
elseif nargin == 2
distancetype = 'correlation';
end
nP = size(X, 1);
[Idx, pDist] = knnsearch(X, X, 'K', nk+1, 'Distance', distancetype);
Idx = Idx(:, 2:end);
pDist = pDist(:, 2:end);
% pairs =... |
8def900f14fe6f370c0a7a4bd7df531aa74ca9c673d7a5090ca232355a6596d3 | MATLAB | 452 | 13 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function simplified_mV2= simplified_mV2(v, mpre, dt, Vt)
minf = 0.5*tanh(-1.718+(2^-4 + 2^-8)*(v-Vt))+0.4976;
taum ... |
b405215403ce48823233470b77f3b80005f05da89987436c7c2ebdf320cfc302 | MATLAB | 452 | 13 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function simplified_nV2= simplified_nV2(v, npre, dt, Vt)
ninf = (2^-1)*tanh(-1.128+((2^-5)+(2^-6))*(v-Vt))+ 0.4675;
ta... |
1bf7139d54b109790577d26ef31b472ed7a91407886145df117e6a317d362497 | MATLAB | 453 | 24 | function H = hsvOccMap(occH,varargin)
%Adrien Peyrache, 2012
slope = 10;
offSet = 0.7;
if ~isempty(varargin)
offSet = varargin{1};
end
H = zeros(size(occH,1),size(occH,2),3);
%pure empirical definition that works best
if min(occH) == max(occH)
occH = ones(size(occH));
else
occH = (occH-min(occH(:))... |
5d2872841c97aa4763dc89cd3d93ce585efbf43700f2d9bbd16f79040ce764b6 | MATLAB | 453 | 16 | function z = outerprod(x, y, varargin)
% OUTERPROD - Multiply two or more arrays to form an outer product.
% Singular dimensions are ignored and automatically squeezed.
%
% Author: Gunnar Farnebäck
% Medical Informatics
% Linköping University, Sweden
% gf@isy.liu.se
dims = [size(x) ... |
6732eca0540511f318d9061cef45ce5b8965e251cac46e36a5728d6dc6047f5f | MATLAB | 453 | 13 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function simplified_n= simplified_n(v, npre, dt)
ninf = (0.001451*v +0.5208)*tanh(1.833+0.05311*v)+ 0.3959;
taun = ... |
d108297277d1a6d366ca4fabe73b33ac94802e8b7b97392f7d675bbb18de12d3 | MATLAB | 453 | 20 | function [xo] = zscore_independent( x )
% *WAVE*
%
% ZSCORE INDEPENDENT returns the z-score of each channel in the datacube
%
% INPUT
% x - datacube (r,c,t)
%
% OUTPUT
% xo - z-scored datacube (r,c,t)
%
assert( ndims(x) == 3, 'datacube input required' );
% get matrices of mean and std
mu = mean( x, 3 ); sigma = std(... |
2d546cff29e00bbab7aabf82c21d202a0a4f92433955c3e988b8a811563da8dd | MATLAB | 454 | 42 | function KL = ClusterLink(L)
ncl = size(L,1);
KL = cell(1, ncl);
done = 0;
for i = 1:ncl
KL{i} = [i];
end
while ~done
done = 1;
for i = 1:ncl
for j = (i+1):ncl
if(sum(sum(L(KL{i},KL{j}))) > 0 )
KL{i} = unique([KL{i}, KL{j}]);
KL{j} = [];
done = 0;
end
end
end
ncl = len... |
c68d4ae97dcd4cf486b25364ac5aea6bf6a5d64690af062cab904ab3926948bd | MATLAB | 455 | 18 | % *WAVE*
%
% FIND AMPLIUDE EPOCHS TEST SCRIPT tests the find amplitude epochs function
% with some simple exmaple data
%
clear all; clc %#ok<CLSCR>
% generate test data
a = zeros( 1, 1000 );
for ii = 1:4, a( (1:100)+(100*2*ii) ) = 1; end
a = repmat( a, [64 1] ); a = reshape( a, 8, 8, 1000 );
% test find... |
44d118289c291dc0ca016a163f2e4dc5b550cf2fc08245a1371aca031da2fe50 | MATLAB | 456 | 17 | function sy=smooth_kernel(y,sigma);
% function y=smooth_kernel(y,sigma);
% runs a gaussian smoothing kernel over the data
% Does not introduce a time shift
% FWHM = 2 * sqrt(2*log(2)) * sigma
N=round(sigma*5)*2;
x=[1:N];
v=normpdf(x,(N)/2,sigma);
[rows,cols]=size(y);
for c=1:cols
pb(1:length(v)-1)=y(1,c);... |
8c77f0b06c6fff54b8680f34396431cf8748ed908edc1bd544edfe14ae0286de | MATLAB | 458 | 23 | function is = toIntervalSet(tsa)
% Returns the intervalSet delimited by the timestamps f a TSD
%
% USAGE:
% is = toIntervalSet(tsa)
%
% INPUTS:
% tsa - a tsd object
%
% OUTPUTS:
% is - the intervalSet where each interval is of the form [tsd(i) tsd(i+1)]
% copyright (c) 2004 Francesco P. Battagl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.