astro.fits
Class FitsCheck

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by astro.fits.FitsCheck
All Implemented Interfaces:
Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying
Direct Known Subclasses:
FlatCheck

public class FitsCheck
extends PropertyBundles

Class for checking raw input files. Especially for calibration files, as discarding too many there does no harm. Bias and darks only have to have low signal, so a pure moments check is ok there, flats need some more thourogh investigation, thus

See Also:
FlatCheck

Nested Class Summary
static class FitsCheck.Failure
           
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
static String DEFFAILEXT
          The parental reduce directory.
private static String DEFTMPDIR
          Temporal directory including slash.
private static String DEFTMPFITS
          Temporal fits file for uncompressing
static String KEY_BIASMAXIMA
          The statistic minima valid bias must fulfill.
static String KEY_BIASMINIMA
          The statistic minima valid bias must fulfill.
static String KEY_DARKMAXIMA
          The statistic minima valid dark must fulfill.
static String KEY_DARKMINIMA
          The statistic minima valid dark must fulfill.
static String KEY_FAILDIR
          Parent directory where the failture files should be writtn/retrieved.
static String KEY_FAILEXT
          The parent directory of the reduced files.
static String KEY_OBSDB
          If non-default properties are needed for the obs db.
static String KEY_TMPDIR
          Temporal directory including slash.
static String KEY_TMPFITS
          Temporal fits file for uncompressing
protected  ObserveSql obs
          Access to the obs table.
static String PREFIX_FLATMAXIMA
          The statistic minima valid flats must fulfill.
static String PREFIX_FLATMINIMA
          The statistic minima valid flats must fulfill.
static String PREFIX_SCIENCEMAXIMA
          The statistic minima valid science frames must fulfill.
static String PREFIX_SCIENCEMINIMA
          The statistic minima valid science frames must fulfill.
 
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
FitsCheck(Map<String,String> prop)
          Defaults everything.
 
Method Summary
 List<FitsCheck.Failure> check(String unique)
          We check an oberservation specified by its unique ID.
protected  List<FitsCheck.Failure> checkAdu(String unique, String minkey, String maxkey, boolean strict)
          Checks average, standard deviation and higher order moments of the stated file to be within the bounds.
 List<FitsCheck.Failure> checkBias(String unique)
          In the basic version diverts to strcit checking of adu statistics.
 List<FitsCheck.Failure> checkCentroid(String unique, float xcen, float ycen)
          From the unique id of a flat observation, we check if the centroid is withinin bounds.
 List<FitsCheck.Failure> checkCentroidFromAverage(float[] av, float xcen, float ycen)
          From the average of a flat observation, we check if the centroid is withinin bounds.
 List<FitsCheck.Failure> checkDark(String unique)
          In the basic version diverts to strcit checking of adu statistics.
 List<FitsCheck.Failure> checkFlat(String unique)
          In the basic version diverts to strict checking of adu statistics.
 List<FitsCheck.Failure> checkScience(String unique)
          In the basic version, do a non-strict checking of adu statistic (failure only if all quadrants fail for the same reason).
protected  List<List<Double>> getAduConstraints(String key)
          Parses a double-linked list into a list of a list of doubles, representing in the outer index the moment, in the inner list the amplifier.
 void init()
          Creates and initializes the obs db.
 List<FitsCheck.Failure> isAduCompatible(String unique, List<List<Double>> min, List<List<Double>> max, boolean strict)
          Checks for a single file if it satisfies the ADU constriants.
 List<FitsCheck.Failure> readFailure(String unique)
          We read the failure flag file.
static List<FitsCheck.Failure> readFailureFile(File fail)
           
protected static void updateFailure(List<FitsCheck.Failure> target, FitsCheck.Failure with, double r)
          Helps to add a new failure to the list if, not already there.
 boolean writeFailure(String unique, List<FitsCheck.Failure> outcome)
          As long as there is no table for indicating failed files, we write a flag-file into the reduced dir.
static boolean writeFailureFile(File fail, List<FitsCheck.Failure> outcome)
           
 
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, 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
 

Field Detail

KEY_TMPDIR

public static final String KEY_TMPDIR
Temporal directory including slash.

See Also:
Constant Field Values

KEY_TMPFITS

public static final String KEY_TMPFITS
Temporal fits file for uncompressing

See Also:
Constant Field Values

KEY_FAILDIR

public static final String KEY_FAILDIR
Parent directory where the failture files should be writtn/retrieved.

See Also:
Constant Field Values

KEY_FAILEXT

public static final String KEY_FAILEXT
The parent directory of the reduced files.

See Also:
Constant Field Values

KEY_BIASMINIMA

public static final String KEY_BIASMINIMA
The statistic minima valid bias must fulfill.

See Also:
Constant Field Values

KEY_BIASMAXIMA

public static final String KEY_BIASMAXIMA
The statistic minima valid bias must fulfill.

See Also:
Constant Field Values

KEY_DARKMINIMA

public static final String KEY_DARKMINIMA
The statistic minima valid dark must fulfill.

See Also:
Constant Field Values

KEY_DARKMAXIMA

public static final String KEY_DARKMAXIMA
The statistic minima valid dark must fulfill.

See Also:
Constant Field Values

PREFIX_FLATMINIMA

public static final String PREFIX_FLATMINIMA
The statistic minima valid flats must fulfill.

See Also:
Constant Field Values

PREFIX_FLATMAXIMA

public static final String PREFIX_FLATMAXIMA
The statistic minima valid flats must fulfill.

See Also:
Constant Field Values

PREFIX_SCIENCEMINIMA

public static final String PREFIX_SCIENCEMINIMA
The statistic minima valid science frames must fulfill.

See Also:
Constant Field Values

PREFIX_SCIENCEMAXIMA

public static final String PREFIX_SCIENCEMAXIMA
The statistic minima valid science frames must fulfill.

See Also:
Constant Field Values

KEY_OBSDB

public static final String KEY_OBSDB
If non-default properties are needed for the obs db.

See Also:
Constant Field Values

DEFFAILEXT

public static final String DEFFAILEXT
The parental reduce directory.

See Also:
Constant Field Values

DEFTMPDIR

private static final String DEFTMPDIR
Temporal directory including slash.

See Also:
Constant Field Values

DEFTMPFITS

private static final String DEFTMPFITS
Temporal fits file for uncompressing

See Also:
Constant Field Values

obs

protected ObserveSql obs
Access to the obs table.

Constructor Detail

FitsCheck

public FitsCheck(Map<String,String> prop)
Defaults everything.

Method Detail

init

public void init()
Creates and initializes the obs db.

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

check

public List<FitsCheck.Failure> check(String unique)
We check an oberservation specified by its unique ID. From the type of the file, we divert to different checking methods.


checkBias

public List<FitsCheck.Failure> checkBias(String unique)
In the basic version diverts to strcit checking of adu statistics.


checkDark

public List<FitsCheck.Failure> checkDark(String unique)
In the basic version diverts to strcit checking of adu statistics.


checkFlat

public List<FitsCheck.Failure> checkFlat(String unique)
In the basic version diverts to strict checking of adu statistics.


checkScience

public List<FitsCheck.Failure> checkScience(String unique)
In the basic version, do a non-strict checking of adu statistic (failure only if all quadrants fail for the same reason).


updateFailure

protected static void updateFailure(List<FitsCheck.Failure> target,
                                    FitsCheck.Failure with,
                                    double r)
Helps to add a new failure to the list if, not already there.


checkAdu

protected List<FitsCheck.Failure> checkAdu(String unique,
                                           String minkey,
                                           String maxkey,
                                           boolean strict)
Checks average, standard deviation and higher order moments of the stated file to be within the bounds.


isAduCompatible

public List<FitsCheck.Failure> isAduCompatible(String unique,
                                               List<List<Double>> min,
                                               List<List<Double>> max,
                                               boolean strict)
Checks for a single file if it satisfies the ADU constriants.


checkCentroid

public List<FitsCheck.Failure> checkCentroid(String unique,
                                             float xcen,
                                             float ycen)
From the unique id of a flat observation, we check if the centroid is withinin bounds. The centroid is approximated by using the average of the four quadrants and weiging them with their respective x/y position on the CCD.
       x_c=0.5*(-Q0+Q1-Q2+Q3)/ΣQ
       y_c=0.5*(-Q0-Q1+Q2+Q3)/ΣQ
       
where the Q's are the average of the respective quadrants. A stuck filter wheel will manifest itself in a possible higher y-centroid.


checkCentroidFromAverage

public List<FitsCheck.Failure> checkCentroidFromAverage(float[] av,
                                                        float xcen,
                                                        float ycen)
From the average of a flat observation, we check if the centroid is withinin bounds. The centroid is approximated by using the average of the four quadrants and weiging them with their respective x/y position on the CCD.
       x_c=0.5*(-Q0+Q1-Q2+Q3)/ΣQ
       y_c=0.5*(-Q0-Q1+Q2+Q3)/ΣQ
       
where the Q's are the average of the respective quadrants. A stuck filter wheel will manifest itself in a possible higher y-centroid.


writeFailure

public boolean writeFailure(String unique,
                            List<FitsCheck.Failure> outcome)
                     throws IOException
As long as there is no table for indicating failed files, we write a flag-file into the reduced dir.

Throws:
IOException

writeFailureFile

public static boolean writeFailureFile(File fail,
                                       List<FitsCheck.Failure> outcome)
                                throws IOException
Throws:
IOException

readFailure

public List<FitsCheck.Failure> readFailure(String unique)
                                    throws IOException
We read the failure flag file.

Throws:
IOException

readFailureFile

public static final List<FitsCheck.Failure> readFailureFile(File fail)
                                                     throws IOException
Throws:
IOException

getAduConstraints

protected List<List<Double>> getAduConstraints(String key)
Parses a double-linked list into a list of a list of doubles, representing in the outer index the moment, in the inner list the amplifier. This means a list like 10000,11000,12000,9000;300,-1,100,200 is interprated as, averages 10000,11000,12000,9000 for the four amplifiers and as variances 300,don't care, 100, and 200. It is used for the minima and maxima. If the maxima is less then the minima, this means this moment for this particular quadrant is ignored.