Skip to content

Commit

Permalink
Minor cleanups to coaddDataIdContainer.py
Browse files Browse the repository at this point in the history
Make use of defaultdict and formatting updates.
  • Loading branch information
laurenam committed Dec 3, 2015
1 parent d39d9e9 commit acbf38e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions python/lsst/coadd/utils/coaddDataIdContainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
import lsst.pipe.base as pipeBase
import argparse
from collections import defaultdict

__all__=["CoaddDataIdContainer", "ExistingCoaddDataIdContainer", "TractDataIdContainer"]
import lsst.pipe.base as pipeBase

import argparse
__all__ = ["CoaddDataIdContainer", "ExistingCoaddDataIdContainer", "TractDataIdContainer"]

class CoaddDataIdContainer(pipeBase.DataIdContainer):
"""A version of lsst.pipe.base.DataIdContainer specialized for coaddition.
Expand Down Expand Up @@ -100,16 +101,15 @@ def makeDataRefList(self, namespace):

if "tract" in dataId:
tractId = dataId["tract"]
if tractId not in tractRefs:
tractRefs[tractId] = []
tractRefs = defaultdict(list)
if "patch" in dataId:
tractRefs[tractId].append(namespace.butler.dataRef(datasetType=datasetType, tract=tractId,
filter=dataId['filter'],
patch=dataId['patch']))
else:
tractRefs[tractId] += getPatchRefList(skymap[tractId])
else:
tractRefs = dict((tract.getId(), tractRefs.get(tract.getId(), []) + getPatchRefList(tract)) for
tract in skymap)
tractRefs = dict((tract.getId(), tractRefs.get(tract.getId(), []) + getPatchRefList(tract))
for tract in skymap)

self.refList = tractRefs.values()

0 comments on commit acbf38e

Please sign in to comment.