public abstract class AbstractAutoGuider extends AcquisitionUnit implements AutoGuiding, ImageProcessing
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractAutoGuider.CommonModes
The known modes each auto guider must support.
|
AcquisitionUnit.ModesPropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private AutoGuidingMode |
active
The guiding mode currently active.
|
private static double |
DEFOFFSETSIGMA
Insignificant offset.
|
private static double |
DEFOSCILLATESIGMA
Insignificant oscillation.
|
private static boolean |
DEFWAITONGUIDE
If true, we wait for offset completion on guide.
|
private AutoGuiderReadoutProviding |
frame
The instance queried by the acquisition CCD for exposures.
|
private int |
guidelost
Counts consecutive losses on the pinhole.
|
private Value |
highwind
Value that has the wind-speed maximum.
|
private double |
increase
A prior detected atmospheric transparency loss for a texp increase.
|
static String |
KEY_ABORTLEFT
Abort only, if we have at least this amount of time left.
|
static String |
KEY_EXPOSURETIMELEFT
The parameter holding the exposure time left.
|
static String |
KEY_FRACTIONALEXPOSE
The parameter holding the fractional exposure time.
|
static String |
KEY_INCREASEGUIDINGLOST
If guiding is lost, increase exposure time by this factor.
|
static String |
KEY_KEEPOFFSETS
If true, we record the az/alt offset in a data output stream.
|
static String |
KEY_KEEPPIDS
If true, we record the pid offset in a data output stream.
|
static String |
KEY_LOSTCOUNT
Issued to the local parameter cluster as number of target losts.
|
static String |
KEY_MODECHANGE
Minimum lost guidings to allow mode change, zero is no change.
|
static String |
KEY_MODESEEING
Minimum seeing at guiding to allow mode change.
|
static String |
KEY_MODEWIND
Minimum wind speed at guiding to allow mode change.
|
static String |
KEY_OFFSETDIR
Directory where the offset streams should be put.
|
static String |
KEY_OFFSETSIGMA
If the average offset is less than this times sigma, we do not send.
|
static String |
KEY_OSCILLATESIGMA
If the average offset is less than this times sigma, we do oscilate.
|
static String |
KEY_SEEING
Issued to the local parameter cluster as the seeing estimate.
|
static String |
KEY_SPURIOUSCOUNT
Issued to the local parameter cluster as number of guiding losts.
|
static String |
KEY_WAITONGUIDE
If true, we wait for offset completion on guide.
|
static String |
KEY_WINDMAX
The wind-speed maxometer parameter.
|
private long |
lastsent
Timestamp of the last offset command sent to the telescope.
|
private List<Vector2D> |
losses
The offsets in the telescope system recorded during pinhole misses.
|
private Value |
lostcount
Value that count star losses.
|
private int |
modelost
Counts consecutive losses of optimum guiding mode.
|
private boolean |
modeswitch
Principal switch that denies automatic mode changes.
|
private DataOutputStream |
offrecord
If measured offset should be written into a stream.
|
private static String |
OFFSETEXTENSION
The extension for the recorded offsets.
|
private List<Vector2D> |
offsets
The offsets in the telescope system recorded per PID period.
|
private AbstractAutoGuider.CommonModes |
original
If the target requested mode is AUTO of the common ones.
|
private DataOutputStream |
pidrecord
If PID-mitigated offset should be written into a stream.
|
private static String |
PIDSEXTENSION
The extension for the recorded pids.
|
static String |
POSTFIX_MODEPROPERTIES
Modes are defined as MODE_XXX+this key, e.g.
|
private Value |
seeing
Value that has the average seeing.
|
private Value |
spuriouscount
Value that count spurious losses.
|
private int |
starlost
Counts consecutive losses of the guide star.
|
private int |
targetlost
Counts consecutive losses of the target.
|
KEY_KEEPFITS, KEY_KEEPWHATKEY_FITSDIR, KEY_XTENSIONKEY_UNITTYPEKEY_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 |
AbstractAutoGuider(Map<String,String> props) |
| Modifier and Type | Method and Description |
|---|---|
private void |
abort()
Abort signaled by the reducer object.
|
private Vector2D |
applicableOffset()
Averages on all accumulated offsets, feeds the significant averages to
the PIDs and returns their correction.
|
protected boolean |
applyNewMode(AutoGuidingMode apply)
This method is called if a new guiding mode should be applied.
|
private Pair<Vector2D,Vector2D> |
averageShift(List<Vector2D> shifts)
Averages one of a list of offsets stored as two-dimensional vectors.
|
private void |
cancelGuiding()
Method to ensure that continuous operation will be canceled as soon as
possible.
|
private Vector2D |
checkForFullOffset()
This method is called if the guide star was still recovered, but has
never been on the pinhole for quite some time.
|
private void |
closeAllOffsetStreams()
Makes sure that all streams are closed.
|
private void |
closeStream(OutputStream record)
Makes sure that the specified stream is closed.
|
void |
configureUnit()
We test is all common modes are available, i.e., all common modes have
properties.
|
abstract AutoGuiderReadoutProviding |
createReadout(Map<String,String> prop)
The readout provide must be able to supply the required readout frame,
binning and exposure time at any time within the guiding process.
|
private AutoGuidingMode |
getCurrentlyBestMode()
From the current wind and seeing conditions, we deduce one of the common
guiding modes to be selected:
AbstractAutoGuider.CommonModes.WIND if the maximum
wind speed exceeds the KEY_MODEWIND property,
AbstractAutoGuider.CommonModes.SEEING if the windspeed is apt, but the average
seeing is higher than KEY_MODESEEING, AbstractAutoGuider.CommonModes.NORMAL
otherwise. |
List<StarProspect> |
getExpectedStars(double texp,
Rectangle readout,
Dimension bin,
boolean single)
From a readout frame plus binning on a detector, return a list of star
one expects to see on the CCD.
|
protected AutoGuidingMode |
getModeFromName(String modename)
Each mode must be present in the autoguiders properties as a
<modename>modeproperties entry. |
private File |
getOffsetStreamDirectory() |
private Map<String,String> |
getPropertiesForModeName(String modename) |
protected Map<String,String> |
getReadoutProperties()
Returns the properties used to construct the readout provider.
|
private String |
getRecordName(String ext) |
private DataOutputStream |
getRecordStream(String ext) |
Vector2D |
guideShift(Rectangle readout,
Dimension bin,
double t0,
MImageHDU reduced,
Guiding ag) |
void |
ioException(IOException atread)
Signals that an I/O Exception has occurred.
|
protected boolean |
isAllowModeSwitch()
Returns the status of the principal mode switch.
|
protected void |
measuredShift(Date now,
Vector2D pixel,
boolean onpin)
This is the callback method from the image reducing instance.
|
boolean |
processFits(MFits ccd,
Rectangle readout,
Dimension bin,
double expt,
Date dateobs,
int count)
Reduces a fits image.
|
void |
registerGlobals(GlobalGrouping set)
We scan the parameter set for the windspeed, seeing, a counter for
spurious guiding losses and target losses.
|
private void |
restart()
We try to reset the CCD.
|
protected void |
setAllowModeSwitch(boolean modeswitch)
Disables automatic adjustment of the active guiding mode if called with
false.
|
protected boolean |
setMode(AutoGuidingMode apply) |
private double |
significant(Vector2D avsig)
Checks the absolute value in the first argument versus the significance
level and the standard deviation in the second argument.
|
boolean |
startGuiding(AutoGuidingMode apply,
Guiding ag,
TransparencyMeasuring prior)
Starts guiding in the requested mode.
|
boolean |
stopGuiding(Guiding ag)
Stops an active guiding and blocks until all exposures are finished.
|
private void |
writeRecord(DataOutputStream record,
double az,
double alt)
If the record file is non null, write the two doubles as floats into it.
|
getAcquisitionResource, getBinaryAcquisition, getExpectedStars, getOneExtension, getRaw, persitent, reduce16, sendFieldOfView, sendShifts, sendTelescopeOffset, setAcquisitionAndGuiding, setCount, setTrybinningAndWindow, getAcquisitionExtension, getFitsDirectory, getOneExposure, isManual, reducedFloat, save, save, setManualdefaultGuidingStar, getMaster, getUnitType, init, isValid, isValid, setMasterclone, 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, waitgetGuidingdefaultBoolean, 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, stringPropertiespublic static final String KEY_OFFSETDIR
public static final String KEY_KEEPOFFSETS
public static final String KEY_KEEPPIDS
public static final String KEY_LOSTCOUNT
public static final String KEY_SPURIOUSCOUNT
public static final String KEY_SEEING
public static final String KEY_WINDMAX
public static final String KEY_EXPOSURETIMELEFT
public static final String KEY_FRACTIONALEXPOSE
public static final String KEY_MODECHANGE
public static final String KEY_MODEWIND
public static final String KEY_MODESEEING
public static final String KEY_WAITONGUIDE
public static final String KEY_ABORTLEFT
public static final String KEY_INCREASEGUIDINGLOST
public static final String KEY_OFFSETSIGMA
public static final String KEY_OSCILLATESIGMA
private static final boolean DEFWAITONGUIDE
private static final double DEFOFFSETSIGMA
private static final double DEFOSCILLATESIGMA
private static final String OFFSETEXTENSION
private static final String PIDSEXTENSION
private AutoGuiderReadoutProviding frame
private AbstractAutoGuider.CommonModes original
private AutoGuidingMode active
private int guidelost
private int starlost
private int targetlost
private int modelost
private DataOutputStream offrecord
private DataOutputStream pidrecord
private List<Vector2D> losses
private long lastsent
private boolean modeswitch
private Value spuriouscount
private Value lostcount
private Value highwind
private Value seeing
private double increase
public static final String POSTFIX_MODEPROPERTIES
public void configureUnit()
throws ConfigurationException
configureUnit in class AncillaryCameraUnitConfigurationExceptionpublic List<StarProspect> getExpectedStars(double texp, Rectangle readout, Dimension bin, boolean single)
AcquisitionUnitgetExpectedStars in class AcquisitionUnittexp - Exposure time in seconds.public void registerGlobals(GlobalGrouping set)
registerGlobals in interface GlobalDependingregisterGlobals in class GenericUnitpublic boolean startGuiding(AutoGuidingMode apply, Guiding ag, TransparencyMeasuring prior)
AutoGuiding#guideShift(Rectangle, Dimension, double, MImageHDU, AcquisitionAndGuiding)
will be called repeatedly.startGuiding in interface AutoGuidingpublic boolean stopGuiding(Guiding ag)
stopGuiding in interface AutoGuidingpublic void ioException(IOException atread)
ImageProcessingioException in interface ImageProcessingpublic boolean processFits(MFits ccd, Rectangle readout, Dimension bin, double expt, Date dateobs, int count)
ImageProcessingMImageHDU, i.e. with a filled buffer
The readout frame is always in unbinned pixel. The exposure time is in milliseconds.
processFits in interface ImageProcessingccd - The non-null, data-carrying FITS object from the camera.readout - Unbinned readout window, if null entire CCD read.bin - The binning used, if null 1x1 binning.expt - The applied exposure time in milliseconds.dateobs - The actual date of the exposure, if null use system time.public Vector2D guideShift(Rectangle readout, Dimension bin, double t0, MImageHDU reduced, Guiding ag) throws NoShiftException
guideShift in interface AutoGuidingreadout - bin - expt - reduced - NoShiftExceptionprotected boolean isAllowModeSwitch()
protected void setAllowModeSwitch(boolean modeswitch)
modeswitch - the modeswitch to setisAllowModeSwitch()private AutoGuidingMode getCurrentlyBestMode()
AbstractAutoGuider.CommonModes.WIND if the maximum
wind speed exceeds the KEY_MODEWIND property,
AbstractAutoGuider.CommonModes.SEEING if the windspeed is apt, but the average
seeing is higher than KEY_MODESEEING, AbstractAutoGuider.CommonModes.NORMAL
otherwise.
The requested mode is then located via its name and must be present in the guiders properties.
getModeFromName(String)protected AutoGuidingMode getModeFromName(String modename) throws NoSuchModeException
<modename>modeproperties entry. If not found,
a NoSuchModeException is thrown.modename - NoSuchModeExceptionprivate Map<String,String> getPropertiesForModeName(String modename) throws NoSuchModeException
modename - NoSuchModeExceptionprivate DataOutputStream getRecordStream(String ext)
private void closeAllOffsetStreams()
IOExceptionprivate void closeStream(OutputStream record)
private void cancelGuiding()
private void restart()
private void abort()
protected void measuredShift(Date now, Vector2D pixel, boolean onpin) throws PositioningException
PositioningExceptionprivate Vector2D applicableOffset()
private double significant(Vector2D avsig)
avsig - private Vector2D checkForFullOffset()
protected boolean applyNewMode(AutoGuidingMode apply) throws PositioningException
apply - PositioningExceptionprotected boolean setMode(AutoGuidingMode apply)
private void writeRecord(DataOutputStream record, double az, double alt)
private Pair<Vector2D,Vector2D> averageShift(List<Vector2D> shifts)
public abstract AutoGuiderReadoutProviding createReadout(Map<String,String> prop)
isFixed... methods
should return true.protected Map<String,String> getReadoutProperties()
private File getOffsetStreamDirectory()