-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wraps distortion code in XYTransform
The new camera objects use XYTransforms to map from one coordinate system to another. This means that the DistEst distortion code needs to be wrapped up in an XYTransform. The XYTransform is exposed in python by adding an entry to the XYTransformRegistry.
- Loading branch information
Showing
9 changed files
with
157 additions
and
127 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// -*- lsst-c++ -*- | ||
|
||
/* | ||
* LSST Data Management System | ||
* Copyright 2008-2015 LSST Corporation. | ||
* | ||
* This product includes software developed by the | ||
* LSST Project (http://www.lsst.org/). | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the LSST License Statement and | ||
* the GNU General Public License along with this program. If not, | ||
* see <http://www.lsstcorp.org/LegalNotices/>. | ||
*/ | ||
|
||
/** | ||
* \file | ||
* @brief Class wrapping the distEst distortion class to present the XYTransform API | ||
*/ | ||
#ifndef LSST_OBS_SUBARU_DISTESTXYTRANSFORM_H | ||
#define LSST_OBS_SUBARU_DISTESTXYTRANSFORM_H | ||
|
||
#include "lsst/daf/base.h" | ||
#include "lsst/afw/geom/AffineTransform.h" | ||
#include "lsst/afw/geom/Angle.h" | ||
#include "lsst/afw/geom/XYTransform.h" | ||
|
||
namespace lsst { | ||
namespace obs { | ||
namespace subaru { | ||
|
||
|
||
/** | ||
* @brief An XYTransform to wrap the distEst distortion class for inclusion in an XYTransformMap. | ||
*/ | ||
class DistEstXYTransform : public afw::geom::XYTransform | ||
{ | ||
public: | ||
DistEstXYTransform(afw::geom::Angle const &elevation, double const plateScale); | ||
virtual PTR(afw::geom::XYTransform) clone() const; | ||
virtual Point2D forwardTransform(afw::geom::Point2D const &point) const; | ||
virtual Point2D reverseTransformIterative(afw::geom::Point2D const &point) const; | ||
virtual Point2D reverseTransform(afw::geom::Point2D const &point) const; | ||
|
||
private: | ||
afw::geom::Angle _elevation; | ||
double _plateScale; | ||
}; | ||
|
||
|
||
|
||
}}} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from hscMapper import * | ||
from .hscMapper import * | ||
from .transformRegistry import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from lsst.afw.geom import xyTransformRegistry | ||
import lsst.afw.geom as afwGeom | ||
from lsst.pex.config import Config, Field | ||
from lsst.obs.subaru.subaruLib import DistEstXYTransform | ||
__all__ = ["xyTransformRegistry"] | ||
|
||
class DistEstXYTransformConfig(Config): | ||
elevation = Field( | ||
doc = """Elevation in degrees to use in constructing the transform""", | ||
dtype = float, | ||
default = 45., | ||
) | ||
plateScale = Field( | ||
doc = """Platescale in arcsec/mm""", | ||
dtype = float, | ||
) | ||
def makeDistEstTransform(config): | ||
""" Make a DistEst XYTransform object | ||
@param[in] config: pexConfig.Config object containing the elevation and plateScale needed to construct the | ||
transform | ||
""" | ||
elevation = afwGeom.Angle(config.elevation, afwGeom.degrees) | ||
return DistEstXYTransform(elevation, config.plateScale) | ||
makeDistEstTransform.ConfigClass = DistEstXYTransformConfig | ||
xyTransformRegistry.register("distEst", makeDistEstTransform) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// -*- lsst-c++ -*- | ||
|
||
/* | ||
* LSST Data Management System | ||
* Copyright 2008-2015 LSST Corporation. | ||
* | ||
* This product includes software developed by the | ||
* LSST Project (http://www.lsst.org/). | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the LSST License Statement and | ||
* the GNU General Public License along with this program. If not, | ||
* see <http://www.lsstcorp.org/LegalNotices/>. | ||
*/ | ||
|
||
#include "lsst/obs/subaru/DistEstXYTransform.h" | ||
#include "hsc/meas/match/distest.h" | ||
#include "boost/make_shared.hpp" | ||
|
||
namespace lsst { | ||
namespace obs { | ||
namespace subaru { | ||
|
||
DistEstXYTransform::DistEstXYTransform(afw::geom::Angle const &elevation, double const plateScale) | ||
: afw::geom::XYTransform(), _elevation(elevation), _plateScale(afw::geom::arcsecToRad(plateScale)) | ||
{ } | ||
|
||
PTR(afw::geom::XYTransform) DistEstXYTransform::clone() const | ||
{ | ||
return boost::make_shared<DistEstXYTransform> (_elevation, afw::geom::radToArcsec(_plateScale)); | ||
} | ||
|
||
afw::geom::Point2D DistEstXYTransform::forwardTransform(afw::geom::Point2D const &point) const | ||
{ | ||
float x, y; | ||
hsc::meas::match::getUndistortedPosition(point.getX(), point.getY(), &x, &y, _elevation.asDegrees()); | ||
return afw::geom::Point2D(x*_plateScale,y*_plateScale); | ||
} | ||
|
||
afw::geom::Point2D DistEstXYTransform::reverseTransformIterative(afw::geom::Point2D const &point) const | ||
{ | ||
float x, y; | ||
hsc::meas::match::getDistortedPositionIterative(point.getX(), point.getY(), &x, &y, _elevation.asDegrees()); | ||
return afw::geom::Point2D(x/_plateScale,y/_plateScale); | ||
} | ||
|
||
afw::geom::Point2D DistEstXYTransform::reverseTransform(afw::geom::Point2D const &point) const | ||
{ | ||
float x, y; | ||
hsc::meas::match::getDistortedPosition(point.getX(), point.getY(), &x, &y, _elevation.asDegrees()); | ||
return afw::geom::Point2D(x/_plateScale,y/_plateScale); | ||
} | ||
|
||
}}} |
This file was deleted.
Oops, something went wrong.
9ee4c04
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work? This seems to be feeding positions into distEst in units of mm, while I believe distEst is expecting pixels.