Questions about flags in the tables of apdb

Hi all,

I’m using the LSST Science Pipelines software v26 to process the DECam data. I notice in each DiaObject, DiaSource, DiaForcedSource table there’s a column called “flags”. Those tables are in the apdb file ( association.db) generated by make_apdb.py and written by the AP pipeline.

I checked DPDD (LSE-163) but didn’t find many details of those flags. I saw DP0.2 had flags for DIA objects and sources. I found there’s a class called UnpackApdbFlags, but I’m not sure how to use it.

The science problem I’m facing is that, how to remove artifacts based on flags in the apdb file? I know diaSrc FITS tables have flag values (with their meanings in the header). For one real object, it can have flag values showing bad quality in some exposures but good quality in other exposures. So I can’t just use diaSrc FITS table flags…

Do you know how to get flag values and the meanings of those flags in the DIA tables (in apdb)?

Thanks.

Hi Shenming,

I don’t think I have a direct answer to your question. But let me try to provide a (hopefully) useful link to an old post regarding “flags”. @ctslater might have an updated answer?

1 Like

We have deprecated and removed that bitpacked flag field per RFC-967, instead including individual flags as boolean fields in the schema (e.g. centroid_flag or pixelFlags_edge). That should be available with v28, which I believe is in preparation for release.

The meanings of the now-deprecated flags field are defined in ap_association/data/association-flag-map.yaml. Pass that file to UnpackApdbFlags, with table_name="DiaSource" to get a class that will allow you to turn the bitpacked flags into individual flag fields, per the definitions in that file. Note that you must use the exact version of the above “flag map” file that the data was processed with: those flags have changed over time.

1 Like

Thank you @galaxyumi331 @parejkoj !
I tested and found it worked for the DiaSource table. Do you know how to unpack the flags in the DiaForcedSource and DiaObject tables?

Check whether those flags are all identically zero for those tables: we might not be writing bitpacked flags for those, or if we are, they’re using the the same flag map, since that’s the only one we’ve defined.

1 Like