miscelanious

This commit is contained in:
Benoît Sierro
2021-08-28 14:15:10 +02:00
parent 5236beedd6
commit 46999f15f7
3 changed files with 10 additions and 5 deletions

View File

@@ -711,6 +711,13 @@ def compute_loss(params: BareParams) -> Optional[np.ndarray]:
out = np.zeros_like(params.l)
out[mask] = alpha
return out
# else:
# return np.where(
# (params.l < params.lower_wavelength_interp_limit)
# | (params.l > params.upper_wavelength_interp_limit),
# 100,
# 0,
# )
return None

View File

@@ -1019,10 +1019,8 @@ def rin_curve(spectra: np.ndarray) -> np.ndarray:
rin_curve : np.ndarray
RIN curve
"""
spec2 = abs2(spectra)
# return np.std(spec, axis=0) / np.mean(spec, axis=0)
m = np.mean(spec2, axis=0)
return np.sqrt(np.mean((spec2 - m) ** 2)) / m
A2 = abs2(spectra)
return np.std(A2, axis=0) / np.mean(A2, axis=0)
def measure_field(t: np.ndarray, field: np.ndarray) -> Tuple[float, float, float]:

View File

@@ -207,7 +207,7 @@ class RK4IP:
return self.stored_spectra
def irun(self):
def irun(self) -> Generator[tuple[int, int, np.ndarray], None, None]:
# Print introduction
self.logger.debug(