-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateSQLookUpTable.cpp
More file actions
108 lines (82 loc) · 2.37 KB
/
CreateSQLookUpTable.cpp
File metadata and controls
108 lines (82 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Q matrices are not scaled with redshift binning function
#include <cstdio>
#include <cstdlib>
#include <cstring> // strcmp
#include <stdexcept>
// prevent gsl_cblas.h from being included
#define __GSL_CBLAS_H__
#ifdef USE_MKL_CBLAS
#include "mkl_cblas.h"
#else
#include "cblas.h"
#endif
#include <gsl/gsl_errno.h>
#include "core/global_numbers.hpp"
#include "core/mpi_manager.hpp"
#include "core/sq_table.hpp"
#include "core/fiducial_cosmology.hpp"
#include "io/config_file.hpp"
#include "io/logger.hpp"
int main(int argc, char *argv[])
{
mympi::init(argc, argv);
if (argc<2)
{
fprintf(stderr, "Missing config file!\n");
mympi::finalize();
return -1;
}
const char *FNAME_CONFIG = argv[1];
bool force_rewrite = true;
if (argc == 3)
force_rewrite = !(strcmp(argv[2], "--unforce") == 0);
ConfigFile config = ConfigFile();
try
{
config.readFile(FNAME_CONFIG);
LOG::LOGGER.open(config.get("OutputDir", "."), mympi::this_pe);
specifics::printBuildSpecifics();
mytime::writeTimeLogHeader();
}
catch (std::exception& e)
{
fprintf(stderr, "Error while reading config file: %s\n", e.what());
return 1;
}
try
{
process::readProcess(config);
bins::readBins(config);
specifics::readSpecifics(config);
fidcosmo::readFiducialCosmo(config);
}
catch (std::exception& e)
{
LOG::LOGGER.ERR("Error while parsing config file: %s\n",
e.what());
mympi::abort();
return 1;
}
gsl_set_error_handler_off();
try
{
process::sq_private_table = std::make_unique<SQLookupTable>(config);
const std::vector<std::string> ignored_keys({
"FileNameList", "FileInputDir", "NumberOfIterations",
"UseChunksMeanFlux", "InputIsDeltaFlux", "MeanFluxFile",
"SmoothNoiseWeights", "PrecomputedFisher", "DifferentNight",
"DifferentFiber", "DifferentPetal", "MinXWaveOverlapRatio",
"Targetids2Ignore"
});
config.checkUnusedKeys(ignored_keys);
process::sq_private_table->computeTables(force_rewrite);
}
catch (std::exception& e)
{
LOG::LOGGER.ERR("Error constructing SQ Table: %s\n", e.what());
mympi::abort();
return 1;
}
mympi::finalize();
return 0;
}