docs line length fixes
This commit is contained in:
@@ -58,7 +58,8 @@ def lambda_for_full_field_dispersion(
|
||||
subset of l in the interpolation range with two extra values on each side
|
||||
to accomodate for taking gradients
|
||||
np.ndarray
|
||||
indices of the original l where the values are valid (i.e. without the two extra on each side)
|
||||
indices of the original l where the values are valid
|
||||
(i.e. without the two extra on each side)
|
||||
"""
|
||||
su = np.where((l >= wavelength_window[0]) & (l <= wavelength_window[1]))[0]
|
||||
if l[su].min() > 1.01 * wavelength_window[0]:
|
||||
@@ -73,7 +74,9 @@ def lambda_for_full_field_dispersion(
|
||||
|
||||
|
||||
def is_dynamic_dispersion(pressure=None):
|
||||
"""tests if the parameter dictionary implies that the dispersion profile of the fiber changes with z
|
||||
"""
|
||||
tests if the parameter dictionary implies that the dispersion profile of
|
||||
the fiber changes with z
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -93,8 +96,8 @@ def is_dynamic_dispersion(pressure=None):
|
||||
|
||||
def gvd_from_n_eff(n_eff: np.ndarray, wl_for_disp: np.ndarray):
|
||||
"""computes the dispersion parameter D from an effective index of refraction n_eff
|
||||
Since computing gradients/derivatives of discrete arrays is not well defined on the boundary, it is
|
||||
advised to chop off the two values on either end of the returned array
|
||||
Since computing gradients/derivatives of discrete arrays is not well defined on the boundary,
|
||||
it is advised to chop off the two values on either end of the returned array
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -175,7 +178,9 @@ def n_eff_marcatili(wl_for_disp, n_gas_2, core_radius, he_mode=(1, 1)):
|
||||
|
||||
|
||||
def n_eff_marcatili_adjusted(wl_for_disp, n_gas_2, core_radius, he_mode=(1, 1), fit_parameters=()):
|
||||
"""computes the effective refractive index according to the Marcatili model of a capillary but adjusted at longer wavelengths
|
||||
"""
|
||||
computes the effective refractive index according to the Marcatili model of a capillary
|
||||
but adjusted at longer wavelengths
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -196,7 +201,8 @@ def n_eff_marcatili_adjusted(wl_for_disp, n_gas_2, core_radius, he_mode=(1, 1),
|
||||
|
||||
Reference
|
||||
----------
|
||||
Köttig, F., et al. "Novel mid-infrared dispersive wave generation in gas-filled PCF by transient ionization-driven changes in dispersion." arXiv preprint arXiv:1701.04843 (2017).
|
||||
Köttig, F., et al. "Novel mid-infrared dispersive wave generation in gas-filled PCF by
|
||||
transient ionization-driven changes in dispersion." arXiv preprint arXiv:1701.04843 (2017).
|
||||
"""
|
||||
u = u_nm(*he_mode)
|
||||
|
||||
@@ -293,24 +299,26 @@ def n_eff_hasan(
|
||||
capillary_spacing: float,
|
||||
capillary_resonance_strengths: list[float],
|
||||
) -> np.ndarray:
|
||||
"""computes the effective refractive index of the fundamental mode according to the Hasan model for a anti-resonance fiber
|
||||
"""
|
||||
computes the effective refractive index of the fundamental mode according to the Hasan
|
||||
model for a anti-resonance fiber
|
||||
|
||||
Parameters
|
||||
----------
|
||||
wl_for_disp
|
||||
wavelenghs array (m)
|
||||
wl_for_disp : np.ndarray, shape(n,)
|
||||
wavelenghs array
|
||||
n_gas_2 : ndarray, shape (n, )
|
||||
squared refractive index of the gas as a function of wl_for_disp
|
||||
core_radius : float
|
||||
radius of the core (m) (from cented to edge of a capillary)
|
||||
radius of the core (from cented to edge of a capillary)
|
||||
capillary_num : int
|
||||
number of capillaries
|
||||
capillary_nested : int, optional
|
||||
number of levels of nested capillaries. default : 0
|
||||
capillary_thickness : float
|
||||
thickness of the capillaries (m)
|
||||
thickness of the capillaries
|
||||
capillary_spacing : float
|
||||
spacing between capillaries (m)
|
||||
spacing between capillaries
|
||||
capillary_resonance_strengths : list or tuple
|
||||
strengths of the resonance lines. may be empty
|
||||
|
||||
@@ -470,7 +478,9 @@ def beta1(w_for_disp: np.ndarray, n_eff: np.ndarray) -> np.ndarray:
|
||||
|
||||
|
||||
def beta2(w_for_disp: np.ndarray, n_eff: np.ndarray) -> np.ndarray:
|
||||
"""computes the dispersion parameter beta2 according to the effective refractive index of the fiber and the frequency range
|
||||
"""
|
||||
computes the dispersion parameter beta2 according to the effective refractive
|
||||
index of the fiber and the frequency range
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -509,8 +519,9 @@ def HCPCF_dispersion(
|
||||
model : string {"marcatili", "marcatili_adjusted", "hasan"}
|
||||
which model of effective refractive index to use
|
||||
model_params : tuple
|
||||
to be cast to the function in charge of computing the effective index of the fiber. Every n_eff_* function has a signature
|
||||
n_eff_(wl_for_disp, n_gas_2, radius, *args) and model_params corresponds to args
|
||||
to be passed on to the function in charge of computing the effective index of the fiber.
|
||||
Every n_eff_* function has a signature
|
||||
`n_eff_(wl_for_disp, n_gas_2, radius, *args)` and model_params corresponds to args
|
||||
temperature : float
|
||||
Temperature of the material
|
||||
pressure : float
|
||||
@@ -566,8 +577,8 @@ def n_eff_pcf(wl_for_disp: np.ndarray, pcf_pitch: float, pcf_pitch_ratio: float)
|
||||
|
||||
Reference
|
||||
---------
|
||||
Formulas and values are from Saitoh K and Koshiba M, "Empirical relations for simple design of photonic crystal fibers" (2005)
|
||||
|
||||
Formulas and values are from Saitoh K and Koshiba M, "Empirical relations for
|
||||
simple design of photonic crystal fibers" (2005)
|
||||
"""
|
||||
# Check validity
|
||||
if pcf_pitch_ratio < 0.2 or pcf_pitch_ratio > 0.8:
|
||||
|
||||
@@ -254,7 +254,8 @@ class Gas:
|
||||
def chi3(self, temperature: float | None = None, pressure: float | None = None) -> float:
|
||||
"""nonlinear susceptibility"""
|
||||
|
||||
# if pressure and/or temperature are specified, adjustment is made according to number density ratio
|
||||
# if pressure and/or temperature are specified, adjustment is made
|
||||
# according to number density ratio
|
||||
if pressure is not None or temperature is not None:
|
||||
N0 = self.number_density_van_der_waals()
|
||||
N = self.number_density_van_der_waals(pressure, temperature)
|
||||
|
||||
@@ -42,7 +42,10 @@ P0T0_to_E0_fac = dict(
|
||||
sech=2, # int(a * sech(x / b)^2 * dx) from -inf to inf = 2 * a * b
|
||||
gaussian=np.sqrt(pi / 2), # int(a * exp(-(x/b)^2)^2 * dx) from -inf to inf = sqrt(pi/2) * a * b
|
||||
)
|
||||
"""relates the total energy (amplitue^2) to the t0 parameter of the amplitude and the peak intensity (peak_amplitude^2)"""
|
||||
"""
|
||||
relates the total energy (amplitue^2) to the t0 parameter of the
|
||||
amplitude and the peak intensity (peak_amplitude^2)
|
||||
"""
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -271,8 +274,9 @@ def conform_pulse_params(
|
||||
indicated by the order in which the parameters are enumerated below holds,
|
||||
meaning the superflous parameters will be overwritten.
|
||||
choose one of the possible combinations :
|
||||
1 of (width, t0), 1 of (peak_power, energy), gamma and beta2 together optional (not one without the other)
|
||||
soliton_num, gamma, 1 of (width, peak_power, energy, t0)
|
||||
[1 of (width, t0), 1 of (peak_power, energy)]
|
||||
adding both gamma and beta2 is optional
|
||||
[soliton_num, gamma, 1 of (width, peak_power, energy, t0)]
|
||||
examples :
|
||||
specify width, peak_power and energy -> t0 and energy will be computed
|
||||
specify soliton_num, gamma, peak_power, t0 -> width, t0 and energy will be computed
|
||||
@@ -578,9 +582,10 @@ def compress_pulse(spectra):
|
||||
Parameters
|
||||
----------
|
||||
spectra : ND array
|
||||
spectra to compress. The shape must be at least 2D. Compression occurs along the -2th axis.
|
||||
This means spectra have to be of shape ([what, ever,] n, nt) where n is the number of spectra
|
||||
brought together for one compression operation and nt the resolution of the grid.
|
||||
spectra to compress. The shape must be at least 2D. Compression occurs along
|
||||
the -2th axis. This means spectra have to be of shape ([what, ever,] n, nt) where n
|
||||
is the number of spectra brought together for one compression operation and nt the
|
||||
resolution of the grid.
|
||||
|
||||
Returns
|
||||
----------
|
||||
@@ -727,7 +732,8 @@ def peak_ind(values, mam=None):
|
||||
Returns
|
||||
----------
|
||||
left_ind, right_ind : int
|
||||
indices of the the left and right spots where values starts rising again, with a margin of 3
|
||||
indices of the the left and right spots where values starts rising again,
|
||||
with a margin of 3
|
||||
"""
|
||||
|
||||
if mam is None:
|
||||
@@ -755,8 +761,9 @@ def peak_ind(values, mam=None):
|
||||
|
||||
|
||||
def setup_splines(x_axis, values, mam=None):
|
||||
"""sets up spline interpolation to better measure a peak. Different splines with different orders are
|
||||
necessary because derivatives and second derivatives are computed to find extremea and inflection points
|
||||
"""sets up spline interpolation to better measure a peak. Different splines with different
|
||||
orders are necessary because derivatives and second derivatives are computed to find extremea
|
||||
and inflection points
|
||||
Parameters
|
||||
----------
|
||||
x_axis : 1D array
|
||||
@@ -925,7 +932,8 @@ def _select_roots(d_spline, d_roots, dd_roots, fwhm_pos):
|
||||
right_lim : list
|
||||
location of the right limit
|
||||
"""
|
||||
# includes inflection points when slope is low (avoids considering the inflection points around fwhm limits)
|
||||
# includes inflection points when slope is low
|
||||
# (avoids considering the inflection points around fwhm limits)
|
||||
|
||||
all_roots = np.append(d_roots, dd_roots)
|
||||
good_roots = all_roots[np.abs(d_spline(all_roots)) < np.max(d_spline(all_roots)) / 10]
|
||||
|
||||
@@ -137,7 +137,10 @@ def create_zoom_axis(
|
||||
frame_style=dict(c="k", lw=0.5),
|
||||
plot=True,
|
||||
):
|
||||
"""creates a zoomed in plot inside a plot. Should be called as a last step as parent axis limits will be locked
|
||||
"""
|
||||
creates a zoomed in plot inside a plot. Should be called as a last step as parent axis
|
||||
limits will be locked
|
||||
|
||||
Parameters
|
||||
----------
|
||||
axis : parent axis object
|
||||
@@ -296,7 +299,8 @@ def propagation_plot(
|
||||
skip : int, optional
|
||||
only plot one every skip values along the x axis (y if transposed), by default 1
|
||||
cbar_label : Optional[str], optional
|
||||
label of the colorbar. No colorbar is drawn if this is set to None, by default "normalized intensity (dB)"
|
||||
label of the colorbar. No colorbar is drawn if this is set to None,
|
||||
by default "normalized intensity (dB)"
|
||||
cmap : str, optional
|
||||
colormap, by default None
|
||||
ax : Axes, optional
|
||||
@@ -565,7 +569,9 @@ def transform_mean_values(
|
||||
log: Union[bool, int, float] = False,
|
||||
spacing: Union[int, float] = 1,
|
||||
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
|
||||
"""transforms values similar to transform_1D_values but with a collection of lines, giving also the mean
|
||||
"""
|
||||
transforms values similar to transform_1D_values but with a collection of lines,
|
||||
giving also the mean
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -851,7 +857,8 @@ def plot_spectrogram(
|
||||
----------
|
||||
values : 2D array
|
||||
axis 0 defines the position in the fiber and axis 1 the position in time, frequency or wl
|
||||
example : [[1, 2, 3], [0, 1, 0]] describes a quantity at 3 different freq/time and at two locations in the fiber
|
||||
example : [[1, 2, 3], [0, 1, 0]] describes a quantity at 3 different freq/time and at
|
||||
two locations in the fiber
|
||||
x_range, y_range : PlotRange
|
||||
one of them must be time, the other one must be wl/freq
|
||||
min, max : int or float
|
||||
|
||||
@@ -394,7 +394,8 @@ class SimulatedFiber:
|
||||
z_ind : int
|
||||
z_index relative to the entire simulation
|
||||
sim_ind : int, optional
|
||||
simulation index, used when repeated simulations with same parameters are ran, by default 0
|
||||
simulation index, used when repeated simulations with same parameters are ran,
|
||||
by default 0
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
||||
Reference in New Issue
Block a user