R: Filter to remove noise in light intensity measurements during...
lightFilter
R Documentation
Filter to remove noise in light intensity measurements during the night
Description
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.
Usage
lightFilter(light, baseline = NULL, iter = 2)
Arguments
light
numerical value of the light intensity (usually
arbitrary units).
baseline
the light intensity baseline (no light). If Default,
it will be calculated as the most frequent value below the mean light
intensities.
iter
a numerical value, specifying how many iterations should
be computed (see details).
Details
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).
Value
numerical vector with the new light levels. Same length as
the initial light vector.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GeoLight)
Loading required package: maps
# maps v3.1: updated 'world': all lakes moved to separate new #
# 'lakes' database. Type '?world' or 'news(package="maps")'. #
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GeoLight/lightFilter.Rd_%03d_medium.png", width=480, height=480)
> ### Name: lightFilter
> ### Title: Filter to remove noise in light intensity measurements during
> ### the night
> ### Aliases: lightFilter
>
> ### ** Examples
>
> 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")
>
>
>
>
>
> dev.off()
null device
1
>