|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
astro.fits.AmplifierCrosstalk
public class AmplifierCrosstalk
This class is designed to measure crosstalk between amplifiers and prepare reduction files to reduce it as far as possible.
Amplifier crosstalk can happen if a monolithic chip is read out using
more than a single amplifier, like reported by Freyhammer et al.
Experimental Astronomy 12, 147 (2001).
We write the measured ADU signal in amplifier i as
ADU_i(x,y) = Σ_j α_ij(x,y) · N_j(x,y),where N_j is the true signal at point x,y, summing over all quadrants, and α_ij(x,y) is a quadratic matrix of dimensionality equal to the number of amplifies. Consequentially, the true signal can be restored by
N_i(x,y) = Σ_j α*_ij · ADU_j(x,y),where α*_ij is the inverse of α_ij(x,y). Ideally, α_ij(x,y) collapses to the Kronecker δ_ij. Note that even if the linearity beween measured and true signal holds until the full-well capacity is reached, normal gain setup in CCD prevent a full recovery since the maximum ADU level (65535 in most cases) ist somewhere below fill-well capacity, in the linear regime of the CCD. Thus, a saturated signal of 65535 may lead to different responses in the affected quadrants, depending wether full-well was already reached. In this region, the correction will not be precise.
The purpose of this class is to measure the forward-crosstalk α*_ij by providing a set of N fits images, each with N extensions corresponding to the amplifiers, where each image ideally is illuminated in a single amplifier section only. We then identify the cross-talk signals in all the other than the exposed section my measuring the signal on x,y and correcting for background light, either by a constant level or a dedicated background image, or even a combination of both. The true signal in the illuminated amplifier is established as the measured signal after a possible backgorund subtraction. Using the entire set of images, the off-diagonal elements of α_ij(x,y) are thus defined, α_ii=1 is assumed. Matrix α_ij(x,y) is then inverted to yield α*_ij(x,y), which is then stored as N fits images with N extensions, allowing then direct recovery of the true signal for all science images taken.
To check the validity of the homogeneous (!) linear relation in the first place, one should use at least two different illumination levels and compare the results. Note, too, that high S/N is required to recover the weak crosstalk signal (an effect below order of 10^-4, hopefully), thus the input images to this class should be gained by averageing a couple of images. Eventually, median-averaging over boxes in the original image may help, thus loosing the pixel-to-pixel response of the reconstruction, but gaining a lot of signal.
Helper classes exists for creating empty HDUs of various sizes. This class is mainly intended for the WiFSIP instrument, which features a four-amp chip.
| Nested Class Summary | |
|---|---|
static class |
AmplifierCrosstalk.Gradient
This class tries to get from real-world measurements to useful input images by subtracting a gradient in the background. |
static class |
AmplifierCrosstalk.LinearRestore
This class takes the fits on the command line argument and does the amplifier correction using the properties stated. |
static class |
AmplifierCrosstalk.Matrix
This class takes N (four for WiFSIP) single-quadrant illuminated fits files and calculates the correction matrix out of it. |
static class |
AmplifierCrosstalk.MatrixFit
This class tries to get from real-world measurements to corrections over the entire amplifier surface. |
static class |
AmplifierCrosstalk.Restore
This class takes the fits on the command line argument and does the amplifier correction using the properties stated. |
static class |
AmplifierCrosstalk.Simul
Test class to generate artificial illumination fits files. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
static double |
ADULIMIT
Numerical maximum ADU reachable in input image. |
private double[][] |
calpha
If constant calibration is sufficient. |
private static String |
DEFCORRECTIONCONS
From a series of mesured regulus images (Apr. |
private static double |
DEFMINILLUMINATION
Default minimum illumination. |
private static String |
DEFOVERSPILL
From science20100616A-0000EXP0005 the overspill. |
static String |
ILLUKEY
Header key for indicating the amplifer the correction applies. |
static String |
ILLUREM
Remark to above key. |
static String |
KEY_BACKGROUNDFITS
If stated, the list of background images. |
static String |
KEY_BACKGROUNDLEVEL
If stated, the double-tokenizable list of background levels. |
static String |
KEY_CORRECTIONCONS
The ,;-list of constant correction elements, if sufficient. |
static String |
KEY_CORRECTIONFITS
The list of the fits that hold the correction matrices. |
static String |
KEY_CROSSTALKFITS
The list of the N single-amplifier exposed fits, each N extension. |
static String |
KEY_CROSSTALKSIGMA
The sigmas to the N single-amplifier exposed fits, each N extension. |
static String |
KEY_MINILLUMINATION
Minimum ADU to call pixel illuminated in an illu quadrant. |
static String |
KEY_OVERSPILL
The ,;-list of overspill corrections for maximum overspill. |
private double[][][][] |
measures
The calibrated measurements. |
private double[][] |
overspill
Overspill correction for estimating correction above 65535. |
| 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 | |
|---|---|
AmplifierCrosstalk(Map<String,String> prop)
Creates a new AmplifierCrosstalk. |
|
| Method Summary | |
|---|---|
private static nom.tam.fits.ImageHDU |
allOnes(nom.tam.fits.BasicHDU size)
Returns an image HDU with all double ones. |
nom.tam.fits.Fits |
applyCorrection(nom.tam.fits.Fits science)
Applies the correction. |
nom.tam.fits.Fits |
applyLinearCorrection(nom.tam.fits.Fits science)
Applies the linear correction. |
static nom.tam.fits.Fits |
correct(nom.tam.fits.Fits science,
double[][][][] alpha,
double[][] spill)
Split a single science fits file into its image quadrants, correct them and convert back into a single fits object. |
static nom.tam.fits.ImageHDU[] |
correctQuadrants(nom.tam.fits.ImageHDU[] science,
double[][][][] alpha,
double[][] overspill)
We apply the corrections on a single quadrant providing the four correct correction coefficients. |
boolean |
createCorrectionMatrix()
This method is used to create the correction fits out of the crosstalk fits. |
private static double |
estimateOverspill(double[][] in,
int x,
int y)
From an x,y position in a quadrant checked as source for overspill, we try to estimate the amount of overspill. |
static nom.tam.fits.ImageHDU |
fitBackground(nom.tam.fits.ImageHDU amplifier,
nom.tam.fits.ImageHDU crstlk,
nom.tam.fits.ImageHDU sigma,
double minillu,
Multidimensional[] model)
If the input images are too noise, we can subtract a fit here. |
static nom.tam.fits.ImageHDU[] |
fitCorrectionMatrix(nom.tam.fits.ImageHDU corr,
nom.tam.fits.ImageHDU sig,
Multidimensional[] model)
Normally, measurements of the crosstalk cannot be obtained across an entire quadrant, meaning that normally only a portion of the quadrant will be illuminated. |
static List<nom.tam.fits.Fits> |
getConversionFits(double[][][][] matrix)
We store the crosstalk-correction matrices as fits files, each fits has a primary extension without data, followed by an extension per amplifier. |
static double[][][][] |
getCorrection(double[][][][] illu,
double minadu)
The input array consists of reduced illumination data. |
static double[][][][] |
getCrosstalk(List<nom.tam.fits.Fits> illu,
List<nom.tam.fits.Fits> bias,
double[][] offset)
Creates the data array out of the image list, the background list, if applicable, and/or a list of constant offsets. |
private List<nom.tam.fits.Fits> |
getFitsList(List<String> ctf)
Returns a list of fits files by either looking up the list entries at files, or, if not existing, as resources. |
void |
init()
Always load the constant coefficients, this is no time. |
private static boolean |
isMax(double[][] in,
int x,
int y)
Checks, if requested coordinate is in image range. |
nom.tam.fits.ImageHDU[] |
linearCorrectQuadrants(nom.tam.fits.ImageHDU[] science)
We apply the corrections on a single quadrant providing the four correct correction coefficients. |
static double[][][][] |
loadConversionFits(List<nom.tam.fits.Fits> alpha)
We load the correction matrix from alist of Fits files. |
static Multidimensional[] |
lowestTwoFit()
Creates the model of a planar plus an xy term fit through the correction matrix. |
static Multidimensional[] |
parabolicFit()
Parabolic fit. |
static Multidimensional[] |
planeFit()
Creates the model of a planar fit through the correction matrix. |
boolean |
storeCorrectionMatrix()
Stores the correction matrix in the fits files. |
private static double[][] |
stringMatrix(String commasemicolon)
Converts a comma-semicolon matrix int a two-dimensional array. |
| 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 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 |
|---|
public static final double ADULIMIT
public static final String ILLUKEY
public static final String ILLUREM
public static final String KEY_BACKGROUNDFITS
public static final String KEY_BACKGROUNDLEVEL
public static final String KEY_CROSSTALKFITS
public static final String KEY_CROSSTALKSIGMA
public static final String KEY_CORRECTIONFITS
public static final String KEY_CORRECTIONCONS
public static final String KEY_OVERSPILL
public static final String KEY_MINILLUMINATION
private static final double DEFMINILLUMINATION
private static final String DEFCORRECTIONCONS
private static final String DEFOVERSPILL
private double[][][][] measures
private double[][] calpha
private double[][] overspill
| Constructor Detail |
|---|
public AmplifierCrosstalk(Map<String,String> prop)
getCrosstalk(java.util.List, java.util.List, double[][]) .
| Method Detail |
|---|
public void init()
init in interface Initializableinit in class PropertyResourcesprivate static double[][] stringMatrix(String commasemicolon)
"1,2,3;4,5,6" would produce an array a[2][3], with
a[0] = 1,2,3 and a[1] = 4,5,6
public boolean createCorrectionMatrix()
throws nom.tam.fits.FitsException,
IOException
nom.tam.fits.FitsException
IOException
public boolean storeCorrectionMatrix()
throws nom.tam.fits.FitsException,
IOException
nom.tam.fits.FitsException
IOException
public nom.tam.fits.Fits applyCorrection(nom.tam.fits.Fits science)
throws nom.tam.fits.FitsException,
IOException
nom.tam.fits.FitsException
IOException
public nom.tam.fits.Fits applyLinearCorrection(nom.tam.fits.Fits science)
throws nom.tam.fits.FitsException,
IOException
nom.tam.fits.FitsException
IOException
private List<nom.tam.fits.Fits> getFitsList(List<String> ctf)
throws nom.tam.fits.FitsException,
IOException
nom.tam.fits.FitsException
IOException
public static double[][][][] getCrosstalk(List<nom.tam.fits.Fits> illu,
List<nom.tam.fits.Fits> bias,
double[][] offset)
throws nom.tam.fits.FitsException,
IOException
illu - The list of individually illuminated amplifier sections.bias - If non-null, this bias is subtracted from the illumination.offset - If non-null subtracted from the illumination level.
nom.tam.fits.FitsException
IOException
public static double[][][][] getCorrection(double[][][][] illu,
double minadu)
throws nom.tam.fits.FitsException,
IOException
minadu - If the illumination is less, ignore data.
nom.tam.fits.FitsException
IOException
public static List<nom.tam.fits.Fits> getConversionFits(double[][][][] matrix)
throws nom.tam.fits.FitsException
nom.tam.fits.FitsException
public static double[][][][] loadConversionFits(List<nom.tam.fits.Fits> alpha)
throws nom.tam.fits.FitsException,
IOException
nom.tam.fits.FitsException
IOException
public static nom.tam.fits.ImageHDU[] correctQuadrants(nom.tam.fits.ImageHDU[] science,
double[][][][] alpha,
double[][] overspill)
throws nom.tam.fits.FitsException
alpha - correction matrix with x/y excahnged, i.e [n][n][y][x]
nom.tam.fits.FitsException
public nom.tam.fits.ImageHDU[] linearCorrectQuadrants(nom.tam.fits.ImageHDU[] science)
throws nom.tam.fits.FitsException
alpha - correction matrix with x/y excahnged, i.e [n][n][y][x]
nom.tam.fits.FitsException
public static nom.tam.fits.Fits correct(nom.tam.fits.Fits science,
double[][][][] alpha,
double[][] spill)
throws nom.tam.fits.FitsException,
IOException
nom.tam.fits.FitsException
IOExceptionpublic static Multidimensional[] planeFit()
public static Multidimensional[] lowestTwoFit()
public static Multidimensional[] parabolicFit()
private static final nom.tam.fits.ImageHDU allOnes(nom.tam.fits.BasicHDU size)
throws nom.tam.fits.FitsException
size - The data template for size.
nom.tam.fits.FitsException
private static double estimateOverspill(double[][] in,
int x,
int y)
throws nom.tam.fits.FitsException
nom.tam.fits.FitsException
private static boolean isMax(double[][] in,
int x,
int y)
throws nom.tam.fits.FitsException
nom.tam.fits.FitsException
public static nom.tam.fits.ImageHDU fitBackground(nom.tam.fits.ImageHDU amplifier,
nom.tam.fits.ImageHDU crstlk,
nom.tam.fits.ImageHDU sigma,
double minillu,
Multidimensional[] model)
throws nom.tam.fits.FitsException,
IOException
KEY_MINILLUMINATION in the amplifier quadrant. To this
extracted ADUs, a linear model is fitted. This model is then
subtracted across the entire target HDU, returning the residuals in
a separated ImageHDU.
If the sigma for the input pixel is known, provide it as a
ImageHDU.
sigma - Can be null
nom.tam.fits.FitsException
IOException
public static nom.tam.fits.ImageHDU[] fitCorrectionMatrix(nom.tam.fits.ImageHDU corr,
nom.tam.fits.ImageHDU sig,
Multidimensional[] model)
throws nom.tam.fits.FitsException
GeneralLinearRegression. The easiest model
would be a plane according to
m_ij = d_0+k_1*x_i+k_2*y_j, which has only three
model functions
nom.tam.fits.FitsExceptionplaneFit()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||