pygeodesy 24.4.4__py2.py3-none-any.whl → 24.4.18__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.4.4.dist-info → PyGeodesy-24.4.18.dist-info}/METADATA +6 -6
- {PyGeodesy-24.4.4.dist-info → PyGeodesy-24.4.18.dist-info}/RECORD +40 -40
- pygeodesy/__init__.py +1 -1
- pygeodesy/albers.py +20 -27
- pygeodesy/auxilats/auxLat.py +3 -3
- pygeodesy/azimuthal.py +9 -8
- pygeodesy/deprecated/__init__.py +1 -1
- pygeodesy/deprecated/classes.py +14 -1
- pygeodesy/ecef.py +4 -4
- pygeodesy/ellipsoidalBase.py +2 -3
- pygeodesy/ellipsoids.py +4 -4
- pygeodesy/elliptic.py +27 -26
- pygeodesy/errors.py +27 -28
- pygeodesy/etm.py +3 -3
- pygeodesy/fmath.py +64 -65
- pygeodesy/frechet.py +6 -6
- pygeodesy/fstats.py +3 -4
- pygeodesy/fsums.py +506 -396
- pygeodesy/geodesicw.py +2 -2
- pygeodesy/geodsolve.py +4 -3
- pygeodesy/geoids.py +4 -4
- pygeodesy/hausdorff.py +5 -5
- pygeodesy/heights.py +6 -6
- pygeodesy/latlonBase.py +6 -6
- pygeodesy/lazily.py +3 -3
- pygeodesy/ltp.py +11 -11
- pygeodesy/ltpTuples.py +3 -4
- pygeodesy/named.py +14 -3
- pygeodesy/nvectorBase.py +5 -5
- pygeodesy/osgr.py +24 -24
- pygeodesy/points.py +3 -3
- pygeodesy/resections.py +16 -24
- pygeodesy/rhumb/bases.py +24 -25
- pygeodesy/sphericalNvector.py +6 -6
- pygeodesy/sphericalTrigonometry.py +3 -4
- pygeodesy/triaxials.py +4 -4
- pygeodesy/utmupsBase.py +6 -6
- pygeodesy/vector2d.py +9 -8
- {PyGeodesy-24.4.4.dist-info → PyGeodesy-24.4.18.dist-info}/WHEEL +0 -0
- {PyGeodesy-24.4.4.dist-info → PyGeodesy-24.4.18.dist-info}/top_level.txt +0 -0
pygeodesy/elliptic.py
CHANGED
|
@@ -97,7 +97,7 @@ from math import asinh, atan, atan2, ceil, cosh, fabs, floor, \
|
|
|
97
97
|
radians, sin, sqrt, tanh
|
|
98
98
|
|
|
99
99
|
__all__ = _ALL_LAZY.elliptic
|
|
100
|
-
__version__ = '24.
|
|
100
|
+
__version__ = '24.04.14'
|
|
101
101
|
|
|
102
102
|
_TolRD = zqrt(EPS * 0.002)
|
|
103
103
|
_TolRF = zqrt(EPS * 0.030)
|
|
@@ -112,7 +112,7 @@ class _Cs(object):
|
|
|
112
112
|
self.__dict__ = kwds
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
class
|
|
115
|
+
class _Dsum(list):
|
|
116
116
|
'''(INTERNAL) Deferred C{Fsum}.
|
|
117
117
|
'''
|
|
118
118
|
def __call__(self, s):
|
|
@@ -405,7 +405,7 @@ class Elliptic(_Named):
|
|
|
405
405
|
# For kp2 close to zero use asin(r / cE) or J. P. Boyd,
|
|
406
406
|
# Applied Math. and Computation 218, 7005-7013 (2012)
|
|
407
407
|
# <https://DOI.org/10.1016/j.amc.2011.12.021>
|
|
408
|
-
_Phi2, self._iteration = Phi.
|
|
408
|
+
_Phi2, self._iteration = Phi.fsum2f_, 0 # aggregate
|
|
409
409
|
for i in range(1, _TRIPS): # GEOGRAPHICLIB_PANIC
|
|
410
410
|
sn, cn, dn = self._sncndn3(phi)
|
|
411
411
|
if dn:
|
|
@@ -896,7 +896,7 @@ class Elliptic3Tuple(_NamedTuple):
|
|
|
896
896
|
_Units_ = ( Scalar, Scalar, Scalar)
|
|
897
897
|
|
|
898
898
|
|
|
899
|
-
class
|
|
899
|
+
class _List(list):
|
|
900
900
|
'''(INTERNAL) Helper for C{_RD}, C{_RF3} and C{_RJ}.
|
|
901
901
|
'''
|
|
902
902
|
_a0 = None
|
|
@@ -938,7 +938,7 @@ class _L(list):
|
|
|
938
938
|
r = fdot(s[:3], s[1], s[2], s[0]) # sqrt(x) * sqrt(y) + ...
|
|
939
939
|
except ValueError: # Fsum(NAN) exception
|
|
940
940
|
r = _sum(s[i] * s[(i + 1) % 3] for i in range(3))
|
|
941
|
-
L[:] =
|
|
941
|
+
L[:] = ((r + _) * _0_25 for _ in L)
|
|
942
942
|
a = (r + a) * _0_25
|
|
943
943
|
if y: # yield only if used
|
|
944
944
|
yield a, m, r, s # L[2] is next z
|
|
@@ -951,9 +951,10 @@ class _L(list):
|
|
|
951
951
|
'''Rescale C{x}, C{y}, ...
|
|
952
952
|
'''
|
|
953
953
|
# assert am
|
|
954
|
-
a0
|
|
954
|
+
a0 = self._a0
|
|
955
|
+
_am = _1_0 / am
|
|
955
956
|
for x in xs:
|
|
956
|
-
yield (a0 - x)
|
|
957
|
+
yield (a0 - x) * _am
|
|
957
958
|
|
|
958
959
|
|
|
959
960
|
def _ab2(inst, x, y):
|
|
@@ -961,16 +962,15 @@ def _ab2(inst, x, y):
|
|
|
961
962
|
'''
|
|
962
963
|
a, b = sqrt(x), sqrt(y)
|
|
963
964
|
if b > a:
|
|
964
|
-
|
|
965
|
-
yield a, b # initial x0, y0
|
|
965
|
+
b, a = a, b
|
|
966
966
|
for i in range(_TRIPS):
|
|
967
|
+
yield a, b # xi, yi
|
|
967
968
|
d = fabs(a - b)
|
|
968
969
|
t = _TolRG0 * a
|
|
969
970
|
if d <= t: # 3-4 trips
|
|
970
971
|
_iterations(inst, i)
|
|
971
972
|
break
|
|
972
973
|
a, b = ((a + b) * _0_5), sqrt(a * b)
|
|
973
|
-
yield a, b # xn, yn
|
|
974
974
|
else: # PYCHOK no cover
|
|
975
975
|
raise _convergenceError(d, t)
|
|
976
976
|
|
|
@@ -1023,15 +1023,16 @@ def _Horner(S, e1, E2, E3, E4, E5, *over):
|
|
|
1023
1023
|
# + 3*E5/26 - E2**3/16 + 3*E3**2/40 + 3*E2*E4/20
|
|
1024
1024
|
# + 45*E2**2*E3/272 - 9*(E3*E4+E2*E5)/68)
|
|
1025
1025
|
# converted to Horner-like form ...
|
|
1026
|
-
F = Fsum
|
|
1027
1026
|
e = e1 * 4084080
|
|
1028
1027
|
S *= e
|
|
1029
|
-
S +=
|
|
1030
|
-
S +=
|
|
1031
|
-
S +=
|
|
1032
|
-
S +=
|
|
1028
|
+
S += Fsum(E2 * -540540, 471240).fmul(E5)
|
|
1029
|
+
S += Fsum(E2 * 612612, E3 * -540540, -556920).fmul(E4)
|
|
1030
|
+
S += Fsum(E2 * -706860, E22 * 675675, E3 * 306306, 680680).fmul(E3)
|
|
1031
|
+
S += Fsum(E2 * 417690, E22 * -255255, -875160).fmul(E2)
|
|
1033
1032
|
S += 4084080
|
|
1034
|
-
|
|
1033
|
+
if over:
|
|
1034
|
+
e *= over[0]
|
|
1035
|
+
return S.fdiv(e) # Fsum
|
|
1035
1036
|
|
|
1036
1037
|
|
|
1037
1038
|
def _iterations(inst, i):
|
|
@@ -1069,8 +1070,8 @@ def _rC(unused, x, y):
|
|
|
1069
1070
|
def _RD(inst, x, y, z, *over):
|
|
1070
1071
|
'''(INTERNAL) Carlson, eqs 2.28 - 2.34.
|
|
1071
1072
|
'''
|
|
1072
|
-
L =
|
|
1073
|
-
S =
|
|
1073
|
+
L = _List(x, y, z)
|
|
1074
|
+
S = _Dsum()
|
|
1074
1075
|
for a, m, r, s in L.amrs4(inst, True, _TolRF):
|
|
1075
1076
|
if s:
|
|
1076
1077
|
S += _over(_3_0, (r + z) * s[2] * m)
|
|
@@ -1097,7 +1098,7 @@ def _rF2(inst, x, y): # 2-arg version, z=0
|
|
|
1097
1098
|
def _RF3(inst, x, y, z): # 3-arg version
|
|
1098
1099
|
'''(INTERNAL) Carlson, eqs 2.2 - 2.7.
|
|
1099
1100
|
'''
|
|
1100
|
-
L =
|
|
1101
|
+
L = _List(x, y, z)
|
|
1101
1102
|
for a, m, _, _ in L.amrs4(inst, False, _TolRF):
|
|
1102
1103
|
pass
|
|
1103
1104
|
x, y = L.rescale(a * m, x, y)
|
|
@@ -1120,14 +1121,14 @@ def _rG2(inst, x, y, PI_=PI_4): # 2-args
|
|
|
1120
1121
|
'''(INTERNAL) Carlson, eqs 2.36 - 2.39.
|
|
1121
1122
|
'''
|
|
1122
1123
|
m = -1 # neg!
|
|
1123
|
-
S =
|
|
1124
|
-
# assert not S
|
|
1124
|
+
S = None
|
|
1125
1125
|
for a, b in _ab2(inst, x, y): # PYCHOK yield
|
|
1126
|
-
if S:
|
|
1126
|
+
if S is None: # initial
|
|
1127
|
+
S = _Dsum()
|
|
1128
|
+
S += (a + b)**2 * _0_5
|
|
1129
|
+
else:
|
|
1127
1130
|
S += (a - b)**2 * m
|
|
1128
1131
|
m *= 2
|
|
1129
|
-
else: # initial
|
|
1130
|
-
S += (a + b)**2 * _0_5
|
|
1131
1132
|
return S(PI_).fover(a + b)
|
|
1132
1133
|
|
|
1133
1134
|
|
|
@@ -1148,9 +1149,9 @@ def _RJ(inst, x, y, z, p, *over):
|
|
|
1148
1149
|
def _xyzp(x, y, z, p):
|
|
1149
1150
|
return (x + p) * (y + p) * (z + p)
|
|
1150
1151
|
|
|
1151
|
-
L =
|
|
1152
|
+
L = _List(x, y, z, p)
|
|
1152
1153
|
n = neg(_xyzp(x, y, z, -p))
|
|
1153
|
-
S =
|
|
1154
|
+
S = _Dsum()
|
|
1154
1155
|
for a, m, _, s in L.amrs4(inst, True, _TolRD):
|
|
1155
1156
|
if s:
|
|
1156
1157
|
d = _xyzp(*s)
|
pygeodesy/errors.py
CHANGED
|
@@ -11,9 +11,9 @@ chaining}, use command line option C{python -X dev} I{OR} set env variable
|
|
|
11
11
|
C{PYTHONDEVMODE=1} or to any non-empty string I{OR} set env variable
|
|
12
12
|
C{PYGEODESY_EXCEPTION_CHAINING=std} or to any non-empty string.
|
|
13
13
|
'''
|
|
14
|
-
# from pygeodesy.basics import isint, isodd, itemsorted, _xinstanceof, _zip # _MODS
|
|
14
|
+
# from pygeodesy.basics import isint, isodd, issubclassof, itemsorted, _xinstanceof, _zip # _MODS
|
|
15
15
|
# from pygeodesy.ellipsoidalBase import CartesianEllipsoidalBase, LatLonEllipsoidalBase # _MODS
|
|
16
|
-
# from pygeodesy import errors # _MODS.getattr
|
|
16
|
+
# from pygeodesy import errors # _MODS, _MODS.getattr
|
|
17
17
|
from pygeodesy.interns import MISSING, NN, _a_, _an_, _and_, _clip_, _COLON_, \
|
|
18
18
|
_COLONSPACE_, _COMMASPACE_, _datum_, _ellipsoidal_, \
|
|
19
19
|
_incompatible_, _invalid_, _len_, _not_, _or_, _SPACE_, \
|
|
@@ -25,7 +25,7 @@ from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS, _getenv, _PYTHON_X_D
|
|
|
25
25
|
from copy import copy as _copy
|
|
26
26
|
|
|
27
27
|
__all__ = _ALL_LAZY.errors # _ALL_DOCS('_InvalidError', '_IsnotError') _under
|
|
28
|
-
__version__ = '24.
|
|
28
|
+
__version__ = '24.04.18'
|
|
29
29
|
|
|
30
30
|
_box_ = 'box'
|
|
31
31
|
_limiterrors = True # in .formy
|
|
@@ -425,7 +425,7 @@ def _error_init(Error, inst, args, fmt_name_value='%s (%r)', txt=NN,
|
|
|
425
425
|
def _error_under(inst):
|
|
426
426
|
'''(INTERNAL) Remove leading underscore from instance' class name.
|
|
427
427
|
'''
|
|
428
|
-
n = inst.__class__.__name__
|
|
428
|
+
n = inst.__class__.__name__ # _tailof?
|
|
429
429
|
if n.startswith(_UNDER_):
|
|
430
430
|
inst.__class__.__name__ = n.lstrip(_UNDER_)
|
|
431
431
|
return inst
|
|
@@ -479,8 +479,15 @@ def isError(exc):
|
|
|
479
479
|
C{False} if B{C{exc}} is a standard Python error
|
|
480
480
|
of C{None} if neither.
|
|
481
481
|
'''
|
|
482
|
-
|
|
483
|
-
|
|
482
|
+
def _X(exc):
|
|
483
|
+
X = type(exc)
|
|
484
|
+
m = X.__module__
|
|
485
|
+
return _MODS.basics.issubclassof(X, *_XErrors) or \
|
|
486
|
+
((m is __name__ or m == __name__) and
|
|
487
|
+
_tailof(X.__name__).startswith(_UNDER_))
|
|
488
|
+
|
|
489
|
+
return True if isinstance(exc, _XErrors) else (
|
|
490
|
+
_X(exc) if isinstance(exc, Exception) else None)
|
|
484
491
|
|
|
485
492
|
|
|
486
493
|
def _IsnotError(*nouns, **name_value_Error_cause): # name=value [, Error=TypeError, cause=None]
|
|
@@ -665,31 +672,23 @@ def _xError2(exc): # in .constants, .fsums, .lazily, .vector2d
|
|
|
665
672
|
|
|
666
673
|
@arg exc: The exception instance (usually, C{Exception}).
|
|
667
674
|
'''
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
return E,
|
|
675
|
+
x = isError(exc)
|
|
676
|
+
if x:
|
|
677
|
+
E = type(exc)
|
|
678
|
+
elif x is None:
|
|
679
|
+
E = _AssertionError
|
|
680
|
+
else: # get _Error from Error
|
|
681
|
+
n = NN(_UNDER_, _tailof(type(exc).__name__))
|
|
682
|
+
E = _MODS.getattr(__name__, n, _NotImplementedError)
|
|
683
|
+
x = E is not _NotImplementedError
|
|
684
|
+
return E, (str(exc) if x else repr(exc))
|
|
678
685
|
|
|
679
686
|
|
|
680
|
-
_XErrors =
|
|
687
|
+
_XErrors = (_AssertionError, _AttributeError, # some isError's
|
|
688
|
+
_TypeError, _ValueError, _ZeroDivisionError)
|
|
681
689
|
# map certain C{Exception} classes to the C{_Error}
|
|
682
|
-
# _X2Error = {AssertionError:
|
|
683
|
-
#
|
|
684
|
-
# ImportError: _ImportError,
|
|
685
|
-
# IndexError: _IndexError,
|
|
686
|
-
# KeyError: _KeyError,
|
|
687
|
-
# NameError: _NameError,
|
|
688
|
-
# NotImplementedError: _NotImplementedError,
|
|
689
|
-
# OverflowError: _OverflowError,
|
|
690
|
-
# TypeError: _TypeError,
|
|
691
|
-
# ValueError: _ValueError,
|
|
692
|
-
# ZeroDivisionError: _ZeroDivisionError}
|
|
690
|
+
# _X2Error = {AssertionError: _AssertionError, ...
|
|
691
|
+
# ZeroDivisionError: _ZeroDivisionError}
|
|
693
692
|
|
|
694
693
|
try:
|
|
695
694
|
_ = {}.__or__ # {} | {} # Python 3.9+
|
pygeodesy/etm.py
CHANGED
|
@@ -92,7 +92,7 @@ from pygeodesy.utm import _cmlon, _LLEB, _parseUTM5, _toBand, _toXtm8, \
|
|
|
92
92
|
from math import asinh, atan2, degrees, radians, sinh, sqrt
|
|
93
93
|
|
|
94
94
|
__all__ = _ALL_LAZY.etm
|
|
95
|
-
__version__ = '24.
|
|
95
|
+
__version__ = '24.04.07'
|
|
96
96
|
|
|
97
97
|
_OVERFLOW = _1_EPS**2 # about 2e+31
|
|
98
98
|
_TAYTOL = pow(EPS, 0.6)
|
|
@@ -606,8 +606,8 @@ class ExactTransverseMercator(_NamedBase):
|
|
|
606
606
|
_zetaDwd2 = self._sigmaDwd2
|
|
607
607
|
|
|
608
608
|
d2, r = tol2, self.raiser
|
|
609
|
-
_U_2 = Fsum(u).
|
|
610
|
-
_V_2 = Fsum(v).
|
|
609
|
+
_U_2 = Fsum(u).fsum2f_
|
|
610
|
+
_V_2 = Fsum(v).fsum2f_
|
|
611
611
|
# min iterations 2, max 6 or 7, mean 3.9 or 4.0
|
|
612
612
|
for i in range(1, _TRIPS): # GEOGRAPHICLIB_PANIC
|
|
613
613
|
sncndn6 = self._sncndn6(u, v)
|
pygeodesy/fmath.py
CHANGED
|
@@ -13,8 +13,8 @@ from pygeodesy.constants import EPS0, EPS02, EPS1, NAN, PI, PI_2, PI_4, \
|
|
|
13
13
|
_copysign_0_0, _isfinite, _over, remainder
|
|
14
14
|
from pygeodesy.errors import _IsnotError, LenError, _TypeError, _ValueError, \
|
|
15
15
|
_xError, _xkwds_get, _xkwds_pop2
|
|
16
|
-
from pygeodesy.fsums import _2float, Fsum, _fsum, fsum, fsum1_,
|
|
17
|
-
|
|
16
|
+
from pygeodesy.fsums import _2float, Fsum, _fsum, fsum, fsum1_, _1primed, \
|
|
17
|
+
Fmt, unstr
|
|
18
18
|
from pygeodesy.interns import MISSING, _few_, _h_, _invokation_, _negative_, \
|
|
19
19
|
_not_scalar_, _SPACE_, _too_
|
|
20
20
|
from pygeodesy.lazily import _ALL_LAZY, _sys_version_info2
|
|
@@ -25,13 +25,21 @@ from math import fabs, sqrt # pow
|
|
|
25
25
|
import operator as _operator # in .datums, .trf, .utm
|
|
26
26
|
|
|
27
27
|
__all__ = _ALL_LAZY.fmath
|
|
28
|
-
__version__ = '24.04.
|
|
28
|
+
__version__ = '24.04.17'
|
|
29
29
|
|
|
30
30
|
# sqrt(2) <https://WikiPedia.org/wiki/Square_root_of_2>
|
|
31
31
|
_0_4142 = 0.41421356237309504880 # ... sqrt(2) - 1
|
|
32
32
|
_h_lt_b_ = 'abs(h) < abs(b)'
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
def _Fsum__init__(inst, raiser=MISSING, **name_RESIDUAL):
|
|
36
|
+
'''(INTERNAL) Init an C{Fsum} instance.
|
|
37
|
+
'''
|
|
38
|
+
Fsum.__init__(inst, **name_RESIDUAL) # PYCHOK self
|
|
39
|
+
inst._fset_ps(_0_0)
|
|
40
|
+
return {} if raiser is MISSING else dict(raiser=raiser)
|
|
41
|
+
|
|
42
|
+
|
|
35
43
|
class Fdot(Fsum):
|
|
36
44
|
'''Precision dot product.
|
|
37
45
|
'''
|
|
@@ -41,8 +49,8 @@ class Fdot(Fsum):
|
|
|
41
49
|
|
|
42
50
|
@arg a: Iterable, list, tuple, etc. (C{scalar}s).
|
|
43
51
|
@arg b: Other values (C{scalar}s), all positional.
|
|
44
|
-
@kwarg name_RESIDUAL: Optional C{B{name}=NN} and
|
|
45
|
-
|
|
52
|
+
@kwarg name_RESIDUAL: Optional C{B{name}=NN} and C{B{RESIDUAL}=None},
|
|
53
|
+
see L{Fsum<Fsum.__init__>}.
|
|
46
54
|
|
|
47
55
|
@raise OverflowError: Partial C{2sum} overflow.
|
|
48
56
|
|
|
@@ -64,8 +72,8 @@ class Fhorner(Fsum):
|
|
|
64
72
|
@arg x: Polynomial argument (C{scalar} or C{Fsum} instance).
|
|
65
73
|
@arg cs: Polynomial coeffients (C{scalar} or C{Fsum}
|
|
66
74
|
instances), all positional.
|
|
67
|
-
@kwarg name_RESIDUAL: Optional C{B{name}=NN} and
|
|
68
|
-
|
|
75
|
+
@kwarg name_RESIDUAL: Optional C{B{name}=NN} and C{B{RESIDUAL}=None},
|
|
76
|
+
see L{Fsum<Fsum.__init__>}.
|
|
69
77
|
|
|
70
78
|
@raise OverflowError: Partial C{2sum} overflow.
|
|
71
79
|
|
|
@@ -92,32 +100,30 @@ class Fhorner(Fsum):
|
|
|
92
100
|
else: # x == 0
|
|
93
101
|
self._fadd(cs[0], op)
|
|
94
102
|
else:
|
|
95
|
-
self.
|
|
103
|
+
self._fset_ps(_0_0)
|
|
96
104
|
|
|
97
105
|
|
|
98
106
|
class Fhypot(Fsum):
|
|
99
107
|
'''Precision summation and hypotenuse, default C{power=2}.
|
|
100
108
|
'''
|
|
101
|
-
def __init__(self, *xs, **
|
|
102
|
-
'''New L{Fhypot} hypotenuse of (the I{
|
|
109
|
+
def __init__(self, *xs, **root_name_RESIDUAL_raiser):
|
|
110
|
+
'''New L{Fhypot} hypotenuse of (the I{root} of) several components.
|
|
103
111
|
|
|
104
|
-
@arg xs: One or more components (each a C{scalar} or an C{Fsum}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
C{B{RESIDUAL}=None}, see L{Fsum.__init__}.
|
|
112
|
+
@arg xs: One or more components (each a C{scalar} or an C{Fsum} instance).
|
|
113
|
+
@kwarg root_name_RESIDUAL_raiser: Optional, exponent and C{B{root}=2} order,
|
|
114
|
+
C{B{name}=NN}, C{B{RESIDUAL}=None} and C{B{raiser}=True}, see
|
|
115
|
+
class L{Fsum<Fsum.__init__>} and method L{root<Fsum.root>}.
|
|
109
116
|
'''
|
|
117
|
+
r = None # _xkwds_pop2 error
|
|
110
118
|
try:
|
|
111
|
-
|
|
112
|
-
|
|
119
|
+
r, kwds = _xkwds_pop2(root_name_RESIDUAL_raiser, root=2)
|
|
120
|
+
r, kwds = _xkwds_pop2(kwds, power=r) # for backward compatibility
|
|
121
|
+
raiser = _Fsum__init__(self, **kwds)
|
|
113
122
|
if xs:
|
|
114
|
-
r
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
self._fset(_0_0)
|
|
119
|
-
except Exception as x:
|
|
120
|
-
raise self._ErrorXs(x, xs, power=p)
|
|
123
|
+
self._facc_power(r, xs, Fhypot, **raiser)
|
|
124
|
+
self._fset(self.root(r, **raiser))
|
|
125
|
+
except Exception as X:
|
|
126
|
+
raise self._ErrorXs(X, xs, root=r)
|
|
121
127
|
|
|
122
128
|
|
|
123
129
|
class Fpolynomial(Fsum):
|
|
@@ -128,10 +134,10 @@ class Fpolynomial(Fsum):
|
|
|
128
134
|
M{sum(cs[i] * x**i for i=0..len(cs)-1)}.
|
|
129
135
|
|
|
130
136
|
@arg x: Polynomial argument (C{scalar} or L{Fsum}).
|
|
131
|
-
@arg cs: Polynomial coeffients (each a C{scalar} or
|
|
132
|
-
|
|
133
|
-
@kwarg name_RESIDUAL: Optional C{B{name}=NN} and
|
|
134
|
-
|
|
137
|
+
@arg cs: Polynomial coeffients (each a C{scalar} or an L{Fsum} instance),
|
|
138
|
+
all positional.
|
|
139
|
+
@kwarg name_RESIDUAL: Optional C{B{name}=NN} and C{B{RESIDUAL}=None},
|
|
140
|
+
see L{Fsum<Fsum.__init__>}.
|
|
135
141
|
|
|
136
142
|
@raise OverflowError: Partial C{2sum} overflow.
|
|
137
143
|
|
|
@@ -147,75 +153,68 @@ class Fpolynomial(Fsum):
|
|
|
147
153
|
if n > 0:
|
|
148
154
|
self.fadd(_1map_mul(cs[1:], _powers(x, n)))
|
|
149
155
|
elif n < 0:
|
|
150
|
-
self.
|
|
156
|
+
self._fset_ps(_0_0)
|
|
151
157
|
|
|
152
158
|
|
|
153
159
|
class Fpowers(Fsum):
|
|
154
160
|
'''Precision summation of powers, optimized for C{power=2, 3 and 4}.
|
|
155
161
|
'''
|
|
156
|
-
def __init__(self, power, *xs, **
|
|
162
|
+
def __init__(self, power, *xs, **name_RESIDUAL_raiser):
|
|
157
163
|
'''New L{Fpowers} sum of (the I{power} of) several values.
|
|
158
164
|
|
|
159
165
|
@arg power: The exponent (C{scalar} or L{Fsum}).
|
|
160
|
-
@arg xs: One or more values (each a C{scalar} or an
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
C{B{RESIDUAL}=None}, see L{Fsum.__init__}.
|
|
166
|
+
@arg xs: One or more values (each a C{scalar} or an C{Fsum} instance).
|
|
167
|
+
@kwarg name_RESIDUAL_raiser: Optional C{B{name}=NN}, C{B{RESIDUAL}=None} and
|
|
168
|
+
C{B{raiser}=True}, see L{Fsum<Fsum.__init__>} and L{fpow<Fsum.fpow>}.
|
|
164
169
|
'''
|
|
165
170
|
try:
|
|
166
|
-
|
|
171
|
+
raiser = _Fsum__init__(self, **name_RESIDUAL_raiser)
|
|
167
172
|
if xs:
|
|
168
|
-
self._facc_power(power, xs, Fpowers) # x**0 == 1
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
except Exception as x:
|
|
172
|
-
raise self._ErrorXs(x, xs, power=power)
|
|
173
|
+
self._facc_power(power, xs, Fpowers, **raiser) # x**0 == 1
|
|
174
|
+
except Exception as X:
|
|
175
|
+
raise self._ErrorXs(X, xs, power=power)
|
|
173
176
|
|
|
174
177
|
|
|
175
|
-
class
|
|
176
|
-
'''
|
|
178
|
+
class Froot(Fsum):
|
|
179
|
+
'''The root of a precision summation.
|
|
177
180
|
'''
|
|
178
|
-
def __init__(self, root, *xs, **
|
|
179
|
-
'''New L{
|
|
181
|
+
def __init__(self, root, *xs, **name_RESIDUAL_raiser):
|
|
182
|
+
'''New L{Froot} root of a precision sum.
|
|
180
183
|
|
|
181
|
-
@arg root: The order (C{scalar} or C{Fsum}),
|
|
182
|
-
|
|
183
|
-
@
|
|
184
|
-
|
|
185
|
-
@kwarg name_RESIDUAL: See L{Fsum.__init__}.
|
|
184
|
+
@arg root: The order (C{scalar} or C{Fsum}), non-zero.
|
|
185
|
+
@arg xs: Values to summate (each a C{scalar} or an C{Fsum} instance).
|
|
186
|
+
@kwarg name_RESIDUAL_raiser: Optional C{B{name}=NN}, C{B{RESIDUAL}=None} and
|
|
187
|
+
C{B{raiser}=True}, see L{Fsum<Fsum.__init__>} and L{fpow<Fsum.fpow>}.
|
|
186
188
|
'''
|
|
187
189
|
try:
|
|
188
|
-
|
|
190
|
+
raiser = _Fsum__init__(self, **name_RESIDUAL_raiser)
|
|
189
191
|
if xs:
|
|
190
|
-
r = _1_0 / root
|
|
191
192
|
self. fadd(xs)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
except Exception as x:
|
|
196
|
-
raise self._ErrorXs(x, xs, root=root)
|
|
193
|
+
self._fset(self.root(root, **raiser))
|
|
194
|
+
except Exception as X:
|
|
195
|
+
raise self._ErrorXs(X, xs, root=root)
|
|
197
196
|
|
|
198
197
|
|
|
199
|
-
class Fcbrt(
|
|
198
|
+
class Fcbrt(Froot):
|
|
200
199
|
'''Cubic root of a precision summation.
|
|
201
200
|
'''
|
|
202
|
-
def __init__(self, *xs, **
|
|
201
|
+
def __init__(self, *xs, **name_RESIDUAL_raiser):
|
|
203
202
|
'''New L{Fcbrt} cubic root of a precision sum.
|
|
204
203
|
|
|
205
|
-
@see: Class L{
|
|
204
|
+
@see: Class L{Froot} for further details.
|
|
206
205
|
'''
|
|
207
|
-
|
|
206
|
+
Froot.__init__(self, _3_0, *xs, **name_RESIDUAL_raiser)
|
|
208
207
|
|
|
209
208
|
|
|
210
|
-
class Fsqrt(
|
|
209
|
+
class Fsqrt(Froot):
|
|
211
210
|
'''Square root of a precision summation.
|
|
212
211
|
'''
|
|
213
|
-
def __init__(self, *xs, **
|
|
212
|
+
def __init__(self, *xs, **name_RESIDUAL_raiser):
|
|
214
213
|
'''New L{Fsqrt} square root of a precision sum.
|
|
215
214
|
|
|
216
|
-
@see: Class L{
|
|
215
|
+
@see: Class L{Froot} for further details.
|
|
217
216
|
'''
|
|
218
|
-
|
|
217
|
+
Froot.__init__(self, _2_0, *xs, **name_RESIDUAL_raiser)
|
|
219
218
|
|
|
220
219
|
|
|
221
220
|
def bqrt(x):
|
|
@@ -818,7 +817,7 @@ def _map_mul(a, b, where):
|
|
|
818
817
|
n = len(b)
|
|
819
818
|
if len(a) != n: # PYCHOK no cover
|
|
820
819
|
raise LenError(where, a=len(a), b=n)
|
|
821
|
-
return
|
|
820
|
+
return _1map_mul(a, b) if n < 4 else map(_operator.mul, a, b)
|
|
822
821
|
|
|
823
822
|
|
|
824
823
|
def _1map_mul(a, b):
|
pygeodesy/frechet.py
CHANGED
|
@@ -89,7 +89,7 @@ import pygeodesy.formy as _formy
|
|
|
89
89
|
from pygeodesy.interns import NN, _DOT_, _n_, _units_
|
|
90
90
|
# from pygeodesy.iters import points2 as _points2 # from .points
|
|
91
91
|
from pygeodesy.lazily import _ALL_LAZY, _FOR_DOCS
|
|
92
|
-
from pygeodesy.named import _Named, _NamedTuple,
|
|
92
|
+
from pygeodesy.named import _Named, _NamedTuple, _Pass
|
|
93
93
|
# from pygeodesy.namedTuples import PhiLam2Tuple # from .points
|
|
94
94
|
from pygeodesy.points import _distanceTo, _fractional, isscalar, \
|
|
95
95
|
PhiLam2Tuple, points2 as _points2, radians
|
|
@@ -102,7 +102,7 @@ from collections import defaultdict as _defaultdict
|
|
|
102
102
|
# from math import radians # from .points
|
|
103
103
|
|
|
104
104
|
__all__ = _ALL_LAZY.frechet
|
|
105
|
-
__version__ = '24.
|
|
105
|
+
__version__ = '24.04.07'
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
def _fraction(fraction, n):
|
|
@@ -248,7 +248,7 @@ class Frechet(_Named):
|
|
|
248
248
|
|
|
249
249
|
def _func(self, *args, **kwds): # PYCHOK no cover
|
|
250
250
|
'''(INTERNAL) I{Must be overloaded}.'''
|
|
251
|
-
|
|
251
|
+
self._notOverloaded(*args, **kwds)
|
|
252
252
|
|
|
253
253
|
@property_RO
|
|
254
254
|
def kwds(self):
|
|
@@ -325,7 +325,7 @@ class FrechetDegrees(Frechet):
|
|
|
325
325
|
|
|
326
326
|
def distance(self, point1, point2, *args, **kwds): # PYCHOK no cover
|
|
327
327
|
'''I{Must be overloaded}.'''
|
|
328
|
-
|
|
328
|
+
self._notOverloaded(point1, point2, *args, **kwds)
|
|
329
329
|
|
|
330
330
|
|
|
331
331
|
class FrechetRadians(Frechet):
|
|
@@ -339,7 +339,7 @@ class FrechetRadians(Frechet):
|
|
|
339
339
|
|
|
340
340
|
def distance(self, point1, point2, *args, **kwds): # PYCHOK no cover
|
|
341
341
|
'''I{Must be overloaded}.'''
|
|
342
|
-
|
|
342
|
+
self._notOverloaded(point1, point2, *args, **kwds)
|
|
343
343
|
|
|
344
344
|
def point(self, point):
|
|
345
345
|
'''Return B{C{point}} as L{PhiLam2Tuple} to maintain
|
|
@@ -373,7 +373,7 @@ class _FrechetMeterRadians(Frechet):
|
|
|
373
373
|
|
|
374
374
|
def _func_(self, *args, **kwds): # PYCHOK no cover
|
|
375
375
|
'''(INTERNAL) I{Must be overloaded}.'''
|
|
376
|
-
|
|
376
|
+
self._notOverloaded(*args, **kwds)
|
|
377
377
|
|
|
378
378
|
|
|
379
379
|
class FrechetCosineAndoyerLambert(_FrechetMeterRadians):
|
pygeodesy/fstats.py
CHANGED
|
@@ -15,15 +15,14 @@ from pygeodesy.fmath import hypot2, sqrt
|
|
|
15
15
|
from pygeodesy.fsums import _2float, Fsum, Fmt
|
|
16
16
|
from pygeodesy.interns import NN, _iadd_op_, _invalid_, _other_, _SPACE_
|
|
17
17
|
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY
|
|
18
|
-
from pygeodesy.named import _Named, _NotImplemented,
|
|
19
|
-
property_RO
|
|
18
|
+
from pygeodesy.named import _Named, _NotImplemented, property_RO
|
|
20
19
|
# from pygeodesy.props import property_RO # from .named
|
|
21
20
|
# from pygeodesy.streprs import Fmt # from .fsums
|
|
22
21
|
|
|
23
22
|
# from math import sqrt # from .fmath
|
|
24
23
|
|
|
25
24
|
__all__ = _ALL_LAZY.fstats
|
|
26
|
-
__version__ = '
|
|
25
|
+
__version__ = '24.04.07'
|
|
27
26
|
|
|
28
27
|
_Floats = Fsum, float
|
|
29
28
|
_Scalar = _Floats + (int,) # XXX basics._Ints is ABCMeta in Python 2
|
|
@@ -114,7 +113,7 @@ class _FstatsBase(_FstatsNamed):
|
|
|
114
113
|
|
|
115
114
|
def fadd(self, xs, sample=False): # PYCHOK no cover
|
|
116
115
|
'''I{Must be overloaded}.'''
|
|
117
|
-
|
|
116
|
+
self._notOverloaded(xs, sample=sample)
|
|
118
117
|
|
|
119
118
|
def fadd_(self, *xs, **sample):
|
|
120
119
|
'''Accumulate and return the current count.
|