Define the PointSource class, code to load weight tables to combine with photon data

Weight tables

We use a full-sky catalog analysis model, currently pointlike, see source_weights, to evaluate the predicted flux from a source of interest with respect to the background, the combined fluxes from all other sources.

We choose the following binning:

  • energy: 4/decade from 100 MeV to 1 TeV (but only upto 10 GeV really used)
  • event types: Front/Back
  • Angular position: HEALPix, nside from 64 to 512 depending on the PSF

In the tables, the energy index and event type are packed into a 1-byte band index, and the HEALPix index is in NEST order.

The table output also includes the predicted flux for each band, and the spectral model used.

@ipynb_doc
def weight_table_plots():
    """
    ### Plots of weight vs. radius
    
    These plots, of a strong source with little background, and a weak one, show the
    value of the weight vs. the radius of the pixels in the table. These is a 
    plot for each energy/event type band. The top row has energies 100 MeV to 1 GeV,
    the bottom row 1 GeV to 10 GeV, Front, in green, and Back in orange.
    {img}
    Note the absense of Back for energies below {Emid} MeV. The pointlike model does not
    compute these to avoid the larger PSF and Earth limb background. The maximum radius
    per band is determined by the PSF. 
    """
    Emid = round(10**2.5)
    img = image('weight_table_plots.png', width=500, caption=None)
    return locals()
weight_table_plots()
ipynb_docgen: Can't set width at the moment

Plots of weight vs. radius

These plots, of a strong source with little background, and a weak one, show the value of the weight vs. the radius of the pixels in the table. These is a plot for each energy/event type band. The top row has energies 100 MeV to 1 GeV, the bottom row 1 GeV to 10 GeV, Front, in green, and Back in orange.

Figure 1
Note the absense of Back for energies below 316 MeV. The pointlike model does not compute these to avoid the larger PSF and Earth limb background. The maximum radius per band is determined by the PSF.

The local code used to do the unpacking is in the class WeightMan

This table is used with the data, as a simple lookup: A weight is assigned to each photon according to which energy, event type or HEALPix pixel it lands in.

Accounting for variations from neighboring sources

Consider the case where sources $S_1$ and $S_2$ have overlapping pixels. For a given pixel and band, the corresponding weights are $w_1$ and $w_2$, and we investigate the effect on $S_1$ from a fractional variation $\alpha_2 \ne 0$ of $S_2$, such that its flux for that pixel, $s_2$, becomes $(1+\alpha )\ s_2$. With the background $b$, the flux of all sources besides $S_1$ and $S_2$, we have for the $S_1$ weight,

$$ w_1 = \frac{s_1}{s_1+s_2+b}\ \ ,$$

and similarly for $S_2$. Replacing $s_2$ with $(1+\alpha ) s_2$, we have for the modified weight $w_1'$ that we should use for $S_1$, $$w'_1 = \frac{w_1}{1+\alpha_2\ w_2}\ \ . $$

get_wtzip_index[source]

get_wtzip_index(config, update=False)

class WeightMan[source]

WeightMan(config, source) :: dict

Weight Management

  • Load weight tables
  • Assign weights to photons

weight_radius_plots[source]

weight_radius_plots(photons)

findsource[source]

findsource(*pars, gal=False)

Return a SkyCoord, looking up a name, or interpreting args

Optional inputs: len(pars) is 1 for a source name or Jxxx, or 2 for coordinate pair

  • name -- look up the name, return None if not found
  • Jxxxx.x+yyyy -- intrepret to get ra, dec, then convert
  • ra,dec -- assume frame=fk5
  • l,b, gal=True -- assume degrees, frame=galactic

class FermiCatalog[source]

FermiCatalog(config=None, max_sep=0.1)

class SourceLookup[source]

SourceLookup(config)

Use lists of the pointlike and catalog sources to check for correspondence of a name or position

SourceLookup.__call__[source]

SourceLookup.__call__(*pars, **kwargs)

Search the catalog lists. Options are:

  • name of a pointlike source
  • name of a source found by astropy, or a coordinate, which is close to a source in the pointlike list
  • a coordinate pair (ra,dec), or (l,b, gal=True)

Returns the pointlike name.

class PointSource[source]

PointSource(*pars, **kwargs)

Manage the position and name of a point source

PointSource.fk5[source]

PointSource.fk5(name, position)

position: (ra,dec) tuple