LSSTApplications  17.0+103,17.0+11,17.0+61,18.0.0+13,18.0.0+25,18.0.0+5,18.0.0+52,18.0.0-4-g68ffd23,18.1.0-1-g0001055+8,18.1.0-1-g03d53ef+1,18.1.0-1-g1349e88+28,18.1.0-1-g2505f39+22,18.1.0-1-g380d4d4+27,18.1.0-1-g5315e5e+1,18.1.0-1-g5e4b7ea+10,18.1.0-1-g7e8fceb+1,18.1.0-1-g85f8cd4+23,18.1.0-1-g9a6769a+13,18.1.0-1-ga1a4c1a+22,18.1.0-1-gd55f500+17,18.1.0-12-g42eabe8e+10,18.1.0-14-gd04256d+15,18.1.0-16-g430f6a53+1,18.1.0-17-gd2166b6e4,18.1.0-18-gb5d19ff+1,18.1.0-2-gfbf3545+7,18.1.0-2-gfefb8b5+16,18.1.0-3-g52aa583+13,18.1.0-3-g62b5e86+14,18.1.0-3-g8f4a2b1+17,18.1.0-3-g9bc06b8+7,18.1.0-3-gb69f684+9,18.1.0-4-g1ee41a7+1,18.1.0-5-g6dbcb01+13,18.1.0-5-gc286bb7+3,18.1.0-6-g48bdcd3+2,18.1.0-6-gd05e160+9,18.1.0-7-gc4d902b+2,18.1.0-7-gebc0338+8,18.1.0-9-gae7190a+10,w.2019.38
LSSTDataManagementBasePackage
utils.h
Go to the documentation of this file.
1 #ifndef LSST_MEAS_EXTENSIONS_ASTROMETRYNET_UTILS_H
2 #define LSST_MEAS_EXTENSIONS_ASTROMETRYNET_UTILS_H
3 
4 #include <string>
5 #include <vector>
6 
8 #include "lsst/afw/coord.h"
9 #include "lsst/geom.h"
10 
11 namespace lsst {
12 namespace meas {
13 namespace extensions {
14 namespace astrometryNet {
15 namespace detail {
16 
17  struct MagColInfo {
21 
22  bool hasErr() const {
23  return !magErrCol.empty();
24  }
25  };
26 
27 
32 struct IndexManager {
33  index_t* index;
34  IndexManager(index_t* ind) : index(ind) {}
36  // Change once astrometry.net-0.40+ is in...
37  /*
38  if (index_close_fds(ind)) {
39  throw LSST_EXCEPT(lsst::pex::exceptions::IoError,
40  "Failed to index_close_fds() an astrometry_net_data file");
41  }
42  */
43  if (index->quads && index->quads->fb && index->quads->fb->fid) {
44  _close(index->quads->fb->fid);
45  }
46  if (index->codekd && index->codekd->tree && index->codekd->tree->io) {
47  _close(index->codekd->tree->io);
48  }
49  if (index->starkd && index->starkd->tree && index->starkd->tree->io) {
50  _close(index->starkd->tree->io);
51  }
52  }
53  void _close(FILE* & fid) {
54  if (fid) {
55  if (fclose(fid)) {
56  std::cerr << "Error closing an astrometry_net_data quadfile" << std::endl;
57  }
58  fid = NULL;
59  }
60  }
61  void _close(void* io) {
62  _close(reinterpret_cast<kdtree_fits_t*>(io)->fid);
63  }
64 };
65 
93  lsst::geom::SpherePoint const &ctrCoord,
95  const char* idCol,
96  std::vector<MagColInfo> const& magColInfoList,
97  const char* starGalCol,
98  const char* varCol,
99  bool uniqueIds=true);
100 
101 }}}}} // lsst::meas::extensions::astrometryNet::detail
102 
103 #endif // LSST_MEAS_EXTENSIONS_ASTROMETRYNET_UTILS_H
std::string magCol
name of magnitude column
Definition: utils.h:19
T empty(T... args)
std::string magErrCol
name of magnitude sigma column
Definition: utils.h:20
T endl(T... args)
A class representing an angle.
Definition: Angle.h:127
STL class.
A base class for image defects.
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
Definition: fwd.h:63
RAII manager for astrometry.net indices.
Definition: utils.h:32
lsst::afw::table::SimpleCatalog getCatalogImpl(std::vector< index_t *> inds, lsst::geom::SpherePoint const &ctrCoord, lsst::geom::Angle const &radius, const char *idCol, std::vector< MagColInfo > const &magColInfoList, const char *starGalCol, const char *varCol, bool uniqueIds=true)
Implementation for index_t::getCatalog method.
Definition: utils.cc:61
STL class.
Point in an unspecified spherical coordinate system.
Definition: SpherePoint.h:57