Skip to content

Commit

Permalink
fix: 🐛 small changes to pass tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachlan Grose committed Feb 21, 2022
1 parent d2e1f0b commit 14c7580
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
3 changes: 1 addition & 2 deletions LoopStructural/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import tempfile
from pathlib import Path
from .version import __version__

experimental = False
ch = logging.StreamHandler()
formatter = logging.Formatter(
"%(levelname)s: %(asctime)s: %(filename)s:%(lineno)d -- %(message)s"
Expand All @@ -22,4 +22,3 @@

logger = getLogger(__name__)
logger.info("Imported LoopStructural")
experimental = False
2 changes: 2 additions & 0 deletions LoopStructural/interpolators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"""
from enum import IntEnum

from LoopStructural.utils import getLogger
import LoopStructural
logger = getLogger(__name__)
class InterpolatorType(IntEnum):
"""
Enum for the different interpolator types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def nodes(self):
Fortran ordered
"""
return self.vertices

def barycentre(self, element_idx=None):
@property
def barycentre(self):
"""
Return the barycentres of all tetrahedrons or of specified tetras using
global index
Expand All @@ -81,8 +81,7 @@ def barycentre(self, element_idx=None):
-------
"""
if element_idx is None:
element_idx = np.arange(0, self.nelements)
element_idx = np.arange(0, self.nelements)
elements = self.elements[element_idx]
barycentre = np.sum(self.nodes[elements][:, :3, :], axis=1) / 3.0
return barycentre
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def nodes(self):
xx, yy = np.meshgrid(x, y, indexing="ij")
return np.array([xx.flatten(order="F"), yy.flatten(order="F")]).T

@property
def barycentre(self):
return self.cell_centres(np.arange(self.n_elements))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def barycentre(self):
"""

tetra = self.get_elements()[elements]
tetra = self.get_elements()
barycentre = np.sum(self.nodes[tetra][:, :, :], axis=1) / 4.0
return barycentre

Expand Down
4 changes: 3 additions & 1 deletion LoopStructural/modelling/core/geological_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

import numpy as np
import pandas as pd
import LoopStructural
from LoopStructural.datasets import normal_vector_headers
from LoopStructural.interpolators import DiscreteFoldInterpolator as DFI
from LoopStructural.interpolators import FiniteDifferenceInterpolator as FDI
from LoopStructural.interpolators import PiecewiseLinearInterpolator as PLI
from LoopStructural.interpolators import P2Interpolator
if LoopStructural.experimental:
from LoopStructural.interpolators import P2Interpolator
try:
from LoopStructural.surfe_wrapper import SurfeRBFInterpolator as Surfe

Expand Down

0 comments on commit 14c7580

Please sign in to comment.