LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Related Symbols | List of all members
lsst::afw::cameraGeom::Detector Class Referencefinal

A representation of a detector in a mosaic camera. More...

#include <Detector.h>

Inheritance diagram for lsst::afw::cameraGeom::Detector:
lsst::afw::cameraGeom::DetectorBase lsst::afw::table::io::PersistableFacade< Detector > lsst::afw::typehandling::Storable lsst::afw::table::io::Persistable

Classes

class  Builder
 A helper class for Detector that allows amplifiers and most fields to be modified. More...
 
class  Factory
 
class  InCameraBuilder
 A helper class that allows the properties of a detector to be modified in the course of modifying a full camera. More...
 
class  PartialRebuilder
 A helper class that allows the properties of a single detector to be modified in isolation. More...
 

Public Types

using CrosstalkMatrix = ndarray::Array<float const, 2>
 

Public Member Functions

std::shared_ptr< PartialRebuilderrebuild () const
 Return a Builder object initialized with the state of this Detector.
 
std::vector< lsst::geom::Point2DgetCorners (CameraSys const &cameraSys) const
 Get the corners of the detector in the specified camera coordinate system.
 
std::vector< lsst::geom::Point2DgetCorners (CameraSysPrefix const &cameraSysPrefix) const
 Get the corners of the detector in the specified camera coordinate system prefix.
 
lsst::geom::Point2D getCenter (CameraSys const &cameraSys) const
 Get the center of the detector in the specified camera coordinate system.
 
lsst::geom::Point2D getCenter (CameraSysPrefix const &cameraSysPrefix) const
 Get the center of the detector in the specified camera coordinate system prefix.
 
bool hasTransform (CameraSys const &cameraSys) const
 Can this object convert between PIXELS and the specified camera coordinate system?
 
bool hasTransform (CameraSysPrefix const &cameraSysPrefix) const
 Can this object convert between PIXELS and the specified camera coordinate system prefix?
 
template<typename FromSysT , typename ToSysT >
std::shared_ptr< afw::geom::TransformPoint2ToPoint2getTransform (FromSysT const &fromSys, ToSysT const &toSys) const
 Get a Transform from one camera coordinate system, or camera coordinate system prefix, to another.
 
template<typename FromSysT , typename ToSysT >
lsst::geom::Point2D transform (lsst::geom::Point2D const &point, FromSysT const &fromSys, ToSysT const &toSys) const
 Transform a point from one camera system to another.
 
template<typename FromSysT , typename ToSysT >
std::vector< lsst::geom::Point2Dtransform (std::vector< lsst::geom::Point2D > const &points, FromSysT const &fromSys, ToSysT const &toSys) const
 Transform a vector of points from one camera system to another.
 
std::shared_ptr< TransformMap const > getTransformMap () const
 Get the transform registry.
 
std::vector< std::shared_ptr< Amplifier const > > const & getAmplifiers () const
 Return the sequence of Amplifiers directly.
 
auto begin () const
 An iterator range over amplifers.
 
auto end () const
 
std::shared_ptr< Amplifier const > operator[] (size_t i) const
 Get the amplifier specified by index.
 
std::shared_ptr< Amplifier const > operator[] (std::string const &name) const
 Get the amplifier specified by name.
 
std::size_t size () const
 Get the number of amplifiers.
 
bool isPersistable () const noexcept override
 Detector is always persistable.
 
template<typename FromSysT , typename ToSysT >
std::shared_ptr< geom::TransformPoint2ToPoint2 > getTransform (FromSysT const &fromSys, ToSysT const &toSys) const
 
std::string getName () const
 Get the detector name.
 
int getId () const
 Get the detector ID.
 
DetectorType getType () const
 Return the purpose of this detector.
 
std::string getSerial () const
 Get the detector serial "number".
 
std::string getPhysicalType () const
 Get the detector's physical type.
 
lsst::geom::Box2I getBBox () const
 Get the bounding box.
 
Orientation getOrientation () const
 Get detector's orientation in the focal plane.
 
lsst::geom::Extent2D getPixelSize () const
 Get size of pixel along (mm)
 
bool hasCrosstalk () const
 Have we got crosstalk coefficients?
 
CrosstalkMatrix getCrosstalk () const
 Get the crosstalk coefficients.
 
CameraSys makeCameraSys (CameraSys const &cameraSys) const
 Get a coordinate system from a coordinate system (return input unchanged and untested)
 
CameraSys makeCameraSys (CameraSysPrefix const &cameraSysPrefix) const
 Get a coordinate system from a detector system prefix (add detector name)
 
CameraSys getNativeCoordSys () const
 The "native" coordinate system of this detector.
 
virtual std::shared_ptr< Storable > cloneStorable () const
 Create a new object that is a copy of this one (optional operation).
 
virtual std::string toString () const
 Create a string representation of this object (optional operation).
 
virtual std::size_t hash_value () const
 Return a hash of this object (optional operation).
 
virtual bool equals (Storable const &other) const noexcept
 Compare this object to another Storable.
 
void writeFits (std::string const &fileName, std::string const &mode="w") const
 Write the object to a regular FITS file.
 
void writeFits (fits::MemFileManager &manager, std::string const &mode="w") const
 Write the object to a FITS image in memory.
 
void writeFits (fits::Fits &fitsfile) const
 Write the object to an already-open FITS object.
 

Static Public Member Functions

static std::shared_ptr< DetectorreadFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object.
 
static std::shared_ptr< DetectorreadFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU)
 Read an object from a regular FITS file.
 
static std::shared_ptr< DetectorreadFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 Read an object from a FITS file in memory.
 
static std::shared_ptr< DetectordynamicCast (std::shared_ptr< Persistable > const &ptr)
 Dynamically cast a shared_ptr.
 

Protected Types

using OutputArchiveHandle = io::OutputArchiveHandle
 

Protected Member Functions

Fields const & getFields () const override
 Return a reference to a Fields struct.
 

Static Protected Member Functions

template<class T >
static bool singleClassEquals (T const &lhs, Storable const &rhs)
 Test if a Storable is of a particular class and equal to another object.
 

Private Member Functions

std::string getPersistenceName () const override
 Return the unique name used to persist this object and look up its factory.
 
std::string getPythonModule () const override
 Return the fully-qualified Python module that should be imported to guarantee that its factory is registered.
 
void write (OutputArchiveHandle &handle) const override
 Write the object to one or more catalogs.
 

Related Symbols

(Note that these are not member symbols.)

std::ostreamoperator<< (std::ostream &os, Storable const &storable)
 Output operator for Storable.
 

Detailed Description

A representation of a detector in a mosaic camera.

Detector holds both simple data fields (see DetectorBase) and a set of related coordinate systems and transforms, and acts as a container of Amplifier objects.

Detector is immutable, but copies can be modified via one of its Builder classes. A Detector must be created initially as part of a Camera (see Camera::Builder::add), but can then be modified either individually (see Detector::rebuild and Detector::PartialRebuilder) or as part of modifying the full Camera (see Detector::InCameraBuilder).

The coordinate systems and transforms known to a Detector are shared with its parent Camera and all other Detectors in that Camera.

Definition at line 181 of file Detector.h.

Member Typedef Documentation

◆ CrosstalkMatrix

using lsst::afw::cameraGeom::DetectorBase::CrosstalkMatrix = ndarray::Array<float const, 2>
inherited

Definition at line 59 of file Detector.h.

◆ OutputArchiveHandle

using lsst::afw::table::io::Persistable::OutputArchiveHandle = io::OutputArchiveHandle
protectedinherited

Definition at line 108 of file Persistable.h.

Member Function Documentation

◆ begin()

auto lsst::afw::cameraGeom::Detector::begin ( ) const
inline

An iterator range over amplifers.

Iterators dereference to shared_ptr<Amplifier const>.

Definition at line 278 of file Detector.h.

278{ return _amplifiers.begin(); }

◆ cloneStorable()

std::shared_ptr< Storable > lsst::afw::typehandling::Storable::cloneStorable ( ) const
virtualinherited

Create a new object that is a copy of this one (optional operation).

This operation is required for Storables that are stored in GenericMap by value, but not for those stored by shared pointer.

Exceptions
UnsupportedOperationExceptionThrown if this object is not cloneable.
Note
If this class supports a clone operation, the two should behave identically except for the formal return type.
When called on Python classes, this method delegates to __deepcopy__ if it exists.

Reimplemented in lsst::afw::detection::Psf, lsst::afw::geom::polygon::Polygon, lsst::afw::geom::SkyWcs, lsst::afw::image::ApCorrMap, lsst::afw::image::CoaddInputs, lsst::afw::image::FilterLabel, lsst::afw::image::PhotoCalib, lsst::afw::image::VisitInfo, and lsst::afw::typehandling::StorableHelper< Base >.

Definition at line 36 of file Storable.cc.

36 {
37 throw LSST_EXCEPT(UnsupportedOperationException, "Cloning is not supported.");
38}
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48

◆ dynamicCast()

Dynamically cast a shared_ptr.

Dynamically cast a shared pointer and raise on failure.

You must provide an explicit template instantiation in the .cc file for each class that inherits from PersistableFacade. Designed to work around RTTI issues on macOS with hidden symbols;

Exceptions
lsst::pex::exceptions::LogicErrorif the cast fails

param[in] ptr The pointer to be cast.

Returns
The cast pointer.
Exceptions
lsst::pex::exceptions::TypeErrorIf the dynamic cast fails.

Definition at line 218 of file Persistable.cc.

◆ end()

auto lsst::afw::cameraGeom::Detector::end ( ) const
inline

Definition at line 279 of file Detector.h.

279{ return _amplifiers.end(); }

◆ equals()

bool lsst::afw::typehandling::Storable::equals ( Storable const & other) const
virtualnoexceptinherited

Compare this object to another Storable.

Subclasses that implement equality comparison must override this method to give results consistent with operator== for all inputs that are accepted by both.

Returns
This implementation returns whether the two objects are the same.
Warning
This method compares an object to any type of Storable, although cross-class comparisons should usually return false. If cross-class comparisons are valid, implementers should take care that they are symmetric and will give the same result no matter what the compile-time types of the left- and right-hand sides are.
See also
singleClassEquals
Note
When called on Python classes, this method delegates to __eq__ if it exists.

Reimplemented in lsst::afw::typehandling::StorableHelper< Base >, lsst::afw::geom::polygon::Polygon, lsst::afw::geom::SkyWcs, lsst::afw::image::PhotoCalib, and lsst::afw::image::VisitInfo.

Definition at line 48 of file Storable.cc.

48{ return this == &other; }

◆ getAmplifiers()

std::vector< std::shared_ptr< Amplifier const > > const & lsst::afw::cameraGeom::Detector::getAmplifiers ( ) const
inline

Return the sequence of Amplifiers directly.

Definition at line 270 of file Detector.h.

270{ return _amplifiers; }

◆ getBBox()

lsst::geom::Box2I lsst::afw::cameraGeom::DetectorBase::getBBox ( ) const
inlineinherited

Get the bounding box.

Definition at line 85 of file Detector.h.

85{ return getFields().bbox; }
virtual Fields const & getFields() const =0
Return a reference to a Fields struct.

◆ getCenter() [1/2]

lsst::geom::Point2D lsst::afw::cameraGeom::Detector::getCenter ( CameraSys const & cameraSys) const

Get the center of the detector in the specified camera coordinate system.

Definition at line 72 of file Detector.cc.

72 {
73 auto ctrPix = lsst::geom::Box2D(getBBox()).getCenter();
74 auto transform = getTransform(PIXELS, cameraSys);
75 return transform->applyForward(ctrPix);
76}
lsst::geom::Box2I getBBox() const
Get the bounding box.
Definition Detector.h:85
std::shared_ptr< afw::geom::TransformPoint2ToPoint2 > getTransform(FromSysT const &fromSys, ToSysT const &toSys) const
Get a Transform from one camera coordinate system, or camera coordinate system prefix,...
A floating-point coordinate rectangle geometry.
Definition Box.h:413
Point2D const getCenter() const noexcept
Return true if the box contains no points.
Definition Box.h:549

◆ getCenter() [2/2]

lsst::geom::Point2D lsst::afw::cameraGeom::Detector::getCenter ( CameraSysPrefix const & cameraSysPrefix) const

Get the center of the detector in the specified camera coordinate system prefix.

Definition at line 78 of file Detector.cc.

78 {
79 return getCenter(makeCameraSys(cameraSysPrefix));
80}
CameraSys makeCameraSys(CameraSys const &cameraSys) const
Get a coordinate system from a coordinate system (return input unchanged and untested)
Definition Detector.h:110
lsst::geom::Point2D getCenter(CameraSys const &cameraSys) const
Get the center of the detector in the specified camera coordinate system.
Definition Detector.cc:72

◆ getCorners() [1/2]

std::vector< lsst::geom::Point2D > lsst::afw::cameraGeom::Detector::getCorners ( CameraSys const & cameraSys) const

Get the corners of the detector in the specified camera coordinate system.

Definition at line 62 of file Detector.cc.

62 {
64 auto nativeToCameraSys = _transformMap->getTransform(getNativeCoordSys(), cameraSys);
65 return nativeToCameraSys->applyForward(nativeCorners);
66}
CameraSys getNativeCoordSys() const
The "native" coordinate system of this detector.
Definition Detector.h:123
std::vector< Point2D > getCorners() const
Get the corner points.
Definition Box.cc:496

◆ getCorners() [2/2]

std::vector< lsst::geom::Point2D > lsst::afw::cameraGeom::Detector::getCorners ( CameraSysPrefix const & cameraSysPrefix) const

Get the corners of the detector in the specified camera coordinate system prefix.

Definition at line 68 of file Detector.cc.

68 {
69 return getCorners(makeCameraSys(cameraSysPrefix));
70}
std::vector< lsst::geom::Point2D > getCorners(CameraSys const &cameraSys) const
Get the corners of the detector in the specified camera coordinate system.
Definition Detector.cc:62

◆ getCrosstalk()

CrosstalkMatrix lsst::afw::cameraGeom::DetectorBase::getCrosstalk ( ) const
inlineinherited

Get the crosstalk coefficients.

Definition at line 100 of file Detector.h.

◆ getFields()

Fields const & lsst::afw::cameraGeom::Detector::getFields ( ) const
inlineoverrideprotectedvirtual

Return a reference to a Fields struct.

Must be implemented by all subclasses.

Implements lsst::afw::cameraGeom::DetectorBase.

Definition at line 306 of file Detector.h.

306{ return _fields; }

◆ getId()

int lsst::afw::cameraGeom::DetectorBase::getId ( ) const
inlineinherited

Get the detector ID.

Definition at line 67 of file Detector.h.

◆ getName()

std::string lsst::afw::cameraGeom::DetectorBase::getName ( ) const
inlineinherited

Get the detector name.

Definition at line 64 of file Detector.h.

◆ getNativeCoordSys()

CameraSys lsst::afw::cameraGeom::DetectorBase::getNativeCoordSys ( ) const
inlineinherited

The "native" coordinate system of this detector.

Definition at line 123 of file Detector.h.

123{ return CameraSys(PIXELS, getName()); }
std::string getName() const
Get the detector name.
Definition Detector.h:64

◆ getOrientation()

Orientation lsst::afw::cameraGeom::DetectorBase::getOrientation ( ) const
inlineinherited

Get detector's orientation in the focal plane.

Definition at line 88 of file Detector.h.

◆ getPersistenceName()

std::string lsst::afw::cameraGeom::Detector::getPersistenceName ( ) const
overrideprivatevirtual

Return the unique name used to persist this object and look up its factory.

Must be less than ArchiveIndexSchema::MAX_NAME_LENGTH characters.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 319 of file Detector.cc.

319 {
320 return "Detector";
321}

◆ getPhysicalType()

std::string lsst::afw::cameraGeom::DetectorBase::getPhysicalType ( ) const
inlineinherited

Get the detector's physical type.

This may mean different things for different cameras; possibilities include the manufacturer ("ITL" vs "E2V") or fundamental technology ("CCD" vs "HgCdTe").

Definition at line 82 of file Detector.h.

◆ getPixelSize()

lsst::geom::Extent2D lsst::afw::cameraGeom::DetectorBase::getPixelSize ( ) const
inlineinherited

Get size of pixel along (mm)

Definition at line 91 of file Detector.h.

91{ return getFields().pixelSize; }

◆ getPythonModule()

std::string lsst::afw::cameraGeom::Detector::getPythonModule ( ) const
overrideprivatevirtual

Return the fully-qualified Python module that should be imported to guarantee that its factory is registered.

Must be less than ArchiveIndexSchema::MAX_MODULE_LENGTH characters.

Will be ignored if empty.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 325 of file Detector.cc.

325 {
326 return "lsst.afw.cameraGeom";
327}

◆ getSerial()

std::string lsst::afw::cameraGeom::DetectorBase::getSerial ( ) const
inlineinherited

Get the detector serial "number".

Definition at line 73 of file Detector.h.

◆ getTransform() [1/2]

template<typename FromSysT , typename ToSysT >
std::shared_ptr< afw::geom::TransformPoint2ToPoint2 > lsst::afw::cameraGeom::Detector::getTransform ( FromSysT const & fromSys,
ToSysT const & toSys ) const

Get a Transform from one camera coordinate system, or camera coordinate system prefix, to another.

Template Parameters
FromSysT,ToSysTType of fromSys, toSys: one of CameraSys or CameraSysPrefix
Parameters
fromSys,toSyscamera coordinate systems or prefixes between which to transform
Returns
a Transform that converts from fromSys to toSys in the forward direction. The Transform will be invertible.
Exceptions
lsst::pex::exceptions::InvalidParameterErrorThrown if either fromSys or toSys is not supported.

◆ getTransform() [2/2]

template<typename FromSysT , typename ToSysT >
std::shared_ptr< geom::TransformPoint2ToPoint2 > lsst::afw::cameraGeom::Detector::getTransform ( FromSysT const & fromSys,
ToSysT const & toSys ) const

Definition at line 89 of file Detector.cc.

90 {
91 return _transformMap->getTransform(makeCameraSys(fromSys), makeCameraSys(toSys));
92}

◆ getTransformMap()

std::shared_ptr< TransformMap const > lsst::afw::cameraGeom::Detector::getTransformMap ( ) const
inline

Get the transform registry.

Definition at line 267 of file Detector.h.

267{ return _transformMap; }

◆ getType()

DetectorType lsst::afw::cameraGeom::DetectorBase::getType ( ) const
inlineinherited

Return the purpose of this detector.

Definition at line 70 of file Detector.h.

◆ hasCrosstalk()

bool lsst::afw::cameraGeom::DetectorBase::hasCrosstalk ( ) const
inlineinherited

Have we got crosstalk coefficients?

Definition at line 94 of file Detector.h.

94 {
95 return !(getFields().crosstalk.isEmpty() ||
96 getFields().crosstalk.getShape() == ndarray::makeVector(0, 0));
97 }

◆ hash_value()

std::size_t lsst::afw::typehandling::Storable::hash_value ( ) const
virtualinherited

Return a hash of this object (optional operation).

Exceptions
UnsupportedOperationExceptionThrown if this object is not hashable.
Note
C++ subclass authors are responsible for any associated specializations of std::hash.
When called on Python classes, this method delegates to __hash__ if it exists.

Reimplemented in lsst::afw::geom::polygon::Polygon, lsst::afw::image::FilterLabel, lsst::afw::image::VisitInfo, and lsst::afw::typehandling::StorableHelper< Base >.

Definition at line 44 of file Storable.cc.

44 {
45 throw LSST_EXCEPT(UnsupportedOperationException, "Hashes are not supported.");
46}

◆ hasTransform() [1/2]

bool lsst::afw::cameraGeom::Detector::hasTransform ( CameraSys const & cameraSys) const

Can this object convert between PIXELS and the specified camera coordinate system?

Definition at line 82 of file Detector.cc.

82{ return _transformMap->contains(cameraSys); }

◆ hasTransform() [2/2]

bool lsst::afw::cameraGeom::Detector::hasTransform ( CameraSysPrefix const & cameraSysPrefix) const

Can this object convert between PIXELS and the specified camera coordinate system prefix?

Definition at line 84 of file Detector.cc.

84 {
85 return hasTransform(makeCameraSys(cameraSysPrefix));
86}
bool hasTransform(CameraSys const &cameraSys) const
Can this object convert between PIXELS and the specified camera coordinate system?
Definition Detector.cc:82

◆ isPersistable()

bool lsst::afw::cameraGeom::Detector::isPersistable ( ) const
inlineoverridevirtualnoexcept

Detector is always persistable.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 302 of file Detector.h.

302{ return true; }

◆ makeCameraSys() [1/2]

CameraSys lsst::afw::cameraGeom::DetectorBase::makeCameraSys ( CameraSys const & cameraSys) const
inlineinherited

Get a coordinate system from a coordinate system (return input unchanged and untested)

Parameters
[in]cameraSysCamera coordinate system
Returns
cameraSys unchanged
Note
the CameraSysPrefix version needs the detector name, which is why this is not static.

Definition at line 110 of file Detector.h.

110{ return cameraSys; }

◆ makeCameraSys() [2/2]

CameraSys lsst::afw::cameraGeom::DetectorBase::makeCameraSys ( CameraSysPrefix const & cameraSysPrefix) const
inlineinherited

Get a coordinate system from a detector system prefix (add detector name)

Parameters
[in]cameraSysPrefixCamera coordinate system prefix
Returns
cameraSysPrefix with the detector name added

Definition at line 118 of file Detector.h.

118 {
119 return CameraSys(cameraSysPrefix, getFields().name);
120 }

◆ operator[]() [1/2]

std::shared_ptr< Amplifier const > lsst::afw::cameraGeom::Detector::operator[] ( size_t i) const
inline

Get the amplifier specified by index.

Exceptions
std::out_of_rangeif index is out of range.

Definition at line 287 of file Detector.h.

287{ return _amplifiers.at(i); }

◆ operator[]() [2/2]

std::shared_ptr< Amplifier const > lsst::afw::cameraGeom::Detector::operator[] ( std::string const & name) const

Get the amplifier specified by name.

Exceptions
lsst::pex::exceptions::InvalidParameterErrorif no such amplifier.

Definition at line 106 of file Detector.cc.

106 {
107 return *findAmpIterByName(_amplifiers.begin(), _amplifiers.end(), name);
108}

◆ readFits() [1/3]

static std::shared_ptr< Detector > lsst::afw::table::io::PersistableFacade< Detector >::readFits ( fits::Fits & fitsfile)
inlinestaticinherited

Read an object from an already open FITS object.

Parameters
[in]fitsfileFITS object to read from, already positioned at the desired HDU.

Definition at line 183 of file Persistable.h.

◆ readFits() [2/3]

static std::shared_ptr< Detector > lsst::afw::table::io::PersistableFacade< Detector >::readFits ( fits::MemFileManager & manager,
int hdu = fits::DEFAULT_HDU )
inlinestaticinherited

Read an object from a FITS file in memory.

Parameters
[in]managerManager for the memory to read from.
[in]hduHDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty.

Definition at line 205 of file Persistable.h.

◆ readFits() [3/3]

static std::shared_ptr< Detector > lsst::afw::table::io::PersistableFacade< Detector >::readFits ( std::string const & fileName,
int hdu = fits::DEFAULT_HDU )
inlinestaticinherited

Read an object from a regular FITS file.

Parameters
[in]fileNameName of the file to read.
[in]hduHDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty.

Definition at line 194 of file Persistable.h.

◆ rebuild()

std::shared_ptr< Detector::PartialRebuilder > lsst::afw::cameraGeom::Detector::rebuild ( ) const

Return a Builder object initialized with the state of this Detector.

This is simply a shortcut for Detector::PartialRebuilder(*this).

Definition at line 58 of file Detector.cc.

58 {
59 return std::make_shared<PartialRebuilder>(*this);
60}

◆ singleClassEquals()

template<class T >
static bool lsst::afw::typehandling::Storable::singleClassEquals ( T const & lhs,
Storable const & rhs )
inlinestaticprotectedinherited

Test if a Storable is of a particular class and equal to another object.

This method template simplifies implementations of equals that delegate to operator== without supporting cross-class comparisons.

Template Parameters
TThe class expected of the two objects to be compared.
Parameters
lhs,rhsThe objects to compare. Note that rhs need not be a T, while lhs must be.
Returns
true if rhs is a T and lhs == rhs; false otherwise.
Exception Safety
Provides the same level of exception safety as operator==. Most implementations of operator== do not throw.
Note
This method template calls operator== with both arguments of compile-time type T const&. Its use is not recommended if there would be any ambiguity as to which operator== gets picked by overload resolution.

This method template is typically called from equals as:

bool MyType::equals(Storable const& other) const noexcept {
    return singleClassEquals(*this, other);
}

Definition at line 151 of file Storable.h.

151 {
152 auto typedRhs = dynamic_cast<T const*>(&rhs);
153 if (typedRhs != nullptr) {
154 return lhs == *typedRhs;
155 } else {
156 return false;
157 }
158 }

◆ size()

std::size_t lsst::afw::cameraGeom::Detector::size ( ) const
inline

Get the number of amplifiers.

Renamed to __len__ in Python.

Definition at line 299 of file Detector.h.

299{ return _amplifiers.size(); }

◆ toString()

std::string lsst::afw::typehandling::Storable::toString ( ) const
virtualinherited

Create a string representation of this object (optional operation).

Exceptions
UnsupportedOperationExceptionThrown if this object does not have a string representation.
Note
When called on Python classes, this method delegates to __repr__.

Reimplemented in lsst::afw::geom::polygon::Polygon, lsst::afw::geom::SkyWcs, lsst::afw::image::FilterLabel, lsst::afw::image::PhotoCalib, lsst::afw::image::VisitInfo, and lsst::afw::typehandling::StorableHelper< Base >.

Definition at line 40 of file Storable.cc.

40 {
41 throw LSST_EXCEPT(UnsupportedOperationException, "No string representation available.");
42}

◆ transform() [1/2]

template<typename FromSysT , typename ToSysT >
lsst::geom::Point2D lsst::afw::cameraGeom::Detector::transform ( lsst::geom::Point2D const & point,
FromSysT const & fromSys,
ToSysT const & toSys ) const

Transform a point from one camera system to another.

Template Parameters
FromSysTClass of fromSys: one of CameraSys or CameraSysPrefix
ToSysTClass of toSys: one of CameraSys or CameraSysPrefix
Parameters
[in]pointCamera point to transform
[in]fromSysCamera coordinate system of point
[in]toSysCamera coordinate system of returned point
Returns
The transformed point
Exceptions
pex::exceptions::InvalidParameterErrorif fromSys or toSys is unknown

Definition at line 95 of file Detector.cc.

96 {
97 return _transformMap->transform(point, makeCameraSys(fromSys), makeCameraSys(toSys));
98}

◆ transform() [2/2]

template<typename FromSysT , typename ToSysT >
std::vector< lsst::geom::Point2D > lsst::afw::cameraGeom::Detector::transform ( std::vector< lsst::geom::Point2D > const & points,
FromSysT const & fromSys,
ToSysT const & toSys ) const

Transform a vector of points from one camera system to another.

Template Parameters
FromSysTClass of fromSys: one of CameraSys or CameraSysPrefix
ToSysTClass of toSys: one of CameraSys or CameraSysPrefix
Parameters
[in]pointsCamera points to transform
[in]fromSysCamera coordinate system of points
[in]toSysCamera coordinate system of returned points
Returns
The transformed points
Exceptions
pex::exceptions::InvalidParameterErrorif fromSys or toSys is unknown

Definition at line 101 of file Detector.cc.

102 {
103 return _transformMap->transform(points, makeCameraSys(fromSys), makeCameraSys(toSys));
104}

◆ write()

void lsst::afw::cameraGeom::Detector::write ( OutputArchiveHandle & handle) const
overrideprivatevirtual

Write the object to one or more catalogs.

The handle object passed to this function provides an interface for adding new catalogs and adding nested objects to the same archive (while checking for duplicates). See OutputArchiveHandle for more information.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 329 of file Detector.cc.

329 {
330 auto const & keys = DetectorSchema();
331
332 auto cat = handle.makeCatalog(keys.schema);
333 auto record = cat.addNew();
334 record->set(keys.name, getName());
335 record->set(keys.id, getId());
336 record->set(keys.type, static_cast<int>(getType()));
337 record->set(keys.serial, getSerial());
338 record->set(keys.bbox, getBBox());
339 record->set(keys.pixelSize, lsst::geom::Point2D(getPixelSize()));
341 record->set(keys.fpPosition, orientation.getFpPosition3());
342 record->set(keys.refPoint, orientation.getReferencePoint());
343 record->set(keys.yaw, orientation.getYaw());
344 record->set(keys.pitch, orientation.getPitch());
345 record->set(keys.roll, orientation.getRoll());
346 record->set(keys.transformMap, handle.put(getTransformMap()));
347
348 auto flattenMatrix = [](ndarray::Array<float const, 2> const & matrix) {
349 // copy because the original isn't guaranteed to have
350 // row-major contiguous elements
351 ndarray::Array<float, 2, 2> copied = ndarray::copy(matrix);
352 // make a view to the copy
353 ndarray::Array<float, 1, 1> flattened = ndarray::flatten<1>(copied);
354 return flattened;
355 };
356
357 record->set(keys.crosstalk, flattenMatrix(getCrosstalk()));
358 record->set(keys.physicalType, getPhysicalType());
359 record->set(keys.version, SERIALIZATION_VERSION);
360 handle.saveCatalog(cat);
361
362 auto ampCat = handle.makeCatalog(Amplifier::getRecordSchema());
363 ampCat.reserve(getAmplifiers().size());
364 for (auto const & amp : getAmplifiers()) {
365 auto record = ampCat.addNew();
366 amp->toRecord(*record);
367 }
368 handle.saveCatalog(ampCat);
369}
static table::Schema getRecordSchema()
Return the schema used in the afw.table representation of amplifiers.
Definition Amplifier.cc:267
lsst::geom::Extent2D getPixelSize() const
Get size of pixel along (mm)
Definition Detector.h:91
int getId() const
Get the detector ID.
Definition Detector.h:67
std::string getPhysicalType() const
Get the detector's physical type.
Definition Detector.h:82
Orientation getOrientation() const
Get detector's orientation in the focal plane.
Definition Detector.h:88
std::string getSerial() const
Get the detector serial "number".
Definition Detector.h:73
CrosstalkMatrix getCrosstalk() const
Get the crosstalk coefficients.
Definition Detector.h:100
DetectorType getType() const
Return the purpose of this detector.
Definition Detector.h:70
std::vector< std::shared_ptr< Amplifier const > > const & getAmplifiers() const
Return the sequence of Amplifiers directly.
Definition Detector.h:270
std::size_t size() const
Get the number of amplifiers.
Definition Detector.h:299
std::shared_ptr< TransformMap const > getTransformMap() const
Get the transform registry.
Definition Detector.h:267
int orientation(UnitVector3d const &a, UnitVector3d const &b, UnitVector3d const &c)
orientation computes and returns the orientations of 3 unit vectors a, b and c.

◆ writeFits() [1/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::Fits & fitsfile) const
inherited

Write the object to an already-open FITS object.

Parameters
[in]fitsfileOpen FITS object to write to.

Definition at line 18 of file Persistable.cc.

18 {
19 OutputArchive archive;
20 archive.put(this);
21 archive.writeFits(fitsfile);
22}

◆ writeFits() [2/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::MemFileManager & manager,
std::string const & mode = "w" ) const
inherited

Write the object to a FITS image in memory.

Parameters
[in]managerName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

Definition at line 29 of file Persistable.cc.

29 {
30 fits::Fits fitsfile(manager, mode, fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
31 writeFits(fitsfile);
32}
void writeFits(std::string const &fileName, std::string const &mode="w") const
Write the object to a regular FITS file.

◆ writeFits() [3/3]

void lsst::afw::table::io::Persistable::writeFits ( std::string const & fileName,
std::string const & mode = "w" ) const
inherited

Write the object to a regular FITS file.

Parameters
[in]fileNameName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

Definition at line 24 of file Persistable.cc.

24 {
25 fits::Fits fitsfile(fileName, mode, fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
26 writeFits(fitsfile);
27}

Friends And Related Symbol Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream & os,
Storable const & storable )
related

Output operator for Storable.

Parameters
osthe desired output stream
storablethe object to print
Returns
a reference to os
Exceptions
UnsupportedOperationExceptionThrown if storable does not have an implementation of Storable::toString.

Definition at line 174 of file Storable.h.

174 {
175 return os << storable.toString();
176}

The documentation for this class was generated from the following files: