LSSTApplications  11.0-24-g0a022a1,14.0+77,15.0,15.0+1
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/afw/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::afw::coord::Coord const &ctrCoord,
94  lsst::afw::geom::Angle const &radius,
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
lsst::afw::table::SimpleCatalog getCatalogImpl(std::vector< index_t *> inds, lsst::afw::coord::Coord const &ctrCoord, lsst::afw::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:59
T empty(T... args)
list extensions
Definition: conf.py:22
std::string magErrCol
name of magnitude sigma column
Definition: utils.h:20
T endl(T... args)
STL class.
A class representing an angle.
Definition: Angle.h:102
A base class for image defects.
Definition: cameraGeom.dox:3
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
STL class.
This is the base class for spherical coordinates.
Definition: Coord.h:63