From 41c0c00311f25a20e545f7d65acaa6696508698e Mon Sep 17 00:00:00 2001 From: PeterMeisrimelModelon <92585725+PeterMeisrimelModelon@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:09:33 +0100 Subject: [PATCH] Cleaning up redudant imports --- setup.py | 4 ++-- src/common/core.py | 4 ++-- src/common/io.py | 4 +--- src/common/plotting/plot_gui.py | 5 ++--- src/pyfmi/debug.py | 15 +-------------- src/pyfmi/examples/fmi20_bouncing_ball_native.py | 10 +++++----- src/pyfmi/examples/fmi_bouncing_ball.py | 14 +++++++------- src/pyfmi/examples/fmi_bouncing_ball_cs.py | 14 +++++++------- src/pyfmi/examples/fmi_bouncing_ball_native.py | 2 +- src/pyfmi/examples/fmu_with_input.py | 14 +++++++------- src/pyfmi/examples/fmu_with_input_function.py | 14 +++++++------- src/pyfmi/fmi.pxd | 9 --------- src/pyfmi/fmi.pyx | 4 +--- src/pyfmi/fmi_algorithm_drivers.py | 2 -- src/pyfmi/fmi_coupled.pyx | 4 +--- src/pyfmi/fmi_extended.pyx | 11 ++--------- src/pyfmi/fmi_util.pyx | 15 ++++----------- src/pyfmi/master.pyx | 11 ++++------- src/pyfmi/simulation/assimulo_interface.pyx | 9 ++------- src/pyfmi/tests/test_util.pxd | 2 +- tests/test_fmi_coupled.py | 6 +----- tests/test_fmi_extended.py | 8 -------- tests/test_fmi_master.py | 9 +++------ tests/test_fmi_util.py | 4 ---- tests/test_stream.py | 2 +- 25 files changed, 62 insertions(+), 134 deletions(-) diff --git a/setup.py b/setup.py index 641ac4a0..cda00370 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ import distutils import os import shutil -import numpy as N +import numpy as np import ctypes.util import sys @@ -251,7 +251,7 @@ def check_extensions(): for i in range(len(ext_list)): - ext_list[i].include_dirs = [N.get_include(), "src", os.path.join("src", "pyfmi"), incdirs] + ext_list[i].include_dirs = [np.get_include(), "src", os.path.join("src", "pyfmi"), incdirs] ext_list[i].library_dirs = [libdirs] ext_list[i].language = "c" ext_list[i].libraries = ["fmilib_shared"] if sys.platform.startswith("win") else ["fmilib"] #If windows shared, else static diff --git a/src/common/core.py b/src/common/core.py index b391d56e..8bd8baaf 100644 --- a/src/common/core.py +++ b/src/common/core.py @@ -20,7 +20,7 @@ import zipfile import tempfile -import platform as PL +import platform as plat import os import sys import shutil @@ -261,7 +261,7 @@ def get_platform_dir(): else: platform = 'linux' - if PL.architecture()[0].startswith('32'): + if plat.architecture()[0].startswith('32'): platform += '32' else: platform += '64' diff --git a/src/common/io.py b/src/common/io.py index fd6d3acb..c0e391da 100644 --- a/src/common/io.py +++ b/src/common/io.py @@ -27,8 +27,6 @@ import numpy as N import numpy as np import scipy -import scipy.io -from scipy import interpolate scipy_minmaj = tuple(map(int, scipy.__version__.split('.')[:2])) if scipy_minmaj >= (1, 8): # due to a DeprecationWarning, we do below, this will likely need another change in a future update of scipy. @@ -1405,7 +1403,7 @@ def _get_interpolated_trajectory(self, data_index): time_vector = self._read_trajectory_data(0, False) data = self._read_trajectory_data(data_index, False) - f = interpolate.interp1d(time_vector, data, fill_value="extrapolate") + f = scipy.interpolate.interp1d(time_vector, data, fill_value="extrapolate") self._data_2[data_index] = f(diag_time_vector) diff --git a/src/common/plotting/plot_gui.py b/src/common/plotting/plot_gui.py index 5064fd28..380f929f 100644 --- a/src/common/plotting/plot_gui.py +++ b/src/common/plotting/plot_gui.py @@ -25,6 +25,7 @@ from matplotlib import rcParams import fnmatch import re +import oss #GUI modules try: @@ -49,8 +50,6 @@ except ImportError: print("JModelica Python package was not found.") -#Import general modules -import os as O ID_GRID = 15001 ID_LICENSE = 15002 @@ -290,7 +289,7 @@ def OnMenuOpen(self, event): #If OK load the results if dlg.ShowModal() == wx.ID_OK: for n in dlg.GetFilenames(): - self._OpenFile(O.path.join(dlg.GetDirectory(),n)) + self._OpenFile(os.path.join(dlg.GetDirectory(),n)) dlg.Destroy() #Destroy the popup window diff --git a/src/pyfmi/debug.py b/src/pyfmi/debug.py index c742c5f2..a66e6e41 100644 --- a/src/pyfmi/debug.py +++ b/src/pyfmi/debug.py @@ -20,7 +20,7 @@ """ import numpy as N -import scipy as S +import pylab as P class DebugInformation: @@ -61,7 +61,6 @@ def _load_data(self): break def plot_time_distribution(self, normalized=False): - import pylab as P if normalized: total_time = N.sum(self.real_time) @@ -79,8 +78,6 @@ def plot_time_distribution(self, normalized=False): P.show() def plot_cumulative_time_elapsed(self, log_scale=False): - import pylab as P - cumulative_sum = N.cumsum(self.real_time) if log_scale: @@ -97,8 +94,6 @@ def plot_cumulative_time_elapsed(self, log_scale=False): P.show() def plot_step_size(self): - import pylab as P - P.semilogy(self.simulated_time,N.diff([0.0]+self.simulated_time),drawstyle="steps-pre") P.ylabel("Step-size") P.xlabel("Time [s]") @@ -107,14 +102,10 @@ def plot_step_size(self): P.show() def _plot_events(self): - import pylab as P - for ev in self.events: P.axvline(x=ev,color='r') def plot_event_indicators(self, mask=None, region=None): - import pylab as P - ev_ind = N.array(self.event_indicators) time = N.array(self.simulated_time) ev_ind_name = N.array(["event_ind_%d"%i for i in range(len(ev_ind[0,:]))]) @@ -183,8 +174,6 @@ def _load_data(self): def plot_order(self): - import pylab as P - P.plot(self.simulated_time, self.order,drawstyle="steps-pre") P.grid() P.xlabel("Time [s]") @@ -198,8 +187,6 @@ def plot_order(self): P.show() def plot_error(self, threshold=None, region=None, legend=True): - import pylab as P - err = N.array(self.weighted_error) time = N.array(self.simulated_time) if region: diff --git a/src/pyfmi/examples/fmi20_bouncing_ball_native.py b/src/pyfmi/examples/fmi20_bouncing_ball_native.py index b9d9240c..9911313f 100644 --- a/src/pyfmi/examples/fmi20_bouncing_ball_native.py +++ b/src/pyfmi/examples/fmi20_bouncing_ball_native.py @@ -14,16 +14,16 @@ # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -import os as O +import os import pylab as P import numpy as N from pyfmi import load_fmu -curr_dir = O.path.dirname(O.path.abspath(__file__)); -path_to_fmus = O.path.join(curr_dir, 'files', 'FMUs') -path_to_fmus_me2 = O.path.join(path_to_fmus,"ME2.0") +curr_dir = os.path.dirname(os.path.abspath(__file__)) +path_to_fmus = os.path.join(curr_dir, 'files', 'FMUs') +path_to_fmus_me2 = os.path.join(path_to_fmus,"ME2.0") def run_demo(with_plots=True): """ @@ -39,7 +39,7 @@ def run_demo(with_plots=True): """ #Load the FMU by specifying the fmu and the directory - bouncing_fmu = load_fmu(O.path.join(path_to_fmus_me2, 'bouncingBall.fmu')) + bouncing_fmu = load_fmu(os.path.join(path_to_fmus_me2, 'bouncingBall.fmu')) Tstart = 0.5 #The start time. Tend = 3.0 #The final simulation time. diff --git a/src/pyfmi/examples/fmi_bouncing_ball.py b/src/pyfmi/examples/fmi_bouncing_ball.py index 0245dc80..f15b080c 100644 --- a/src/pyfmi/examples/fmi_bouncing_ball.py +++ b/src/pyfmi/examples/fmi_bouncing_ball.py @@ -14,16 +14,16 @@ # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -import os as O +import os import pylab as P import numpy as N from pyfmi import load_fmu -curr_dir = O.path.dirname(O.path.abspath(__file__)); -path_to_fmus = O.path.join(curr_dir, 'files', 'FMUs','ME1.0') -path_to_fmus2 = O.path.join(curr_dir, 'files', 'FMUs','ME2.0') +curr_dir = os.path.dirname(os.path.abspath(__file__)); +path_to_fmus = os.path.join(curr_dir, 'files', 'FMUs','ME1.0') +path_to_fmus2 = os.path.join(curr_dir, 'files', 'FMUs','ME2.0') def run_demo(with_plots=True, version="2.0"): """ @@ -31,9 +31,9 @@ def run_demo(with_plots=True, version="2.0"): ME FMUs version 1.0 and 2.0. """ if version == '1.0': - fmu_name = O.path.join(path_to_fmus,'bouncingBall.fmu') + fmu_name = os.path.join(path_to_fmus,'bouncingBall.fmu') else: - fmu_name = O.path.join(path_to_fmus2,'bouncingBall.fmu') + fmu_name = os.path.join(path_to_fmus2,'bouncingBall.fmu') model = load_fmu(fmu_name) @@ -49,7 +49,7 @@ def run_demo(with_plots=True, version="2.0"): # Plot the solution if with_plots: # Plot the height - fig = P.figure() + P.figure() P.clf() P.subplot(2,1,1) P.plot(t, h_res) diff --git a/src/pyfmi/examples/fmi_bouncing_ball_cs.py b/src/pyfmi/examples/fmi_bouncing_ball_cs.py index 236e3cf8..c3e8785c 100644 --- a/src/pyfmi/examples/fmi_bouncing_ball_cs.py +++ b/src/pyfmi/examples/fmi_bouncing_ball_cs.py @@ -14,16 +14,16 @@ # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -import os as O +import os import pylab as P import numpy as N from pyfmi import load_fmu -curr_dir = O.path.dirname(O.path.abspath(__file__)); -path_to_fmus = O.path.join(curr_dir, 'files', 'FMUs', 'CS1.0') -path_to_fmus2 = O.path.join(curr_dir, 'files', 'FMUs', 'CS2.0') +curr_dir = os.path.dirname(os.path.abspath(__file__)); +path_to_fmus = os.path.join(curr_dir, 'files', 'FMUs', 'CS1.0') +path_to_fmus2 = os.path.join(curr_dir, 'files', 'FMUs', 'CS2.0') def run_demo(with_plots=True, version='2.0'): """ @@ -32,9 +32,9 @@ def run_demo(with_plots=True, version='2.0'): """ if version == '1.0': - fmu_name = O.path.join(path_to_fmus,'bouncingBall.fmu') + fmu_name = os.path.join(path_to_fmus,'bouncingBall.fmu') else: - fmu_name = O.path.join(path_to_fmus2,'bouncingBall.fmu') + fmu_name = os.path.join(path_to_fmus2,'bouncingBall.fmu') model = load_fmu(fmu_name) res = model.simulate(final_time=2.) @@ -49,7 +49,7 @@ def run_demo(with_plots=True, version='2.0'): # Plot the solution if with_plots: # Plot the height - fig = P.figure() + P.figure() P.clf() P.subplot(2,1,1) P.plot(t, h_res) diff --git a/src/pyfmi/examples/fmi_bouncing_ball_native.py b/src/pyfmi/examples/fmi_bouncing_ball_native.py index e00a81f4..bf747260 100644 --- a/src/pyfmi/examples/fmi_bouncing_ball_native.py +++ b/src/pyfmi/examples/fmi_bouncing_ball_native.py @@ -21,7 +21,7 @@ from pyfmi import load_fmu -curr_dir = os.path.dirname(os.path.abspath(__file__)); +curr_dir = os.path.dirname(os.path.abspath(__file__)) path_to_fmus = os.path.join(curr_dir, 'files', 'FMUs') path_to_fmus_me1 = os.path.join(path_to_fmus,"ME1.0") path_to_fmus_cs1 = os.path.join(path_to_fmus,"CS1.0") diff --git a/src/pyfmi/examples/fmu_with_input.py b/src/pyfmi/examples/fmu_with_input.py index 2f7684f3..177b60d0 100644 --- a/src/pyfmi/examples/fmu_with_input.py +++ b/src/pyfmi/examples/fmu_with_input.py @@ -15,16 +15,16 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -import os as O +import os import numpy as N import pylab as p from pyfmi import load_fmu -curr_dir = O.path.dirname(O.path.abspath(__file__)); -path_to_fmus = O.path.join(curr_dir, 'files', 'FMUs') -path_to_fmus_me1 = O.path.join(path_to_fmus,"ME1.0") -path_to_fmus_cs1 = O.path.join(path_to_fmus,"CS1.0") +curr_dir = os.path.dirname(os.path.abspath(__file__)) +path_to_fmus = os.path.join(curr_dir, 'files', 'FMUs') +path_to_fmus_me1 = os.path.join(path_to_fmus,"ME1.0") +path_to_fmus_cs1 = os.path.join(path_to_fmus,"CS1.0") def run_demo(with_plots=True): """ @@ -32,7 +32,7 @@ def run_demo(with_plots=True): See also simulation_with_input.py """ - fmu_name = O.path.join(path_to_fmus_me1,'SecondOrder.fmu') + fmu_name = os.path.join(path_to_fmus_me1,'SecondOrder.fmu') # Generate input t = N.linspace(0.,10.,100) @@ -61,7 +61,7 @@ def run_demo(with_plots=True): assert N.abs(res.final('u')*1.e1 - (-8.3907153)) < 1e-3 if with_plots: - fig = p.figure() + p.figure() p.subplot(2,1,1) p.plot(time_sim, x1_sim, time_sim, x2_sim) p.subplot(2,1,2) diff --git a/src/pyfmi/examples/fmu_with_input_function.py b/src/pyfmi/examples/fmu_with_input_function.py index c97db89e..e0abaaa9 100644 --- a/src/pyfmi/examples/fmu_with_input_function.py +++ b/src/pyfmi/examples/fmu_with_input_function.py @@ -15,16 +15,16 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -import os as O +import os import numpy as N import pylab as p from pyfmi import load_fmu -curr_dir = O.path.dirname(O.path.abspath(__file__)); -path_to_fmus = O.path.join(curr_dir, 'files', 'FMUs') -path_to_fmus_me1 = O.path.join(path_to_fmus,"ME1.0") -path_to_fmus_cs1 = O.path.join(path_to_fmus,"CS1.0") +curr_dir = os.path.dirname(os.path.abspath(__file__)) +path_to_fmus = os.path.join(curr_dir, 'files', 'FMUs') +path_to_fmus_me1 = os.path.join(path_to_fmus,"ME1.0") +path_to_fmus_cs1 = os.path.join(path_to_fmus,"CS1.0") def run_demo(with_plots=True): """ @@ -32,7 +32,7 @@ def run_demo(with_plots=True): See also simulation_with_input.py """ - fmu_name = O.path.join(path_to_fmus_me1,'SecondOrder.fmu') + fmu_name = os.path.join(path_to_fmus_me1,'SecondOrder.fmu') # Create input object input_object = ('u', N.cos) @@ -53,7 +53,7 @@ def run_demo(with_plots=True): assert N.abs(res.final('u')*1.e1 - (1.54251449888)) < 1e-3 if with_plots: - fig = p.figure() + p.figure() p.subplot(2,1,1) p.plot(time_sim, x1_sim, time_sim, x2_sim) p.subplot(2,1,2) diff --git a/src/pyfmi/fmi.pxd b/src/pyfmi/fmi.pxd index 1c5bd842..ad27c383 100644 --- a/src/pyfmi/fmi.pxd +++ b/src/pyfmi/fmi.pxd @@ -17,18 +17,9 @@ """ Module containing the FMI interface Python wrappers. """ -import os -import sys -import logging -import fnmatch -import re -from collections import OrderedDict - import numpy as N cimport numpy as N -N.import_array() - cimport pyfmi.fmil_import as FMIL cdef FMIL.fmi_version_enu_t import_and_get_version(FMIL.fmi_import_context_t*, char*, char*, int) diff --git a/src/pyfmi/fmi.pyx b/src/pyfmi/fmi.pyx index 5d02cf8f..bc29d43e 100644 --- a/src/pyfmi/fmi.pyx +++ b/src/pyfmi/fmi.pyx @@ -27,7 +27,6 @@ For profiling: # distutils: define_macros=CYTHON_TRACE_NOGIL=1 """ import os -import sys import logging import fnmatch import re @@ -42,8 +41,7 @@ from numpy cimport PyArray_DATA cimport pyfmi.fmil_import as FMIL -from pyfmi.common.core import create_temp_dir, delete_temp_dir -from pyfmi.common.core import create_temp_file, delete_temp_file +from pyfmi.common.core import create_temp_dir from pyfmi.fmi_util import cpr_seed, enable_caching from pyfmi.fmi_util cimport encode, decode diff --git a/src/pyfmi/fmi_algorithm_drivers.py b/src/pyfmi/fmi_algorithm_drivers.py index d68065ab..70618d33 100644 --- a/src/pyfmi/fmi_algorithm_drivers.py +++ b/src/pyfmi/fmi_algorithm_drivers.py @@ -19,7 +19,6 @@ pyfmi.fmi.FMUModel*.simulate. """ -#from abc import ABCMeta, abstractmethod import logging as logging_module import time import numpy as N @@ -1302,7 +1301,6 @@ def solve(self): """ Runs the estimation. """ - import scipy as sci import scipy.optimize as sciopt from pyfmi.fmi_util import parameter_estimation_f diff --git a/src/pyfmi/fmi_coupled.pyx b/src/pyfmi/fmi_coupled.pyx index ba3f2967..7885c9e6 100644 --- a/src/pyfmi/fmi_coupled.pyx +++ b/src/pyfmi/fmi_coupled.pyx @@ -21,15 +21,13 @@ import pyfmi.fmi as fmi from pyfmi.fmi cimport FMUModelME2 cimport fmil_import as FMIL -from pyfmi.fmi_util import cpr_seed, enable_caching, Graph +from pyfmi.fmi_util import enable_caching, Graph from collections import OrderedDict import time -import warnings import numpy as np cimport numpy as np import scipy.optimize as sopt -import scipy def init_f_block(u, coupled, block): diff --git a/src/pyfmi/fmi_extended.pyx b/src/pyfmi/fmi_extended.pyx index 01ee7045..07d37ce9 100644 --- a/src/pyfmi/fmi_extended.pyx +++ b/src/pyfmi/fmi_extended.pyx @@ -20,22 +20,15 @@ """ Module containing the FMI interface Python wrappers. """ -import os -import sys -import logging -import fnmatch -import re -from collections import OrderedDict +import logging import numpy as N cimport numpy as N -N.import_array() - cimport fmil_import as FMIL from pyfmi.fmi cimport FMUModelME1 from pyfmi.fmi import FMUException -from pyfmi.fmi import FMI_OK, FMI_DEFAULT_LOG_LEVEL, FMI_ME +from pyfmi.fmi import FMI_OK, FMI_DEFAULT_LOG_LEVEL cdef class FMUModelME1Extended(FMUModelME1): diff --git a/src/pyfmi/fmi_util.pyx b/src/pyfmi/fmi_util.pyx index cb4053a4..deae039b 100644 --- a/src/pyfmi/fmi_util.pyx +++ b/src/pyfmi/fmi_util.pyx @@ -21,24 +21,17 @@ Module containing the FMI interface Python wrappers. """ import collections -from collections import OrderedDict import itertools -from operator import attrgetter -import numpy as np -from numpy.compat import asbytes - -from pyfmi.common import encode +import numpy as np cimport numpy as np -cimport fmil_import as FMIL -from cpython cimport array -from pyfmi.fmi cimport FMUModelME2, FMUModelBase +cimport fmil_import as FMIL +from pyfmi.fmi cimport FMUModelME2 import functools import marshal import pyfmi.fmi as fmi -import sys cpdef decode(x): if isinstance(x, bytes): @@ -647,7 +640,7 @@ class Graph: if self.graph_info[node]["type"] == GRAPH_OUTPUT: model = self.graph_info[node]["model"] if not (model in trees): - trees[model] = OrderedDict() + trees[model] = collections.OrderedDict() trees[model][node] = self.dfs(node) joined_nodes[node] = [node] else: diff --git a/src/pyfmi/master.pyx b/src/pyfmi/master.pyx index 3ab68ff1..a9942b25 100644 --- a/src/pyfmi/master.pyx +++ b/src/pyfmi/master.pyx @@ -19,7 +19,7 @@ import pyfmi.fmi as fmi from pyfmi.common.algorithm_drivers import OptionBase, InvalidAlgorithmOptionException, AssimuloSimResult -from pyfmi.common.io import ResultDymolaTextual, ResultHandlerFile, ResultHandlerDummy, ResultHandlerBinaryFile, ResultDymolaBinary +from pyfmi.common.io import ResultHandlerFile, ResultHandlerDummy, ResultHandlerBinaryFile from pyfmi.common.core import TrajectoryLinearInterpolation from pyfmi.common.core import TrajectoryUserFunction @@ -27,17 +27,14 @@ from timeit import default_timer as timer import fnmatch import sys -import re from collections import OrderedDict import time import numpy as np import warnings cimport numpy as np import scipy.sparse as sp -import scipy.linalg as lin import scipy.sparse.linalg as splin import scipy.optimize as sopt -import scipy.version from pyfmi.fmi cimport FMUModelCS2 from cpython cimport bool @@ -1323,15 +1320,15 @@ cdef class Master: if C is not None: C = C.todense() _ident_matrix = np.eye(*DL.shape) - LIDLC = self.L.dot(lin.solve(_ident_matrix-DL,C)) + LIDLC = self.L.dot(np.linalg.solve(_ident_matrix-DL,C)) print(" , rho(L(I-DL)^(-1)C)=%s"%(str(numpy.linalg.eig(LIDLC)[0]))) A = self.compute_global_A() B = self.compute_global_B() if C is not None and A is not None and B is not None: A = A.todense(); B = B.todense() eAH = slin.expm(A*step_size) - K1 = lin.solve(_ident_matrix-DL,C) - K2 = lin.solve(A,(eAH-np.eye(*eAH.shape)).dot(B.dot(self.L.todense()))) + K1 = np.linalg.solve(_ident_matrix-DL,C) + K2 = np.linalg.solve(A,(eAH-np.eye(*eAH.shape)).dot(B.dot(self.L.todense()))) R1 = np.hstack((eAH, K1)) R2 = np.hstack((K2.dot(eAH), K2.dot(K1))) G = np.vstack((R1,R2)) diff --git a/src/pyfmi/simulation/assimulo_interface.pyx b/src/pyfmi/simulation/assimulo_interface.pyx index a426876f..288c41c3 100644 --- a/src/pyfmi/simulation/assimulo_interface.pyx +++ b/src/pyfmi/simulation/assimulo_interface.pyx @@ -25,22 +25,17 @@ import logging as logging_module from operator import index import numpy as N -from numpy.core.einsumfunc import einsum - -from pyfmi.fmi import FMUException cimport numpy as N -import numpy.linalg as LIN import scipy.sparse as sp import time -from pyfmi.common.io import ResultWriterDymola, ResultHandlerBinaryFile +from pyfmi.common.io import ResultWriterDymola import pyfmi.fmi as fmi +from pyfmi.fmi import FMUException from pyfmi.fmi cimport FMUModelME2 -from pyfmi.common.core import TrajectoryLinearInterpolation from timeit import default_timer as timer -import time cimport fmil_import as FMIL try: diff --git a/src/pyfmi/tests/test_util.pxd b/src/pyfmi/tests/test_util.pxd index 9ddbec5b..bd175471 100644 --- a/src/pyfmi/tests/test_util.pxd +++ b/src/pyfmi/tests/test_util.pxd @@ -30,4 +30,4 @@ cdef class _ForTestingFMUModelME2(FMUModelME2): cdef int _get_integer(self, FMIL.fmi2_value_reference_t[:] valueref, size_t _size, FMIL.fmi2_integer_t[:] values) cdef int _get_boolean(self, FMIL.fmi2_value_reference_t[:] valueref, size_t _size, FMIL.fmi2_real_t[:] values) cdef int _get_nominal_continuous_states_fmil(self, FMIL.fmi2_real_t* xnominal, size_t nx) - cpdef set_initialized_fmu(self, int value) \ No newline at end of file + cpdef set_initialized_fmu(self, int value) diff --git a/tests/test_fmi_coupled.py b/tests/test_fmi_coupled.py index d0b26f88..b1b622a8 100644 --- a/tests/test_fmi_coupled.py +++ b/tests/test_fmi_coupled.py @@ -17,16 +17,12 @@ import nose import os -import numpy as np from pyfmi import testattr -from pyfmi.fmi import FMUException, FMUModelME1, FMUModelCS1, load_fmu, FMUModelCS2, FMUModelME2, PyEventInfo +from pyfmi.fmi import FMUModelME2 from pyfmi.fmi_coupled import CoupledFMUModelME2 -import pyfmi.fmi_util as fmi_util import pyfmi.fmi as fmi -import pyfmi.fmi_algorithm_drivers as fmi_algorithm_drivers from pyfmi.tests.test_util import Dummy_FMUModelME2 -from pyfmi.common.io import ResultHandler assimulo_installed = True try: diff --git a/tests/test_fmi_extended.py b/tests/test_fmi_extended.py index 884bb1f9..b0655012 100644 --- a/tests/test_fmi_extended.py +++ b/tests/test_fmi_extended.py @@ -15,19 +15,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import nose import os import numpy as np from pyfmi import testattr -from pyfmi.fmi import FMUException, FMUModelME1, FMUModelCS1, load_fmu, FMUModelCS2, FMUModelME2, PyEventInfo -from pyfmi.fmi_coupled import CoupledFMUModelME2 from pyfmi.fmi_extended import FMUModelME1Extended -import pyfmi.fmi_util as fmi_util -import pyfmi.fmi as fmi -import pyfmi.fmi_algorithm_drivers as fmi_algorithm_drivers -from pyfmi.tests.test_util import Dummy_FMUModelME2 -from pyfmi.common.io import ResultHandler file_path = os.path.dirname(os.path.abspath(__file__)) diff --git a/tests/test_fmi_master.py b/tests/test_fmi_master.py index 811c4b01..13e58749 100644 --- a/tests/test_fmi_master.py +++ b/tests/test_fmi_master.py @@ -19,12 +19,9 @@ import os import numpy as np -from pyfmi import testattr -from pyfmi.fmi import FMUException, FMUModelME1, FMUModelCS1, load_fmu, FMUModelCS2, FMUModelME2 -import pyfmi.fmi_util as fmi_util -import pyfmi.fmi as fmi -from pyfmi import Master -from pyfmi.tests.test_util import Dummy_FMUModelME2, Dummy_FMUModelCS2 +from pyfmi import testattr, Master +from pyfmi.fmi import FMUException, FMUModelCS2, FMUModelME2 +from pyfmi.tests.test_util import Dummy_FMUModelCS2 file_path = os.path.dirname(os.path.abspath(__file__)) diff --git a/tests/test_fmi_util.py b/tests/test_fmi_util.py index eb969edb..5c03a930 100644 --- a/tests/test_fmi_util.py +++ b/tests/test_fmi_util.py @@ -19,15 +19,11 @@ Module containing the tests for the FMI interface. """ -import nose -import os import numpy as np from collections import OrderedDict from pyfmi import testattr -from pyfmi.fmi import FMUException, FMUModelME1, FMUModelCS1, load_fmu, FMUModelCS2, FMUModelME2, PyEventInfo import pyfmi.fmi_util as fmi_util -import pyfmi.fmi as fmi class Test_FMIUtil: diff --git a/tests/test_stream.py b/tests/test_stream.py index a517eb51..758c7af1 100644 --- a/tests/test_stream.py +++ b/tests/test_stream.py @@ -277,4 +277,4 @@ def test_extract_xml_log_into_stream(self): xml_log = fmu.extract_xml_log() err_msg = "Unequal xml files, please compare the contents of:\n{}\nand\n{}".format(xml_file1, xml_log) - nose.tools.assert_true(compare_files(xml_file1, xml_log), err_msg) \ No newline at end of file + nose.tools.assert_true(compare_files(xml_file1, xml_log), err_msg)