about to move repeat from simulations to iterator

This commit is contained in:
Benoît Sierro
2021-01-29 17:46:58 +01:00
parent bf8e2ec0b1
commit 15bc736294
29 changed files with 789 additions and 51358 deletions

View File

@@ -9,11 +9,9 @@ run `sc.parallel_simulations(config_file)` or `sc.simulate(config_file)`
# How to analyse a simulation # How to analyse a simulation
load data with the load_sim_data method load data with the load_sim_data method
spectra = load_sim_data("varyTechNoise100kW_sim_data", nickname="cool_sim") spectra, params = load_sim_data("varyTechNoise100kW_sim_data")
to plot to plot
plot_results_2D(spectra[0], (600, 1450, nm)) # will take care of looking up the nickname plot_results_2D(spectra[0], (600, 1450, nm), params)
to retrieve a paramteter:
z = state.params["cool_sim"]["z"]
# Configuration # Configuration

View File

@@ -1,586 +0,0 @@
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 0)]
wavelength_8.35e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:01:39 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:01:44 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 25s (30% in total). ETA : 2021-01-28 16:02:16 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_0: remaining : 0h 0min 21s (41% in total). ETA : 2021-01-28 16:02:15 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 16:02:10 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 11s (60% in total). ETA : 2021-01-28 16:02:07 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 7s (71% in total). ETA : 2021-01-28 16:02:03 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:02:01 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:02:00 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:01:59 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_0: propagation finished in 4634 steps (19.990754 seconds)
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 0)]
wavelength_8.3e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:02:00 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:02:05 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_0: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_0: remaining : 0h 0min 23s (30% in total). ETA : 2021-01-28 16:02:33 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.3e-07_num_0: remaining : 0h 0min 19s (41% in total). ETA : 2021-01-28 16:02:31 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 14s (50% in total). ETA : 2021-01-28 16:02:28 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 10s (60% in total). ETA : 2021-01-28 16:02:25 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 6s (71% in total). ETA : 2021-01-28 16:02:22 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.3e-07_num_0: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:02:21 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.3e-07_num_0: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:02:19 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:02:18 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_0: propagation finished in 4181 steps (18.946698 seconds)
scgenerator.physics.simulate: Merging data...
scgenerator.physics.simulate: Finished simulations from config full anomalous !
scgenerator.physics.simulate: 1 node in the Ray cluster : ['Obento.fritz.box']
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 0)], job : df5a1a828c9685d3ffffffff0100000001000000
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 0)], job : cb230a572350ff44ffffffff0100000001000000
wavelength_8.35e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:08:57 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:08:58 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:09:02 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:09:03 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_0: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_0: remaining : 0h 0min 23s (30% in total). ETA : 2021-01-28 16:09:31 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.35e-07_num_0: remaining : 0h 0min 28s (30% in total). ETA : 2021-01-28 16:09:37 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.3e-07_num_0: remaining : 0h 0min 20s (41% in total). ETA : 2021-01-28 16:09:31 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 16:09:28 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 24s (41% in total). ETA : 2021-01-28 16:09:37 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 11s (60% in total). ETA : 2021-01-28 16:09:25 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 17s (50% in total). ETA : 2021-01-28 16:09:32 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 7s (71% in total). ETA : 2021-01-28 16:09:22 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.35e-07_num_0: remaining : 0h 0min 12s (60% in total). ETA : 2021-01-28 16:09:28 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:09:20 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.35e-07_num_0: remaining : 0h 0min 8s (71% in total). ETA : 2021-01-28 16:09:25 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:09:19 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 5s (80% in total). ETA : 2021-01-28 16:09:23 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:09:18 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_0: propagation finished in 4181 steps (20.752765 seconds)
wavelength_8.35e-07_num_0: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:09:21 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:09:19 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_0: propagation finished in 4634 steps (22.817256 seconds)
scgenerator.physics.simulate: Merging data...
scgenerator.physics.simulate: Finished simulations from config full anomalous !
scgenerator.physics.simulate: 1 node in the Ray cluster : ['Obento.fritz.box']
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 0)], job : df5a1a828c9685d3ffffffff0100000001000000
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 1)], job : cb230a572350ff44ffffffff0100000001000000
wavelength_8.35e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_1: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_1: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_1: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:21:10 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:21:11 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:21:15 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:21:16 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 30s (30% in total). ETA : 2021-01-28 16:21:54 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_1: remaining : 0h 0min 30s (30% in total). ETA : 2021-01-28 16:21:54 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_0: remaining : 0h 0min 24s (41% in total). ETA : 2021-01-28 16:21:52 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 24s (41% in total). ETA : 2021-01-28 16:21:52 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 17s (50% in total). ETA : 2021-01-28 16:21:46 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 17s (50% in total). ETA : 2021-01-28 16:21:47 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 12s (60% in total). ETA : 2021-01-28 16:21:42 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 12s (60% in total). ETA : 2021-01-28 16:21:43 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 8s (71% in total). ETA : 2021-01-28 16:21:39 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 8s (71% in total). ETA : 2021-01-28 16:21:39 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 5s (80% in total). ETA : 2021-01-28 16:21:37 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 5s (80% in total). ETA : 2021-01-28 16:21:37 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:21:35 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:21:35 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:21:33 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_0: propagation finished in 4634 steps (23.470734 seconds)
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 2)], job : 7bbd90284b71e599ffffffff0100000001000000
wavelength_8.35e-07_num_1: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:21:34 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_1: propagation finished in 4634 steps (23.325504 seconds)
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 3)], job : bd37d2621480fc7dffffffff0100000001000000
scgenerator.initialize: computed initial N = 8.66
wavelength_8.35e-07_num_2: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_2: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_2: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_3: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_3: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_3: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_2: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:21:35 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:21:35 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:21:40 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:21:40 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 28s (30% in total). ETA : 2021-01-28 16:22:15 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_3: remaining : 0h 0min 28s (30% in total). ETA : 2021-01-28 16:22:15 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_2: remaining : 0h 0min 23s (41% in total). ETA : 2021-01-28 16:22:13 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 23s (41% in total). ETA : 2021-01-28 16:22:14 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 16:22:08 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 16:22:09 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 12s (60% in total). ETA : 2021-01-28 16:22:05 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 12s (60% in total). ETA : 2021-01-28 16:22:05 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 8s (71% in total). ETA : 2021-01-28 16:22:01 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 8s (71% in total). ETA : 2021-01-28 16:22:02 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 5s (80% in total). ETA : 2021-01-28 16:21:59 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 5s (80% in total). ETA : 2021-01-28 16:22:00 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:21:58 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:21:58 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:21:56 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_2: propagation finished in 4634 steps (22.065082 seconds)
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 0)], job : 88866c7daffdd00effffffff0100000001000000
wavelength_8.35e-07_num_3: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:21:57 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_3: propagation finished in 4634 steps (22.22073 seconds)
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 1)], job : d251967856448cebffffffff0100000001000000
wavelength_8.3e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_1: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_1: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_1: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:21:58 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:21:59 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:22:03 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:22:04 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_0: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_1: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_0: remaining : 0h 0min 23s (30% in total). ETA : 2021-01-28 16:22:31 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.3e-07_num_1: remaining : 0h 0min 23s (30% in total). ETA : 2021-01-28 16:22:31 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.3e-07_num_0: remaining : 0h 0min 20s (41% in total). ETA : 2021-01-28 16:22:32 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 20s (41% in total). ETA : 2021-01-28 16:22:32 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 15s (50% in total). ETA : 2021-01-28 16:22:28 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 15s (50% in total). ETA : 2021-01-28 16:22:28 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 11s (60% in total). ETA : 2021-01-28 16:22:25 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 11s (60% in total). ETA : 2021-01-28 16:22:25 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 7s (71% in total). ETA : 2021-01-28 16:22:22 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.3e-07_num_1: remaining : 0h 0min 7s (71% in total). ETA : 2021-01-28 16:22:23 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.3e-07_num_0: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:22:20 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.3e-07_num_1: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:22:21 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.3e-07_num_0: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:22:19 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:22:20 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:22:18 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_0: propagation finished in 4181 steps (20.406912 seconds)
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 2)], job : 3bf0c856ace5a4d8ffffffff0100000001000000
wavelength_8.3e-07_num_1: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:22:18 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_1: propagation finished in 4181 steps (20.386092 seconds)
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 3)], job : 72e11b46e93d91e4ffffffff0100000001000000
wavelength_8.3e-07_num_2: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_2: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_2: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_3: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_3: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_3: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_2: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:22:20 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:22:20 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:22:25 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:22:25 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_2: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_3: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_2: remaining : 0h 0min 23s (30% in total). ETA : 2021-01-28 16:22:52 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.3e-07_num_3: remaining : 0h 0min 23s (30% in total). ETA : 2021-01-28 16:22:53 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.3e-07_num_2: remaining : 0h 0min 20s (41% in total). ETA : 2021-01-28 16:22:53 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 20s (41% in total). ETA : 2021-01-28 16:22:54 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 15s (50% in total). ETA : 2021-01-28 16:22:49 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 15s (50% in total). ETA : 2021-01-28 16:22:50 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 11s (60% in total). ETA : 2021-01-28 16:22:46 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 11s (60% in total). ETA : 2021-01-28 16:22:47 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 7s (71% in total). ETA : 2021-01-28 16:22:43 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.3e-07_num_3: remaining : 0h 0min 7s (71% in total). ETA : 2021-01-28 16:22:44 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.3e-07_num_2: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:22:42 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.3e-07_num_3: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:22:42 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.3e-07_num_2: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:22:40 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:22:41 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:22:39 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_2: propagation finished in 4181 steps (20.253876 seconds)
wavelength_8.3e-07_num_3: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:22:40 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_3: propagation finished in 4181 steps (20.165082 seconds)
scgenerator.physics.simulate: Merging data...
scgenerator.physics.simulate: Finished simulations from config full anomalous !
scgenerator.physics.simulate: 1 node in the Ray cluster : ['Obento.fritz.box']
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 0)], job : df5a1a828c9685d3ffffffff0100000001000000
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 1)], job : cb230a572350ff44ffffffff0100000001000000
wavelength_8.35e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_1: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_1: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_1: step 1 rejected with h = 7.9365e-05, doing over
scgenerator.physics.simulate: 1 node in the Ray cluster : ['Obento.fritz.box']
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 0)], job : df5a1a828c9685d3ffffffff0100000001000000
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 1)], job : cb230a572350ff44ffffffff0100000001000000
wavelength_8.35e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:45:21 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_1: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_1: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_1: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_1: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:45:22 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:45:26 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:45:27 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 28s (30% in total). ETA : 2021-01-28 16:46:00 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_1: remaining : 0h 0min 28s (30% in total). ETA : 2021-01-28 16:46:01 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_0: remaining : 0h 0min 21s (41% in total). ETA : 2021-01-28 16:45:57 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 21s (41% in total). ETA : 2021-01-28 16:45:58 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 16:45:53 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 16:45:53 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 11s (60% in total). ETA : 2021-01-28 16:45:49 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 11s (60% in total). ETA : 2021-01-28 16:45:50 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 7s (71% in total). ETA : 2021-01-28 16:45:46 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 7s (71% in total). ETA : 2021-01-28 16:45:47 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:45:44 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:45:45 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:45:43 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:45:44 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:45:42 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_0: propagation finished in 4634 steps (21.323236 seconds)
scgenerator.physics.simulate: remaining : 0h 2min 41s (12% in total). ETA : 2021-01-28 16:48:23
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 2)], job : 7bbd90284b71e599ffffffff0100000001000000
wavelength_8.35e-07_num_1: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:45:42 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_1: propagation finished in 4634 steps (21.296093 seconds)
scgenerator.physics.simulate: remaining : 0h 1min 9s (25% in total). ETA : 2021-01-28 16:46:51
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 3)], job : bd37d2621480fc7dffffffff0100000001000000
scgenerator.initialize: computed initial N = 8.66
wavelength_8.35e-07_num_2: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_2: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_2: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_3: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_3: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_3: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_2: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:45:43 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:45:44 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:45:48 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:45:49 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 28s (30% in total). ETA : 2021-01-28 16:46:23 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_3: remaining : 0h 0min 28s (30% in total). ETA : 2021-01-28 16:46:24 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_2: remaining : 0h 0min 23s (41% in total). ETA : 2021-01-28 16:46:22 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 23s (41% in total). ETA : 2021-01-28 16:46:23 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 16:46:17 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 16:46:17 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 12s (60% in total). ETA : 2021-01-28 16:46:13 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 12s (60% in total). ETA : 2021-01-28 16:46:14 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 8s (71% in total). ETA : 2021-01-28 16:46:10 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 8s (71% in total). ETA : 2021-01-28 16:46:11 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 5s (80% in total). ETA : 2021-01-28 16:46:08 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 5s (80% in total). ETA : 2021-01-28 16:46:08 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:46:06 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:46:07 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:46:05 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_2: propagation finished in 4634 steps (22.109413 seconds)
scgenerator.physics.simulate: remaining : 0h 1min 17s (37% in total). ETA : 2021-01-28 16:47:21
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 0)], job : 88866c7daffdd00effffffff0100000001000000
wavelength_8.35e-07_num_3: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:46:05 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_3: propagation finished in 4634 steps (22.079782 seconds)
scgenerator.physics.simulate: remaining : 0h 0min 47s (50% in total). ETA : 2021-01-28 16:46:52
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 1)], job : d251967856448cebffffffff0100000001000000
wavelength_8.3e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_1: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_1: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_1: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:46:06 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:46:07 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:46:11 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:46:12 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_0: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_1: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_0: remaining : 0h 0min 21s (30% in total). ETA : 2021-01-28 16:46:36 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.3e-07_num_1: remaining : 0h 0min 21s (30% in total). ETA : 2021-01-28 16:46:37 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.3e-07_num_0: remaining : 0h 0min 19s (41% in total). ETA : 2021-01-28 16:46:38 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 19s (41% in total). ETA : 2021-01-28 16:46:38 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 14s (50% in total). ETA : 2021-01-28 16:46:34 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 14s (50% in total). ETA : 2021-01-28 16:46:35 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 10s (60% in total). ETA : 2021-01-28 16:46:31 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 10s (60% in total). ETA : 2021-01-28 16:46:32 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 6s (71% in total). ETA : 2021-01-28 16:46:29 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.3e-07_num_1: remaining : 0h 0min 6s (71% in total). ETA : 2021-01-28 16:46:29 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.3e-07_num_0: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:46:27 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.3e-07_num_1: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:46:28 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.3e-07_num_0: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:46:26 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:46:26 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:46:25 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_0: propagation finished in 4181 steps (19.058624 seconds)
scgenerator.physics.simulate: remaining : 0h 0min 40s (62% in total). ETA : 2021-01-28 16:47:04
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 2)], job : 3bf0c856ace5a4d8ffffffff0100000001000000
wavelength_8.3e-07_num_1: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:46:25 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_1: propagation finished in 4181 steps (19.191059 seconds)
scgenerator.physics.simulate: remaining : 0h 0min 22s (75% in total). ETA : 2021-01-28 16:46:48
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 3)], job : 72e11b46e93d91e4ffffffff0100000001000000
wavelength_8.3e-07_num_2: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_2: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_2: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_3: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_3: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_3: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_2: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:46:27 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 16:46:27 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 16:46:32 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 8s (20% in total). ETA : 2021-01-28 16:46:36 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_2: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_3: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_2: remaining : 0h 0min 25s (30% in total). ETA : 2021-01-28 16:47:02 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.3e-07_num_3: remaining : 0h 0min 25s (30% in total). ETA : 2021-01-28 16:47:03 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.3e-07_num_2: remaining : 0h 0min 21s (41% in total). ETA : 2021-01-28 16:47:02 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 20s (41% in total). ETA : 2021-01-28 16:47:01 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 16:46:58 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 16:46:58 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 11s (60% in total). ETA : 2021-01-28 16:46:54 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 11s (60% in total). ETA : 2021-01-28 16:46:55 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 7s (71% in total). ETA : 2021-01-28 16:46:51 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.3e-07_num_3: remaining : 0h 0min 7s (71% in total). ETA : 2021-01-28 16:46:52 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.3e-07_num_2: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:46:49 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.3e-07_num_3: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 16:46:50 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.3e-07_num_2: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:46:48 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 16:46:48 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:46:47 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_2: propagation finished in 4181 steps (20.62597 seconds)
scgenerator.physics.simulate: remaining : 0h 0min 13s (87% in total). ETA : 2021-01-28 16:46:59
wavelength_8.3e-07_num_3: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:46:47 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_3: propagation finished in 4181 steps (20.517408 seconds)
scgenerator.physics.simulate: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 16:46:47
scgenerator.physics.simulate: Merging data...
scgenerator.physics.simulate: Finished simulations from config full anomalous !
scgenerator.initialize: using computed ɣ = 2.00e-02 W/m^2
scgenerator.initialize: computed initial N = 17.4
scgenerator.initialize: intensity noise of 0.0005
scgenerator.initialize: computed initial N = 8.66
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 0)]
wavelength_8.35e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 19:54:08 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 19:54:13 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 23s (30% in total). ETA : 2021-01-28 19:54:41 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_0: remaining : 0h 0min 19s (41% in total). ETA : 2021-01-28 19:54:39 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 14s (50% in total). ETA : 2021-01-28 19:54:36 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 10s (60% in total). ETA : 2021-01-28 19:54:33 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 6s (71% in total). ETA : 2021-01-28 19:54:30 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 19:54:28 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 19:54:27 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 19:54:26 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_0: propagation finished in 4634 steps (18.270374 seconds)
scgenerator.physics.simulate: remaining : 0h 2min 6s (12% in total). ETA : 2021-01-28 19:56:32
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 1)]
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 0)]
wavelength_8.35e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 19:56:42 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 19:56:47 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 23s (30% in total). ETA : 2021-01-28 19:57:15 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_0: remaining : 0h 0min 19s (41% in total). ETA : 2021-01-28 19:57:14 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 14s (50% in total). ETA : 2021-01-28 19:57:10 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 10s (60% in total). ETA : 2021-01-28 19:57:07 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 6s (71% in total). ETA : 2021-01-28 19:57:04 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 19:57:03 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 19:57:01 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 19:57:00 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_0: propagation finished in 4634 steps (18.345039 seconds)
scgenerator.physics.simulate: remaining : 0h 2min 6s (12% in total). ETA : 2021-01-28 19:59:06
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 1)]
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 0)]
wavelength_8.35e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 19:59:41 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 19:59:46 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 23s (30% in total). ETA : 2021-01-28 20:00:15 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_0: remaining : 0h 0min 20s (41% in total). ETA : 2021-01-28 20:00:15 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 15s (50% in total). ETA : 2021-01-28 20:00:10 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 10s (60% in total). ETA : 2021-01-28 20:00:07 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 6s (71% in total). ETA : 2021-01-28 20:00:04 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 20:00:02 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 20:00:01 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 20:00:00 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_0: propagation finished in 4634 steps (18.838541 seconds)
scgenerator.physics.simulate: remaining : 0h 2min 6s (12% in total). ETA : 2021-01-28 20:02:06
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 1)]
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 0)]
wavelength_8.35e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 20:01:06 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 20:01:11 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 23s (30% in total). ETA : 2021-01-28 20:01:40 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_0: remaining : 0h 0min 20s (41% in total). ETA : 2021-01-28 20:01:40 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 15s (50% in total). ETA : 2021-01-28 20:01:36 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 11s (60% in total). ETA : 2021-01-28 20:01:33 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 7s (71% in total). ETA : 2021-01-28 20:01:30 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 20:01:28 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 20:01:26 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 20:01:25 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_0: propagation finished in 4634 steps (19.588611 seconds)
scgenerator.physics.simulate: remaining : 0h 2min 13s (12% in total). ETA : 2021-01-28 20:03:38
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 1)]
wavelength_8.35e-07_num_1: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_1: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_1: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_1: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 20:01:26 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 20:01:31 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 28s (30% in total). ETA : 2021-01-28 20:02:06 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_1: remaining : 0h 0min 21s (41% in total). ETA : 2021-01-28 20:02:03 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 20:01:59 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 11s (60% in total). ETA : 2021-01-28 20:01:55 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 7s (71% in total). ETA : 2021-01-28 20:01:51 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 4s (80% in total). ETA : 2021-01-28 20:01:49 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 20:01:48 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 20:01:46 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_1: propagation finished in 4634 steps (20.783914 seconds)
scgenerator.physics.simulate: remaining : 0h 2min 0s (25% in total). ETA : 2021-01-28 20:03:46
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 2)]
wavelength_8.35e-07_num_2: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_2: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_2: step 1 rejected with h = 7.9365e-05, doing over
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 0)]
wavelength_8.35e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 20:03:06 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 4s (20% in total). ETA : 2021-01-28 20:03:11 (353 steps). z = 0.0041, h = 4.8586e-06
scgenerator.physics.simulate: 1 node in the Ray cluster : ['Obento.fritz.box']
scgenerator.initialize: computed initial N = 8.66
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 0)], job : df5a1a828c9685d3ffffffff0100000001000000
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 1)], job : cb230a572350ff44ffffffff0100000001000000
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 2)], job : 7bbd90284b71e599ffffffff0100000001000000
wavelength_8.35e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_1: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_1: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_2: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_1: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_2: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_2: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_0: remaining : 0h 0min 8s (11% in total). ETA : 2021-01-28 20:03:57 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 8s (11% in total). ETA : 2021-01-28 20:03:57 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 8s (11% in total). ETA : 2021-01-28 20:03:57 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 8s (20% in total). ETA : 2021-01-28 20:03:58 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 8s (20% in total). ETA : 2021-01-28 20:03:58 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 8s (20% in total). ETA : 2021-01-28 20:03:58 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 37s (30% in total). ETA : 2021-01-28 20:04:41 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_2: remaining : 0h 0min 37s (30% in total). ETA : 2021-01-28 20:04:41 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_0: remaining : 0h 0min 37s (30% in total). ETA : 2021-01-28 20:04:41 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.35e-07_num_2: remaining : 0h 0min 30s (41% in total). ETA : 2021-01-28 20:04:39 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 30s (41% in total). ETA : 2021-01-28 20:04:39 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 30s (41% in total). ETA : 2021-01-28 20:04:39 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 22s (50% in total). ETA : 2021-01-28 20:04:33 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 22s (50% in total). ETA : 2021-01-28 20:04:33 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 22s (50% in total). ETA : 2021-01-28 20:04:33 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 16s (60% in total). ETA : 2021-01-28 20:04:28 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 16s (60% in total). ETA : 2021-01-28 20:04:28 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 16s (60% in total). ETA : 2021-01-28 20:04:28 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 10s (71% in total). ETA : 2021-01-28 20:04:24 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 10s (71% in total). ETA : 2021-01-28 20:04:24 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 10s (71% in total). ETA : 2021-01-28 20:04:24 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 6s (80% in total). ETA : 2021-01-28 20:04:21 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 6s (80% in total). ETA : 2021-01-28 20:04:21 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 6s (80% in total). ETA : 2021-01-28 20:04:21 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 3s (90% in total). ETA : 2021-01-28 20:04:18 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_0: remaining : 0h 0min 3s (90% in total). ETA : 2021-01-28 20:04:19 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 3s (90% in total). ETA : 2021-01-28 20:04:19 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.35e-07_num_2: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 20:04:17 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_2: propagation finished in 4634 steps (28.97378 seconds)
scgenerator.physics.simulate: remaining : 0h 3min 30s (12% in total). ETA : 2021-01-28 20:07:47
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.35e-07), ('num', 3)], job : bd37d2621480fc7dffffffff0100000001000000
scgenerator.initialize: computed initial N = 8.66
wavelength_8.35e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 20:04:17 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_1: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 20:04:17 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_0: propagation finished in 4634 steps (29.131892 seconds)
wavelength_8.35e-07_num_1: propagation finished in 4634 steps (29.093002 seconds)
scgenerator.physics.simulate: remaining : 0h 1min 33s (25% in total). ETA : 2021-01-28 20:05:50
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 0)], job : 88866c7daffdd00effffffff0100000001000000
scgenerator.physics.simulate: remaining : 0h 0min 52s (37% in total). ETA : 2021-01-28 20:05:08
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 1)], job : d251967856448cebffffffff0100000001000000
wavelength_8.35e-07_num_3: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.35e-07_num_3: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.35e-07_num_3: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_0: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_0: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_0: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_1: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_1: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_1: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_3: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 20:04:18 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 20:04:19 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 0s (11% in total). ETA : 2021-01-28 20:04:19 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 8s (20% in total). ETA : 2021-01-28 20:04:28 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 8s (20% in total). ETA : 2021-01-28 20:04:28 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 8s (20% in total). ETA : 2021-01-28 20:04:28 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_0: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_1: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_0: remaining : 0h 0min 30s (30% in total). ETA : 2021-01-28 20:05:01 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.3e-07_num_1: remaining : 0h 0min 30s (30% in total). ETA : 2021-01-28 20:05:01 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.35e-07_num_3: remaining : 0h 0min 35s (30% in total). ETA : 2021-01-28 20:05:08 (2638 steps). z = 0.0060, h = 9.7856e-07
wavelength_8.3e-07_num_0: remaining : 0h 0min 24s (41% in total). ETA : 2021-01-28 20:05:00 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 24s (41% in total). ETA : 2021-01-28 20:05:00 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 18s (50% in total). ETA : 2021-01-28 20:04:56 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 18s (50% in total). ETA : 2021-01-28 20:04:56 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 28s (41% in total). ETA : 2021-01-28 20:05:07 (3444 steps). z = 0.0083, h = 1.7968e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 13s (60% in total). ETA : 2021-01-28 20:04:52 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 13s (60% in total). ETA : 2021-01-28 20:04:52 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 9s (71% in total). ETA : 2021-01-28 20:04:49 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.3e-07_num_1: remaining : 0h 0min 9s (71% in total). ETA : 2021-01-28 20:04:49 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.35e-07_num_3: remaining : 0h 0min 21s (50% in total). ETA : 2021-01-28 20:05:01 (3706 steps). z = 0.0102, h = 2.8346e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 5s (80% in total). ETA : 2021-01-28 20:04:46 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.3e-07_num_1: remaining : 0h 0min 5s (80% in total). ETA : 2021-01-28 20:04:46 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.35e-07_num_3: remaining : 0h 0min 16s (60% in total). ETA : 2021-01-28 20:04:58 (3915 steps). z = 0.0121, h = 8.8081e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 3s (90% in total). ETA : 2021-01-28 20:04:46 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.3e-07_num_1: remaining : 0h 0min 3s (90% in total). ETA : 2021-01-28 20:04:46 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 10s (71% in total). ETA : 2021-01-28 20:04:55 (4135 steps). z = 0.0143, h = 5.7601e-06
wavelength_8.3e-07_num_0: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 20:04:45 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_1: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 20:04:45 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_0: propagation finished in 4181 steps (27.237882 seconds)
wavelength_8.3e-07_num_1: propagation finished in 4181 steps (27.326729 seconds)
scgenerator.physics.simulate: remaining : 0h 0min 59s (50% in total). ETA : 2021-01-28 20:05:44
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 2)], job : 3bf0c856ace5a4d8ffffffff0100000001000000
scgenerator.physics.simulate: remaining : 0h 0min 35s (62% in total). ETA : 2021-01-28 20:05:21
scgenerator.physics.simulate: launching simulation with [('wavelength', 8.3e-07), ('num', 3)], job : 72e11b46e93d91e4ffffffff0100000001000000
wavelength_8.3e-07_num_2: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_2: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_2: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.3e-07_num_3: Storing 63 new spectra, first one at 0.00031746031746031746m
wavelength_8.3e-07_num_3: step 1 rejected with h = 1.5873e-04, doing over
wavelength_8.3e-07_num_3: step 1 rejected with h = 7.9365e-05, doing over
wavelength_8.35e-07_num_3: remaining : 0h 0min 7s (80% in total). ETA : 2021-01-28 20:04:54 (4307 steps). z = 0.0162, h = 6.6994e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 8s (11% in total). ETA : 2021-01-28 20:04:56 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 8s (11% in total). ETA : 2021-01-28 20:04:56 (132 steps). z = 0.0022, h = 5.5668e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 3s (90% in total). ETA : 2021-01-28 20:04:52 (4466 steps). z = 0.0181, h = 5.4078e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 8s (20% in total). ETA : 2021-01-28 20:04:57 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.35e-07_num_3: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 20:04:50 (4634 steps). z = 0.0200, h = 7.4967e-06
wavelength_8.35e-07_num_3: propagation finished in 4634 steps (31.918563 seconds)
scgenerator.physics.simulate: remaining : 0h 0min 21s (75% in total). ETA : 2021-01-28 20:05:11
wavelength_8.3e-07_num_3: remaining : 0h 0min 8s (20% in total). ETA : 2021-01-28 20:04:57 (353 steps). z = 0.0041, h = 4.8586e-06
wavelength_8.3e-07_num_3: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_2: step 997 rejected with h = 2.7537e-06, doing over
wavelength_8.3e-07_num_2: remaining : 0h 0min 25s (30% in total). ETA : 2021-01-28 20:05:24 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.3e-07_num_3: remaining : 0h 0min 25s (30% in total). ETA : 2021-01-28 20:05:24 (2162 steps). z = 0.0060, h = 3.8127e-08
wavelength_8.3e-07_num_2: remaining : 0h 0min 21s (41% in total). ETA : 2021-01-28 20:05:24 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 21s (41% in total). ETA : 2021-01-28 20:05:24 (2991 steps). z = 0.0083, h = 5.8562e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 20:05:20 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 16s (50% in total). ETA : 2021-01-28 20:05:21 (3242 steps). z = 0.0102, h = 6.5756e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 12s (60% in total). ETA : 2021-01-28 20:05:17 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 12s (60% in total). ETA : 2021-01-28 20:05:17 (3443 steps). z = 0.0121, h = 2.9227e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 8s (71% in total). ETA : 2021-01-28 20:05:14 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.3e-07_num_3: remaining : 0h 0min 8s (71% in total). ETA : 2021-01-28 20:05:14 (3664 steps). z = 0.0143, h = 1.1425e-05
wavelength_8.3e-07_num_2: remaining : 0h 0min 5s (80% in total). ETA : 2021-01-28 20:05:12 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.3e-07_num_3: remaining : 0h 0min 5s (80% in total). ETA : 2021-01-28 20:05:13 (3833 steps). z = 0.0162, h = 1.0515e-05
wavelength_8.3e-07_num_2: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 20:05:11 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.3e-07_num_3: remaining : 0h 0min 2s (90% in total). ETA : 2021-01-28 20:05:11 (4003 steps). z = 0.0181, h = 7.4644e-06
wavelength_8.3e-07_num_2: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 20:05:10 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_2: propagation finished in 4181 steps (22.964871 seconds)
scgenerator.physics.simulate: remaining : 0h 0min 12s (87% in total). ETA : 2021-01-28 20:05:22
wavelength_8.3e-07_num_3: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 20:05:10 (4181 steps). z = 0.0200, h = 1.21e-05
wavelength_8.3e-07_num_3: propagation finished in 4181 steps (22.72864 seconds)
scgenerator.physics.simulate: remaining : 0h 0min 0s (100% in total). ETA : 2021-01-28 20:05:10
scgenerator.physics.simulate: Merging data...
scgenerator.physics.simulate: Finished simulations from config full anomalous !

View File

@@ -1,7 +1,6 @@
from . import initialize, io, math, plotting, state, utilities
from .initialize import compute_init_parameters from .initialize import compute_init_parameters
from .io import Paths, iter_load_sim_data, load_toml, load_sim_data from .io import Paths, iter_load_sim_data, load_toml, load_sim_data
from .math import abs2, argclosest, span from .math import abs2, argclosest, span
from .physics import fiber, materials, pulse, simulate, units from .physics import fiber, materials, pulse, simulate, units
from .physics.simulate import RK4IP, parallel_simulations from .physics.simulate import RK4IP, new_simulations
from .plotting import plot_avg, plot_results_1D, plot_results_2D, plot_spectrogram from .plotting import plot_avg, plot_results_1D, plot_results_2D, plot_spectrogram

View File

@@ -103,7 +103,7 @@ valid_param_types = dict(
he_mode=he_mode, he_mode=he_mode,
fit_parameters=fit_parameters, fit_parameters=fit_parameters,
beta=beta, beta=beta,
model=string(["pcf", "marcatili", "marcatili_adjusted", "hasan"]), model=string(["pcf", "marcatili", "marcatili_adjusted", "hasan", "custom"]),
length=num, length=num,
capillary_num=integer, capillary_num=integer,
capillary_outer_d=num, capillary_outer_d=num,
@@ -144,6 +144,7 @@ valid_param_types = dict(
step_size=num, step_size=num,
lower_wavelength_interp_limit=num, lower_wavelength_interp_limit=num,
upper_wavelength_interp_limit=num, upper_wavelength_interp_limit=num,
frep=num,
), ),
) )
@@ -193,3 +194,4 @@ valid_varying = dict(
TMP_FOLDER_KEY_BASE = "SCGENERATOR_TMP" TMP_FOLDER_KEY_BASE = "SCGENERATOR_TMP"
PARAM_SEPARATOR = " "

View File

@@ -1,4 +1,4 @@
import numpy as np import matplotlib.pyplot as plt
from .errors import MissingParameterError from .errors import MissingParameterError
@@ -28,6 +28,34 @@ default_parameters = dict(
ideal_gas=False, ideal_gas=False,
) )
default_plotting = dict(
figsize=(10, 7),
interpolation_2D="bicubic",
vmin=-40,
vmax=0,
vmax_with_headroom=2,
name="plot",
avg_main_to_coherence_ratio=4,
avg_line_labels=["individual values", "mean"],
muted_style=dict(linewidth=0.5, c=(0.8, 0.8, 0.8, 0.4)),
highlighted_style=dict(c="red"),
color_cycle=plt.rcParams["axes.prop_cycle"].by_key()["color"],
light_color=(1, 1, 1, 0.7),
markers=["*", "+", ".", "D", "x", "d", "v", "s", "1", "^"],
cmap="viridis",
label_quality_factor=r"$F_\mathrm{Q}$",
label_mean_g12=r"$\langle | g_{12} |\rangle$",
label_g12=r"|$g_{12}$|",
label_z="propagation distance z (m)",
label_fwhm=r"$T_\mathrm{FWHM}$ (fs)",
label_wb_distance=r"$L_\mathrm{WB}$",
label_t_jitter="timing jitter (fs)",
label_fwhm_noise="FWHM noise (%)",
label_int_noise="RIN (%)",
text_topright_style=dict(verticalalignment="top", horizontalalignment="right"),
text_topleft_style=dict(verticalalignment="top", horizontalalignment="left"),
)
def get(section_dict, param, **kwargs): def get(section_dict, param, **kwargs):
"""checks if param is in the parameter section dict and attempts to fill in a default value """checks if param is in the parameter section dict and attempts to fill in a default value

View File

@@ -1,17 +1,15 @@
from os import path import os
from typing import Iterator, Mapping, Tuple from typing import Any, Iterator, List, Mapping, Tuple
import numpy as np import numpy as np
from numpy import pi from numpy import pi
from numpy.core.fromnumeric import var
from ray.state import current_node_id
from . import io, state, defaults from . import defaults, io, utils
from .math import length, power_fact from .math import length, power_fact
from .physics import fiber, pulse, units from .physics import fiber, pulse, units
from .const import valid_param_types, valid_varying, hc_model_specific_parameters from .const import valid_param_types, valid_varying, hc_model_specific_parameters
from .errors import * from .errors import *
from .io import get_logger from .logger import get_logger
from .utilities import varying_iterator, count_variations from .utils import varying_iterator, count_variations
class ParamSequence(Mapping): class ParamSequence(Mapping):
@@ -23,15 +21,6 @@ class ParamSequence(Mapping):
self.num_sim, self.num_varying = count_variations(self.config) self.num_sim, self.num_varying = count_variations(self.config)
self.single_sim = self.num_sim == 1 self.single_sim = self.num_sim == 1
def get_pulse(self, key):
return self.config["pulse"][key]
def get_fiber(self, key):
return self.config["fiber"][key]
def get_simulation(self, key):
return self.config["pulse"][key]
def __iter__(self) -> Iterator[Tuple[list, dict]]: def __iter__(self) -> Iterator[Tuple[list, dict]]:
"""iterates through all possible parameters, yielding a config as welle as a flattened """iterates through all possible parameters, yielding a config as welle as a flattened
computed parameters set each time""" computed parameters set each time"""
@@ -48,6 +37,32 @@ class ParamSequence(Mapping):
return f"dispatcher generated from config {self.name}" return f"dispatcher generated from config {self.name}"
class RecoveryParamSequence(ParamSequence):
def __init__(self, config, task_id):
super().__init__(config)
self.id = task_id
for sub_folder in io.get_data_subfolders(io.get_data_folder(self.id)):
if io.propagation_completed(sub_folder, config["simulation"]["z_num"]):
self.num_sim -= 1
self.single_sim = self.num_sim == 1
def __iter__(self) -> Iterator[Tuple[list, dict]]:
for varying_only, full_config in varying_iterator(self.config):
sub_folder = os.path.join(
io.get_data_folder(self.id), utils.format_varying_list(varying_only)
)
print(f"{io.propagation_initiated(sub_folder)=}, {sub_folder=}")
continue
if not io.propagation_initiated(vary_str):
yield varying_only, compute_init_parameters(full_config)
elif not io.propagation_completed(vary_str):
yield varying_only, recover_params(full_config, varying_only, self.id)
else:
continue
def wspace(t, t_num=0): def wspace(t, t_num=0):
"""frequency array such that x(t) <-> np.fft(x)(w) """frequency array such that x(t) <-> np.fft(x)(w)
Parameters Parameters
@@ -356,6 +371,18 @@ def ensure_consistency(config):
return config return config
def recover_params(params: dict, varying_only: List[Tuple[str, Any]], task_id: int):
print("RECOVERING PARAMETERS")
params = compute_init_parameters(params)
vary_str = utils.format_varying_list(varying_only)
path = os.path.join(io.get_data_folder(task_id), vary_str)
num, last_spectrum = io.load_last_spectrum(path)
params["spec_0"] = last_spectrum
params["field_0"] = np.fft.ifft(last_spectrum)
params["recovery_last_stored"] = num
params["cons_qty"] = np.load(os.path.join(path, "cons_qty.npy"))
return params
def compute_init_parameters(config): def compute_init_parameters(config):
"""computes all derived values from a config dictionary """computes all derived values from a config dictionary
@@ -364,6 +391,7 @@ def compute_init_parameters(config):
---------- ----------
config : dict config : dict
a configuration dictionary containing the pulse, fiber and simulation sections with no varying parameter. a configuration dictionary containing the pulse, fiber and simulation sections with no varying parameter.
a flattened parameters dictionary may be provided instead
Note : checking the validity of the configuration shall be done before calling this function. Note : checking the validity of the configuration shall be done before calling this function.
Returns Returns
@@ -381,6 +409,12 @@ def compute_init_parameters(config):
params[key] = value params[key] = value
params = _generate_sim_grid(params) params = _generate_sim_grid(params)
if "step_size" in params:
params["error_ok"] = params["step_size"]
params["adapt_step_size"] = False
else:
params["error_ok"] = params["tolerated_error"]
params["adapt_step_size"] = True
# FIBER # FIBER
params["interp_range"] = _interp_range( params["interp_range"] = _interp_range(
@@ -435,6 +469,8 @@ def compute_init_parameters(config):
params["w_c"], params["w0"], params["time_window"], params["dt"] params["w_c"], params["w0"], params["time_window"], params["dt"]
) )
params["spec_0"] = np.fft.fft(params["field_0"])
return params return params
@@ -506,10 +542,13 @@ def _generate_sim_grid(params):
dict dict
updated parameter dictionary updated parameter dictionary
""" """
t = tspace( t = params.get(
time_window=params.get("time_window", None), "t",
t_num=params.get("t_num", None), tspace(
dt=params.get("dt", None), time_window=params.get("time_window", None),
t_num=params.get("t_num", None),
dt=params.get("dt", None),
),
) )
params["t"] = t params["t"] = t
params["time_window"] = length(t) params["time_window"] = length(t)
@@ -524,209 +563,10 @@ def _generate_sim_grid(params):
params["w_power_fact"] = [power_fact(w_c, k) for k in range(2, 11)] params["w_power_fact"] = [power_fact(w_c, k) for k in range(2, 11)]
params["z_targets"] = np.linspace(0, params["length"], params["z_num"]) params["z_targets"] = np.linspace(0, params["length"], params["z_num"])
params["store_num"] = len(params["z_targets"])
return params return params
# def compute_init_parameters_old(dictionary):
# """
# computes the initial parameters required and sorts them in 3 categories : simulations, pulse and fiber
# Parameters
# ----------
# dictionary : dict, optional
# dictionary containing parameters for a single simulation
# Returns
# -------
# params : dict
# dictionary of parameters
# Note
# ----
# Parameter computation occurs in 3 different stages
# Simulation-specific parameters
# Fiber-specific parameters
# Initial pulse parameters
# """
# logger = state.CurrentLogger
# param_dico = dictionary.copy()
# if "name" not in param_dico:
# param_dico["name"] = "untitled_parameters"
# # convert units
# param_dico = units.standardize_dictionary(param_dico)
# #### SIMULATION SPECIFIC VALUES
# # time/frequency grid
# lambda0 = param_dico["lambda0"]
# t = tspace(
# T=param_dico.get("T", None), t_num=param_dico.get("nt", None), dt=param_dico.get("dt", None)
# ) # time grid
# w_c = wspace(t)
# w0 = units.m(lambda0)
# param_dico["T"] = length(t)
# param_dico["dt"] = t[1] - t[0]
# param_dico["nt"] = len(t)
# param_dico["w0"] = w0
# param_dico["w_c"] = w_c
# param_dico["w"] = w_c + w0
# param_dico["t"] = t
# # precompute (w - w0)^k / k!
# param_dico["w_power_fact"] = [power_fact(w_c, k) for k in range(2, 11)]
# logger.log(
# f"time window : {1e15*param_dico['T']:.1f}fs with {1e15*param_dico['dt']:.1f}fs resolution"
# )
# logger.log(
# f"wl window : {units.nm.inv(np.max(param_dico['w']))}nm to {units.nm.inv(np.min(param_dico['w'][param_dico['w'] > 0]))}nm"
# )
# # High frequencies can be a problem
# # We can ignore them with a lower_wavelength_interp_limit parameter
# if units.nm.inv(np.max(w_c + w0)) < 450 and "lower_wavelength_interp_limit" not in param_dico:
# pass
# if "lower_wavelength_interp_limit" in param_dico:
# lower_wavelength_interp_limit = units.nm(param_dico["lower_wavelength_interp_limit"])
# logger.log(
# f"ignoring wavelength below {lower_wavelength_interp_limit} for dispersion and photon number computation"
# )
# del param_dico["lower_wavelength_interp_limit"]
# else:
# lower_wavelength_interp_limit = np.inf
# #### FIBER PARAMETERS
# # Unify data whether we want spectra stored at certain places or just
# # a certain number of them uniformly spaced
# if "z_targets" not in param_dico:
# param_dico["z_targets"] = np.linspace(0, 1, state.default_z_target_size)
# else:
# param_dico["z_targets"] = sanitize_z_targets(param_dico["z_targets"])
# param_dico["store_num"] = len(param_dico["z_targets"])
# # Dispersion parameters of the fiber, as well as gamma
# if "interp_range" not in param_dico:
# # the interpolation range of the dispersion polynomial stops exactly
# # at the boundary of the frequency window we consider
# param_dico["interp_range"] = [
# units.nm.inv(max(np.max(w_c + w0), units.nm(lower_wavelength_interp_limit))),
# 1900,
# ]
# if "beta" in param_dico:
# param_dico["beta"] = np.array(param_dico["beta"])
# temp_gamma = 0
# param_dico["dynamic_dispersion"] = False
# else:
# param_dico["dynamic_dispersion"] = fiber.is_dynamic_dispersion(param_dico)
# param_dico["beta"], temp_gamma = fiber.dispersion_central(
# param_dico.get("fiber_model", "PCF"), param_dico
# )
# if param_dico["dynamic_dispersion"]:
# param_dico["gamma_func"] = temp_gamma
# param_dico["beta_func"] = param_dico["beta"]
# param_dico["beta"] = param_dico["beta_func"](0)
# temp_gamma = temp_gamma(0)
# if "gamma" not in param_dico:
# param_dico["gamma"] = temp_gamma
# logger.log(f"computed gamma coefficient of {temp_gamma:.2e}")
# # Raman response
# if "raman" in param_dico["behaviors"]:
# param_dico["hr_w"] = fiber.delayed_raman_w(
# t, param_dico["dt"], param_dico.get("raman_type", "stolen")
# )
# #### PULSE PARAMETERS
# # Convert if pulse energy is given
# if "E0" in param_dico:
# param_dico["P0"] = pulse.E0_to_P0(
# param_dico["E0"], param_dico["T0_FWHM"], param_dico.get("pulse_shape", "gaussian")
# )
# logger.log(
# f"Pulse energy of {1e6 * param_dico['E0']:.2f} microjoules converted to peak power of {1e-3 * param_dico['P0']:.0f}kW."
# )
# # Soliton Number
# param_dico["t0"] = (
# param_dico["T0_FWHM"] * pulse.fwhm_to_T0_fac[param_dico.get("pulse_shape", "gaussian")]
# )
# if "N" in param_dico:
# param_dico["P0"] = (
# param_dico["N"] ** 2
# * np.abs(param_dico["beta"][0])
# / (param_dico["gamma"] * param_dico["t0"] ** 2)
# )
# logger.log(
# "Pump power adjusted to {:.2f} W to match solition number {}".format(
# param_dico["P0"], param_dico["N"]
# )
# )
# else:
# param_dico["N"] = np.sqrt(
# param_dico["P0"]
# * param_dico["gamma"]
# * param_dico["t0"] ** 2
# / np.abs(param_dico["beta"][0])
# )
# logger.log("Soliton number : {:.2f}".format(param_dico["N"]))
# # Other caracteristic quantities
# param_dico["L_D"] = param_dico["t0"] ** 2 / np.abs(param_dico["beta"][0])
# param_dico["L_NL"] = 1 / (param_dico["gamma"] * param_dico["P0"])
# param_dico["L_sol"] = pi / 2 * param_dico["L_D"]
# # Technical noise
# if "delta_I" in param_dico:
# if param_dico["delta_I"] > 0:
# logger.log(f"intensity noise of {param_dico['delta_I']}")
# delta_int, delta_T0 = pulse.technical_noise(param_dico["delta_I"])
# param_dico["P0"] *= delta_int
# param_dico["t0"] *= delta_T0
# param_dico["T0_FWHM"] *= delta_T0
# # Initial field
# field_0 = np.zeros(param_dico["nt"], dtype="complex")
# # check validity if an array is given, otherwise compute it according to given values
# if "field_0" in param_dico:
# if isinstance(param_dico["field_0"], str):
# field_0 = evaluate_field_equation(param_dico["field_0"], **param_dico)
# elif len(param_dico["field_0"]) != param_dico["nt"] or not isinstance(
# param_dico["field_0"], (tuple, list, np.ndarray)
# ):
# raise ValueError(
# "initial field is given but doesn't match size and type with the time array"
# )
# else:
# shape = param_dico.get("pulse_shape", "gaussian")
# if shape.lower() == "gaussian":
# field_0 = pulse.gauss_pulse(param_dico["t"], param_dico["T0_FWHM"], param_dico["P0"])
# elif shape.lower() == "sech":
# field_0 = pulse.sech_pulse(param_dico["t"], param_dico["T0_FWHM"], param_dico["P0"])
# # Shot noise
# if "q_noise" in param_dico["behaviors"]:
# field_0 = field_0 + pulse.shot_noise(w_c, w0, param_dico["T"], param_dico["dt"])
# param_dico["field_0"] = np.array(field_0, dtype="complex")
# return param_dico
def sanitize_z_targets(z_targets): def sanitize_z_targets(z_targets):
""" """
processes the 'z_targets' arguments and guarantees that: processes the 'z_targets' arguments and guarantees that:
@@ -744,7 +584,7 @@ def sanitize_z_targets(z_targets):
z_targets : list (mutability is important) z_targets : list (mutability is important)
""" """
if isinstance(z_targets, (float, int)): if isinstance(z_targets, (float, int)):
z_targets = np.linspace(0, z_targets, state.default_z_target_size) z_targets = np.linspace(0, z_targets, defaults.default_parameters["length"])
else: else:
z_targets = np.array(z_targets).flatten() z_targets = np.array(z_targets).flatten()

View File

@@ -1,22 +1,19 @@
import itertools
import json import json
import logging
import os import os
import shutil
from datetime import datetime from datetime import datetime
from glob import glob from glob import glob
from typing import Any, Dict, Iterable, List, Tuple from typing import Any, Dict, Iterable, List, Tuple
import matplotlib.pyplot as plt
import numpy as np import numpy as np
import pkg_resources as pkg import pkg_resources as pkg
import toml import toml
from matplotlib.gridspec import GridSpec from send2trash import TrashPermissionError, send2trash
from scgenerator import utilities from . import utils
from scgenerator.const import TMP_FOLDER_KEY_BASE, num from .const import TMP_FOLDER_KEY_BASE, PARAM_SEPARATOR
from scgenerator.errors import IncompleteDataFolderError from .errors import IncompleteDataFolderError
from .logger import get_logger
from . import state
def load_toml(path): def load_toml(path):
@@ -37,55 +34,6 @@ def save_toml(path, dico):
return dico return dico
def get_logger(name=None):
"""returns a logging.Logger instance. This function is there because if scgenerator
is used with ray, workers are not aware of any configuration done with the logging
and so it must be reconfigured.
Parameters
----------
name : str, optional
name of the logger, by default None
Returns
-------
logging.Logger obj
logger
"""
name = __name__ if name is None else name
logger = logging.getLogger(name)
return configure_logger(logger)
def configure_logger(logger, logfile="scgenerator.log"):
"""configures a logging.Logger obj
Parameters
----------
logger : logging.Logger
logger to configure
logfile : str or None, optional
path to log file
Returns
-------
logging.Logger obj
updated logger
"""
if not hasattr(logger, "already_configured"):
if logfile is not None:
file_handler = logging.FileHandler("scgenerator.log", "a+")
file_handler.setFormatter(logging.Formatter("{name}: {message}", style="{"))
logger.addHandler(file_handler)
stream_handler = logging.StreamHandler()
logger.addHandler(stream_handler)
logger.setLevel(logging.INFO)
logger.already_configured = True
return logger
class Paths: class Paths:
home = os.path.expanduser("~") home = os.path.expanduser("~")
_data_files = ["silica.toml", "gas.toml", "hr_t.npz"] _data_files = ["silica.toml", "gas.toml", "hr_t.npz"]
@@ -151,7 +99,7 @@ def _prepare_for_serialization(dico):
dico : dict dico : dict
dictionary dictionary
""" """
forbiden_keys = ["w_c", "w_power_fact", "field_0", "w"] forbiden_keys = ["w_c", "w_power_fact", "field_0", "spec_0", "w"]
types = (np.ndarray, float, int, str, list, tuple, dict) types = (np.ndarray, float, int, str, list, tuple, dict)
out = {} out = {}
for key, value in dico.items(): for key, value in dico.items():
@@ -245,7 +193,6 @@ def load_sim_data(folder_name, ind=None, load_param=True):
- If only 1 int, will cast the (1, n, nt) array into a (n, nt) array - If only 1 int, will cast the (1, n, nt) array into a (n, nt) array
load_param : (bool) return the parameter dictionary as well. returns None load_param : (bool) return the parameter dictionary as well. returns None
if not available if not available
dico_name : name of the params dict stored in state.Params
Returns Returns
---------- ----------
spectra : array spectra : array
@@ -326,8 +273,8 @@ def iter_load_sim_data(folder_name, with_params=False) -> Iterable[np.ndarray]:
yield load_single_spectrum(folder_name, i) yield load_single_spectrum(folder_name, i)
def _get_data_subfolders(path: str) -> List[str]: def get_data_subfolders(path: str) -> List[str]:
"""returns a list of subfolders in the specified directory """returns a list of path/subfolders in the specified directory
Parameters Parameters
---------- ----------
@@ -344,29 +291,6 @@ def _get_data_subfolders(path: str) -> List[str]:
return sub_folders return sub_folders
# def _sort_subfolder_list(
# sub_folders: List[str], varying_lists: List[Tuple[str, Any]]
# ) -> Tuple[list]:
# """sorts the two lists in parallel according to parameter values
# Parameters
# ----------
# sub_folders : List[str]
# paths to where spectra are loaded
# varying_lists : List[Tuple]
# (param_name, value) tuples corresponding to the sub_folders
# Returns
# -------
# Tuple[list]
# the input, sorted
# """
# both_lists = list(zip(sub_folders, varying_lists))
# for i in range(len(varying_lists[0])):
# both_lists.sort(key=lambda el: el[1][i][1])
# return tuple(zip(*both_lists))
def check_data_integrity(sub_folders: List[str], init_z_num: int): def check_data_integrity(sub_folders: List[str], init_z_num: int):
"""checks the integrity and completeness of a simulation data folder """checks the integrity and completeness of a simulation data folder
@@ -383,71 +307,71 @@ def check_data_integrity(sub_folders: List[str], init_z_num: int):
raised if not all spectra are present in any folder raised if not all spectra are present in any folder
""" """
for sub_folder in sub_folders: for sub_folder in sub_folders:
params = load_toml(os.path.join(sub_folder, "params.toml")) if not propagation_completed(sub_folder, init_z_num):
z_num = params["z_num"]
num_spectra = len(glob(os.path.join(sub_folder, "spectrum*.npy")))
if z_num != init_z_num:
raise IncompleteDataFolderError( raise IncompleteDataFolderError(
f"initial config specifies {init_z_num} spectra per" f"not enough spectra of the specified {init_z_num} found in {sub_folder}"
+ f" but the parameter file in {sub_folder} specifies {z_num}"
)
if num_spectra != z_num:
raise IncompleteDataFolderError(
f"only {num_spectra} spectra found in {sub_folder} instead of the specified {z_num}"
) )
# def preprocess_data_folder(path: str) -> bool: def propagation_initiated(sub_folder) -> bool:
# config = load_toml(os.path.join(path, "initial_config.toml")) print(f"{sub_folder=}")
# num_sims, _ = utilities.count_variations(config) if os.path.isdir(sub_folder):
# sub_folders = _get_data_subfolders(path) return find_last_spectrum_file(sub_folder) > 0
# init_z_num = config["simulation"]["z_num"] return False
# if len(sub_folders) != num_sims:
# raise IncompleteDataFolderError(
# f"only {len(sub_folders)} simulations out of {num_sims} have been made"
# )
# varying_lists = [utilities.varying_list_from_path(os.path.split(s)[1]) for s in sub_folders]
# varying_params = [el[0] for el in varying_lists[0]]
# sub_folders, varying_lists = _update_varying_lists(
# sub_folders, varying_lists, varying_params, init_z_num
# )
# possible_values = []
# for i, p in enumerate(varying_params):
# tmp = set()
# for v_list in varying_lists:
# tmp.add(v_list[i][1])
# tmp = list(tmp)
# possible_values.append(tmp)
# return sub_folders, varying_lists, varying_params, possible_values, init_z_num
# def merge_data(path: str): def propagation_completed(sub_folder: str, init_z_num: int):
# sub_folders, varying_lists, varying_params, possible_values, z_num = preprocess_data_folder( """checks if a propagation has completed
# path
# ) Parameters
# z_values = list(range(z_num)) ----------
# pt = utilities.ProgressTracker(z_num, auto_print=True) sub_folder : str
# shape = tuple((len(l) for l in possible_values)) path to the sub folder containing the spectra
# for z_num in z_values: init_z_num : int
# to_save = [] number of z position to store as specified in the master config file
# for i in range(np.product(shape)):
# to_save.append(np.load(os.path.join(sub_folders[i], f"spectrum_{z_num}.npy"))) Returns
# out = np.array(to_save).reshape((*shape, len(to_save[0]))) -------
# np.save(os.path.join(path, f"spectra_{z_num}.npy"), out) bool
# pt.update() True if the propagation has completed
# _create_reference_file(varying_params, possible_values)
# return Raises
------
IncompleteDataFolderError
raised if init_z_num doesn't match that specified in the individual parameter file
"""
params = load_toml(os.path.join(sub_folder, "params.toml"))
z_num = params["z_num"]
num_spectra = find_last_spectrum_file(sub_folder)
if z_num != init_z_num:
raise IncompleteDataFolderError(
f"initial config specifies {init_z_num} spectra per"
+ f" but the parameter file in {sub_folder} specifies {z_num}"
)
return num_spectra == z_num
def find_last_spectrum_file(path: str):
num = 0
while True:
if os.path.isfile(os.path.join(path, f"spectrum_{num}.npy")):
num += 1
pass
else:
return num - 1
def load_last_spectrum(path: str):
num = find_last_spectrum_file(path)
return num, np.load(os.path.join(path, f"spectrum_{num}.npy"))
def merge_same_simulations(path: str): def merge_same_simulations(path: str):
num_separator = "_num_" logger = get_logger(__name__)
sub_folders = _get_data_subfolders(path) num_separator = PARAM_SEPARATOR + "num" + PARAM_SEPARATOR
sub_folders = get_data_subfolders(path)
config = load_toml(os.path.join(path, "initial_config.toml")) config = load_toml(os.path.join(path, "initial_config.toml"))
repeat = config["simulation"].get("repeat", 1) repeat = config["simulation"].get("repeat", 1)
z_num = config["simulation"]["z_num"] z_num = config["simulation"]["z_num"]
@@ -461,7 +385,9 @@ def merge_same_simulations(path: str):
if len(base_folder) > 0: if len(base_folder) > 0:
base_folders.add(base_folder) base_folders.add(base_folder)
print(base_folders) num_operations = z_num * len(base_folders) + len(base_folders)
pt = utils.ProgressTracker(num_operations, logger=logger, prefix="merging data : ")
for base_folder in base_folders: for base_folder in base_folders:
for j in range(z_num): for j in range(z_num):
spectra = [] spectra = []
@@ -472,191 +398,19 @@ def merge_same_simulations(path: str):
dest_folder = ensure_folder(base_folder, prevent_overwrite=False) dest_folder = ensure_folder(base_folder, prevent_overwrite=False)
spectra = np.array(spectra).reshape(repeat, len(spectra[0])) spectra = np.array(spectra).reshape(repeat, len(spectra[0]))
np.save(os.path.join(dest_folder, f"spectra_{j}.npy"), spectra) np.save(os.path.join(dest_folder, f"spectra_{j}.npy"), spectra)
pt.update()
for file_name in ["z.npy", "params.toml"]:
shutil.copy(
os.path.join(f"{base_folder}{num_separator}0", file_name),
os.path.join(base_folder, ""),
)
pt.update()
try:
# class tmp_index_manager: for sub_folder in sub_folders:
# """Manages a temporary index of files while the simulation is running send2trash(sub_folder)
# and merge them at the end automatically""" except TrashPermissionError:
logger.warning(f"could not send send {len(base_folders)} folder(s) to trash")
# def __init__(self, config_name="untitled", task_id=0, varying_keys=None):
# self.path = os.path.join(Paths.tmp(task_id), "index.json")
# self.config_name = config_name
# self.varying_keys = varying_keys
# # set up the directories
# if not os.path.exists(Paths.tmp(task_id)):
# os.makedirs(Paths.tmp(task_id))
# file_num = 0
# while os.path.exists(self.path):
# self.path = os.path.join(Paths.tmp(task_id), f"index_{file_num}.json")
# file_num += 1
# self.index = dict(spectra={}, z={}, params={})
# self.ids = set()
# with open(self.path, "w") as file:
# json.dump(self.index, file)
# def get_path(self):
# return self.path
# def append_to_index(self, param_id, spectra_file_name="", params_file_name=""):
# """add one or two files to the index
# Parameters
# ----------
# param_id : id of the parameter set
# spectra_file_name : name of the spectra file
# params_file_name : name of the parameters file
# Returns
# ----------
# None
# """
# # names of the recorded values in order
# # here : {"spectra":spectra_file_name, "params":params_file_name}
# file_names = [spectra_file_name, params_file_name]
# file_names_dict = dict(zip(state.recorded_types, file_names))
# param_id = str(param_id)
# self.ids.add(param_id)
# with open(self.path, "r") as file:
# self.index = json.loads(file.read())
# for type_name, file_name in file_names_dict.items():
# if file_name != "":
# if param_id not in self.index[type_name]:
# self.index[type_name][param_id] = []
# self.index[type_name][param_id].append(file_name)
# with open(self.path, "w") as file:
# json.dump(self.index, file)
# def convert_sim_data(self):
# return convert_sim_data(self.path, name=self.config_name, varying_keys=self.varying_keys)
# def convert_sim_data(path, name="untitled", ids=None, varying_keys=[], delete_temps=True):
# """Converts simulation data that are stored as 1 file/simulation to 1 file
# per parameters set
# Parameters
# ----------
# path : path to the index containing infos about how to group files together
# name : name of the final folder
# ids : list of ids, 1 per set of parameters
# Returns
# ----------
# path to the converted data
# """
# with open(path, "r") as file:
# index = json.loads(file.read())
# folder_0 = os.path.join(Paths.get("data"), name)
# folder_0 = ensure_folder(folder_0) # related to the set of simulation / job
# # find the ids if not stored already
# if ids is None:
# ids = set()
# for key in state.recorded_types:
# for k in index[key]:
# ids.add(k)
# not_found = []
# for param_id in ids:
# print("ids", ids)
# # Load the spectra
# spectra = []
# for f in index["spectra"][param_id]:
# try:
# spectra.append(np.load(f))
# except FileNotFoundError:
# not_found.append(f)
# index["spectra"][param_id].remove(f)
# spectra = np.array(spectra)
# # Load the params
# main_param_name = index["params"][param_id][0] + ".json"
# try:
# with open(main_param_name, "r") as file:
# params = json.load(file)
# except FileNotFoundError:
# print(f"no parameters for id {param_id} found. Skipping this one")
# not_found += index["params"][param_id]
# continue
# if len(not_found) > 0:
# print(f"{len(not_found)} files not found:")
# for file_not_found in not_found:
# print("\t" + file_not_found)
# # create sub folder
# if len(ids) > 1:
# complement = [param_id]
# for key in varying_keys:
# if key in ["T0_FWHM", "P0"]:
# key = "init_" + key
# complement.append(key)
# complement.append(format(params.get(key, 0), ".2e").split("e")[0])
# folder_1 = "_".join(complement) # related to specific parameter
# folder_name = os.path.join(folder_0, folder_1)
# else:
# folder_name = folder_0
# if not os.path.exists(folder_name):
# os.makedirs(folder_name)
# os.rename(main_param_name, os.path.join(folder_name, "param.json"))
# # Save the data in a more easily manageable format (one file per z position)
# for k in range(len(spectra[0])):
# np.save(os.path.join(folder_name, f"spectra_{k}"), spectra[:, k])
# print(f"{len(spectra)} simulations converted. Data saved in {folder_name}")
# deleted = 0
# if delete_temps:
# # once everything is saved, delete the temporary files to free up space
# param_file_names = [f + ".json" for f in index["params"][param_id]]
# try:
# param_file_names.remove(main_param_name)
# except ValueError:
# pass
# fail_list = []
# for f in index["spectra"][param_id] + param_file_names:
# try:
# os.remove(f)
# deleted += 1
# except FileNotFoundError:
# fail_list.append(f)
# if len(fail_list) > 0:
# print(f"could not remove {len(fail_list)} temporary files :")
# for failed in fail_list:
# print("\t" + failed)
# print(f"Merge finished, deleted {deleted} temporary files.")
# if delete_temps:
# os.remove(path)
# delete_tmp_folder()
# return folder_0
# def delete_tmp_folder():
# """deletes temporary folders if they are empty"""
# for folder in glob(Paths.tmp()):
# try:
# os.rmdir(folder)
# except OSError as err:
# print(err)
def get_data_folder(task_id: int, name_if_new: str = ""): def get_data_folder(task_id: int, name_if_new: str = ""):
@@ -669,7 +423,21 @@ def get_data_folder(task_id: int, name_if_new: str = ""):
return tmp return tmp
def generate_file_path(file_name: str, task_id: int, sub_folder: str = "") -> str: def set_data_folder(task_id: int, path: str):
"""stores the path to an existing data folder in the environment
Parameters
----------
task_id : int
id uniquely identifying the session
path : str
path to the root of the data folder
"""
idstr = str(int(task_id))
os.environ[TMP_FOLDER_KEY_BASE + idstr] = path
def generate_file_path(file_name: str, task_id: int, identifier: str = "") -> str:
"""generates a path for the desired file name """generates a path for the desired file name
Parameters Parameters
@@ -678,7 +446,7 @@ def generate_file_path(file_name: str, task_id: int, sub_folder: str = "") -> st
desired file name. May be altered if it already exists desired file name. May be altered if it already exists
task_id : int task_id : int
unique id of the process unique id of the process
sub_folder : str identifier : str
subfolder in which to store the file. default : "" subfolder in which to store the file. default : ""
Returns Returns
@@ -688,7 +456,7 @@ def generate_file_path(file_name: str, task_id: int, sub_folder: str = "") -> st
""" """
base_name, ext = os.path.splitext(file_name) base_name, ext = os.path.splitext(file_name)
folder = get_data_folder(task_id) folder = get_data_folder(task_id)
folder = os.path.join(folder, sub_folder) folder = os.path.join(folder, identifier)
folder = ensure_folder(folder, prevent_overwrite=False) folder = ensure_folder(folder, prevent_overwrite=False)
i = 0 i = 0
base_name = os.path.join(folder, base_name) base_name = os.path.join(folder, base_name)
@@ -701,7 +469,7 @@ def generate_file_path(file_name: str, task_id: int, sub_folder: str = "") -> st
return new_name return new_name
def save_data(data: np.ndarray, file_name: str, task_id: int, subfolder: str = ""): def save_data(data: np.ndarray, file_name: str, task_id: int, identifier: str = ""):
"""saves numpy array to disk """saves numpy array to disk
Parameters Parameters
@@ -712,26 +480,13 @@ def save_data(data: np.ndarray, file_name: str, task_id: int, subfolder: str = "
file name file name
task_id : int task_id : int
id that uniquely identifies the process id that uniquely identifies the process
subfolder : str, optional identifier : str, optional
subfolder in the main data folder of the task, by default "" identifier in the main data folder of the task, by default ""
""" """
path = generate_file_path(file_name, task_id, subfolder) path = generate_file_path(file_name, task_id, identifier)
np.save(path, data) np.save(path, data)
def generate_tmp_file_name_old(file_name, job_id=0, param_id=0, task_id=0, ext=""):
"""returns a guaranteed available file name"""
main_suffix = f"_JOBID{job_id}_PARAMID{param_id}"
suffix = main_suffix + "_" + str(0)
no_dup = 1
while os.path.exists(os.path.join(Paths.tmp(task_id), file_name + suffix + ext)):
suffix = main_suffix + "_" + str(no_dup)
no_dup += 1
return os.path.join(Paths.tmp(task_id), file_name + suffix + ext)
def ensure_folder(name, i=0, suffix="", prevent_overwrite=True): def ensure_folder(name, i=0, suffix="", prevent_overwrite=True):
"""creates a folder for simulation data named name and prevents overwrite """creates a folder for simulation data named name and prevents overwrite
by adding a suffix if necessary and returning the name""" by adding a suffix if necessary and returning the name"""
@@ -756,119 +511,3 @@ def ensure_folder(name, i=0, suffix="", prevent_overwrite=True):
else: else:
return folder_name return folder_name
return folder_name return folder_name
# class Logger:
# def __init__(self, print_level=10000):
# """
# Parameters
# ----------
# print_level : messages above this priority will be printed as well as recorded
# """
# log_file_name = (
# "scgenerator_log_"
# + format(datetime.today())[:-7].replace(" ", "_").replace(":", "-")
# + ".txt"
# )
# self.log_file = os.path.join(Paths.get("logs"), log_file_name)
# self.print_level = print_level
# self.prefix_length = 0
# self.default_prefix = "Main Thread"
# if not os.path.exists(self.log_file):
# with open(self.log_file, "w"):
# pass
# with open(self.log_file, "a") as file:
# file.write(
# f"\n---------------------------\nNew Log {str(datetime.today()):19.19}\n---------------------------\n"
# )
# def log(self, s, priority=0, prefix=None):
# """logs a message
# Parameters
# ----------
# s : the string to log
# priority : will be compared to the logger's print_level to decide whether to print the string
# prefix : string identifying which thread or part of the program is giving the message
# Returns
# ----------
# nothing
# """
# if prefix is None:
# prefix = self.default_prefix
# if priority >= self.print_level:
# print(s)
# with open(self.log_file, "a") as file:
# if len(prefix) > self.prefix_length:
# self.prefix_length = len(prefix)
# prefix = format(prefix[: self.prefix_length], str(self.prefix_length))
# file.write(prefix + " : " + str(s) + "\n")
def plot_setup(
folder_name=None,
file_name=None,
file_type="png",
figsize=state.plot_default_figsize,
params=None,
mode="default",
):
"""It should return :
- a folder_name
- a file name
- a fig
- an axis
"""
file_name = state.plot_default_name if file_name is None else file_name
if params is not None:
folder_name = params.get("plot.folder_name", folder_name)
file_name = params.get("plot.file_name", file_name)
file_type = params.get("plot.file_type", file_type)
figsize = params.get("plot.figsize", figsize)
# ensure output folder_name exists
folder_name, file_name = (
os.path.split(file_name)
if folder_name is None
else (folder_name, os.path.split(file_name)[1])
)
folder_name = os.path.join(Paths.get("plots"), folder_name)
if not os.path.exists(os.path.abspath(folder_name)):
os.makedirs(os.path.abspath(folder_name))
# ensure no overwrite
ind = 0
while os.path.exists(os.path.join(folder_name, file_name + "_" + str(ind) + "." + file_type)):
ind += 1
file_name = file_name + "_" + str(ind) + "." + file_type
if mode == "default":
fig, ax = plt.subplots(figsize=figsize)
elif mode == "coherence":
n = state.plot_avg_default_main_to_coherence_ratio
gs1 = GridSpec(n + 1, 1, hspace=0.4)
fig = plt.figure(figsize=state.plot_default_figsize)
top = fig.add_subplot(gs1[:n])
top.tick_params(labelbottom=False)
bot = fig.add_subplot(gs1[n], sharex=top)
bot.set_ylim(-0.1, 1.1)
bot.set_ylabel(r"|$g_{12}$|")
ax = (top, bot)
elif mode == "coherence_T":
n = state.plot_avg_default_main_to_coherence_ratio
gs1 = GridSpec(1, n + 1, wspace=0.4)
fig = plt.figure(figsize=state.plot_default_figsize)
top = fig.add_subplot(gs1[:n])
top.tick_params(labelleft=False, left=False, right=True)
bot = fig.add_subplot(gs1[n], sharey=top)
bot.set_xlim(1.1, -0.1)
bot.set_xlabel(r"|$g_{12}$|")
ax = (top, bot)
else:
raise ValueError(f"mode {mode} not understood")
return folder_name, file_name, fig, ax

50
src/scgenerator/logger.py Normal file
View File

@@ -0,0 +1,50 @@
import logging
def get_logger(name=None):
"""returns a logging.Logger instance. This function is there because if scgenerator
is used with ray, workers are not aware of any configuration done with the logging
and so it must be reconfigured.
Parameters
----------
name : str, optional
name of the logger, by default None
Returns
-------
logging.Logger obj
logger
"""
name = __name__ if name is None else name
logger = logging.getLogger(name)
return configure_logger(logger)
def configure_logger(logger, logfile="scgenerator.log"):
"""configures a logging.Logger obj
Parameters
----------
logger : logging.Logger
logger to configure
logfile : str or None, optional
path to log file
Returns
-------
logging.Logger obj
updated logger
"""
if not hasattr(logger, "already_configured"):
if logfile is not None:
file_handler = logging.FileHandler("scgenerator.log", "a+")
file_handler.setFormatter(logging.Formatter("{name}: {message}", style="{"))
logger.addHandler(file_handler)
stream_handler = logging.StreamHandler()
logger.addHandler(stream_handler)
logger.setLevel(logging.INFO)
logger.already_configured = True
return logger

View File

@@ -4,8 +4,6 @@ from numpy.fft import fft, ifft
from numpy.polynomial.chebyshev import Chebyshev, cheb2poly from numpy.polynomial.chebyshev import Chebyshev, cheb2poly
from scipy.interpolate import interp1d from scipy.interpolate import interp1d
from scgenerator.state import _DEBUG
from .. import io from .. import io
from ..const import hc_model_specific_parameters from ..const import hc_model_specific_parameters
from ..math import abs2, argclosest, power_fact, u_nm from ..math import abs2, argclosest, power_fact, u_nm

View File

@@ -1,6 +1,7 @@
import numpy as np import numpy as np
from .. import state from ..logger import get_logger
from . import units from . import units
from .units import NA, c, kB from .units import NA, c, kB
@@ -38,6 +39,9 @@ def number_density_van_der_waals(
---------- ----------
ValueError : Since the Van der Waals equation is a cubic one, there could be more than one real, positive solution ValueError : Since the Van der Waals equation is a cubic one, there could be more than one real, positive solution
""" """
logger = get_logger
if pressure == 0: if pressure == 0:
return 0 return 0
if material_dico is not None: if material_dico is not None:
@@ -68,9 +72,9 @@ def number_density_van_der_waals(
roots = roots[roots > 0] roots = roots[roots > 0]
if len(roots) != 1: if len(roots) != 1:
s = f"Van der Waals eq with parameters P={pressure}, T={temperature}, a={a}, b={b}" s = f"Van der Waals eq with parameters P={pressure}, T={temperature}, a={a}, b={b}"
s += f"\nThere is more than one possible number density : {roots}." s += f", There is more than one possible number density : {roots}."
s += f"\n{np.min(roots)} was returned" s += f", {np.min(roots)} was returned"
state.CurrentLogger.log(s) logger.info(s)
return np.min(roots) return np.min(roots)

View File

@@ -18,8 +18,10 @@ from numpy import pi
from numpy.fft import fft, fftshift, ifft from numpy.fft import fft, fftshift, ifft
from scipy.interpolate import UnivariateSpline from scipy.interpolate import UnivariateSpline
from .. import state from ..defaults import default_plotting
from ..io import plot_setup
from ..logger import get_logger
from ..plotting import plot_setup
from ..math import * from ..math import *
c = 299792458.0 c = 299792458.0
@@ -527,6 +529,8 @@ def find_lobe_limits(x_axis, values, debug="", already_sorted=True):
spline_4 : scipy.interpolate.UnivariateSpline spline_4 : scipy.interpolate.UnivariateSpline
order 4 spline that interpolate values around the peak order 4 spline that interpolate values around the peak
""" """
logger = get_logger(__name__)
if not already_sorted: if not already_sorted:
x_axis, values = x_axis.copy(), values.copy() x_axis, values = x_axis.copy(), values.copy()
values = values[np.argsort(x_axis)] values = values[np.argsort(x_axis)]
@@ -545,9 +549,7 @@ def find_lobe_limits(x_axis, values, debug="", already_sorted=True):
# if there are more than 2 fwhm position, a detailed analysis can help # if there are more than 2 fwhm position, a detailed analysis can help
# determining the true ones. If that fails, there is no meaningful peak to measure # determining the true ones. If that fails, there is no meaningful peak to measure
detailed_measurement = len(fwhm_pos) > 2 or state._DEBUG.get( detailed_measurement = len(fwhm_pos) > 2
"find_lobe_limits.always_plot", False
)
if detailed_measurement: if detailed_measurement:
print("trouble measuring the peak.{}".format(debug_str)) print("trouble measuring the peak.{}".format(debug_str))
@@ -588,9 +590,8 @@ def find_lobe_limits(x_axis, values, debug="", already_sorted=True):
label="lobe pos", label="lobe pos",
c=color[5], c=color[5],
) )
if not "find_lobe_limits.ax" in state._DEBUG: ax.legend()
ax.legend() fig.savefig(os.path.join(folder_name, file_name), bbox_inches="tight")
fig.savefig(os.path.join(folder_name, file_name), bbox_inches="tight")
plt.close(fig) plt.close(fig)
else: else:
@@ -695,18 +696,14 @@ def _detailed_find_lobe_limits(
folder_name, file_name, fig, ax = plot_setup( folder_name, file_name, fig, ax = plot_setup(
file_name=f"it_{iterations}_{debug}", folder_name="measurements_errors_plots" file_name=f"it_{iterations}_{debug}", folder_name="measurements_errors_plots"
) )
ax = state._DEBUG.get("find_lobe_limits.ax", ax)
plt.sca(ax)
state._DEBUG["x"] = x_axis
new_fwhm_pos = np.array([np.max(left_pos), np.min(right_pos)]) new_fwhm_pos = np.array([np.max(left_pos), np.min(right_pos)])
# PLOT # PLOT
newx = np.linspace(*span(x_axis[l_ind : r_ind + 1]), 1000) newx = np.linspace(*span(x_axis[l_ind : r_ind + 1]), 1000)
color = state._DEBUG.get("color", state.plot_default_color_cycle) color = default_plotting["color_cycle"]
if state._DEBUG.get("find_lobe_limits.draw_raw_data", True): ax.plot(x_axis[l_ind - 5 : r_ind + 6], values[l_ind - 5 : r_ind + 6], c=color[0])
ax.plot(x_axis[l_ind - 5 : r_ind + 6], values[l_ind - 5 : r_ind + 6], c=color[0])
ax.plot(newx, spline_5(newx), c=color[1]) ax.plot(newx, spline_5(newx), c=color[1])
ax.scatter(fwhm_pos, spline_4(fwhm_pos), marker="+", label="all fwhm", c=color[2]) ax.scatter(fwhm_pos, spline_4(fwhm_pos), marker="+", label="all fwhm", c=color[2])
ax.scatter(peak_pos, spline_4(peak_pos), marker=".", label="peak pos", c=color[3]) ax.scatter(peak_pos, spline_4(peak_pos), marker=".", label="peak pos", c=color[3])

View File

@@ -1,19 +1,13 @@
import json
import os import os
from datetime import datetime from datetime import datetime
from typing import List from typing import List, Tuple
import numpy as np import numpy as np
from numpy.fft import fft, ifft from numpy.fft import fft, ifft
from .. import initialize, io, utils
from .. import initialize from ..logger import get_logger
from .. import io, state from . import pulse
from .. import utilities
from ..io import generate_file_path, get_logger
from ..math import abs2
from ..utilities import ProgressTracker, format_varying_list
from . import pulse, units
from .fiber import create_non_linear_op, fast_dispersion_op from .fiber import create_non_linear_op, fast_dispersion_op
using_ray = False using_ray = False
@@ -25,6 +19,267 @@ except ModuleNotFoundError:
pass pass
class RK4IP:
def __init__(self, sim_params, save_data=False, job_identifier="", task_id=0, n_percent=10):
self.job_identifier = job_identifier
self.id = task_id
self.n_percent = n_percent
self.logger = get_logger(self.job_identifier)
self.resuming = False
self.save_data = save_data
self._extract_params(sim_params)
self._setup_functions()
self.starting_num = sim_params.get("recovery_last_store", 1) - 1
self._setup_sim_parameters()
def _extract_params(self, params):
self.w_c = params.pop("w_c")
self.w0 = params.pop("w0")
self.w_power_fact = params.pop("w_power_fact")
self.spec_0 = params.pop("spec_0")
self.z_targets = params.pop("z_targets")
self.z_final = params.pop("length")
self.beta = params.pop("beta_func", params.pop("beta"))
self.gamma = params.pop("gamma_func", params.pop("gamma"))
self.behaviors = params.pop("behaviors")
self.raman_type = params.pop("raman_type", "stolen")
self.f_r = params.pop("f_r", 0)
self.hr_w = params.pop("hr_w", None)
self.adapt_step_size = params.pop("adapt_step_size", True)
self.error_ok = params.pop("error_ok")
self.dynamic_dispersion = params.pop("dynamic_dispersion", False)
def _setup_functions(self):
self.N_func = create_non_linear_op(
self.behaviors, self.w_c, self.w0, self.gamma, self.raman_type, self.f_r, self.hr_w
)
if self.dynamic_dispersion:
self.disp = lambda r: fast_dispersion_op(self.w_c, self.beta(r), self.w_power_fact)
else:
self.disp = lambda r: fast_dispersion_op(self.w_c, self.beta, self.w_power_fact)
# Set up which quantity is conserved for adaptive step size
if self.adapt_step_size:
if "raman" in self.behaviors:
self.conserved_quantity_func = pulse.photon_number
else:
self.logger.info("energy conserved")
self.conserved_quantity_func = pulse.pulse_energy
else:
self.conserved_quantity_func = lambda a, b, c, d: 0
def _setup_sim_parameters(self):
# making sure to keep only the z that we want
self.z_targets = list(self.z_targets.copy()[self.starting_num :])
self.z_targets.sort()
self.store_num = len(self.z_targets)
# Initial setup of simulation parameters
self.d_w = self.w_c[1] - self.w_c[0] # resolution of the frequency grid
self.z = self.z_targets.pop(0)
self.z_stored = [self.z] # position of each stored spectrum (for display)
self.progress_tracker = utils.ProgressTracker(
self.z_final, percent_incr=self.n_percent, logger=self.logger
)
# Setup initial values for every physical quantity that we want to track
self.current_spectrum = self.spec_0.copy()
self.stored_spectra = self.starting_num * [None] + [self.current_spectrum.copy()]
self.cons_qty = [
self.conserved_quantity_func(
self.current_spectrum,
self.w_c + self.w0,
self.d_w,
self.gamma,
),
0,
]
self.size_fac = 2 ** (1 / 5)
if self.save_data:
_save_current_spectrum(
self.current_spectrum, self.cons_qty, 0, self.id, self.job_identifier
)
# Initial step size
if self.adapt_step_size:
self.initial_h = (self.z_targets[0] - self.z) / 2
else:
self.initial_h = self.error_ok
# def _setup_sim_parameters(self):
# # making sure to keep only the z that we want
# self.z_targets = list(self.z_targets.copy())
# self.z_targets.sort()
# self.store_num = len(self.z_targets)
# # Initial setup of simulation parameters
# self.d_w = self.w_c[1] - self.w_c[0] # resolution of the frequency grid
# self.z = self.z_targets.pop(0)
# self.z_stored = [self.z] # position of each stored spectrum (for display)
# self.progress_tracker = utils.ProgressTracker(
# self.z_final, percent_incr=self.n_percent, logger=self.logger
# )
# # Setup initial values for every physical quantity that we want to track
# self.current_spectrum = self.spec_0.copy()
# self.stored_spectra = [self.current_spectrum.copy()]
# self.cons_qty = [
# self.conserved_quantity_func(
# self.current_spectrum,
# self.w_c + self.w0,
# self.d_w,
# self.gamma,
# ),
# 0,
# ]
# self.size_fac = 2 ** (1 / 5)
# if self.save_data:
# _save_current_spectrum(
# self.current_spectrum, self.cons_qty, 0, self.id, self.job_identifier
# )
# # Initial step size
# if self.adapt_step_size:
# self.initial_h = (self.z_targets[0] - self.z) / 2
# else:
# self.initial_h = self.error_ok
def run(self):
# Print introduction
self.logger.info(
"Computing {} new spectra, first one at {}m".format(self.store_num, self.z_targets[0])
)
self.progress_tracker.set(self.z)
# Start of the integration
step = 1
h_taken = self.initial_h
h_next_step = self.initial_h
store = False # store a spectrum
time_start = datetime.today()
while self.z < self.z_final:
h_taken, h_next_step, self.current_spectrum = self.take_step(
step, h_next_step, self.current_spectrum.copy()
)
self.z += h_taken
step += 1
self.cons_qty.append(0)
# Whether the current spectrum has to be stored depends on previous step
if store:
self.progress_tracker.suffix = " ({} steps). z = {:.4f}, h = {:.5g}".format(
step, self.z, h_taken
)
self.progress_tracker.set(self.z)
self.stored_spectra.append(self.current_spectrum)
if self.save_data:
_save_current_spectrum(
self.current_spectrum,
self.cons_qty,
len(self.stored_spectra) - 1,
self.id,
self.job_identifier,
)
self.z_stored.append(self.z)
del self.z_targets[0]
# reset the constant step size after a spectrum is stored
if not self.adapt_step_size:
h_next_step = self.error_ok
if len(self.z_targets) == 0:
break
store = False
# if the next step goes over a position at which we want to store
# a spectrum, we shorten the step to reach this position exactly
if self.z + h_next_step >= self.z_targets[0]:
store = True
h_next_step = self.z_targets[0] - self.z
self.logger.info(
"propagation finished in {} steps ({} seconds)".format(
step, (datetime.today() - time_start).total_seconds()
)
)
if self.save_data:
io.save_data(self.z_stored, "z.npy", self.id, self.job_identifier)
return self.stored_spectra
def take_step(
self, step: int, h_next_step: float, current_spectrum: np.ndarray
) -> Tuple[float, float, np.ndarray]:
"""computes a new spectrum, whilst adjusting step size if required, until the error estimation
validates the new spectrum
Parameters
----------
step : int
index of the current
h_next_step : float
candidate step size
current_spectrum : np.ndarray
spectrum of the last step taken
Returns
-------
h : float
step sized used
h_next_step : float
candidate next step size
new_spectrum : np.ndarray
new spectrum
"""
keep = False
while not keep:
h = h_next_step
z_ratio = self.z / self.z_final
expD = np.exp(h / 2 * self.disp(z_ratio))
A_I = expD * current_spectrum
k1 = expD * (h * self.N_func(current_spectrum, z_ratio))
k2 = h * self.N_func(A_I + k1 / 2, z_ratio)
k3 = h * self.N_func(A_I + k2 / 2, z_ratio)
k4 = h * self.N_func(expD * (A_I + k3), z_ratio)
new_spectrum = expD * (A_I + k1 / 6 + k2 / 3 + k3 / 3) + k4 / 6
if self.adapt_step_size:
self.cons_qty[step] = self.conserved_quantity_func(
new_spectrum, self.w_c + self.w0, self.d_w, self.gamma
)
curr_p_change = np.abs(self.cons_qty[step - 1] - self.cons_qty[step])
cons_qty_change_ok = self.error_ok * self.cons_qty[step - 1]
if curr_p_change > 2 * cons_qty_change_ok:
progress_str = f"step {step} rejected with h = {h:.4e}, doing over"
self.logger.info(progress_str)
keep = False
h_next_step = h / 2
elif cons_qty_change_ok < curr_p_change <= 2 * cons_qty_change_ok:
keep = True
h_next_step = h / self.size_fac
elif curr_p_change < 0.1 * cons_qty_change_ok:
keep = True
h_next_step = h * self.size_fac
else:
keep = True
h_next_step = h
return h, h_next_step, new_spectrum
class Simulations: class Simulations:
"""The recommended way to run simulations. """The recommended way to run simulations.
New Simulations child classes can be written and must implement the following New Simulations child classes can be written and must implement the following
@@ -65,18 +320,10 @@ class Simulations:
self.using_ray = False self.using_ray = False
self.sim_jobs = 1 self.sim_jobs = 1
self.propagation_func = lambda params, varying_list: RK4IP( self.propagator = RK4IP
params,
save_data=True,
job_identifier=utilities.format_varying_list(varying_list),
task_id=self.id,
)
self.progress_tracker = utilities.ProgressTracker( self.progress_tracker = utils.ProgressTracker(
max=len(self.param_seq), len(self.param_seq), percent_incr=1, logger=self.logger
auto_print=True,
percent_incr=1,
callback=lambda s, logger: logger.info(s),
) )
def run(self): def run(self):
@@ -86,7 +333,7 @@ class Simulations:
io.save_parameters( io.save_parameters(
params, params,
io.generate_file_path( io.generate_file_path(
"params.toml", self.id, utilities.format_varying_list(varying) "params.toml", self.id, utils.format_varying_list(varying)
), ),
) )
self.new_sim(varying, params.copy()) self.new_sim(varying, params.copy())
@@ -118,14 +365,20 @@ class Simulations:
raise NotImplementedError() raise NotImplementedError()
def merge_data(self): def merge_data(self):
io.merge_data(self.data_folder) io.merge_same_simulations(self.data_folder)
class SequencialSimulations(Simulations, available=True, priority=0): class SequencialSimulations(Simulations, available=True, priority=0):
def new_sim(self, varying_list: List[tuple], params: dict): def new_sim(self, varying_list: List[tuple], params: dict):
self.logger.info(f"launching simulation with {varying_list}") v_list_str = utils.format_varying_list(varying_list)
self.propagation_func(params, varying_list) self.logger.info(f"launching simulation with {v_list_str}")
self.progress_tracker.update(1, [self.logger]) self.propagator(
params,
save_data=True,
job_identifier=v_list_str,
task_id=self.id,
).run()
self.progress_tracker.update()
def finish(self): def finish(self):
pass pass
@@ -150,27 +403,38 @@ class RaySimulations(Simulations, available=using_ray, priority=1):
) )
self.sim_jobs = min(self.param_seq.num_sim, self.param_seq["simulation", "parallel"]) self.sim_jobs = min(self.param_seq.num_sim, self.param_seq["simulation", "parallel"])
self.propagation_func = ray.remote(self.propagation_func).options( self.propagator = ray.remote(self.propagator).options(
override_environment_variables=io.get_all_environ() override_environment_variables=io.get_all_environ()
) )
self.jobs = [] self.jobs = []
self.actors = {}
def new_sim(self, varying_list: List[tuple], params: dict): def new_sim(self, varying_list: List[tuple], params: dict):
if len(self.jobs) >= self.sim_jobs: while len(self.jobs) >= self.sim_jobs:
self._collect_1_job()
# wait for a slot to free before starting a new job v_list_str = utils.format_varying_list(varying_list)
_, self.jobs = ray.wait(self.jobs)
ray.get(_)
self.progress_tracker.update(1, [self.logger])
self.jobs.append(self.propagation_func.remote(params, varying_list)) new_actor = self.propagator.remote(
params, save_data=True, job_identifier=v_list_str, task_id=self.id
)
new_job = new_actor.run.remote()
self.logger.info(f"launching simulation with {varying_list}, job : {self.jobs[-1].hex()}") self.actors[new_job.task_id()] = new_actor
self.jobs.append(new_job)
self.logger.info(f"launching simulation with {v_list_str}, job : {self.jobs[-1].hex()}")
def finish(self): def finish(self):
for job in self.jobs: while len(self.jobs) > 0:
ray.get(job) self._collect_1_job()
self.progress_tracker.update(1, [self.logger])
def _collect_1_job(self):
ready, self.jobs = ray.wait(self.jobs)
ray.get(ready)
del self.actors[ready[0].task_id()]
self.progress_tracker.update()
def stop(self): def stop(self):
ray.shutdown() ray.shutdown()
@@ -181,13 +445,26 @@ def new_simulations(config_file: str, task_id: int, data_folder="scgenerator/"):
config = io.load_toml(config_file) config = io.load_toml(config_file)
param_seq = initialize.ParamSequence(config) param_seq = initialize.ParamSequence(config)
return _new_simulations(param_seq, task_id, data_folder)
def resume_simulations(data_folder: str, task_id: int = 0):
config = io.load_toml(os.path.join(data_folder, "initial_config.toml"))
io.set_data_folder(task_id, data_folder)
param_seq = initialize.RecoveryParamSequence(config, task_id)
return _new_simulations(param_seq, task_id, data_folder)
def _new_simulations(param_seq: initialize.ParamSequence, task_id, data_folder):
if param_seq.num_sim > 1 and param_seq["simulation", "parallel"] > 1 and using_ray: if param_seq.num_sim > 1 and param_seq["simulation", "parallel"] > 1 and using_ray:
return Simulations.get_best_method()(param_seq, task_id, data_folder=data_folder) return Simulations.get_best_method()(param_seq, task_id, data_folder=data_folder)
else: else:
return SequencialSimulations(param_seq, task_id, data_folder=data_folder) return SequencialSimulations(param_seq, task_id, data_folder=data_folder)
def RK4IP(sim_params, save_data=False, job_identifier="", task_id=0, n_percent=10): def RK4IP_func(sim_params, save_data=False, job_identifier="", task_id=0, n_percent=10):
"""Computes the spectrum of a pulse as it propagates through a PCF """Computes the spectrum of a pulse as it propagates through a PCF
Parameters Parameters
@@ -201,8 +478,8 @@ def RK4IP(sim_params, save_data=False, job_identifier="", task_id=0, n_percent=1
time time
dt : float dt : float
time resolution time resolution
field_0 : array spec_0 : array
initial field envelope as function of w_c initial spectral envelope as function of w_c
z_targets : list z_targets : list
target distances target distances
beta : array beta : array
@@ -239,14 +516,12 @@ def RK4IP(sim_params, save_data=False, job_identifier="", task_id=0, n_percent=1
if True and save_data False, will return photon number and step sizes as well as the spectra. if True and save_data False, will return photon number and step sizes as well as the spectra.
Returns Returns
---------- ----------
stored_spectra : (store_num, nt) array stored_spectra : (z_num, nt) array
spectrum aligned on w_c array spectrum aligned on w_c array
h_stored : 1D array h_stored : 1D array
length of each valid step length of each valid step
cons_qty : 1D array cons_qty : 1D array
conserved quantity at each valid step conserved quantity at each valid step
cons_qty_change : 1D array
conserved quantity change at each valid step
""" """
# DEBUG # DEBUG
@@ -255,7 +530,7 @@ def RK4IP(sim_params, save_data=False, job_identifier="", task_id=0, n_percent=1
w_c = sim_params.pop("w_c") w_c = sim_params.pop("w_c")
w0 = sim_params.pop("w0") w0 = sim_params.pop("w0")
w_power_fact = sim_params.pop("w_power_fact") w_power_fact = sim_params.pop("w_power_fact")
field_0 = sim_params.pop("field_0") spec_0 = sim_params.pop("spec_0")
z_targets = sim_params.pop("z_targets") z_targets = sim_params.pop("z_targets")
z_final = sim_params.pop("length") z_final = sim_params.pop("length")
beta = sim_params.pop("beta_func", sim_params.pop("beta")) beta = sim_params.pop("beta_func", sim_params.pop("beta"))
@@ -265,7 +540,7 @@ def RK4IP(sim_params, save_data=False, job_identifier="", task_id=0, n_percent=1
f_r = sim_params.pop("f_r", 0) f_r = sim_params.pop("f_r", 0)
hr_w = sim_params.pop("hr_w", None) hr_w = sim_params.pop("hr_w", None)
adapt_step_size = sim_params.pop("adapt_step_size", True) adapt_step_size = sim_params.pop("adapt_step_size", True)
error_ok = sim_params.pop("error_ok", 1e-10) error_ok = sim_params.pop("error_ok")
dynamic_dispersion = sim_params.pop("dynamic_dispersion", False) dynamic_dispersion = sim_params.pop("dynamic_dispersion", False)
del sim_params del sim_params
@@ -289,41 +564,37 @@ def RK4IP(sim_params, save_data=False, job_identifier="", task_id=0, n_percent=1
conserved_quantity_func = lambda a, b, c, d: 0 conserved_quantity_func = lambda a, b, c, d: 0
# making sure to keep only the z that we want # making sure to keep only the z that we want
z_targets = list(set(value for value in z_targets if value > 0)) z_targets = list(z_targets.copy())
z_targets.sort() z_targets.sort()
store_num = len(z_targets) store_num = len(z_targets)
# Initial setup of simulation parameters # Initial setup of simulation parameters
d_w = w_c[1] - w_c[0] # resolution of the frequency grid d_w = w_c[1] - w_c[0] # resolution of the frequency grid
z_stored, z = [0], 0 # position of each stored spectrum (for display) z = z_targets.pop(0)
z_stored = [z] # position of each stored spectrum (for display)
pt = utilities.ProgressTracker( pt = utils.ProgressTracker(z_final, percent_incr=n_percent, logger=logger)
z_final,
auto_print=True,
percent_incr=n_percent,
callback=_gen_RK4IP_progress_callback(),
)
# Setup initial values for every physical quantity that we want to track # Setup initial values for every physical quantity that we want to track
current_spectrum = fft(field_0) current_spectrum = spec_0.copy()
stored_spectra = [current_spectrum.copy()] stored_spectra = [current_spectrum.copy()]
stored_field = [ifft(current_spectrum.copy())] stored_field = [ifft(current_spectrum.copy())]
cons_qty = [conserved_quantity_func(current_spectrum, w_c + w0, d_w, gamma), 0] cons_qty = [conserved_quantity_func(current_spectrum, w_c + w0, d_w, gamma), 0]
cons_qty_change = [0, 0]
size_fac = 2 ** (1 / 5) size_fac = 2 ** (1 / 5)
if save_data: if save_data:
_save_current_spectrum(current_spectrum, 0, task_id, job_identifier) _save_current_spectrum(current_spectrum, cons_qty, 0, task_id, job_identifier)
# Initial step size # Initial step size
if adapt_step_size: if adapt_step_size:
h = z_targets[0] / 2 h = (z_targets[0] - z) / 2
else: else:
h = error_ok h = error_ok
newh = h newh = h
# Print introduction # Print introduction
logger.info("Storing {} new spectra, first one at {}m".format(store_num, z_targets[0])) logger.info("Computing {} new spectra, first one at {}m".format(store_num, z_targets[0]))
pt.set(z)
# Start of the integration # Start of the integration
step = 1 step = 1
@@ -351,7 +622,6 @@ def RK4IP(sim_params, save_data=False, job_identifier="", task_id=0, n_percent=1
if adapt_step_size: if adapt_step_size:
cons_qty[step] = conserved_quantity_func(end_spectrum, w_c + w0, d_w, gamma) cons_qty[step] = conserved_quantity_func(end_spectrum, w_c + w0, d_w, gamma)
curr_p_change = np.abs(cons_qty[step - 1] - cons_qty[step]) curr_p_change = np.abs(cons_qty[step - 1] - cons_qty[step])
cons_qty_change[step] = cons_qty_change[step - 1] + curr_p_change
cons_qty_change_ok = error_ok * cons_qty[step - 1] cons_qty_change_ok = error_ok * cons_qty[step - 1]
if curr_p_change > 2 * cons_qty_change_ok: if curr_p_change > 2 * cons_qty_change_ok:
@@ -374,19 +644,19 @@ def RK4IP(sim_params, save_data=False, job_identifier="", task_id=0, n_percent=1
z += h z += h
step += 1 step += 1
cons_qty.append(0) cons_qty.append(0)
cons_qty_change.append(0)
current_spectrum = end_spectrum.copy() current_spectrum = end_spectrum.copy()
# Whether the current spectrum has to be stored depends on previous step # Whether the current spectrum has to be stored depends on previous step
if store: if store:
pt.set(z, [logger, step, z, h]) pt.suffix = " ({} steps). z = {:.4f}, h = {:.5g}".format(step, z, h)
pt.set(z)
stored_spectra.append(end_spectrum) stored_spectra.append(end_spectrum)
stored_field.append(ifft(end_spectrum)) stored_field.append(ifft(end_spectrum))
if save_data: if save_data:
_save_current_spectrum( _save_current_spectrum(
end_spectrum, len(stored_spectra) - 1, task_id, job_identifier end_spectrum, cons_qty, len(stored_spectra) - 1, task_id, job_identifier
) )
z_stored.append(z) z_stored.append(z)
@@ -422,301 +692,23 @@ def RK4IP(sim_params, save_data=False, job_identifier="", task_id=0, n_percent=1
return stored_spectra return stored_spectra
def _save_current_spectrum(spectrum: np.ndarray, num: int, task_id: int, job_identifier: str): def _save_current_spectrum(
base_name = f"spectrum_{num}.npy" spectrum: np.ndarray, cons_qty: np.ndarray, num: int, task_id: int, job_identifier: str
io.save_data(spectrum, base_name, task_id, job_identifier) ):
"""saves the spectrum and the corresponding cons_qty array
def _gen_RK4IP_progress_callback():
def callback(s, logger, step, z, h):
progress_str = " ({} steps). z = {:.4f}, h = {:.5g}".format(step, z, h)
logger.info(s + progress_str)
return callback
def _RK4IP_extract_params(sim_params):
"""extracts the right parameters from the the flattened params dict
Parameters Parameters
---------- ----------
sim_params : dict spectrum : np.ndarray
flattened parameters dictionary spectrum as function of w
cons_qty : np.ndarray
Returns cons_qty array
------- num : int
tuple index of the z postition
all the necessary parameters task_id : int
unique number identifyin the session
job_identifier : str
to differentiate this particular run from the others in the session
""" """
w_c = sim_params.pop("w_c") io.save_data(spectrum, f"spectrum_{num}", task_id, job_identifier)
w0 = sim_params.pop("w0") io.save_data(cons_qty, f"cons_qty", task_id, job_identifier)
w_power_fact = sim_params.pop("w_power_fact")
field_0 = sim_params.pop("field_0")
z_targets = sim_params.pop("z_targets")
beta = sim_params.pop("beta_func", sim_params.pop("beta"))
gamma = sim_params.pop("gamma_func", sim_params.pop("gamma"))
behaviors = sim_params.pop("behaviors")
raman_type = sim_params.pop("raman_type", "stolen")
f_r = sim_params.pop("f_r", 0)
hr_w = sim_params.pop("hr_w", None)
adapt_step_size = sim_params.pop("adapt_step_size", True)
error_ok = sim_params.pop("error_ok", 1e-10)
dynamic_dispersion = sim_params.pop("dynamic_dispersion", False)
del sim_params
return (
behaviors,
w_c,
w0,
gamma,
raman_type,
f_r,
hr_w,
dynamic_dispersion,
beta,
w_power_fact,
adapt_step_size,
z_targets,
field_0,
error_ok,
)
def _prepare_grid(z_targets, w_c):
"""prepares some derived values for the propagation
Parameters
----------
z_targets : array
array of target z positions
w_c : array
angular frequency array (centered on 0)
Returns
-------
d_w : float
angular frequency grid size
z_targets : list
list of target z positions
store_num : int
number of spectra to store
z_final : float
final z position
z_sored : list
where the spectra are already stored
"""
# making sure to keep only the z that we want
z_targets = list(set(value for value in z_targets if value > 0))
z_targets.sort()
z_final = z_targets[-1]
store_num = len(z_targets)
# Initial setup of simulation parameters
d_w = w_c[1] - w_c[0] # resolution of the frequency grid
z_stored = [0] # position of each stored spectrum (for display)
return d_w, z_targets, store_num, z_final, z_stored
def parallel_simulations(config_file, num_cpu_per_task=1, task_id=0):
"""runs simulations in parallel thanks to Ray
Parameters
----------
config_file : str
name of the config file
should be a json containing all necessary parameters for the simulation. Varying parameters should be placed in a subdictionary
called "varying" (see scgenerator.utilities.dictionary_iterator for details)
num_cpu_per_task : int
number of concurrent job per node
task_id : give an id for book keeping purposes (must be set if multiple ray instances run at once so their files do not overlap)
Returns
----------
name of the folder where the data is stored
"""
logger = ray.remote(io.Logger).remote()
state.CurrentLogger.focus_logger(logger)
print("Nodes in the Ray cluster:", len(ray.nodes()))
for node in ray.nodes():
print(" " + node.get("NodeManagerHostname", "unknown"))
config_name, config_dict, store_num, n, m = _sim_preps(config_file)
# Override number of simultaneous jobs if provided by config file
sim_jobs = config_dict.pop("sim_jobs", len(ray.nodes()) * num_cpu_per_task)
print(f"number of simultaneous jobs : {sim_jobs}")
if n * m < sim_jobs:
sim_jobs = n * m
# Initiate helper workers (a logger, a progress tracker to give estimates of
# completion time and an indexer to keep track of the individual files
# created after each simulation. The indexer can then automatically merge them)
pt = ray.remote(ProgressTracker).remote(max=n * m * store_num, auto_print=True, percent_incr=1)
indexer = ray.remote(io.tmp_index_manager).remote(
config_name=config_name, task_id=task_id, varying_keys=config_dict.get("varying", None)
)
ray.get(
logger.log.remote(f"CRITICAL FILE at {ray.get(indexer.get_path.remote())}, do not touch it")
)
RK4IP_parallel = ray.remote(RK4IP)
jobs = []
# we treat loops over different parameters differently
for k, dico in enumerate(utilities.dictionary_iterator(config_dict, varying_dict="varying")):
# loop over same parameter set
for i in range(n):
# because of random processes, initial conditions are recalculated every time
params = initialize.compute_init_parameters(dictionary=config_dict, replace=dico)
# make sure initial conditions are saved
params["init_P0"] = dico.get("P0", config_dict.get("P0", 0))
params["init_T0_FWHM"] = dico.get("T0_FWHM", config_dict.get("T0_FWHM", 0))
params["param_id"] = k
params_file_name = io.generate_file_path("param", i, k, task_id, "")
io.save_parameters(params, params_file_name)
ray.get(indexer.append_to_index.remote(k, params_file_name=params_file_name))
if len(jobs) >= sim_jobs:
# update the number of jobs if new nodes connect
sim_jobs = min(n * (m - k) - i, len(ray.nodes()) * num_cpu_per_task)
# print(f"Nodes in the Ray cluster: {len(ray.nodes())}, {sim_jobs} simultaneous jobs")
# for node in ray.nodes():
# print(" " + node.get("NodeManagerHostname", "unknown"))
# wait for a slot to free before starting a new job
_, jobs = ray.wait(jobs)
ray.get(_)
# start a new simulation
ray.get(
logger.log.remote(
f"Launching propagation of a {params.get('t0', 0) * 1e15:.2f}fs pulse with {np.max(abs2(params['field_0'])):.0f}W peak power over {np.max(params['z_targets'])}m"
)
)
jobs.append(
RK4IP_parallel.remote(
params,
save_data=True,
job_id=i,
param_id=k,
task_id=task_id,
pt=pt,
indexer=indexer,
logger=logger,
n_percent=1,
)
)
ray.get(logger.log.remote("number of running jobs : {}".format(len(jobs))))
ray.get(logger.log.remote(ray.get(pt.get_eta.remote())))
# wait for the last jobs to finish
ray.get(jobs)
# merge the data properly
folder_0 = ray.get(indexer.convert_sim_data.remote())
print(f"{config_name} successfully finished ! data saved in {folder_0}")
return folder_0
def simulate(config_file, task_id=0, n_percent=1):
"""runs simulations one after another
Parameters
----------
config_file : str
name of the config file
should be a json containing all necessary parameters for the simulation. Varying parameters should be placed in a subdictionary
called "varying" (see scgenerator.utilities.dictionary_iterator for details)
task_id : any formatable (int, string, float, ...)
give an id for book keeping purposes (must be set if multiple ray instances run at once so their files do not overlap)
n_percent : int or float
each individual simulation reports its progress every n_percent percent.
Returns
----------
name of the folder where the data is stored
"""
logger = io.Logger()
state.CurrentLogger.focus_logger(logger)
config_name, config_dict, store_num, n, m = _sim_preps(config_file)
# Initiate helper workers (a logger, a progress tracker to give estimates of
# completion time and an indexer to keep track of the individual files
# created after each simulation. The indexer can then automatically merge them)
pt = ProgressTracker(max=n * m * store_num, auto_print=True, percent_incr=1)
indexer = io.tmp_index_manager(
config_name=config_name, task_id=task_id, varying_keys=config_dict.get("varying", None)
)
logger.log(f"CRITICAL FILE at {indexer.get_path()}, do not touch it")
# we treat loops over different parameters differently
for k, dico in enumerate(utilities.dictionary_iterator(config_dict, varying_dict="varying")):
# loop over same parameter set
for i in range(n):
# because of random processes, initial conditions are recalculated every time
params = initialize.compute_init_parameters(dictionary=config_dict, replace=dico)
# make sure initial conditions are saved
params["init_P0"] = dico.get("P0", config_dict.get("P0", 0))
params["init_T0_FWHM"] = dico.get("T0_FWHM", config_dict.get("T0_FWHM", 0))
params["param_id"] = k
params_file_name = io.generate_file_path("param", i, k, task_id, "")
io.save_parameters(params, params_file_name)
indexer.append_to_index(k, params_file_name=params_file_name)
# start a new simulation
logger.log(
f"Launching propagation of a {params.get('t0', 0) * 1e15:.2f}fs pulse with {np.max(abs2(params['field_0'])):.0f}W peak power over {np.max(params['z_targets'])}m"
)
RK4IP(
params,
save_data=True,
job_id=i,
param_id=k,
task_id=task_id,
pt=pt,
indexer=indexer,
logger=logger,
n_percent=n_percent,
)
logger.log(pt.get_eta())
# merge the data properly
folder_0 = indexer.convert_sim_data()
print(f"{config_name} successfully finished ! data saved in {folder_0}")
return folder_0
def _sim_preps(config_file):
# Load the config file
try:
with open(config_file, "r") as file:
config_dict = json.loads(file.read())
except FileNotFoundError:
print("No config file named {} found".format(config_file))
raise
# Store a master dictionary of parameters to generate file names and such
config_name = config_dict.pop("name", os.path.split(config_file)[-1][:-5])
# make sure we store spectra every time at the exact same place
if "z_targets" not in config_dict:
config_dict["z_targets"] = np.linspace(0, 1, 128)
config_dict["z_targets"] = initialize.sanitize_z_targets(config_dict["z_targets"])
config_dict = units.standardize_dictionary(config_dict)
store_num = len(config_dict["z_targets"])
# How many total simulations
n = int(config_dict.pop("n", 1))
m = np.prod([len(np.atleast_1d(ls)) for _, ls in config_dict.get("varying", {1: 1}).items()])
return config_name, config_dict, store_num, n, m

View File

@@ -6,9 +6,78 @@ import numpy as np
from matplotlib.colors import ListedColormap from matplotlib.colors import ListedColormap
from scipy.interpolate import UnivariateSpline from scipy.interpolate import UnivariateSpline
from . import io, math, state from . import io, math
from .math import abs2, make_uniform_1D, span from .math import abs2, make_uniform_1D, span
from .physics import pulse, units from .physics import pulse, units
from .defaults import default_plotting as defaults
def plot_setup(
folder_name=None,
file_name=None,
file_type="png",
figsize=defaults["figsize"],
params=None,
mode="default",
):
"""It should return :
- a folder_name
- a file name
- a fig
- an axis
"""
file_name = defaults["name"] if file_name is None else file_name
if params is not None:
folder_name = params.get("plot.folder_name", folder_name)
file_name = params.get("plot.file_name", file_name)
file_type = params.get("plot.file_type", file_type)
figsize = params.get("plot.figsize", figsize)
# ensure output folder_name exists
folder_name, file_name = (
os.path.split(file_name)
if folder_name is None
else (folder_name, os.path.split(file_name)[1])
)
folder_name = os.path.join(io.Paths.get("plots"), folder_name)
if not os.path.exists(os.path.abspath(folder_name)):
os.makedirs(os.path.abspath(folder_name))
# ensure no overwrite
ind = 0
while os.path.exists(os.path.join(folder_name, file_name + "_" + str(ind) + "." + file_type)):
ind += 1
file_name = file_name + "_" + str(ind) + "." + file_type
if mode == "default":
fig, ax = plt.subplots(figsize=figsize)
elif mode == "coherence":
n = defaults["avg_main_to_coherence_ratio"]
gs1 = plt.GridSpec(n + 1, 1, hspace=0.4)
fig = plt.figure(figsize=defaults["figsize"])
top = fig.add_subplot(gs1[:n])
top.tick_params(labelbottom=False)
bot = fig.add_subplot(gs1[n], sharex=top)
bot.set_ylim(-0.1, 1.1)
bot.set_ylabel(r"|$g_{12}$|")
ax = (top, bot)
elif mode == "coherence_T":
n = defaults["avg_main_to_coherence_ratio"]
gs1 = plt.GridSpec(1, n + 1, wspace=0.4)
fig = plt.figure(figsize=defaults["default_figsize"])
top = fig.add_subplot(gs1[:n])
top.tick_params(labelleft=False, left=False, right=True)
bot = fig.add_subplot(gs1[n], sharey=top)
bot.set_xlim(1.1, -0.1)
bot.set_xlabel(r"|$g_{12}$|")
ax = (top, bot)
else:
raise ValueError(f"mode {mode} not understood")
return folder_name, file_name, fig, ax
def draw_across(ax1, xy1, ax2, xy2, clip_on=False, **kwargs): def draw_across(ax1, xy1, ax2, xy2, clip_on=False, **kwargs):
@@ -44,7 +113,13 @@ def zoom(ax, zoom_ax, clip_on=False, **kwargs):
def create_zoom_axis( def create_zoom_axis(
axis, xlim, ylim=None, width_ratios=[1, 1, 1], height_ratios=[1, 1, 1], frame_style=dict(c="k", lw=0.5), plot=True axis,
xlim,
ylim=None,
width_ratios=[1, 1, 1],
height_ratios=[1, 1, 1],
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 Parameters
@@ -68,7 +143,13 @@ def create_zoom_axis(
# set up the axis # set up the axis
grid = gs.GridSpecFromSubplotSpec( grid = gs.GridSpecFromSubplotSpec(
3, 3, subplot_spec=axis, width_ratios=width_ratios, height_ratios=height_ratios, hspace=0, wspace=0 3,
3,
subplot_spec=axis,
width_ratios=width_ratios,
height_ratios=height_ratios,
hspace=0,
wspace=0,
) )
inset = axis.get_figure().add_subplot(grid[1, 1]) inset = axis.get_figure().add_subplot(grid[1, 1])
width_ratios = np.cumsum(np.array(width_ratios) / np.sum(width_ratios)) width_ratios = np.cumsum(np.array(width_ratios) / np.sum(width_ratios))
@@ -82,7 +163,9 @@ def create_zoom_axis(
xdata = line.get_xdata() xdata = line.get_xdata()
xdata, ind, _ = units.sort_axis(xdata, (*xlim, units.s)) xdata, ind, _ = units.sort_axis(xdata, (*xlim, units.s))
ydata = line.get_ydata()[ind] ydata = line.get_ydata()[ind]
inset.plot(xdata, ydata, c=line.get_color(), ls=line.get_linestyle(), lw=line.get_linewidth()) inset.plot(
xdata, ydata, c=line.get_color(), ls=line.get_linestyle(), lw=line.get_linewidth()
)
inset.set_xlim(xlim) inset.set_xlim(xlim)
if ylim is not None: if ylim is not None:
inset.set_ylim(ylim) inset.set_ylim(ylim)
@@ -177,8 +260,8 @@ def _finish_plot_2D(
# apply log transform if required # apply log transform if required
if log != False: if log != False:
vmax = state.plot_default_vmax if vmax is None else vmax vmax = defaults["vmax"] if vmax is None else vmax
vmin = state.plot_default_vmin if vmin is None else vmin vmin = defaults["vmin"] if vmin is None else vmin
if isinstance(log, (float, int)) and log != True: if isinstance(log, (float, int)) and log != True:
values = units.to_log(values, ref=log) values = units.to_log(values, ref=log)
@@ -204,7 +287,7 @@ def _finish_plot_2D(
_finish_plot_2D.ref = ref _finish_plot_2D.ref = ref
values = units.to_log(values, ref=ref) values = units.to_log(values, ref=ref)
cmap = state.plot_default_cmap if cmap is None else cmap cmap = defaults["cmap"] if cmap is None else cmap
is_new_plot = ax is None is_new_plot = ax is None
cbar_ax = None cbar_ax = None
@@ -213,7 +296,9 @@ def _finish_plot_2D(
folder_name = "" folder_name = ""
if is_new_plot: if is_new_plot:
folder_name, file_name, fig, ax = io.plot_setup(file_name=file_name, file_type=file_type, params=params) folder_name, file_name, fig, ax = io.plot_setup(
file_name=file_name, file_type=file_type, params=params
)
else: else:
fig = ax.get_figure() fig = ax.get_figure()
@@ -238,7 +323,7 @@ def _finish_plot_2D(
ax.set_xlim(*ext_x) ax.set_xlim(*ext_x)
ax.set_ylim(*ext_y) ax.set_ylim(*ext_y)
interpolation = params.get("plot.interpolation", state.plot_default_2D_interpolation) interpolation = params.get("plot.interpolation", defaults["interpolation_2D"])
im = ax.imshow( im = ax.imshow(
values, values,
extent=[ext_x[0] - dx / 2, ext_x[1] + dx / 2, ext_y[0] - dy / 2, ext_y[1] + dy / 2], extent=[ext_x[0] - dx / 2, ext_x[1] + dx / 2, ext_y[0] - dy / 2, ext_y[1] + dy / 2],
@@ -346,7 +431,9 @@ def plot_spectrogram(
new_f, ind_f, _ = units.sort_axis(params["w"], f_range) new_f, ind_f, _ = units.sort_axis(params["w"], f_range)
values = spec[ind_t][:, ind_f] values = spec[ind_t][:, ind_f]
if f_range[2].type == "WL": if f_range[2].type == "WL":
values = np.apply_along_axis(units.to_WL, 1, values, params["frep"], units.m(f_range[2].inv(new_f))) values = np.apply_along_axis(
units.to_WL, 1, values, params["frep"], units.m(f_range[2].inv(new_f))
)
values = np.apply_along_axis(make_uniform_1D, 1, values, new_f) values = np.apply_along_axis(make_uniform_1D, 1, values, new_f)
if time_axis == 0: if time_axis == 0:
@@ -458,7 +545,9 @@ def plot_results_2D(
if plt_range[2].type == "WL": if plt_range[2].type == "WL":
if is_spectrum: if is_spectrum:
values = np.apply_along_axis(units.to_WL, 1, values, params.get("frep", 1), x_axis) values = np.apply_along_axis(units.to_WL, 1, values, params.get("frep", 1), x_axis)
values = np.array([make_uniform_1D(v, x_axis, n=len(x_axis), method="linear") for v in values]) values = np.array(
[make_uniform_1D(v, x_axis, n=len(x_axis), method="linear") for v in values]
)
return _finish_plot_2D( return _finish_plot_2D(
values, values,
@@ -581,8 +670,8 @@ def plot_results_1D(
pass pass
else: else:
ylabel = "normalized intensity (dB)" if ylabel is None else ylabel ylabel = "normalized intensity (dB)" if ylabel is None else ylabel
vmax = state.plot_default_vmax_with_headroom if vmax is None else vmax vmax = defaults["vmax_with_headroom"] if vmax is None else vmax
vmin = state.plot_default_vmin if vmin is None else vmin vmin = defaults["vmin"] if vmin is None else vmin
if isinstance(log, (float, int)) and log != True: if isinstance(log, (float, int)) and log != True:
values = units.to_log(values, ref=log) values = units.to_log(values, ref=log)
else: else:
@@ -592,7 +681,9 @@ def plot_results_1D(
folder_name = "" folder_name = ""
if is_new_plot: if is_new_plot:
folder_name, file_name, fig, ax = io.plot_setup(file_name=file_name, file_type=file_type, params=params) folder_name, file_name, fig, ax = io.plot_setup(
file_name=file_name, file_type=file_type, params=params
)
else: else:
fig = ax.get_figure() fig = ax.get_figure()
if transpose: if transpose:
@@ -725,7 +816,9 @@ def plot_avg(
# change the resolution # change the resolution
if isinstance(spacing, float): if isinstance(spacing, float):
new_x_axis = np.linspace(*span(x_axis), int(len(x_axis) / spacing)) new_x_axis = np.linspace(*span(x_axis), int(len(x_axis) / spacing))
values = np.array([UnivariateSpline(x_axis, value, k=4, s=0)(new_x_axis) for value in values]) values = np.array(
[UnivariateSpline(x_axis, value, k=4, s=0)(new_x_axis) for value in values]
)
if add_coherence: if add_coherence:
coherence = UnivariateSpline(x_axis, coherence, k=4, s=0)(new_x_axis) coherence = UnivariateSpline(x_axis, coherence, k=4, s=0)(new_x_axis)
mean_values = np.mean(values, axis=0) mean_values = np.mean(values, axis=0)
@@ -740,8 +833,8 @@ def plot_avg(
# apply log transform if required # apply log transform if required
if log != False: if log != False:
ylabel = "normalized intensity (dB)" if ylabel is None else ylabel ylabel = "normalized intensity (dB)" if ylabel is None else ylabel
vmax = state.plot_default_vmax_with_headroom if vmax is None else vmax vmax = defaults["vmax_with_headroom"] if vmax is None else vmax
vmin = state.plot_default_vmin if vmin is None else vmin vmin = defaults["vmin"] if vmin is None else vmin
if isinstance(log, (float, int)) and log != True: if isinstance(log, (float, int)) and log != True:
ref = log ref = log
else: else:
@@ -756,7 +849,9 @@ def plot_avg(
file_name=file_name, file_type=file_type, params=params, mode=mode file_name=file_name, file_type=file_type, params=params, mode=mode
) )
else: else:
folder_name, file_name, fig, top = io.plot_setup(file_name=file_name, file_type=file_type, params=params) folder_name, file_name, fig, top = io.plot_setup(
file_name=file_name, file_type=file_type, params=params
)
bot = top bot = top
else: else:
if isinstance(ax, (tuple, list)): if isinstance(ax, (tuple, list)):
@@ -775,15 +870,15 @@ def plot_avg(
# Actual Plotting # Actual Plotting
gray_style = state.plot_muted_style gray_style = defaults["muted_style"]
highlighted_style = state.plot_highlighted_style highlighted_style = defaults["highlighted_style"]
if transpose: if transpose:
for value in values: for value in values:
top.plot(value, x_axis, **gray_style) top.plot(value, x_axis, **gray_style)
top.plot(mean_values, x_axis, **highlighted_style) top.plot(mean_values, x_axis, **highlighted_style)
if add_coherence: if add_coherence:
bot.plot(coherence, x_axis, c=state.plot_default_color_cycle[0]) bot.plot(coherence, x_axis, c=defaults["color_cycle"][0])
top.set_xlim(left=vmax, right=vmin) top.set_xlim(left=vmax, right=vmin)
top.yaxis.tick_right() top.yaxis.tick_right()
@@ -798,7 +893,7 @@ def plot_avg(
top.plot(x_axis, value, **gray_style) top.plot(x_axis, value, **gray_style)
top.plot(x_axis, mean_values, **highlighted_style) top.plot(x_axis, mean_values, **highlighted_style)
if add_coherence: if add_coherence:
bot.plot(x_axis, coherence, c=state.plot_default_color_cycle[0]) bot.plot(x_axis, coherence, c=defaults["color_cycle"][0])
top.set_ylim(bottom=vmin, top=vmax) top.set_ylim(bottom=vmin, top=vmax)
top.set_ylabel(ylabel) top.set_ylabel(ylabel)
@@ -806,8 +901,11 @@ def plot_avg(
bot.set_xlabel(plt_range[2].label) bot.set_xlabel(plt_range[2].label)
bot.set_xlim(*ext) bot.set_xlim(*ext)
custom_lines = [plt.Line2D([0], [0], lw=2, c=gray_style["c"]), plt.Line2D([0], [0], lw=2, c=highlighted_style["c"])] custom_lines = [
line_labels = state.plot_avg_default_line_labels if line_labels is None else line_labels plt.Line2D([0], [0], lw=2, c=gray_style["c"]),
plt.Line2D([0], [0], lw=2, c=highlighted_style["c"]),
]
line_labels = defaults["avg_line_labels"] if line_labels is None else line_labels
line_labels = list(line_labels) line_labels = list(line_labels)
if not is_new_plot: if not is_new_plot:
@@ -868,7 +966,9 @@ def prepare_plot_1D(values, plt_range, x_axis, yscaling=1, spacing=1, frep=80e6)
if isinstance(spacing, float): if isinstance(spacing, float):
new_x_axis = np.linspace(*span(x_axis), int(len(x_axis) / spacing)) new_x_axis = np.linspace(*span(x_axis), int(len(x_axis) / spacing))
values = np.array([UnivariateSpline(x_axis, value, k=4, s=0)(new_x_axis) for value in values]) values = np.array(
[UnivariateSpline(x_axis, value, k=4, s=0)(new_x_axis) for value in values]
)
x_axis = new_x_axis x_axis = new_x_axis
elif isinstance(spacing, int) and spacing > 1: elif isinstance(spacing, int) and spacing > 1:
values = values[:, ::spacing] values = values[:, ::spacing]
@@ -925,3 +1025,33 @@ def white_bottom_cmap(name, start=0, end=1, new_name="white_background", c_back=
for i in range(4): for i in range(4):
bottom[:, i] = np.linspace(c_back[i], top(start)[i], n_bottom) bottom[:, i] = np.linspace(c_back[i], top(start)[i], n_bottom)
return ListedColormap(np.vstack((bottom, top(np.linspace(start, end, 1024)))), name=new_name) return ListedColormap(np.vstack((bottom, top(np.linspace(start, end, 1024)))), name=new_name)
def default_marker_style(k):
"""returns a style dictionary
Parameters
----------
k : int
index in the cycle
Returns
-------
dict
style dictionnary
"""
return dict(
marker=defaults["markers"][k],
markerfacecolor="none",
linestyle=":",
lw=1,
c=defaults["color_cycle"][k],
)
def arrowstyle(direction=1, color="white"):
return dict(
arrowprops=dict(arrowstyle="->", connectionstyle=f"arc3,rad={direction*0.3}", color=color),
color=color,
backgroundcolor=(0.5, 0.5, 0.5, 0.5),
)

View File

@@ -1,103 +0,0 @@
import matplotlib.pyplot as plt
from . import utilities as util
"""
This File is used as a public global variable storage solutions. Main functions are having a centralised
parameters index
plotting parameters
logger
This is not a solution when functions are accessing this module in parallel threads, as
changes made by a thread are not reflected in other threads, which is why another solution should be used when dealing
with parameters or paths (if those paths are not stored in paths.json)
"""
class CurrentLogger:
_current_logger = None
@classmethod
def focus_logger(cls, logger):
cls._current_logger = logger
@classmethod
def log(cls, *args, **kwargs):
if cls._current_logger is not None:
util.ray_safe(cls._current_logger.log, *args, **kwargs)
else:
print(*args)
# WILL BREAK SIMULATION SAVING AND MERGING IF CHANGED
recorded_types = ["spectra", "params"] # nickname of the objects saved and tracked when doing automatic simulations
# --------SIMULATION VARIABLES--------#
default_z_target_size = 128
# ---------PLOTTING VARIABLES---------#
def plot_arrowstyle(direction=1, color="white"):
return dict(
arrowprops=dict(arrowstyle="->", connectionstyle=f"arc3,rad={direction*0.3}", color=color),
color=color,
backgroundcolor=(0.5, 0.5, 0.5, 0.5),
)
plot_default_figsize = (10, 7)
plot_default_2D_interpolation = "bicubic"
plot_default_vmin = -40
plot_default_vmax = 0
plot_default_vmax_with_headroom = 2
plot_default_name = "plot"
plot_avg_default_main_to_coherence_ratio = 4
plot_avg_default_line_labels = ["individual values", "mean"]
plot_muted_style = dict(linewidth=0.5, c=(0.8, 0.8, 0.8, 0.4))
plot_highlighted_style = dict(c="red")
plot_default_color_cycle = plt.rcParams["axes.prop_cycle"].by_key()["color"]
plot_default_light_color = (1, 1, 1, 0.7)
plot_default_markers = ["*", "+", ".", "D", "x", "d", "v", "s", "1", "^"]
plot_default_cmap = "viridis"
plot_label_quality_factor = r"$F_\mathrm{Q}$"
plot_label_mean_g12 = r"$\langle | g_{12} |\rangle$"
plot_label_g12 = r"|$g_{12}$|"
plot_label_z = "propagation distance z (m)"
plot_label_fwhm = r"$T_\mathrm{FWHM}$ (fs)"
plot_label_wb_distance = r"$L_\mathrm{WB}$"
plot_label_t_jitter = "timing jitter (fs)"
plot_label_fwhm_noise = "FWHM noise (%)"
plot_label_int_noise = "RIN (%)"
plot_text_topright_style = dict(verticalalignment="top", horizontalalignment="right")
plot_text_topleft_style = dict(verticalalignment="top", horizontalalignment="left")
# ------------------------------------#
# plotting choices
dist = 1.5
# plotting variables
def style(k):
return dict(
marker=plot_default_markers[k], markerfacecolor="none", linestyle=":", lw=1, c=plot_default_color_cycle[k]
)
default_width = 10
def fs(ratio):
return (default_width, default_width * ratio)
# store global variables for debug purposes
_DEBUG = {}

View File

@@ -7,13 +7,15 @@ scgenerator module but some function may be used in any python program
import datetime as dt import datetime as dt
import itertools import itertools
from typing import Callable, List, Tuple, Union, Any import logging
from typing import Any, Callable, List, Tuple, Union
import numpy as np import numpy as np
import ray import ray
from .const import PARAM_SEPARATOR, valid_varying
from .logger import get_logger
from .math import * from .math import *
from .const import valid_varying
# XXX ############################################ # XXX ############################################
# XXX ############### Pure Python ################ # XXX ############### Pure Python ################
@@ -24,37 +26,38 @@ class ProgressTracker:
def __init__( def __init__(
self, self,
max: Union[int, float], max: Union[int, float],
auto_print: bool = False, prefix: str = "",
suffix: str = "",
logger: logging.Logger = get_logger(),
auto_print: bool = True,
percent_incr: Union[int, float] = 5, percent_incr: Union[int, float] = 5,
default_update: Union[int, float] = 1, default_update: Union[int, float] = 1,
callback: Callable[[str, Any], None] = None,
): ):
self.max = max self.max = max
self.current = 0 self.current = 0
self.prefix = prefix
self.suffix = suffix
self.start_time = dt.datetime.now() self.start_time = dt.datetime.now()
self.auto_print = auto_print self.auto_print = auto_print
self.next_percent = percent_incr self.next_percent = percent_incr
self.percent_incr = percent_incr self.percent_incr = percent_incr
self.default_update = default_update self.default_update = default_update
self.callback = callback self.logger = logger
def _update(self, callback_args): def _update(self):
if self.auto_print and self.current / self.max >= self.next_percent / 100: if self.auto_print and self.current / self.max >= self.next_percent / 100:
self.next_percent += self.percent_incr self.next_percent += self.percent_incr
if self.callback is None: self.logger.info(self.prefix + self.ETA + self.suffix)
print(self.ETA)
else:
self.callback(self.ETA, *callback_args)
def update(self, num=None, callback_args=[]): def update(self, num=None):
if num is None: if num is None:
num = self.default_update num = self.default_update
self.current += num self.current += num
self._update(callback_args) self._update()
def set(self, value, callback_args=[]): def set(self, value):
self.current = value self.current = value
self._update(callback_args) self._update()
@property @property
def ETA(self): def ETA(self):
@@ -108,9 +111,8 @@ def count_variations(config: dict) -> Tuple[int, int]:
return num, varying_params return num, varying_params
def format_varying_list(l: List[tuple], joints: List[str] = ""): def format_varying_list(l: List[tuple]):
while len(joints) < 2: joints = 2 * PARAM_SEPARATOR
joints += "_"
str_list = [] str_list = []
for p_name, p_value in l: for p_name, p_value in l:
ps = p_name.replace("/", "").replace(joints[0], "").replace(joints[1], "") ps = p_name.replace("/", "").replace(joints[0], "").replace(joints[1], "")
@@ -121,7 +123,7 @@ def format_varying_list(l: List[tuple], joints: List[str] = ""):
def varying_list_from_path(s: str) -> List[tuple]: def varying_list_from_path(s: str) -> List[tuple]:
s = s.replace("/", "") s = s.replace("/", "")
str_list = s.split("_") str_list = s.split(PARAM_SEPARATOR)
out = [] out = []
for i in range(0, len(str_list) // 2 * 2, 2): for i in range(0, len(str_list) // 2 * 2, 2):
out.append((str_list[i], get_value(str_list[i + 1]))) out.append((str_list[i], get_value(str_list[i + 1])))

View File

@@ -1,6 +0,0 @@
a = [ 0, 1, 2, 3, 4,]
c = [ 0, 1, 2, 3, 4,]
b = "<built-in function print>"
aa = [ "0j", "(1+0j)", "(2+0j)", "(3+0j)", "(4+0j)",]
bb = [ 0.0, 1.0, 2.0, 3.0, 4.0,]
ddd = 2021-01-21T07:55:18.881790

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +0,0 @@
a = [ 0, 1, 2, 3, 4,]
c = [ 0, 1, 2, 3, 4,]
bb = [ 0.0, 1.0, 2.0, 3.0, 4.0,]
datetime = 2021-01-21T07:55:18.882279

View File

@@ -1,15 +0,0 @@
from scgenerator import io
from scgenerator.io import _get_data_subfolders
import numpy as np
from glob import glob
from scgenerator.math import abs2
from matplotlib import pyplot as plt
path = "scgenerator_full anomalous123/wavelength_8.35e-07"
for i in [0, 63]:
dat = np.load(f"{path}/spectra_{i}.npy")
for d in dat:
plt.plot(abs2(d))
plt.show()

View File

@@ -1,15 +0,0 @@
from scgenerator.initialize import ParamSequence
from logging import StreamHandler
from scgenerator import io
from scgenerator import utilities
# dispatcher = ParamSequence(io.load_toml("testing/configs/ensure_consistency/good4"))
dispatcher = ParamSequence(io.load_toml("testing/configs/compute_init_parameters/good"))
print(dispatcher)
for only, params in dispatcher:
print(only, params["width"])
print(len(dispatcher))
print(dispatcher["fiber", "length"])
print(utilities.varying_list_from_path("/a_5_b_asdf"))

View File

@@ -1,13 +0,0 @@
from prettyprinter import pprint
from scgenerator import initialize as init
from scgenerator.io import load_toml
debug = 56
config = load_toml("testing/configs/compute_init_parameters/good.toml")
config = init.ensure_consistency(config)
try:
params = init.compute_init_parameters(config)
except:
raise
pprint(params)

View File

@@ -1,38 +0,0 @@
{
"name": "test config",
"fiber": {
"gamma": 0.018,
"pitch": 1.5e-06,
"pitch_ratio": 0.37,
"type": "pcf"
},
"pulse": {
"power": 100000.0,
"quantum_noise": true,
"shape": "gaussian",
"wavelength": 1.05e-06,
"varying": {
"intensity_noise": [
0.0005,
0.001
],
"pulse_width": [
5e-14,
1e-13,
2e-13
]
}
},
"simulation": {
"behaviors": [
"spm",
"raman",
"ss"
],
"nt": 16384,
"raman_type": "agrawal",
"repeat": 4,
"time_window": 3.7e-11,
"tolerated_error": 1e-11
}
}

View File

@@ -1,28 +0,0 @@
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]
pulse_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

View File

@@ -1,11 +0,0 @@
import toml
from prettyprinter import pprint
import json
config = toml.load("tests/test_config.toml")
pprint(config)
with open("tests/test_config.toml") as file:
config = toml.load(file)
# with open("tests/test_config.json", "w") as file:
# json.dump(config, file)

View File

@@ -1,29 +0,0 @@
from scgenerator.io import merge_same_simulations
from prettyprinter import pprint
# a, b = [
# "scgenerator_full anomalous123_1/wavelength_8.35e-07_num_3",
# "scgenerator_full anomalous123_1/wavelength_8.35e-07_num_2",
# "scgenerator_full anomalous123_1/wavelength_8.3e-07_num_1",
# "scgenerator_full anomalous123_1/wavelength_8.3e-07_num_0",
# "scgenerator_full anomalous123_1/wavelength_8.35e-07_num_0",
# "scgenerator_full anomalous123_1/wavelength_8.35e-07_num_1",
# "scgenerator_full anomalous123_1/wavelength_8.3e-07_num_2",
# "scgenerator_full anomalous123_1/wavelength_8.3e-07_num_3",
# ], [
# [("wavelength", 8.3e-07), ("num", 0)],
# [("wavelength", 8.35e-07), ("num", 0)],
# [("wavelength", 8.3e-07), ("num", 1)],
# [("wavelength", 8.35e-07), ("num", 1)],
# [("wavelength", 8.3e-07), ("num", 2)],
# [("wavelength", 8.35e-07), ("num", 2)],
# [("wavelength", 8.3e-07), ("num", 3)],
# [("wavelength", 8.35e-07), ("num", 3)],
# ]
# pprint(list(zip(a, b)))
all = merge_same_simulations("scgenerator_full anomalous123")
pprint(all)

View File

@@ -1,8 +0,0 @@
from scgenerator.physics.simulate import new_simulations
from scgenerator import io
import ray
ray.init()
sim = new_simulations("testing/configs/run_simulations/full_anomalous.toml", 123)
sim.run()

View File

@@ -1,17 +0,0 @@
from json import encoder
import toml
import numpy as np
from datetime import datetime
from scgenerator.io import save_parameters
x = np.arange(5)
y = np.arange(5, dtype="complex")
z = np.arange(5, dtype="float")
dico = dict(a=x, c=list(x), b=print, aa=y, bb=z, ddd=datetime.now())
with open("tests/numpy.toml", "w") as file:
toml.dump(dico, file, encoder=toml.TomlNumpyEncoder())
save_parameters(dico, "tests/param")
save_parameters(toml.load("tests/test_config.toml"), "tests/test_save_config")

View File

@@ -1,26 +0,0 @@
name = "test config"
datetime = 2021-01-21T07:55:18.883204
[fiber]
gamma = 0.018
pitch = 1.5e-6
pitch_ratio = 0.37
type = "pcf"
[pulse]
power = 100000.0
quantum_noise = true
shape = "gaussian"
wavelength = 1.05e-6
[simulation]
behaviors = [ "spm", "raman", "ss",]
nt = 16384
raman_type = "agrawal"
repeat = 4
time_window = 3.7e-11
tolerated_error = 1e-11
[pulse.varying]
intensity_noise = [ 0.0005, 0.001,]
pulse_width = [ 5e-14, 1e-13, 2e-13,]

View File

@@ -1,6 +0,0 @@
from scgenerator.initialize import validate_types
from scgenerator.io import load_toml
config = load_toml("tests/test_config.toml")
validate_types(config)