lsst.afw  16.0-9-gdf7162dbc+1
imageContinued.py
Go to the documentation of this file.
1 #
2 # LSST Data Management System
3 # Copyright 2008-2017 LSST/AURA.
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 
23 __all__ = ["Image", "DecoratedImage"]
24 
25 import numpy as np
26 from lsst.utils import TemplateMeta
27 
28 from ..slicing import supportSlicing
29 from .image import ImageI, ImageF, ImageD, ImageU, ImageL
30 from .image import DecoratedImageI, DecoratedImageF, DecoratedImageD, DecoratedImageU, DecoratedImageL
31 
32 
33 class Image(metaclass=TemplateMeta):
34 
35  def __reduce__(self):
36  from lsst.afw.fits import reduceToFits
37  return reduceToFits(self)
38 
39 
40 Image.register(np.int32, ImageI)
41 Image.register(np.float32, ImageF)
42 Image.register(np.float64, ImageD)
43 Image.register(np.uint16, ImageU)
44 Image.register(np.int64, ImageL)
45 Image.alias("I", ImageI)
46 Image.alias("F", ImageF)
47 Image.alias("D", ImageD)
48 Image.alias("U", ImageU)
49 Image.alias("L", ImageL)
50 
51 
52 class DecoratedImage(metaclass=TemplateMeta):
53 
54  def convertF(self):
55  return ImageF(self, deep=True)
56 
57  def convertD(self):
58  return ImageD(self, deep=True)
59 
60 
61 DecoratedImage.register(np.int32, DecoratedImageI)
62 DecoratedImage.register(np.float32, DecoratedImageF)
63 DecoratedImage.register(np.float64, DecoratedImageD)
64 DecoratedImage.register(np.uint16, DecoratedImageU)
65 DecoratedImage.register(np.int64, DecoratedImageL)
66 DecoratedImage.alias("I", DecoratedImageI)
67 DecoratedImage.alias("F", DecoratedImageF)
68 DecoratedImage.alias("D", DecoratedImageD)
69 DecoratedImage.alias("U", DecoratedImageU)
70 DecoratedImage.alias("L", DecoratedImageL)
71 
72 
73 for cls in set(Image.values()):
74  supportSlicing(cls)
75 
76 for cls in set(DecoratedImage.values()):
77  supportSlicing(cls)
def supportSlicing(cls)
Definition: slicing.py:92
daf::base::PropertySet * set
Definition: fits.cc:818