apsg 1.1.5__tar.gz → 1.2.1__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 (67) hide show
  1. {apsg-1.1.5 → apsg-1.2.1}/HISTORY.md +7 -0
  2. {apsg-1.1.5 → apsg-1.2.1}/PKG-INFO +10 -2
  3. {apsg-1.1.5 → apsg-1.2.1}/docs/conf.py +2 -2
  4. {apsg-1.1.5 → apsg-1.2.1}/setup.cfg +1 -1
  5. {apsg-1.1.5 → apsg-1.2.1}/setup.py +3 -3
  6. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/__init__.py +1 -1
  7. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/feature/_container.py +16 -4
  8. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/feature/_geodata.py +40 -11
  9. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/plotting/_stereonet.py +7 -7
  10. {apsg-1.1.5 → apsg-1.2.1}/src/apsg.egg-info/PKG-INFO +10 -2
  11. {apsg-1.1.5 → apsg-1.2.1}/src/apsg.egg-info/requires.txt +2 -1
  12. {apsg-1.1.5 → apsg-1.2.1}/AUTHORS.md +0 -0
  13. {apsg-1.1.5 → apsg-1.2.1}/CONTRIBUTING.md +0 -0
  14. {apsg-1.1.5 → apsg-1.2.1}/LICENSE +0 -0
  15. {apsg-1.1.5 → apsg-1.2.1}/MANIFEST.in +0 -0
  16. {apsg-1.1.5 → apsg-1.2.1}/README.md +0 -0
  17. {apsg-1.1.5 → apsg-1.2.1}/docs/Makefile +0 -0
  18. {apsg-1.1.5 → apsg-1.2.1}/docs/apsg.database.rst +0 -0
  19. {apsg-1.1.5 → apsg-1.2.1}/docs/apsg.feature.rst +0 -0
  20. {apsg-1.1.5 → apsg-1.2.1}/docs/apsg.helpers.rst +0 -0
  21. {apsg-1.1.5 → apsg-1.2.1}/docs/apsg.math.rst +0 -0
  22. {apsg-1.1.5 → apsg-1.2.1}/docs/apsg.pandas.rst +0 -0
  23. {apsg-1.1.5 → apsg-1.2.1}/docs/apsg.plotting.rst +0 -0
  24. {apsg-1.1.5 → apsg-1.2.1}/docs/authors.rst +0 -0
  25. {apsg-1.1.5 → apsg-1.2.1}/docs/automodules.rst +0 -0
  26. {apsg-1.1.5 → apsg-1.2.1}/docs/contributing.rst +0 -0
  27. {apsg-1.1.5 → apsg-1.2.1}/docs/index.rst +0 -0
  28. {apsg-1.1.5 → apsg-1.2.1}/docs/installation.rst +0 -0
  29. {apsg-1.1.5 → apsg-1.2.1}/docs/make.bat +0 -0
  30. {apsg-1.1.5 → apsg-1.2.1}/docs/tutorials.rst +0 -0
  31. {apsg-1.1.5 → apsg-1.2.1}/pyproject.toml +0 -0
  32. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/config.py +0 -0
  33. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/database/__init__.py +0 -0
  34. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/database/_alchemy.py +0 -0
  35. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/database/_sdbread.py +0 -0
  36. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/decorator/__init__.py +0 -0
  37. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/decorator/_decorator.py +0 -0
  38. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/feature/__init__.py +0 -0
  39. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/feature/_paleomag.py +0 -0
  40. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/feature/_statistics.py +0 -0
  41. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/feature/_tensor2.py +0 -0
  42. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/feature/_tensor3.py +0 -0
  43. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/helpers/__init__.py +0 -0
  44. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/helpers/_helper.py +0 -0
  45. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/helpers/_math.py +0 -0
  46. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/helpers/_notation.py +0 -0
  47. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/math/__init__.py +0 -0
  48. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/math/_matrix.py +0 -0
  49. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/math/_vector.py +0 -0
  50. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/pandas/__init__.py +0 -0
  51. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/pandas/_pandas_api.py +0 -0
  52. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/plotting/__init__.py +0 -0
  53. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/plotting/_fabricplot.py +0 -0
  54. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/plotting/_paleomagplots.py +0 -0
  55. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/plotting/_plot_artists.py +0 -0
  56. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/plotting/_projection.py +0 -0
  57. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/plotting/_roseplot.py +0 -0
  58. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/plotting/_stereogrid.py +0 -0
  59. {apsg-1.1.5 → apsg-1.2.1}/src/apsg/shell.py +0 -0
  60. {apsg-1.1.5 → apsg-1.2.1}/src/apsg.egg-info/SOURCES.txt +0 -0
  61. {apsg-1.1.5 → apsg-1.2.1}/src/apsg.egg-info/dependency_links.txt +0 -0
  62. {apsg-1.1.5 → apsg-1.2.1}/src/apsg.egg-info/entry_points.txt +0 -0
  63. {apsg-1.1.5 → apsg-1.2.1}/src/apsg.egg-info/top_level.txt +0 -0
  64. {apsg-1.1.5 → apsg-1.2.1}/tests/__init__.py +0 -0
  65. {apsg-1.1.5 → apsg-1.2.1}/tests/conftest.py +0 -0
  66. {apsg-1.1.5 → apsg-1.2.1}/tests/test_apsg.py +0 -0
  67. {apsg-1.1.5 → apsg-1.2.1}/tests/test_tensors.py +0 -0
@@ -1,5 +1,12 @@
1
1
  # Changes
2
2
 
3
+ ### 1.2.1 (Sep 23 2024)
4
+ * Fault sense could be defined by str, one of 's', 'd', 'n' and 'r'
5
+
6
+ ### 1.2.0 (May 24 2024)
7
+ * sqlalchemy and pandas added to requirements
8
+ * quicknet fault bug fixed
9
+
3
10
  ### 1.1.5 (May 15 2024)
4
11
  * paleomag Core .dd bug fixed
5
12
  * fix round-off domain math error for acosd and asind
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apsg
3
- Version: 1.1.5
3
+ Version: 1.2.1
4
4
  Summary: APSG - The package for structural geologists
5
5
  Home-page: https://github.com/ondrolexa/apsg
6
6
  Author: Ondrej Lexa
@@ -23,6 +23,8 @@ License-File: AUTHORS.md
23
23
  Requires-Dist: numpy
24
24
  Requires-Dist: matplotlib
25
25
  Requires-Dist: scipy
26
+ Requires-Dist: sqlalchemy
27
+ Requires-Dist: pandas
26
28
  Provides-Extra: docs
27
29
  Requires-Dist: sphinx; extra == "docs"
28
30
  Requires-Dist: ipykernel; extra == "docs"
@@ -32,7 +34,6 @@ Requires-Dist: pytest; extra == "test"
32
34
  Requires-Dist: black; extra == "test"
33
35
  Provides-Extra: extra
34
36
  Requires-Dist: jupyterlab; extra == "extra"
35
- Requires-Dist: pandas; extra == "extra"
36
37
 
37
38
  <img src="https://ondrolexa.github.io/apsg/apsg_banner.svg" alt="APSG logo" width="300px"/>
38
39
 
@@ -139,6 +140,13 @@ APSG is free software: you can redistribute it and/or modify it under the terms
139
140
 
140
141
  # Changes
141
142
 
143
+ ### 1.2.1 (Sep 23 2024)
144
+ * Fault sense could be defined by str, one of 's', 'd', 'n' and 'r'
145
+
146
+ ### 1.2.0 (May 24 2024)
147
+ * sqlalchemy and pandas added to requirements
148
+ * quicknet fault bug fixed
149
+
142
150
  ### 1.1.5 (May 15 2024)
143
151
  * paleomag Core .dd bug fixed
144
152
  * fix round-off domain math error for acosd and asind
@@ -69,9 +69,9 @@ copyright = "2023, Ondrej Lexa"
69
69
  # the built documents.
70
70
  #
71
71
  # The short X.Y version.
72
- version = "1.1"
72
+ version = "1.2"
73
73
  # The full version, including alpha/beta/rc tags.
74
- release = "1.1.5"
74
+ release = "1.2.1"
75
75
 
76
76
  # The language for content autogenerated by Sphinx. Refer to documentation
77
77
  # for a list of supported languages.
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 1.1.5
2
+ current_version = 1.2.1
3
3
  commit = False
4
4
  tag = False
5
5
 
@@ -17,7 +17,7 @@ with open(path.join(CURRENT_PATH, "HISTORY.md")) as file:
17
17
 
18
18
  setup(
19
19
  name="apsg",
20
- version="1.1.5",
20
+ version="1.2.1",
21
21
  description="APSG - The package for structural geologists",
22
22
  long_description=readme + "\n\n" + history,
23
23
  long_description_content_type="text/markdown",
@@ -37,11 +37,11 @@ setup(
37
37
  ],
38
38
  packages=find_packages(where="src"),
39
39
  package_dir={"": "src"},
40
- install_requires=["numpy", "matplotlib", "scipy"],
40
+ install_requires=["numpy", "matplotlib", "scipy", "sqlalchemy", "pandas"],
41
41
  extras_require={
42
42
  "docs": ["sphinx", "ipykernel", "nbsphinx"],
43
43
  "test": ["pytest", "black"],
44
- "extra": ["jupyterlab", "pandas"],
44
+ "extra": ["jupyterlab"],
45
45
  },
46
46
  project_urls={
47
47
  "Documentation": "https://apsg.readthedocs.io/",
@@ -98,6 +98,6 @@ __all__ = (
98
98
  "quicknet",
99
99
  )
100
100
 
101
- __version__ = "1.1.5"
101
+ __version__ = "1.2.1"
102
102
  __author__ = "Ondrej Lexa"
103
103
  __email__ = "lexa.ondrej@gmail.com"
@@ -1563,6 +1563,18 @@ class ClusterSet(object):
1563
1563
  Provides a hierarchical clustering using `scipy.cluster` routines.
1564
1564
  The distance matrix is calculated as an angle between features, where ``Foliation``
1565
1565
  and ``Lineation`` use axial angles while ``Vector3`` uses direction angles.
1566
+
1567
+ Args:
1568
+ azi (float): plunge direction of linear feature in degrees
1569
+ inc (float): plunge of linear feature in degrees
1570
+
1571
+ Keyword Args:
1572
+ maxclust (int): Desired number of clusters. Default 2
1573
+ angle (float): Forms flat clusters so that the original observations in each
1574
+ cluster have no greater angle. Default is None to use maxclust criterion.
1575
+ method (str): Method for calculating the distance between the newly formed
1576
+ cluster and observations. Default is 'average' for UPGMA algorithm
1577
+
1566
1578
  """
1567
1579
 
1568
1580
  def __init__(self, d, **kwargs):
@@ -1580,13 +1592,13 @@ class ClusterSet(object):
1580
1592
  def __repr__(self):
1581
1593
  info = f"Already {len(self.groups)} clusters created."
1582
1594
  if self.angle is not None:
1583
- crit = "Criterion: Angle\nSettings: distance=%.4g\n" % (self.angle)
1595
+ crit = f"Criterion: Angle\nSettings: distance={self.angle:.4g}\n"
1584
1596
  else:
1585
- crit = "Criterion: Maxclust\nSettings: muxclust=%.4g\n" % (self.maxclust)
1597
+ crit = f"Criterion: Maxclust\nSettings: maxclust={self.maxclust:.4g}\n"
1586
1598
  return (
1587
1599
  "ClusterSet\n"
1588
- + "Number of data: %d\n" % len(self.data)
1589
- + "Linkage method: %s\n" % self.method
1600
+ + f"Number of data: {len(self.data)}\n"
1601
+ + f"Linkage method: {self.method}\n"
1590
1602
  + crit
1591
1603
  + info
1592
1604
  )
@@ -367,8 +367,9 @@ class Fault(Pair):
367
367
  - `p` could be Fault
368
368
  - `p` could be tuple of (fazi, finc, lazi, linc, sense)
369
369
  - `p` could be tuple of (fx, fy ,fz, lx, ly, lz)
370
- - with 2 arguments f and l could be Vector3 like objects,
371
- e.g. ``Foliation`` and ``Lineation``
370
+ - with 2 arguments p (Pair object) and sense
371
+ - with 3 arguments f, l (Vector3 like objects), e.g. ``Foliation``
372
+ and ``Lineation`` and sense
372
373
  - with 5 numerical arguments defining `fol(fazi, finc)`, `lin(lazi, linc)` and sense
373
374
 
374
375
  Args:
@@ -376,7 +377,9 @@ class Fault(Pair):
376
377
  finc (float): dip of planar feature in degrees
377
378
  lazi (float): plunge direction of linear feature in degrees
378
379
  linc (float): plunge of linear feature in degrees
379
- sense (float): sense of movement -/+1 hanging-wall up/down reverse/normal
380
+ sense (float or str): sense of movement +/11 hanging-wall down/up. When str,
381
+ ,ust be one of 's', 'd', 'n', 'r'.
382
+
380
383
 
381
384
  Attributes:
382
385
  fvec (Vector3): corrected vector normal to plane
@@ -384,11 +387,11 @@ class Fault(Pair):
384
387
  sense (int): sense of movement (+/-1)
385
388
 
386
389
  Example:
387
- >>> fault()
388
- >>> fault(p)
389
- >>> fault(f, l)
390
- >>> fault(fazi, finc, lazi, linc, sense)
391
390
  >>> f = fault(140, 30, 110, 26, -1)
391
+ >>> f = fault(140, 30, 110, 26, 'r')
392
+ >>> p = pair(140, 30, 110, 26)
393
+ >>> f = fault(p, 'n')
394
+ >>> f = fault(fol(120, 80), lin(32, 10), 's')
392
395
 
393
396
  """
394
397
 
@@ -396,18 +399,20 @@ class Fault(Pair):
396
399
 
397
400
  def __init__(self, *args):
398
401
  if len(args) == 0:
399
- fvec, lvec, sense = Vector3(0, 0, 1), Vector3(1, 0, 0), 1
402
+ fvec, lvec = Vector3(0, 0, 1), Vector3(1, 0, 0)
400
403
  elif len(args) == 1 and np.asarray(args[0]).shape == (5,):
401
404
  fazi, finc, lazi, linc, sense = (float(v) for v in args[0])
402
405
  fvec, lvec = Foliation(fazi, finc), Lineation(lazi, linc)
406
+ sense = self.calc_sense(fvec, lvec, sense)
403
407
  if sense < 0:
404
408
  lvec = -lvec
405
409
  elif len(args) == 1 and issubclass(type(args[0]), Pair):
406
410
  fvec, lvec = args[0].fvec, args[0].lvec
407
411
  elif len(args) == 2 and issubclass(type(args[0]), Pair):
408
412
  fvec, lvec = args[0].fvec, args[0].lvec
413
+ sense = self.calc_sense(fvec, lvec, args[1])
409
414
  georax = lvec.lower().cross(fvec.lower())
410
- if args[0].rax == georax and args[1] < 0:
415
+ if args[0].rax == georax and sense < 0:
411
416
  lvec = -lvec
412
417
  elif len(args) == 2:
413
418
  if issubclass(type(args[0]), Vector3) and issubclass(
@@ -419,19 +424,43 @@ class Fault(Pair):
419
424
  type(args[1]), Vector3
420
425
  ):
421
426
  fvec, lvec = args[0], args[1]
427
+ sense = self.calc_sense(fvec, lvec, args[2])
422
428
  rax = lvec.cross(fvec)
423
429
  georax = lvec.lower().cross(fvec.lower())
424
- if rax == georax and args[2] < 0:
430
+ if rax == georax and sense < 0:
425
431
  lvec = -lvec
426
432
  elif len(args) == 5:
427
433
  fvec = Foliation(args[0], args[1])
428
434
  lvec = Lineation(args[2], args[3])
429
- if args[4] < 0:
435
+ sense = self.calc_sense(fvec, lvec, args[4])
436
+ if sense < 0:
430
437
  lvec = -lvec
431
438
  else:
432
439
  raise TypeError("Not valid arguments for Fault")
433
440
  super().__init__(fvec, lvec)
434
441
 
442
+ @classmethod
443
+ def calc_sense(cls, fvec, lvec, sense):
444
+ if isinstance(sense, int) or isinstance(sense, float):
445
+ return sense
446
+ elif isinstance(sense, str):
447
+ p = Pair(fvec, lvec)
448
+ if sense.lower() == "s":
449
+ if p.rax == p.rax.lower():
450
+ res = -1
451
+ else:
452
+ res = 1
453
+ elif sense.lower() == "d":
454
+ if p.rax == p.rax.lower():
455
+ res = 1
456
+ else:
457
+ res = -1
458
+ elif sense.lower() == "n":
459
+ res = 1
460
+ elif sense.lower() == "r":
461
+ res = -1
462
+ return res
463
+
435
464
  def __repr__(self):
436
465
  fazi, finc = self.fol.geo
437
466
  lazi, linc = self.lin.geo
@@ -940,17 +940,17 @@ def quicknet(*args, **kwargs):
940
940
  filename (str): filename for figure. Default `stereonet.png`
941
941
  savefig_kwargs (dict): dict passed to ``plt.savefig``
942
942
  fol_as_pole (bool): True to plot planar features as poles,
943
- False for plotting as great circle. Default `True`
943
+ False for plotting as great circle. Default `False`
944
944
 
945
945
  Example:
946
946
  >>> l = linset.random_fisher(position=lin(120, 50))
947
947
  >>> f = folset.random_fisher(position=lin(300, 40))
948
- >>> quicknet(f, l, fol_as_pole=False)
948
+ >>> quicknet(f, l)
949
949
  """
950
950
  savefig = kwargs.get("savefig", False)
951
951
  filename = kwargs.get("filename", "stereonet.png")
952
952
  savefig_kwargs = kwargs.get("savefig_kwargs", {})
953
- fol_as_pole = kwargs.get("fol_as_pole", True)
953
+ fol_as_pole = kwargs.get("fol_as_pole", False)
954
954
  s = StereoNet(**kwargs)
955
955
  for arg in args:
956
956
  if isinstance(arg, Vector3):
@@ -963,10 +963,10 @@ def quicknet(*args, **kwargs):
963
963
  s.line(arg)
964
964
  else:
965
965
  s.vector(arg)
966
- elif isinstance(arg, Pair):
967
- s.pair(arg)
968
966
  elif isinstance(arg, Fault):
969
967
  s.fault(arg)
968
+ elif isinstance(arg, Pair):
969
+ s.pair(arg)
970
970
  elif isinstance(arg, Cone):
971
971
  s.cone(arg)
972
972
  elif isinstance(arg, Vector3Set):
@@ -979,10 +979,10 @@ def quicknet(*args, **kwargs):
979
979
  s.line(arg)
980
980
  else:
981
981
  s.vector(arg)
982
- elif isinstance(arg, PairSet):
983
- s.pair(arg)
984
982
  elif isinstance(arg, FaultSet):
985
983
  s.fault(arg)
984
+ elif isinstance(arg, PairSet):
985
+ s.pair(arg)
986
986
  else:
987
987
  print(f"{type(arg)} not supported.")
988
988
  if savefig:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apsg
3
- Version: 1.1.5
3
+ Version: 1.2.1
4
4
  Summary: APSG - The package for structural geologists
5
5
  Home-page: https://github.com/ondrolexa/apsg
6
6
  Author: Ondrej Lexa
@@ -23,6 +23,8 @@ License-File: AUTHORS.md
23
23
  Requires-Dist: numpy
24
24
  Requires-Dist: matplotlib
25
25
  Requires-Dist: scipy
26
+ Requires-Dist: sqlalchemy
27
+ Requires-Dist: pandas
26
28
  Provides-Extra: docs
27
29
  Requires-Dist: sphinx; extra == "docs"
28
30
  Requires-Dist: ipykernel; extra == "docs"
@@ -32,7 +34,6 @@ Requires-Dist: pytest; extra == "test"
32
34
  Requires-Dist: black; extra == "test"
33
35
  Provides-Extra: extra
34
36
  Requires-Dist: jupyterlab; extra == "extra"
35
- Requires-Dist: pandas; extra == "extra"
36
37
 
37
38
  <img src="https://ondrolexa.github.io/apsg/apsg_banner.svg" alt="APSG logo" width="300px"/>
38
39
 
@@ -139,6 +140,13 @@ APSG is free software: you can redistribute it and/or modify it under the terms
139
140
 
140
141
  # Changes
141
142
 
143
+ ### 1.2.1 (Sep 23 2024)
144
+ * Fault sense could be defined by str, one of 's', 'd', 'n' and 'r'
145
+
146
+ ### 1.2.0 (May 24 2024)
147
+ * sqlalchemy and pandas added to requirements
148
+ * quicknet fault bug fixed
149
+
142
150
  ### 1.1.5 (May 15 2024)
143
151
  * paleomag Core .dd bug fixed
144
152
  * fix round-off domain math error for acosd and asind
@@ -1,6 +1,8 @@
1
1
  numpy
2
2
  matplotlib
3
3
  scipy
4
+ sqlalchemy
5
+ pandas
4
6
 
5
7
  [docs]
6
8
  sphinx
@@ -9,7 +11,6 @@ nbsphinx
9
11
 
10
12
  [extra]
11
13
  jupyterlab
12
- pandas
13
14
 
14
15
  [test]
15
16
  pytest
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
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