diff --git a/include/util/ExperimentUtils.hpp b/include/util/ExperimentUtils.hpp index 2ddd9dc..1133303 100644 --- a/include/util/ExperimentUtils.hpp +++ b/include/util/ExperimentUtils.hpp @@ -13,6 +13,11 @@ #include #include +#include std::string formatExperimentName(const std::string& name, const nlohmann::json& modelConfig); + +// Convert a string to an experiment root path. +// Relative paths are considered to be relative to the experiments directory (doot2::experimentsDirectory) +std::filesystem::path experimentRootFromString(const std::string& experimentRoot); diff --git a/src/util/ExperimentUtils.cpp b/src/util/ExperimentUtils.cpp index a55920d..3fb3adf 100644 --- a/src/util/ExperimentUtils.cpp +++ b/src/util/ExperimentUtils.cpp @@ -9,6 +9,7 @@ // #include "util/ExperimentUtils.hpp" +#include "Constants.hpp" #include #include @@ -33,3 +34,11 @@ std::string formatExperimentName(const std::string& name, const nlohmann::json& return experimentName; } + +std::filesystem::path experimentRootFromString(const std::string& experimentRoot) +{ + std::filesystem::path root = experimentRoot; + if (!root.is_absolute()) + root = doot2::experimentsDirectory / root; + return root; +}