Legacy DoL Functions¶
(gdt.missions.fermi.gbm.localization.dol.legacy_functions)
The methods provided in this module handle the basic functionality needed to operate the legacy DoL localization algorithm in a way that replicates the original Fortran code. These include legacy angular operations as well as coordinate conversions that would typically be handled by astropy in other parts of the GDT. A number of these methods are performed with 32-bit floating point accuracy to match the original Fortran code. A full list of available methods is shown in the Reference/API section at the bottom of this page.
Here we will focus on describing the core localization fit procedure find_best_location().
This method is a \(\chi^2\) minimization routine with \(\chi^2\) defined as
where \(M_i\) are the measured counts and \(E_i\) are the expected counts in detector \(i\). This assumes the measured counts follow a Gaussian distribution with symmetric variance \(E_i\), which is true for GBM given that typical backgrounds alone provide a few hundred measured counts across 50-300 keV in each detector during most GRB emission timescales.
The expected counts \(E_i\) are determined from the sum of the source \(S_i\) and background \(B_i\) expectations for each detector
\(B_i\) are typically determined from a polynomial fit to background periods (See Localization Example). \(S_i\) consists of the response of each detector \(R_i\) multiplied by the flux \(f\) of the source
where the source flux \(f\) is found by solving for the value that minimizes \(\chi^2\). This is done by analytically setting the derivative of \(\chi^2\) equal to zero and solving for \(f\)
To make this process easier, the \(\chi^2\) is modified to exchange the model variance \(var(E_i) = E_i\) with the variance estimated from the measured counts \(var(M_i) = M_i\)
In this case, only the term \(E_i\) in the numerator depends on \(f\)
Substituting \(E_i = f \times R_i + B_i\) then yields
Reference/API¶
gdt.missions.fermi.gbm.localization.dol.legacy_functions Module¶
Functions¶
|
Add scattering data for each spectrum |
|
Make a multidimensional index mask into another array |
|
Convert right ascension and declination to Cartesian coordinates. |
|
Convert azimuth and zenith to Cartesian coordinates. |
|
Compute arctan2. |
|
Function to choose energy bins |
|
Function to compute response of NaI detectors over a selected set of energy channels. |
|
Cross product of two vectors |
|
Compute deadtime corrected rates |
|
Dot product of two vectors |
|
Function to convert from equatorial (ra, dec) coordinates in J2000 epoch to Galactic coordinates (lii, bii) |
|
Calculate chi2 for each visible location and find minimum. |
|
Get detector geometry relative to source. |
Function to calculate equatorial (ra, dec) to Galactic (lii, bii) coordinate rotation matrix. |
|
|
Get Earth center and spacecraft direction cosine matrix. |
|
Given 2 Cartesian (unit or not) vectors, return angle between them. |
|
Get list of points occulted by the Earth. |
|
Calculate amount of scattering given geometry. |
|
Get spectral shape in each energy bin |
|
Contains geometry from rmk of 07/07 Given nai el & az, calculate unit vectors in SC frame of each NaI Tested 08/14/07 -- produces correct unit vector angles as per geometry from rmk of 07/07. |
|
Interpolate between 2 values by weighting by distance between 2 pts. |
|
Convert from j2000 position to space craft azimuth and zenith. |
|
Read array of position vectors used to compute scattering of photons off Earth's atmosphere. |
|
Read atmospheric scattering matrix. |
|
Read database table with detector response for each point on the sky. |
|
Convert Cartesian source position from space craft frame to right ascension and declination in Earth-centered frame. |
|
Compute the location of the sun in equatorial (ra, dec) coordinates |
Classes¶
|
Definition of ETOG class which allows caching of ETOG value |
Class Inheritance Diagram¶
