5 #include "astrometry/solver.h"
6 #include "astrometry/index.h"
7 #include "astrometry/multiindex.h"
8 #include "astrometry/starkd.h"
9 #include "astrometry/fitsioutils.h"
10 #include "astrometry/fitstable.h"
11 #include "astrometry/log.h"
12 #include "astrometry/tic.h"
13 #include "astrometry/healpix.h"
28 #include "boost/format.hpp"
30 #include "lsst/utils/python.h"
32 #include "lsst/base.h"
33 #include "lsst/log/Log.h"
34 #include "lsst/daf/persistence.h"
35 #include "lsst/daf/base/Persistable.h"
36 #include "lsst/daf/base/PropertyList.h"
37 #include "lsst/afw/table.h"
38 #include "lsst/afw/image/Wcs.h"
39 #include "lsst/afw/image/TanWcs.h"
40 #include "lsst/afw/geom.h"
41 #include "lsst/afw/coord.h"
45 namespace extensions {
46 namespace astrometryNet {
68 return multiindex_get(_multiindex.get(), i);
74 void addIndex(std::string
const & filepath,
bool metadataOnly);
85 multiindex_unload(_multiindex.get());
89 return _multiindex->fits->filename;
96 return multiindex_n(_multiindex.get());
107 void operator()(multiindex_t* m) {
112 std::unique_ptr<multiindex_t, _Deleter> _multiindex;
157 std::vector<index_t*> inds,
158 lsst::afw::coord::Coord
const &ctrCoord,
159 lsst::afw::geom::Angle
const &radius,
161 std::vector<std::string>
const& filterNameList,
162 std::vector<std::string>
const& magColList,
163 std::vector<std::string>
const& magErrColList,
164 const char* starGalCol,
166 bool uniqueIds=
true);
168 std::shared_ptr<lsst::daf::base::PropertyList>
getSolveStats()
const;
170 std::shared_ptr<lsst::afw::image::Wcs>
getWcs();
173 return solver_did_solve(_solver.get());
176 void run(
double cpulimit);
180 solver_get_quad_size_range_arcsec(_solver.get(), &qlo, &qhi);
181 return std::make_pair(qlo, qhi);
196 _solver->parity = flipped ? PARITY_FLIP : PARITY_NORMAL;
200 solver_set_keep_logodds(_solver.get(), threshold);
204 _solver->funits_lower = low;
205 _solver->funits_upper = high;
209 solver_set_radec(_solver.get(), ra, dec, radius_deg);
215 _solver->endobj = maxStars;
218 void setStars(lsst::afw::table::SourceCatalog
const & srcs,
int x0,
int y0);
223 void operator()(solver_t* m) {
228 std::unique_ptr<solver_t, _Deleter> _solver;
236 lsst::afw::geom::Angle
healpixDistance(
int hp,
int nside, lsst::afw::coord::Coord
const& coord);
void unload()
Unload the indices.
A thin C++ wrapper around astrometry.net's solver_t struct.
void setParity(bool flipped)
Set parity to flipped (if true) or normal (if false)
std::string getName() const
MultiIndex(std::string const &filepath)
Construct a MultiIndex from an astrometry.net multi-index file.
void run(double cpulimit)
void setImageSize(int width, int height)
void setMatchThreshold(double threshold)
void addIndices(std::vector< index_t * > inds)
Add indices to the solver.
void addIndex(std::string const &filepath, bool metadataOnly)
Add an index read from a file.
void setRaDecRadius(double ra, double dec, double radius_deg)
lsst::afw::table::SimpleCatalog getCatalog(std::vector< index_t * > inds, lsst::afw::coord::Coord const &ctrCoord, lsst::afw::geom::Angle const &radius, const char *idCol, std::vector< std::string > const &filterNameList, std::vector< std::string > const &magColList, std::vector< std::string > const &magErrColList, const char *starGalCol, const char *varCol, bool uniqueIds=true)
Load reference objects in a region of the sky described by a center coordinate and a radius...
std::pair< double, double > getQuadSizeRangeArcsec() const
std::shared_ptr< lsst::daf::base::PropertyList > getSolveStats() const
lsst::afw::geom::Angle healpixDistance(int hp, int nside, lsst::afw::coord::Coord const &coord)
Calculate the distance from coordinates to a healpix.
std::shared_ptr< lsst::afw::image::Wcs > getWcs()
index_t * operator[](int i) const
Get the specified index.
void setMaxStars(int maxStars)
void setStars(lsst::afw::table::SourceCatalog const &srcs, int x0, int y0)
int getLength() const
Get the number of indices.
void reload()
Reload the indices.
int isWithinRange(double ra, double dec, double radius_deg)
Is this multi-index in range of the specified cone?
void setPixelScaleRange(double low, double high)