change pypho symlink to submodule and handle new location in _path_fix.py

This commit is contained in:
Joseph Hopfmüller
2024-11-15 20:56:34 +01:00
parent c42da6ca58
commit 5e2d3dd6b7
3 changed files with 8 additions and 8 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,4 @@
src/**/*.ini
pypho
# VSCode
.vscode

View File

@@ -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"))

View File

@@ -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)