LSSTApplications  17.0+11,17.0+34,17.0+56,17.0+57,17.0+59,17.0+7,17.0-1-g377950a+33,17.0.1-1-g114240f+2,17.0.1-1-g4d4fbc4+28,17.0.1-1-g55520dc+49,17.0.1-1-g5f4ed7e+52,17.0.1-1-g6dd7d69+17,17.0.1-1-g8de6c91+11,17.0.1-1-gb9095d2+7,17.0.1-1-ge9fec5e+5,17.0.1-1-gf4e0155+55,17.0.1-1-gfc65f5f+50,17.0.1-1-gfc6fb1f+20,17.0.1-10-g87f9f3f+1,17.0.1-11-ge9de802+16,17.0.1-16-ga14f7d5c+4,17.0.1-17-gc79d625+1,17.0.1-17-gdae4c4a+8,17.0.1-2-g26618f5+29,17.0.1-2-g54f2ebc+9,17.0.1-2-gf403422+1,17.0.1-20-g2ca2f74+6,17.0.1-23-gf3eadeb7+1,17.0.1-3-g7e86b59+39,17.0.1-3-gb5ca14a,17.0.1-3-gd08d533+40,17.0.1-30-g596af8797,17.0.1-4-g59d126d+4,17.0.1-4-gc69c472+5,17.0.1-6-g5afd9b9+4,17.0.1-7-g35889ee+1,17.0.1-7-gc7c8782+18,17.0.1-9-gc4bbfb2+3,w.2019.22
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 48 of file detector.cc.

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

◆ declare2SysMethods()

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

Definition at line 61 of file detector.cc.

61  {
62  cls.def("getTransform",
63  (std::shared_ptr<geom::TransformPoint2ToPoint2>(Detector::*)(FromSysT const &, ToSysT const &)
64  const) &
65  Detector::getTransform,
66  "fromSys"_a, "toSys"_a);
67  cls.def("transform",
68  (lsst::geom::Point2D(Detector::*)(lsst::geom::Point2D const &, FromSysT const &, ToSysT const &) const) &
70  "point"_a, "fromSys"_a, "toSys"_a);
71  cls.def("transform",
72  (std::vector<lsst::geom::Point2D>(Detector::*)(std::vector<lsst::geom::Point2D> const &, FromSysT const &,
73  ToSysT const &) const) &
74  Detector::transform,
75  "points"_a, "fromSys"_a, "toSys"_a);
76 }
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:75
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 78 of file detector.cc.

78  {
79  /* Module level */
80  py::class_<Detector, std::shared_ptr<Detector>> cls(mod, "Detector");
81 
82  /* Member types and enums */
83  py::enum_<DetectorType>(mod, "DetectorType")
84  .value("SCIENCE", DetectorType::SCIENCE)
85  .value("FOCUS", DetectorType::FOCUS)
86  .value("GUIDER", DetectorType::GUIDER)
87  .value("WAVEFRONT", DetectorType::WAVEFRONT)
88  .export_values();
89 
90  /* Constructors */
91  cls.def(py::init<std::string const &, int, DetectorType, std::string const &, lsst::geom::Box2I const &,
92  table::AmpInfoCatalog const &, Orientation const &, lsst::geom::Extent2D const &,
93  TransformMap::Transforms const &, Detector::CrosstalkMatrix const &,
94  std::string const&>(),
95  "name"_a, "id"_a, "type"_a, "serial"_a, "bbox"_a, "ampInfoCatalog"_a, "orientation"_a,
96  "pixelSize"_a, "transforms"_a, "crosstalk"_a = Detector::CrosstalkMatrix(),
97  "physicalType"_a = "");
98  cls.def(py::init<std::string const &, int, DetectorType, std::string const &, lsst::geom::Box2I const &,
99  table::AmpInfoCatalog const &, Orientation const &, lsst::geom::Extent2D const &,
100  std::shared_ptr<TransformMap const>, Detector::CrosstalkMatrix const &,
101  std::string const&>(),
102  "name"_a, "id"_a, "type"_a, "serial"_a, "bbox"_a, "ampInfoCatalog"_a, "orientation"_a,
103  "pixelSize"_a, "transformMap"_a, "crosstalk"_a = Detector::CrosstalkMatrix(),
104  "physicalType"_a = "");
105 
106  /* Operators */
107  cls.def("__getitem__",
108  (std::shared_ptr<table::AmpInfoRecord const>(Detector::*)(int) const) & Detector::_get, "i"_a);
109  cls.def("__getitem__",
110  (std::shared_ptr<table::AmpInfoRecord const>(Detector::*)(std::string const &) const) &
111  Detector::_get,
112  "name"_a);
113  cls.def("__len__", &Detector::size);
114 
115  /* Members */
116  cls.def("getName", &Detector::getName);
117  cls.def("getId", &Detector::getId);
118  cls.def("getType", &Detector::getType);
119  cls.def("getPhysicalType", &Detector::getPhysicalType);
120  cls.def("getSerial", &Detector::getSerial);
121  cls.def("getBBox", &Detector::getBBox);
122  cls.def("getAmpInfoCatalog", &Detector::getAmpInfoCatalog);
123  cls.def("getOrientation", &Detector::getOrientation);
124  cls.def("getPixelSize", &Detector::getPixelSize);
125  cls.def("hasCrosstalk", &Detector::hasCrosstalk);
126  cls.def("getCrosstalk", &Detector::getCrosstalk);
127  cls.def("getTransformMap", &Detector::getTransformMap);
128  cls.def("getNativeCoordSys", &Detector::getNativeCoordSys);
129  declare1SysMethods<CameraSys>(cls);
130  declare1SysMethods<CameraSysPrefix>(cls);
131  declare2SysMethods<CameraSys, CameraSys>(cls);
132  declare2SysMethods<CameraSys, CameraSysPrefix>(cls);
133  declare2SysMethods<CameraSysPrefix, CameraSys>(cls);
134  declare2SysMethods<CameraSysPrefix, CameraSysPrefix>(cls);
135 
137 }
def init()
Definition: tests.py:75
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.