llama.files.healpix.psf module¶
Functions for working with point sources, applying point spread functions (PSFs) thereto, and making those PSFs compatible with other HEALPix skymaps.
-
class
llama.files.healpix.psf.
Psf
¶ Bases:
abc.ABC
A point spread function that can be applied to a HEALPix skymap.
-
abstract
calculate
()¶ Calculate a Point Spread Function (PSF) over a bunch of NUNIQ HEALPix pixels.
- Returns
densities – An array of densities for this skymap. See
Psf.indices
for the corresponding pixel indices.- Return type
array
-
property
dangle
¶ Return the angular distances of the important pixels in this PSF from the center of the PSF in units of [degrees]; the indices of these pixels are given by the
indices
property in NUNIQ ordering. Omitted pixels are too far from the center of the PSF to be important.
-
abstract property
dec
¶ The declination of the point having a spread function applied to it [degrees].
-
property
indices
¶ Return the indices of the important pixels in this PSF in NUNIQ ordering; all other pixels will be assumed to be zero. Indices are sorted in ascending order and are guaranteed to be unique.
-
property
max_nside
¶ Get the maximum HEALPix NSIDE scale, i.e. the scale at which
1.2*self.max_scale
(the maximum relevant radius of the PSF, times a conservative factor to account for the fact that pixels are not perfectly square) will be smaller than the average width of a pixel. At this scale, the pixel containing the point-source and its 8 neighbors will completely contain all of the relevant PSF pixels atself.min_nside
resolution returned byself.indices
.
-
abstract property
max_scale
¶ The angular size of a circle in which nearly all of the probability will be contained [deg].
-
property
max_scale_indices
¶ Get the 9 large pixel indices in NUNIQ ordering at the NSIDE scale defined by
self.max_nside
that will completely contain the PSF.
-
property
min_nside
¶ Get the minimum HEALPix NSIDE required to provide adequate resolution for this PSF. Just find the NSIDE that will give pixel spaces smaller than
self.min_scale
.
-
abstract property
min_scale
¶ The rough scale [deg] of the smallest feature in this PSF. A discrete grid on which the PSF is being calculated should have pixel distances no greater than this.
-
property
pix_area
¶ The area per-pixel in [deg**2] of the returned indices (note that they are at the same resolution, so this is a scalar).
-
abstract property
ra
¶ The right ascension of the point having a spread function applied to it [degrees].
-
skymap_product
(indices, values, density=True)¶ Take the pixelwise product of
self.calculate
with another HEALPix NUNIQ-ordered skymap. Will cleverly downselect and resize the other skymap’s pixels to efficiently use memory and CPU resources.- Parameters
indices (array) – Indices of other skymap’s HEALPix pixels in NUNIQ ordering.
values (array) – Corresponding values of the other skymap’s pixels.
density (bool, optional) – Whether the other skymap’s pixel values are some sort of density. If True (the default), the pixel values will not be modified during rescaling (since they don’t depend on pixel area). Otherwise, THE PIXEL VALUES WILL BE CONVERTED TO DENSITIES.
- Returns
product_indices (array) – The HEALPix NUNIQ indices of the pixels of the product of the two skymaps.
product_values (array) – The pixel values of the product of the two skymaps corresponding to the
product_indices
.
Examples
The product between a PSF and a lower-resolution density value of 1 should be the same as the original PSF:
>>> import numpy as np >>> identity_inds = np.arange(4, 16) # NSIDE = 1 >>> identity_values = np.ones_like(identity_inds) >>> psf = PsfGaussian(30, 10, 1) # use a Gaussian PSF as an example >>> inds, values = psf.skymap_product(identity_inds, identity_values, ... density=True) >>> np.all(psf.indices == inds) True >>> np.all(psf.calculate() == values) True
-
abstract
-
class
llama.files.healpix.psf.
PsfGaussian
¶ Bases:
llama.files.healpix.psf.GaussTuple
,llama.files.healpix.psf.Psf
A Point Spread Function (PSF) for a Gaussian distribution.
- rafloat
Right Ascension of the center of the distribution [degrees]
- decfloat
Declination of the center of the distribution [degrees]
- sigmafloat
Standard deviation of the distribution [degrees]
-
calculate
()¶ Return a 2-D Gaussian PDF function to be used as a PSF (point spread function) on the sphere. Note that this Gaussian PDF does not take account of curvature and is accurate only for small angular spreads. Angles must be in degrees.
-
property
max_scale
¶ The angular size of a circle in which nearly all of the probability will be contained [deg].
-
property
min_scale
¶ The rough scale [deg] of the smallest feature in this PSF. A discrete grid on which the PSF is being calculated should have pixel distances no greater than this.
-
llama.files.healpix.psf.
resolutions
()¶ Get an array mapping from HEALPix NSIDE values to corresponding resolutions in square degrees.