stella.adapter
Class AbstractStarGuider

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.adapter.StellaGuider
                  extended by stella.adapter.AbstractStarGuider
All Implemented Interfaces:
Cloneable, Guiding, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying
Direct Known Subclasses:
AbstractAltAzGuider, AbstractNasmythGuider, GregorGuider

public abstract class AbstractStarGuider
extends StellaGuider

Class that defines some useful methods for autoguiders.


Nested Class Summary
static class AbstractStarGuider.Exposure
          Test class to print out estimated magnitudes.
static class AbstractStarGuider.Magnitudes
          Test class to print out estimated magnitudes.
 
Nested classes/interfaces inherited from class stella.adapter.StellaGuider
StellaGuider.Continuous, StellaGuider.Single
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Nested classes/interfaces inherited from interface stella.adapter.Guiding
Guiding.RawFrame, Guiding.RawStar
 
Field Summary
private  Value alt
          We cache the altitude parameter.
private  Value az
          We cache the azimuth parameter.
private  Value derotoff
          We cache the derotator offset parameter.
private  Value focus
          We cache the focus parameter.
private  List<StarDescription> fov
          The field of view as a list of StarDescriptions.
private  Value imrot
          We cache the image rotation parameter.
static String KEY_ALIGNMENTANGLE
          Alignment angle of the guider ccd with respect to north.
static String KEY_ALTITUDEFLIP
          If the altitude is flipped, it cannot be compensated by a rotation.
static String KEY_DARKGUIDER
          The dark plus sky rate on the guider CCD.
static String KEY_DETECTIONLIMIT
          Stars have a probability higher than this value.
static String KEY_DIRECTPINHOLE
          The pinhole position on the direct image.
static String KEY_ELONGATIONMAX
          The maximum elongation for a valid star detection, 0=round.
static String KEY_ELONGATIONWIDTH
          The steepness of the elongation drop.
static String KEY_EPSILONMAG
          The derivative of instrumental magnitudes to star color.
static String KEY_GUIDERSCALE
          The guider scale on the direct image.
static String KEY_KMAG
          The derivative of instrumental magnitudes to airmass.
static String KEY_MAXTIMEGUIDER
          Maximum exposure time on guider ccd in ms.
static String KEY_READOUTGUIDER
          The bias level on the guider ccd.
static String KEY_SHARPPEAK
          The sharpness peak for a valid star detection.
static String KEY_SHARPWIDTH
          The sharpness peak width for a valid star detection.
static String KEY_SOURCEGUIDER
          The magnitude gain for an 8th Rmag star on the guider.
static String KEY_STRIPDISTANCE
          Read-out stripes have this maximum column offset.
static String KEY_STRIPESMAX
          Read-out stripes have this maximum stroke.
static String KEY_SURESTRIPES
          Strokes below this are immediately identified as stripes.
static String KEY_ZETAMAG
          The constant from catalog magnitudes to instrumental mags.
private  String lastdate
          If we have no access to unique, this is the last date.
static long REFERENCEEXPOSE
          The exposure time for a reference magnitude star.
static double REFERENCEMAG
          The magnitude we reference to, i.e.
private  int targetcount
          If we have no access to unique, this is the last date.
private  Parameter unique
          We cache the Unique parameter.
 
Fields inherited from class stella.adapter.StellaGuider
biasfits, biastime, CLEAN, CLEANNAME, darkfits, darktime, GAUSS, GAUSSNAME, KEY_DEPTHMEDIAN, KEY_FITSDIR, KEY_GAUSSFWHM, KEY_GAUSSTRUNCATE, KEY_GUIDINGIMG, KEY_LOWPASS, KEY_MAGTRUNCATE, KEY_MATCHERVERSION, KEY_REDUCEDIR, KEY_REDUCETIME, KEY_SIZELOWPASS, KEY_SIZEMEDIAN, LOWPASS, LOWPASSNAME, maxsize, MEDIAN, MEDIANNAME, RECTANGULARMATCHER, REDUCED, REDUCEDNAME, SKYFRAME, STARREGISTER
 
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
protected AbstractStarGuider(Map<String,String> prop)
           
 
Method Summary
protected  Guiding.RawStar closestToPinhole(List<Guiding.RawStar> raw, double maxdistance)
          During guiding we assume that the target star is close to the direct mirror position.
protected static Guiding.RawStar closestToPixel(Point2D pinhole, List<Guiding.RawStar> raw, double maxdistance)
          During guiding we assume that the target star is close to the direct mirror position.
private  int dataMin(double rmag, double exptime)
           
protected  List<Guiding.RawStar> detect(boolean keep, int what, String type, String append, Guiding.RawFrame frame, long exposuretime, float gaussfwhm, float gausstrunc, int datamin, int datamax, int searchbox)
          Does a find-stars on the guider ccd.
protected  List<Guiding.RawStar> detect(boolean keep, int what, String type, String append, Guiding.RawFrame frame, long exposuretime, int datamin, int datamax, int searchbox)
          Does a find-stars on the guider ccd.
protected  int estimateDataMin(StarDescription main, double exptime)
          Estimates the datamin of a read-out stripe we will get on a star.
protected  long estimateExposureTime(double sn, Dimension bin, StarDescription main)
          Estimates an exposure time for the guider from a desired signal-to-noise.
protected  double estimateGuiderMag(long expose, float mag, float col, double z)
          Estimates the guider magnitude from an exposure time, a known magnitude plus color index and the current airmass.
private  double estimateReferenceMag(float mag, float color, double airmass)
          From the magnitude handed over we estimate the current R-magnitude of the star for calculation of exposure time or instrumental magnitudes.
protected  double estimateReferenceMag(StarDescription star)
          From the magnitude handed over we estimate the current R-magnitude of the star for calculation of exposure time or instrumental magnitudes.
private  long exposureTimeFor(double aim, double rmag)
          Calculates the exposure time from a given, binning corrected S/N.
protected  Vector2D fieldOfViewOffset(Rectangle catalog, double poserror, double magerror, List<Guiding.RawStar> found, long exposuretime, Point2D needpixel, boolean oncenter)
          Does a matching of a detected star list (which might be further cleaned by removing mirrors etc) to the field-of-view.
protected  Point2D fieldOfViewShift(Rectangle catalog, double poserror, double magerror, List<Guiding.RawStar> found, long exposuretime, boolean oncenter)
          Does a matching of a detected star list (which might be further cleaned by removing mirrors etc) to the field-of-view.
protected  String formatWithUnique(String head, String append)
          Formats a file with the unique parameter in a sense that once can supply a header and a tail to it.
private  double getAirmass()
          Converts the altitude parameter to the airmass.
protected  Number getAltitude()
          Returns the target altitude.
private  Vector2D getAzAltOffset(Point2D pixshift, double theta)
          Converts a distance in CCD-pixel to a distance in current alt/az in degrees.
protected  Number getAzimuth()
          Returns the target altitude.
private  List<Guiding.RawStar> getCatalogList(List<StarDescription> stars, Rectangle box, long expose, boolean oncenter)
          Converts a list of catalog stars to a list of Guiding#RawStars.
protected  Point2D getCatalogPosition(StarDescription catalog)
          Returns the calculated position of the star on the guider CCD.
protected abstract  Number getCurrentAzAltRotation()
          Returns the current rotation of the CCD axis to the az/alt direction.
protected abstract  Number getCurrentFieldRotation()
          Returns the current field rotation angle, used for converting ra/dec to pixel.
protected  Number getDerotator()
          Returns an optional derotator offset.
protected  List<Guiding.RawStar> getExpectedList(Rectangle catalog, long exposuretime, boolean oncenter)
          Returns the previously set field-of-view as it is expected to be seen on the CCD frame.
protected  Number getFocus()
          Returns the current focus or null if unknown.
protected  List<StarDescription> getFov()
          Returns the field of view.
 double getGuiderScale()
          Returns the guider scale.
 long getMaximumExposureTime()
          Returns the maximum time in ms allowed for the guider ccd.
protected static List<Guiding.RawStar> getNeighbours(List<Guiding.RawStar> principal, Point2D center, double d)
          We scan a list of Guiding.RawStars and return all entries that are within a certain distance to the given center point.
protected  Point2D getPinhole()
          Returns the direct pinhole.
protected  List<Guiding.RawStar> getPinholeNeighbours(List<Guiding.RawStar> found, double d)
          Returns a list of all Guiding.RawStars found in the vicinity of the pinhole.
private  Point2D getPixelOffset(Vector2D dazalt, double theta)
          Converts a distance in az/alt in degrees into a pixel distance.
protected abstract  Vector2D getRaDeCenter()
          Returns the nominal center of the pointing direction in ra,dec.
protected  Number getRotation()
          Returns the current field rotation, i.e.
protected static List<Guiding.RawStar> getStrip(List<Guiding.RawStar> principal, Point2D center, double dist)
          We scan a list of Guiding.RawStars and return all entries that are within a certain column, defined in center.
protected  Parameter getUnique()
          Gets the unique parameter.
protected  boolean isStar(Guiding.RawStar star)
          Returns true, if the star detected is truely belived to be a star.
protected  Point2D offsetAzAltToPixel(Vector2D dazalt)
          Converts a az/alt shift into a pixel shift.
protected  Vector2D pixelToAzAltOffset(Point2D pixshift)
          Converts a pixel shift into an az/alt shift.
protected  List<Guiding.RawStar> removeSpurious(List<Guiding.RawStar> raw)
          Iteratates through a list of Giding.RawStars and calculates a probability for each to be a star.
protected  List<Guiding.RawStar> removeStripes(List<Guiding.RawStar> stars)
          For bright stars, stars brighter than 9th mag, read-out stripes can be seen in the image because of the shutterless operation.
protected  void setFocus(Value f)
          Sets the focus value needed sometimes for proper calculation of the central point.
protected  boolean setFov(List<?> starlist)
          Sets the fov.
protected  void setOrientationValues(Value altitude, Value imageangle, Value offset)
          This method sets the parameters needed for each unit to correctly interpret pixel coordinates.
protected  void setOrientationValues(Value azimuth, Value altitude, Value imageangle, Value offset)
          This method sets the parameters needed for each unit to correctly interpret pixel coordinates.
protected  void setPinhole(Point2D pinhole)
          Sets the direct pinhole.
protected  void setUnique(Parameter id)
          Sets the unique parameter.
protected  Vector2D starOffset(Guiding.RawStar proximity, Point2D needshift)
          Returns the offset of the Guiding.RawStar to the pinholde position in azimuth/altitude.
protected  Vector2D starOffset(Guiding.RawStar proximity, Point2D center, Point2D needshift)
          Returns the offset of the Guiding.RawStar to the pinholde position in azimuth/altitude.
protected  Point2D starShift(Guiding.RawStar proximity)
          Returns the offset of the Guiding.RawStar to the pinholde position in pixel.
protected static Point2D starShift(Guiding.RawStar proximity, Point2D central)
          Returns the offset of the Guiding.RawStar to the pinholde position in pixel.
 
Methods inherited from class stella.adapter.StellaGuider
background, cancelContinuous, countSum, fluxInside, getCcd, getCcdSize, getContinuousList, getContinuousMinimumExpose, getCurrentExpsoureNumber, getFitsDir, getGuidingStars, getGuidingStars, getGuidingStars, isReady, match, photometry, prepareContinuous, reduceFitsFile, registerCcd, setBiasReduction, setDarkReduction, startContinuous, startContinuous, stopContinuous
 
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

REFERENCEMAG

public static final double REFERENCEMAG
The magnitude we reference to, i.e. a central magnitude.

See Also:
Constant Field Values

REFERENCEEXPOSE

public static final long REFERENCEEXPOSE
The exposure time for a reference magnitude star.

See Also:
Constant Field Values

KEY_READOUTGUIDER

public static final String KEY_READOUTGUIDER
The bias level on the guider ccd.

See Also:
Constant Field Values

KEY_DARKGUIDER

public static final String KEY_DARKGUIDER
The dark plus sky rate on the guider CCD.

See Also:
Constant Field Values

KEY_SOURCEGUIDER

public static final String KEY_SOURCEGUIDER
The magnitude gain for an 8th Rmag star on the guider.

See Also:
Constant Field Values

KEY_MAXTIMEGUIDER

public static final String KEY_MAXTIMEGUIDER
Maximum exposure time on guider ccd in ms.

See Also:
Constant Field Values

KEY_DETECTIONLIMIT

public static final String KEY_DETECTIONLIMIT
Stars have a probability higher than this value.

See Also:
Constant Field Values

KEY_SHARPPEAK

public static final String KEY_SHARPPEAK
The sharpness peak for a valid star detection.

See Also:
Constant Field Values

KEY_SHARPWIDTH

public static final String KEY_SHARPWIDTH
The sharpness peak width for a valid star detection.

See Also:
Constant Field Values

KEY_ELONGATIONMAX

public static final String KEY_ELONGATIONMAX
The maximum elongation for a valid star detection, 0=round.

See Also:
Constant Field Values

KEY_ELONGATIONWIDTH

public static final String KEY_ELONGATIONWIDTH
The steepness of the elongation drop.

See Also:
Constant Field Values

KEY_SURESTRIPES

public static final String KEY_SURESTRIPES
Strokes below this are immediately identified as stripes.

See Also:
Constant Field Values

KEY_STRIPESMAX

public static final String KEY_STRIPESMAX
Read-out stripes have this maximum stroke.

See Also:
Constant Field Values

KEY_STRIPDISTANCE

public static final String KEY_STRIPDISTANCE
Read-out stripes have this maximum column offset.

See Also:
Constant Field Values

KEY_GUIDERSCALE

public static final String KEY_GUIDERSCALE
The guider scale on the direct image.

See Also:
Constant Field Values

KEY_DIRECTPINHOLE

public static final String KEY_DIRECTPINHOLE
The pinhole position on the direct image.

See Also:
Constant Field Values

KEY_ALIGNMENTANGLE

public static final String KEY_ALIGNMENTANGLE
Alignment angle of the guider ccd with respect to north.

See Also:
Constant Field Values

KEY_ZETAMAG

public static final String KEY_ZETAMAG
The constant from catalog magnitudes to instrumental mags.

See Also:
Constant Field Values

KEY_KMAG

public static final String KEY_KMAG
The derivative of instrumental magnitudes to airmass.

See Also:
Constant Field Values

KEY_EPSILONMAG

public static final String KEY_EPSILONMAG
The derivative of instrumental magnitudes to star color.

See Also:
Constant Field Values

KEY_ALTITUDEFLIP

public static final String KEY_ALTITUDEFLIP
If the altitude is flipped, it cannot be compensated by a rotation.

See Also:
Constant Field Values

fov

private List<StarDescription> fov
The field of view as a list of StarDescriptions.


unique

private Parameter unique
We cache the Unique parameter.


az

private Value az
We cache the azimuth parameter.


alt

private Value alt
We cache the altitude parameter.


imrot

private Value imrot
We cache the image rotation parameter.


derotoff

private Value derotoff
We cache the derotator offset parameter.


focus

private Value focus
We cache the focus parameter.


lastdate

private String lastdate
If we have no access to unique, this is the last date.


targetcount

private int targetcount
If we have no access to unique, this is the last date.

Constructor Detail

AbstractStarGuider

protected AbstractStarGuider(Map<String,String> prop)
Method Detail

getCurrentFieldRotation

protected abstract Number getCurrentFieldRotation()
Returns the current field rotation angle, used for converting ra/dec to pixel. This angle depends heavily on the place where the guider is mounted (i.e. Nasmyth, prime, derotator), thus concrete subclasses have to provide this method.

Returns:
Current rotation of the CCD axis to ra,de in degrees.

getCurrentAzAltRotation

protected abstract Number getCurrentAzAltRotation()
Returns the current rotation of the CCD axis to the az/alt direction. Used to convert a pixel shift to an az/alt offset. A pixel shift is alwayshe calculated position minus the measured position, i.e. on a pinhole guider the position of the pinhole from the properties minus the position measured. This angle depends heavily on the place where the guider is mounted (i.e. Nasmyth, prime, derotator), thus concrete subclasses have to provide this method.

Returns:
Current rotation of the CCD axis to az,alt in degrees.

getRaDeCenter

protected abstract Vector2D getRaDeCenter()
Returns the nominal center of the pointing direction in ra,dec. In single-object guiders (SES) this is also the position we guide on, i.e. it is occupied by the target. Thus it can be retrieved from the field of view's first star. In multi-object guiders (WiFSIP) this position points to the ra dec the derotator should rotate the field around. It does not have to be occupied by a star and thus cannot be reconstructed from the field-of-view.


setFov

protected boolean setFov(List<?> starlist)
Sets the fov. Checks if empty or contains objects besides StarDescriptions, in which case the fov is not set.

Returns:
True, if setting is accepted.

getFov

protected List<StarDescription> getFov()
Returns the field of view. If #isValid returns true, this will never return null.


getPinhole

protected Point2D getPinhole()
Returns the direct pinhole. Used for dithering.


setPinhole

protected void setPinhole(Point2D pinhole)
Sets the direct pinhole.


setOrientationValues

protected void setOrientationValues(Value altitude,
                                    Value imageangle,
                                    Value offset)
This method sets the parameters needed for each unit to correctly interpret pixel coordinates. It spares the azimuth parameter, which is normally not necessarry.

Parameters:
altitude - The altitude of the object.
imageangle - The current field rotation angle, i.e. the angle between the y-axis of the CCD and the celestial North.
offset - If the derotator has an additional offset. Might be null.

setOrientationValues

protected void setOrientationValues(Value azimuth,
                                    Value altitude,
                                    Value imageangle,
                                    Value offset)
This method sets the parameters needed for each unit to correctly interpret pixel coordinates. Most cases will work even with azimuth=null

Parameters:
altitude - The altitude of the object.
imageangle - The current field rotation angle, i.e. the angle between the y-axis of the CCD and the celestial North.
offset - If the derotator has an additional offset. Might be null.

setFocus

protected void setFocus(Value f)
Sets the focus value needed sometimes for proper calculation of the central point.


setUnique

protected void setUnique(Parameter id)
Sets the unique parameter.


getUnique

protected Parameter getUnique()
Gets the unique parameter.


formatWithUnique

protected String formatWithUnique(String head,
                                  String append)
Formats a file with the unique parameter in a sense that once can supply a header and a tail to it.


getFocus

protected Number getFocus()
Returns the current focus or null if unknown.


getAzimuth

protected Number getAzimuth()
Returns the target altitude.


getAltitude

protected Number getAltitude()
Returns the target altitude.


getRotation

protected Number getRotation()
Returns the current field rotation, i.e. the angle between the plumb line and the celestial North. If #isValid returns true, this will never return null.


getDerotator

protected Number getDerotator()
Returns an optional derotator offset. This method might return null.


detect

protected List<Guiding.RawStar> detect(boolean keep,
                                       int what,
                                       String type,
                                       String append,
                                       Guiding.RawFrame frame,
                                       long exposuretime,
                                       int datamin,
                                       int datamax,
                                       int searchbox)
                                throws IOException,
                                       IllegalWindowException,
                                       IllegalSearchBoxException
Does a find-stars on the guider ccd. Additionally to the StellaGuider.getGuidingStars(stella.adapter.Guiding.RawFrame, long, int, int, int, java.lang.String) method, we can specify optional keeping of the fits frames and supply individual name parts.

Parameters:
keep - If true, the raw frame plus reductional frames are kept.
what - Or'd value of StellaGuider.MEDIAN etc.
type - Defines the bias/dark frames and is the header of the permanent fits file.
append - Things to append after the unique ID.
Throws:
IOException
IllegalWindowException
IllegalSearchBoxException
See Also:
StellaGuider.getGuidingStars(stella.adapter.Guiding.RawFrame, long, int, int, int, java.lang.String)

detect

protected List<Guiding.RawStar> detect(boolean keep,
                                       int what,
                                       String type,
                                       String append,
                                       Guiding.RawFrame frame,
                                       long exposuretime,
                                       float gaussfwhm,
                                       float gausstrunc,
                                       int datamin,
                                       int datamax,
                                       int searchbox)
                                throws IOException,
                                       IllegalWindowException,
                                       IllegalSearchBoxException
Does a find-stars on the guider ccd. Additionally to the StellaGuider.getGuidingStars(stella.adapter.Guiding.RawFrame, long, int, int, int, java.lang.String) method, we can specify optional keeping of the fits frames and supply individual name parts.

Parameters:
keep - If true, the raw frame plus reductional frames are kept.
what - Or'd value of StellaGuider.MEDIAN etc.
type - Defines the bias/dark frames and is the header of the permanent fits file.
append - Things to append after the unique ID.
Throws:
IOException
IllegalWindowException
IllegalSearchBoxException
See Also:
StellaGuider.getGuidingStars(stella.adapter.Guiding.RawFrame, long, int, int, int, java.lang.String)

fieldOfViewShift

protected Point2D fieldOfViewShift(Rectangle catalog,
                                   double poserror,
                                   double magerror,
                                   List<Guiding.RawStar> found,
                                   long exposuretime,
                                   boolean oncenter)
                            throws AmbiguousPatternException,
                                   CannotMatchException,
                                   InsufficientDataException,
                                   NoStarException
Does a matching of a detected star list (which might be further cleaned by removing mirrors etc) to the field-of-view. The field of view catalog must be set.

Parameters:
catalog - The pixel serach box in the catalog, at least the frame size taken on ccd.
The - position error allowed for this catalog.
magerror - The magnitude error allowed for this catalog.
found - The list of #Guiding.RawStars to match.
exposuretime - The exposure time used on generating the found list.
Returns:
A shift in x/y, pixel
Throws:
InsufficientDataException - If the field-of-view is empty.
AmbiguousPatternException
CannotMatchException
NoStarException

getExpectedList

protected List<Guiding.RawStar> getExpectedList(Rectangle catalog,
                                                long exposuretime,
                                                boolean oncenter)
Returns the previously set field-of-view as it is expected to be seen on the CCD frame. Only positions and magnitudes are set.


fieldOfViewOffset

protected Vector2D fieldOfViewOffset(Rectangle catalog,
                                     double poserror,
                                     double magerror,
                                     List<Guiding.RawStar> found,
                                     long exposuretime,
                                     Point2D needpixel,
                                     boolean oncenter)
                              throws AmbiguousPatternException,
                                     NoStarException,
                                     InsufficientDataException,
                                     CannotMatchException
Does a matching of a detected star list (which might be further cleaned by removing mirrors etc) to the field-of-view. The field of view catalog must be set. If the caller requires the pixel offset, too, he can supply a non-null needpixel arguement, which will be filled with the offset. This is guaranteed as long as no exception is thrown. A pixel shift or offset is alway the calculated position minus the measured position, i.e. on a pinhole guider the position of the pinhole from the properties minus the position measured.

Parameters:
catalog - The pixel serach box in the catalog, at least the frame size taken on ccd.
The - position error allowed for this catalog.
magerror - The magnitude error allowed for this catalog.
found - The list of #Guiding.RawStars to match.
exposuretime - The exposure time used on generating the found list.
needpixel - If non-null,the pixel shift is entered into this point.
Returns:
A shift in azimuth and altitude, degrees.
Throws:
InsufficientDataException - If the field-of-view is empty.
AmbiguousPatternException
NoStarException
CannotMatchException

pixelToAzAltOffset

protected Vector2D pixelToAzAltOffset(Point2D pixshift)
Converts a pixel shift into an az/alt shift. A pixel shift or offset is alway the calculated position minus the measured position, i.e. on a pinhole guider the position of the pinhole from the properties minus the position measured. Only used during manual pixel offsets.


offsetAzAltToPixel

protected Point2D offsetAzAltToPixel(Vector2D dazalt)
Converts a az/alt shift into a pixel shift. A pixel shift or offset is alway the calculated position minus the measured position, i.e. on a pinhole guider the position of the pinhole from the properties minus the position measured.


starShift

protected Point2D starShift(Guiding.RawStar proximity)
Returns the offset of the Guiding.RawStar to the pinholde position in pixel. This method can be used if you already know what your guiding/acquire star is. If the star handed over is null or has no position, null is returned, otherwise the pixel shift is returned.


starShift

protected static Point2D starShift(Guiding.RawStar proximity,
                                   Point2D central)
Returns the offset of the Guiding.RawStar to the pinholde position in pixel. This method can be used if you already know what your guiding/acquire star is. If the star handed over is null or has no position, null is returned, otherwise the pixel shift is returned.


removeSpurious

protected List<Guiding.RawStar> removeSpurious(List<Guiding.RawStar> raw)
Iteratates through a list of Giding.RawStars and calculates a probability for each to be a star. Those considered non-stars are removed from the input list and returned in a separate List.

Parameters:
raw - The list where spurious detections should be removed.

isStar

protected boolean isStar(Guiding.RawStar star)
Returns true, if the star detected is truely belived to be a star. The default implementation was for a sharpness distributed like an inverse cosh and an elongation that may not be too little (due to the double-image on the beam splitter).


starOffset

protected Vector2D starOffset(Guiding.RawStar proximity,
                              Point2D needshift)
Returns the offset of the Guiding.RawStar to the pinholde position in azimuth/altitude. This method can be used if you already know what your guiding/acquire star is. If the star handed over is null or has no position, or you have no access to the field rotation, null is returned, otherwise the offset in degrees is returned.

Parameters:
proximity - The star we want to calculate the shift on.
needshift - If non-null, we enter the pixel shift into this.
Returns:
A Vector, x is azimuth offset in degrees, y altitude offset.

starOffset

protected Vector2D starOffset(Guiding.RawStar proximity,
                              Point2D center,
                              Point2D needshift)
Returns the offset of the Guiding.RawStar to the pinholde position in azimuth/altitude. This method can be used if you already know what your guiding/acquire star is. If the star handed over is null or has no position, or you have no access to the field rotation, null is returned, otherwise the offset in degrees is returned.

Parameters:
proximity - The star we want to calculate the shift on.
needshift - If non-null, we enter the pixel shift into this.
Returns:
A Vector, x is azimuth offset in degrees, y altitude offset.

getMaximumExposureTime

public long getMaximumExposureTime()
Returns the maximum time in ms allowed for the guider ccd. Defined by the RPC time-out of the server.


getGuiderScale

public double getGuiderScale()
Returns the guider scale.


estimateReferenceMag

protected double estimateReferenceMag(StarDescription star)
From the magnitude handed over we estimate the current R-magnitude of the star for calculation of exposure time or instrumental magnitudes.

Parameters:
mag - The color in the catalog color.
color - The color index according to catalog
airmass - The current airmass.
info - Must contain KEY_EPSILONMAG and KEY_KMAG.

estimateReferenceMag

private double estimateReferenceMag(float mag,
                                    float color,
                                    double airmass)
From the magnitude handed over we estimate the current R-magnitude of the star for calculation of exposure time or instrumental magnitudes.

Parameters:
mag - The color in the catalog color.
color - The color index according to catalog
airmass - The current airmass.
info - Must contain KEY_EPSILONMAG and KEY_KMAG.

estimateGuiderMag

protected double estimateGuiderMag(long expose,
                                   float mag,
                                   float col,
                                   double z)
Estimates the guider magnitude from an exposure time, a known magnitude plus color index and the current airmass. Estimates first the Reference-mag of the star, then adds the expected count rate times exposure time to it and finally applies a zero-point shift.

Parameters:
expose - Exposure time in millisec.
mag - The color in the catalog color.
col - The color index according to catalog
z - The current airmass.
info - Must contain KEY_SOURCEGUIDER, KEY_DARKGUIDER, KEY_ZETAMAG, KEY_EPSILONMAG and KEY_KMAG.

estimateExposureTime

protected long estimateExposureTime(double sn,
                                    Dimension bin,
                                    StarDescription main)
Estimates an exposure time for the guider from a desired signal-to-noise.


estimateDataMin

protected int estimateDataMin(StarDescription main,
                              double exptime)
Estimates the datamin of a read-out stripe we will get on a star. The exposure time will come from the properties, a more correct formular can be estimated like this: Suppose you have an gaussian profile for your star, then the peak flux will be
       I_0=Φ∗/2πσ²,
       
If we read out at a speed v pixel/sec, a pixel directly in the path of the read-out strip will get
       I_s=2∫I_0exp(-v²t²/2σ²)dt
       
counts, or, if integrating to t=∞
       I_s=Φ∗/(vσ√(2π)).
       
Thus the exposure time you specify here should be 1/2.5*v*sigma.


dataMin

private int dataMin(double rmag,
                    double exptime)

exposureTimeFor

private long exposureTimeFor(double aim,
                             double rmag)
Calculates the exposure time from a given, binning corrected S/N.
       I_*=K_S*10^(-.4*R_mag)
I_t=I_*+I_d
I_r=I_*sqrt(4*K_R/(S/N)^2+(I_t/I_*)^2)
t_exp=0.5*REFERENCEEXPOSE*(S/N)^2*(I_t+I_r)/I_*^2
where the last formular can be written as
       t_exp=0.5*REFERENCEEXPOSE*(S/N)^2/I_*O(1),
       
meaning that the exposure time is indirectly proportional to KEY_SOURCEGUIDER.


getAirmass

private double getAirmass()
Converts the altitude parameter to the airmass. If the altitude is not defined, we issue a warning and return 1.


removeStripes

protected List<Guiding.RawStar> removeStripes(List<Guiding.RawStar> stars)
For bright stars, stars brighter than 9th mag, read-out stripes can be seen in the image because of the shutterless operation. We remove those here assuming the following: The star that produces the read-out stripes is always at the position with the highest y value. Stripes have only marginally different x. The stroke parameter of the raw star is then queried, if it is lower than KEY_STRIPESMAX, the image is considered a read-out stripe and removed from the list.

This method is only there for convenience, see Shutterless.


getAzAltOffset

private Vector2D getAzAltOffset(Point2D pixshift,
                                double theta)
Converts a distance in CCD-pixel to a distance in current alt/az in degrees. This az alt offset is always the offset which should be added to the telescope to get it to the correct position. A pixel shift or offset is alway the calculated position minus the measured position, i.e. on a pinhole guider the position of the pinhole from the properties minus the position measured.

Parameters:
pixshift - Shift in unbinned pixels on the CCD.
alt - The height of the target for normalizing azimuth shift.
theta - Current angle between CCD-x and az/alt.
info - Properties containing the guider scale.

getPixelOffset

private Point2D getPixelOffset(Vector2D dazalt,
                               double theta)
Converts a distance in az/alt in degrees into a pixel distance. A pixel shift or offset is alway the calculated position minus the measured position, i.e. on a pinhole guider the position of the pinhole from the properties minus the position measured.

Parameters:
dazalt - The shift in azimuth and altitude, degrees.
theta - Current angle between CCD-x and az/alt.
Returns:
A pixel shift in unbinned CCD pixel

closestToPinhole

protected Guiding.RawStar closestToPinhole(List<Guiding.RawStar> raw,
                                           double maxdistance)
During guiding we assume that the target star is close to the direct mirror position. We scan the list provided for the closest Guiding#RawStar to this position and return it. If no entry is found within the provided maximum distance, null is returned.

Parameters:
raw - The list with all detections.
maxdistance - The maximum allowed distance in pixels.

closestToPixel

protected static Guiding.RawStar closestToPixel(Point2D pinhole,
                                                List<Guiding.RawStar> raw,
                                                double maxdistance)
During guiding we assume that the target star is close to the direct mirror position. We scan the list provided for the closest Guiding#RawStar to this position and return it. If no entry is found within the provided maximum distance, null is returned.

Parameters:
raw - The list with all detections.
maxdistance - The maximum allowed distance in pixels.

getPinholeNeighbours

protected List<Guiding.RawStar> getPinholeNeighbours(List<Guiding.RawStar> found,
                                                     double d)
Returns a list of all Guiding.RawStars found in the vicinity of the pinhole.


getCatalogList

private List<Guiding.RawStar> getCatalogList(List<StarDescription> stars,
                                             Rectangle box,
                                             long expose,
                                             boolean oncenter)
Converts a list of catalog stars to a list of Guiding#RawStars. The current field rotation is taken into account on calculating the desired positions.

Parameters:
stars - A list of StarDescriptions.
box - The box on the CCD plus pointing offset growth.
expose - The exposure time for estimating guider mags.
oncenter - True, if we query for this list during final acquire on center star.

getCatalogPosition

protected Point2D getCatalogPosition(StarDescription catalog)
Returns the calculated position of the star on the guider CCD. This is the position of the star on a perfectly pointing telescope.

Parameters:
catalog - A star from the fov star catalog.
Returns:
Position on CCD in pixel.

getNeighbours

protected static List<Guiding.RawStar> getNeighbours(List<Guiding.RawStar> principal,
                                                     Point2D center,
                                                     double d)
We scan a list of Guiding.RawStars and return all entries that are within a certain distance to the given center point.


getStrip

protected static List<Guiding.RawStar> getStrip(List<Guiding.RawStar> principal,
                                                Point2D center,
                                                double dist)
We scan a list of Guiding.RawStars and return all entries that are within a certain column, defined in center.