better logging
This commit is contained in:
7
TODO.md
Normal file
7
TODO.md
Normal file
@@ -0,0 +1,7 @@
|
||||
* plot cli command should show by default, not save
|
||||
* logger should hook to pbar when it exists
|
||||
* find a way to make evaluator debugging easier
|
||||
|
||||
# Ideas
|
||||
|
||||
* have a `scan` section in the config to more granularly control parameter scanning. That way, the user provides single default values to all necessary parameters and then call the single-sim or scan commands to run the config accordingly.
|
||||
@@ -234,7 +234,7 @@ class Evaluator:
|
||||
else:
|
||||
v_str = format(returned_value).replace("\n", "")
|
||||
success_str = f"computed {param_name}={v_str} "
|
||||
self.logger.info(
|
||||
self.logger.debug(
|
||||
prefix
|
||||
+ success_str
|
||||
+ f"using {rule.func.__name__} from {rule.func.__module__}"
|
||||
@@ -382,6 +382,9 @@ default_rules: list[Rule] = [
|
||||
),
|
||||
Rule("n2", materials.gas_n2),
|
||||
Rule("n2", lambda: 2.2e-20, priorities=-1),
|
||||
Rule("gamma", lambda gamma_arr: gamma_arr[0], priorities=-1),
|
||||
Rule("gamma", fiber.gamma_parameter),
|
||||
Rule("gamma_arr", fiber.gamma_parameter, ["n2", "w0", "A_eff_arr"]),
|
||||
# operators
|
||||
Rule("n_op", operators.ConstantRefractiveIndex),
|
||||
Rule("n_op", operators.MarcatiliRefractiveIndex),
|
||||
@@ -411,10 +414,6 @@ envelope_rules = default_rules + [
|
||||
fiber.load_custom_dispersion,
|
||||
priorities=[2, 2, 2],
|
||||
),
|
||||
# Nonlinearity
|
||||
Rule("gamma", lambda gamma_arr: gamma_arr[0], priorities=-1),
|
||||
Rule("gamma", fiber.gamma_parameter),
|
||||
Rule("gamma_arr", fiber.gamma_parameter, ["n2", "w0", "A_eff_arr"]),
|
||||
# Operators
|
||||
Rule("gamma_op", operators.ConstantGamma, priorities=1),
|
||||
Rule("gamma_op", operators.ConstantScalarGamma),
|
||||
@@ -446,6 +445,7 @@ full_field_rules = default_rules + [
|
||||
# Dispersion
|
||||
Rule(["wl_for_disp", "dispersion_ind"], fiber.lambda_for_full_field_dispersion),
|
||||
Rule("frame_velocity", fiber.frame_velocity),
|
||||
Rule("beta2", lambda beta2_arr, w0_ind: beta2_arr[w0_ind]),
|
||||
# Nonlinearity
|
||||
Rule("chi3", materials.gas_chi3),
|
||||
# Operators
|
||||
|
||||
@@ -627,6 +627,7 @@ def beta2(w_for_disp: np.ndarray, n_eff: np.ndarray) -> np.ndarray:
|
||||
return np.gradient(np.gradient(beta(w_for_disp, n_eff), w_for_disp), w_for_disp)
|
||||
|
||||
|
||||
|
||||
def frame_velocity(beta1_arr: np.ndarray, w0_ind: int) -> float:
|
||||
return 1.0 / beta1_arr[w0_ind]
|
||||
|
||||
|
||||
@@ -131,6 +131,7 @@ class RK4IP:
|
||||
def run(self) -> list[np.ndarray]:
|
||||
time_start = datetime.today()
|
||||
state = self.init_state
|
||||
self.logger.info(f"integration scheme : {self.params.integration_scheme}")
|
||||
for num, state in self.irun():
|
||||
if self.save_data:
|
||||
self._save_current_spectrum(state.actual_spectrum, num)
|
||||
|
||||
@@ -23,7 +23,8 @@ class Variationer:
|
||||
|
||||
Example
|
||||
-------
|
||||
`>> var = Variationer([dict(a=[1, 2]), [dict(b=["000", "111"], c=["a", "-1"])]])
|
||||
```
|
||||
>> var = Variationer([dict(a=[1, 2]), [dict(b=["000", "111"], c=["a", "-1"])]])
|
||||
list(v.raw_descr for v in var.iterate())
|
||||
|
||||
[
|
||||
@@ -31,8 +32,8 @@ class Variationer:
|
||||
((("a", 1),), (("b", "111"), ("c", "-1"))),
|
||||
((("a", 2),), (("b", "000"), ("c", "a"))),
|
||||
((("a", 2),), (("b", "111"), ("c", "-1"))),
|
||||
]`
|
||||
|
||||
]
|
||||
```
|
||||
"""
|
||||
|
||||
all_indices: list[list[int]]
|
||||
|
||||
Reference in New Issue
Block a user