Skip to content

Commit

Permalink
fix: merge origin/intrusion to local intrusion
Browse files Browse the repository at this point in the history
  • Loading branch information
Fer071989 committed Mar 8, 2022
2 parents b8000db + bd3f428 commit 2507b33
Show file tree
Hide file tree
Showing 64 changed files with 4,112 additions and 3,171 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/windows_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Installing dependencies
shell: bash -l {0}
run: |
conda install -c conda-forge cython numpy scipy scikit-image scikit-learn pyamg flake8 pytest networkx
conda install -c conda-forge cython numpy scipy scikit-image scikit-learn pyamg flake8 pytest networkx osqp
- name: Checking formatting of code
shell: bash -l {0}
run: |
Expand Down
Binary file added .vs/LoopStructural/v17/.suo
Binary file not shown.
13 changes: 13 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"ExpandedNodes": [
"",
"\\LoopStructural",
"\\LoopStructural\\modelling",
"\\LoopStructural\\modelling\\core",
"\\LoopStructural\\modelling\\fault",
"\\LoopStructural\\modelling\\intrusions",
"\\LoopStructural\\modelling\\intrusions\\old"
],
"SelectedNode": "\\LoopStructural\\modelling\\intrusions\\old\\intrusion_frame.py",
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
# Changelog

### [1.4.3](https://www.github.com/Loop3D/LoopStructural/compare/v1.4.2...v1.4.3) (2022-02-21)


### Bug Fixes

* :ambulance: added scale parameter for calculate_topo matrix. ([839e0e0](https://www.github.com/Loop3D/LoopStructural/commit/839e0e07fd8333c70ca71c0d8cf356ccd2e9e604))
* :bug: adding experimental flag for loopstructural ([f810479](https://www.github.com/Loop3D/LoopStructural/commit/f810479f6d057d21f9229ae645d39257b051d906))
* :bug: changes support barycentre to property ([d2e1f0b](https://www.github.com/Loop3D/LoopStructural/commit/d2e1f0b54d71eb2cdae3a92e9fcbce9a7e189d26))
* :bug: fixing bugs for flake8 ([9dce30c](https://www.github.com/Loop3D/LoopStructural/commit/9dce30c012ba6543a7936275a4452c25d30412fc))
* :bug: small changes to pass tests. ([14c7580](https://www.github.com/Loop3D/LoopStructural/commit/14c758044d36962b6b63d7af7dd6783638539023))
* :zap: changing aabb to sparse matrix ([2cbdab7](https://www.github.com/Loop3D/LoopStructural/commit/2cbdab7feb1cafe4491766f056b3fe58e32ac706))
* adding isnan to inequality check ([d780300](https://www.github.com/Loop3D/LoopStructural/commit/d7803005971e8e72663ebe2538251407079cb30b))
* adding node inequality constraints ([de33914](https://www.github.com/Loop3D/LoopStructural/commit/de3391403a7012895f7bf1bf170862ca2cfa6ed7))
* adding option to use mkl ([22883ba](https://www.github.com/Loop3D/LoopStructural/commit/22883ba59c13476ff77f91265268d10e56cd8a84))
* adding p2 interpolator for 3d :) ([5d0acfb](https://www.github.com/Loop3D/LoopStructural/commit/5d0acfb99458f2cacfbbfe099164e32ebe2a6d3b))
* bug with equality constraints ([b192cff](https://www.github.com/Loop3D/LoopStructural/commit/b192cff05987b6ad9350ade53208943afca18823))
* changing base unstructred support to work ([50ca16b](https://www.github.com/Loop3D/LoopStructural/commit/50ca16b70ddafd29ead061e153fe2b0652ca0e2b))
* correct ordering of shape functions ([6f2f113](https://www.github.com/Loop3D/LoopStructural/commit/6f2f113abb42a14c4b5278a635066f1696bf062d))
* minor fix to variogram saving wavelength guess as attribute ([2dbc29e](https://www.github.com/Loop3D/LoopStructural/commit/2dbc29e0696fe25bc3f55afb6cee1bea7bb9d9f1))
* modifying for 3d/generic case. ([c6a8ea3](https://www.github.com/Loop3D/LoopStructural/commit/c6a8ea3dcfdb7098d9e77df83f87e0f50036b670))
* norm constraints p2 ([93d3165](https://www.github.com/Loop3D/LoopStructural/commit/93d31654a9403f285a5ce3e4cfc3c6b4f91becf5))
* region funct type incorrect causing ([a5d27f1](https://www.github.com/Loop3D/LoopStructural/commit/a5d27f1569e0337971cc4997c673333ff1842d83))
* storing constraints as numpy array ([6c75379](https://www.github.com/Loop3D/LoopStructural/commit/6c753799019e19bb69d8621d5020787d5c42339f))


### Documentation

* :memo: adding warning that analysis module is experimental ([0574e57](https://www.github.com/Loop3D/LoopStructural/commit/0574e57bc639fe809b3e9b02531ce0e10742ea36))
* :memo: updating documentation for evaluate model ([1dcc716](https://www.github.com/Loop3D/LoopStructural/commit/1dcc716c6ae5cb0c77a54bf794ee14e077a874ce))

### [1.4.2](https://www.github.com/Loop3D/LoopStructural/compare/v1.4.1...v1.4.2) (2022-02-07)


### Bug Fixes

* actually fixing divide by zero ([ef4d7d0](https://www.github.com/Loop3D/LoopStructural/commit/ef4d7d036a24730a5c296f8e7779d76e405b98ce))
* added function for plotting structural frames ([69dbc6d](https://www.github.com/Loop3D/LoopStructural/commit/69dbc6d12999952d6266d003e8e7bda37551670c))
* adding mpl syntax for 3d view points ([cc7788f](https://www.github.com/Loop3D/LoopStructural/commit/cc7788f62f82b4bdc4bba242c394212ed94e6d5d))
* bug where data is not float ([e6f7e1f](https://www.github.com/Loop3D/LoopStructural/commit/e6f7e1fb6c09d4702bc49218d5b7b4e73385de7a))
* bug with calculating average fault ori ([a2099cd](https://www.github.com/Loop3D/LoopStructural/commit/a2099cd0477a18a6448d5e556795b0e40a1f05a6))
* commenting out osqp ([c2fd2da](https://www.github.com/Loop3D/LoopStructural/commit/c2fd2da4c5f6b84424cbd0fa0f3e940b7cadeb4f))
* crashing when all constraints of a type outside of box ([7907f58](https://www.github.com/Loop3D/LoopStructural/commit/7907f5814a4e2a0672c3fb73616325e533549809))
* extra checks ([ba6f391](https://www.github.com/Loop3D/LoopStructural/commit/ba6f39134e02daf996e59fd321d2698ce1dee040))
* fault interpolation taking a long time ([78fa916](https://www.github.com/Loop3D/LoopStructural/commit/78fa9163bc0b5fd84ef93302541dbf2da474749b))
* faults interpolation mesh was not being adjusted ([33722f6](https://www.github.com/Loop3D/LoopStructural/commit/33722f6c103701a7c7bf5dadb88c3bd422752622))
* faults not rescaling when incorrect norm vectors used ([9706f25](https://www.github.com/Loop3D/LoopStructural/commit/9706f255c612af4ea702c89f870826eed380167b))
* faults not visible in model ([32cbb2a](https://www.github.com/Loop3D/LoopStructural/commit/32cbb2a849c7f0c87da4adc2485013973eb2380b))
* faults with no value data not interpolating ([bf55ec6](https://www.github.com/Loop3D/LoopStructural/commit/bf55ec684cd4635f7396a4245a79b2e9adf81697))
* interpolator type is now an enum ([8197552](https://www.github.com/Loop3D/LoopStructural/commit/81975524f9ee487d8de489501b5fd2455150d20f))
* norm constraint out of model cause crash ([20692e2](https://www.github.com/Loop3D/LoopStructural/commit/20692e21dd7b97911e1b38f66ba405dfc152cb5f))
* number of constraints warning message ([9abcc04](https://www.github.com/Loop3D/LoopStructural/commit/9abcc042947b06f80db121aa48f9a9c1f0648b81))
* removed divide by 0 error ([9f17489](https://www.github.com/Loop3D/LoopStructural/commit/9f17489cf8f233651778e817f7fd9c3258bc7d9f))
* updating logging ([f77f915](https://www.github.com/Loop3D/LoopStructural/commit/f77f9156dfae6a58ea4a31b4b577dd2f207d2b8a))

### [1.4.1](https://www.github.com/Loop3D/LoopStructural/compare/v1.4.0...v1.4.1) (2021-12-06)


Expand Down
3 changes: 1 addition & 2 deletions LoopStructural/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
LoopStructural API
=======================
Expand All @@ -12,6 +10,7 @@
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 Down
14 changes: 11 additions & 3 deletions LoopStructural/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
Various tools for analysing loopstructural models, including calculating fault intersections and fault toplogies
"""
from ._fault_displacement import displacement_missfit
from ._fault_intersection import calculate_fault_intersections
from ._topology import calculate_fault_topology_matrix
from LoopStructural.utils import getLogger
import LoopStructural

logger = getLogger(__name__)
if LoopStructural.experimental:
logger.warning(
"LoopStructural.analysis is experimental and may not perform as expected"
)
from ._fault_displacement import displacement_missfit
from ._fault_intersection import calculate_fault_intersections
from ._topology import calculate_fault_topology_matrix
10 changes: 8 additions & 2 deletions LoopStructural/analysis/_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
logger = getLogger(__name__)


def calculate_fault_topology_matrix(model, xyz=None, threshold=0.001):
def calculate_fault_topology_matrix(model, xyz=None, threshold=0.001, scale=True):
"""Calculate fault ellipsoid and hw/fw
Parameters
Expand All @@ -13,12 +13,18 @@ def calculate_fault_topology_matrix(model, xyz=None, threshold=0.001):
the model containing the faults
xyz : np.array
xyz locations in model coordinates
threshold : float
threshold for determining if point is inside fault volume
scale : bool
flag whether to rescale xyz to model coordinates
Returns
-------
topology_matrix : np.array
matrix containing nan (outside), 0 (footwall), 1 (hangingwall)
"""
if xyz is not None and scale == True:
logger.warning("Scaling XYZ to model coordinate system")
xyz = model.scale(xyz, inplace=False)
if xyz is None:
xyz = model.regular_grid(rescale=False, shuffle=False)
topology_matrix = np.zeros((xyz.shape[0], len(model.faults)))
Expand Down
2 changes: 1 addition & 1 deletion LoopStructural/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
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_tabular_intrusion
5 changes: 3 additions & 2 deletions LoopStructural/datasets/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def strike_dip_headers():
def normal_vector_headers():
return ["X", "Y", "Z", "nx", "ny", "nz"]


def load_tabular_intrusion():
"""Model dataset sampled for a model of a tabular intrusion
Expand All @@ -154,5 +155,5 @@ def load_tabular_intrusion():
"""
module_path = dirname(__file__)
data = pd.read_csv(join(module_path, Path("data/tabular_intrusion.csv")))
bb = np.array([[0, 0, 0], [5,5,5]])
return data, bb
bb = np.array([[0, 0, 0], [5, 5, 5]])
return data, bb
59 changes: 51 additions & 8 deletions LoopStructural/interpolators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,60 @@
Interpolators and interpolation supports
"""
from LoopStructural.interpolators.discrete_fold_interpolator import (
DiscreteFoldInterpolator,
from enum import IntEnum

from LoopStructural.utils import getLogger
import LoopStructural

logger = getLogger(__name__)


class InterpolatorType(IntEnum):
"""
Enum for the different interpolator types
1-9 should cover interpolators with supports
9+ are data supported
"""

BASE = 0
BASE_DISCRETE = 1
FINITE_DIFFERENCE = 2
DISCRETE_FOLD = 3
PIECEWISE_LINEAR = 4
PIECEWISE_QUADRATIC = 5
BASE_DATA_SUPPORTED = 10
SURFE = 11


from LoopStructural.interpolators._geological_interpolator import GeologicalInterpolator
from LoopStructural.interpolators._discrete_interpolator import DiscreteInterpolator
from LoopStructural.interpolators.supports import (
TetMesh,
StructuredGrid,
UnStructuredTetMesh,
P1Unstructured2d,
P2Unstructured2d,
StructuredGrid2D,
P2UnstructuredTetMesh,
)
from LoopStructural.interpolators.finite_difference_interpolator import (


from LoopStructural.interpolators._finite_difference_interpolator import (
FiniteDifferenceInterpolator,
)
from LoopStructural.interpolators.piecewiselinear_interpolator import (
PiecewiseLinearInterpolator,
)
from LoopStructural.interpolators.structured_tetra import TetMesh
from LoopStructural.interpolators.unstructured_tetra import UnStructuredTetMesh
from LoopStructural.interpolators.structured_grid import StructuredGrid
from LoopStructural.interpolators.geological_interpolator import GeologicalInterpolator
from LoopStructural.interpolators.discrete_interpolator import DiscreteInterpolator
from LoopStructural.interpolators._discrete_fold_interpolator import (
DiscreteFoldInterpolator,
)

try:
from LoopStructural.interpolators._surfe_wrapper import SurfeRBFInterpolator
except ImportError:
logger.warning('Can\'t import surfepy - to install "pip install surfe"')

logger.warning("Using experimental interpolators: P1Interpolator and P2Interpolator")
from ._p1interpolator import P1Interpolator
from ._p2interpolator import P2Interpolator
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
import logging

import numpy as np
from LoopStructural.interpolators.cython.dsi_helper import fold_cg

from LoopStructural.interpolators.piecewiselinear_interpolator import (
PiecewiseLinearInterpolator,
)
from LoopStructural.interpolators import PiecewiseLinearInterpolator, InterpolatorType

from LoopStructural.utils import getLogger

logger = getLogger(__name__)

from .cython.dsi_helper import fold_cg


class DiscreteFoldInterpolator(PiecewiseLinearInterpolator):
""" """
Expand All @@ -31,7 +30,7 @@ def __init__(self, support, fold):
"""

PiecewiseLinearInterpolator.__init__(self, support)
self.type = ["foldinterpolator"]
self.type = InterpolatorType.DISCRETE_FOLD
self.fold = fold

@classmethod
Expand Down Expand Up @@ -128,7 +127,7 @@ def add_fold_constraints(
]
# calculate the fold geometry for the elements barycentre
deformed_orientation, fold_axis, dgz = self.fold.get_deformed_orientation(
self.support.barycentre()
self.support.barycentre
)
element_idx = np.arange(self.support.n_elements)
np.random.shuffle(element_idx)
Expand Down Expand Up @@ -251,5 +250,5 @@ def add_fold_constraints(
B = np.zeros(A.shape[0])
idc = np.array(idc[:ncons, :])
self.add_constraints_to_least_squares(
A, B, fold_regularisation[1], idc, name="fold regularisation 3"
A, B, fold_regularisation[2], idc, name="fold regularisation 3"
)

0 comments on commit 2507b33

Please sign in to comment.