From 6694f809c09ce75c3d4048f7f6628bbdd5cccee2 Mon Sep 17 00:00:00 2001 From: Ludovico Bianchi Date: Wed, 13 Dec 2023 10:22:44 -0600 Subject: [PATCH] Enable CI static check to enforce consistent import order (#1170) * Enable wrong-import-order Pylint check * Investigate why enabled check is not enforced * Edit CLI flags on the command that actually gets run * Make pytest jobs dependent on pylint * Run isort 5.12.0 * Run Black * Move conditional imports after normal imports to allow isort to work * Run isort --profile=black * Fix remaining file * Run isort on recently added or modified files --- .github/actions/pylint/action.yml | 2 +- .github/workflows/checks.yml | 4 +- foqus_lib/conftest.py | 3 +- foqus_lib/foqus.py | 32 +++++---- foqus_lib/framework/graph/OptGraphOptim.py | 8 ++- foqus_lib/framework/graph/graph.py | 24 +++---- foqus_lib/framework/graph/heatIntegration.py | 3 +- foqus_lib/framework/graph/node.py | 22 ++++--- foqus_lib/framework/graph/nodeVars.py | 10 +-- foqus_lib/framework/listen/listen.py | 5 +- .../framework/ml_ai_models/mlaiSearch.py | 6 +- foqus_lib/framework/optimizer/BFGS.py | 12 ++-- foqus_lib/framework/optimizer/NLopt.py | 12 ++-- foqus_lib/framework/optimizer/OptCMA.py | 12 ++-- foqus_lib/framework/optimizer/OptSNOBFIT.py | 4 +- foqus_lib/framework/optimizer/PSUADE.py | 17 +++-- foqus_lib/framework/optimizer/SLSQP.py | 12 ++-- foqus_lib/framework/optimizer/SM_Optimizer.py | 39 +++++------ foqus_lib/framework/optimizer/Sample.py | 10 +-- foqus_lib/framework/optimizer/Snobfit.py | 17 ++--- foqus_lib/framework/optimizer/optimization.py | 14 ++-- foqus_lib/framework/optimizer/problem.py | 9 +-- foqus_lib/framework/ouu/OUU.py | 12 ++-- foqus_lib/framework/plugins/pluginSearch.py | 6 +- .../framework/pymodel/heat_integration.py | 6 +- foqus_lib/framework/pymodel/matlab_fs.py | 5 +- foqus_lib/framework/pymodel/pymodel.py | 4 +- foqus_lib/framework/pymodel/pymodel_test.py | 3 +- foqus_lib/framework/pymodel/steam_cycle.py | 3 +- foqus_lib/framework/sampleResults/results.py | 11 ++-- .../sampleResults/test/results_s3_test.py | 3 +- foqus_lib/framework/sdoe/irsf.py | 8 ++- foqus_lib/framework/sdoe/nusf.py | 6 +- foqus_lib/framework/sdoe/odoeu.py | 8 +-- foqus_lib/framework/sdoe/order.py | 2 + foqus_lib/framework/sdoe/plot_utils.py | 7 +- foqus_lib/framework/sdoe/sdoe.py | 13 ++-- .../framework/sdoe/test/test_distance.py | 9 ++- foqus_lib/framework/sdoe/test/test_irsf.py | 6 +- foqus_lib/framework/sdoe/test/test_nusf.py | 2 + foqus_lib/framework/sdoe/test/test_order.py | 3 +- .../framework/sdoe/test/test_plot_utils.py | 14 ++-- foqus_lib/framework/sdoe/test/test_sdoe.py | 3 +- foqus_lib/framework/sdoe/test/test_usf.py | 2 + foqus_lib/framework/sdoe/usf.py | 6 +- foqus_lib/framework/session/session.py | 23 +++---- foqus_lib/framework/sim/process_management.py | 3 +- .../framework/sim/turbineConfiguration.py | 54 +++++++-------- foqus_lib/framework/sim/turbineLiteDB.py | 5 +- .../sintervectorize/SinterFileVectorize.py | 8 +-- foqus_lib/framework/solventfit/SolventFit.py | 9 +-- .../solventfit/SolventFit_testing.py | 15 +++-- .../framework/solventfit/solvfit_calibfit.py | 1 + .../framework/solventfit/solvfit_calibpred.py | 1 + .../framework/solventfit/solvfit_emulfit.py | 1 + .../framework/solventfit/solvfit_emulpred.py | 1 + .../framework/solventfit/test_solventfit.py | 1 + foqus_lib/framework/surrogate/ACOSSO.py | 24 +++---- foqus_lib/framework/surrogate/ALAMO.py | 33 +++++----- foqus_lib/framework/surrogate/BSS-ANOVA.py | 24 +++---- .../framework/surrogate/acosso/acosso_fit.py | 1 + .../surrogate/bssanova/bssanova_fit.py | 1 + .../framework/surrogate/foqusALAMOClient.py | 5 +- foqus_lib/framework/surrogate/keras_nn.py | 47 +++++++------ foqus_lib/framework/surrogate/pytorch_nn.py | 46 ++++++------- foqus_lib/framework/surrogate/scikit_nn.py | 48 +++++++------- foqus_lib/framework/surrogate/surrogate.py | 13 ++-- foqus_lib/framework/uq/Common.py | 10 +-- foqus_lib/framework/uq/CorrelationAnalysis.py | 4 +- foqus_lib/framework/uq/DataProcessor.py | 7 +- foqus_lib/framework/uq/ExperimentalDesign.py | 12 ++-- .../framework/uq/LocalExecutionModule.py | 28 ++++---- foqus_lib/framework/uq/Model.py | 6 +- foqus_lib/framework/uq/ParameterScreening.py | 4 +- foqus_lib/framework/uq/Plotter.py | 7 +- foqus_lib/framework/uq/RSAnalyzer.py | 22 ++++--- foqus_lib/framework/uq/RSInference.py | 18 ++--- .../framework/uq/RSSensitivityAnalysis.py | 6 +- .../framework/uq/RSUncertaintyAnalysis.py | 6 +- foqus_lib/framework/uq/RSValidation.py | 9 +-- foqus_lib/framework/uq/RSVisualization.py | 5 +- foqus_lib/framework/uq/RawDataAnalyzer.py | 10 +-- foqus_lib/framework/uq/SampleData.py | 10 +-- foqus_lib/framework/uq/SampleRefiner.py | 10 +-- foqus_lib/framework/uq/SensitivityAnalysis.py | 4 +- foqus_lib/framework/uq/SurrogateParser.py | 7 +- foqus_lib/framework/uq/UQRSAnalysis.py | 3 +- foqus_lib/framework/uq/UncertaintyAnalysis.py | 4 +- foqus_lib/framework/uq/Visualization.py | 3 +- foqus_lib/framework/uq/Visualizer.py | 12 ++-- foqus_lib/framework/uq/flowsheetToUQModel.py | 2 +- foqus_lib/gui/basic_data/basicDataFrame.py | 5 +- .../gui/basic_data/basicDataParentFrame.py | 2 +- foqus_lib/gui/common/InputPriorTable.py | 17 ++--- foqus_lib/gui/flowsheet/calculatedColumns.py | 3 +- foqus_lib/gui/flowsheet/columns.py | 1 + foqus_lib/gui/flowsheet/dataBrowserDialog.py | 3 +- foqus_lib/gui/flowsheet/dataBrowserFrame.py | 19 +++--- foqus_lib/gui/flowsheet/dataFilterDialog.py | 16 ++--- foqus_lib/gui/flowsheet/dataModel.py | 3 +- foqus_lib/gui/flowsheet/drawFlowsheet.py | 10 +-- foqus_lib/gui/flowsheet/edgePanel.py | 2 +- .../gui/flowsheet/flowsheetSettingsDialog.py | 1 + foqus_lib/gui/flowsheet/nodePanel.py | 19 +++--- foqus_lib/gui/flowsheet/runRowsDialog.py | 1 + .../heatIntegration/heatIntegrationFrame.py | 1 + foqus_lib/gui/help/helpBrowser.py | 19 +++--- foqus_lib/gui/helpers/guiHelpers.py | 9 +-- foqus_lib/gui/main/mainWindow.py | 66 ++++++++++--------- foqus_lib/gui/main/saveMetadataDialog.py | 3 +- foqus_lib/gui/main/sessionDescriptionEdit.py | 4 +- foqus_lib/gui/main/settingsFrame.py | 22 +++---- foqus_lib/gui/main/turbineConfig.py | 8 ++- foqus_lib/gui/make_shortcut.py | 2 +- foqus_lib/gui/model/dmfUploadDialog.py | 47 ++++++------- foqus_lib/gui/model/gatewayUploadDialog.py | 10 +-- .../gui/optimization/optMessageWindow.py | 1 + foqus_lib/gui/optimization/optMonitor.py | 16 +++-- .../gui/optimization/optSampleGenDialog.py | 4 +- foqus_lib/gui/optimization/optSetupFrame.py | 12 ++-- foqus_lib/gui/ouu/foqusPSUADEClient.py | 1 + foqus_lib/gui/ouu/ouuSetupFrame.py | 46 ++++++------- foqus_lib/gui/pysyntax_hl/pysyntax_hl.py | 3 +- foqus_lib/gui/sdoe/odoeSimSetup.py | 25 +++---- foqus_lib/gui/sdoe/sdoeAnalysisDialog.py | 23 +++---- foqus_lib/gui/sdoe/sdoePreview.py | 15 ++--- foqus_lib/gui/sdoe/sdoeSetupFrame.py | 59 ++++++++--------- foqus_lib/gui/sdoe/sdoeSimSetup.py | 25 +++---- foqus_lib/gui/sdoe/updateSDOEModelDialog.py | 8 +-- foqus_lib/gui/sinter/sinter_config.py | 13 ++-- .../sintervectorize/SinterVectorizeDialog.py | 14 ++-- .../gui/solventfit/solventFitSetupFrame.py | 33 +++++----- foqus_lib/gui/surrogate/surrogateFrame.py | 15 +++-- foqus_lib/gui/tests/conftest.py | 8 +-- foqus_lib/gui/tests/test_main_window.py | 1 - foqus_lib/gui/tests/test_ml_ai.py | 9 ++- foqus_lib/gui/tests/test_ouu.py | 16 ++--- foqus_lib/gui/tests/test_plugins.py | 9 ++- foqus_lib/gui/tests/test_sdoe.py | 11 ++-- foqus_lib/gui/tests/test_surrogate.py | 4 +- foqus_lib/gui/tests/test_uq.py | 11 ++-- foqus_lib/gui/uq/AnalysisDialog.py | 60 +++++++++-------- foqus_lib/gui/uq/AnalysisInfoDialog.py | 12 ++-- foqus_lib/gui/uq/InferenceDialog.py | 25 +++---- foqus_lib/gui/uq/Preview.py | 27 ++++---- foqus_lib/gui/uq/RSCombos.py | 3 +- foqus_lib/gui/uq/SimSetup.py | 44 +++++++------ foqus_lib/gui/uq/dialogTest.py | 3 +- foqus_lib/gui/uq/stopEnsembleDialog.py | 1 + foqus_lib/gui/uq/updateUQModelDialog.py | 22 +++---- foqus_lib/gui/uq/uqDataBrowserFrame.py | 1 + foqus_lib/gui/uq/uqSetupFrame.py | 62 ++++++++--------- foqus_lib/service/flowsheet.py | 33 ++++++---- .../service/test/flowsheet_control_test.py | 13 ++-- foqus_lib/unit_test/massBalance_test.py | 10 +-- foqus_lib/unit_test/nodeVarList_test.py | 8 ++- foqus_lib/unit_test/nodeVars_test.py | 8 ++- foqus_lib/unit_test/node_test.py | 32 ++++----- foqus_lib/unit_test/turbineLite_test.py | 10 +-- 159 files changed, 1096 insertions(+), 945 deletions(-) diff --git a/.github/actions/pylint/action.yml b/.github/actions/pylint/action.yml index 54d87b123..7d7e4be1b 100644 --- a/.github/actions/pylint/action.yml +++ b/.github/actions/pylint/action.yml @@ -15,6 +15,6 @@ runs: shell: bash run: | echo '::group::Output of pylint' - pylint --rcfile=.pylint/pylintrc --disable=W,C,R,I foqus_lib/ + pylint --rcfile=.pylint/pylintrc --disable=all --enable=E --enable=wrong-import-order foqus_lib/ echo '::endgroup::' diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 05ecb8dfe..12f343d3e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -59,7 +59,7 @@ jobs: config: .typos.toml pytest: name: pytest (py${{ matrix.python-version }}/${{ matrix.os }}) - needs: [code-formatting, spell-check] + needs: [spell-check, code-formatting, pylint] runs-on: ${{ matrix.os-version }} strategy: fail-fast: false @@ -148,7 +148,7 @@ jobs: pip-install-target: -r requirements-dev.txt - name: Run pylint run: | - pylint --rcfile=.pylint/pylintrc --disable=W,C,R,I foqus_lib/ + pylint --rcfile=.pylint/pylintrc --disable=all --enable=E --enable=wrong-import-order foqus_lib/ docs: name: Build docs diff --git a/foqus_lib/conftest.py b/foqus_lib/conftest.py index 783095f87..4eb4ef938 100644 --- a/foqus_lib/conftest.py +++ b/foqus_lib/conftest.py @@ -14,9 +14,10 @@ ################################################################################# import contextlib import os -from pathlib import Path import shutil import zipfile +from pathlib import Path + import pytest diff --git a/foqus_lib/foqus.py b/foqus_lib/foqus.py index 3dd14970a..cb5cfd538 100644 --- a/foqus_lib/foqus.py +++ b/foqus_lib/foqus.py @@ -20,19 +20,20 @@ Keith Beattie, Lawrence Berkeley National Labs, 2020 """ +import argparse +import json +import logging + # Imports import signal -import uuid import sys -import argparse import time -import json -import logging +import uuid # FOQUS imports import foqus_lib.version.version as ver # foqus version and other info -from foqus_lib.framework.session.session import * from foqus_lib.framework.listen.listen import foqusListener2 +from foqus_lib.framework.session.session import * from foqus_lib.gui.make_shortcut import makeShortcut loadGUI = False @@ -56,7 +57,10 @@ def guiImport(mpl_backend="Qt5Agg"): global PyQt5 # GUI Imports try: # Check if the PySide libraries are available + import matplotlib import PyQt5 + import PyQt5.QtCore + import PyQt5.QtGui # QtWidgets, QtGui, and QtCore are used in this module, # but they might not be available in PyQt5 without importing them first @@ -64,9 +68,6 @@ def guiImport(mpl_backend="Qt5Agg"): # from the imports in foqus_lib.framework.session.session # to be on the safe side, we run these imports explicitly here, too import PyQt5.QtWidgets - import PyQt5.QtGui - import PyQt5.QtCore - import matplotlib matplotlib.use(mpl_backend) matplotlib.rcParams["backend"] = mpl_backend @@ -362,8 +363,10 @@ def main(args_to_parse=None): sys.exit(makeShortcut()) if args.terminateConsumer: try: - from foqus_lib.framework.sim.turbineLiteDB import turbineLiteDB - from foqus_lib.framework.sim.turbineLiteDB import keepAliveTimer + from foqus_lib.framework.sim.turbineLiteDB import ( + keepAliveTimer, + turbineLiteDB, + ) fs = generalSettings() # foqus settings fs.load(logging=False) @@ -379,8 +382,10 @@ def main(args_to_parse=None): sys.exit(1) elif args.addTurbineApp: try: - from foqus_lib.framework.sim.turbineLiteDB import turbineLiteDB - from foqus_lib.framework.sim.turbineLiteDB import keepAliveTimer + from foqus_lib.framework.sim.turbineLiteDB import ( + keepAliveTimer, + turbineLiteDB, + ) fs = generalSettings() # foqus settings fs.load(logging=False) @@ -596,8 +601,7 @@ def main(args_to_parse=None): listener.start() listener.join() elif args.consumer: - from foqus_lib.framework.sim.turbineLiteDB import turbineLiteDB - from foqus_lib.framework.sim.turbineLiteDB import keepAliveTimer + from foqus_lib.framework.sim.turbineLiteDB import keepAliveTimer, turbineLiteDB load_gui = False # Make ctrl-c do nothing but and SIGINT donothing but interrupt diff --git a/foqus_lib/framework/graph/OptGraphOptim.py b/foqus_lib/framework/graph/OptGraphOptim.py index 09ee224e4..95077e1af 100644 --- a/foqus_lib/framework/graph/OptGraphOptim.py +++ b/foqus_lib/framework/graph/OptGraphOptim.py @@ -12,11 +12,13 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import numpy -import time import math -from foqus_lib.framework.graph.node import * +import time + +import numpy + from foqus_lib.framework.graph.edge import * +from foqus_lib.framework.graph.node import * class optimObj: diff --git a/foqus_lib/framework/graph/graph.py b/foqus_lib/framework/graph/graph.py index 120bf69f6..ed78382d7 100644 --- a/foqus_lib/framework/graph/graph.py +++ b/foqus_lib/framework/graph/graph.py @@ -21,25 +21,27 @@ John Eslick, Carnegie Mellon University, 2014 """ -import queue -import foqus_lib.framework.sampleResults.results as resultList -import multiprocessing.dummy as multiprocessing -import numpy -import math -import time -import csv import copy -import threading +import csv import logging +import math +import multiprocessing.dummy as multiprocessing +import queue import sys +import threading +import time from collections import OrderedDict + +import numpy +import pandas + +import foqus_lib.framework.sampleResults.results as resultList +from foqus_lib.framework.graph.edge import * # Edge and variable connection classes from foqus_lib.framework.graph.node import * # Node, input var and output var classes from foqus_lib.framework.graph.nodeModelTypes import nodeModelTypes -from foqus_lib.framework.graph.edge import * # Edge and variable connection classes +from foqus_lib.framework.graph.nodeVars import * from foqus_lib.framework.graph.OptGraphOptim import * # Objective function calculation class from foqus_lib.framework.sim.turbineConfiguration import * -from foqus_lib.framework.graph.nodeVars import * -import pandas _log = logging.getLogger("foqus." + __name__) diff --git a/foqus_lib/framework/graph/heatIntegration.py b/foqus_lib/framework/graph/heatIntegration.py index 5770f99ca..cabd50dc0 100644 --- a/foqus_lib/framework/graph/heatIntegration.py +++ b/foqus_lib/framework/graph/heatIntegration.py @@ -12,9 +12,10 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from . import node as gn import subprocess +from . import node as gn + def makeHeatIntegrationNode(node): # setup whatever i need for heat integration diff --git a/foqus_lib/framework/graph/node.py b/foqus_lib/framework/graph/node.py index 62b2e377f..b8786306a 100644 --- a/foqus_lib/framework/graph/node.py +++ b/foqus_lib/framework/graph/node.py @@ -19,19 +19,21 @@ John Eslick, Carnegie Mellon University, 2014 """ -import os import json -import math -import numpy as np import logging -from foqus_lib.framework.pymodel.pymodel import * -from foqus_lib.framework.graph.nodeVars import * -from foqus_lib.framework.graph.nodeModelTypes import nodeModelTypes +import math +import os from collections import OrderedDict +from importlib import import_module + +import numpy as np + +from foqus_lib.framework.at_dict.at_dict import AtDict from foqus_lib.framework.foqusOptions.optionList import optionList +from foqus_lib.framework.graph.nodeModelTypes import nodeModelTypes +from foqus_lib.framework.graph.nodeVars import * +from foqus_lib.framework.pymodel.pymodel import * from foqus_lib.framework.sim.turbineConfiguration import TurbineInterfaceEx -from foqus_lib.framework.at_dict.at_dict import AtDict -from importlib import import_module _logger = logging.getLogger("foqus." + __name__) @@ -146,7 +148,6 @@ def attempt_load_sklearn(try_imports=True): try: assert try_imports # if False will auto-trigger exceptions # sklearn should be installed, but not required for non ML/AI models - import sklearn import pickle skl_pickle_load = pickle.load @@ -168,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 diff --git a/foqus_lib/framework/graph/nodeVars.py b/foqus_lib/framework/graph/nodeVars.py index badb8ca53..922f4a9f5 100644 --- a/foqus_lib/framework/graph/nodeVars.py +++ b/foqus_lib/framework/graph/nodeVars.py @@ -20,12 +20,14 @@ John Eslick, Carnegie Mellon University, 2014 """ -from collections import OrderedDict -import numpy as np +import copy import json -import math import logging -import copy +import math +from collections import OrderedDict + +import numpy as np + from foqus_lib.framework.foqusException.foqusException import * from foqus_lib.framework.uq.Distribution import Distribution diff --git a/foqus_lib/framework/listen/listen.py b/foqus_lib/framework/listen/listen.py index 04de86887..1558e5a11 100644 --- a/foqus_lib/framework/listen/listen.py +++ b/foqus_lib/framework/listen/listen.py @@ -23,12 +23,13 @@ """ +import copy import logging -from multiprocessing.connection import Listener import threading import time +from multiprocessing.connection import Listener + import numpy as np -import copy class foqusListener2(threading.Thread): diff --git a/foqus_lib/framework/ml_ai_models/mlaiSearch.py b/foqus_lib/framework/ml_ai_models/mlaiSearch.py index e20ac1b05..d2461cd29 100644 --- a/foqus_lib/framework/ml_ai_models/mlaiSearch.py +++ b/foqus_lib/framework/ml_ai_models/mlaiSearch.py @@ -20,11 +20,11 @@ John Eslick, Carnegie Mellon University, 2014 """ -import sys -import os +import imp import importlib import logging -import imp +import os +import sys _log = logging.getLogger("foqus." + __name__) diff --git a/foqus_lib/framework/optimizer/BFGS.py b/foqus_lib/framework/optimizer/BFGS.py index 6dacfbbec..98970e99a 100644 --- a/foqus_lib/framework/optimizer/BFGS.py +++ b/foqus_lib/framework/optimizer/BFGS.py @@ -23,17 +23,19 @@ John Eslick, Carnegie Mellon University, 2014 """ -import time import copy import csv -import pickle -import queue -import sys import logging import math -import numpy import os +import pickle +import queue +import sys +import time import traceback + +import numpy + from foqus_lib.framework.optimizer.optimization import optimization # Check that the BFGS python script is available and import it if diff --git a/foqus_lib/framework/optimizer/NLopt.py b/foqus_lib/framework/optimizer/NLopt.py index 96441e0d4..84f394d4e 100644 --- a/foqus_lib/framework/optimizer/NLopt.py +++ b/foqus_lib/framework/optimizer/NLopt.py @@ -25,17 +25,19 @@ John Eslick, Carnegie Mellon University, 2014 """ -import time # Some of these things are left over from CMA-ES import copy # too lazy to sort out which I really need in here import csv -import pickle -import queue -import sys import logging import math -import numpy import os +import pickle +import queue +import sys +import time # Some of these things are left over from CMA-ES import traceback + +import numpy + from foqus_lib.framework.optimizer.optimization import optimization # Check that the NLopt module is available and import it if possible. diff --git a/foqus_lib/framework/optimizer/OptCMA.py b/foqus_lib/framework/optimizer/OptCMA.py index 1ce30f0a0..8a2cb3431 100644 --- a/foqus_lib/framework/optimizer/OptCMA.py +++ b/foqus_lib/framework/optimizer/OptCMA.py @@ -32,17 +32,19 @@ John Eslick, Carnegie Mellon University, 2014 """ -import time import copy import csv -import pickle -import queue -import sys import logging import math -import numpy import os +import pickle +import queue +import sys +import time import traceback + +import numpy + from foqus_lib.framework.optimizer.optimization import optimization # Check that the CMA-ES python script is available and import it if diff --git a/foqus_lib/framework/optimizer/OptSNOBFIT.py b/foqus_lib/framework/optimizer/OptSNOBFIT.py index 102cd47a6..4b5f992a0 100644 --- a/foqus_lib/framework/optimizer/OptSNOBFIT.py +++ b/foqus_lib/framework/optimizer/OptSNOBFIT.py @@ -12,7 +12,9 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import time, copy +import copy +import time + import numpy snobfit_available = True diff --git a/foqus_lib/framework/optimizer/PSUADE.py b/foqus_lib/framework/optimizer/PSUADE.py index b15a874e3..fd0b2a83c 100644 --- a/foqus_lib/framework/optimizer/PSUADE.py +++ b/foqus_lib/framework/optimizer/PSUADE.py @@ -19,19 +19,22 @@ text). They also need to have a .py extension and inherit the optimization class. """ -# -# PSUADE -# -import time import copy import csv -import queue -import sys import logging import math -import numpy import os +import queue +import sys + +# +# PSUADE +# +import time import traceback + +import numpy + from foqus_lib.framework.optimizer.optimization import optimization diff --git a/foqus_lib/framework/optimizer/SLSQP.py b/foqus_lib/framework/optimizer/SLSQP.py index cafad664e..4c34bb157 100644 --- a/foqus_lib/framework/optimizer/SLSQP.py +++ b/foqus_lib/framework/optimizer/SLSQP.py @@ -24,17 +24,19 @@ John Eslick, Carnegie Mellon University, 2014 """ -import time import copy import csv -import pickle -import queue -import sys import logging import math -import numpy import os +import pickle +import queue +import sys +import time import traceback + +import numpy + from foqus_lib.framework.optimizer.optimization import optimization try: diff --git a/foqus_lib/framework/optimizer/SM_Optimizer.py b/foqus_lib/framework/optimizer/SM_Optimizer.py index 89981bf4e..af7674cb0 100644 --- a/foqus_lib/framework/optimizer/SM_Optimizer.py +++ b/foqus_lib/framework/optimizer/SM_Optimizer.py @@ -23,22 +23,23 @@ Anuja Deshpande, KeyLogic Systems, Inc. - NETL """ +import copy import csv -import pickle import importlib -import numpy as np -import threading -import queue import logging -import subprocess +import math import os +import pickle +import queue +import re +import shutil +import subprocess import sys -import copy -import traceback +import threading import time -import shutil -import re -import math +import traceback + +import numpy as np try: import win32api # used to get short file name for alamo sim exe @@ -46,9 +47,9 @@ except: pass -from foqus_lib.framework.optimizer.optimization import optimization -from foqus_lib.framework.graph.nodeVars import NodeVars from foqus_lib.framework.graph.edge import edge, edgeConnect +from foqus_lib.framework.graph.nodeVars import NodeVars +from foqus_lib.framework.optimizer.optimization import optimization from foqus_lib.framework.surrogate.surrogate import surrogate from foqus_lib.framework.uq.SurrogateParser import SurrogateParser @@ -58,24 +59,24 @@ try: # add direct imports (in addition to existing wildcard import) # to make pylint happy without affecting the existing runtime behavior + import pyutilib.subprocess.GlobalData from pyomo.environ import ( - Var, - Objective, + ConcreteModel, Constraint, ConstraintList, - ConcreteModel, + Objective, PositiveReals, - value, - log, + Var, exp, + log, + value, ) from pyomo.opt import SolverFactory - import pyutilib.subprocess.GlobalData pyutilib.subprocess.GlobalData.DEFINE_SIGNAL_HANDLERS_DEFAULT = False + from pyDOE import * from pyomo.core.expr import current as EXPR from pyomo.core.expr.current import clone_expression - from pyDOE import * from smt.sampling_methods import LHS packages_available = True diff --git a/foqus_lib/framework/optimizer/Sample.py b/foqus_lib/framework/optimizer/Sample.py index bd9695f59..59726a402 100644 --- a/foqus_lib/framework/optimizer/Sample.py +++ b/foqus_lib/framework/optimizer/Sample.py @@ -24,16 +24,18 @@ John Eslick, Carnegie Mellon University, 2014 """ -import time import copy import csv -import queue -import sys import logging import math -import numpy import os +import queue +import sys +import time import traceback + +import numpy + from foqus_lib.framework.optimizer.optimization import optimization diff --git a/foqus_lib/framework/optimizer/Snobfit.py b/foqus_lib/framework/optimizer/Snobfit.py index 10584e746..e54616065 100644 --- a/foqus_lib/framework/optimizer/Snobfit.py +++ b/foqus_lib/framework/optimizer/Snobfit.py @@ -23,27 +23,28 @@ Anuja Deshpande, KeyLogic Systems, Inc. - NETL """ -import time import copy import csv -import pickle -import queue -import sys import logging import math -import numpy import os +import pickle +import queue +import sys +import time import traceback -from foqus_lib.framework.optimizer.optimization import optimization -from foqus_lib.framework.graph.OptGraphOptim import optim, optimObj +import numpy + from foqus_lib.framework.graph.nodeVars import NodeVars +from foqus_lib.framework.graph.OptGraphOptim import optim, optimObj +from foqus_lib.framework.optimizer.optimization import optimization # Check that the Snobfit module is available and import it if possible. # If not the Snobfit plug-in will not be available. try: - import SQSnobFit import SQCommon + import SQSnobFit snobfit_available = True except ImportError: diff --git a/foqus_lib/framework/optimizer/optimization.py b/foqus_lib/framework/optimizer/optimization.py index 87133caaa..24e56c41a 100644 --- a/foqus_lib/framework/optimizer/optimization.py +++ b/foqus_lib/framework/optimizer/optimization.py @@ -19,16 +19,18 @@ John Eslick, Carnegie Mellon University, 2014 """ -import queue +import copy +import importlib import logging +import os +import queue +import sys import threading -import copy +import traceback + from foqus_lib.framework.foqusOptions.optionList import optionList + from .problem import * -import sys -import os -import importlib -import traceback class optimization(threading.Thread): diff --git a/foqus_lib/framework/optimizer/problem.py b/foqus_lib/framework/optimizer/problem.py index 53364c5f6..439bbd8dc 100644 --- a/foqus_lib/framework/optimizer/problem.py +++ b/foqus_lib/framework/optimizer/problem.py @@ -20,16 +20,17 @@ """ import copy -import time -import math import csv import json import logging +import math import operator -from foqus_lib.framework.foqusOptions.optionList import optionList -from foqus_lib.framework.at_dict.at_dict import AtDict +import time from functools import reduce +from foqus_lib.framework.at_dict.at_dict import AtDict +from foqus_lib.framework.foqusOptions.optionList import optionList + class objectiveFunction(object): def __init__(self, pycode="", ps=1, failval=1000): diff --git a/foqus_lib/framework/ouu/OUU.py b/foqus_lib/framework/ouu/OUU.py index fd8412111..670edf527 100644 --- a/foqus_lib/framework/ouu/OUU.py +++ b/foqus_lib/framework/ouu/OUU.py @@ -13,18 +13,20 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os -import subprocess -import tempfile import platform import re +import subprocess +import tempfile + import numpy as np from PyQt5 import QtCore, QtGui -from foqus_lib.framework.uq.Model import Model -from foqus_lib.framework.uq.Distribution import Distribution -from foqus_lib.framework.uq.SampleData import SampleData + from foqus_lib.framework.uq.Common import Common +from foqus_lib.framework.uq.Distribution import Distribution from foqus_lib.framework.uq.LocalExecutionModule import LocalExecutionModule +from foqus_lib.framework.uq.Model import Model from foqus_lib.framework.uq.RSAnalyzer import RSAnalyzer +from foqus_lib.framework.uq.SampleData import SampleData from foqus_lib.framework.uq.SamplingMethods import SamplingMethods diff --git a/foqus_lib/framework/plugins/pluginSearch.py b/foqus_lib/framework/plugins/pluginSearch.py index bdf64c1cf..02eb828d1 100644 --- a/foqus_lib/framework/plugins/pluginSearch.py +++ b/foqus_lib/framework/plugins/pluginSearch.py @@ -23,12 +23,12 @@ John Eslick, Carnegie Mellon University, 2014 """ -import sys -import os +import imp import importlib import logging -import imp +import os import re +import sys import traceback _log = logging.getLogger("foqus." + __name__) diff --git a/foqus_lib/framework/pymodel/heat_integration.py b/foqus_lib/framework/pymodel/heat_integration.py index 0a200e3be..f4b983c0c 100644 --- a/foqus_lib/framework/pymodel/heat_integration.py +++ b/foqus_lib/framework/pymodel/heat_integration.py @@ -15,11 +15,13 @@ # # FOQUS_PYMODEL_PLUGIN -import subprocess import logging +import subprocess + import numpy -from foqus_lib.framework.pymodel.pymodel import * + from foqus_lib.framework.graph.nodeVars import * +from foqus_lib.framework.pymodel.pymodel import * def checkAvailable(): diff --git a/foqus_lib/framework/pymodel/matlab_fs.py b/foqus_lib/framework/pymodel/matlab_fs.py index 8a72901b2..3c0005235 100644 --- a/foqus_lib/framework/pymodel/matlab_fs.py +++ b/foqus_lib/framework/pymodel/matlab_fs.py @@ -14,9 +14,10 @@ ################################################################################# # FOQUS_PYMODEL_PLUGIN # -from foqus_lib.framework.pymodel.pymodel import * -import time import subprocess +import time + +from foqus_lib.framework.pymodel.pymodel import * # Check that the MATLAB engine module is available and import it if possible. # If not the MATLAB plug-in cannot be used. diff --git a/foqus_lib/framework/pymodel/pymodel.py b/foqus_lib/framework/pymodel/pymodel.py index cd07ff6cf..7dc4557ae 100644 --- a/foqus_lib/framework/pymodel/pymodel.py +++ b/foqus_lib/framework/pymodel/pymodel.py @@ -12,9 +12,11 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# +from collections import OrderedDict + import numpy + from foqus_lib.framework.graph.nodeVars import * -from collections import OrderedDict class pymodel: diff --git a/foqus_lib/framework/pymodel/pymodel_test.py b/foqus_lib/framework/pymodel/pymodel_test.py index e31b09089..38921b81e 100644 --- a/foqus_lib/framework/pymodel/pymodel_test.py +++ b/foqus_lib/framework/pymodel/pymodel_test.py @@ -16,8 +16,9 @@ # FOQUS_PYMODEL_PLUGIN import numpy -from foqus_lib.framework.pymodel.pymodel import * + from foqus_lib.framework.graph.nodeVars import * +from foqus_lib.framework.pymodel.pymodel import * def checkAvailable(): diff --git a/foqus_lib/framework/pymodel/steam_cycle.py b/foqus_lib/framework/pymodel/steam_cycle.py index c5483973d..511146862 100644 --- a/foqus_lib/framework/pymodel/steam_cycle.py +++ b/foqus_lib/framework/pymodel/steam_cycle.py @@ -16,8 +16,9 @@ # FOQUS_PYMODEL_PLUGIN import numpy -from foqus_lib.framework.pymodel.pymodel import * + from foqus_lib.framework.graph.nodeVars import * +from foqus_lib.framework.pymodel.pymodel import * def checkAvailable(): diff --git a/foqus_lib/framework/sampleResults/results.py b/foqus_lib/framework/sampleResults/results.py index 6ca288f35..46f20123c 100644 --- a/foqus_lib/framework/sampleResults/results.py +++ b/foqus_lib/framework/sampleResults/results.py @@ -19,15 +19,16 @@ John Eslick, Carnegie Mellon University, 2014 """ -import numpy as np -import pandas as pd -import re -from io import StringIO -import json import datetime +import json import logging +import re import time from collections import OrderedDict +from io import StringIO + +import numpy as np +import pandas as pd _log = logging.getLogger("foqus.{}".format(__name__)) diff --git a/foqus_lib/framework/sampleResults/test/results_s3_test.py b/foqus_lib/framework/sampleResults/test/results_s3_test.py index 189ddb390..dda138eb5 100644 --- a/foqus_lib/framework/sampleResults/test/results_s3_test.py +++ b/foqus_lib/framework/sampleResults/test/results_s3_test.py @@ -23,8 +23,9 @@ import json import logging import time -from .. import results + from ...graph.graph import Graph +from .. import results try: from unittest.mock import MagicMock, patch diff --git a/foqus_lib/framework/sdoe/irsf.py b/foqus_lib/framework/sdoe/irsf.py index 24fa87f0a..3ea9c56bc 100644 --- a/foqus_lib/framework/sdoe/irsf.py +++ b/foqus_lib/framework/sdoe/irsf.py @@ -12,11 +12,13 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from .distance import compute_dist, compute_min_params +import itertools +import time + import numpy as np import pandas as pd -import time -import itertools + +from .distance import compute_dist, compute_min_params def unit_scale(xs): diff --git a/foqus_lib/framework/sdoe/nusf.py b/foqus_lib/framework/sdoe/nusf.py index b5b39b5cf..f29ed8107 100644 --- a/foqus_lib/framework/sdoe/nusf.py +++ b/foqus_lib/framework/sdoe/nusf.py @@ -12,11 +12,13 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# +import time + import numpy as np +import pandas as pd # only used for the final output of criterion from scipy.stats import rankdata + from .distance import compute_dist, compute_min_params -import time -import pandas as pd # only used for the final output of criterion def compute_dmat(weight_mat, xcols, wcol, hist=None): diff --git a/foqus_lib/framework/sdoe/odoeu.py b/foqus_lib/framework/sdoe/odoeu.py index 400c99179..3c32c59b1 100644 --- a/foqus_lib/framework/sdoe/odoeu.py +++ b/foqus_lib/framework/sdoe/odoeu.py @@ -13,13 +13,13 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os -import tempfile -import re import platform +import re +import tempfile -from foqus_lib.framework.uq.RSAnalyzer import RSAnalyzer -from foqus_lib.framework.uq.ResponseSurfaces import ResponseSurfaces from foqus_lib.framework.uq.Common import Common +from foqus_lib.framework.uq.ResponseSurfaces import ResponseSurfaces +from foqus_lib.framework.uq.RSAnalyzer import RSAnalyzer dname = os.path.join(os.getcwd(), "ODOE_files") diff --git a/foqus_lib/framework/sdoe/order.py b/foqus_lib/framework/sdoe/order.py index 6ef8c931f..ce239b067 100644 --- a/foqus_lib/framework/sdoe/order.py +++ b/foqus_lib/framework/sdoe/order.py @@ -18,8 +18,10 @@ """ import logging import os + import numpy as np from python_tsp.exact import solve_tsp_dynamic_programming + from .df_utils import load, write _log = logging.getLogger("foqus." + __name__) diff --git a/foqus_lib/framework/sdoe/plot_utils.py b/foqus_lib/framework/sdoe/plot_utils.py index 0cb7a5fa0..b46b0c22c 100644 --- a/foqus_lib/framework/sdoe/plot_utils.py +++ b/foqus_lib/framework/sdoe/plot_utils.py @@ -12,11 +12,12 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import matplotlib.pyplot as plt -from matplotlib.ticker import MaxNLocator -import numpy as np import matplotlib.cm as cm +import matplotlib.pyplot as plt import mplcursors +import numpy as np +from matplotlib.ticker import MaxNLocator + from .df_utils import load from .nusf import scale_y diff --git a/foqus_lib/framework/sdoe/sdoe.py b/foqus_lib/framework/sdoe/sdoe.py index 70a5e5d06..9effa65b8 100644 --- a/foqus_lib/framework/sdoe/sdoe.py +++ b/foqus_lib/framework/sdoe/sdoe.py @@ -12,21 +12,22 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import tempfile +import configparser +import os import platform import re +import tempfile +import time -from .df_utils import load, write -import configparser, time, os import numpy as np import pandas as pd from foqus_lib.framework.uq.Common import Common -from foqus_lib.framework.uq.RSAnalyzer import RSAnalyzer from foqus_lib.framework.uq.LocalExecutionModule import LocalExecutionModule - - from foqus_lib.framework.uq.ResponseSurfaces import ResponseSurfaces +from foqus_lib.framework.uq.RSAnalyzer import RSAnalyzer + +from .df_utils import load, write def save(fnames, results, elapsed_time, irsf=False): diff --git a/foqus_lib/framework/sdoe/test/test_distance.py b/foqus_lib/framework/sdoe/test/test_distance.py index 54d5748c1..5c6e78640 100644 --- a/foqus_lib/framework/sdoe/test/test_distance.py +++ b/foqus_lib/framework/sdoe/test/test_distance.py @@ -12,12 +12,15 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# +from contextlib import contextmanager + import numpy as np import pytest +from hypothesis import assume, example, given +from hypothesis.extra.numpy import array_shapes +from hypothesis.extra.numpy import arrays as arrays_strat + from foqus_lib.framework.sdoe import distance -from hypothesis.extra.numpy import arrays as arrays_strat, array_shapes -from hypothesis import given, example, assume -from contextlib import contextmanager @contextmanager diff --git a/foqus_lib/framework/sdoe/test/test_irsf.py b/foqus_lib/framework/sdoe/test/test_irsf.py index ddade2ee4..6e0699ee3 100644 --- a/foqus_lib/framework/sdoe/test/test_irsf.py +++ b/foqus_lib/framework/sdoe/test/test_irsf.py @@ -17,12 +17,14 @@ See LICENSE.md for license and copyright details. """ +from importlib import resources from unittest import result -import pytest + import numpy as np import pandas as pd +import pytest + from foqus_lib.framework.sdoe import irsf -from importlib import resources @pytest.mark.skip diff --git a/foqus_lib/framework/sdoe/test/test_nusf.py b/foqus_lib/framework/sdoe/test/test_nusf.py index 7d292c650..0d5fdc750 100644 --- a/foqus_lib/framework/sdoe/test/test_nusf.py +++ b/foqus_lib/framework/sdoe/test/test_nusf.py @@ -13,8 +13,10 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# from unittest import result + import numpy as np import pandas as pd + from foqus_lib.framework.sdoe import nusf diff --git a/foqus_lib/framework/sdoe/test/test_order.py b/foqus_lib/framework/sdoe/test/test_order.py index 77151e248..8f3faa68a 100644 --- a/foqus_lib/framework/sdoe/test/test_order.py +++ b/foqus_lib/framework/sdoe/test/test_order.py @@ -24,8 +24,7 @@ import numpy as np import pandas as pd -from foqus_lib.framework.sdoe import order -from foqus_lib.framework.sdoe import df_utils +from foqus_lib.framework.sdoe import df_utils, order def test_mat2tuples(): diff --git a/foqus_lib/framework/sdoe/test/test_plot_utils.py b/foqus_lib/framework/sdoe/test/test_plot_utils.py index c3609c003..eae449742 100644 --- a/foqus_lib/framework/sdoe/test/test_plot_utils.py +++ b/foqus_lib/framework/sdoe/test/test_plot_utils.py @@ -12,15 +12,17 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# +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 sdoe, nusf, plot_utils, df_utils -from unittest import mock -from importlib import resources -from pathlib import Path -import configparser -import json + +from foqus_lib.framework.sdoe import df_utils, nusf, plot_utils, sdoe @mock.patch("foqus_lib.framework.sdoe.plot_utils.plt") diff --git a/foqus_lib/framework/sdoe/test/test_sdoe.py b/foqus_lib/framework/sdoe/test/test_sdoe.py index 50f4d061a..0afe1f377 100644 --- a/foqus_lib/framework/sdoe/test/test_sdoe.py +++ b/foqus_lib/framework/sdoe/test/test_sdoe.py @@ -12,10 +12,11 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from foqus_lib.framework.sdoe import sdoe from importlib import resources from pathlib import Path +from foqus_lib.framework.sdoe import sdoe + def test_run_irsf(): config_file = "config_irsf.ini" diff --git a/foqus_lib/framework/sdoe/test/test_usf.py b/foqus_lib/framework/sdoe/test/test_usf.py index fa799a23c..9ee4269e7 100644 --- a/foqus_lib/framework/sdoe/test/test_usf.py +++ b/foqus_lib/framework/sdoe/test/test_usf.py @@ -13,8 +13,10 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# from unittest import result + import numpy as np import pandas as pd + from foqus_lib.framework.sdoe import usf diff --git a/foqus_lib/framework/sdoe/usf.py b/foqus_lib/framework/sdoe/usf.py index 48e5ed723..37df29c24 100644 --- a/foqus_lib/framework/sdoe/usf.py +++ b/foqus_lib/framework/sdoe/usf.py @@ -12,10 +12,12 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from operator import lt, gt +import time +from operator import gt, lt + import numpy as np + from .distance import compute_dist -import time def compute_min_dist(mat, scl, hist_xs=None): diff --git a/foqus_lib/framework/session/session.py b/foqus_lib/framework/session/session.py index 85c86e076..a3f08ddc0 100644 --- a/foqus_lib/framework/session/session.py +++ b/foqus_lib/framework/session/session.py @@ -20,31 +20,32 @@ John Eslick, Carnegie Mellon University, 2014 """ +import collections import json +import logging import os import shutil -import collections import sys -import logging import uuid + +import foqus_lib.framework.optimizer.problem as oprob from foqus_lib.framework.graph.graph import * from foqus_lib.framework.graph.node import nodeModelTypes -import foqus_lib.framework.optimizer.problem as oprob -from foqus_lib.framework.sim.turbineConfiguration import * -from foqus_lib.framework.plugins import pluginSearch from foqus_lib.framework.ml_ai_models import mlaiSearch -from foqus_lib.framework.surrogate import surrogate from foqus_lib.framework.optimizer import problem -from foqus_lib.framework.pymodel import pymodel -from foqus_lib.framework.uq.Model import * -from foqus_lib.framework.uq.SampleData import * -from foqus_lib.framework.uq.LocalExecutionModule import * -from foqus_lib.framework.sampleResults.results import Results # these are just imported so py2exe will pick them up since they # are used only in plugins from foqus_lib.framework.optimizer.optimization import optimization as junk +from foqus_lib.framework.plugins import pluginSearch +from foqus_lib.framework.pymodel import pymodel +from foqus_lib.framework.sampleResults.results import Results +from foqus_lib.framework.sim.turbineConfiguration import * +from foqus_lib.framework.surrogate import surrogate from foqus_lib.framework.surrogate.surrogate import surrogate as junk2 +from foqus_lib.framework.uq.LocalExecutionModule import * +from foqus_lib.framework.uq.Model import * +from foqus_lib.framework.uq.SampleData import * # Before the session class there are a few functions to help set up the # FOQUS environment. diff --git a/foqus_lib/framework/sim/process_management.py b/foqus_lib/framework/sim/process_management.py index 8d51d15c3..e20661a0c 100644 --- a/foqus_lib/framework/sim/process_management.py +++ b/foqus_lib/framework/sim/process_management.py @@ -19,9 +19,10 @@ Joshua Boverhof, Lawrence Berkeley National Lab """ -import psutil import logging +import psutil + _log = logging.getLogger("foqus." + __name__) _process_username = psutil.Process().username() diff --git a/foqus_lib/framework/sim/turbineConfiguration.py b/foqus_lib/framework/sim/turbineConfiguration.py index 20d2cf740..431f47265 100644 --- a/foqus_lib/framework/sim/turbineConfiguration.py +++ b/foqus_lib/framework/sim/turbineConfiguration.py @@ -21,26 +21,42 @@ John Eslick, Carnegie Mellon University, 2014 """ -import os -import os.path import configparser +import imp import json -import re -import time +import logging +import os +import os.path import random +import re +import socket import ssl +import subprocess +import time +import traceback import urllib.parse import urllib.request -import logging -import traceback -import subprocess -import socket -import imp +from collections import OrderedDict + +import turbine.commands +import turbine.commands.turbine_application_script as _tapp +import turbine.commands.turbine_consumer_script as _tcon +import turbine.commands.turbine_job_script as _tjob +import turbine.commands.turbine_session_script as _tsess +import turbine.commands.turbine_simulation_script as _tsim +from turbine.commands import turbine_session_result_script +from turbine.commands.requests_base import ( + HTTPStatusCode, + delete_page, + get_page_by_url, + post_page_by_url, + read_configuration, +) + import foqus_lib.framework.sim.process_management as _pm +from foqus_lib.framework.foqusException.foqusException import * _log = logging.getLogger("foqus." + __name__) -from collections import OrderedDict - if os.name == "nt": import win32process @@ -50,22 +66,6 @@ except Exception: _log.exception("Problem importing turbineLiteDB") -from foqus_lib.framework.foqusException.foqusException import * -import turbine.commands.turbine_application_script as _tapp -import turbine.commands.turbine_session_script as _tsess -import turbine.commands.turbine_simulation_script as _tsim -import turbine.commands.turbine_job_script as _tjob -import turbine.commands.turbine_consumer_script as _tcon -import turbine.commands -from turbine.commands.requests_base import ( - HTTPStatusCode, - read_configuration, - get_page_by_url, - post_page_by_url, - delete_page, -) -from turbine.commands import turbine_session_result_script - class TurbineInterfaceEx(foqusException): """ diff --git a/foqus_lib/framework/sim/turbineLiteDB.py b/foqus_lib/framework/sim/turbineLiteDB.py index 30fcd998a..a430453f0 100644 --- a/foqus_lib/framework/sim/turbineLiteDB.py +++ b/foqus_lib/framework/sim/turbineLiteDB.py @@ -17,10 +17,11 @@ John Eslick, Carnegie Mellon University, 2014 """ -import time -import uuid import os import threading +import time +import uuid + import adodbapi import adodbapi.apibase diff --git a/foqus_lib/framework/sintervectorize/SinterFileVectorize.py b/foqus_lib/framework/sintervectorize/SinterFileVectorize.py index 87b4bdd18..30051115c 100644 --- a/foqus_lib/framework/sintervectorize/SinterFileVectorize.py +++ b/foqus_lib/framework/sintervectorize/SinterFileVectorize.py @@ -17,12 +17,12 @@ to include vector variables. """ -import sys -import json +import ast import copy -from collections import OrderedDict +import json import os -import ast +import sys +from collections import OrderedDict # Check that the win32com module is available and import it if possible. # If not, the module will not be used. diff --git a/foqus_lib/framework/solventfit/SolventFit.py b/foqus_lib/framework/solventfit/SolventFit.py index 83e3b6d63..6d95383f5 100644 --- a/foqus_lib/framework/solventfit/SolventFit.py +++ b/foqus_lib/framework/solventfit/SolventFit.py @@ -12,16 +12,17 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import os import csv +import os +import platform import subprocess + import numpy as np -import platform -from foqus_lib.framework.uq.Distribution import * from foqus_lib.framework.uq.Common import * -from foqus_lib.framework.uq.RSInference import RSInferencer +from foqus_lib.framework.uq.Distribution import * from foqus_lib.framework.uq.Plotter import Plotter +from foqus_lib.framework.uq.RSInference import RSInferencer class SolventFit: diff --git a/foqus_lib/framework/solventfit/SolventFit_testing.py b/foqus_lib/framework/solventfit/SolventFit_testing.py index c971071c5..b13423266 100644 --- a/foqus_lib/framework/solventfit/SolventFit_testing.py +++ b/foqus_lib/framework/solventfit/SolventFit_testing.py @@ -12,25 +12,26 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import os import csv -import subprocess -import numpy as np - -import sys +import os # print(sys.path) # sys.path.append('/Users/a241211/Documents/CCSI/Solvents/RCode/SolventFit/'); # sys.path.append('/Users/a241211/Documents/CCSI/Solvents/RCode/SolventFit/foqus_lib/framework/uq/'); import shutil +import subprocess +import sys + +import numpy as np + +from foqus_lib.framework.uq.Common import * +from foqus_lib.framework.uq.Distribution import * # from Distribution import * # from Common import * # from RSInference import * # from Plotter import * -from foqus_lib.framework.uq.Distribution import * -from foqus_lib.framework.uq.Common import * # from foqus_lib.framework.uq.RSInference import RSInferencer # from foqus_lib.framework.uq.Plotter import Plotter diff --git a/foqus_lib/framework/solventfit/solvfit_calibfit.py b/foqus_lib/framework/solventfit/solvfit_calibfit.py index 36dfa7566..81377e5ce 100644 --- a/foqus_lib/framework/solventfit/solvfit_calibfit.py +++ b/foqus_lib/framework/solventfit/solvfit_calibfit.py @@ -14,6 +14,7 @@ ################################################################################# import subprocess + # --------------------------------------- # SOLVENTFIT CALIBRATION fit function # --------------------------------------- diff --git a/foqus_lib/framework/solventfit/solvfit_calibpred.py b/foqus_lib/framework/solventfit/solvfit_calibpred.py index e415bd846..b46e80e87 100644 --- a/foqus_lib/framework/solventfit/solvfit_calibpred.py +++ b/foqus_lib/framework/solventfit/solvfit_calibpred.py @@ -14,6 +14,7 @@ ################################################################################# import subprocess + # --------------------------------------- # SOLVENTFIT CALIBRATION predict function # --------------------------------------- diff --git a/foqus_lib/framework/solventfit/solvfit_emulfit.py b/foqus_lib/framework/solventfit/solvfit_emulfit.py index c75c38e25..381bba973 100644 --- a/foqus_lib/framework/solventfit/solvfit_emulfit.py +++ b/foqus_lib/framework/solventfit/solvfit_emulfit.py @@ -14,6 +14,7 @@ ################################################################################# import subprocess + # --------------------------------------- # SOLVENTFIT EMULATOR fit function # --------------------------------------- diff --git a/foqus_lib/framework/solventfit/solvfit_emulpred.py b/foqus_lib/framework/solventfit/solvfit_emulpred.py index 7ac4aacaf..f1b0e3fc8 100644 --- a/foqus_lib/framework/solventfit/solvfit_emulpred.py +++ b/foqus_lib/framework/solventfit/solvfit_emulpred.py @@ -14,6 +14,7 @@ ################################################################################# import subprocess + # --------------------------------------- # SOLVENTFIT EMULATOR predict function # --------------------------------------- diff --git a/foqus_lib/framework/solventfit/test_solventfit.py b/foqus_lib/framework/solventfit/test_solventfit.py index 41979b1fb..596a5e221 100644 --- a/foqus_lib/framework/solventfit/test_solventfit.py +++ b/foqus_lib/framework/solventfit/test_solventfit.py @@ -13,6 +13,7 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# from foqus_lib.framework.uq.Distribution import Distribution + from .SolventFit import SolventFit as S xdatfile = "example/xdat.csv" diff --git a/foqus_lib/framework/surrogate/ACOSSO.py b/foqus_lib/framework/surrogate/ACOSSO.py index d455b2ce6..b05f3aece 100644 --- a/foqus_lib/framework/surrogate/ACOSSO.py +++ b/foqus_lib/framework/surrogate/ACOSSO.py @@ -25,23 +25,25 @@ John Eslick, Carnegie Mellon University, 2014 """ -import numpy as np -import threading -import queue +import copy +import json import logging -import subprocess import os +import queue +import re +import shutil +import subprocess import sys -import copy -import traceback +import threading import time -import shutil -import re -import json +import traceback +from multiprocessing.connection import Client + +import numpy as np + +from foqus_lib.framework.listen import listen from foqus_lib.framework.surrogate.surrogate import surrogate from foqus_lib.framework.uq.SurrogateParser import SurrogateParser -from foqus_lib.framework.listen import listen -from multiprocessing.connection import Client def checkAvailable(): diff --git a/foqus_lib/framework/surrogate/ALAMO.py b/foqus_lib/framework/surrogate/ALAMO.py index 5513bfe87..cc80f892d 100644 --- a/foqus_lib/framework/surrogate/ALAMO.py +++ b/foqus_lib/framework/surrogate/ALAMO.py @@ -31,31 +31,34 @@ """ -import numpy as np -import threading -import queue +import copy import logging -import subprocess +import math import os +import queue +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 multiprocessing.connection import Client + +import numpy as np + +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 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 def checkAvailable(): diff --git a/foqus_lib/framework/surrogate/BSS-ANOVA.py b/foqus_lib/framework/surrogate/BSS-ANOVA.py index c00c0b5f5..99c818de4 100644 --- a/foqus_lib/framework/surrogate/BSS-ANOVA.py +++ b/foqus_lib/framework/surrogate/BSS-ANOVA.py @@ -26,23 +26,25 @@ John Eslick, Carnegie Mellon University, 2014 """ -import numpy as np -import threading -import queue +import copy +import json import logging -import subprocess import os +import queue +import re +import shutil +import subprocess import sys -import copy -import traceback +import threading import time -import shutil -import re -import json +import traceback +from multiprocessing.connection import Client + +import numpy as np + +from foqus_lib.framework.listen import listen from foqus_lib.framework.surrogate.surrogate import surrogate from foqus_lib.framework.uq.SurrogateParser import SurrogateParser -from foqus_lib.framework.listen import listen -from multiprocessing.connection import Client def checkAvailable(): diff --git a/foqus_lib/framework/surrogate/acosso/acosso_fit.py b/foqus_lib/framework/surrogate/acosso/acosso_fit.py index d16a0ce0d..8445afa63 100644 --- a/foqus_lib/framework/surrogate/acosso/acosso_fit.py +++ b/foqus_lib/framework/surrogate/acosso/acosso_fit.py @@ -14,6 +14,7 @@ ################################################################################# import subprocess + # --------------------------------------- # ACOSSO fit function # --------------------------------------- diff --git a/foqus_lib/framework/surrogate/bssanova/bssanova_fit.py b/foqus_lib/framework/surrogate/bssanova/bssanova_fit.py index fb0ecca63..478ffbb0e 100644 --- a/foqus_lib/framework/surrogate/bssanova/bssanova_fit.py +++ b/foqus_lib/framework/surrogate/bssanova/bssanova_fit.py @@ -14,6 +14,7 @@ ################################################################################# import subprocess + # --------------------------------------- # BSSANOVA fit function # --------------------------------------- diff --git a/foqus_lib/framework/surrogate/foqusALAMOClient.py b/foqus_lib/framework/surrogate/foqusALAMOClient.py index baf245676..9099fb10a 100644 --- a/foqus_lib/framework/surrogate/foqusALAMOClient.py +++ b/foqus_lib/framework/surrogate/foqusALAMOClient.py @@ -23,11 +23,12 @@ John Eslick, Carnegie Mellon University, 2014 """ -import numpy as np -import time import sys +import time from multiprocessing.connection import Client +import numpy as np + if __name__ == "__main__": inputFile = "input.txt" outputFile = "output.txt" diff --git a/foqus_lib/framework/surrogate/keras_nn.py b/foqus_lib/framework/surrogate/keras_nn.py index 43f993aa8..91ac408d9 100644 --- a/foqus_lib/framework/surrogate/keras_nn.py +++ b/foqus_lib/framework/surrogate/keras_nn.py @@ -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() diff --git a/foqus_lib/framework/surrogate/pytorch_nn.py b/foqus_lib/framework/surrogate/pytorch_nn.py index e6dce2228..7f0ae8aa9 100644 --- a/foqus_lib/framework/surrogate/pytorch_nn.py +++ b/foqus_lib/framework/surrogate/pytorch_nn.py @@ -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) diff --git a/foqus_lib/framework/surrogate/scikit_nn.py b/foqus_lib/framework/surrogate/scikit_nn.py index 338f98847..fc3567ee9 100644 --- a/foqus_lib/framework/surrogate/scikit_nn.py +++ b/foqus_lib/framework/surrogate/scikit_nn.py @@ -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): diff --git a/foqus_lib/framework/surrogate/surrogate.py b/foqus_lib/framework/surrogate/surrogate.py index c2b7c5484..eb30b6ce5 100644 --- a/foqus_lib/framework/surrogate/surrogate.py +++ b/foqus_lib/framework/surrogate/surrogate.py @@ -12,17 +12,18 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from foqus_lib.framework.foqusOptions.optionList import optionList -import threading import copy -import queue -import os -import foqus_lib.framework.uq.SurrogateParser import json - +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 + class surrogate(threading.Thread): """ diff --git a/foqus_lib/framework/uq/Common.py b/foqus_lib/framework/uq/Common.py index 8893c4d0f..3127d1833 100644 --- a/foqus_lib/framework/uq/Common.py +++ b/foqus_lib/framework/uq/Common.py @@ -12,19 +12,19 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import sys +import io +import logging import os +import platform import re import shutil import subprocess +import sys import tempfile import time -import platform -import logging -import io try: - from PyQt5 import QtGui, QtCore, QtWidgets + from PyQt5 import QtCore, QtGui, QtWidgets usePyside = True except: diff --git a/foqus_lib/framework/uq/CorrelationAnalysis.py b/foqus_lib/framework/uq/CorrelationAnalysis.py index 1e012213a..94c6a33e8 100644 --- a/foqus_lib/framework/uq/CorrelationAnalysis.py +++ b/foqus_lib/framework/uq/CorrelationAnalysis.py @@ -12,9 +12,9 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from .UQAnalysis import UQAnalysis -from .RawDataAnalyzer import RawDataAnalyzer from .Common import Common +from .RawDataAnalyzer import RawDataAnalyzer +from .UQAnalysis import UQAnalysis class CorrelationAnalysis(UQAnalysis): diff --git a/foqus_lib/framework/uq/DataProcessor.py b/foqus_lib/framework/uq/DataProcessor.py index ae3f37e2f..0c07fc880 100644 --- a/foqus_lib/framework/uq/DataProcessor.py +++ b/foqus_lib/framework/uq/DataProcessor.py @@ -13,13 +13,14 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os +import platform import subprocess import tempfile -import platform + +from .Common import Common +from .LocalExecutionModule import LocalExecutionModule from .Model import Model from .SampleData import SampleData -from .LocalExecutionModule import LocalExecutionModule -from .Common import Common class DataProcessor: diff --git a/foqus_lib/framework/uq/ExperimentalDesign.py b/foqus_lib/framework/uq/ExperimentalDesign.py index bcae226fe..bb240bc28 100644 --- a/foqus_lib/framework/uq/ExperimentalDesign.py +++ b/foqus_lib/framework/uq/ExperimentalDesign.py @@ -12,20 +12,22 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import os -import subprocess import copy -import numpy +import os import platform +import subprocess import tempfile +import numpy + +from foqus_lib.framework.uq.Distribution import Distribution from foqus_lib.framework.uq.Model import Model from foqus_lib.framework.uq.SampleData import SampleData -from foqus_lib.framework.uq.Distribution import Distribution from foqus_lib.framework.uq.SamplingMethods import SamplingMethods + +from .Common import Common from .LocalExecutionModule import LocalExecutionModule from .RSAnalyzer import RSAnalyzer -from .Common import Common class ExperimentalDesign: diff --git a/foqus_lib/framework/uq/LocalExecutionModule.py b/foqus_lib/framework/uq/LocalExecutionModule.py index d7ad1f238..b3bc86867 100644 --- a/foqus_lib/framework/uq/LocalExecutionModule.py +++ b/foqus_lib/framework/uq/LocalExecutionModule.py @@ -59,15 +59,16 @@ """ -import sys -import os -import subprocess +import copy +import csv import glob +import os import platform -import numpy -import copy import re -import csv +import subprocess +import sys + +import numpy try: from PyQt5 import QtCore, QtWidgets @@ -76,15 +77,14 @@ except: usePyside = False -from .Model import Model -from .SampleData import SampleData +from turbine.commands import _open_config, turbine_psuade_session_script + +from .Common import Common from .Distribution import Distribution +from .Model import Model from .ResponseSurfaces import ResponseSurfaces +from .SampleData import SampleData from .SamplingMethods import SamplingMethods -from .Common import Common - -from turbine.commands import turbine_psuade_session_script -from turbine.commands import _open_config class LocalExecutionModule(object): @@ -1135,9 +1135,9 @@ def run(self): # print outputStatus emulatorFileName = "emulatorData" self.data.writeToPsuade(emulatorFileName) - from .RSAnalyzer import ( + from .RSAnalyzer import ( # importing at top creates circular import RSAnalyzer, - ) # importing at top creates circular import + ) LocalExecutionModule.runStarted = True Common.initFolder(RSAnalyzer.dname) diff --git a/foqus_lib/framework/uq/Model.py b/foqus_lib/framework/uq/Model.py index 16976218f..db14b0ea8 100644 --- a/foqus_lib/framework/uq/Model.py +++ b/foqus_lib/framework/uq/Model.py @@ -104,11 +104,13 @@ """ import collections.abc -import numbers, json +import json +import numbers + import numpy -from .SamplingMethods import SamplingMethods from .Distribution import * +from .SamplingMethods import SamplingMethods class Model: diff --git a/foqus_lib/framework/uq/ParameterScreening.py b/foqus_lib/framework/uq/ParameterScreening.py index 3b252db9d..cdcb67a6d 100644 --- a/foqus_lib/framework/uq/ParameterScreening.py +++ b/foqus_lib/framework/uq/ParameterScreening.py @@ -12,9 +12,9 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from .UQAnalysis import UQAnalysis -from .RawDataAnalyzer import RawDataAnalyzer from .Common import Common +from .RawDataAnalyzer import RawDataAnalyzer +from .UQAnalysis import UQAnalysis class ParameterScreening(UQAnalysis): diff --git a/foqus_lib/framework/uq/Plotter.py b/foqus_lib/framework/uq/Plotter.py index dfd1569d5..4619d7885 100644 --- a/foqus_lib/framework/uq/Plotter.py +++ b/foqus_lib/framework/uq/Plotter.py @@ -13,11 +13,12 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import re -import numpy as np + import matplotlib as mpl -import matplotlib.pyplot as plt -import matplotlib.colors as colors import matplotlib.cm as cmx +import matplotlib.colors as colors +import matplotlib.pyplot as plt +import numpy as np from matplotlib.figure import Figure try: diff --git a/foqus_lib/framework/uq/RSAnalyzer.py b/foqus_lib/framework/uq/RSAnalyzer.py index 9810abfe7..09be6ff3e 100644 --- a/foqus_lib/framework/uq/RSAnalyzer.py +++ b/foqus_lib/framework/uq/RSAnalyzer.py @@ -12,24 +12,26 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# +import copy import math import os -import subprocess -import tempfile import platform -import copy import re +import subprocess +import tempfile + import numpy as np from scipy import stats -from .Model import Model -from .SampleData import SampleData -from .SamplingMethods import SamplingMethods -from .Distribution import Distribution + from .Common import Common +from .Distribution import Distribution from .LocalExecutionModule import LocalExecutionModule -from .ResponseSurfaces import ResponseSurfaces -from .RawDataAnalyzer import RawDataAnalyzer +from .Model import Model from .Plotter import Plotter +from .RawDataAnalyzer import RawDataAnalyzer +from .ResponseSurfaces import ResponseSurfaces +from .SampleData import SampleData +from .SamplingMethods import SamplingMethods class RSAnalyzer: @@ -1599,7 +1601,7 @@ def pdfrange(pdf, param1, param2=None): # apply this function for initializing the prior bounds # make sure parameters are passed in as floats - from scipy.stats import norm, lognorm, triang, gamma, beta, expon, weibull_min + from scipy.stats import beta, expon, gamma, lognorm, norm, triang, weibull_min if pdf == Distribution.NORMAL: # norm.pdf(x) = exp(-x**2/2)/sqrt(2*pi) diff --git a/foqus_lib/framework/uq/RSInference.py b/foqus_lib/framework/uq/RSInference.py index e719264b3..eab2a3c82 100644 --- a/foqus_lib/framework/uq/RSInference.py +++ b/foqus_lib/framework/uq/RSInference.py @@ -12,25 +12,27 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import os +import abc import copy +import os +import platform import subprocess import tempfile -import platform -import abc + import numpy as np -from scipy.stats import norm, lognorm, triang, gamma, beta, expon, weibull_min # from PySide import QtCore, QtGui from PyQt5 import QtCore, QtGui -from .Model import Model -from .SampleData import SampleData -from .Distribution import Distribution +from scipy.stats import beta, expon, gamma, lognorm, norm, triang, weibull_min + from .Common import Common +from .Distribution import Distribution from .LocalExecutionModule import LocalExecutionModule +from .Model import Model +from .Plotter import Plotter from .ResponseSurfaces import ResponseSurfaces from .RSAnalyzer import RSAnalyzer -from .Plotter import Plotter +from .SampleData import SampleData from .UQAnalysis import UQAnalysis from .UQRSAnalysis import UQRSAnalysis diff --git a/foqus_lib/framework/uq/RSSensitivityAnalysis.py b/foqus_lib/framework/uq/RSSensitivityAnalysis.py index 936547b82..4df0d2879 100644 --- a/foqus_lib/framework/uq/RSSensitivityAnalysis.py +++ b/foqus_lib/framework/uq/RSSensitivityAnalysis.py @@ -12,12 +12,12 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from .UQRSAnalysis import UQRSAnalysis -from .UQAnalysis import UQAnalysis +from .Common import Common from .ResponseSurfaces import ResponseSurfaces from .RSAnalyzer import RSAnalyzer from .SensitivityAnalysis import SensitivityAnalysis -from .Common import Common +from .UQAnalysis import UQAnalysis +from .UQRSAnalysis import UQRSAnalysis class RSSensitivityAnalysis(UQRSAnalysis): diff --git a/foqus_lib/framework/uq/RSUncertaintyAnalysis.py b/foqus_lib/framework/uq/RSUncertaintyAnalysis.py index d66988873..38a971c31 100644 --- a/foqus_lib/framework/uq/RSUncertaintyAnalysis.py +++ b/foqus_lib/framework/uq/RSUncertaintyAnalysis.py @@ -12,11 +12,11 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from .UQRSAnalysis import UQRSAnalysis -from .UQAnalysis import UQAnalysis +from .Common import Common from .ResponseSurfaces import ResponseSurfaces from .RSAnalyzer import RSAnalyzer -from .Common import Common +from .UQAnalysis import UQAnalysis +from .UQRSAnalysis import UQRSAnalysis class RSUncertaintyAnalysis(UQRSAnalysis): diff --git a/foqus_lib/framework/uq/RSValidation.py b/foqus_lib/framework/uq/RSValidation.py index f2a9fab99..f9225e28f 100644 --- a/foqus_lib/framework/uq/RSValidation.py +++ b/foqus_lib/framework/uq/RSValidation.py @@ -13,11 +13,12 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os -from .UQRSAnalysis import UQRSAnalysis -from .UQAnalysis import UQAnalysis -from .RSAnalyzer import RSAnalyzer -from .ResponseSurfaces import ResponseSurfaces + from .Common import Common +from .ResponseSurfaces import ResponseSurfaces +from .RSAnalyzer import RSAnalyzer +from .UQAnalysis import UQAnalysis +from .UQRSAnalysis import UQRSAnalysis class RSValidation(UQRSAnalysis): diff --git a/foqus_lib/framework/uq/RSVisualization.py b/foqus_lib/framework/uq/RSVisualization.py index 6b7bc54db..1408d2ee0 100644 --- a/foqus_lib/framework/uq/RSVisualization.py +++ b/foqus_lib/framework/uq/RSVisualization.py @@ -13,11 +13,12 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import numpy -from .UQRSAnalysis import UQRSAnalysis + +from .Common import Common from .ResponseSurfaces import ResponseSurfaces from .UQAnalysis import UQAnalysis +from .UQRSAnalysis import UQRSAnalysis from .Visualizer import Visualizer -from .Common import Common class RSVisualization(UQRSAnalysis): diff --git a/foqus_lib/framework/uq/RawDataAnalyzer.py b/foqus_lib/framework/uq/RawDataAnalyzer.py index 1892d3420..d23041a8c 100644 --- a/foqus_lib/framework/uq/RawDataAnalyzer.py +++ b/foqus_lib/framework/uq/RawDataAnalyzer.py @@ -13,14 +13,15 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os +import platform import subprocess import tempfile -import platform -from .Model import Model -from .SampleData import SampleData + from .Common import Common from .LocalExecutionModule import LocalExecutionModule +from .Model import Model from .Plotter import Plotter +from .SampleData import SampleData class RawDataAnalyzer: @@ -394,9 +395,10 @@ def plotSA(data, cmd, y, mfile): ftitle = "%s Sensitivity Analysis on Ensemble Data" % figtitle[cmd] ptitle = "%s for %s" % (title[cmd], outVarName) if cmd == "ie": - import numpy as np # numpy used here only import math # math used here only + import numpy as np # numpy used here only + L = len(dat) M = int(math.sqrt(L)) dat = np.reshape(dat, [M, M], order="F") diff --git a/foqus_lib/framework/uq/SampleData.py b/foqus_lib/framework/uq/SampleData.py index 3e7b89de4..51bebe68f 100644 --- a/foqus_lib/framework/uq/SampleData.py +++ b/foqus_lib/framework/uq/SampleData.py @@ -129,14 +129,16 @@ Writes SampleData data to a csv file that can be read in by Excel """ -import os -import numpy import copy +import os import time -from .Model import Model + +import numpy + from .Distribution import Distribution -from .SamplingMethods import SamplingMethods +from .Model import Model from .ResponseSurfaces import ResponseSurfaces +from .SamplingMethods import SamplingMethods from .UQAnalysis import UQAnalysis diff --git a/foqus_lib/framework/uq/SampleRefiner.py b/foqus_lib/framework/uq/SampleRefiner.py index 56b197db5..3b2c2c625 100644 --- a/foqus_lib/framework/uq/SampleRefiner.py +++ b/foqus_lib/framework/uq/SampleRefiner.py @@ -13,15 +13,17 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os +import platform import subprocess import tempfile -import platform -from .SamplingMethods import SamplingMethods -from .SampleData import SampleData + +from PyQt5 import QtWidgets + from .Common import Common from .LocalExecutionModule import LocalExecutionModule from .Plotter import Plotter -from PyQt5 import QtWidgets +from .SampleData import SampleData +from .SamplingMethods import SamplingMethods class SampleRefiner: diff --git a/foqus_lib/framework/uq/SensitivityAnalysis.py b/foqus_lib/framework/uq/SensitivityAnalysis.py index 64f49640f..b9ea7d478 100644 --- a/foqus_lib/framework/uq/SensitivityAnalysis.py +++ b/foqus_lib/framework/uq/SensitivityAnalysis.py @@ -12,9 +12,9 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from .UQAnalysis import UQAnalysis -from .RawDataAnalyzer import RawDataAnalyzer from .Common import Common +from .RawDataAnalyzer import RawDataAnalyzer +from .UQAnalysis import UQAnalysis class SensitivityAnalysis(UQAnalysis): diff --git a/foqus_lib/framework/uq/SurrogateParser.py b/foqus_lib/framework/uq/SurrogateParser.py index 6350b90b1..34960f36f 100644 --- a/foqus_lib/framework/uq/SurrogateParser.py +++ b/foqus_lib/framework/uq/SurrogateParser.py @@ -12,12 +12,15 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import os, re +import os +import re + import numpy as np + +from .Distribution import Distribution from .Model import Model from .SampleData import SampleData from .SamplingMethods import SamplingMethods -from .Distribution import Distribution class SurrogateParser: diff --git a/foqus_lib/framework/uq/UQRSAnalysis.py b/foqus_lib/framework/uq/UQRSAnalysis.py index 9cc9c0523..bf6582624 100644 --- a/foqus_lib/framework/uq/UQRSAnalysis.py +++ b/foqus_lib/framework/uq/UQRSAnalysis.py @@ -12,9 +12,10 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import os import abc # abstract base class +import os from collections import OrderedDict + from .ResponseSurfaces import ResponseSurfaces from .UQAnalysis import UQAnalysis diff --git a/foqus_lib/framework/uq/UncertaintyAnalysis.py b/foqus_lib/framework/uq/UncertaintyAnalysis.py index b806e5a0a..f12681d00 100644 --- a/foqus_lib/framework/uq/UncertaintyAnalysis.py +++ b/foqus_lib/framework/uq/UncertaintyAnalysis.py @@ -12,9 +12,9 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from .UQAnalysis import UQAnalysis -from .RawDataAnalyzer import RawDataAnalyzer from .Common import Common +from .RawDataAnalyzer import RawDataAnalyzer +from .UQAnalysis import UQAnalysis class UncertaintyAnalysis(UQAnalysis): diff --git a/foqus_lib/framework/uq/Visualization.py b/foqus_lib/framework/uq/Visualization.py index 543946d98..67aa82883 100644 --- a/foqus_lib/framework/uq/Visualization.py +++ b/foqus_lib/framework/uq/Visualization.py @@ -13,9 +13,10 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import numpy + +from .Common import Common from .UQAnalysis import UQAnalysis from .Visualizer import Visualizer -from .Common import Common class Visualization(UQAnalysis): diff --git a/foqus_lib/framework/uq/Visualizer.py b/foqus_lib/framework/uq/Visualizer.py index e7277ef6c..ffa3c1852 100644 --- a/foqus_lib/framework/uq/Visualizer.py +++ b/foqus_lib/framework/uq/Visualizer.py @@ -13,16 +13,18 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os +import platform +import re import subprocess import tempfile -import re -import platform + import numpy as np -from .Model import Model -from .SampleData import SampleData -from .LocalExecutionModule import LocalExecutionModule + from .Common import Common +from .LocalExecutionModule import LocalExecutionModule +from .Model import Model from .Plotter import Plotter +from .SampleData import SampleData class Visualizer: diff --git a/foqus_lib/framework/uq/flowsheetToUQModel.py b/foqus_lib/framework/uq/flowsheetToUQModel.py index 8ee263c31..99a8b5f7f 100644 --- a/foqus_lib/framework/uq/flowsheetToUQModel.py +++ b/foqus_lib/framework/uq/flowsheetToUQModel.py @@ -13,8 +13,8 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# from foqus_lib.framework.graph.graph import * -from foqus_lib.framework.uq.Model import * from foqus_lib.framework.uq.Distribution import * +from foqus_lib.framework.uq.Model import * def flowsheetToUQModel(gr): diff --git a/foqus_lib/gui/basic_data/basicDataFrame.py b/foqus_lib/gui/basic_data/basicDataFrame.py index 2d6a61329..90e604adf 100644 --- a/foqus_lib/gui/basic_data/basicDataFrame.py +++ b/foqus_lib/gui/basic_data/basicDataFrame.py @@ -12,13 +12,12 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import os import logging +import os import platform import subprocess -from urllib.request import urlopen - from io import StringIO +from urllib.request import urlopen if os.name == "nt": try: diff --git a/foqus_lib/gui/basic_data/basicDataParentFrame.py b/foqus_lib/gui/basic_data/basicDataParentFrame.py index 7760d9dd8..903c54ead 100644 --- a/foqus_lib/gui/basic_data/basicDataParentFrame.py +++ b/foqus_lib/gui/basic_data/basicDataParentFrame.py @@ -12,8 +12,8 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import sys import os +import sys from PyQt5 import uic from PyQt5.QtWidgets import QApplication, QMainWindow diff --git a/foqus_lib/gui/common/InputPriorTable.py b/foqus_lib/gui/common/InputPriorTable.py index 84f9f9753..c8f2c4d5b 100644 --- a/foqus_lib/gui/common/InputPriorTable.py +++ b/foqus_lib/gui/common/InputPriorTable.py @@ -13,23 +13,24 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os + +import numpy as np from PyQt5.QtCore import Qt, pyqtSignal +from PyQt5.QtGui import QColor from PyQt5.QtWidgets import ( + QAbstractItemView, QApplication, - QTableWidget, - QTableWidgetItem, - QComboBox, QCheckBox, + QComboBox, + QFileDialog, QMessageBox, - QAbstractItemView, QSpinBox, - QFileDialog, + QTableWidget, + QTableWidgetItem, ) -from PyQt5.QtGui import QColor -import numpy as np -from foqus_lib.framework.uq.SampleData import * from foqus_lib.framework.uq.LocalExecutionModule import * +from foqus_lib.framework.uq.SampleData import * class InputPriorTable(QTableWidget): diff --git a/foqus_lib/gui/flowsheet/calculatedColumns.py b/foqus_lib/gui/flowsheet/calculatedColumns.py index 2c2906ba4..7416044e5 100644 --- a/foqus_lib/gui/flowsheet/calculatedColumns.py +++ b/foqus_lib/gui/flowsheet/calculatedColumns.py @@ -18,8 +18,9 @@ John Eslick, Carnegie Mellon University, 2014 """ -import os import logging +import os + from PyQt5 import QtCore, QtWidgets, uic _log = logging.getLogger("foqus.{}".format(__name__)) diff --git a/foqus_lib/gui/flowsheet/columns.py b/foqus_lib/gui/flowsheet/columns.py index 8546534ea..071aa0158 100644 --- a/foqus_lib/gui/flowsheet/columns.py +++ b/foqus_lib/gui/flowsheet/columns.py @@ -18,6 +18,7 @@ John Eslick, Carnegie Mellon University, 2014 """ import os + from PyQt5 import QtCore, uic from PyQt5.QtWidgets import QDialogButtonBox, QListWidgetItem diff --git a/foqus_lib/gui/flowsheet/dataBrowserDialog.py b/foqus_lib/gui/flowsheet/dataBrowserDialog.py index 0bec3bec7..ec141fa96 100644 --- a/foqus_lib/gui/flowsheet/dataBrowserDialog.py +++ b/foqus_lib/gui/flowsheet/dataBrowserDialog.py @@ -20,10 +20,11 @@ """ import os -from foqus_lib.gui.flowsheet.dataBrowserFrame import * from PyQt5 import uic from PyQt5.QtWidgets import QDialog +from foqus_lib.gui.flowsheet.dataBrowserFrame import * + mypath = os.path.dirname(__file__) _dataBrowserDialogUI, _dataBrowserDialog = uic.loadUiType( os.path.join(mypath, "dataBrowserDialog_UI.ui") diff --git a/foqus_lib/gui/flowsheet/dataBrowserFrame.py b/foqus_lib/gui/flowsheet/dataBrowserFrame.py index b8298c52d..1e19a356d 100644 --- a/foqus_lib/gui/flowsheet/dataBrowserFrame.py +++ b/foqus_lib/gui/flowsheet/dataBrowserFrame.py @@ -21,22 +21,23 @@ import json import os -from foqus_lib.gui.flowsheet.columns import * -from . import dataFilterDialog -from foqus_lib.gui.flowsheet.dataModel import * -from foqus_lib.gui.flowsheet.calculatedColumns import calculatedColumnsDialog - from PyQt5 import uic from PyQt5.QtWidgets import ( + QAction, QApplication, + QFileDialog, + QInputDialog, + QLineEdit, QMenu, QMessageBox, - QAction, - QLineEdit, - QInputDialog, - QFileDialog, ) +from foqus_lib.gui.flowsheet.calculatedColumns import calculatedColumnsDialog +from foqus_lib.gui.flowsheet.columns import * +from foqus_lib.gui.flowsheet.dataModel import * + +from . import dataFilterDialog + mypath = os.path.dirname(__file__) _dataBrowserFrameUI, _dataBrowserFrame = uic.loadUiType( os.path.join(mypath, "dataBrowserFrame_UI.ui") diff --git a/foqus_lib/gui/flowsheet/dataFilterDialog.py b/foqus_lib/gui/flowsheet/dataFilterDialog.py index 038326373..9ea5f6bd4 100644 --- a/foqus_lib/gui/flowsheet/dataFilterDialog.py +++ b/foqus_lib/gui/flowsheet/dataFilterDialog.py @@ -25,22 +25,22 @@ _log = logging.getLogger("foqus.{}".format(__name__)) -from foqus_lib.framework.sampleResults.results import * -import foqus_lib.gui.helpers.guiHelpers as gh -from foqus_lib.gui.flowsheet.calculatedColumns import calculatedColumnsDialog - from PyQt5 import uic +from PyQt5.QtCore import QDataStream, QEvent, QObject, QSize, Qt from PyQt5.QtGui import QColor -from PyQt5.QtCore import QObject, QEvent, QDataStream, QSize, Qt from PyQt5.QtWidgets import ( + QAbstractItemView, QApplication, - QMessageBox, - QSplitter, QInputDialog, QLineEdit, - QAbstractItemView, + QMessageBox, + QSplitter, ) +import foqus_lib.gui.helpers.guiHelpers as gh +from foqus_lib.framework.sampleResults.results import * +from foqus_lib.gui.flowsheet.calculatedColumns import calculatedColumnsDialog + mypath = os.path.dirname(__file__) _dataFilterDialogUI, _dataFilterDialog = uic.loadUiType( os.path.join(mypath, "dataFilterDialog_UI.ui") diff --git a/foqus_lib/gui/flowsheet/dataModel.py b/foqus_lib/gui/flowsheet/dataModel.py index 7358cb32b..2888067c8 100644 --- a/foqus_lib/gui/flowsheet/dataModel.py +++ b/foqus_lib/gui/flowsheet/dataModel.py @@ -18,10 +18,11 @@ John Eslick, Carnegie Mellon University, 2014 """ -from PyQt5 import QtCore import json import logging + import numpy as np +from PyQt5 import QtCore class dataModel(QtCore.QAbstractTableModel): diff --git a/foqus_lib/gui/flowsheet/drawFlowsheet.py b/foqus_lib/gui/flowsheet/drawFlowsheet.py index e4608c8b7..74a169244 100644 --- a/foqus_lib/gui/flowsheet/drawFlowsheet.py +++ b/foqus_lib/gui/flowsheet/drawFlowsheet.py @@ -17,15 +17,18 @@ John Eslick, Carnegie Mellon University, 2014 """ +import math +import types + from PyQt5 import QtCore from PyQt5.QtGui import ( + QBrush, QColor, QFont, - QPen, - QBrush, QPainter, QPainterPath, QPainterPathStroker, + QPen, ) from PyQt5.QtWidgets import ( QGraphicsScene, @@ -34,9 +37,8 @@ QLineEdit, QMessageBox, ) + from foqus_lib.framework.graph import * -import math -import types class fsScene(QGraphicsScene): diff --git a/foqus_lib/gui/flowsheet/edgePanel.py b/foqus_lib/gui/flowsheet/edgePanel.py index 0018e070b..d86510823 100644 --- a/foqus_lib/gui/flowsheet/edgePanel.py +++ b/foqus_lib/gui/flowsheet/edgePanel.py @@ -12,8 +12,8 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import os import logging +import os from PyQt5 import QtCore, uic diff --git a/foqus_lib/gui/flowsheet/flowsheetSettingsDialog.py b/foqus_lib/gui/flowsheet/flowsheetSettingsDialog.py index 9ca47b17b..7b0163cf2 100644 --- a/foqus_lib/gui/flowsheet/flowsheetSettingsDialog.py +++ b/foqus_lib/gui/flowsheet/flowsheetSettingsDialog.py @@ -18,6 +18,7 @@ John Eslick, Carnegie Mellon University, 2014 """ import os + from PyQt5 import uic mypath = os.path.dirname(__file__) diff --git a/foqus_lib/gui/flowsheet/nodePanel.py b/foqus_lib/gui/flowsheet/nodePanel.py index 23c7a192d..df40f182e 100644 --- a/foqus_lib/gui/flowsheet/nodePanel.py +++ b/foqus_lib/gui/flowsheet/nodePanel.py @@ -17,23 +17,22 @@ John Eslick, Carnegie Mellon University, 2014 """ +import ast import os -import types import platform +import types from configparser import RawConfigParser from io import StringIO -import ast - -from foqus_lib.gui.dialogs.tagSelectDialog import * -from foqus_lib.framework.graph.node import * -from foqus_lib.framework.graph.node import * -import foqus_lib.gui.helpers.guiHelpers as gh -from foqus_lib.gui.pysyntax_hl.pysyntax_hl import * -from foqus_lib.framework.uq.Distribution import Distribution from PyQt5 import QtCore, uic -from PyQt5.QtWidgets import QMessageBox, QInputDialog, QLineEdit, QAbstractItemView from PyQt5.QtGui import QColor +from PyQt5.QtWidgets import QAbstractItemView, QInputDialog, QLineEdit, QMessageBox + +import foqus_lib.gui.helpers.guiHelpers as gh +from foqus_lib.framework.graph.node import * +from foqus_lib.framework.uq.Distribution import Distribution +from foqus_lib.gui.dialogs.tagSelectDialog import * +from foqus_lib.gui.pysyntax_hl.pysyntax_hl import * mypath = os.path.dirname(__file__) _nodeDockUI, _nodeDock = uic.loadUiType(os.path.join(mypath, "nodePanel_UI.ui")) diff --git a/foqus_lib/gui/flowsheet/runRowsDialog.py b/foqus_lib/gui/flowsheet/runRowsDialog.py index c2bb79fd2..830c5a478 100644 --- a/foqus_lib/gui/flowsheet/runRowsDialog.py +++ b/foqus_lib/gui/flowsheet/runRowsDialog.py @@ -13,6 +13,7 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os + from PyQt5 import uic mypath = os.path.dirname(__file__) diff --git a/foqus_lib/gui/heatIntegration/heatIntegrationFrame.py b/foqus_lib/gui/heatIntegration/heatIntegrationFrame.py index 82889480f..388685122 100644 --- a/foqus_lib/gui/heatIntegration/heatIntegrationFrame.py +++ b/foqus_lib/gui/heatIntegration/heatIntegrationFrame.py @@ -13,6 +13,7 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os + from PyQt5 import uic mypath = os.path.dirname(__file__) diff --git a/foqus_lib/gui/help/helpBrowser.py b/foqus_lib/gui/help/helpBrowser.py index 28cd0276f..a6cf62297 100644 --- a/foqus_lib/gui/help/helpBrowser.py +++ b/foqus_lib/gui/help/helpBrowser.py @@ -23,21 +23,22 @@ John Eslick, Carnegie Mellon University, 2014 """ -import os -import time -import logging import base64 import json +import logging +import os import threading +import time from datetime import datetime -from foqus_lib.framework.sim.turbineConfiguration import TurbineConfiguration -import websocket from typing import Optional -from foqus_lib.help.helpPath import * -from foqus_lib.gui.pysyntax_hl.pysyntax_hl import * + +import websocket from PyQt5 import QtCore, uic -from PyQt5.QtWidgets import QDialog, QFileDialog, QMessageBox, QTextBrowser -from PyQt5.QtWidgets import QMainWindow +from PyQt5.QtWidgets import QDialog, QFileDialog, QMainWindow, QMessageBox, QTextBrowser + +from foqus_lib.framework.sim.turbineConfiguration import TurbineConfiguration +from foqus_lib.gui.pysyntax_hl.pysyntax_hl import * +from foqus_lib.help.helpPath import * mypath = os.path.dirname(__file__) _helpBrowserDockUI, _helpBrowserDock = uic.loadUiType( diff --git a/foqus_lib/gui/helpers/guiHelpers.py b/foqus_lib/gui/helpers/guiHelpers.py index 6ad79a4f0..0c98a705d 100644 --- a/foqus_lib/gui/helpers/guiHelpers.py +++ b/foqus_lib/gui/helpers/guiHelpers.py @@ -19,12 +19,13 @@ John Eslick, Carnegie Mellon University, 2014 """ +import copy +import json + +import numpy from PyQt5 import QtCore from PyQt5.QtGui import QColor -from PyQt5.QtWidgets import QTableWidgetItem, QComboBox -import numpy -import json -import copy +from PyQt5.QtWidgets import QComboBox, QTableWidgetItem def setColHeaderIntem(table, col, text=None): diff --git a/foqus_lib/gui/main/mainWindow.py b/foqus_lib/gui/main/mainWindow.py index 5a0396dd6..0058f1959 100644 --- a/foqus_lib/gui/main/mainWindow.py +++ b/foqus_lib/gui/main/mainWindow.py @@ -18,56 +18,58 @@ John Eslick, Carnegie Mellon University, 2014 """ -import time -import math -import logging -import subprocess -import collections import array -import platform +import collections import functools +import logging +import math import os -from foqus_lib.framework.graph.graph import * -from foqus_lib.framework.session.session import * -from foqus_lib.framework.session.hhmmss import * -from foqus_lib.framework.sim.turbineConfiguration import * -from foqus_lib.framework import optimizer -from foqus_lib.framework.uq.Model import * -from foqus_lib.framework.sintervectorize.SinterFileVectorize import * +import platform +import subprocess +import time +from configparser import * + from PyQt5 import QtCore +from PyQt5.QtGui import QIcon, QKeySequence from PyQt5.QtWidgets import ( - QMainWindow, - QStackedWidget, - QWidget, + QAction, QActionGroup, + QMainWindow, QMenu, - QAction, + QStackedWidget, QToolBar, + QWidget, ) -from PyQt5.QtGui import QIcon, QKeySequence + +from foqus_lib.framework import optimizer +from foqus_lib.framework.graph.graph import * +from foqus_lib.framework.session.hhmmss import * +from foqus_lib.framework.session.session import * +from foqus_lib.framework.sim.turbineConfiguration import * +from foqus_lib.framework.sintervectorize.SinterFileVectorize import * +from foqus_lib.framework.uq.Model import * from foqus_lib.gui import icons_rc +from foqus_lib.gui.basic_data.basicDataParentFrame import * from foqus_lib.gui.dialogs.variableBrowser import * -from foqus_lib.gui.main.Dash import * -from foqus_lib.gui.main.settingsFrame import * -from foqus_lib.gui.main.sessionDescriptionEdit import * -from foqus_lib.gui.main.saveMetadataDialog import * -from foqus_lib.gui.model.gatewayUploadDialog import * -from foqus_lib.gui.sintervectorize.SinterVectorizeDialog import * +from foqus_lib.gui.flowsheet.dataBrowserDialog import * from foqus_lib.gui.flowsheet.drawFlowsheet import * -from foqus_lib.gui.flowsheet.nodePanel import * from foqus_lib.gui.flowsheet.edgePanel import * from foqus_lib.gui.flowsheet.flowsheetSettingsDialog import * -from foqus_lib.gui.flowsheet.dataBrowserDialog import * -from foqus_lib.gui.basic_data.basicDataParentFrame import * +from foqus_lib.gui.flowsheet.nodePanel import * +from foqus_lib.gui.heatIntegration.heatIntegrationFrame import * +from foqus_lib.gui.help.helpBrowser import * +from foqus_lib.gui.main.Dash import * +from foqus_lib.gui.main.saveMetadataDialog import * +from foqus_lib.gui.main.sessionDescriptionEdit import * +from foqus_lib.gui.main.settingsFrame import * +from foqus_lib.gui.model.gatewayUploadDialog import * from foqus_lib.gui.optimization.optSetupFrame import * from foqus_lib.gui.ouu.ouuSetupFrame import * -from foqus_lib.gui.uq.uqSetupFrame import * from foqus_lib.gui.sdoe.sdoeSetupFrame import * -from foqus_lib.gui.uq.updateUQModelDialog import * -from foqus_lib.gui.help.helpBrowser import * +from foqus_lib.gui.sintervectorize.SinterVectorizeDialog import * from foqus_lib.gui.surrogate.surrogateFrame import * -from foqus_lib.gui.heatIntegration.heatIntegrationFrame import * -from configparser import * +from foqus_lib.gui.uq.updateUQModelDialog import * +from foqus_lib.gui.uq.uqSetupFrame import * _log = logging.getLogger("foqus." + __name__) diff --git a/foqus_lib/gui/main/saveMetadataDialog.py b/foqus_lib/gui/main/saveMetadataDialog.py index f7f335eae..56802d545 100644 --- a/foqus_lib/gui/main/saveMetadataDialog.py +++ b/foqus_lib/gui/main/saveMetadataDialog.py @@ -13,7 +13,8 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os -from PyQt5 import uic, QtCore + +from PyQt5 import QtCore, uic mypath = os.path.dirname(__file__) _saveMetadataDialogUI, _saveMetadataDialog = uic.loadUiType( diff --git a/foqus_lib/gui/main/sessionDescriptionEdit.py b/foqus_lib/gui/main/sessionDescriptionEdit.py index fd8f097de..f1d8fd0aa 100644 --- a/foqus_lib/gui/main/sessionDescriptionEdit.py +++ b/foqus_lib/gui/main/sessionDescriptionEdit.py @@ -13,8 +13,8 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os -from PyQt5 import QtCore, uic, QtGui -from PyQt5 import uic + +from PyQt5 import QtCore, QtGui, uic mypath = os.path.dirname(__file__) _sessionDescriptionDialogUI, _sessionDescriptionDialog = uic.loadUiType( diff --git a/foqus_lib/gui/main/settingsFrame.py b/foqus_lib/gui/main/settingsFrame.py index c09938576..cf07df142 100644 --- a/foqus_lib/gui/main/settingsFrame.py +++ b/foqus_lib/gui/main/settingsFrame.py @@ -16,26 +16,26 @@ John Eslick, Carnegie Mellon University, 2014 """ -from foqus_lib.gui.main.turbineConfig import * -from foqus_lib.framework.uq.LocalExecutionModule import * - -import os import logging -import time +import os +import pickle # not sure why this is here probably remove import re -from io import StringIO import shutil -import pickle # not sure why this is here probably remove -from pprint import pprint import subprocess +import time import xml.etree.ElementTree as ET +from io import StringIO +from pprint import pprint + +from PyQt5 import QtCore, uic +from PyQt5.QtWidgets import QFileDialog, QInputDialog, QMessageBox + +from foqus_lib.framework.uq.LocalExecutionModule import * +from foqus_lib.gui.main.turbineConfig import * if os.name == "nt": import win32process -from PyQt5 import QtCore, uic -from PyQt5.QtWidgets import QMessageBox, QInputDialog, QFileDialog - mypath = os.path.dirname(__file__) _settingsFrameUI, _settingsFrame = uic.loadUiType( os.path.join(mypath, "settingsFrame_UI.ui") diff --git a/foqus_lib/gui/main/turbineConfig.py b/foqus_lib/gui/main/turbineConfig.py index b9c4f3cf0..4934ca22d 100644 --- a/foqus_lib/gui/main/turbineConfig.py +++ b/foqus_lib/gui/main/turbineConfig.py @@ -18,12 +18,14 @@ John Eslick, Carnegie Mellon University, 2014 """ import os + +from PyQt5 import QtCore, uic +from PyQt5.QtWidgets import QDialog, QFileDialog, QMessageBox + from foqus_lib.framework.sim.turbineConfiguration import ( - TurbineInterfaceEx, TurbineConfiguration, + TurbineInterfaceEx, ) -from PyQt5 import QtCore, uic -from PyQt5.QtWidgets import QMessageBox, QFileDialog, QDialog mypath = os.path.dirname(__file__) _turbineConfigUI, _turbineConfigFrame = uic.loadUiType( diff --git a/foqus_lib/gui/make_shortcut.py b/foqus_lib/gui/make_shortcut.py index dcdf279b1..260f0ba40 100644 --- a/foqus_lib/gui/make_shortcut.py +++ b/foqus_lib/gui/make_shortcut.py @@ -16,10 +16,10 @@ def makeShortcut(): """Create a windows shortcut on the desktop to start FOQUS""" + import logging import os import pathlib as pl import sys - import logging log = logging.getLogger("foqus." + __name__) if os.name != "nt": diff --git a/foqus_lib/gui/model/dmfUploadDialog.py b/foqus_lib/gui/model/dmfUploadDialog.py index 879b5d3c0..447bd4e38 100644 --- a/foqus_lib/gui/model/dmfUploadDialog.py +++ b/foqus_lib/gui/model/dmfUploadDialog.py @@ -17,32 +17,40 @@ John Eslick, Carnegie Mellon University, 2014 """ -import foqus_lib.gui.helpers.guiHelpers as gh -import os import json import logging +import os import platform import subprocess +from io import StringIO +from urllib.request import urlopen + +from PyQt5 import QtCore, uic +from PyQt5.QtWidgets import QDialog, QFileDialog, QInputDialog, QLineEdit, QMessageBox + +import foqus_lib.gui.helpers.guiHelpers as gh try: # pylint: disable=import-error - from dmf_lib.dmf_browser import DMFBrowser + from dmf_lib.common.common import ( + DMF_HOME, + DMF_LITE_REPO_NAME, + PROP_HEADER, + PROPERTIES_EXT, + REPO_PROPERTIES_UNIX_PATH, + REPO_PROPERTIES_WIN_PATH, + REQUESTS_TIMEOUT, + SC_TITLE, + SHARE_LOGIN_EXT, + UNIX_PATH_SEPARATOR, + UTF8, + WIN_PATH_SEPARATOR, + WINDOWS, + ) + from dmf_lib.common.methods import Common from dmf_lib.dialogs.select_repo_dialog import SelectRepoDialog from dmf_lib.dialogs.status_dialog import StatusDialog - from dmf_lib.common.methods import Common - from dmf_lib.common.common import DMF_HOME - from dmf_lib.common.common import DMF_LITE_REPO_NAME - from dmf_lib.common.common import PROP_HEADER - from dmf_lib.common.common import PROPERTIES_EXT - from dmf_lib.common.common import REPO_PROPERTIES_UNIX_PATH - from dmf_lib.common.common import REPO_PROPERTIES_WIN_PATH - from dmf_lib.common.common import REQUESTS_TIMEOUT - from dmf_lib.common.common import SC_TITLE - from dmf_lib.common.common import SHARE_LOGIN_EXT - from dmf_lib.common.common import UNIX_PATH_SEPARATOR - from dmf_lib.common.common import UTF8 - from dmf_lib.common.common import WIN_PATH_SEPARATOR - from dmf_lib.common.common import WINDOWS + from dmf_lib.dmf_browser import DMFBrowser useDMF = True except ImportError: @@ -50,11 +58,6 @@ "Failed to import or launch DMFBrowser" ) useDMF = False -from urllib.request import urlopen -from io import StringIO - -from PyQt5 import QtCore, uic -from PyQt5.QtWidgets import QMessageBox, QDialog, QInputDialog, QFileDialog, QLineEdit mypath = os.path.dirname(__file__) _dmfUploadDialogUI, _dmfUploadDialog = uic.loadUiType( diff --git a/foqus_lib/gui/model/gatewayUploadDialog.py b/foqus_lib/gui/model/gatewayUploadDialog.py index 6e8ae3a15..2633fe44c 100644 --- a/foqus_lib/gui/model/gatewayUploadDialog.py +++ b/foqus_lib/gui/model/gatewayUploadDialog.py @@ -18,13 +18,15 @@ John Eslick, Carnegie Mellon University, 2014 """ import json +import logging import os -import sys import subprocess -import logging -import foqus_lib.gui.helpers.guiHelpers as gh +import sys + from PyQt5 import QtCore, uic -from PyQt5.QtWidgets import QMessageBox, QDialog, QInputDialog, QFileDialog, QLineEdit +from PyQt5.QtWidgets import QDialog, QFileDialog, QInputDialog, QLineEdit, QMessageBox + +import foqus_lib.gui.helpers.guiHelpers as gh mypath = os.path.dirname(__file__) _gatewayUploadDialogUI, _gatewayUploadDialog = uic.loadUiType( diff --git a/foqus_lib/gui/optimization/optMessageWindow.py b/foqus_lib/gui/optimization/optMessageWindow.py index 324d10f9e..ff64d3260 100644 --- a/foqus_lib/gui/optimization/optMessageWindow.py +++ b/foqus_lib/gui/optimization/optMessageWindow.py @@ -16,6 +16,7 @@ John Eslick, Carnegie Mellon University, 2013 """ import os + from PyQt5 import uic mypath = os.path.dirname(__file__) diff --git a/foqus_lib/gui/optimization/optMonitor.py b/foqus_lib/gui/optimization/optMonitor.py index 0052f202f..dfb428a7a 100644 --- a/foqus_lib/gui/optimization/optMonitor.py +++ b/foqus_lib/gui/optimization/optMonitor.py @@ -16,18 +16,20 @@ John Eslick, Carnegie Mellon University, 2013 """ -from foqus_lib.framework.session.hhmmss import * - -import numpy as np -import time import math +import os +import time + import matplotlib +import numpy as np from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure -from .optMessageWindow import * -import os from PyQt5 import QtCore, uic -from PyQt5.QtWidgets import QWidget, QMessageBox, QVBoxLayout +from PyQt5.QtWidgets import QMessageBox, QVBoxLayout, QWidget + +from foqus_lib.framework.session.hhmmss import * + +from .optMessageWindow import * mypath = os.path.dirname(__file__) _optMonitorUI, _optMonitor = uic.loadUiType(os.path.join(mypath, "optMonitor_UI.ui")) diff --git a/foqus_lib/gui/optimization/optSampleGenDialog.py b/foqus_lib/gui/optimization/optSampleGenDialog.py index 4ed044430..b6b2d5c81 100644 --- a/foqus_lib/gui/optimization/optSampleGenDialog.py +++ b/foqus_lib/gui/optimization/optSampleGenDialog.py @@ -18,10 +18,12 @@ John Eslick, Carnegie Mellon University, 2014 """ import os -import foqus_lib.gui.helpers.guiHelpers as gh + from PyQt5 import uic from PyQt5.QtWidgets import QDialog, QFileDialog, QMessageBox +import foqus_lib.gui.helpers.guiHelpers as gh + mypath = os.path.dirname(__file__) _optSampleGenDialogUI, _optSampleGenDialog = uic.loadUiType( os.path.join(mypath, "optSampleGenDialog_UI.ui") diff --git a/foqus_lib/gui/optimization/optSetupFrame.py b/foqus_lib/gui/optimization/optSetupFrame.py index b4d571abf..051aa8273 100644 --- a/foqus_lib/gui/optimization/optSetupFrame.py +++ b/foqus_lib/gui/optimization/optSetupFrame.py @@ -18,22 +18,22 @@ John Eslick, Carnegie Mellon University, 2014 """ -import json import copy +import json import os +from PyQt5 import QtCore, uic +from PyQt5.QtGui import QColor +from PyQt5.QtWidgets import QDialog, QMessageBox + +import foqus_lib.gui.helpers.guiHelpers as gh from foqus_lib.framework.graph.graph import * from foqus_lib.framework.graph.node import * from foqus_lib.framework.graph.nodeVars import * -import foqus_lib.gui.helpers.guiHelpers as gh from foqus_lib.gui.optimization.optMonitor import * from foqus_lib.gui.optimization.optSampleGenDialog import * from foqus_lib.gui.pysyntax_hl.pysyntax_hl import * -from PyQt5 import QtCore, uic -from PyQt5.QtWidgets import QMessageBox, QDialog -from PyQt5.QtGui import QColor - mypath = os.path.dirname(__file__) _optSetupFrameUI, _optSetupFrame = uic.loadUiType( os.path.join(mypath, "optSetupFrame_UI.ui") diff --git a/foqus_lib/gui/ouu/foqusPSUADEClient.py b/foqus_lib/gui/ouu/foqusPSUADEClient.py index f7c634138..5878c78d2 100644 --- a/foqus_lib/gui/ouu/foqusPSUADEClient.py +++ b/foqus_lib/gui/ouu/foqusPSUADEClient.py @@ -26,6 +26,7 @@ import sys from multiprocessing.connection import Client + # ================================================== # Function to get input data for interpolation # ================================================== diff --git a/foqus_lib/gui/ouu/ouuSetupFrame.py b/foqus_lib/gui/ouu/ouuSetupFrame.py index e992efb86..c7bafedf1 100644 --- a/foqus_lib/gui/ouu/ouuSetupFrame.py +++ b/foqus_lib/gui/ouu/ouuSetupFrame.py @@ -12,49 +12,41 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import sys -import os, re import math -from .nodeToUQModel import nodeToUQModel -from foqus_lib.framework.uq.flowsheetToUQModel import flowsheetToUQModel -from foqus_lib.framework.listen import listen -from multiprocessing.connection import Client +import os +import re import shutil +import sys +from multiprocessing.connection import Client import matplotlib from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure - -if __name__ == "__main__": - import imp - - # f, filename, desc = imp.find_module('foqus_lib', ['c:\\Users\\ou3.THE-LAB\\Documents\\CCSI\\foqus\\']) - # f, filename, desc = imp.find_module('foqus_lib', ['/g/g12/ou3/ccsi/foqus/']) - # f, filename, desc = imp.find_module('foqus_lib', ['/g/g19/ng30/ts6/foqus/']) - f, filename, desc = imp.find_module("foqus_lib", ["c:\\CCSI\\foqus"]) - foqus_lib = imp.load_module("foqus_lib", f, filename, desc) - -from foqus_lib.framework.uq.Common import * -from foqus_lib.framework.uq.LocalExecutionModule import * - -# from foqus_lib.gui.uq.Preview import * -# from InputPriorTable import InputPriorTable -from foqus_lib.gui.common.InputPriorTable import InputPriorTable -from foqus_lib.framework.ouu.OUU import OUU - from PyQt5 import QtCore, uic from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import ( QApplication, + QComboBox, QFileDialog, + QGroupBox, QMessageBox, - QTableWidgetItem, QRadioButton, - QComboBox, - QGroupBox, + QTableWidgetItem, QVBoxLayout, ) +from foqus_lib.framework.listen import listen +from foqus_lib.framework.ouu.OUU import OUU +from foqus_lib.framework.uq.Common import * +from foqus_lib.framework.uq.flowsheetToUQModel import flowsheetToUQModel +from foqus_lib.framework.uq.LocalExecutionModule import * + +# from foqus_lib.gui.uq.Preview import * +# from InputPriorTable import InputPriorTable +from foqus_lib.gui.common.InputPriorTable import InputPriorTable + +from .nodeToUQModel import nodeToUQModel + mypath = os.path.dirname(__file__) _ouuSetupFrameUI, _ouuSetupFrame = uic.loadUiType( os.path.join(mypath, "ouuSetupFrame.ui") diff --git a/foqus_lib/gui/pysyntax_hl/pysyntax_hl.py b/foqus_lib/gui/pysyntax_hl/pysyntax_hl.py index b5df14c9a..de0946aa6 100644 --- a/foqus_lib/gui/pysyntax_hl/pysyntax_hl.py +++ b/foqus_lib/gui/pysyntax_hl/pysyntax_hl.py @@ -21,8 +21,9 @@ """ import sys + from PyQt5.QtCore import QRegExp -from PyQt5.QtGui import QColor, QTextCharFormat, QFont, QSyntaxHighlighter +from PyQt5.QtGui import QColor, QFont, QSyntaxHighlighter, QTextCharFormat def format(color, style=""): diff --git a/foqus_lib/gui/sdoe/odoeSimSetup.py b/foqus_lib/gui/sdoe/odoeSimSetup.py index b7bd5da31..a3e04f8ee 100644 --- a/foqus_lib/gui/sdoe/odoeSimSetup.py +++ b/foqus_lib/gui/sdoe/odoeSimSetup.py @@ -12,28 +12,29 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import os import copy -import tempfile +import os import subprocess +import tempfile + +# from SimSetup_UI import Ui_Dialog +from PyQt5 import uic +from PyQt5.QtCore import Qt +from PyQt5.QtGui import QCursor +from PyQt5.QtWidgets import QApplication, QComboBox, QMessageBox, QStackedLayout from foqus_lib.framework.sampleResults.results import Results +from foqus_lib.framework.uq.Common import Common +from foqus_lib.framework.uq.Distribution import Distribution +from foqus_lib.framework.uq.ExperimentalDesign import ExperimentalDesign from foqus_lib.framework.uq.LocalExecutionModule import LocalExecutionModule from foqus_lib.framework.uq.Model import Model from foqus_lib.framework.uq.SampleData import SampleData -from foqus_lib.framework.uq.Distribution import Distribution from foqus_lib.framework.uq.SamplingMethods import SamplingMethods -from foqus_lib.framework.uq.ExperimentalDesign import ExperimentalDesign -from foqus_lib.framework.uq.Common import Common -from foqus_lib.gui.flowsheet.dataBrowserFrame import dataBrowserFrame -from .sdoePreview import sdoePreview from foqus_lib.gui.common.InputPriorTable import InputPriorTable +from foqus_lib.gui.flowsheet.dataBrowserFrame import dataBrowserFrame -# from SimSetup_UI import Ui_Dialog -from PyQt5 import uic -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QStackedLayout, QComboBox, QApplication, QMessageBox -from PyQt5.QtGui import QCursor +from .sdoePreview import sdoePreview mypath = os.path.dirname(__file__) _SimSetupUI, _odoeSimSetup = uic.loadUiType(os.path.join(mypath, "SimSetup_UI.ui")) diff --git a/foqus_lib/gui/sdoe/sdoeAnalysisDialog.py b/foqus_lib/gui/sdoe/sdoeAnalysisDialog.py index b07c942a2..fa06946e0 100644 --- a/foqus_lib/gui/sdoe/sdoeAnalysisDialog.py +++ b/foqus_lib/gui/sdoe/sdoeAnalysisDialog.py @@ -12,27 +12,28 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# +import configparser import os from datetime import datetime -import configparser - -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 .sdoeSetupFrame import * -from .sdoePreview import sdoePreview, Window from PyQt5 import uic from PyQt5.QtCore import Qt +from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import ( + QAbstractItemView, QApplication, - QMessageBox, QCheckBox, - QTableWidgetItem, - QAbstractItemView, + QMessageBox, QPushButton, + QTableWidgetItem, ) -from PyQt5.QtGui import QCursor + +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 * mypath = os.path.dirname(__file__) _sdoeAnalysisDialogUI, _sdoeAnalysisDialog = uic.loadUiType( diff --git a/foqus_lib/gui/sdoe/sdoePreview.py b/foqus_lib/gui/sdoe/sdoePreview.py index b09fa1a0f..b147304aa 100644 --- a/foqus_lib/gui/sdoe/sdoePreview.py +++ b/foqus_lib/gui/sdoe/sdoePreview.py @@ -16,22 +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 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")) diff --git a/foqus_lib/gui/sdoe/sdoeSetupFrame.py b/foqus_lib/gui/sdoe/sdoeSetupFrame.py index 1889b0ab1..43ae6cf9e 100644 --- a/foqus_lib/gui/sdoe/sdoeSetupFrame.py +++ b/foqus_lib/gui/sdoe/sdoeSetupFrame.py @@ -12,46 +12,45 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import platform -import os -import logging import copy +import logging +import os +import platform import time -import pandas as pd from datetime import datetime -from foqus_lib.gui.sdoe.updateSDOEModelDialog import * -from foqus_lib.gui.sdoe.sdoeSimSetup import * -from foqus_lib.gui.sdoe.odoeSimSetup import * -from foqus_lib.gui.uq import RSCombos -from foqus_lib.gui.uq.uqDataBrowserFrame import uqDataBrowserFrame -from foqus_lib.framework.uq.DataProcessor import * -from foqus_lib.framework.uq.RSValidation import * -from foqus_lib.framework.uq.RSAnalyzer import * -from foqus_lib.framework.uq.Common import * -from foqus_lib.framework.uq.LocalExecutionModule import * -from foqus_lib.framework.sampleResults.results import Results -from foqus_lib.framework.sdoe import df_utils, odoeu, sdoe -from .sdoePreview import sdoePreview -from foqus_lib.gui.common.InputPriorTable import InputPriorTable - -from PyQt5 import QtCore, uic, QtGui +import pandas as pd +from PyQt5 import QtCore, QtGui, uic +from PyQt5.QtCore import QCoreApplication, QEvent, QRect, QSize +from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import ( - QStyledItemDelegate, + QAbstractItemView, QApplication, - QTableWidgetItem, - QPushButton, - QStyle, + QCheckBox, QDialog, - QMessageBox, QMenu, - QAbstractItemView, - QCheckBox, + QMessageBox, + QPushButton, + QStyle, + QStyledItemDelegate, + QTableWidgetItem, ) -from PyQt5.QtCore import QCoreApplication, QSize, QRect, QEvent -from PyQt5.QtGui import QCursor -from PyQt5 import uic +from foqus_lib.framework.sampleResults.results import Results +from foqus_lib.framework.sdoe import df_utils, odoeu, sdoe +from foqus_lib.framework.uq.Common import * +from foqus_lib.framework.uq.DataProcessor import * +from foqus_lib.framework.uq.LocalExecutionModule import * +from foqus_lib.framework.uq.RSAnalyzer import * +from foqus_lib.framework.uq.RSValidation import * +from foqus_lib.gui.common.InputPriorTable import InputPriorTable +from foqus_lib.gui.sdoe.odoeSimSetup import * +from foqus_lib.gui.sdoe.sdoeSimSetup import * +from foqus_lib.gui.sdoe.updateSDOEModelDialog import * +from foqus_lib.gui.uq import RSCombos +from foqus_lib.gui.uq.uqDataBrowserFrame import uqDataBrowserFrame + +from .sdoePreview import sdoePreview mypath = os.path.dirname(__file__) _sdoeSetupFrameUI, _sdoeSetupFrame = uic.loadUiType( diff --git a/foqus_lib/gui/sdoe/sdoeSimSetup.py b/foqus_lib/gui/sdoe/sdoeSimSetup.py index 5d107475b..8ca48a832 100644 --- a/foqus_lib/gui/sdoe/sdoeSimSetup.py +++ b/foqus_lib/gui/sdoe/sdoeSimSetup.py @@ -12,28 +12,29 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import os import copy -import tempfile +import os import subprocess +import tempfile + +# from SimSetup_UI import Ui_Dialog +from PyQt5 import uic +from PyQt5.QtCore import Qt +from PyQt5.QtGui import QCursor +from PyQt5.QtWidgets import QApplication, QComboBox, QMessageBox, QStackedLayout from foqus_lib.framework.sampleResults.results import Results +from foqus_lib.framework.uq.Common import Common +from foqus_lib.framework.uq.Distribution import Distribution +from foqus_lib.framework.uq.ExperimentalDesign import ExperimentalDesign from foqus_lib.framework.uq.LocalExecutionModule import LocalExecutionModule from foqus_lib.framework.uq.Model import Model from foqus_lib.framework.uq.SampleData import SampleData -from foqus_lib.framework.uq.Distribution import Distribution from foqus_lib.framework.uq.SamplingMethods import SamplingMethods -from foqus_lib.framework.uq.ExperimentalDesign import ExperimentalDesign -from foqus_lib.framework.uq.Common import Common -from foqus_lib.gui.flowsheet.dataBrowserFrame import dataBrowserFrame -from .sdoePreview import sdoePreview from foqus_lib.gui.common.InputPriorTable import InputPriorTable +from foqus_lib.gui.flowsheet.dataBrowserFrame import dataBrowserFrame -# from SimSetup_UI import Ui_Dialog -from PyQt5 import uic -from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QStackedLayout, QComboBox, QApplication, QMessageBox -from PyQt5.QtGui import QCursor +from .sdoePreview import sdoePreview mypath = os.path.dirname(__file__) _SimSetupUI, _sdoeSimSetup = uic.loadUiType(os.path.join(mypath, "SimSetup_UI.ui")) diff --git a/foqus_lib/gui/sdoe/updateSDOEModelDialog.py b/foqus_lib/gui/sdoe/updateSDOEModelDialog.py index b18b2dd2d..dc96c57be 100644 --- a/foqus_lib/gui/sdoe/updateSDOEModelDialog.py +++ b/foqus_lib/gui/sdoe/updateSDOEModelDialog.py @@ -12,15 +12,15 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import platform import os +import platform + import numpy as np +from PyQt5 import uic +from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFileDialog, QListWidgetItem from foqus_lib.framework.uq.LocalExecutionModule import * -from PyQt5 import uic -from PyQt5.QtWidgets import QFileDialog, QListWidgetItem, QDialogButtonBox, QDialog - mypath = os.path.dirname(__file__) _updateSDOEModelDialogUI, _updateSDOEModelDialog = uic.loadUiType( os.path.join(mypath, "updateSDOEModelDialog_UI.ui") diff --git a/foqus_lib/gui/sinter/sinter_config.py b/foqus_lib/gui/sinter/sinter_config.py index 0a509c63c..542dd3113 100644 --- a/foqus_lib/gui/sinter/sinter_config.py +++ b/foqus_lib/gui/sinter/sinter_config.py @@ -12,19 +12,20 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import os +import hashlib import json import logging -from PyQt5 import uic -from PyQt5 import QtCore +import os + +from PyQt5 import QtCore, uic from PyQt5.QtWidgets import ( - QFileDialog, + QAbstractItemView, QDialog, + QFileDialog, QMessageBox, - QAbstractItemView, QTableWidgetItem, ) -import hashlib + import foqus_lib.gui.helpers.guiHelpers as gh _log = logging.getLogger(__name__) diff --git a/foqus_lib/gui/sintervectorize/SinterVectorizeDialog.py b/foqus_lib/gui/sintervectorize/SinterVectorizeDialog.py index ce58407e7..f5e762330 100644 --- a/foqus_lib/gui/sintervectorize/SinterVectorizeDialog.py +++ b/foqus_lib/gui/sintervectorize/SinterVectorizeDialog.py @@ -16,22 +16,24 @@ * dialog to vectorize SimSinter (.json) files """ import json +import logging import os -import sys import subprocess -import logging -import foqus_lib.gui.helpers.guiHelpers as gh -import foqus_lib.framework.sintervectorize.SinterFileVectorize as sv +import sys + from PyQt5 import QtCore, uic from PyQt5.QtWidgets import ( - QMessageBox, QDialog, - QInputDialog, QFileDialog, + QInputDialog, QLineEdit, + QMessageBox, QTextEdit, ) +import foqus_lib.framework.sintervectorize.SinterFileVectorize as sv +import foqus_lib.gui.helpers.guiHelpers as gh + mypath = os.path.dirname(__file__) _SinterVectorizeDialogUI, _SinterVectorizeDialog = uic.loadUiType( os.path.join(mypath, "SinterVectorizeDialog_UI.ui") diff --git a/foqus_lib/gui/solventfit/solventFitSetupFrame.py b/foqus_lib/gui/solventfit/solventFitSetupFrame.py index 8bd692184..5ad834b73 100644 --- a/foqus_lib/gui/solventfit/solventFitSetupFrame.py +++ b/foqus_lib/gui/solventfit/solventFitSetupFrame.py @@ -12,34 +12,35 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import sys -import shutil import os -from foqus_lib.framework.uq.SampleData import * -from foqus_lib.framework.uq.Model import * -from foqus_lib.framework.uq.SamplingMethods import * -from foqus_lib.framework.uq.ResponseSurfaces import * -from foqus_lib.framework.uq.RSInference import * -from foqus_lib.framework.solventfit.SolventFit import SolventFit -from foqus_lib.framework.uq.Visualizer import Visualizer -from foqus_lib.framework.uq.Common import * -from foqus_lib.gui.uq import RSCombos -from foqus_lib.gui.common.InputPriorTable import InputPriorTable +import shutil +import sys from PyQt5 import uic from PyQt5.QtCore import Qt from PyQt5.QtGui import QColor, QCursor from PyQt5.QtWidgets import ( - QFileDialog, - QMessageBox, QApplication, - QTableWidgetItem, QCheckBox, + QFileDialog, + QLabel, QMainWindow, + QMessageBox, + QTableWidgetItem, QVBoxLayout, - QLabel, ) +from foqus_lib.framework.solventfit.SolventFit import SolventFit +from foqus_lib.framework.uq.Common import * +from foqus_lib.framework.uq.Model import * +from foqus_lib.framework.uq.ResponseSurfaces import * +from foqus_lib.framework.uq.RSInference import * +from foqus_lib.framework.uq.SampleData import * +from foqus_lib.framework.uq.SamplingMethods import * +from foqus_lib.framework.uq.Visualizer import Visualizer +from foqus_lib.gui.common.InputPriorTable import InputPriorTable +from foqus_lib.gui.uq import RSCombos + mypath = os.path.dirname(__file__) _solventFitSetupFrameUI, _solventFitSetupFrame = uic.loadUiType( os.path.join(mypath, "solventFitSetupFrame.ui") diff --git a/foqus_lib/gui/surrogate/surrogateFrame.py b/foqus_lib/gui/surrogate/surrogateFrame.py index 1b55e5441..2a0fb5880 100644 --- a/foqus_lib/gui/surrogate/surrogateFrame.py +++ b/foqus_lib/gui/surrogate/surrogateFrame.py @@ -22,18 +22,19 @@ John Eslick, Carnegie Mellon University, 2014 """ -import time import math -import traceback import os import shutil -from foqus_lib.gui.flowsheet.dataBrowserFrame import * -import foqus_lib.gui.helpers.guiHelpers as gh -from foqus_lib.framework.session.hhmmss import * +import time +import traceback + from PyQt5 import QtCore, uic -from PyQt5.QtWidgets import QMessageBox, QFileDialog, QTableWidget from PyQt5.QtGui import QColor -from PyQt5 import uic +from PyQt5.QtWidgets import QFileDialog, QMessageBox, QTableWidget + +import foqus_lib.gui.helpers.guiHelpers as gh +from foqus_lib.framework.session.hhmmss import * +from foqus_lib.gui.flowsheet.dataBrowserFrame import * mypath = os.path.dirname(__file__) _surrogateFrameUI, _surrogateFrame = uic.loadUiType( diff --git a/foqus_lib/gui/tests/conftest.py b/foqus_lib/gui/tests/conftest.py index 312f1891a..bc326520a 100644 --- a/foqus_lib/gui/tests/conftest.py +++ b/foqus_lib/gui/tests/conftest.py @@ -15,16 +15,16 @@ import contextlib import logging import os -from pathlib import Path import shutil import sys import typing as t - -from PyQt5 import QtWidgets, QtCore, QtGui +from pathlib import Path import pytest -from pytestqt.exceptions import capture_exceptions, format_captured_exceptions from _pytest.monkeypatch import MonkeyPatch +from PyQt5 import QtCore, QtGui, QtWidgets +from pytestqt.exceptions import capture_exceptions, format_captured_exceptions + import pytest_qt_extras diff --git a/foqus_lib/gui/tests/test_main_window.py b/foqus_lib/gui/tests/test_main_window.py index be948c5e0..1f3ca15e8 100644 --- a/foqus_lib/gui/tests/test_main_window.py +++ b/foqus_lib/gui/tests/test_main_window.py @@ -16,7 +16,6 @@ import pytest - pytestmark = pytest.mark.gui diff --git a/foqus_lib/gui/tests/test_ml_ai.py b/foqus_lib/gui/tests/test_ml_ai.py index eb99d981f..aa202fce1 100644 --- a/foqus_lib/gui/tests/test_ml_ai.py +++ b/foqus_lib/gui/tests/test_ml_ai.py @@ -12,19 +12,18 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# +import os from pathlib import Path from typing import List, Tuple -import os import pytest -from pytest_qt_extras import QtBot from PyQt5 import QtWidgets -from foqus_lib.gui.main.mainWindow import mainWindow +from foqus_lib.framework.ml_ai_models.mlaiSearch import ml_ai_models from foqus_lib.framework.session import session as FoqusSession from foqus_lib.gui.flowsheet.drawFlowsheet import drawFlowsheet -from foqus_lib.framework.ml_ai_models.mlaiSearch import ml_ai_models - +from foqus_lib.gui.main.mainWindow import mainWindow +from pytest_qt_extras import QtBot pytestmark = pytest.mark.gui diff --git a/foqus_lib/gui/tests/test_ouu.py b/foqus_lib/gui/tests/test_ouu.py index d076ec0b3..4f27ee356 100644 --- a/foqus_lib/gui/tests/test_ouu.py +++ b/foqus_lib/gui/tests/test_ouu.py @@ -22,23 +22,19 @@ Author: Devarshi Ghoshal """ +import os import time import typing -import os -from PyQt5 import QtWidgets, QtCore import pytest - -from foqus_lib.gui.ouu.ouuSetupFrame import ouuSetupFrame -from foqus_lib.gui.ouu import foqusPSUADEClient -from foqus_lib.gui.ouu.OUUInputsTable import OUUInputsTable -from foqus_lib.gui.ouu import nodeToUQModel +from PyQt5 import QtCore, QtWidgets +from PyQt5.QtWidgets import QMessageBox from foqus_lib.framework.uq.LocalExecutionModule import LocalExecutionModule from foqus_lib.gui.common.InputPriorTable import InputPriorTable - -from PyQt5.QtWidgets import QMessageBox - +from foqus_lib.gui.ouu import foqusPSUADEClient, nodeToUQModel +from foqus_lib.gui.ouu.OUUInputsTable import OUUInputsTable +from foqus_lib.gui.ouu.ouuSetupFrame import ouuSetupFrame pytestmark = pytest.mark.gui diff --git a/foqus_lib/gui/tests/test_plugins.py b/foqus_lib/gui/tests/test_plugins.py index 7787e6966..876ab8d28 100644 --- a/foqus_lib/gui/tests/test_plugins.py +++ b/foqus_lib/gui/tests/test_plugins.py @@ -12,19 +12,18 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# +import os from pathlib import Path from typing import List, Tuple -import os import pytest -from pytest_qt_extras import QtBot from PyQt5 import QtWidgets -from foqus_lib.gui.main.mainWindow import mainWindow +from foqus_lib.framework.plugins.pluginSearch import plugins from foqus_lib.framework.session import session as FoqusSession from foqus_lib.gui.flowsheet.drawFlowsheet import drawFlowsheet -from foqus_lib.framework.plugins.pluginSearch import plugins - +from foqus_lib.gui.main.mainWindow import mainWindow +from pytest_qt_extras import QtBot pytestmark = pytest.mark.gui diff --git a/foqus_lib/gui/tests/test_sdoe.py b/foqus_lib/gui/tests/test_sdoe.py index fc76c009c..fe4d28fdc 100644 --- a/foqus_lib/gui/tests/test_sdoe.py +++ b/foqus_lib/gui/tests/test_sdoe.py @@ -12,19 +12,18 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# +import shutil import time import typing -import shutil -from PyQt5 import QtWidgets, QtCore -from foqus_lib.framework.uq.LocalExecutionModule import * -from foqus_lib.gui.sdoe.sdoeSetupFrame import sdoeSetupFrame +import pytest +from PyQt5 import QtCore, QtWidgets + from foqus_lib.framework.sampleResults.results import Results +from foqus_lib.framework.uq.LocalExecutionModule import * from foqus_lib.gui.sdoe.sdoeAnalysisDialog import sdoeAnalysisDialog from foqus_lib.gui.sdoe.sdoePreview import sdoePreview -import pytest - pytestmark = pytest.mark.gui diff --git a/foqus_lib/gui/tests/test_surrogate.py b/foqus_lib/gui/tests/test_surrogate.py index cd295c9fb..c4034813f 100644 --- a/foqus_lib/gui/tests/test_surrogate.py +++ b/foqus_lib/gui/tests/test_surrogate.py @@ -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 diff --git a/foqus_lib/gui/tests/test_uq.py b/foqus_lib/gui/tests/test_uq.py index 855a49484..2bbdf59a0 100644 --- a/foqus_lib/gui/tests/test_uq.py +++ b/foqus_lib/gui/tests/test_uq.py @@ -14,15 +14,14 @@ ################################################################################# import time import typing -from PyQt5 import QtWidgets, QtCore - -from foqus_lib.gui.uq.uqSetupFrame import uqSetupFrame -from foqus_lib.gui.uq.SimSetup import SimSetup -from foqus_lib.gui.uq.updateUQModelDialog import updateUQModelDialog -from foqus_lib.gui.uq.AnalysisDialog import AnalysisDialog import pytest +from PyQt5 import QtCore, QtWidgets +from foqus_lib.gui.uq.AnalysisDialog import AnalysisDialog +from foqus_lib.gui.uq.SimSetup import SimSetup +from foqus_lib.gui.uq.updateUQModelDialog import updateUQModelDialog +from foqus_lib.gui.uq.uqSetupFrame import uqSetupFrame pytestmark = pytest.mark.gui diff --git a/foqus_lib/gui/uq/AnalysisDialog.py b/foqus_lib/gui/uq/AnalysisDialog.py index 6ef85e338..b90f72108 100644 --- a/foqus_lib/gui/uq/AnalysisDialog.py +++ b/foqus_lib/gui/uq/AnalysisDialog.py @@ -12,50 +12,52 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import sys import os -import numpy import shutil +import sys import textwrap -from foqus_lib.framework.uq.SampleData import * -from foqus_lib.framework.uq.Model import * -from foqus_lib.framework.uq.SamplingMethods import * -from foqus_lib.framework.uq.ParameterScreening import * -from foqus_lib.framework.uq.Visualization import * -from foqus_lib.framework.uq.UncertaintyAnalysis import * -from foqus_lib.framework.uq.CorrelationAnalysis import * -from foqus_lib.framework.uq.SensitivityAnalysis import * -from foqus_lib.framework.uq.RSValidation import * -from foqus_lib.framework.uq.RSUncertaintyAnalysis import * -from foqus_lib.framework.uq.RSSensitivityAnalysis import * -from foqus_lib.framework.uq.RSVisualization import * -from foqus_lib.framework.uq.ResponseSurfaces import * -from foqus_lib.framework.uq.RawDataAnalyzer import * -from foqus_lib.framework.uq.RSAnalyzer import * -from foqus_lib.framework.uq.Visualizer import Visualizer -from foqus_lib.framework.uq.Common import * -from .AnalysisInfoDialog import * -from .InferenceDialog import * -from foqus_lib.gui.common.InputPriorTable import InputPriorTable -from . import RSCombos +import numpy # from AnalysisDialog_UI import Ui_Dialog from PyQt5 import uic from PyQt5.QtCore import Qt +from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import ( + QAbstractItemView, QApplication, - QMessageBox, - QFileDialog, QCheckBox, - QTableWidgetItem, - QAbstractItemView, - QGridLayout, QDialog, + QFileDialog, + QGridLayout, QLabel, + QMessageBox, QPushButton, + QTableWidgetItem, ) -from PyQt5.QtGui import QCursor + +from foqus_lib.framework.uq.Common import * +from foqus_lib.framework.uq.CorrelationAnalysis import * +from foqus_lib.framework.uq.Model import * +from foqus_lib.framework.uq.ParameterScreening import * +from foqus_lib.framework.uq.RawDataAnalyzer import * +from foqus_lib.framework.uq.ResponseSurfaces import * +from foqus_lib.framework.uq.RSAnalyzer import * +from foqus_lib.framework.uq.RSSensitivityAnalysis import * +from foqus_lib.framework.uq.RSUncertaintyAnalysis import * +from foqus_lib.framework.uq.RSValidation import * +from foqus_lib.framework.uq.RSVisualization import * +from foqus_lib.framework.uq.SampleData import * +from foqus_lib.framework.uq.SamplingMethods import * +from foqus_lib.framework.uq.SensitivityAnalysis import * +from foqus_lib.framework.uq.UncertaintyAnalysis import * +from foqus_lib.framework.uq.Visualization import * +from foqus_lib.framework.uq.Visualizer import Visualizer +from foqus_lib.gui.common.InputPriorTable import InputPriorTable + +from . import RSCombos +from .AnalysisInfoDialog import * +from .InferenceDialog import * mypath = os.path.dirname(__file__) _AnalysisDialogUI, _AnalysisDialog = uic.loadUiType( diff --git a/foqus_lib/gui/uq/AnalysisInfoDialog.py b/foqus_lib/gui/uq/AnalysisInfoDialog.py index 17eb56e14..da94b9459 100644 --- a/foqus_lib/gui/uq/AnalysisInfoDialog.py +++ b/foqus_lib/gui/uq/AnalysisInfoDialog.py @@ -13,17 +13,19 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import copy +from collections import OrderedDict + from PyQt5 import QtCore +from PyQt5.QtGui import QFont from PyQt5.QtWidgets import ( + QDialog, QGridLayout, - QTableWidget, - QTableWidgetItem, QLabel, QPushButton, - QDialog, + QTableWidget, + QTableWidgetItem, ) -from PyQt5.QtGui import QFont -from collections import OrderedDict + from foqus_lib.framework.uq.Distribution import Distribution from foqus_lib.framework.uq.ResponseSurfaces import ResponseSurfaces diff --git a/foqus_lib/gui/uq/InferenceDialog.py b/foqus_lib/gui/uq/InferenceDialog.py index d91f2e193..69d99eff8 100644 --- a/foqus_lib/gui/uq/InferenceDialog.py +++ b/foqus_lib/gui/uq/InferenceDialog.py @@ -12,26 +12,27 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import sys -import shutil import os +import shutil +import sys -from foqus_lib.framework.uq.SampleData import * +# from InferenceDialog_UI import Ui_Dialog +from PyQt5 import QtCore, uic +from PyQt5.QtCore import Qt +from PyQt5.QtGui import * +from PyQt5.QtWidgets import * + +from foqus_lib.framework.solventfit.SolventFit import SolventFit +from foqus_lib.framework.uq.Common import * from foqus_lib.framework.uq.Model import * -from foqus_lib.framework.uq.SamplingMethods import * from foqus_lib.framework.uq.ResponseSurfaces import * from foqus_lib.framework.uq.RSInference import * -from foqus_lib.framework.solventfit.SolventFit import SolventFit +from foqus_lib.framework.uq.SampleData import * +from foqus_lib.framework.uq.SamplingMethods import * from foqus_lib.framework.uq.Visualizer import Visualizer -from foqus_lib.framework.uq.Common import * -from . import RSCombos from foqus_lib.gui.common.InputPriorTable import InputPriorTable -# from InferenceDialog_UI import Ui_Dialog -from PyQt5 import QtCore, uic -from PyQt5.QtWidgets import * -from PyQt5.QtCore import Qt -from PyQt5.QtGui import * +from . import RSCombos mypath = os.path.dirname(__file__) _InferenceDialogUI, _InferenceDialog = uic.loadUiType( diff --git a/foqus_lib/gui/uq/Preview.py b/foqus_lib/gui/uq/Preview.py index 9b28f231c..6c693a056 100644 --- a/foqus_lib/gui/uq/Preview.py +++ b/foqus_lib/gui/uq/Preview.py @@ -12,28 +12,29 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import sys import os - -from foqus_lib.framework.uq.Model import Model -from foqus_lib.framework.uq.SampleData import SampleData -from foqus_lib.framework.uq.Visualizer import Visualizer -from foqus_lib.framework.uq.Common import * -from foqus_lib.framework.uq.RSInference import RSInferencer - -# from Preview_UI import Ui_Dialog +import sys from PyQt5 import uic from PyQt5.QtCore import Qt +from PyQt5.QtGui import QColor, QCursor from PyQt5.QtWidgets import ( - QFileDialog, - QListWidgetItem, QAbstractItemView, - QDialogButtonBox, QApplication, + QDialogButtonBox, + QFileDialog, + QListWidgetItem, QTableWidgetItem, ) -from PyQt5.QtGui import QCursor, QColor + +from foqus_lib.framework.uq.Common import * +from foqus_lib.framework.uq.Model import Model +from foqus_lib.framework.uq.RSInference import RSInferencer +from foqus_lib.framework.uq.SampleData import SampleData +from foqus_lib.framework.uq.Visualizer import Visualizer + +# from Preview_UI import Ui_Dialog + mypath = os.path.dirname(__file__) _PreviewUI, _Preview = uic.loadUiType(os.path.join(mypath, "Preview_UI.ui")) diff --git a/foqus_lib/gui/uq/RSCombos.py b/foqus_lib/gui/uq/RSCombos.py index e3ff27fd8..be360b546 100644 --- a/foqus_lib/gui/uq/RSCombos.py +++ b/foqus_lib/gui/uq/RSCombos.py @@ -13,9 +13,10 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import time + import numpy -from PyQt5.QtWidgets import QComboBox, QFileDialog, QSpinBox from PyQt5.QtCore import pyqtSignal +from PyQt5.QtWidgets import QComboBox, QFileDialog, QSpinBox from foqus_lib.framework.uq.LocalExecutionModule import * from foqus_lib.framework.uq.ResponseSurfaces import * diff --git a/foqus_lib/gui/uq/SimSetup.py b/foqus_lib/gui/uq/SimSetup.py index 0881615ed..3bf9fc071 100644 --- a/foqus_lib/gui/uq/SimSetup.py +++ b/foqus_lib/gui/uq/SimSetup.py @@ -12,39 +12,41 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import sys -import os import copy -import tempfile -import subprocess -import numpy +import os import platform +import subprocess +import sys +import tempfile -from foqus_lib.framework.uq.LocalExecutionModule import LocalExecutionModule -from foqus_lib.framework.uq.Model import Model -from foqus_lib.framework.uq.SampleData import SampleData -from foqus_lib.framework.uq.Distribution import Distribution -from foqus_lib.framework.uq.SamplingMethods import SamplingMethods -from foqus_lib.framework.uq.ExperimentalDesign import ExperimentalDesign -from foqus_lib.framework.uq.Common import Common -from foqus_lib.gui.flowsheet.dataBrowserFrame import dataBrowserFrame -from .Preview import Preview -from foqus_lib.gui.common.InputPriorTable import InputPriorTable +import numpy # from SimSetup_UI import Ui_Dialog from PyQt5 import uic from PyQt5.QtCore import Qt +from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import ( - QFileDialog, - QListWidgetItem, QAbstractItemView, - QDialogButtonBox, - QStackedLayout, - QComboBox, QApplication, + QComboBox, + QDialogButtonBox, + QFileDialog, + QListWidgetItem, QMessageBox, + QStackedLayout, ) -from PyQt5.QtGui import QCursor + +from foqus_lib.framework.uq.Common import Common +from foqus_lib.framework.uq.Distribution import Distribution +from foqus_lib.framework.uq.ExperimentalDesign import ExperimentalDesign +from foqus_lib.framework.uq.LocalExecutionModule import LocalExecutionModule +from foqus_lib.framework.uq.Model import Model +from foqus_lib.framework.uq.SampleData import SampleData +from foqus_lib.framework.uq.SamplingMethods import SamplingMethods +from foqus_lib.gui.common.InputPriorTable import InputPriorTable +from foqus_lib.gui.flowsheet.dataBrowserFrame import dataBrowserFrame + +from .Preview import Preview mypath = os.path.dirname(__file__) _SimSetupUI, _SimSetup = uic.loadUiType(os.path.join(mypath, "SimSetup_UI.ui")) diff --git a/foqus_lib/gui/uq/dialogTest.py b/foqus_lib/gui/uq/dialogTest.py index 2d11f247c..2616f5670 100644 --- a/foqus_lib/gui/uq/dialogTest.py +++ b/foqus_lib/gui/uq/dialogTest.py @@ -13,7 +13,8 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import sys -from PyQt5 import QtGui, QtCore, QtWidgets + +from PyQt5 import QtCore, QtGui, QtWidgets class Dialog(QtWidgets.QDialog): # QtWidgets.QMainWindow): diff --git a/foqus_lib/gui/uq/stopEnsembleDialog.py b/foqus_lib/gui/uq/stopEnsembleDialog.py index 0acdd1593..e979934a1 100644 --- a/foqus_lib/gui/uq/stopEnsembleDialog.py +++ b/foqus_lib/gui/uq/stopEnsembleDialog.py @@ -13,6 +13,7 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os + from PyQt5 import uic mypath = os.path.dirname(__file__) diff --git a/foqus_lib/gui/uq/updateUQModelDialog.py b/foqus_lib/gui/uq/updateUQModelDialog.py index 3ff567d33..0af995d32 100644 --- a/foqus_lib/gui/uq/updateUQModelDialog.py +++ b/foqus_lib/gui/uq/updateUQModelDialog.py @@ -12,25 +12,25 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import platform import os - -from foqus_lib.framework.graph.graph import * -from foqus_lib.framework.uq.flowsheetToUQModel import * -from foqus_lib.framework.uq.Model import * -from foqus_lib.framework.uq.LocalExecutionModule import * -from foqus_lib.framework.uq.ResponseSurfaces import * -from foqus_lib.framework.uq.Common import Common +import platform from PyQt5 import uic from PyQt5.QtWidgets import ( - QFileDialog, - QListWidgetItem, QAbstractItemView, - QDialogButtonBox, QDialog, + QDialogButtonBox, + QFileDialog, + QListWidgetItem, ) +from foqus_lib.framework.graph.graph import * +from foqus_lib.framework.uq.Common import Common +from foqus_lib.framework.uq.flowsheetToUQModel import * +from foqus_lib.framework.uq.LocalExecutionModule import * +from foqus_lib.framework.uq.Model import * +from foqus_lib.framework.uq.ResponseSurfaces import * + mypath = os.path.dirname(__file__) _updateUQModelDialogUI, _updateUQModelDialog = uic.loadUiType( os.path.join(mypath, "updateUQModelDialog_UI.ui") diff --git a/foqus_lib/gui/uq/uqDataBrowserFrame.py b/foqus_lib/gui/uq/uqDataBrowserFrame.py index da5e64c05..302fb26b6 100644 --- a/foqus_lib/gui/uq/uqDataBrowserFrame.py +++ b/foqus_lib/gui/uq/uqDataBrowserFrame.py @@ -15,6 +15,7 @@ __author__ = "sotorrio1" from PyQt5.QtCore import pyqtSignal + from foqus_lib.gui.flowsheet.dataBrowserFrame import dataBrowserFrame diff --git a/foqus_lib/gui/uq/uqSetupFrame.py b/foqus_lib/gui/uq/uqSetupFrame.py index cf8f5b1aa..b9ce18e41 100644 --- a/foqus_lib/gui/uq/uqSetupFrame.py +++ b/foqus_lib/gui/uq/uqSetupFrame.py @@ -12,47 +12,47 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import platform -import os -import logging -import numpy import copy -from foqus_lib.gui.uq.updateUQModelDialog import * -from foqus_lib.gui.uq.SimSetup import * -from foqus_lib.gui.uq.stopEnsembleDialog import * -from foqus_lib.gui.uq.uqDataBrowserFrame import uqDataBrowserFrame -from foqus_lib.framework.uq.SampleData import * -from foqus_lib.framework.uq.Model import * -from foqus_lib.framework.uq.SamplingMethods import * -from foqus_lib.framework.uq.ResponseSurfaces import * -from foqus_lib.framework.uq.DataProcessor import * -from foqus_lib.framework.uq.RawDataAnalyzer import * -from foqus_lib.framework.uq.RSAnalyzer import * -from foqus_lib.framework.uq.Visualizer import * -from foqus_lib.framework.uq.SampleRefiner import * -from foqus_lib.framework.uq.Common import * -from foqus_lib.framework.uq.LocalExecutionModule import * -from foqus_lib.framework.sampleResults.results import Results -from .AnalysisDialog import AnalysisDialog +import logging +import os +import platform -from PyQt5 import QtCore, uic, QtGui +import numpy +from PyQt5 import QtCore, QtGui, uic +from PyQt5.QtCore import QCoreApplication, QEvent, QRect, QSize +from PyQt5.QtGui import QColor, QCursor from PyQt5.QtWidgets import ( - QStyledItemDelegate, QApplication, QButtonGroup, - QTableWidgetItem, - QProgressBar, - QPushButton, - QStyle, QDialog, - QMessageBox, QInputDialog, QMenu, + QMessageBox, + QProgressBar, + QPushButton, + QStyle, + QStyledItemDelegate, + QTableWidgetItem, ) -from PyQt5.QtCore import QCoreApplication, QSize, QRect, QEvent -from PyQt5.QtGui import QCursor, QColor -from PyQt5 import uic +from foqus_lib.framework.sampleResults.results import Results +from foqus_lib.framework.uq.Common import * +from foqus_lib.framework.uq.DataProcessor import * +from foqus_lib.framework.uq.LocalExecutionModule import * +from foqus_lib.framework.uq.Model import * +from foqus_lib.framework.uq.RawDataAnalyzer import * +from foqus_lib.framework.uq.ResponseSurfaces import * +from foqus_lib.framework.uq.RSAnalyzer import * +from foqus_lib.framework.uq.SampleData import * +from foqus_lib.framework.uq.SampleRefiner import * +from foqus_lib.framework.uq.SamplingMethods import * +from foqus_lib.framework.uq.Visualizer import * +from foqus_lib.gui.uq.SimSetup import * +from foqus_lib.gui.uq.stopEnsembleDialog import * +from foqus_lib.gui.uq.updateUQModelDialog import * +from foqus_lib.gui.uq.uqDataBrowserFrame import uqDataBrowserFrame + +from .AnalysisDialog import AnalysisDialog mypath = os.path.dirname(__file__) _uqSetupFrameUI, _uqSetupFrame = uic.loadUiType( diff --git a/foqus_lib/service/flowsheet.py b/foqus_lib/service/flowsheet.py index 5f05eb15d..e2d7c6ed1 100644 --- a/foqus_lib/service/flowsheet.py +++ b/foqus_lib/service/flowsheet.py @@ -18,24 +18,35 @@ Joshua Boverhof, Lawrence Berkeley National Lab """ -import socket +import errno +import json +import logging +import logging.config +import optparse import os +import signal +import socket +import sys +import threading import time -import boto3, optparse -import sys, json, signal, os, errno, uuid, threading, time, traceback +import traceback +import urllib.error +import urllib.parse +import urllib.request +import uuid from os.path import expanduser -import urllib.request, urllib.error, urllib.parse -from foqus_lib.framework.session.session import session as Session -from foqus_lib.framework.session.session import generalSettings as FoqusSettings -from foqus_lib.framework.graph.nodeVars import NodeVarListEx, NodeVarEx + +import boto3 +import botocore.exceptions +from turbine.commands import turbine_simulation_script + from foqus_lib.framework.foqusException.foqusException import * from foqus_lib.framework.graph.graph import Graph +from foqus_lib.framework.graph.nodeVars import NodeVarEx, NodeVarListEx from foqus_lib.framework.plugins import pluginSearch from foqus_lib.framework.pymodel import pymodel -from turbine.commands import turbine_simulation_script -import logging -import logging.config -import botocore.exceptions +from foqus_lib.framework.session.session import generalSettings as FoqusSettings +from foqus_lib.framework.session.session import session as Session WORKING_DIRECTORY = os.path.abspath( os.environ.get("FOQUS_SERVICE_WORKING_DIR", "\\ProgramData\\foqus_service") diff --git a/foqus_lib/service/test/flowsheet_control_test.py b/foqus_lib/service/test/flowsheet_control_test.py index cbc213d97..e584341f5 100644 --- a/foqus_lib/service/test/flowsheet_control_test.py +++ b/foqus_lib/service/test/flowsheet_control_test.py @@ -21,20 +21,21 @@ """ import io import json -import uuid +import os import urllib.request -from urllib.parse import urlparse +import uuid from shutil import copyfile -from botocore.stub import Stubber -import os +from urllib.parse import urlparse import pytest -import foqus_lib import turbine +from botocore.stub import Stubber + +import foqus_lib from foqus_lib.framework.graph.graph import Graph from foqus_lib.framework.graph.node import Node -from foqus_lib.framework.sim.turbineConfiguration import TurbineConfiguration from foqus_lib.framework.session.session import session +from foqus_lib.framework.sim.turbineConfiguration import TurbineConfiguration try: from unittest.mock import MagicMock, PropertyMock, patch diff --git a/foqus_lib/unit_test/massBalance_test.py b/foqus_lib/unit_test/massBalance_test.py index 8bd3b6d5d..7ee17c896 100644 --- a/foqus_lib/unit_test/massBalance_test.py +++ b/foqus_lib/unit_test/massBalance_test.py @@ -12,13 +12,15 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from foqus_lib.framework.graph.graph import * -import traceback -import unittest import copy -import numpy import json import os +import traceback +import unittest + +import numpy + +from foqus_lib.framework.graph.graph import * class testMassBalance(unittest.TestCase): diff --git a/foqus_lib/unit_test/nodeVarList_test.py b/foqus_lib/unit_test/nodeVarList_test.py index dcd391483..110b1ed30 100644 --- a/foqus_lib/unit_test/nodeVarList_test.py +++ b/foqus_lib/unit_test/nodeVarList_test.py @@ -12,12 +12,14 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from foqus_lib.framework.graph.nodeVars import * +import copy +import json import traceback import unittest -import copy + import numpy -import json + +from foqus_lib.framework.graph.nodeVars import * class testNodeVarListSteady(unittest.TestCase): diff --git a/foqus_lib/unit_test/nodeVars_test.py b/foqus_lib/unit_test/nodeVars_test.py index 3e0f80bbb..03b78027a 100644 --- a/foqus_lib/unit_test/nodeVars_test.py +++ b/foqus_lib/unit_test/nodeVars_test.py @@ -12,12 +12,14 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from foqus_lib.framework.graph.nodeVars import * +import copy +import json import traceback import unittest -import copy + import numpy -import json + +from foqus_lib.framework.graph.nodeVars import * class testNodeVarsSteady(unittest.TestCase): diff --git a/foqus_lib/unit_test/node_test.py b/foqus_lib/unit_test/node_test.py index 3ceb1dec2..f5b81fd51 100644 --- a/foqus_lib/unit_test/node_test.py +++ b/foqus_lib/unit_test/node_test.py @@ -12,30 +12,30 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# +import os +import sys +import unittest +from collections import OrderedDict +from importlib import import_module +from pathlib import Path +from typing import List, Tuple + +import pytest + +from foqus_lib.framework.graph.graph import Graph from foqus_lib.framework.graph.node import ( - attempt_load_tensorflow, - attempt_load_sympy, + Node, + NodeEx, attempt_load_pytorch, attempt_load_sklearn, attempt_load_smt, + attempt_load_sympy, + attempt_load_tensorflow, 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 - -from importlib import import_module -from pathlib import Path -from typing import List, Tuple -from collections import OrderedDict -import unittest -import os -import sys -import pytest +from foqus_lib.framework.pymodel.pymodel import pymodel @pytest.fixture(scope="session") diff --git a/foqus_lib/unit_test/turbineLite_test.py b/foqus_lib/unit_test/turbineLite_test.py index 9df01f034..514475249 100644 --- a/foqus_lib/unit_test/turbineLite_test.py +++ b/foqus_lib/unit_test/turbineLite_test.py @@ -12,13 +12,15 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from foqus_lib.framework.sim.turbineConfiguration import * -import traceback -import unittest import copy -import numpy import json import os +import traceback +import unittest + +import numpy + +from foqus_lib.framework.sim.turbineConfiguration import * class turbineLiteTest(unittest.TestCase):