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