LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
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.
An include file to include the header files for lsst::afw::coord.
std::string magErrCol
name of magnitude sigma column
Definition: utils.h:19
std::string magCol
name of magnitude column
Definition: utils.h:18
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
afwTable::SimpleCatalog getCatalogImpl(std::vector< index_t * > inds, lsst::afw::coord::Coord const &ctrCoord, lsst::afw::geom::Angle const &radius, char const *idCol, std::vector< MagColInfo > const &magColInfoList, char const *isStarCol, char const *isVarCol, bool uniqueIds)
Definition: utils.cc:58
std::string filterName
name of filter
Definition: utils.h:17