Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions FoldOptLib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
# from .fold_modelling import FoldModel, BaseFoldFrameBuilder
from .helper import _helper, utils
from .input import CheckInputData, InputDataProcessor
from .objective_functions import GeologicalKnowledgeFunctions, VonMisesFisher, LeastSquaresFunctions, \
loglikelihood_fourier_series, loglikelihood_axial_surface, gaussian_log_likelihood, loglikelihood, \
is_axial_plane_compatible
from .optimisers import FourierSeriesOptimiser, AxialSurfaceOptimiser
from .splot import SPlotProcessor
from .ipywidgets_interface import create_value_widgets, on_add_button_click, on_constraint_change, \
on_sub_constraint_change, display_dict_selection
"""FoldOptLib package."""
from .version import __version__
11 changes: 11 additions & 0 deletions FoldOptLib/fold_modelling_plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Compatibility wrapper to support legacy import paths used in tests.
# Re-export objects from the main package modules.
# Avoid importing heavy modules at import time. Instead expose them lazily by
# referencing the corresponding modules from the main package when accessed.
from importlib import import_module


def __getattr__(name):
return import_module(f"FoldOptLib.{name}")

__all__ = []
1 change: 1 addition & 0 deletions FoldOptLib/fold_modelling_plugin/input/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ...input import *
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ...input.input_data_checker import *
9 changes: 8 additions & 1 deletion FoldOptLib/helper/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
from ._helper import *
# Import helper modules. Some of these rely on optional dependencies from
# LoopStructural. To allow using parts of this package without those
# heavy dependencies, guard the imports with try/except blocks.
try:
from ._helper import *
except Exception: # pragma: no cover - optional dependency may be missing
pass

from .utils import *
10 changes: 9 additions & 1 deletion FoldOptLib/input/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
from .input_data_checker import CheckInputData
from .input_data_processor import InputDataProcessor

# Import InputDataProcessor lazily so that optional heavy dependencies used in
# this module do not interfere with lightweight parts of the package such as the
# tests for ``CheckInputData``. This avoids importing ``helper._helper`` at
# package import time.
try:
from .input_data_processor import InputDataProcessor
except Exception: # pragma: no cover - optional dependency may be missing
InputDataProcessor = None
2 changes: 1 addition & 1 deletion FoldOptLib/input/input_data_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def check_bounding_box(self):
if self.bounding_box.size == 0:
raise ValueError("bounding_box array is empty.")
# check if the bounding box has the correct format
if not len(self.bounding_box[0]) == 3 and not len(self.bounding_box[1]) == 3:
if len(self.bounding_box[0]) != 3 or len(self.bounding_box[1]) != 3:
raise ValueError("Bounding box must have the following format: [[minX, maxX, minY], [maxY, minZ, maxZ]]")

# write a function that checks all the input data
Expand Down
Loading