lightFilter | R Documentation |
The filter identifies and removes light intensities oczillating around the
baseline or few light intensities resulting in a short light peak during the
night. Such noise during the night will increase the calculated twilight
events using the function twilightCalc
and therewith the
manual work to remove these false twilight events.
lightFilter(light, baseline = NULL, iter = 2)
light |
|
baseline |
the light intensity baseline (no light). If |
iter |
a |
The filter searches for light levels above the baseline and compares the prior and posterior levels. If these values are below the threshold the particular light level will be reduced to the baseline. A few (usually two) iterations might be enough to remove most noise during the night (however, not if such noise occurs at the begining or at the end were not enough prior or posterior values are available).
numerical vector
with the new light levels. Same length as
the initial light vector.
Simeon Lisovski
night <- rep(0,50); night[runif(4,0,50)] <- 10; night[runif(4,0,50)] <- -5
nightday <- c(night,rep(30,50))
plot(nightday,type="l",ylim=c(-5,30),ylab="light level",xlab="time (time)")
light2 <- lightFilter(nightday, baseline=0, iter=4)
lines(light2,col="red")
legend("bottomright",c("before","after"),lty=c(1,1),col=c("black","red"),bty="n")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.