LSSTApplications  17.0+50,17.0+84,17.0+9,18.0.0+14,18.0.0+2,18.0.0+30,18.0.0+4,18.0.0+9,18.0.0-2-ge43143a+4,18.1.0-1-g0001055,18.1.0-1-g0896a44+6,18.1.0-1-g1349e88+4,18.1.0-1-g2505f39+3,18.1.0-1-g380d4d4+4,18.1.0-1-g5e4b7ea,18.1.0-1-g85f8cd4+3,18.1.0-1-g9a6769a+2,18.1.0-1-ga1a4c1a+2,18.1.0-1-gc037db8,18.1.0-1-gd55f500+1,18.1.0-1-ge10677a+3,18.1.0-10-g73b8679e+7,18.1.0-11-g311e899+3,18.1.0-12-g0d73a3591,18.1.0-12-gc95f69a+3,18.1.0-2-g000ad9a+3,18.1.0-2-g31c43f9+3,18.1.0-2-g9c63283+4,18.1.0-2-gdf0b915+4,18.1.0-2-gf03bb23,18.1.0-3-g2e29e3d+6,18.1.0-3-g52aa583+2,18.1.0-3-g9cb968e+3,18.1.0-4-gd2e8982+6,18.1.0-5-g510c42a+3,18.1.0-5-gaeab27e+4,18.1.0-6-gdda7f3e+6,18.1.0-7-g89824ecc+4,w.2019.32
LSSTDataManagementBasePackage
Namespaces | Classes | Enumerations | Functions | Variables
lsst::afw::cameraGeom Namespace Reference

Namespaces

 assembleImage
 
 camera
 
 cameraConfig
 
 cameraFactory
 
 cameraGeomEnumDicts
 
 cameraGeomLib
 
 detector
 
 detectorCollection
 
 fitsUtils
 
 makePixelToTanPixel
 
 pupil
 
 rotateBBoxBy90
 
 testUtils
 
 transformConfig
 
 utils
 

Classes

class  Camera
 A collection of Detectors plus additional coordinate system support. More...
 
class  CameraSys
 Camera coordinate system; used as a key in in TransformMap. More...
 
class  CameraSysPrefix
 Camera coordinate system prefix. More...
 
class  Detector
 Information about a CCD or other imaging detector. More...
 
class  DetectorCollection
 An immutable collection of Detectors that can be accessed by name or ID. More...
 
class  Orientation
 Describe a detector's orientation in the focal plane. More...
 
class  TransformMap
 A registry of 2-dimensional coordinate transforms for a specific camera. More...
 

Enumerations

enum  DetectorType { SCIENCE, FOCUS, GUIDER, WAVEFRONT }
 Type of imaging detector. More...
 

Functions

std::ostreamoperator<< (std::ostream &os, CameraSysPrefix const &detSysPrefix)
 
std::ostreamoperator<< (std::ostream &os, CameraSys const &cameraSys)
 
 PYBIND11_MODULE (camera, mod)
 
 PYBIND11_MODULE (cameraSys, mod)
 
template<typename SysT , typename PyClass >
void declare1SysMethods (PyClass &cls)
 
template<typename FromSysT , typename ToSysT , typename PyClass >
void declare2SysMethods (PyClass &cls)
 
 PYBIND11_MODULE (detector, mod)
 
 PYBIND11_MODULE (detectorCollection, mod)
 
 PYBIND11_MODULE (orientation, mod)
 

Variables

CameraSys const FOCAL_PLANE = CameraSys("FocalPlane")
 Focal plane coordinates: Position on a 2-d planar approximation to the focal plane (x,y mm). More...
 
CameraSys const FIELD_ANGLE = CameraSys("FieldAngle")
 Field angle coordinates: Angle of a principal ray relative to the optical axis (x,y radians). More...
 
CameraSysPrefix const PIXELS = CameraSysPrefix("Pixels")
 Pixel coordinates: Nominal position on the entry surface of a given detector (x, y unbinned pixels). More...
 
CameraSysPrefix const TAN_PIXELS = CameraSysPrefix("TanPixels")
 Tangent-plane pixels on the detector (x, y unbinned pixels) More...
 
CameraSysPrefix const ACTUAL_PIXELS = CameraSysPrefix("ActualPixels")
 The actual pixels where the photon lands and electrons are generated (x,y unbinned) This takes into account manufacturing defects, "tree ring" distortions and other such effects. More...
 
string NullLinearityType = "None"
 

Enumeration Type Documentation

◆ DetectorType

Type of imaging detector.

Enumerator
SCIENCE 
FOCUS 
GUIDER 
WAVEFRONT 

Definition at line 44 of file Detector.h.

Function Documentation

◆ declare1SysMethods()

template<typename SysT , typename PyClass >
void lsst::afw::cameraGeom::declare1SysMethods ( PyClass &  cls)

Definition at line 49 of file detector.cc.

49  {
50  cls.def("getCorners",
51  (std::vector<lsst::geom::Point2D>(Detector::*)(SysT const &) const) & Detector::getCorners,
52  "cameraSys"_a);
53  cls.def("getCenter", (lsst::geom::Point2D(Detector::*)(SysT const &) const) & Detector::getCenter,
54  "cameraSys"_a);
55  cls.def("hasTransform", (bool (Detector::*)(SysT const &) const) & Detector::hasTransform, "cameraSys"_a);
56  cls.def("makeCameraSys", (CameraSys const (Detector::*)(SysT const &) const) & Detector::makeCameraSys,
57  "cameraSys"_a);
58 }
STL class.

◆ declare2SysMethods()

template<typename FromSysT , typename ToSysT , typename PyClass >
void lsst::afw::cameraGeom::declare2SysMethods ( PyClass &  cls)

Definition at line 62 of file detector.cc.

62  {
63  cls.def("getTransform",
64  (std::shared_ptr<geom::TransformPoint2ToPoint2>(Detector::*)(FromSysT const &, ToSysT const &)
65  const) &
66  Detector::getTransform,
67  "fromSys"_a, "toSys"_a);
68  cls.def("transform",
69  (lsst::geom::Point2D(Detector::*)(lsst::geom::Point2D const &, FromSysT const &, ToSysT const &) const) &
71  "point"_a, "fromSys"_a, "toSys"_a);
72  cls.def("transform",
73  (std::vector<lsst::geom::Point2D>(Detector::*)(std::vector<lsst::geom::Point2D> const &, FromSysT const &,
74  ToSysT const &) const) &
75  Detector::transform,
76  "points"_a, "fromSys"_a, "toSys"_a);
77 }
STL class.
table::Key< int > transform

◆ operator<<() [1/2]

std::ostream & lsst::afw::cameraGeom::operator<< ( std::ostream os,
CameraSysPrefix const &  detSysPrefix 
)

Definition at line 47 of file CameraSys.cc.

47  {
48  os << "CameraSysPrefix(" << camSysPrefix.getSysName() << ")";
49  return os;
50 }
std::ostream * os
Definition: Schema.cc:746

◆ operator<<() [2/2]

std::ostream & lsst::afw::cameraGeom::operator<< ( std::ostream os,
CameraSys const &  cameraSys 
)

Definition at line 52 of file CameraSys.cc.

52  {
53  os << "CameraSys(" << cameraSys.getSysName();
54  if (cameraSys.hasDetectorName()) {
55  os << ", " << cameraSys.getDetectorName();
56  }
57  os << ")";
58  return os;
59 }
std::ostream * os
Definition: Schema.cc:746

◆ PYBIND11_MODULE() [1/5]

lsst::afw::cameraGeom::PYBIND11_MODULE ( camera  ,
mod   
)

Definition at line 34 of file camera.cc.

34  {
35  py::module::import("lsst.afw.cameraGeom.detectorCollection");
36  py::module::import("lsst.afw.cameraGeom.transformMap");
37 
38  py::class_<Camera, DetectorCollection, std::shared_ptr<Camera>> cls(mod, "Camera");
39 
40  cls.def(py::init<std::string const &, Camera::DetectorList const &,
42  "name"_a, "detectorList"_a, "transformMap"_a, "pupilFactoryName"_a);
43  // Python-only constructor that takes a PupilFactory type object for
44  // backwards compatibility.
45  cls.def(
46  py::init(
47  [](
48  std::string const & name,
49  Camera::DetectorList const & detectorList,
51  py::object pupilFactoryClass
52  ) {
53  std::string pupilFactoryName = "lsst.afw.cameraGeom.pupil.PupilFactory";
54  if (!pupilFactoryClass.is(py::none())) {
55  pupilFactoryName = py::str("{}.{}").format(
56  pupilFactoryClass.attr("__module__"),
57  pupilFactoryClass.attr("__name__")
58  );
59  }
60  return std::make_shared<Camera>(name, detectorList, transformMap, pupilFactoryName);
61  }
62  ),
63  "name"_a,
64  "detectorList"_a,
65  "transformMap"_a,
66  "pupilFactoryClass"_a=py::none()
67  );
68  cls.def("getName", &Camera::getName);
69  cls.def("getPupilFactoryName", &Camera::getPupilFactoryName);
70  cls.def("findDetectors", &Camera::findDetectors, "point"_a, "cameraSys"_a);
71  cls.def("findDetectorsList", &Camera::findDetectorsList, "pointList"_a, "cameraSys"_a);
72  cls.def("getTransformMap", &Camera::getTransformMap);
73  // transform methods are wrapped with lambdas that translate exceptions for backwards compatibility
74  cls.def(
75  "getTransform",
76  [](Camera const & self, CameraSys const & fromSys, CameraSys const & toSys) {
77  try {
78  return self.getTransform(fromSys, toSys);
79  } catch (pex::exceptions::NotFoundError & err) {
80  PyErr_SetString(PyExc_KeyError, err.what());
81  throw py::error_already_set();
82  }
83  },
84  "fromSys"_a, "toSys"_a
85  );
86  cls.def(
87  "transform",
88  [](
89  Camera const & self,
90  lsst::geom::Point2D const & point,
91  CameraSys const & fromSys,
92  CameraSys const & toSys
93  ) {
94  try {
95  return self.transform(point, fromSys, toSys);
96  } catch (pex::exceptions::NotFoundError & err) {
97  PyErr_SetString(PyExc_KeyError, err.what());
98  throw py::error_already_set();
99  }
100  },
101  "point"_a, "fromSys"_a, "toSys"_a
102  );
103  cls.def(
104  "transform",
105  [](
106  Camera const & self,
107  std::vector<lsst::geom::Point2D> const & points,
108  CameraSys const & fromSys,
109  CameraSys const & toSys
110  ) {
111  try {
112  return self.transform(points, fromSys, toSys);
113  } catch (pex::exceptions::NotFoundError & err) {
114  PyErr_SetString(PyExc_KeyError, err.what());
115  throw py::error_already_set();
116  }
117  },
118  "points"_a, "fromSys"_a, "toSys"_a
119  );
120 
122 }
def init()
Definition: tests.py:64
void addPersistableMethods(pybind11::class_< Class, Args... > &cls)
Add table::io::Persistable and PersistableFacade methods to the pybind11 wrapper for a class...
Definition: python.h:88
STL class.
table::Key< int > transformMap
Definition: Camera.cc:164
STL class.
table::Key< std::string > pupilFactoryName
Definition: Camera.cc:163

◆ PYBIND11_MODULE() [2/5]

lsst::afw::cameraGeom::PYBIND11_MODULE ( detectorCollection  ,
mod   
)

Definition at line 35 of file detectorCollection.cc.

35  {
36  py::module::import("lsst.afw.cameraGeom.detector");
37 
38  py::class_<DetectorCollection, std::shared_ptr<DetectorCollection>> cls(mod, "DetectorCollection");
39 
40  cls.def(py::init<DetectorCollection::List const & >(), "list"_a);
41  cls.def("getNameMap", &DetectorCollection::getNameMap);
42  cls.def("getIdMap", &DetectorCollection::getIdMap);
43  cls.def("getFpBBox", &DetectorCollection::getFpBBox);
44  cls.def("__len__", &DetectorCollection::size);
45  cls.def(
46  "get",
47  py::overload_cast<std::string const &, std::shared_ptr<Detector>>(
48  &DetectorCollection::get, py::const_
49  ),
50  "name"_a, "default"_a=nullptr
51  );
52  cls.def(
53  "get",
54  py::overload_cast<int, std::shared_ptr<Detector>>(
55  &DetectorCollection::get, py::const_
56  ),
57  "id"_a, "default"_a=nullptr
58  );
59  cls.def(
60  "__contains__",
61  [](DetectorCollection const & self, std::string const &name) {
62  return self.get(name) != nullptr;
63  }
64  );
65  cls.def(
66  "__contains__",
67  [](DetectorCollection const & self, int id) {
68  return self.get(id) != nullptr;
69  }
70  );
71 
73 }
void addPersistableMethods(pybind11::class_< Class, Args... > &cls)
Add table::io::Persistable and PersistableFacade methods to the pybind11 wrapper for a class...
Definition: python.h:88
STL class.

◆ PYBIND11_MODULE() [3/5]

lsst::afw::cameraGeom::PYBIND11_MODULE ( orientation  ,
mod   
)

Definition at line 36 of file orientation.cc.

36  {
37  py::module::import("lsst.geom");
38 
39  /* Module level */
40  py::class_<Orientation> cls(mod, "Orientation");
41 
42  /* Member types and enums */
43 
44  /* Constructors */
45  cls.def(py::init<lsst::geom::Point2D, lsst::geom::Point2D, lsst::geom::Angle, lsst::geom::Angle, lsst::geom::Angle>(),
46  "fpPosition"_a = lsst::geom::Point2D(0, 0), "refPoint"_a = lsst::geom::Point2D(-0.5, -0.5),
47  "yaw"_a = lsst::geom::Angle(0), "pitch"_a = lsst::geom::Angle(0), "roll"_a = lsst::geom::Angle(0));
48 
49  /* Operators */
50 
51  /* Members */
52  cls.def("getFpPosition", &Orientation::getFpPosition);
53  cls.def("getReferencePoint", &Orientation::getReferencePoint);
54  cls.def("getYaw", &Orientation::getYaw);
55  cls.def("getPitch", &Orientation::getPitch);
56  cls.def("getRoll", &Orientation::getRoll);
57  cls.def("getNQuarter", &Orientation::getNQuarter);
58  cls.def("makePixelFpTransform", &Orientation::makePixelFpTransform, "pixelSizeMm"_a);
59  cls.def("makeFpPixelTransform", &Orientation::makeFpPixelTransform, "pixelSizeMm"_a);
60  cls.def("getFpPosition", &Orientation::getFpPosition);
61  cls.def("getFpPosition", &Orientation::getFpPosition);
62  cls.def("getFpPosition", &Orientation::getFpPosition);
63  cls.def("getFpPosition", &Orientation::getFpPosition);
64 }
A class representing an angle.
Definition: Angle.h:127

◆ PYBIND11_MODULE() [4/5]

lsst::afw::cameraGeom::PYBIND11_MODULE ( cameraSys  ,
mod   
)

Definition at line 62 of file cameraSys.cc.

62  {
63  /* Module level */
64  py::class_<CameraSysPrefix> clsCameraSysPrefix(mod, "CameraSysPrefix");
65  py::class_<CameraSys> clsCameraSys(mod, "CameraSys");
66 
67  // The following must come after the associated pybind11 class is declared
68  // (e.g. FOCAL_PLANE is a CameraSys, so clsCameraSys must have been declared
69  mod.attr("FOCAL_PLANE") = py::cast(FOCAL_PLANE);
70  mod.attr("FIELD_ANGLE") = py::cast(FIELD_ANGLE);
71  mod.attr("PIXELS") = py::cast(PIXELS);
72  mod.attr("TAN_PIXELS") = py::cast(TAN_PIXELS);
73  mod.attr("ACTUAL_PIXELS") = py::cast(ACTUAL_PIXELS);
74 
75  /* Member types and enums */
76  declareCommonSysMethods<CameraSysPrefix>(clsCameraSysPrefix);
77  declareCommonSysMethods<CameraSys>(clsCameraSys);
78 
79  /* Constructors */
80  clsCameraSysPrefix.def(py::init<std::string const &>(), "sysName"_a);
81  clsCameraSys.def(py::init<std::string const &, std::string const &>(), "sysName"_a,
82  "detectorName"_a = "");
83  clsCameraSys.def(py::init<CameraSysPrefix const &, std::string const &>(), "sysPrefix"_a,
84  "detectorName"_a = "");
85 
86  /* Operators */
87 
88  /* Members */
89  clsCameraSys.def("getDetectorName", &CameraSys::getDetectorName);
90  clsCameraSys.def("hasDetectorName", &CameraSys::hasDetectorName);
91 }
CameraSysPrefix const PIXELS
Pixel coordinates: Nominal position on the entry surface of a given detector (x, y unbinned pixels)...
Definition: CameraSys.cc:34
CameraSysPrefix const ACTUAL_PIXELS
The actual pixels where the photon lands and electrons are generated (x,y unbinned) This takes into a...
Definition: CameraSys.cc:38
CameraSys const FIELD_ANGLE
Field angle coordinates: Angle of a principal ray relative to the optical axis (x,y radians).
Definition: CameraSys.cc:32
CameraSysPrefix const TAN_PIXELS
Tangent-plane pixels on the detector (x, y unbinned pixels)
Definition: CameraSys.cc:36
CameraSys const FOCAL_PLANE
Focal plane coordinates: Position on a 2-d planar approximation to the focal plane (x...
Definition: CameraSys.cc:30

◆ PYBIND11_MODULE() [5/5]

lsst::afw::cameraGeom::PYBIND11_MODULE ( detector  ,
mod   
)

Definition at line 79 of file detector.cc.

79  {
80  /* Module level */
81  py::module::import("lsst.afw.typehandling");
82  py::class_<Detector, std::shared_ptr<Detector>, typehandling::Storable> cls(mod, "Detector");
83 
84  /* Member types and enums */
85  py::enum_<DetectorType>(mod, "DetectorType")
86  .value("SCIENCE", DetectorType::SCIENCE)
87  .value("FOCUS", DetectorType::FOCUS)
88  .value("GUIDER", DetectorType::GUIDER)
89  .value("WAVEFRONT", DetectorType::WAVEFRONT)
90  .export_values();
91 
92  /* Constructors */
93  cls.def(py::init<std::string const &, int, DetectorType, std::string const &, lsst::geom::Box2I const &,
94  table::AmpInfoCatalog const &, Orientation const &, lsst::geom::Extent2D const &,
95  TransformMap::Transforms const &, Detector::CrosstalkMatrix const &,
96  std::string const&>(),
97  "name"_a, "id"_a, "type"_a, "serial"_a, "bbox"_a, "ampInfoCatalog"_a, "orientation"_a,
98  "pixelSize"_a, "transforms"_a, "crosstalk"_a = Detector::CrosstalkMatrix(),
99  "physicalType"_a = "");
100  cls.def(py::init<std::string const &, int, DetectorType, std::string const &, lsst::geom::Box2I const &,
101  table::AmpInfoCatalog const &, Orientation const &, lsst::geom::Extent2D const &,
102  std::shared_ptr<TransformMap const>, Detector::CrosstalkMatrix const &,
103  std::string const&>(),
104  "name"_a, "id"_a, "type"_a, "serial"_a, "bbox"_a, "ampInfoCatalog"_a, "orientation"_a,
105  "pixelSize"_a, "transformMap"_a, "crosstalk"_a = Detector::CrosstalkMatrix(),
106  "physicalType"_a = "");
107 
108  /* Operators */
109  cls.def("__getitem__",
110  (std::shared_ptr<table::AmpInfoRecord const>(Detector::*)(int) const) & Detector::_get, "i"_a);
111  cls.def("__getitem__",
112  (std::shared_ptr<table::AmpInfoRecord const>(Detector::*)(std::string const &) const) &
113  Detector::_get,
114  "name"_a);
115  cls.def("__len__", &Detector::size);
116 
117  /* Members */
118  cls.def("getName", &Detector::getName);
119  cls.def("getId", &Detector::getId);
120  cls.def("getType", &Detector::getType);
121  cls.def("getPhysicalType", &Detector::getPhysicalType);
122  cls.def("getSerial", &Detector::getSerial);
123  cls.def("getBBox", &Detector::getBBox);
124  cls.def("getAmpInfoCatalog", &Detector::getAmpInfoCatalog);
125  cls.def("getOrientation", &Detector::getOrientation);
126  cls.def("getPixelSize", &Detector::getPixelSize);
127  cls.def("hasCrosstalk", &Detector::hasCrosstalk);
128  cls.def("getCrosstalk", &Detector::getCrosstalk);
129  cls.def("getTransformMap", &Detector::getTransformMap);
130  cls.def("getNativeCoordSys", &Detector::getNativeCoordSys);
131  declare1SysMethods<CameraSys>(cls);
132  declare1SysMethods<CameraSysPrefix>(cls);
133  declare2SysMethods<CameraSys, CameraSys>(cls);
134  declare2SysMethods<CameraSys, CameraSysPrefix>(cls);
135  declare2SysMethods<CameraSysPrefix, CameraSys>(cls);
136  declare2SysMethods<CameraSysPrefix, CameraSysPrefix>(cls);
137 
139 }
def init()
Definition: tests.py:64
void addPersistableMethods(pybind11::class_< Class, Args... > &cls)
Add table::io::Persistable and PersistableFacade methods to the pybind11 wrapper for a class...
Definition: python.h:88
STL class.
CatalogT< AmpInfoRecord > AmpInfoCatalog
Definition: fwd.h:97
DetectorType
Type of imaging detector.
Definition: Detector.h:44
An integer coordinate rectangle.
Definition: Box.h:54

Variable Documentation

◆ ACTUAL_PIXELS

CameraSysPrefix const lsst::afw::cameraGeom::ACTUAL_PIXELS = CameraSysPrefix("ActualPixels")

The actual pixels where the photon lands and electrons are generated (x,y unbinned) This takes into account manufacturing defects, "tree ring" distortions and other such effects.

This is a detector prefix; call Detector.makeCameraSys(ACTUAL_PIXELS) to make a full CameraSys.

Definition at line 38 of file CameraSys.cc.

◆ FIELD_ANGLE

CameraSys const lsst::afw::cameraGeom::FIELD_ANGLE = CameraSys("FieldAngle")

Field angle coordinates: Angle of a principal ray relative to the optical axis (x,y radians).

The orientation of the x,y axes is the same as FOCAL_PLANE.

Definition at line 32 of file CameraSys.cc.

◆ FOCAL_PLANE

CameraSys const lsst::afw::cameraGeom::FOCAL_PLANE = CameraSys("FocalPlane")

Focal plane coordinates: Position on a 2-d planar approximation to the focal plane (x,y mm).

The origin and orientation may be defined by the camera team, but we strongly recommend that the origin be on the optical axis and (if using CCD detectors) that the X axis be aligned along CCD rows.

Note
Location and orientation of detectors are defined in a 3-d version of FOCAL_PLANE coordinates (the z axis is also relevant). Rectilinear x, y (and z when talking about the location of a detector) on the camera focal plane (mm). For z=0 choose a convenient point near the focus at x, y = 0.

Definition at line 30 of file CameraSys.cc.

◆ NullLinearityType

string lsst.afw.cameraGeom.NullLinearityType = "None"

Definition at line 37 of file __init__.py.

◆ PIXELS

CameraSysPrefix const lsst::afw::cameraGeom::PIXELS = CameraSysPrefix("Pixels")

Pixel coordinates: Nominal position on the entry surface of a given detector (x, y unbinned pixels).

For CCD detectors the x axis must be along rows (the direction of the serial register). This is required for our interpolation algorithm to interpolate across bad columns.

This ignores manufacturing imperfections, "tree ring" distortions and all other such effects. It is a uniform grid of rectangular (usually square) pixels.

Warning
This is a detector prefix; call Detector.makeCameraSys(PIXELS) to make a full CameraSys.

Definition at line 34 of file CameraSys.cc.

◆ TAN_PIXELS

CameraSysPrefix const lsst::afw::cameraGeom::TAN_PIXELS = CameraSysPrefix("TanPixels")

Tangent-plane pixels on the detector (x, y unbinned pixels)

Converting from PIXELS to TAN_PIXELS has the effect of removing optical distortion (and the distortion due to rectangular pixels) with the point at the center of the detector being unaffected by the transformation.

In detail, PIXELS->TAN_PIXELS is PIXELS->FIELD_ANGLE plus an affine transformation, such that:

  • The x,y axes are parallel to the detector axes
  • The dimensions are nominal pixels at the center of the focal plane (where nominal pixels size is mean of x, y pixel size).
  • The point at the center of the detector has the same value in PIXELS and TAN_PIXELS

This is a detector prefix; call Detector.makeCameraSys(TAN_PIXELS) to make a full CameraSys.

Definition at line 36 of file CameraSys.cc.