astro
Class WcsFit

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

public class WcsFit
extends PropertyBundles

Tries to fit pixels pairs in a fits image to a WcsProjection that minimizes the differences from the projected pixel pairs to the catalog pairs. The matching, i.e. ensuring that pixel pair at index n correponds to the catalog position a t n, must be performed on the outside, calling setMatches(vec_math.VectorG[], vec_math.VectorG[]) throws an IllegalArgumentException, if the two arrays are not of corresponding size.


Nested Class Summary
static class WcsFit.Linear
          We solve for a wcs, reading the pixel pairs and the matched catalog from an ascii file.
static class WcsFit.Minimization
          Three different minimization functions, increasing in robustness.
private static class WcsFit.Parser
           
static class WcsFit.Polynomial
          We solve for a wcs, reading the pixel pairs and the matched catalog from an ascii file.
static class WcsFit.PositionExchange
          To check if the uncertainty in the WCS determination is from the sextractor positions, we take the IRAF positions as input for the wcs fitter.
static class WcsFit.Residual
          This class tries to fit the residuals on command the command line
static class WcsFit.SigmaMaps
          Takes a valid WCS from a file plus a matched file and outputs the sigma maps.
static class WcsFit.Stepper
          We solve for a wcs, reading the pixel pairs and the matched catalog from an ascii file.
static class WcsFit.Variable
          We solve for a wcs, reading the pixel pairs and the matched catalog from an ascii file.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  VectorG[] catalog
          The model uses these catalog positions to the stars in the image.
private static double DEFRESTARTSCALE
          Default property value.
private static double DEFTOLERANCE
          Default property value.
static String KEY_RESTARTSCALE
          Muliplier in simplex size on restart.
static String KEY_TOLERANCE
          Muliplier in simplex tolerance.
private  WcsModel model
          The wcs model we are using.
private  VectorG[] pixel
          The model uses these pixel as the identified location of stars.
private  WcsProjection projection
          The model is composed with this projection.
private  VectorG solution
          After solving, this is the result.
private static String WIFSIP
           
private static String WIFSIPOLD
           
 
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
WcsFit(Map<String,String> prop)
          Constructs a WCS regression analyser.
 
Method Summary
private  VectorG amoebaSolve(VectorG start, VectorG len, WcsFit.Minimization how)
          We solve with an Amoeba and return the result.
private static void around(float[][] adu, int x0, int y0, int box, float v)
           
 int clip(int maxreject, double sigma)
          After solving, this method rejects up to the maximum stated number of measures that are outside the specified RMS-range.
 int clip(int maxreject, VectorG rms)
          After solving, this method rejects up to the maximum stated number of measures that are outside the specified RMS-range.
private static nom.tam.fits.Fits createSigma(WcsFit fit)
          Save three sigma plots.
private static nom.tam.fits.Fits createSigma(WcsFit fit, Dimension size, int comp, int blowup)
          Save three sigma plots.
private static nom.tam.fits.BasicHDU extractImageHDU(File fits)
          From a file, we extract the first image header (with two axes).
private static nom.tam.fits.Header extractImageHeader(File fits)
          From a file, we extract the first image header (with two axes).
 double getRms()
          Returns the rms of the fitted model to the model data.
 WcsModel getWcsModel()
          Returns the WCS-model used for fitting the coordinate systems.
private static VectorG[] linkMatched(File iraf, File sex, double pix)
          Helper method that links an IRAF-output match containing CCD positions, ra and dec, but no magnitude to a daofind-like output provided by sextractor.
 VectorG prepareFit(nom.tam.fits.Header h)
          From a fits header we try to deduce our starting conditions for fitting the WCS model.
private static VectorG[][] readIraf(File f)
          Helper method that reads an ascii-file into an ra/de vectorG array and a vectorG array of pixel x/y.
private static VectorG[][] readMatched(File f)
          Helper method that reads an ascii-file into an ra/de vectorG array and a vectorG array of pixel x/y.
private static void saveSigma(WcsFit fit)
           
 void setMatches(VectorG[] xy, VectorG[] rade)
          Sets the matched pixel position and the corresponding catalog entries.
 void setWcsProjection(WcsProjection wcs)
          Sets the WCSprojection we use for fitting our model.
private  nom.tam.fits.ImageHDU sigmaImage(Multidimensional sigma, Dimension box, int compress, int blowup)
          We take the residuals to the solution and return an sigma-fits from them.
 VectorG solve(VectorG start)
          We try to solve for the WCS with a chi-2 model.
 VectorG solve(VectorG start, WcsFit.Minimization how)
          We try to solve for the WCS.
 
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_RESTARTSCALE

public static final String KEY_RESTARTSCALE
Muliplier in simplex size on restart.

See Also:
Constant Field Values

KEY_TOLERANCE

public static final String KEY_TOLERANCE
Muliplier in simplex tolerance.

See Also:
Constant Field Values

DEFRESTARTSCALE

private static final double DEFRESTARTSCALE
Default property value.

See Also:
Constant Field Values

DEFTOLERANCE

private static final double DEFTOLERANCE
Default property value.

See Also:
Constant Field Values

model

private WcsModel model
The wcs model we are using.


projection

private WcsProjection projection
The model is composed with this projection.


pixel

private VectorG[] pixel
The model uses these pixel as the identified location of stars.


catalog

private VectorG[] catalog
The model uses these catalog positions to the stars in the image.


solution

private VectorG solution
After solving, this is the result.


WIFSIP

private static final String WIFSIP
See Also:
Constant Field Values

WIFSIPOLD

private static final String WIFSIPOLD
See Also:
Constant Field Values
Constructor Detail

WcsFit

public WcsFit(Map<String,String> prop)
Constructs a WCS regression analyser.

Method Detail

getWcsModel

public WcsModel getWcsModel()
Returns the WCS-model used for fitting the coordinate systems.


setWcsProjection

public void setWcsProjection(WcsProjection wcs)
Sets the WCSprojection we use for fitting our model. If the pixel and catalogs have been set, we readily construct the WcsModel here. It can be retrieved immediately with getWcsModel().


setMatches

public void setMatches(VectorG[] xy,
                       VectorG[] rade)
Sets the matched pixel position and the corresponding catalog entries. This method does not try to find matches, it is assumed that the pixel and star arrays have been matched already. Consequentially, we throw an IllegalArgumentException, if the length of the arrays is not identical.


prepareFit

public VectorG prepareFit(nom.tam.fits.Header h)
                   throws nom.tam.fits.HeaderCardException
From a fits header we try to deduce our starting conditions for fitting the WCS model. This is done by passing the header to the estimateParameter method of the projection.

Throws:
nom.tam.fits.HeaderCardException

solve

public VectorG solve(VectorG start)
We try to solve for the WCS with a chi-2 model.


solve

public VectorG solve(VectorG start,
                     WcsFit.Minimization how)
We try to solve for the WCS. If we reach convergence, we re-issue with smaller length scale to the Amoeba solver.


amoebaSolve

private VectorG amoebaSolve(VectorG start,
                            VectorG len,
                            WcsFit.Minimization how)
We solve with an Amoeba and return the result.


getRms

public double getRms()
Returns the rms of the fitted model to the model data.


clip

public int clip(int maxreject,
                double sigma)
After solving, this method rejects up to the maximum stated number of measures that are outside the specified RMS-range. If more than the stated number of measures are outside the specified range, those with the highest residuals are discarded first.

Parameters:
maxreject - Maximum number of measures to reject, zero for no bound
rms - The RMS of the current solution is multiplied with this vector and returns the maximum residual per coordinate
Returns:
The number of rejected measures, zero for no rejection.

clip

public int clip(int maxreject,
                VectorG rms)
After solving, this method rejects up to the maximum stated number of measures that are outside the specified RMS-range. If more than the stated number of measures are outside the specified range, those with the highest residuals are discarded first.

Parameters:
maxreject - Maximum number of measures to reject, zero for no bound
rms - The RMS of the current solution is multiplied with this vector2D and returns the maximum residual per coordinate
Returns:
The number of rejected measures, zero for no rejection.

sigmaImage

private nom.tam.fits.ImageHDU sigmaImage(Multidimensional sigma,
                                         Dimension box,
                                         int compress,
                                         int blowup)
                                  throws nom.tam.fits.FitsException
We take the residuals to the solution and return an sigma-fits from them.

Throws:
nom.tam.fits.FitsException

around

private static void around(float[][] adu,
                           int x0,
                           int y0,
                           int box,
                           float v)

linkMatched

private static final VectorG[] linkMatched(File iraf,
                                           File sex,
                                           double pix)
Helper method that links an IRAF-output match containing CCD positions, ra and dec, but no magnitude to a daofind-like output provided by sextractor. From the pixel matches we construct a 3-D vector that take the magnitudes from the sextractor file, but the coordinates from the IRAF file. Note that the coordinates differ by one (different origin).

Parameters:
pix - maximum allowed pixel tolerance, >1.

readMatched

private static final VectorG[][] readMatched(File f)
Helper method that reads an ascii-file into an ra/de vectorG array and a vectorG array of pixel x/y. Ra/de are sexagesimal positions. On the third index, the magnitudes (catalog and instrumental) are provided.


readIraf

private static final VectorG[][] readIraf(File f)
Helper method that reads an ascii-file into an ra/de vectorG array and a vectorG array of pixel x/y. Ra/de are sexagesimal positions in degrees.


extractImageHDU

private static nom.tam.fits.BasicHDU extractImageHDU(File fits)
                                              throws nom.tam.fits.FitsException
From a file, we extract the first image header (with two axes).

Throws:
nom.tam.fits.FitsException

extractImageHeader

private static nom.tam.fits.Header extractImageHeader(File fits)
                                               throws nom.tam.fits.FitsException
From a file, we extract the first image header (with two axes).

Throws:
nom.tam.fits.FitsException

createSigma

private static nom.tam.fits.Fits createSigma(WcsFit fit)
                                      throws nom.tam.fits.FitsException
Save three sigma plots.

Throws:
nom.tam.fits.FitsException

createSigma

private static nom.tam.fits.Fits createSigma(WcsFit fit,
                                             Dimension size,
                                             int comp,
                                             int blowup)
                                      throws nom.tam.fits.FitsException
Save three sigma plots.

Throws:
nom.tam.fits.FitsException

saveSigma

private static void saveSigma(WcsFit fit)
                       throws nom.tam.fits.FitsException,
                              IOException
Throws:
nom.tam.fits.FitsException
IOException