Unverified Commit 0bb6b87a authored by Akke Viitanen's avatar Akke Viitanen
Browse files

documents galaxy catalog

parent f592e2fd
Loading
Loading
Loading
Loading
+11 −30
Original line number Diff line number Diff line
@@ -3,9 +3,7 @@
# Email: akke.viitanen@helsinki.fi
# Date: 2023-02-13 16:20:51

"""
Create Galaxy+AGN mocks for the LSST Italian AGN in-kind contribution
"""
"""Create Galaxy+AGN mocks for the LSST Italian AGN in-kind contribution."""

import logging
import os
@@ -17,27 +15,18 @@ logger = logging.getLogger(__name__)


class CatalogGalaxy:
    """
    Galaxy catalog
    """
    """Galaxy catalog class."""

    def __init__(self, dirname: str, egg: dict):
        """
        Initialize the galaxy catalog
        """

        """Initialize the galaxy catalog."""
        self.dirname = dirname
        self.egg = egg
        self.bands = [s.strip() for s in self.egg["BANDS"][0]]
        self.rfbands = [s.strip() for s in self.egg["RFBANDS"][0]]

        self.catalog = self.get_catalog()

    def get_catalog(self):
        """
        Generates the galaxy catalog and writes it to disk
        """

        """Generate the galaxy catalog and writes it to disk."""
        # Create the Galaxy catalog
        self.catalog = np.empty_like(self.egg["RA"][0], dtype=self.get_dtype())
        filename = f"{self.dirname}/galaxy.fits"
@@ -58,11 +47,11 @@ class CatalogGalaxy:
    @staticmethod
    def get_columns(bands, rfbands, is_public=False):
        """
        Returns the galaxy catalog columns, types, and descriptions. The
        arguments 'bands' and 'rfbands' are used to generate the columns for
        the fluxes and apparent magnitudes, respectively.
        """
        Return the galaxy catalog columns, types, and descriptions.

        The arguments 'bands' and 'rfbands' are used to generate the columns
        for the fluxes and apparent magnitudes, respectively.
        """
        ret = (
            [
                ("ID", np.int64, "unique ID", ""),
@@ -97,20 +86,14 @@ class CatalogGalaxy:
        return ret

    def get_dtype(self):
        """
        Returns the numpy dtype corresponding to the columns
        """

        """Return the numpy dtype corresponding to the columns."""
        dtype = []
        for n, t, _, _ in self.get_columns(self.bands, self.rfbands):
            dtype += [(n, t)]
        return np.dtype(dtype)

    def get_galaxy(self, key):
        """
        Returns the galaxy property corresponding to 'key'
        """

        """Return the galaxy property corresponding to 'key'."""
        logger.info(f"Getting galaxy attribute {key}")

        _bands = [b.strip() for b in self.bands]
@@ -156,7 +139,5 @@ class CatalogGalaxy:
        return self.egg[key][0]

    def __getitem__(self, key):
        """
        Returns the galaxy catalog column corresponding to 'key'
        """
        """Return the galaxy catalog column corresponding to 'key'."""
        return self.get_galaxy(key)