stella.util
Class BeamSplitterFit

java.lang.Object
  extended by stella.util.BeamSplitterFit
All Implemented Interfaces:
Multidimensional

public class BeamSplitterFit
extends Object
implements Multidimensional

This class tries to fit data from the guider ccd to a double-peaked gaussian to resemble the STELLA-I guiding setup. The function fitted reads as

   f(x,y) = I_0·exp(-((x-x_0)²+(y-y_0)²)/2σ_0²+
        k_I I_0·exp(-((x-x_0-Δx)²+(y-y_0-Δy)²)/2σ_0²·k_s²+sky;
   
The values fitted are I_0, x_0, y_0, σ_0, k_I, k_s, and Δx, Δy, which are the peak intensity and the peak center on the CCD, the peak width, the offset of the secondary peak in Δx,y and the realative intensity k_I and relative width k_s. It is guaranteed, that Δx and Δy are constant and also k_I and k_s should not vary. So, determining these coefficients once leaves only four parameter that vary from frame to frame. The Δx Δy and k's might also be used for fitting the star plus the hole, with signs on Δ's reversed. Solving for the parameters is done with a simplex method. For each x/y coordinate pair, the function above is evaluated, the difference to the counts is calculated and squared and the squared difference is weighed with a poisson noise plus a readout noise. The sky value is estimated from the median of the outermost pixel.


Nested Class Summary
static class BeamSplitterFit.FitsFile
          Reads a fits-file, extracts the counts out of it and does a beam-splitter fit.
 
Field Summary
private  int[][] counts
          The count arra, normally deduced from a fits file, x is first index.
private  double deltax
          On declaring hole fitting, we set the binning factor and get deltax.
static double DELTAX
          After averaging some non-pinhole images, the secondary peak offset.
private  double deltay
          On declaring hole fitting, we set the binning factor and get deltax.
static double DELTAY
          The average secondary peak offset in the mirror.
static double FWHMMIRROR
          The average fwhm factor between direct and mirror in best focus.
private  boolean hole
          If this is true, we fit to double gauss plus pinhole.
static double IMIRROR
          The average intensity factor between the direct and the mirror image.
private  double intensity
          On hole fitting, we set the direct intensity and get the mirror i.
static double KI
          The average intensity factor of the secondary peak.
static double KS
          The average fwhm relation between primary and secondary peak.
private  double sigma
          On hole fitting, we set the direct fwhm and get the mirror sigma.
private  double sky
          The sky count.
private  double[][] weight
          The weight of each pixel, calculateed from readout noise and Poisson.
 
Constructor Summary
BeamSplitterFit(int[][] ccd, double gain, double readout, boolean weigh)
          Constructs a new beam splitter that can readily be used for Amoeba.
 
Method Summary
 int dimension()
          Returns 8 for normal fits, 6 for pinhole fits.
 double evaluate(VectorG fit)
          Evaluates the functional fit.
private  double evaluate(VectorG fit, boolean print)
          Evaluates the functional fit.
 void evaluateHole(int binx, int biny, double idirect, double fwhmdirect)
          If we want to fit the double gaussian and the pinhole as negative gaussian, we can do that here.
private static double gauss(double i0, double x, double y, double sig)
          Calculates a two-dimensional gauss.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELTAX

public static final double DELTAX
After averaging some non-pinhole images, the secondary peak offset.

See Also:
Constant Field Values

DELTAY

public static final double DELTAY
The average secondary peak offset in the mirror.

See Also:
Constant Field Values

KI

public static final double KI
The average intensity factor of the secondary peak.

See Also:
Constant Field Values

KS

public static final double KS
The average fwhm relation between primary and secondary peak.

See Also:
Constant Field Values

IMIRROR

public static final double IMIRROR
The average intensity factor between the direct and the mirror image.

See Also:
Constant Field Values

FWHMMIRROR

public static final double FWHMMIRROR
The average fwhm factor between direct and mirror in best focus.

See Also:
Constant Field Values

counts

private int[][] counts
The count arra, normally deduced from a fits file, x is first index.


weight

private double[][] weight
The weight of each pixel, calculateed from readout noise and Poisson.


sky

private double sky
The sky count.


hole

private boolean hole
If this is true, we fit to double gauss plus pinhole.


deltax

private double deltax
On declaring hole fitting, we set the binning factor and get deltax.


deltay

private double deltay
On declaring hole fitting, we set the binning factor and get deltax.


intensity

private double intensity
On hole fitting, we set the direct intensity and get the mirror i.


sigma

private double sigma
On hole fitting, we set the direct fwhm and get the mirror sigma.

Constructor Detail

BeamSplitterFit

public BeamSplitterFit(int[][] ccd,
                       double gain,
                       double readout,
                       boolean weigh)
Constructs a new beam splitter that can readily be used for Amoeba.

Method Detail

evaluateHole

public void evaluateHole(int binx,
                         int biny,
                         double idirect,
                         double fwhmdirect)
If we want to fit the double gaussian and the pinhole as negative gaussian, we can do that here. First test showed too high error if we also fit the height and with of the mirror star, but from comparison with non-pinhole affected images, we can derive the mirror intensity and the mirror fwhm from first solving on the direct image, then multiplying the intensity and fwhm of the direct image with IMIRROR and FWHMMIRROR, respectively. In this method, we have to give the intensity and the fwhm of the direct solution.


evaluate

public double evaluate(VectorG fit)
Evaluates the functional fit. The vector passed over must have a dimensionality of nine and must provide the data in the following form, ordered by index number. For each pixel pair, the deviation to the functional fix is evaluated and squared, this deviation is added together with a weighing according to Poisson noise of the data.

Specified by:
evaluate in interface Multidimensional

evaluate

private double evaluate(VectorG fit,
                        boolean print)
Evaluates the functional fit. The vector passed over must have a dimensionality of nine and must provide the data in the following form, ordered by index number. For each pixel pair, the deviation to the functional fix is evaluated and squared, this deviation is added together with a weighing according to Poisson noise of the data.

Parameters:
print - If true, we print x/y count fit count-fit

dimension

public int dimension()
Returns 8 for normal fits, 6 for pinhole fits.

Specified by:
dimension in interface Multidimensional

gauss

private static final double gauss(double i0,
                                  double x,
                                  double y,
                                  double sig)
Calculates a two-dimensional gauss.