Simulate example images
This notebooks demonstrates how to use the AGILE truth catalog in order to simulate synthetic LSST images.
We use imSim (https://lsstdesc.org/imSim/index.html) to simulate the images. The purpose of this notebook is not to doucment the feature of imSim, but only to demonstrate how to pass our truth catalog as input to imSim, and how to run software using the tools available in AGILE. Note that imSim only simulates raw LSSTCam data (incl. e.g. sky and instrumental noise), which are not science ready products. The raw images are processed in subsequent steps by using the LSST Science pipelines.
Below, we provide helpful links and resources to further understand the LSST survey, LSSTCam, and the survey strategy.
VRO survey strategy: https://survey-strategy.lsst.io/
LSSTCam: https://ctn-001.lsst.io/
LSSTCam detector layout: https://lsstdesc.org/imSim/lsst-camera.html
The following notebook may be accessed here
[ ]:
import os
if not os.path.exists("src/lsst_inaf_agile"):
os.chdir("../../")
os.getcwd()
dirname = "data/tests/test_agile"
[ ]:
import logging
import numpy as np
from lsst_inaf_agile.catalog_agn import CatalogAGN
from lsst_inaf_agile.catalog_combined import CatalogCombined
from lsst_inaf_agile.catalog_galaxy import CatalogGalaxy
from lsst_inaf_agile.catalog_star import CatalogStar
from lsst_inaf_agile.egg import Egg
from lsst_inaf_agile.image_simulator import ImageSimulator
from lsst_inaf_agile.merloni2014 import Merloni2014
from lsst_inaf_agile import util
Read the truth catalog
NOTE: you should run the truth catalog notebook first.
[ ]:
# Get the combined catalog
catalog_combined = get_catalog_combined(dirname)
Initialize the ImageSimulator
[ ]:
# Select a baseline
# NOTE: https://usdf-maf.slac.stanford.edu/
filename_baseline = "data/baseline/baseline_v4.0_10yrs.db"
image_simulator = ImageSimulator(f"{dirname}/imsim", catalog_combined, filename_baseline)
Explore the visits database
[ ]:
visits = image_simulator.get_visit()
visits.info()
[ ]:
visits[:5]
[ ]:
observation_id = 779
ra_dec = +150.11916667, +2.20583333
image_simulator.write_instance_catalog(observation_id, ra_dec=ra_dec)
Simulate a single visit and single detector
[ ]:
detector = 94
image_simulator.simulate_image(observation_id=observation_id, detector=detector)
Explore the output products
[ ]:
dirname_output = os.path.join(dirname, "imsim", str(observation_id), "output")
print("Dirname_output is {dirname_output}")
[ ]:
os.listdir(dirname_output)
On simulating multiple images and/or detectors
Simulating any large dataset is a computationally expensive task. To simulate any significantly large dataset (such as the AGILE DR1), one is adviced to wrap the image_simulator.simulate_image into a callable script which could be executed with multiple cores and/or threads. In AGILE DR1, this orchestration was done with slurm (https://slurm.schedmd.com/documentation.html).