added auto range functions

This commit is contained in:
Benoît Sierro
2023-10-11 15:21:07 +02:00
parent 232cea62bd
commit 2e878303a5

View File

@@ -1155,6 +1155,16 @@ def annotate_fwhm(
ax.text(x, y, arrow_label, transform=trans, **text_kwargs)
def auto_time_range(t: np.ndarray, t_int: np.ndarray, threshold: float) -> PlotRange:
imin, imax = math.span_above(t_int, t_int.max() * threshold)
return PlotRange(t[imin] * 1e15, t[imax] * 1e15, "fs")
def auto_wl_range(wl: np.ndarray, wl_int: np.ndarray, threshold: float) -> PlotRange:
imin, imax = math.span_above(wl_int, wl_int.max() * threshold)
return PlotRange(wl[imin] * 1e9, wl[imax] * 1e9, "nm")
def summary_plot(
specs: Spectrum,
z: Sequence[float] | None = None,