lsst.meas.astrom
g91f025aaea+e2f0a7808d
Toggle main menu visibility
Loading...
Searching...
No Matches
include
lsst
meas
astrom
ScaledPolynomialTransformFitter.h
Go to the documentation of this file.
1
// -*- LSST-C++ -*-
2
3
/*
4
* LSST Data Management System
5
* Copyright 2016 LSST/AURA
6
*
7
* This product includes software developed by the
8
* LSST Project (http://www.lsst.org/).
9
*
10
* This program is free software: you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation, either version 3 of the License, or
13
* (at your option) any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
19
*
20
* You should have received a copy of the LSST License Statement and
21
* the GNU General Public License along with this program. If not,
22
* see <http://www.lsstcorp.org/LegalNotices/>.
23
*/
24
#ifndef LSST_MEAS_ASTROM_TanSipFitter_INCLUDED
25
#define LSST_MEAS_ASTROM_TanSipFitter_INCLUDED
26
27
#include "lsst/pex/config.h"
28
#include "
lsst/geom/Box.h
"
29
#include "
lsst/geom/AffineTransform.h
"
30
#include "
lsst/afw/geom/SkyWcs.h
"
31
#include "
lsst/afw/table/Catalog.h
"
32
#include "
lsst/afw/table/BaseRecord.h
"
33
#include "
lsst/meas/astrom/PolynomialTransform.h
"
34
#include "
lsst/meas/astrom/SipTransform.h
"
35
36
namespace
lsst
{
37
namespace
meas
{
38
namespace
astrom
{
39
45
class
OutlierRejectionControl
{
46
public
:
47
OutlierRejectionControl
() :
nSigma
(3),
nClipMin
(1),
nClipMax
(5) {}
48
49
LSST_CONTROL_FIELD(
nSigma
,
double
,
"Number of sigma to clip at."
);
50
51
LSST_CONTROL_FIELD(
nClipMin
,
int
,
"Always clip at least this many matches."
);
52
53
LSST_CONTROL_FIELD(
nClipMax
,
int
,
"Never clip more than this many matches."
);
54
};
55
101
class
ScaledPolynomialTransformFitter {
102
public
:
137
static
ScaledPolynomialTransformFitter
fromMatches
(
int
maxOrder,
138
afw::table::ReferenceMatchVector
const
& matches,
139
afw::geom::SkyWcs
const
& initialWcs,
140
double
intrinsicScatter);
141
170
static
ScaledPolynomialTransformFitter
fromGrid
(
int
maxOrder,
geom::Box2D
const
& bbox,
int
nGridX,
171
int
nGridY,
ScaledPolynomialTransform
const
& toInvert);
172
185
void
fit
(
int
order = -1);
186
194
void
updateModel
();
195
208
double
updateIntrinsicScatter
();
209
219
double
getIntrinsicScatter
()
const
{
return
_intrinsicScatter; }
220
239
std::pair<double, size_t>
rejectOutliers
(
OutlierRejectionControl
const
& ctrl);
240
249
afw::table::BaseCatalog
const
&
getData
()
const
{
return
_data; }
250
260
ScaledPolynomialTransform
const
&
getTransform
()
const
{
return
_transform; }
261
265
PolynomialTransform
const
&
getPoly
()
const
{
return
_transform.getPoly(); }
266
270
geom::AffineTransform
const
&
getInputScaling
()
const
{
return
_transform.getInputScaling(); }
271
275
geom::AffineTransform
const
&
getOutputScaling
()
const
{
return
_outputScaling; }
276
277
private
:
278
class
Keys;
279
280
ScaledPolynomialTransformFitter
(
afw::table::BaseCatalog
const
& data, Keys
const
& keys,
int
maxOrder,
281
double
intrinsicScatter,
geom::AffineTransform
const
& inputScaling,
282
geom::AffineTransform
const
& outputScaling);
283
284
double
computeIntrinsicScatter()
const
;
285
286
// Normally it's not safe to use a reference as a data member because the
287
// class holding it can't control when the referenced object gets
288
// destroyed, but this points to one of two singletons (which never get
289
// destroyed).
290
Keys
const
& _keys;
291
double
_intrinsicScatter;
292
afw::table::BaseCatalog
_data;
293
geom::AffineTransform
_outputScaling;
294
ScaledPolynomialTransform
_transform;
295
// 2-d generalization of the Vandermonde matrix: evaluates polynomial at
296
// all data points when multiplied by a vector of packed polynomial
297
// coefficients.
298
Eigen::MatrixXd _vandermonde;
299
};
300
301
}
// namespace astrom
302
}
// namespace meas
303
}
// namespace lsst
304
305
#endif
// !LSST_MEAS_ASTROM_TanSipFitter_INCLUDEDtr
AffineTransform.h
BaseRecord.h
Box.h
PolynomialTransform.h
SipTransform.h
SkyWcs.h
Catalog.h
lsst::afw::geom::SkyWcs
lsst::geom::AffineTransform
lsst::geom::Box2D
lsst::meas::astrom::OutlierRejectionControl
Control object for outlier rejection in ScaledPolynomialTransformFitter.
Definition
ScaledPolynomialTransformFitter.h:45
lsst::meas::astrom::OutlierRejectionControl::nClipMax
int nClipMax
"Never clip more than this many matches." ;
Definition
ScaledPolynomialTransformFitter.h:53
lsst::meas::astrom::OutlierRejectionControl::nSigma
double nSigma
"Number of sigma to clip at." ;
Definition
ScaledPolynomialTransformFitter.h:49
lsst::meas::astrom::OutlierRejectionControl::OutlierRejectionControl
OutlierRejectionControl()
Definition
ScaledPolynomialTransformFitter.h:47
lsst::meas::astrom::OutlierRejectionControl::nClipMin
int nClipMin
"Always clip at least this many matches." ;
Definition
ScaledPolynomialTransformFitter.h:51
lsst::meas::astrom::PolynomialTransform
A 2-d coordinate transform represented by a pair of standard polynomials (one for each coordinate).
Definition
PolynomialTransform.h:45
lsst::meas::astrom::ScaledPolynomialTransformFitter
A fitter class for scaled polynomial transforms.
Definition
ScaledPolynomialTransformFitter.h:101
lsst::meas::astrom::ScaledPolynomialTransformFitter::fromMatches
static ScaledPolynomialTransformFitter fromMatches(int maxOrder, afw::table::ReferenceMatchVector const &matches, afw::geom::SkyWcs const &initialWcs, double intrinsicScatter)
Initialize a fit from intermediate world coordinates to pixels using source/reference matches.
Definition
ScaledPolynomialTransformFitter.cc:127
lsst::meas::astrom::ScaledPolynomialTransformFitter::getPoly
PolynomialTransform const & getPoly() const
Return the polynomial part of the best-fit transform.
Definition
ScaledPolynomialTransformFitter.h:265
lsst::meas::astrom::ScaledPolynomialTransformFitter::rejectOutliers
std::pair< double, size_t > rejectOutliers(OutlierRejectionControl const &ctrl)
Mark outliers in the data catalog using sigma clipping.
Definition
ScaledPolynomialTransformFitter.cc:367
lsst::meas::astrom::ScaledPolynomialTransformFitter::getOutputScaling
geom::AffineTransform const & getOutputScaling() const
Return the output scaling transform that maps output data points to [-1, 1].
Definition
ScaledPolynomialTransformFitter.h:275
lsst::meas::astrom::ScaledPolynomialTransformFitter::getIntrinsicScatter
double getIntrinsicScatter() const
Return the current estimate of the intrinsic scatter.
Definition
ScaledPolynomialTransformFitter.h:219
lsst::meas::astrom::ScaledPolynomialTransformFitter::updateModel
void updateModel()
Update the 'model' field in the data catalog using the current best- fit transform.
Definition
ScaledPolynomialTransformFitter.cc:291
lsst::meas::astrom::ScaledPolynomialTransformFitter::getInputScaling
geom::AffineTransform const & getInputScaling() const
Return the input scaling transform that maps input data points to [-1, 1].
Definition
ScaledPolynomialTransformFitter.h:270
lsst::meas::astrom::ScaledPolynomialTransformFitter::fit
void fit(int order=-1)
Perform a linear least-squares fit of the polynomial coefficients.
Definition
ScaledPolynomialTransformFitter.cc:200
lsst::meas::astrom::ScaledPolynomialTransformFitter::getData
afw::table::BaseCatalog const & getData() const
Return a catalog of data points and model values for diagnostic purposes.
Definition
ScaledPolynomialTransformFitter.h:249
lsst::meas::astrom::ScaledPolynomialTransformFitter::updateIntrinsicScatter
double updateIntrinsicScatter()
Infer the intrinsic scatter in the offset between the data points and the best-fit model,...
Definition
ScaledPolynomialTransformFitter.cc:297
lsst::meas::astrom::ScaledPolynomialTransformFitter::getTransform
ScaledPolynomialTransform const & getTransform() const
Return the best-fit transform.
Definition
ScaledPolynomialTransformFitter.h:260
lsst::meas::astrom::ScaledPolynomialTransformFitter::fromGrid
static ScaledPolynomialTransformFitter fromGrid(int maxOrder, geom::Box2D const &bbox, int nGridX, int nGridY, ScaledPolynomialTransform const &toInvert)
Initialize a fit that inverts an existing transform by evaluating and fitting to points on a grid.
Definition
ScaledPolynomialTransformFitter.cc:150
lsst::meas::astrom::ScaledPolynomialTransform
A 2-d coordinate transform represented by a lazy composition of an AffineTransform,...
Definition
PolynomialTransform.h:157
lsst::afw::table::ReferenceMatchVector
std::vector< ReferenceMatch > ReferenceMatchVector
lsst::afw::table::BaseCatalog
CatalogT< BaseRecord > BaseCatalog
lsst::meas::astrom
Definition
polynomialUtils.h:32
lsst::meas
Definition
polynomialUtils.h:31
lsst
std::pair
Generated on
for lsst.meas.astrom by
1.17.0