wf_net | R Documentation |
Perform post-processing of phase and modulation estimates performed by any of the fringe analysis routines
wf_net(phi, mod, cp, options)
phi |
wrapped phase map |
mod |
modulation estimate |
cp |
a list describing the pupil boundary |
options |
a list of options. See |
Called by psifit, vortexfit, fftfit
.
This now performs all of the post-processing on a calculated wrapped phase
and modulus estimate from any of the fringe analysis routines in this package.
This includes calculating the actual interferogram location parameters if
not specified at call time, cropping if desired, unwrapping the phase,
calculating a net and Zernike fit wavefront.
A list with the following components:
phi |
the input phase, cropped if requested |
mod |
the input modulus |
cp |
interferogram location parameters as returned by |
cp.orig |
input cp |
wf.net |
Net unsmoothed wavefront; a matrix of class |
wf.smooth |
Net smoothed wavefront |
wf.residual |
Difference between net wavefront and polynomial fit |
fit |
Return value from |
zcoef.net |
Net Zernike coefficients from fit |
As of ver. 3.7.2 the values of options$isoseq
and cp$obstruct
determine what is called to fit Zernikes.
If isoseq
is TRUE
it's either zpm_cart
or zapm_cart
, with the latter
called automatically if cp$obstruct > 0
. Otherwise the calls are made to
zpm
or zapmC
.
M.L. Peck mpeck1@ix.netcom.com
## illustrates effect of incremental addition of an obstruction
## and standalone use of wf_net
require(zernike)
fpath <- file.path(find.package(package="zernike"), "psidata")
files <- scan(file.path(fpath, "files.txt"), what="character")
for (i in 1:length(files)) files[i] <- file.path(fpath, files[i])
# load the images into an array
images <- load.images(files)
# parameters for this run
source(file.path(fpath, "parameters.txt"))
# phase shifts
phases <- wrap((0:(dim(images)[3]-1))/frames.per.cycle*2*pi)
phases <- switch(ps.dir, ccw = -phases, cw = phases, phases)
# target SA coefficients for numerical null.
sa.t <- sconic(diam,roc,lambda=wavelength)
zopt <- psfit_options(satarget=sa.t)
psfit <- psifit(images, phases, psialg="ls", options=zopt)
# get back the raw wavefront
cp <- psfit$cp
eps <- seq(0.1, 0.5, by=0.1)
ne <- length(eps)
pad0 <- rep(0, ne)
## collect some basic data
df.annfits <- data.frame(eps=c(0, eps), sa.null = c(sa.t[1], pad0), sa.obs = c(psfit$fit[9], pad0), sa.net = c(psfit$zcoef.net[8], pad0),
rms.net = c(sqrt(crossprod(psfit$zcoef.net)), pad0), defocus=c(psfit$fit[4], pad0))
for (i in seq_along(eps)) {
cp$obstruct <- eps[i]
sa.t <- sconic(diam, roc, eps=eps[i], lambda=wavelength)
zopt$satarget <- sa.t
fiti <- wf_net(psfit$phi, psfit$mod, cp=cp, options=zopt)
df.annfits[i+1, 2:ncol(df.annfits)] <- c(sa.t[1], fiti$fit[9], fiti$zcoef.net[8], sqrt(crossprod(fiti$zcoef.net)), fiti$fit[4])
}
rm(eps)
attach(df.annfits)
X11()
plot(eps, sa.null, type="b", ylim=range(df.annfits[,2:ncol(df.annfits)]), xlim=c(0, 0.8), main="Trends with obstruction fraction")
points(eps, sa.obs, type="b", pch=2, col=2, lty=2)
points(eps, sa.net, type="b", pch=3, col=3, lty=3)
points(eps, rms.net, type="b", pch=4, col=4, lty=4)
points(eps, defocus, type="b", pch=5, col=5, lty=5)
grid()
legend(x=0.6, y=0, legend=names(df.annfits)[-1], col=1:5, lty=1:5, pch=1:5)
## plot the first and last smoothed wavefronts to show difference is completely symmetrical
plotn(psfit, fiti, wftype="smooth", qt=c(0,1))
detach(df.annfits)
print(df.annfits, digits=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.