From c703e64ce77b1cf52e0e3f33198f87df6d2317ad Mon Sep 17 00:00:00 2001 From: Lachlan Grose Date: Wed, 23 Apr 2025 10:04:12 +1000 Subject: [PATCH] style: pre-commit isort/black --- .flake8 | 2 +- .github/ISSUE_TEMPLATE/questions-.md | 2 - .github/workflows/pypi.yml | 2 +- .gitignore | 2 +- .pre-commit-config.yaml | 19 ++++++++ Dockerfile | 2 +- LoopStructural/__init__.py | 11 ++--- LoopStructural/datasets/__init__.py | 34 +++++++------- LoopStructural/datasets/_base.py | 1 + .../datasets/data/fault_trace/fault_trace.cpg | 2 +- .../datasets/data/fault_trace/fault_trace.prj | 2 +- LoopStructural/datatypes/__init__.py | 2 +- LoopStructural/datatypes/_bounding_box.py | 12 ++--- LoopStructural/datatypes/_point.py | 5 ++- LoopStructural/datatypes/_structured_grid.py | 4 +- LoopStructural/datatypes/_surface.py | 4 +- LoopStructural/export/exporters.py | 9 ++-- LoopStructural/export/geoh5.py | 1 + LoopStructural/export/omf_wrapper.py | 3 +- LoopStructural/interpolators/__init__.py | 34 +++++++------- LoopStructural/interpolators/_api.py | 5 ++- .../interpolators/_cython/dsi_helper.pyx | 6 ++- .../_discrete_fold_interpolator.py | 4 +- .../interpolators/_discrete_interpolator.py | 5 +-- .../_finite_difference_interpolator.py | 7 +-- .../interpolators/_geological_interpolator.py | 8 ++-- .../interpolators/_interpolator_builder.py | 28 ++++++------ .../interpolators/_interpolator_factory.py | 13 +++--- .../interpolators/_p2interpolator.py | 2 +- .../interpolators/_surfe_wrapper.py | 8 ++-- .../supports/_2d_base_unstructured.py | 3 +- .../supports/_2d_p1_unstructured.py | 3 +- .../supports/_2d_p2_unstructured.py | 3 +- .../supports/_2d_structured_grid.py | 5 ++- .../supports/_3d_base_structured.py | 7 ++- .../interpolators/supports/_3d_p2_tetra.py | 4 +- .../supports/_3d_structured_grid.py | 8 ++-- .../supports/_3d_structured_tetra.py | 6 ++- .../supports/_3d_unstructured_tetra.py | 7 ++- .../interpolators/supports/__init__.py | 4 +- .../interpolators/supports/_base_support.py | 3 +- .../supports/_support_factory.py | 6 ++- LoopStructural/modelling/__init__.py | 5 +-- .../modelling/core/geological_model.py | 32 ++++++------- LoopStructural/modelling/features/__init__.py | 8 ++-- .../modelling/features/_analytical_feature.py | 7 +-- .../features/_base_geological_feature.py | 12 ++--- .../_cross_product_geological_feature.py | 4 +- .../modelling/features/_geological_feature.py | 14 +++--- .../features/_lambda_geological_feature.py | 9 ++-- .../features/_projected_vector_feature.py | 4 +- .../modelling/features/_structural_frame.py | 8 ++-- .../features/_unconformity_feature.py | 5 +-- .../modelling/features/builders/__init__.py | 4 +- .../features/builders/_fault_builder.py | 22 ++++----- .../builders/_folded_feature_builder.py | 14 +++--- .../builders/_geological_feature_builder.py | 45 ++++++++++--------- .../builders/_structural_frame_builder.py | 12 ++--- .../modelling/features/fault/__init__.py | 2 +- .../features/fault/_fault_function.py | 5 ++- .../features/fault/_fault_function_feature.py | 3 +- .../features/fault/_fault_segment.py | 17 +++---- .../modelling/features/fold/__init__.py | 2 +- .../modelling/features/fold/_foldframe.py | 1 - .../modelling/features/fold/_svariogram.py | 4 +- .../features/fold/fold_function/__init__.py | 8 ++-- .../_base_fold_rotation_angle.py | 5 ++- .../_fourier_series_fold_rotation_angle.py | 6 ++- .../_lambda_fold_rotation_angle.py | 6 ++- .../_trigo_fold_rotation_angle.py | 6 ++- .../modelling/input/map2loop_processor.py | 4 +- .../modelling/input/process_data.py | 5 ++- .../modelling/input/project_file.py | 3 +- .../modelling/intrusions/__init__.py | 10 ++--- .../intrusions/geom_conceptual_models.py | 1 + .../intrusions/geometric_scaling_functions.py | 3 +- .../modelling/intrusions/intrusion_builder.py | 7 +-- .../modelling/intrusions/intrusion_feature.py | 7 +-- .../intrusions/intrusion_frame_builder.py | 7 ++- .../intrusions/intrusion_support_functions.py | 1 + LoopStructural/utils/__init__.py | 21 ++++----- LoopStructural/utils/_surface.py | 6 ++- LoopStructural/utils/_transformation.py | 1 + LoopStructural/utils/logging.py | 3 +- LoopStructural/utils/maths.py | 6 ++- LoopStructural/utils/typing.py | 2 +- LoopStructural/utils/utils.py | 4 +- LoopStructural/visualisation/__init__.py | 2 +- docs/build_docs.sh | 2 +- docs/docker-compose.yml | 2 +- docs/requirements.txt | 2 +- docs/source/_static/docker.rst | 2 +- docs/source/_static/infinity_loop_icon.svg | 2 +- docs/source/_static/overview.rst | 2 - docs/source/_static/ubuntu_install.rst | 2 - docs/source/_static/windows_install.rst | 1 - docs/source/_static/wls_install.rst | 2 - .../_templates/custom-class-template.rst | 2 +- docs/source/_templates/custom.css | 2 +- docs/source/_templates/page.html | 2 +- docs/source/conf.py | 3 +- docs/source/docs_references.bib | 1 - docs/source/getting_started/about.rst | 1 - docs/source/getting_started/background.rst | 3 -- .../getting_started/contributors_guide.rst | 2 - docs/source/getting_started/installation.rst | 2 - .../getting_started/loopstructural_design.rst | 2 +- docs/source/getting_started/todo.rst | 2 +- docs/source/index.rst | 2 - docs/source/user_guide/debugging.rst | 4 -- docs/source/user_guide/fault_modelling.rst | 1 - docs/source/user_guide/fold_modelling.rst | 2 +- docs/source/user_guide/index.rst | 2 +- docs/source/user_guide/input_data.rst | 1 - .../user_guide/interpolation_options.rst | 1 - docs/source/user_guide/visualisation.rst | 4 -- .../user_guide/what_is_a_geological_model.rst | 5 --- examples/1_basic/README.rst | 2 +- examples/1_basic/plot_1_data_prepration.py | 1 + examples/1_basic/plot_2_surface_modelling.py | 7 ++- .../1_basic/plot_3_model_visualisation.py | 4 +- examples/1_basic/plot_3_multiple_groups.py | 1 - .../plot_4_using_stratigraphic_column.py | 4 +- examples/1_basic/plot_5_unconformities.py | 3 +- examples/1_basic/plot_6_fault_parameters.py | 3 +- examples/2_fold/README.rst | 2 +- examples/2_fold/_refolded_folds.py | 5 ++- .../2_fold/plot_1_adding_folds_to_surfaces.py | 4 +- examples/3_fault/README.rst | 2 +- .../3_fault/_define_fault_displacement.py | 3 +- examples/3_fault/_faulted_intrusion.py | 7 +-- examples/3_fault/fault_network.py | 11 ++--- examples/4_advanced/_5_using_logging.py | 8 ++-- .../4_advanced/_model_from_geological_map.py | 8 ++-- examples/README.rst | 2 +- requirements.txt | 3 -- setup.cfg | 2 +- setup.py | 3 +- tests/fixtures/interpolator.py | 10 +++-- tests/integration/test_fold_models.py | 8 ++-- tests/integration/test_interpolator.py | 3 +- tests/integration/test_refolded.py | 2 +- tests/unit/datatypes/test__structured_grid.py | 1 + tests/unit/datatypes/test__surface.py | 1 + tests/unit/datatypes/test_bounding_box.py | 3 +- tests/unit/input/test_data_processor.py | 5 ++- .../interpolator/test_2d_discrete_support.py | 3 +- .../interpolator/test_discrete_supports.py | 3 +- .../interpolator/test_interpolator_builder.py | 5 ++- tests/unit/interpolator/test_outside_box.py | 3 +- tests/unit/interpolator/test_solvers.py | 1 - .../test_unstructured_supports.py | 4 +- .../modelling/intrusions/test_intrusions.py | 9 ++-- tests/unit/modelling/test__bounding_box.py | 1 + tests/unit/modelling/test__fault_builder.py | 5 ++- tests/unit/modelling/test_faults_segment.py | 3 +- .../unit/modelling/test_geological_feature.py | 6 ++- .../test_geological_feature_builder.py | 6 +-- tests/unit/modelling/test_geological_model.py | 3 +- tests/unit/modelling/test_structural_frame.py | 12 ++--- tests/unit/utils/test_conversions.py | 3 +- 161 files changed, 485 insertions(+), 422 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.flake8 b/.flake8 index e0ea542fd..8dd399ab5 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] max-line-length = 88 -extend-ignore = E203 \ No newline at end of file +extend-ignore = E203 diff --git a/.github/ISSUE_TEMPLATE/questions-.md b/.github/ISSUE_TEMPLATE/questions-.md index a6ce5421a..ccd002011 100644 --- a/.github/ISSUE_TEMPLATE/questions-.md +++ b/.github/ISSUE_TEMPLATE/questions-.md @@ -6,5 +6,3 @@ labels: '' assignees: '' --- - - diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 195e082c9..2e4dba69b 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -33,4 +33,4 @@ jobs: skip_existing: true verbose: true user: ${{ secrets.PYPI_USERNAME }} - password: ${{ secrets.PYPI_PASSWORD }} \ No newline at end of file + password: ${{ secrets.PYPI_PASSWORD }} diff --git a/.gitignore b/.gitignore index fc3a44841..b83ed4017 100644 --- a/.gitignore +++ b/.gitignore @@ -135,4 +135,4 @@ docs/source/sg_execution_times.rst conda/index.html conda/channeldata.json conda/noarch -conda/win-64 \ No newline at end of file +conda/win-64 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..4074e4d5f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files +- repo: https://github.com/psf/black + rev: 25.1.0 + hooks: + - id: black +- repo: https://github.com/pycqa/isort + rev: 6.0.1 + hooks: + - id: isort + name: isort (python) + args: ["--profile", "black"] diff --git a/Dockerfile b/Dockerfile index 8c598538c..8d6df3e7a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -88,4 +88,4 @@ WORKDIR ${HOME}/notebooks CMD ["jupyter", "lab", "--ip='0.0.0.0'", "--NotebookApp.token=''", "--no-browser" ] EXPOSE 8050 -EXPOSE 8080:8090 \ No newline at end of file +EXPOSE 8080:8090 diff --git a/LoopStructural/__init__.py b/LoopStructural/__init__.py index 147a984fb..7b9c2101f 100644 --- a/LoopStructural/__init__.py +++ b/LoopStructural/__init__.py @@ -8,8 +8,9 @@ from logging.config import dictConfig __all__ = ["GeologicalModel"] -import tempfile from pathlib import Path +import tempfile + from .version import __version__ experimental = False @@ -18,11 +19,11 @@ ch.setFormatter(formatter) ch.setLevel(logging.WARNING) loggers = {} -from .modelling.core.geological_model import GeologicalModel -from .interpolators._api import LoopInterpolator -from .interpolators import InterpolatorBuilder from .datatypes import BoundingBox -from .utils import log_to_console, log_to_file, getLogger, rng, get_levels +from .interpolators import InterpolatorBuilder +from .interpolators._api import LoopInterpolator +from .modelling.core.geological_model import GeologicalModel +from .utils import get_levels, getLogger, log_to_console, log_to_file, rng logger = getLogger(__name__) logger.info("Imported LoopStructural") diff --git a/LoopStructural/datasets/__init__.py b/LoopStructural/datasets/__init__.py index 7ce90817c..59c570c44 100644 --- a/LoopStructural/datasets/__init__.py +++ b/LoopStructural/datasets/__init__.py @@ -5,19 +5,21 @@ Various datasets used for documentation and tutorials. """ -from ._base import load_claudius -from ._base import load_grose2017 -from ._base import load_grose2018 -from ._base import load_grose2019 -from ._base import load_laurent2016 -from ._base import load_noddy_single_fold -from ._base import load_intrusion -from ._base import normal_vector_headers -from ._base import strike_dip_headers -from ._base import value_headers -from ._base import load_unconformity -from ._base import load_duplex -from ._base import load_tabular_intrusion -from ._base import load_geological_map_data -from ._base import load_fault_trace -from ._base import load_horizontal +from ._base import ( + load_claudius, + load_duplex, + load_fault_trace, + load_geological_map_data, + load_grose2017, + load_grose2018, + load_grose2019, + load_horizontal, + load_intrusion, + load_laurent2016, + load_noddy_single_fold, + load_tabular_intrusion, + load_unconformity, + normal_vector_headers, + strike_dip_headers, + value_headers, +) diff --git a/LoopStructural/datasets/_base.py b/LoopStructural/datasets/_base.py index 8516d7e41..b0416a9c7 100644 --- a/LoopStructural/datasets/_base.py +++ b/LoopStructural/datasets/_base.py @@ -1,6 +1,7 @@ from os.path import dirname, join from pathlib import Path from typing import Tuple + import numpy as np import pandas as pd diff --git a/LoopStructural/datasets/data/fault_trace/fault_trace.cpg b/LoopStructural/datasets/data/fault_trace/fault_trace.cpg index 3ad133c04..7edc66b06 100644 --- a/LoopStructural/datasets/data/fault_trace/fault_trace.cpg +++ b/LoopStructural/datasets/data/fault_trace/fault_trace.cpg @@ -1 +1 @@ -UTF-8 \ No newline at end of file +UTF-8 diff --git a/LoopStructural/datasets/data/fault_trace/fault_trace.prj b/LoopStructural/datasets/data/fault_trace/fault_trace.prj index 2e75c32d1..8f3043aeb 100644 --- a/LoopStructural/datasets/data/fault_trace/fault_trace.prj +++ b/LoopStructural/datasets/data/fault_trace/fault_trace.prj @@ -1 +1 @@ -PROJCS["GDA2020_MGA_Zone_53",GEOGCS["GCS_GDA2020",DATUM["GDA2020",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",10000000.0],PARAMETER["Central_Meridian",135.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]] \ No newline at end of file +PROJCS["GDA2020_MGA_Zone_53",GEOGCS["GCS_GDA2020",DATUM["GDA2020",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",10000000.0],PARAMETER["Central_Meridian",135.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]] diff --git a/LoopStructural/datatypes/__init__.py b/LoopStructural/datatypes/__init__.py index ccb1a4828..b08a35277 100644 --- a/LoopStructural/datatypes/__init__.py +++ b/LoopStructural/datatypes/__init__.py @@ -1,4 +1,4 @@ -from ._surface import Surface from ._bounding_box import BoundingBox from ._point import ValuePoints, VectorPoints from ._structured_grid import StructuredGrid +from ._surface import Surface diff --git a/LoopStructural/datatypes/_bounding_box.py b/LoopStructural/datatypes/_bounding_box.py index dc1d01e81..aebc1536e 100644 --- a/LoopStructural/datatypes/_bounding_box.py +++ b/LoopStructural/datatypes/_bounding_box.py @@ -1,11 +1,13 @@ from __future__ import annotations -from typing import Optional, Union, Dict -from LoopStructural.utils.exceptions import LoopValueError -from LoopStructural.utils import rng -from LoopStructural.datatypes._structured_grid import StructuredGrid -import numpy as np + import copy +from typing import Dict, Optional, Union +import numpy as np + +from LoopStructural.datatypes._structured_grid import StructuredGrid +from LoopStructural.utils import rng +from LoopStructural.utils.exceptions import LoopValueError from LoopStructural.utils.logging import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/datatypes/_point.py b/LoopStructural/datatypes/_point.py index 4542262d5..e9294e705 100644 --- a/LoopStructural/datatypes/_point.py +++ b/LoopStructural/datatypes/_point.py @@ -1,8 +1,9 @@ from dataclasses import dataclass, field +import io +from typing import Optional, Union + import numpy as np -from typing import Optional, Union -import io from LoopStructural.utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/datatypes/_structured_grid.py b/LoopStructural/datatypes/_structured_grid.py index dd3229681..af4f15664 100644 --- a/LoopStructural/datatypes/_structured_grid.py +++ b/LoopStructural/datatypes/_structured_grid.py @@ -1,6 +1,8 @@ +from dataclasses import dataclass, field from typing import Dict + import numpy as np -from dataclasses import dataclass, field + from LoopStructural.utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/datatypes/_surface.py b/LoopStructural/datatypes/_surface.py index 5a2ae2abe..f7b0df731 100644 --- a/LoopStructural/datatypes/_surface.py +++ b/LoopStructural/datatypes/_surface.py @@ -1,7 +1,9 @@ from dataclasses import dataclass, field +import io from typing import Optional, Union + import numpy as np -import io + from LoopStructural.utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/export/exporters.py b/LoopStructural/export/exporters.py index bf0c30a00..e832dee4c 100644 --- a/LoopStructural/export/exporters.py +++ b/LoopStructural/export/exporters.py @@ -3,14 +3,15 @@ """ import os -from pyevtk.hl import unstructuredGridToVTK, pointsToVTK -from pyevtk.vtk import VtkTriangle + import numpy as np +from pyevtk.hl import pointsToVTK, unstructuredGridToVTK +from pyevtk.vtk import VtkTriangle from skimage.measure import marching_cubes -from LoopStructural.utils.helper import create_box -from LoopStructural.export.file_formats import FileFormat from LoopStructural.datatypes import Surface +from LoopStructural.export.file_formats import FileFormat +from LoopStructural.utils.helper import create_box from ..utils import getLogger diff --git a/LoopStructural/export/geoh5.py b/LoopStructural/export/geoh5.py index c91501e0e..a6c3f0aa8 100644 --- a/LoopStructural/export/geoh5.py +++ b/LoopStructural/export/geoh5.py @@ -1,6 +1,7 @@ import geoh5py import geoh5py.workspace import numpy as np + from LoopStructural.datatypes import ValuePoints, VectorPoints diff --git a/LoopStructural/export/omf_wrapper.py b/LoopStructural/export/omf_wrapper.py index 2440ec0fe..61464fd0d 100644 --- a/LoopStructural/export/omf_wrapper.py +++ b/LoopStructural/export/omf_wrapper.py @@ -5,10 +5,11 @@ "You need to install the omf package to use this feature. " "You can install it with: pip install mira-omf" ) -import numpy as np import datetime import os +import numpy as np + def get_project(filename): if os.path.exists(filename): diff --git a/LoopStructural/interpolators/__init__.py b/LoopStructural/interpolators/__init__.py index 7fdc3adec..303fa6ec9 100644 --- a/LoopStructural/interpolators/__init__.py +++ b/LoopStructural/interpolators/__init__.py @@ -54,31 +54,29 @@ class InterpolatorType(IntEnum): "DFI": InterpolatorType.DISCRETE_FOLD, 'surfe': InterpolatorType.SURFE, } -from ..interpolators._geological_interpolator import GeologicalInterpolator -from ..interpolators._discrete_interpolator import DiscreteInterpolator -from ..interpolators.supports import ( - TetMesh, - StructuredGrid, - UnStructuredTetMesh, - P1Unstructured2d, - P2Unstructured2d, - StructuredGrid2D, - P2UnstructuredTetMesh, - SupportType, +from ..interpolators._discrete_fold_interpolator import ( + DiscreteFoldInterpolator, ) - - +from ..interpolators._discrete_interpolator import DiscreteInterpolator from ..interpolators._finite_difference_interpolator import ( FiniteDifferenceInterpolator, ) +from ..interpolators._geological_interpolator import GeologicalInterpolator from ..interpolators._p1interpolator import ( + P1Interpolator, P1Interpolator as PiecewiseLinearInterpolator, ) -from ..interpolators._discrete_fold_interpolator import ( - DiscreteFoldInterpolator, -) from ..interpolators._p2interpolator import P2Interpolator -from ..interpolators._p1interpolator import P1Interpolator +from ..interpolators.supports import ( + P1Unstructured2d, + P2Unstructured2d, + P2UnstructuredTetMesh, + StructuredGrid, + StructuredGrid2D, + SupportType, + TetMesh, + UnStructuredTetMesh, +) try: from ..interpolators._surfe_wrapper import SurfeRBFInterpolator @@ -113,7 +111,7 @@ class InterpolatorType(IntEnum): }, } -from ._interpolator_factory import InterpolatorFactory from ._interpolator_builder import InterpolatorBuilder +from ._interpolator_factory import InterpolatorFactory # from ._api import LoopInterpolator diff --git a/LoopStructural/interpolators/_api.py b/LoopStructural/interpolators/_api.py index 032f6c4db..af1ff2dcc 100644 --- a/LoopStructural/interpolators/_api.py +++ b/LoopStructural/interpolators/_api.py @@ -1,12 +1,13 @@ +from typing import Optional + import numpy as np -from typing import Optional +from LoopStructural.datatypes import BoundingBox from LoopStructural.interpolators import ( GeologicalInterpolator, InterpolatorFactory, InterpolatorType, ) -from LoopStructural.datatypes import BoundingBox from LoopStructural.utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/interpolators/_cython/dsi_helper.pyx b/LoopStructural/interpolators/_cython/dsi_helper.pyx index 580a30c9c..769699466 100644 --- a/LoopStructural/interpolators/_cython/dsi_helper.pyx +++ b/LoopStructural/interpolators/_cython/dsi_helper.pyx @@ -1,8 +1,12 @@ import cython import numpy as np import numpy.linalg as la + cimport numpy as np + from math import * + + @cython.boundscheck(False) @cython.wraparound(False) #cython: language_level=3 @@ -306,4 +310,4 @@ def tetra_neighbours(long long [:,:] elements, long long [:,:] neighbours): # pairs[face_n][1] = n # # face_n+=1 -# return pairs \ No newline at end of file +# return pairs diff --git a/LoopStructural/interpolators/_discrete_fold_interpolator.py b/LoopStructural/interpolators/_discrete_fold_interpolator.py index a5ec0cfd1..b81376ea4 100644 --- a/LoopStructural/interpolators/_discrete_fold_interpolator.py +++ b/LoopStructural/interpolators/_discrete_fold_interpolator.py @@ -2,11 +2,11 @@ Piecewise linear interpolator using folds """ -from typing import Optional, Callable +from typing import Callable, Optional import numpy as np -from ..interpolators import PiecewiseLinearInterpolator, InterpolatorType +from ..interpolators import InterpolatorType, PiecewiseLinearInterpolator from ..modelling.features.fold import FoldEvent from ..utils import getLogger, rng diff --git a/LoopStructural/interpolators/_discrete_interpolator.py b/LoopStructural/interpolators/_discrete_interpolator.py index 60f19932f..3bd5d8244 100644 --- a/LoopStructural/interpolators/_discrete_interpolator.py +++ b/LoopStructural/interpolators/_discrete_interpolator.py @@ -3,14 +3,13 @@ """ from abc import abstractmethod -from typing import Callable, Optional, Union import logging +from typing import Callable, Optional, Union import numpy as np from scipy import sparse # import sparse.coo_matrix, sparse.bmat, sparse.eye -from ..interpolators import InterpolatorType -from ..interpolators import GeologicalInterpolator +from ..interpolators import GeologicalInterpolator, InterpolatorType from ..utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/interpolators/_finite_difference_interpolator.py b/LoopStructural/interpolators/_finite_difference_interpolator.py index a0b03e11f..ca727a612 100644 --- a/LoopStructural/interpolators/_finite_difference_interpolator.py +++ b/LoopStructural/interpolators/_finite_difference_interpolator.py @@ -3,12 +3,13 @@ """ import numpy as np +from scipy.spatial import KDTree + +from LoopStructural.utils import getLogger +from ..interpolators import InterpolatorType from ..utils import get_vectors from ._discrete_interpolator import DiscreteInterpolator -from ..interpolators import InterpolatorType -from scipy.spatial import KDTree -from LoopStructural.utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/interpolators/_geological_interpolator.py b/LoopStructural/interpolators/_geological_interpolator.py index 840faf6a1..05fd397fc 100644 --- a/LoopStructural/interpolators/_geological_interpolator.py +++ b/LoopStructural/interpolators/_geological_interpolator.py @@ -3,11 +3,13 @@ """ from abc import ABCMeta, abstractmethod -from LoopStructural.utils.exceptions import LoopTypeError -from ..interpolators import InterpolatorType +from typing import Optional + import numpy as np -from typing import Optional +from LoopStructural.utils.exceptions import LoopTypeError + +from ..interpolators import InterpolatorType from ..utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/interpolators/_interpolator_builder.py b/LoopStructural/interpolators/_interpolator_builder.py index b67946627..2bc48fe11 100644 --- a/LoopStructural/interpolators/_interpolator_builder.py +++ b/LoopStructural/interpolators/_interpolator_builder.py @@ -1,11 +1,12 @@ +from typing import Optional, Union + +import numpy as np + +from LoopStructural.datatypes import BoundingBox from LoopStructural.interpolators import ( InterpolatorFactory, InterpolatorType, ) -from LoopStructural.datatypes import BoundingBox -from typing import Union, Optional -import numpy as np - from LoopStructural.interpolators._geological_interpolator import GeologicalInterpolator @@ -37,12 +38,12 @@ def __init__( self.buffer = buffer self.kwargs = kwargs self.interpolator = InterpolatorFactory.create_interpolator( - interpolatortype=self.interpolatortype, - boundingbox=self.bounding_box, - nelements=self.nelements, - buffer=self.buffer, - **self.kwargs, - ) + interpolatortype=self.interpolatortype, + boundingbox=self.bounding_box, + nelements=self.nelements, + buffer=self.buffer, + **self.kwargs, + ) def add_value_constraints(self, value_constraints: np.ndarray) -> 'InterpolatorBuilder': """Add value constraints to the interpolator @@ -55,7 +56,7 @@ def add_value_constraints(self, value_constraints: np.ndarray) -> 'InterpolatorB Returns ------- InterpolatorBuilder - reference to the builder + reference to the builder """ if self.interpolator: self.interpolator.set_value_constraints(value_constraints) @@ -100,7 +101,8 @@ def add_normal_constraints(self, normal_constraints: np.ndarray) -> 'Interpolato if self.interpolator: self.interpolator.set_normal_constraints(normal_constraints) return self - #TODO implement/check inequalities + + # TODO implement/check inequalities # def add_inequality_constraints(self, inequality_constraints: np.ndarray) -> 'InterpolatorBuilder': # if self.interpolator: # self.interpolator.set_value_inequality_constraints(inequality_constraints) @@ -123,7 +125,7 @@ def setup_interpolator(self, **kwargs) -> 'InterpolatorBuilder': self.interpolator.setup(**kwargs) return self - def build(self)->GeologicalInterpolator: + def build(self) -> GeologicalInterpolator: """Builds the interpolator and returns it Returns diff --git a/LoopStructural/interpolators/_interpolator_factory.py b/LoopStructural/interpolators/_interpolator_factory.py index 83fa9472d..8f4a9689b 100644 --- a/LoopStructural/interpolators/_interpolator_factory.py +++ b/LoopStructural/interpolators/_interpolator_factory.py @@ -1,13 +1,16 @@ from typing import Optional, Union -from .supports import SupportFactory + +import numpy as np + +from LoopStructural.datatypes import BoundingBox + from . import ( - interpolator_map, InterpolatorType, - support_interpolator_map, + interpolator_map, interpolator_string_map, + support_interpolator_map, ) -from LoopStructural.datatypes import BoundingBox -import numpy as np +from .supports import SupportFactory class InterpolatorFactory: diff --git a/LoopStructural/interpolators/_p2interpolator.py b/LoopStructural/interpolators/_p2interpolator.py index 1d6c8e352..401d04388 100644 --- a/LoopStructural/interpolators/_p2interpolator.py +++ b/LoopStructural/interpolators/_p2interpolator.py @@ -3,7 +3,7 @@ """ import logging -from typing import Optional, Callable +from typing import Callable, Optional import numpy as np diff --git a/LoopStructural/interpolators/_surfe_wrapper.py b/LoopStructural/interpolators/_surfe_wrapper.py index 6ebc1bcf7..031f517d2 100644 --- a/LoopStructural/interpolators/_surfe_wrapper.py +++ b/LoopStructural/interpolators/_surfe_wrapper.py @@ -2,14 +2,14 @@ Wrapper for using surfepy """ -from ..utils.maths import get_vectors -from ..interpolators import GeologicalInterpolator +from typing import Optional import numpy as np +import surfepy +from ..interpolators import GeologicalInterpolator from ..utils import getLogger -import surfepy -from typing import Optional +from ..utils.maths import get_vectors logger = getLogger(__name__) diff --git a/LoopStructural/interpolators/supports/_2d_base_unstructured.py b/LoopStructural/interpolators/supports/_2d_base_unstructured.py index 82868d0b1..4ee59a34a 100644 --- a/LoopStructural/interpolators/supports/_2d_base_unstructured.py +++ b/LoopStructural/interpolators/supports/_2d_base_unstructured.py @@ -5,13 +5,14 @@ from abc import abstractmethod import logging from typing import Tuple + import numpy as np from scipy import sparse from . import SupportType from ._2d_structured_grid import StructuredGrid2D -from ._base_support import BaseSupport from ._aabb import _initialise_aabb +from ._base_support import BaseSupport from ._face_table import _init_face_table logger = logging.getLogger(__name__) diff --git a/LoopStructural/interpolators/supports/_2d_p1_unstructured.py b/LoopStructural/interpolators/supports/_2d_p1_unstructured.py index 64857591b..b0fdad075 100644 --- a/LoopStructural/interpolators/supports/_2d_p1_unstructured.py +++ b/LoopStructural/interpolators/supports/_2d_p1_unstructured.py @@ -5,8 +5,9 @@ import logging import numpy as np -from ._2d_base_unstructured import BaseUnstructured2d + from . import SupportType +from ._2d_base_unstructured import BaseUnstructured2d logger = logging.getLogger(__name__) diff --git a/LoopStructural/interpolators/supports/_2d_p2_unstructured.py b/LoopStructural/interpolators/supports/_2d_p2_unstructured.py index 832b2fd8d..6934face9 100644 --- a/LoopStructural/interpolators/supports/_2d_p2_unstructured.py +++ b/LoopStructural/interpolators/supports/_2d_p2_unstructured.py @@ -5,8 +5,9 @@ import logging import numpy as np -from ._2d_base_unstructured import BaseUnstructured2d + from . import SupportType +from ._2d_base_unstructured import BaseUnstructured2d logger = logging.getLogger(__name__) diff --git a/LoopStructural/interpolators/supports/_2d_structured_grid.py b/LoopStructural/interpolators/supports/_2d_structured_grid.py index 61e8d825d..cc9e7f7a7 100644 --- a/LoopStructural/interpolators/supports/_2d_structured_grid.py +++ b/LoopStructural/interpolators/supports/_2d_structured_grid.py @@ -4,12 +4,13 @@ """ import logging +from typing import Dict, Tuple import numpy as np + from . import SupportType -from ._base_support import BaseSupport -from typing import Dict, Tuple from .._operator import Operator +from ._base_support import BaseSupport logger = logging.getLogger(__name__) diff --git a/LoopStructural/interpolators/supports/_3d_base_structured.py b/LoopStructural/interpolators/supports/_3d_base_structured.py index 4c91322ca..2f4e0828d 100644 --- a/LoopStructural/interpolators/supports/_3d_base_structured.py +++ b/LoopStructural/interpolators/supports/_3d_base_structured.py @@ -1,9 +1,12 @@ -from LoopStructural.utils.exceptions import LoopException from abc import abstractmethod +from typing import Tuple + import numpy as np + from LoopStructural.utils import getLogger +from LoopStructural.utils.exceptions import LoopException + from . import SupportType -from typing import Tuple logger = getLogger(__name__) diff --git a/LoopStructural/interpolators/supports/_3d_p2_tetra.py b/LoopStructural/interpolators/supports/_3d_p2_tetra.py index 445e39336..44680299d 100644 --- a/LoopStructural/interpolators/supports/_3d_p2_tetra.py +++ b/LoopStructural/interpolators/supports/_3d_p2_tetra.py @@ -1,7 +1,7 @@ -from ._3d_unstructured_tetra import UnStructuredTetMesh - import numpy as np + from . import SupportType +from ._3d_unstructured_tetra import UnStructuredTetMesh class P2UnstructuredTetMesh(UnStructuredTetMesh): diff --git a/LoopStructural/interpolators/supports/_3d_structured_grid.py b/LoopStructural/interpolators/supports/_3d_structured_grid.py index 19cc641bc..711086b18 100644 --- a/LoopStructural/interpolators/supports/_3d_structured_grid.py +++ b/LoopStructural/interpolators/supports/_3d_structured_grid.py @@ -3,15 +3,15 @@ """ +from typing import Dict, Tuple + import numpy as np from LoopStructural.interpolators._operator import Operator +from LoopStructural.utils import getLogger -from ._3d_base_structured import BaseStructuredSupport -from typing import Dict, Tuple from . import SupportType - -from LoopStructural.utils import getLogger +from ._3d_base_structured import BaseStructuredSupport logger = getLogger(__name__) diff --git a/LoopStructural/interpolators/supports/_3d_structured_tetra.py b/LoopStructural/interpolators/supports/_3d_structured_tetra.py index 70ecba374..7ca76aa1b 100644 --- a/LoopStructural/interpolators/supports/_3d_structured_tetra.py +++ b/LoopStructural/interpolators/supports/_3d_structured_tetra.py @@ -3,11 +3,13 @@ """ import numpy as np -from ._3d_base_structured import BaseStructuredSupport -from . import SupportType from scipy.sparse import coo_matrix, tril + from LoopStructural.utils import getLogger +from . import SupportType +from ._3d_base_structured import BaseStructuredSupport + logger = getLogger(__name__) diff --git a/LoopStructural/interpolators/supports/_3d_unstructured_tetra.py b/LoopStructural/interpolators/supports/_3d_unstructured_tetra.py index f55e8deb3..afcfc7c7a 100644 --- a/LoopStructural/interpolators/supports/_3d_unstructured_tetra.py +++ b/LoopStructural/interpolators/supports/_3d_unstructured_tetra.py @@ -4,13 +4,12 @@ from ast import Tuple - import numpy as np -from scipy.sparse import csr_matrix, coo_matrix, tril +from scipy.sparse import coo_matrix, csr_matrix, tril -from . import StructuredGrid from LoopStructural.utils import getLogger -from . import SupportType + +from . import StructuredGrid, SupportType from ._base_support import BaseSupport logger = getLogger(__name__) diff --git a/LoopStructural/interpolators/supports/__init__.py b/LoopStructural/interpolators/supports/__init__.py index 2a9376746..ef07085f2 100644 --- a/LoopStructural/interpolators/supports/__init__.py +++ b/LoopStructural/interpolators/supports/__init__.py @@ -25,10 +25,10 @@ class SupportType(IntEnum): from ._2d_p1_unstructured import P1Unstructured2d from ._2d_p2_unstructured import P2Unstructured2d from ._2d_structured_grid import StructuredGrid2D +from ._3d_p2_tetra import P2UnstructuredTetMesh from ._3d_structured_grid import StructuredGrid -from ._3d_unstructured_tetra import UnStructuredTetMesh from ._3d_structured_tetra import TetMesh -from ._3d_p2_tetra import P2UnstructuredTetMesh +from ._3d_unstructured_tetra import UnStructuredTetMesh def no_support(*args, **kwargs): diff --git a/LoopStructural/interpolators/supports/_base_support.py b/LoopStructural/interpolators/supports/_base_support.py index 1e1a1d093..f090260dc 100644 --- a/LoopStructural/interpolators/supports/_base_support.py +++ b/LoopStructural/interpolators/supports/_base_support.py @@ -1,7 +1,8 @@ from abc import ABCMeta, abstractmethod -import numpy as np from typing import Tuple +import numpy as np + class BaseSupport(metaclass=ABCMeta): """ diff --git a/LoopStructural/interpolators/supports/_support_factory.py b/LoopStructural/interpolators/supports/_support_factory.py index 1dadc2746..5074620c4 100644 --- a/LoopStructural/interpolators/supports/_support_factory.py +++ b/LoopStructural/interpolators/supports/_support_factory.py @@ -1,7 +1,9 @@ -from LoopStructural.interpolators.supports import support_map, SupportType -import numpy as np from typing import Optional +import numpy as np + +from LoopStructural.interpolators.supports import SupportType, support_map + class SupportFactory: @staticmethod diff --git a/LoopStructural/modelling/__init__.py b/LoopStructural/modelling/__init__.py index 4e3e30d01..122585970 100644 --- a/LoopStructural/modelling/__init__.py +++ b/LoopStructural/modelling/__init__.py @@ -9,14 +9,13 @@ "Map2LoopProcessor", "LoopProjectfileProcessor", ] -from ..utils import getLogger -from ..utils import LoopImportError +from ..utils import LoopImportError, getLogger from .core.geological_model import GeologicalModel logger = getLogger(__name__) from ..modelling.input import ( - ProcessInputData, Map2LoopProcessor, + ProcessInputData, ) try: diff --git a/LoopStructural/modelling/core/geological_model.py b/LoopStructural/modelling/core/geological_model.py index 72233b09a..e79ed88b6 100644 --- a/LoopStructural/modelling/core/geological_model.py +++ b/LoopStructural/modelling/core/geological_model.py @@ -2,42 +2,36 @@ Main entry point for creating a geological model """ -from ...utils import getLogger, log_to_file +import pathlib +from typing import List import numpy as np import pandas as pd -from typing import List -import pathlib -from ...modelling.features.fault import FaultSegment +from ...datatypes import BoundingBox +from ...modelling.features import ( + FeatureType, + GeologicalFeature, + StructuralFrame, + UnconformityFeature, +) from ...modelling.features.builders import ( FaultBuilder, + FoldedFeatureBuilder, GeologicalFeatureBuilder, StructuralFrameBuilder, - FoldedFeatureBuilder, -) -from ...modelling.features import ( - UnconformityFeature, - StructuralFrame, - GeologicalFeature, - FeatureType, ) +from ...modelling.features.fault import FaultSegment from ...modelling.features.fold import ( FoldEvent, FoldFrame, ) - +from ...modelling.intrusions import IntrusionBuilder, IntrusionFrameBuilder +from ...utils import getLogger, log_to_file, strikedip2vector from ...utils.helper import ( all_heading, gradient_vec_names, ) -from ...utils import strikedip2vector -from ...datatypes import BoundingBox - -from ...modelling.intrusions import IntrusionBuilder - -from ...modelling.intrusions import IntrusionFrameBuilder - logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/__init__.py b/LoopStructural/modelling/features/__init__.py index af93f1b05..ab474388f 100644 --- a/LoopStructural/modelling/features/__init__.py +++ b/LoopStructural/modelling/features/__init__.py @@ -19,15 +19,15 @@ class FeatureType(IntEnum): ONLAPUNCONFORMITY = 12 +from ._analytical_feature import AnalyticalGeologicalFeature + # from .builders._geological_feature_builder import GeologicalFeatureBuilder from ._base_geological_feature import BaseFeature +from ._cross_product_geological_feature import CrossProductGeologicalFeature from ._geological_feature import GeologicalFeature from ._lambda_geological_feature import LambdaGeologicalFeature +from ._projected_vector_feature import ProjectedVectorFeature # from .builders._geological_feature_builder import GeologicalFeatureBuilder from ._structural_frame import StructuralFrame -from ._cross_product_geological_feature import CrossProductGeologicalFeature - from ._unconformity_feature import UnconformityFeature -from ._analytical_feature import AnalyticalGeologicalFeature -from ._projected_vector_feature import ProjectedVectorFeature diff --git a/LoopStructural/modelling/features/_analytical_feature.py b/LoopStructural/modelling/features/_analytical_feature.py index 27bc71d5d..15b9aee05 100644 --- a/LoopStructural/modelling/features/_analytical_feature.py +++ b/LoopStructural/modelling/features/_analytical_feature.py @@ -1,8 +1,9 @@ +from typing import Optional + import numpy as np -from ...modelling.features import BaseFeature + +from ...modelling.features import BaseFeature, FeatureType from ...utils import getLogger -from ...modelling.features import FeatureType -from typing import Optional logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/_base_geological_feature.py b/LoopStructural/modelling/features/_base_geological_feature.py index 39ea44bf3..527b165db 100644 --- a/LoopStructural/modelling/features/_base_geological_feature.py +++ b/LoopStructural/modelling/features/_base_geological_feature.py @@ -1,15 +1,15 @@ from __future__ import annotations from abc import ABCMeta, abstractmethod -from typing import Union, List, Optional -from LoopStructural.modelling.features import FeatureType -from LoopStructural.utils import getLogger -from LoopStructural.utils.typing import NumericInput -from LoopStructural.utils import LoopIsosurfacer, surface_list -from LoopStructural.datatypes import VectorPoints +from typing import List, Optional, Union import numpy as np +from LoopStructural.datatypes import VectorPoints +from LoopStructural.modelling.features import FeatureType +from LoopStructural.utils import LoopIsosurfacer, getLogger, surface_list +from LoopStructural.utils.typing import NumericInput + logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/_cross_product_geological_feature.py b/LoopStructural/modelling/features/_cross_product_geological_feature.py index 6df12e1b7..bd1be1fba 100644 --- a/LoopStructural/modelling/features/_cross_product_geological_feature.py +++ b/LoopStructural/modelling/features/_cross_product_geological_feature.py @@ -1,10 +1,10 @@ """ """ -import numpy as np from typing import Optional -from ...modelling.features import BaseFeature +import numpy as np +from ...modelling.features import BaseFeature from ...utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/_geological_feature.py b/LoopStructural/modelling/features/_geological_feature.py index 56eeccea3..1ff4e4dbf 100644 --- a/LoopStructural/modelling/features/_geological_feature.py +++ b/LoopStructural/modelling/features/_geological_feature.py @@ -2,15 +2,15 @@ Geological features """ -from LoopStructural.utils.maths import regular_tetraherdron_for_points, gradient_from_tetrahedron -from ...modelling.features import BaseFeature -from ...utils import getLogger -from ...modelling.features import FeatureType +from typing import List, Optional, Union + import numpy as np -from typing import Optional, List, Union -from ...datatypes import ValuePoints, VectorPoints -from ...utils import LoopValueError +from LoopStructural.utils.maths import gradient_from_tetrahedron, regular_tetraherdron_for_points + +from ...datatypes import ValuePoints, VectorPoints +from ...modelling.features import BaseFeature, FeatureType +from ...utils import LoopValueError, getLogger logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/_lambda_geological_feature.py b/LoopStructural/modelling/features/_lambda_geological_feature.py index 3894c15d7..3f375f7af 100644 --- a/LoopStructural/modelling/features/_lambda_geological_feature.py +++ b/LoopStructural/modelling/features/_lambda_geological_feature.py @@ -2,12 +2,13 @@ Geological features """ -from ...modelling.features import BaseFeature -from ...utils import getLogger -from ...modelling.features import FeatureType -import numpy as np from typing import Callable, Optional +import numpy as np + +from ...modelling.features import BaseFeature, FeatureType +from ...utils import getLogger + logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/_projected_vector_feature.py b/LoopStructural/modelling/features/_projected_vector_feature.py index 89bed98ca..1df6142a8 100644 --- a/LoopStructural/modelling/features/_projected_vector_feature.py +++ b/LoopStructural/modelling/features/_projected_vector_feature.py @@ -1,10 +1,10 @@ """ """ -import numpy as np from typing import Optional -from ...modelling.features import BaseFeature +import numpy as np +from ...modelling.features import BaseFeature from ...utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/_structural_frame.py b/LoopStructural/modelling/features/_structural_frame.py index 9a884536c..9c209e9ed 100644 --- a/LoopStructural/modelling/features/_structural_frame.py +++ b/LoopStructural/modelling/features/_structural_frame.py @@ -2,11 +2,13 @@ Structural frames """ -from ..features import BaseFeature, FeatureType +from typing import List, Optional, Union + import numpy as np -from ...utils import getLogger -from typing import Optional, List, Union + from ...datatypes import ValuePoints, VectorPoints +from ...utils import getLogger +from ..features import BaseFeature, FeatureType logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/_unconformity_feature.py b/LoopStructural/modelling/features/_unconformity_feature.py index c3a8eae1e..2cb1b9f72 100644 --- a/LoopStructural/modelling/features/_unconformity_feature.py +++ b/LoopStructural/modelling/features/_unconformity_feature.py @@ -1,8 +1,7 @@ -from ...modelling.features import GeologicalFeature -from ...modelling.features import FeatureType - import numpy as np +from ...modelling.features import FeatureType, GeologicalFeature + class UnconformityFeature(GeologicalFeature): """ """ diff --git a/LoopStructural/modelling/features/builders/__init__.py b/LoopStructural/modelling/features/builders/__init__.py index 3b1eb4da5..d524ccdd8 100644 --- a/LoopStructural/modelling/features/builders/__init__.py +++ b/LoopStructural/modelling/features/builders/__init__.py @@ -1,5 +1,5 @@ from ._base_builder import BaseBuilder -from ._geological_feature_builder import GeologicalFeatureBuilder +from ._fault_builder import FaultBuilder from ._folded_feature_builder import FoldedFeatureBuilder +from ._geological_feature_builder import GeologicalFeatureBuilder from ._structural_frame_builder import StructuralFrameBuilder -from ._fault_builder import FaultBuilder diff --git a/LoopStructural/modelling/features/builders/_fault_builder.py b/LoopStructural/modelling/features/builders/_fault_builder.py index a22fc6897..308fecfcf 100644 --- a/LoopStructural/modelling/features/builders/_fault_builder.py +++ b/LoopStructural/modelling/features/builders/_fault_builder.py @@ -1,13 +1,15 @@ from typing import Union -from LoopStructural.utils.maths import rotation -from ._structural_frame_builder import StructuralFrameBuilder -from .. import AnalyticalGeologicalFeature -from LoopStructural.utils import get_vectors import numpy as np import pandas as pd -from ....utils import getLogger + +from LoopStructural.utils import get_vectors +from LoopStructural.utils.maths import rotation + +from .. import AnalyticalGeologicalFeature from ....datatypes import BoundingBox +from ....utils import getLogger +from ._structural_frame_builder import StructuralFrameBuilder logger = getLogger(__name__) @@ -36,9 +38,9 @@ def __init__( the maximum area around the model domain that a fault is modelled. For high displacement faults this may need to be large, smaller values will be result in fewer degrees of freedom = quicker interpolation """ - from LoopStructural.modelling.features.fault import ( + from LoopStructural.modelling.features.fault import ( # defer import until needed FaultSegment, - ) # defer import until needed + ) StructuralFrameBuilder.__init__( self, @@ -215,9 +217,9 @@ def create_data_from_geometry( fault_slip_vector = dip_vector[:, 0] if fault_pitch is not None: print('using pitch') - rotm = rotation(fault_normal_vector[None,:],[fault_pitch]) - print(rotm.shape,fault_slip_vector.shape) - fault_slip_vector = np.einsum("ijk,k->ij", rotm, fault_slip_vector)[0,:] + rotm = rotation(fault_normal_vector[None, :], [fault_pitch]) + print(rotm.shape, fault_slip_vector.shape) + fault_slip_vector = np.einsum("ijk,k->ij", rotm, fault_slip_vector)[0, :] logger.info(f"Estimated fault slip vector: {fault_slip_vector}") else: fault_slip_vector = fault_slip_data.mean(axis=0).to_numpy() diff --git a/LoopStructural/modelling/features/builders/_folded_feature_builder.py b/LoopStructural/modelling/features/builders/_folded_feature_builder.py index f33367b16..6d7318507 100644 --- a/LoopStructural/modelling/features/builders/_folded_feature_builder.py +++ b/LoopStructural/modelling/features/builders/_folded_feature_builder.py @@ -1,9 +1,9 @@ -from ....modelling.features.builders import GeologicalFeatureBuilder -from ....modelling.features.fold.fold_function import FoldRotationType, get_fold_rotation_profile import numpy as np -from ....utils import getLogger, InterpolatorError from ....datatypes import BoundingBox +from ....modelling.features.builders import GeologicalFeatureBuilder +from ....modelling.features.fold.fold_function import FoldRotationType, get_fold_rotation_profile +from ....utils import InterpolatorError, getLogger logger = getLogger(__name__) @@ -89,7 +89,9 @@ def set_fold_axis(self): fold_axis_rotation = get_fold_rotation_profile(self.axis_profile_type, far, fad) if "axis_function" in kwargs: # allow predefined function to be used - logger.error("axis_function is deprecated, use a specific fold rotation angle profile type") + logger.error( + "axis_function is deprecated, use a specific fold rotation angle profile type" + ) else: fold_axis_rotation.fit(params={'wavelength': kwargs.get("axis_wl", None)}) self.fold.fold_axis_rotation = fold_axis_rotation @@ -107,7 +109,9 @@ def set_fold_limb_rotation(self): fold_limb_rotation = get_fold_rotation_profile(self.limb_profile_type, flr, fld) if "limb_function" in kwargs: # allow for predefined functions to be used - logger.error("limb_function is deprecated, use a specific fold rotation angle profile type") + logger.error( + "limb_function is deprecated, use a specific fold rotation angle profile type" + ) else: fold_limb_rotation.fit(params={'wavelength': kwargs.get("limb_wl", None)}) diff --git a/LoopStructural/modelling/features/builders/_geological_feature_builder.py b/LoopStructural/modelling/features/builders/_geological_feature_builder.py index 016ffb758..0a859a41d 100644 --- a/LoopStructural/modelling/features/builders/_geological_feature_builder.py +++ b/LoopStructural/modelling/features/builders/_geological_feature_builder.py @@ -5,28 +5,22 @@ import numpy as np import pandas as pd +from ....interpolators import DiscreteInterpolator, GeologicalInterpolator, InterpolatorFactory +from ....modelling.features import GeologicalFeature +from ....modelling.features.builders import BaseBuilder from ....utils import getLogger - - -from ....interpolators import GeologicalInterpolator from ....utils.helper import ( - xyz_names, - val_name, - normal_vec_names, - weight_name, + get_data_bounding_box_map as get_data_bounding_box, gradient_vec_names, - tangent_vec_names, - interface_name, inequality_name, + interface_name, + normal_vec_names, pairs_name, + tangent_vec_names, + val_name, + weight_name, + xyz_names, ) -from ....modelling.features import GeologicalFeature -from ....modelling.features.builders import BaseBuilder -from ....utils.helper import ( - get_data_bounding_box_map as get_data_bounding_box, -) -from ....interpolators import DiscreteInterpolator -from ....interpolators import InterpolatorFactory logger = getLogger(__name__) @@ -59,7 +53,7 @@ def __init__( nelements=nelements, buffer=kwargs.get("buffer", 0.2), ) - + if not issubclass(type(interpolator), GeologicalInterpolator): raise TypeError( "interpolator is {} and must be a GeologicalInterpolator".format(type(interpolator)) @@ -86,7 +80,15 @@ def __init__( self._orthogonal_features = {} self._equality_constraints = {} # add default parameters - self.update_build_arguments({'cpw':1.0,'npw':1.0,'regularisation':1.0,'nelements':self.interpolator.n_elements}) + self.update_build_arguments( + { + 'cpw': 1.0, + 'npw': 1.0, + 'regularisation': 1.0, + 'nelements': self.interpolator.n_elements, + } + ) + def set_not_up_to_date(self, caller): logger.info( f"Setting {self.name} to not up to date from an instance of {caller.__class__.__name__}" @@ -475,7 +477,8 @@ def check_interpolation_geometry(self, data, buffer=0.3): ] self.interpolator.support.origin = origin self.interpolator.support.maximum = maximum - self.update_build_arguments({'nelements':self.interpolator.n_elements}) + self.update_build_arguments({'nelements': self.interpolator.n_elements}) + def build(self, data_region=None, **kwargs): """ Runs the interpolation and builds the geological feature @@ -504,7 +507,9 @@ def build(self, data_region=None, **kwargs): logger.info(f'Kwargs has {kwargs["nelements"]} elements') if self.interpolator.n_elements != kwargs['nelements']: logger.info('Setting nelements to {} for {}'.format(kwargs['nelements'], self.name)) - self.build_arguments['nelements'] = self.interpolator.set_nelements(kwargs['nelements']) + self.build_arguments['nelements'] = self.interpolator.set_nelements( + kwargs['nelements'] + ) logger.info(f'Interpolator nelements {self.interpolator.n_elements}') self._up_to_date = False if domain: diff --git a/LoopStructural/modelling/features/builders/_structural_frame_builder.py b/LoopStructural/modelling/features/builders/_structural_frame_builder.py index b73907a65..de29c20c8 100644 --- a/LoopStructural/modelling/features/builders/_structural_frame_builder.py +++ b/LoopStructural/modelling/features/builders/_structural_frame_builder.py @@ -4,19 +4,18 @@ from typing import Union -from LoopStructural.utils.exceptions import LoopException - import numpy as np -from ....utils import getLogger +from LoopStructural.utils.exceptions import LoopException + from ....datatypes import BoundingBox +from ....utils import getLogger logger = getLogger(__name__) -from ....modelling.features.builders import GeologicalFeatureBuilder -from ....modelling.features.builders import FoldedFeatureBuilder from ....modelling.features import StructuralFrame +from ....modelling.features.builders import FoldedFeatureBuilder, GeologicalFeatureBuilder class StructuralFrameBuilder: @@ -120,12 +119,15 @@ def __init__( model=self.model, ) self._frame.builder = self + @property def build_arguments(self): return self.builders[0].build_arguments + def update_build_arguments(self, kwargs): for i in range(3): self.builders[i].update_build_arguments(kwargs) + @property def frame(self): return self._frame diff --git a/LoopStructural/modelling/features/fault/__init__.py b/LoopStructural/modelling/features/fault/__init__.py index a08d7f757..9209e06b3 100644 --- a/LoopStructural/modelling/features/fault/__init__.py +++ b/LoopStructural/modelling/features/fault/__init__.py @@ -1,3 +1,3 @@ -from ._fault_function import Composite, CubicFunction, Ones, Zeros, FaultDisplacement +from ._fault_function import Composite, CubicFunction, FaultDisplacement, Ones, Zeros from ._fault_function_feature import FaultDisplacementFeature from ._fault_segment import FaultSegment diff --git a/LoopStructural/modelling/features/fault/_fault_function.py b/LoopStructural/modelling/features/fault/_fault_function.py index b5d58043b..c85560a6a 100644 --- a/LoopStructural/modelling/features/fault/_fault_function.py +++ b/LoopStructural/modelling/features/fault/_fault_function.py @@ -1,7 +1,8 @@ from __future__ import annotations -from abc import abstractmethod, ABCMeta -from typing import Optional, List +from abc import ABCMeta, abstractmethod +from typing import List, Optional + import numpy as np from ....utils import getLogger diff --git a/LoopStructural/modelling/features/fault/_fault_function_feature.py b/LoopStructural/modelling/features/fault/_fault_function_feature.py index e70dab1f7..9eb78abc9 100644 --- a/LoopStructural/modelling/features/fault/_fault_function_feature.py +++ b/LoopStructural/modelling/features/fault/_fault_function_feature.py @@ -1,5 +1,6 @@ -from ....modelling.features import BaseFeature, StructuralFrame from typing import Optional + +from ....modelling.features import BaseFeature, StructuralFrame from ....utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/fault/_fault_segment.py b/LoopStructural/modelling/features/fault/_fault_segment.py index 737b8f8a3..c4bc9690c 100644 --- a/LoopStructural/modelling/features/fault/_fault_segment.py +++ b/LoopStructural/modelling/features/fault/_fault_segment.py @@ -1,14 +1,15 @@ -from LoopStructural.utils.maths import regular_tetraherdron_for_points, gradient_from_tetrahedron +from concurrent.futures import ThreadPoolExecutor + +import numpy as np + +from LoopStructural.utils.maths import gradient_from_tetrahedron, regular_tetraherdron_for_points + +from ....modelling.features import FeatureType, StructuralFrame +from ....modelling.features.fault._fault_function import BaseFault, BaseFault3D, FaultDisplacement from ....modelling.features.fault._fault_function_feature import ( FaultDisplacementFeature, ) -from ....modelling.features import FeatureType -from ....modelling.features.fault._fault_function import BaseFault, BaseFault3D, FaultDisplacement -from ....utils import getLogger, NegativeRegion, PositiveRegion -from ....modelling.features import StructuralFrame - -from concurrent.futures import ThreadPoolExecutor -import numpy as np +from ....utils import NegativeRegion, PositiveRegion, getLogger logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/fold/__init__.py b/LoopStructural/modelling/features/fold/__init__.py index d441843fd..d86bb8b70 100644 --- a/LoopStructural/modelling/features/fold/__init__.py +++ b/LoopStructural/modelling/features/fold/__init__.py @@ -1,6 +1,6 @@ """ """ from ._fold import FoldEvent -from ._svariogram import SVariogram from ._fold_rotation_angle_feature import FoldRotationAngleFeature from ._foldframe import FoldFrame +from ._svariogram import SVariogram diff --git a/LoopStructural/modelling/features/fold/_foldframe.py b/LoopStructural/modelling/features/fold/_foldframe.py index 02ef4810f..ee2837466 100644 --- a/LoopStructural/modelling/features/fold/_foldframe.py +++ b/LoopStructural/modelling/features/fold/_foldframe.py @@ -1,7 +1,6 @@ import numpy as np from ....modelling.features._structural_frame import StructuralFrame - from ....utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/fold/_svariogram.py b/LoopStructural/modelling/features/fold/_svariogram.py index 99bea941c..a069d0e9c 100644 --- a/LoopStructural/modelling/features/fold/_svariogram.py +++ b/LoopStructural/modelling/features/fold/_svariogram.py @@ -1,5 +1,7 @@ +from typing import List, Optional, Tuple + import numpy as np -from typing import List, Tuple, Optional + from ....utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/fold/fold_function/__init__.py b/LoopStructural/modelling/features/fold/fold_function/__init__.py index 09fa020f7..90a52c85c 100644 --- a/LoopStructural/modelling/features/fold/fold_function/__init__.py +++ b/LoopStructural/modelling/features/fold/fold_function/__init__.py @@ -1,9 +1,11 @@ -from ._trigo_fold_rotation_angle import TrigoFoldRotationAngleProfile -from ._fourier_series_fold_rotation_angle import FourierSeriesFoldRotationAngleProfile from enum import Enum from typing import Optional -import numpy.typing as npt + import numpy as np +import numpy.typing as npt + +from ._fourier_series_fold_rotation_angle import FourierSeriesFoldRotationAngleProfile +from ._trigo_fold_rotation_angle import TrigoFoldRotationAngleProfile class FoldRotationType(Enum): diff --git a/LoopStructural/modelling/features/fold/fold_function/_base_fold_rotation_angle.py b/LoopStructural/modelling/features/fold/fold_function/_base_fold_rotation_angle.py index 54a537cb9..f3dbe27ad 100644 --- a/LoopStructural/modelling/features/fold/fold_function/_base_fold_rotation_angle.py +++ b/LoopStructural/modelling/features/fold/fold_function/_base_fold_rotation_angle.py @@ -1,12 +1,13 @@ from abc import ABCMeta, abstractmethod from ast import List -from typing import Union, Optional +from typing import Optional, Union + import numpy as np import numpy.typing as npt -from .._svariogram import SVariogram from scipy.optimize import curve_fit from .....utils import getLogger +from .._svariogram import SVariogram logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/fold/fold_function/_fourier_series_fold_rotation_angle.py b/LoopStructural/modelling/features/fold/fold_function/_fourier_series_fold_rotation_angle.py index 6ad3fdf1e..5337c34f8 100644 --- a/LoopStructural/modelling/features/fold/fold_function/_fourier_series_fold_rotation_angle.py +++ b/LoopStructural/modelling/features/fold/fold_function/_fourier_series_fold_rotation_angle.py @@ -1,8 +1,10 @@ -from ._base_fold_rotation_angle import BaseFoldRotationAngleProfile +from typing import List, Optional, Union + import numpy as np import numpy.typing as npt -from typing import Optional, List, Union + from .....utils import getLogger +from ._base_fold_rotation_angle import BaseFoldRotationAngleProfile logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/fold/fold_function/_lambda_fold_rotation_angle.py b/LoopStructural/modelling/features/fold/fold_function/_lambda_fold_rotation_angle.py index 79c01cba9..1e3f82e0e 100644 --- a/LoopStructural/modelling/features/fold/fold_function/_lambda_fold_rotation_angle.py +++ b/LoopStructural/modelling/features/fold/fold_function/_lambda_fold_rotation_angle.py @@ -1,8 +1,10 @@ -from ._base_fold_rotation_angle import BaseFoldRotationAngleProfile +from typing import Callable, Optional + import numpy as np import numpy.typing as npt -from typing import Optional, Callable + from .....utils import getLogger +from ._base_fold_rotation_angle import BaseFoldRotationAngleProfile logger = getLogger(__name__) diff --git a/LoopStructural/modelling/features/fold/fold_function/_trigo_fold_rotation_angle.py b/LoopStructural/modelling/features/fold/fold_function/_trigo_fold_rotation_angle.py index 1908179ec..b8d9b8c63 100644 --- a/LoopStructural/modelling/features/fold/fold_function/_trigo_fold_rotation_angle.py +++ b/LoopStructural/modelling/features/fold/fold_function/_trigo_fold_rotation_angle.py @@ -1,8 +1,10 @@ -from ._base_fold_rotation_angle import BaseFoldRotationAngleProfile +from typing import List, Optional, Union + import numpy as np import numpy.typing as npt -from typing import Optional, Union, List + from .....utils import getLogger +from ._base_fold_rotation_angle import BaseFoldRotationAngleProfile logger = getLogger(__name__) diff --git a/LoopStructural/modelling/input/map2loop_processor.py b/LoopStructural/modelling/input/map2loop_processor.py index f49c2e6c1..54d7c90f9 100644 --- a/LoopStructural/modelling/input/map2loop_processor.py +++ b/LoopStructural/modelling/input/map2loop_processor.py @@ -1,9 +1,9 @@ -from .process_data import ProcessInputData +import networkx import numpy as np import pandas as pd -import networkx from ...utils import getLogger +from .process_data import ProcessInputData logger = getLogger(__name__) diff --git a/LoopStructural/modelling/input/process_data.py b/LoopStructural/modelling/input/process_data.py index bc985b23e..17434594f 100644 --- a/LoopStructural/modelling/input/process_data.py +++ b/LoopStructural/modelling/input/process_data.py @@ -1,7 +1,8 @@ -import pandas as pd import numpy as np -from .fault_network import FaultNetwork +import pandas as pd + from ...utils import getLogger, rng, strikedip2vector +from .fault_network import FaultNetwork logger = getLogger(__name__) diff --git a/LoopStructural/modelling/input/project_file.py b/LoopStructural/modelling/input/project_file.py index fa116a3eb..30cfd3871 100644 --- a/LoopStructural/modelling/input/project_file.py +++ b/LoopStructural/modelling/input/project_file.py @@ -5,9 +5,10 @@ except ImportError: raise LoopImportError("LoopProjectFile cannot be imported") -from .process_data import ProcessInputData from matplotlib.colors import to_hex + from ...utils import getLogger +from .process_data import ProcessInputData logger = getLogger(__name__) diff --git a/LoopStructural/modelling/intrusions/__init__.py b/LoopStructural/modelling/intrusions/__init__.py index e2c2817cb..da4aabde8 100644 --- a/LoopStructural/modelling/intrusions/__init__.py +++ b/LoopStructural/modelling/intrusions/__init__.py @@ -1,16 +1,16 @@ -from .intrusion_feature import IntrusionFeature -from .intrusion_frame_builder import IntrusionFrameBuilder -from .intrusion_builder import IntrusionBuilder from .geom_conceptual_models import ( - ellipse_function, constant_function, + ellipse_function, obliquecone_function, ) from .geometric_scaling_functions import ( + contact_pts_using_geometric_scaling, geometric_scaling_parameters, thickness_from_geometric_scaling, - contact_pts_using_geometric_scaling, ) +from .intrusion_builder import IntrusionBuilder +from .intrusion_feature import IntrusionFeature +from .intrusion_frame_builder import IntrusionFrameBuilder __all__ = [ "IntrusionFeature", diff --git a/LoopStructural/modelling/intrusions/geom_conceptual_models.py b/LoopStructural/modelling/intrusions/geom_conceptual_models.py index b4a0d3e52..94d366445 100644 --- a/LoopStructural/modelling/intrusions/geom_conceptual_models.py +++ b/LoopStructural/modelling/intrusions/geom_conceptual_models.py @@ -1,6 +1,7 @@ # Geometrical conceptual models for lateral and vertical extent of intrusions import numpy as np import pandas as pd + from ...utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/modelling/intrusions/geometric_scaling_functions.py b/LoopStructural/modelling/intrusions/geometric_scaling_functions.py index 643fde0c6..c902bf928 100644 --- a/LoopStructural/modelling/intrusions/geometric_scaling_functions.py +++ b/LoopStructural/modelling/intrusions/geometric_scaling_functions.py @@ -1,8 +1,7 @@ # import scipy as sc -import scipy.stats as sct - import numpy as np import pandas as pd +import scipy.stats as sct from ...utils import getLogger, rng diff --git a/LoopStructural/modelling/intrusions/intrusion_builder.py b/LoopStructural/modelling/intrusions/intrusion_builder.py index 745048a51..8361d1ad5 100644 --- a/LoopStructural/modelling/intrusions/intrusion_builder.py +++ b/LoopStructural/modelling/intrusions/intrusion_builder.py @@ -1,13 +1,10 @@ import numpy as np import pandas as pd -from ...utils import getLogger -from .intrusion_feature import IntrusionFeature - - +from ...utils import getLogger, rng from ..features.builders import BaseBuilder -from ...utils import rng from .geometric_scaling_functions import * +from .intrusion_feature import IntrusionFeature logger = getLogger(__name__) diff --git a/LoopStructural/modelling/intrusions/intrusion_feature.py b/LoopStructural/modelling/intrusions/intrusion_feature.py index 60a2a13c9..4ec1e5dc1 100644 --- a/LoopStructural/modelling/intrusions/intrusion_feature.py +++ b/LoopStructural/modelling/intrusions/intrusion_feature.py @@ -1,12 +1,13 @@ from typing import Optional + import numpy as np import pandas as pd -from LoopStructural.modelling.features import BaseFeature -from LoopStructural.modelling.features import FeatureType +from scipy.interpolate import Rbf + +from LoopStructural.modelling.features import BaseFeature, FeatureType # import logging from ...utils import getLogger -from scipy.interpolate import Rbf logger = getLogger(__name__) diff --git a/LoopStructural/modelling/intrusions/intrusion_frame_builder.py b/LoopStructural/modelling/intrusions/intrusion_frame_builder.py index 9d8ae8ff5..9925143f2 100644 --- a/LoopStructural/modelling/intrusions/intrusion_frame_builder.py +++ b/LoopStructural/modelling/intrusions/intrusion_frame_builder.py @@ -1,10 +1,9 @@ +from typing import Union + +from ...datatypes import BoundingBox from ...modelling.features.builders import StructuralFrameBuilder from ...modelling.features.fault import FaultSegment from ...utils import getLogger, rng -from ...datatypes import BoundingBox - -from typing import Union - logger = getLogger(__name__) diff --git a/LoopStructural/modelling/intrusions/intrusion_support_functions.py b/LoopStructural/modelling/intrusions/intrusion_support_functions.py index cc9f0e250..266d5a4b3 100644 --- a/LoopStructural/modelling/intrusions/intrusion_support_functions.py +++ b/LoopStructural/modelling/intrusions/intrusion_support_functions.py @@ -1,5 +1,6 @@ ## Support Functions for intrusion network simulated as the shortest path, and for simulations in general import numpy as np + from ...utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/utils/__init__.py b/LoopStructural/utils/__init__.py index 35987f02d..725f1c039 100644 --- a/LoopStructural/utils/__init__.py +++ b/LoopStructural/utils/__init__.py @@ -3,35 +3,36 @@ ===== """ -from .logging import getLogger, log_to_file, log_to_console, get_levels +import numpy as np + +from ._transformation import EuclideanTransformation from .exceptions import ( + InterpolatorError, LoopException, LoopImportError, - InterpolatorError, LoopTypeError, LoopValueError, ) -from ._transformation import EuclideanTransformation from .helper import ( + create_box, + create_surface, get_data_bounding_box, get_data_bounding_box_map, ) +from .json_encoder import LoopJSONEncoder +from .logging import get_levels, getLogger, log_to_console, log_to_file # from ..datatypes._bounding_box import BoundingBox from .maths import ( + azimuthplunge2vector, get_dip_vector, get_strike_vector, get_vectors, - strikedip2vector, - azimuthplunge2vector, normal_vector_to_strike_and_dip, rotate, + strikedip2vector, ) -from .helper import create_surface, create_box -from .regions import RegionEverywhere, RegionFunction, NegativeRegion, PositiveRegion - -from .json_encoder import LoopJSONEncoder -import numpy as np +from .regions import NegativeRegion, PositiveRegion, RegionEverywhere, RegionFunction rng = np.random.default_rng() diff --git a/LoopStructural/utils/_surface.py b/LoopStructural/utils/_surface.py index a6c431117..e1d751561 100644 --- a/LoopStructural/utils/_surface.py +++ b/LoopStructural/utils/_surface.py @@ -1,9 +1,11 @@ from __future__ import annotations -from typing import Optional, Union, Callable, List from collections.abc import Iterable +from typing import Callable, List, Optional, Union + import numpy as np import numpy.typing as npt + from LoopStructural.utils.logging import getLogger logger = getLogger(__name__) @@ -14,7 +16,7 @@ from skimage.measure import marching_cubes_lewiner as marching_cubes # from LoopStructural.interpolators._geological_interpolator import GeologicalInterpolator -from LoopStructural.datatypes import Surface, BoundingBox +from LoopStructural.datatypes import BoundingBox, Surface surface_list = List[Surface] diff --git a/LoopStructural/utils/_transformation.py b/LoopStructural/utils/_transformation.py index af7116fec..7d5d0f020 100644 --- a/LoopStructural/utils/_transformation.py +++ b/LoopStructural/utils/_transformation.py @@ -1,4 +1,5 @@ import numpy as np + from . import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/utils/logging.py b/LoopStructural/utils/logging.py index 602d2ce83..ba9ee26e9 100644 --- a/LoopStructural/utils/logging.py +++ b/LoopStructural/utils/logging.py @@ -1,7 +1,8 @@ import logging -import LoopStructural import os +import LoopStructural + def get_levels(): """dict for converting to logger levels from string diff --git a/LoopStructural/utils/maths.py b/LoopStructural/utils/maths.py index caf8247d3..de9616928 100644 --- a/LoopStructural/utils/maths.py +++ b/LoopStructural/utils/maths.py @@ -1,8 +1,10 @@ -from LoopStructural.utils.typing import NumericInput -import numpy as np import numbers from typing import Tuple +import numpy as np + +from LoopStructural.utils.typing import NumericInput + def strikedip2vector(strike: NumericInput, dip: NumericInput) -> np.ndarray: """Convert strike and dip to a vector diff --git a/LoopStructural/utils/typing.py b/LoopStructural/utils/typing.py index de7489421..bdc926e07 100644 --- a/LoopStructural/utils/typing.py +++ b/LoopStructural/utils/typing.py @@ -1,5 +1,5 @@ -from typing import TypeVar, Union, List import numbers +from typing import List, TypeVar, Union T = TypeVar("T") Array = Union[List[T]] diff --git a/LoopStructural/utils/utils.py b/LoopStructural/utils/utils.py index 40004e0f2..0c48d1b3a 100644 --- a/LoopStructural/utils/utils.py +++ b/LoopStructural/utils/utils.py @@ -1,5 +1,7 @@ -import numpy as np import re + +import numpy as np + from ..utils import getLogger logger = getLogger(__name__) diff --git a/LoopStructural/visualisation/__init__.py b/LoopStructural/visualisation/__init__.py index 065299fdd..5b02afef9 100644 --- a/LoopStructural/visualisation/__init__.py +++ b/LoopStructural/visualisation/__init__.py @@ -1,8 +1,8 @@ try: from loopstructuralvisualisation import ( + Loop2DView, Loop3DView, RotationAnglePlotter, - Loop2DView, StratigraphicColumnView, ) except ImportError as e: diff --git a/docs/build_docs.sh b/docs/build_docs.sh index fa4efd5dc..c9bf04158 100755 --- a/docs/build_docs.sh +++ b/docs/build_docs.sh @@ -9,4 +9,4 @@ # exec "$@" pip install ./LoopStructural pip install loopstructuralvisualisation[all] -make -C LoopStructural/docs html \ No newline at end of file +make -C LoopStructural/docs html diff --git a/docs/docker-compose.yml b/docs/docker-compose.yml index 225d5454b..b71ee378f 100644 --- a/docs/docker-compose.yml +++ b/docs/docker-compose.yml @@ -7,4 +7,4 @@ services: volumes: - ../:/LoopStructural command: ./LoopStructural/docs/build_docs.sh - tty: true \ No newline at end of file + tty: true diff --git a/docs/requirements.txt b/docs/requirements.txt index 2e5ec648f..8ee12ff5b 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,4 +2,4 @@ sphinx==3.5.4 sphinx_gallery sphinxcontrib-bibtex pydata_sphinx_theme -myst-parser \ No newline at end of file +myst-parser diff --git a/docs/source/_static/docker.rst b/docs/source/_static/docker.rst index d20debb7f..8065a4e25 100644 --- a/docs/source/_static/docker.rst +++ b/docs/source/_static/docker.rst @@ -37,4 +37,4 @@ Docker to link your local directory (this can be anywhere) with the docker container. To do this add :code:`-v LOCALDIRPATH:/home/jovyan/shared_volume` to the docker command so it becomes :code:`docker run -i -t -p 8888:8888 -v LOCALDIRPATH:/home/jovyan/shared_volume loop`. - :code:`LOCALDIRPATH` is the relative or full path to the directory you want to share. \ No newline at end of file + :code:`LOCALDIRPATH` is the relative or full path to the directory you want to share. diff --git a/docs/source/_static/infinity_loop_icon.svg b/docs/source/_static/infinity_loop_icon.svg index a69ecd1b2..7d423b32a 100644 --- a/docs/source/_static/infinity_loop_icon.svg +++ b/docs/source/_static/infinity_loop_icon.svg @@ -1,4 +1,4 @@ \ No newline at end of file + style="enable-background:new 0 0 122.88 62.63" xml:space="preserve"> diff --git a/docs/source/_static/overview.rst b/docs/source/_static/overview.rst index b7af02bd5..d18413b2d 100644 --- a/docs/source/_static/overview.rst +++ b/docs/source/_static/overview.rst @@ -45,5 +45,3 @@ PiecewiseLinearInterpolator FiniteDifferenceInterpolator ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - diff --git a/docs/source/_static/ubuntu_install.rst b/docs/source/_static/ubuntu_install.rst index 6b79ee0f4..3483edcb3 100644 --- a/docs/source/_static/ubuntu_install.rst +++ b/docs/source/_static/ubuntu_install.rst @@ -62,5 +62,3 @@ Linux If you want to use a jupyter notebook then you can launch a server by running :code:`make notebook`, alternatively you can run :code:`make notebookbuild` if you want to build the library before launching the server. - - diff --git a/docs/source/_static/windows_install.rst b/docs/source/_static/windows_install.rst index b9329aa9b..4d5434d60 100644 --- a/docs/source/_static/windows_install.rst +++ b/docs/source/_static/windows_install.rst @@ -18,4 +18,3 @@ Windows using conda This is best done using anaconda - diff --git a/docs/source/_static/wls_install.rst b/docs/source/_static/wls_install.rst index 63554ed72..df14ed286 100644 --- a/docs/source/_static/wls_install.rst +++ b/docs/source/_static/wls_install.rst @@ -240,5 +240,3 @@ Windows using linux subsystem jupyter-notebook --no-browser You can then navigate to localhost:8888 or the port specified. - - diff --git a/docs/source/_templates/custom-class-template.rst b/docs/source/_templates/custom-class-template.rst index 46cae576b..7bdbf1002 100644 --- a/docs/source/_templates/custom-class-template.rst +++ b/docs/source/_templates/custom-class-template.rst @@ -29,4 +29,4 @@ ~{{ name }}.{{ item }} {%- endfor %} {% endif %} - {% endblock %} \ No newline at end of file + {% endblock %} diff --git a/docs/source/_templates/custom.css b/docs/source/_templates/custom.css index 90e4da242..2c6806323 100644 --- a/docs/source/_templates/custom.css +++ b/docs/source/_templates/custom.css @@ -9,4 +9,4 @@ .toggle .header.open:after { content: " ▼"; -} \ No newline at end of file +} diff --git a/docs/source/_templates/page.html b/docs/source/_templates/page.html index 429a7dedd..b8163bdde 100644 --- a/docs/source/_templates/page.html +++ b/docs/source/_templates/page.html @@ -11,4 +11,4 @@ }) }); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/docs/source/conf.py b/docs/source/conf.py index 33d246572..287eb8782 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -125,10 +125,11 @@ autosummary_mock_imports = [ "LoopStructural.interpolators._cython", ] +import pyvista + # Sphinx gallery examples # from LoopStructural.visualisation.sphinx_scraper import Scraper as LoopScraper from sphinx_gallery.sorting import ExampleTitleSortKey -import pyvista pyvista.BUILDING_GALLERY = True diff --git a/docs/source/docs_references.bib b/docs/source/docs_references.bib index b018c892e..26191c8ee 100644 --- a/docs/source/docs_references.bib +++ b/docs/source/docs_references.bib @@ -79,4 +79,3 @@ @article{Irakarama2020 url = {https://doi.org/10.1007/s11004-020-09887-w}, year = {2020} } - diff --git a/docs/source/getting_started/about.rst b/docs/source/getting_started/about.rst index a53811168..bdf9058f0 100644 --- a/docs/source/getting_started/about.rst +++ b/docs/source/getting_started/about.rst @@ -26,4 +26,3 @@ Grose, L., Laurent, G., Aillères, L., Armit, R., Jessell, M. and Caumon, G.: St Hillier, M. J., Schetselaar, E. M., de Kemp, E. A. and Perron, G.: Three-Dimensional Modelling of Geological Surfaces Using Generalized Interpolation with Radial Basis Functions, Math. Geosci., 46(8), 931–953, doi:10.1007/s11004-014-9540-3, 2014. Laurent, G., Ailleres, L., Grose, L., Caumon, G., Jessell, M. and Armit, R.: Implicit modeling of folds and overprinting deformation, Earth Planet. Sci. Lett., 456, 26–38, doi:10.1016/j.epsl.2016.09.040, 2016. Mallet, J.-L.: Elements of Mathematical Sedimentary Geology: the GeoChron Model, , 1–4, doi:10.3997/9789073834811, 2014. - diff --git a/docs/source/getting_started/background.rst b/docs/source/getting_started/background.rst index 1fef48d67..821570423 100644 --- a/docs/source/getting_started/background.rst +++ b/docs/source/getting_started/background.rst @@ -20,6 +20,3 @@ To build a geological model the user needs to convert their observations into th Automatic intepretation into a model using map2loop ---------------------------------------------------- - - - diff --git a/docs/source/getting_started/contributors_guide.rst b/docs/source/getting_started/contributors_guide.rst index 4d723ac46..4e26caa82 100644 --- a/docs/source/getting_started/contributors_guide.rst +++ b/docs/source/getting_started/contributors_guide.rst @@ -144,5 +144,3 @@ following style: License ~~~~~~~ LoopStructural is licensed unded an MIT license and all contributions MUST conform to this license. - - diff --git a/docs/source/getting_started/installation.rst b/docs/source/getting_started/installation.rst index 9f1934ddb..fa1d239a8 100644 --- a/docs/source/getting_started/installation.rst +++ b/docs/source/getting_started/installation.rst @@ -57,5 +57,3 @@ Optional dependencies: * dill, serialisation of python objects * loopsolver, solving of inequalities * tqdm, progress bar - - diff --git a/docs/source/getting_started/loopstructural_design.rst b/docs/source/getting_started/loopstructural_design.rst index 664e58275..0321a50d7 100644 --- a/docs/source/getting_started/loopstructural_design.rst +++ b/docs/source/getting_started/loopstructural_design.rst @@ -189,4 +189,4 @@ Ideally the unit test will only be testing a very small portion of code. An integration test may be a more substantial test, which will test whether multiple sections of code act as they are intended. An end to end test will be a complete geological modelling workflow and will require significant computational time. -End to end tests should be used sparingly as identifying the true cause of a failed test may be challenging. \ No newline at end of file +End to end tests should be used sparingly as identifying the true cause of a failed test may be challenging. diff --git a/docs/source/getting_started/todo.rst b/docs/source/getting_started/todo.rst index 2e93cf175..e10ed2a15 100644 --- a/docs/source/getting_started/todo.rst +++ b/docs/source/getting_started/todo.rst @@ -11,4 +11,4 @@ - -3. \ No newline at end of file +3. diff --git a/docs/source/index.rst b/docs/source/index.rst index 083f0d1a3..0964a1c85 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -140,5 +140,3 @@ constraints. :hidden: API - - diff --git a/docs/source/user_guide/debugging.rst b/docs/source/user_guide/debugging.rst index 6a1a821b4..f1a986f8a 100644 --- a/docs/source/user_guide/debugging.rst +++ b/docs/source/user_guide/debugging.rst @@ -92,7 +92,3 @@ No displacement view.add_vector_field(model['fault'][1],locations=model.regular_grid()[::200]) #random 200 locations view.add_isosurface(model['fault'][0],0) view.interactive() - - - - diff --git a/docs/source/user_guide/fault_modelling.rst b/docs/source/user_guide/fault_modelling.rst index 20f09fa26..26f9dce11 100644 --- a/docs/source/user_guide/fault_modelling.rst +++ b/docs/source/user_guide/fault_modelling.rst @@ -76,4 +76,3 @@ Before interpolating a geological feature the associated faults, stored in the : The geological feature can be built using the restored data. When the feature is evaluated, the locations being evaluated are first past through the list of faults using the :meth:`LoopStructural.modelling.features.BaseFeature._apply_faults`. The `apply_faults` method should be called whenever :meth:`LoopStructural.modelling.features.BaseFeature.evaluate_value` or :meth:`LoopStructural.modelling.features.BaseFeature.evaluate_gradient` are overriden. - diff --git a/docs/source/user_guide/fold_modelling.rst b/docs/source/user_guide/fold_modelling.rst index 6f3adce6e..4d37c0403 100644 --- a/docs/source/user_guide/fold_modelling.rst +++ b/docs/source/user_guide/fold_modelling.rst @@ -1,4 +1,4 @@ Fold modelling =============== -A specific interpolator can be used for modelling folds geological features. The LoopStructural implements \ No newline at end of file +A specific interpolator can be used for modelling folds geological features. The LoopStructural implements diff --git a/docs/source/user_guide/index.rst b/docs/source/user_guide/index.rst index cccc80a91..c415d079c 100644 --- a/docs/source/user_guide/index.rst +++ b/docs/source/user_guide/index.rst @@ -16,4 +16,4 @@ for a list of topics covered in this section. fold_modelling fault_modelling visualisation - debugging \ No newline at end of file + debugging diff --git a/docs/source/user_guide/input_data.rst b/docs/source/user_guide/input_data.rst index 94a178bc3..d61aa5cd0 100644 --- a/docs/source/user_guide/input_data.rst +++ b/docs/source/user_guide/input_data.rst @@ -59,4 +59,3 @@ Constrains a vector to be orthogonal to the scalar field by adding the following This constraint does not control the vaue of the scalar field and is quite weak. It is not recommended for use, however it could be used for integrating form lines, instead of using interface constraints. - diff --git a/docs/source/user_guide/interpolation_options.rst b/docs/source/user_guide/interpolation_options.rst index 2356afb87..596c08702 100644 --- a/docs/source/user_guide/interpolation_options.rst +++ b/docs/source/user_guide/interpolation_options.rst @@ -278,4 +278,3 @@ Additional parameters can be specified to the interpolator including: * - anisotropy - boolean, whether to use global anisotropy - diff --git a/docs/source/user_guide/visualisation.rst b/docs/source/user_guide/visualisation.rst index 5ae2d1635..caa074dd8 100644 --- a/docs/source/user_guide/visualisation.rst +++ b/docs/source/user_guide/visualisation.rst @@ -129,7 +129,3 @@ The LambdaGeologicalFeature is a class allowing for a function describing the va The function passed to the LambdaGeologicalFeature can be as simple or complicated as required. It will be evaluated for the locations within the model that the visualisation requires, usually between the origin and maximum of the geoloical model. By default the min and max values are 0, however these can be overwritten by setting the attribute min and max to the required values. - - - - diff --git a/docs/source/user_guide/what_is_a_geological_model.rst b/docs/source/user_guide/what_is_a_geological_model.rst index 7e07fae26..e3eb15b5d 100644 --- a/docs/source/user_guide/what_is_a_geological_model.rst +++ b/docs/source/user_guide/what_is_a_geological_model.rst @@ -190,8 +190,3 @@ We can see that the scalar field fits the value constraints and interpolates bet The scalar field value constraints can have a significant impact on the geometry of the implicit function, especially where the the geometry of the contacts outlies a structure (e.g. folded layers). Larger differences between the scalar field value effectively increase the magnitude of the implicit functions gradient norm. - - - - - diff --git a/examples/1_basic/README.rst b/examples/1_basic/README.rst index db3ea3ac0..0b570ce0a 100644 --- a/examples/1_basic/README.rst +++ b/examples/1_basic/README.rst @@ -1,2 +1,2 @@ 1. Basics ---------- \ No newline at end of file +--------- diff --git a/examples/1_basic/plot_1_data_prepration.py b/examples/1_basic/plot_1_data_prepration.py index c6b6d2127..bb80f4675 100644 --- a/examples/1_basic/plot_1_data_prepration.py +++ b/examples/1_basic/plot_1_data_prepration.py @@ -56,6 +56,7 @@ # add some noise to make it interesting! # import numpy as np + from LoopStructural.utils import rng extent = np.zeros((3, 2)) diff --git a/examples/1_basic/plot_2_surface_modelling.py b/examples/1_basic/plot_2_surface_modelling.py index 2e47a743a..0f90626b0 100644 --- a/examples/1_basic/plot_2_surface_modelling.py +++ b/examples/1_basic/plot_2_surface_modelling.py @@ -35,12 +35,11 @@ # Import the required objects from LoopStructural for visualisation and # model building -from LoopStructural import GeologicalModel -from LoopStructural.visualisation import Loop3DView -from LoopStructural.datasets import load_claudius # demo data - import numpy as np +from LoopStructural import GeologicalModel +from LoopStructural.datasets import load_claudius # demo data +from LoopStructural.visualisation import Loop3DView ###################################################################### # The data for this example can be imported from the example datasets diff --git a/examples/1_basic/plot_3_model_visualisation.py b/examples/1_basic/plot_3_model_visualisation.py index 4d2076fa2..8e932d9bf 100644 --- a/examples/1_basic/plot_3_model_visualisation.py +++ b/examples/1_basic/plot_3_model_visualisation.py @@ -18,10 +18,8 @@ # model building from LoopStructural import GeologicalModel -from LoopStructural.visualisation import Loop3DView - from LoopStructural.datasets import load_claudius # demo data - +from LoopStructural.visualisation import Loop3DView ##################### # Build the model diff --git a/examples/1_basic/plot_3_multiple_groups.py b/examples/1_basic/plot_3_multiple_groups.py index bd5afcca4..e11055882 100644 --- a/examples/1_basic/plot_3_multiple_groups.py +++ b/examples/1_basic/plot_3_multiple_groups.py @@ -9,7 +9,6 @@ from LoopStructural.datasets import load_claudius from LoopStructural.visualisation import Loop3DView - data, bb = load_claudius() data = data.reset_index() diff --git a/examples/1_basic/plot_4_using_stratigraphic_column.py b/examples/1_basic/plot_4_using_stratigraphic_column.py index 3c1086394..1f00caccb 100644 --- a/examples/1_basic/plot_4_using_stratigraphic_column.py +++ b/examples/1_basic/plot_4_using_stratigraphic_column.py @@ -5,12 +5,12 @@ """ +import numpy as np + from LoopStructural import GeologicalModel from LoopStructural.datasets import load_claudius from LoopStructural.visualisation import Loop3DView -import numpy as np - data, bb = load_claudius() data = data.reset_index() diff --git a/examples/1_basic/plot_5_unconformities.py b/examples/1_basic/plot_5_unconformities.py index 3efba37fa..c6abc1fe3 100644 --- a/examples/1_basic/plot_5_unconformities.py +++ b/examples/1_basic/plot_5_unconformities.py @@ -6,10 +6,11 @@ """ +import matplotlib.pyplot as plt import numpy as np import pandas as pd + from LoopStructural import GeologicalModel -import matplotlib.pyplot as plt data = pd.DataFrame( [ diff --git a/examples/1_basic/plot_6_fault_parameters.py b/examples/1_basic/plot_6_fault_parameters.py index a7b21e307..07a23e74f 100644 --- a/examples/1_basic/plot_6_fault_parameters.py +++ b/examples/1_basic/plot_6_fault_parameters.py @@ -6,10 +6,11 @@ """ +import matplotlib.pyplot as plt import numpy as np import pandas as pd + from LoopStructural import GeologicalModel -import matplotlib.pyplot as plt data = pd.DataFrame( [ diff --git a/examples/2_fold/README.rst b/examples/2_fold/README.rst index 15654475a..9e6266a77 100644 --- a/examples/2_fold/README.rst +++ b/examples/2_fold/README.rst @@ -1,2 +1,2 @@ 2. Modelling Folds -------------------- \ No newline at end of file +------------------- diff --git a/examples/2_fold/_refolded_folds.py b/examples/2_fold/_refolded_folds.py index 1b68dc06a..ad2165aa1 100644 --- a/examples/2_fold/_refolded_folds.py +++ b/examples/2_fold/_refolded_folds.py @@ -5,10 +5,11 @@ """ +import pandas as pd + from LoopStructural import GeologicalModel -from LoopStructural.visualisation import Loop3DView, RotationAnglePlotter from LoopStructural.datasets import load_laurent2016 -import pandas as pd +from LoopStructural.visualisation import Loop3DView, RotationAnglePlotter # logging.getLogger().setLevel(logging.INFO) diff --git a/examples/2_fold/plot_1_adding_folds_to_surfaces.py b/examples/2_fold/plot_1_adding_folds_to_surfaces.py index 2c12d6cfd..293c17b88 100644 --- a/examples/2_fold/plot_1_adding_folds_to_surfaces.py +++ b/examples/2_fold/plot_1_adding_folds_to_surfaces.py @@ -18,11 +18,11 @@ # ------- # +import pandas as pd + from LoopStructural import GeologicalModel from LoopStructural.datasets import load_noddy_single_fold from LoopStructural.visualisation import Loop3DView, RotationAnglePlotter -import pandas as pd - ###################################################################### # diff --git a/examples/3_fault/README.rst b/examples/3_fault/README.rst index 45d5f8c0e..d3a4ce9a1 100644 --- a/examples/3_fault/README.rst +++ b/examples/3_fault/README.rst @@ -1,2 +1,2 @@ 3. Modelling Faults --------------------- \ No newline at end of file +-------------------- diff --git a/examples/3_fault/_define_fault_displacement.py b/examples/3_fault/_define_fault_displacement.py index d86c29003..3bfa45397 100644 --- a/examples/3_fault/_define_fault_displacement.py +++ b/examples/3_fault/_define_fault_displacement.py @@ -6,6 +6,7 @@ import numpy as np import pandas as pd + import LoopStructural as LS # Define a dataset for a fault @@ -77,8 +78,8 @@ # We will modify this profile so that the hanging wall is displaced by a constant value from LoopStructural.modelling.features.fault._fault_function import ( - FaultDisplacement, CubicFunction, + FaultDisplacement, Ones, ) diff --git a/examples/3_fault/_faulted_intrusion.py b/examples/3_fault/_faulted_intrusion.py index d2ec07881..54580cdd2 100644 --- a/examples/3_fault/_faulted_intrusion.py +++ b/examples/3_fault/_faulted_intrusion.py @@ -4,11 +4,12 @@ """ +import matplotlib.pyplot as plt +import numpy as np + from LoopStructural import GeologicalModel -from LoopStructural.visualisation import Loop3DView from LoopStructural.datasets import load_intrusion -import numpy as np -import matplotlib.pyplot as plt +from LoopStructural.visualisation import Loop3DView data, bb = load_intrusion() diff --git a/examples/3_fault/fault_network.py b/examples/3_fault/fault_network.py index 29cf0c85b..30ced067f 100644 --- a/examples/3_fault/fault_network.py +++ b/examples/3_fault/fault_network.py @@ -8,14 +8,15 @@ LoopStructural.__version__ +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd + from LoopStructural import GeologicalModel -from LoopStructural.modelling import ProcessInputData -from LoopStructural.visualisation import Loop3DView from LoopStructural.datasets import load_fault_trace +from LoopStructural.modelling import ProcessInputData from LoopStructural.utils import rng -import pandas as pd -import matplotlib.pyplot as plt -import numpy as np +from LoopStructural.visualisation import Loop3DView ############################## # Read shapefile diff --git a/examples/4_advanced/_5_using_logging.py b/examples/4_advanced/_5_using_logging.py index 43a037f45..36fe28c5e 100644 --- a/examples/4_advanced/_5_using_logging.py +++ b/examples/4_advanced/_5_using_logging.py @@ -21,10 +21,9 @@ Lets have a look at the logging from the Claudius model. """ -from LoopStructural import GeologicalModel -from LoopStructural.visualisation import Loop3DView +from LoopStructural import GeologicalModel, log_to_file from LoopStructural.datasets import load_claudius # demo data -from LoopStructural import log_to_file +from LoopStructural.visualisation import Loop3DView ################################################################################################## # Specify a log file @@ -83,9 +82,8 @@ from LoopStructural import GeologicalModel -from LoopStructural.visualisation import Loop3DView from LoopStructural.datasets import load_claudius # demo data - +from LoopStructural.visualisation import Loop3DView data, bb = load_claudius() model = GeologicalModel(bb[0, :], bb[1, :]) diff --git a/examples/4_advanced/_model_from_geological_map.py b/examples/4_advanced/_model_from_geological_map.py index 1a9362ade..c1d650fb8 100644 --- a/examples/4_advanced/_model_from_geological_map.py +++ b/examples/4_advanced/_model_from_geological_map.py @@ -18,12 +18,12 @@ # ~~~~~~~ -from LoopStructural.modelling import ProcessInputData +import matplotlib.pyplot as plt + from LoopStructural import GeologicalModel -from LoopStructural.visualisation import Loop3DView from LoopStructural.datasets import load_geological_map_data - -import matplotlib.pyplot as plt +from LoopStructural.modelling import ProcessInputData +from LoopStructural.visualisation import Loop3DView ############################## # Read stratigraphy from csv diff --git a/examples/README.rst b/examples/README.rst index 7d4d0aaef..bac945d55 100644 --- a/examples/README.rst +++ b/examples/README.rst @@ -1,2 +1,2 @@ Examples -======== \ No newline at end of file +======== diff --git a/requirements.txt b/requirements.txt index 95ff0d144..cac419b42 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,3 @@ setuptools pandas pyevtk dill - - - diff --git a/setup.cfg b/setup.cfg index 33482f439..306d97e3c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1 +1 @@ -[metadata] \ No newline at end of file +[metadata] diff --git a/setup.py b/setup.py index 2446e066c..dd78b7248 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,9 @@ """See pyproject.toml for project metadata.""" -from setuptools import setup import os +from setuptools import setup + package_root = os.path.abspath(os.path.dirname(__file__)) version = {} diff --git a/tests/fixtures/interpolator.py b/tests/fixtures/interpolator.py index 6bf5e6ba2..94b44efbd 100644 --- a/tests/fixtures/interpolator.py +++ b/tests/fixtures/interpolator.py @@ -1,11 +1,13 @@ +import numpy as np +import pytest + +from LoopStructural.datatypes import BoundingBox from LoopStructural.interpolators import ( FiniteDifferenceInterpolator as FDI, PiecewiseLinearInterpolator as PLI, + StructuredGrid, + TetMesh, ) -from LoopStructural.interpolators import StructuredGrid, TetMesh -from LoopStructural.datatypes import BoundingBox -import pytest -import numpy as np @pytest.fixture(params=["FDI", "PLI"]) diff --git a/tests/integration/test_fold_models.py b/tests/integration/test_fold_models.py index ece4d922e..c4ee9bfca 100644 --- a/tests/integration/test_fold_models.py +++ b/tests/integration/test_fold_models.py @@ -1,9 +1,9 @@ +import numpy as np +import pandas as pd + from LoopStructural import GeologicalModel -from LoopStructural.modelling.features import GeologicalFeature from LoopStructural.datasets import load_noddy_single_fold - -import pandas as pd -import numpy as np +from LoopStructural.modelling.features import GeologicalFeature data, boundary_points = load_noddy_single_fold() data.head() diff --git a/tests/integration/test_interpolator.py b/tests/integration/test_interpolator.py index bcb326fc8..46a1281a0 100644 --- a/tests/integration/test_interpolator.py +++ b/tests/integration/test_interpolator.py @@ -1,6 +1,7 @@ +import numpy as np + from LoopStructural import GeologicalModel from LoopStructural.datasets import load_claudius, load_horizontal -import numpy as np def model_fit(model, data): diff --git a/tests/integration/test_refolded.py b/tests/integration/test_refolded.py index e459ed424..ec238695f 100644 --- a/tests/integration/test_refolded.py +++ b/tests/integration/test_refolded.py @@ -1,6 +1,6 @@ from LoopStructural import GeologicalModel -from LoopStructural.modelling.features import StructuralFrame from LoopStructural.datasets import load_laurent2016 +from LoopStructural.modelling.features import StructuralFrame def average_axis(): diff --git a/tests/unit/datatypes/test__structured_grid.py b/tests/unit/datatypes/test__structured_grid.py index 44accb9b1..c16bae270 100644 --- a/tests/unit/datatypes/test__structured_grid.py +++ b/tests/unit/datatypes/test__structured_grid.py @@ -1,5 +1,6 @@ import numpy as np import pytest + from LoopStructural.datatypes._structured_grid import StructuredGrid from LoopStructural.utils import rng diff --git a/tests/unit/datatypes/test__surface.py b/tests/unit/datatypes/test__surface.py index db0396b47..dc07bb166 100644 --- a/tests/unit/datatypes/test__surface.py +++ b/tests/unit/datatypes/test__surface.py @@ -1,5 +1,6 @@ import numpy as np import pytest + from LoopStructural.datatypes._surface import Surface diff --git a/tests/unit/datatypes/test_bounding_box.py b/tests/unit/datatypes/test_bounding_box.py index 1b3bb2cf8..93f701108 100644 --- a/tests/unit/datatypes/test_bounding_box.py +++ b/tests/unit/datatypes/test_bounding_box.py @@ -1,6 +1,7 @@ -from LoopStructural.datatypes import BoundingBox import numpy as np +from LoopStructural.datatypes import BoundingBox + def test_create_bounding_box(): bbox = BoundingBox(origin=[0, 0, 0], maximum=[1, 1, 1]) diff --git a/tests/unit/input/test_data_processor.py b/tests/unit/input/test_data_processor.py index 94e92ae68..d81c3a596 100644 --- a/tests/unit/input/test_data_processor.py +++ b/tests/unit/input/test_data_processor.py @@ -1,7 +1,8 @@ +import numpy as np +import pandas as pd + from LoopStructural.modelling import ProcessInputData from LoopStructural.utils import rng -import pandas as pd -import numpy as np def test_create_processor(): diff --git a/tests/unit/interpolator/test_2d_discrete_support.py b/tests/unit/interpolator/test_2d_discrete_support.py index d9aba5457..2a826763d 100644 --- a/tests/unit/interpolator/test_2d_discrete_support.py +++ b/tests/unit/interpolator/test_2d_discrete_support.py @@ -1,6 +1,7 @@ -from LoopStructural.interpolators import StructuredGrid2D import numpy as np +from LoopStructural.interpolators import StructuredGrid2D + ## structured grid 2d tests def test_create_structured_grid2d(): diff --git a/tests/unit/interpolator/test_discrete_supports.py b/tests/unit/interpolator/test_discrete_supports.py index eb8103d6b..c079513da 100644 --- a/tests/unit/interpolator/test_discrete_supports.py +++ b/tests/unit/interpolator/test_discrete_supports.py @@ -1,6 +1,7 @@ -from LoopStructural.interpolators import StructuredGrid import numpy as np +from LoopStructural.interpolators import StructuredGrid + ## structured grid tests def test_create_support(support): diff --git a/tests/unit/interpolator/test_interpolator_builder.py b/tests/unit/interpolator/test_interpolator_builder.py index bd0f46155..10811eee6 100644 --- a/tests/unit/interpolator/test_interpolator_builder.py +++ b/tests/unit/interpolator/test_interpolator_builder.py @@ -1,8 +1,9 @@ -import pytest import numpy as np +import pytest + from LoopStructural.datatypes import BoundingBox -from LoopStructural.interpolators._interpolator_builder import InterpolatorBuilder from LoopStructural.interpolators import InterpolatorType +from LoopStructural.interpolators._interpolator_builder import InterpolatorBuilder @pytest.fixture diff --git a/tests/unit/interpolator/test_outside_box.py b/tests/unit/interpolator/test_outside_box.py index a5eb440ab..d61bd60fe 100644 --- a/tests/unit/interpolator/test_outside_box.py +++ b/tests/unit/interpolator/test_outside_box.py @@ -1,5 +1,6 @@ -import pandas as pd import numpy as np +import pandas as pd + from LoopStructural import GeologicalModel diff --git a/tests/unit/interpolator/test_solvers.py b/tests/unit/interpolator/test_solvers.py index 8b1378917..e69de29bb 100644 --- a/tests/unit/interpolator/test_solvers.py +++ b/tests/unit/interpolator/test_solvers.py @@ -1 +0,0 @@ - diff --git a/tests/unit/interpolator/test_unstructured_supports.py b/tests/unit/interpolator/test_unstructured_supports.py index b2468c52a..ae70be69f 100644 --- a/tests/unit/interpolator/test_unstructured_supports.py +++ b/tests/unit/interpolator/test_unstructured_supports.py @@ -1,7 +1,9 @@ +from os.path import dirname + import numpy as np + from LoopStructural.interpolators import UnStructuredTetMesh from LoopStructural.utils import rng -from os.path import dirname file_path = dirname(__file__) diff --git a/tests/unit/modelling/intrusions/test_intrusions.py b/tests/unit/modelling/intrusions/test_intrusions.py index 377ccc2e5..1e8f4c4a7 100644 --- a/tests/unit/modelling/intrusions/test_intrusions.py +++ b/tests/unit/modelling/intrusions/test_intrusions.py @@ -1,15 +1,14 @@ # Loop library from LoopStructural import GeologicalModel -from LoopStructural.modelling.intrusions import IntrusionFrameBuilder -from LoopStructural.modelling.intrusions import IntrusionBuilder +from LoopStructural.datasets import load_tabular_intrusion from LoopStructural.modelling.features import StructuralFrame from LoopStructural.modelling.intrusions import ( - ellipse_function, + IntrusionBuilder, + IntrusionFrameBuilder, constant_function, + ellipse_function, ) -from LoopStructural.datasets import load_tabular_intrusion - data, boundary_points = load_tabular_intrusion() diff --git a/tests/unit/modelling/test__bounding_box.py b/tests/unit/modelling/test__bounding_box.py index 59cbdde7a..9829d6ab4 100644 --- a/tests/unit/modelling/test__bounding_box.py +++ b/tests/unit/modelling/test__bounding_box.py @@ -1,5 +1,6 @@ import numpy as np import pytest + from LoopStructural.datatypes._bounding_box import BoundingBox diff --git a/tests/unit/modelling/test__fault_builder.py b/tests/unit/modelling/test__fault_builder.py index 9006b61f2..184c7236a 100644 --- a/tests/unit/modelling/test__fault_builder.py +++ b/tests/unit/modelling/test__fault_builder.py @@ -1,9 +1,10 @@ import numpy as np import pandas as pd import pytest -from LoopStructural.modelling.features.builders._fault_builder import FaultBuilder -from LoopStructural.datatypes import BoundingBox + from LoopStructural import GeologicalModel +from LoopStructural.datatypes import BoundingBox +from LoopStructural.modelling.features.builders._fault_builder import FaultBuilder def test_fault_builder_update_geometry(interpolatortype): diff --git a/tests/unit/modelling/test_faults_segment.py b/tests/unit/modelling/test_faults_segment.py index 4f017a2a5..76378f3c6 100644 --- a/tests/unit/modelling/test_faults_segment.py +++ b/tests/unit/modelling/test_faults_segment.py @@ -1,6 +1,7 @@ +import pandas as pd + from LoopStructural import GeologicalModel from LoopStructural.modelling.features.fault import FaultSegment -import pandas as pd def test_create_and_add_fault(): diff --git a/tests/unit/modelling/test_geological_feature.py b/tests/unit/modelling/test_geological_feature.py index 5a4b86ff5..fa8dbdd00 100644 --- a/tests/unit/modelling/test_geological_feature.py +++ b/tests/unit/modelling/test_geological_feature.py @@ -1,9 +1,10 @@ +import numpy as np + from LoopStructural.modelling.features import ( - GeologicalFeature, AnalyticalGeologicalFeature, FeatureType, + GeologicalFeature, ) -import numpy as np def test_constructors(): @@ -39,6 +40,7 @@ def test_toggle_faults(): def test_tojson(): base_feature = GeologicalFeature("test", None, [], [], None) import json + from LoopStructural.utils import LoopJSONEncoder json.dumps(base_feature, cls=LoopJSONEncoder) diff --git a/tests/unit/modelling/test_geological_feature_builder.py b/tests/unit/modelling/test_geological_feature_builder.py index 0cea013a7..df78c1bb2 100644 --- a/tests/unit/modelling/test_geological_feature_builder.py +++ b/tests/unit/modelling/test_geological_feature_builder.py @@ -1,8 +1,4 @@ - - -def test_geological_feature_builder_constructor( - interpolatortype, bounding_box, nelements -): +def test_geological_feature_builder_constructor(interpolatortype, bounding_box, nelements): # builder = GeologicalFeatureBuilder(interpolatortype, bounding_box, nelements) # assert builder.interpolator == interpolator pass diff --git a/tests/unit/modelling/test_geological_model.py b/tests/unit/modelling/test_geological_model.py index 0318181a1..11df29955 100644 --- a/tests/unit/modelling/test_geological_model.py +++ b/tests/unit/modelling/test_geological_model.py @@ -1,6 +1,7 @@ +import numpy as np + from LoopStructural import GeologicalModel from LoopStructural.datasets import load_claudius -import numpy as np def test_create_geological_model(): diff --git a/tests/unit/modelling/test_structural_frame.py b/tests/unit/modelling/test_structural_frame.py index 7e51ecde4..646c5d135 100644 --- a/tests/unit/modelling/test_structural_frame.py +++ b/tests/unit/modelling/test_structural_frame.py @@ -1,12 +1,12 @@ +import numpy as np +import pandas as pd + +from LoopStructural import GeologicalModel +from LoopStructural.datatypes import BoundingBox from LoopStructural.modelling.features import ( - StructuralFrame, GeologicalFeature, + StructuralFrame, ) -from LoopStructural.datatypes import BoundingBox - -from LoopStructural import GeologicalModel -import numpy as np -import pandas as pd def test_structural_frame(): diff --git a/tests/unit/utils/test_conversions.py b/tests/unit/utils/test_conversions.py index 7d05b5212..1350e42ea 100644 --- a/tests/unit/utils/test_conversions.py +++ b/tests/unit/utils/test_conversions.py @@ -1,6 +1,7 @@ -from LoopStructural.utils import strikedip2vector, azimuthplunge2vector import numpy as np +from LoopStructural.utils import azimuthplunge2vector, strikedip2vector + def test_strikedip2vector(): strike = [0, 45, 90]