stella.parameter
Class FlatExposureTime

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.FlatExposureTime
All Implemented Interfaces:
Cloneable, Parameter, ExposureTimeMeasuring, TargetDependingValue, ParameterDepending, TargetDepending, TargetDependingParameter, Value, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class FlatExposureTime
extends AbstractFitsMomentsValue
implements ExposureTimeMeasuring

We estimate the exposure time for a flat field to yield a good exposure level. The parameter is reset on target picked. Later, as we have ADU moments available, we use the average of all quadrants to estimate a new exposure time. This parameter listens to the filter in the target supplied to make a zero-guess. The exposure time returned is in seconds. 25000*tanh(0.3*x-.8)+25000


Nested Class Summary
static class FlatExposureTime.FitsFile
          Reads the fits file given at the command line, extract the exposure time and does an exposure calculation using default bias levels.
static class FlatExposureTime.Test
          Reads the fits file given at the command line, extract the exposure time and does an exposure calculation using default bias levels.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  List<Double> bias
          All quadrants average bias level.
private static double DEFADUTOLERANCE
          The default tolerance if on exposure edge.
private static double DEFADUTWILIGHT
          The default tolerance if on exposure edge.
private static String DEFBIASADU
          The default bias ADU per quadrant, measured on STELLA1, 12-07-10.
private static String DEFFILTERLUX
          The default lux-to-sec expressions for all filters.
private static String DEFGAIN
          The default gains, measured 01-07-2010.
private static String DEFLUXSENSOR
          The default lux value name.
static String DEFNAME
          The default name.
private static String DEFTARGETADU
          The default adus for a good flat.
private static double DEFTIMEHIGH
          Default high time limit.
private static double DEFTIMELOW
          Default low time limit.
private  List<Double> desired
          All quadrant's target ADU for a good flat.
private  boolean dolog
          For debugging purpose, a flag to write.
private  String filter
          The last filter registered.
private  List<Double> gain
          All quadrant's target ADU for a good flat.
static String KEY_ADUTOLERANCE
          The tolerance in target adu if at exposure limit.
static String KEY_ADUTWILIGHT
          If we have sol sink parameter, we add/subtract this from targetadu.
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_FILTERLUX
          This key links filter names to expressions for time calculation.
static String KEY_GAIN
          The gains of the quadrants.
static String KEY_LUXSENSOR
          The name of the parameter that delivers the current sky brightness.
static String KEY_SETUP
          The setup section that carries the flat-field filter.
static String KEY_TARGETADU
          The list of desireged average ADUs after bias substraction.
static String KEY_TIMEHIGH
          If exposure time falls below this limit, we increase the target adu.
static String KEY_TIMELOW
          If exposure time falls below this limit, we increase the target adu.
static String KEY_USEQUADRANTS
          If that is given, only use these quadrants for averaging.
private  Value lux
          The parameter that delivers current sky brightness.
private  Map<String,Function> luxtime
          The expressions on how we calculate from lux to exposure time.
private  long pick
          The time the target was chosen.
private  SolSink sunset
          We allow to distinguish berween sun rise and sun set.
private  List<Integer> usequad
          If this is set, only these quadrants are used.
 
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 util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
FlatExposureTime(Map<String,String> prop)
          Construction of the flat exposure time calculator.
 
Method Summary
private  double getExposureEstimate(String f)
          Using the flat-field filter name and the fits moments, we estimate the best exposure time by using the average of the current fits compared to the target average in #KEY_TARGETLEVEL.
private  double getExposureLevelTime(double texp, List<CentralMoments> cm)
          From the average of the exposure, do the calculation for the time.
 Number getForTarget(TargetDefinition td)
          If queried with a target, we always ignore the fits moments, as these cannot be valid.
private  double getLightLevelTime(String f)
          We calculate an exposure time from the light sensor.
 Number getValue()
          We get the estimated flat exposure time.
 void init()
          On init, we create the table for calculating the times.
 void registerParameter(Parameter p)
          We register a parameter that delivers sky brightness.
 void registerTarget(TargetDefinition td)
          We register the target.
 
Methods inherited from class stella.parameter.AbstractFitsMomentsValue
getDateObs, getExposureTime, getFits, getRegistered, registerMonitor, 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.Value
setValue
 
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_FILTERLUX

public static final String KEY_FILTERLUX
This key links filter names to expressions for time calculation.

See Also:
Constant Field Values

KEY_LUXSENSOR

public static final String KEY_LUXSENSOR
The name of the parameter that delivers the current sky brightness.

See Also:
Constant Field Values

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_TARGETADU

public static final String KEY_TARGETADU
The list of desireged average ADUs after bias substraction.

See Also:
Constant Field Values

KEY_ADUTOLERANCE

public static final String KEY_ADUTOLERANCE
The tolerance in target adu if at exposure limit.

See Also:
Constant Field Values

KEY_ADUTWILIGHT

public static final String KEY_ADUTWILIGHT
If we have sol sink parameter, we add/subtract this from targetadu.

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_USEQUADRANTS

public static final String KEY_USEQUADRANTS
If that is given, only use these quadrants for averaging.

See Also:
Constant Field Values

KEY_TIMELOW

public static final String KEY_TIMELOW
If exposure time falls below this limit, we increase the target adu.

See Also:
Constant Field Values

KEY_TIMEHIGH

public static final String KEY_TIMEHIGH
If exposure time falls below this limit, we increase the target adu.

See Also:
Constant Field Values

DEFNAME

public static final String DEFNAME
The default name.

See Also:
Constant Field Values

DEFFILTERLUX

private static final String DEFFILTERLUX
The default lux-to-sec expressions for all filters.

See Also:
Constant Field Values

DEFLUXSENSOR

private static final String DEFLUXSENSOR
The default lux value name.

See Also:
Constant Field Values

DEFTARGETADU

private static final String DEFTARGETADU
The default adus for a good flat.

See Also:
Constant Field Values

DEFADUTOLERANCE

private static final double DEFADUTOLERANCE
The default tolerance if on exposure edge.

See Also:
Constant Field Values

DEFADUTWILIGHT

private static final double DEFADUTWILIGHT
The default tolerance if on exposure edge.

See Also:
Constant Field Values

DEFBIASADU

private static final String DEFBIASADU
The default bias ADU per quadrant, measured on STELLA1, 12-07-10.

See Also:
Constant Field Values

DEFGAIN

private static final String DEFGAIN
The default gains, measured 01-07-2010.

See Also:
Constant Field Values

DEFTIMELOW

private static final double DEFTIMELOW
Default low time limit.

See Also:
Constant Field Values

DEFTIMEHIGH

private static final double DEFTIMEHIGH
Default high time limit.

See Also:
Constant Field Values

luxtime

private Map<String,Function> luxtime
The expressions on how we calculate from lux to exposure time.


usequad

private List<Integer> usequad
If this is set, only these quadrants are used.


desired

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


gain

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


bias

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


lux

private Value lux
The parameter that delivers current sky brightness.


sunset

private SolSink sunset
We allow to distinguish berween sun rise and sun set.


filter

private String filter
The last filter registered.


pick

private long pick
The time the target was chosen.


dolog

private boolean dolog
For debugging purpose, a flag to write.

Constructor Detail

FlatExposureTime

public FlatExposureTime(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

registerParameter

public void registerParameter(Parameter p)
We register a parameter that delivers sky brightness. Preferrably it links directly to a brightness sensor, if none is present, a solz-dependancy can be used.

Specified by:
registerParameter in interface ParameterDepending
Overrides:
registerParameter in class AbstractFitsMomentsValue

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

getValue

public Number getValue()
We get the estimated flat exposure time.

Specified by:
getValue in interface Value

getForTarget

public Number getForTarget(TargetDefinition td)
If queried with a target, we always ignore the fits moments, as these cannot be valid.

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

getExposureEstimate

private double getExposureEstimate(String f)
Using the flat-field filter name and the fits moments, we estimate the best exposure time by using the average of the current fits compared to the target average in #KEY_TARGETLEVEL. If there is no prior fits average, we try to estimate the exposure time from the current light level.


getExposureLevelTime

private double getExposureLevelTime(double texp,
                                    List<CentralMoments> cm)
From the average of the exposure, do the calculation for the time.


getLightLevelTime

private double getLightLevelTime(String f)
We calculate an exposure time from the light sensor. This is done, if no prior flats in the desired filter has been exposed.