add license EUPL-1.2

This commit is contained in:
Joseph Hopfmüller
2024-11-15 18:28:45 +01:00
parent e929991b3d
commit c42da6ca58
5 changed files with 336 additions and 140 deletions

View File

@@ -1,3 +1,16 @@
"""
generate_signal.py
This file is part of the repo "optical-regeneration"
https://git.suuppl.dev/seppl/optical-regeneration.git
Joseph Hopfmüller
Copyright 2024
Licensed under the EUPL
Full license text in LICENSE file
"""
import configparser
from datetime import datetime
import hashlib
@@ -235,7 +248,7 @@ def initialize_fiber_and_data(config, input_data_override=None):
config["fiber"]["birefseed"],
)
c_params = pypho.cfiber.ParamsWrapper.from_fiber(
py_fiber, max_step=1e3 if py_fiber.gamma == 0 else 200
py_fiber, max_step=py_fiber.l if py_fiber.gamma == 0 else 200
)
c_fiber = pypho.cfiber.FiberWrapper(c_data, c_params, c_glova)
@@ -314,6 +327,7 @@ def save_data(data, config):
config["fiber"]["d"],
config["fiber"]["s"],
f"{config['signal']['modulation'].upper()}{config['signal']['mod_order']}",
config["fiber"]["birefsteps"],
)
lookup_file = "-".join(map(str, filename_components)) + ".ini"
@@ -323,20 +337,23 @@ def save_data(data, config):
np.save(save_dir / save_file, save_data)
print("Saved config to", data_dir / lookup_file)
print("Saved data to", save_dir / f"{config_hash}.npy")
print("Saved data to", save_dir / save_file)
def length_loop(config, lengths):
def length_loop(config, lengths, incremental=False):
lengths = sorted(lengths)
input_override = None
for lind, length in enumerate(lengths):
# print(f"\nGenerating data for fiber length {length}")
if lind > 0:
if lind > 0 and incremental:
# set the length to the difference between the current and previous length -> incremental
length = lengths[lind] - lengths[lind - 1]
print(
f"\nGenerating data for fiber length {lengths[lind]}m [using {length}m increment]"
)
if incremental:
print(
f"\nGenerating data for fiber length {lengths[lind]}m [using {length}m increment]"
)
else:
print(f"\nGenerating data for fiber length {length}m")
config["fiber"]["length"] = length
# set the input data to the output data of the previous run
cfiber, cdata, noise, edfa = initialize_fiber_and_data(
@@ -482,17 +499,17 @@ def plot_eye_diagram(
if __name__ == "__main__":
config = get_config()
length_ranges = [1, 10, 100, 1000, 10000]
length_ranges = [1000, 10000]
length_scales = [1, 2, 5]
length_scales = [1, 2, 3, 4, 5, 6, 7, 8, 9]
lengths = [
length_scale * length_range
for length_range in length_ranges
for length_scale in length_scales
]
lengths.append(max(length_ranges))
lengths.append(max(length_ranges)*10)
# length_loop(config, lengths)
length_loop(config, lengths)
# single_run_with_plot(config)
single_run_with_plot(config)

View File

@@ -1,40 +0,0 @@
[glova]
nos = 2**14
sps = 128
f0 = 193414489032258.06
; -> delta0 = 1550.0 nm
symbolrate = 10e9
wisdom_dir = "/home/suppl/.pypho"
flags = "FFTW_PATIENT"
nthreads = 32
[fiber]
length = 100
gamma = 0
alpha = 0
D = 17
; 1700 ps/nm/km @ 1 km length is equivalent to 17 ps/nm/km @ 100 km length but the simulation is way faster
S = 0
birefsteps = 0
; birefseed = 0xC0FFEE
[signal]
seed = 0xC0FFEE
modulation = "pam"
mod_order = 4
mod_depth = 0.8
max_jitter=0.02
; jitter_seed = 0xC0FFEE
laser_power = 0
edfa_power = 3
edfa_nf = 5
pulse_shape = "gauss"
fwhm = 0.33
[data]
dir = "data"
npy_dir = "npys"