This page summarizes the contents of the different sims packages.  It discusses the most useful classes and methods in each and how to import them.

Finding source code

Recall that, to find the source code for any of the packages here, you should look in

$LSST_HOME/yourOperatingSystem/packageName/yourVersion/python/lsst/sims/shortPackageName/

For example, on my Mac, the source code for sims_photUtils is in

lsst_150412/DarwinX86/sims_photUtils/1.0.0-86-g4e41113+4/python/lsst/sims/photUtils/

where lsst_150412 is the directory in which I built my stack and 1.0.0-86... is the Git SHA-1 of the version of sims_photUtils I most recently installed.

Sometimes, the package name is broken up further.  The source code for sims_catalogs_generation is in

lsst_150412/DarwinX86/sims_catalogs_generation/1.0.0-86-g4e41113+4/python/lsst/sims/catalogs/generation/

 

To find the path to the setup version of a package, use

eups list -v packageName | grep "setup"

Import statements

Because of our directory structure, classes and methods from the LSST sims stack are imported like

from lsst.sims.packageName import className

so, for example, to import the class PhotometryStars from sims_photUtils, one would use

from lsst.sims.photUtils import PhotometryStars

In some cases, the source code is further sub-divided in the package directory tree, and an extra level is needed in the import statements.  It is also possible that packageName has been broken up into '.' separated words.  For example

from lsst.sims.catalogs.generation.db import CatalogDBObject

In the discussion below, we present the general format of import statements from each package.  We also highlight cases where the source code has been sub-divided inside the directory structure.

Package: sims_utils

Imports from sims_utils take the form

from lsst.sims.utils import methodName

 

sims_utils is a package that contains methods that do not depend on any other LSST code.  Mostly this means that it contains methods which wrap coordinate transformation routines from PALPY.  These are the methods you would use to, for example, convert between equatorial and horizontal coordinates, or find the distance between two points on a sphere.  The methods provided by sims_utils are

sims_utils also defines the class Site which carries data about the LSST site (and can be customized to contain data about any observing site).  To access this class use

from lsst.sims.utils import Site

Package: sims_catalogs_generation

All of the useful code in sims_catalogs_generation is imported like

from lsst.sims.catalogs.generation.db import className

sims_catalogs_generation contains the classes which connect to databases of simulated objects (i.e. this is where the CatalogDBObject class mentioned in the Framework Overview page is defined).  sims_catalogs_generation also defines the class ObservationMetaData which stores the meta data describing a simulated telescope pointing.  The important classes from sims_catalogs_generation are

Package: sims_catalogs_measures

Classes from the package sims_catalogs_measures are imported like

from lsst.sims.catalogs.measures.instance import className

The most important class defined in sims_catalogs_measures is the InstanceCatalog class.  This is the class which takes the results of the raw database query performed by CatalogDBObject and formats it into a human-readable catalog as specified by the user.  In most cases, you will be writing daughter classes that inherit from InstanceCatalog and use its basic infrastructure to create customized catalogs.  Examples of this can be found in

sims_catUtils/python/lsst/sims/catUtils/exampleCatalogDefinitions/

Package: sims_coordUtils

Classes and methods defined by sims_coordUtils are imported like

from lsst.sims.coordUtils import className, methodName

sims_coordUtils defines methods that apply astrometric affects to the mean RA, Dec values stored in the database of simulated object.  It also defines mixin classes that provide getters which allow InstanceCatalog and its daughter classes to calculate columns.

The methods provided by sims_coordUtils are

The classes provided by sims_coordUtils are (see this page for a list of the actual getters provided by these classes)

Package: sims_photUtils

Classes and methods defined in sims_photUtils are imported like

from lsst.sims.photUtils import className, methodName

sims_photUtils provides methods and classes to calculate the magnitudes of objects in different bandpasses as well as the noise associated with those calculations.

Two very important classes defined in sims_photUtils are Bandpass and Sed.  These are the classes which read in and manipulate instrumental throughput curves and spectral energy distributions (SEDs), respectively.  Most importantly, the Sed class provides the main methods for calculating the magnitude of a source in a given bandpass.

Methods provided in the Sed class are:

Other methods provided by sims_photUtils for calculating photometric quantities that are not associated with the Sed class are

Other classes provided by sims_photUtils are (remember, to see the specific getters provided by the mixins below, go to this page.)

sims_catalogs_photUtils also provides classes which allow a user to take her own catalog of magnitudes and associate the objects in that catalog with SEDs from the library provided by the stack.  These classes are

Examples of their use can be found in

sims_photUtils/examples/

Finally, the method setupPhotometryCatalog provides a way for a user to 'automatically' associate an InstanceCatalog daughter class with a given ObservationMetaData and CatalogDBObject.  In cases where users wish to write many catalogs containing only observations in filters specified by ObservationMetaData instantiations, this method may prove less tedious than writing out InstanceCatalog daughter classes by hand.

Package: sims_catUtils

Classes and methods from sims_catUtils are imported like

from lsst.sims.catUtils.subDirectory import className, methodName

The available sub-directories will be discussed below.

sims_catUtils is the highest level CatSim package.  This is where daughter classes of InstanceCatalog and CatalogDBObject specifically designed to interface with the LSST simulations databases hosted at the University of Washington are defined.  It is also where tutorials designed to encompass the functionality of the whole CatSim stack are provided.

Examples and tutorials

The directories

sims_catUtils/examples
sims_catUtils/examples/tutorials/

contain python scripts and iPython notebooks designed to demonstrate some of the functionality described above.  The available examples are

Sub-directory: baseCatalogModels

Classes from this sub-directory are imported like

from lsst.sims.catUtils.baseCatalogModels import className

This is the sub-directory in which daughter classes of CatalogDBObject are defined.  Each daughter class is designed to interface with a specific table on the University of Washington database.  These classes are listed on this page under "DBObject classes which access database tables."

Sub-directory: exampleCatalogDefinitions

Classes from this sub-directory are imported like

from lsst.sims.catUtils.exampleCatalogDefinitions import className

This is the sub-directory in which daughter classes of InstanceCatalog have been defined.  The list of classes defined here is by no means complete, but the should serve as useful examples to the user.  They are

Sub-directory: utils

Methods in this directory are imported like

from lsst.sims.catUtils.utils import methodName

This sub-directory contains the method ObservationMetaDataGenerator which allows the user to read in an OpSim run database and produce realistic ObservationMetaData instantiations from it.  Its use is demonstrated in the CatSimTutorial_SimulationAHM_1503.ipynb notebook in the UWSST LSST-Tutorials Git repository.

Sub-directory: galSimInterface

This is where the CatSim-GalSim interface classes are defined.  They are discussed in more detail here.

 

Return to the main catalog simulations documentation page