28 #include "ndarray/eigen.h"
48 if (
transform.getToEndpoint().getNAxes() != 1) {
50 "To EndPoint of transform must have 1 axis but has " +
60 ndarray::Array<double const, 1>
const&
y)
const {
61 if (
x.getSize<0>() !=
y.getSize<0>()) {
68 int const nPoints =
x.getSize<0>();
69 ndarray::Array<double, 2, 2> xy = ndarray::allocate(ndarray::makeVector(2, nPoints));
78 auto resShape = ndarray::makeVector(nPoints);
79 auto resStrides = ndarray::makeVector(1);
80 return ndarray::external(res2D.getData(), resShape, resStrides, res2D);
87 struct PersistenceHelper {
91 table::Key<table::Array<std::uint8_t>>
frameSet;
97 "frameSet",
"FrameSet contained in the Transform",
"", 0)) {}
99 PersistenceHelper(table::Schema
const& s) :
schema(s),
bbox(s[
"bbox"]),
frameSet(s[
"frameSet"]) {}
102 class TransformBoundedFieldFactory :
public table::io::PersistableFactory {
105 :
afw::table::io::PersistableFactory(
name) {}
108 CatalogVector
const& catalogs)
const override {
111 table::BaseRecord
const& record = catalogs.front().front();
112 PersistenceHelper
const keys(record.getSchema());
118 return std::make_shared<TransformBoundedField>(
bbox, *
transform);
122 std::string getTransformBoundedFieldPersistenceName() {
return "TransformBoundedField"; }
124 TransformBoundedFieldFactory registration(getTransformBoundedFieldPersistenceName());
129 return getTransformBoundedFieldPersistenceName();
135 PersistenceHelper
const keys;
146 auto newTransform =
Transform(newMapping);
147 return std::make_shared<TransformBoundedField>(
getBBox(), newTransform);
152 if (!rhsCasted)
return false;
154 return getBBox() == rhsCasted->getBBox() &&
158 std::string TransformBoundedField::toString()
const {
return "TransformBoundedField"; }
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
SeriesMap then(Mapping const &next) const
Return a series compound mapping this(first(input)) containing shallow copies of the original.
void applyForward(ConstArray2D const &from, Array2D const &to) const
Perform a forward transformation on 2-D array, putting the results into a pre-allocated 2-D array.
A Mapping which "zooms" a set of points about the origin by multiplying all coordinate values by the ...
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.
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.
An integer coordinate rectangle.
Reports invalid arguments.
def scale(algorithm, min, max=None, frame=None)
BoxKey< lsst::geom::Box2I > Box2IKey
A base class for image defects.