stella.util
Class MasterDark

java.lang.Object
  extended by stella.util.MasterDark

public class MasterDark
extends Object

A class that reads dark frames and constructs a master dark and a sigma map out of it. For shutterless operation, like on the stella guider, a short exposure time should be used to create a master bias and a master dark, record the exposure times, and use for guiding the bias as recorded with the short exposure time and as the dark fits the difference in the long dark and the short dark.


Nested Class Summary
static class MasterDark.Xtend
          Packs all extensions into a single file.
static class MasterDark.Xtendfind
          Packs all extensions into a single file, operates with a file filter on the current directory.
 
Field Summary
private  int bitpix
          The number of bits per pixel.
private  nom.tam.fits.ImageHDU[] darks
          All dark data.
private  nom.tam.fits.ImageHDU masterdark
          The master dark, per extension
private  nom.tam.fits.ImageHDU sigmadark
          The master dark sigma map.
private  int xsize
          The size of the image, x-direction.
private  int ysize
          The size of the image, y-direction.
 
Constructor Summary
MasterDark(List<File> ff)
           
MasterDark(List<File> ff, int xtension)
           
MasterDark(String fitsbase, int start, int count, int xtension)
          Constructs a new master dark with a base fits name, a starting index and the number of images to read.
 
Method Summary
private static nom.tam.fits.Header addCardsToHeader(nom.tam.fits.Header head, List<nom.tam.fits.HeaderCard> cards)
          Adds a list of header cards to the fits header.
private  boolean createMasterDark(nom.tam.fits.Header head)
          Creates a master dark image HDU and ists sigma map in the following way: Depending on the number of bits, the image data is cast to an appropriate double-indexed array.
private static String getFilename(String base, int nr)
           
private static List<File> getNumbered(String fitsbase, int start, int count)
           
static void main(String[] arg)
          Reads the fitsbase as the first command line argument, the starting number as second and the number of images as third.
private static void printCounts(Number[] counts)
          Prints a number array to system.out
private static boolean writeHDU(File file, nom.tam.fits.ImageHDU hdu)
          Writes an image hdu to the given fits file.
 boolean writeMasterDark(File darkfile)
          Writes the master dark to the provided fits file.
 boolean writeMasterDark(File darkfile, List<nom.tam.fits.HeaderCard> cards)
          Writes the master dark to the provided fits file.
 boolean writeMasterSigma(File darkfile)
          Writes the master dark sigma to the provided fits file.
 boolean writeMasterSigma(File darkfile, List<nom.tam.fits.HeaderCard> cards)
          Writes the master dark sigma to the provided fits file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

darks

private nom.tam.fits.ImageHDU[] darks
All dark data. First index of fits file, second xtension


bitpix

private int bitpix
The number of bits per pixel.


xsize

private int xsize
The size of the image, x-direction.


ysize

private int ysize
The size of the image, y-direction.


masterdark

private nom.tam.fits.ImageHDU masterdark
The master dark, per extension


sigmadark

private nom.tam.fits.ImageHDU sigmadark
The master dark sigma map.

Constructor Detail

MasterDark

public MasterDark(String fitsbase,
                  int start,
                  int count,
                  int xtension)
Constructs a new master dark with a base fits name, a starting index and the number of images to read. The images sizes are checked for equality and stored. The number of bits per pixel is also checked and stored.


MasterDark

public MasterDark(List<File> ff)

MasterDark

public MasterDark(List<File> ff,
                  int xtension)
Method Detail

getNumbered

private static final List<File> getNumbered(String fitsbase,
                                            int start,
                                            int count)

getFilename

private static String getFilename(String base,
                                  int nr)

writeMasterDark

public boolean writeMasterDark(File darkfile)
                        throws nom.tam.fits.FitsException
Writes the master dark to the provided fits file.

Throws:
nom.tam.fits.FitsException

writeMasterDark

public boolean writeMasterDark(File darkfile,
                               List<nom.tam.fits.HeaderCard> cards)
                        throws nom.tam.fits.FitsException
Writes the master dark to the provided fits file.

Throws:
nom.tam.fits.FitsException

writeMasterSigma

public boolean writeMasterSigma(File darkfile)
                         throws nom.tam.fits.FitsException
Writes the master dark sigma to the provided fits file.

Throws:
nom.tam.fits.FitsException

writeMasterSigma

public boolean writeMasterSigma(File darkfile,
                                List<nom.tam.fits.HeaderCard> cards)
                         throws nom.tam.fits.FitsException
Writes the master dark sigma to the provided fits file.

Throws:
nom.tam.fits.FitsException

addCardsToHeader

private static nom.tam.fits.Header addCardsToHeader(nom.tam.fits.Header head,
                                                    List<nom.tam.fits.HeaderCard> cards)
Adds a list of header cards to the fits header.


writeHDU

private static boolean writeHDU(File file,
                                nom.tam.fits.ImageHDU hdu)
                         throws nom.tam.fits.FitsException
Writes an image hdu to the given fits file.

Throws:
nom.tam.fits.FitsException

createMasterDark

private boolean createMasterDark(nom.tam.fits.Header head)
                          throws nom.tam.fits.FitsException
Creates a master dark image HDU and ists sigma map in the following way:

Returns:
False on failure.
Throws:
nom.tam.fits.FitsException

printCounts

private static void printCounts(Number[] counts)
Prints a number array to system.out


main

public static void main(String[] arg)
                 throws nom.tam.fits.FitsException
Reads the fitsbase as the first command line argument, the starting number as second and the number of images as third.

Throws:
nom.tam.fits.FitsException