nothing fancy

This commit is contained in:
Benoît Sierro
2023-01-24 09:33:43 +01:00
parent aa225a0820
commit 239eaddd7c
7 changed files with 2992 additions and 253 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,271 +1,262 @@
[silica.sellmeier] [silica.sellmeier]
B = [0.6961663, 0.4079426, 0.8974794] B = [0.6961663, 0.4079426, 0.8974794]
C = [4.67914826e-15, 1.35120631e-14, 9.79340025e-11] C = [4.67914826e-15, 1.35120631e-14, 9.79340025e-11]
kind = 1 kind = 1
reference = [ reference = [
"I. H. Malitson. Interspecimen comparison of the refractive index of fused silica, J. Opt. Soc. Am. 55, 1205-1208 (1965)", "I. H. Malitson. Interspecimen comparison of the refractive index of fused silica, J. Opt. Soc. Am. 55, 1205-1208 (1965)",
"C. Z. Tan. Determination of refractive index of silica glass for infrared wavelengths by IR spectroscopy, J. Non-Cryst. Solids 223, 158-163 (1998)", "C. Z. Tan. Determination of refractive index of silica glass for infrared wavelengths by IR spectroscopy, J. Non-Cryst. Solids 223, 158-163 (1998)",
] ]
[nbk7.sellmeier] [nbk7.sellmeier]
B = [1.03961212, 0.231792344, 1.01046945] B = [1.03961212, 0.231792344, 1.01046945]
C = [6.00069867e-15, 2.00179144e-14, 1.03560653e-10] C = [6.00069867e-15, 2.00179144e-14, 1.03560653e-10]
kind = 1 kind = 1
reference = [ reference = ["SCHOTT Zemax catalog 2017-01-20b (obtained from http://www.schott.com)"]
"SCHOTT Zemax catalog 2017-01-20b (obtained from http://www.schott.com)",
]
[e7.sellmeier] [e7.sellmeier]
B = [0.0, 7.2e-15, 3e-28] B = [0.0, 7.2e-15, 3e-28]
C = [] C = []
kind = 3 kind = 3
reference = [ reference = [
"J. Li, C. H. Wen, S. Gauza, R. Lu and S. T. Wu. Refractive indices of liquid crystals for display applications, J. Disp. Technol. 1, 51-61, 2005", "J. Li, C. H. Wen, S. Gauza, R. Lu and S. T. Wu. Refractive indices of liquid crystals for display applications, J. Disp. Technol. 1, 51-61, 2005",
] ]
[d-zlaf52la.sellmeier] [d-zlaf52la.sellmeier]
B = [ B = [-8.48750283e9, 3.1753525, 3.71301651e-14, -1.09609062e-27, 2.4418582e-40, -8.94583294e-54]
-8.48750283e9, C = []
3.1753525, kind = 3
3.71301651e-14, reference = ["CDGM Zemax catalog 2017-09 (obtained from http://www.cdgmgd.com)"]
-1.09609062e-27,
2.4418582e-40,
-8.94583294e-54,
]
C = []
kind = 3
reference = ["CDGM Zemax catalog 2017-09 (obtained from http://www.cdgmgd.com)"]
# ----- # -----
# GASES # GASES
# ----- # -----
[air] [air]
a = 0.1358 a = 0.1358
b = 3.64e-5 atomic_mass = 4.809e-26
atomic_mass = 4.809e-26 b = 3.64e-5
[air.sellmeier] [air.sellmeier]
B = [57921050000.0, 1679170000.0] B = [57921050000.0, 1679170000.0]
C = [238018500000000.0, 57362000000000.0] C = [238018500000000.0, 57362000000000.0]
P0 = 101325 P0 = 101325
T0 = 288.15 T0 = 288.15
kind = 2 kind = 2
[air.kerr] [air.kerr]
P0 = 101325 P0 = 101325
T0 = 293.15 T0 = 293.15
n2 = 4.0e-23 n2 = 4.0e-23
source = "Pigeon, J. J., Tochitsky, S. Y., Welch, E. C., & Joshi, C. (2016). Measurements of the nonlinear refractive index of air, N 2, and O 2 at 10 μm using four-wave mixing. Optics letters, 41(17), 3924-3927." source = "Pigeon, J. J., Tochitsky, S. Y., Welch, E. C., & Joshi, C. (2016). Measurements of the nonlinear refractive index of air, N 2, and O 2 at 10 μm using four-wave mixing. Optics letters, 41(17), 3924-3927."
[nitrogen] [nitrogen]
a = 0.137 a = 0.137
b = 1.709e-5 atomic_mass = 2.3259e-26
atomic_mass = 2.3259e-26 b = 1.709e-5
[nitrogen.sellmeier] [nitrogen.sellmeier]
B = [32431570000.0] B = [32431570000.0]
C = [144000000000000.0] C = [144000000000000.0]
P0 = 101325 P0 = 101325
T0 = 273.15 T0 = 273.15
const = 6.8552e-5 const = 6.8552e-5
kind = 2 kind = 2
[nitrogen.kerr] [nitrogen.kerr]
P0 = 30400.0 P0 = 30400.0
T0 = 273.15 T0 = 273.15
n2 = 2.2e-23 n2 = 2.2e-23
source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904." source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904."
[helium] [helium]
a = 0.00346 a = 0.00346
b = 2.38e-5 atomic_mass = 6.646477e-27
ionization_energy = 3.9393356074281e-18 atomic_number = 2
atomic_number = 2 b = 2.38e-5
atomic_mass = 6.646477e-27 ionization_energy = 3.9393356074281e-18
[helium.sellmeier] [helium.sellmeier]
B = [2.16463842e-5, 2.10561127e-7, 4.7509272e-5] B = [2.16463842e-5, 2.10561127e-7, 4.7509272e-5]
C = [-6.80769781e-16, 5.13251289e-15, 3.18621354e-15] C = [-6.80769781e-16, 5.13251289e-15, 3.18621354e-15]
P0 = 101325 P0 = 101325
T0 = 273.15 T0 = 273.15
kind = 1 kind = 1
source = "A. Ermolov, K. F. Mak, M. H. Frosz, J. C. Travers, P. St. J. Russell, Supercontinuum generation in the vacuum ultraviolet through dispersive-wave and soliton-plasma interaction in a noble-gas-filled hollow-core photonic crystal fiber, Phys. Rev. A 92, 033821 (2015)" source = "A. Ermolov, K. F. Mak, M. H. Frosz, J. C. Travers, P. St. J. Russell, Supercontinuum generation in the vacuum ultraviolet through dispersive-wave and soliton-plasma interaction in a noble-gas-filled hollow-core photonic crystal fiber, Phys. Rev. A 92, 033821 (2015)"
[helium.kerr] [helium.kerr]
P0 = 30400.0 P0 = 30400.0
T0 = 273.15 T0 = 273.15
n2 = 3.1e-25 n2 = 3.1e-25
source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904." source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904."
[helium_alt] [helium_alt]
a = 0.00346 a = 0.00346
b = 2.38e-5 b = 2.38e-5
[helium_alt.sellmeier] [helium_alt.sellmeier]
B = [14755297000.0] B = [14755297000.0]
C = [426297400000000.0] C = [426297400000000.0]
P0 = 101325 P0 = 101325
T0 = 273.15 T0 = 273.15
kind = 2 kind = 2
source = " C. Cuthbertson and M. Cuthbertson. The refraction and dispersion of neon and helium. Proc. R. Soc. London A 135, 40-47 (1936)" source = " C. Cuthbertson and M. Cuthbertson. The refraction and dispersion of neon and helium. Proc. R. Soc. London A 135, 40-47 (1936)"
[helium_alt.kerr] [helium_alt.kerr]
P0 = 30400.0 P0 = 30400.0
T0 = 273.15 T0 = 273.15
n2 = 3.1e-25 n2 = 3.1e-25
[hydrogen] [hydrogen]
a = 0.02453 a = 0.02453
b = 2.651e-5 atomic_mass = 1.674e-27
atomic_mass = 1.674e-27 b = 2.651e-5
[hydrogen.sellmeier] [hydrogen.sellmeier]
B = [0.0148956, 0.0049037] B = [0.0148956, 0.0049037]
C = [1.807e-10, 9.2e-11] C = [1.807e-10, 9.2e-11]
P0 = 101325 P0 = 101325
T0 = 273.15 T0 = 273.15
kind = 2 kind = 2
source = "E. R. Peck and S. Hung. Refractivity and dispersion of hydrogen in the visible and near infrared, J. Opt. Soc. Am. 67, 1550-1554 (1977)" source = "E. R. Peck and S. Hung. Refractivity and dispersion of hydrogen in the visible and near infrared, J. Opt. Soc. Am. 67, 1550-1554 (1977)"
[hydrogen.kerr] [hydrogen.kerr]
P0 = 30400.0 P0 = 30400.0
T0 = 273.15 T0 = 273.15
n2 = 6.36e-24 n2 = 6.36e-24
source = "Shelton, D. P., & Rice, J. E. (1994). Measurements and calculations of the hyperpolarizabilities of atoms and small molecules in the gas phase. Chemical Reviews, 94(1), 3-29" source = "Shelton, D. P., & Rice, J. E. (1994). Measurements and calculations of the hyperpolarizabilities of atoms and small molecules in the gas phase. Chemical Reviews, 94(1), 3-29"
[neon] [neon]
a = 0.02135 a = 0.02135
b = 1.709e-5 atomic_mass = 3.35092e-26
ionization_energy = 3.45501365359425e-18 atomic_number = 10
atomic_number = 10 b = 1.709e-5
atomic_mass = 3.35092e-26 ionization_energy = 3.45501365359425e-18
[neon.sellmeier] [neon.sellmeier]
B = [1281450000.0, 22048600000.0] B = [1281450000.0, 22048600000.0]
C = [184661000000000.0, 376840000000000.0] C = [184661000000000.0, 376840000000000.0]
P0 = 101325 P0 = 101325
T0 = 273.15 T0 = 273.15
kind = 2 kind = 2
[neon.kerr] [neon.kerr]
P0 = 30400.0 P0 = 30400.0
T0 = 273.15 T0 = 273.15
n2 = 8.7e-25 n2 = 8.7e-25
source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904." source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904."
[argon] [argon]
a = 0.1355 a = 0.1355
b = 3.201e-5 atomic_mass = 6.6338e-26
ionization_energy = 2.5249661793774e-18 atomic_number = 18
atomic_number = 18 b = 3.201e-5
atomic_mass = 6.6338e-26 ionization_energy = 2.5249661793774e-18
[argon.sellmeier] [argon.sellmeier]
B = [2501410000.0, 500283000.0, 52234300000.0] B = [2501410000.0, 500283000.0, 52234300000.0]
C = [91012000000000.0, 87892000000000.0, 214020000000000.0] C = [91012000000000.0, 87892000000000.0, 214020000000000.0]
P0 = 101325 P0 = 101325
T0 = 273.15 T0 = 273.15
kind = 2 kind = 2
source = "A. Bideau-Mehu, Y. Guern, R. Abjean, A. Johannin-Gilles. Measurement of refractive indices of neon, argon, krypton and xenon in the 253.7-140.4 nm wavelength range. Dispersion relations and estimated oscillator strengths of the resonance lines. J. Quant. Spectrosc. Rad. Transfer 25, 395-402 (1981)" source = "A. Bideau-Mehu, Y. Guern, R. Abjean, A. Johannin-Gilles. Measurement of refractive indices of neon, argon, krypton and xenon in the 253.7-140.4 nm wavelength range. Dispersion relations and estimated oscillator strengths of the resonance lines. J. Quant. Spectrosc. Rad. Transfer 25, 395-402 (1981)"
[argon.kerr] [argon.kerr]
P0 = 30400.0 P0 = 30400.0
T0 = 273.15 T0 = 273.15
n2 = 9.7e-24 n2 = 9.7e-24
source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904." source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904."
[argon_alt] [argon_alt]
a = 0.1355 a = 0.1355
b = 3.201e-5 b = 3.201e-5
[argon_alt.sellmeier] [argon_alt.sellmeier]
B = [0.0002033229, 0.0003445831] B = [0.0002033229, 0.0003445831]
C = [2.0612e-16, 8.066e-15] C = [2.0612e-16, 8.066e-15]
P0 = 101325 P0 = 101325
T0 = 273.15 T0 = 273.15
kind = 1 kind = 1
source = "A. Börzsönyi, Z. Heiner, M. P. Kalashnikov, A. P. Kovács, and K. Osvay, Dispersion measurement of inert gases and gas mixtures at 800 nm, Appl. Opt. 47, 4856-4863 (2008)" source = "A. Börzsönyi, Z. Heiner, M. P. Kalashnikov, A. P. Kovács, and K. Osvay, Dispersion measurement of inert gases and gas mixtures at 800 nm, Appl. Opt. 47, 4856-4863 (2008)"
[argon_alt.kerr] [argon_alt.kerr]
P0 = 30400.0 P0 = 30400.0
T0 = 273.15 T0 = 273.15
n2 = 9.7e-24 n2 = 9.7e-24
source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904." source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904."
[argon_alt2] [argon_alt2]
a = 0.1355 a = 0.1355
b = 3.201e-5 b = 3.201e-5
[argon_alt2.sellmeier] [argon_alt2.sellmeier]
B = [0.030182943] B = [0.030182943]
C = [144000000000000.0] C = [144000000000000.0]
P0 = 101325 P0 = 101325
T0 = 273.15 T0 = 273.15
const = 6.7867e-5 const = 6.7867e-5
kind = 2 kind = 2
source = "E. R. Peck and D. J. Fisher. Dispersion of argon, J. Opt. Soc. Am. 54, 1362-1364 (1964)" source = "E. R. Peck and D. J. Fisher. Dispersion of argon, J. Opt. Soc. Am. 54, 1362-1364 (1964)"
[argon_alt2.kerr] [argon_alt2.kerr]
P0 = 30400.0 P0 = 30400.0
T0 = 273.15 T0 = 273.15
n2 = 9.7e-24 n2 = 9.7e-24
source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904." source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904."
[krypton] [krypton]
a = 0.2349 a = 0.2349
b = 3.978e-5 atomic_mass = 1.3915e-25
ionization_energy = 2.2429831039374e-18 atomic_number = 36
atomic_number = 36 b = 3.978e-5
atomic_mass = 1.3915e-25 ionization_energy = 2.2429831039374e-18
[krypton.sellmeier] [krypton.sellmeier]
B = [2536370000.0, 2736490000.0, 62080200000.0] B = [2536370000.0, 2736490000.0, 62080200000.0]
C = [65474200000000.0, 73698000000000.0, 181080000000000.0] C = [65474200000000.0, 73698000000000.0, 181080000000000.0]
P0 = 101325 P0 = 101325
T0 = 273.15 T0 = 273.15
kind = 2 kind = 2
[krypton.kerr] [krypton.kerr]
P0 = 30400.0 P0 = 30400.0
T0 = 273.15 T0 = 273.15
n2 = 2.2e-23 n2 = 2.2e-23
source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904." source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904."
[xenon] [xenon]
a = 0.425 a = 0.425
b = 5.105e-5 atomic_mass = 2.18017e-25
ionization_energy = 1.94342415157935 atomic_number = 54
atomic_number = 54 b = 5.105e-5
atomic_mass = 2.18017e-25 ionization_energy = 1.94342415157935
[xenon.sellmeier] [xenon.sellmeier]
B = [3228690000.0, 3553930000.0, 60676400000.0] B = [3228690000.0, 3553930000.0, 60676400000.0]
C = [46301000000000.0, 59578000000000.0, 112740000000000.0] C = [46301000000000.0, 59578000000000.0, 112740000000000.0]
P0 = 101325 P0 = 101325
T0 = 273.15 T0 = 273.15
kind = 2 kind = 2
[xenon.kerr] [xenon.kerr]
P0 = 30400.0 P0 = 30400.0
T0 = 273.15 T0 = 273.15
n2 = 5.8e-23 n2 = 5.8e-23
source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904." source = "Wahlstrand, J. K., Cheng, Y. H., & Milchberg, H. M. (2012). High field optical nonlinearity and the Kramers-Kronig relations. Physical review letters, 109(11), 113904."
[vacuum] [vacuum]
a = 0 a = 0
b = 0 atomic_mass = 0
atomic_mass = 0 b = 0
[vacuum.sellmeier] [vacuum.sellmeier]
B = [] B = []
C = [] C = []
P0 = 101325 P0 = 101325
T0 = 273.15 T0 = 273.15
kind = 1 kind = 1
[vacuum.kerr] [vacuum.kerr]
P0 = 30400.0 P0 = 30400.0
T0 = 273.15 T0 = 273.15
n2 = 0 n2 = 0
source = "none" source = "none"

File diff suppressed because it is too large Load Diff

View File

@@ -2,12 +2,14 @@
series of helper functions series of helper functions
""" """
from scgenerator.physics.materials import n_gas_2
from scgenerator.physics.fiber import n_eff_marcatili, beta2, beta2_to_D
from scgenerator.physics.units import c
import numpy as np import numpy as np
__all__ = ["capillary_dispersion"] from scgenerator.math import all_zeros
from scgenerator.physics.fiber import beta2, n_eff_marcatili, n_eff_hasan
from scgenerator.physics.materials import n_gas_2
from scgenerator.physics.units import c
__all__ = ["capillary_dispersion", "capillary_zdw", "revolver_dispersion"]
def capillary_dispersion( def capillary_dispersion(
@@ -43,11 +45,100 @@ def capillary_dispersion(
return beta2(w, n)[2:-2] return beta2(w, n)[2:-2]
def extend_axis(wl): def capillary_zdw(
dwl_left = wl[1] - wl[0] radius: float,
dwl_right = wl[-1] - wl[-2] gas_name: str,
wl = np.concatenate( pressure=None,
([wl[0] - 2 * dwl_left, wl[0] - dwl_left], wl, [wl[-1] + dwl_right, wl[-1] + 2 * dwl_right]) temperature=None,
search_range: tuple[float, float] = (200e-9, 3000e-9),
) -> np.ndarray:
"""find the zero dispersion wavelength of a capilally
Parameters
----------
radius : float
in mnm
gas_name : str
gas name (case insensitive)
pressure : float, optional
pressure in Pa (multiply mbar by 100 to get Pa), by default atm pressure
temperature : float, optional
temperature in K, by default 20°C
search_range : (float, float), optional
range of wavelength (in m) in which to search for the ZDW, by default (200e-9, 3000e-9)
Returns
-------
np.ndarray
array of zero dispersion wavelength(s)
"""
wl = np.linspace(*search_range[:2], 1024)
disp = capillary_dispersion(wl, radius, gas_name, pressure, temperature)
return all_zeros(wl, disp)
def revolver_dispersion(
wl: np.ndarray,
core_radius: float,
gas_name: str,
capillary_num: int,
capillary_thickness: float,
capillary_spacing: float,
capillary_nested: int = 0,
capillary_resonance_strengths: list[float] = None,
pressure=None,
temperature=None,
) -> np.ndarray:
"""computes the dispersion (beta2) of a capillary tube
Parameters
----------
wl : np.ndarray
wavelength in m
radius : float
core radius in m
gas_name : str
gas name (case insensitive)
pressure : float, optional
pressure in Pa (multiply mbar by 100 to get Pa), by default atm pressure
temperature : float, optional
temperature in K, by default 20°C
Returns
-------
np.ndarray
D parameter
"""
capillary_resonance_strengths = capillary_resonance_strengths or []
wl = extend_axis(wl)
if pressure is None:
pressure = 101325
if temperature is None:
temperature = 293.15
n = n_eff_hasan(
wl,
n_gas_2(wl, gas_name.lower(), pressure, temperature, False),
core_radius,
capillary_num,
capillary_nested,
capillary_thickness,
capillary_spacing,
capillary_resonance_strengths,
)
w = 2 * np.pi * c / wl
return beta2(w, n)[2:-2]
def extend_axis(axis: np.ndarray) -> np.ndarray:
"""add 4 values to an array, 2 on each 'side'"""
dwl_left = axis[1] - axis[0]
dwl_right = axis[-1] - axis[-2]
axis = np.concatenate(
(
[axis[0] - 2 * dwl_left, axis[0] - dwl_left],
axis,
[axis[-1] + dwl_right, axis[-1] + 2 * dwl_right],
)
) )
return wl return axis

View File

@@ -4,15 +4,14 @@ import numpy as np
from numpy import e from numpy import e
from numpy.fft import fft from numpy.fft import fft
from numpy.polynomial.chebyshev import Chebyshev, cheb2poly from numpy.polynomial.chebyshev import Chebyshev, cheb2poly
from scgenerator import utils
from scgenerator.cache import np_cache
from scgenerator.math import argclosest, u_nm
from scgenerator.physics import materials as mat
from scgenerator.physics import units
from scgenerator.physics.units import c, pi
from scipy.interpolate import interp1d from scipy.interpolate import interp1d
from .. import utils
from ..cache import np_cache
from ..math import argclosest, u_nm
from . import materials as mat
from . import units
from .units import c, pi
pipi = 2 * pi pipi = 2 * pi
T = TypeVar("T") T = TypeVar("T")
@@ -112,12 +111,12 @@ def gvd_from_n_eff(n_eff: np.ndarray, wl_for_disp: np.ndarray):
def beta2_to_D(beta2, wl_for_disp): def beta2_to_D(beta2, wl_for_disp):
"""returns the D parameter corresponding to beta2(wl_for_disp)""" """returns the D parameter corresponding to beta2(wl_for_disp)"""
return -(pipi * c) / (wl_for_disp ** 2) * beta2 return -(pipi * c) / (wl_for_disp**2) * beta2
def D_to_beta2(D, wl_for_disp): def D_to_beta2(D, wl_for_disp):
"""returns the beta2 parameters corresponding to D(wl_for_disp)""" """returns the beta2 parameters corresponding to D(wl_for_disp)"""
return -(wl_for_disp ** 2) / (pipi * c) * D return -(wl_for_disp**2) / (pipi * c) * D
def A_to_C(A: np.ndarray, A_eff_arr: np.ndarray) -> np.ndarray: def A_to_C(A: np.ndarray, A_eff_arr: np.ndarray) -> np.ndarray:
@@ -147,9 +146,9 @@ def plasma_dispersion(wl_for_disp, number_density, simple=False):
w = units.m(wl_for_disp) w = units.m(wl_for_disp)
if simple: if simple:
w_pl = number_density * e2_me_e0 w_pl = number_density * e2_me_e0
return -(w_pl ** 2) / (c * w ** 2) return -(w_pl**2) / (c * w**2)
beta2_arr = beta2(w, np.sqrt(1 - number_density * e2_me_e0 / w ** 2)) beta2_arr = beta2(w, np.sqrt(1 - number_density * e2_me_e0 / w**2))
return beta2_arr return beta2_arr
@@ -224,7 +223,7 @@ def A_eff_marcatili(core_radius: float) -> float:
float float
effective mode field area effective mode field area
""" """
return 1.5 * core_radius ** 2 return 1.5 * core_radius**2
def capillary_spacing_hasan( def capillary_spacing_hasan(
@@ -261,7 +260,7 @@ def resonance_thickness(
wl_for_disp wl_for_disp
/ (4 * np.sqrt(n_si_2)) / (4 * np.sqrt(n_si_2))
* (2 * order + 1) * (2 * order + 1)
* (1 - n_gas_2 / n_si_2 + wl_for_disp ** 2 / (4 * n_si_2 * core_radius ** 2)) ** -0.5 * (1 - n_gas_2 / n_si_2 + wl_for_disp**2 / (4 * n_si_2 * core_radius**2)) ** -0.5
) )
@@ -328,7 +327,9 @@ def n_eff_hasan(
Reference Reference
---------- ----------
Hasan, Md Imran, Nail Akhmediev, and Wonkeun Chang. "Empirical formulae for dispersion and effective mode area in hollow-core antiresonant fibers." Journal of Lightwave Technology 36.18 (2018): 4060-4065. Hasan, Md Imran, Nail Akhmediev, and Wonkeun Chang. "Empirical formulae for dispersion and
effective mode area in hollow-core antiresonant fibers." Journal of Lightwave Technology 36.18
(2018): 4060-4065.
""" """
u = u_nm(1, 1) u = u_nm(1, 1)
alpha = 5e-12 alpha = 5e-12
@@ -340,7 +341,7 @@ def n_eff_hasan(
if capillary_nested > 0: if capillary_nested > 0:
f2 += 0.0045 * np.exp(-4.1589 / (capillary_nested * Rg)) f2 += 0.0045 * np.exp(-4.1589 / (capillary_nested * Rg))
R_eff = f1 * core_radius * (1 - f2 * wl_for_disp ** 2 / (core_radius * capillary_thickness)) R_eff = f1 * core_radius * (1 - f2 * wl_for_disp**2 / (core_radius * capillary_thickness))
n_eff_2 = n_gas_2 - (u * wl_for_disp / (pipi * R_eff)) ** 2 n_eff_2 = n_gas_2 - (u * wl_for_disp / (pipi * R_eff)) ** 2
@@ -350,8 +351,8 @@ def n_eff_hasan(
for m, strength in enumerate(capillary_resonance_strengths): for m, strength in enumerate(capillary_resonance_strengths):
n_eff_2 += ( n_eff_2 += (
strength strength
* wl_for_disp ** 2 * wl_for_disp**2
/ (alpha + wl_for_disp ** 2 - chi_sil * (2 * capillary_thickness / (m + 1)) ** 2) / (alpha + wl_for_disp**2 - chi_sil * (2 * capillary_thickness / (m + 1)) ** 2)
) )
return np.sqrt(n_eff_2) return np.sqrt(n_eff_2)
@@ -374,7 +375,7 @@ def A_eff_hasan(core_radius, capillary_num, capillary_spacing):
A_eff : float A_eff : float
""" """
M_f = 1.5 / (1 - 0.5 * np.exp(-0.245 * capillary_num)) M_f = 1.5 / (1 - 0.5 * np.exp(-0.245 * capillary_num))
return M_f * core_radius ** 2 * np.exp((capillary_spacing / 22e-6) ** 2.5) return M_f * core_radius**2 * np.exp((capillary_spacing / 22e-6) ** 2.5)
def V_eff_step_index( def V_eff_step_index(
@@ -437,8 +438,8 @@ def V_parameter_koshiba(l: np.ndarray, pitch: float, pitch_ratio: float) -> floa
V = A[0] + A[1] / (1 + A[2] * np.exp(A[3] * ratio_l)) V = A[0] + A[1] / (1 + A[2] * np.exp(A[3] * ratio_l))
n_FSM2 = 1.45 ** 2 - (l * V / (pi2a)) ** 2 n_FSM2 = 1.45**2 - (l * V / (pi2a)) ** 2
V_eff = pi2a / l * np.sqrt(n_co ** 2 - n_FSM2) V_eff = pi2a / l * np.sqrt(n_co**2 - n_FSM2)
return V_eff return V_eff
@@ -627,7 +628,6 @@ def beta2(w_for_disp: np.ndarray, n_eff: np.ndarray) -> np.ndarray:
return np.gradient(np.gradient(beta(w_for_disp, n_eff), w_for_disp), w_for_disp) return np.gradient(np.gradient(beta(w_for_disp, n_eff), w_for_disp), w_for_disp)
def frame_velocity(beta1_arr: np.ndarray, w0_ind: int) -> float: def frame_velocity(beta1_arr: np.ndarray, w0_ind: int) -> float:
return 1.0 / beta1_arr[w0_ind] return 1.0 / beta1_arr[w0_ind]
@@ -719,7 +719,7 @@ def dynamic_HCPCF_dispersion(
in the fiber in the fiber
""" """
A_eff = 1.5 * core_radius ** 2 A_eff = 1.5 * core_radius**2
# defining function instead of storing every possilble value # defining function instead of storing every possilble value
def pressure(r): def pressure(r):
@@ -811,7 +811,7 @@ def n_eff_pcf(wl_for_disp: np.ndarray, pitch: float, pitch_ratio: float) -> np.n
V = A[0] + A[1] / (1 + A[2] * np.exp(A[3] * ratio_l)) V = A[0] + A[1] / (1 + A[2] * np.exp(A[3] * ratio_l))
W = B[0] + B[1] / (1 + B[2] * np.exp(B[3] * ratio_l)) W = B[0] + B[1] / (1 + B[2] * np.exp(B[3] * ratio_l))
n_FSM2 = 1.45 ** 2 - (wl_for_disp * V / (pi2a)) ** 2 n_FSM2 = 1.45**2 - (wl_for_disp * V / (pi2a)) ** 2
n_eff2 = (wl_for_disp * W / (pi2a)) ** 2 + n_FSM2 n_eff2 = (wl_for_disp * W / (pi2a)) ** 2 + n_FSM2
n_eff = np.sqrt(n_eff2) n_eff = np.sqrt(n_eff2)
@@ -845,8 +845,8 @@ def saitoh_paramters(pitch_ratio: float) -> tuple[float, float]:
di2 = np.array([9, 6.58, 10, 0.41]) di2 = np.array([9, 6.58, 10, 0.41])
di3 = np.array([10, 24.8, 15, 6]) di3 = np.array([10, 24.8, 15, 6])
A = ai0 + ai1 * pitch_ratio ** bi1 + ai2 * pitch_ratio ** bi2 + ai3 * pitch_ratio ** bi3 A = ai0 + ai1 * pitch_ratio**bi1 + ai2 * pitch_ratio**bi2 + ai3 * pitch_ratio**bi3
B = ci0 + ci1 * pitch_ratio ** di1 + ci2 * pitch_ratio ** di2 + ci3 * pitch_ratio ** di3 B = ci0 + ci1 * pitch_ratio**di1 + ci2 * pitch_ratio**di2 + ci3 * pitch_ratio**di3
return A, B return A, B
@@ -960,7 +960,7 @@ def dispersion_from_coefficients(
coef = np.array(beta2_coefficients) / np.cumprod([1] + list(range(1, len(beta2_coefficients)))) coef = np.array(beta2_coefficients) / np.cumprod([1] + list(range(1, len(beta2_coefficients))))
beta_arr = np.zeros_like(w_c) beta_arr = np.zeros_like(w_c)
for k, b in reversed(list(enumerate(coef))): for k, b in reversed(list(enumerate(coef))):
beta_arr = beta_arr + b * w_c ** k beta_arr = beta_arr + b * w_c**k
return beta_arr return beta_arr
@@ -985,12 +985,12 @@ def delayed_raman_t(t: np.ndarray, raman_type: str) -> np.ndarray:
t_ = t - t[0] t_ = t - t[0]
t = t_ t = t_
if raman_type == "stolen": if raman_type == "stolen":
hr_arr = (tau1 / tau2 ** 2 + 1 / tau1) * np.exp(-t_ / tau2) * np.sin(t_ / tau1) hr_arr = (tau1 / tau2**2 + 1 / tau1) * np.exp(-t_ / tau2) * np.sin(t_ / tau1)
elif raman_type == "agrawal": elif raman_type == "agrawal":
taub = 96e-15 taub = 96e-15
h_a = (tau1 / tau2 ** 2 + 1 / tau1) * np.exp(-t_ / tau2) * np.sin(t_ / tau1) h_a = (tau1 / tau2**2 + 1 / tau1) * np.exp(-t_ / tau2) * np.sin(t_ / tau1)
h_b = (2 * taub - t_) / taub ** 2 * np.exp(-t_ / taub) h_b = (2 * taub - t_) / taub**2 * np.exp(-t_ / taub)
hr_arr = 0.79 * h_a + 0.21 * h_b hr_arr = 0.79 * h_a + 0.21 * h_b
elif raman_type == "measured": elif raman_type == "measured":
@@ -1096,12 +1096,12 @@ def effective_core_radius(wl_for_disp, core_radius, s=0.08, h=200e-9):
------- -------
effective_core_radius : ndarray, shape (n, ) effective_core_radius : ndarray, shape (n, )
""" """
return core_radius / (1 + s * wl_for_disp ** 2 / (core_radius * h)) return core_radius / (1 + s * wl_for_disp**2 / (core_radius * h))
def effective_radius_HCARF(core_radius, t, f1, f2, wl_for_disp): def effective_radius_HCARF(core_radius, t, f1, f2, wl_for_disp):
"""eq. 3 in Hasan 2018""" """eq. 3 in Hasan 2018"""
return f1 * core_radius * (1 - f2 * wl_for_disp ** 2 / (core_radius * t)) return f1 * core_radius * (1 - f2 * wl_for_disp**2 / (core_radius * t))
def capillary_loss(wl: np.ndarray, he_mode: tuple[int, int], core_radius: float) -> np.ndarray: def capillary_loss(wl: np.ndarray, he_mode: tuple[int, int], core_radius: float) -> np.ndarray:
@@ -1123,7 +1123,7 @@ def capillary_loss(wl: np.ndarray, he_mode: tuple[int, int], core_radius: float)
""" """
chi_silica = abs(mat.sellmeier(wl, utils.load_material_dico("silica"))) chi_silica = abs(mat.sellmeier(wl, utils.load_material_dico("silica")))
nu_n = 0.5 * (chi_silica + 2) / np.sqrt(chi_silica) nu_n = 0.5 * (chi_silica + 2) / np.sqrt(chi_silica)
return nu_n * (u_nm(*he_mode) * wl / pipi) ** 2 * core_radius ** -3 return nu_n * (u_nm(*he_mode) * wl / pipi) ** 2 * core_radius**-3
def extinction_distance(loss: T, ratio=1 / e) -> T: def extinction_distance(loss: T, ratio=1 / e) -> T:

View File

@@ -1,14 +1,15 @@
from __future__ import annotations
import functools import functools
from dataclasses import dataclass, field from dataclasses import dataclass, field
from typing import Any, TypeVar from typing import Any, TypeVar
import numpy as np import numpy as np
from scgenerator import utils
from .. import utils from scgenerator.cache import np_cache
from ..cache import np_cache from scgenerator.logger import get_logger
from ..logger import get_logger from scgenerator.physics import units
from . import units from scgenerator.physics.units import NA, c, epsilon0, kB
from .units import NA, c, epsilon0, kB
T = TypeVar("T", np.floating, np.ndarray) T = TypeVar("T", np.floating, np.ndarray)
@@ -22,6 +23,21 @@ class Sellmeier:
kind: int = 2 kind: int = 2
constant: float = 0 constant: float = 0
@classmethod
def load(cls, name: str) -> Sellmeier:
mat_dico = utils.load_material_dico(name)
s = mat_dico.get("sellmeier", {})
return cls(
**{
newk: s.get(k, None)
for newk, k in zip(
["B", "C", "pressure_ref", "temperature_ref", "kind", "constant"],
["B", "C", "P0", "T0", "kind", "const"],
)
if k in s
}
)
def chi(self, wl: T) -> T: def chi(self, wl: T) -> T:
"""n^2 - 1""" """n^2 - 1"""
if isinstance(wl, np.ndarray): if isinstance(wl, np.ndarray):
@@ -30,10 +46,10 @@ class Sellmeier:
chi = 0 chi = 0
if self.kind == 1: if self.kind == 1:
for b, c_ in zip(self.B, self.C): for b, c_ in zip(self.B, self.C):
chi += wl ** 2 * b / (wl ** 2 - c_) chi += wl**2 * b / (wl**2 - c_)
elif self.kind == 2: # gives n-1 elif self.kind == 2: # gives n-1
for b, c_ in zip(self.B, self.C): for b, c_ in zip(self.B, self.C):
chi += b / (c_ - 1 / wl ** 2) chi += b / (c_ - 1 / wl**2)
chi += self.constant chi += self.constant
chi = (chi + 1) ** 2 - 1 chi = (chi + 1) ** 2 - 1
elif self.kind == 3: # Schott formula elif self.kind == 3: # Schott formula
@@ -201,7 +217,7 @@ def pressure_from_gradient(ratio, p0, p1):
---------- ----------
the pressure (float) the pressure (float)
""" """
return np.sqrt(p0 ** 2 - ratio * (p0 ** 2 - p1 ** 2)) return np.sqrt(p0**2 - ratio * (p0**2 - p1**2))
def number_density_van_der_waals( def number_density_van_der_waals(
@@ -241,7 +257,7 @@ def number_density_van_der_waals(
pressure = 101325 if pressure is None else pressure pressure = 101325 if pressure is None else pressure
temperature = 273.15 if temperature is None else temperature temperature = 273.15 if temperature is None else temperature
ap = a / NA ** 2 ap = a / NA**2
bp = b / NA bp = b / NA
# setup van der Waals equation for the number density # setup van der Waals equation for the number density
@@ -306,11 +322,11 @@ def sellmeier(
if kind == 1: if kind == 1:
logger.debug("materials : using Sellmeier 1st kind equation") logger.debug("materials : using Sellmeier 1st kind equation")
for b, c_ in zip(B, C): for b, c_ in zip(B, C):
chi[ind] += temp_l ** 2 * b / (temp_l ** 2 - c_) chi[ind] += temp_l**2 * b / (temp_l**2 - c_)
elif kind == 2: # gives n-1 elif kind == 2: # gives n-1
logger.debug("materials : using Sellmeier 2nd kind equation") logger.debug("materials : using Sellmeier 2nd kind equation")
for b, c_ in zip(B, C): for b, c_ in zip(B, C):
chi[ind] += b / (c_ - 1 / temp_l ** 2) chi[ind] += b / (c_ - 1 / temp_l**2)
chi += const chi += const
chi = (chi + 1) ** 2 - 1 chi = (chi + 1) ** 2 - 1
elif kind == 3: # Schott formula elif kind == 3: # Schott formula
@@ -433,8 +449,8 @@ def gas_chi3(gas_name: str, wavelength: float, pressure: float, temperature: flo
def n2_to_chi3(n2: float, n0: float) -> float: def n2_to_chi3(n2: float, n0: float) -> float:
return n2 * 4 * epsilon0 * n0 ** 2 * c / 3 return n2 * 4 * epsilon0 * n0**2 * c / 3
def chi3_to_n2(chi3: float, n0: float) -> float: def chi3_to_n2(chi3: float, n0: float) -> float:
return 3.0 * chi3 / (4.0 * epsilon0 * c * n0 ** 2) return 3.0 * chi3 / (4.0 * epsilon0 * c * n0**2)

View File

@@ -14,16 +14,16 @@ from dataclasses import dataclass
from functools import cache, lru_cache from functools import cache, lru_cache
from pathlib import Path from pathlib import Path
from string import printable as str_printable from string import printable as str_printable
from typing import Any, Callable, MutableMapping, Sequence, TypeVar, Set, Union from typing import Any, Callable, MutableMapping, Sequence, TypeVar, Union
import numpy as np import numpy as np
import pkg_resources as pkg import pkg_resources as pkg
import tomli import tomli
import tomli_w import tomli_w
from .const import PARAM_FN, PARAM_SEPARATOR, SPEC1_FN, Z_FN, ROOT_PARAMETERS from scgenerator.const import PARAM_FN, PARAM_SEPARATOR, ROOT_PARAMETERS, SPEC1_FN, Z_FN
from .logger import get_logger from scgenerator.errors import DuplicateParameterError
from .errors import DuplicateParameterError from scgenerator.logger import get_logger
T_ = TypeVar("T_") T_ = TypeVar("T_")
@@ -85,8 +85,8 @@ class Paths:
class SubConfig: class SubConfig:
fixed: dict[str, Any] fixed: dict[str, Any]
variable: list[dict[str, list]] variable: list[dict[str, list]]
fixed_keys: Set[str] fixed_keys: set[str]
variable_keys: Set[str] variable_keys: set[str]
def __init__(self, dico: dict[str, Any]): def __init__(self, dico: dict[str, Any]):
dico = dico.copy() dico = dico.copy()