2626#include " ElementsKernel/Exception.h"
2727#include " ElementsKernel/Logging.h"
2828#include " PhzConfiguration/AuxDataDirConfig.h"
29+ #include < filesystem>
30+
31+ #include " PhzConfiguration/CatalogTypeConfig.h"
2932#include " PhzConfiguration/FilterConfig.h"
3033#include " PhzConfiguration/FilterProviderConfig.h"
34+ #include " PhzConfiguration/IntermediateDirConfig.h"
3135#include " PhzConfiguration/PhotometryGridConfig.h"
3236#include " PhzConfiguration/SedConfig.h"
3337#include " PhzConfiguration/SedProviderConfig.h"
@@ -44,7 +48,8 @@ static const std::string SED_WEIGHT_OUTPUT{"SED-Weight-Output"};
4448static const std::string SED_WEIGHT_SAMPLING{" SED-Weight-sampling" };
4549
4650ComputeSedWeightConfig::ComputeSedWeightConfig (long manager_id) : Configuration(manager_id) {
47- declareDependency<AuxDataDirConfig>();
51+ declareDependency<CatalogTypeConfig>();
52+ declareDependency<IntermediateDirConfig>();
4853 declareDependency<PhotometryGridConfig>();
4954 declareDependency<SedProviderConfig>();
5055 declareDependency<FilterConfig>();
@@ -57,9 +62,9 @@ auto ComputeSedWeightConfig::getProgramOptions() -> std::map<std::string, Option
5762
5863 {SED_WEIGHT_OUTPUT.c_str (), po::value<std::string>()->default_value (" SedWeight.ascii" ),
5964 " Path of the file into which output the SED weights. Relative path are relative to "
60- " <AuxDataDir >/GenericPriors/SedWeight/" },
61- {SED_WEIGHT_SAMPLING.c_str (), po::value<int >()->default_value (100000 ),
62- " Number of sample for computing SED weight, if put to 0 all weight are set to 1" }
65+ " <intermediate_dir>/<catalog_type >/GenericPriors/SedWeight/" },
66+ {SED_WEIGHT_SAMPLING.c_str (), po::value<int >()->default_value (100000 ),
67+ " Number of sample for computing SED weight, if put to 0 all weight are set to 1" }
6368
6469 }}};
6570}
@@ -72,9 +77,21 @@ void ComputeSedWeightConfig::initialize(const UserValues& args) {
7277 m_output_file = file_name;
7378 } else {
7479 // relative to
75- boost::filesystem::path dir (getDependency<AuxDataDirConfig>().getAuxDataDir () / " GenericPriors" / " SedWeight" );
76- boost::filesystem::create_directory (dir);
77- fs::path result = getDependency<AuxDataDirConfig>().getAuxDataDir () / " GenericPriors" / " SedWeight" / file_name;
80+
81+ boost::filesystem::path outer_dir (getDependency<IntermediateDirConfig>().getIntermediateDir () /
82+ getDependency<CatalogTypeConfig>().getCatalogType () / " GenericPriors" );
83+
84+ if (!std::filesystem::exists (outer_dir.string ())) {
85+ boost::filesystem::create_directory (outer_dir);
86+ }
87+
88+ boost::filesystem::path dir (getDependency<IntermediateDirConfig>().getIntermediateDir () /
89+ getDependency<CatalogTypeConfig>().getCatalogType () / " GenericPriors" / " SedWeight" );
90+ if (!std::filesystem::exists (dir.string ())) {
91+ boost::filesystem::create_directory (dir);
92+ }
93+
94+ fs::path result = dir / file_name;
7895 m_output_file = result.string ();
7996 }
8097
@@ -95,6 +112,5 @@ int ComputeSedWeightConfig::getWeightSampling() const {
95112 return m_sampling;
96113}
97114
98-
99115} // namespace PhzConfiguration
100116} // namespace Euclid
0 commit comments