exosim.tools.pixelsNonLinearity#
Classes#
This tools helps the user to find the pixel non-linearity coefficients to as inputs for ExoSim, |
Module Contents#
- class PixelsNonLinearity(options_file, output=None, show_results=True)[source]#
Bases:
exosim.tools.exosimTool.ExoSimToolThis tools helps the user to find the pixel non-linearity coefficients to as inputs for ExoSim, starting from the an estimate of pixel non-linearity correction.
This class will retrieve the \(a_i\) coefficients, starting from physical assumptions.
The detector non linearity model, is written as polynomial such as
\[Q_{det} = Q \cdot (1 + \sum_i a_i \cdot Q^i)\]where \(Q_{det}\) is the charge read by the detector, and \(Q\) is the ideal count, as \(Q = \phi_t\), with \(\phi\) being the number of electrons generated and \(t\) being the elapsed time.
Considering the detector as a capacitor, the charge \(Q_{det}\) is given by
\[Q_{det} = \phi \tau \cdot \left(1 - e^{-Q/\phi \tau}\right)\]where \(\phi\) is the charge generated in the detector pixel, and \(\tau\) is the capacitor time constant. In fact the product \(\phi \tau\) is constant \(Q\) is the response of a linear detectror is given by \(Q = \phi t\)
The detector is considered saturated when the charge \(Q_{det}\) at the well depth \(Q_{det, \, wd}\) differs from the ideal well depth \(Q_{wd}\) by 5%.
\[Q_{det} = (1-5\%)Q_{wd}\]Then
\[\phi \tau \cdot \left(1 - e^{-Q_{wd}/\phi \tau}\right) = (1-5\%)Q_{wd}\]This equation can be solved numerically and gives
\[\frac{Q_{wd}}{\phi \tau} \sim 0.103479\]Therefore the detector collected charge is given by
\[Q_{det} = \frac{Q_{wd}}{0.103479} \cdot \left(1 - e^\frac{- 0.103479 \, Q}{Q_{wd}}\right)\]Which can be approximated by a polynomial of order 4 as
\[ \begin{align}\begin{aligned}Q_{det} = Q\left[ 1- \frac{1}{2!}\frac{0.103479}{Q_{wd}} Q\\+ \frac{1}{3!}\left(\frac{0.103479}{Q_{wd}}\right)^2 Q^2\\- \frac{1}{4!}\left(\frac{0.103479}{Q_{wd}}\right)^3 Q^3\\+ \frac{1}{5!}\left(\frac{0.103479}{Q_{wd}}\right)^4 Q^4 \right]\end{aligned}\end{align} \]The results are the coefficients for a 4-th order polynomial:
\[Q_{det} = Q \cdot (a_1 + a_2 \cdot Q + a_3 \cdot Q^2 + a_4 \cdot Q^3 + a_5 \cdot Q^4)\]However, each pixel is different, and therefore, this class also produces a map of the coefficient for each pixel. Each coefficient is normally distributed around the mean value, with a standard deviation indicated in the configuration. If no standard deviation is indicated, the coefficients are assumed to be constant.
The code output is a map of \(a_i\) coefficients for each pixel, which can be injected into
ApplyPixelsNonLinearity.Examples
>>> import exosim.tools as tools >>> >>> results = tools.PixelsNonLinearity(options_file='tools_input_example.xml', >>> output='output_pnl_map.h5')
- compute_coefficients(parameters, show_results=True)[source]#
It computes the non linearity coefficients.
- Parameters:
parameters (dict) – dictionary contained the sources parameters. This is usually parsed from
LoadOptionsshow_results (bool) – it tells the code if showing the results in a plot. Default is True.
- Return type:
- create_map(parameters, input_dict, show_results=True)[source]#
Create a map of the pixel non-linearity correction coefficients. To create a non linearity map of the detector, we randomize the coefficients. If not specified, the standard deviation is set to 0 and the coefficients are assumed to be standard. of the mean value of the polynomial coefficients
- Parameters:
parameters (dict) – dictionary contained the sources parameters. This is usually parsed from
LoadOptionsinput_dict (dict) – dictionary produced by compute_coefficients. It contains the coefficients (coeff), the saturation (‘saturation’) and the estimated well depth (well_depth)
show_results (bool) – it tells the code if showing the results in a plot. Default is True.
- Returns:
map of the coefficients. The shape is (4, nrow, ncol) The first axes refers to the coefficients (a, b, c, d, e)
- Return type:
np.ndarray