diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c593e8079..63769e02e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,18 +31,18 @@ repos: exclude: '(\.Rd|python/doc/source/reference/.*|test-doctest-.*)' - repo: https://github.com/tox-dev/tox-ini-fmt - rev: 1.7.2 + rev: 1.10.0 hooks: - id: tox-ini-fmt - repo: https://github.com/tox-dev/pyproject-fmt - rev: v2.25.2 + rev: v2.30.3 hooks: - id: pyproject-fmt additional_dependencies: ["tox>=4.12.1"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.21 + rev: v0.17.2 hooks: # Run the formatter. - id: ruff-format @@ -54,7 +54,7 @@ repos: require_serial: true - repo: https://github.com/astral-sh/ty-pre-commit - rev: v0.0.89 + rev: v0.0.92 hooks: - id: ty args: [--project=python, --isolated] @@ -65,7 +65,7 @@ repos: - id: sphinx-lint - repo: https://github.com/lorenzwalthert/precommit - rev: v0.4.3.9030 + rev: v0.4.3.9032 hooks: - id: parsable-R - id: no-browser-statement diff --git a/c/update_readme.py b/c/update_readme.py index 48ad65a27..fdfb2be56 100644 --- a/c/update_readme.py +++ b/c/update_readme.py @@ -1,5 +1,5 @@ -from pathlib import Path import subprocess +from pathlib import Path def replace_between_markers( diff --git a/python/benchmarks/bench.py b/python/benchmarks/bench.py index e9e7c409c..c79c222b9 100644 --- a/python/benchmarks/bench.py +++ b/python/benchmarks/bench.py @@ -1,14 +1,16 @@ +import importlib import pathlib -import numpy as np -import pandas as pd +import shutil +import subprocess +import timeit + +import cpuinfo import matplotlib.pyplot as plt import matplotlib.ticker as mticker +import numpy as np +import pandas as pd + import moocore -import timeit -import cpuinfo -import shutil -import subprocess -import importlib timeit_template_return_1_value = """ def inner(_it, _timer{init}): diff --git a/python/benchmarks/bench_epsilon.py b/python/benchmarks/bench_epsilon.py index 0701b0fae..0c3238a40 100644 --- a/python/benchmarks/bench_epsilon.py +++ b/python/benchmarks/bench_epsilon.py @@ -5,15 +5,15 @@ """ -from bench import Bench, read_data, check_float_values - -import numpy as np -import moocore import pathlib -import matplotlib.pyplot as plt +import matplotlib.pyplot as plt +import numpy as np +from bench import Bench, check_float_values, read_data from jmetal.core.quality_indicator import EpsilonIndicator as jmetal_EPS +import moocore + path_to_data = "../../testsuite/data/" if not pathlib.Path(path_to_data).expanduser().exists(): path_to_data = ( diff --git a/python/benchmarks/bench_hv.py b/python/benchmarks/bench_hv.py index d353529f8..0fedba41a 100644 --- a/python/benchmarks/bench_hv.py +++ b/python/benchmarks/bench_hv.py @@ -5,23 +5,19 @@ """ +import pathlib + +import matplotlib.pyplot as plt +import numpy as np +import torch from bench import ( Bench, - read_datasets_and_filter_dominated, - get_geomrange, check_float_values, + get_geomrange, + read_datasets_and_filter_dominated, ) - -import numpy as np -import moocore -import pathlib -import matplotlib.pyplot as plt - from botorch.utils.multi_objective.hypervolume import Hypervolume as botorch_HV -import torch -from nevergrad.optimization.multiobjective import HypervolumeIndicator as ng_HV from fast_pareto import hypervolume as fp_hv -from optuna._hypervolume import compute_hypervolume as optuna_hv ## paretobench is 2x slower than botorch, so too slow for benchmarking. ## https://github.com/electronsandstuff/ParetoBench/issues/57 @@ -31,8 +27,11 @@ ## https://github.com/secondmind-labs/trieste/issues/917 # from trieste.acquisition.multi_objective import Pareto as trieste_Pareto # import tensorflow as tf - from moarchiving import get_mo_archive as moarch_get_mo_archive +from nevergrad.optimization.multiobjective import HypervolumeIndicator as ng_HV +from optuna._hypervolume import compute_hypervolume as optuna_hv + +import moocore # FIXME: How to test both float and Fractions? moarch_get_mo_archive.hypervolume_computation_float_type = float diff --git a/python/benchmarks/bench_hvapprox.py b/python/benchmarks/bench_hvapprox.py index 6c631cc03..22cd52425 100644 --- a/python/benchmarks/bench_hvapprox.py +++ b/python/benchmarks/bench_hvapprox.py @@ -6,19 +6,20 @@ """ -import numpy as np -import moocore import pathlib -import matplotlib.pyplot as plt import timeit # time_hv_exact +import matplotlib.pyplot as plt +import numpy as np from bench import ( Bench, - read_datasets_and_filter_dominated, get_range, + read_datasets_and_filter_dominated, timeit_template_return_1_value, # time_hv_exact ) +import moocore + # See https://github.com/multi-objective/testsuite/tree/main/data path_to_data = "../../testsuite/data/" assert pathlib.Path(path_to_data).expanduser().exists() diff --git a/python/benchmarks/bench_igdplus.py b/python/benchmarks/bench_igdplus.py index e11c620e3..617429a8e 100644 --- a/python/benchmarks/bench_igdplus.py +++ b/python/benchmarks/bench_igdplus.py @@ -5,22 +5,21 @@ """ +import matplotlib.pyplot as plt +import numpy as np from bench import ( Bench, check_float_values, get_geomrange, read_datasets_and_filter_dominated, ) - -import numpy as np -import moocore -import matplotlib.pyplot as plt - from desdeo.tools.indicators_unary import igd_plus_indicator as desdeo_igd_plus from jmetal.core.quality_indicator import ( InvertedGenerationalDistancePlus as jmetal_IGDplus, ) +import moocore + files = { "ran.1000pts.3d": "ran.1000pts.3d.10", } diff --git a/python/benchmarks/bench_ndom.py b/python/benchmarks/bench_ndom.py index c1416ff1a..1a411dc75 100644 --- a/python/benchmarks/bench_ndom.py +++ b/python/benchmarks/bench_ndom.py @@ -6,28 +6,27 @@ """ import gc -import numpy as np -import moocore -import matplotlib.pyplot as plt - -from bench import Bench, get_geomrange, check_float_vector +import matplotlib.pyplot as plt +import numpy as np import torch +from bench import Bench, check_float_vector, get_geomrange from botorch.utils.multi_objective.pareto import ( is_non_dominated as botorch_is_nondominated, ) - from desdeo.tools.non_dominated_sorting import ( non_dominated as desdeo_is_nondominated, ) +from fast_pareto import is_pareto_front as fast_pareto_is_pf +from optuna.study._multi_objective import _is_pareto_front as optuna_is_pf ## paretobench is always slower than botorch, too slower for benchmarking. # import paretobench from paretoset import paretoset -from fast_pareto import is_pareto_front as fast_pareto_is_pf -from optuna.study._multi_objective import _is_pareto_front as optuna_is_pf from patatune.util import get_dominated as patatune_get_dominated +import moocore + # See https://github.com/multi-objective/testsuite/tree/main/data files = { # range are the (start, stop, num) parameters for np.geomspace() diff --git a/python/benchmarks/bench_ndsort.py b/python/benchmarks/bench_ndsort.py index 5994503dc..8f68970e3 100644 --- a/python/benchmarks/bench_ndsort.py +++ b/python/benchmarks/bench_ndsort.py @@ -5,19 +5,19 @@ """ -from bench import Bench, get_geomrange, check_array_equal - -import numpy as np import matplotlib.pyplot as plt -import moocore - -from pymoo.util.nds.non_dominated_sorting import ( - NonDominatedSorting as pymoo_NDS, -) +import numpy as np +from bench import Bench, check_array_equal, get_geomrange from desdeo.tools.non_dominated_sorting import ( fast_non_dominated_sort as desdeo_nds, ) from paretoset import paretorank as paretoset_paretorank +from pymoo.util.nds.non_dominated_sorting import ( + NonDominatedSorting as pymoo_NDS, +) + +import moocore + ## It cannot be installed: https://github.com/esa/pygmo2/issues/152 # from pygmo import pareto_dominance as pg_pareto_dominance diff --git a/python/conftest.py b/python/conftest.py index 1a7fed29e..78589f363 100644 --- a/python/conftest.py +++ b/python/conftest.py @@ -1,5 +1,6 @@ # ruff: noqa: D100, D103 import pytest + import moocore diff --git a/python/doc/conftest.py b/python/doc/conftest.py index ac41805fa..a8c87692f 100644 --- a/python/doc/conftest.py +++ b/python/doc/conftest.py @@ -1,5 +1,6 @@ # ruff: noqa: D100, D103 import pytest + import moocore diff --git a/python/doc/source/conf.py b/python/doc/source/conf.py index 4a80c3dd6..2d820c184 100644 --- a/python/doc/source/conf.py +++ b/python/doc/source/conf.py @@ -8,11 +8,11 @@ # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -from datetime import date -import sphinx - import os import sys +from datetime import date + +import sphinx # Building the docs requires installing the package. import moocore diff --git a/python/doc/source/my_unsrt_style.py b/python/doc/source/my_unsrt_style.py index 69c395932..834fcbcc6 100644 --- a/python/doc/source/my_unsrt_style.py +++ b/python/doc/source/my_unsrt_style.py @@ -1,7 +1,7 @@ # ruff: noqa: D100, D101, D102 -from pybtex.style.formatting.unsrt import Style as UnsrtStyle -from pybtex.style.template import sentence, href, join, optional, field from pybtex.plugin import register_plugin +from pybtex.style.formatting.unsrt import Style as UnsrtStyle +from pybtex.style.template import field, href, join, optional, sentence class MyUnsrtStyle(UnsrtStyle): diff --git a/python/doc/source/my_unused_images.py b/python/doc/source/my_unused_images.py index b440e3cb1..0792839f6 100644 --- a/python/doc/source/my_unused_images.py +++ b/python/doc/source/my_unused_images.py @@ -1,5 +1,6 @@ # ruff: noqa: D100 from pathlib import Path + from docutils import nodes from sphinx.util import logging diff --git a/python/doc/source/super_with_brackets.py b/python/doc/source/super_with_brackets.py index 5f4e70506..fd6cd865b 100644 --- a/python/doc/source/super_with_brackets.py +++ b/python/doc/source/super_with_brackets.py @@ -1,10 +1,11 @@ # ruff: noqa: D100, D101 from dataclasses import dataclass, field -from sphinxcontrib.bibtex.style.referencing import BracketStyle, PersonStyle -from sphinxcontrib.bibtex.style.referencing.super_ import SuperReferenceStyle + from sphinxcontrib.bibtex.plugin import ( register_plugin as sphinxcontrib_register_plugin, ) +from sphinxcontrib.bibtex.style.referencing import BracketStyle, PersonStyle +from sphinxcontrib.bibtex.style.referencing.super_ import SuperReferenceStyle @dataclass diff --git a/python/examples/_utils.py b/python/examples/_utils.py index c1309f750..e03e925ab 100644 --- a/python/examples/_utils.py +++ b/python/examples/_utils.py @@ -1,11 +1,12 @@ -import numpy as np -import moocore import matplotlib.pyplot as plt -from matplotlib.patches import Arc -from matplotlib.colors import to_hex +import numpy as np import plotly.graph_objects as go +from matplotlib.colors import to_hex +from matplotlib.patches import Arc from plotly.subplots import make_subplots +import moocore + def plot_3d(what, x, title, plotly=False, rank=False, show_index=False): """Scatter plot of 3D points.""" diff --git a/python/examples/plot_eaf.py b/python/examples/plot_eaf.py index abc874cf3..5e4338378 100644 --- a/python/examples/plot_eaf.py +++ b/python/examples/plot_eaf.py @@ -13,6 +13,7 @@ import numpy as np import pandas as pd + import moocore A = moocore.get_dataset("ALG_1_dat.xz") diff --git a/python/examples/plot_generate.py b/python/examples/plot_generate.py index 4c6c5a07f..2de25771d 100644 --- a/python/examples/plot_generate.py +++ b/python/examples/plot_generate.py @@ -9,12 +9,12 @@ """ # sphinx_gallery_multi_image = "single" -import moocore -import numpy as np import matplotlib.pyplot as plt - +import numpy as np from _utils import plotly_3d, plotly_3d_side_by_side +import moocore + def generate_ndset_plotly_3d(n, method, seed): """Generate points with moocore.generate_ndset() and plot them with plotly_3d().""" diff --git a/python/examples/plot_generate_sequence.py b/python/examples/plot_generate_sequence.py index e2744fc95..314e2d19f 100644 --- a/python/examples/plot_generate_sequence.py +++ b/python/examples/plot_generate_sequence.py @@ -9,11 +9,11 @@ """ # sphinx_gallery_multi_image = "single" -import moocore -import numpy as np import matplotlib.pyplot as plt +import numpy as np +from _utils import plot_sequence_2d, plotly_3d, plotly_3d_side_by_side -from _utils import plotly_3d, plotly_3d_side_by_side, plot_sequence_2d +import moocore def plotly_generate_sequence_3d(what, n, method, seed, show_index=False): diff --git a/python/examples/plot_hv_approx.py b/python/examples/plot_hv_approx.py index b769a83a0..7e1092763 100644 --- a/python/examples/plot_hv_approx.py +++ b/python/examples/plot_hv_approx.py @@ -17,10 +17,11 @@ """ # sphinx_gallery_multi_image = "single" +import matplotlib.pyplot as plt import numpy as np import pandas as pd -import matplotlib.pyplot as plt import seaborn as sns + import moocore # %% diff --git a/python/examples/plot_metrics.py b/python/examples/plot_metrics.py index b0de49ab8..a6bba34fd 100644 --- a/python/examples/plot_metrics.py +++ b/python/examples/plot_metrics.py @@ -7,6 +7,7 @@ """ import numpy as np + import moocore # %% @@ -80,8 +81,8 @@ # Assuming minimization of both objectives, A is better than B in terms of Pareto optimality. # -import pandas as pd import matplotlib.pyplot as plt +import pandas as pd import seaborn as sns sns.set_theme() diff --git a/python/examples/plot_pandas.py b/python/examples/plot_pandas.py index 12e8ef8d7..f7001e393 100644 --- a/python/examples/plot_pandas.py +++ b/python/examples/plot_pandas.py @@ -6,9 +6,10 @@ """ -import moocore import pandas as pd +import moocore + print(f"pandas version: {pd.__version__}") # %% diff --git a/python/pyproject.toml b/python/pyproject.toml index 28febc668..952339420 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -31,6 +31,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", ] dependencies = [ "cffi>=1.17.1", @@ -188,26 +189,26 @@ expand_tables = [ "project.optional-dependencies", "project.urls" ] # List of tables to force collapse regardless of table_format or expand_tables settings collapse_tables = [ "project.authors" ] -[tool.ty.rules] -invalid-assignment = "ignore" [tool.ty.src] include = [ "src" ] +[tool.ty.rules] +invalid-assignment = "ignore" [tool.pytest.ini_options] -faulthandler_timeout = 10 -doctest_optionflags = "NUMBER" addopts = [ "--import-mode=importlib", "--durations=5", "--durations-min=1.0" ] +doctest_optionflags = "NUMBER" +faulthandler_timeout = 10 +[tool.coverage.run] +branch = true [tool.coverage.report] # Same as tool.gcovr.exclude-lines-by-pattern. exclude_also = [ "^.*(?:#|//)\\s+nocov", + "^.*(?:GCOVR?|LCOV)_EXCL_LINE", "^.*\\b(?:ASSUME|(?:DEBUG1|DEBUG2|DEBUG3)(?:_PRINT)?)\\s?\\(", "^.*\\bunreachable\\s?\\(\\)", - "^.*(?:GCOVR?|LCOV)_EXCL_LINE", ] -[tool.coverage.run] -branch = true [tool.gcovr] # The regex must match the start of the line. diff --git a/python/src/moocore/__init__.py b/python/src/moocore/__init__.py index d07f559f0..ca8e30560 100644 --- a/python/src/moocore/__init__.py +++ b/python/src/moocore/__init__.py @@ -1,4 +1,11 @@ # ruff: noqa: D104 +from importlib.metadata import version as _metadata_version + +from ._datasets import ( + get_dataset, + get_dataset_path, +) +from ._generate import generate_ndset, generate_sequence from ._moocore import ( Hypervolume, ReadDatasetsError, @@ -10,7 +17,6 @@ eafdiff, epsilon_additive, epsilon_mult, - r2_exact, filter_dominated, filter_dominated_within_sets, hv_approx, @@ -23,6 +29,7 @@ largest_eafdiff, normalise, pareto_rank, + r2_exact, read_datasets, total_whv_rect, vorob_dev, @@ -31,15 +38,6 @@ whv_rect, ) -from ._datasets import ( - get_dataset, - get_dataset_path, -) - -from ._generate import generate_ndset, generate_sequence - -from importlib.metadata import version as _metadata_version - __version__ = _metadata_version("moocore") # Remove symbols imported for internal use del _metadata_version diff --git a/python/src/moocore/_datasets.py b/python/src/moocore/_datasets.py index 7931f6067..15c9981fd 100644 --- a/python/src/moocore/_datasets.py +++ b/python/src/moocore/_datasets.py @@ -1,20 +1,21 @@ from __future__ import annotations -from typing import Any import hashlib -import numpy as np import os import shutil -import warnings import time +import warnings +from importlib.metadata import version as _metadata_version +from importlib.resources import files from pathlib import Path from tempfile import NamedTemporaryFile +from typing import Any from urllib.error import URLError from urllib.request import urlretrieve -from importlib.resources import files -from importlib.metadata import version as _metadata_version +import numpy as np from platformdirs import user_cache_path + from ._moocore import read_datasets _moocore_version = _metadata_version("moocore") diff --git a/python/src/moocore/_docsubstitute.py b/python/src/moocore/_docsubstitute.py index 4e1f142d6..9063efeda 100644 --- a/python/src/moocore/_docsubstitute.py +++ b/python/src/moocore/_docsubstitute.py @@ -1,8 +1,7 @@ -from typing import Any, TypeVar +import inspect from collections.abc import Callable - from string import Template -import inspect +from typing import Any, TypeVar _CallableT = TypeVar("_CallableT", bound=Callable[..., Any]) diff --git a/python/src/moocore/_ffi_build.py b/python/src/moocore/_ffi_build.py index 87e32fff0..60732dce3 100644 --- a/python/src/moocore/_ffi_build.py +++ b/python/src/moocore/_ffi_build.py @@ -8,11 +8,11 @@ """ -from typing import Any - import os import platform import shlex +from typing import Any + from cffi import FFI DEBUG = 0 # Default value. diff --git a/python/src/moocore/_generate.py b/python/src/moocore/_generate.py index 57ed44a66..6bf1bae74 100644 --- a/python/src/moocore/_generate.py +++ b/python/src/moocore/_generate.py @@ -6,7 +6,6 @@ # https://www.sciencedirect.com/science/article/pii/S0305054816301538?via=ihub#bib26 # (code: # https://github.com/renaudlr/moo-nondominated-sets/blob/master/wfgHardGenerator.R) - from ._docsubstitute import DocSubstitute from ._moocore import any_dominated, pareto_rank from ._utils import is_integer_value diff --git a/python/src/moocore/_moocore.py b/python/src/moocore/_moocore.py index 9979878c3..02b2b7bb3 100644 --- a/python/src/moocore/_moocore.py +++ b/python/src/moocore/_moocore.py @@ -1,35 +1,33 @@ from __future__ import annotations -import os -from io import StringIO -from collections.abc import Callable, Sequence -from numpy.typing import ArrayLike, NDArray # For type hints -from typing import Literal, Any, NamedTuple, TypeAlias -import numbers - # NOTE: if we ever start using SciPy, we can use # from scipy.special import gamma_function - import lzma +import numbers +import os import shutil import tempfile +from collections.abc import Callable, Sequence +from io import StringIO +from typing import Any, Literal, NamedTuple, TypeAlias import numpy as np +from numpy.typing import ArrayLike, NDArray # For type hints + +from ._docsubstitute import DocSubstitute +## The CFFI library is used to create C bindings. +from ._libmoocore import ffi, lib # ty: ignore[unresolved-import] from ._utils import ( + _get_seed_for_c, + array_1d_of_length_n, asarray_maybe_copy, - unique_nosort, - np2d_to_double_array, + is_integer_value, np1d_to_double_array, np1d_to_int_array, - array_1d_of_length_n, - is_integer_value, - _get_seed_for_c, + np2d_to_double_array, + unique_nosort, ) -from ._docsubstitute import DocSubstitute - -## The CFFI library is used to create C bindings. -from ._libmoocore import lib, ffi # ty: ignore[unresolved-import] MaximiseType: TypeAlias = bool | Sequence[bool | int] | NDArray[np.bool_] diff --git a/python/src/moocore/_utils.py b/python/src/moocore/_utils.py index 6ef8006e7..e91a73daa 100644 --- a/python/src/moocore/_utils.py +++ b/python/src/moocore/_utils.py @@ -1,7 +1,8 @@ -from numpy.typing import ArrayLike # For type hints from typing import Any import numpy as np +from numpy.typing import ArrayLike # For type hints + from ._libmoocore import ffi # ty: ignore[unresolved-import] diff --git a/python/tests/conftest.py b/python/tests/conftest.py index 54db7486a..5c8a4c74e 100644 --- a/python/tests/conftest.py +++ b/python/tests/conftest.py @@ -1,6 +1,8 @@ # ruff: noqa: D100 import pytest + import moocore + from .helpers.immutability import deep_copy, deep_equal, freeze_numpy diff --git a/python/tests/helpers/immutability.py b/python/tests/helpers/immutability.py index c84cde650..2dff6a420 100644 --- a/python/tests/helpers/immutability.py +++ b/python/tests/helpers/immutability.py @@ -1,6 +1,7 @@ # ruff: noqa: D100 import copy from collections.abc import Mapping + import numpy as np from numpy.testing import assert_array_equal diff --git a/python/tests/test_bugs.py b/python/tests/test_bugs.py index 13188f25f..229980d24 100644 --- a/python/tests/test_bugs.py +++ b/python/tests/test_bugs.py @@ -3,6 +3,7 @@ from numpy.testing import ( assert_array_equal, ) + import moocore diff --git a/python/tests/test_immutability.py b/python/tests/test_immutability.py index 4d6679b2c..a4471005d 100644 --- a/python/tests/test_immutability.py +++ b/python/tests/test_immutability.py @@ -1,6 +1,6 @@ # ruff: noqa: D100, D103 -import pytest import numpy as np +import pytest def test_immutable_call(immutable_call): diff --git a/python/tests/test_moocore.py b/python/tests/test_moocore.py index cd999e2e7..12ef2a5fc 100644 --- a/python/tests/test_moocore.py +++ b/python/tests/test_moocore.py @@ -1,11 +1,13 @@ # ruff: noqa: D100, D103 -import pytest +import math + import numpy as np +import pytest from numpy.testing import ( - assert_array_equal, assert_allclose, + assert_array_equal, ) -import math + import moocore fun_c2py = { diff --git a/python/tests/test_pandas.py b/python/tests/test_pandas.py index 5c540c81c..1efaf8670 100644 --- a/python/tests/test_pandas.py +++ b/python/tests/test_pandas.py @@ -1,7 +1,8 @@ # ruff: noqa: D100, D103 import pytest +from numpy.testing import assert_allclose, assert_array_equal + import moocore -from numpy.testing import assert_array_equal, assert_allclose pd = pytest.importorskip("pandas") diff --git a/release.py b/release.py index 4e4aeb782..4e02e6c6d 100755 --- a/release.py +++ b/release.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 +import argparse import re from datetime import datetime -import argparse def print_status(prefix, total_width=40): diff --git a/spack/packages/py-moocore/package.py b/spack/packages/py-moocore/package.py index a4e5aaaaf..cba846e7b 100644 --- a/spack/packages/py-moocore/package.py +++ b/spack/packages/py-moocore/package.py @@ -1,4 +1,3 @@ -# ruff: noqa: F403, F405 from spack.package import * diff --git a/tools/hypersphere_volume.py b/tools/hypersphere_volume.py index a64b0df36..ef6ed449f 100644 --- a/tools/hypersphere_volume.py +++ b/tools/hypersphere_volume.py @@ -1,9 +1,9 @@ # Requires # sympy >= 1.14.0 # mpmath>=1.4.1 -import sympy as sp import mpmath import numpy as np +import sympy as sp # Set the precision to 128 bits mpmath.mp.dps = 128 diff --git a/tools/rphi_seq.py b/tools/rphi_seq.py index 624e16912..862a6f2f7 100644 --- a/tools/rphi_seq.py +++ b/tools/rphi_seq.py @@ -7,9 +7,9 @@ # Requires # sympy >= 1.14.0 # mpmath>=1.4.1 -from sympy import symbols, solve, N -from mpmath import mp import numpy as np +from mpmath import mp +from sympy import N, solve, symbols # Set precision to 128 bits mp.prec = 128