apsg 2.0.5__tar.gz → 2.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. {apsg-2.0.5/src/apsg.egg-info → apsg-2.0.6}/PKG-INFO +1 -1
  2. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/__init__.py +1 -1
  3. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/feature/_container.py +3 -3
  4. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/feature/_tensor3.py +15 -8
  5. {apsg-2.0.5 → apsg-2.0.6/src/apsg.egg-info}/PKG-INFO +1 -1
  6. {apsg-2.0.5 → apsg-2.0.6}/tests/test_containers.py +2 -2
  7. {apsg-2.0.5 → apsg-2.0.6}/tests/test_tensors.py +14 -2
  8. {apsg-2.0.5 → apsg-2.0.6}/LICENSE +0 -0
  9. {apsg-2.0.5 → apsg-2.0.6}/README.md +0 -0
  10. {apsg-2.0.5 → apsg-2.0.6}/pyproject.toml +0 -0
  11. {apsg-2.0.5 → apsg-2.0.6}/setup.cfg +0 -0
  12. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/config.py +0 -0
  13. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/database/__init__.py +0 -0
  14. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/database/_sdbmodels.py +0 -0
  15. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/database/_sdbsession.py +0 -0
  16. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/database/_websdbsession.py +0 -0
  17. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/database/_webtransport.py +0 -0
  18. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/feature/__init__.py +0 -0
  19. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/feature/_geodata.py +0 -0
  20. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/feature/_paleomag.py +0 -0
  21. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/feature/_statistics.py +0 -0
  22. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/feature/_tensor2.py +0 -0
  23. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/helpers/__init__.py +0 -0
  24. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/helpers/_helper.py +0 -0
  25. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/helpers/_math.py +0 -0
  26. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/helpers/_notation.py +0 -0
  27. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/math/__init__.py +0 -0
  28. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/math/_matrix.py +0 -0
  29. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/math/_vector.py +0 -0
  30. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/pandas/__init__.py +0 -0
  31. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/pandas/_accessors.py +0 -0
  32. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/pandas/_gbfunctions.py +0 -0
  33. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/pandas/_pandas_api.py +0 -0
  34. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/__init__.py +0 -0
  35. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/_fabricplot.py +0 -0
  36. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/_paleomagplots.py +0 -0
  37. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/_plot_artists.py +0 -0
  38. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/_roseplot.py +0 -0
  39. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/_stereo_engine/__init__.py +0 -0
  40. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/_stereo_engine/_axes.py +0 -0
  41. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/_stereo_engine/_stereogrid.py +0 -0
  42. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/_stereo_engine/_transforms.py +0 -0
  43. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/_stereo_engine/_utils.py +0 -0
  44. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/_stereogrid.py +0 -0
  45. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/_stereonet.py +0 -0
  46. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/plotting/_styles.py +0 -0
  47. {apsg-2.0.5 → apsg-2.0.6}/src/apsg/shell.py +0 -0
  48. {apsg-2.0.5 → apsg-2.0.6}/src/apsg.egg-info/SOURCES.txt +0 -0
  49. {apsg-2.0.5 → apsg-2.0.6}/src/apsg.egg-info/dependency_links.txt +0 -0
  50. {apsg-2.0.5 → apsg-2.0.6}/src/apsg.egg-info/entry_points.txt +0 -0
  51. {apsg-2.0.5 → apsg-2.0.6}/src/apsg.egg-info/requires.txt +0 -0
  52. {apsg-2.0.5 → apsg-2.0.6}/src/apsg.egg-info/top_level.txt +0 -0
  53. {apsg-2.0.5 → apsg-2.0.6}/tests/test_apsg.py +0 -0
  54. {apsg-2.0.5 → apsg-2.0.6}/tests/test_pandas.py +0 -0
  55. {apsg-2.0.5 → apsg-2.0.6}/tests/test_plotting.py +0 -0
  56. {apsg-2.0.5 → apsg-2.0.6}/tests/test_websdb.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apsg
3
- Version: 2.0.5
3
+ Version: 2.0.6
4
4
  Summary: APSG - The package for structural geologists
5
5
  Author-email: Ondrej Lexa <lexa.ondrej@gmail.com>
6
6
  Maintainer-email: Ondrej Lexa <lexa.ondrej@gmail.com>
@@ -195,6 +195,6 @@ __all__ = (
195
195
  "velgrad2",
196
196
  )
197
197
 
198
- __version__ = "2.0.5"
198
+ __version__ = "2.0.6"
199
199
  __author__ = "Ondrej Lexa"
200
200
  __email__ = "lexa.ondrej@gmail.com"
@@ -2731,10 +2731,10 @@ class Stress3Set(FeatureSet):
2731
2731
  return np.array([e.I3 for e in self])
2732
2732
 
2733
2733
  @property
2734
- def shape_ratio(self) -> np.ndarray:
2735
- """Return the array of shape ratios (Gephart & Forsyth, 1984)."""
2734
+ def stress_ratio(self) -> np.ndarray:
2735
+ """Return the array of stress ratios R = (σ2 - σ3) / (σ1 - σ3)."""
2736
2736
 
2737
- return np.array([e.shape_ratio for e in self])
2737
+ return np.array([e.stress_ratio for e in self])
2738
2738
 
2739
2739
  def mean_tensor(self, level=0.95, normalize=False, anisoft=False):
2740
2740
  """Return mean tensor and confidence ellipses of its principal axes.
@@ -840,10 +840,11 @@ class Stress3(Tensor3):
840
840
  @classmethod
841
841
  def from_ratio(cls, r=0.5, mag=1):
842
842
  """
843
- Return ``Stress`` tensor with given shape ration.
843
+ Return ``Stress`` tensor with given stress ratio.
844
844
 
845
845
  Keyword Args:
846
- r (float): shape ratio between 0 and 1. Default 0.5
846
+ r (float): stress ratio R = (σ2 - σ3) / (σ1 - σ3) between 0 and 1.
847
+ Default 0.5
847
848
  mag (float): magnitude of differential stress. Default 1.
848
849
 
849
850
  Examples:
@@ -851,15 +852,16 @@ class Stress3(Tensor3):
851
852
  >>> S
852
853
  Stress3
853
854
  [[ 5. 0. 0. ]
854
- [ 0. 2.5 0. ]
855
+ [ 0. -2.5 0. ]
855
856
  [ 0. 0. -5. ]]
856
857
 
857
858
  Returns:
858
- Stress3: ``Stress`` tensor with given shape ration.
859
+ Stress3: ``Stress`` tensor with given stress ratio.
859
860
  """
860
861
 
861
862
  xx = mag / 2
862
- yy = xx - r * mag
863
+ # sigma2 placed so that (σ2 - σ3) / (σ1 - σ3) == r in either convention
864
+ yy = stress_sign() * (xx - r * mag)
863
865
  zz = -mag / 2
864
866
  return cls([[xx, 0, 0], [0, yy, 0], [0, 0, zz]])
865
867
 
@@ -1092,9 +1094,14 @@ class Stress3(Tensor3):
1092
1094
  return np.where(np.isclose(denom, 0), np.nan, (Se.sigma1 - sn) / denom)
1093
1095
 
1094
1096
  @property
1095
- def shape_ratio(self):
1096
- """Return shape ratio R (Gephart & Forsyth 1984)."""
1097
- return float((self.sigma1 - self.sigma2) / (self.sigma1 - self.sigma3))
1097
+ def stress_ratio(self):
1098
+ """Return stress ratio R = (σ2 - σ3) / (σ1 - σ3).
1099
+
1100
+ Structural geology definition: R = 0 for σ2 = σ3 (prolate) and
1101
+ R = 1 for σ2 = σ1 (oblate). Note that the seismological definition
1102
+ (σ1 - σ2) / (σ1 - σ3) equals 1 - R.
1103
+ """
1104
+ return float((self.sigma2 - self.sigma3) / (self.sigma1 - self.sigma3))
1098
1105
 
1099
1106
 
1100
1107
  class Ellipsoid(Tensor3):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apsg
3
- Version: 2.0.5
3
+ Version: 2.0.6
4
4
  Summary: APSG - The package for structural geologists
5
5
  Author-email: Ondrej Lexa <lexa.ondrej@gmail.com>
6
6
  Maintainer-email: Ondrej Lexa <lexa.ondrej@gmail.com>
@@ -1510,14 +1510,14 @@ class TestStress3Set:
1510
1510
  assert isinstance(s.I3, np.ndarray)
1511
1511
  assert len(s.I1) == len(s.I2) == len(s.I3) == 2
1512
1512
 
1513
- def test_shape_ratio_property(self):
1513
+ def test_stress_ratio_property(self):
1514
1514
  s = Stress3Set(
1515
1515
  [
1516
1516
  Stress3([[10, 2, -3], [2, 5, 1], [-3, 1, -2]]),
1517
1517
  Stress3([[8, 0, 0], [0, 5, 0], [0, 0, 1]]),
1518
1518
  ]
1519
1519
  )
1520
- r = s.shape_ratio
1520
+ r = s.stress_ratio
1521
1521
  assert isinstance(r, np.ndarray)
1522
1522
  assert len(r) == 2
1523
1523
 
@@ -1139,9 +1139,21 @@ class TestStress3:
1139
1139
  t = S.dilation_tendency(Foliation(160, 30))
1140
1140
  assert 0 <= t <= 1
1141
1141
 
1142
- def test_shape_ratio(self):
1142
+ def test_stress_ratio(self):
1143
1143
  S = Stress3.from_ratio(r=0.5, mag=1)
1144
- assert 0 <= S.shape_ratio <= 1
1144
+ assert 0 <= S.stress_ratio <= 1
1145
+
1146
+ def test_stress_ratio_structural_definition(self):
1147
+ # R = (s2 - s3) / (s1 - s3)
1148
+ S = Stress3([[8, 0, 0], [0, 5, 0], [0, 0, 1]])
1149
+ assert math.isclose(S.stress_ratio, 4 / 7)
1150
+
1151
+ def test_from_ratio_roundtrip(self):
1152
+ for convention in ("geological", "mechanical"):
1153
+ with apsg_conf_context(stress_convention=convention):
1154
+ for r in (0.0, 0.25, 0.5, 0.8, 1.0):
1155
+ S = Stress3.from_ratio(r=r, mag=10)
1156
+ assert math.isclose(S.stress_ratio, r, abs_tol=1e-12)
1145
1157
 
1146
1158
  def test_eigenlins(self):
1147
1159
  S = Stress3.from_comp(xx=5, yy=2, zz=-10, xy=1)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes