stella.util
Class SimulateFits

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.util.SimulateFits
All Implemented Interfaces:
Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class SimulateFits
extends PropertyBundles

A class that generates artificial fits images using skymaker and some additional properties to simulate our expected guider field. The pinhole is modeled with

 p(r)=1-k*exp(-r^4/2sig^4),
 
as it is steeper than a Gaussian, but not a rectangular bin. For this formular, fwhm/σ=(8*ln2)^1/4.


Nested Class Summary
static class SimulateFits.Generate
          Generates simulated guider/acquire frames.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static String DEFBIASMASTER
          The fits file with the bias level.
private static String DEFBIASSIGMA
          The fits file with the bias sigma.
private static String DEFDARKMASTER
          The fits file with the bias level.
private static String DEFDARKSIGMA
          The fits file with the bias sigma.
private static Point2D DEFMIRROR
          The pinhole position, main dip in unbinned frame.
private static double DEFMIRRORDIP
          The pinhole dip in percent, main dip.
private static Point2D DEFPINHOLE
          The pinhole position, main dip in unbinned frame.
private static double DEFPINHOLEDIP
          The pinhole dip in percent, main dip.
private static double DEFPINHOLEFWHM
          The pinhole fwhm in unbinned pixel, main dip.
private static double DEFPIXELSCALE
          The default pixel scale, actual folded with binning.
private static String DEFSKYCONFIG
          The default configuration file for skymaker.
private static String DEFSKYFITS
          The fits file output for starmaker, temporal file.
private static String DEFSKYLIST
          The default input list for skymaker.
private static String DEFSKYMAKER
          The path to the skymaker executable.
private static Point2D DEFSPLIT
          The offset between main and sencondary image in unbinned pixel.
private static double DEFSPLITDIP
          The brightness difference between primary and secondary image.
private static File DEFTMPCONFIG
          The configuration file for skymaker writtn by this class.
private static File DEFTMPLIST
          The default input list for skymaker.
private static String DEFURLRESOURCES
          The default resource path.
private static boolean DEFUSEBIAS
          True, if bias should be added.
private static boolean DEFUSEDARK
          True, if dark should be added.
private static boolean DEFUSEMIRROR
          True, if pinhole position should be considered.
private static boolean DEFUSEPINHOLE
          True, if pinhole position should be considered.
private static boolean DEFUSESPLIT
          True, if beam-splitter double image should be used.
static String KEY_BIASMASTER
          The fits file with the bias level.
static String KEY_BIASSIGMA
          The fits file with the bias sigma.
static String KEY_DARKMASTER
          The fits file with the bias level.
static String KEY_DARKSIGMA
          The fits file with the bias sigma.
static String KEY_MIRROR
          The mirror position in unbinned frame.
static String KEY_MIRRORDIP
          The mirror dip in percent, main dip.
static String KEY_PINHOLE
          The pinhole position, main dip in unbinned frame.
static String KEY_PINHOLEDIP
          The pinhole dip in percent, main dip.
static String KEY_PINHOLEFWHM
          The pinhole fwhm in unbinned pixel, main dip.
static String KEY_PIXELSCALE
          The default pixel scale, actual folded with binning.
static String KEY_SKYCONFIG
          The default configuration file for skymaker.
static String KEY_SKYFITS
          The fits file output for starmaker, temposral file.
static String KEY_SKYLIST
          The default input list for skymaker.
static String KEY_SKYMAKER
          The path to the skymaker executable.
static String KEY_SPLIT
          The offset between main and sencondary image in unbinned pixel.
static String KEY_SPLITDIP
          The brightness difference between primary and secondary image.
static String KEY_TMPCONFIG
          The configuration file for skymaker writtn by this class.
static String KEY_TMPLIST
          The default input list for skymaker.
static String KEY_USEBIAS
          True, if bias should be added.
static String KEY_USEDARK
          True, if dark should be added.
static String KEY_USEMIRROR
          True, if mirror position should be considered.
static String KEY_USEPINHOLE
          True, if pinhole position should be considered.
static String KEY_USESPLIT
          True, if beam-splitter double image should be used.
 
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
SimulateFits(Map prop)
          Constructs a fits simulator.
 
Method Summary
 boolean postProcess(File fitsout, Rectangle frame, int bin, double sec)
          Post-processes the file sky-maker generated.
 boolean runSkyMaker()
          Runs the skymaker as an external program.
 boolean writeConfig(Rectangle size, int bin, double sec, double see)
          Writes a new config file for skymaker using the config file specified in the properties and writes it to the temporarily config file.
 boolean writeList(Rectangle frame, int bin, double xjit, double yjit, double xosc, double yosc)
          Writes a new list file for skymaker using the original configuration file and applying x/y white noise and oscillation to it.
private static boolean writeStar(BufferedWriter out, double xcor, double ycor, double m, String rest, Rectangle frame, int bin)
          Writes a single star entry to the buffered stream.
 
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, init, 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
 
Methods inherited from interface util.Initializable
init
 

Field Detail

KEY_USEMIRROR

public static final String KEY_USEMIRROR
True, if mirror position should be considered.

See Also:
Constant Field Values

KEY_MIRROR

public static final String KEY_MIRROR
The mirror position in unbinned frame.

See Also:
Constant Field Values

KEY_MIRRORDIP

public static final String KEY_MIRRORDIP
The mirror dip in percent, main dip.

See Also:
Constant Field Values

KEY_USEPINHOLE

public static final String KEY_USEPINHOLE
True, if pinhole position should be considered.

See Also:
Constant Field Values

KEY_PINHOLE

public static final String KEY_PINHOLE
The pinhole position, main dip in unbinned frame.

See Also:
Constant Field Values

KEY_PINHOLEDIP

public static final String KEY_PINHOLEDIP
The pinhole dip in percent, main dip.

See Also:
Constant Field Values

KEY_PINHOLEFWHM

public static final String KEY_PINHOLEFWHM
The pinhole fwhm in unbinned pixel, main dip.

See Also:
Constant Field Values

KEY_USESPLIT

public static final String KEY_USESPLIT
True, if beam-splitter double image should be used.

See Also:
Constant Field Values

KEY_SPLIT

public static final String KEY_SPLIT
The offset between main and sencondary image in unbinned pixel.

See Also:
Constant Field Values

KEY_SPLITDIP

public static final String KEY_SPLITDIP
The brightness difference between primary and secondary image.

See Also:
Constant Field Values

KEY_USEBIAS

public static final String KEY_USEBIAS
True, if bias should be added.

See Also:
Constant Field Values

KEY_BIASMASTER

public static final String KEY_BIASMASTER
The fits file with the bias level.

See Also:
Constant Field Values

KEY_BIASSIGMA

public static final String KEY_BIASSIGMA
The fits file with the bias sigma.

See Also:
Constant Field Values

KEY_USEDARK

public static final String KEY_USEDARK
True, if dark should be added.

See Also:
Constant Field Values

KEY_DARKMASTER

public static final String KEY_DARKMASTER
The fits file with the bias level.

See Also:
Constant Field Values

KEY_DARKSIGMA

public static final String KEY_DARKSIGMA
The fits file with the bias sigma.

See Also:
Constant Field Values

KEY_PIXELSCALE

public static final String KEY_PIXELSCALE
The default pixel scale, actual folded with binning.

See Also:
Constant Field Values

KEY_SKYMAKER

public static final String KEY_SKYMAKER
The path to the skymaker executable.

See Also:
Constant Field Values

KEY_SKYFITS

public static final String KEY_SKYFITS
The fits file output for starmaker, temposral file.

See Also:
Constant Field Values

KEY_SKYCONFIG

public static final String KEY_SKYCONFIG
The default configuration file for skymaker.

See Also:
Constant Field Values

KEY_TMPCONFIG

public static final String KEY_TMPCONFIG
The configuration file for skymaker writtn by this class.

See Also:
Constant Field Values

KEY_SKYLIST

public static final String KEY_SKYLIST
The default input list for skymaker.

See Also:
Constant Field Values

KEY_TMPLIST

public static final String KEY_TMPLIST
The default input list for skymaker.

See Also:
Constant Field Values

DEFURLRESOURCES

private static final String DEFURLRESOURCES
The default resource path.

See Also:
Constant Field Values

DEFUSEMIRROR

private static final boolean DEFUSEMIRROR
True, if pinhole position should be considered.

See Also:
Constant Field Values

DEFMIRROR

private static final Point2D DEFMIRROR
The pinhole position, main dip in unbinned frame.


DEFMIRRORDIP

private static final double DEFMIRRORDIP
The pinhole dip in percent, main dip.

See Also:
Constant Field Values

DEFUSEPINHOLE

private static final boolean DEFUSEPINHOLE
True, if pinhole position should be considered.

See Also:
Constant Field Values

DEFPINHOLE

private static final Point2D DEFPINHOLE
The pinhole position, main dip in unbinned frame.


DEFPINHOLEDIP

private static final double DEFPINHOLEDIP
The pinhole dip in percent, main dip.

See Also:
Constant Field Values

DEFPINHOLEFWHM

private static final double DEFPINHOLEFWHM
The pinhole fwhm in unbinned pixel, main dip.

See Also:
Constant Field Values

DEFUSESPLIT

private static final boolean DEFUSESPLIT
True, if beam-splitter double image should be used.

See Also:
Constant Field Values

DEFSPLIT

private static final Point2D DEFSPLIT
The offset between main and sencondary image in unbinned pixel.


DEFSPLITDIP

private static final double DEFSPLITDIP
The brightness difference between primary and secondary image.

See Also:
Constant Field Values

DEFUSEBIAS

private static final boolean DEFUSEBIAS
True, if bias should be added.

See Also:
Constant Field Values

DEFBIASMASTER

private static final String DEFBIASMASTER
The fits file with the bias level.

See Also:
Constant Field Values

DEFBIASSIGMA

private static final String DEFBIASSIGMA
The fits file with the bias sigma.

See Also:
Constant Field Values

DEFUSEDARK

private static final boolean DEFUSEDARK
True, if dark should be added.

See Also:
Constant Field Values

DEFDARKMASTER

private static final String DEFDARKMASTER
The fits file with the bias level.

See Also:
Constant Field Values

DEFDARKSIGMA

private static final String DEFDARKSIGMA
The fits file with the bias sigma.

See Also:
Constant Field Values

DEFPIXELSCALE

private static final double DEFPIXELSCALE
The default pixel scale, actual folded with binning.

See Also:
Constant Field Values

DEFSKYMAKER

private static final String DEFSKYMAKER
The path to the skymaker executable.

See Also:
Constant Field Values

DEFSKYFITS

private static final String DEFSKYFITS
The fits file output for starmaker, temporal file.

See Also:
Constant Field Values

DEFSKYCONFIG

private static final String DEFSKYCONFIG
The default configuration file for skymaker.

See Also:
Constant Field Values

DEFTMPCONFIG

private static final File DEFTMPCONFIG
The configuration file for skymaker writtn by this class.


DEFSKYLIST

private static final String DEFSKYLIST
The default input list for skymaker.

See Also:
Constant Field Values

DEFTMPLIST

private static final File DEFTMPLIST
The default input list for skymaker.

Constructor Detail

SimulateFits

public SimulateFits(Map prop)
Constructs a fits simulator.

Method Detail

writeConfig

public boolean writeConfig(Rectangle size,
                           int bin,
                           double sec,
                           double see)
                    throws IOException
Writes a new config file for skymaker using the config file specified in the properties and writes it to the temporarily config file. Warning: The specified configuration parameter names are hard-coded.

Parameters:
fitsname - The fits file name set into the config file.
size - Image frame unbinned.
bin - Binning in x and y.
sec - Integration time in seconds.
see - Seeing fwhm (including motion) in arcsec.
Throws:
IOException

writeList

public boolean writeList(Rectangle frame,
                         int bin,
                         double xjit,
                         double yjit,
                         double xosc,
                         double yosc)
                  throws IOException
Writes a new list file for skymaker using the original configuration file and applying x/y white noise and oscillation to it. Only acts on star position, if jitter should increase the PSF, alter the configuration file!

Parameters:
xjit - Arcsec jitter in x of telescope.
yjit - Arcsec jitter in y of telescope.
xosc - Value describing arcsec oscilation in x or null.
yosc - Value describing arcsec oscilation in y or null.
Throws:
IOException

writeStar

private static boolean writeStar(BufferedWriter out,
                                 double xcor,
                                 double ycor,
                                 double m,
                                 String rest,
                                 Rectangle frame,
                                 int bin)
                          throws IOException
Writes a single star entry to the buffered stream.

Throws:
IOException

runSkyMaker

public boolean runSkyMaker()
                    throws IOException
Runs the skymaker as an external program.

Throws:
IOException

postProcess

public boolean postProcess(File fitsout,
                           Rectangle frame,
                           int bin,
                           double sec)
                    throws IOException,
                           nom.tam.fits.FitsException
Post-processes the file sky-maker generated. If bias and dark should be used, the appropriate file must be set.

Throws:
IOException
nom.tam.fits.FitsException