LSSTApplications  11.0-22-g33de520,12.1+21,13.0
LSSTDataManagementBasePackage
utils.h
Go to the documentation of this file.
1 #if !defined(LSST_MEAS_ASTROM_UTILS_H)
2 #define LSST_MEAS_ASTROM_UTILS_H 1
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 astrom {
14 namespace detail {
15 
16  struct MagColInfo {
17  std::string filterName;
18  std::string magCol;
19  std::string magErrCol;
20 
21  bool hasErr() const {
22  return !magErrCol.empty();
23  }
24  };
25 
26 
31 struct IndexManager {
32  index_t* index;
33  IndexManager(index_t* ind) : index(ind) {}
35  // Change once astrometry.net-0.40+ is in...
36  /*
37  if (index_close_fds(ind)) {
38  throw LSST_EXCEPT(lsst::pex::exceptions::IoError,
39  "Failed to index_close_fds() an astrometry_net_data file");
40  }
41  */
42  if (index->quads && index->quads->fb && index->quads->fb->fid) {
43  _close(index->quads->fb->fid);
44  }
45  if (index->codekd && index->codekd->tree && index->codekd->tree->io) {
46  _close(index->codekd->tree->io);
47  }
48  if (index->starkd && index->starkd->tree && index->starkd->tree->io) {
49  _close(index->starkd->tree->io);
50  }
51  }
52  void _close(FILE* & fid) {
53  if (fid) {
54  if (fclose(fid)) {
55  std::cerr << "Error closing an astrometry_net_data quadfile" << std::endl;
56  }
57  fid = NULL;
58  }
59  }
60  void _close(void* io) {
61  _close(reinterpret_cast<kdtree_fits_t*>(io)->fid);
62  }
63 };
64 
91  std::vector<index_t*> inds,
92  lsst::afw::coord::Coord const &ctrCoord,
93  lsst::afw::geom::Angle const &radius,
94  const char* idCol,
95  std::vector<MagColInfo> const& magColInfoList,
96  const char* starGalCol,
97  const char* varCol,
98  bool uniqueIds=true);
99 
100 }}}}
101 #endif
An include file to include the header files for lsst::afw::geom.
std::string magCol
name of magnitude column
Definition: utils.h:18
An include file to include the header files for lsst::afw::coord.
A class representing an Angle.
Definition: Angle.h:103
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:55
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:58
std::string magErrCol
name of magnitude sigma column
Definition: utils.h:19
std::string filterName
name of filter
Definition: utils.h:17
RAII manager for astrometry.net indices.
Definition: utils.h:31
This is the base class for spherical coordinates.
Definition: Coord.h:69