stella.adapter
Class AbstractPinholeModel

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.adapter.AbstractPinholeShift
                  extended by stella.adapter.AbstractPinholeModel
All Implemented Interfaces:
Cloneable, PinholeShift, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying
Direct Known Subclasses:
AveragePinhole, ModelDrift

public abstract class AbstractPinholeModel
extends AbstractPinholeShift

Class that determines the pixel shift between pinhole and star by modelling the star plus pinhole. This class comprises methods to quantify the fit quality.


Nested Class Summary
static interface AbstractPinholeModel.PinholeModel
          This is the data model that somehow describes the star plus pinhole.
 
Nested classes/interfaces inherited from class stella.adapter.AbstractPinholeShift
AbstractPinholeShift.Background, AbstractPinholeShift.Evaluate, AbstractPinholeShift.Reconstruct
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  Dimension box
          The geometry of the data model to derive the 2-dim back.
private static double DEFMU
          Pixel size of detector, mu
private static double DEFPIXELSCALE
          Pixel size of detector in arcseconds.
private static boolean DEFUSESIMPLEX
          Default we are not using simplex.
protected  AbstractPinholeModel.PinholeModel fit
          The data model, where the times are the rectangular grid.
private  nom.tam.fits.ImageHDU hdu
          We also need the original data.
static String KEY_MU
          The pixel size in micron .
static String KEY_PIXELSCALE
          The pixel size in micron .
static String KEY_USESIMPLEX
          If false, we use Levenberg-Marquardt algorithm, otherwise Simplex.
private  VectorG last
          The last solution.
 
Fields inherited from class stella.adapter.AbstractPinholeShift
KEY_ADNOISE, KEY_APPLICABLE, KEY_GAIN, KEY_PINHOLE, KEY_SIGMACLIP, KEY_SKYTHICK
 
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
protected AbstractPinholeModel(Map<String,String> prop)
          Constructs a model-shift.
 
Method Summary
protected abstract  AbstractPinholeModel.PinholeModel generatePinholeModel(nom.tam.fits.ImageHDU hdu, Rectangle frame, double back, double backerr, Point2D pinhole)
          This method intializes the pinhole model used in the fitting process during initFiberView(nom.tam.fits.Fits).
static List<String> getGnuPlotLines(double[][] data)
          Returns a list of lines for a three-dim GNU plot input.
 double[][] getMeasures()
          Returns the flux of the star as it would have been seen without a pinhole as a two-dim model.
 double[][] getModel()
          Returns the flux of the star as it would have been seen without a pinhole as a two-dim model.
 double[][] getModel(VectorG with)
          Returns the flux of the star as it would have been seen without a pinhole as a two-dim model.
 double[][] getRelativeStarModel()
          We divide the residual by the star model flux at all pixels.
 double getRemainingFlux()
          Gets the measured ADU of the star.
 double[][] getResiduals()
          Returns the residuals of the model as a two-dimensional array representing the original geometry, x in the first index, y in second.
 double getRms()
          Returns the RMS of the model, zero if no convergence was obtained
 VectorG getSolution()
          Returns the final solution.
 double[][] getStarModel()
          Returns the flux of the star as it would have been seen without a pinhole as a two-dim model.
abstract  Point2D getStarPosition()
          Returns the star position.
 Point2D initFiberView(nom.tam.fits.Fits ccd)
          Returns the center of gravity shift of the image from the pinhole position.
static double sumup(double[][] data)
          Sums a model flux.
 
Methods inherited from class stella.adapter.AbstractPinholeShift
backgroundFrameMean, backgroundFrameMedian, backgroundMean, backgroundMedian, getAduSignal, getApplicableWindow, getFlux, getFwhm, getPinholePosition, getSignalToNoise, init
 
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 stella.adapter.PinholeShift
getBackground
 
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_MU

public static final String KEY_MU
The pixel size in micron .

See Also:
Constant Field Values

KEY_PIXELSCALE

public static final String KEY_PIXELSCALE
The pixel size in micron .

See Also:
Constant Field Values

KEY_USESIMPLEX

public static final String KEY_USESIMPLEX
If false, we use Levenberg-Marquardt algorithm, otherwise Simplex.

See Also:
Constant Field Values

DEFMU

private static final double DEFMU
Pixel size of detector, mu

See Also:
Constant Field Values

DEFPIXELSCALE

private static final double DEFPIXELSCALE
Pixel size of detector in arcseconds.

See Also:
Constant Field Values

DEFUSESIMPLEX

private static final boolean DEFUSESIMPLEX
Default we are not using simplex.

See Also:
Constant Field Values

last

private VectorG last
The last solution.


fit

protected AbstractPinholeModel.PinholeModel fit
The data model, where the times are the rectangular grid.


box

private Dimension box
The geometry of the data model to derive the 2-dim back.


hdu

private nom.tam.fits.ImageHDU hdu
We also need the original data.

Constructor Detail

AbstractPinholeModel

protected AbstractPinholeModel(Map<String,String> prop)
Constructs a model-shift.

Method Detail

generatePinholeModel

protected abstract AbstractPinholeModel.PinholeModel generatePinholeModel(nom.tam.fits.ImageHDU hdu,
                                                                          Rectangle frame,
                                                                          double back,
                                                                          double backerr,
                                                                          Point2D pinhole)
                                                                   throws nom.tam.fits.FitsException
This method intializes the pinhole model used in the fitting process during initFiberView(nom.tam.fits.Fits). We supply the image data, the applicable image rectangle, the background estimate plus its error and the zero-order pinhole position.

Throws:
nom.tam.fits.FitsException

getRms

public double getRms()
Returns the RMS of the model, zero if no convergence was obtained


getSolution

public VectorG getSolution()
Returns the final solution.


getResiduals

public double[][] getResiduals()
Returns the residuals of the model as a two-dimensional array representing the original geometry, x in the first index, y in second.


getRemainingFlux

public double getRemainingFlux()
Gets the measured ADU of the star. First, we call the abstract PinholeShift.getBackground(nom.tam.fits.ImageHDU) method, then we use sigma-clipping to get all pixel that have a signal. The number of pixels with signal and the ADU sum are returned.

Returns:
The number of pixels with signal in the first index, the ADU-sum in the second.

getStarPosition

public abstract Point2D getStarPosition()
Returns the star position.


getStarModel

public double[][] getStarModel()
Returns the flux of the star as it would have been seen without a pinhole as a two-dim model.


getMeasures

public double[][] getMeasures()
Returns the flux of the star as it would have been seen without a pinhole as a two-dim model.


getModel

public double[][] getModel()
Returns the flux of the star as it would have been seen without a pinhole as a two-dim model.


getModel

public double[][] getModel(VectorG with)
Returns the flux of the star as it would have been seen without a pinhole as a two-dim model.


sumup

public static double sumup(double[][] data)
Sums a model flux.


getRelativeStarModel

public double[][] getRelativeStarModel()
We divide the residual by the star model flux at all pixels.


getGnuPlotLines

public static List<String> getGnuPlotLines(double[][] data)
Returns a list of lines for a three-dim GNU plot input. Plot it with
       gnuplot> splot "data.file" matrix with lines
       


initFiberView

public Point2D initFiberView(nom.tam.fits.Fits ccd)
Returns the center of gravity shift of the image from the pinhole position. The true center of gravity is scaled with two functions to return true shifts.

Parameters:
ccd - The image of the pinhole entrance
Returns:
The pixel shift from the pinhole center to the star.