stella.adapter
Class AdapterGuider

java.lang.Object
  extended by util.PropertyContainer
      extended by stella.adapter.StellaGuider
          extended by stella.adapter.AdapterGuider
All Implemented Interfaces:
Cloneable, Guiding, Initializable, PropertyBearing

public class AdapterGuider
extends StellaGuider

A helper class that houses methods for the adapter master and its subsystems.


Nested Class Summary
static class AdapterGuider.Exposure
          Test class to print out estimated magnitudes.
static class AdapterGuider.Location
          Test class for calculating the expected guider locations from a list of stars.
static class AdapterGuider.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.PropertyContainer
PropertyContainer.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 static double DEFALIGNMENTANGLE
          Alignment angle of the guider ccd with respect to north.
private static double DEFDARKGUIDER
          The default dark/sky countrate.
private static double DEFDETECTIONLIMIT
          The default minimum instrumental magnitude to not be spurious.
private static Point2D DEFDIRECTPINHOLE
          The pinhole location on the direct image.
private static double DEFELONGATIONMAX
          The default maximum elongation for round stars.
private static double DEFELONGATIONWIDTH
          The minimum fwhm for a valid star detection.
private static double DEFEPSILONMAG
          The default epsilon for the full light guider CCD.
private static boolean DEFFIXEDDEROTATOR
          Default status of the derotator.
private static double DEFGHOSTDISTANCE
          The mxium offset of the mirror ghost from the ghostellipse.
private static MyEllipse DEFGHOSTELLIPSE
          The ring with the ghosts of the mirror image if on edge.
private static double DEFGUIDERSCALE
          The image scale on the direct image.
private static double DEFKMAG
          The default k prime parameter for the full light guider CCD.
private static long DEFMAXTIMEGUIDER
          Maximum exposure time on acquire in ms.
private static Point2D DEFMIRRORCENTER
          The virtual center of mirroring.
private static double DEFMIRRORDECAY
          The expected magnitude decay constant of mirror image.
private static double DEFMIRRORDECAYHALF
          The expected pixel length over which a decay occurs.
private static double DEFMIRROREDGE
          The maximum offset from mirrorellipse to produce ghosts.
private static MyEllipse DEFMIRRORELLIPSE
          The circlular mirror at the fiber entrance, as seen on guider.
private static double DEFMIRRORFAINT
          The distance whithin mirror magnitude is low due to fiber entrance.
private static double DEFMIRRORMAG
          The expected magnitude difference of mirror image.
private static double DEFMIRRORMAGSIGMA
          The deviation of the mirror mag to be considered as mirror.
private static double DEFMIRROROFFSET
          The sigma on the mirror center position.
private static double DEFMIRROROUTSIDE
          The multiplier for mirror image fainterness error if outside main.
private static Point2D DEFMIRRORPINHOLE
          The pinhole location on the mirror image.
private static double DEFMIRRORSCALE
          The default image scale on the mirror image.
private static double DEFREADOUTGUIDER
          The default bias level on the guider CCD.
private static double DEFSHARPPEAK
          The default minimum sharpness for star images.
private static double DEFSHARPWIDTH
          The default maximum sharpness for star images.
private static double DEFSOURCEGUIDER
          The gain for a R=10 star.
private static double DEFSTRIPDISTANCE
          The maximum column offset of read-out stripes.
private static double DEFSTRIPESMAX
          The maximum stroke value read-out stripes may have.
private static double DEFSURESTRIPES
          Detection with a stroke below this are always stripes..
private static double DEFZETAMAG
          The default zero point for the guider CCD.
private  Value derotoff
          We cache the derotator offset parameter.
private  List 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_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_FIXEDDEROTATOR
          Status of the derotator.
static String KEY_GHOSTDISTANCE
          The expected maximum distance from ghost ring.
static String KEY_GHOSTELLIPSE
          The shape on the CCD where mirrored images will fall into.
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_MIRRORCENTER
          The mirror point of the center.
static String KEY_MIRRORDECAY
          The expected magnitude decay constant of mirror image.
static String KEY_MIRRORDECAYHALF
          The expected pixel length over which a decay occurs.
static String KEY_MIRROREDGE
          The expected thickness where ghost may occur.
static String KEY_MIRRORELLIPSE
          The shape on the CCD where mirrored images will fall into.
static String KEY_MIRRORFAINT
          The distance within the pinhole where mirrors are fainter.
static String KEY_MIRRORMAG
          The expected magnitude difference of mirror image.
static String KEY_MIRRORMAGSIGMA
          The maximum deviation of the mirror mag to be considered as mirror.
static String KEY_MIRROROFFSET
          The sigma on the mirror center position.
static String KEY_MIRROROUTSIDE
          The multiplier for mirror image fainterness error if outside main.
static String KEY_MIRRORPINHOLE
          The pinhole position on the reflected image, normally not used.
static String KEY_MIRRORSCALE
          The guider scale on the reflected image, normally not used.
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.PropertyContainer
KEY_LISTSEPARATOR, KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR, KEY_NOINITONCREATE, KEY_RESOURCEBUNDLES
 
Fields inherited from interface util.PropertyBearing
CONFIG, KEY_CLASS, KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
AdapterGuider(Map prop)
          Constructs a new adapter helper, defaulting all properties.
 
Method Summary
protected  Guiding.RawStar closestToFiber(List raw, double maxdistance)
          During guiding we assume that the target star is close to the direct mirror position.
protected  List 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 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.
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 found, long exposuretime, Point2D needpixel)
          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 found, long exposuretime)
          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  Value 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.
private  List getCatalogList(List stars, Rectangle box, long expose)
          Converts a list of catalog stars to a list of Guiding#RawStars.
private  Number getCurrentAzAltRotation()
          Returns the current azimuth/altitude alignment angle, depending on fixed or non-fixed derotator and on target.
private  Number getCurrentFieldRotation()
          Returns the current field rotation angle, depending on fixed or non-fixed derotator and target.
protected  Value getDerotator()
          Returns an optional derotator offset.
protected  List 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  double getMirrorFaintness()
          Returns the mirror faintness.
protected  Point2D getMirrorPosition(Point2D direct)
          Converts a position on the direct image to the mirror position.
private static List getNeighbours(List 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 getPinholeNeighbours(List found, double d)
          Returns a list of all Guiding.RawStars found in the vicinity of the pinhole.
protected  Value getRotation()
          Returns the current field rotation, i.e.
private static List getStrip(List 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  Vector2D pixelToAzAltOffset(Point2D pixshift)
          Converts a pixel shift into an az/alt shift.
protected  List removeGhosts(List mirrors, List stars)
          A further complication are mirrors that spark ghosts.
protected  List removeMirrors(List stars)
          Iterates through a list of stars and tries to detect mirror images.
protected  List removeSpurious(List raw)
          Iteratates through a list of Giding.RawStars and calculates a probability for each to be a star.
protected  List removeStripes(List stars)
          For bright stars, stars brighter than 9th mag, read-out stripes can be seen in the image because of the shutterless operation.
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 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  Point2D starShift(Guiding.RawStar proximity)
          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.PropertyContainer
augment, augment, augment, clone, createFrom, createFrom, createFrom, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getLocalClassLoader, getLocalized, getLocalized, getLocalizedString, getLocalizedString, getProperties, getPropertiesToKey, getPropertiesToKey, getProperty, getResource, getResourceAsStream, getResourceFromKey, getResources, has, init, isNew, keyCreate, keyCreate, parseObject, reload, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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_MIRRORELLIPSE

public static final String KEY_MIRRORELLIPSE
The shape on the CCD where mirrored images will fall into.

See Also:
Constant Field Values

KEY_GHOSTELLIPSE

public static final String KEY_GHOSTELLIPSE
The shape on the CCD where mirrored images will fall into.

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_MIRRORSCALE

public static final String KEY_MIRRORSCALE
The guider scale on the reflected image, normally not used.

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_MIRRORPINHOLE

public static final String KEY_MIRRORPINHOLE
The pinhole position on the reflected image, normally not used.

See Also:
Constant Field Values

KEY_MIRRORCENTER

public static final String KEY_MIRRORCENTER
The mirror point of the center.

See Also:
Constant Field Values

KEY_MIRRORFAINT

public static final String KEY_MIRRORFAINT
The distance within the pinhole where mirrors are fainter.

See Also:
Constant Field Values

KEY_MIRROROFFSET

public static final String KEY_MIRROROFFSET
The sigma on the mirror center position. Search radius 3sigma.

See Also:
Constant Field Values

KEY_MIRRORMAG

public static final String KEY_MIRRORMAG
The expected magnitude difference of mirror image.

See Also:
Constant Field Values

KEY_MIRRORMAGSIGMA

public static final String KEY_MIRRORMAGSIGMA
The maximum deviation of the mirror mag to be considered as mirror.

See Also:
Constant Field Values

KEY_MIRROROUTSIDE

public static final String KEY_MIRROROUTSIDE
The multiplier for mirror image fainterness error if outside main.

See Also:
Constant Field Values

KEY_MIRRORDECAY

public static final String KEY_MIRRORDECAY
The expected magnitude decay constant of mirror image.

See Also:
Constant Field Values

KEY_MIRRORDECAYHALF

public static final String KEY_MIRRORDECAYHALF
The expected pixel length over which a decay occurs.

See Also:
Constant Field Values

KEY_MIRROREDGE

public static final String KEY_MIRROREDGE
The expected thickness where ghost may occur.

See Also:
Constant Field Values

KEY_GHOSTDISTANCE

public static final String KEY_GHOSTDISTANCE
The expected maximum distance from ghost ring.

See Also:
Constant Field Values

KEY_FIXEDDEROTATOR

public static final String KEY_FIXEDDEROTATOR
Status of the derotator.

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

DEFREADOUTGUIDER

private static final double DEFREADOUTGUIDER
The default bias level on the guider CCD.

See Also:
Constant Field Values

DEFDARKGUIDER

private static final double DEFDARKGUIDER
The default dark/sky countrate.

See Also:
Constant Field Values

DEFSOURCEGUIDER

private static final double DEFSOURCEGUIDER
The gain for a R=10 star.

See Also:
Constant Field Values

DEFMAXTIMEGUIDER

private static final long DEFMAXTIMEGUIDER
Maximum exposure time on acquire in ms.

See Also:
Constant Field Values

DEFSHARPPEAK

private static final double DEFSHARPPEAK
The default minimum sharpness for star images.

See Also:
Constant Field Values

DEFSHARPWIDTH

private static final double DEFSHARPWIDTH
The default maximum sharpness for star images.

See Also:
Constant Field Values

DEFELONGATIONMAX

private static final double DEFELONGATIONMAX
The default maximum elongation for round stars.

See Also:
Constant Field Values

DEFELONGATIONWIDTH

private static final double DEFELONGATIONWIDTH
The minimum fwhm for a valid star detection.

See Also:
Constant Field Values

DEFSURESTRIPES

private static final double DEFSURESTRIPES
Detection with a stroke below this are always stripes..

See Also:
Constant Field Values

DEFSTRIPESMAX

private static final double DEFSTRIPESMAX
The maximum stroke value read-out stripes may have.

See Also:
Constant Field Values

DEFSTRIPDISTANCE

private static final double DEFSTRIPDISTANCE
The maximum column offset of read-out stripes.

See Also:
Constant Field Values

DEFDETECTIONLIMIT

private static final double DEFDETECTIONLIMIT
The default minimum instrumental magnitude to not be spurious.

See Also:
Constant Field Values

DEFMIRRORELLIPSE

private static final MyEllipse DEFMIRRORELLIPSE
The circlular mirror at the fiber entrance, as seen on guider.


DEFGHOSTELLIPSE

private static final MyEllipse DEFGHOSTELLIPSE
The ring with the ghosts of the mirror image if on edge.


DEFMIRROREDGE

private static final double DEFMIRROREDGE
The maximum offset from mirrorellipse to produce ghosts.

See Also:
Constant Field Values

DEFGHOSTDISTANCE

private static final double DEFGHOSTDISTANCE
The mxium offset of the mirror ghost from the ghostellipse.

See Also:
Constant Field Values

DEFGUIDERSCALE

private static final double DEFGUIDERSCALE
The image scale on the direct image. Pixel per radian, 0.297"/px.

See Also:
Constant Field Values

DEFMIRRORSCALE

private static final double DEFMIRRORSCALE
The default image scale on the mirror image. Pixel per radian.

See Also:
Constant Field Values

DEFDIRECTPINHOLE

private static final Point2D DEFDIRECTPINHOLE
The pinhole location on the direct image. Calculated from mirror.


DEFMIRRORPINHOLE

private static final Point2D DEFMIRRORPINHOLE
The pinhole location on the mirror image. Measured with backlight.


DEFMIRRORCENTER

private static final Point2D DEFMIRRORCENTER
The virtual center of mirroring.


DEFMIRRORFAINT

private static final double DEFMIRRORFAINT
The distance whithin mirror magnitude is low due to fiber entrance.

See Also:
Constant Field Values

DEFMIRROROFFSET

private static final double DEFMIRROROFFSET
The sigma on the mirror center position. Search radius 3sigma.

See Also:
Constant Field Values

DEFMIRRORMAG

private static final double DEFMIRRORMAG
The expected magnitude difference of mirror image.

See Also:
Constant Field Values

DEFMIRRORMAGSIGMA

private static final double DEFMIRRORMAGSIGMA
The deviation of the mirror mag to be considered as mirror. True 0.08

See Also:
Constant Field Values

DEFMIRROROUTSIDE

private static final double DEFMIRROROUTSIDE
The multiplier for mirror image fainterness error if outside main.

See Also:
Constant Field Values

DEFMIRRORDECAY

private static final double DEFMIRRORDECAY
The expected magnitude decay constant of mirror image.

See Also:
Constant Field Values

DEFMIRRORDECAYHALF

private static final double DEFMIRRORDECAYHALF
The expected pixel length over which a decay occurs.

See Also:
Constant Field Values

DEFFIXEDDEROTATOR

private static final boolean DEFFIXEDDEROTATOR
Default status of the derotator.

See Also:
Constant Field Values

DEFALIGNMENTANGLE

private static final double DEFALIGNMENTANGLE
Alignment angle of the guider ccd with respect to north.

See Also:
Constant Field Values

DEFZETAMAG

private static final double DEFZETAMAG
The default zero point for the guider CCD.

See Also:
Constant Field Values

DEFKMAG

private static final double DEFKMAG
The default k prime parameter for the full light guider CCD.

See Also:
Constant Field Values

DEFEPSILONMAG

private static final double DEFEPSILONMAG
The default epsilon for the full light guider CCD.

See Also:
Constant Field Values

fov

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


unique

private Parameter unique
We cache the Unique 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.


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

AdapterGuider

public AdapterGuider(Map prop)
Constructs a new adapter helper, defaulting all properties.

Method Detail

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 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.

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.

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.


getAltitude

protected Value getAltitude()
Returns the target altitude. If #isValid returns true, this will never return null.


getRotation

protected Value 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 Value getDerotator()
Returns an optional derotator offset. This method might return null.


detect

protected List 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 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 found,
                                   long exposuretime)
                            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

fieldOfViewOffset

protected Vector2D fieldOfViewOffset(Rectangle catalog,
                                     double poserror,
                                     double magerror,
                                     List found,
                                     long exposuretime,
                                     Point2D needpixel)
                              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.

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. Only used during manual pixel offsets.


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.


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.

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

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.


exposureTimeFor

private long exposureTimeFor(double aim,
                             double rmag)
Calculates the exposure time from a given, binning corrected S/N.


getMirrorPosition

protected Point2D getMirrorPosition(Point2D direct)
Converts a position on the direct image to the mirror position. No range checks applied.


getAirmass

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


getCurrentFieldRotation

private Number getCurrentFieldRotation()
Returns the current field rotation angle, depending on fixed or non-fixed derotator and target. Offset is applied. If parameters are missing, null is returned. Used for converting ra/dec to pixel.

Parameters:
alt - Height of target, needed for fixed derotators.
imrot - Field rotation in focal plane, needed for fixed derot.
derotoffset - For non-fixed derotators, the constant offset
Returns:
Current Nasmith filed rotation with offset in degrees.

getCurrentAzAltRotation

private Number getCurrentAzAltRotation()
Returns the current azimuth/altitude alignment angle, depending on fixed or non-fixed derotator and on target. Derotator offset is applied. If parameters are missing, null is returned. Used for converting pixels to alt/az.

Parameters:
alt - Height of target, needed for fixed derotators.
imrot - Field rotation in focal plane, needed for fixed derot.
derotoffset - For non-fixed derotators, the constant offset
Returns:
The rotation angle between x/y and current alt/az in degrees.

getAzAltOffset

private Vector2D getAzAltOffset(Point2D pixshift,
                                double theta)
Converts a distance in CCD-pixel to a distance in current alt/az in degrees.

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.

closestToFiber

protected Guiding.RawStar closestToFiber(List 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 getPinholeNeighbours(List found,
                                    double d)
Returns a list of all Guiding.RawStars found in the vicinity of the pinhole.


getMirrorFaintness

protected double getMirrorFaintness()
Returns the mirror faintness. This is the magnitude difference between the mirror image and the direct image, if the mirror image is not obstructed by the pinhole.


getCatalogList

private List getCatalogList(List stars,
                            Rectangle box,
                            long expose)
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.
alt - The current target height.
imrot - The current field rotation in the focal plane.
info - Access to various guider properties.

removeSpurious

protected List removeSpurious(List 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.

removeMirrors

protected List removeMirrors(List stars)
Iterates through a list of stars and tries to detect mirror images. Normally, the mirror image should be a little bit weaker, as defined in KEY_MIRRORMAG, but, as KEY_MIRRORMAGSIGMA can exceed this difference this is not guranteed. Thus we go through the entire list of stars and try to detect mirrors, either as the entries itself or via its mirror image.


removeGhosts

protected List removeGhosts(List mirrors,
                            List stars)
A further complication are mirrors that spark ghosts. This is only possible on the edge of the mirror, thus from all detected mirrors, we look-up our stars to find those ghosts. The ghosts are removed from the star list and returned in a separate list.


removeStripes

protected List removeStripes(List 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.


getNeighbours

private static List getNeighbours(List 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

private static List getStrip(List 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.