| LSSTApplications
    20.0.0
    LSSTDataManagementBasePackage | 
 
 
 
Go to the documentation of this file.
   46 template <
typename KeyType, 
typename ValueType>
 
   50     for (
auto const &i : map) {
 
   66         int chipOrder, 
int visitOrder)
 
   68           _skyToTangentPlane(projectionHandler) {
 
   74     for (
auto &ccdImage : ccdImageList) {
 
   78         auto visitp = _visitMap.find(
visit);
 
   79         if (visitp == _visitMap.end()) {
 
   83         auto chipp = _chipMap.find(chip);
 
   84         if (chipp == _chipMap.end()) {
 
   87             if (radius2 < minRadius2) {
 
   89                 constrainedChip = chip;
 
   99             _chipMap[chip] = std::make_shared<SimplePolyMapping>(shiftAndNormalize,
 
  100                                                                  pol * shiftAndNormalize.
inverted());
 
  105     _chipMap.at(constrainedChip)->setToBeFit(
false);
 
  108     for (
auto &ccdImage : ccdImageList) {
 
  115         if (_chipMap.find(chip) == _chipMap.end()) {
 
  116             LOGLS_WARN(
_log, 
"Chip " << chip << 
" is missing in the reference exposure, expect troubles.");
 
  121         _mappings[ccdImage->getHashKey()] =
 
  122                 std::make_unique<ChipVisitAstrometryMapping>(_chipMap[chip], _visitMap[
visit]);
 
  124     LOGLS_INFO(
_log, 
"Got " << _chipMap.size() << 
" chip mappings and " << _visitMap.size()
 
  125                             << 
" visit mappings; holding chip " << constrainedChip << 
" fixed (" 
  127     LOGLS_DEBUG(
_log, 
"CcdImage map has " << _mappings.size() << 
" mappings, with " 
  128                                           << _mappings.bucket_count() << 
" buckets and a load factor of " 
  129                                           << _mappings.load_factor());
 
  133     return findMapping(ccdImage);
 
  141                                                        Eigen::Index firstIndex) {
 
  142     Eigen::Index index = firstIndex;
 
  143     if (whatToFit.
find(
"Distortions") == std::string::npos) {
 
  144         LOGLS_ERROR(
_log, 
"assignIndices was called and Distortions is *not* in whatToFit");
 
  148     _fittingChips = (whatToFit.
find(
"DistortionsChip") != std::string::npos);
 
  149     _fittingVisits = (whatToFit.
find(
"DistortionsVisit") != std::string::npos);
 
  151     if ((!_fittingChips) && (!_fittingVisits)) {
 
  152         _fittingChips = _fittingVisits = 
true;
 
  155         for (
auto &i : _chipMap) {
 
  156             i.second->setIndex(index);
 
  157             index += i.second->getNpar();
 
  160         for (
auto &i : _visitMap) {
 
  161             i.second->setIndex(index);
 
  162             index += i.second->getNpar();
 
  165     for (
auto &i : _mappings) {
 
  166         i.second->setWhatToFit(_fittingChips, _fittingVisits);
 
  173         for (
auto &i : _chipMap) {
 
  174             auto mapping = i.second.get();
 
  175             mapping->offsetParams(delta.segment(mapping->getIndex(), mapping->getNpar()));
 
  178         for (
auto &i : _visitMap) {
 
  179             auto mapping = i.second.get();
 
  180             mapping->offsetParams(delta.segment(mapping->getIndex(), mapping->getNpar()));
 
  185     for (
auto i = _visitMap.begin(); i != _visitMap.end(); ++i) i->second->freezeErrorTransform();
 
  186     for (
auto i = _chipMap.begin(); i != _chipMap.end(); ++i) i->second->freezeErrorTransform();
 
  190     auto chipp = _chipMap.find(chip);
 
  191     if (chipp == _chipMap.end()) {
 
  193         errMsg << 
"No such chipId: " << chip << 
" among ";
 
  194         outputMapKeys(_chipMap, errMsg);
 
  198     return chipp->second->getTransform();
 
  205     for (
auto i = _visitMap.begin(); i != _visitMap.end(); ++i) res.
push_back(i->first);
 
  210     auto visitp = _visitMap.find(
visit);
 
  211     if (visitp == _visitMap.end()) {
 
  213         errMsg << 
"No such visitId: " << 
visit << 
" among ";
 
  214         outputMapKeys(_visitMap, errMsg);
 
  218     return visitp->second->getTransform();
 
  223     for (
auto &i : _chipMap) {
 
  224         total += i.second->getNpar();
 
  226     for (
auto &i : _visitMap) {
 
  227         total += i.second->getNpar();
 
  249     auto iwcToSkyMap = iwcToSkyWcs->getFrameDict()->getMapping(
"PIXELS", 
"SKY");
 
  250     auto skyFrame = iwcToSkyWcs->getFrameDict()->getFrame(
"SKY");
 
  253     frameDict.
addFrame(
"PIXELS", *pixelsToFocal, focalFrame);
 
  254     frameDict.
addFrame(
"FOCAL", *focalToIwc, iwcFrame);
 
  255     frameDict.
addFrame(
"IWC", *iwcToSkyMap, *skyFrame);
 
  256     return std::make_shared<afw::geom::SkyWcs>(frameDict);
 
  260     out << 
"Constrained Astrometry Model (" << _mappings.size() << 
" composite mappings; " << _chipMap.size()
 
  261         << 
" sensor mappings, " << _visitMap.size() << 
" visit mappings):" << 
std::endl;
 
  263     out << 
"Sensor to sky transforms:" << 
std::endl;
 
  264     for (
auto &i : _mappings) {
 
  271     auto i = _mappings.find(ccdImage.
getHashKey());
 
  272     if (i == _mappings.end())
 
  274                           "ConstrainedAstrometryModel cannot find CcdImage " + ccdImage.
getName());
 
  275     return i->second.get();
 
  
constexpr AngleUnit degrees
constant with units of degrees
CcdImageKey getHashKey() const
ConstrainedAstrometryModel(CcdImageList const &ccdImageList, std::shared_ptr< ProjectionHandler const > projectionHandler, int chipOrder, int visitOrder)
std::vector< VisitIdType > getVisits() const
Access to array of visits involved in the solution.
std::size_t getTotalParameters() const override
Return the total number of parameters in this model.
void freezeErrorTransform() override
From there on, measurement errors are propagated using the current transforms (and no longer evolve).
A FrameSet whose frames can be referenced by domain name.
#define LOGLS_INFO(logger, message)
void addFrame(int iframe, Mapping const &map, Frame const &frame) override
Add a new Frame and an associated Mapping to this FrameSet so as to define a new coordinate system,...
#define LOGLS_ERROR(logger, message)
std::string getName() const
Return the _name that identifies this ccdImage.
#define LOGLS_WARN(logger, message)
Eigen::Index assignIndices(std::string const &whatToFit, Eigen::Index firstIndex) override
Positions the various parameter sets into the parameter vector, starting at firstIndex.
Frame is used to represent a coordinate system.
Frame const  & getImageFrame() const
Frame in pixels.
Interface between AstrometryFit and the combinations of Mappings from pixels to some tangent plane (a...
Handler of an actual image from a single CCD.
AstrometryMapping const  * getMapping(CcdImage const &) const override
Mapping associated to a given CcdImage.
AstrometryTransform const  & getVisitTransform(VisitIdType const &visit) const
Access to mappings.
AstrometryTransformLinear normalizeCoordinatesTransform(const Frame &frame)
Returns the transformation that maps the input frame along both axes to [-1,1].
LOG_LOGGER _log
lsst.logging instance, to be created by a subclass so that messages have consistent name.
A base class for image defects.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
#define LOGLS_DEBUG(logger, message)
VisitIdType getVisit() const
returns visit ID
CameraSys const FOCAL_PLANE
Focal plane coordinates: Position on a 2-d planar approximation to the focal plane (x,...
CcdIdType getCcdId() const
returns ccd ID
std::shared_ptr< afw::geom::SkyWcs > makeSkyWcs(CcdImage const &ccdImage) const override
Make a SkyWcs that contains this model.
Reports invalid arguments.
Eigen::Matrix2d makeCdMatrix(lsst::geom::Angle const &scale, lsst::geom::Angle const &orientation=0 *lsst::geom::degrees, bool flipX=false)
Make a WCS CD matrix.
const std::shared_ptr< AstrometryTransform const  > getSkyToTangentPlane(CcdImage const &ccdImage) const override
The mapping of sky coordinates (i.e.
virtual class needed in the abstraction of the distortion model
std::shared_ptr< SkyWcs > makeSkyWcs(daf::base::PropertySet &metadata, bool strip=false)
Construct a SkyWcs from FITS keywords.
std::shared_ptr< afw::cameraGeom::Detector > getDetector() const
Point in an unspecified spherical coordinate system.
void offsetParams(Eigen::VectorXd const &Delta) override
Dispaches the offsets after a fit step into the actual locations of parameters.
CameraSysPrefix const PIXELS
Pixel coordinates: Nominal position on the entry surface of a given detector (x, y unbinned pixels).
LSST DM logging module built on log4cxx.
void print(std::ostream &out) const override
Print a string representation of the contents of this mapping, for debugging.
rectangle with sides parallel to axes.
AstrometryTransform const  & getChipTransform(CcdIdType const chip) const
Access to mappings.