Source code for lightcurvelynx.obstable.location_free_obstable

"""The LocationFreeObsTable stores observation information from the entire sky."""

import logging

import numpy as np
import pandas as pd
from mocpy import MOC

from lightcurvelynx.obstable.obs_table import ObsTable


[docs] class LocationFreeObsTable(ObsTable): """An ObsTable for observations from the entire sky (no location information). This is used when you want to simulate observations on a regular cadence regardless of where they are in the sky, such as when comparing them to a survey that has a regular cadence (e.g. ZTF, ATLAS, etc.). Parameters ---------- table : dict or pandas.core.frame.DataFrame The table with all the ObsTable information. Must have columns "time" and "filter". colmap : dict, optional A mapping of standard column names to a list of possible names in the input table. Each value in the dictionary can be a string or a list of strings. **kwargs : dict Additional keyword arguments to pass to the ObsTable constructor. This includes overrides for survey parameters such as: - survey_name: The name of the survey (default="FAKE_SURVEY"). - dark_electrons : The dark current for the camera in electrons per second per pixel. - gain: The gain for the camera in electrons per ADU. - pixel_scale: The pixel scale for the camera in arcseconds per pixel. - radius: The angular radius of the observations (in degrees). - read_noise: The readout noise for the camera in electrons per pixel. """ # Default column mapping and survey values (no noise by default). _required_columns = ["time", "filter"] _default_colnames = {} _default_survey_values = { "nexposure": 1, "radius": 180.0, # degrees "survey_name": "location_free", } def __init__(self, table, *, colmap=None, **kwargs): # If the input is a dictionary, convert it to a DataFrame. if isinstance(table, dict): table = pd.DataFrame(table) # Use the default column mapping if one is not provided. if colmap is None: colmap = self._default_colnames # Check the unsupported terms in the kwargs and raise an error if they are provided. if kwargs.get("detector_footprint") is not None or kwargs.get("wcs") is not None: # pragma: no cover raise ValueError("LocationFreeObsTable does not support detector footprints.") super().__init__(table=table, colmap=colmap, **kwargs)
[docs] def set_detector_footprint(self, detector_footprint, wcs=None): """Set the detector footprint, so footprint filtering is done. Parameters ---------- detector_footprint : astropy.regions.SkyRegion, Astropy.regions.PixelRegion, or DetectorFootprint The footprint object for the instrument's detector. wcs : astropy.wcs.WCS, optional The WCS for the footprint. Either this or pixel_scale must be provided if a footprint is provided as a Astropy region. """ raise NotImplementedError("LocationFreeObsTable does not support detector footprints.")
def _build_spatial_data(self): """Build the spatial data for the LocationFreeObsTable. This is a no-op since the LocationFreeObsTable covers the entire sky. """ pass
[docs] def build_moc(self, max_depth=10, **kwargs): """Build a Multi-Order Coverage Map from the regions in the data set. This will always be the whole sky. Parameters ---------- max_depth : int, optional The maximum depth of the MOC. Default is 10. **kwargs : dict Additional keyword arguments to pass to the MOC construction. Not currently used, but accepted for consistency with the ObsTable interface. Returns ------- MOC The Multi-Order Coverage Map constructed from the data set. """ logger = logging.getLogger(__name__) logger.debug(f"Building MOC from LocationFreeObsTable at depth={max_depth}.") moc = MOC.from_healpix_cells( np.arange(12, dtype=np.uint64), depth=0, max_depth=max_depth, ) return moc
def _derive_noise_columns(self): """Derive any missing noise-related columns (e.g. zero points) from the existing columns and survey values. """ pass