pygeodesy 24.9.9__py2.py3-none-any.whl → 24.9.29__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.9.9.dist-info → PyGeodesy-24.9.29.dist-info}/METADATA +7 -7
- {PyGeodesy-24.9.9.dist-info → PyGeodesy-24.9.29.dist-info}/RECORD +24 -24
- pygeodesy/__init__.py +7 -5
- pygeodesy/basics.py +11 -12
- pygeodesy/booleans.py +6 -7
- pygeodesy/clipy.py +7 -7
- pygeodesy/constants.py +21 -7
- pygeodesy/deprecated/__init__.py +1 -1
- pygeodesy/deprecated/functions.py +9 -1
- pygeodesy/ellipsoidalBaseDI.py +4 -4
- pygeodesy/errors.py +40 -5
- pygeodesy/fmath.py +43 -21
- pygeodesy/formy.py +2 -1
- pygeodesy/fstats.py +10 -14
- pygeodesy/fsums.py +819 -511
- pygeodesy/karney.py +1 -5
- pygeodesy/lazily.py +6 -6
- pygeodesy/points.py +3 -3
- pygeodesy/resections.py +2 -2
- pygeodesy/sphericalNvector.py +4 -4
- pygeodesy/sphericalTrigonometry.py +2 -2
- pygeodesy/streprs.py +14 -7
- {PyGeodesy-24.9.9.dist-info → PyGeodesy-24.9.29.dist-info}/WHEEL +0 -0
- {PyGeodesy-24.9.9.dist-info → PyGeodesy-24.9.29.dist-info}/top_level.txt +0 -0
pygeodesy/fmath.py
CHANGED
|
@@ -10,11 +10,11 @@ from pygeodesy.basics import _copysign, copysign0, isbool, isint, isscalar, \
|
|
|
10
10
|
len2, map1, _xiterable
|
|
11
11
|
from pygeodesy.constants import EPS0, EPS02, EPS1, NAN, PI, PI_2, PI_4, \
|
|
12
12
|
_0_0, _0_125, _1_6th, _0_25, _1_3rd, _0_5, _1_0, \
|
|
13
|
-
_N_1_0, _1_5, _copysign_0_0,
|
|
13
|
+
_N_1_0, _1_5, _copysign_0_0, isfinite, remainder
|
|
14
14
|
from pygeodesy.errors import _IsnotError, LenError, _TypeError, _ValueError, \
|
|
15
|
-
_xError, _xkwds_get1, _xkwds_pop2
|
|
16
|
-
from pygeodesy.fsums import _2float, Fsum, fsum, fsum1_,
|
|
17
|
-
Fmt, unstr
|
|
15
|
+
_xError, _xkwds_get1, _xkwds_pop2, _xsError
|
|
16
|
+
from pygeodesy.fsums import _2float, Fsum, fsum, fsum1_, _isFsum_2Tuple, \
|
|
17
|
+
_1primed, _Psum_, Fmt, unstr
|
|
18
18
|
from pygeodesy.interns import MISSING, _negative_, _not_scalar_
|
|
19
19
|
from pygeodesy.lazily import _ALL_LAZY, _sys_version_info2
|
|
20
20
|
# from pygeodesy.streprs import Fmt, unstr # from .fsums
|
|
@@ -24,7 +24,7 @@ from math import fabs, sqrt # pow
|
|
|
24
24
|
import operator as _operator # in .datums, .trf, .utm
|
|
25
25
|
|
|
26
26
|
__all__ = _ALL_LAZY.fmath
|
|
27
|
-
__version__ = '24.09.
|
|
27
|
+
__version__ = '24.09.29'
|
|
28
28
|
|
|
29
29
|
# sqrt(2) - 1 <https://WikiPedia.org/wiki/Square_root_of_2>
|
|
30
30
|
_0_4142 = 0.41421356237309504880 # ... ~ 3730904090310553 / 9007199254740992
|
|
@@ -262,7 +262,7 @@ def cbrt(x):
|
|
|
262
262
|
|
|
263
263
|
@see: Functions L{cbrt2} and L{sqrt3}.
|
|
264
264
|
'''
|
|
265
|
-
if
|
|
265
|
+
if _isFsum_2Tuple(x):
|
|
266
266
|
r = abs(x).fpow(_1_3rd)
|
|
267
267
|
if x.signOf() < 0:
|
|
268
268
|
r = -r
|
|
@@ -280,7 +280,7 @@ def cbrt2(x): # PYCHOK attr
|
|
|
280
280
|
|
|
281
281
|
@see: Functions L{cbrt} and L{sqrt3}.
|
|
282
282
|
'''
|
|
283
|
-
return abs(x).fpow(_2_3rd) if
|
|
283
|
+
return abs(x).fpow(_2_3rd) if _isFsum_2Tuple(x) else _cbrt(x**2)
|
|
284
284
|
|
|
285
285
|
|
|
286
286
|
def euclid(x, y):
|
|
@@ -431,8 +431,9 @@ def fdot(a, *b):
|
|
|
431
431
|
|
|
432
432
|
@raise LenError: Unequal C{len(B{a})} and C{len(B{b})}.
|
|
433
433
|
|
|
434
|
-
@see: Class L{Fdot}
|
|
435
|
-
<https://www.TUHH.De/ti3/paper/rump/OgRuOi05.pdf>}
|
|
434
|
+
@see: Class L{Fdot}, U{Algorithm 5.10 B{DotK}
|
|
435
|
+
<https://www.TUHH.De/ti3/paper/rump/OgRuOi05.pdf>} and function
|
|
436
|
+
C{math.sumprod} in Python 3.12 and later.
|
|
436
437
|
'''
|
|
437
438
|
return fsum(_map_mul(a, b, fdot))
|
|
438
439
|
|
|
@@ -544,16 +545,20 @@ def fidw(xs, ds, beta=2):
|
|
|
544
545
|
return x
|
|
545
546
|
|
|
546
547
|
|
|
547
|
-
def fma(x, y, z):
|
|
548
|
-
'''Fused-multiply-add,
|
|
548
|
+
def fma(x, y, z, **nonfinites):
|
|
549
|
+
'''Fused-multiply-add, using C{math.fma(x, y, z)} in Python 3.13+
|
|
550
|
+
or an equivalent implementation.
|
|
549
551
|
|
|
550
|
-
@arg x:
|
|
551
|
-
@arg y:
|
|
552
|
-
@arg z:
|
|
552
|
+
@arg x: Multiplicand (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
|
|
553
|
+
@arg y: Multiplier (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
|
|
554
|
+
@arg z: Addend (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
|
|
555
|
+
@kwarg nonfinites: Use C{B{nonfinites}=True} or C{=False}, to
|
|
556
|
+
override default L{nonfiniterrors} (C{bool}),
|
|
557
|
+
see L{Fsum<Fsum.__init__>},
|
|
553
558
|
|
|
554
|
-
@return: C{(x * y) + z} (
|
|
559
|
+
@return: C{(x * y) + z} (L{Fsum} or C{float}).
|
|
555
560
|
'''
|
|
556
|
-
return
|
|
561
|
+
return _Psum_(x).fma(y, z, **nonfinites).as_iscalar
|
|
557
562
|
|
|
558
563
|
|
|
559
564
|
def fmean(xs):
|
|
@@ -581,6 +586,22 @@ def fmean_(*xs):
|
|
|
581
586
|
return fmean(xs)
|
|
582
587
|
|
|
583
588
|
|
|
589
|
+
def f2mul_(x, *ys, **nonfinites):
|
|
590
|
+
'''Cascaded, accurate multiplication C{B{x} * B{y} * B{y} ...} for all B{C{ys}}.
|
|
591
|
+
|
|
592
|
+
@arg x: Multiplicand (C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
|
|
593
|
+
@arg ys: Multipliers (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}), all
|
|
594
|
+
positional.
|
|
595
|
+
@kwarg nonfinites: Use C{B{nonfinites}=True} or C{=False}, to override default
|
|
596
|
+
L{nonfiniterrors} (C{bool}), see L{Fsum<Fsum.__init__>}.
|
|
597
|
+
|
|
598
|
+
@return: The cascaded I{TwoProduct} (L{Fsum}, C{float} or C{int}).
|
|
599
|
+
|
|
600
|
+
@see: U{Equations 2.3<https://www.TUHH.De/ti3/paper/rump/OzOgRuOi06.pdf>}
|
|
601
|
+
'''
|
|
602
|
+
return _Psum_(x).f2mul_(*ys, **nonfinites).as_iscalar
|
|
603
|
+
|
|
604
|
+
|
|
584
605
|
def fpolynomial(x, *cs, **over):
|
|
585
606
|
'''Evaluate the polynomial M{sum(cs[i] * x**i for i=0..len(cs))
|
|
586
607
|
[/ over]}.
|
|
@@ -615,7 +636,7 @@ def fpowers(x, n, alts=0):
|
|
|
615
636
|
elif n < 1:
|
|
616
637
|
raise _ValueError(n=n)
|
|
617
638
|
|
|
618
|
-
p = x if
|
|
639
|
+
p = x if isscalar(x) or _isFsum_2Tuple(x) else _2float(x=x)
|
|
619
640
|
ps = tuple(_powers(p, n))
|
|
620
641
|
|
|
621
642
|
if alts > 0: # x**2, x**4, ...
|
|
@@ -752,7 +773,7 @@ def fremainder(x, y):
|
|
|
752
773
|
# On Windows 32-bit with python 2.7, math.fmod(-0.0, 360)
|
|
753
774
|
# == +0.0. This fixes this bug. See also Math::AngNormalize
|
|
754
775
|
# in the C++ library, Math.sincosd has a similar fix.
|
|
755
|
-
if
|
|
776
|
+
if isfinite(x):
|
|
756
777
|
try:
|
|
757
778
|
r = remainder(x, y) if x else x
|
|
758
779
|
except Exception as e:
|
|
@@ -818,7 +839,7 @@ def hypot1(x):
|
|
|
818
839
|
|
|
819
840
|
@return: Norm (C{float}).
|
|
820
841
|
'''
|
|
821
|
-
if
|
|
842
|
+
if _isFsum_2Tuple(x):
|
|
822
843
|
h = float(Fhypot(_1_0, x)) if x else _1_0
|
|
823
844
|
else:
|
|
824
845
|
h = hypot(_1_0, x) if x else _1_0
|
|
@@ -916,13 +937,14 @@ def norm_(*xs):
|
|
|
916
937
|
or zero norm.
|
|
917
938
|
'''
|
|
918
939
|
try:
|
|
919
|
-
i =
|
|
940
|
+
i = h = None
|
|
941
|
+
x = xs
|
|
920
942
|
h = hypot_(*xs)
|
|
921
943
|
_h = (_1_0 / h) if h else _0_0
|
|
922
944
|
for i, x in enumerate(xs):
|
|
923
945
|
yield x * _h
|
|
924
946
|
except Exception as X:
|
|
925
|
-
raise
|
|
947
|
+
raise _xsError(X, xs, i, x, h=h)
|
|
926
948
|
|
|
927
949
|
|
|
928
950
|
def _powers(x, n):
|
pygeodesy/formy.py
CHANGED
|
@@ -6,6 +6,7 @@ u'''Formulary of basic geodesy functions and approximations.
|
|
|
6
6
|
# make sure int/int division yields float quotient, see .basics
|
|
7
7
|
from __future__ import division as _; del _ # PYCHOK semicolon
|
|
8
8
|
|
|
9
|
+
# from pygeodesy.basics import W_args_kwds_count2
|
|
9
10
|
# from pygeodesy.cartesianBase import CartesianBase # _MODS
|
|
10
11
|
from pygeodesy.constants import EPS, EPS0, EPS1, PI, PI2, PI3, PI_2, R_M, \
|
|
11
12
|
_0_0s, float0_, isnon0, remainder, _umod_PI2, \
|
|
@@ -42,7 +43,7 @@ from contextlib import contextmanager
|
|
|
42
43
|
from math import asin, atan, atan2, cos, degrees, fabs, radians, sin, sqrt # pow
|
|
43
44
|
|
|
44
45
|
__all__ = _ALL_LAZY.formy
|
|
45
|
-
__version__ = '24.
|
|
46
|
+
__version__ = '24.09.27'
|
|
46
47
|
|
|
47
48
|
_RADIANS2 = (PI / _180_0)**2 # degrees- to radians-squared
|
|
48
49
|
_ratio_ = 'ratio'
|
pygeodesy/fstats.py
CHANGED
|
@@ -10,9 +10,10 @@ from __future__ import division as _; del _ # PYCHOK semicolon
|
|
|
10
10
|
from pygeodesy.basics import isscalar, isodd, _xinstanceof, \
|
|
11
11
|
_xiterable, _xsubclassof, _zip
|
|
12
12
|
from pygeodesy.constants import _0_0, _1_0, _2_0, _3_0, _4_0, _6_0
|
|
13
|
-
from pygeodesy.errors import
|
|
13
|
+
from pygeodesy.errors import _ValueError, _xError, _xkwds_item2, \
|
|
14
|
+
_xsError
|
|
14
15
|
from pygeodesy.fmath import Fsqrt, Fmt
|
|
15
|
-
from pygeodesy.fsums import _2finite, Fsum, _iadd_op_,
|
|
16
|
+
from pygeodesy.fsums import _2finite, Fsum, _iadd_op_, _isFsum_2Tuple
|
|
16
17
|
from pygeodesy.interns import _odd_, _SPACE_
|
|
17
18
|
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY
|
|
18
19
|
from pygeodesy.named import _name__, _Named, _NotImplemented, \
|
|
@@ -21,24 +22,19 @@ from pygeodesy.named import _name__, _Named, _NotImplemented, \
|
|
|
21
22
|
# from pygeodesy.streprs import Fmt # from .fmath
|
|
22
23
|
|
|
23
24
|
__all__ = _ALL_LAZY.fstats
|
|
24
|
-
__version__ = '24.
|
|
25
|
+
__version__ = '24.09.28'
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
def _2Floats(**xs):
|
|
28
|
-
'''(INTERNAL) Yield
|
|
29
|
+
'''(INTERNAL) Yield all C{xs} as C{float} or L{Fsum}.
|
|
29
30
|
'''
|
|
31
|
+
name, xs = _xkwds_item2(xs)
|
|
30
32
|
try:
|
|
31
|
-
|
|
32
|
-
except Exception as X:
|
|
33
|
-
raise _AssertionError(xs=xs, cause=X)
|
|
34
|
-
|
|
35
|
-
try:
|
|
36
|
-
i = None
|
|
33
|
+
i, x = None, xs
|
|
37
34
|
for i, x in enumerate(_xiterable(xs)): # don't unravel Fsums
|
|
38
|
-
yield x._Fsum if
|
|
35
|
+
yield x._Fsum if _isFsum_2Tuple(x) else _2finite(x)
|
|
39
36
|
except Exception as X:
|
|
40
|
-
raise
|
|
41
|
-
_xError(X, Fmt.INDEX(name, i), x)
|
|
37
|
+
raise _xsError(X, xs, i, x, name)
|
|
42
38
|
|
|
43
39
|
|
|
44
40
|
def _sampled(n, sample):
|
|
@@ -190,7 +186,7 @@ class _FstatsBase(_FstatsNamed):
|
|
|
190
186
|
'''(INTERNAL) Add one or several values.
|
|
191
187
|
'''
|
|
192
188
|
try:
|
|
193
|
-
if
|
|
189
|
+
if _isFsum_2Tuple(other):
|
|
194
190
|
self.fadd_(other._Fsum)
|
|
195
191
|
elif isscalar(other):
|
|
196
192
|
self.fadd_(_2finite(other))
|