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

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