From 78c210b15f61f034ec3db454f55cba89e23eb389 Mon Sep 17 00:00:00 2001 From: Lorenzo Volpi Date: Sat, 2 Dec 2023 02:07:13 +0100 Subject: [PATCH] sort method added --- quacc/evaluation/estimators.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/quacc/evaluation/estimators.py b/quacc/evaluation/estimators.py index d1d6f13..a736628 100644 --- a/quacc/evaluation/estimators.py +++ b/quacc/evaluation/estimators.py @@ -26,6 +26,9 @@ class CompEstimatorName_: elif isinstance(e, list): return list(self.ce._CompEstimator__get(e).keys()) + def sort(self, e: List[str]): + return list(self.ce._CompEstimator__get(e, get_ref=False).keys()) + @property def all(self): return list(self.ce._CompEstimator__get("__all").keys()) @@ -36,7 +39,7 @@ class CompEstimatorName_: class CompEstimator: - def __get(cls, e: str | List[str]): + def __get(cls, e: str | List[str], get_ref=True): _dict = method._methods | baseline._baselines match e: @@ -58,8 +61,10 @@ class CompEstimator: ) e_fun = {k: fun for k, fun in _dict.items() if k in e} - if "ref" not in e: + if get_ref and "ref" not in e: e_fun["ref"] = _dict["ref"] + elif not get_ref and "ref" in e: + del e_fun["ref"] return e_fun