descwl.catalog module

Load source parameters from catalog files.

There is a separate catalog page with details on the expected catalog contents and formatting.

class descwl.catalog.Reader(catalog_name, ra_center=0.0, dec_center=0.0, only_id=[], skip_id=[])[source]

Bases: object

Read source parameters from a catalog to simulate an image.

The entire catalog is read when the object is constructed, independently of the only_id and skip_id parameter values. Note that constructor parameter defaults are specified in the add_args() function.

Details on the catalog contents and format are documented on the catalog page.

  • catalog_name (str) – Name of catalog file, which must exist and be readable. The catalog will be read as a FITS table if catalog_name ends with ‘.fits’. Otherwise, it will be read as an ASCII file.
  • ra_center (float) – Right ascension of image center in degrees.
  • dec_center (float) – Declination of image center in degrees.
  • only_id (array) – Only read ids in this array of integer ids.
  • skip_id (array) – Skip ids in this array of integer ids.

RuntimeError – Missing required catalog_name arg.

static add_args(parser)[source]

Add command-line arguments for constructing a new Reader.

The added arguments are our constructor parameters with ‘_’ replaced by ‘-‘ in the names. Note that constructor parameter defaults are specified here rather than in the constructor, so that they are included in command-line help.

Parameters:parser (argparse.ArgumentParser) – Arguments will be added to this parser object using its add_argument method.
classmethod from_args(args)[source]

Create a new Reader object from a set of arguments.

Parameters:args (object) – A set of arguments accessed as a dict using the built-in vars() function. Any extra arguments beyond those defined in add_args() will be silently ignored.
Returns:A newly constructed Reader object.
Return type:Reader
potentially_visible_entries(survey, render_options)[source]

Iterate over potentially visible catalog entries.

Potential visibility is determined by the combined survey parameters and rendering options and implemented so that all actually visible entries are included. Returned entries might not be actually visible, for example, if they are too faint. If only_id has any entries, then only the specified ids will be considered. Otherwise, all ids are considered. Any ids in skip_id will be silently ignored.

Filtering on (ra,dec) to determine visibility is currently not very robust and assumes that ra_center is close to zero and that subtracting 360 from any ra > 180 is sufficient for interval tests.

  • survey (descwl.survey.Survey) – Survey parameters used to determine which entries are visible.
  • render_options (descwl.render.Options) – Rendering options used to determine which entries are visible.


Tuple (entry,dx,dy) of the current catalog entry (astropy.table.Row)

and the x,y offsets (float) of this entry’s centroid from the image center in pixels.