LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
coadd_utils
11.0+1
python
lsst
coadd
utils
coaddDataIdContainer.py
Go to the documentation of this file.
1
#
2
# LSST Data Management System
3
# Copyright 2008-2015 AURA/LSST.
4
#
5
# This product includes software developed by the
6
# LSST Project (http://www.lsst.org/).
7
#
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
12
#
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
17
#
18
# You should have received a copy of the LSST License Statement and
19
# the GNU General Public License along with this program. If not,
20
# see <http://www.lsstcorp.org/LegalNotices/>.
21
#
22
import
lsst.pipe.base
as
pipeBase
23
24
__all__=[
"CoaddDataIdContainer"
,
"ExistingCoaddDataIdContainer"
]
25
26
import
argparse
27
28
class
CoaddDataIdContainer
(pipeBase.DataIdContainer):
29
"""A version of lsst.pipe.base.DataIdContainer specialized for coaddition.
30
31
Required because butler.subset does not support patch and tract
32
33
This code was originally in pipe_tasks (coaddBase.py)
34
"""
35
def
getSkymap
(self, namespace, datasetType):
36
"""Only retrieve skymap if required"""
37
if
not
hasattr(self,
"_skymap"
):
38
self.
_skymap
= namespace.butler.get(datasetType +
"_skyMap"
)
39
return
self.
_skymap
40
41
def
makeDataRefList
(self, namespace):
42
"""Make self.refList from self.idList
43
"""
44
datasetType = namespace.config.coaddName +
"Coadd"
45
validKeys = namespace.butler.getKeys(datasetType=datasetType, level=self.level)
46
47
for
dataId
in
self.idList:
48
for
key
in
validKeys:
49
if
key
in
(
"tract"
,
"patch"
):
50
# Will deal with these explicitly
51
continue
52
if
key
not
in
dataId:
53
raise
argparse.ArgumentError(
None
,
"--id must include "
+ key)
54
55
# tract and patch are required; iterate over them if not provided
56
if
not
"tract"
in
dataId:
57
if
"patch"
in
dataId:
58
raise
RuntimeError(
"'patch' cannot be specified without 'tract'"
)
59
addList = [dict(tract=tract.getId(), patch=
"%d,%d"
% patch.getIndex(), **dataId)
60
for
tract
in
self.
getSkymap
(namespace, datasetType)
for
patch
in
tract]
61
elif
not
"patch"
in
dataId:
62
tract = self.
getSkymap
(namespace, datasetType)[dataId[
"tract"
]]
63
import
pdb
64
pdb.set_trace()
65
addList = [dict(patch=
"%d,%d"
% patch.getIndex(), **dataId)
for
patch
in
tract]
66
else
:
67
addList = [dataId]
68
69
self.refList += [namespace.butler.dataRef(datasetType=datasetType, dataId=addId)
70
for
addId
in
addList]
71
72
class
ExistingCoaddDataIdContainer
(
CoaddDataIdContainer
):
73
"""A version of CoaddDataIdContainer that only produces references that exist"""
74
def
makeDataRefList
(self, namespace):
75
super(ExistingCoaddDataIdContainer, self).
makeDataRefList
(namespace)
76
self.
refList
= [ref
for
ref
in
self.
refList
if
ref.datasetExists()]
lsst.coadd.utils.coaddDataIdContainer.ExistingCoaddDataIdContainer
Definition:
coaddDataIdContainer.py:72
lsst.coadd.utils.coaddDataIdContainer.ExistingCoaddDataIdContainer.makeDataRefList
def makeDataRefList
Definition:
coaddDataIdContainer.py:74
lsst.pipe.base
Definition:
__init__.py:1
lsst.coadd.utils.coaddDataIdContainer.CoaddDataIdContainer.makeDataRefList
def makeDataRefList
Definition:
coaddDataIdContainer.py:41
lsst.coadd.utils.coaddDataIdContainer.CoaddDataIdContainer
Definition:
coaddDataIdContainer.py:28
lsst.coadd.utils.coaddDataIdContainer.CoaddDataIdContainer.getSkymap
def getSkymap
Definition:
coaddDataIdContainer.py:35
lsst.coadd.utils.coaddDataIdContainer.ExistingCoaddDataIdContainer.refList
refList
Definition:
coaddDataIdContainer.py:76
lsst.coadd.utils.coaddDataIdContainer.CoaddDataIdContainer._skymap
_skymap
Definition:
coaddDataIdContainer.py:38
Generated on Thu Sep 24 2015 02:29:18 for LSSTApplications by
1.8.5