Computation of deepCoaddId in obs_lsstSim

butler
dm-dev
Tags: #<Tag:0x00007f7f760d7df0> #<Tag:0x00007f7f760d7c38>

(Francois Lanusse) #1

I just ran into an issue when trying to get a deepCoaddId from the Butler for some given tract, patch in the DC2 products produced by DESC.
I can successfully access the coadd like so:

>>> coadd = butler.get( "deepCoadd_calexp", tract=4638, patch='0,0', filter='i')

But when extracting the deepCoaddId, it fails on some checks of the range of tract/patch:

>>> coadd_image_id = butler.get("deepCoaddId", tract=4638, patch='0,0', filter='i')
RuntimeError                              Traceback (most recent call last)
<ipython-input-54-3c78959602a7> in <module>()
      1 butler = dafPersist.Butler('/global/projecta/projectdirs/lsst/global/in2p3/Run1.1/output')
      2 coadd = butler.get( "deepCoadd_calexp", tract=4638, patch='0,0', filter='i')
----> 3 coadd_image_id = butler.get("deepCoaddId", tract=4638, patch='0,0', filter='i')

/global/common/software/lsst/cori-haswell-gcc/stack/w.2018.19_sim2.8.0/stack/miniconda3-4.3.21-10a4fa6/Linux64/daf_persistence/15.0-7-g0c26201/python/lsst/daf/persistence/butler.py in get(self, datasetType, dataId, immediate, **rest)
   1408         dataId.update(**rest)
   1409 
-> 1410         location = self._locate(datasetType, dataId, write=False)
   1411         if location is None:
   1412             raise NoResults("No locations for get:", datasetType, dataId)

/global/common/software/lsst/cori-haswell-gcc/stack/w.2018.19_sim2.8.0/stack/miniconda3-4.3.21-10a4fa6/Linux64/daf_persistence/15.0-7-g0c26201/python/lsst/daf/persistence/butler.py in _locate(self, datasetType, dataId, write)
   1356                         bypass = self._getBypassFunc(location, dataId)
   1357                         try:
-> 1358                             bypass = bypass()
   1359                             location.bypass = bypass
   1360                         except (NoResults, IOError):

/global/common/software/lsst/cori-haswell-gcc/stack/w.2018.19_sim2.8.0/stack/miniconda3-4.3.21-10a4fa6/Linux64/daf_persistence/15.0-7-g0c26201/python/lsst/daf/persistence/butler.py in <lambda>()
   1384                 pythonType = doImport(pythonType)
   1385         bypassFunc = getattr(location.mapper, "bypass_" + location.datasetType)
-> 1386         return lambda: bypassFunc(location.datasetType, pythonType, location, dataId)
   1387 
   1388     def get(self, datasetType, dataId=None, immediate=True, **rest):

/global/common/software/lsst/cori-haswell-gcc/stack/w.2018.19_sim2.8.0/stack/miniconda3-4.3.21-10a4fa6/Linux64/obs_lsstSim/15.0-7-ga00a9c6+27/python/lsst/obs/lsstSim/lsstSimMapper.py in bypass_deepCoaddId(self, datasetType, pythonType, location, dataId)
    296 
    297     def bypass_deepCoaddId(self, datasetType, pythonType, location, dataId):
--> 298         return self._computeCoaddExposureId(dataId, True)
    299 
    300     def bypass_deepCoaddId_bits(self, datasetType, pythonType, location, dataId):

/global/common/software/lsst/cori-haswell-gcc/stack/w.2018.19_sim2.8.0/stack/miniconda3-4.3.21-10a4fa6/Linux64/obs_lsstSim/15.0-7-ga00a9c6+27/python/lsst/obs/lsstSim/lsstSimMapper.py in _computeCoaddExposureId(self, dataId, singleFilter)
    218         tract = int(dataId['tract'])
    219         if tract < 0 or tract >= 128:
--> 220             raise RuntimeError('tract not in range [0,128)')
    221         patchX, patchY = list(map(int, dataId['patch'].split(',')))
    222         for p in (patchX, patchY):

RuntimeError: tract not in range [0,128)

This is due to the following code in obs_lsstSim: https://github.com/lsst/obs_lsstSim/commit/2523c9ec295b9c44a96f618337e6ec074cc068f4

        if tract < 0 or tract >= 128:
            raise RuntimeError('tract not in range [0,128)')
        patchX, patchY = map(int, dataId['patch'].split(','))
        for p in (patchX, patchY):
            if p < 0 or p >= 2**13:
                raise RuntimeError('patch component not in range [0, 8192)')

I don’t understand these ranges for the tract and patches. Is it that this formula for computing the Id is not up to date ? Or am I missing something ?
Thanks !


(Dominique Boutigny) #2

You need to use obs_lsstSim from https://github.com/LSSTDESC/obs_lsstSim there was a fix introduced by @nchotard to make obs_lsstSim skyMap compatible with the RING scheme.


(Francois Lanusse) #3

Great, thanks Dominique!