pygeodesy 24.8.24__py2.py3-none-any.whl → 24.9.24__py2.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.
- {PyGeodesy-24.8.24.dist-info → PyGeodesy-24.9.24.dist-info}/METADATA +7 -7
- {PyGeodesy-24.8.24.dist-info → PyGeodesy-24.9.24.dist-info}/RECORD +49 -48
- pygeodesy/__init__.py +7 -5
- pygeodesy/__main__.py +46 -47
- pygeodesy/auxilats/_CX_4.py +104 -181
- pygeodesy/auxilats/_CX_6.py +152 -277
- pygeodesy/auxilats/_CX_8.py +211 -438
- pygeodesy/auxilats/_CX_Rs.py +222 -0
- pygeodesy/auxilats/__init__.py +2 -2
- pygeodesy/auxilats/__main__.py +30 -38
- pygeodesy/auxilats/auxLat.py +28 -36
- pygeodesy/auxilats/auxily.py +30 -50
- pygeodesy/basics.py +24 -14
- pygeodesy/booleans.py +13 -14
- pygeodesy/clipy.py +7 -7
- pygeodesy/constants.py +44 -31
- pygeodesy/deprecated/__init__.py +1 -1
- pygeodesy/deprecated/functions.py +9 -1
- pygeodesy/elliptic.py +154 -88
- pygeodesy/errors.py +32 -5
- pygeodesy/etm.py +71 -59
- pygeodesy/fmath.py +125 -96
- pygeodesy/fstats.py +8 -12
- pygeodesy/fsums.py +802 -355
- pygeodesy/geodesici.py +6 -5
- pygeodesy/geodesicx/_C4_24.py +1 -3
- pygeodesy/geodesicx/_C4_27.py +1 -3
- pygeodesy/geodesicx/_C4_30.py +1 -3
- pygeodesy/geodesicx/__init__.py +1 -1
- pygeodesy/geodesicx/__main__.py +44 -46
- pygeodesy/geodesicx/gxarea.py +3 -3
- pygeodesy/geodesicx/gxbases.py +32 -18
- pygeodesy/internals.py +50 -9
- pygeodesy/interns.py +3 -2
- pygeodesy/karney.py +79 -60
- pygeodesy/ktm.py +4 -4
- pygeodesy/lazily.py +10 -5
- pygeodesy/mgrs.py +47 -42
- pygeodesy/named.py +4 -1
- pygeodesy/points.py +3 -3
- pygeodesy/props.py +7 -6
- pygeodesy/resections.py +2 -2
- pygeodesy/rhumb/__init__.py +1 -1
- pygeodesy/rhumb/aux_.py +42 -60
- pygeodesy/sphericalNvector.py +4 -4
- pygeodesy/sphericalTrigonometry.py +2 -2
- pygeodesy/triaxials.py +3 -3
- {PyGeodesy-24.8.24.dist-info → PyGeodesy-24.9.24.dist-info}/WHEEL +0 -0
- {PyGeodesy-24.8.24.dist-info → PyGeodesy-24.9.24.dist-info}/top_level.txt +0 -0
pygeodesy/elliptic.py
CHANGED
|
@@ -65,7 +65,8 @@ in U{B. C. Carlson, Computation of real or complex elliptic integrals
|
|
|
65
65
|
The computation of the Jacobi elliptic functions uses the algorithm
|
|
66
66
|
given in U{R. Bulirsch, Numerical Calculation of Elliptic Integrals
|
|
67
67
|
and Elliptic Functions<https://DOI.org/10.1007/BF01397975>},
|
|
68
|
-
Numerische Mathematik 7, 78--90 (1965)
|
|
68
|
+
Numerische Mathematik 7, 78--90 (1965) or optionally the C{Jacobi
|
|
69
|
+
amplitude} in method L{Elliptic.sncndn<pygeodesy.Elliptic.sncndn>}.
|
|
69
70
|
|
|
70
71
|
The notation follows U{NIST Digital Library of Mathematical Functions
|
|
71
72
|
<https://DLMF.NIST.gov>} chapters U{19<https://DLMF.NIST.gov/19>} and
|
|
@@ -75,13 +76,13 @@ U{22<https://DLMF.NIST.gov/22>}.
|
|
|
75
76
|
from __future__ import division as _; del _ # PYCHOK semicolon
|
|
76
77
|
|
|
77
78
|
from pygeodesy.basics import copysign0, map2, neg, neg_
|
|
78
|
-
from pygeodesy.constants import EPS, INF, NAN, PI, PI_2, PI_4, \
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
from pygeodesy.constants import EPS, INF, NAN, PI, PI_2, PI_4, _0_0, \
|
|
80
|
+
_0_25, _0_5, _1_0, _2_0, _N_2_0, _3_0, \
|
|
81
|
+
_4_0, _6_0, _8_0, _64_0, _180_0, _360_0, \
|
|
82
|
+
_EPStol as _TolJAC, _over, \
|
|
83
|
+
_EPSjam as _TolJAM # PYCHOK used!
|
|
83
84
|
# from pygeodesy.errors import _ValueError # from .fmath
|
|
84
|
-
from pygeodesy.fmath import
|
|
85
|
+
from pygeodesy.fmath import favg, hypot1, zqrt, _ValueError
|
|
85
86
|
from pygeodesy.fsums import Fsum, _sum
|
|
86
87
|
# from pygeodesy.internals import _dunder_nameof # from .lazily
|
|
87
88
|
from pygeodesy.interns import NN, _delta_, _DOT_, _f_, _invalid_, \
|
|
@@ -94,16 +95,16 @@ from pygeodesy.props import _allPropertiesOf_n, Property_RO, _update_all
|
|
|
94
95
|
from pygeodesy.units import Scalar, Scalar_
|
|
95
96
|
# from pygeodesy.utily import sincos2 as _sincos2 # from .karney
|
|
96
97
|
|
|
97
|
-
from math import asinh, atan, atan2, ceil, cosh, fabs, floor, \
|
|
98
|
-
radians, sin, sqrt, tanh
|
|
98
|
+
from math import asin, asinh, atan, atan2, ceil, cosh, fabs, floor, \
|
|
99
|
+
radians, sin, sinh, sqrt, tan, tanh
|
|
99
100
|
|
|
100
101
|
__all__ = _ALL_LAZY.elliptic
|
|
101
|
-
__version__ = '24.
|
|
102
|
+
__version__ = '24.09.06'
|
|
102
103
|
|
|
103
104
|
_TolRD = zqrt(EPS * 0.002)
|
|
104
105
|
_TolRF = zqrt(EPS * 0.030)
|
|
105
106
|
_TolRG0 = _TolJAC * 2.7
|
|
106
|
-
_TRIPS =
|
|
107
|
+
_TRIPS = 25 # Max depth, 6-7 might be sufficient
|
|
107
108
|
|
|
108
109
|
|
|
109
110
|
class _Cs(object):
|
|
@@ -127,6 +128,19 @@ class _Dsum(list):
|
|
|
127
128
|
return self
|
|
128
129
|
|
|
129
130
|
|
|
131
|
+
class _Dadd(_Dsum):
|
|
132
|
+
'''(INTERNAL) Deferred C{Fsum} for C{_List.amrs4}.
|
|
133
|
+
'''
|
|
134
|
+
def __init__(self, mul):
|
|
135
|
+
self._mul = mul
|
|
136
|
+
|
|
137
|
+
def __add__(self, x):
|
|
138
|
+
self += x
|
|
139
|
+
r = self(self._mul)
|
|
140
|
+
_ = self.pop()
|
|
141
|
+
return r # Fsum or float
|
|
142
|
+
|
|
143
|
+
|
|
130
144
|
class Elliptic(_Named):
|
|
131
145
|
'''Elliptic integrals and functions.
|
|
132
146
|
|
|
@@ -407,7 +421,6 @@ class Elliptic(_Named):
|
|
|
407
421
|
# Applied Math. and Computation 218, 7005-7013 (2012)
|
|
408
422
|
# <https://DOI.org/10.1016/j.amc.2011.12.021>
|
|
409
423
|
_Phi2 = Phi.fsum2f_ # aggregate
|
|
410
|
-
_abs = fabs
|
|
411
424
|
for i in range(1, _TRIPS): # GEOGRAPHICLIB_PANIC
|
|
412
425
|
sn, cn, dn = self._sncndn3(phi)
|
|
413
426
|
if dn:
|
|
@@ -415,7 +428,7 @@ class Elliptic(_Named):
|
|
|
415
428
|
phi, d = _Phi2((r - sn) / dn)
|
|
416
429
|
else: # PYCHOK no cover
|
|
417
430
|
d = _0_0 # XXX continue?
|
|
418
|
-
if
|
|
431
|
+
if fabs(d) < _TolJAC: # 3-4 trips
|
|
419
432
|
_iterations(self, i)
|
|
420
433
|
break
|
|
421
434
|
else: # PYCHOK no cover
|
|
@@ -505,7 +518,8 @@ class Elliptic(_Named):
|
|
|
505
518
|
return ei
|
|
506
519
|
|
|
507
520
|
return self._fXf(phi_or_sn, cn, dn, self.cE,
|
|
508
|
-
self.deltaE, _fE
|
|
521
|
+
self.deltaE, _fE,
|
|
522
|
+
k2_0=self.k2==0)
|
|
509
523
|
|
|
510
524
|
def fEd(self, deg):
|
|
511
525
|
'''The incomplete integral of the second kind with
|
|
@@ -561,7 +575,8 @@ class Elliptic(_Named):
|
|
|
561
575
|
return r
|
|
562
576
|
|
|
563
577
|
return self._fXf(phi_or_sn, cn, dn, self.cK,
|
|
564
|
-
self.deltaF, _fF
|
|
578
|
+
self.deltaF, _fF,
|
|
579
|
+
k2_0=self.k2==0, kp2_0=self.kp2==0)
|
|
565
580
|
|
|
566
581
|
def fG(self, phi_or_sn, cn=None, dn=None):
|
|
567
582
|
'''Legendre's geodesic longitude integral in terms of
|
|
@@ -648,12 +663,16 @@ class Elliptic(_Named):
|
|
|
648
663
|
|
|
649
664
|
return self._fXf(phi_or_sn, cn, dn, cX, deltaX, _fX)
|
|
650
665
|
|
|
651
|
-
def _fXf(self, phi_or_sn, cn, dn, cX, deltaX, fX):
|
|
666
|
+
def _fXf(self, phi_or_sn, cn, dn, cX, deltaX, fX, k2_0=False, kp2_0=False):
|
|
652
667
|
'''(INTERNAL) Helper for C{.fD}, C{.fE}, C{.fF} and C{._fXa}.
|
|
653
668
|
'''
|
|
654
669
|
self._iteration = 0 # aggregate
|
|
655
670
|
phi = sn = phi_or_sn
|
|
656
671
|
if cn is dn is None: # fX(phi) call
|
|
672
|
+
if k2_0: # C++ version 2.4
|
|
673
|
+
return phi
|
|
674
|
+
elif kp2_0:
|
|
675
|
+
return asinh(tan(phi))
|
|
657
676
|
sn, cn, dn = self._sncndn3(phi)
|
|
658
677
|
if fabs(phi) >= PI:
|
|
659
678
|
return (deltaX(sn, cn, dn) + phi) * cX / PI_2
|
|
@@ -668,6 +687,51 @@ class Elliptic(_Named):
|
|
|
668
687
|
xi = fX(sn, cn, dn) if cn > 0 else cX
|
|
669
688
|
return copysign0(xi, sn)
|
|
670
689
|
|
|
690
|
+
def _jam(self, x):
|
|
691
|
+
'''Jacobi amplitude function.
|
|
692
|
+
|
|
693
|
+
@return: C{phi} (C{float}).
|
|
694
|
+
'''
|
|
695
|
+
# implements DLMF Sec 22.20(ii), see also U{Sala
|
|
696
|
+
# (1989)<https://doi.org/10.1137/0520100>}, Sec 5
|
|
697
|
+
if self.k2:
|
|
698
|
+
if self.kp2:
|
|
699
|
+
r, ac = self._jamac2
|
|
700
|
+
x *= r # phi
|
|
701
|
+
for a, c in ac:
|
|
702
|
+
p = x
|
|
703
|
+
x = favg(asin(c * sin(x) / a), x)
|
|
704
|
+
if self.k2 < 0: # Sala Eq. 5.8
|
|
705
|
+
x = p - x
|
|
706
|
+
else: # PYCHOK no cover
|
|
707
|
+
x = atan(sinh(x)) # gd(x)
|
|
708
|
+
return x
|
|
709
|
+
|
|
710
|
+
@Property_RO
|
|
711
|
+
def _jamac2(self):
|
|
712
|
+
'''(INTERNAL) Get Jacobi amplitude 2-tuple C{(r, ac)}.
|
|
713
|
+
'''
|
|
714
|
+
a = r = _1_0
|
|
715
|
+
b, c = self.kp2, self.k2
|
|
716
|
+
# assert b and c
|
|
717
|
+
if c < 0: # Sala Eq. 5.8
|
|
718
|
+
r = sqrt(b)
|
|
719
|
+
b = _1_0 / b
|
|
720
|
+
# c *= b # unused
|
|
721
|
+
ac = [] # [(a, sqrt(c))] unused
|
|
722
|
+
for i in range(1, _TRIPS): # GEOGRAPHICLIB_PANIC
|
|
723
|
+
b = sqrt(a * b)
|
|
724
|
+
c = favg(a, -b)
|
|
725
|
+
a = favg(a, b) # == PI_2 / K
|
|
726
|
+
ac.append((a, c))
|
|
727
|
+
if c <= (a * _TolJAM): # 7 trips, quadratic
|
|
728
|
+
_iterations(self, i)
|
|
729
|
+
break
|
|
730
|
+
else: # PYCHOK no cover
|
|
731
|
+
raise _convergenceError(c / a, _TolJAM)
|
|
732
|
+
r *= a * float(1 << i) # 2**i == 2**len(ac)
|
|
733
|
+
return r, tuple(reversed(ac))
|
|
734
|
+
|
|
671
735
|
@Property_RO
|
|
672
736
|
def k2(self):
|
|
673
737
|
'''Get k^2, the square of the modulus (C{float}).
|
|
@@ -723,38 +787,46 @@ class Elliptic(_Named):
|
|
|
723
787
|
# Pi(alpha2, 1) = inf
|
|
724
788
|
# G( alpha2, 1) = H(alpha2, 1) = RC(1, alphap2)
|
|
725
789
|
|
|
726
|
-
def sncndn(self, x):
|
|
727
|
-
'''The Jacobi elliptic function.
|
|
790
|
+
def sncndn(self, x, jam=False):
|
|
791
|
+
'''The Jacobi amplitude and elliptic function.
|
|
728
792
|
|
|
729
793
|
@arg x: The argument (C{float}).
|
|
794
|
+
@kwarg jam: If C{True}, use the Jacobi amplitude otherwise the
|
|
795
|
+
Bulirsch' function (C{bool}).
|
|
730
796
|
|
|
731
|
-
@return: An L{Elliptic3Tuple}C{(sn, cn, dn)} with
|
|
732
|
-
C{*n(B{x}, k)}.
|
|
797
|
+
@return: An L{Elliptic3Tuple}C{(sn, cn, dn)} with C{*n(B{x}, k)}.
|
|
733
798
|
|
|
734
799
|
@raise EllipticError: No convergence.
|
|
735
800
|
'''
|
|
736
801
|
self._iteration = 0 # reset
|
|
737
|
-
try:
|
|
802
|
+
try:
|
|
738
803
|
if self.kp2:
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
for
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
804
|
+
if jam: # Jacobi amplitude, C++ version 2.4
|
|
805
|
+
sn, cn, dn = self._sncndn3(self._jam(x))
|
|
806
|
+
|
|
807
|
+
else: # Bulirsch's sncndn routine, p 89 of
|
|
808
|
+
# Numerische Mathematik 7, 78-90 (1965).
|
|
809
|
+
# Implements DLMF Eqs 22.17.2 - 22.17.4,
|
|
810
|
+
# but only good for .k2 > 1 or .kp2 < 0
|
|
811
|
+
c, d, cd, mn = self._sncndn4
|
|
812
|
+
dn = _1_0
|
|
813
|
+
sn, cn = _sincos2(x * cd)
|
|
814
|
+
if sn:
|
|
815
|
+
a = cn / sn
|
|
816
|
+
c *= a
|
|
817
|
+
for m, n in mn:
|
|
818
|
+
a *= c
|
|
819
|
+
c *= dn
|
|
820
|
+
dn = (n + a) / (m + a)
|
|
821
|
+
a = c / m
|
|
822
|
+
a = _1_0 / hypot1(c)
|
|
823
|
+
sn = neg(a) if _signBit(sn) else a
|
|
824
|
+
cn = sn * c
|
|
825
|
+
if d: # and _signBit(self.kp2): # implied
|
|
826
|
+
cn, dn = dn, cn
|
|
827
|
+
sn = sn / d # /= chokes PyChecker
|
|
756
828
|
else:
|
|
757
|
-
sn = tanh(x)
|
|
829
|
+
sn = tanh(x) # accurate for large abs(x)
|
|
758
830
|
cn = dn = _1_0 / cosh(x)
|
|
759
831
|
|
|
760
832
|
except Exception as e:
|
|
@@ -763,7 +835,7 @@ class Elliptic(_Named):
|
|
|
763
835
|
return Elliptic3Tuple(sn, cn, dn, iteration=self._iteration)
|
|
764
836
|
|
|
765
837
|
def _sncndn3(self, phi):
|
|
766
|
-
'''(INTERNAL) Helper for C{.fEinv} and C{.
|
|
838
|
+
'''(INTERNAL) Helper for C{.fEinv}, C{._fXf} and C{.sncndn}.
|
|
767
839
|
'''
|
|
768
840
|
sn, cn = _sincos2(phi)
|
|
769
841
|
return sn, cn, self.fDelta(sn, cn)
|
|
@@ -772,29 +844,27 @@ class Elliptic(_Named):
|
|
|
772
844
|
def _sncndn4(self):
|
|
773
845
|
'''(INTERNAL) Get Bulirsch' 4-tuple C{(c, d, cd, mn)}.
|
|
774
846
|
'''
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
mn, a = [], _1_0
|
|
847
|
+
d, b = 0, self.kp2
|
|
848
|
+
if _signBit(b):
|
|
849
|
+
d = _1_0 - b
|
|
850
|
+
b = neg(b / d)
|
|
851
|
+
d = sqrt(d)
|
|
852
|
+
ab, a = [], _1_0
|
|
783
853
|
for i in range(1, _TRIPS): # GEOGRAPHICLIB_PANIC
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
c = (a
|
|
787
|
-
r =
|
|
788
|
-
|
|
789
|
-
if r <= t: # 6 trips, quadratic
|
|
854
|
+
b = sqrt(b)
|
|
855
|
+
ab.append((a, b))
|
|
856
|
+
c = favg(a, b)
|
|
857
|
+
r = fabs(a - b)
|
|
858
|
+
if r <= (a * _TolJAC): # 6 trips, quadratic
|
|
790
859
|
_iterations(self, i)
|
|
791
860
|
break
|
|
792
|
-
|
|
793
|
-
a
|
|
861
|
+
t = a
|
|
862
|
+
b *= a
|
|
863
|
+
a = c
|
|
794
864
|
else: # PYCHOK no cover
|
|
795
|
-
raise _convergenceError(r,
|
|
865
|
+
raise _convergenceError(r / t, _TolJAC)
|
|
796
866
|
cd = (c * d) if d else c
|
|
797
|
-
return c, d, cd,
|
|
867
|
+
return c, d, cd, tuple(reversed(ab))
|
|
798
868
|
|
|
799
869
|
@staticmethod
|
|
800
870
|
def fRC(x, y):
|
|
@@ -882,7 +952,7 @@ class Elliptic(_Named):
|
|
|
882
952
|
raise _ellipticError(Elliptic._RFRD, x, y, z, m, cause=e)
|
|
883
953
|
return float(R)
|
|
884
954
|
|
|
885
|
-
_allPropertiesOf_n(
|
|
955
|
+
_allPropertiesOf_n(16, Elliptic) # # PYCHOK assert, see Elliptic.reset
|
|
886
956
|
|
|
887
957
|
|
|
888
958
|
class EllipticError(_ValueError):
|
|
@@ -901,25 +971,18 @@ class Elliptic3Tuple(_NamedTuple):
|
|
|
901
971
|
class _List(list):
|
|
902
972
|
'''(INTERNAL) Helper for C{_RD}, C{_RF3} and C{_RJ}.
|
|
903
973
|
'''
|
|
904
|
-
_a0
|
|
905
|
-
# _xyzp = ()
|
|
974
|
+
_a0 = None
|
|
906
975
|
|
|
907
976
|
def __init__(self, *xyzp): # x, y, z [, p]
|
|
908
977
|
list.__init__(self, xyzp)
|
|
909
|
-
self._xyzp = xyzp
|
|
910
978
|
|
|
911
979
|
def a0(self, n):
|
|
912
980
|
'''Compute the initial C{a}.
|
|
913
981
|
'''
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
try:
|
|
919
|
-
a = Fsum(*t).fover(n)
|
|
920
|
-
except ValueError: # Fsum(NAN) exception
|
|
921
|
-
a = _sum(t) / n
|
|
922
|
-
self._a0 = a
|
|
982
|
+
A = _Dsum(self)
|
|
983
|
+
while len(A) < n:
|
|
984
|
+
A += A[-1]
|
|
985
|
+
self._a0 = a = float(A(_1_0 / n))
|
|
923
986
|
return a
|
|
924
987
|
|
|
925
988
|
def amrs4(self, inst, y, Tol):
|
|
@@ -929,20 +992,22 @@ class _List(list):
|
|
|
929
992
|
L = self
|
|
930
993
|
a = L.a0(5 if y else 3)
|
|
931
994
|
m = 1
|
|
932
|
-
t = max(fabs(a - _) for _ in L) / Tol
|
|
995
|
+
t = max(fabs(a - _) for _ in L) / Tol # thresh
|
|
933
996
|
for i in range(_TRIPS):
|
|
934
997
|
d = fabs(a * m)
|
|
935
998
|
if d > t: # 3-6 trips
|
|
936
999
|
_iterations(inst, i)
|
|
937
1000
|
break
|
|
938
1001
|
s = map2(sqrt, L) # sqrt(x), srqt(y), sqrt(z) [, sqrt(p)]
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1002
|
+
# Deferred fdot(s[:3], s[1], s[2], s[0]) + ...
|
|
1003
|
+
Q = _Dadd(_0_25)
|
|
1004
|
+
Q += s[0] * s[1]
|
|
1005
|
+
Q += s[1] * s[2]
|
|
1006
|
+
Q += s[2] * s[0]
|
|
1007
|
+
L[:] = (float(Q + _) for _ in L)
|
|
1008
|
+
a = float(Q + a)
|
|
945
1009
|
if y: # yield only if used
|
|
1010
|
+
r = _sum(Q) # fdot
|
|
946
1011
|
yield a, m, r, s # L[2] is next z
|
|
947
1012
|
m *= 4
|
|
948
1013
|
else: # PYCHOK no cover
|
|
@@ -967,14 +1032,15 @@ def _ab2(inst, x, y):
|
|
|
967
1032
|
b, a = a, b
|
|
968
1033
|
for i in range(_TRIPS):
|
|
969
1034
|
yield a, b # xi, yi
|
|
970
|
-
d =
|
|
971
|
-
|
|
972
|
-
if d <= t: # 3-4 trips
|
|
1035
|
+
d = fabs(a - b)
|
|
1036
|
+
if d <= (a * _TolRG0): # 3-4 trips
|
|
973
1037
|
_iterations(inst, i)
|
|
974
1038
|
break
|
|
975
|
-
|
|
1039
|
+
t = a
|
|
1040
|
+
a = favg(t, b)
|
|
1041
|
+
b = sqrt(t * b)
|
|
976
1042
|
else: # PYCHOK no cover
|
|
977
|
-
raise _convergenceError(d,
|
|
1043
|
+
raise _convergenceError(d / t, _TolRG0)
|
|
978
1044
|
|
|
979
1045
|
|
|
980
1046
|
def _convergenceError(d, tol, **thresh):
|
|
@@ -1083,10 +1149,10 @@ def _RD(inst, x, y, z, *over):
|
|
|
1083
1149
|
z = (x + y) / _3_0
|
|
1084
1150
|
z2 = z**2
|
|
1085
1151
|
return _Horner(S(_1_0), sqrt(a) * a * m,
|
|
1086
|
-
|
|
1087
|
-
(xy * _3_0 -
|
|
1088
|
-
(xy -
|
|
1089
|
-
|
|
1152
|
+
(xy - z2 * _6_0),
|
|
1153
|
+
(xy * _3_0 - z2 * _8_0) * z,
|
|
1154
|
+
(xy - z2) * z2 * _3_0,
|
|
1155
|
+
(xy * z2 * z), *over) # Fsum
|
|
1090
1156
|
|
|
1091
1157
|
|
|
1092
1158
|
def _rF2(inst, x, y): # 2-arg version, z=0
|
|
@@ -1160,7 +1226,7 @@ def _RJ(inst, x, y, z, p, *over):
|
|
|
1160
1226
|
if d:
|
|
1161
1227
|
if n:
|
|
1162
1228
|
rc = _rC(inst, _1_0, n / d**2 + _1_0)
|
|
1163
|
-
n
|
|
1229
|
+
n = n / _64_0 # /= chokes PyChecker
|
|
1164
1230
|
else:
|
|
1165
1231
|
rc = _1_0 # == _rC(None, _1_0, _1_0)
|
|
1166
1232
|
S += rc / (d * m)
|
pygeodesy/errors.py
CHANGED
|
@@ -27,7 +27,7 @@ from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS, _getenv, _PYTHON_X_D
|
|
|
27
27
|
from copy import copy as _copy
|
|
28
28
|
|
|
29
29
|
__all__ = _ALL_LAZY.errors # _ALL_DOCS('_InvalidError', '_IsnotError') _under
|
|
30
|
-
__version__ = '24.
|
|
30
|
+
__version__ = '24.09.19'
|
|
31
31
|
|
|
32
32
|
_argument_ = 'argument'
|
|
33
33
|
_box_ = 'box'
|
|
@@ -759,14 +759,16 @@ try:
|
|
|
759
759
|
_ = {}.__or__ # {} | {} # Python 3.9+
|
|
760
760
|
|
|
761
761
|
def _xkwds(kwds, **dflts):
|
|
762
|
-
'''(INTERNAL) Update C{dflts} with specified C{kwds}
|
|
762
|
+
'''(INTERNAL) Update C{dflts} with specified C{kwds},
|
|
763
|
+
i.e. C{copy(kwds).update(dflts)}.
|
|
763
764
|
'''
|
|
764
|
-
return (dflts | kwds) if kwds else dflts
|
|
765
|
+
return ((dflts | kwds) if kwds else dflts) if dflts else kwds
|
|
765
766
|
|
|
766
767
|
except AttributeError:
|
|
767
768
|
|
|
768
769
|
def _xkwds(kwds, **dflts): # PYCHOK expected
|
|
769
|
-
'''(INTERNAL) Update C{dflts} with specified C{kwds}
|
|
770
|
+
'''(INTERNAL) Update C{dflts} with specified C{kwds},
|
|
771
|
+
i.e. C{copy(kwds).update(dflts)}.
|
|
770
772
|
'''
|
|
771
773
|
d = dflts
|
|
772
774
|
if kwds:
|
|
@@ -787,6 +789,20 @@ except AttributeError:
|
|
|
787
789
|
# setattr(inst, NN(_UNDER_, n), v)
|
|
788
790
|
|
|
789
791
|
|
|
792
|
+
def _xkwds_from(orig, *args, **kwds):
|
|
793
|
+
'''(INTERNAL) Return the items from C{orig} with the keys
|
|
794
|
+
from C{kwds} and a value not in C{args} and C{kwds}.
|
|
795
|
+
'''
|
|
796
|
+
def _items(orig, args, items):
|
|
797
|
+
for n, m in items:
|
|
798
|
+
if n in orig: # n in (orig.keys() & kwds.keys())
|
|
799
|
+
t = orig[n]
|
|
800
|
+
if t is not m and t not in args:
|
|
801
|
+
yield n, t
|
|
802
|
+
|
|
803
|
+
return _items(orig, args, kwds.items())
|
|
804
|
+
|
|
805
|
+
|
|
790
806
|
def _xkwds_get(kwds, **name_default):
|
|
791
807
|
'''(INTERNAL) Get a C{kwds} value by C{name} or the
|
|
792
808
|
C{default} if not present.
|
|
@@ -809,7 +825,8 @@ def _xkwds_get_(kwds, **names_defaults):
|
|
|
809
825
|
|
|
810
826
|
def _xkwds_get1(kwds, **name_default):
|
|
811
827
|
'''(INTERNAL) Get one C{kwds} value by C{name} or the
|
|
812
|
-
C{default} if not present.
|
|
828
|
+
C{default} if not present. Raise an C{_UnexpectedError}
|
|
829
|
+
with any remaining keyword arguments.
|
|
813
830
|
'''
|
|
814
831
|
v, kwds = _xkwds_pop2(kwds, **name_default)
|
|
815
832
|
if kwds:
|
|
@@ -842,6 +859,16 @@ def _xkwds_not(*args, **kwds):
|
|
|
842
859
|
return dict((n, v) for n, v in kwds.items() if v not in args)
|
|
843
860
|
|
|
844
861
|
|
|
862
|
+
def _xkwds_pop(kwds, **name_default):
|
|
863
|
+
'''(INTERNAL) Pop an item by C{name} from C{kwds} and
|
|
864
|
+
return its value, otherwise return the C{default}.
|
|
865
|
+
'''
|
|
866
|
+
if isinstance(kwds, dict) and len(name_default) == 1:
|
|
867
|
+
for n, v in name_default.items():
|
|
868
|
+
return kwds.pop(n, v)
|
|
869
|
+
raise _xAssertionError(_xkwds_pop, kwds, **name_default)
|
|
870
|
+
|
|
871
|
+
|
|
845
872
|
def _xkwds_pop2(kwds, **name_default):
|
|
846
873
|
'''(INTERNAL) Pop a C{kwds} item by C{name} and return the value and
|
|
847
874
|
reduced C{kwds} copy, otherwise the C{default} and original C{kwds}.
|