diff --git a/.gitignore b/.gitignore index 4a3e68c..d58e7eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ src/**/*.ini -pypho # VSCode .vscode diff --git a/src/single-core-regen/_path_fix.py b/src/single-core-regen/_path_fix.py index 72e5669..74aadb1 100644 --- a/src/single-core-regen/_path_fix.py +++ b/src/single-core-regen/_path_fix.py @@ -3,7 +3,7 @@ from pathlib import Path # hack to add the parent directory to the path -> pypho doesn't have to be installed as package parent_dir = Path(__file__).parent -while not (parent_dir / "pypho").exists() and parent_dir != Path("/"): +while not (parent_dir / "pypho" / "pypho").exists() and parent_dir != Path("/"): parent_dir = parent_dir.parent -print(f"Adding '{parent_dir}' to 'sys.path' to enable import of '{parent_dir / 'pypho'}'") -sys.path.append(str(parent_dir)) +print(f"Adding '{parent_dir / "pypho"}' to 'sys.path' to enable import of '{parent_dir / 'pypho'}'") +sys.path.append(str(parent_dir / "pypho")) diff --git a/src/single-core-regen/generate_signal.py b/src/single-core-regen/generate_signal.py index 0624037..d8c55e4 100644 --- a/src/single-core-regen/generate_signal.py +++ b/src/single-core-regen/generate_signal.py @@ -387,7 +387,7 @@ def length_loop(config, lengths, incremental=False): in_out_eyes(cfiber, cdata) -def single_run_with_plot(config): +def single_run_with_plot(config, save=True): cfiber, cdata, noise, edfa = initialize_fiber_and_data(config) mean_power_in = np.sum(pypho.functions.getpower_W(cdata.E_in)) @@ -405,7 +405,8 @@ def single_run_with_plot(config): E_tmp = [{'E': cdata.E_out, 'noise': noise*(-cfiber.params.l*cfiber.params.alpha)}] E_tmp = edfa(E=E_tmp) cdata.E_out = E_tmp[0]['E'] - save_data(cdata, config) + if save: + save_data(cdata, config) in_out_eyes(cfiber, cdata) @@ -509,7 +510,7 @@ if __name__ == "__main__": ] lengths.append(max(length_ranges)*10) - length_loop(config, lengths) + # length_loop(config, lengths) - # single_run_with_plot(config) + single_run_with_plot(config, save=False)