resample
resample#
- resample(x: Union[jax.Array, numpy.ndarray, numpy.bool_, numpy.number, bool, int, float, complex], xp: Union[jax.Array, numpy.ndarray, numpy.bool_, numpy.number, bool, int, float, complex], sdict: Dict[Tuple[str, str], jaxtyping.Complex[Array, '...']]) Dict[Tuple[str, str], jaxtyping.Complex[Array, '...']] [source]#
Resample an s-dictionary to a new frequency grid.
- Parameters
x (ArrayLike) – The x-coordinates at which to evaluate the interpolated values (desired frequency or wavelength grid).
xp (ArrayLike) – The x-coordinates of the data points, must be increasing (existing frequency or wavelength grid).
sdict (sax.SDict) – Dictionary of scattering parameters sampled at
xp
.
- Returns
Dictionary of scattering parameters resampled at
x
.- Return type
sax.SDict
Examples
S-param files define frequencies, while most simulations are done in wavelength. You can resample the s-parameters to a new frequency grid using this function:
p = Path("dc_gap=200nm_Lc=0um.sparam") _, df = load_sparams(p) f, sdict = df_to_sdict(df) wl = np.linspace(1.5, 1.6, 1000) s_new = resample(wlum2freq(wl), f, sdict) plt.plot(wl, np.abs(s_new["o1", "o3"]) ** 2)