35 CCfits::PHDU& phdu = pFits->pHDU();
36 if (phdu.axes() != 0) {
41 CCfits::ExtHDU& psf_data = pFits->extension(1);
42 if (psf_data.axes() != 2) {
47 CCfits::ExtHDU& position_data = pFits->extension(2);
48 if (position_data.axes() != 2) {
49 throw Elements::Exception() <<
"The second HDU has not the right dimension! File: " << pFits->name();
53 stack_logger.debug() <<
"Checked the file: " << pFits->name();
68 }
catch (CCfits::HDU::NoSuchKeyword&) {
80 }
catch (CCfits::Table::NoSuchColumn) {
89 }
catch (CCfits::FitsException&
e) {
102 m_pFits->extension(1).readKey(
"NAXIS1", naxis1);
103 m_pFits->extension(1).readKey(
"NAXIS2", naxis2);
112 <<
" NAXIS1: " << naxis1;
115 <<
" NAXIS2: " << naxis1;
119 long index_min_distance = 0;
120 double min_distance = 1.0e+32;
123 if (values.
size() != 2)
124 throw Elements::Exception() <<
"There can be only two positional value for the stacked PSF!";
127 for (
int act_index = 0; act_index <
m_nrows; act_index++) {
128 double act_distance = (values[0] -
m_x_values[act_index]) * (values[0] -
m_x_values[act_index]) +
130 if (act_distance < min_distance) {
131 index_min_distance = act_index;
132 min_distance = act_distance;
136 stack_logger.debug() <<
"Distance: " <<
sqrt(min_distance) <<
" (" << values[0] <<
"," << values[1] <<
")<-->("
138 <<
") index: " << index_min_distance;
149 m_pFits->extension(1).read(stamp_data, first_vertex, last_vertex, stride);
static Logging getLogger(const std::string &name="")
T minmax_element(T... args)