get_clusters_3d.RdThis function extracts events from a three-dimensional (2D spatial x 1D time) data stream.
get_clusters_3d(dat, thres = 0.95, epsilon = 3, miniPts = 15)The data matrix
The cut-off quantile. Default is set to 0.95. Values greater than the quantile will be clustered. The rest is not clustered.
The eps parameter in dbscan function in the package dbscan
The minPts parameter in dbscan function in the package dbscan
A list with following components
clustersThe cluster assignment according to DBSCAN output.
dataThe data of this cluster assignment.
set.seed(1)
arr <- array(rnorm(12000),dim=c(40,25,30))
arr[25:33,12:20, 20:23] <- 10
# getting events
out <- get_clusters_3d(arr, thres=0.985)
# plots
oldpar <- par(mfrow=c(1,3))
plot(out$data[,c(1,2)], xlab="x", ylab="y", col=as.factor(out$clusters$cluster))
plot(out$data[,c(1,3)], xlab="x", ylab="z",col=as.factor(out$clusters$cluster))
plot(out$data[,c(2,3)], xlab="y", ylab="z",col=as.factor(out$clusters$cluster))
par(oldpar)