Skip to content

Commit

Permalink
Running under black and isort
Browse files Browse the repository at this point in the history
Signed-off-by: João Lucas de Sousa Almeida <[email protected]>
  • Loading branch information
Joao-L-S-Almeida committed Mar 6, 2024
1 parent b825bbe commit b8199f2
Show file tree
Hide file tree
Showing 82 changed files with 539 additions and 503 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@


import os

import matplotlib.pyplot as plt
import numpy as np

from simulai.file import SPFile
from simulai.optimization import Optimizer
from simulai.residuals import SymbolicOperator

# In[3]:


from simulai.file import SPFile
from simulai.optimization import Optimizer
from simulai.residuals import SymbolicOperator


# #### Basic configuration
Expand Down Expand Up @@ -281,7 +282,6 @@ def model():

from scipy.integrate import odeint


# #### Pendulum numerical solver

# In[ ]:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import numpy as np
import torch

from simulai.optimization import Optimizer
from simulai.residuals import SymbolicOperator
from simulai.tokens import Dot, Gp
from simulai.optimization import Optimizer


def model():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
import matplotlib.pyplot as plt
import numpy as np

from examples.utils.oscillator_solver import (
oscillator_solver,
oscillator_solver_forcing,
)
from examples.utils.oscillator_solver import (oscillator_solver,
oscillator_solver_forcing)
from simulai.models import ModelPool
from simulai.regression import EchoStateNetwork
from simulai.utilities import make_temp_directory
Expand Down
7 changes: 2 additions & 5 deletions examples/MapValid/map_valid_reshaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@
from simulai.io import BatchCopy, MapValid
from simulai.metrics import L2Norm, MemorySizeEval
from simulai.models import ModelPool
from simulai.normalization import (
BatchNormalization,
UnitaryNormalization,
UnitarySymmetricalNormalization,
)
from simulai.normalization import (BatchNormalization, UnitaryNormalization,
UnitarySymmetricalNormalization)
from simulai.rom import IPOD
from simulai.simulation import Pipeline

Expand Down
1 change: 0 additions & 1 deletion examples/OpInf/scripts/lorenz_96_chaotic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import os

#!/usr/bin/env python
import warnings

Expand Down
1 change: 0 additions & 1 deletion examples/OpInf/scripts/lorenz_96_chaotic_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import os
import time

#!/usr/bin/env python
import warnings

Expand Down
1 change: 0 additions & 1 deletion examples/OpInf/scripts/lorenz_96_stability.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import os
import pickle

#!/usr/bin/env python
import warnings
from argparse import ArgumentParser
Expand Down
8 changes: 2 additions & 6 deletions examples/OpInf/scripts/opinf_nonlinear_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@
from examples.utils.lorenz_solver import lorenz_solver
from simulai.math.integration import LSODA, ClassWrapper
from simulai.optimization import Optimizer, ScipyInterface
from simulai.regression import (
AutoEncoderKoopman,
DenseNetwork,
KoopmanNetwork,
OpInfNetwork,
)
from simulai.regression import (AutoEncoderKoopman, DenseNetwork,
KoopmanNetwork, OpInfNetwork)


class LorenzJacobian:
Expand Down
1 change: 0 additions & 1 deletion examples/OpInf/scripts/svd_lorenz_96_chaotic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import os

#!/usr/bin/env python
import warnings

Expand Down
4 changes: 2 additions & 2 deletions examples/PINN/scripts/Bioreactor/001-Bioreactor_ODEs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"""

""" Python Libraries"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.integrate import solve_ivp

""" Kinetics constants"""
Expand Down
14 changes: 8 additions & 6 deletions examples/PINN/scripts/Bioreactor/002-Bioreactor_PINN.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,25 @@
"""

""" Import Python Libraries """
import math
import os
import random
from argparse import ArgumentParser
from typing import List

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import math
import random
import torch

torch.set_default_dtype(torch.float64)
torch.set_default_tensor_type(torch.DoubleTensor)

from simulai import ARRAY_DTYPE
from simulai.file import SPFile
from simulai.optimization import Optimizer, PIRMSELoss, ScipyInterface
from simulai.residuals import SymbolicOperator
from simulai.templates import NetworkTemplate, guarantee_device
from simulai.file import SPFile

"""#########################################################################"""
"""REPRODUCIBILITY """
Expand Down Expand Up @@ -301,8 +302,8 @@ def adaptative_scale_factors(alpha: float = None):
activations_funct = "tanh"

def model():
from simulai.regression import SLFNN, ConvexDenseNetwork
from simulai.models import ImprovedDenseNetwork
from simulai.regression import SLFNN, ConvexDenseNetwork

# Configuration for the fully-connected network
config = {
Expand Down Expand Up @@ -370,10 +371,11 @@ def model_():

torch.set_default_dtype(torch.float64)

from simulai.templates import NetworkTemplate, guarantee_device
import numpy as np

from simulai.models import ImprovedDenseNetwork
from simulai.regression import SLFNN, ConvexDenseNetwork
from simulai.templates import NetworkTemplate, guarantee_device

depth = 3
width = 64
Expand All @@ -382,8 +384,8 @@ def model_():

# Model used for initialization
def sub_model():
from simulai.regression import SLFNN, ConvexDenseNetwork
from simulai.models import ImprovedDenseNetwork
from simulai.regression import SLFNN, ConvexDenseNetwork

# Configuration for the fully-connected network
config = {
Expand Down
12 changes: 7 additions & 5 deletions examples/PINN/scripts/Bioreactor_Multifidelity.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@
"""

""" Import Python Libraries """
import random
from argparse import ArgumentParser
from typing import List

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import random
import torch

torch.set_default_dtype(torch.float64)

from simulai.file import SPFile
from simulai.optimization import Optimizer, PIRMSELoss, ScipyInterface
from simulai.residuals import SymbolicOperator
from simulai.templates import NetworkTemplate, guarantee_device
from simulai.file import SPFile

""" Variables """
# Bioreactor
Expand Down Expand Up @@ -120,8 +121,8 @@ def Epoch_Decay(iteration_number):
activations_funct = "tanh"

def model():
from simulai.regression import SLFNN, ConvexDenseNetwork
from simulai.models import ImprovedDenseNetwork
from simulai.regression import SLFNN, ConvexDenseNetwork

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

Expand Down Expand Up @@ -183,10 +184,11 @@ def model_():

torch.set_default_dtype(torch.float64)

from simulai.templates import NetworkTemplate, guarantee_device
import numpy as np

from simulai.models import ImprovedDenseNetwork
from simulai.regression import SLFNN, ConvexDenseNetwork
from simulai.templates import NetworkTemplate, guarantee_device

t_max = 72.0
n_intervals = 72
Expand All @@ -198,8 +200,8 @@ def model_():

# Model used for initialization
def sub_model():
from simulai.regression import SLFNN, ConvexDenseNetwork
from simulai.models import ImprovedDenseNetwork
from simulai.regression import SLFNN, ConvexDenseNetwork

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

Expand Down
12 changes: 7 additions & 5 deletions examples/PINN/scripts/Bioreactor_Multifidelity_AutoTimeStep.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@
"""

""" Import Python Libraries """
import random
from argparse import ArgumentParser
from typing import List

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import random
import torch

torch.set_default_dtype(torch.float64)

from simulai.file import SPFile
from simulai.optimization import Optimizer, PIRMSELoss, ScipyInterface
from simulai.residuals import SymbolicOperator
from simulai.templates import NetworkTemplate, guarantee_device
from simulai.file import SPFile

""" Variables """
# Bioreactor
Expand Down Expand Up @@ -147,8 +148,8 @@ def Delta_t(i, last_delta_t):
activations_funct = "tanh"

def model():
from simulai.regression import SLFNN, ConvexDenseNetwork
from simulai.models import ImprovedDenseNetwork
from simulai.regression import SLFNN, ConvexDenseNetwork

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

Expand Down Expand Up @@ -210,10 +211,11 @@ def model_():

torch.set_default_dtype(torch.float64)

from simulai.templates import NetworkTemplate, guarantee_device
import numpy as np

from simulai.models import ImprovedDenseNetwork
from simulai.regression import SLFNN, ConvexDenseNetwork
from simulai.templates import NetworkTemplate, guarantee_device

depth = 3
width = 50
Expand All @@ -222,8 +224,8 @@ def model_():

# Model used for initialization
def sub_model():
from simulai.regression import SLFNN, ConvexDenseNetwork
from simulai.models import ImprovedDenseNetwork
from simulai.regression import SLFNN, ConvexDenseNetwork

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,22 @@
"""

""" Import Python Libraries """
import random
from argparse import ArgumentParser
from typing import List

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import random
import torch

torch.set_default_dtype(torch.float64)

from simulai import ARRAY_DTYPE
from simulai.file import SPFile
from simulai.optimization import Optimizer, PIRMSELoss, ScipyInterface
from simulai.residuals import SymbolicOperator
from simulai.templates import NetworkTemplate, guarantee_device
from simulai.file import SPFile

""" Variables """
# Bioreactor
Expand Down Expand Up @@ -148,8 +149,8 @@ def Delta_t(i, last_delta_t):
activations_funct = "tanh"

def model():
from simulai.regression import SLFNN, ConvexDenseNetwork
from simulai.models import ImprovedDenseNetwork
from simulai.regression import SLFNN, ConvexDenseNetwork

# Configuration for the fully-connected network
config = {
Expand Down Expand Up @@ -217,10 +218,11 @@ def model_():

torch.set_default_dtype(torch.float64)

from simulai.templates import NetworkTemplate, guarantee_device
import numpy as np

from simulai.models import ImprovedDenseNetwork
from simulai.regression import SLFNN, ConvexDenseNetwork
from simulai.templates import NetworkTemplate, guarantee_device

depth = 3
width = 50
Expand All @@ -229,8 +231,8 @@ def model_():

# Model used for initialization
def sub_model():
from simulai.regression import SLFNN, ConvexDenseNetwork
from simulai.models import ImprovedDenseNetwork
from simulai.regression import SLFNN, ConvexDenseNetwork

# Configuration for the fully-connected network
config = {
Expand Down
Loading

0 comments on commit b8199f2

Please sign in to comment.