LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
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: Rectilinear x, y (and z when talking about the location of a detector) on the camera focal plane (mm). More...
 
CameraSys const FIELD_ANGLE = CameraSys("FieldAngle")
 Field angle coordinates: Angular x,y offset from the optic axis (radians). More...
 
CameraSysPrefix const PIXELS = CameraSysPrefix("Pixels")
 Nominal pixels on the detector (unbinned) This ignores manufacturing imperfections, "tree ring" distortions and all other such effects. More...
 
CameraSysPrefix const TAN_PIXELS = CameraSysPrefix("TanPixels")
 Tangent-plane pixels on the detector (unbinned) More...
 
CameraSysPrefix const ACTUAL_PIXELS = CameraSysPrefix("ActualPixels")
 The actual pixels where the photon lands and electrons are generated (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 43 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 != 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
Nominal pixels on the detector (unbinned) This ignores manufacturing imperfections, "tree ring" distortions and all other such effects.
Definition: CameraSys.cc:34
CameraSysPrefix const ACTUAL_PIXELS
The actual pixels where the photon lands and electrons are generated (unbinned) This takes into accou...
Definition: CameraSys.cc:38
CameraSys const FIELD_ANGLE
Field angle coordinates: Angular x,y offset from the optic axis (radians).
Definition: CameraSys.cc:32
CameraSysPrefix const TAN_PIXELS
Tangent-plane pixels on the detector (unbinned)
Definition: CameraSys.cc:36
CameraSys const FOCAL_PLANE
Focal plane coordinates: Rectilinear x, y (and z when talking about the location of a detector) on th...
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  "name"_a, "id"_a, "type"_a, "serial"_a, "bbox"_a, "ampInfoCatalog"_a, "orientation"_a,
95  "pixelSize"_a, "transforms"_a, "crosstalk"_a = Detector::CrosstalkMatrix());
96  cls.def(py::init<std::string const &, int, DetectorType, std::string const &, lsst::geom::Box2I const &,
97  table::AmpInfoCatalog const &, Orientation const &, lsst::geom::Extent2D const &,
98  std::shared_ptr<TransformMap const>, Detector::CrosstalkMatrix const &>(),
99  "name"_a, "id"_a, "type"_a, "serial"_a, "bbox"_a, "ampInfoCatalog"_a, "orientation"_a,
100  "pixelSize"_a, "transformMap"_a, "crosstalk"_a = Detector::CrosstalkMatrix());
101 
102  /* Operators */
103  cls.def("__getitem__",
104  (std::shared_ptr<table::AmpInfoRecord const>(Detector::*)(int) const) & Detector::_get, "i"_a);
105  cls.def("__getitem__",
106  (std::shared_ptr<table::AmpInfoRecord const>(Detector::*)(std::string const &) const) &
107  Detector::_get,
108  "name"_a);
109  cls.def("__len__", &Detector::size);
110 
111  /* Members */
112  cls.def("getName", &Detector::getName);
113  cls.def("getId", &Detector::getId);
114  cls.def("getType", &Detector::getType);
115  cls.def("getSerial", &Detector::getSerial);
116  cls.def("getBBox", &Detector::getBBox);
117  cls.def("getAmpInfoCatalog", &Detector::getAmpInfoCatalog);
118  cls.def("getOrientation", &Detector::getOrientation);
119  cls.def("getPixelSize", &Detector::getPixelSize);
120  cls.def("hasCrosstalk", &Detector::hasCrosstalk);
121  cls.def("getCrosstalk", &Detector::getCrosstalk);
122  cls.def("getTransformMap", &Detector::getTransformMap);
123  cls.def("getNativeCoordSys", &Detector::getNativeCoordSys);
124  declare1SysMethods<CameraSys>(cls);
125  declare1SysMethods<CameraSysPrefix>(cls);
126  declare2SysMethods<CameraSys, CameraSys>(cls);
127  declare2SysMethods<CameraSys, CameraSysPrefix>(cls);
128  declare2SysMethods<CameraSysPrefix, CameraSys>(cls);
129  declare2SysMethods<CameraSysPrefix, CameraSysPrefix>(cls);
130 
132 }
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:43
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 (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 coordsys.

Definition at line 38 of file CameraSys.cc.

◆ FIELD_ANGLE

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

Field angle coordinates: Angular x,y offset from the optic axis (radians).

Definition at line 32 of file CameraSys.cc.

◆ FOCAL_PLANE

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

Focal plane coordinates: 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")

Nominal pixels on the detector (unbinned) This ignores manufacturing imperfections, "tree ring" distortions and all other such effects.

It is a uniform grid of rectangular (usually square) pixels.

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

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 (unbinned)

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 coordsys.

Definition at line 36 of file CameraSys.cc.