From 21dc79522fe6c212b349a5ca87ece3a88a46a634 Mon Sep 17 00:00:00 2001 From: Matthias Cuntz Date: Thu, 13 Feb 2020 12:40:50 +0100 Subject: [PATCH] Restructured package with functions and utils subpackages. --- AUTHORS.md | 8 ++- CHANGELOG.md | 3 + README.md | 2 +- docs/source/conf.py | 2 +- ...ns.rst => functions.general_functions.rst} | 2 +- ...ns.rst => functions.sa_test_functions.rst} | 2 +- .../source/{utils.rst => functions.utils.rst} | 2 +- docs/source/index.rst | 2 +- docs/source/morris_method.rst | 2 +- docs/source/package.rst | 14 ++-- docs/source/userguide.rst | 70 +++++++++---------- ...wrapper.rst => utils.function_wrapper.rst} | 2 +- docs/source/{std_io.rst => utils.std_io.rst} | 2 +- docs/source/{tee.rst => utils.tee.rst} | 2 +- pyeee/__init__.py | 32 ++------- pyeee/eee.py | 20 +++--- pyeee/functions/__init__.py | 40 +++++++++++ pyeee/{ => functions}/general_functions.py | 22 +++--- pyeee/{ => functions}/sa_test_functions.py | 2 +- pyeee/{ => functions}/utils.py | 2 +- pyeee/screening.py | 1 - pyeee/utils/__init__.py | 41 +++++++++++ pyeee/{ => utils}/function_wrapper.py | 2 +- pyeee/{ => utils}/std_io.py | 2 +- pyeee/{ => utils}/tee.py | 2 +- pyeee/version.py | 4 +- tests/ishiexe.py | 5 +- tests/test_eee.py | 20 +++--- tests/test_function_wrapper.py | 41 ++++++----- tests/test_general_functions.py | 14 ++-- tests/test_morris.py | 4 +- tests/test_sa_test_functions.py | 6 +- tests/test_screening.py | 51 ++++++++------ tests/test_std_io.py | 14 ++-- tests/test_tee.py | 2 +- 35 files changed, 261 insertions(+), 181 deletions(-) rename docs/source/{general_functions.rst => functions.general_functions.rst} (75%) rename docs/source/{sa_test_functions.rst => functions.sa_test_functions.rst} (75%) rename docs/source/{utils.rst => functions.utils.rst} (78%) rename docs/source/{function_wrapper.rst => utils.function_wrapper.rst} (77%) rename docs/source/{std_io.rst => utils.std_io.rst} (80%) rename docs/source/{tee.rst => utils.tee.rst} (81%) create mode 100644 pyeee/functions/__init__.py rename pyeee/{ => functions}/general_functions.py (93%) rename pyeee/{ => functions}/sa_test_functions.py (99%) rename pyeee/{ => functions}/utils.py (97%) create mode 100644 pyeee/utils/__init__.py rename pyeee/{ => utils}/function_wrapper.py (99%) rename pyeee/{ => utils}/std_io.py (99%) rename pyeee/{ => utils}/tee.py (98%) diff --git a/AUTHORS.md b/AUTHORS.md index a48b5ae..e5146b8 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -13,5 +13,9 @@ Copyright (c) 2012-2020 Matthias Cuntz, Juliane Mai ## Main Authors -- [Matthias Cuntz](https://github.com/mcuntz), Email: mc (at) macu (dot) de -- [Juliane Mai](https://github.com/jmai) +- [Matthias Cuntz](https://github.com/mcuntz), E-mail: mc (at) macu (dot) de +- [Juliane Mai](https://github.com/julemai) + +## Contributing Authors + +- [Sebastian Müller](https://github.com/MuellerSeb) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b5039a..4d8c32f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes after its initial development up to January 2020 (v0.2) are documented in this file. +### v1.0 + - Restructured package with functions and utils subpackages. + ### v0.9 - Added mention to template of Sebastian Mueller in README.md and documentation. - Renamed morris.py to morris_method.py. diff --git a/README.md b/README.md index 38d7349..fd6cad1 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ can then simply call it as `func(x)`, so that `x` is passed to *pyeee* provides wrappers to use with partial. ```python - from pyeee import func_wrapper + from pyeee.utils import func_wrapper args = [a, b] kwargs = {} func = partial(func_wrapper, ishigami, args, kwargs) diff --git a/docs/source/conf.py b/docs/source/conf.py index a257fb7..a21a273 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -98,7 +98,7 @@ def setup(app): # General information about the project. project = "pyeee" -copyright = "2019, Matthias Cuntz" +copyright = "2019-2020, Matthias Cuntz" author = "Matthias Cuntz" # The version info for the project you're documenting, acts as replacement for diff --git a/docs/source/general_functions.rst b/docs/source/functions.general_functions.rst similarity index 75% rename from docs/source/general_functions.rst rename to docs/source/functions.general_functions.rst index aaa1e51..7c51702 100644 --- a/docs/source/general_functions.rst +++ b/docs/source/functions.general_functions.rst @@ -1,7 +1,7 @@ pyeee.general_functions ======================= -.. automodule:: pyeee.general_functions +.. automodule:: pyeee.functions.general_functions :members: :undoc-members: :inherited-members: diff --git a/docs/source/sa_test_functions.rst b/docs/source/functions.sa_test_functions.rst similarity index 75% rename from docs/source/sa_test_functions.rst rename to docs/source/functions.sa_test_functions.rst index 821dac3..a236007 100644 --- a/docs/source/sa_test_functions.rst +++ b/docs/source/functions.sa_test_functions.rst @@ -1,7 +1,7 @@ pyeee.sa_test_functions ======================= -.. automodule:: pyeee.sa_test_functions +.. automodule:: pyeee.functions.sa_test_functions :members: :undoc-members: :inherited-members: diff --git a/docs/source/utils.rst b/docs/source/functions.utils.rst similarity index 78% rename from docs/source/utils.rst rename to docs/source/functions.utils.rst index 8534601..dc9482d 100644 --- a/docs/source/utils.rst +++ b/docs/source/functions.utils.rst @@ -1,7 +1,7 @@ pyeee.utils ================= -.. automodule:: pyeee.utils +.. automodule:: pyeee.functions.utils :members: :undoc-members: :inherited-members: diff --git a/docs/source/index.rst b/docs/source/index.rst index bc92b04..fe1a9e7 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -140,7 +140,7 @@ Function wrappers .. code-block:: python - from pyeee import func_wrapper + from pyeee.utils import func_wrapper args = [a, b] kwargs = {} func = partial(func_wrapper, ishigami, args, kwargs) diff --git a/docs/source/morris_method.rst b/docs/source/morris_method.rst index 6d89c59..d3fe425 100644 --- a/docs/source/morris_method.rst +++ b/docs/source/morris_method.rst @@ -1,7 +1,7 @@ pyeee.morris ================= -.. automodule:: pyeee.morris +.. automodule:: pyeee.morris_method :members: :undoc-members: :inherited-members: diff --git a/docs/source/package.rst b/docs/source/package.rst index a42b606..3f089f5 100644 --- a/docs/source/package.rst +++ b/docs/source/package.rst @@ -11,11 +11,11 @@ pyeee API .. toctree:: eee.rst - function_wrapper.rst - general_functions.rst - morris_method.rst - sa_test_functions.rst screening.rst - std_io.rst - tee.rst - utils.rst + morris_method.rst + functions.general_functions.rst + functions.sa_test_functions.rst + functions.utils.rst + utils.function_wrapper.rst + utils.std_io.rst + utils.tee.rst diff --git a/docs/source/userguide.rst b/docs/source/userguide.rst index eac2dd8..793ece2 100644 --- a/docs/source/userguide.rst +++ b/docs/source/userguide.rst @@ -274,11 +274,11 @@ finished and `x`, `a` and `b` are passed to `ishigami`. ``pyeee`` provides wrapper functions to work with :any:`functools.partial`. `call_ishigami` can be replaced by the wrapper function of ``pyeee``: -:func:`~pyeee.function_wrapper.func_wrapper`: +:func:`~pyeee.utils.function_wrapper.func_wrapper`: .. code-block:: python - from pyeee import func_wrapper + from pyeee.utils import func_wrapper arg = [a, b] kwarg = {} func = partial(func_wrapper, ishigami, arg, kwarg) @@ -291,7 +291,7 @@ finally passes `x`, `arg` and `kwarg` to `func(x, *arg, **kwarg)`. ``pyeee`` provides also a wrapper function to work with masks as above. To exclude the second parameter :math:`x_1` from screening of the Ishigami-Homma function again, `x0` and `mask` must be given to -:func:`~pyeee.function_wrapper.func_mask_wrapper` as well. Then +:func:`~pyeee.utils.function_wrapper.func_mask_wrapper` as well. Then Elementary Effects will be calculated only for the remaining parameters, between `lb[mask]` and `ub[mask]`. All other non-masked parameters will be taken as `x0`. Remember that `mask` is @@ -300,7 +300,7 @@ an include-mask, i.e. all `mask==True` will be screened and all .. code-block:: python - from pyeee import func_mask_wrapper + from pyeee.utils import func_mask_wrapper func = partial(func_mask_wrapper, ishigami, x0, mask, arg, kwarg) out = ee(func, lb[mask], ub[mask]) @@ -354,7 +354,7 @@ effects :func:`~pyeee.screening.ee`: def ishigami(x, a, b): return np.sin(x[0]) + a * np.sin(x[1])**2 + b * x[2]**4 * np.sin(x[0]) - from pyeee import func_wrapper + from pyeee.utils import func_wrapper arg = [a, b] kwarg = {} func = partial(func_wrapper, ishigami, arg, kwarg) @@ -379,12 +379,12 @@ effects :func:`~pyeee.screening.ee`: sensitive parameters and `False` for noninformative parameters. The mask can be combined by `logical_and` with an incoming mask. -Note if you use :func:`~pyeee.function_wrapper.func_mask_wrapper`, `out` +Note if you use :func:`~pyeee.utils.function_wrapper.func_mask_wrapper`, `out` has the dimension of the `mask==True` elements: .. code-block:: python - from pyeee import func_mask_wrapper + from pyeee.utils import func_mask_wrapper func = partial(func_mask_wrapper, ishigami, x0, mask, arg, kwarg) out = eee(func, lb[mask], ub[mask]) @@ -469,7 +469,7 @@ reading in the three parameters :math:`x_0, x_1, x_2` from a return np.sin(x[0]) + np.sin(x[1])**2 + x[2]**4 * np.sin(x[0]) # read parameters - from pyeee import standard_parameter_reader + from pyeee.utils import standard_parameter_reader ## from std_io import standard_parameter_reader pfile = 'params.txt' x = standard_parameter_reader(pfile) @@ -490,12 +490,12 @@ This program can be called on the command line with: python ishiexe.py The external program can be used in ``pyeee`` with :any:`functools.partial` and the -wrapper function :func:`~pyeee.function_wrapper.exe_wrapper`: +wrapper function :func:`~pyeee.utils.function_wrapper.exe_wrapper`: .. code-block:: python from functools import partial - from pyeee import exe_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.utils import exe_wrapper, standard_parameter_writer, standard_objective_reader ishi = ['python', 'ishiexe.py'] parameterfile = 'params.txt' objectivefile = 'obj.txt' @@ -509,10 +509,10 @@ wrapper function :func:`~pyeee.function_wrapper.exe_wrapper`: from pyeee import ee out = ee(func, lb, ub) -:func:`~pyeee.std_io.standard_parameter_reader` and -:func:`~pyeee.std_io.standard_parameter_writer` are convenience +:func:`~pyeee.utils.std_io.standard_parameter_reader` and +:func:`~pyeee.utils.std_io.standard_parameter_writer` are convenience functions that read and write one parameter per line in a file without -a header. The function :func:`~pyeee.std_io.standard_objective_reader` +a header. The function :func:`~pyeee.utils.std_io.standard_objective_reader` simply reads one value from a file without header. The empty directory at the end will be explained below at `Further arguments of wrappers`_. @@ -523,11 +523,11 @@ any compiled executable from C, Fortran or alike. Exclude parameters from screening --------------------------------- -Similar to :func:`~pyeee.function_wrapper.func_mask_wrapper`, there is +Similar to :func:`~pyeee.utils.function_wrapper.func_mask_wrapper`, there is also a wrapper to work with masks and external executables: -:func:`~pyeee.function_wrapper.exe_mask_wrapper`. To exclude the second parameter :math:`x_1` from screening of +:func:`~pyeee.utils.function_wrapper.exe_mask_wrapper`. To exclude the second parameter :math:`x_1` from screening of the Ishigami-Homma function again, `x0` and `mask` must be given to -:func:`~pyeee.function_wrapper.exe_mask_wrapper` as well. Remember that `mask` is +:func:`~pyeee.utils.function_wrapper.exe_mask_wrapper` as well. Remember that `mask` is an include-mask, i.e. all `mask==True` will be screened and all `mask==False` will not be screened: @@ -561,8 +561,8 @@ Further arguments of wrappers ----------------------------- The user can pass further arguments to -:func:`~pyeee.function_wrapper.exe_wrapper` and -:func:`~pyeee.function_wrapper.exe_mask_wrapper` via a dictionary at +:func:`~pyeee.utils.function_wrapper.exe_wrapper` and +:func:`~pyeee.utils.function_wrapper.exe_mask_wrapper` via a dictionary at the end of the call. Setting the key `shell` to `True` passes `shell=True` to :func:`subprocess.check_output`, which makes :func:`subprocess.check_output` open a shell for running the external @@ -603,12 +603,12 @@ parameter value, 4. maximum parameter value, 5. parameter mask, e.g.: 3 1.0 -3.1415 3.1415 1 One can use -:func:`~pyeee.std_io.standard_parameter_reader_bounds_mask` in this +:func:`~pyeee.utils.std_io.standard_parameter_reader_bounds_mask` in this case. Parameter bounds and mask can be passed via `pargs`: .. code-block:: python - from pyeee import standard_parameter_reader_bounds_mask + from pyeee.utils import standard_parameter_reader_bounds_mask ishi = ['python', 'ishiexe.py'] func = partial(exe_wrapper, ishi, parameterfile, standard_parameter_reader_bounds_mask, @@ -620,7 +620,7 @@ Or in case of exclusion of :math:`x_1`: .. code-block:: python - from pyeee import standard_parameter_reader_bounds_mask + from pyeee.utils import standard_parameter_reader_bounds_mask func = partial(exe_mask_wrapper, ishi, x0, mask, parameterfile, standard_parameter_reader_bounds_mask, objectivefile, standard_objective_reader, @@ -641,13 +641,13 @@ the sampled parameter values. The parameterfile might look like: x2 = 1.0 / -The function :func:`~pyeee.std_io.sub_names_params_files` (which is -identical to :func:`~pyeee.std_io.sub_names_params_files_ignorecase`) +The function :func:`~pyeee.utils.std_io.sub_names_params_files` (which is +identical to :func:`~pyeee.utils.std_io.sub_names_params_files_ignorecase`) can be used and parameter names are passed via `pargs`: .. code-block:: python - from pyeee import sub_names_params_files + from pyeee.utils import sub_names_params_files pnames = ['x0', 'x1', 'x2'] func = partial(exe_wrapper, ishi, parameterfile, sub_names_params_files, @@ -656,12 +656,12 @@ can be used and parameter names are passed via `pargs`: out = ee(func, lb, ub) `parameterfile` can be a list of parameterfiles in case of -:func:`~pyeee.std_io.sub_names_params_files`. `pid` will be explained +:func:`~pyeee.utils.std_io.sub_names_params_files`. `pid` will be explained in the next section. Note that `pargs` is set to `[pnames]`. Setting `'pargs':pnames` would give `*pnames` to the parameterwriter, that means each parameter name as an individual argument, which would be wrong because it wants to have a list of parameter names. The -docstring of :func:`~pyeee.function_wrapper.exe_wrapper` states: +docstring of :func:`~pyeee.utils.function_wrapper.exe_wrapper` states: .. code-block:: none @@ -671,21 +671,21 @@ docstring of :func:`~pyeee.function_wrapper.exe_wrapper` states: or if pid==True: parameterwriter(parameterfile, pid, x, *pargs, **pkwargs) -And the definition of :func:`~pyeee.std_io.sub_names_params_files` is: +And the definition of :func:`~pyeee.utils.std_io.sub_names_params_files` is: .. code-block:: python def sub_names_params_files_ignorecase(files, pid, params, names): so `*pargs` passes `*[pnames]` that means `pnames` as argument after the -parameters to :func:`~pyeee.std_io.sub_names_params_files`. +parameters to :func:`~pyeee.utils.std_io.sub_names_params_files`. Excluding :math:`x_1` would then be achieved by simply excluding `x1` from `pnames`: .. code-block:: python - from pyeee import sub_names_params_files + from pyeee.utils import sub_names_params_files pnames = ['x0', 'x2'] func = partial(exe_wrapper, ishi, parameterfile, sub_names_params_files, @@ -705,7 +705,7 @@ times in the same directory at the same time, all model runs would read the same parameter file and overwrite the output of each other. -:func:`~pyeee.function_wrapper.exe_wrapper` concatenates an individual +:func:`~pyeee.utils.function_wrapper.exe_wrapper` concatenates an individual integer number to the function string (or list, see :any:`subprocess`), adds the integer to call of `parameterwrite` and appends the number to the `objectivefile`, like: @@ -739,7 +739,7 @@ The `parameterwriter` is supposed to write `parameterfile+'.'+ipid` return np.sin(x[0]) + np.sin(x[1])**2 + x[2]**4 * np.sin(x[0]) # read parameters - from pyeee import standard_parameter_reader + from pyeee.utils import standard_parameter_reader ## from std_io import standard_parameter_reader pfile = 'params.txt' if pid is not None: @@ -757,12 +757,12 @@ The `parameterwriter` is supposed to write `parameterfile+'.'+ipid` print(y, file=ff) ff.close() -:func:`~pyeee.function_wrapper.exe_wrapper` would then be used with +:func:`~pyeee.utils.function_wrapper.exe_wrapper` would then be used with `'pid':True` and one can use several parallel processes: .. code-block:: python - from pyeee import exe_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.utils import exe_wrapper, standard_parameter_writer, standard_objective_reader ishi = ['python3', 'ishiexe1.py'] parameterfile = 'params.txt' objectivefile = 'obj.txt' @@ -774,7 +774,7 @@ The `parameterwriter` is supposed to write `parameterfile+'.'+ipid` ub = np.ones(npars) * np.pi out = ee(func, lb, ub, processes=8) -Note that :func:`~pyeee.std_io.sub_names_params_files` writes +Note that :func:`~pyeee.utils.std_io.sub_names_params_files` writes `parameterfile+'.'+ipid` and does not work with `'pid':False`. If you cannot change your computational model, you can use, for @@ -811,7 +811,7 @@ which would then be used: .. code-block:: python from functools import partial - from pyeee import exe_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.utils import exe_wrapper, standard_parameter_writer, standard_objective_reader ishi = './ishiexe.sh' parameterfile = 'params.txt' objectivefile = 'obj.txt' diff --git a/docs/source/function_wrapper.rst b/docs/source/utils.function_wrapper.rst similarity index 77% rename from docs/source/function_wrapper.rst rename to docs/source/utils.function_wrapper.rst index f7c5d6d..9e7b545 100644 --- a/docs/source/function_wrapper.rst +++ b/docs/source/utils.function_wrapper.rst @@ -1,7 +1,7 @@ pyeee.function_wrapper ======================= -.. automodule:: pyeee.function_wrapper +.. automodule:: pyeee.utils.function_wrapper :members: :undoc-members: :inherited-members: diff --git a/docs/source/std_io.rst b/docs/source/utils.std_io.rst similarity index 80% rename from docs/source/std_io.rst rename to docs/source/utils.std_io.rst index e1def68..40ef842 100644 --- a/docs/source/std_io.rst +++ b/docs/source/utils.std_io.rst @@ -1,7 +1,7 @@ pyeee.std_io ======================= -.. automodule:: pyeee.std_io +.. automodule:: pyeee.utils.std_io :members: :undoc-members: :inherited-members: diff --git a/docs/source/tee.rst b/docs/source/utils.tee.rst similarity index 81% rename from docs/source/tee.rst rename to docs/source/utils.tee.rst index cd0d034..3bb4c29 100644 --- a/docs/source/tee.rst +++ b/docs/source/utils.tee.rst @@ -1,7 +1,7 @@ pyeee.tee ================= -.. automodule:: pyeee.tee +.. automodule:: pyeee.utils.tee :members: :undoc-members: :inherited-members: diff --git a/pyeee/__init__.py b/pyeee/__init__.py index f35b8dd..84690d6 100644 --- a/pyeee/__init__.py +++ b/pyeee/__init__.py @@ -16,38 +16,18 @@ =========== .. autosummary:: eee - function_wrapper - general_functions + functions morris_method - sa_test_functions screening - tee utils version """ + +# sub-packages without dependencies to rest of pyeee +from . import functions +from . import utils + from .version import __version__ -# Common functions that are used in curve_fit or fmin parameter estimations -from .general_functions import curvature -from .general_functions import logistic, logistic_p, dlogistic, dlogistic_p, d2logistic, d2logistic_p -from .general_functions import logistic_offset, logistic_offset_p, dlogistic_offset, dlogistic_offset_p -from .general_functions import d2logistic_offset, d2logistic_offset_p, logistic2_offset, logistic2_offset_p -from .general_functions import dlogistic2_offset, dlogistic2_offset_p, d2logistic2_offset, d2logistic2_offset_p -# Sensitivity analysis test functions -from .sa_test_functions import B, g, G, Gstar, bratley, K, fmorris, morris, oakley_ohagan, ishigami_homma -from .sa_test_functions import linear, product, ratio, ishigami_homma_easy -# Utilities -from .utils import cost_square -from .tee import tee -# Function wrappers to be used with partial from functools -from .function_wrapper import exe_wrapper, exe_mask_wrapper -from .function_wrapper import func_wrapper, func_mask_wrapper -# Standard parameter reader and writer functions as well as objective reader functions -from .std_io import sub_ja_params_files -from .std_io import sub_names_params_files, sub_names_params_files_case, sub_names_params_files_ignorecase -from .std_io import standard_objective_reader -from .std_io import standard_parameter_reader, standard_parameter_writer -from .std_io import standard_parameter_reader_bounds_mask, standard_parameter_writer_bounds_mask -from .std_io import standard_time_series_reader, standard_timeseries_reader # Sampling of optimised trajectories for and calculation of Morris Measures / Elementary Effects from .morris_method import morris_sampling, elementary_effects # Sample trajectories, run model and return Morris Elementary Effects diff --git a/pyeee/eee.py b/pyeee/eee.py index 1dd3930..ea74b9f 100644 --- a/pyeee/eee.py +++ b/pyeee/eee.py @@ -28,18 +28,14 @@ """ import numpy as np import scipy.optimize as opt -# from pyeee import tee -# from pyeee import cost_square -# from pyeee import curvature, logistic_offset_p, dlogistic, d2logistic -# from pyeee import screening -from .tee import tee -from .utils import cost_square -from .general_functions import curvature, logistic_offset_p, dlogistic, d2logistic -from .screening import screening -# from tee import tee -# from utils import cost_square -# from general_functions import curvature, logistic_offset_p, dlogistic, d2logistic -# from screening import screening +from pyeee import screening +from pyeee.functions import cost_square +from pyeee.functions import curvature, logistic_offset_p, dlogistic, d2logistic +from pyeee.utils import tee +# from .tee import tee +# from .utils import cost_square +# from .general_functions import curvature, logistic_offset_p, dlogistic, d2logistic +# from .screening import screening __all__ = ['eee', 'see'] diff --git a/pyeee/functions/__init__.py b/pyeee/functions/__init__.py new file mode 100644 index 0000000..8ac33ca --- /dev/null +++ b/pyeee/functions/__init__.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +from __future__ import division, absolute_import, print_function +""" +Purpose +======= + +Generel set of functions such as the logistic function +as well as test functions for Sensitivity Analysis. + +:copyright: Copyright 2019-2020 Matthias Cuntz, see AUTHORS.md for details. +:license: MIT License, see LICENSE for details. + +Subpackages +=========== +.. autosummary:: + general_functions + sa_test_functions + utils +""" + +__all__ = ['curvature', + 'logistic', 'logistic_p', 'dlogistic', 'dlogistic_p', 'd2logistic', 'd2logistic_p', + 'logistic_offset', 'logistic_offset_p', 'dlogistic_offset', 'dlogistic_offset_p', + 'd2logistic_offset', 'd2logistic_offset_p', 'logistic2_offset', 'logistic2_offset_p', + 'dlogistic2_offset', 'dlogistic2_offset_p', 'd2logistic2_offset', 'd2logistic2_offset_p', + 'B', 'g', 'G', 'Gstar', 'bratley', 'K', 'fmorris', 'morris', 'oakley_ohagan', 'ishigami_homma', + 'linear', 'product', 'ratio', 'ishigami_homma_easy', + 'cost_square'] + +# Common functions that are used in curve_fit or fmin parameter estimations +from .general_functions import curvature +from .general_functions import logistic, logistic_p, dlogistic, dlogistic_p, d2logistic, d2logistic_p +from .general_functions import logistic_offset, logistic_offset_p, dlogistic_offset, dlogistic_offset_p +from .general_functions import d2logistic_offset, d2logistic_offset_p, logistic2_offset, logistic2_offset_p +from .general_functions import dlogistic2_offset, dlogistic2_offset_p, d2logistic2_offset, d2logistic2_offset_p +# Test functions for Sensitivity Analysis +from .sa_test_functions import B, g, G, Gstar, bratley, K, fmorris, morris, oakley_ohagan, ishigami_homma +from .sa_test_functions import linear, product, ratio, ishigami_homma_easy +# Utilities +from .utils import cost_square diff --git a/pyeee/general_functions.py b/pyeee/functions/general_functions.py similarity index 93% rename from pyeee/general_functions.py rename to pyeee/functions/general_functions.py index 65f33d6..8e2d339 100644 --- a/pyeee/general_functions.py +++ b/pyeee/functions/general_functions.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from __future__ import division, absolute_import, print_function """ -Module with general functions, derivatives, etc. for Efficient/Sequential Elementary Effects. +Module with general functions, derivatives, etc. The current functions are: curvature Curvature of function f: f''/(1+f'^2)^3/2 @@ -41,7 +41,7 @@ .. moduleauthor:: Matthias Cuntz -The following functions are provided +The following functions are provided: .. autosummary:: curvature @@ -137,7 +137,7 @@ def logistic(x, L, k, x0): def logistic_p(x, p): """ - Wrapper function for :func:`~pyeee.general_functions.logistic`: `logistic(x, *p)`. + Wrapper function for :func:`~pyeee.functions.general_functions.logistic`: `logistic(x, *p)`. """ return logistic(x, *p) @@ -175,7 +175,7 @@ def dlogistic(x, L, k, x0): def dlogistic_p(x, p): """ - Wrapper function for :func:`~pyeee.general_functions.dlogistic`: `dlogistic(x, *p)`. + Wrapper function for :func:`~pyeee.functions.general_functions.dlogistic`: `dlogistic(x, *p)`. """ return dlogistic(x, *p) @@ -214,7 +214,7 @@ def d2logistic(x, L, k, x0): def d2logistic_p(x, p): """ - Wrapper function for :func:`~pyeee.general_functions.d2logistic`: `d2logistic(x, *p)`. + Wrapper function for :func:`~pyeee.functions.general_functions.d2logistic`: `d2logistic(x, *p)`. """ return d2logistic(x, *p) @@ -250,7 +250,7 @@ def logistic_offset(x, L, k, x0, a): def logistic_offset_p(x, p): """ - Wrapper function for :func:`~pyeee.general_functions.logistic_offset`: `logistic_offset(x, *p)`. + Wrapper function for :func:`~pyeee.functions.general_functions.logistic_offset`: `logistic_offset(x, *p)`. """ return logistic_offset(x, *p) @@ -291,7 +291,7 @@ def dlogistic_offset(x, L, k, x0, a): def dlogistic_offset_p(x, p): """ - Wrapper function for :func:`~pyeee.general_functions.dlogistic_offset`: `dlogistic_offset(x, *p)`. + Wrapper function for :func:`~pyeee.functions.general_functions.dlogistic_offset`: `dlogistic_offset(x, *p)`. """ return dlogistic_offset(x, *p) @@ -333,7 +333,7 @@ def d2logistic_offset(x, L, k, x0, a): def d2logistic_offset_p(x, p): """ - Wrapper function for :func:`~pyeee.general_functions.d2logistic_offset`: `d2logistic_offset(x, *p)`. + Wrapper function for :func:`~pyeee.functions.general_functions.d2logistic_offset`: `d2logistic_offset(x, *p)`. """ return d2logistic_offset(x, *p) @@ -375,7 +375,7 @@ def logistic2_offset(x, L1, k1, x01, L2, k2, x02, a): def logistic2_offset_p(x, p): """ - Wrapper function for :func:`~pyeee.general_functions.logistic2_offset`: `logistic2_offset(x, *p)`. + Wrapper function for :func:`~pyeee.functions.general_functions.logistic2_offset`: `logistic2_offset(x, *p)`. """ return logistic2_offset(x, *p) @@ -422,7 +422,7 @@ def dlogistic2_offset(x, L1, k1, x01, L2, k2, x02, a): def dlogistic2_offset_p(x, p): """ - Wrapper function for :func:`~pyeee.general_functions.dlogistic2_offset`: `dlogistic2_offset(x, *p)`. + Wrapper function for :func:`~pyeee.functions.general_functions.dlogistic2_offset`: `dlogistic2_offset(x, *p)`. """ return dlogistic2_offset(x, *p) @@ -471,7 +471,7 @@ def d2logistic2_offset(x, L1, k1, x01, L2, k2, x02, a): def d2logistic2_offset_p(x, p): """ - Wrapper function for :func:`~pyeee.general_functions.d2logistic2_offset`: `d2logistic2_offset(x, *p)`. + Wrapper function for :func:`~pyeee.functions.general_functions.d2logistic2_offset`: `d2logistic2_offset(x, *p)`. """ return d2logistic2_offset(x, *p) diff --git a/pyeee/sa_test_functions.py b/pyeee/functions/sa_test_functions.py similarity index 99% rename from pyeee/sa_test_functions.py rename to pyeee/functions/sa_test_functions.py index 784aae2..a79c66f 100644 --- a/pyeee/sa_test_functions.py +++ b/pyeee/functions/sa_test_functions.py @@ -46,7 +46,7 @@ .. moduleauthor:: Matthias Cuntz -The following functions are provided +The following functions are provided: .. autosummary:: B diff --git a/pyeee/utils.py b/pyeee/functions/utils.py similarity index 97% rename from pyeee/utils.py rename to pyeee/functions/utils.py index fbf4e89..8ae9c9b 100644 --- a/pyeee/utils.py +++ b/pyeee/functions/utils.py @@ -16,7 +16,7 @@ .. moduleauthor:: Matthias Cuntz -The following functions are provided +The following functions are provided: .. autosummary:: cost_square diff --git a/pyeee/screening.py b/pyeee/screening.py index dea01d1..f2a3348 100644 --- a/pyeee/screening.py +++ b/pyeee/screening.py @@ -34,7 +34,6 @@ import numpy as np # from pyeee import morris_sampling, elementary_effects from .morris_method import morris_sampling, elementary_effects -# from morris import morris_sampling, elementary_effects __all__ = ['screening', 'ee'] diff --git a/pyeee/utils/__init__.py b/pyeee/utils/__init__.py new file mode 100644 index 0000000..fa2283b --- /dev/null +++ b/pyeee/utils/__init__.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +from __future__ import division, absolute_import, print_function +""" +Purpose +======= + +Utilities used with and within pyeee. + +:copyright: Copyright 2019-2020 Matthias Cuntz, see AUTHORS.md for details. +:license: MIT License, see LICENSE for details. + +Subpackages +=========== +.. autosummary:: + function_wrapper + std_io + tee +""" + +__all__ = ['tee', + 'exe_wrapper', 'exe_mask_wrapper', + 'func_wrapper', 'func_mask_wrapper', + 'sub_ja_params_files', + 'sub_names_params_files', 'sub_names_params_files_case', 'sub_names_params_files_ignorecase', + 'standard_objective_reader', + 'standard_parameter_reader', 'standard_parameter_writer', + 'standard_parameter_reader_bounds_mask', 'standard_parameter_writer_bounds_mask', + 'standard_time_series_reader', 'standard_timeseries_reader'] + +# Utilities +from .tee import tee +# Function wrappers to be used with partial from functools +from .function_wrapper import exe_wrapper, exe_mask_wrapper +from .function_wrapper import func_wrapper, func_mask_wrapper +# Standard parameter reader and writer functions as well as objective reader functions +from .std_io import sub_ja_params_files +from .std_io import sub_names_params_files, sub_names_params_files_case, sub_names_params_files_ignorecase +from .std_io import standard_objective_reader +from .std_io import standard_parameter_reader, standard_parameter_writer +from .std_io import standard_parameter_reader_bounds_mask, standard_parameter_writer_bounds_mask +from .std_io import standard_time_series_reader, standard_timeseries_reader diff --git a/pyeee/function_wrapper.py b/pyeee/utils/function_wrapper.py similarity index 99% rename from pyeee/function_wrapper.py rename to pyeee/utils/function_wrapper.py index d49ac7d..c7c28d8 100644 --- a/pyeee/function_wrapper.py +++ b/pyeee/utils/function_wrapper.py @@ -40,7 +40,7 @@ .. moduleauthor:: Matthias Cuntz -The following wrappers are provided +The following wrappers are provided: .. autosummary:: exe_wrapper diff --git a/pyeee/std_io.py b/pyeee/utils/std_io.py similarity index 99% rename from pyeee/std_io.py rename to pyeee/utils/std_io.py index fc62d5c..d27eb66 100644 --- a/pyeee/std_io.py +++ b/pyeee/utils/std_io.py @@ -30,7 +30,7 @@ .. moduleauthor:: Matthias Cuntz -The following functions are provided +The following functions are provided: .. autosummary:: sub_ja_params_files diff --git a/pyeee/tee.py b/pyeee/utils/tee.py similarity index 98% rename from pyeee/tee.py rename to pyeee/utils/tee.py index fa46bdd..f0bbcde 100644 --- a/pyeee/tee.py +++ b/pyeee/utils/tee.py @@ -18,7 +18,7 @@ .. moduleauthor:: Matthias Cuntz -The following functions are provided +The following functions are provided: .. autosummary:: tee diff --git a/pyeee/version.py b/pyeee/version.py index 58538d8..f44b720 100644 --- a/pyeee/version.py +++ b/pyeee/version.py @@ -22,7 +22,9 @@ * v0.7, systematically logistic_p versions, and keep formatting with substitution functions, Feb 2020, Matthias Cuntz * v0.8, Split tests into individual files per module, and small bug fixes in tests and error handling, Feb 2020, Matthias Cuntz * v0.9, Renamed morris.py to morris_method.py and adapted args and kwargs to common names in pyeee, Feb 2020, Matthias Cuntz +* v1.0, Restructured package with functions and utils subpackages, Feb 2020, Matthias Cuntz .. moduleauthor:: Matthias Cuntz """ -__version__ = "0.9" + +__version__ = "1.0" diff --git a/tests/ishiexe.py b/tests/ishiexe.py index 05885a9..5d86771 100644 --- a/tests/ishiexe.py +++ b/tests/ishiexe.py @@ -1,9 +1,8 @@ #!/usr/bin/env python from __future__ import division, absolute_import, print_function -from pyeee import standard_parameter_reader, ishigami_homma -# from std_io import standard_parameter_reader -# from sa_test_functions import ishigami_homma +from pyeee.utils import standard_parameter_reader +from pyeee.functions import ishigami_homma # read pid if given import sys diff --git a/tests/test_eee.py b/tests/test_eee.py index a65d569..4f0ba5d 100644 --- a/tests/test_eee.py +++ b/tests/test_eee.py @@ -44,8 +44,9 @@ def setUp(self): def test_eee_g(self): from functools import partial import numpy as np - from pyeee import func_wrapper, eee - from pyeee import G + from pyeee import eee + from pyeee.utils import func_wrapper + from pyeee.functions import G # Function and parameters func = G @@ -73,8 +74,9 @@ def test_eee_g(self): def test_see_gstar(self): from functools import partial import numpy as np - from pyeee import func_wrapper, eee, see - from pyeee import Gstar + from pyeee import eee, see + from pyeee.utils import func_wrapper + from pyeee.functions import Gstar # Function and parameters func = Gstar @@ -115,8 +117,9 @@ def test_eee_k(self): import os import numpy as np import schwimmbad - from pyeee import func_wrapper, eee - from pyeee import bratley + from pyeee import eee + from pyeee.utils import func_wrapper + from pyeee.functions import bratley # Function and parameters func = bratley @@ -147,8 +150,9 @@ def test_eee_fmorris(self): from functools import partial import os import numpy as np - from pyeee import func_wrapper, eee - from pyeee import fmorris + from pyeee import eee + from pyeee.utils import func_wrapper + from pyeee.functions import fmorris # Function and parameters func = fmorris diff --git a/tests/test_function_wrapper.py b/tests/test_function_wrapper.py index 55a8444..36aa75c 100644 --- a/tests/test_function_wrapper.py +++ b/tests/test_function_wrapper.py @@ -35,8 +35,9 @@ def setUp(self): def test_func_wrapper(self): from functools import partial import numpy as np - from pyeee import ee, ishigami_homma - from pyeee import func_wrapper + from pyeee import ee + from pyeee.functions import ishigami_homma + from pyeee.utils import func_wrapper func = ishigami_homma npars = 3 @@ -59,8 +60,9 @@ def test_func_wrapper(self): def test_func_mask_wrapper(self): from functools import partial import numpy as np - from pyeee import ee, ishigami_homma - from pyeee import func_mask_wrapper + from pyeee import ee + from pyeee.functions import ishigami_homma + from pyeee.utils import func_mask_wrapper func = ishigami_homma npars = 3 @@ -89,7 +91,8 @@ def test_exe_wrapper(self): from functools import partial import numpy as np from pyeee import ee - from pyeee import exe_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.functions import ishigami_homma + from pyeee.utils import exe_wrapper, standard_parameter_writer, standard_objective_reader ishi = ['python3', 'tests/ishiexe.py'] npars = 3 @@ -114,8 +117,9 @@ def test_exe_wrapper(self): def test_exe_wrapper_error(self): from functools import partial import numpy as np - from pyeee import ee, ishigami_homma - from pyeee import exe_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee import ee + from pyeee.functions import ishigami_homma + from pyeee.utils import exe_wrapper, standard_parameter_writer, standard_objective_reader ishi = ishigami_homma npars = 3 @@ -139,7 +143,7 @@ def test_exe_wrapper4(self): from functools import partial import numpy as np from pyeee import ee - from pyeee import exe_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.utils import exe_wrapper, standard_parameter_writer, standard_objective_reader ishi = ['python3', 'tests/ishiexe.py'] npars = 3 @@ -165,7 +169,7 @@ def test_exe_wrapper_debug(self): from functools import partial import numpy as np from pyeee import ee - from pyeee import exe_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.utils import exe_wrapper, standard_parameter_writer, standard_objective_reader ishi = ['python3', 'tests/ishiexe.py'] npars = 3 @@ -191,7 +195,7 @@ def test_exe_wrapper4_pid_debug(self): from functools import partial import numpy as np from pyeee import ee - from pyeee import exe_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.utils import exe_wrapper, standard_parameter_writer, standard_objective_reader ishi = ['python3', 'tests/ishiexe.py'] npars = 3 @@ -217,7 +221,7 @@ def test_exe_wrapper4_shell(self): from functools import partial import numpy as np from pyeee import ee - from pyeee import exe_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.utils import exe_wrapper, standard_parameter_writer, standard_objective_reader ishi = './tests/ishiexe.sh' npars = 3 @@ -243,7 +247,7 @@ def test_exe_wrapper4_shell_debug(self): from functools import partial import numpy as np from pyeee import ee - from pyeee import exe_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.utils import exe_wrapper, standard_parameter_writer, standard_objective_reader ishi = './tests/ishiexe.sh' npars = 3 @@ -269,7 +273,7 @@ def test_exe_mask_wrapper(self): from functools import partial import numpy as np from pyeee import ee - from pyeee import exe_mask_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.utils import exe_mask_wrapper, standard_parameter_writer, standard_objective_reader ishi = ['python3', 'tests/ishiexe.py'] npars = 3 @@ -298,8 +302,9 @@ def test_exe_mask_wrapper(self): def test_exe_mask_wrapper_error(self): from functools import partial import numpy as np - from pyeee import ee, ishigami_homma - from pyeee import exe_mask_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee import ee + from pyeee.functions import ishigami_homma + from pyeee.utils import exe_mask_wrapper, standard_parameter_writer, standard_objective_reader ishi = ishigami_homma npars = 3 @@ -327,7 +332,7 @@ def test_exe_mask_wrapper4(self): from functools import partial import numpy as np from pyeee import ee - from pyeee import exe_mask_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.utils import exe_mask_wrapper, standard_parameter_writer, standard_objective_reader ishi = ['python3', 'tests/ishiexe.py'] npars = 3 @@ -357,7 +362,7 @@ def test_exe_mask_wrapper4_shell_debug(self): from functools import partial import numpy as np from pyeee import ee - from pyeee import exe_mask_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.utils import exe_mask_wrapper, standard_parameter_writer, standard_objective_reader ishi = './tests/ishiexe.sh' npars = 3 @@ -387,7 +392,7 @@ def test_exe_mask_wrapper_debug(self): from functools import partial import numpy as np from pyeee import ee - from pyeee import exe_mask_wrapper, standard_parameter_writer, standard_objective_reader + from pyeee.utils import exe_mask_wrapper, standard_parameter_writer, standard_objective_reader ishi = ['python3', 'tests/ishiexe.py'] npars = 3 diff --git a/tests/test_general_functions.py b/tests/test_general_functions.py index e0e95c6..2a037d0 100644 --- a/tests/test_general_functions.py +++ b/tests/test_general_functions.py @@ -16,13 +16,13 @@ class TestGeneralFunctions(unittest.TestCase): def test_general_functions(self): import os import numpy as np - from pyeee import curvature - from pyeee import logistic, logistic_offset, logistic2_offset - from pyeee import dlogistic, dlogistic_offset, dlogistic2_offset - from pyeee import d2logistic, d2logistic_offset, d2logistic2_offset - from pyeee import logistic_p, logistic_offset_p, logistic2_offset_p - from pyeee import dlogistic_p, dlogistic_offset_p, dlogistic2_offset_p - from pyeee import d2logistic_p, d2logistic_offset_p, d2logistic2_offset_p + from pyeee.functions import curvature + from pyeee.functions import logistic, logistic_offset, logistic2_offset + from pyeee.functions import dlogistic, dlogistic_offset, dlogistic2_offset + from pyeee.functions import d2logistic, d2logistic_offset, d2logistic2_offset + from pyeee.functions import logistic_p, logistic_offset_p, logistic2_offset_p + from pyeee.functions import dlogistic_p, dlogistic_offset_p, dlogistic2_offset_p + from pyeee.functions import d2logistic_p, d2logistic_offset_p, d2logistic2_offset_p self.assertEqual(logistic(1., 1., 0., 2.), 0.5) self.assertEqual(logistic(1., 1., 2., 1.), 0.5) diff --git a/tests/test_morris.py b/tests/test_morris.py index 13a0b13..7301b70 100644 --- a/tests/test_morris.py +++ b/tests/test_morris.py @@ -13,8 +13,8 @@ # morris.py # Missing coverage: # 336-339: Same trajectories in ntotal -# 441-442, 471-472: ImportError of matplotlib not installed -# 657: if NumGroups == 0: if SAm.size > 1: ? +# 442-443, 472-473: ImportError of matplotlib not installed +# 655: if NumGroups == 0: if SAm.size > 1: ? class TestMorris(unittest.TestCase): def setUp(self): diff --git a/tests/test_sa_test_functions.py b/tests/test_sa_test_functions.py index b310e44..4d9694a 100644 --- a/tests/test_sa_test_functions.py +++ b/tests/test_sa_test_functions.py @@ -11,8 +11,6 @@ # -------------------------------------------------------------------- # sa_test_functions.py -# Missing coverage: -# 521: morris as wrapper to fmorris not working because morris is also the name of a module here class TestSATestFunctions(unittest.TestCase): def setUp(self): @@ -24,8 +22,8 @@ def setUp(self): def test_sa_test_functions(self): import os import numpy as np - from pyeee import B, g, G, Gstar, K, bratley, oakley_ohagan, ishigami_homma - from pyeee import linear, product, ratio, ishigami_homma_easy, fmorris, morris + from pyeee.functions import B, g, G, Gstar, K, bratley, oakley_ohagan, ishigami_homma + from pyeee.functions import linear, product, ratio, ishigami_homma_easy, fmorris, morris # scalar self.assertEqual(B(np.arange(10)), 80) diff --git a/tests/test_screening.py b/tests/test_screening.py index 94deec8..b52aeef 100644 --- a/tests/test_screening.py +++ b/tests/test_screening.py @@ -12,8 +12,8 @@ # -------------------------------------------------------------------- # screening.py # Missing coverage: -# 169-172: MPI -# 233: function has multiple outputs +# 170-173: MPI +# 234: function has multiple outputs class TestScreening(unittest.TestCase): def setUp(self): @@ -31,8 +31,9 @@ def setUp(self): def test_ee_g(self): from functools import partial import numpy as np - from pyeee import func_wrapper, ee - from pyeee import G + from pyeee import ee + from pyeee.functions import G + from pyeee.utils import func_wrapper # Function and parameters func = G @@ -60,8 +61,9 @@ def test_ee_g(self): def test_ee_g_mask(self): from functools import partial import numpy as np - from pyeee import func_wrapper, ee - from pyeee import G + from pyeee import ee + from pyeee.functions import G + from pyeee.utils import func_wrapper # Function and parameters func = G @@ -92,8 +94,9 @@ def test_ee_g_mask(self): def test_ee_g_mask_error(self): from functools import partial import numpy as np - from pyeee import func_wrapper, ee - from pyeee import G + from pyeee import ee + from pyeee.functions import G + from pyeee.utils import func_wrapper # Function and parameters func = G @@ -121,8 +124,9 @@ def test_ee_g_mask_error(self): def test_ee_g_nt1(self): from functools import partial import numpy as np - from pyeee import func_wrapper, ee - from pyeee import G + from pyeee import ee + from pyeee.functions import G + from pyeee.utils import func_wrapper # Function and parameters func = G @@ -151,8 +155,9 @@ def test_ee_g_pool(self): from functools import partial import numpy as np import schwimmbad - from pyeee import func_wrapper, ee - from pyeee import G + from pyeee import ee + from pyeee.functions import G + from pyeee.utils import func_wrapper # Function and parameters func = G @@ -183,8 +188,9 @@ def test_ee_g_pool(self): def test_ee_g_1(self): from functools import partial import numpy as np - from pyeee import func_wrapper, ee - from pyeee import G + from pyeee import ee + from pyeee.functions import G + from pyeee.utils import func_wrapper # Function and parameters func = G @@ -210,8 +216,9 @@ def test_ee_g_1(self): def test_screening_gstar(self): from functools import partial import numpy as np - from pyeee import func_wrapper, ee, screening - from pyeee import Gstar + from pyeee import ee, screening + from pyeee.functions import Gstar + from pyeee.utils import func_wrapper # Function and parameters func = Gstar @@ -251,8 +258,9 @@ def test_ee_k(self): from functools import partial import os import numpy as np - from pyeee import func_wrapper, ee - from pyeee import bratley + from pyeee import ee + from pyeee.functions import bratley + from pyeee.utils import func_wrapper # Function and parameters func = bratley @@ -272,11 +280,12 @@ def test_ee_k(self): # Morris function - def test_ee_morris(self): + def test_ee_fmorris(self): from functools import partial import numpy as np - from pyeee import func_wrapper, ee - from pyeee.sa_test_functions import morris as fmorris + from pyeee import ee + from pyeee.functions import fmorris + from pyeee.utils import func_wrapper # Function and parameters func = fmorris diff --git a/tests/test_std_io.py b/tests/test_std_io.py index 7b0063b..e8374bc 100644 --- a/tests/test_std_io.py +++ b/tests/test_std_io.py @@ -17,7 +17,7 @@ class TestStd_io(unittest.TestCase): def test_std_io_sub_ja(self): import os import numpy as np - from pyeee import sub_ja_params_files + from pyeee.utils import sub_ja_params_files # standard_parameter_writer without pid filename1 = 'params1.txt' @@ -72,8 +72,8 @@ def test_std_io_sub_ja(self): def test_std_io_sub_names_params(self): import os import numpy as np - from pyeee import sub_names_params_files_ignorecase, sub_names_params_files_case - from pyeee import sub_names_params_files + from pyeee.utils import sub_names_params_files_ignorecase, sub_names_params_files_case + from pyeee.utils import sub_names_params_files # ignore case filename1 = 'params11.txt' @@ -232,10 +232,10 @@ def test_std_io_sub_names_params(self): def test_std_io_standard(self): import os import numpy as np - from pyeee import standard_parameter_writer, standard_parameter_reader - from pyeee import standard_parameter_writer_bounds_mask, standard_parameter_reader_bounds_mask - from pyeee import standard_objective_reader - from pyeee import standard_timeseries_reader, standard_time_series_reader + from pyeee.utils import standard_parameter_writer, standard_parameter_reader + from pyeee.utils import standard_parameter_writer_bounds_mask, standard_parameter_reader_bounds_mask + from pyeee.utils import standard_objective_reader + from pyeee.utils import standard_timeseries_reader, standard_time_series_reader # standard_parameter_reader/writer without pid filename = 'params.txt' diff --git a/tests/test_tee.py b/tests/test_tee.py index b7940a4..9db3429 100644 --- a/tests/test_tee.py +++ b/tests/test_tee.py @@ -15,7 +15,7 @@ class TestTee(unittest.TestCase): def test_tee(self): import os - from pyeee import tee + from pyeee.utils import tee tee('T T T Test 1') ff = open('log.txt', 'w')