Merge branch 'master' into dev
This commit is contained in:
@@ -720,7 +720,7 @@ class Configuration:
|
||||
num = utils.find_last_spectrum_num(data_dir)
|
||||
if config_dict is None:
|
||||
try:
|
||||
config_dict = utils._open_config(data_dir / PARAM_FN)
|
||||
config_dict = utils.load_toml(data_dir / PARAM_FN)
|
||||
except FileNotFoundError:
|
||||
self.logger.warning(f"did not find {PARAM_FN!r} in {data_dir}")
|
||||
return self.State.ABSENT, 0
|
||||
|
||||
@@ -172,8 +172,7 @@ class VariationDescriptor(BaseModel):
|
||||
str_list = []
|
||||
|
||||
for p_name, p_value in self.flat:
|
||||
ps = p_name.replace("/", "").replace("\\", "").replace(PARAM_SEPARATOR, "")
|
||||
vs = self.format_value(p_name, p_value).replace("/", "").replace(PARAM_SEPARATOR, "")
|
||||
ps, vs = self._format_single_pair(p_name, p_value)
|
||||
str_list.append(ps + PARAM_SEPARATOR + vs)
|
||||
tmp_name = PARAM_SEPARATOR.join(str_list)
|
||||
if not add_identifier:
|
||||
@@ -182,6 +181,11 @@ class VariationDescriptor(BaseModel):
|
||||
self.identifier + PARAM_SEPARATOR + self.branch.identifier + PARAM_SEPARATOR + tmp_name
|
||||
)
|
||||
|
||||
def _format_single_pair(self, p_name: str, p_value: Any) -> tuple[str, str]:
|
||||
ps = p_name.replace("/", "").replace("\\", "").replace(PARAM_SEPARATOR, "")
|
||||
vs = self.format_value(p_name, p_value).replace("/", "").replace(PARAM_SEPARATOR, "")
|
||||
return ps, vs
|
||||
|
||||
def __getitem__(self, key) -> "VariationDescriptor":
|
||||
return VariationDescriptor(
|
||||
raw_descr=self.raw_descr[key], index=self.index[key], separator=self.separator
|
||||
@@ -235,6 +239,13 @@ class VariationDescriptor(BaseModel):
|
||||
yield from p.iter_parents()
|
||||
yield self
|
||||
|
||||
@property
|
||||
def short(self) -> str:
|
||||
"""shortened description of the simulation"""
|
||||
return " ".join(
|
||||
self._format_single_pair(p, v)[1] for p, v in self.flat if p not in {"fiber", "num"}
|
||||
)
|
||||
|
||||
@property
|
||||
def flat(self) -> list[tuple[str, Any]]:
|
||||
out = []
|
||||
|
||||
Reference in New Issue
Block a user