ICOD/Training_IC_on_Demand.ipynb
2024-06-10 13:53:47 +02:00

8.6 KiB

Create ICs on Demand

In [1]:
import numpy as np
import matplotlib.pylab as plt

from models.multiresolution_flow_3d import *
from models.trainer import *

%matplotlib inline

Setup the model

In [2]:
nlevel=5

shape = (2**nlevel,2**nlevel,2**nlevel)

model = multi_scale_model(nlevel=nlevel)

tm = trainer(model)
Trainer model: tm
load initial state

test training with white noise

In [6]:
for i in np.arange(1000):
    x_train = np.random.normal(0,0.01,shape)+3.1415
    tm.train_single(x_train, silent=True)
tm.transfer(silent=False)
Train model...
Training done
Out[6]:
0
In [7]:
x = model.generate()
print(np.mean(x[nlevel].flatten()),np.std(x[nlevel].flatten()))


plt.hist(x[nlevel].flatten(),bins=100)
plt.show()
0.006170461447273722 1.006313544079366
No description has been provided for this image
In [ ]: