46 PixelAreaBoundedField::PixelAreaBoundedField(
 
   55     if (_skyWcs == 
nullptr) {
 
   58             "SkyWcs passed to PixelAreaBoundedField is null." 
   61     _scaling /= 
std::pow((1.0*unit).asRadians(), 2);
 
   65     return std::pow(_skyWcs->getPixelScale(position).asRadians(), 2) * _scaling;
 
   69     ndarray::Array<double const, 1> 
const & 
x,
 
   70     ndarray::Array<double const, 1> 
const & 
y 
   72     if (
x.getShape() != 
y.getShape()) {
 
   75             (
boost::format(
"Inconsistent shapes in evaluate; %s != %s.") % 
x.getShape() % 
y.getShape()).str()
 
   80     double constexpr side = 1.0;
 
   89     auto skyPoints = _skyWcs->pixelToSky(pixPoints);
 
   91     ndarray::Array<double, 1, 1> 
z = ndarray::allocate(
x.getShape());
 
   94         auto skyLL = skyPoints[j].getVector();
 
   95         auto skyDx = skyPoints[j + 1].getVector() - skyLL;
 
   96         auto skyDy = skyPoints[j + 2].getVector() - skyLL;
 
   97         double skyAreaSq = skyDx.cross(skyDy).getSquaredNorm();
 
   98         z[i] = _scaling * 
std::sqrt(skyAreaSq) / (side*side);
 
  104     return _skyWcs->isPersistable();
 
  113     if (!rhsCasted) 
return false;
 
  115     return getBBox() == rhsCasted->getBBox() && *_skyWcs == *rhsCasted->_skyWcs &&
 
  116         _scaling == rhsCasted->_scaling;
 
  119 std::string PixelAreaBoundedField::toString()
 const {
 
  121     os << 
"PixelAreaBoundedField(" << (*_skyWcs) << 
", scaling=" << _scaling << 
")";
 
  128 struct PersistenceHelper {
 
  134     static PersistenceHelper 
const & get() {
 
  135         static PersistenceHelper 
const instance;
 
  140     PersistenceHelper() :
 
  143         wcs(
schema.addField<int>(
"wcs", 
"Archive ID for SkyWcs instance.")),
 
  145                                         "Scaling factor (including any transformation from rad^2."))
 
  147     PersistenceHelper(PersistenceHelper 
const &) = 
delete;
 
  148     PersistenceHelper(PersistenceHelper &&) = 
delete;
 
  149     PersistenceHelper & 
operator=(PersistenceHelper 
const &) = 
delete;
 
  150     PersistenceHelper & 
operator=(PersistenceHelper &&) = 
delete;
 
  151     ~PersistenceHelper() noexcept = default;
 
  154 class PixelAreaBoundedFieldFactory : public table::io::PersistableFactory {
 
  157             : 
afw::table::io::PersistableFactory(
name) {}
 
  160                                                  CatalogVector 
const& catalogs)
 const override {
 
  163         table::BaseRecord 
const& record = catalogs.front().front();
 
  164         auto const & 
keys = PersistenceHelper::get();
 
  167         auto wcs = archive.get<afw::geom::SkyWcs>(record.get(
keys.wcs));
 
  173 std::string getPixelAreaBoundedFieldPersistenceName() { 
return "PixelAreaBoundedField"; }
 
  175 PixelAreaBoundedFieldFactory registration(getPixelAreaBoundedFieldPersistenceName());
 
  180     return getPixelAreaBoundedFieldPersistenceName();
 
  186     auto const & 
keys = PersistenceHelper::get();
 
  190     record->set(
keys.wcs, handle.
put(_skyWcs));
 
  191     record->set(
keys.scaling, _scaling);
 
table::Key< std::string > name
 
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
 
table::Key< double > scaling
 
A BoundedField that gives the amount a pixel is distorted at each point.
 
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
 
An abstract base class for 2-d functions defined on an integer bounding boxes.
 
lsst::geom::Box2I getBBox() const
Return the bounding box that defines the region where the field is valid.
 
A BoundedField that evaluate the pixel area of a SkyWcs in angular units.
 
double evaluate(lsst::geom::Point2D const &position) const override
Evaluate the field at the given point.
 
std::shared_ptr< BoundedField > operator*(double const scale) const override
Return a scaled BoundedField.
 
bool isPersistable() const noexcept override
PixelAreaBoundedField is persistable if and only if the nested SkyWcs is.
 
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
 
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 reg...
 
bool operator==(BoundedField const &rhs) const override
BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal.
 
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
 
An object passed to Persistable::write to allow it to persist itself.
 
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
 
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
 
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...
 
static std::shared_ptr< T > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
 
A class used to convert scalar POD types such as double to Angle.
 
An integer coordinate rectangle.
 
Reports invalid arguments.
 
T emplace_back(T... args)
 
def scale(algorithm, min, max=None, frame=None)
 
FilterProperty & operator=(FilterProperty const &)=default
 
BoxKey< lsst::geom::Box2I > Box2IKey
 
constexpr AngleUnit radians
constant with units of radians
 
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
 
A base class for image defects.
 
std::shared_ptr< table::io::Persistable > read(table::io::InputArchive const &archive, table::io::CatalogVector const &catalogs) const override