Skip to content

Commit

Permalink
Run isort on recently added or modified files
Browse files Browse the repository at this point in the history
  • Loading branch information
lbianchi-lbl committed Dec 13, 2023
1 parent d8af08b commit 0f8146a
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 116 deletions.
3 changes: 2 additions & 1 deletion foqus_lib/framework/graph/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ def attempt_load_smt(try_imports=True):
try:
assert try_imports # if False will auto-trigger exceptions
# smt should be installed, but not required for non ML/AI models
import smt
import pickle

import smt

smt_pickle_load = pickle.load

# throw warning if manually failed for test or if package actually not available
Expand Down
14 changes: 6 additions & 8 deletions foqus_lib/framework/sdoe/test/test_plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@
# respectively. This file is also available online at the URL
# "https://github.com/CCSI-Toolset/FOQUS".
#################################################################################
import matplotlib.pyplot as plt
import pandas as pd
import pytest
from foqus_lib.framework.sdoe import sdoe, nusf, plot_utils, df_utils
from unittest import mock
from importlib import resources
from pathlib import Path
import configparser
import json
from importlib import resources
from pathlib import Path
from unittest import mock

import matplotlib.pyplot as plt
import pandas as pd
import pytest

from foqus_lib.framework.sdoe import plot_utils
from foqus_lib.framework.sdoe import df_utils, nusf, plot_utils, sdoe


@mock.patch("foqus_lib.framework.sdoe.plot_utils.plt")
Expand Down
47 changes: 22 additions & 25 deletions foqus_lib/framework/surrogate/keras_nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,37 @@
"""


from contextlib import nullcontext
from tokenize import String
from pathlib import Path
import numpy as np
import pandas as pd
import threading
import queue
import contextlib
import copy
import io
import logging
import subprocess
import math
import os
import queue
import random as rn
import re
import shutil
import subprocess
import sys
import copy
import traceback
import threading
import time
import shutil
import re
import math
import io
import contextlib
import traceback
from contextlib import nullcontext
from multiprocessing.connection import Client
from pathlib import Path
from tokenize import String

import numpy as np
import pandas as pd
import tensorflow as tf # pylint: disable=import-error

from foqus_lib.framework.listen import listen
from foqus_lib.framework.session.session import exePath

try:
import win32api # used to get short file name for alamo sim exe
import win32process
except:
pass
# from foqus_lib.framework.graph.graph import Graph
from foqus_lib.framework.surrogate.surrogate import surrogate
from foqus_lib.framework.uq.SurrogateParser import SurrogateParser
from foqus_lib.framework.listen import listen
from foqus_lib.framework.session.session import exePath
from multiprocessing.connection import Client

import random as rn
import tensorflow as tf # pylint: disable=import-error

# custom class to define Keras NN layers
@tf.keras.utils.register_keras_serializable()
Expand Down
46 changes: 21 additions & 25 deletions foqus_lib/framework/surrogate/pytorch_nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,36 @@
"""


from contextlib import nullcontext
from tokenize import String
from pathlib import Path
import numpy as np
import pandas as pd
import threading
import queue
import copy
import logging
import subprocess
import math
import os
import queue
import random as rn
import re
import shutil
import subprocess
import sys
import copy
import traceback
import threading
import time
import shutil
import re
import math

try:
import win32api # used to get short file name for alamo sim exe
import win32process
except:
pass
# from foqus_lib.framework.graph.graph import Graph
from foqus_lib.framework.surrogate.surrogate import surrogate
from foqus_lib.framework.uq.SurrogateParser import SurrogateParser
from foqus_lib.framework.listen import listen
from foqus_lib.framework.session.session import exePath
import traceback
from contextlib import nullcontext
from multiprocessing.connection import Client
from pathlib import Path
from tokenize import String

import random as rn
import numpy as np
import pandas as pd
import torch # pylint: disable=import-error
import torch.nn as nn # pylint: disable=import-error

from foqus_lib.framework.listen import listen
from foqus_lib.framework.session.session import exePath

# from foqus_lib.framework.graph.graph import Graph
from foqus_lib.framework.surrogate.surrogate import surrogate
from foqus_lib.framework.uq.SurrogateParser import SurrogateParser

# custom class to define Keras NN layers
np.random.seed(46)
rn.seed(1342)
Expand Down
48 changes: 22 additions & 26 deletions foqus_lib/framework/surrogate/scikit_nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,36 @@
"""


from contextlib import nullcontext
from tokenize import String
from pathlib import Path
import numpy as np
import pandas as pd
import threading
import queue
import copy
import logging
import subprocess
import math
import os
import pickle
import queue
import random as rn
import re
import shutil
import subprocess
import sys
import copy
import traceback
import threading
import time
import shutil
import re
import math
import traceback
from contextlib import nullcontext
from multiprocessing.connection import Client
from pathlib import Path
from tokenize import String
from types import SimpleNamespace

import numpy as np
import pandas as pd
from sklearn.neural_network import MLPRegressor # pylint: disable=import-error

try:
import win32api # used to get short file name for alamo sim exe
import win32process
except:
pass
# from foqus_lib.framework.graph.graph import Graph
from foqus_lib.framework.surrogate.surrogate import surrogate
from foqus_lib.framework.uq.SurrogateParser import SurrogateParser
from foqus_lib.framework.listen import listen
from foqus_lib.framework.session.session import exePath
from multiprocessing.connection import Client

import random as rn
from sklearn.neural_network import MLPRegressor # pylint: disable=import-error
import pickle
from types import SimpleNamespace
# from foqus_lib.framework.graph.graph import Graph
from foqus_lib.framework.surrogate.surrogate import surrogate
from foqus_lib.framework.uq.SurrogateParser import SurrogateParser


def validate_training_data(xdata: np.ndarray, zdata: np.ndarray):
Expand Down
6 changes: 3 additions & 3 deletions foqus_lib/framework/surrogate/surrogate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
import os
import queue
import threading
from typing import Tuple

import pandas as pd

import foqus_lib.framework.uq.SurrogateParser
from foqus_lib.framework.foqusOptions.optionList import optionList

from typing import Tuple
import pandas as pd


class surrogate(threading.Thread):
"""
Expand Down
3 changes: 2 additions & 1 deletion foqus_lib/gui/sdoe/sdoeAnalysisDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
from foqus_lib.framework.sdoe import order, sdoe
from foqus_lib.framework.sdoe.df_utils import load
from foqus_lib.framework.sdoe.plot_utils import plot_pareto

from .sdoePreview import Window, sdoePreview
from .sdoeSetupFrame import *
from .sdoePreview import sdoePreview, Window

mypath = os.path.dirname(__file__)
_sdoeAnalysisDialogUI, _sdoeAnalysisDialog = uic.loadUiType(
Expand Down
16 changes: 7 additions & 9 deletions foqus_lib/gui/sdoe/sdoePreview.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,21 @@

from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar

from foqus_lib.framework.uq.Model import Model
from foqus_lib.framework.sdoe import plot_utils
from foqus_lib.framework.uq.Model import Model

from PyQt5 import uic
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QColor, QCursor
from PyQt5.QtWidgets import (
QAbstractItemView,
QApplication,
QDialog,
QVBoxLayout,
QHBoxLayout,
QListWidgetItem,
QAbstractItemView,
QApplication,
QTableWidgetItem,
QVBoxLayout,
)
from PyQt5.QtGui import QCursor, QColor

from foqus_lib.framework.sdoe import plot_utils
from foqus_lib.framework.uq.Model import Model

mypath = os.path.dirname(__file__)
_sdoePreviewUI, _sdoePreview = uic.loadUiType(os.path.join(mypath, "sdoePreview_UI.ui"))
Expand Down
4 changes: 2 additions & 2 deletions foqus_lib/gui/tests/test_surrogate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# "https://github.com/CCSI-Toolset/FOQUS".
#################################################################################

from foqus_lib.gui.main.mainWindow import mainWindow
from foqus_lib.gui.surrogate.surrogateFrame import surrogateFrame
import pytest

from foqus_lib.gui.main.mainWindow import mainWindow
from foqus_lib.gui.surrogate.surrogateFrame import surrogateFrame

pytestmark = pytest.mark.gui

Expand Down
21 changes: 5 additions & 16 deletions foqus_lib/unit_test/node_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,10 @@
# respectively. This file is also available online at the URL
# "https://github.com/CCSI-Toolset/FOQUS".
#################################################################################
from foqus_lib.framework.graph.node import (
attempt_load_tensorflow,
attempt_load_sympy,
attempt_load_pytorch,
attempt_load_sklearn,
attempt_load_smt,
pymodel_ml_ai,
Node,
NodeEx,
)

from foqus_lib.framework.graph.graph import Graph
from foqus_lib.framework.graph.nodeModelTypes import nodeModelTypes
from foqus_lib.framework.pymodel.pymodel import pymodel
from foqus_lib.framework.pymodel import pymodel_test

import os
import sys
import unittest
from collections import OrderedDict
from importlib import import_module
from pathlib import Path
from typing import List, Tuple
Expand All @@ -40,6 +28,7 @@
NodeEx,
attempt_load_pytorch,
attempt_load_sklearn,
attempt_load_smt,
attempt_load_sympy,
attempt_load_tensorflow,
pymodel_ml_ai,
Expand Down

0 comments on commit 0f8146a

Please sign in to comment.