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