LSSTApplications
19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
30 namespace cameraGeom {
35 CameraSys
const getNativeCameraSys() {
return FOCAL_PLANE; }
47 auto nativePoint =
transform(point, cameraSys, getNativeCameraSys());
50 for (
auto const &item :
getIdMap()) {
52 auto pointPixels =
detector->transform(nativePoint, getNativeCameraSys(),
PIXELS);
63 auto nativePointList =
transform(pointList, cameraSys, getNativeCameraSys());
67 auto pointPixelsList =
detector->transform(nativePointList, getNativeCameraSys(),
PIXELS);
68 for (
std::size_t i = 0; i < pointPixelsList.size(); ++i) {
69 auto const &pointPixels = pointPixelsList[i];
75 return detectorListList;
106 Detector::InCameraBuilder
const &
detector
114 class PersistenceHelper {
117 static PersistenceHelper
const & get() {
118 static PersistenceHelper
const instance;
129 PersistenceHelper() :
131 name(
schema.addField<
std::string>(
"name",
"Camera name",
"", 0)),
133 "Fully-qualified name of a Python PupilFactory class",
135 transformMap(
schema.addField<int>(
"transformMap",
"archive ID for Camera's TransformMap"))
139 PersistenceHelper(PersistenceHelper
const &) =
delete;
140 PersistenceHelper(PersistenceHelper &&) =
delete;
142 PersistenceHelper & operator=(PersistenceHelper
const &) =
delete;
143 PersistenceHelper & operator=(PersistenceHelper &&) =
delete;
151 auto const &
keys = PersistenceHelper::get();
153 auto record = cat.
addNew();
190 auto const &
keys = PersistenceHelper::get();
192 auto const & cat = catalogs[1];
195 auto const & record = cat.front();
196 _name = record.get(
keys.name);
197 _pupilFactoryName = record.get(
keys.pupilFactoryName);
201 std::string Camera::getPersistenceName()
const {
return "Camera"; }
212 for (
auto const & pair : camera.
getIdMap()) {
217 for (
auto const & connection : camera.
getTransformMap()->getConnections()) {
226 if (connection.fromSys.hasDetectorName()) {
227 assert(connection.toSys.getDetectorName() == connection.fromSys.getDetectorName());
228 auto detector = (*this)[connection.fromSys.getDetectorName()];
229 assert(connection.fromSys ==
detector->getNativeCoordSys());
231 connection.transform);
233 assert(connection.fromSys == getNativeCameraSys());
234 if (!connection.toSys.hasDetectorName()) {
235 _connections.push_back(connection);
253 for (
auto const & pair :
getIdMap()) {
254 auto const & detectorBuilder = *pair.second;
257 detectorBuilder.getOrientation().makeFpPixelTransform(detectorBuilder.getPixelSize()),
258 getNativeCameraSys(),
259 detectorBuilder.getNativeCoordSys()
263 getDetectorBuilderConnections(detectorBuilder).begin(),
264 getDetectorBuilderConnections(detectorBuilder).
end());
270 detectors.reserve(
size());
271 for (
auto const & pair :
getIdMap()) {
272 auto const & detectorBuilder = *pair.second;
273 detectors.push_back(detectorBuilder.finish(
transformMap));
287 template <
typename Iter>
288 Iter findConnection(Iter
first, Iter last,
CameraSys const & toSys) {
291 [&toSys](
auto const & connection) {
292 return connection.toSys == toSys;
306 (
boost::format(
"%s should be added to Detector %s, not Camera") %
310 auto iter = findConnection(_connections.begin(), _connections.end(), toSys);
311 if (
iter == _connections.end()) {
312 _connections.push_back(
321 auto iter = findConnection(_connections.begin(), _connections.end(), toSys);
322 if (
iter != _connections.end()) {
323 _connections.erase(
iter);
340 template class PersistableFacade<cameraGeom::Camera>;
An immutable representation of a camera.
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
An object passed to Persistable::write to allow it to persist itself.
std::string getName() const
Return the name of the camera.
bool contains(Point2D const &point) const noexcept
Return true if the box contains the point.
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
static Factory const registration
std::string getSysName() const
Get coordinate system name.
table::Key< int > transformMap
std::size_t size() const noexcept
Get the number of detectors.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
PersistableFactory(std::string const &name)
Constructor for the factory.
Builder(std::string const &name)
Construct a Builder for a completely new Camera with the given name.
virtual ~Builder() noexcept
std::shared_ptr< TransformMap const > getTransformMap() const noexcept
Obtain the transform registry.
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
Reports errors in the logical structure of the program.
A vector of catalogs used by Persistable.
virtual ~Camera() noexcept
A base class for factory classes used to reconstruct objects from records.
DetectorCollection::List DetectorList
lsst::geom::Point2D transform(lsst::geom::Point2D const &point, CameraSys const &fromSys, CameraSys const &toSys) const
Transform a point from one camera coordinate system to another.
table::Key< std::string > pupilFactoryName
A helper class that allows the properties of a detector to be modified in the course of modifying a f...
IdMap const & getIdMap() const noexcept
Get a map keyed and ordered by ID.
A base class for image defects.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
An immutable collection of Detectors that can be accessed by name or ID.
Camera(Camera const &)=delete
std::shared_ptr< Persistable > read(InputArchive const &archive, CatalogVector const &catalogs) const override
Construct a new object from the given InputArchive and vector of catalogs.
CameraSys const FOCAL_PLANE
Focal plane coordinates: Position on a 2-d planar approximation to the focal plane (x,...
void setTransformFromFocalPlaneTo(CameraSys const &toSys, std::shared_ptr< afw::geom::TransformPoint2ToPoint2 const > transform)
Set the transformation from FOCAL_PLANE to the given coordinate system.
std::shared_ptr< afw::geom::TransformPoint2ToPoint2 > getTransform(CameraSys const &fromSys, CameraSys const &toSys) const
Get a transform from one CameraSys to another.
std::shared_ptr< Detector::InCameraBuilder > add(std::string const &name, int id)
Add a new Detector with the given name and ID.
void add(std::shared_ptr< Detector::InCameraBuilder > detector)
Add a detector to the collection.
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
std::string getDetectorName() const
Get detector name, or "" if not a detector-specific coordinate system.
DetectorList findDetectors(lsst::geom::Point2D const &point, CameraSys const &cameraSys) const
Find the detectors that cover a point in any camera system.
table::Key< int > detector
A helper class for creating and modifying cameras.
table::Key< std::string > name
std::string getPupilFactoryName() const
Return the fully-qualified name of the Python class that provides this Camera's PupilFactory.
int put(Persistable const *obj, bool permissive=false)
Save an object to the archive and return a unique ID that can be used to retrieve it from an InputArc...
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
A floating-point coordinate rectangle geometry.
Camera coordinate system prefix.
bool hasDetectorName() const noexcept
Does this have a non-blank detector name?
std::vector< DetectorList > findDetectorsList(std::vector< lsst::geom::Point2D > const &pointList, CameraSys const &cameraSys) const
Find the detectors that cover a list of points in any camera system.
CameraSysPrefix const PIXELS
Pixel coordinates: Nominal position on the entry surface of a given detector (x, y unbinned pixels).
bool discardTransformFromFocalPlaneTo(CameraSys const &toSys)
Remove any transformation from FOCAL_PLANE to the given coordinate system.
Camera coordinate system; used as a key in in TransformMap.