LSST Applications g0b6bd0c080+a72a5dd7e6,g1182afd7b4+2a019aa3bb,g17e5ecfddb+2b8207f7de,g1d67935e3f+06cf436103,g38293774b4+ac198e9f13,g396055baef+6a2097e274,g3b44f30a73+6611e0205b,g480783c3b1+98f8679e14,g48ccf36440+89c08d0516,g4b93dc025c+98f8679e14,g5c4744a4d9+a302e8c7f0,g613e996a0d+e1c447f2e0,g6c8d09e9e7+25247a063c,g7271f0639c+98f8679e14,g7a9cd813b8+124095ede6,g9d27549199+a302e8c7f0,ga1cf026fa3+ac198e9f13,ga32aa97882+7403ac30ac,ga786bb30fb+7a139211af,gaa63f70f4e+9994eb9896,gabf319e997+ade567573c,gba47b54d5d+94dc90c3ea,gbec6a3398f+06cf436103,gc6308e37c7+07dd123edb,gc655b1545f+ade567573c,gcc9029db3c+ab229f5caf,gd01420fc67+06cf436103,gd877ba84e5+06cf436103,gdb4cecd868+6f279b5b48,ge2d134c3d5+cc4dbb2e3f,ge448b5faa6+86d1ceac1d,gecc7e12556+98f8679e14,gf3ee170dca+25247a063c,gf4ac96e456+ade567573c,gf9f5ea5b4d+ac198e9f13,gff490e6085+8c2580be5c,w.2022.27
LSST Data Management Base Package
Functions
lsst.coadd.utils.getGen3CoaddExposureId Namespace Reference

Functions

def getGen3CoaddExposureId (dataRef, coaddName="deep", includeBand=True, log=None)
 

Function Documentation

◆ getGen3CoaddExposureId()

def lsst.coadd.utils.getGen3CoaddExposureId.getGen3CoaddExposureId (   dataRef,
  coaddName = "deep",
  includeBand = True,
  log = None 
)
Return the coadd expId consistent with Gen3 implementation.

This is a temporary interface intended to aid with the migration from
Gen2 to Gen3 middleware.  It will be removed with the Gen2 middleware.

Parameters
----------
dataRef : `lsst.daf.persistence.butlerSubset.ButlerDataRef`
    The data reference for the patch.
coaddName : `str`, optional
    The prefix for the coadd name, e.g. "deep" for "deepCoadd"
includeBand : `bool`, optional
    Whether to include band as part of the dataId packing.
log : `lsst.log.Log` or `None`, optional
    Logger object for logging messages.

Returns
-------
expId : `int`
    The integer id associated with `patchRef` that mimics that of Gen3.

Definition at line 27 of file getGen3CoaddExposureId.py.

27def getGen3CoaddExposureId(dataRef, coaddName="deep", includeBand=True, log=None):
28 """Return the coadd expId consistent with Gen3 implementation.
29
30 This is a temporary interface intended to aid with the migration from
31 Gen2 to Gen3 middleware. It will be removed with the Gen2 middleware.
32
33 Parameters
34 ----------
36 The data reference for the patch.
37 coaddName : `str`, optional
38 The prefix for the coadd name, e.g. "deep" for "deepCoadd"
39 includeBand : `bool`, optional
40 Whether to include band as part of the dataId packing.
41 log : `lsst.log.Log` or `None`, optional
42 Logger object for logging messages.
43
44 Returns
45 -------
46 expId : `int`
47 The integer id associated with `patchRef` that mimics that of Gen3.
48 """
49 tract = dataRef.dataId["tract"]
50 patch = dataRef.dataId["patch"]
51 filter = dataRef.dataId["filter"]
52 skyMap = dataRef.get(coaddName + "Coadd_skyMap")
53 tractInfo = skyMap[tract]
54 if includeBand:
55 try:
56 band = dataRef.get(coaddName + "Coadd_band")
57 if log is not None:
58 camera = dataRef.get("camera")
59 log.info("Filter %s has been assigned %s as the associated generic band for expId "
60 "computation.", filter, band)
61 except NoResults:
62 band = filter
63 if log is not None:
64 camera = dataRef.get("camera")
65 log.info("No %s mapping found for %s. Using filter %s in dataId as band",
66 coaddName + "Coadd_band", camera.getName(), band)
67 else:
68 band = None
69
70 # Note: the function skyMap.pack_data_id() requires Gen3-style
71 # dataId entries, namely the generic "band" rather than the
72 # "physical_filter", and the sequential patch id number rather
73 # than the comma separated string version.
74 for patchInfo in tractInfo:
75 patchIndexStr = str(patchInfo.getIndex()[0]) + "," + str(patchInfo.getIndex()[1])
76 if patchIndexStr == patch:
77 patchNumId = tractInfo.getSequentialPatchIndex(patchInfo)
78 break
79 try:
80 expId, maxBits = skyMap.pack_data_id(tract, patchNumId, band=band)
81 except Exception as e:
82 if log is not None:
83 log.warning("Setting exposureId to match Gen3 failed with: %s. Falling back to "
84 "Gen2 implementation.", e)
85 expId = int(dataRef.get(coaddName + "CoaddId"))
86 return expId
This static class includes a variety of methods for interacting with the the logging module.
Definition: Log.h:724
def getGen3CoaddExposureId(dataRef, coaddName="deep", includeBand=True, log=None)