Skip to content

Commit 14c7580

Browse files
author
Lachlan Grose
committed
fix: 🐛 small changes to pass tests.
1 parent d2e1f0b commit 14c7580

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

LoopStructural/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import tempfile
1010
from pathlib import Path
1111
from .version import __version__
12-
12+
experimental = False
1313
ch = logging.StreamHandler()
1414
formatter = logging.Formatter(
1515
"%(levelname)s: %(asctime)s: %(filename)s:%(lineno)d -- %(message)s"
@@ -22,4 +22,3 @@
2222

2323
logger = getLogger(__name__)
2424
logger.info("Imported LoopStructural")
25-
experimental = False

LoopStructural/interpolators/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"""
55
from enum import IntEnum
66

7+
from LoopStructural.utils import getLogger
78
import LoopStructural
9+
logger = getLogger(__name__)
810
class InterpolatorType(IntEnum):
911
"""
1012
Enum for the different interpolator types

LoopStructural/interpolators/supports/_2d_base_unstructured.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def nodes(self):
6666
Fortran ordered
6767
"""
6868
return self.vertices
69-
70-
def barycentre(self, element_idx=None):
69+
@property
70+
def barycentre(self):
7171
"""
7272
Return the barycentres of all tetrahedrons or of specified tetras using
7373
global index
@@ -81,8 +81,7 @@ def barycentre(self, element_idx=None):
8181
-------
8282
8383
"""
84-
if element_idx is None:
85-
element_idx = np.arange(0, self.nelements)
84+
element_idx = np.arange(0, self.nelements)
8685
elements = self.elements[element_idx]
8786
barycentre = np.sum(self.nodes[elements][:, :3, :], axis=1) / 3.0
8887
return barycentre

LoopStructural/interpolators/supports/_2d_structured_grid.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def nodes(self):
5757
xx, yy = np.meshgrid(x, y, indexing="ij")
5858
return np.array([xx.flatten(order="F"), yy.flatten(order="F")]).T
5959

60+
@property
6061
def barycentre(self):
6162
return self.cell_centres(np.arange(self.n_elements))
6263

LoopStructural/interpolators/supports/_3d_structured_tetra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def barycentre(self):
5555
5656
"""
5757

58-
tetra = self.get_elements()[elements]
58+
tetra = self.get_elements()
5959
barycentre = np.sum(self.nodes[tetra][:, :, :], axis=1) / 4.0
6060
return barycentre
6161

LoopStructural/modelling/core/geological_model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55

66
import numpy as np
77
import pandas as pd
8+
import LoopStructural
89
from LoopStructural.datasets import normal_vector_headers
910
from LoopStructural.interpolators import DiscreteFoldInterpolator as DFI
1011
from LoopStructural.interpolators import FiniteDifferenceInterpolator as FDI
1112
from LoopStructural.interpolators import PiecewiseLinearInterpolator as PLI
12-
from LoopStructural.interpolators import P2Interpolator
13+
if LoopStructural.experimental:
14+
from LoopStructural.interpolators import P2Interpolator
1315
try:
1416
from LoopStructural.surfe_wrapper import SurfeRBFInterpolator as Surfe
1517

0 commit comments

Comments
 (0)