Skip to content

Commit 3841468

Browse files
Merge pull request #187 from IBM/maintenance
Maintenance
2 parents b69ee1a + dc9ceae commit 3841468

File tree

83 files changed

+614
-580
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+614
-580
lines changed

examples/DeepONet/miscellaneous/notebooks/timeint_DeepONet_simple_manufactured_pinn.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@
2323

2424

2525
import os
26+
2627
import matplotlib.pyplot as plt
2728
import numpy as np
2829

30+
from simulai.file import SPFile
31+
from simulai.optimization import Optimizer
32+
from simulai.residuals import SymbolicOperator
2933

3034
# In[3]:
3135

3236

33-
from simulai.file import SPFile
34-
from simulai.optimization import Optimizer
35-
from simulai.residuals import SymbolicOperator
3637

3738

3839
# #### Basic configuration
@@ -281,7 +282,6 @@ def model():
281282

282283
from scipy.integrate import odeint
283284

284-
285285
# #### Pendulum numerical solver
286286

287287
# In[ ]:

examples/DeepONet/miscellaneous/scripts/polynomial_integration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import numpy as np
22
import torch
33

4+
from simulai.optimization import Optimizer
45
from simulai.residuals import SymbolicOperator
56
from simulai.tokens import Dot, Gp
6-
from simulai.optimization import Optimizer
77

88

99
def model():

examples/ESN-RC/scripts/independent_esn_rc_nonlinear_forcing.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@
1919
import matplotlib.pyplot as plt
2020
import numpy as np
2121

22-
from examples.utils.oscillator_solver import (
23-
oscillator_solver,
24-
oscillator_solver_forcing,
25-
)
22+
from examples.utils.oscillator_solver import (oscillator_solver,
23+
oscillator_solver_forcing)
2624
from simulai.models import ModelPool
2725
from simulai.regression import EchoStateNetwork
2826
from simulai.utilities import make_temp_directory

examples/MapValid/map_valid_reshaper.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@
2323
from simulai.io import BatchCopy, MapValid
2424
from simulai.metrics import L2Norm, MemorySizeEval
2525
from simulai.models import ModelPool
26-
from simulai.normalization import (
27-
BatchNormalization,
28-
UnitaryNormalization,
29-
UnitarySymmetricalNormalization,
30-
)
26+
from simulai.normalization import (BatchNormalization, UnitaryNormalization,
27+
UnitarySymmetricalNormalization)
3128
from simulai.rom import IPOD
3229
from simulai.simulation import Pipeline
3330

examples/OpInf/scripts/lorenz_96_chaotic.py

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import os
16-
1716
#!/usr/bin/env python
1817
import warnings
1918

examples/OpInf/scripts/lorenz_96_chaotic_multiple.py

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import os
1616
import time
17-
1817
#!/usr/bin/env python
1918
import warnings
2019

examples/OpInf/scripts/lorenz_96_stability.py

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import os
1616
import pickle
17-
1817
#!/usr/bin/env python
1918
import warnings
2019
from argparse import ArgumentParser

examples/OpInf/scripts/opinf_nonlinear_network.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,8 @@
2525
from examples.utils.lorenz_solver import lorenz_solver
2626
from simulai.math.integration import LSODA, ClassWrapper
2727
from simulai.optimization import Optimizer, ScipyInterface
28-
from simulai.regression import (
29-
AutoEncoderKoopman,
30-
DenseNetwork,
31-
KoopmanNetwork,
32-
OpInfNetwork,
33-
)
28+
from simulai.regression import (AutoEncoderKoopman, DenseNetwork,
29+
KoopmanNetwork, OpInfNetwork)
3430

3531

3632
class LorenzJacobian:

examples/OpInf/scripts/svd_lorenz_96_chaotic.py

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import os
16-
1716
#!/usr/bin/env python
1817
import warnings
1918

examples/PINN/scripts/Bioreactor/001-Bioreactor_ODEs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"""
88

99
""" Python Libraries"""
10-
import pandas as pd
11-
import numpy as np
1210
import matplotlib.pyplot as plt
11+
import numpy as np
12+
import pandas as pd
1313
from scipy.integrate import solve_ivp
1414

1515
""" Kinetics constants"""

examples/PINN/scripts/Bioreactor/002-Bioreactor_PINN.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,25 @@
2323
"""
2424

2525
""" Import Python Libraries """
26+
import math
2627
import os
28+
import random
2729
from argparse import ArgumentParser
2830
from typing import List
31+
2932
import matplotlib.pyplot as plt
3033
import numpy as np
3134
import pandas as pd
32-
import math
33-
import random
3435
import torch
3536

3637
torch.set_default_dtype(torch.float64)
3738
torch.set_default_tensor_type(torch.DoubleTensor)
3839

3940
from simulai import ARRAY_DTYPE
41+
from simulai.file import SPFile
4042
from simulai.optimization import Optimizer, PIRMSELoss, ScipyInterface
4143
from simulai.residuals import SymbolicOperator
4244
from simulai.templates import NetworkTemplate, guarantee_device
43-
from simulai.file import SPFile
4445

4546
"""#########################################################################"""
4647
"""REPRODUCIBILITY """
@@ -301,8 +302,8 @@ def adaptative_scale_factors(alpha: float = None):
301302
activations_funct = "tanh"
302303

303304
def model():
304-
from simulai.regression import SLFNN, ConvexDenseNetwork
305305
from simulai.models import ImprovedDenseNetwork
306+
from simulai.regression import SLFNN, ConvexDenseNetwork
306307

307308
# Configuration for the fully-connected network
308309
config = {
@@ -370,10 +371,11 @@ def model_():
370371

371372
torch.set_default_dtype(torch.float64)
372373

373-
from simulai.templates import NetworkTemplate, guarantee_device
374374
import numpy as np
375+
375376
from simulai.models import ImprovedDenseNetwork
376377
from simulai.regression import SLFNN, ConvexDenseNetwork
378+
from simulai.templates import NetworkTemplate, guarantee_device
377379

378380
depth = 3
379381
width = 64
@@ -382,8 +384,8 @@ def model_():
382384

383385
# Model used for initialization
384386
def sub_model():
385-
from simulai.regression import SLFNN, ConvexDenseNetwork
386387
from simulai.models import ImprovedDenseNetwork
388+
from simulai.regression import SLFNN, ConvexDenseNetwork
387389

388390
# Configuration for the fully-connected network
389391
config = {

examples/PINN/scripts/Bioreactor_Multifidelity.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,21 @@
2323
"""
2424

2525
""" Import Python Libraries """
26+
import random
2627
from argparse import ArgumentParser
2728
from typing import List
29+
2830
import matplotlib.pyplot as plt
2931
import numpy as np
3032
import pandas as pd
31-
import random
3233
import torch
3334

3435
torch.set_default_dtype(torch.float64)
3536

37+
from simulai.file import SPFile
3638
from simulai.optimization import Optimizer, PIRMSELoss, ScipyInterface
3739
from simulai.residuals import SymbolicOperator
3840
from simulai.templates import NetworkTemplate, guarantee_device
39-
from simulai.file import SPFile
4041

4142
""" Variables """
4243
# Bioreactor
@@ -120,8 +121,8 @@ def Epoch_Decay(iteration_number):
120121
activations_funct = "tanh"
121122

122123
def model():
123-
from simulai.regression import SLFNN, ConvexDenseNetwork
124124
from simulai.models import ImprovedDenseNetwork
125+
from simulai.regression import SLFNN, ConvexDenseNetwork
125126

126127
scale_factors = np.array([1, 1, 1, 1])
127128

@@ -183,10 +184,11 @@ def model_():
183184

184185
torch.set_default_dtype(torch.float64)
185186

186-
from simulai.templates import NetworkTemplate, guarantee_device
187187
import numpy as np
188+
188189
from simulai.models import ImprovedDenseNetwork
189190
from simulai.regression import SLFNN, ConvexDenseNetwork
191+
from simulai.templates import NetworkTemplate, guarantee_device
190192

191193
t_max = 72.0
192194
n_intervals = 72
@@ -198,8 +200,8 @@ def model_():
198200

199201
# Model used for initialization
200202
def sub_model():
201-
from simulai.regression import SLFNN, ConvexDenseNetwork
202203
from simulai.models import ImprovedDenseNetwork
204+
from simulai.regression import SLFNN, ConvexDenseNetwork
203205

204206
scale_factors = np.array([1, 1, 1, 1])
205207

examples/PINN/scripts/Bioreactor_Multifidelity_AutoTimeStep.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,21 @@
2323
"""
2424

2525
""" Import Python Libraries """
26+
import random
2627
from argparse import ArgumentParser
2728
from typing import List
29+
2830
import matplotlib.pyplot as plt
2931
import numpy as np
3032
import pandas as pd
31-
import random
3233
import torch
3334

3435
torch.set_default_dtype(torch.float64)
3536

37+
from simulai.file import SPFile
3638
from simulai.optimization import Optimizer, PIRMSELoss, ScipyInterface
3739
from simulai.residuals import SymbolicOperator
3840
from simulai.templates import NetworkTemplate, guarantee_device
39-
from simulai.file import SPFile
4041

4142
""" Variables """
4243
# Bioreactor
@@ -147,8 +148,8 @@ def Delta_t(i, last_delta_t):
147148
activations_funct = "tanh"
148149

149150
def model():
150-
from simulai.regression import SLFNN, ConvexDenseNetwork
151151
from simulai.models import ImprovedDenseNetwork
152+
from simulai.regression import SLFNN, ConvexDenseNetwork
152153

153154
scale_factors = np.array([1, 1, 1, 1])
154155

@@ -210,10 +211,11 @@ def model_():
210211

211212
torch.set_default_dtype(torch.float64)
212213

213-
from simulai.templates import NetworkTemplate, guarantee_device
214214
import numpy as np
215+
215216
from simulai.models import ImprovedDenseNetwork
216217
from simulai.regression import SLFNN, ConvexDenseNetwork
218+
from simulai.templates import NetworkTemplate, guarantee_device
217219

218220
depth = 3
219221
width = 50
@@ -222,8 +224,8 @@ def model_():
222224

223225
# Model used for initialization
224226
def sub_model():
225-
from simulai.regression import SLFNN, ConvexDenseNetwork
226227
from simulai.models import ImprovedDenseNetwork
228+
from simulai.regression import SLFNN, ConvexDenseNetwork
227229

228230
scale_factors = np.array([1, 1, 1, 1])
229231

examples/PINN/scripts/Bioreactor_Multifidelity_AutoTimeStep_mod.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,22 @@
2323
"""
2424

2525
""" Import Python Libraries """
26+
import random
2627
from argparse import ArgumentParser
2728
from typing import List
29+
2830
import matplotlib.pyplot as plt
2931
import numpy as np
3032
import pandas as pd
31-
import random
3233
import torch
3334

3435
torch.set_default_dtype(torch.float64)
3536

3637
from simulai import ARRAY_DTYPE
38+
from simulai.file import SPFile
3739
from simulai.optimization import Optimizer, PIRMSELoss, ScipyInterface
3840
from simulai.residuals import SymbolicOperator
3941
from simulai.templates import NetworkTemplate, guarantee_device
40-
from simulai.file import SPFile
4142

4243
""" Variables """
4344
# Bioreactor
@@ -148,8 +149,8 @@ def Delta_t(i, last_delta_t):
148149
activations_funct = "tanh"
149150

150151
def model():
151-
from simulai.regression import SLFNN, ConvexDenseNetwork
152152
from simulai.models import ImprovedDenseNetwork
153+
from simulai.regression import SLFNN, ConvexDenseNetwork
153154

154155
# Configuration for the fully-connected network
155156
config = {
@@ -217,10 +218,11 @@ def model_():
217218

218219
torch.set_default_dtype(torch.float64)
219220

220-
from simulai.templates import NetworkTemplate, guarantee_device
221221
import numpy as np
222+
222223
from simulai.models import ImprovedDenseNetwork
223224
from simulai.regression import SLFNN, ConvexDenseNetwork
225+
from simulai.templates import NetworkTemplate, guarantee_device
224226

225227
depth = 3
226228
width = 50
@@ -229,8 +231,8 @@ def model_():
229231

230232
# Model used for initialization
231233
def sub_model():
232-
from simulai.regression import SLFNN, ConvexDenseNetwork
233234
from simulai.models import ImprovedDenseNetwork
235+
from simulai.regression import SLFNN, ConvexDenseNetwork
234236

235237
# Configuration for the fully-connected network
236238
config = {

0 commit comments

Comments
 (0)