stella.adapter
Class AuxiliaryGuidingUnit

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.adapter.AuxiliaryUnit
                  extended by stella.adapter.AuxiliaryCaptureUnit
                      extended by stella.adapter.AuxiliaryGuidingUnit
All Implemented Interfaces:
Cloneable, FrameShifting, Guiding.RawFrame, PostReducing, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class AuxiliaryGuidingUnit
extends AuxiliaryCaptureUnit
implements FrameShifting, PostReducing

The guider unit task and the timer loop. The adapter master may prepare the guiding by a call to the do unit task, afterwards the guider loop might be retrieved with #createGuiderLoop.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  boolean allowswitch
          If true, the guider is allowed to request a guider mode change.
private static String CONTINUOUSSEEING
          Properties of the internal seeing monitor.
private  ShelfStatistic contseeing
          The value with continuous seeing.
private  int currentguider
          Counting the guider frames.
static int DEFAPERTURE
          An integer value of the aperture size.
private static Dimension DEFENLARGEGUIDE
          The default pixel enlargement during guide.
private static double DEFFRACTION
          The default maximum fraction for reacquire/mode switch requests.
static int DEFGUIDERTILE
          An integer value of the guiding tile size index.
private static boolean DEFKEEPFITS
          If true, all guiding fits are kept on disc.
private static int DEFKEEPWHAT
          An integer specifying which guider fits to keep.
private static double DEFMAGERROR
          An estimate of the mgnitude error.
private static int DEFMODECHANGE
          The default number of minimum guider losts for mode change.
private static double DEFMODEFREQUENCY
          The default minimum occurence frequency of guider losts.
private static double DEFMODESEEING
          The default maximum seeing for good seeing guiding.
private static double DEFMODESWITCHLEFT
          The default minimum time left for mode switch requests, ms.
private static double DEFMODEWIND
          The default maximum wind speed for non-wind guiding.
private static double DEFPOSITIONERROR
          An estimate of the catalog errors in pixels on ccd.
private static double DEFREACQUIRELEFT
          The default minimum time left for reacquire requests, ms.
private static long DEFROWTIMING
          Read out time for a single row, guiding frame in mu-seconds.
private static double DEFSIGNIFICANCE
          The default maximum fraction for reacquire/mode switch requests.
private static boolean DEFWAITONGUIDE
          If true, we wait for offset completion on guide.
private  Value exposuretimeleft
          The Value holding the exposure time left.
private  long expt
          The exposure time for the guider applied on the CCD.
private  Value fractionalexpose
          The value holding the fractional exposure time.
private  long guideraw
          The exposure time for the guider without increase.
private  StarDescription guidestar
          The guide star.
private  int guidinglost
          The counter of repetitive guiding failures.
private  Value highwind
          The value with wind peaks.
private  double increase
          A value set from the outside signaling increased exposure time.
static String KEY_APERTURE
          On aperture photometry the radius of the square box, unbinned.
static String KEY_ENLARGEGUIDE
          A gray-zone around the guide field for catalog star inclusion.
static String KEY_FRACTION
          No reposition or change mode after this fraction of exposure time.
static String KEY_MODECHANGE
          Minimum lost guidings to allow mode change, zero is no change.
static String KEY_MODEFREQUENCY
          Minimum frequency of guiding losts to allow mode change.
static String KEY_MODEPROPERTIES
          Modes are defined as MODE_XXX+this key, e.g.
static String KEY_MODESEEING
          Minimum seeing at guiding to allow mode change.
static String KEY_MODESWITCHLEFT
          To request a mode switch, at least this exposure time must remain.
static String KEY_MODEWIND
          Minimum wind speed at guiding to allow mode change.
static String KEY_REACQUIRELEFT
          To request a reposition, at least this exposure time must remain.
static String KEY_SIGNIFICANCE
          The sigma-level for an offset average to be significant.
static String KEY_WAITONGUIDE
          If true, we wait for offset completion on guide.
private  long lastsent
          The time of the last PID query.
private  Value lostcount
          The value counting the severe guiding losts.
private  List losts
          A list of az/alt offsets, used on permanent misses, but not star lost.
private  GuiderMode mode
          The current guiding mode, initialized on unit task.
static String MODE_AUTO
          Auto mode, select best as you think...
static String MODE_NORMAL
          Normal guider mode.
static String MODE_SEEING
          Bad seeing guider mode.
static String MODE_TRACKING
          No-guiding mode, pure tracking.
static String MODE_WIND
          High wind guider mode.
private  int modeswitch
          The counter of absolute guider losts for mode change.
private  DataOutputStream offrecord
          An object output stream were we serialize our alt/az offs in.
private  EncoderOffsetTelescope offsetcommand
          Re-use the offset command.
private  List offsets
          A list of az/alt offsets.
private  boolean onstar
          True, if we are currently on star.
private  DataOutputStream pidrecord
          An object output stream were we serialize our alt/az offs in.
private  Value pinholemiss
          The value averaging pinhole-offsets.
private  boolean running
          If this method is true, another task is running and we exit.
private  Value spuriouscount
          The value counting the spurious guiding losts.
private  int starlost
          The counter of repetitive star-not-visible.
private  long start
          The starting time of the guider loop.
private  int targetlost
          The counter of repetitive target failures.
private  Value targetseeing
          The value averaging per-target seeing.
 
Fields inherited from class stella.adapter.AuxiliaryCaptureUnit
KEY_DATAMAX, KEY_DATAMIN, KEY_EXPOSE, KEY_KEEPFITS, KEY_KEEPWHAT, KEY_MAGERROR, KEY_MINOFFTIME, KEY_MINTIME, KEY_POSITIONERROR, KEY_ROWTIMING, KEY_SAFETYOFFSET, KEY_SEARCHBOX, KEY_USECENTRAL
 
Fields inherited from class stella.adapter.AuxiliaryUnit
COARSETYPE, FINETYPE, GUIDERTYPE, KEY_FALLBACK, KEY_GUIDERTILE, PINHOLETYPE
 
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
AuxiliaryGuidingUnit(Map prop)
          Constructs a new guider unit.
 
Method Summary
private  Vector2D averageAzAltShift(List shifts)
          Averages a list of az/alt offsets stored as two-dimensional vectors.
private  void cancel()
          Canceling means stop the continuous mode.
private  boolean check(Value v, double above)
          Check, if the value is non-null, its value is non-null and if this value is higher than the supplied double.
protected  ErrorEvent doAuxiliaryTask(String guidingmode)
          Doing the unit task means start guiding.
protected  String getAuxiliaryType()
          The type of the guider unit is AdapterUnit.GUIDERTYPE.
protected  double getExposureSN()
          If we have a guider mode established, return the mode's exposure signal instead of the default one.
protected  long getExposureTime()
          Returns the guider exposure time, available after unit task.
 Guiding.RawFrame getFrame()
          If we can use the center, we return the nominal frame here, otherwise we calculate the frame around the guiding star, which is also the focus star.
protected  GuiderMode getMode()
          Returns the currently active guider mode.
 void init()
          Initializes the guiding unit.
 boolean isMovingFrame()
          We have a moving frame, if we cannot use the central object for guiding.
private  boolean isViable(double left)
          Checks, if sending an error to request new guiding mode or to reposition the telescope is feasible.
private  Vector2D measureInitialOffset(StarDescription gs)
          This is similar to the coarse acquire, we try to find the guide star on the CCD and record the az-alt offset.
 void postProcess(List<Guiding.RawStar> found)
          The method does the actual guiding.
protected  void resetUnit()
          Resets the guider unit.
private  double seeingAndPhotometry(Guiding.RawStar pinhole)
          Takes a guiding signal and estimates seeing and photometry from it.
protected  void setAllowSwitch(boolean modechange)
          Sets the state of the allow switch.
protected  void setExposure(Value timeleft, Value fractional)
          Sets the values related to exposure time.
protected  void setGuidingLost(Value losses)
          Sets the value counting the spurious guiding losses.
protected  void setIncrease(double afteracquire)
          Sets the increase value.
protected  void setOffsetStream(DataOutputStream open)
          Sets a stream that should be used to serialize the offset data into.
protected  void setPIDStream(DataOutputStream open)
          Sets a stream that should be used to serialize the pids data into.
protected  void setPinholeMiss(Value miss)
          Sets the value with the target seeing.
protected  void setSeeing(Value seeing)
          Sets the value with the target seeing.
protected  void setTargetLost(Value losses)
          Sets the value counting the spurious guiding losses.
protected  void setWindPeak(Value windmax)
          Sets the value with the high-peaked winds.
private  void writeRecord(DataOutputStream record, double az, double alt)
          If the record file is non null, write the two doubles as floats into it.
 
Methods inherited from class stella.adapter.AuxiliaryCaptureUnit
canUseCentral, getCaptureSignal, getCaptureTime, getFocusPoint, getGuideStar, getMinimumCaptureTime, isGuideCenter, isUseCentral, setGuideStar, setGuideStar
 
Methods inherited from class stella.adapter.AuxiliaryUnit
getBiasFrame, getBiasTime, getBinning, getDarkFrame, getDarkTime, getGuider, getMaster, getReadoutFrame, getTelescope, isManual, isValid, setGuider, setManual, setMaster, setTelescope
 
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, 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
 

Field Detail

MODE_AUTO

public static final String MODE_AUTO
Auto mode, select best as you think...

See Also:
Constant Field Values

MODE_NORMAL

public static final String MODE_NORMAL
Normal guider mode.

See Also:
Constant Field Values

MODE_SEEING

public static final String MODE_SEEING
Bad seeing guider mode.

See Also:
Constant Field Values

MODE_WIND

public static final String MODE_WIND
High wind guider mode.

See Also:
Constant Field Values

MODE_TRACKING

public static final String MODE_TRACKING
No-guiding mode, pure tracking.

See Also:
Constant Field Values

KEY_MODEPROPERTIES

public static final String KEY_MODEPROPERTIES
Modes are defined as MODE_XXX+this key, e.g. 'normalmodeproperties'.

See Also:
Constant Field Values

KEY_ENLARGEGUIDE

public static final String KEY_ENLARGEGUIDE
A gray-zone around the guide field for catalog star inclusion.

See Also:
Constant Field Values

KEY_WAITONGUIDE

public static final String KEY_WAITONGUIDE
If true, we wait for offset completion on guide.

See Also:
Constant Field Values

KEY_APERTURE

public static final String KEY_APERTURE
On aperture photometry the radius of the square box, unbinned.

See Also:
Constant Field Values

KEY_MODECHANGE

public static final String KEY_MODECHANGE
Minimum lost guidings to allow mode change, zero is no change.

See Also:
Constant Field Values

KEY_MODEFREQUENCY

public static final String KEY_MODEFREQUENCY
Minimum frequency of guiding losts to allow mode change.

See Also:
Constant Field Values

KEY_MODEWIND

public static final String KEY_MODEWIND
Minimum wind speed at guiding to allow mode change.

See Also:
Constant Field Values

KEY_MODESEEING

public static final String KEY_MODESEEING
Minimum seeing at guiding to allow mode change.

See Also:
Constant Field Values

KEY_REACQUIRELEFT

public static final String KEY_REACQUIRELEFT
To request a reposition, at least this exposure time must remain.

See Also:
Constant Field Values

KEY_MODESWITCHLEFT

public static final String KEY_MODESWITCHLEFT
To request a mode switch, at least this exposure time must remain.

See Also:
Constant Field Values

KEY_FRACTION

public static final String KEY_FRACTION
No reposition or change mode after this fraction of exposure time.

See Also:
Constant Field Values

KEY_SIGNIFICANCE

public static final String KEY_SIGNIFICANCE
The sigma-level for an offset average to be significant.

See Also:
Constant Field Values

DEFENLARGEGUIDE

private static final Dimension DEFENLARGEGUIDE
The default pixel enlargement during guide.


DEFWAITONGUIDE

private static final boolean DEFWAITONGUIDE
If true, we wait for offset completion on guide.

See Also:
Constant Field Values

DEFKEEPFITS

private static final boolean DEFKEEPFITS
If true, all guiding fits are kept on disc.

See Also:
Constant Field Values

DEFKEEPWHAT

private static final int DEFKEEPWHAT
An integer specifying which guider fits to keep.

See Also:
Constant Field Values

DEFGUIDERTILE

public static final int DEFGUIDERTILE
An integer value of the guiding tile size index.

See Also:
Constant Field Values

DEFAPERTURE

public static final int DEFAPERTURE
An integer value of the aperture size.

See Also:
Constant Field Values

DEFROWTIMING

private static final long DEFROWTIMING
Read out time for a single row, guiding frame in mu-seconds.

See Also:
Constant Field Values

DEFPOSITIONERROR

private static final double DEFPOSITIONERROR
An estimate of the catalog errors in pixels on ccd.

See Also:
Constant Field Values

DEFMAGERROR

private static final double DEFMAGERROR
An estimate of the mgnitude error.

See Also:
Constant Field Values

DEFMODECHANGE

private static final int DEFMODECHANGE
The default number of minimum guider losts for mode change.

See Also:
Constant Field Values

DEFMODEFREQUENCY

private static final double DEFMODEFREQUENCY
The default minimum occurence frequency of guider losts.

See Also:
Constant Field Values

DEFMODEWIND

private static final double DEFMODEWIND
The default maximum wind speed for non-wind guiding.

See Also:
Constant Field Values

DEFMODESEEING

private static final double DEFMODESEEING
The default maximum seeing for good seeing guiding.

See Also:
Constant Field Values

DEFREACQUIRELEFT

private static final double DEFREACQUIRELEFT
The default minimum time left for reacquire requests, ms.

See Also:
Constant Field Values

DEFMODESWITCHLEFT

private static final double DEFMODESWITCHLEFT
The default minimum time left for mode switch requests, ms.

See Also:
Constant Field Values

DEFFRACTION

private static final double DEFFRACTION
The default maximum fraction for reacquire/mode switch requests.

See Also:
Constant Field Values

DEFSIGNIFICANCE

private static final double DEFSIGNIFICANCE
The default maximum fraction for reacquire/mode switch requests.

See Also:
Constant Field Values

CONTINUOUSSEEING

private static final String CONTINUOUSSEEING
Properties of the internal seeing monitor.

See Also:
Constant Field Values

mode

private GuiderMode mode
The current guiding mode, initialized on unit task.


spuriouscount

private Value spuriouscount
The value counting the spurious guiding losts. Reset from master.


lostcount

private Value lostcount
The value counting the severe guiding losts. Reset from master.


highwind

private Value highwind
The value with wind peaks.


contseeing

private ShelfStatistic contseeing
The value with continuous seeing.


targetseeing

private Value targetseeing
The value averaging per-target seeing.


pinholemiss

private Value pinholemiss
The value averaging pinhole-offsets.


exposuretimeleft

private Value exposuretimeleft
The Value holding the exposure time left.


fractionalexpose

private Value fractionalexpose
The value holding the fractional exposure time.


increase

private double increase
A value set from the outside signaling increased exposure time.


guidestar

private StarDescription guidestar
The guide star.


guideraw

private long guideraw
The exposure time for the guider without increase.


expt

private long expt
The exposure time for the guider applied on the CCD.


start

private long start
The starting time of the guider loop.


running

private boolean running
If this method is true, another task is running and we exit.


currentguider

private int currentguider
Counting the guider frames.


lastsent

private long lastsent
The time of the last PID query.


onstar

private boolean onstar
True, if we are currently on star.


guidinglost

private int guidinglost
The counter of repetitive guiding failures.


starlost

private int starlost
The counter of repetitive star-not-visible.


targetlost

private int targetlost
The counter of repetitive target failures.


allowswitch

private boolean allowswitch
If true, the guider is allowed to request a guider mode change.


modeswitch

private int modeswitch
The counter of absolute guider losts for mode change.


offsetcommand

private EncoderOffsetTelescope offsetcommand
Re-use the offset command.


offsets

private List offsets
A list of az/alt offsets.


losts

private List losts
A list of az/alt offsets, used on permanent misses, but not star lost.


offrecord

private DataOutputStream offrecord
An object output stream were we serialize our alt/az offs in.


pidrecord

private DataOutputStream pidrecord
An object output stream were we serialize our alt/az offs in.

Constructor Detail

AuxiliaryGuidingUnit

public AuxiliaryGuidingUnit(Map prop)
Constructs a new guider unit. Differnt to acquire, we might have different errors on the catalog for two reasone, first the guider may see not as many stars as the acquire field, thus the the catalog error might be smaller. On the other hand, exposure time is short, thus the magnitude error might be higher.

Method Detail

init

public void init()
Initializes the guiding unit.

Specified by:
init in interface Initializable
Overrides:
init in class AuxiliaryCaptureUnit

setAllowSwitch

protected void setAllowSwitch(boolean modechange)
Sets the state of the allow switch. If this is true, the guider may issue request to change the guiding mode.


getExposureTime

protected long getExposureTime()
Returns the guider exposure time, available after unit task.


setIncrease

protected void setIncrease(double afteracquire)
Sets the increase value.


setGuidingLost

protected void setGuidingLost(Value losses)
Sets the value counting the spurious guiding losses.


setTargetLost

protected void setTargetLost(Value losses)
Sets the value counting the spurious guiding losses.


setWindPeak

protected void setWindPeak(Value windmax)
Sets the value with the high-peaked winds.


setSeeing

protected void setSeeing(Value seeing)
Sets the value with the target seeing.


setPinholeMiss

protected void setPinholeMiss(Value miss)
Sets the value with the target seeing.


setOffsetStream

protected void setOffsetStream(DataOutputStream open)
Sets a stream that should be used to serialize the offset data into.


setPIDStream

protected void setPIDStream(DataOutputStream open)
Sets a stream that should be used to serialize the pids data into.


setExposure

protected void setExposure(Value timeleft,
                           Value fractional)
Sets the values related to exposure time.

Parameters:
timeleft - The value holding the exposure time left.
fractional - The value holding the fraction of exposure done.

getAuxiliaryType

protected String getAuxiliaryType()
The type of the guider unit is AdapterUnit.GUIDERTYPE.

Specified by:
getAuxiliaryType in class AuxiliaryUnit

getMode

protected GuiderMode getMode()
Returns the currently active guider mode.


doAuxiliaryTask

protected ErrorEvent doAuxiliaryTask(String guidingmode)
Doing the unit task means start guiding. Only if the guider mode was set to MODE_AUTO, the mode is calculated from the current wind, otherwise the appropriate guider mode is loaded. The unit task does not start or create the guider loop, this must be done after the unti task by a call to #createGuiderLoop.

Specified by:
doAuxiliaryTask in class AuxiliaryUnit
Parameters:
guidingmode - An integer specifying the action to be taken.
Returns:
null on okay, or an ErrorEvent desribing the failure.

resetUnit

protected void resetUnit()
Resets the guider unit. This is done only on first start of guiding loop, not at each restart, as we than lose the targetcounts.


getExposureSN

protected double getExposureSN()
If we have a guider mode established, return the mode's exposure signal instead of the default one.


seeingAndPhotometry

private double seeingAndPhotometry(Guiding.RawStar pinhole)
Takes a guiding signal and estimates seeing and photometry from it.

Parameters:
pinhole - The direct image of the star on the pinhole
Returns:
The fraction of light lost.

isViable

private boolean isViable(double left)
Checks, if sending an error to request new guiding mode or to reposition the telescope is feasible. This depends on the value of the exposure time remaining and on the fractional exposure time.

Parameters:
left - The time in ms that must be left on the exposure.

isMovingFrame

public boolean isMovingFrame()
We have a moving frame, if we cannot use the central object for guiding.

Specified by:
isMovingFrame in interface FrameShifting

getFrame

public Guiding.RawFrame getFrame()
If we can use the center, we return the nominal frame here, otherwise we calculate the frame around the guiding star, which is also the focus star.

Specified by:
getFrame in interface FrameShifting

postProcess

public void postProcess(List<Guiding.RawStar> found)
The method does the actual guiding. It is called whenever a frame has been taken and reduced. The argument is a list of Guiding#RawStar objects.

Specified by:
postProcess in interface PostReducing
Parameters:
found - A list of Guiding#RawStars.

cancel

private void cancel()
Canceling means stop the continuous mode.


check

private final boolean check(Value v,
                            double above)
Check, if the value is non-null, its value is non-null and if this value is higher than the supplied double.


averageAzAltShift

private Vector2D averageAzAltShift(List shifts)
Averages a list of az/alt offsets stored as two-dimensional vectors. If the average is not significant, i.e. if it is less than KEY_SIGNIFICANCE times the standard deviation, it is set to zero.


writeRecord

private void writeRecord(DataOutputStream record,
                         double az,
                         double alt)
If the record file is non null, write the two doubles as floats into it.


measureInitialOffset

private Vector2D measureInitialOffset(StarDescription gs)
This is similar to the coarse acquire, we try to find the guide star on the CCD and record the az-alt offset.