astro.fits
Class BiasMaster

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by astro.fits.ReductionMaster
                  extended by astro.fits.BiasMaster
All Implemented Interfaces:
Cloneable, ExitCleaning, Initializable, LocalizedSupplying, Preserving, PropertySupplying, ResourceSupplying

public class BiasMaster
extends ReductionMaster
implements Preserving

We generate a master bias from a number of at least #KEY_MINBIAS good bias observation, which have been conducted in a single block, normally during dusk or dawn. The master bias is kept for later reference.


Nested Class Summary
static class BiasMaster.All
          Does all until the very first day of observation.
static class BiasMaster.Back
          We create master bias from now back for the given number of days.
static class BiasMaster.First
          We create a single master bias from the first bias block found.
 
Nested classes/interfaces inherited from class astro.fits.ReductionMaster
ReductionMaster.ImageBlock, ReductionMaster.ImageInfo, ReductionMaster.Interpolate, ReductionMaster.Listing, ReductionMaster.MasterFits
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  NavigableMap<Date,ReductionMaster.MasterFits> biaslookup
          A mapping of center-time-of-block to compressed master bias file.
private static double DEFALLOWSPANAMBTEMP
          The maximum spread in det temps.
private static double DEFALLOWSPANCCDTEMP
          The maximum spread in det temps.
private static long DEFALLOWSPANTIME
          The maximum spread in dark observations.
private static String DEFBESTRULES
          How we interpolate.
private static String DEFBESTSPANS
          For each rule, we must exceed this value in the master difference.
private static boolean DEFBIASCOMBINEAV
          Bias is combined useing average normally.
private static int DEFBIASCOUNTMIN
          The default minimum number of useable bias .
private static double DEFBIASHISIGMA
          The upper rejection limit, again in terms of the standard deviation.
private static int DEFBIASKEEP
          The minimum number of ADU to keep per combined pixel.
private static double DEFBIASLOSIGMA
          Reject all ADU in the combined pixel that are lower than the average.
private static int DEFBIASREJECTLOOPS
          During clipping, maximum number of iterations.
private static boolean DEFBIASSPEEDCLIP
          Normally we do not have speed problems, thus median.
private static double DEFBIASTREND
          A trend may only be called a trend, if ADU difference exceeds this.
private static String DEFBIASWEIGHT
          The cards used for weighed averages.
private static String DEFMAXBIAS
          The default ADU-values for the statistic test.
private static String DEFMINBIAS
          The default ADU-values for the statistic test.
private static String DEFOVERSCANCARDS
          The cards used from the overscan.
private static String DEFSERIALIZE
          The default serialization file.
private  List<ReductionMaster.ImageBlock> done
          The list of image blocks already reduced.
static String KEY_BIASCOMBINEAV
          If true, we combine the final bias using the average, otherwise med.
static String KEY_BIASCOUNTMIN
          The minimum number of useable bias to remain in a block.
static String KEY_BIASHISIGMA
          The upper rejection limit, again in terms of the standard deviation.
static String KEY_BIASKEEP
          The minimum number of ADU to keep per combined pixel.
static String KEY_BIASLOSIGMA
          Reject all ADU in the combined pixel that are lower than the average.
static String KEY_BIASPURGEAMP
          The cards to be purged from the constructed extensions.
static String KEY_BIASREJECTLOOPS
          During clipping, maximum number of iterations.
static String KEY_BIASSPEEDCLIP
          During clipping, using median is better, but slower.
static String KEY_BIASTREND
          A drift in the bias is present, if this ADU difference is exceeded.
static String KEY_BIASWEIGHT
          In constructing a intermediate master, keep this keys as weighed av.
static String KEY_OVERSCANCARDS
          The cards used from the overscan.
static String KEY_SERIALIZE
          On restarts, these are the image blocks we have already checked.
 
Fields inherited from class astro.fits.ReductionMaster
ADUSEPARATOR, DEFLOCALNFS, FIRSTNIGHT, gain, INPOL, INPOLREM, IPOLANTE, IPOLANTEREM, IPOLBASE, IPOLBASEREM, IPOLDRFT, IPOLDRFTREM, IPOLPOST, IPOLPOSTREM, IPOLTIME, IPOLTIMEREM, KEY_ALLOWSPANAMBTEMP, KEY_ALLOWSPANCCDTEMP, KEY_ALLOWSPANTIME, KEY_AMBTEMP, KEY_AMPLIFIERS, KEY_AVCARDS, KEY_BESTRULES, KEY_BESTSPANS, KEY_CCDTEMP, KEY_COPYCARDS, KEY_DEROTSEPARATE, KEY_EQUALCARDS, KEY_EXTCARDORDER, KEY_EXTRAPOLATE, KEY_FILTERAWAREADU, KEY_FILTERSEPARATE, KEY_FIRSTCARDS, KEY_FITSSETBRIDGE, KEY_GAIN, KEY_GENERATECARDS, KEY_IMCOPY, KEY_IMCOPYFLAG, KEY_INTRINSIC, KEY_LASTCARDS, KEY_LOCALFITS, KEY_LOCALNFS, KEY_LOCALTMP, KEY_MASTERHEAD, KEY_MAXCARDS, KEY_MAXEXPOSURETIME, KEY_MEDIANCARDS, KEY_MINCARDS, KEY_OBSDB, KEY_OVERSCAN, KEY_PRIMCARDORDER, KEY_QUADRANTS, KEY_QUADRANTSIZE, KEY_READNOISE, KEY_REDUCED, KEY_ROTTOLERANCE, KEY_SET, KEY_SITE, KEY_STRICTADU, KEY_TELESCOPE, PREFIX_ADUMAX, PREFIX_ADUMIN, PREFIX_AMPCARDS, readnoise
 
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
BiasMaster(Map<String,String> prop)
           
 
Method Summary
private  ReductionMaster.MasterFits createMasterBias(ReductionMaster.ImageBlock bias, SettableBoolean recover)
          We create a master bias from a bias observing block.
 void exit()
          On exit, we save all treated bias blocks.
 nom.tam.fits.Fits getBestBias(ReductionMaster.ImageInfo ii)
          We return the best bias that should be used for the image in this image info.
 File getClosestBiasFile(Date d)
          We return the master bias file that is closest to the given date in question.
 nom.tam.fits.Fits getClosestBiasFits(Date d)
          We return the master bias file that is closest to the given date in question.
private  ReductionMaster.MasterFits getClosestBiasMaster(Date d)
          Returns the master fits that is pointing closest to the given date in question.
 File[] getEnclosingBiasFile(Date d)
          We return the to master bias that are closest before and after this date.
private  ReductionMaster.MasterFits[] getEnclosingBiasMaster(Date d)
          We return the to master fits that are closest before and after this date.
 void init()
          On init, we restore the list of all treated bias blocks.
 boolean preserve()
          On preserving, we try to store the already treated image blocks.
private  int reduceNight(Date now)
          We scan the given night, first get all observing blocks, secondly check if they are present in our done list.
 boolean restore()
          On restoring, we try to read the already treated image blocks.
static ObserveSql.Types typeOf()
           
 
Methods inherited from class astro.fits.ReductionMaster
addAverageCards, addEqualCards, addGeneratorCards, addMaximumCards, addMedianCards, addMinimumCards, addSingleCards, aduFailure, aduStatistic, allTransferred, alreadyTested, checkAmbTempSpan, checkDetTempSpan, compress, crosstalkCorrect, existing, existingFits, getAduConstraints, getHeaderValueStatistic, getMasterCards, getMasterCardsFromPrimary, getMidnight, getReducedParentDir, getTemporalFits, getUncompressed, intermediate, markTested, merge, merge, overscanCorrect, primaryHDU, readPrimaryCards, removeUncompressed, restoreMasterFits, scanNight, secondaryHDU, skipToHDU, uncompress, uncompressEventually
 
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_BIASCOMBINEAV

public static final String KEY_BIASCOMBINEAV
If true, we combine the final bias using the average, otherwise med.

See Also:
Constant Field Values

KEY_BIASLOSIGMA

public static final String KEY_BIASLOSIGMA
Reject all ADU in the combined pixel that are lower than the average.

See Also:
Constant Field Values

KEY_BIASHISIGMA

public static final String KEY_BIASHISIGMA
The upper rejection limit, again in terms of the standard deviation.

See Also:
Constant Field Values

KEY_BIASKEEP

public static final String KEY_BIASKEEP
The minimum number of ADU to keep per combined pixel.

See Also:
Constant Field Values

KEY_BIASSPEEDCLIP

public static final String KEY_BIASSPEEDCLIP
During clipping, using median is better, but slower.

See Also:
Constant Field Values

KEY_BIASREJECTLOOPS

public static final String KEY_BIASREJECTLOOPS
During clipping, maximum number of iterations.

See Also:
Constant Field Values

KEY_SERIALIZE

public static final String KEY_SERIALIZE
On restarts, these are the image blocks we have already checked.

See Also:
Constant Field Values

KEY_BIASCOUNTMIN

public static final String KEY_BIASCOUNTMIN
The minimum number of useable bias to remain in a block.

See Also:
Constant Field Values

KEY_BIASPURGEAMP

public static final String KEY_BIASPURGEAMP
The cards to be purged from the constructed extensions.

See Also:
Constant Field Values

KEY_OVERSCANCARDS

public static final String KEY_OVERSCANCARDS
The cards used from the overscan.

See Also:
Constant Field Values

KEY_BIASTREND

public static final String KEY_BIASTREND
A drift in the bias is present, if this ADU difference is exceeded.

See Also:
Constant Field Values

KEY_BIASWEIGHT

public static final String KEY_BIASWEIGHT
In constructing a intermediate master, keep this keys as weighed av.

See Also:
Constant Field Values

DEFBIASCOMBINEAV

private static final boolean DEFBIASCOMBINEAV
Bias is combined useing average normally.

See Also:
Constant Field Values

DEFBIASLOSIGMA

private static final double DEFBIASLOSIGMA
Reject all ADU in the combined pixel that are lower than the average.

See Also:
Constant Field Values

DEFBIASHISIGMA

private static final double DEFBIASHISIGMA
The upper rejection limit, again in terms of the standard deviation.

See Also:
Constant Field Values

DEFBIASKEEP

private static final int DEFBIASKEEP
The minimum number of ADU to keep per combined pixel.

See Also:
Constant Field Values

DEFBIASSPEEDCLIP

private static final boolean DEFBIASSPEEDCLIP
Normally we do not have speed problems, thus median.

See Also:
Constant Field Values

DEFBIASREJECTLOOPS

private static final int DEFBIASREJECTLOOPS
During clipping, maximum number of iterations.

See Also:
Constant Field Values

DEFOVERSCANCARDS

private static final String DEFOVERSCANCARDS
The cards used from the overscan.

See Also:
Constant Field Values

DEFBESTRULES

private static final String DEFBESTRULES
How we interpolate.

See Also:
Constant Field Values

DEFBESTSPANS

private static final String DEFBESTSPANS
For each rule, we must exceed this value in the master difference.

See Also:
Constant Field Values

DEFBIASTREND

private static final double DEFBIASTREND
A trend may only be called a trend, if ADU difference exceeds this.

See Also:
Constant Field Values

DEFBIASWEIGHT

private static final String DEFBIASWEIGHT
The cards used for weighed averages.

See Also:
Constant Field Values

DEFSERIALIZE

private static final String DEFSERIALIZE
The default serialization file.

See Also:
Constant Field Values

DEFBIASCOUNTMIN

private static final int DEFBIASCOUNTMIN
The default minimum number of useable bias .

See Also:
Constant Field Values

DEFALLOWSPANTIME

private static final long DEFALLOWSPANTIME
The maximum spread in dark observations.

See Also:
Constant Field Values

DEFALLOWSPANCCDTEMP

private static final double DEFALLOWSPANCCDTEMP
The maximum spread in det temps.

See Also:
Constant Field Values

DEFALLOWSPANAMBTEMP

private static final double DEFALLOWSPANAMBTEMP
The maximum spread in det temps.

See Also:
Constant Field Values

DEFMINBIAS

private static final String DEFMINBIAS
The default ADU-values for the statistic test.

See Also:
Constant Field Values

DEFMAXBIAS

private static final String DEFMAXBIAS
The default ADU-values for the statistic test.

See Also:
Constant Field Values

done

private List<ReductionMaster.ImageBlock> done
The list of image blocks already reduced.


biaslookup

private NavigableMap<Date,ReductionMaster.MasterFits> biaslookup
A mapping of center-time-of-block to compressed master bias file.

Constructor Detail

BiasMaster

public BiasMaster(Map<String,String> prop)
Method Detail

typeOf

public static final ObserveSql.Types typeOf()

init

public void init()
On init, we restore the list of all treated bias blocks.

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

exit

public void exit()
On exit, we save all treated bias blocks.

Specified by:
exit in interface ExitCleaning

preserve

public boolean preserve()
On preserving, we try to store the already treated image blocks.

Specified by:
preserve in interface Preserving
Returns:
false, if preserving the current state was not possible

restore

public boolean restore()
On restoring, we try to read the already treated image blocks.

Specified by:
restore in interface Preserving
Returns:
False, if restoring the value was not possible.

getClosestBiasMaster

private ReductionMaster.MasterFits getClosestBiasMaster(Date d)
Returns the master fits that is pointing closest to the given date in question.


getEnclosingBiasMaster

private ReductionMaster.MasterFits[] getEnclosingBiasMaster(Date d)
We return the to master fits that are closest before and after this date. These two bias could then be used to interpolate to the 'best' bias.

Returns:
Null array if none found, otherwise always an array of size two, may have zero on 0/1.

getClosestBiasFile

public File getClosestBiasFile(Date d)
We return the master bias file that is closest to the given date in question.


getClosestBiasFits

public nom.tam.fits.Fits getClosestBiasFits(Date d)
                                     throws nom.tam.fits.FitsException,
                                            IOException
We return the master bias file that is closest to the given date in question.

Throws:
nom.tam.fits.FitsException
IOException

getEnclosingBiasFile

public File[] getEnclosingBiasFile(Date d)
We return the to master bias that are closest before and after this date. These two bias could then be used to interpolate to the 'best' bias.

Returns:
Null array if none found, otherwise always an array of size two, may have zero on 0/1.

getBestBias

public nom.tam.fits.Fits getBestBias(ReductionMaster.ImageInfo ii)
                              throws IOException,
                                     nom.tam.fits.FitsException
We return the best bias that should be used for the image in this image info. The Fits object is constructed from the two enclosing bias, sacling according to the rules specified in ReductionMaster.KEY_BESTRULES.

Throws:
IOException
nom.tam.fits.FitsException

reduceNight

private int reduceNight(Date now)
                 throws IOException,
                        nom.tam.fits.FitsException,
                        SQLException
We scan the given night, first get all observing blocks, secondly check if they are present in our done list. If not, we process them, mark them as done in the list and store the final master in the lookup table.

Returns:
Number of new master bias generated.
Throws:
IOException
nom.tam.fits.FitsException
SQLException

createMasterBias

private ReductionMaster.MasterFits createMasterBias(ReductionMaster.ImageBlock bias,
                                                    SettableBoolean recover)
                                             throws IOException,
                                                    nom.tam.fits.FitsException
We create a master bias from a bias observing block. Always creates a master bias if all requirements are met.

Throws:
IOException
nom.tam.fits.FitsException