This commit is contained in:
Benoît Sierro
2021-06-11 14:38:08 +02:00
parent 828a3a2941
commit 7e2ba74520
8 changed files with 23 additions and 16 deletions

View File

@@ -25,19 +25,17 @@ The configuration file can have a ```name``` parameter at the root and must othe
Examples :
```
[fiber]
n2 = 2.2e-20
```
a single simulation is ran with this value
```
[fiber.variable]
[variable]
n2 = [2.1e-20, 2.4e-20, 2.6e-20]
```
3 simulations are ran, one for each value
```
[fiber]
n2 = 2.2e-20
[fiber.variable]
[variable]
n2 = [2.1e-20, 2.4e-20, 2.6e-20]
```
NOT ALLOWED
@@ -251,6 +249,9 @@ upper_wavelength_interp_limit: float
sets the lowest end of this range. If the set value is higher than the higher end of the
wavelength window, it is lowered down to that point. default : 1900e-9
interp_degree: int
max degree of the Taylor polynomial fitting the dispersion data
readjust_wavelength : bool
if a custom input field is set, it is likely that the maximum of its corresponding spectrum doesn't lies exactly at the
set wavelength. If this setting is True, the program will override the wavelength parameter so that the maximum of the spectrum

View File

@@ -14,7 +14,6 @@
# Load modules or your own conda environment here
{environment_setup}
################# DO NOT CHANGE THINGS HERE UNLESS YOU KNOW WHAT YOU ARE DOING ###############
# This script is a modification to the implementation suggest by gregSchwartz18 here:
# https://github.com/ray-project/ray/issues/826#issuecomment-522116599
redis_password=$(uuidgen)
@@ -47,7 +46,6 @@ do
srun --nodes=1 --ntasks=1 -w $node_i start_worker.sh $ip_head $redis_password &
sleep 5
done
##############################################################################################
#### call your code below
scgenerator {command} {configs_list}

View File

@@ -25,6 +25,7 @@ default_parameters = dict(
tolerated_error=1e-11,
lower_wavelength_interp_limit=300e-9,
upper_wavelength_interp_limit=1900e-9,
interp_degree=8,
ideal_gas=False,
readjust_wavelength=False,
recovery_last_stored=0,

View File

@@ -216,6 +216,7 @@ class Config(BareConfig):
"repeat",
"lower_wavelength_interp_limit",
"upper_wavelength_interp_limit",
"interp_degree",
"ideal_gas",
"readjust_wavelength",
"recovery_last_stored",

View File

@@ -493,7 +493,7 @@ def dynamic_HCPCF_dispersion(
w0: float,
interp_range: Tuple[float, float],
material_dico: Dict[str, Any],
deg,
deg: int,
):
"""returns functions for beta2 coefficients and gamma instead of static values
@@ -648,7 +648,7 @@ def PCF_dispersion(lambda_, pitch, ratio_d, w0=None, n2=None, A_eff=None):
return beta2, gamma
def compute_dispersion(params: BareParams, deg=8):
def compute_dispersion(params: BareParams):
"""dispatch function depending on what type of fiber is used
Parameters
@@ -710,7 +710,7 @@ def compute_dispersion(params: BareParams, deg=8):
params.w0,
params.interp_range,
material_dico,
deg,
params.interp_degree,
)
else:
@@ -739,7 +739,9 @@ def compute_dispersion(params: BareParams, deg=8):
if params.plasma_density > 0:
beta2 += plasma_dispersion(lambda_, params.plasma_density)
beta2_coef = dispersion_coefficients(lambda_, beta2, params.w0, params.interp_range, deg)
beta2_coef = dispersion_coefficients(
lambda_, beta2, params.w0, params.interp_range, params.interp_degree
)
if gamma is None:
if params.A_eff is not None:

View File

@@ -314,7 +314,7 @@ def _finish_plot_2D(
ax.set_xlim(*ext_x)
ax.set_ylim(*ext_y)
interpolation = params.get("plot.interpolation", defaults["interpolation_2D"])
interpolation = defaults["interpolation_2D"]
im = ax.imshow(
values,
extent=[ext_x[0] - dx / 2, ext_x[1] + dx / 2, ext_y[0] - dy / 2, ext_y[1] + dy / 2],

View File

@@ -15,16 +15,16 @@ from ..utils import count_variations
def primes(n):
primfac = []
prime_factors = []
d = 2
while d * d <= n:
while (n % d) == 0:
primfac.append(d) # supposing you want multiple factors repeated
prime_factors.append(d)
n //= d
d += 1
if n > 1:
primfac.append(n)
return primfac
prime_factors.append(n)
return prime_factors
def balance(n, lim=(32, 32)):

View File

@@ -237,6 +237,8 @@ class VariableParameter:
valid_variable = {
"dispersion_file",
"field_file",
"beta",
"gamma",
"pitch",
@@ -255,7 +257,8 @@ valid_variable = {
"pressure",
"temperature",
"gas_name",
"plasma_density" "peak_power",
"plasma_density",
"peak_power",
"mean_power",
"peak_power",
"energy",
@@ -358,6 +361,7 @@ class BareParams:
step_size: float = Parameter(positive(float, int))
lower_wavelength_interp_limit: float = Parameter(in_range_incl(100e-9, 3000e-9))
upper_wavelength_interp_limit: float = Parameter(in_range_incl(200e-9, 5000e-9))
interp_degree: int = Parameter(positive(int))
frep: float = Parameter(positive(float, int))
prev_sim_dir: str = Parameter(string)
readjust_wavelength: bool = Parameter(boolean)