Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Any implementation of photometry getters should occur within a mixin class that inherits from either PhotometryStars or PhotometryGalaxies.  These are the mixins defined in

Code Block
sims_photUtilscatUtils/python/lsst/sims/catUtils/photUtilsmixins/PhotometryPhotometryMixin.py

that provide the basic infrastructure for calculating magnitudes in an arbitrary set of bandpasses.  Specifically, they define the methods

...

method _magnitudeGetter which takes a a set of

...

In theory, once loadTotalBandpassesFromFiles() has been called and self.bandpassDict and self.phiArray have been initialized, one only needs to call meta_magnitdues_getter() and the magnitudes corresponding to self.bandpassDict and self.phiArray will be calculated and stored in a way that CatSim can handle.  Thus, any getter for non-LSST magnitudes should, the first time it is called, call loadTotalBandpassesFromFiles().  Subsequent calls to the getter only need call the meta_magnitudes_getter().  We can see this by examining the getter for stellar magnitudes in the SDSS bandpassesarbitrary bandpasses (stored in an instance of the class BandpassDict) and returns the magnitudes of objects returned by CatSim in those bandpasses.  We can see the use of this method demonstrated in the magnitudes getter from the example SDSS catalog above:

Code Block
    @compound('sdss_u','sdss_g','sdss_r','sdss_i','sdss_z')
    def get_sdss_magnitudes(self):
        """
        An example getter for sdss stellar magnitudes
 in SDSS bands
     bandpassRoot is the root"""
 of the names of the files in which
# Load a BandpassDict of SDSS   the bandpasses, areif stored
not        """

done already
        objectIDif =not self.column_by_name('id')
        columnNames = [name for name in self.get_sdss_magnitudes._colnames]
hasattr(self, 'sdssBandpassDict'):
              bandpassNames = ['u','g','r','i','z']
            bandpassDir = os.path.join(os.getenvgetPackageDir('THROUGHPUTS_DIRthroughputs'),'sdss')
            bandpassRoot = 'sdss_'

         """
   self.sdssBandpassDict = BandpassDict.loadTotalBandpassesFromFiles(bandpassNames,
   Here is where we need some code to load a list of bandpass objects
        into self.bandpassDict so that the bandpasses are available to the
        mixin.  Ideally, we would only do this once for the whole catalog
        """
    bandpassRoot = bandpassRoot,
  if self.bandpassDict is None or self.phiArray is None:
            self.loadTotalBandpassesFromFiles(bandpassNames,
                     bandpassRoot = bandpassRoot,
                     bandpassDir = bandpassDir)
        # Actually calculate the magnitudes
        return self.meta_magnitudes_getter(objectID, columnNames)magnitudeGetter(self.sdssBandpassDict, self.get_sdss_magnitudes._colnames)

 Note: Every time loadTotalBandpassesFromFiles() is called, it deletes an existing self.bandpassDict and self.phiArray and creates a new one.  Thus, catalogs that wish to simultaneously calculate magnitudes in two different magnitude systems need to combine them into a single getter (i.e. a single call to loadTotalBandpassesFromFiles() and a single call to meta_magnitudes_getter())

loadTotalBandpassesFromFiles

loadTotalBandpassesFromFiles() needs to be called the same way whether you are calculating the magnitudes for a star (which just has one component), or a galaxy (which will have separate magnitudes for the bulge, disk, and agn components).  loadTotalBandpassesFromFiles() requires as argumentsIt is a class method of the class BandpassDict defined in

Code Block
sims_photUtils/python/lsst/sims/photUtils/BandpassDict

Its arguments are

  • bandpassNames – a list of the names of the bandpasses; these correspond to the keys for self.bandpassDict.  See the example above for SDSS bands.
  • bandpassDir – this is the absolute path to the directory in which the bandpass throughput files are kept.
  • bandpassRoot – this is the root of the name of each bandpass throughput file

...

Code Block
/my/bandpass/directory/sillyBandpass_x.dat
/my/bandpass/directory/sillyBandpass_y.dat
/my/bandpass/directory/sillyBandpass_z.dat

...

_

...

magnitudeGetter()

The meta _magnitudes_gettermagnitudeGetter() method differs depending on whether you are inheriting from PhotometryStars or PhotometryGalaxies.  It takes as arguments

  • componentName – for galaxies only.  This specifies whether the getter is calculating magnitudes for the 'disk', 'bulge', or 'agn'
  • bandpassDict – a BandpassDict instantiation containing the bandpasses to be integrated.  The bandpasses in this dict must occur in the same order as the magnitudes are declared to the @compound getter.
  • columnNameList – a list of the names of the columns to which these magnitudes correspond.  This is so that the getter can associate the magnitudes with any variability model that may have been implemented.  This list of magnitudes must occur in the same order as declared to the @compound getter.

The PhotometryStars case is very straightforward.  In this case, the method reads in the SED file names and normalizations , normalizations, and dust extinction parameters A(V) associated with each object, converts that data into instantiations an instantiation of the Sed SedList class defined in

Code Block
sims_photUtils/python/lsst/sims/photUtils/SedSedList.py

and integrates those the SEDs in that SedList over the bandpasses in self.bandpassDict and self.phiArray to produce magnitudesthe BandpassDict passed to _magnitudeGetter().  Magnitudes are returned in a two dimensional numpy array in which each row corresponds to a different bandpass (in the order they occur in self.bandpassDict) and each column corresponds to a different object (i.e. a row of the database).

Note: because the meta _magnitudes_gettermagnitudeGetter() returns magnitudes in the order specified by self.bandpassDict the input BandpassDict (which, in turn, is specified by the order of filters in the bandpassNames argument passed to loadTotalBandpassesFromFiles()), it is very important that the columns declared for the getter by @compound occur in the same order as the bandpasses in the list of bandpassNames passed to loadTotalBandpassesFromFiles().

In PhotometryGalaxies, the meta_magnitudes_getter() computes magnitudes in each bandpass for each component of the galaxy the case of galaxies, each component (bulge, disk, AGN, and total).  In this case, it is important not only that the columns declared to @compound occur in bandpassName order, but that, as components, they occur in the order [total magnitude, bulge magnitude, disk magnitude, agn magnitude], as this is what the meta_magnitudes_getter() expect.  See, for example, the PhotometryGalaxies getter for SDSS magnitudes) of the galaxy has its own SED and related parameters.  This requires a suite of getter methods (including a getter method to combine the components into a total magntiude for the galaxy).  In the case of our example SDSS catalog, this looks like

Code Block
    @compound('sdss_bulge_u', 'sdss_bulge_g', 'sdss_bulge_r', 'sdss_bulge_i', 'sdss_bulge_z')
    def get_sdss_bulge_mags(self):
         'sdss_i', 'sdss_z',"""
        An example getter for SDSS bulge magnitudes
        """
        # load a BandpassDict of SDSS bandpasses, if not done already
        if not hasattr(self, 'sdssBandpassDict'):
            bandpassNames = ['sdss_uBulgeu', 'sdss_gBulgeg', 'sdss_rBulger', 'sdss_iBulgei', 'sdss_zBulgez',]
            bandpassDir = 'sdss_uDisk', 'sdss_gDisk',os.path.join(getPackageDir('throughputs'),'sdss')
            bandpassRoot = 'sdss_rDisk', 'sdss_iDisk', 'sdss_zDisk',
'
            self.sdssBandpassDict = BandpassDict.loadTotalBandpassesFromFiles(bandpassNames,
                                                                 bandpassRoot = bandpassRoot,
                                                                 bandpassDir = bandpassDir)
        # actually calculate the magnitudes
        return self._magnitudeGetter('bulge', self.sdssBandpassDict,
                                     self.get_sdss_bulge_mags._colnames)

    @compound('sdss_uAgndisk_u', 'sdss_disk_gAgng', 'sdss_disk_rAgnr', 'sdss_iAgndisk_i', 'sdss_zAgndisk_z')
    def get_allsdss_sdssdisk_mags(self):
        """
        An example getter for sdssSDSS galaxydisk magnitudes
        """
   bandpassRoot is the root of the names of the files in which     # load a BandpassDict of SDSS bandpasses, if not done already
        if not hasattr(self, 'sdssBandpassDict'):
            bandpassNames = ['u','g','r','i','z']
            bandpassDir = os.path.join(getPackageDir('throughputs'),'sdss')
        the    bandpassesbandpassRoot are stored
= 'sdss_'
            self.sdssBandpassDict  """

= BandpassDict.loadTotalBandpassesFromFiles(bandpassNames,
                                                                 bandpassRoot = bandpassRoot,
                 objectID = self.column_by_name('galid')
                                                bandpassDir = bandpassDir)
        # actually calculate the magnitudes
        return self._magnitudeGetter('disk', self.sdssBandpassDict,
          columnNames = [name for name in                           self.get_allsdss_sdssdisk_mags._colnames]
)

    @compound('sdss_agn_u', 'sdss_agn_g', 'sdss_agn_r', 'sdss_agn_i', 'sdss_agn_z')
    def get_sdss_agn_mags(self):
        """
        An example getter for SDSS AGN magnitudes
        """
        # load a BandpassDict of SDSS bandpasses, if not done already
        if not hasattr(self, 'sdssBandpassDict'):
            bandpassNames = ['u','g','r','i','z']
            bandpassDir = os.path.join(os.getenvgetPackageDir('THROUGHPUTS_DIRthroughputs'),'sdss')
            bandpassRoot = 'sdss_'
            self.sdssBandpassDict = BandpassDict.loadTotalBandpassesFromFiles(bandpassNames,
                                                   """
              bandpassRoot = bandpassRoot,
                                                            Here is where we need some code to load a list of bandpass objects      bandpassDir = bandpassDir)
        # actually calculate the magnitudes
        into self.bandpassDict so that the bandpasses are available to the
 return self._magnitudeGetter('agn', self.sdssBandpassDict,
                                     mixin.  Ideally, we would only do this once for the whole catalogself.get_sdss_agn_mags._colnames)

    @compound('sdss_u', 'sdss_g', 'sdss_r', 'sdss_i', 'sdss_z', 'sdss_y')
    def get_sdss_total_mags(self):
        """
        An example getter for total galaxy magnitudes in SDSS bands
        """
        idList if self.bandpassDict is None or self.phiArray is None:= self.column_by_name('uniqueId')
        numObj = len(idList)
        output = []
        # Go through each of the calculated columns.  Find the bulge, disk, and agn
        # magnitudes corresponding to each bandpass.  Sum them using the
        # sum_magnitudes method
  self.loadTotalBandpassesFromFiles(bandpassNames,
           for columnName in self.get_sdss_total_mags._colnames:
            if columnName not in self._actually_calculated_columns:
                bandpassRootsub_list = bandpassRoot,[numpy.NaN]*numObj
            else:
         bandpassDir       bandpass = bandpassDir)

columnName[-1]
                bulge return= self.metacolumn_magnitudesby_getter(objectID, columnNames)

Note: we also pass a list of columnNames (in the order that they occur to @compound) to the meta_magnitudes_getter().  This is because, in both the PhotometryStars and the PhotometryGalaxies cases, the meta_magnitudes_getter() is where the delta_columnName columns from the variability model are detected and added, if appropriate.

name('sdss_bulge_%s' % bandpass)
                disk = self.column_by_name('sdss_disk_%s' % bandpass)
                agn = self.column_by_name('sdss_agn_%s' % bandpass)
                sub_list = self.sum_magnitudes(bulge=bulge, disk=disk, agn=agn)
            output.append(sub_list)
        return numpy.array(output)

The _magnitudeGetter for galaxies behaves exactly like the _magnitudeGetter for stars, except that it takes the extra argument componentName ('bulge', 'disk', or 'agn') so that it knows which list of SEDs to load and integrate over the BandpassDict. 

Return to the main Catalog Simulations documentation page.

...