128 return { {
"Assoc config", {
130 "Assoc catalog file"},
131 {
ASSOC_COLUMNS.c_str(), po::value<std::string>()->default_value(
"1,2"),
132 "Assoc columns to specify x/ra,y/dec[,weight] (the index of the first column is 1)"},
133 {
ASSOC_MODE.c_str(), po::value<std::string>()->default_value(
"NEAREST"),
134 "Assoc mode [FIRST, NEAREST, MEAN, MAG_MEAN, SUM, MAG_SUM, MIN, MAX]"},
135 {
ASSOC_RADIUS.c_str(), po::value<double>()->default_value(2.0),
136 "Assoc radius (Always in pixels of the detection image)"},
137 {
ASSOC_FILTER.c_str(), po::value<std::string>()->default_value(
"ALL"),
138 "Assoc catalog filter setting: ALL, MATCHED, UNMATCHED"},
139 {
ASSOC_COPY.c_str(), po::value<std::string>()->default_value(
""),
140 "List of columns indices in the assoc catalog to copy on match (the index of the first column is 1). "},
141 {
ASSOC_COORD_TYPE.c_str(), po::value<std::string>()->default_value(
"PIXEL"),
142 "Assoc coordinates type: PIXEL, WORLD"},
144 "Column containing the source radius (in reference frame pixels)"},
146 "Column containing the source half width (in reference frame pixels)"},
148 "Column containing the source half height (in reference frame pixels)"},
150 "Default source size (in reference frame pixels)"},
152 "Column containing the group id"},
154 "Text file containing the assoc columns configuration"},
156 "Prints the assoc configuration and quits"},
256 throw Elements::Exception() <<
"Use either X/Y or RA/DEC coordinates in assoc config file but not both";
270 throw Elements::Exception() <<
"Use either X/Y or RA/DEC coordinates in assoc config file but not both";
379 for (
auto& row : table) {
388 if (coordinate_system !=
nullptr) {
389 coord = coordinate_system->worldToImage(world_coord);
397 if (coordinate_system !=
nullptr) {
398 world_coord = coordinate_system->imageToWorld(coord);
402 if (columns.
size() == 3 && columns.
at(2) >= 0) {
405 for (
auto column : copy_columns) {
406 if (column >=
static_cast<int>(row.size())) {
409 if (row[column].
type() ==
typeid(
int)) {
410 catalog.
back().assoc_columns.emplace_back(boost::get<int>(row[column]));
411 }
else if (row[column].
type() ==
typeid(
double)) {
412 catalog.
back().assoc_columns.emplace_back(boost::get<double>(row[column]));
413 }
else if (row[column].
type() ==
typeid(
int64_t)) {
414 catalog.
back().assoc_columns.emplace_back(boost::get<int64_t>(row[column]));
415 }
else if (row[column].
type() ==
typeid(
SeFloat)) {
416 catalog.
back().assoc_columns.emplace_back(boost::get<SeFloat>(row[column]));
442 COLUMN_X, COLUMN_Y, COLUMN_RA, COLUMN_DEC, COLUMN_WEIGHT,
443 COLUMN_GROUP_ID, COLUMN_PIXEL_SIZE, COLUMN_PIXEL_HALF_WIDTH, COLUMN_PIXEL_HALF_HEIGHT
448 throw Elements::Exception() <<
"Can't either open or read assoc config file: " << filename;
452 int current_column_nb = 1;
456 if (line.
empty() || line[0] ==
'#') {
463 auto equal_sign_pos = line.
find(
'=');
464 if (equal_sign_pos != std::string::npos) {
465 name = line.
substr(0, equal_sign_pos);
470 current_column_nb = number + 1;
473 number = current_column_nb++;
477 if (
std::find(reserved_names.
begin(), reserved_names.
end(), boost::to_lower_copy(name)) != reserved_names.
end()) {
478 boost::to_lower(name);
483 columns[name] = number;