change: facilitate recovery
This commit is contained in:
@@ -234,7 +234,7 @@ class Evaluator:
|
||||
if dico is None, update the internal dict of parameters with params
|
||||
"""
|
||||
for k, v in params.items():
|
||||
self.main_map[k] = EvaluatedValue(v, np.inf)
|
||||
self.main_map[k] = EvaluatedValue(v, INF)
|
||||
|
||||
def reset(self):
|
||||
self.main_map = {}
|
||||
|
||||
@@ -494,9 +494,9 @@ class Parameters:
|
||||
def copy(self, deep: bool = True, freeze: bool = False) -> Parameters:
|
||||
"""create a deep copy of self. if freeze is True, the returned copy is read-only"""
|
||||
if deep:
|
||||
params = Parameters(**deepcopy(self.strip_params_dict()))
|
||||
params = Parameters(**deepcopy(self._param_dico))
|
||||
else:
|
||||
params = Parameters(**self.strip_params_dict())
|
||||
params = Parameters(**self._param_dico)
|
||||
if freeze:
|
||||
params.freeze()
|
||||
return params
|
||||
|
||||
@@ -161,19 +161,20 @@ def solve43(
|
||||
else:
|
||||
h = 0.000664237859 # from Luna
|
||||
const_step_size = False
|
||||
k5 = nonlinear(spec, 0)
|
||||
z = 0
|
||||
stats = {}
|
||||
rejected = []
|
||||
if targets is not None:
|
||||
if len(targets) <= 1:
|
||||
return
|
||||
targets = list(sorted(set(targets)))
|
||||
if targets[0] == 0:
|
||||
targets.pop(0)
|
||||
h = min(h, targets[0] / 2)
|
||||
z = targets[0]
|
||||
h = min(h, (targets[1] - targets[0]) / 2)
|
||||
targets.pop(0)
|
||||
|
||||
k5 = nonlinear(spec, z)
|
||||
step_ind = 0
|
||||
msg = TimedMessage(2)
|
||||
running = True
|
||||
last_error = 0
|
||||
error = 0
|
||||
store_next = False
|
||||
@@ -183,7 +184,7 @@ def solve43(
|
||||
|
||||
yield spec, stats() | dict(h=0)
|
||||
|
||||
while running:
|
||||
while True:
|
||||
expD = np.exp(h * 0.5 * linear(z))
|
||||
|
||||
A_I = expD * spec
|
||||
|
||||
@@ -17,7 +17,7 @@ def test_rk43_absorbtion_only():
|
||||
)
|
||||
non_lin = op.no_op_freq(n)
|
||||
|
||||
res = sc.integrate(spec0, 1.0, lin, non_lin, targets=[1.0])
|
||||
res = sc.integrate(spec0, 1.0, lin, non_lin, targets=[0, 1.0])
|
||||
assert np.max(sc.abs2(res.spectra[-1])) == pytest.approx(0.5)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user