xlens.simulator.layout

Layout generators for placing simulated objects on a coadd.

Submodules

Classes

Layout

Generate object positions on a coadd (flat sky), returning absolute

Package Contents

class Layout(*, layout_name: str, wcs: lsst.afw.geom.SkyWcs, boundary_box: lsst.geom.Box2I, sep_arcsec: float | None = None, extend_ratio: float = 1.08)[source]

Generate object positions on a coadd (flat sky), returning absolute arcsec coordinates in a structured array with fields (“dx”,”dy”).

Workflow

  1. Read center in pixels from boundary_box.getCenterX/Y() and convert to arcseconds via wcs.getPixelScale().asArcseconds().

2) Build a square sampling region based on the bbox, padded by 20″ on each side. 3) Call the helper function to get center-relative arcsec shifts. 4) Add the (arcsec) center to make absolute arcsec coordinates.

param layout_name:

Layout pattern for placing objects.

type layout_name:

{‘grid’,’hex’,’random’,’random_disk’}

param wcs:

Used to obtain pixel scale via getPixelScale().asArcseconds().

type wcs:

SkyWcs-like

param boundary_box:

Pixel bounding box defining the coadd region.

type boundary_box:

lsst.geom.Box2I or Box2D

param sep_arcsec:

Spacing (arcsec) for ‘grid’/’hex’; defaults to GRID_SPACING/HEX_SPACING.

type sep_arcsec:

float or None, optional

param extend_ratio:

extention ratio in x and y; defaults to 1.08

type extend_ratio:

float, optional

Notes

  • All helper functions are expected to accept a numpy.random.RandomState and to return a structured array with fields (“dx”,”dy”) in arcseconds, relative to the center of boundary box.

  • Returned dx, dy are arcseconds, absolute on the coadd tangent plane.

sep = None
_x_center_arcsec
_y_center_arcsec
_dim_pixels
_pixscale_arcsec
_name
property pixel_scale_arcsec: float

Arcseconds per pixel.

property dim_pixels: int

Square dimension (pixels) used for layout generation (includes padding).

property area_arcmin2: float

Area used for Poisson draws (/arcmin^2). Zero for ‘grid’/’hex’.

get_shifts(*, rng: numpy.random.RandomState, density: float = RANDOM_DENSITY) numpy.ndarray[source]

Generate absolute coadd-plane positions (dtype=[(“dx”,”f8”),(“dy”,”f8”)], arcsec).

Parameters:
  • rng (numpy.random.RandomState) – Random number generator (old NumPy RNG API).

  • density (float, optional) – Number density (/arcmin^2) for ‘random’/’random_disk’. Ignored for ‘grid’/’hex’.

Returns:

shifts – Structured array with fields (“dx”,”dy”), arcseconds, absolute.

Return type:

np.ndarray