Better handling of no ZDW found
This commit is contained in:
@@ -23,12 +23,12 @@ def app(config_file: os.PathLike | None = None):
|
||||
|
||||
with PlotApp(
|
||||
f"Dispersion design with {config.gas.title()}",
|
||||
core_diameter_um=np.linspace(50, 300),
|
||||
core_diameter_um=np.arange(50, 301, dtype=float),
|
||||
pressure_mbar=np.geomspace(1, 2000),
|
||||
wall_thickness_um=np.geomspace(0.01, 10),
|
||||
n_tubes=np.arange(6, 16),
|
||||
gap_um=np.linspace(1, 15),
|
||||
t_fwhm_fs=np.linspace(10, 200, 96),
|
||||
gap_um=np.arange(1, 15.5, 0.5),
|
||||
t_fwhm_fs=np.arange(10, 201, dtype=float),
|
||||
) as app:
|
||||
# initial setup
|
||||
app[0].horizontal_line("reference", 0, color="gray")
|
||||
@@ -64,7 +64,7 @@ def app(config_file: os.PathLike | None = None):
|
||||
disp = compute_capillary(core_diameter_um, pressure_mbar)
|
||||
wl_zero_disp = sc.math.all_zeros(wl, disp)
|
||||
if len(wl_zero_disp) == 0:
|
||||
return
|
||||
raise ValueError("No zero dispersion found")
|
||||
wl_zero_disp = wl_zero_disp[0]
|
||||
|
||||
with warnings.catch_warnings():
|
||||
@@ -138,15 +138,22 @@ def app(config_file: os.PathLike | None = None):
|
||||
|
||||
@app.update
|
||||
def draw_energy_limit(core_diameter_um: float, pressure_mbar: float, t_fwhm_fs: float):
|
||||
lim = compute_max_energy(core_diameter_um, pressure_mbar, t_fwhm_fs)
|
||||
zdw = lim.wl_zero_disp * 1e9
|
||||
app[0].set_line_data("zdw", [zdw, zdw], [-3, 3])
|
||||
|
||||
info_lines = [
|
||||
f"gas = {config.gas.title()}",
|
||||
f"rep rate = {config.rep_rate*1e-3}kHz",
|
||||
f"ZDW = {zdw:.0f}nm",
|
||||
]
|
||||
|
||||
try:
|
||||
lim = compute_max_energy(core_diameter_um, pressure_mbar, t_fwhm_fs)
|
||||
except ValueError:
|
||||
info_lines.append("No ZDW found")
|
||||
app.info_label.setText("\n".join(info_lines))
|
||||
return
|
||||
|
||||
zdw = lim.wl_zero_disp * 1e9
|
||||
app[0].set_line_data("zdw", [zdw, zdw], [-3, 3])
|
||||
|
||||
info_lines.append(f"ZDW = {zdw:.0f}nm")
|
||||
if lim.ion_lim > lim.sf_lim:
|
||||
power = lim.sf_lim * 1e3 * config.rep_rate
|
||||
info_lines += [
|
||||
|
||||
Reference in New Issue
Block a user