Skip to content

Commit

Permalink
post review updates
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Nov 29, 2018
1 parent 2db888c commit fb940c7
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 37 deletions.
14 changes: 8 additions & 6 deletions include/lsst/jointcal/CcdImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,19 @@ class CcdImage {
*/
jointcal::Point const &getCommonTangentPoint() const { return _commonTangentPoint; }

std::shared_ptr<Gtransfo> const getPixToCommonTangentPlane() const { return _pixToCommonTangentPlane; }
std::shared_ptr<Gtransfo> const getPixelToCommonTangentPlane() const {
return _pixelToCommonTangentPlane;
}

std::shared_ptr<Gtransfo> const getCommonTangentPlaneToTangentPlane() const {
return _commonTangentPlaneToTangentPlane;
}

std::shared_ptr<Gtransfo> const getTangentPlaneToCommonTangentPlane() const {
return _TangentPlaneToCommonTangentPlane;
return _tangentPlaneToCommonTangentPlane;
}

std::shared_ptr<Gtransfo> const getPixToTangentPlane() const { return _pixToTangentPlane; }
std::shared_ptr<Gtransfo> const getPixelToTangentPlane() const { return _pixelToTangentPlane; }

std::shared_ptr<Gtransfo> const getSkyToTangentPlane() const { return _skyToTangentPlane; }

Expand Down Expand Up @@ -202,9 +204,9 @@ class CcdImage {
// The following ones should probably be mostly removed.
// go from CommonTangentPlane to this tangent plane.
std::shared_ptr<Gtransfo> _commonTangentPlaneToTangentPlane;
std::shared_ptr<Gtransfo> _TangentPlaneToCommonTangentPlane; // reverse one
std::shared_ptr<Gtransfo> _pixToCommonTangentPlane; // pixels -> CTP
std::shared_ptr<Gtransfo> _pixToTangentPlane;
std::shared_ptr<Gtransfo> _tangentPlaneToCommonTangentPlane; // reverse one
std::shared_ptr<Gtransfo> _pixelToCommonTangentPlane; // pixels -> CTP
std::shared_ptr<Gtransfo> _pixelToTangentPlane;

std::shared_ptr<Gtransfo> _skyToTangentPlane;

Expand Down
10 changes: 5 additions & 5 deletions include/lsst/jointcal/Gtransfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ class BaseTanWcs : public Gtransfo {

//! Get a transform from pixels to tangent plane (degrees)
//! This is a linear transform plus the effects of the correction
virtual GtransfoPoly getPixToTangentPlane() const = 0;
virtual GtransfoPoly getPixelToTangentPlane() const = 0;

//! Transform from pixels to tangent plane (degrees)
virtual void pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane,
Expand All @@ -588,8 +588,8 @@ class BaseTanWcs : public Gtransfo {
~BaseTanWcs();

protected:
GtransfoLin linPixToTan; // transform from pixels to tangent plane (degrees)
// a linear approximation centered at the pixel and sky origins
GtransfoLin linPixelToTan; // transform from pixels to tangent plane (degrees)
// a linear approximation centered at the pixel and sky origins
std::unique_ptr<GtransfoPoly> corr;
double ra0, dec0; // sky origin (radians)
double cos0, sin0; // cos(dec0), sin(dec0)
Expand All @@ -607,7 +607,7 @@ class TanPixelToRaDec : public BaseTanWcs {
const GtransfoPoly *corrections = nullptr);

//! the transformation from pixels to tangent plane (degrees)
GtransfoPoly getPixToTangentPlane() const;
GtransfoPoly getPixelToTangentPlane() const;

//! transforms from pixel space to tangent plane (degrees)
virtual void pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane,
Expand Down Expand Up @@ -649,7 +649,7 @@ class TanSipPixelToRaDec : public BaseTanWcs {
const GtransfoPoly *corrections = nullptr);

//! the transformation from pixels to tangent plane (degrees)
GtransfoPoly getPixToTangentPlane() const;
GtransfoPoly getPixelToTangentPlane() const;

//! transforms from pixel space to tangent plane (degrees)
virtual void pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane,
Expand Down
6 changes: 3 additions & 3 deletions src/Associations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void Associations::associateCatalogs(const double matchCutInArcSec, const bool u
if (!useFittedList) fittedStarList.clear();

for (auto &ccdImage : ccdImageList) {
std::shared_ptr<Gtransfo> toCommonTangentPlane = ccdImage->getPixToCommonTangentPlane();
std::shared_ptr<Gtransfo> toCommonTangentPlane = ccdImage->getPixelToCommonTangentPlane();

// Clear the catalog to fit and copy the whole catalog into it.
// This allows reassociating from scratch after a fit.
Expand Down Expand Up @@ -250,7 +250,7 @@ const lsst::afw::geom::Box2D Associations::getRaDecBBox() {
Frame tangentPlaneFrame;

for (auto const &ccdImage : ccdImageList) {
Frame CTPFrame = ccdImage->getPixToCommonTangentPlane()->apply(ccdImage->getImageFrame(), false);
Frame CTPFrame = ccdImage->getPixelToCommonTangentPlane()->apply(ccdImage->getImageFrame(), false);
if (tangentPlaneFrame.getArea() == 0)
tangentPlaneFrame = CTPFrame;
else
Expand Down Expand Up @@ -351,7 +351,7 @@ void Associations::normalizeFittedStars() const {

// Iterate over measuredStars to add their values into their fittedStars
for (auto const &ccdImage : ccdImageList) {
std::shared_ptr<Gtransfo> toCommonTangentPlane = ccdImage->getPixToCommonTangentPlane();
std::shared_ptr<Gtransfo> toCommonTangentPlane = ccdImage->getPixelToCommonTangentPlane();
MeasuredStarList &catalog = ccdImage->getCatalogForFit();
for (auto &mi : catalog) {
auto fittedStar = mi->getFittedStar();
Expand Down
6 changes: 3 additions & 3 deletions src/CcdImage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,18 @@ void CcdImage::setCommonTangentPoint(Point const &commonTangentPoint) {
actually goes through TP */
GtransfoLin identity;
TanRaDecToPixel raDecToTangentPlane(identity, tangentPoint);
_pixToTangentPlane = gtransfoCompose(raDecToTangentPlane, *_readWcs);
_pixelToTangentPlane = gtransfoCompose(raDecToTangentPlane, *_readWcs);
TanPixelToRaDec CommonTangentPlane2RaDec(identity, commonTangentPoint);
_commonTangentPlaneToTangentPlane = gtransfoCompose(raDecToTangentPlane, CommonTangentPlane2RaDec);

// jump from one TP to an other:
TanRaDecToPixel raDecToCommonTangentPlane(identity, commonTangentPoint);
TanPixelToRaDec TangentPlaneToRaDec(identity, tangentPoint);
_TangentPlaneToCommonTangentPlane = gtransfoCompose(raDecToCommonTangentPlane, TangentPlaneToRaDec);
_tangentPlaneToCommonTangentPlane = gtransfoCompose(raDecToCommonTangentPlane, TangentPlaneToRaDec);
_skyToTangentPlane.reset(new TanRaDecToPixel(identity, tangentPoint));

// this one is needed for matches :
_pixToCommonTangentPlane = gtransfoCompose(raDecToCommonTangentPlane, *_readWcs);
_pixelToCommonTangentPlane = gtransfoCompose(raDecToCommonTangentPlane, *_readWcs);
}
} // namespace jointcal
} // namespace lsst
38 changes: 19 additions & 19 deletions src/Gtransfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1300,10 +1300,10 @@ static double deg2rad(double degree) { return degree * M_PI / 180.; }
static double rad2deg(double rad) { return rad * 180. / M_PI; }

/************* WCS transfo ******************/
/************** LinPixToTan *******************/
/************** LinPixelToTan *******************/

/* Implementation note : it seemed wise to incorporate
the radians to degreess convertion into the linPixToTan
the radians to degreess convertion into the linPixelToTan
part (right in the constructor), and to do the
opposite operation in the LinPart routine.
When I was coding the fit, I realized that it was a
Expand All @@ -1319,8 +1319,8 @@ static double rad2deg(double rad) { return rad * 180. / M_PI; }
*/
BaseTanWcs::BaseTanWcs(GtransfoLin const &pixToTan, Point const &tangentPoint,
const GtransfoPoly *corrections) {
// the angles returned by linPixToTan should be in degrees.
linPixToTan = pixToTan;
// the angles returned by linPixelToTan should be in degrees.
linPixelToTan = pixToTan;
ra0 = deg2rad(tangentPoint.x);
dec0 = deg2rad(tangentPoint.y);
cos0 = std::cos(dec0);
Expand All @@ -1339,7 +1339,7 @@ BaseTanWcs::BaseTanWcs(const BaseTanWcs &original) : Gtransfo() {
}

void BaseTanWcs::operator=(const BaseTanWcs &original) {
linPixToTan = original.linPixToTan;
linPixelToTan = original.linPixelToTan;
ra0 = original.ra0;
dec0 = original.dec0;
cos0 = std::cos(dec0);
Expand Down Expand Up @@ -1376,7 +1376,7 @@ void BaseTanWcs::apply(const double xIn, const double yIn, double &xOut, double

Point BaseTanWcs::getTangentPoint() const { return Point(rad2deg(ra0), rad2deg(dec0)); }

GtransfoLin BaseTanWcs::getLinPart() const { return linPixToTan; }
GtransfoLin BaseTanWcs::getLinPart() const { return linPixelToTan; }

void BaseTanWcs::setCorrections(std::unique_ptr<GtransfoPoly> corrections) { corr = std::move(corrections); }

Expand All @@ -1388,7 +1388,7 @@ Point BaseTanWcs::getCrPix() const {
so that CrPix is the point which transforms to (0,0)
*/
const GtransfoLin inverse = linPixToTan.inverted();
const GtransfoLin inverse = linPixelToTan.inverted();
return Point(inverse.Dx(), inverse.Dy());
}

Expand Down Expand Up @@ -1431,7 +1431,7 @@ std::unique_ptr<Gtransfo> TanPixelToRaDec::composeAndReduce(GtransfoLin const &r

TanPixelToRaDec TanPixelToRaDec::operator*(GtransfoLin const &right) const {
TanPixelToRaDec result(*this);
result.linPixToTan = result.linPixToTan * right;
result.linPixelToTan = result.linPixelToTan * right;
return result;
}

Expand All @@ -1454,17 +1454,17 @@ std::unique_ptr<Gtransfo> TanPixelToRaDec::inverseTransfo(const double precision
return std::unique_ptr<Gtransfo>(new GtransfoInverse(this, precision, region));
}

GtransfoPoly TanPixelToRaDec::getPixToTangentPlane() const {
GtransfoPoly TanPixelToRaDec::getPixelToTangentPlane() const {
if (corr)
return (*corr) * linPixToTan;
return (*corr) * linPixelToTan;
else
return linPixToTan;
return linPixelToTan;
}

void TanPixelToRaDec::pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane,
double &yTangentPlane) const {
// xTangentPlane, yTangentPlane in degrees.
linPixToTan.apply(xPixel, yPixel, xTangentPlane, yTangentPlane);
linPixelToTan.apply(xPixel, yPixel, xTangentPlane, yTangentPlane);
if (corr) {
double xtmp = xTangentPlane;
double ytmp = yTangentPlane;
Expand All @@ -1477,7 +1477,7 @@ std::unique_ptr<Gtransfo> TanPixelToRaDec::clone() const {
}

void TanPixelToRaDec::dump(ostream &stream) const {
stream << " TanPixelToRaDec, lin part :" << endl << linPixToTan;
stream << " TanPixelToRaDec, lin part :" << endl << linPixelToTan;
Point tp = getTangentPoint();
stream << " tangent point " << tp.x << ' ' << tp.y << endl;
Point crpix = getCrPix();
Expand Down Expand Up @@ -1523,11 +1523,11 @@ std::unique_ptr<Gtransfo> TanSipPixelToRaDec::inverseTransfo(const double precis
return std::unique_ptr<Gtransfo>(new GtransfoInverse(this, precision, region));
}

GtransfoPoly TanSipPixelToRaDec::getPixToTangentPlane() const {
GtransfoPoly TanSipPixelToRaDec::getPixelToTangentPlane() const {
if (corr)
return GtransfoPoly(linPixToTan) * (*corr);
return GtransfoPoly(linPixelToTan) * (*corr);
else
return linPixToTan;
return linPixelToTan;
}

void TanSipPixelToRaDec::pixToTangentPlane(double xPixel, double yPixel, double &xTangentPlane,
Expand All @@ -1536,17 +1536,17 @@ void TanSipPixelToRaDec::pixToTangentPlane(double xPixel, double yPixel, double
if (corr) {
double xtmp, ytmp;
corr->apply(xPixel, yPixel, xtmp, ytmp);
linPixToTan.apply(xtmp, ytmp, xTangentPlane, yTangentPlane);
linPixelToTan.apply(xtmp, ytmp, xTangentPlane, yTangentPlane);
} else
linPixToTan.apply(xPixel, yPixel, xTangentPlane, yTangentPlane);
linPixelToTan.apply(xPixel, yPixel, xTangentPlane, yTangentPlane);
}

std::unique_ptr<Gtransfo> TanSipPixelToRaDec::clone() const {
return std::unique_ptr<Gtransfo>(new TanSipPixelToRaDec(getLinPart(), getTangentPoint(), corr.get()));
}

void TanSipPixelToRaDec::dump(ostream &stream) const {
stream << " TanSipPixelToRaDec, lin part :" << endl << linPixToTan;
stream << " TanSipPixelToRaDec, lin part :" << endl << linPixelToTan;
Point tp = getTangentPoint();
stream << " tangent point " << tp.x << ' ' << tp.y << endl;
Point crpix = getCrPix();
Expand Down
2 changes: 1 addition & 1 deletion src/SimpleAstrometryModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ SimpleAstrometryModel::SimpleAstrometryModel(CcdImageList const &ccdImageList,
const Frame &frame = im.getImageFrame();
GtransfoLin shiftAndNormalize = normalizeCoordinatesTransfo(frame);
if (initFromWcs) {
pol = GtransfoPoly(im.getPixToTangentPlane().get(), frame, order);
pol = GtransfoPoly(im.getPixelToTangentPlane().get(), frame, order);
pol = pol * shiftAndNormalize.inverted();
}
_myMap[im.getHashKey()] =
Expand Down

0 comments on commit fb940c7

Please sign in to comment.