Searching for TruthSummary Correspondence with DiaObject

Hello,

I was interested in examining the time series features of the true injected sources that are in DP 0.2 inside the DiaObject table – I’m assuming the TruthSummary table contains that information?

service = get_tap_service()
ra, dec, sep = 62.0, -37.0, 0.05

query = "SELECT mt.id_truth_type, mt.match_objectId, ts.ra, ts.dec, ts.truth_type, "\
        "obj.coord_ra, obj.coord_dec "\
        "FROM dp02_dc2_catalogs.MatchesTruth AS mt "\
        "JOIN dp02_dc2_catalogs.TruthSummary AS ts ON mt.id_truth_type = ts.id_truth_type "\
        "JOIN dp02_dc2_catalogs.Object AS obj ON mt.match_objectId = obj.objectId "\
        f"WHERE CONTAINS(POINT('ICRS', ts.ra, ts.dec), CIRCLE('ICRS', {ra}, {dec}, {sep})) = 1 "
xm_withIDs = service.search(query).to_table()

tab = service.search("SELECT * "
                         "FROM dp02_dc2_catalogs.DiaObject as dio "
                         "WHERE CONTAINS(POINT('ICRS', ra, decl), "
                         f"CIRCLE('ICRS', {ra}, {dec}, {sep})) = 1 ").to_table()

true = service.search("SELECT * "
                         "FROM dp02_dc2_catalogs.TruthSummary as dio "
                         "WHERE CONTAINS(POINT('ICRS', ra, dec), "
                         f"CIRCLE('ICRS', {ra}, {dec}, {sep})) = 1 ").to_table()

I first tried finding the matching match_objectId with the diaObjectId and then finding the corresponding id_truth_type to map the DiaObjectId to the TruthSummary table. Here’s how I do that:

true_id_truth_type = [] # id_truth_type values for the TruthSummary that have been cross-match between DiaObject & xm_withIDs 
index_of_id = [] # Indices for DiaObject table 

for _id, _idT in zip(xm_withIDs['match_objectId'], xm_withIDs['id_truth_type']):
    if any(tab['diaObjectId']==_id):
        select = np.where(tab['diaObjectId']==_id)
        if any(true['id_truth_type']==_idT):
            true_id_truth_type.append(_idT)
            index_of_id.append(select[0][0])

It seems that my returned DiaObject table and TruthSummary table are not consistent with each other - particularly the measured flux values. I’m wondering if there’s something wrong with my approach here, or if I’m simply looking at the wrong tables.

My apologies in advance if this is a repeated question or a simpler mistake on my end. Thank you in advance!

Cheers,
Andy

Hi Andy, thanks this is a good question!

The DC2 truth tables (TruthSummary, MatchesTruth) have not been and will not be cross-matched to the DP0.2 DiaObject table, only to the Object table.

So no elements of the match_objectId column from the MatchesTruth table correspond to the diaObjectId column from the DiaObject table; they only correspond to the ObjectId column from the Object table.

However, there are a couple of contributed notebooks in the delegate-contributions-dp02 repository that do spatial cross-matching between subsets of true SNIa and DiaObjects.

The main notebook is dia_exploration/dia_match_truth.ipynb, and then Section 2.3 of dia_exploration/dia_template_contamination.ipynb applies the same technique.

So maybe take a look at those notebooks, and let me know if that’s what you need? And if so, please mark this reply as the solution using the checkbox below.

So from what I see in the tutorials, a spatial cross-matching between the catalogs seems to do the trick. This is exactly what I was looking for. Thank you so much! :smile:

1 Like