wl shift issue

This commit is contained in:
Benoît Sierro
2021-06-04 14:41:56 +02:00
parent c3511dc2ff
commit 7c0daa0787
14 changed files with 35 additions and 11 deletions

View File

@@ -251,3 +251,8 @@ upper_wavelength_interp_limit: float
sets the lowest end of this range. If the set value is higher than the higher end of the sets the lowest end of this range. If the set value is higher than the higher end of the
wavelength window, it is lowered down to that point. default : 1900e-9 wavelength window, it is lowered down to that point. default : 1900e-9
readjust_wavelength : bool
if a custom input field is set, it is likely that the maximum of its corresponding spectrum doesn't lies exactly at the
set wavelength. If this setting is True, the program will override the wavelength parameter so that the maximum of the spectrum
lies on the desired wavelength.

View File

@@ -79,7 +79,7 @@ def merge(args):
path_trees = io.build_path_trees(Path(args.path)) path_trees = io.build_path_trees(Path(args.path))
if args.output_name is None: if args.output_name is None:
args.output_name = path_trees[-1][0][0].parent.name + " merged" args.output_name = path_trees[0][-1][0].parent.name + " merged"
io.merge(args.output_name, path_trees) io.merge(args.output_name, path_trees)

View File

@@ -195,6 +195,7 @@ valid_param_types = dict(
upper_wavelength_interp_limit=in_range_excl(num, (100e-9, 5000e-9)), upper_wavelength_interp_limit=in_range_excl(num, (100e-9, 5000e-9)),
frep=num, frep=num,
prev_sim_dir=string(), prev_sim_dir=string(),
readjust_wavelength=boolean,
), ),
) )
@@ -242,7 +243,14 @@ valid_variable = dict(
"width", "width",
"soliton_num", "soliton_num",
], ],
simulation=["behaviors", "raman_type", "tolerated_error", "step_size", "ideal_gas"], simulation=[
"behaviors",
"raman_type",
"tolerated_error",
"step_size",
"ideal_gas",
"readjust_wavelength",
],
) )
ENVIRON_KEY_BASE = "SCGENERATOR_" ENVIRON_KEY_BASE = "SCGENERATOR_"

View File

@@ -27,6 +27,7 @@ default_parameters = dict(
lower_wavelength_interp_limit=300e-9, lower_wavelength_interp_limit=300e-9,
upper_wavelength_interp_limit=1900e-9, upper_wavelength_interp_limit=1900e-9,
ideal_gas=False, ideal_gas=False,
readjust_wavelength=False,
) )
default_plotting = dict( default_plotting = dict(

View File

@@ -511,6 +511,7 @@ def _ensure_consistency_simulation(simulation):
"lower_wavelength_interp_limit", "lower_wavelength_interp_limit",
"upper_wavelength_interp_limit", "upper_wavelength_interp_limit",
"ideal_gas", "ideal_gas",
"readjust_wavelength",
]: ]:
simulation = defaults.get(simulation, param) simulation = defaults.get(simulation, param)
@@ -715,6 +716,7 @@ def setup_custom_field(params: Dict[str, Any]) -> bool:
params["width"], params["peak_power"], params["energy"] = pulse.measure_field( params["width"], params["peak_power"], params["energy"] = pulse.measure_field(
params["t"], params["field_0"] params["t"], params["field_0"]
) )
if params.get("readjust_wavelength", False):
delta_w = params["w_c"][np.argmax(abs2(np.fft.fft(params["field_0"])))] delta_w = params["w_c"][np.argmax(abs2(np.fft.fft(params["field_0"])))]
logger.debug(f"adjusted w by {delta_w}") logger.debug(f"adjusted w by {delta_w}")
params["wavelength"] = units.m.inv(units.m(params["wavelength"]) - delta_w) params["wavelength"] = units.m.inv(units.m(params["wavelength"]) - delta_w)

View File

@@ -698,6 +698,10 @@ def run_simulation_sequence(
sim.run() sim.run()
prev = sim.sim_dir prev = sim.sim_dir
path_trees = io.build_path_trees(sim.sim_dir) path_trees = io.build_path_trees(sim.sim_dir)
if final_name is None:
final_name = path_trees[0][-1][0].parent.name + " merged"
io.merge(final_name, path_trees) io.merge(final_name, path_trees)

View File

@@ -66,9 +66,6 @@ class PBars:
def print(self): def print(self):
if "file" not in self.policy: if "file" not in self.policy:
return return
if len(self.pbars) > 1:
s = [""]
else:
s = [] s = []
for pbar in self.pbars: for pbar in self.pbars:
s.append(str(pbar)) s.append(str(pbar))

View File

@@ -2,6 +2,7 @@ dt = 1e-15
field_file = "testing/configs/custom_field/init_field.npz" field_file = "testing/configs/custom_field/init_field.npz"
length = 1 length = 1
mean_power = 220e-3 mean_power = 220e-3
readjust_wavelength = true
repetition_rate = 40e6 repetition_rate = 40e6
t_num = 2048 t_num = 2048
wavelength = 1000e-9 wavelength = 1000e-9

View File

@@ -1,6 +1,7 @@
dt = 1e-15 dt = 1e-15
field_file = "testing/configs/custom_field/init_field.npz" field_file = "testing/configs/custom_field/init_field.npz"
length = 1 length = 1
readjust_wavelength = true
t_num = 2048 t_num = 2048
wavelength = 1000e-9 wavelength = 1000e-9
z_num = 32 z_num = 32

View File

@@ -2,6 +2,7 @@ dt = 1e-15
field_file = "testing/configs/custom_field/init_field.npz" field_file = "testing/configs/custom_field/init_field.npz"
length = 1 length = 1
peak_power = 20000 peak_power = 20000
readjust_wavelength = true
t_num = 2048 t_num = 2048
wavelength = 1593e-9 wavelength = 1593e-9
z_num = 32 z_num = 32

View File

@@ -2,6 +2,7 @@ dt = 1e-15
input_transmission = 1 input_transmission = 1
length = 1 length = 1
prev_data_dir = "testing/configs/custom_field/recover_data" prev_data_dir = "testing/configs/custom_field/recover_data"
readjust_wavelength = true
t_num = 2048 t_num = 2048
wavelength = 1000e-9 wavelength = 1000e-9
z_num = 32 z_num = 32

View File

@@ -2,6 +2,7 @@ dt = 1e-15
input_transmission = 0.9 input_transmission = 0.9
length = 1 length = 1
prev_data_dir = "testing/configs/custom_field/recover_data" prev_data_dir = "testing/configs/custom_field/recover_data"
readjust_wavelength = true
t_num = 2048 t_num = 2048
wavelength = 1000e-9 wavelength = 1000e-9
z_num = 32 z_num = 32

View File

@@ -15,6 +15,7 @@ wavelength = 1050e-9
behaviors = ["spm", "raman", "ss"] behaviors = ["spm", "raman", "ss"]
lower_wavelength_interp_limit = 300e-9 lower_wavelength_interp_limit = 300e-9
raman_type = "agrawal" raman_type = "agrawal"
readjust_wavelength = true
t_num = 16384 t_num = 16384
time_window = 37e-12 time_window = 37e-12
tolerated_error = 1e-11 tolerated_error = 1e-11

View File

@@ -16,6 +16,7 @@ wavelength = [1050e-9, 1321e-9, 1593e-9]
behaviors = ["spm", "raman", "ss"] behaviors = ["spm", "raman", "ss"]
lower_wavelength_interp_limit = 300e-9 lower_wavelength_interp_limit = 300e-9
raman_type = "agrawal" raman_type = "agrawal"
readjust_wavelength = true
t_num = 16384 t_num = 16384
time_window = 37e-12 time_window = 37e-12
tolerated_error = 1e-11 tolerated_error = 1e-11