IAP GITLAB

Skip to content
Snippets Groups Projects
Commit cedacf87 authored by Remy Prechelt's avatar Remy Prechelt
Browse files

Support writing summary files for each output.

parent 8b621c99
No related branches found
No related tags found
1 merge request!317Output infrastructure and Python analysis library.
Pipeline #3497 failed
......@@ -151,19 +151,6 @@ namespace corsika {
energy_ground_ / 1_GeV, count_ground_);
}
// template <typename TOutput>
// YAML::Node ObservationPlane<TOutput>::getFinalResults() const {
// // construct the top-level node
// YAML::Node node;
// node["energy_at_ground"] = energy_ground_ / 1 GeV;
// node["count_at_ground"] = count_ground_;
// return node;
// }
template <typename TOutput>
YAML::Node ObservationPlane<TOutput>::getConfig() const {
using namespace units::si;
......
......@@ -20,7 +20,6 @@
namespace corsika {
void OutputManager::writeNode(YAML::Node const& node,
std::filesystem::path const& path) const {
......@@ -61,7 +60,6 @@ namespace corsika {
// create a quick lambda function to convert a time-instance to a string
auto timeToString = [&](auto const time) -> std::string {
// the format for our date string
auto format{"%d/%m/%Y %H:%M:%S %Z"};
......@@ -220,8 +218,18 @@ namespace corsika {
throw std::runtime_error("endOfLibrary() called in invalid state.");
}
// forward the endOfLibrary() call to all the registered outputs
for (auto& [name, output] : outputs_) { output.get().endOfLibrary(); }
// write the summary for each output and forward the endOfLibrary call()
for (auto& [name, output] : outputs_) {
// we get the summary for each output as a YAML node
auto summary{outputs_.at(name).get().getSummary()};
// write the summary for this output to the file
writeNode(summary, root_ / name / "summary.yaml");
// and forward the end of library call
output.get().endOfLibrary();
}
// and the library has finished
state_ = OutputState::LibraryFinished;
......
......@@ -52,9 +52,9 @@ namespace corsika {
virtual YAML::Node getConfig() const = 0;
/**
* Get final text outputs for the config file.
* Get any summary information for the entire library.
*/
virtual YAML::Node getFinalOutput() { return YAML::Node(); };
virtual YAML::Node getSummary() { return YAML::Node(); };
};
} // namespace corsika
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment