|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.util.MomentsFocusser
public class MomentsFocusser
This class uses maximization of ADU moments to obtain a best focus. Its
mechanism of offsetting the focus are unspecified, but a CCD must be
present in order to obtain images from which ADU statistics can be drawn.
Additionally, a method must be present that allows a crude estimate of the
focus position. This can be done with a temperature model, but any other
mechanism is allowed, as long as it adheres to crudeFocus().
| Nested Class Summary | |
|---|---|
static class |
MomentsFocusser.IntExt
This class takes a extra focal and an intra focal image and calculates the focus that follows from the A4 parameter. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private CcdDriver |
ccd
The CCD to take images with. |
private static double |
DEFA4ERROR
Default A4 error (2011-10-14). |
private static double |
DEFA4SLOPE
Default A4 slope (2011-10-14). |
private static Dimension |
DEFADUSIZE
The default size around the bright spot. |
private static Dimension |
DEFBLOBSIZE
The default blob size. |
private static boolean |
DEFDOSAVE
If true we save the indivdual images during focus. |
private static boolean |
DEFDOSEARCH
If temperature model is accurate enough, we can skip the search. |
private static double |
DEFERRORZERNIKE
Default always do sequence. |
private static double |
DEFEXPOSEFOCUS
The default S/N on acquire. |
private static int |
DEFEXTENSION
The moment during fine focus. |
private static Dimension |
DEFFOCUSBINNING
The default binning on acquire. |
private static int |
DEFFOCUSORDER
The moment during fine focus. |
private static double |
DEFHIGHSKYSIGMA
Per default we do not do ADU rejection, thus this is zero. |
private static double |
DEFLOWSKYSIGMA
Per default we do not do ADU rejection, thus this is zero. |
private static boolean |
DEFMEDIANSKY
Default we use median for sky-level determination. |
private static String |
DEFMOMENTS
Default moments parameter name. |
private static int |
DEFSEARCHORDER
The moment during coarse focus. |
private static int |
DEFSEARCHSTEPS
Default half-number of search steps. |
private static int |
DEFSKYFRAME
The defautl sky frame size. |
private static String |
DEFUNIQUE
Default unique parameter name. |
private static double |
DEFZERNIKESTEP
Default no extra Zernike images. |
private static double |
DEFZEXPOSE
Default no extra increase in exposure time on Zernikes. |
private long |
expt
The exposure time in ms calculated once per focus sequence. |
static String |
EXTRAFOCAL
Extension for extrafocal image in Zernike coefficient determination. |
static String |
INTRAFOCAL
Extension for intrafocal image in Zernike coefficient determination. |
static String |
KEY_A4ERROR
This is the error estimate for A4 slope. |
static String |
KEY_A4SLOPE
This is the slope of A4 versus steps. |
static String |
KEY_ADUSIZE
The box to scan for A4. |
static String |
KEY_BLOBSIZE
The default blob size. |
static String |
KEY_CCD
The name of the ccd to use. |
static String |
KEY_DOSAVE
Save the focus sequence images. |
static String |
KEY_DOSEARCH
Once the temperature model is accurate enough, we do not search. |
static String |
KEY_ERRORZERNIKE
If the zernike error is below this, we spare the sequence. |
static String |
KEY_EXTENSION
The extension with best signal if more than one amplifier. |
static String |
KEY_FOCUSBINNING
The binnning for focus images. |
static String |
KEY_FOCUSFRAME
The frame for focus images. |
static String |
KEY_FOCUSOFFSET
The offset from the optimal focus for image 1&2. |
static String |
KEY_FOCUSORDER
The moment during fine focus. |
static String |
KEY_HIGHSKYSIGMA
If greather than zero, the high bound sigma for background rejection. |
static String |
KEY_LOWSKYSIGMA
If greather than zero, the low-bound sigma for background rejection. |
static String |
KEY_MAXFOCUSEXPOSE
If the exposure time required for moments exceed this, do T only. |
static String |
KEY_MEDIANSKY
If true, use median in background frame. |
static String |
KEY_MOMENTS
The name of the fits moments to use. |
static String |
KEY_MOMENTSFRAME
The frame for focus moments, smaller than image frame. |
static String |
KEY_SEARCHOFFSET
The step with, if focus model is bad. |
static String |
KEY_SEARCHORDER
The moment during coarse focus. |
static String |
KEY_SEARCHSTEPS
The number of search steps in either direction. |
static String |
KEY_SKYFRAME
The default sky frame size. |
static String |
KEY_STEP0
The focus position for focus temperture T0. |
static String |
KEY_STEPTEMP
Per degree difference to T0, we add this number of steps. |
static String |
KEY_TEMP0
At this temperature, optimal focus is at step0. |
static String |
KEY_TEMPERATURE
The name of the temperature to use. |
static String |
KEY_UNIQUE
The name of the unique parameter. |
static String |
KEY_ZERNIKESTEP
If this multiplier to searchsteps is greater 0, we do Zernikes. |
static String |
KEY_ZEXPOSE
Multiplier to nominal exposure time for extra/intra focal Zernike. |
private FitsMoments |
moments
The fits-moments parameter. |
private Focusable |
telescope
The object that allows me to set the focus. |
private Value |
temp
The value that delivers the temperature relevant for focus model. |
private Parameter |
unique
The unique parameter. |
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Constructor Summary | |
|---|---|
MomentsFocusser(Map<String,String> prop)
Constructor chaining. |
|
| Method Summary | |
|---|---|
private double |
coarseFocus()
In the coarse focus, we do a temperature model, even if very inaccurate, then procced to in and out with #KEY_SEARCH step, doing a
image on the small frame along the offsets. |
protected double |
crudeFocus()
We position the linear sledge at the temperature model focus. |
ErrorEvent |
doFocus()
Task of this object is to auto focus after a successful acquire. |
private double |
doZernikes(double zernike,
double pos0)
Does two zernike out-of-focus image and returns true if the focus obtained is good enough. |
private Double[] |
getMomentAt(double step,
int order,
String fext)
We position the linear stage at the indicated step, take an image with the CCD camera on the #KEY_FOCSUFRAME and calculate the moments
of this image. |
private Double |
getMomentValue(CentralMoments cm,
int order)
Gets the requested value from our central moments. |
boolean |
isReady()
Checks, if all required values and objects are in place, sparing expt. |
boolean |
isValid()
Checks, if all required values and objects are in place. |
boolean |
registerDriver(Driver d)
If this driver is a ccd and its name equals KEY_CCD. |
void |
registerExposureTime(long ms)
The exposure time is set from the outside. |
void |
registerFocus(Focusable f)
We register the object that can set a focus position. |
void |
registerParameter(Parameter p)
We use the parameter, if it is a fitsmoments and if the name agrees with the property KEY_MOMENTS |
private double |
scanA4(nom.tam.fits.Fits ff,
int use)
We calculate the A4 parameter from second image moments following Equation 5 in PASP118, 1165, but without pixel scaling. |
private nom.tam.fits.Fits |
takeSingleImage(CcdDriver ccd,
long ms,
Dimension bin,
String store)
Takes a single image, stores it, if desired. |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, init, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Methods inherited from interface util.Initializable |
|---|
init |
| Field Detail |
|---|
public static final String EXTRAFOCAL
public static final String INTRAFOCAL
public static final String KEY_UNIQUE
public static final String KEY_MOMENTS
public static final String KEY_TEMPERATURE
public static final String KEY_CCD
public static final String KEY_FOCUSOFFSET
public static final String KEY_FOCUSORDER
public static final String KEY_EXTENSION
public static final String KEY_SEARCHSTEPS
public static final String KEY_SEARCHOFFSET
public static final String KEY_SEARCHORDER
public static final String KEY_DOSEARCH
public static final String KEY_FOCUSFRAME
public static final String KEY_MOMENTSFRAME
public static final String KEY_FOCUSBINNING
public static final String KEY_MAXFOCUSEXPOSE
public static final String KEY_STEP0
public static final String KEY_TEMP0
public static final String KEY_STEPTEMP
public static final String KEY_DOSAVE
public static final String KEY_ZERNIKESTEP
public static final String KEY_ZEXPOSE
public static final String KEY_A4SLOPE
public static final String KEY_A4ERROR
public static final String KEY_BLOBSIZE
public static final String KEY_ADUSIZE
public static final String KEY_SKYFRAME
public static final String KEY_MEDIANSKY
public static final String KEY_LOWSKYSIGMA
public static final String KEY_HIGHSKYSIGMA
public static final String KEY_ERRORZERNIKE
private static final String DEFUNIQUE
private static final String DEFMOMENTS
private static final int DEFSEARCHSTEPS
private static final boolean DEFDOSEARCH
private static final double DEFEXPOSEFOCUS
private static final int DEFSEARCHORDER
private static final int DEFFOCUSORDER
private static final int DEFEXTENSION
private static final Dimension DEFFOCUSBINNING
private static final boolean DEFDOSAVE
private static final double DEFZERNIKESTEP
private static final double DEFZEXPOSE
private static final double DEFA4SLOPE
private static final double DEFA4ERROR
private static final Dimension DEFBLOBSIZE
private static final Dimension DEFADUSIZE
private static final int DEFSKYFRAME
private static final boolean DEFMEDIANSKY
private static final double DEFLOWSKYSIGMA
private static final double DEFHIGHSKYSIGMA
private static final double DEFERRORZERNIKE
private Parameter unique
private Value temp
private FitsMoments moments
private long expt
private Focusable telescope
private CcdDriver ccd
| Constructor Detail |
|---|
public MomentsFocusser(Map<String,String> prop)
| Method Detail |
|---|
public void registerParameter(Parameter p)
KEY_MOMENTS
registerParameter in interface ParameterDependingpublic boolean registerDriver(Driver d)
KEY_CCD.
registerDriver in interface DriverDependingpublic void registerFocus(Focusable f)
public void registerExposureTime(long ms)
public boolean isValid()
public boolean isReady()
protected double crudeFocus()
public ErrorEvent doFocus()
private double coarseFocus()
#KEY_SEARCH step, doing a
image on the small frame along the offsets. For each image, the value
of the KEY_SEARCHORDER moment is recorded, in this list the
maximum is found. From this maximum and from its neighbouring values,
a parabola is fit through this three points, the maximum is the new
focus, which we also set. If the maximum value in the original sequence
is at the edge, we return a value slightly inside, depending on
the two inner points to the maximum.
private double doZernikes(double zernike,
double pos0)
private double scanA4(nom.tam.fits.Fits ff,
int use)
throws nom.tam.fits.FitsException,
IOException
A4 = sqrt(Mx+My), with
Mx,y = Σ(x,y_ij-x,y_c)^2*ADU_ij/ΣADU_ij
Centered on the brightest pixel blob in the image, we use a rectangle
of size KEY_ADUSIZE and around that a #SKYFRAME thick
frame for background determination. The background is either the
median or the mean of the ADUs in the sky frame, the RMS estimate
is either the quartile-sigma or the standard deviation. The two
values KEY_LOWSKYSIGMA and KEY_HIGHSKYSIGMA define
which range of ADUs should be considered background. This background
count is removed from the image prior to calculating the moments.
nom.tam.fits.FitsException
IOException
private nom.tam.fits.Fits takeSingleImage(CcdDriver ccd,
long ms,
Dimension bin,
String store)
private Double[] getMomentAt(double step,
int order,
String fext)
#KEY_FOCSUFRAME and calculate the moments
of this image. The value returned is the indicated central normalized
moment, except for 1 that returns the average and 2 returns the square
root of the variance. If the positioning fails (or if the requested
position is out of range) null is returned.
private Double getMomentValue(CentralMoments cm,
int order)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||