From 0b489a868ed6efd9a9ed0fef80a601acecaf384e Mon Sep 17 00:00:00 2001 From: Joaquin Matres <4514346+joamatab@users.noreply.github.com> Date: Sun, 6 Aug 2023 15:38:09 -0700 Subject: [PATCH] improve notebook --- docs/notebooks/11_sparameters_gratings.py | 27 ++++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/docs/notebooks/11_sparameters_gratings.py b/docs/notebooks/11_sparameters_gratings.py index d0914a8b..d0808043 100644 --- a/docs/notebooks/11_sparameters_gratings.py +++ b/docs/notebooks/11_sparameters_gratings.py @@ -40,8 +40,23 @@ ) f = gt.plot_simulation(s) + +# %% +def log(x): + return 20 * np.log10(x) + + +# %% +sp = gt.write_sparameters_grating_coupler( + c, + is_3d=False, + fiber_angle_deg=fiber_angle_deg, + fiber_xoffset=0, + filepath=PATH.sparameters / "gc_te1550.npz", +) + # %% -offsets = np.arange(-15, 6, 5) +offsets = np.arange(-5, 5 + 1, 5) offsets # %% @@ -52,17 +67,13 @@ fiber_angle_deg=fiber_angle_deg, fiber_xoffset=fiber_xoffset, dirpath=PATH.sparameters, + filepath=PATH.sparameters + / f"{c.name}_{fiber_angle_deg:.1f}deg_{fiber_xoffset:.1f}um.npz", ) for fiber_xoffset in offsets ] sps = gt.write_sparameters_grating_coupler_batch(jobs) - -# %% -def log(x): - return 20 * np.log10(x) - - # %% for offset in offsets: sp = gt.write_sparameters_grating_coupler( @@ -70,7 +81,7 @@ def log(x): is_3d=False, fiber_angle_deg=fiber_angle_deg, fiber_xoffset=offset, - dirpath=PATH.sparameters, + filepath=PATH.sparameters / f"gc_{offset}.npz", ) plt.plot( sp["wavelengths"],