initial commit
This commit is contained in:
26
testing/configs/compute_init_parameters/good.toml
Normal file
26
testing/configs/compute_init_parameters/good.toml
Normal file
@@ -0,0 +1,26 @@
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
# gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
intensity_noise = 0.05e-2
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
width = 50e-15
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
29
testing/configs/ensure_consistency/bad1.toml
Normal file
29
testing/configs/ensure_consistency/bad1.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
#t0 or width missing
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
29
testing/configs/ensure_consistency/bad2.toml
Normal file
29
testing/configs/ensure_consistency/bad2.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
#t0, width, power or energy missing
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
soliton_num = [1, 2, 3, 4]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
29
testing/configs/ensure_consistency/bad3.toml
Normal file
29
testing/configs/ensure_consistency/bad3.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
# window size or dt missing
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
31
testing/configs/ensure_consistency/bad4.toml
Normal file
31
testing/configs/ensure_consistency/bad4.toml
Normal file
@@ -0,0 +1,31 @@
|
||||
#multiple width parameters
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
width = 120e-15
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
32
testing/configs/ensure_consistency/bad5.toml
Normal file
32
testing/configs/ensure_consistency/bad5.toml
Normal file
@@ -0,0 +1,32 @@
|
||||
# missing capillary_thickness
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
capillary_num = 6
|
||||
capillary_outer_d = 2e-6
|
||||
capillary_spacing = 4e-6
|
||||
core_radius = 50e-6
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "hasan"
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
31
testing/configs/ensure_consistency/bad6.toml
Normal file
31
testing/configs/ensure_consistency/bad6.toml
Normal file
@@ -0,0 +1,31 @@
|
||||
# missing capillary_outer_d and capillary_spacing
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
capillary_num = 6
|
||||
capillary_thickness = 4e-6
|
||||
core_radius = 50e-6
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "hasan"
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
29
testing/configs/ensure_consistency/good1.toml
Normal file
29
testing/configs/ensure_consistency/good1.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
# model 'pcf' should be added and no gas dico
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
29
testing/configs/ensure_consistency/good2.toml
Normal file
29
testing/configs/ensure_consistency/good2.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
# raman_type should be added
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
28
testing/configs/ensure_consistency/good3.toml
Normal file
28
testing/configs/ensure_consistency/good3.toml
Normal file
@@ -0,0 +1,28 @@
|
||||
# name should be added
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
38
testing/configs/ensure_consistency/good4.toml
Normal file
38
testing/configs/ensure_consistency/good4.toml
Normal file
@@ -0,0 +1,38 @@
|
||||
# should add capillary_nested and capillary_resonance_strengths
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
capillary_num = 6
|
||||
capillary_outer_d = 2e-6
|
||||
capillary_spacing = 4e-6
|
||||
capillary_thickness = 1e-7
|
||||
core_radius = 50e-6
|
||||
length = 1
|
||||
model = "hasan"
|
||||
|
||||
[gas]
|
||||
gas_name = "helium"
|
||||
|
||||
[gas.varying]
|
||||
temperature = [300, 350, 400]
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
29
testing/configs/ensure_consistency/good5.toml
Normal file
29
testing/configs/ensure_consistency/good5.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
# should add he_mode and gas
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
core_radius = 50e-6
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "marcatili"
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
31
testing/configs/ensure_consistency/good6.toml
Normal file
31
testing/configs/ensure_consistency/good6.toml
Normal file
@@ -0,0 +1,31 @@
|
||||
# should not touch simulation parameters
|
||||
# should add wavelength ranges
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
32
testing/configs/run_simulations/full_anomalous.toml
Normal file
32
testing/configs/run_simulations/full_anomalous.toml
Normal file
@@ -0,0 +1,32 @@
|
||||
name = "full anomalous"
|
||||
|
||||
[fiber]
|
||||
beta = [
|
||||
-1.183e-26,
|
||||
8.1038e-41,
|
||||
-9.5205e-56,
|
||||
2.0737e-70,
|
||||
-5.3943e-85,
|
||||
1.3486e-99,
|
||||
-2.5495e-114,
|
||||
3.0524e-129,
|
||||
-1.714e-144,
|
||||
]
|
||||
gamma = 0.11
|
||||
length = 0.02
|
||||
|
||||
[pulse]
|
||||
power = 10000
|
||||
t0 = 2.84e-14
|
||||
|
||||
[pulse.varying]
|
||||
wavelength = [835e-9, 830e-9]
|
||||
|
||||
[simulation]
|
||||
dt = 1e-15
|
||||
parallel = 3
|
||||
raman_type = "measured"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
tolerated_error = 1e-10
|
||||
z_num = 64
|
||||
20
testing/configs/single_sim/false1.toml
Normal file
20
testing/configs/single_sim/false1.toml
Normal file
@@ -0,0 +1,20 @@
|
||||
[fiber]
|
||||
core_radius = 50e-6
|
||||
length = 50e-2
|
||||
model = "marcatili"
|
||||
|
||||
[gas]
|
||||
gas_name = "air"
|
||||
|
||||
[pulse]
|
||||
wavelength = 800e-9
|
||||
width = 250e-15
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
repeat = 2
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
23
testing/configs/single_sim/false2.toml
Normal file
23
testing/configs/single_sim/false2.toml
Normal file
@@ -0,0 +1,23 @@
|
||||
[fiber]
|
||||
core_radius = 50e-6
|
||||
length = 50e-2
|
||||
model = "marcatili"
|
||||
|
||||
[gas]
|
||||
gas_name = "air"
|
||||
|
||||
[pulse]
|
||||
wavelength = 800e-9
|
||||
width = 250e-15
|
||||
|
||||
[pulse.varying]
|
||||
shape = ["gaussian", "sech"]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
repeat = 1
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
20
testing/configs/single_sim/true1.toml
Normal file
20
testing/configs/single_sim/true1.toml
Normal file
@@ -0,0 +1,20 @@
|
||||
[fiber]
|
||||
core_radius = 50e-6
|
||||
length = 50e-2
|
||||
model = "marcatili"
|
||||
|
||||
[gas]
|
||||
gas_name = "air"
|
||||
|
||||
[pulse]
|
||||
wavelength = 800e-9
|
||||
width = 250e-15
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
repeat = 1
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
30
testing/configs/validate_types/bad1.toml
Normal file
30
testing/configs/validate_types/bad1.toml
Normal file
@@ -0,0 +1,30 @@
|
||||
# pitch in wrong section
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
pitch = 1.5e-6
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
30
testing/configs/validate_types/bad2.toml
Normal file
30
testing/configs/validate_types/bad2.toml
Normal file
@@ -0,0 +1,30 @@
|
||||
# wrong value in behaviors
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss", "q_noise"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
30
testing/configs/validate_types/bad3.toml
Normal file
30
testing/configs/validate_types/bad3.toml
Normal file
@@ -0,0 +1,30 @@
|
||||
# wrong type in width
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = ["gaussian", "sech"]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
32
testing/configs/validate_types/bad4.toml
Normal file
32
testing/configs/validate_types/bad4.toml
Normal file
@@ -0,0 +1,32 @@
|
||||
# parallel should not be varying
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 1
|
||||
|
||||
[simulation.varying]
|
||||
parallel = [2, 4]
|
||||
30
testing/configs/validate_types/bad5.toml
Normal file
30
testing/configs/validate_types/bad5.toml
Normal file
@@ -0,0 +1,30 @@
|
||||
#varying parameters should be lists
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = 0.05e-2
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
30
testing/configs/validate_types/bad6.toml
Normal file
30
testing/configs/validate_types/bad6.toml
Normal file
@@ -0,0 +1,30 @@
|
||||
#repeat should not be 0
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
intensity_noise = 0.05e-2
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 0
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
28
testing/configs/validate_types/bad7.toml
Normal file
28
testing/configs/validate_types/bad7.toml
Normal file
@@ -0,0 +1,28 @@
|
||||
# gamma missing
|
||||
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
beta = [1, 2, 3]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = []
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
28
testing/configs/validate_types/good.toml
Normal file
28
testing/configs/validate_types/good.toml
Normal file
@@ -0,0 +1,28 @@
|
||||
name = "test config"
|
||||
|
||||
[fiber]
|
||||
gamma = 0.018
|
||||
length = 1
|
||||
model = "pcf"
|
||||
pitch = 1.5e-6
|
||||
pitch_ratio = 0.37
|
||||
|
||||
[pulse]
|
||||
power = 100e3
|
||||
quantum_noise = true
|
||||
shape = "gaussian"
|
||||
wavelength = 1050e-9
|
||||
|
||||
[pulse.varying]
|
||||
intensity_noise = [0.05e-2, 0.1e-2]
|
||||
width = [50e-15, 100e-15, 200e-15]
|
||||
|
||||
[simulation]
|
||||
behaviors = ["spm", "raman", "ss"]
|
||||
parallel = 2
|
||||
raman_type = "agrawal"
|
||||
repeat = 4
|
||||
t_num = 16384
|
||||
time_window = 37e-12
|
||||
tolerated_error = 1e-11
|
||||
z_num = 128
|
||||
155
testing/test_initialize.py
Normal file
155
testing/test_initialize.py
Normal file
@@ -0,0 +1,155 @@
|
||||
import unittest
|
||||
import toml
|
||||
import scgenerator.initialize as init
|
||||
from scgenerator.errors import *
|
||||
from prettyprinter import pprint
|
||||
|
||||
|
||||
def load_conf(name):
|
||||
with open("testing/configs/" + name + ".toml") as file:
|
||||
conf = toml.load(file)
|
||||
return conf
|
||||
|
||||
|
||||
def conf_maker(folder):
|
||||
def conf(name):
|
||||
return load_conf(folder + "/" + name)
|
||||
|
||||
return conf
|
||||
|
||||
|
||||
class TestInitializeMethods(unittest.TestCase):
|
||||
def test_validate_types(self):
|
||||
conf = lambda s: load_conf("validate_types/" + s)
|
||||
with self.assertRaisesRegex(TypeError, "belong"):
|
||||
init.validate_types(conf("bad1"))
|
||||
|
||||
with self.assertRaisesRegex(TypeError, "valid list of behaviors"):
|
||||
init.validate_types(conf("bad2"))
|
||||
|
||||
with self.assertRaisesRegex(TypeError, "single, real, non-negative number"):
|
||||
init.validate_types(conf("bad3"))
|
||||
|
||||
with self.assertRaisesRegex(TypeError, "'parallel' is not a valid variable parameter"):
|
||||
init.validate_types(conf("bad4"))
|
||||
|
||||
with self.assertRaisesRegex(TypeError, "Varying parameters should be specified in a list"):
|
||||
init.validate_types(conf("bad5"))
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
TypeError,
|
||||
"value '0' of type <class 'int'> for key 'repeat' is not valid, must be a strictly positive integer",
|
||||
):
|
||||
init.validate_types(conf("bad6"))
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
ValueError,
|
||||
r"Varying parameters lists should contain at least 1 element",
|
||||
):
|
||||
init.ensure_consistency(conf("bad7"))
|
||||
|
||||
self.assertIsNone(init.validate_types(conf("good")))
|
||||
|
||||
def test_ensure_consistency(self):
|
||||
conf = lambda s: load_conf("ensure_consistency/" + s)
|
||||
with self.assertRaisesRegex(
|
||||
MissingParameterError,
|
||||
r"1 of '\['t0', 'width'\]' is required and no defaults have been set",
|
||||
):
|
||||
init.ensure_consistency(conf("bad1"))
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
MissingParameterError,
|
||||
r"1 of '\['power', 'energy', 'width', 't0'\]' is required when 'soliton_num' is specified and no defaults have been set",
|
||||
):
|
||||
init.ensure_consistency(conf("bad2"))
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
MissingParameterError,
|
||||
r"2 of '\['dt', 't_num', 'time_window'\]' are required and no defaults have been set",
|
||||
):
|
||||
init.ensure_consistency(conf("bad3"))
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
DuplicateParameterError,
|
||||
r"got multiple values for parameter 'width'",
|
||||
):
|
||||
init.ensure_consistency(conf("bad4"))
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
MissingParameterError,
|
||||
r"'capillary_thickness' is a required parameter for fiber model 'hasan' and no defaults have been set",
|
||||
):
|
||||
init.ensure_consistency(conf("bad5"))
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
MissingParameterError,
|
||||
r"1 of '\['capillary_spacing', 'capillary_outer_d'\]' is required for fiber model 'hasan' and no defaults have been set",
|
||||
):
|
||||
init.ensure_consistency(conf("bad6"))
|
||||
|
||||
self.assertLessEqual(
|
||||
{"model": "pcf"}.items(), init.ensure_consistency(conf("good1"))["fiber"].items()
|
||||
)
|
||||
|
||||
self.assertNotIn("gas", init.ensure_consistency(conf("good1")))
|
||||
|
||||
self.assertNotIn("gamma", init.ensure_consistency(conf("good4"))["fiber"])
|
||||
|
||||
self.assertLessEqual(
|
||||
{"raman_type": "agrawal"}.items(),
|
||||
init.ensure_consistency(conf("good2"))["simulation"].items(),
|
||||
)
|
||||
|
||||
self.assertLessEqual(
|
||||
{"name": "no name"}.items(), init.ensure_consistency(conf("good3")).items()
|
||||
)
|
||||
|
||||
self.assertLessEqual(
|
||||
{"capillary_nested": 0, "capillary_resonance_strengths": []}.items(),
|
||||
init.ensure_consistency(conf("good4"))["fiber"].items(),
|
||||
)
|
||||
|
||||
self.assertLessEqual(
|
||||
dict(he_mode=(1, 1)).items(),
|
||||
init.ensure_consistency(conf("good5"))["fiber"].items(),
|
||||
)
|
||||
|
||||
self.assertLessEqual(
|
||||
dict(temperature=300, pressure=1e5, gas_name="vacuum", plasma_density=0).items(),
|
||||
init.ensure_consistency(conf("good5"))["gas"].items(),
|
||||
)
|
||||
|
||||
self.assertLessEqual(
|
||||
dict(
|
||||
t_num=16384,
|
||||
time_window=37e-12,
|
||||
lower_wavelength_interp_limit=0,
|
||||
upper_wavelength_interp_limit=1900e-9,
|
||||
).items(),
|
||||
init.ensure_consistency(conf("good6"))["simulation"].items(),
|
||||
)
|
||||
|
||||
def test_single_sim(self):
|
||||
conf = conf_maker("single_sim")
|
||||
|
||||
self.assertTrue(init.single_sim(conf("true1")))
|
||||
|
||||
self.assertFalse(init.single_sim(conf("false1")))
|
||||
|
||||
self.assertFalse(init.single_sim(conf("false2")))
|
||||
|
||||
# def test_compute_init_parameters(self):
|
||||
# conf = lambda s: load_conf("compute_init_parameters/" + s)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
conf = conf_maker("validate_types")
|
||||
config = conf("good")
|
||||
pprint(config)
|
||||
config = init.ensure_consistency(config)
|
||||
pprint(config)
|
||||
params = init.compute_init_parameters(config)
|
||||
pprint(params)
|
||||
|
||||
unittest.main()
|
||||
41
testing/test_pulse.py
Normal file
41
testing/test_pulse.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import unittest
|
||||
from scgenerator.physics.pulse import conform_pulse_params
|
||||
|
||||
|
||||
class TestPulseMethods(unittest.TestCase):
|
||||
def test_conform_pulse_params(self):
|
||||
self.assertNotIn(None, conform_pulse_params("gaussian", t0=5, energy=6))
|
||||
self.assertNotIn(None, conform_pulse_params("gaussian", width=5, energy=6))
|
||||
self.assertNotIn(None, conform_pulse_params("gaussian", t0=5, power=6))
|
||||
self.assertNotIn(None, conform_pulse_params("gaussian", width=5, power=6))
|
||||
|
||||
self.assertEqual(4, len(conform_pulse_params("gaussian", t0=5, energy=6)))
|
||||
self.assertEqual(4, len(conform_pulse_params("gaussian", width=5, energy=6)))
|
||||
self.assertEqual(4, len(conform_pulse_params("gaussian", t0=5, power=6)))
|
||||
self.assertEqual(4, len(conform_pulse_params("gaussian", width=5, power=6)))
|
||||
|
||||
with self.assertRaisesRegex(
|
||||
TypeError, "when soliton number is desired, both gamma and beta2 must be specified"
|
||||
):
|
||||
conform_pulse_params("gaussian", t0=5, energy=6, gamma=0.01)
|
||||
with self.assertRaisesRegex(
|
||||
TypeError, "when soliton number is desired, both gamma and beta2 must be specified"
|
||||
):
|
||||
conform_pulse_params("gaussian", t0=5, energy=6, beta2=0.01)
|
||||
|
||||
self.assertEqual(
|
||||
5, len(conform_pulse_params("gaussian", t0=5, energy=6, gamma=0.01, beta2=2e-6))
|
||||
)
|
||||
self.assertEqual(
|
||||
5, len(conform_pulse_params("gaussian", width=5, energy=6, gamma=0.01, beta2=2e-6))
|
||||
)
|
||||
self.assertEqual(
|
||||
5, len(conform_pulse_params("gaussian", t0=5, power=6, gamma=0.01, beta2=2e-6))
|
||||
)
|
||||
self.assertEqual(
|
||||
5, len(conform_pulse_params("gaussian", width=5, power=6, gamma=0.01, beta2=2e-6))
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user