This notebook shows how to cull needed information from the opsim and cached star databases for the relevant truth information for the stars in the Twinkles field. Once the data is gathered we also calculate the expected flux for the objects in each visit in the Twinkles run. This is used to gather values to compare against the DM processed data in our pserv databases.
"True" in this case refers to the values that come from our LSST CATSIM database. This CATSIM database stores the LSST simulated universe model that we use to provide inputs to LSST simulations. It is important to note that this means that "true" does not refer to actual stars in sky, but to the known inputs to our simulations. More information on the LSST Simulations can be found here.
Note: Requires an Opsim database. Twinkles 1.1 uses kraken_1042 while Twinkles 1.3 uses minion_1016.
In [1]:
import desc.monitor
import pandas as pd
%load_ext autoreload
%autoreload 2
In [2]:
truth_db_conn = desc.monitor.StarCacheDBObj(database='../data/star_cache.db')
In [3]:
truth_db_conn.columns
Out[3]:
We also have methods to interact with the LSST Opsim databases. This can be used to get the observing conditions simulated for each visit. We then use this information to create a pandas dataframe with the expected flux based upon the Opsim information and CatSim flux of the objects in the field.
In [4]:
worker = desc.monitor.TrueStars(truth_db_conn, '../../kraken_1042_sqlite.db')
In [5]:
# Just use one visit here for the demo. Otherwise it will use the list in data/selectedVisits.csv
star_df = worker.get_true_stars(for_obsHistIds=200, catalog_constraints='gmag > 11')
In [6]:
star_df
Out[6]:
In [7]:
worker.write_to_db(star_df, 'twinkles_truth_demo.db', if_exists='replace')
In [ ]: