apsg 1.3.2__py3-none-any.whl → 1.3.4__py3-none-any.whl

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.
apsg/__init__.py CHANGED
@@ -98,6 +98,6 @@ __all__ = (
98
98
  "quicknet",
99
99
  )
100
100
 
101
- __version__ = "1.3.2"
101
+ __version__ = "1.3.4"
102
102
  __author__ = "Ondrej Lexa"
103
103
  __email__ = "lexa.ondrej@gmail.com"
apsg/database/_alchemy.py CHANGED
@@ -22,7 +22,6 @@ from sqlalchemy import (
22
22
  Table,
23
23
  Text,
24
24
  text,
25
- UniqueConstraint,
26
25
  )
27
26
  from sqlalchemy.orm import relationship
28
27
  from sqlalchemy.ext.declarative import declarative_base
@@ -35,7 +34,7 @@ class Meta(Base):
35
34
  __tablename__ = "meta"
36
35
 
37
36
  id = Column(Integer, primary_key=True, autoincrement=True)
38
- name = Column(String(16), nullable=False)
37
+ name = Column(String(16), nullable=False, unique=True)
39
38
  value = Column(Text)
40
39
 
41
40
  def __repr__(self):
@@ -47,7 +46,7 @@ class Site(Base):
47
46
 
48
47
  id = Column(Integer, primary_key=True, autoincrement=True)
49
48
  id_units = Column(ForeignKey("units.id"), nullable=False, index=True)
50
- name = Column(String(16), nullable=False)
49
+ name = Column(String(16), nullable=False, unique=True)
51
50
  x_coord = Column(Float, server_default=text("NULL"))
52
51
  y_coord = Column(Float, server_default=text("NULL"))
53
52
  description = Column(Text)
@@ -58,8 +57,6 @@ class Site(Base):
58
57
  "Structdata", back_populates="site", cascade="all, delete-orphan"
59
58
  )
60
59
 
61
- __table_args__ = (UniqueConstraint("name", name="_site_name_uc"),)
62
-
63
60
  def __repr__(self):
64
61
  return "Site:{} ({})".format(self.name, self.unit.name)
65
62
 
@@ -131,7 +128,7 @@ class Structype(Base):
131
128
 
132
129
  id = Column(Integer, primary_key=True, autoincrement=True)
133
130
  pos = Column(Integer, nullable=False, server_default=text("0"))
134
- structure = Column(String(16), nullable=False)
131
+ structure = Column(String(16), nullable=False, unique=True)
135
132
  description = Column(Text)
136
133
  structcode = Column(Integer, server_default=text("0"))
137
134
  groupcode = Column(Integer, server_default=text("0"))
@@ -139,8 +136,6 @@ class Structype(Base):
139
136
 
140
137
  structdata = relationship("Structdata", back_populates="structype")
141
138
 
142
- __table_args__ = (UniqueConstraint("structure", name="_structype_structure_uc"),)
143
-
144
139
  def __repr__(self):
145
140
  return "Type:{}".format(self.structure)
146
141
 
@@ -150,13 +145,11 @@ class Tag(Base):
150
145
 
151
146
  id = Column(Integer, primary_key=True, autoincrement=True)
152
147
  pos = Column(Integer, nullable=False, server_default=text("0"))
153
- name = Column(String(16), nullable=False)
148
+ name = Column(String(16), nullable=False, unique=True)
154
149
  description = Column(Text)
155
150
 
156
151
  structdata = relationship("Structdata", secondary=tagged, back_populates="tags")
157
152
 
158
- __table_args__ = (UniqueConstraint("name", name="_tag_name_uc"),)
159
-
160
153
  def __repr__(self):
161
154
  return "Tag:{}".format(self.name)
162
155
 
@@ -166,13 +159,11 @@ class Unit(Base):
166
159
 
167
160
  id = Column(Integer, primary_key=True, autoincrement=True)
168
161
  pos = Column(Integer, nullable=False, server_default=text("0"))
169
- name = Column(String(60), nullable=False)
162
+ name = Column(String(60), nullable=False, unique=True)
170
163
  description = Column(Text)
171
164
 
172
165
  sites = relationship("Site", back_populates="unit")
173
166
 
174
- __table_args__ = (UniqueConstraint("name", name="_unit_name_uc"),)
175
-
176
167
  def __repr__(self):
177
168
  return "Unit:{}".format(self.name)
178
169
 
apsg/database/_sdbread.py CHANGED
@@ -94,6 +94,13 @@ class SDB(object):
94
94
  raise
95
95
 
96
96
  def info(self, report="basic"):
97
+ """
98
+ PySDB database report
99
+
100
+ Args:
101
+ report (str): type of report. `basic`, `data` or `tags`. Default `basic`
102
+
103
+ """
97
104
  lines = []
98
105
  if report == "basic":
99
106
  lines.append("PySDB database version: {}".format(self.meta("version")))
@@ -111,7 +118,7 @@ class SDB(object):
111
118
  if len(r) > 0:
112
119
  lines.append("Number of {} measurements: {}".format(s, len(r)))
113
120
  elif report == "tags":
114
- for s in self.structures():
121
+ for s in self.tags():
115
122
  r = self.execsql(self._make_select(tags=s))
116
123
  if len(r) > 0:
117
124
  lines.append("{} measurements tagged as {}.".format(len(r), s))
@@ -26,14 +26,18 @@ class Projection:
26
26
  if self.hemisphere == "upper":
27
27
  X, Y = self._project(-x, -y, -z)
28
28
  if clip_inside:
29
- outside = X * X + Y * Y > 1.0
29
+ outside = np.logical_and(
30
+ X * X + Y * Y > 1.0, ~np.isclose(X * X + Y * Y, 1)
31
+ )
30
32
  X[outside] = np.nan
31
33
  Y[outside] = np.nan
32
34
  return -X, -Y
33
35
  else:
34
36
  X, Y = self._project(x, y, z)
35
37
  if clip_inside:
36
- outside = X * X + Y * Y > 1.0
38
+ outside = np.logical_and(
39
+ X * X + Y * Y > 1.0, ~np.isclose(X * X + Y * Y, 1)
40
+ )
37
41
  X[outside] = np.nan
38
42
  Y[outside] = np.nan
39
43
  return X, Y
@@ -44,8 +48,12 @@ class Projection:
44
48
  X1, Y1 = self._project(x, y, z)
45
49
  X2, Y2 = self._project(-x, -y, -z)
46
50
  if clip_inside:
47
- outside1 = X1 * X1 + Y1 * Y1 > 1.0
48
- outside2 = X2 * X2 + Y2 * Y2 > 1.0
51
+ outside1 = np.logical_and(
52
+ X1 * X1 + Y1 * Y1 > 1.0, ~np.isclose(X1 * X1 + Y1 * Y1, 1)
53
+ )
54
+ outside2 = np.logical_and(
55
+ X2 * X2 + Y2 * Y2 > 1.0, ~np.isclose(X2 * X2 + Y2 * Y2, 1)
56
+ )
49
57
  X1[outside1] = np.nan
50
58
  Y1[outside1] = np.nan
51
59
  X2[outside2] = np.nan
@@ -939,6 +939,7 @@ def quicknet(*args, **kwargs):
939
939
  savefig_kwargs (dict): dict passed to ``plt.savefig``
940
940
  fol_as_pole (bool): True to plot planar features as poles,
941
941
  False for plotting as great circle. Default `False`
942
+ Additional kwargs are passed to StereoNet method
942
943
 
943
944
  Example:
944
945
  >>> l = linset.random_fisher(position=lin(120, 50))
@@ -949,39 +950,39 @@ def quicknet(*args, **kwargs):
949
950
  filename = kwargs.get("filename", "stereonet.png")
950
951
  savefig_kwargs = kwargs.get("savefig_kwargs", {})
951
952
  fol_as_pole = kwargs.get("fol_as_pole", False)
952
- label = kwargs.get("label", "_nolegend_")
953
+ kwargs["label"] = kwargs.get("label", "_nolegend_")
953
954
  s = StereoNet(**kwargs)
954
955
  for arg in args:
955
956
  if isinstance(arg, Vector3):
956
957
  if isinstance(arg, Foliation):
957
958
  if fol_as_pole:
958
- s.pole(arg, label=label)
959
+ s.pole(arg, **kwargs)
959
960
  else:
960
- s.great_circle(arg, label=label)
961
+ s.great_circle(arg, **kwargs)
961
962
  elif isinstance(arg, Lineation):
962
- s.line(arg, label=label)
963
+ s.line(arg, **kwargs)
963
964
  else:
964
- s.vector(arg, label=label)
965
+ s.vector(arg, **kwargs)
965
966
  elif isinstance(arg, Fault):
966
- s.fault(arg, label=label)
967
+ s.fault(arg, **kwargs)
967
968
  elif isinstance(arg, Pair):
968
- s.pair(arg, label=label)
969
+ s.pair(arg, **kwargs)
969
970
  elif isinstance(arg, Cone):
970
- s.cone(arg, label=label)
971
+ s.cone(arg, **kwargs)
971
972
  elif isinstance(arg, Vector3Set):
972
973
  if isinstance(arg, FoliationSet):
973
974
  if fol_as_pole:
974
- s.pole(arg, label=label)
975
+ s.pole(arg, **kwargs)
975
976
  else:
976
- s.great_circle(arg, label=label)
977
+ s.great_circle(arg, **kwargs)
977
978
  elif isinstance(arg, LineationSet):
978
- s.line(arg, label=label)
979
+ s.line(arg, **kwargs)
979
980
  else:
980
- s.vector(arg, label=label)
981
+ s.vector(arg, **kwargs)
981
982
  elif isinstance(arg, FaultSet):
982
- s.fault(arg, label=label)
983
+ s.fault(arg, **kwargs)
983
984
  elif isinstance(arg, PairSet):
984
- s.pair(arg, label=label)
985
+ s.pair(arg, **kwargs)
985
986
  else:
986
987
  print(f"{type(arg)} not supported.")
987
988
  if savefig:
apsg/shell.py CHANGED
@@ -6,8 +6,6 @@
6
6
  Run the interactive shell.
7
7
  """
8
8
 
9
-
10
- import pkg_resources
11
9
  import code
12
10
 
13
11
  try:
@@ -15,14 +13,16 @@ try:
15
13
  except ImportError:
16
14
  pass
17
15
 
18
- from pylab import * # NOQA
16
+ import numpy as np
17
+ import matplotlib.pyplot as plt
18
+ import apsg
19
19
  from apsg import * # NOQA
20
20
 
21
21
 
22
22
  def main():
23
23
  banner = "+----------------------------------------------------------+\n"
24
24
  banner += " APSG toolbox "
25
- banner += pkg_resources.require("apsg")[0].version
25
+ banner += apsg.__version__
26
26
  banner += " - http://ondrolexa.github.io/apsg\n"
27
27
  banner += "+----------------------------------------------------------+"
28
28
  vars = globals().copy()
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: apsg
3
- Version: 1.3.2
3
+ Version: 1.3.4
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>
@@ -67,6 +67,7 @@ Requires-Dist: readthedocs-sphinx-search; extra == "dev"
67
67
  Requires-Dist: ipykernel; extra == "dev"
68
68
  Requires-Dist: nbsphinx; extra == "dev"
69
69
  Requires-Dist: autodocsumm; extra == "dev"
70
+ Dynamic: license-file
70
71
 
71
72
  <img src="https://ondrolexa.github.io/apsg/apsg_banner.svg" alt="APSG logo" width="300px"/>
72
73
 
@@ -1,9 +1,9 @@
1
- apsg/__init__.py,sha256=0HF522QDBElQju1ab_cwS3U0p00ZRfvzITYnTBRNDa4,1966
1
+ apsg/__init__.py,sha256=-6B9IAuTnyKs_jwpjcUz4lRL5QvrcH1pzUyazuh5gwc,1966
2
2
  apsg/config.py,sha256=X3_yXT96xXlVxFA94EfYFKJbrcGIHT0PvB9s8EKmYOg,4569
3
- apsg/shell.py,sha256=UFIOy01KckLsOlqfB0UomyWZ1ITL36-lBUFhlxWdZLE,718
3
+ apsg/shell.py,sha256=1D0PeB7qXzlpiOf2QYGo6OJlEVN1KJPYld1GEREBiFg,707
4
4
  apsg/database/__init__.py,sha256=7Rvcf1KBBBNhoM28ZlvQ01CkScQTroFkoS4d1kD55Ws,315
5
- apsg/database/_alchemy.py,sha256=cs8un4RJwUoE62GOberiTIQ2akFXYM0FoR-f1h4_DW8,19726
6
- apsg/database/_sdbread.py,sha256=Gzj0bpp0vnMvCfxIuX6Ktf01LoQWDCOcXST7HZp_XTY,10868
5
+ apsg/database/_alchemy.py,sha256=geV3Q6ZLdGvjzxry7GTHHIQq6t_ccsUxZvuv13CLYFQ,19467
6
+ apsg/database/_sdbread.py,sha256=EP0hSp6_4-DZZptkMNDgKnQ3GD58mpr_SAgFohKu6xQ,11017
7
7
  apsg/decorator/__init__.py,sha256=fZ-dxpldQIk6-2JhVnCj-Tsl8bz2nvoGOyG7uXKvBfg,160
8
8
  apsg/decorator/_decorator.py,sha256=8TMSrcVvhU5UCbNMrnyrW3-65qo20_6N2ShtXd3bP-k,1194
9
9
  apsg/feature/__init__.py,sha256=XGLq3GXpiWtzX6ROtuSc0kCPJEPTVRoIUtr8VpRZOWI,1664
@@ -26,13 +26,13 @@ apsg/plotting/__init__.py,sha256=immav5OfKhYlOGZWUsFjuBp7k71vr2xLYygQkO6Oimc,627
26
26
  apsg/plotting/_fabricplot.py,sha256=yjy3DEhIZfq448FYKnQb3EhqLm9-f-EZHJEamG98k9Q,18858
27
27
  apsg/plotting/_paleomagplots.py,sha256=Gw-fqYJVjNxTNXLwAiUKnFUBoOTZv2MEd3XACLmQ6AM,2325
28
28
  apsg/plotting/_plot_artists.py,sha256=6S0EKCqYU6rlBxcxcXALTk9PaUK6QL-BgUKmZH8tkMc,21059
29
- apsg/plotting/_projection.py,sha256=qnJgTQaFW0v2Pu9ySAEPADHhLgpXmfJ6QIrydry8rXQ,11473
29
+ apsg/plotting/_projection.py,sha256=ix67PwOU2WGjryEcsHlVIMpcVC9yxy45ycOV9k5x_Q8,11805
30
30
  apsg/plotting/_roseplot.py,sha256=jbaUXSb3DIcXs0pWAQUTZfdlA2XcbquT0yHLYDjLirQ,12808
31
31
  apsg/plotting/_stereogrid.py,sha256=awh7MwN1WgszhOlr6UgR20wHQJ8u778-Tf_w1uflrV4,11869
32
- apsg/plotting/_stereonet.py,sha256=-BFM9RCInI-RYs1DKz-ymNFkMFJLTWuw3JcyUs7YiGM,36596
33
- apsg-1.3.2.dist-info/LICENSE,sha256=lY0kfpVRrzcgVZq7pI6rLK5WYiUMWe0bdKpDelN6hk8,1120
34
- apsg-1.3.2.dist-info/METADATA,sha256=RtbuiUnWF0ArtuePgaLRg3Ve7kMPT3e6RJFHzZZKKhI,8276
35
- apsg-1.3.2.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
36
- apsg-1.3.2.dist-info/entry_points.txt,sha256=SowP7_uRI0NJuzznKBXyM9BJcSwBxbXo6Iz5LUo9mEQ,42
37
- apsg-1.3.2.dist-info/top_level.txt,sha256=xWxwi0nqqOyKdmpsszfR-bmqnNpgVbhnLRuIKGJnaUM,5
38
- apsg-1.3.2.dist-info/RECORD,,
32
+ apsg/plotting/_stereonet.py,sha256=uHJXluFMkeaI4yzD9pGc4DIlgjZA01INySLKtUHLAlU,36624
33
+ apsg-1.3.4.dist-info/licenses/LICENSE,sha256=lY0kfpVRrzcgVZq7pI6rLK5WYiUMWe0bdKpDelN6hk8,1120
34
+ apsg-1.3.4.dist-info/METADATA,sha256=7HV-9ufjlab_qZ0vL3D-Il9UObgVg_FTRUfOZxGmENY,8298
35
+ apsg-1.3.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ apsg-1.3.4.dist-info/entry_points.txt,sha256=SowP7_uRI0NJuzznKBXyM9BJcSwBxbXo6Iz5LUo9mEQ,42
37
+ apsg-1.3.4.dist-info/top_level.txt,sha256=xWxwi0nqqOyKdmpsszfR-bmqnNpgVbhnLRuIKGJnaUM,5
38
+ apsg-1.3.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5