LSSTApplications
19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
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.