15 LOG_LOGGER _log =
LOG_GET(
"jointcal.SimpleAstrometryModel");
23 bool initFromWcs,
unsigned nNotFit,
unsigned order)
24 : _sky2TP(projectionHandler)
29 for (
auto i = ccdImageList.
cbegin(); i != ccdImageList.
cend(); ++i, ++count) {
31 if (count < nNotFit) {
48 while (
unsigned(pol.
getNpar()) > 2 * nObj) {
49 LOGLS_WARN(_log,
"Reducing polynomial order from " 50 << pol.
getOrder() <<
", due to too few sources (" << nObj
51 <<
" vs. " << pol.
getNpar() <<
" parameters)");
67 pol = pol * shiftAndNormalize.
invert();
76 return findMapping(ccdImage);
80 if (whatToFit.
find(
"Distortions") == std::string::npos) {
81 LOGLS_ERROR(_log,
"AssignIndices was called and Distortions is *not* in whatToFit.");
84 unsigned index = firstIndex;
85 for (
auto i = _myMap.begin(); i != _myMap.end(); ++i) {
95 for (
auto &i : _myMap) {
96 auto mapping = i.second.get();
97 mapping->offsetParams(delta.segment(mapping->getIndex(), mapping->getNpar()));
102 for (
auto &i : _myMap) i.second->freezeErrorTransform();
107 for (
auto &i : _myMap) {
108 total += i.second->getNpar();
127 afw::geom::Point2D(0, 0),
128 afw::geom::SpherePoint(tangentPoint.x, tangentPoint.y, afw::geom::degrees),
130 auto iwcToSkyMap = iwcToSkyWcs->getFrameDict()->getMapping(
"PIXELS",
"SKY");
131 auto skyFrame = iwcToSkyWcs->getFrameDict()->getFrame(
"SKY");
134 frameDict.
addFrame(
"IWC", *iwcToSkyMap, *skyFrame);
135 return std::make_shared<afw::geom::SkyWcs>(frameDict);
140 if (i == _myMap.end())
142 "SimpleAstrometryModel cannot find CcdImage " + ccdImage.
getName());
143 return i->second.get();
implements the linear transformations (6 real coefficients).
Gtransfo const & getTransfo(CcdImage const &ccdImage) const
Access to mappings.
SimpleAstrometryModel(CcdImageList const &ccdImageList, const std::shared_ptr< ProjectionHandler const > projectionHandler, bool initFromWCS, unsigned nNotFit=0, unsigned order=3)
Sky2TP is just a name, it can be anything.
const AstrometryMapping * getMapping(CcdImage const &) const override
Mapping associated to a given CcdImage.
GtransfoLin invert() const
returns the inverse: T1 = T2.invert();
void offsetParams(Eigen::VectorXd const &delta) override
Offset the parameters by the provided amounts.
void setOrder(const unsigned order)
Sets the polynomial order (the highest sum of exponents of the largest monomial). ...
std::string getName() const
Return the _name that identifies this ccdImage.
Mapping implementation for a polynomial transformation.
Gtransfo const * getPix2TangentPlane() const
Polynomial transformation class.
GtransfoLin normalizeCoordinatesTransfo(const Frame &frame)
Returns the transformation that maps the input frame along both axes to [-1,1].
std::shared_ptr< afw::geom::SkyWcs > makeSkyWcs(CcdImage const &ccdImage) const override
Make a SkyWcs that contains this model.
unsigned getNpar() const
Number of parameters in total.
void addFrame(int iframe, Mapping const &map, Frame const &frame) override
const std::shared_ptr< Gtransfo const > getSky2TP(CcdImage const &ccdImage) const override
the mapping of sky coordinates (i.e.
rectangle with sides parallel to axes.
Class for a simple mapping implementing a generic Gtransfo.
int getTotalParameters() const override
Return the total number of parameters in this model.
virtual std::shared_ptr< ast::Mapping > toAstMap(jointcal::Frame const &domain) const
Create an equivalent AST mapping for this transformation, including an analytic inverse if possible...
void setIndex(unsigned i)
T dynamic_pointer_cast(T... args)
unsigned getOrder() const
Returns the polynomial order.
A do-nothing transformation. It anyway has dummy routines to mimick a Gtransfo.
#define LSST_EXCEPT(type,...)
This one is the Tangent Plane (called gnomonic) projection (from celestial sphere to tangent plane) ...
MeasuredStarList const & getCatalogForFit() const
Gets the catalog to be used for fitting, which may have been cleaned-up.
a virtual (interface) class for geometric transformations.
std::shared_ptr< SkyWcs > makeSkyWcs(daf::base::PropertySet &metadata, bool strip=false)
Eigen::Matrix2d makeCdMatrix(lsst::geom::Angle const &scale, lsst::geom::Angle const &orientation=0 *lsst::geom::degrees, bool flipX=false)
virtual class needed in the abstraction of the distortion model
CcdImageKey getHashKey() const
Handler of an actual image from a single CCD.
unsigned assignIndices(std::string const &whatToFit, unsigned firstIndex) override
Positions the various parameter sets into the parameter vector, starting at firstIndex.
void freezeErrorTransform() override
int getNpar() const override
total number of parameters
Frame const & getImageFrame() const
Frame in pixels.
#define LOGLS_ERROR(logger, message)
#define LOGLS_WARN(logger, message)