descwl.survey module

Manage the parameters that define a simulated survey’s camera design and observing conditions.

class descwl.survey.Survey(**args)[source]

Bases: object

Survey camera and observing parameters.

No default values are assigned to constructor args since these are handled at run time based on a requested (survey_name,filter_band) combination using get_defaults().
  • survey_name (str) – Use default camera and observing parameters appropriate for this survey.
  • filter_band (str) – LSST imaging band to simulate. Must be one of ‘u’,’g’,’r’,’i’,’z’,’y’.
  • image_width (int) – Simulated camera image width in pixels.
  • image_height (int) – Simulated camera image height in pixels.
  • pixel_scale (float) – Simulated camera pixel scale in arcseconds per pixel.
  • exposure_time (float) – Simulated camera total exposure time seconds.
  • zero_point (float) – Simulated camera zero point in electrons per second at 24th magnitude.
  • mirror_diameter (float) – Size of the primary mirror’s clear aperture in meters to use for the optical PSF, or zero if no optical PSF should be simulated.
  • effective_area (float) – Effective total light collecting area in square meters. Used to determine the obscuration fraction in the simulated optical PSF. Ignored if mirror_diameter is zero.
  • zenith_psf_fwhm (float) – FWHM of the atmospheric PSF at zenith in arcseconds.
  • atmospheric_psf_beta (float) – Moffat beta parameter of the atmospheric PSF, or use a Kolmogorov PSF if beta <= 0.
  • atmospheric_psf_e1 (float) – Atmospheric ellipticity component e1 (+) with |e| = (a-b)/(a+b).
  • atmospheric_psf_e2 (float) – Atmospheric ellipticity component e2 (x) with |e| = (a-b)/(a+b).
  • sky_brightness (float) – Sky brightness in mags/sq.arcsec during the observation.
  • airmass (float) – Optical path length through the atmosphere relative to the zenith path length.
  • extinction (float) – Exponential exctinction coefficient for atmospheric absorption.
  • cosmic_shear_g1 (float) – Cosmic shear ellipticity component g1 (+) with |g| = (a-b)/(a+b).
  • cosmic_shear_g2 (float) – Cosmic shear ellipticity component g2 (x) with |g| = (a-b)/(a+b).

RuntimeError – Missing or extra arguments provided or unable to calculate PSF size.

static add_args(parser)[source]

Add command-line arguments for constructing a new Survey.

The added arguments are our constructor parameters with ‘_’ replaced by ‘-‘ in the names. No default values are assigned to the added args since these are handled at run time based on a requested (survey_name,filter_band) combination using get_defaults().

Parameters:parser (argparse.ArgumentParser) – Arguments will be added to this parser object using its add_argument method.

Describe the survey we simulate.

Returns:Description of the camera design and observing conditions we simulate.
Return type:str
classmethod from_args(args)[source]

Create a new Survey object from a set of arguments.

Parameters:args (object) – A set of arguments accessed as a dict using the built-in vars() function. The argument set must include those defined in add_args(). Two additional arguments are also required: survey_name and filter_band. These establish the constructor parameter defaults via :func:get_defaults. Any extra arguments beyond those defined in add_args(), survey_name, and filter_band will be silently ignored.
Returns:A newly constructed Survey object.
Return type:Survey
Raises:RuntimeError – Defaults not yet defined for requested combination.
static get_defaults(survey_name, filter_band)[source]

Get survey camera and observing parameter default values.

  • survey_name (str) – Use defaults for this survey. Case is significant.
  • filter_band (str) – Use defaults for this filter band. Case is significant.

Dictionary of parameter (name,value) pairs.

Return type:



RuntimeError – Defaults not yet defined for requested combination.


Convert source magnitude to flux.

The calculation includes the effects of atmospheric extinction.

Parameters:ab_magnitude (float) – AB magnitude of source.
Returns:Flux in detected electrons.
Return type:float
get_image_coordinates(dx_arcsecs, dy_arcsecs)[source]

Convert a physical offset from the image center into image coordinates.

  • dx_arcsecs (float) – Offset from the image center in arcseconds.
  • dy_arcsecs (float) – Offset from the image center in arcseconds.

Corresponding floating-point image coordinates (x_pixels,y_pixels)

whose math.floor() value gives pixel indices and whose...

Return type:


static print_defaults()[source]

Print parameters for all available (survey,filter band) combinations.