Correct initialization of convergence loop

This commit is contained in:
Jakob Lass
2025-08-21 11:41:15 +02:00
parent 25f47e5e23
commit 4f6e75915a

View File

@@ -613,11 +613,10 @@ class background():
# Loss function
loss = []#np.zeros(n_epochs, dtype=self.dtype)
old_loss = 2000000
new_loss = 1000000
old_loss = 0
new_loss = 0
k = 0
while (old_loss - new_loss > 1e-3) and (k < n_epochs):
while ((old_loss - new_loss > 1e-3) and (k < n_epochs)) or k < 2:
# Compute A = Y - B by filling the nans with 0s
A = np.where(np.isnan(Y_r - b_tmp) == True, 0.0, Y_r - b_tmp)