stella.util
Class ImageAmoeba

java.lang.Object
  extended by util.PropertyContainer
      extended by stella.util.ImageAmoeba
All Implemented Interfaces:
Cloneable, Initializable, PropertyBearing, Multidimensional

public class ImageAmoeba
extends PropertyContainer
implements Multidimensional, Initializable

This class searches the parameter space to determine the best values to use on guider images for preparing a star detection. First attempt with minimizing 7 parameters has too poor convergence, thus in the current version only three parameters are optimized with the amoeba, while others are searched with brute-force. The amoeba parameters are:

Other interesting parameters are integers and solved with an trial-and-error approach. These parameters are Especially for big sizes of the median box, evaluation can be slow.


Nested Class Summary
static class ImageAmoeba.Single
          A single run with hard-coded low-pass size, median-size and search box.
 
Nested classes/interfaces inherited from class util.PropertyContainer
PropertyContainer.URLResource
 
Field Summary
private  File bias
          Fits file to the bias frame.
private  File dark
          Fits file to the scalable dark frame.
private static double DEFDEVIATION
          The default allowed squared deviation in square-pixel.
private static double DEFELONGATION
          The default elongation at which penalties occur.
private static double DEFELONGPENALTY
          The default elongation penalty.
private static double DEFFAULTPENALTY
          The default fault penalty.
private static File DEFFITSDIR
          The default fits directory.
private static double DEFMAG
          The default magnitude at which penalties occur.
private static double DEFMAGPENALTY
          The default magnitude penalty.
private static double DEFSHARPMAX
          The default maximum sharp which penalties occur.
private static double DEFSHARPMIN
          The default maximum sharp which penalties occur.
private static double DEFSHARPPENALTY
          The default elongation penalty.
private static double DEFSTARPENALTY
          The default star penalty.
private static boolean DEFUPDATE
          The default update behaviour.
private  Map fits
          The map of fits files to star lists found in the position files.
private  int kernelsize
          Size of low-pass kernel.
static String KEY_DEVIATION
          The tolerance in position difference.
static String KEY_ELONGATION
          The maximum elongation without penalty.
static String KEY_ELONGPENALTY
          The penalty for stars with an elongation above KEY_ELONGATION.
static String KEY_FAULTPENALTY
          The penalty for each non-object identified.
static String KEY_FITSDIR
          The fits-files directory.
static String KEY_MAG
          The magnitude for spurious brightness.
static String KEY_MAGPENALTY
          The penalty for spurious detections below KEY_MAG.
static String KEY_SHARPMAX
          The maximum sharpness without penalty.
static String KEY_SHARPMIN
          The minimum sharpness without penalty.
static String KEY_SHARPPENALTY
          The penalty for stars with a sharpness deviation.
static String KEY_STARPENALTY
          The penalty for stars not found.
static String KEY_UPDATE
          If true, positions are updated on the first run.
private  int mediansize
          Size of median.
private  int searchsize
          Size of search-box.
 
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
ImageAmoeba(Map prop)
          Constructs a new image amoeba.
 
Method Summary
 int dimension()
          Returns the dimension of this multidimensional.
 double evaluate(VectorG param)
          Evaluates the goodness of the supplied parameter.
private  double evaluate(VectorG param, boolean virgin, boolean update)
          Evaluates the goodness of the supplied parameter.
private  void hitScan(Writer out, Guiding.RawStar update, List candidates, int index)
          Scans the list of current raw stars and tries to match it to the given object.
 void init()
          Reads the directory with the fits files to store all relevant data in a list additinally, the static information on the detected stars in the positions file is extracted and stored.
static void main(String[] arg)
          If we supplied an argument, this is treated as the properties of the image amoeba, otherwise we use all default values.
private  void updatePositions(String hip, List raw)
          On the first run, we assume to start with good values.
 
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, 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

KEY_STARPENALTY

public static final String KEY_STARPENALTY
The penalty for stars not found.

See Also:
Constant Field Values

KEY_ELONGPENALTY

public static final String KEY_ELONGPENALTY
The penalty for stars with an elongation above KEY_ELONGATION.

See Also:
Constant Field Values

KEY_SHARPPENALTY

public static final String KEY_SHARPPENALTY
The penalty for stars with a sharpness deviation.

See Also:
Constant Field Values

KEY_ELONGATION

public static final String KEY_ELONGATION
The maximum elongation without penalty.

See Also:
Constant Field Values

KEY_SHARPMAX

public static final String KEY_SHARPMAX
The maximum sharpness without penalty.

See Also:
Constant Field Values

KEY_SHARPMIN

public static final String KEY_SHARPMIN
The minimum sharpness without penalty.

See Also:
Constant Field Values

KEY_FAULTPENALTY

public static final String KEY_FAULTPENALTY
The penalty for each non-object identified.

See Also:
Constant Field Values

KEY_MAGPENALTY

public static final String KEY_MAGPENALTY
The penalty for spurious detections below KEY_MAG.

See Also:
Constant Field Values

KEY_MAG

public static final String KEY_MAG
The magnitude for spurious brightness.

See Also:
Constant Field Values

KEY_DEVIATION

public static final String KEY_DEVIATION
The tolerance in position difference.

See Also:
Constant Field Values

KEY_FITSDIR

public static final String KEY_FITSDIR
The fits-files directory.

See Also:
Constant Field Values

KEY_UPDATE

public static final String KEY_UPDATE
If true, positions are updated on the first run.

See Also:
Constant Field Values

DEFSTARPENALTY

private static final double DEFSTARPENALTY
The default star penalty.

See Also:
Constant Field Values

DEFELONGPENALTY

private static final double DEFELONGPENALTY
The default elongation penalty.

See Also:
Constant Field Values

DEFSHARPPENALTY

private static final double DEFSHARPPENALTY
The default elongation penalty.

See Also:
Constant Field Values

DEFFAULTPENALTY

private static final double DEFFAULTPENALTY
The default fault penalty.

See Also:
Constant Field Values

DEFMAGPENALTY

private static final double DEFMAGPENALTY
The default magnitude penalty.

See Also:
Constant Field Values

DEFELONGATION

private static final double DEFELONGATION
The default elongation at which penalties occur.

See Also:
Constant Field Values

DEFSHARPMAX

private static final double DEFSHARPMAX
The default maximum sharp which penalties occur.

See Also:
Constant Field Values

DEFSHARPMIN

private static final double DEFSHARPMIN
The default maximum sharp which penalties occur.

See Also:
Constant Field Values

DEFMAG

private static final double DEFMAG
The default magnitude at which penalties occur.

See Also:
Constant Field Values

DEFDEVIATION

private static final double DEFDEVIATION
The default allowed squared deviation in square-pixel.

See Also:
Constant Field Values

DEFUPDATE

private static final boolean DEFUPDATE
The default update behaviour.

See Also:
Constant Field Values

DEFFITSDIR

private static final File DEFFITSDIR
The default fits directory.


fits

private Map fits
The map of fits files to star lists found in the position files.


bias

private File bias
Fits file to the bias frame.


dark

private File dark
Fits file to the scalable dark frame.


kernelsize

private int kernelsize
Size of low-pass kernel.


mediansize

private int mediansize
Size of median.


searchsize

private int searchsize
Size of search-box.

Constructor Detail

ImageAmoeba

public ImageAmoeba(Map prop)
Constructs a new image amoeba. Starting values are not supplied.

Method Detail

init

public void init()
Reads the directory with the fits files to store all relevant data in a list additinally, the static information on the detected stars in the positions file is extracted and stored.

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

dimension

public int dimension()
Returns the dimension of this multidimensional.

Specified by:
dimension in interface Multidimensional

evaluate

public double evaluate(VectorG param)
Evaluates the goodness of the supplied parameter. A new star finder is run on each hip-file found in the fits directory and the result is compared to the previously prepared postition data.

Specified by:
evaluate in interface Multidimensional

evaluate

private double evaluate(VectorG param,
                        boolean virgin,
                        boolean update)
Evaluates the goodness of the supplied parameter. A new star finder is run on each hip-file found in the fits directory and the result is compared to the previously prepared postition data.


updatePositions

private void updatePositions(String hip,
                             List raw)
On the first run, we assume to start with good values. To get an estimate of the accuracy of positions determinations, we compare the first fit with the positions data and update the positions file with the newly acquired info.


hitScan

private void hitScan(Writer out,
                     Guiding.RawStar update,
                     List candidates,
                     int index)
              throws IOException
Scans the list of current raw stars and tries to match it to the given object. If a match is found, we write the updated info to the given writer.

Throws:
IOException

main

public static void main(String[] arg)
If we supplied an argument, this is treated as the properties of the image amoeba, otherwise we use all default values.