stella.util
Class GuiderData

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.util.GuiderData
All Implemented Interfaces:
Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class GuiderData
extends PropertyBundles

A base class to read image reduction data from the guider CCD. This class supplies access to individual datas files. Various inner classes allow the user to process the data further.


Nested Class Summary
static class GuiderData.Integrity
          A class to test the integrity of the data file.
static class GuiderData.Regular
          A class that prints out all position files that do not show the same number of mirrors and direct images or have a missing main star.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  double airmass
          The airmass of the object at observing time.
private static String DEFCATALOG
          The default catalog name used for vizier resolving.
private static String DEFDATAEXT
          The string to append to get from truncated to position data.
private static String DEFDATE
          The fits-header key to the file ceration time.
private static Format DEFDATEFORMAT
          The default date formatter in the fits file date.
private static long DEFEXPMULTI
          The default multiplier to get from fits exp-time to ms.
private static String DEFEXPTIME
          The fits-header key to the exposure time.
private static String DEFFITSEXT
          The string to append to get from truncated to fits file.
private static boolean DEFIGNOREHEADERDATE
          The string to append to get from truncated to position data.
private static String DEFSITE
          The default site name, parsable from Site.
private static String DEFURLRESOURCES
          Default URL of fits data directory and position directory.
private  long exposure
          The exposure time (ms).
private  List ghosts
          A list of mirror ghotst.
static String KEY_CATALOG
          The key to the main catalog name vor Vizier resolves.
static String KEY_DATAEXT
          The extension to get from the name header to the positions file.
static String KEY_DATE
          The fits header key for date.
static String KEY_DATEFORMAT
          The key to the date formatter used in the fits header.
static String KEY_EXPMULTI
          The multiplier to get from the fits exposure time to ms.
static String KEY_EXPTIME
          The fits header key for exposure time.
static String KEY_FITSEXT
          The extension to get from the name header to the fits file.
static String KEY_IGNOREHEADERDATE
          If true, the fits modification time is used instead of Header time.
static String KEY_SITE
          The key to the name of the observing site.
private  Latitude latitude
          The latitude of the observatory.
private  Longitude longitude
          The longitude of the observatory.
private  StarDescription main
          The StarDescription object retrieved for object name.
private  List mirrors
          A list of star mirror images.
private  String name
          The catalog-resolvable object name.
private  List nonstars
          A list of non-stars, ordered as encountered in the file.
private  List spurious
          A list of spurious detections.
private  List stars
          A list of stars, where the index is the star number.
private  Date time
          The date of the guider image.
private  String truncated
          The truncated guidere image and data file.
 
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
GuiderData(Map prop, String mainname)
          Constructs a new guider data object from a truncated file name.
GuiderData(String mainname)
          Constructs a new guider data object from a truncated file name.
 
Method Summary
 double getAirmass()
          Returns the airmass of the observation.
private static double getAirmass(StarDescription star, Date when, Longitude lambda, Latitude phi)
          Takes a StarDescription object that has at least the right ascension and declination of the star defined and calculates the airmass at the given time for the given location.
 StarDescription getCatalogMain()
          Returns the main star entry.
 long getExposureTime()
          Returns the exposure time in millisec.
private static nom.tam.fits.Header getFitsHeader(URL file)
          Takes a resource and parses the first header if it is a fits-file.
 List getGhosts()
          Returns the list of ghost images to the mirror images.
private static StarDescription getMainStar(String name, String cat)
          Resolve the catalog name.
 List getMirrors()
          Returns the list of mirrors.
 List getNonStars()
          Returns the list of non-stars.
private static List getRawStars(List lines)
          Takes a list of ascii-descriptions of raw stars and converts them into a list of Guiding.RawStars.
 List getSpurious()
          Returns the list of spurios detections.
 List getStars()
          Returns the list of stars detected.
 Guiding.RawStar getTargetMirror()
          Returns the main star mirror or null if not detected.
 Guiding.RawStar getTargetStar()
          Returns the main star entry or null if not detected.
 Date getTime()
          Returns the date of the exposure.
 String getTruncated()
          Returns the truncated file name.
 boolean hasTargetMirror()
          Returns true if the main star is detected and has a mirror.
private static String parseFromFile(String file)
          From a truncated file name, we parse a hopefully resolvable catalog name out of it.
 boolean resolveAirmass()
          Resolves the airmass of the target at the time of observation this method will only succeed if the position of the main star is known #resolveMain and if the date of the exposure time is valid.
 boolean resolveCatalogMain()
          Resolves the main star by passing the parsed star name and the catalog name to getMainStar(java.lang.String, java.lang.String).
 boolean resolveFitsTimes()
          Resolves the image properties like exposure time and file creation time.
 boolean resolvePositions()
          Reads the data from a position file with the ASCII-format
 void setGhosts(List setghosts)
          Sets the list of ghosts.
 void setMirrors(List setmirrors)
          Sets the mirror list.
 void setNonStars(List setnonstars)
          Sets the list of non-stars, but still star-like.
 void setSpurious(List setspurious)
          Sets the list of spurious detections.
 void setStars(List setstars)
          Sets the list of stars.
 boolean writeGuiderData()
          Writes the guider data to a new file, constructed from truncated file name.
 
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

KEY_CATALOG

public static final String KEY_CATALOG
The key to the main catalog name vor Vizier resolves.

See Also:
Constant Field Values

KEY_SITE

public static final String KEY_SITE
The key to the name of the observing site.

See Also:
Constant Field Values

KEY_DATE

public static final String KEY_DATE
The fits header key for date.

See Also:
Constant Field Values

KEY_DATEFORMAT

public static final String KEY_DATEFORMAT
The key to the date formatter used in the fits header.

See Also:
Constant Field Values

KEY_EXPTIME

public static final String KEY_EXPTIME
The fits header key for exposure time.

See Also:
Constant Field Values

KEY_EXPMULTI

public static final String KEY_EXPMULTI
The multiplier to get from the fits exposure time to ms.

See Also:
Constant Field Values

KEY_FITSEXT

public static final String KEY_FITSEXT
The extension to get from the name header to the fits file.

See Also:
Constant Field Values

KEY_DATAEXT

public static final String KEY_DATAEXT
The extension to get from the name header to the positions file.

See Also:
Constant Field Values

KEY_IGNOREHEADERDATE

public static final String KEY_IGNOREHEADERDATE
If true, the fits modification time is used instead of Header time.

See Also:
Constant Field Values

DEFURLRESOURCES

private static final String DEFURLRESOURCES
Default URL of fits data directory and position directory.

See Also:
Constant Field Values

DEFCATALOG

private static final String DEFCATALOG
The default catalog name used for vizier resolving.

See Also:
Constant Field Values

DEFSITE

private static final String DEFSITE
The default site name, parsable from Site.

See Also:
Constant Field Values

DEFDATE

private static final String DEFDATE
The fits-header key to the file ceration time.

See Also:
Constant Field Values

DEFDATEFORMAT

private static final Format DEFDATEFORMAT
The default date formatter in the fits file date.


DEFEXPTIME

private static final String DEFEXPTIME
The fits-header key to the exposure time.

See Also:
Constant Field Values

DEFEXPMULTI

private static final long DEFEXPMULTI
The default multiplier to get from fits exp-time to ms.

See Also:
Constant Field Values

DEFFITSEXT

private static final String DEFFITSEXT
The string to append to get from truncated to fits file.

See Also:
Constant Field Values

DEFDATAEXT

private static final String DEFDATAEXT
The string to append to get from truncated to position data.

See Also:
Constant Field Values

DEFIGNOREHEADERDATE

private static final boolean DEFIGNOREHEADERDATE
The string to append to get from truncated to position data.

See Also:
Constant Field Values

truncated

private String truncated
The truncated guidere image and data file.


stars

private List stars
A list of stars, where the index is the star number.


mirrors

private List mirrors
A list of star mirror images. Mirrors missing are null elements.


ghosts

private List ghosts
A list of mirror ghotst.


nonstars

private List nonstars
A list of non-stars, ordered as encountered in the file.


spurious

private List spurious
A list of spurious detections.


time

private Date time
The date of the guider image. Inferred from modification time.


exposure

private long exposure
The exposure time (ms). Read from the #EXPTIME header card.


name

private String name
The catalog-resolvable object name. Parsed from file name.


main

private StarDescription main
The StarDescription object retrieved for object name.


longitude

private Longitude longitude
The longitude of the observatory.


latitude

private Latitude latitude
The latitude of the observatory.


airmass

private double airmass
The airmass of the object at observing time.

Constructor Detail

GuiderData

public GuiderData(String mainname)
Constructs a new guider data object from a truncated file name. The file name is also used to parse the catalog resolvable name out of it. The site name is STELLA. Nothing else is done until methods like #readData etc. are called. The vizier catalog used is the hipparchos catalog.


GuiderData

public GuiderData(Map prop,
                  String mainname)
Constructs a new guider data object from a truncated file name. The file name is also used to parse the catalog resolvable name out of it. The site name is used to parse the geographical longitude and latitude out of it. Nothing else is done until methods like #readData etc. are called.

Method Detail

getTruncated

public String getTruncated()
Returns the truncated file name.


getStars

public List getStars()
Returns the list of stars detected. Stars are indicated with positive integer ids.


setStars

public void setStars(List setstars)
Sets the list of stars.


getMirrors

public List getMirrors()
Returns the list of mirrors. Mirrors are indicated with negative integer ids.


setMirrors

public void setMirrors(List setmirrors)
Sets the mirror list.


getGhosts

public List getGhosts()
Returns the list of ghost images to the mirror images. Ghosts are inidicated with negative non-integer ids. The part before the comma is the index of the mirror the ghosts belongs to.


setGhosts

public void setGhosts(List setghosts)
Sets the list of ghosts.


getNonStars

public List getNonStars()
Returns the list of non-stars. Non-stars are inidcated with a zero id and might be anything, but normally images of the fiber.


setNonStars

public void setNonStars(List setnonstars)
Sets the list of non-stars, but still star-like.


getSpurious

public List getSpurious()
Returns the list of spurios detections. Those are detections depending on the image reduction. They have an 'x' in their id column.


setSpurious

public void setSpurious(List setspurious)
Sets the list of spurious detections.


writeGuiderData

public boolean writeGuiderData()
                        throws IOException
Writes the guider data to a new file, constructed from truncated file name. If the output file exists, rename it.

Throws:
IOException

getTime

public Date getTime()
Returns the date of the exposure.


getExposureTime

public long getExposureTime()
Returns the exposure time in millisec.


getAirmass

public double getAirmass()
Returns the airmass of the observation.


getCatalogMain

public StarDescription getCatalogMain()
Returns the main star entry.


getTargetStar

public Guiding.RawStar getTargetStar()
Returns the main star entry or null if not detected.


getTargetMirror

public Guiding.RawStar getTargetMirror()
Returns the main star mirror or null if not detected.


hasTargetMirror

public boolean hasTargetMirror()
Returns true if the main star is detected and has a mirror.


resolveCatalogMain

public boolean resolveCatalogMain()
Resolves the main star by passing the parsed star name and the catalog name to getMainStar(java.lang.String, java.lang.String).

Returns:
True on success.

resolveFitsTimes

public boolean resolveFitsTimes()
Resolves the image properties like exposure time and file creation time.


resolveAirmass

public boolean resolveAirmass()
Resolves the airmass of the target at the time of observation this method will only succeed if the position of the main star is known #resolveMain and if the date of the exposure time is valid.


resolvePositions

public boolean resolvePositions()
Reads the data from a position file with the ASCII-format
       xc yc mag sharp elong theta area sky fwhm id
       
where xc/yc are the position on the CCD in pixel, mag is the instrumental magnitude of the star, sharp the sharpness parameter, elong the elongation of the image (zero for perfect roundness), theta the position angle in degrees of the major axis of the object ellipse, to x-direction, area the number of pixels within the search-box considered for the object, sky the average of the 'good' pixel values, fwhm the full-width half-maximum of the image, and id is zero for non-stars, positive numbers for direct star images, starting with one for the main star, and negative indices for mirrored images, the absoulte value being the index of the direct star image. Ghosts to these mirrors are non-integers (linke '-1.1'), where the integer part is the mirror the ghosts belongs to. Spurious detections, i.e. those that are artifacts of the image reduction are indicated with an 'x' in the id field.


getRawStars

private static List getRawStars(List lines)
Takes a list of ascii-descriptions of raw stars and converts them into a list of Guiding.RawStars. Data following the tenth column is ignored.


getFitsHeader

private static nom.tam.fits.Header getFitsHeader(URL file)
Takes a resource and parses the first header if it is a fits-file.


getAirmass

private static double getAirmass(StarDescription star,
                                 Date when,
                                 Longitude lambda,
                                 Latitude phi)
Takes a StarDescription object that has at least the right ascension and declination of the star defined and calculates the airmass at the given time for the given location.


getMainStar

private static StarDescription getMainStar(String name,
                                           String cat)
Resolve the catalog name. We query simbad for the object using the parsed name and the catalog used for resolving, #catalog.


parseFromFile

private static String parseFromFile(String file)
From a truncated file name, we parse a hopefully resolvable catalog name out of it. The character found until the first number constituite a catalog name. All numbers then are the catalog number, the rest of the name is ignored.