Skip to content

Commit 7ad2311

Browse files
committed
fix: linting
1 parent af970a0 commit 7ad2311

File tree

5 files changed

+66
-13
lines changed

5 files changed

+66
-13
lines changed

LoopStructural/interpolators/supports/_2d_structured_grid.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
44
"""
55

6-
from ast import Not
76
import logging
87

98
from typing import Tuple

LoopStructural/modelling/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
__all__ = [
77
"GeologicalModel",
88
"ProcessInputData",
9-
"Loop3DView",
109
"Map2LoopProcessor",
1110
"LoopProjectfileProcessor",
1211
]
1312
from ..utils import getLogger
1413
from ..utils import LoopImportError
14+
from .core.geological_model import GeologicalModel
1515

1616
logger = getLogger(__name__)
1717
from ..modelling.input import (

LoopStructural/modelling/features/_geological_feature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from ...modelling.features import BaseFeature
77
from ...utils import getLogger
88
from ...modelling.features import FeatureType
9-
from ...interpolators import GeologicalInterpolator, DiscreteInterpolator
9+
from ...interpolators import GeologicalInterpolator
1010
import numpy as np
1111
from typing import Optional, List, Union
1212
from ...datatypes import ValuePoints, VectorPoints

LoopStructural/modelling/features/fold/_fold_rotation_angle.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from scipy.optimize import curve_fit
33

44
from ....modelling.features.fold._fold_rotation_angle_feature import (
5-
fourier_series,
5+
# fourier_series,
6+
trigo_fold_profile,
67
)
78
from ....modelling.features.fold import SVariogram
89

@@ -53,9 +54,10 @@ def fit_fourier_series(
5354
wl = self.svario.find_wavelengths(lags=lags, nlag=nlag, lag=lag)
5455
# for now only consider single fold wavelength
5556
wl = wl[0]
56-
guess = np.zeros(4)
57-
guess[3] = wl # np.max(limb_wl)
58-
logger.info(f"Guess: {guess[0]} {guess[1]} {guess[2]} {guess[3]}")
57+
guess = np.zeros(3)
58+
guess[1] = wl
59+
guess[2] = np.deg2rad(45) # np.max(limb_wl)
60+
logger.info(f"Guess: {guess[0]} {guess[1]} {guess[2]} ")
5961
# mask nans
6062
mask = np.logical_or(~np.isnan(self.fold_frame_coordinate), ~np.isnan(self.rotation_angle))
6163
logger.info(
@@ -71,7 +73,7 @@ def fit_fourier_series(
7173
try:
7274
# try fitting using wavelength guess
7375
popt, pcov = curve_fit(
74-
fourier_series,
76+
trigo_fold_profile,
7577
self.fold_frame_coordinate[mask],
7678
np.tan(np.deg2rad(self.rotation_angle[mask])),
7779
guess,
@@ -81,7 +83,7 @@ def fit_fourier_series(
8183
# if fitting failed, try with just 0s
8284
logger.info("Running curve fit without initial guess")
8385
popt, pcov = curve_fit(
84-
fourier_series,
86+
trigo_fold_profile,
8587
self.fold_frame_coordinate[mask],
8688
np.tan(np.deg2rad(self.rotation_angle[mask])),
8789
)
@@ -90,15 +92,14 @@ def fit_fourier_series(
9092
popt = guess
9193
logger.error("Could not fit curve to S-Plot, check the wavelength")
9294
self.fitted_params = popt
93-
logger.info(f"Fitted: {popt[0]} {popt[1]} {popt[2]} {popt[3]}")
95+
logger.info(f"Fitted: {popt[0]} {popt[1]} {popt[2]} ")
9496
self.fold_rotation_function = lambda x: np.rad2deg(
9597
np.arctan(
96-
fourier_series(
98+
trigo_fold_profile(
9799
x,
98100
self.fitted_params[0],
99101
self.fitted_params[1],
100102
self.fitted_params[2],
101-
self.fitted_params[3],
102103
)
103104
)
104105
)

LoopStructural/modelling/features/fold/_fold_rotation_angle_feature.py

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import numpy as np
22
from ....modelling.features import BaseFeature
3-
43
from ....utils import getLogger
54

65
logger = getLogger(__name__)
@@ -46,6 +45,40 @@ def evaluate_value(self, location):
4645
return r
4746

4847

48+
# class BaseFoldProfile(ABCMeta):
49+
# def __init__(self):
50+
# pass
51+
52+
# @abstractmethod
53+
# def params(self):
54+
# pass
55+
56+
57+
# @abstractmethod
58+
# def __call__(self, s):
59+
# pass
60+
61+
62+
# class TrigoFoldProfile(BaseFoldProfile):
63+
# def __init__(self, origin, wavelength, inflectionpointangle):
64+
# self.origin = origin
65+
# self.wavelength = wavelength
66+
# self.inflectionpointangle = inflectionpointangle
67+
# self.tan_alpha_delta_half = np.tan(self.inflectionpointangle)
68+
69+
# self.tan_alpha_shift = 0
70+
71+
# def position_in_period(self, s):
72+
# return (s - self.origin) / self.wavelength
73+
74+
# def __call__(self, s):
75+
# x = self.position_in_period(s)
76+
# return np.rad2deg(
77+
# np.arctan(self.tan_alpha_delta_half * np.sin(2 * np.pi * x) + self.tan_alpha_shift)
78+
# )
79+
# class FourierSeriesFoldProfile(BaseFoldProfile):
80+
81+
4982
def fourier_series(x, c0, c1, c2, w):
5083
"""
5184
@@ -65,3 +98,23 @@ def fourier_series(x, c0, c1, c2, w):
6598
# v.fill(c0)
6699
v = c0 + c1 * np.cos(2 * np.pi / w * x) + c2 * np.sin(2 * np.pi / w * x)
67100
return np.rad2deg(np.arctan(v))
101+
102+
103+
def trigo_fold_profile(s, origin, wavelength, inflectionpointangle):
104+
"""
105+
106+
Parameters
107+
----------
108+
s
109+
origin
110+
wavelength
111+
inflectionpointangle
112+
113+
Returns
114+
-------
115+
116+
"""
117+
tan_alpha_delta_half = np.tan(inflectionpointangle)
118+
tan_alpha_shift = 0
119+
x = (s - origin) / wavelength
120+
return np.rad2deg(np.arctan(tan_alpha_delta_half * np.sin(2 * np.pi * x) + tan_alpha_shift))

0 commit comments

Comments
 (0)