misc
This commit is contained in:
@@ -4,5 +4,5 @@ from .physics import fiber, materials, pulse, simulate, units
|
||||
from .physics.simulate import RK4IP, parallel_RK4IP, run_simulation
|
||||
from .plotting import mean_values_plot, plot_spectrogram, propagation_plot, single_position_plot
|
||||
from .spectra import Pulse, Spectrum
|
||||
from .utils import Paths, open_config
|
||||
from .utils import Paths, open_config, parameter
|
||||
from .utils.parameter import Configuration, Parameters, PlotRange
|
||||
|
||||
@@ -116,7 +116,7 @@ def open_config(path: os.PathLike):
|
||||
|
||||
dico.setdefault("variable", {})
|
||||
for key in {"simulation", "fiber", "gas", "pulse"} & dico.keys():
|
||||
section = dico.pop(key, {})
|
||||
section = dico.pop(key)
|
||||
dico["variable"].update(section.pop("variable", {}))
|
||||
dico.update(section)
|
||||
if len(dico["variable"]) == 0:
|
||||
|
||||
@@ -1227,11 +1227,21 @@ def format_variable_list(l: list[tuple[str, Any]], add_iden=False) -> str:
|
||||
tmp_name = PARAM_SEPARATOR.join(str_list)
|
||||
if not add_iden:
|
||||
return tmp_name
|
||||
unique_id = "u_" + utils.to_62(hash(str(l)))
|
||||
branch_id = "b_" + utils.to_62(hash(str([el for el in l if el[0] != "num"])))
|
||||
unique_id = unique_identifier(l)
|
||||
branch_id = branch_identifier(l)
|
||||
return unique_id + PARAM_SEPARATOR + branch_id + PARAM_SEPARATOR + tmp_name
|
||||
|
||||
|
||||
def branch_identifier(l):
|
||||
branch_id = "b_" + utils.to_62(hash(str([el for el in l if el[0] != "num"])))
|
||||
return branch_id
|
||||
|
||||
|
||||
def unique_identifier(l):
|
||||
unique_id = "u_" + utils.to_62(hash(str(l)))
|
||||
return unique_id
|
||||
|
||||
|
||||
def format_value(name: str, value) -> str:
|
||||
if value is True or value is False:
|
||||
return str(value)
|
||||
|
||||
Reference in New Issue
Block a user