LSST Applications g070148d5b3+33e5256705,g0d53e28543+25c8b88941,g0da5cf3356+2dd1178308,g1081da9e2a+62d12e78cb,g17e5ecfddb+7e422d6136,g1c76d35bf8+ede3a706f7,g295839609d+225697d880,g2e2c1a68ba+cc1f6f037e,g2ffcdf413f+853cd4dcde,g38293774b4+62d12e78cb,g3b44f30a73+d953f1ac34,g48ccf36440+885b902d19,g4b2f1765b6+7dedbde6d2,g5320a0a9f6+0c5d6105b6,g56b687f8c9+ede3a706f7,g5c4744a4d9+ef6ac23297,g5ffd174ac0+0c5d6105b6,g6075d09f38+66af417445,g667d525e37+2ced63db88,g670421136f+2ced63db88,g71f27ac40c+2ced63db88,g774830318a+463cbe8d1f,g7876bc68e5+1d137996f1,g7985c39107+62d12e78cb,g7fdac2220c+0fd8241c05,g96f01af41f+368e6903a7,g9ca82378b8+2ced63db88,g9d27549199+ef6ac23297,gabe93b2c52+e3573e3735,gb065e2a02a+3dfbe639da,gbc3249ced9+0c5d6105b6,gbec6a3398f+0c5d6105b6,gc9534b9d65+35b9f25267,gd01420fc67+0c5d6105b6,geee7ff78d7+a14128c129,gf63283c776+ede3a706f7,gfed783d017+0c5d6105b6,w.2022.47
LSST Data Management Base Package
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions
lsst::jointcal Namespace Reference

Namespaces

namespace  cameraGeometry
 
namespace  check_logged_chi2
 
namespace  jointcal
 
namespace  testUtils
 
namespace  version
 

Classes

class  Associations
 The class that implements the relations between MeasuredStar and FittedStar. More...
 
class  AstrometryFit
 Class that handles the astrometric least squares problem. More...
 
class  AstrometryMapping
 virtual class needed in the abstraction of the distortion model More...
 
class  AstrometryModel
 Interface between AstrometryFit and the combinations of Mappings from pixels to some tangent plane (aka distortions). More...
 
class  AstrometryTransform
 a virtual (interface) class for geometric transformations. More...
 
class  AstrometryTransformComposition
 Private class to handle AstrometryTransform compositions (i.e. More...
 
class  AstrometryTransformIdentity
 A do-nothing transformation. It anyway has dummy routines to mimick a AstrometryTransform. More...
 
class  AstrometryTransformInverse
 
class  AstrometryTransformLinear
 implements the linear transformations (6 real coefficients). More...
 
class  AstrometryTransformLinearRot
 just here to provide a specialized constructor, and fit. More...
 
class  AstrometryTransformLinearScale
 just here to provide specialized constructors. AstrometryTransformLinear fit routine. More...
 
class  AstrometryTransformLinearShift
 just here to provide a specialized constructor, and fit. More...
 
class  AstrometryTransformPolynomial
 Polynomial transformation class. More...
 
class  AstrometryTransformSkyWcs
 A AstrometryTransform that holds a SkyWcs. More...
 
class  BaseStar
 The base class for handling stars. Used by all matching routines. More...
 
class  BaseTanWcs
 
class  CcdImage
 Handler of an actual image from a single CCD. More...
 
struct  CcdImageKey
 For hashing a ccdImage: the pair of (visit, ccd) IDs should be unique to each ccdImage. More...
 
class  Chi2Accumulator
 Base class for Chi2Statistic and Chi2List, to allow addEntry inside Fitter for either class. More...
 
class  Chi2List
 Structure to accumulate the chi2 contributions per each star (to help find outliers). More...
 
struct  Chi2Star
 
class  Chi2Statistic
 Simple structure to accumulate chi2 and ndof. More...
 
class  ChipVisitAstrometryMapping
 The mapping with two transforms in a row. More...
 
class  ChipVisitFluxMapping
 
class  ChipVisitMagnitudeMapping
 
class  ChipVisitPhotometryMapping
 A two-level photometric transform: one for the ccd and one for the visit. More...
 
class  ConstrainedAstrometryModel
 A multi-component model, fitting mappings for sensors and visits simultaneously. More...
 
class  ConstrainedFluxModel
 
class  ConstrainedMagnitudeModel
 
class  ConstrainedPhotometryModel
 Photometry model with constraints, \(M(x,y) = M_CCD(x,y)*M_visit(u,v)\). More...
 
class  FastFinder
 This is an auxillary class for matching objects from starlists. More...
 
class  FatPoint
 A Point with uncertainties. More...
 
class  FittedStar
 FittedStars are objects whose position or flux is going to be fitted, and which come from the association of multiple MeasuredStars. More...
 
class  FittedStarList
 A list of FittedStar s. Such a list is typically constructed by Associations. More...
 
class  FitterBase
 Base class for fitters. More...
 
class  FluxTransformChebyshev
 nth-order 2d Chebyshev photometry transform, times the input flux. More...
 
class  FluxTransformSpatiallyInvariant
 Photometric offset independent of position, defined as (fluxMag0)^-1. More...
 
class  Frame
 rectangle with sides parallel to axes. More...
 
class  Histo2d
 
class  IdentityProjectionHandler
 The simplest implementation of ProjectionHandler. More...
 
struct  JointcalControl
 
class  MagnitudeTransformChebyshev
 nth-order 2d Chebyshev photometry transform, plus the input flux. More...
 
class  MagnitudeTransformSpatiallyInvariant
 Photometric offset independent of position, defined as -2.5 * log(flux / fluxMag0). More...
 
struct  MatchConditions
 Parameters to be provided to combinatorial searches. More...
 
class  MeasuredStar
 Sources measured on images. More...
 
class  MeasuredStarList
 A list of MeasuredStar. They are usually filled in Associations::createCcdImage. More...
 
class  OneTPPerVisitHandler
 A projection handler in which all CCDs from the same visit have the same tangent point. More...
 
class  PhotometryFit
 Class that handles the photometric least squares problem. More...
 
class  PhotometryMapping
 A mapping containing a single photometryTransform. More...
 
class  PhotometryMappingBase
 Relates transform(s) to their position in the fitting matrix and allows interaction with the transform(s). More...
 
class  PhotometryModel
 
class  PhotometryTransform
 A photometric transform, defined in terms of the input flux or magnitude. More...
 
class  PhotometryTransformChebyshev
 nth-order 2d Chebyshev photometry transform. More...
 
class  PhotometryTransformSpatiallyInvariant
 Photometry offset independent of position. More...
 
class  Point
 A point in a plane. More...
 
class  PolyXY
 
struct  ProjectionHandler
 This is a virtual class that allows a lot of freedom in the choice of the projection from "Sky" (where coodinates are reported) to tangent plane (where they are compared to transformed measurements) More...
 
class  ProperMotion
 Proper motion data for a reference star or fitted star. More...
 
class  RefStar
 Objects used as position/flux anchors (e.g. More...
 
class  RefStarList
 
struct  Segment
 
class  SegmentList
 
struct  SegmentPair
 
class  SimpleAstrometryMapping
 Class for a simple mapping implementing a generic AstrometryTransform. More...
 
class  SimpleAstrometryModel
 A model where there is one independent transform per CcdImage. More...
 
class  SimpleFluxModel
 
class  SimpleMagnitudeModel
 
class  SimplePhotometryModel
 Photometric response model which has a single photometric factor per CcdImage. More...
 
class  SimplePolyMapping
 Mapping implementation for a polynomial transformation. More...
 
class  SparseHisto4d
 A class to histogram in 4 dimensions. More...
 
class  StarList
 std::lists of Stars. More...
 
class  StarMatch
 A hanger for star associations. More...
 
class  StarMatchList
 
class  TanPixelToRaDec
 The transformation that handles pixels to sideral transformations (Gnomonic, possibly with polynomial distortions). More...
 
class  TanRaDecToPixel
 This one is the Tangent Plane (called gnomonic) projection (from celestial sphere to tangent plane) More...
 
class  TanSipPixelToRaDec
 Implements the (forward) SIP distorsion scheme. More...
 
class  TripletList
 
class  UserTransform
 A run-time transform that allows users to define a AstrometryTransform with minimal coding (just the apply routine). More...
 

Typedefs

using RefFluxMapType = std::map< std::string, std::vector< double > >
 
using AstrometryTransformFun = void(const double, const double, double &, double &, const void *)
 signature of the user-provided routine that actually does the coordinate transform for UserTransform. More...
 
using BaseStarList = StarList< BaseStar >
 
using BaseStarCIterator = BaseStarList::const_iterator
 
using BaseStarIterator = BaseStarList::iterator
 
using CcdImageList = std::list< std::shared_ptr< CcdImage > >
 
using VisitIdType = long
 
using CcdIdType = int
 
using FittedStarCIterator = FittedStarList::const_iterator
 
using FittedStarIterator = FittedStarList::iterator
 
using MeasuredStarCIterator = MeasuredStarList::const_iterator
 
using MeasuredStarIterator = MeasuredStarList::iterator
 
using RefStarCIterator = RefStarList::const_iterator
 
using RefStarIterator = RefStarList::iterator
 
using StarMatchIterator = ::std::list< StarMatch >::iterator
 
using StarMatchCIterator = ::std::list< StarMatch >::const_iterator
 
using Trip = Eigen::Triplet< double >
 
using Iterator = FastFinder::Iterator
 
using SegmentIterator = std::list< Segment >::iterator
 
using SegmentCIterator = std::list< Segment >::const_iterator
 
using SegmentPairList = std::list< SegmentPair >
 
using SegmentPairListIterator = SegmentPairList::iterator
 
using SegmentPairListCIterator = SegmentPairList::const_iterator
 
using SolList = std::list< std::unique_ptr< StarMatchList > >
 

Enumerations

enum class  MinimizeResult { Converged , Chi2Increased , Failed , NonFinite }
 Return value of minimize() More...
 

Functions

std::ostreamoperator<< (std::ostream &stream, AstrometryMapping const &mapping)
 
std::ostreamoperator<< (std::ostream &stream, AstrometryModel const &model)
 
std::ostreamoperator<< (std::ostream &stream, AstrometryTransform const &transform)
 
std::unique_ptr< AstrometryTransformcompose (AstrometryTransform const &left, AstrometryTransform const &right)
 Returns a pointer to a composition of transforms, representing left(right()). More...
 
std::unique_ptr< AstrometryTransformcompose (AstrometryTransform const &left, AstrometryTransformIdentity const &right)
 
bool isIntegerShift (const AstrometryTransform *transform)
 Shorthand test to tell if a transform is a simple integer shift. More...
 
std::shared_ptr< AstrometryTransformPolynomialinversePolyTransform (AstrometryTransform const &forward, Frame const &domain, double precision, std::size_t maxOrder=9, std::size_t nSteps=50)
 Approximate the inverse by a polynomial, to some precision. More...
 
AstrometryTransformLinear normalizeCoordinatesTransform (const Frame &frame)
 Returns the transformation that maps the input frame along both axes to [-1,1]. More...
 
std::unique_ptr< AstrometryTransformastrometryTransformRead (const std::string &fileName)
 The virtual constructor from a file. More...
 
std::unique_ptr< AstrometryTransformastrometryTransformRead (std::istream &s)
 The virtual constructor from a file. More...
 
std::ostreamoperator<< (std::ostream &out, CcdImageKey const &key)
 
BaseStarListFitted2Base (FittedStarList &This)
 
BaseStarListFitted2Base (FittedStarList *This)
 
const BaseStarListFitted2Base (const FittedStarList &This)
 
const BaseStarListFitted2Base (const FittedStarList *This)
 
std::unique_ptr< StarMatchListmatchSearchRotShift (BaseStarList &list1, BaseStarList &list2, const MatchConditions &conditions)
 searches a geometrical transformation that goes from list1 to list2. More...
 
std::unique_ptr< StarMatchListmatchSearchRotShiftFlip (BaseStarList &list1, BaseStarList &list2, const MatchConditions &conditions)
 same as above but searches also a flipped solution. More...
 
std::unique_ptr< StarMatchListlistMatchCollect (const BaseStarList &list1, const BaseStarList &list2, const AstrometryTransform *guess, double maxDist)
 assembles star matches. More...
 
std::unique_ptr< StarMatchListlistMatchCollect (const BaseStarList &list1, const BaseStarList &list2, double maxDist)
 same as before except that the transform is the identity More...
 
std::unique_ptr< AstrometryTransformLinearlistMatchupShift (const BaseStarList &list1, const BaseStarList &list2, const AstrometryTransform &transform, double maxShift, double binSize=0)
 searches for a 2 dimensional shift using a very crude histogram method. More...
 
std::unique_ptr< AstrometryTransformlistMatchCombinatorial (const BaseStarList &list1, const BaseStarList &list2, const MatchConditions &conditions=MatchConditions())
 
std::unique_ptr< AstrometryTransformlistMatchRefine (const BaseStarList &list1, const BaseStarList &list2, std::unique_ptr< AstrometryTransform > transform, int maxOrder=3)
 
BaseStarListMeasured2Base (MeasuredStarList &This)
 
BaseStarListMeasured2Base (MeasuredStarList *This)
 
const BaseStarListMeasured2Base (const MeasuredStarList &This)
 
const BaseStarListMeasured2Base (const MeasuredStarList *This)
 
std::ostreamoperator<< (std::ostream &stream, const Point &point)
 
std::ostreamoperator<< (std::ostream &stream, ProjectionHandler const &projectionHandler)
 
BaseStarListRef2Base (RefStarList &This)
 
BaseStarListRef2Base (RefStarList *This)
 
const BaseStarListRef2Base (const RefStarList &This)
 
const BaseStarListRef2Base (const RefStarList *This)
 
template<class Star >
std::ostreamoperator<< (std::ostream &stream, const StarList< Star > &list)
 enables More...
 
bool compareStar1 (const StarMatch &one, const StarMatch &two)
 
bool sameStar1 (const StarMatch &one, const StarMatch &two)
 
bool compareStar2 (const StarMatch &one, const StarMatch &two)
 
bool sameStar2 (const StarMatch &one, const StarMatch &two)
 
std::ostreamoperator<< (std::ostream &stream, const StarMatch &match)
 
std::ostreamoperator<< (std::ostream &stream, const StarMatchList &starMatchList)
 A std::list of star matches,. More...
 
double computeDist2 (const StarMatchList &S, const AstrometryTransform &transform)
 sum of distance squared More...
 
double computeChi2 (const StarMatchList &L, const AstrometryTransform &transform)
 the actual chi2 More...
 
std::ostreamoperator<< (std::ostream &s, Chi2List const &chi2List)
 
std::ostreamoperator<< (std::ostream &stream, ProperMotion const &pm)
 

Typedef Documentation

◆ AstrometryTransformFun

using lsst::jointcal::AstrometryTransformFun = typedef void (const double, const double, double &, double &, const void *)

signature of the user-provided routine that actually does the coordinate transform for UserTransform.

Definition at line 754 of file AstrometryTransform.h.

◆ BaseStarCIterator

using lsst::jointcal::BaseStarCIterator = typedef BaseStarList::const_iterator

Definition at line 123 of file BaseStar.h.

◆ BaseStarIterator

using lsst::jointcal::BaseStarIterator = typedef BaseStarList::iterator

Definition at line 124 of file BaseStar.h.

◆ BaseStarList

Definition at line 121 of file BaseStar.h.

◆ CcdIdType

using lsst::jointcal::CcdIdType = typedef int

Definition at line 49 of file CcdImage.h.

◆ CcdImageList

Definition at line 46 of file CcdImage.h.

◆ FittedStarCIterator

using lsst::jointcal::FittedStarCIterator = typedef FittedStarList::const_iterator

Definition at line 124 of file FittedStar.h.

◆ FittedStarIterator

using lsst::jointcal::FittedStarIterator = typedef FittedStarList::iterator

Definition at line 125 of file FittedStar.h.

◆ Iterator

Definition at line 178 of file FastFinder.cc.

◆ MeasuredStarCIterator

using lsst::jointcal::MeasuredStarCIterator = typedef MeasuredStarList::const_iterator

Definition at line 158 of file MeasuredStar.h.

◆ MeasuredStarIterator

using lsst::jointcal::MeasuredStarIterator = typedef MeasuredStarList::iterator

Definition at line 159 of file MeasuredStar.h.

◆ RefFluxMapType

Definition at line 52 of file Associations.h.

◆ RefStarCIterator

using lsst::jointcal::RefStarCIterator = typedef RefStarList::const_iterator

Definition at line 89 of file RefStar.h.

◆ RefStarIterator

using lsst::jointcal::RefStarIterator = typedef RefStarList::iterator

Definition at line 90 of file RefStar.h.

◆ SegmentCIterator

using lsst::jointcal::SegmentCIterator = typedef std::list<Segment>::const_iterator

Definition at line 92 of file ListMatch.cc.

◆ SegmentIterator

Definition at line 91 of file ListMatch.cc.

◆ SegmentPairList

Definition at line 119 of file ListMatch.cc.

◆ SegmentPairListCIterator

using lsst::jointcal::SegmentPairListCIterator = typedef SegmentPairList::const_iterator

Definition at line 121 of file ListMatch.cc.

◆ SegmentPairListIterator

using lsst::jointcal::SegmentPairListIterator = typedef SegmentPairList::iterator

Definition at line 120 of file ListMatch.cc.

◆ SolList

Definition at line 156 of file ListMatch.cc.

◆ StarMatchCIterator

using lsst::jointcal::StarMatchCIterator = typedef ::std::list<StarMatch>::const_iterator

Definition at line 135 of file StarMatch.h.

◆ StarMatchIterator

Definition at line 134 of file StarMatch.h.

◆ Trip

using lsst::jointcal::Trip = typedef Eigen::Triplet<double>

Definition at line 35 of file Tripletlist.h.

◆ VisitIdType

using lsst::jointcal::VisitIdType = typedef long

Definition at line 48 of file CcdImage.h.

Enumeration Type Documentation

◆ MinimizeResult

enum class lsst::jointcal::MinimizeResult
strong

Return value of minimize()

Enumerator
Converged 
Chi2Increased 
Failed 
NonFinite 

Definition at line 42 of file FitterBase.h.

42 {
43 Converged, // fit has converged - no more outliers
44 Chi2Increased, // still some ouliers but chi2 increases
45 Failed, // factorization failed
46 NonFinite // non-finite chi2 statistic
47};

Function Documentation

◆ astrometryTransformRead() [1/2]

std::unique_ptr< AstrometryTransform > lsst::jointcal::astrometryTransformRead ( const std::string fileName)

The virtual constructor from a file.

Definition at line 1811 of file AstrometryTransform.cc.

1811 {
1812 ifstream s(fileName.c_str());
1813 if (!s)
1815 " astrometryTransformRead : cannot open " + fileName);
1816 try {
1818 s.close();
1819 return res;
1822 std::string(e.what()) + " in file " + fileName);
1823 }
1824}
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
T c_str(T... args)
virtual char const * what(void) const noexcept
Return a character string summarizing this exception.
Definition: Exception.cc:99
Reports invalid arguments.
Definition: Runtime.h:66
std::unique_ptr< AstrometryTransform > astrometryTransformRead(const std::string &fileName)
The virtual constructor from a file.

◆ astrometryTransformRead() [2/2]

std::unique_ptr< AstrometryTransform > lsst::jointcal::astrometryTransformRead ( std::istream s)

The virtual constructor from a file.

Definition at line 1826 of file AstrometryTransform.cc.

1826 {
1828 s >> type;
1829 if (s.fail())
1831 "astrometryTransformRead : could not find a AstrometryTransformtype");
1832 if (type == "AstrometryTransformIdentity") {
1834 res->read(s);
1835 return std::move(res);
1836 } else if (type == "AstrometryTransformPolynomial") {
1837 std::unique_ptr<AstrometryTransformPolynomial> res(new AstrometryTransformPolynomial());
1838 res->read(s);
1839 return std::move(res);
1840 } else
1841 throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
1842 " astrometryTransformRead : No reader for AstrometryTransform type " + type);
1843}
table::Key< int > type
Definition: Detector.cc:163
A do-nothing transformation. It anyway has dummy routines to mimick a AstrometryTransform.
T fail(T... args)
T move(T... args)

◆ compareStar1()

bool lsst::jointcal::compareStar1 ( const StarMatch one,
const StarMatch two 
)
inline

Definition at line 116 of file StarMatch.h.

116 {
117 return ((one.s1 == two.s1) ? (one.distance < two.distance) : (&(*one.s1) > &(*two.s1)));
118}
std::shared_ptr< const BaseStar > s1
Definition: StarMatch.h:63

◆ compareStar2()

bool lsst::jointcal::compareStar2 ( const StarMatch one,
const StarMatch two 
)
inline

Definition at line 122 of file StarMatch.h.

122 {
123 return ((one.s2 == two.s2) ? (one.distance < two.distance) : (&(*one.s2) > &(*two.s2)));
124}
std::shared_ptr< const BaseStar > s2
Definition: StarMatch.h:63

◆ compose() [1/2]

std::unique_ptr< AstrometryTransform > lsst::jointcal::compose ( AstrometryTransform const &  left,
AstrometryTransform const &  right 
)

Returns a pointer to a composition of transforms, representing left(right()).

Deletion of returned value to be done by caller.

If left->composeAndReduce(right) returns NULL, build a AstrometryTransformComposition and return it. This routine implements "run-time" compositions. When there is a possible "reduction" (e.g. compositions of polynomials), compose detects it and returns a genuine AstrometryTransform.

Returns
The composed transform.

Definition at line 427 of file AstrometryTransform.cc.

428 {
429 // Try to use the composeAndReduce method from left. If absent, AstrometryTransform::composeAndReduce
430 // returns NULL. composeAndReduce is non trivial for polynomials.
431 std::unique_ptr<AstrometryTransform> composition(left.composeAndReduce(right));
432 // composition == NULL means no reduction: just build a Composition that pipelines "left" and "right".
433 if (composition == nullptr)
434 return std::make_unique<AstrometryTransformComposition>(left, right);
435 else
436 return composition;
437}
T left(T... args)

◆ compose() [2/2]

std::unique_ptr< AstrometryTransform > lsst::jointcal::compose ( AstrometryTransform const &  left,
AstrometryTransformIdentity const &  right 
)

Definition at line 422 of file AstrometryTransform.cc.

423 {
424 return left.clone();
425}

◆ computeChi2()

double lsst::jointcal::computeChi2 ( const StarMatchList L,
const AstrometryTransform transform 
)

the actual chi2

Definition at line 244 of file StarMatch.cc.

244 {
245 auto chi2s(chi2_array(starMatchList, transform));
246 double chi2 = 0;
247 for (auto const &c : chi2s) chi2 += c;
248 return chi2;
249}

◆ computeDist2()

double lsst::jointcal::computeDist2 ( const StarMatchList S,
const AstrometryTransform transform 
)

sum of distance squared

Definition at line 237 of file StarMatch.cc.

237 {
238 double dist2 = 0;
239 for (auto const &starMatch : starMatchList)
240 dist2 += transform.apply(starMatch.point1).computeDist2(starMatch.point2);
241 return dist2;
242}
table::Key< int > transform

◆ Fitted2Base() [1/4]

const BaseStarList & lsst::jointcal::Fitted2Base ( const FittedStarList This)

Definition at line 68 of file FittedStar.cc.

68{ return (const BaseStarList &)This; }
std::lists of Stars.
Definition: StarList.h:58

◆ Fitted2Base() [2/4]

const BaseStarList * lsst::jointcal::Fitted2Base ( const FittedStarList This)

Definition at line 70 of file FittedStar.cc.

70{ return (BaseStarList *)This; }

◆ Fitted2Base() [3/4]

BaseStarList & lsst::jointcal::Fitted2Base ( FittedStarList This)

Definition at line 64 of file FittedStar.cc.

64{ return (BaseStarList &)This; }

◆ Fitted2Base() [4/4]

BaseStarList * lsst::jointcal::Fitted2Base ( FittedStarList This)

Definition at line 66 of file FittedStar.cc.

66{ return (BaseStarList *)This; }

◆ inversePolyTransform()

std::shared_ptr< AstrometryTransformPolynomial > lsst::jointcal::inversePolyTransform ( AstrometryTransform const &  forward,
Frame const &  domain,
double  precision,
std::size_t  maxOrder = 9,
std::size_t  nSteps = 50 
)

Approximate the inverse by a polynomial, to some precision.

Parameters
forwardTransform to be inverted.
[in]domainThe domain of forward.
[in]precisionRequire that \(chi2 / (nsteps^2) < precision^2\).
[in]maxOrderThe maximum order allowed of the inverse polynomial.
[in]nStepsThe number of sample points per axis (nSteps^2 total points).
Returns
A polynomial that best approximates forward.

Definition at line 1149 of file AstrometryTransform.cc.

1153 {
1154 StarMatchList sm;
1155 double xStart = domain.xMin;
1156 double yStart = domain.yMin;
1157 double xStep = domain.getWidth() / (nSteps - 1);
1158 double yStep = domain.getHeight() / (nSteps - 1);
1159 for (std::size_t i = 0; i < nSteps; ++i) {
1160 for (std::size_t j = 0; j < nSteps; ++j) {
1161 Point in(xStart + i * xStep, yStart + j * yStep);
1162 Point out(forward.apply(in));
1163 sm.push_back(StarMatch(out, in, nullptr, nullptr));
1164 }
1165 }
1166 std::size_t npairs = sm.size();
1170 double chi2 = 0;
1171 double oldChi2 = std::numeric_limits<double>::infinity();
1172 for (order = 1; order <= maxOrder; ++order) {
1173 poly.reset(new AstrometryTransformPolynomial(order));
1174 auto success = poly->fit(sm);
1175 if (success == -1) {
1176 std::stringstream errMsg;
1177 errMsg << "Cannot fit a polynomial of order " << order << " with " << nSteps << "^2 points";
1178 throw pexExcept::RuntimeError(errMsg.str());
1179 }
1180 // compute the chi2 ignoring errors:
1181 chi2 = 0;
1182 for (auto const &i : sm) chi2 += i.point2.computeDist2(poly->apply((i.point1)));
1183 LOGLS_TRACE(_log, "inversePoly order " << order << ": " << chi2 << " / " << npairs << " = "
1184 << chi2 / npairs << " < " << precision * precision);
1185
1186 if (chi2 / npairs < precision * precision) break;
1187
1188 // If this triggers, we know we did not reach the required precision.
1189 if (chi2 > oldChi2) {
1190 LOGLS_WARN(_log, "inversePolyTransform: chi2 increases ("
1191 << chi2 << " > " << oldChi2 << "); ending fit with order: " << order);
1192 LOGLS_WARN(_log, "inversePolyTransform: requested precision not reached: "
1193 << chi2 << " / " << npairs << " = " << chi2 / npairs << " < "
1194 << precision * precision);
1195 poly = std::move(oldPoly);
1196 order--;
1197 break;
1198 } else {
1199 oldChi2 = chi2;
1200 // Clone it so we don't lose it in the next iteration.
1201 oldPoly = dynamic_pointer_cast<AstrometryTransformPolynomial>(
1203 }
1204 }
1205 if (order > maxOrder)
1206 LOGLS_WARN(_log, "inversePolyTransform: Reached max order without reaching requested precision: "
1207 << chi2 << " / " << npairs << " = " << chi2 / npairs << " < "
1208 << precision * precision);
1209 return poly;
1210}
#define LOGLS_WARN(logger, message)
Log a warn-level message using an iostream-based interface.
Definition: Log.h:659
#define LOGLS_TRACE(logger, message)
Log a trace-level message using an iostream-based interface.
Definition: Log.h:599
A point in a plane.
Definition: Point.h:37
A hanger for star associations.
Definition: StarMatch.h:55
Reports errors that are due to events beyond the control of the program.
Definition: Runtime.h:104
T forward(T... args)
T infinity(T... args)
Low-level polynomials (including special polynomials) in C++.
T push_back(T... args)
T size(T... args)
T str(T... args)
table::Key< int > order

◆ isIntegerShift()

bool lsst::jointcal::isIntegerShift ( const AstrometryTransform transform)

Shorthand test to tell if a transform is a simple integer shift.

Definition at line 57 of file AstrometryTransform.cc.

57 {
58 const auto *shift =
59 dynamic_cast<const AstrometryTransformPolynomial *>(transform);
60 if (shift == nullptr) return false;
61
62 static const double eps = 1e-5;
63
64 double dx = shift->getCoefficient(0, 0, 0);
65 double dy = shift->getCoefficient(0, 0, 1);
66
67 static Point dumb(4000, 4000);
68 if (fabs(dx - int(floor(dx + 0.5))) < eps && fabs(dy - int(floor(dy + 0.5))) < eps &&
69 fabs(dumb.x + dx - shift->apply(dumb).x) < eps && fabs(dumb.y + dy - shift->apply(dumb).y) < eps)
70 return true;
71
72 return false;
73}
double getCoefficient(std::size_t powX, std::size_t powY, std::size_t whichCoord) const
Get the coefficient of a given power in x and y, for either the x or y coordinate.
T fabs(T... args)
T floor(T... args)

◆ listMatchCollect() [1/2]

std::unique_ptr< StarMatchList > lsst::jointcal::listMatchCollect ( const BaseStarList list1,
const BaseStarList list2,
const AstrometryTransform guess,
double  maxDist 
)

assembles star matches.

It picks stars in list1, transforms them through guess, and collects closest star in list2, and builds a match if closer than maxDist).

Definition at line 568 of file ListMatch.cc.

569 {
571 /****** Collect ***********/
572 FastFinder finder(list2);
573 for (const auto & si : list1) {
574 auto p1 = si;
575 Point p2 = guess->apply(*p1);
576 auto neighbour = finder.findClosest(p2, maxDist);
577 if (!neighbour) continue;
578 double distance = p2.Distance(*neighbour);
579 if (distance < maxDist) {
580 matches->push_back(StarMatch(*p1, *neighbour, p1, neighbour));
581 // assign the distance, since we have it in hand:
582 matches->back().distance = distance;
583 }
584 }
585 matches->setTransform(guess);
586
587 return matches;
588}
virtual void apply(double xIn, double yIn, double &xOut, double &yOut) const =0
This is an auxillary class for matching objects from starlists.
Definition: FastFinder.h:54
double Distance(const Point &other) const
Definition: Point.h:51

◆ listMatchCollect() [2/2]

std::unique_ptr< StarMatchList > lsst::jointcal::listMatchCollect ( const BaseStarList list1,
const BaseStarList list2,
double  maxDist 
)

same as before except that the transform is the identity

Definition at line 614 of file ListMatch.cc.

615 {
617 FastFinder finder(list2);
618 for (const auto & si : list1) {
619 auto p1 = si;
620 auto neighbour = finder.findClosest(*p1, maxDist);
621 if (!neighbour) continue;
622 double distance = p1->Distance(*neighbour);
623 if (distance < maxDist) {
624 matches->push_back(StarMatch(*p1, *neighbour, p1, neighbour));
625 // assign the distance, since we have it in hand:
626 matches->back().distance = distance;
627 }
628 }
629
630 matches->setTransform(std::make_shared<AstrometryTransformIdentity>());
631
632 return matches;
633}

◆ listMatchCombinatorial()

std::unique_ptr< AstrometryTransform > lsst::jointcal::listMatchCombinatorial ( const BaseStarList list1,
const BaseStarList list2,
const MatchConditions conditions = MatchConditions() 
)

Definition at line 679 of file ListMatch.cc.

681 {
682 BaseStarList list1, list2;
683 List1.copyTo(list1);
684 list1.fluxSort();
685 List2.copyTo(list2);
686 list2.fluxSort();
687
688 LOGLS_INFO(_log, "listMatchCombinatorial: find match between " << list1.size() << " and " << list2.size()
689 << " stars...");
690 auto match = matchSearchRotShiftFlip(list1, list2, conditions);
691 double pixSizeRatio2 = std::pow(conditions.sizeRatio, 2);
692 size_t nmin =
693 std::min(size_t(10), size_t(std::min(List1.size(), List2.size()) * conditions.minMatchRatio));
694
696 if (is_transform_ok(match.get(), pixSizeRatio2, nmin))
697 transform = match->getTransform()->clone();
698 else {
699 LOGL_ERROR(_log, "listMatchCombinatorial: direct transform failed, trying reverse");
700 match = matchSearchRotShiftFlip(list2, list1, conditions);
701 if (is_transform_ok(match.get(), pixSizeRatio2, nmin))
702 transform = match->inverseTransform();
703 else {
704 LOGL_FATAL(_log, "FAILED");
705 }
706 }
707
708 if (transform) {
709 LOGL_INFO(_log, "FOUND");
710 if (conditions.printLevel >= 1) {
711 LOGL_DEBUG(_log, " listMatchCombinatorial: found the following transform.");
712 LOGLS_DEBUG(_log, *transform);
713 }
714 } else
715 LOGL_ERROR(_log, "listMatchCombinatorial: failed to find a transform");
716 return transform;
717}
#define LOGL_INFO(logger, message...)
Log a info-level message using a varargs/printf style interface.
Definition: Log.h:531
#define LOGLS_INFO(logger, message)
Log a info-level message using an iostream-based interface.
Definition: Log.h:639
#define LOGL_ERROR(logger, message...)
Log a error-level message using a varargs/printf style interface.
Definition: Log.h:563
#define LOGLS_DEBUG(logger, message)
Log a debug-level message using an iostream-based interface.
Definition: Log.h:619
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
Definition: Log.h:515
#define LOGL_FATAL(logger, message...)
Log a fatal-level message using a varargs/printf style interface.
Definition: Log.h:579
void copyTo(StarList< Star > &copy) const
clears copy and makes a copy of the std::list to copy
Definition: StarList.cc:68
void fluxSort()
a model routine to sort the std::list
Definition: StarList.cc:42
T min(T... args)
std::unique_ptr< StarMatchList > matchSearchRotShiftFlip(BaseStarList &list1, BaseStarList &list2, const MatchConditions &conditions)
same as above but searches also a flipped solution.
Definition: ListMatch.cc:432
T pow(T... args)

◆ listMatchRefine()

std::unique_ptr< AstrometryTransform > lsst::jointcal::listMatchRefine ( const BaseStarList list1,
const BaseStarList list2,
std::unique_ptr< AstrometryTransform transform,
int  maxOrder = 3 
)

Definition at line 719 of file ListMatch.cc.

721 {
722 if (!transform) {
724 }
725
726 // some hard-coded constants that could go in a param file
727 const double brightDist = 2.; // distance in pixels in a match
728 const double fullDist = 4.; // distance in pixels in a match between entire lists
729 const double nSigmas = 3.; // k-sigma clipping on residuals
730 const size_t nStars = 500; // max number of bright stars to fit
731
732 int order = 1;
733 size_t nstarmin = 3;
734
735 BaseStarList list1, list2;
736 List1.copyTo(list1);
737 list1.fluxSort();
738 list1.cutTail(nStars);
739 List2.copyTo(list2);
740 list2.fluxSort();
741 list2.cutTail(nStars);
742
743 auto fullMatch = listMatchCollect(List1, List2, transform.get(), fullDist);
744 auto brightMatch = listMatchCollect(list1, list2, transform.get(), brightDist);
745 double curChi2 = computeChi2(*brightMatch, *transform) / brightMatch->size();
746
747 LOGLS_INFO(_log, "listMatchRefine: start: med.resid " << median_distance(fullMatch.get(), transform.get())
748 << " #match " << fullMatch->size());
749
750 do { // loop on transform order on full list of stars
751 auto curTransform = brightMatch->getTransform()->clone();
752 unsigned iter = 0;
753 double transDiff;
754 do { // loop on transform diff only on bright stars
755 brightMatch->setTransformOrder(order);
756 brightMatch->refineTransform(nSigmas);
757 transDiff = transform_diff(list1, brightMatch->getTransform().get(), curTransform.get());
758 curTransform = brightMatch->getTransform()->clone();
759 brightMatch = listMatchCollect(list1, list2, curTransform.get(), brightDist);
760 } while (brightMatch->size() > nstarmin && transDiff > 0.05 && ++iter < 5);
761
762 double prevChi2 = curChi2;
763 curChi2 = computeChi2(*brightMatch, *curTransform) / brightMatch->size();
764
765 fullMatch = listMatchCollect(List1, List2, curTransform.get(), fullDist);
766 LOGLS_INFO(_log, "listMatchRefine: order " << order << " med.resid "
767 << median_distance(fullMatch.get(), curTransform.get())
768 << " #match " << fullMatch->size());
769 if (((prevChi2 - curChi2) > 0.01 * curChi2) && curChi2 > 0) {
770 LOGLS_INFO(_log, " listMatchRefine: order " << order << " was a better guess.");
771 transform = brightMatch->getTransform()->clone();
772 }
773 nstarmin = brightMatch->getTransform()->getNpar();
774 } while (++order <= maxOrder);
775
776 return transform;
777}

◆ listMatchupShift()

std::unique_ptr< AstrometryTransformLinear > lsst::jointcal::listMatchupShift ( const BaseStarList list1,
const BaseStarList list2,
const AstrometryTransform transform,
double  maxShift,
double  binSize = 0 
)

searches for a 2 dimensional shift using a very crude histogram method.

Definition at line 490 of file ListMatch.cc.

493 {
494 int nx;
495 if (binSize == 0) {
496 int ncomb = list1.size() * list2.size();
497 if (ncomb > 10000)
498 nx = 100;
499 else
500 nx = (int)sqrt(double(ncomb));
501 if (!ncomb) return std::unique_ptr<AstrometryTransformLinear>(nullptr);
502 } else
503 nx = int(2 * maxShift / binSize + 0.5);
504
505 Histo2d histo(nx, -maxShift, maxShift, nx, -maxShift, maxShift);
506 double binSizeNew = 2 * maxShift / nx;
507
508 BaseStarCIterator s1;
509 FastFinder finder(list2);
510 double x1, y1;
511 for (s1 = list1.begin(); s1 != list1.end(); ++s1) {
512 transform.apply((*s1)->x, (*s1)->y, x1, y1);
513 FastFinder::Iterator it = finder.beginScan(Point(x1, y1), maxShift);
514 while (*it) {
515 auto s2 = *it;
516 histo.fill(s2->x - x1, s2->y - y1);
517 ++it;
518 }
519 }
520 SolList Solutions;
521 for (int i = 0; i < 4; ++i) {
522 double dx = 0, dy = 0;
523 double count = histo.maxBin(dx, dy);
524 histo.fill(dx, dy, -count); // zero the maxbin
525 AstrometryTransformLinearShift shift(dx, dy);
526 auto newGuess = compose(shift, transform);
527 auto raw_matches = listMatchCollect(list1, list2, newGuess.get(), binSizeNew);
528 std::unique_ptr<StarMatchList> matches(new StarMatchList);
529 raw_matches->applyTransform(*matches, &transform);
530 matches->setTransformOrder(1);
531 matches->refineTransform(3.);
532 Solutions.push_back(std::move(matches));
533 }
534 Solutions.sort(DecreasingQuality);
536 new AstrometryTransformLinear(*std::const_pointer_cast<AstrometryTransformLinear>(
537 std::dynamic_pointer_cast<const AstrometryTransformLinear>(
538 Solutions.front()->getTransform()))));
539 return best;
540}
T begin(T... args)
T count(T... args)
T end(T... args)
std::list< std::unique_ptr< StarMatchList > > SolList
Definition: ListMatch.cc:156
std::unique_ptr< AstrometryTransform > compose(AstrometryTransform const &left, AstrometryTransform const &right)
Returns a pointer to a composition of transforms, representing left(right()).
std::unique_ptr< StarMatchList > listMatchCollect(const BaseStarList &list1, const BaseStarList &list2, const AstrometryTransform *guess, double maxDist)
assembles star matches.
Definition: ListMatch.cc:568
T sqrt(T... args)

◆ matchSearchRotShift()

std::unique_ptr< StarMatchList > lsst::jointcal::matchSearchRotShift ( BaseStarList list1,
BaseStarList list2,
const MatchConditions conditions 
)

searches a geometrical transformation that goes from list1 to list2.

The found transformation is a field of the returned object, as well as the star pairs (the matches) that were constructed. (see StarMatchList class definition for more details). The various cuts are contained in conditions (see listmatch.h) for its contents. This routine searches a transformation that involves a shift and a rotation.

Definition at line 424 of file ListMatch.cc.

425 {
426 list1.fluxSort();
427 list2.fluxSort();
428
429 return ListMatchupRotShift(list1, list2, AstrometryTransformIdentity(), conditions);
430}

◆ matchSearchRotShiftFlip()

std::unique_ptr< StarMatchList > lsst::jointcal::matchSearchRotShiftFlip ( BaseStarList list1,
BaseStarList list2,
const MatchConditions conditions 
)

same as above but searches also a flipped solution.

Definition at line 432 of file ListMatch.cc.

433 {
434 list1.fluxSort();
435 list2.fluxSort();
436
437 AstrometryTransformLinear flip(0, 0, 1, 0, 0, -1);
438 std::unique_ptr<StarMatchList> flipped(ListMatchupRotShift(list1, list2, flip, conditions));
440 ListMatchupRotShift(list1, list2, AstrometryTransformIdentity(), conditions));
441 if (!flipped || !unflipped) return std::unique_ptr<StarMatchList>(nullptr);
442 if (conditions.printLevel >= 1) {
443 LOGLS_DEBUG(_log,
444 "unflipped Residual " << unflipped->computeResidual() << " nused " << unflipped->size());
445 LOGLS_DEBUG(_log, "flipped Residual " << flipped->computeResidual() << " nused " << flipped->size());
446 }
447 if (DecreasingQuality(flipped, unflipped)) {
448 if (conditions.printLevel >= 1) LOGL_DEBUG(_log, "Keeping flipped solution.");
449 // One should NOT apply the flip to the result because the matchlist
450 // (even the flipped one) contains the actual coordinates of stars.
451 // MatchListExtract is always called with AstrometryTransformIdentity() as last parameter
452 return flipped;
453 } else {
454 if (conditions.printLevel >= 1) LOGL_DEBUG(_log, "Keeping unflipped solution.");
455 return unflipped;
456 }
457}
implements the linear transformations (6 real coefficients).

◆ Measured2Base() [1/4]

const BaseStarList & lsst::jointcal::Measured2Base ( const MeasuredStarList This)

Definition at line 62 of file MeasuredStar.cc.

62{ return (const BaseStarList &)This; }

◆ Measured2Base() [2/4]

const BaseStarList * lsst::jointcal::Measured2Base ( const MeasuredStarList This)

Definition at line 64 of file MeasuredStar.cc.

64{ return (BaseStarList *)This; }

◆ Measured2Base() [3/4]

BaseStarList & lsst::jointcal::Measured2Base ( MeasuredStarList This)

Definition at line 58 of file MeasuredStar.cc.

58{ return (BaseStarList &)This; }

◆ Measured2Base() [4/4]

BaseStarList * lsst::jointcal::Measured2Base ( MeasuredStarList This)

Definition at line 60 of file MeasuredStar.cc.

60{ return (BaseStarList *)This; }

◆ normalizeCoordinatesTransform()

AstrometryTransformLinear lsst::jointcal::normalizeCoordinatesTransform ( const Frame frame)

Returns the transformation that maps the input frame along both axes to [-1,1].

Definition at line 834 of file AstrometryTransform.cc.

834 {
835 Point center = frame.getCenter();
836 return AstrometryTransformLinearScale(2. / frame.getWidth(), 2. / frame.getHeight()) *
837 AstrometryTransformLinearShift(-center.x, -center.y);
838}
just here to provide specialized constructors. AstrometryTransformLinear fit routine.
just here to provide a specialized constructor, and fit.
double x
coordinate
Definition: Point.h:42

◆ operator<<() [1/11]

std::ostream & lsst::jointcal::operator<< ( std::ostream out,
CcdImageKey const &  key 
)

Definition at line 53 of file CcdImage.cc.

53 {
54 out << "(visit: " << key.visit << ", detector: " << key.ccd << ")";
55 return out;
56}

◆ operator<<() [2/11]

std::ostream & lsst::jointcal::operator<< ( std::ostream s,
Chi2List const &  chi2List 
)

Definition at line 45 of file Chi2.cc.

45 {
46 s << "chi2 per star : ";
47 for (const auto& chi2 : chi2List) {
48 s << *(chi2.star) << " chi2: " << chi2.chi2 << " ; ";
49 }
50 s << std::endl;
51 return s;
52}
T endl(T... args)

◆ operator<<() [3/11]

std::ostream & lsst::jointcal::operator<< ( std::ostream stream,
AstrometryMapping const &  mapping 
)
inline

Definition at line 78 of file AstrometryMapping.h.

78 {
79 mapping.print(stream);
80 return stream;
81}

◆ operator<<() [4/11]

std::ostream & lsst::jointcal::operator<< ( std::ostream stream,
AstrometryModel const &  model 
)

Definition at line 42 of file AstrometryModel.cc.

42 {
43 model.print(stream);
44 return stream;
45}

◆ operator<<() [5/11]

ostream & lsst::jointcal::operator<< ( std::ostream stream,
AstrometryTransform const &  transform 
)

Definition at line 242 of file AstrometryTransform.cc.

242 {
243 transform.print(stream);
244 return stream;
245}

◆ operator<<() [6/11]

std::ostream & lsst::jointcal::operator<< ( std::ostream stream,
const Point point 
)

Definition at line 70 of file Point.h.

70 {
71 point.print(stream);
72 return stream;
73 }
virtual void print(std::ostream &s=std::cout) const
Definition: Point.h:66

◆ operator<<() [7/11]

template<class Star >
std::ostream & lsst::jointcal::operator<< ( std::ostream stream,
const StarList< Star > &  list 
)

enables

std::cout << my_list; 

Definition at line 105 of file StarList.h.

105 {
106 list.print(stream);
107 return stream;
108}

◆ operator<<() [8/11]

std::ostream & lsst::jointcal::operator<< ( std::ostream stream,
const StarMatch match 
)

Definition at line 55 of file StarMatch.cc.

55 {
56 stream << match.point1.x << ' ' << match.point1.y << ' ' << match.point2.x << ' ' << match.point2.y << ' '
57 << match.distance << std::endl;
58 return stream;
59}
FatPoint point2
2 points
Definition: StarMatch.h:61

◆ operator<<() [9/11]

std::ostream & lsst::jointcal::operator<< ( std::ostream stream,
const StarMatchList starMatchList 
)

A std::list of star matches,.

To be used as the argument to AstrometryTransform::fit routines. There is as well a StarMatch::fit routine which fits a polynomial by default, although the transform may be user-provided. The StarMatchList::refineTransform is a convenient tool to reject outliers. Given two catalogs, one can assemble a StarMatchList using utilities such as listMatchCollect. StarMatchList's have write capabilities. NStarMatchList is a generalization of this 2-match to n-matches.

Definition at line 61 of file StarMatch.cc.

61 {
62 stream << " number of elements " << starMatchList.size() << std::endl;
63 copy(starMatchList.begin(), starMatchList.end(), std::ostream_iterator<StarMatch>(stream));
64 return stream;
65}
T copy(T... args)

◆ operator<<() [10/11]

std::ostream & lsst::jointcal::operator<< ( std::ostream stream,
ProjectionHandler const &  projectionHandler 
)

Definition at line 34 of file Projectionhandler.cc.

34 {
35 projectionHandler.print(stream);
36 return stream;
37}

◆ operator<<() [11/11]

std::ostream & lsst::jointcal::operator<< ( std::ostream stream,
ProperMotion const &  pm 
)

Definition at line 44 of file ProperMotion.cc.

44 {
45 stream << "pm_ra*cos(dec)=" << pm._ra << "rad/yr, pm_dec=" << pm._dec << "rad/yr, pm_raErr=" << pm._raErr
46 << "rad/yr, pm_decErr=" << pm._decErr << "rad/yr, pm_raDecCov=" << pm._raDecCov;
47 return stream;
48}

◆ Ref2Base() [1/4]

const BaseStarList & lsst::jointcal::Ref2Base ( const RefStarList This)

Definition at line 46 of file RefStar.cc.

46{ return (const BaseStarList &)This; }

◆ Ref2Base() [2/4]

const BaseStarList * lsst::jointcal::Ref2Base ( const RefStarList This)

Definition at line 48 of file RefStar.cc.

48{ return (BaseStarList *)This; }

◆ Ref2Base() [3/4]

BaseStarList & lsst::jointcal::Ref2Base ( RefStarList This)

Definition at line 42 of file RefStar.cc.

42{ return (BaseStarList &)This; }

◆ Ref2Base() [4/4]

BaseStarList * lsst::jointcal::Ref2Base ( RefStarList This)

Definition at line 44 of file RefStar.cc.

44{ return (BaseStarList *)This; }

◆ sameStar1()

bool lsst::jointcal::sameStar1 ( const StarMatch one,
const StarMatch two 
)
inline

Definition at line 120 of file StarMatch.h.

120{ return (one.s1 == two.s1); }

◆ sameStar2()

bool lsst::jointcal::sameStar2 ( const StarMatch one,
const StarMatch two 
)
inline

Definition at line 126 of file StarMatch.h.

126{ return (one.s2 == two.s2); }