n2 is now computed with HC-PCFs
This commit is contained in:
@@ -355,7 +355,7 @@ class Parameters(_AbstractParameters):
|
||||
# # fiber
|
||||
input_transmission: float = Parameter(in_range_incl(0, 1), default=1.0)
|
||||
gamma: float = Parameter(non_negative(float, int))
|
||||
n2: float = Parameter(non_negative(float, int), default=2.2e-20)
|
||||
n2: float = Parameter(non_negative(float, int))
|
||||
loss: str = Parameter(literal("capillary"))
|
||||
loss_file: str = Parameter(string)
|
||||
effective_mode_diameter: float = Parameter(positive(float, int))
|
||||
@@ -702,9 +702,7 @@ class Evaluator:
|
||||
error = None
|
||||
|
||||
# try every rule until one succeeds
|
||||
for ii, rule in enumerate(
|
||||
filter(lambda r: self.validate_condition(r), self.rules[target])
|
||||
):
|
||||
for ii, rule in enumerate(filter(self.validate_condition, self.rules[target])):
|
||||
self.logger.debug(
|
||||
prefix + f"attempt {ii+1} to compute {target}, this time using {rule!r}"
|
||||
)
|
||||
@@ -747,9 +745,13 @@ class Evaluator:
|
||||
else:
|
||||
default = self.get_default(target)
|
||||
if default is None:
|
||||
error = NoDefaultError(prefix + f"No default provided for {target}. Current lookup cycle : {self.__curent_lookup!r}")
|
||||
error = NoDefaultError(
|
||||
prefix
|
||||
+ f"No default provided for {target}. Current lookup cycle : {self.__curent_lookup!r}"
|
||||
)
|
||||
else:
|
||||
value = default
|
||||
self.logger.info(f"using default value of {value} for {target}")
|
||||
self.set_value(target, value, 0)
|
||||
|
||||
if value is None and error is not None:
|
||||
@@ -1138,6 +1140,8 @@ default_rules: list[Rule] = [
|
||||
),
|
||||
Rule("gamma", lambda gamma_arr: gamma_arr[0]),
|
||||
Rule("gamma_arr", fiber.gamma_parameter, ["n2", "w0", "A_eff_arr"]),
|
||||
Rule("n2", materials.gas_n2),
|
||||
Rule("n2", lambda: 2.2e-20, priorities=-1),
|
||||
# Fiber loss
|
||||
Rule("alpha_arr", fiber.compute_capillary_loss),
|
||||
Rule("alpha_arr", fiber.load_custom_loss),
|
||||
|
||||
@@ -195,10 +195,29 @@ def non_linear_refractive_index(material_dico, pressure=None, temperature=None):
|
||||
ratio = N / N0
|
||||
else:
|
||||
ratio = 1
|
||||
|
||||
return ratio * n2_ref
|
||||
|
||||
|
||||
def gas_n2(gas_name: str, pressure: float, temperature: float) -> float:
|
||||
"""returns the nonlinear refractive index
|
||||
|
||||
Parameters
|
||||
----------
|
||||
gas_name : str
|
||||
gas name
|
||||
pressure : float
|
||||
pressure in Pa
|
||||
temperature : float
|
||||
temperature in K
|
||||
|
||||
Returns
|
||||
-------
|
||||
float
|
||||
n2 in m2/W
|
||||
"""
|
||||
return non_linear_refractive_index(_utils.load_material_dico(gas_name), pressure, temperature)
|
||||
|
||||
|
||||
def adiabadicity(w: np.ndarray, I: float, field: np.ndarray) -> np.ndarray:
|
||||
return w * np.sqrt(2 * me * I) / (e * np.abs(field))
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ class RK4IP:
|
||||
self.C_to_A_factor * spectrum, self.dw
|
||||
)
|
||||
else:
|
||||
self.logger.debug(f"Using constant step size of {1e6*self.error_ok:.3f}")
|
||||
self.conserved_quantity_func = lambda spectrum, h: 0.0
|
||||
|
||||
def _setup_sim_parameters(self):
|
||||
|
||||
@@ -1071,9 +1071,8 @@ def partial_plot(root: os.PathLike):
|
||||
spec_list = sorted(
|
||||
path.glob(SPEC1_FN.format("*")), key=lambda el: int(re.search("[0-9]+", el.name)[0])
|
||||
)
|
||||
print(spec_list)
|
||||
raw_values = np.array([load_spectrum(s) for s in spec_list])
|
||||
specs = units.to_log2D(math.abs2(np.fft.fftshift(raw_values)))
|
||||
specs = units.to_log2D(math.abs2(np.fft.fftshift(raw_values, axes=-1)))
|
||||
fields = math.abs2(np.fft.ifft(raw_values))
|
||||
left.imshow(specs, origin="lower", aspect="auto", vmin=-60, interpolation="nearest")
|
||||
right.imshow(fields, origin="lower", aspect="auto", interpolation="nearest")
|
||||
|
||||
Reference in New Issue
Block a user