stella.parameter
Class FlatQuality

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.parameter.AbstractParameter
                  extended by stella.parameter.AbstractTargetParameter
                      extended by stella.parameter.AbstractTargetValue
                          extended by stella.parameter.AbstractFitsMomentsValue
                              extended by stella.parameter.FlatQuality
All Implemented Interfaces:
Cloneable, ErrorDependingParameter, Parameter, TargetDependingValue, ParameterDepending, TargetDepending, TargetDependingParameter, Value, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class FlatQuality
extends AbstractFitsMomentsValue
implements ErrorDependingParameter

We estimate the quality of the currently accumulated flat fields. For this purpose, we do the following (assuming proper parameter registering has already occured).

For details on the evaluation process, lokk into #evaluate.


Nested Class Summary
private  class FlatQuality.Gather
          This thread waits on notification from the fits moment parameter and adds a new moments statistic whenever it receivesd one.
static class FlatQuality.Test
           
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  Map<String,Double> avmax
          Parsed mapping from properties.
private  Map<String,Double> avmin
          Parsed mapping from properties.
private  List<Double> bias
          All quadrants average bias level.
private static String DEFAVERAGEMAX
          The default maximum averages per filter and quadrant.
private static String DEFAVERAGEMIN
          The default minimum averages per filter and quadrant.
private static String DEFBIASADU
          The default bias ADU per quadrant, measured on robotel, 24-07-09.
private static String DEFGAIN
          The default gains.
private static Rectangle DEFMOMENTBOX
          Default box size spares the five outer pixel.
private static int DEFMOMENTORDER
          Default order is average and sigma.
private static String DEFMOMENTSDEV
          Allowed deviation from moment median to be allowed, negativ for all.
private static String DEFMOMENTSMAX
          The default maximum moments value per filter and quadrant.
private static String DEFMOMENTSMIN
          The default minimum moments values per filter and quadrant.
static String DEFNAME
          Default name.
private static String DEFSIGMAMAX
          The default maximum standard deviation per filter and quadrant.
private static String DEFSIGMAMIN
          The default minimum standard deviations per filter and quadrant.
private static int DEFSTATISTICS
          The default number after which also current statistic should be used.
private  String filter
          The last filter registered.
private  List<Double> gain
          All quadrant's target ADU for a good flat.
private  FlatQuality.Gather gather
          The thread that gathers all recorded moments during flats.
static double INVALID
          Default return if invalid.
static String KEY_AVERAGEMAX
          The mapping of filters plus quadrants to their maximum average ADU.
static String KEY_AVERAGEMIN
          The mapping of filters plus quadrants to their minimum average ADU.
static String KEY_BIASADU
          The crude bias estimation of the quadrants.
static String KEY_CONSTANT
          The name of the setup constant that holds the filter.
static String KEY_GAIN
          The gains of the quadrants.
static String KEY_MOMENTBOX
          The box which we should include during exposure estimate.
static String KEY_MOMENTORDER
          The order to which we should calculate during exposure estimate.
static String KEY_MOMENTSDEV
          The list of allowed deviations from moment median.
static String KEY_MOMENTSMAX
          Filter plus quadrants to the list of minimum central moments.
static String KEY_MOMENTSMIN
          Filter plus quadrants to the list of minimum central moments.
static String KEY_SETUP
          The setup section that carries the flat-field filter.
static String KEY_SIGMAMAX
          The mapping of filters plus quadrants to their maximum standard dev.
static String KEY_SIGMAMIN
          The mapping of filters plus quadrants to their minimum standard dev.
static String KEY_STATISTIC
          The minimum nuber of flats to additionally consider moment statistic.
private  Map<String,List<Double>> momentdev
          Parsed mapping from properties.
private  Map<String,List<Double>> momentmax
          Parsed mapping from properties.
private  Map<String,List<Double>> momentmin
          Parsed mapping from properties.
private  long pick
          The time the target was chosen.
private  Map<String,Double> sigmax
          Parsed mapping from properties.
private  Map<String,Double> sigmin
          Parsed mapping from properties.
 
Fields inherited from class stella.parameter.AbstractFitsMomentsValue
KEY_FITSMOMENTS
 
Fields inherited from class stella.parameter.AbstractTargetParameter
KEY_INDEX
 
Fields inherited from class stella.parameter.AbstractParameter
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWN
 
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 stella.ErrorDependingParameter
NAMING_EXTENSION
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
FlatQuality(Map<String,String> prop)
          Construction of the flat exposure time calculator.
 
Method Summary
private  boolean basicFulfill(List<CentralMoments> check)
          We check if the moments fulfill the basic requirements, i.e.
 double estimateSignal(List<List<CentralMoments>> valid)
          From the list of moments that fulfilled all selection criteria, we estimate the ADUs from the average per quadrant, subtract the bias level there and convert it via the gain factors to a number of photons.
private  List<List<CentralMoments>> filterFulfill(List<List<CentralMoments>> basic)
          If enough moments have been collected, we can narrow the valid ones further down by lokking at the statistics of the moment.
 Number getForError(ErrorEvent td)
          If queried with an error, recording probably just starts.
 Number getForTarget(TargetDefinition td)
          If queried with a target, we cannot return anything, thus null is returned here.
 Number getValue()
          We get the estimated flat field quality already accumulated.
 void init()
          On init, we create the table for calculating the times.
private static Map<String,Double> parseDoubleMapping(String in)
           
private static Map<String,List<Double>> parseListofDouble(String in)
           
 void registerError(ErrorEvent ee)
          If we receive an error AccumulationStart, we set the new moment window, start our gather thread and clear any old list.
 void registerTarget(TargetDefinition td)
          We register the target.
 
Methods inherited from class stella.parameter.AbstractFitsMomentsValue
getDateObs, getExposureTime, getFits, getRegistered, registerMonitor, registerParameter, setValue
 
Methods inherited from class stella.parameter.AbstractTargetValue
get, set
 
Methods inherited from class stella.parameter.AbstractTargetParameter
getAsStar, getConstant, getFormattedFor, getSetup
 
Methods inherited from class stella.parameter.AbstractParameter
createParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, register, rescanned, setName, toString
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, setObject, setProperties, setProperty, stringProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface stella.Parameter
get, getFormatted, getName, getString, set
 
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 stella.TargetDependingParameter
getFormattedFor
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

KEY_SETUP

public static final String KEY_SETUP
The setup section that carries the flat-field filter.

See Also:
Constant Field Values

KEY_CONSTANT

public static final String KEY_CONSTANT
The name of the setup constant that holds the filter.

See Also:
Constant Field Values

KEY_MOMENTORDER

public static final String KEY_MOMENTORDER
The order to which we should calculate during exposure estimate.

See Also:
Constant Field Values

KEY_MOMENTBOX

public static final String KEY_MOMENTBOX
The box which we should include during exposure estimate.

See Also:
Constant Field Values

KEY_BIASADU

public static final String KEY_BIASADU
The crude bias estimation of the quadrants.

See Also:
Constant Field Values

KEY_GAIN

public static final String KEY_GAIN
The gains of the quadrants.

See Also:
Constant Field Values

KEY_AVERAGEMIN

public static final String KEY_AVERAGEMIN
The mapping of filters plus quadrants to their minimum average ADU.

See Also:
Constant Field Values

KEY_AVERAGEMAX

public static final String KEY_AVERAGEMAX
The mapping of filters plus quadrants to their maximum average ADU.

See Also:
Constant Field Values

KEY_SIGMAMIN

public static final String KEY_SIGMAMIN
The mapping of filters plus quadrants to their minimum standard dev.

See Also:
Constant Field Values

KEY_SIGMAMAX

public static final String KEY_SIGMAMAX
The mapping of filters plus quadrants to their maximum standard dev.

See Also:
Constant Field Values

KEY_MOMENTSMIN

public static final String KEY_MOMENTSMIN
Filter plus quadrants to the list of minimum central moments.

See Also:
Constant Field Values

KEY_MOMENTSMAX

public static final String KEY_MOMENTSMAX
Filter plus quadrants to the list of minimum central moments.

See Also:
Constant Field Values

KEY_STATISTIC

public static final String KEY_STATISTIC
The minimum nuber of flats to additionally consider moment statistic.

See Also:
Constant Field Values

KEY_MOMENTSDEV

public static final String KEY_MOMENTSDEV
The list of allowed deviations from moment median.

See Also:
Constant Field Values

DEFNAME

public static final String DEFNAME
Default name.

See Also:
Constant Field Values

INVALID

public static final double INVALID
Default return if invalid.

See Also:
Constant Field Values

DEFMOMENTORDER

private static final int DEFMOMENTORDER
Default order is average and sigma.

See Also:
Constant Field Values

DEFMOMENTBOX

private static final Rectangle DEFMOMENTBOX
Default box size spares the five outer pixel.


DEFBIASADU

private static final String DEFBIASADU
The default bias ADU per quadrant, measured on robotel, 24-07-09.

See Also:
Constant Field Values

DEFGAIN

private static final String DEFGAIN
The default gains.

See Also:
Constant Field Values

DEFAVERAGEMIN

private static final String DEFAVERAGEMIN
The default minimum averages per filter and quadrant.

See Also:
Constant Field Values

DEFAVERAGEMAX

private static final String DEFAVERAGEMAX
The default maximum averages per filter and quadrant.

See Also:
Constant Field Values

DEFSIGMAMIN

private static final String DEFSIGMAMIN
The default minimum standard deviations per filter and quadrant.

See Also:
Constant Field Values

DEFSIGMAMAX

private static final String DEFSIGMAMAX
The default maximum standard deviation per filter and quadrant.

See Also:
Constant Field Values

DEFMOMENTSMAX

private static final String DEFMOMENTSMAX
The default maximum moments value per filter and quadrant.

See Also:
Constant Field Values

DEFMOMENTSMIN

private static final String DEFMOMENTSMIN
The default minimum moments values per filter and quadrant.

See Also:
Constant Field Values

DEFSTATISTICS

private static final int DEFSTATISTICS
The default number after which also current statistic should be used.

See Also:
Constant Field Values

DEFMOMENTSDEV

private static final String DEFMOMENTSDEV
Allowed deviation from moment median to be allowed, negativ for all.

See Also:
Constant Field Values

gain

private List<Double> gain
All quadrant's target ADU for a good flat.


bias

private List<Double> bias
All quadrants average bias level.


avmin

private Map<String,Double> avmin
Parsed mapping from properties.


avmax

private Map<String,Double> avmax
Parsed mapping from properties.


sigmin

private Map<String,Double> sigmin
Parsed mapping from properties.


sigmax

private Map<String,Double> sigmax
Parsed mapping from properties.


momentmin

private Map<String,List<Double>> momentmin
Parsed mapping from properties.


momentmax

private Map<String,List<Double>> momentmax
Parsed mapping from properties.


momentdev

private Map<String,List<Double>> momentdev
Parsed mapping from properties.


filter

private String filter
The last filter registered.


gather

private FlatQuality.Gather gather
The thread that gathers all recorded moments during flats.


pick

private long pick
The time the target was chosen.

Constructor Detail

FlatQuality

public FlatQuality(Map<String,String> prop)
Construction of the flat exposure time calculator.

Method Detail

init

public void init()
On init, we create the table for calculating the times.

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

parseDoubleMapping

private static final Map<String,Double> parseDoubleMapping(String in)

parseListofDouble

private static final Map<String,List<Double>> parseListofDouble(String in)

registerTarget

public void registerTarget(TargetDefinition td)
We register the target. Grabs the the target filter and grabs the current time-stamp to allow proper identification of the fits moments.

Specified by:
registerTarget in interface TargetDepending

registerError

public void registerError(ErrorEvent ee)
If we receive an error AccumulationStart, we set the new moment window, start our gather thread and clear any old list.

Specified by:
registerError in interface ErrorDependingParameter

getValue

public Number getValue()
We get the estimated flat field quality already accumulated. First, we look if we have already accumulated some basically valid data with our #Gather thread. If enough data has been collected to allow statistics to operate, we filter those with too high divergences and pass the resulting averages to the estimateSignal(java.util.List>) routine. If invalid for any reason, -1 is returned.

Specified by:
getValue in interface Value

getForTarget

public Number getForTarget(TargetDefinition td)
If queried with a target, we cannot return anything, thus null is returned here.

Specified by:
getForTarget in interface TargetDependingValue
Specified by:
getForTarget in interface TargetDependingParameter

getForError

public Number getForError(ErrorEvent td)
If queried with an error, recording probably just starts.

Specified by:
getForError in interface ErrorDependingParameter

filterFulfill

private List<List<CentralMoments>> filterFulfill(List<List<CentralMoments>> basic)
If enough moments have been collected, we can narrow the valid ones further down by lokking at the statistics of the moment. Each moment in each quadrant is then checked to have a value that is not more then the deviation specified away from the median value.


estimateSignal

public double estimateSignal(List<List<CentralMoments>> valid)
From the list of moments that fulfilled all selection criteria, we estimate the ADUs from the average per quadrant, subtract the bias level there and convert it via the gain factors to a number of photons. Poisson statistic (1/sqrt(N)) gives the projected quality there.

Returns:
-1 if quality cannot be deduced.

basicFulfill

private boolean basicFulfill(List<CentralMoments> check)
We check if the moments fulfill the basic requirements, i.e. if they are in the min/max range specified in the properties. Statistic checks are always carried out at runtime only, see getValue().