public abstract class FocussingMoments extends FocussingUnit implements Abortable
#crudeFocus.| Modifier and Type | Class and Description |
|---|---|
static class |
FocussingMoments.Zernike
From a recorded Zernike fits, call scanA4.
|
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static String |
A4MOM |
private static String |
A4MOMREM |
private boolean |
abort
Abort ongoing focus sequence.
|
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 Rectangle |
DEFBLOBFRAME
The default blob frame.
|
private static Dimension |
DEFBLOBSIZE
The default blob size.
|
private static double |
DEFCOARSEACCEPT
Default always do sequence.
|
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 |
DEFERRORCRUDE
Default temperature focusing error in steps.
|
private static double |
DEFEXPOSEFOCUS
The default S/N on acquire.
|
private static Dimension |
DEFFOCUSBINNING
The default binning on acquire.
|
private static int |
DEFFOCUSORDER
The moment during fine focus.
|
private static String |
DEFFWHMMEASURE
Default fwhm measure parameter name.
|
private static Dimension |
DEFFWHMSIZE
The default size around the bright spot.
|
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 focus temperature 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 double |
DEFZERNIKEACCEPT
Default always do sequence.
|
private static double |
DEFZERNIKESTEP
Default no extra Zernike images.
|
private static double |
DEFZEXPOSE
Default no extra increase in exposure time on Zernikes.
|
private long |
exptms
The exposure time in ms calculated once per focus sequence.
|
static String |
EXTRAFOCAL
Extension for extrafocal image in Zernike coefficient determination.
|
private static String |
FOCMOM |
private static String |
FOCMOMREM |
private static String |
FWHMGAUSS |
private static String |
FWHMGAUSSREM |
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_BLOBFRAME
The frame for searching blobs, smaller than image frame.
|
static String |
KEY_BLOBSIZE
The default blob size.
|
static String |
KEY_COARSEACCEPT
If the coarse error is below this, we spare the sequence.
|
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_ERRORCRUDE
Estimated focussing error on crude focus.
|
static String |
KEY_EXPOSEFOCUS
The S/N for focus.
|
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_FWHMMEASURE
The name of the fwhm measurement parameter to use.
|
static String |
KEY_FWHMSIZE
The box to scan for fwhm.
|
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 width, 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_ZERNIKEACCEPT
If the zernike error is below this, we spare the sequence.
|
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 FwhmMeasure |
measfwhm
We also measure the FWHM in the final focus image.
|
private FitsMoments |
moments
The fits-moments parameter.
|
static String |
SEARCH
If the mode quals search, we always do an extensive search.
|
private static String |
SETFOCUS |
private static String |
SETFOCUSREM |
increaseACQUIRETYPE, GUIDERTYPE, PYRAMIDTYPEKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOMECONFIG, KEY_CLASS| Modifier | Constructor and Description |
|---|---|
protected |
FocussingMoments(Map<String,String> prop)
Constructor chaining.
|
| Modifier and Type | Method and Description |
|---|---|
protected ErrorEvent |
doFocusTask(String mode)
Task of this unit is to auto focus after a successful acquire.
|
private Vector2D |
doZernikes(double zernike,
double pos0)
Does Zernike focussing using A4.
|
protected abstract double |
getCrudeFocus()
This method estimates a first crude focus and returns this
position in arbitrary units, which my be millimeters or steps or even
non-linear units.
|
private double |
getFwhm(MImageHDU f0) |
abstract double |
getMaximumFocus()
Returns the maximum focus position to avoid focus underruns.
|
abstract double |
getMinimumFocus()
Returns the minimum focus position to avoid focus underruns.
|
private Pair<Double,MImageHDU> |
getMomentAt(double step,
int order)
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. |
protected boolean |
isValid()
We are valid only if we have the linear drive and the moments.
|
private Vector2D |
limitCoarseFocus()
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. |
private Vector2D |
limitCrudeFocus() |
private double |
scanA4(MImageHDU hdu)
We calculate the A4 parameter from second image moments following
Equation 5 in PASP118, 1165, but without pixel scaling.
|
void |
setAbort(boolean to)
Allows the sub-device to abort as soone as possible.
|
protected void |
setMaster(AdapterMaster chef)
From the master, we query the driver for the linear stage and grab the
temperature and the fits moments parameter.
|
private boolean |
store(MImageHDU image,
String store) |
private MFits |
takeSingleImage(CcdDriver ccd,
double ms,
Dimension bin)
Takes a single image, resets the driver if necessary.
|
setFocus, setFocusOffset, setIncreasedoUnitTask, getGuider, getMaster, getTelescope, getUnitType, init, isManual, resetUnit, setGuider, setManual, setTelescopeclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, 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, parseObject, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringProperties, toStringequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefaultBoolean, 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, stringPropertiesprivate static final String A4MOMREM
private static final String A4MOM
private static final String FWHMGAUSSREM
private static final String FWHMGAUSS
private static final String FOCMOMREM
private static final String FOCMOM
private static final String SETFOCUSREM
private static final String SETFOCUS
public static final String EXTRAFOCAL
public static final String INTRAFOCAL
public static final String SEARCH
public static final String KEY_FWHMMEASURE
public static final String KEY_MOMENTS
public static final String KEY_FOCUSOFFSET
public static final String KEY_FOCUSORDER
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_DOSAVE
public static final String KEY_FOCUSFRAME
public static final String KEY_MOMENTSFRAME
public static final String KEY_BLOBFRAME
public static final String KEY_FOCUSBINNING
public static final String KEY_EXPOSEFOCUS
public static final String KEY_MAXFOCUSEXPOSE
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_FWHMSIZE
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_ZERNIKEACCEPT
public static final String KEY_COARSEACCEPT
public static final String KEY_ERRORCRUDE
private static final String DEFMOMENTS
private static final String DEFFWHMMEASURE
private static final int DEFSEARCHSTEPS
private static final boolean DEFDOSEARCH
private static final boolean DEFDOSAVE
private static final double DEFEXPOSEFOCUS
private static final int DEFSEARCHORDER
private static final int DEFFOCUSORDER
private static final Dimension DEFFOCUSBINNING
private static final double DEFZERNIKESTEP
private static final double DEFZEXPOSE
private static final double DEFA4SLOPE
private static final double DEFA4ERROR
private static final Rectangle DEFBLOBFRAME
private static final Dimension DEFBLOBSIZE
private static final Dimension DEFADUSIZE
private static final Dimension DEFFWHMSIZE
private static final int DEFSKYFRAME
private static final boolean DEFMEDIANSKY
private static final double DEFLOWSKYSIGMA
private static final double DEFHIGHSKYSIGMA
private static final double DEFZERNIKEACCEPT
private static final double DEFCOARSEACCEPT
private static final double DEFERRORCRUDE
private FitsMoments moments
private FwhmMeasure measfwhm
private long exptms
private boolean abort
public abstract double getMinimumFocus()
public abstract double getMaximumFocus()
protected abstract double getCrudeFocus()
protected void setMaster(AdapterMaster chef)
setMaster in class AdapterUnitprotected boolean isValid()
isValid in class AdapterUnitpublic void setAbort(boolean to)
Abortableprotected ErrorEvent doFocusTask(String mode)
private Vector2D limitCrudeFocus()
private Vector2D limitCoarseFocus()
#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 Vector2D doZernikes(double zernike, double pos0)
private double scanA4(MImageHDU hdu) throws BasicFitsException
A4 = sqrt(Mx+My), withCentered on the brightest pixel blob in the image, we use a rectangle of size
Mx,y = Σ(x,y_ij-x,y_c)^2*ADU_ij/ΣADU_ij
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.BasicFitsExceptionprivate Pair<Double,MImageHDU> getMomentAt(double step, int order)
#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 getFwhm(MImageHDU f0)