pygeodesy 24.9.29__py2.py3-none-any.whl → 24.10.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.9.29.dist-info → PyGeodesy-24.10.24.dist-info}/METADATA +15 -15
- {PyGeodesy-24.9.29.dist-info → PyGeodesy-24.10.24.dist-info}/RECORD +56 -56
- pygeodesy/__init__.py +20 -19
- pygeodesy/__main__.py +5 -5
- pygeodesy/albers.py +12 -17
- pygeodesy/basics.py +38 -41
- pygeodesy/booleans.py +54 -46
- pygeodesy/cartesianBase.py +2 -2
- pygeodesy/constants.py +20 -16
- pygeodesy/datums.py +3 -3
- pygeodesy/dms.py +250 -270
- pygeodesy/ellipsoidalBase.py +2 -2
- pygeodesy/ellipsoidalBaseDI.py +10 -10
- pygeodesy/ellipsoidalNvector.py +4 -4
- pygeodesy/ellipsoidalVincenty.py +2 -2
- pygeodesy/ellipsoids.py +7 -48
- pygeodesy/elliptic.py +14 -14
- pygeodesy/errors.py +15 -10
- pygeodesy/etm.py +18 -2
- pygeodesy/fmath.py +188 -176
- pygeodesy/formy.py +4 -4
- pygeodesy/fstats.py +54 -56
- pygeodesy/fsums.py +304 -266
- pygeodesy/geodesici.py +43 -40
- pygeodesy/geodesicw.py +3 -3
- pygeodesy/geodesicx/gxarea.py +3 -2
- pygeodesy/geodsolve.py +73 -24
- pygeodesy/geohash.py +2 -2
- pygeodesy/geoids.py +28 -27
- pygeodesy/internals.py +156 -85
- pygeodesy/interns.py +23 -20
- pygeodesy/karney.py +61 -12
- pygeodesy/latlonBase.py +13 -15
- pygeodesy/lazily.py +206 -214
- pygeodesy/mgrs.py +13 -13
- pygeodesy/named.py +11 -10
- pygeodesy/nvectorBase.py +1 -1
- pygeodesy/points.py +2 -2
- pygeodesy/props.py +34 -13
- pygeodesy/rhumb/bases.py +5 -5
- pygeodesy/rhumb/solve.py +7 -8
- pygeodesy/solveBase.py +7 -25
- pygeodesy/sphericalBase.py +20 -23
- pygeodesy/sphericalNvector.py +24 -23
- pygeodesy/sphericalTrigonometry.py +9 -8
- pygeodesy/streprs.py +11 -8
- pygeodesy/trf.py +6 -4
- pygeodesy/triaxials.py +46 -9
- pygeodesy/units.py +4 -3
- pygeodesy/ups.py +6 -6
- pygeodesy/utily.py +2 -2
- pygeodesy/utm.py +2 -2
- pygeodesy/vector3d.py +5 -5
- pygeodesy/vector3dBase.py +4 -5
- {PyGeodesy-24.9.29.dist-info → PyGeodesy-24.10.24.dist-info}/WHEEL +0 -0
- {PyGeodesy-24.9.29.dist-info → PyGeodesy-24.10.24.dist-info}/top_level.txt +0 -0
pygeodesy/formy.py
CHANGED
|
@@ -20,11 +20,11 @@ from pygeodesy.errors import IntersectionError, LimitError, limiterrors, \
|
|
|
20
20
|
_xcallable,_xkwds, _xkwds_pop2
|
|
21
21
|
from pygeodesy.fmath import euclid, hypot, hypot2, sqrt0
|
|
22
22
|
from pygeodesy.fsums import fsumf_, Fmt, unstr
|
|
23
|
-
# from pygeodesy.internals import
|
|
23
|
+
# from pygeodesy.internals import _DUNDER_nameof # from .named
|
|
24
24
|
from pygeodesy.interns import _delta_, _distant_, _inside_, _SPACE_, _too_
|
|
25
25
|
from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS
|
|
26
26
|
from pygeodesy.named import _name__, _name2__, _NamedTuple, _xnamed, \
|
|
27
|
-
|
|
27
|
+
_DUNDER_nameof
|
|
28
28
|
from pygeodesy.namedTuples import Bearing2Tuple, Distance4Tuple, LatLon2Tuple, \
|
|
29
29
|
Intersection3Tuple, PhiLam2Tuple, Vector3Tuple
|
|
30
30
|
# from pygeodesy.streprs import Fmt, unstr # from .fsums
|
|
@@ -43,7 +43,7 @@ from contextlib import contextmanager
|
|
|
43
43
|
from math import asin, atan, atan2, cos, degrees, fabs, radians, sin, sqrt # pow
|
|
44
44
|
|
|
45
45
|
__all__ = _ALL_LAZY.formy
|
|
46
|
-
__version__ = '24.
|
|
46
|
+
__version__ = '24.10.14'
|
|
47
47
|
|
|
48
48
|
_RADIANS2 = (PI / _180_0)**2 # degrees- to radians-squared
|
|
49
49
|
_ratio_ = 'ratio'
|
|
@@ -1136,7 +1136,7 @@ class _idllmn6(object): # see also .geodesicw._wargs, .latlonBase._toCartesian3
|
|
|
1136
1136
|
_, lat2, lon2 = _Wrap.latlon3(lon1, lat2, lon2, wrap)
|
|
1137
1137
|
kwds = _xkwds(kwds, wrap=wrap) # for _xError
|
|
1138
1138
|
m = small if small is _100km else Meter_(small=small)
|
|
1139
|
-
n =
|
|
1139
|
+
n = _DUNDER_nameof(intersections2 if s else intersection2)
|
|
1140
1140
|
if datum is None or euclidean(lat1, lon1, lat2, lon2) < m:
|
|
1141
1141
|
d, m = None, _MODS.vector3d
|
|
1142
1142
|
_i = m._intersects2 if s else m._intersect3d3
|
pygeodesy/fstats.py
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
u'''Classes for I{running} statistics and regressions based on
|
|
5
|
-
L{pygeodesy.Fsum}, precision floating point summation
|
|
5
|
+
L{pygeodesy.Fsum}, precision floating point summation and accurate
|
|
6
|
+
multiplication.
|
|
6
7
|
'''
|
|
7
8
|
# make sure int/int division yields float quotient, see .basics
|
|
8
9
|
from __future__ import division as _; del _ # PYCHOK semicolon
|
|
@@ -22,36 +23,35 @@ from pygeodesy.named import _name__, _Named, _NotImplemented, \
|
|
|
22
23
|
# from pygeodesy.streprs import Fmt # from .fmath
|
|
23
24
|
|
|
24
25
|
__all__ = _ALL_LAZY.fstats
|
|
25
|
-
__version__ = '24.
|
|
26
|
+
__version__ = '24.10.08'
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
def
|
|
29
|
+
def _sampled(n, sample):
|
|
30
|
+
'''(INTERNAL) Return the sample or the entire count.
|
|
31
|
+
'''
|
|
32
|
+
return (n - 1) if sample and n > 0 else n
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _Xs(**name_xs):
|
|
29
36
|
'''(INTERNAL) Yield all C{xs} as C{float} or L{Fsum}.
|
|
30
37
|
'''
|
|
31
|
-
name, xs = _xkwds_item2(
|
|
38
|
+
name, xs = _xkwds_item2(name_xs)
|
|
32
39
|
try:
|
|
33
|
-
i, x =
|
|
34
|
-
for i, x in enumerate(
|
|
35
|
-
yield x._Fsum if _isFsum_2Tuple(x) else
|
|
40
|
+
i, x = 0, xs
|
|
41
|
+
for i, x in enumerate(xs): # don't unravel Fsums
|
|
42
|
+
yield x._Fsum if _isFsum_2Tuple(x) else x
|
|
36
43
|
except Exception as X:
|
|
37
44
|
raise _xsError(X, xs, i, x, name)
|
|
38
45
|
|
|
39
46
|
|
|
40
|
-
def _sampled(n, sample):
|
|
41
|
-
'''(INTERNAL) Return the sample or the entire count.
|
|
42
|
-
'''
|
|
43
|
-
return (n - 1) if sample and n > 0 else n
|
|
44
|
-
|
|
45
|
-
|
|
46
47
|
class _FstatsNamed(_Named):
|
|
47
48
|
'''(INTERNAL) Base class.
|
|
48
49
|
'''
|
|
49
50
|
_n = 0
|
|
50
51
|
|
|
51
52
|
def __add__(self, other):
|
|
52
|
-
'''Sum of this and an other instance
|
|
53
|
-
|
|
54
|
-
.
|
|
53
|
+
'''Sum of this and an other instance, a C{scalar}, an L{Fsum}
|
|
54
|
+
or L{Fsum2Tuple}.
|
|
55
55
|
'''
|
|
56
56
|
f = self.copy(name=self.__add__.__name__) # PYCHOK expected
|
|
57
57
|
f += other
|
|
@@ -103,7 +103,7 @@ class _FstatsBase(_FstatsNamed):
|
|
|
103
103
|
_Ms = ()
|
|
104
104
|
|
|
105
105
|
def _copy(self, d, s):
|
|
106
|
-
'''(INTERNAL) Copy C{B{
|
|
106
|
+
'''(INTERNAL) Copy C{B{d} = B{s}}.
|
|
107
107
|
'''
|
|
108
108
|
_xinstanceof(self.__class__, d=d, s=s)
|
|
109
109
|
d._Ms = tuple(M.copy() for M in s._Ms) # deep=False
|
|
@@ -124,8 +124,8 @@ class _FstatsBase(_FstatsNamed):
|
|
|
124
124
|
def fmean(self, xs=None):
|
|
125
125
|
'''Accumulate and return the current mean.
|
|
126
126
|
|
|
127
|
-
@kwarg xs: Iterable of additional values (each C{scalar}
|
|
128
|
-
an L{Fsum} or L{Fsum2Tuple}
|
|
127
|
+
@kwarg xs: Iterable of additional values (each C{scalar},
|
|
128
|
+
an L{Fsum} or L{Fsum2Tuple}).
|
|
129
129
|
|
|
130
130
|
@return: Current, running mean (C{float}).
|
|
131
131
|
|
|
@@ -143,8 +143,8 @@ class _FstatsBase(_FstatsNamed):
|
|
|
143
143
|
def fstdev(self, xs=None, **sample):
|
|
144
144
|
'''Accumulate and return the current standard deviation.
|
|
145
145
|
|
|
146
|
-
@arg xs: Iterable of additional values (each C{scalar}
|
|
147
|
-
|
|
146
|
+
@arg xs: Iterable of additional values (each C{scalar}, an L{Fsum}
|
|
147
|
+
or L{Fsum2Tuple}).
|
|
148
148
|
@kwarg sample: Use C{B{sample}=True} for the I{sample} deviation
|
|
149
149
|
instead of the I{population} deviation (C{bool}).
|
|
150
150
|
|
|
@@ -164,8 +164,8 @@ class _FstatsBase(_FstatsNamed):
|
|
|
164
164
|
def fvariance(self, xs=None, **sample):
|
|
165
165
|
'''Accumulate and return the current variance.
|
|
166
166
|
|
|
167
|
-
@arg xs: Iterable of additional values (each C{scalar}
|
|
168
|
-
|
|
167
|
+
@arg xs: Iterable of additional values (each C{scalar}, an L{Fsum}
|
|
168
|
+
or L{Fsum2Tuple}).
|
|
169
169
|
@kwarg sample: Use C{B{sample}=True} for the I{sample} variance
|
|
170
170
|
instead of the I{population} variance (C{bool}).
|
|
171
171
|
|
|
@@ -238,8 +238,8 @@ class Fcook(_FstatsBase):
|
|
|
238
238
|
def __init__(self, xs=None, **name):
|
|
239
239
|
'''New L{Fcook} stats accumulator.
|
|
240
240
|
|
|
241
|
-
@arg xs: Iterable of additional values (each C{scalar}
|
|
242
|
-
|
|
241
|
+
@arg xs: Iterable of additional values (each C{scalar}, an
|
|
242
|
+
L{Fsum} or L{Fsum2Tuple}).
|
|
243
243
|
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
244
244
|
|
|
245
245
|
@see: Method L{Fcook.fadd}.
|
|
@@ -254,8 +254,8 @@ class Fcook(_FstatsBase):
|
|
|
254
254
|
'''Add B{C{other}} to this L{Fcook} instance.
|
|
255
255
|
|
|
256
256
|
@arg other: An L{Fcook} instance or value or iterable
|
|
257
|
-
of values (each C{scalar}
|
|
258
|
-
|
|
257
|
+
of values (each C{scalar}, an L{Fsum} or
|
|
258
|
+
L{Fsum2Tuple}).
|
|
259
259
|
|
|
260
260
|
@return: This instance, updated (L{Fcook}).
|
|
261
261
|
|
|
@@ -311,8 +311,8 @@ class Fcook(_FstatsBase):
|
|
|
311
311
|
def fadd(self, xs, sample=False):
|
|
312
312
|
'''Accumulate and return the current count.
|
|
313
313
|
|
|
314
|
-
@arg xs: Iterable of additional values (each C{scalar}
|
|
315
|
-
L{Fsum} or L{Fsum2Tuple}
|
|
314
|
+
@arg xs: Iterable of additional values (each C{scalar}, an
|
|
315
|
+
L{Fsum} or L{Fsum2Tuple}).
|
|
316
316
|
@kwarg sample: Use C{B{sample}=True} for the I{sample} count
|
|
317
317
|
instead of the I{population} count (C{bool}).
|
|
318
318
|
|
|
@@ -330,7 +330,7 @@ class Fcook(_FstatsBase):
|
|
|
330
330
|
n = self._n
|
|
331
331
|
if xs:
|
|
332
332
|
M1, M2, M3, M4 = self._Ms
|
|
333
|
-
for x in
|
|
333
|
+
for x in _Xs(xs=xs): # PYCHOK yield
|
|
334
334
|
n1 = n
|
|
335
335
|
n += 1
|
|
336
336
|
D = x - M1
|
|
@@ -364,7 +364,7 @@ class Fcook(_FstatsBase):
|
|
|
364
364
|
'''Accumulate and compute the current U{Jarque-Bera
|
|
365
365
|
<https://WikiPedia.org/wiki/Jarque–Bera_test>} normality.
|
|
366
366
|
|
|
367
|
-
@kwarg xs: Iterable of additional values (each C{scalar}
|
|
367
|
+
@kwarg xs: Iterable of additional values (each C{scalar}, an
|
|
368
368
|
L{Fsum} or L{Fsum2Tuple}).
|
|
369
369
|
@kwarg excess: Apply the I{excess} kurtosis (C{bool}), default.
|
|
370
370
|
@kwarg sample: Use C{B{sample}=False} for the I{population}
|
|
@@ -387,8 +387,8 @@ class Fcook(_FstatsBase):
|
|
|
387
387
|
def fkurtosis(self, xs=None, excess=True, **sample):
|
|
388
388
|
'''Accumulate and return the current kurtosis.
|
|
389
389
|
|
|
390
|
-
@arg xs: Iterable of additional values (each C{scalar}
|
|
391
|
-
|
|
390
|
+
@arg xs: Iterable of additional values (each C{scalar}, an L{Fsum}
|
|
391
|
+
or L{Fsum2Tuple}).
|
|
392
392
|
@kwarg excess: Return the I{excess} kurtosis (C{bool}), default.
|
|
393
393
|
@kwarg sample: Use C{B{sample}=True} for the I{sample} kurtosis
|
|
394
394
|
instead of the I{population} kurtosis (C{bool}).
|
|
@@ -413,8 +413,8 @@ class Fcook(_FstatsBase):
|
|
|
413
413
|
def fmedian(self, xs=None):
|
|
414
414
|
'''Accumulate and return the current median.
|
|
415
415
|
|
|
416
|
-
@arg xs: Iterable of additional values (each C{scalar} or
|
|
417
|
-
L{
|
|
416
|
+
@arg xs: Iterable of additional values (each C{scalar}, an L{Fsum} or
|
|
417
|
+
L{Fsum2Tuple}).
|
|
418
418
|
|
|
419
419
|
@return: Current, running median (C{float}).
|
|
420
420
|
|
|
@@ -435,8 +435,8 @@ class Fcook(_FstatsBase):
|
|
|
435
435
|
def fskewness(self, xs=None, **sample):
|
|
436
436
|
'''Accumulate and return the current skewness.
|
|
437
437
|
|
|
438
|
-
@arg xs: Iterable of additional values (each C{scalar}
|
|
439
|
-
|
|
438
|
+
@arg xs: Iterable of additional values (each C{scalar}, an L{Fsum}
|
|
439
|
+
or L{Fsum2Tuple}).
|
|
440
440
|
@kwarg sample: Use C{B{sample}=True} for the I{sample} skewness
|
|
441
441
|
instead of the I{population} skewness (C{bool}).
|
|
442
442
|
|
|
@@ -526,8 +526,7 @@ class Fwelford(_FstatsBase):
|
|
|
526
526
|
def __init__(self, xs=None, **name):
|
|
527
527
|
'''New L{Fwelford} stats accumulator.
|
|
528
528
|
|
|
529
|
-
@arg xs: Iterable of initial values (each C{scalar} or
|
|
530
|
-
L{Fsum} or L{Fsum2Tuple} instance).
|
|
529
|
+
@arg xs: Iterable of initial values (each C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
|
|
531
530
|
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
532
531
|
|
|
533
532
|
@see: Method L{Fwelford.fadd}.
|
|
@@ -541,9 +540,9 @@ class Fwelford(_FstatsBase):
|
|
|
541
540
|
def __iadd__(self, other):
|
|
542
541
|
'''Add B{C{other}} to this L{Fwelford} instance.
|
|
543
542
|
|
|
544
|
-
@arg other: An L{Fwelford} or L{Fcook} instance or value
|
|
545
|
-
|
|
546
|
-
|
|
543
|
+
@arg other: An L{Fwelford} or L{Fcook} instance or value or an
|
|
544
|
+
iterable of values (each C{scalar}, an L{Fsum} or
|
|
545
|
+
L{Fsum2Tuple}).
|
|
547
546
|
|
|
548
547
|
@return: This instance, updated (L{Fwelford}).
|
|
549
548
|
|
|
@@ -590,8 +589,8 @@ class Fwelford(_FstatsBase):
|
|
|
590
589
|
def fadd(self, xs, sample=False):
|
|
591
590
|
'''Accumulate and return the current count.
|
|
592
591
|
|
|
593
|
-
@arg xs: Iterable of additional values (each C{scalar}
|
|
594
|
-
L{Fsum} or L{Fsum2Tuple}
|
|
592
|
+
@arg xs: Iterable of additional values (each C{scalar}, an
|
|
593
|
+
L{Fsum} or L{Fsum2Tuple}).
|
|
595
594
|
@kwarg sample: Use C{B{sample}=True} for the I{sample} count
|
|
596
595
|
instead of the I{population} count (C{bool}).
|
|
597
596
|
|
|
@@ -606,7 +605,7 @@ class Fwelford(_FstatsBase):
|
|
|
606
605
|
n = self._n
|
|
607
606
|
if xs:
|
|
608
607
|
M, S = self._Ms
|
|
609
|
-
for x in
|
|
608
|
+
for x in _Xs(xs=xs): # PYCHOK yield
|
|
610
609
|
n += 1
|
|
611
610
|
D = x - M
|
|
612
611
|
M += D / n
|
|
@@ -625,10 +624,10 @@ class Flinear(_FstatsNamed):
|
|
|
625
624
|
def __init__(self, xs=None, ys=None, Fstats=Fwelford, **name):
|
|
626
625
|
'''New L{Flinear} regression accumulator.
|
|
627
626
|
|
|
628
|
-
@kwarg xs: Iterable of initial C{x} values (each C{scalar}
|
|
629
|
-
an L{Fsum} or L{Fsum2Tuple}
|
|
630
|
-
@kwarg ys: Iterable of initial C{y} values (each C{scalar}
|
|
631
|
-
an L{Fsum} or L{Fsum2Tuple}
|
|
627
|
+
@kwarg xs: Iterable of initial C{x} values (each C{scalar},
|
|
628
|
+
an L{Fsum} or L{Fsum2Tuple}).
|
|
629
|
+
@kwarg ys: Iterable of initial C{y} values (each C{scalar},
|
|
630
|
+
an L{Fsum} or L{Fsum2Tuple}).
|
|
632
631
|
@kwarg Fstats: Class for C{xs} and C{ys} values (L{Fcook} or
|
|
633
632
|
L{Fwelford}).
|
|
634
633
|
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
@@ -704,10 +703,10 @@ class Flinear(_FstatsNamed):
|
|
|
704
703
|
def fadd(self, xs, ys, sample=False):
|
|
705
704
|
'''Accumulate and return the current count.
|
|
706
705
|
|
|
707
|
-
@arg xs: Iterable of additional C{x} values (each C{scalar}
|
|
708
|
-
|
|
709
|
-
@arg ys: Iterable of additional C{y} values (each C{scalar}
|
|
710
|
-
|
|
706
|
+
@arg xs: Iterable of additional C{x} values (each C{scalar},
|
|
707
|
+
an L{Fsum} or L{Fsum2Tuple}).
|
|
708
|
+
@arg ys: Iterable of additional C{y} values (each C{scalar},
|
|
709
|
+
an L{Fsum} or L{Fsum2Tuple}).
|
|
711
710
|
@kwarg sample: Use C{B{sample}=True} for the I{sample} count
|
|
712
711
|
instead of the I{population} count (C{bool}).
|
|
713
712
|
|
|
@@ -724,7 +723,7 @@ class Flinear(_FstatsNamed):
|
|
|
724
723
|
S = self._S
|
|
725
724
|
X = self._X
|
|
726
725
|
Y = self._Y
|
|
727
|
-
for x, y in _zip(
|
|
726
|
+
for x, y in _zip(_Xs(xs=xs), _Xs(ys=ys)): # PYCHOK strict=True
|
|
728
727
|
n1 = n
|
|
729
728
|
n += 1
|
|
730
729
|
if n1 > 0:
|
|
@@ -738,8 +737,7 @@ class Flinear(_FstatsNamed):
|
|
|
738
737
|
'''Accumulate and return the current count.
|
|
739
738
|
|
|
740
739
|
@arg x_ys: Individual, alternating C{x, y, x, y, ...} values
|
|
741
|
-
(each C{scalar}
|
|
742
|
-
instance).
|
|
740
|
+
(each C{scalar}, an L{Fsum} or L{Fsum2Tuple}).
|
|
743
741
|
|
|
744
742
|
@see: Method C{Flinear.fadd} for further details.
|
|
745
743
|
'''
|