SourceXtractorPlusPlus  0.19
SourceXtractor++, the next generation SExtractor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PyFitsFile.cpp
Go to the documentation of this file.
1 
18 #include "SEUtils/VariantCast.h"
20 #include <boost/algorithm/string.hpp>
21 
22 namespace SourceXtractor {
23 
24 PyFitsFile::PyFitsFile(const std::string& filename) : m_filename(filename) {
25  m_file = std::make_shared<FitsFile>(filename, false);
26 }
27 
30 
31  for(auto num : m_file->getImageHdus()) {
32  v.push_back(num-1);
33  }
34 
35  return v;
36 }
37 
39  return m_file->getDimensions(hdu+1);
40 }
41 
42 
44  const auto& headers = m_file->getHDUHeaders(hdu+1);
46 
47  for (auto& i : headers) {
48  auto key = i.first;
49  auto value = VariantCast<std::string>(i.second.m_value);
50  boost::trim(key);
51  boost::trim(value);
52  headers_str[key] = value;
53  }
54 
55  return headers_str;
56 }
57 
58 }
std::map< std::string, std::string > getHeaders(int hdu) const
Definition: PyFitsFile.cpp:43
std::shared_ptr< FitsFile > m_file
Definition: PyFitsFile.h:47
PyFitsFile(const std::string &filename)
Definition: PyFitsFile.cpp:24
std::vector< int > getImageHdus() const
Definition: PyFitsFile.cpp:28
STL class.
std::vector< int > getDimensions(int hdu) const
Definition: PyFitsFile.cpp:38
T push_back(T...args)
string filename
Definition: conf.py:65