pygeodesy 24.5.8__py2.py3-none-any.whl → 24.5.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.5.8.dist-info → PyGeodesy-24.5.24.dist-info}/METADATA +2 -2
- PyGeodesy-24.5.24.dist-info/RECORD +116 -0
- pygeodesy/__init__.py +16 -12
- pygeodesy/__main__.py +9 -10
- pygeodesy/albers.py +42 -42
- pygeodesy/auxilats/__init__.py +1 -1
- pygeodesy/auxilats/__main__.py +7 -10
- pygeodesy/auxilats/auxAngle.py +32 -31
- pygeodesy/auxilats/auxLat.py +81 -51
- pygeodesy/azimuthal.py +123 -124
- pygeodesy/basics.py +165 -176
- pygeodesy/booleans.py +14 -15
- pygeodesy/cartesianBase.py +25 -23
- pygeodesy/clipy.py +3 -3
- pygeodesy/constants.py +8 -6
- pygeodesy/css.py +50 -42
- pygeodesy/datums.py +50 -48
- pygeodesy/dms.py +6 -6
- pygeodesy/ecef.py +27 -27
- pygeodesy/elevations.py +2 -2
- pygeodesy/ellipsoidalBase.py +28 -27
- pygeodesy/ellipsoidalBaseDI.py +8 -7
- pygeodesy/ellipsoidalNvector.py +11 -12
- pygeodesy/ellipsoids.py +41 -35
- pygeodesy/elliptic.py +12 -10
- pygeodesy/epsg.py +4 -3
- pygeodesy/errors.py +35 -13
- pygeodesy/etm.py +62 -53
- pygeodesy/fmath.py +48 -41
- pygeodesy/formy.py +93 -65
- pygeodesy/frechet.py +117 -102
- pygeodesy/fstats.py +52 -46
- pygeodesy/fsums.py +169 -145
- pygeodesy/gars.py +10 -9
- pygeodesy/geodesicw.py +32 -30
- pygeodesy/geodesicx/__init__.py +1 -1
- pygeodesy/geodesicx/__main__.py +4 -4
- pygeodesy/geodesicx/gx.py +40 -32
- pygeodesy/geodesicx/gxarea.py +15 -12
- pygeodesy/geodesicx/gxbases.py +3 -4
- pygeodesy/geodesicx/gxline.py +6 -8
- pygeodesy/geodsolve.py +28 -26
- pygeodesy/geohash.py +47 -44
- pygeodesy/geoids.py +37 -35
- pygeodesy/hausdorff.py +112 -99
- pygeodesy/heights.py +136 -129
- pygeodesy/internals.py +576 -0
- pygeodesy/interns.py +6 -207
- pygeodesy/iters.py +22 -19
- pygeodesy/karney.py +18 -15
- pygeodesy/ktm.py +31 -24
- pygeodesy/latlonBase.py +12 -11
- pygeodesy/lazily.py +140 -218
- pygeodesy/lcc.py +24 -25
- pygeodesy/ltp.py +83 -71
- pygeodesy/ltpTuples.py +7 -5
- pygeodesy/mgrs.py +5 -4
- pygeodesy/named.py +136 -49
- pygeodesy/namedTuples.py +33 -25
- pygeodesy/nvectorBase.py +10 -9
- pygeodesy/osgr.py +14 -12
- pygeodesy/points.py +13 -13
- pygeodesy/props.py +7 -7
- pygeodesy/rhumb/__init__.py +1 -1
- pygeodesy/rhumb/bases.py +3 -2
- pygeodesy/rhumb/solve.py +2 -2
- pygeodesy/solveBase.py +8 -7
- pygeodesy/sphericalTrigonometry.py +5 -5
- pygeodesy/streprs.py +8 -7
- pygeodesy/trf.py +8 -8
- pygeodesy/triaxials.py +67 -63
- pygeodesy/units.py +48 -50
- pygeodesy/unitsBase.py +24 -11
- pygeodesy/ups.py +7 -6
- pygeodesy/utily.py +4 -4
- pygeodesy/utm.py +53 -52
- pygeodesy/utmupsBase.py +11 -8
- pygeodesy/vector2d.py +6 -7
- pygeodesy/vector3d.py +16 -17
- pygeodesy/vector3dBase.py +5 -5
- PyGeodesy-24.5.8.dist-info/RECORD +0 -115
- {PyGeodesy-24.5.8.dist-info → PyGeodesy-24.5.24.dist-info}/WHEEL +0 -0
- {PyGeodesy-24.5.8.dist-info → PyGeodesy-24.5.24.dist-info}/top_level.txt +0 -0
pygeodesy/fstats.py
CHANGED
|
@@ -11,17 +11,17 @@ 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
13
|
from pygeodesy.errors import _AssertionError, _ValueError, _xError
|
|
14
|
-
from pygeodesy.fmath import Fsqrt
|
|
15
|
-
from pygeodesy.fsums import _2finite,
|
|
16
|
-
|
|
17
|
-
from pygeodesy.interns import NN, _odd_, _SPACE_
|
|
14
|
+
from pygeodesy.fmath import Fsqrt, Fmt
|
|
15
|
+
from pygeodesy.fsums import _2finite, Fsum, _iadd_op_, _isFsumTuple
|
|
16
|
+
from pygeodesy.interns import _odd_, _SPACE_
|
|
18
17
|
from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY
|
|
19
|
-
from pygeodesy.named import _Named, _NotImplemented,
|
|
18
|
+
from pygeodesy.named import _name__, _Named, _NotImplemented, \
|
|
19
|
+
property_RO
|
|
20
20
|
# from pygeodesy.props import property_RO # from .named
|
|
21
|
-
# from pygeodesy.streprs import Fmt # from .
|
|
21
|
+
# from pygeodesy.streprs import Fmt # from .fmath
|
|
22
22
|
|
|
23
23
|
__all__ = _ALL_LAZY.fstats
|
|
24
|
-
__version__ = '24.05.
|
|
24
|
+
__version__ = '24.05.21'
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def _2Floats(**xs):
|
|
@@ -33,11 +33,12 @@ def _2Floats(**xs):
|
|
|
33
33
|
raise _AssertionError(xs=xs, cause=X)
|
|
34
34
|
|
|
35
35
|
try:
|
|
36
|
-
i
|
|
37
|
-
for i, x in enumerate(xs): # don't unravel Fsums
|
|
36
|
+
i = None
|
|
37
|
+
for i, x in enumerate(_xiterable(xs)): # don't unravel Fsums
|
|
38
38
|
yield x._Fsum if _isFsumTuple(x) else _2finite(x)
|
|
39
39
|
except Exception as X:
|
|
40
|
-
raise _xError(X,
|
|
40
|
+
raise _xError(X, name, xs) if i is None else \
|
|
41
|
+
_xError(X, Fmt.INDEX(name, i), x)
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
def _sampled(n, sample):
|
|
@@ -86,10 +87,14 @@ class _FstatsNamed(_Named):
|
|
|
86
87
|
n = _SPACE_(self.classname, n) if n else self.classname
|
|
87
88
|
return Fmt.SQUARE(n, len(self))
|
|
88
89
|
|
|
89
|
-
def copy(self, deep=False, name
|
|
90
|
+
def copy(self, deep=False, **name):
|
|
90
91
|
'''Copy this instance, C{shallow} or B{C{deep}}.
|
|
92
|
+
|
|
93
|
+
@kwarg name: Optional, overriding C{B{name}="copy"} (C{str}).
|
|
94
|
+
|
|
95
|
+
@return: The copy instance.
|
|
91
96
|
'''
|
|
92
|
-
n =
|
|
97
|
+
n = _name__(name, name__=self.copy)
|
|
93
98
|
f = _Named.copy(self, deep=deep, name=n)
|
|
94
99
|
return self._copy(f, self) # PYCHOK expected
|
|
95
100
|
|
|
@@ -105,8 +110,8 @@ class _FstatsBase(_FstatsNamed):
|
|
|
105
110
|
'''(INTERNAL) Copy C{B{c} = B{s}}.
|
|
106
111
|
'''
|
|
107
112
|
_xinstanceof(self.__class__, d=d, s=s)
|
|
108
|
-
d._Ms =
|
|
109
|
-
d._n =
|
|
113
|
+
d._Ms = tuple(M.copy() for M in s._Ms) # deep=False
|
|
114
|
+
d._n = s._n
|
|
110
115
|
return d
|
|
111
116
|
|
|
112
117
|
def fadd(self, xs, sample=False): # PYCHOK no cover
|
|
@@ -130,7 +135,7 @@ class _FstatsBase(_FstatsNamed):
|
|
|
130
135
|
|
|
131
136
|
@see: Method C{fadd}.
|
|
132
137
|
'''
|
|
133
|
-
return
|
|
138
|
+
return float(self._Mean(xs))
|
|
134
139
|
|
|
135
140
|
def fmean_(self, *xs):
|
|
136
141
|
'''Accumulate and return the current mean.
|
|
@@ -151,7 +156,7 @@ class _FstatsBase(_FstatsNamed):
|
|
|
151
156
|
|
|
152
157
|
@see: Method C{fadd}.
|
|
153
158
|
'''
|
|
154
|
-
return
|
|
159
|
+
return float(self._Stdev(xs, **sample))
|
|
155
160
|
|
|
156
161
|
def fstdev_(self, *xs, **sample):
|
|
157
162
|
'''Accumulate and return the current standard deviation.
|
|
@@ -172,7 +177,7 @@ class _FstatsBase(_FstatsNamed):
|
|
|
172
177
|
|
|
173
178
|
@see: Method C{fadd}.
|
|
174
179
|
'''
|
|
175
|
-
return
|
|
180
|
+
return float(self._Variance(xs, **sample))
|
|
176
181
|
|
|
177
182
|
def fvariance_(self, *xs, **sample):
|
|
178
183
|
'''Accumulate and return the current variance.
|
|
@@ -189,12 +194,11 @@ class _FstatsBase(_FstatsNamed):
|
|
|
189
194
|
self.fadd_(other._Fsum)
|
|
190
195
|
elif isscalar(other):
|
|
191
196
|
self.fadd_(_2finite(other))
|
|
192
|
-
|
|
193
|
-
_xiterable(other)
|
|
197
|
+
elif _xiterable(other):
|
|
194
198
|
self.fadd(other)
|
|
195
|
-
except Exception as
|
|
199
|
+
except Exception as X:
|
|
196
200
|
t = _SPACE_(self, _iadd_op_, repr(other))
|
|
197
|
-
raise _xError(
|
|
201
|
+
raise _xError(X, t)
|
|
198
202
|
|
|
199
203
|
@property_RO
|
|
200
204
|
def _M1(self):
|
|
@@ -235,16 +239,16 @@ class Fcook(_FstatsBase):
|
|
|
235
239
|
@see: L{Fwelford} and U{Higher-order statistics<https://
|
|
236
240
|
WikiPedia.org/wiki/Algorithms_for_calculating_variance>}.
|
|
237
241
|
'''
|
|
238
|
-
def __init__(self, xs=None, name
|
|
242
|
+
def __init__(self, xs=None, **name):
|
|
239
243
|
'''New L{Fcook} stats accumulator.
|
|
240
244
|
|
|
241
245
|
@arg xs: Iterable of additional values (each C{scalar} or
|
|
242
246
|
an L{Fsum} or L{Fsum2Tuple} instance).
|
|
243
|
-
@kwarg name: Optional name (C{str}).
|
|
247
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
244
248
|
|
|
245
249
|
@see: Method L{Fcook.fadd}.
|
|
246
250
|
'''
|
|
247
|
-
self._Ms =
|
|
251
|
+
self._Ms = tuple(Fsum() for _ in range(4)) # 1st, 2nd ... Moment
|
|
248
252
|
if name:
|
|
249
253
|
self.name = name
|
|
250
254
|
if xs:
|
|
@@ -265,7 +269,7 @@ class Fcook(_FstatsBase):
|
|
|
265
269
|
|
|
266
270
|
@see: Method L{Fcook.fadd}.
|
|
267
271
|
'''
|
|
268
|
-
if
|
|
272
|
+
if isinstance(other, Fcook):
|
|
269
273
|
nb = len(other)
|
|
270
274
|
if nb > 0:
|
|
271
275
|
na = len(self)
|
|
@@ -374,7 +378,7 @@ class Fcook(_FstatsBase):
|
|
|
374
378
|
|
|
375
379
|
@see: Method L{Fcook.fadd}.
|
|
376
380
|
'''
|
|
377
|
-
return
|
|
381
|
+
return float(self._JarqueBera(xs, excess, sample=sample))
|
|
378
382
|
|
|
379
383
|
def fjb_(self, *xs, **sample_excess):
|
|
380
384
|
'''Accumulate and compute the current U{Jarque-Bera
|
|
@@ -401,7 +405,7 @@ class Fcook(_FstatsBase):
|
|
|
401
405
|
@see: Method L{Fcook.fadd}.
|
|
402
406
|
'''
|
|
403
407
|
n = self.fadd(xs, **sample)
|
|
404
|
-
return
|
|
408
|
+
return float(self._Kurtosis(n, excess, **sample))
|
|
405
409
|
|
|
406
410
|
def fkurtosis_(self, *xs, **excess_sample):
|
|
407
411
|
'''Accumulate and return the current kurtosis.
|
|
@@ -423,7 +427,7 @@ class Fcook(_FstatsBase):
|
|
|
423
427
|
https://TowardsDataScience.com/skewness-kurtosis-simplified-1338e094fc85>}
|
|
424
428
|
and method L{Fcook.fadd}.
|
|
425
429
|
'''
|
|
426
|
-
return
|
|
430
|
+
return float(self._Median(xs))
|
|
427
431
|
|
|
428
432
|
def fmedian_(self, *xs):
|
|
429
433
|
'''Accumulate and return the current median.
|
|
@@ -448,7 +452,7 @@ class Fcook(_FstatsBase):
|
|
|
448
452
|
@see: Method L{Fcook.fadd}.
|
|
449
453
|
'''
|
|
450
454
|
n = self.fadd(xs, **sample)
|
|
451
|
-
return
|
|
455
|
+
return float(self._Skewness(n, **sample))
|
|
452
456
|
|
|
453
457
|
def fskewness_(self, *xs, **sample):
|
|
454
458
|
'''Accumulate and return the current skewness.
|
|
@@ -506,10 +510,12 @@ class Fcook(_FstatsBase):
|
|
|
506
510
|
S *= (n + 1) / (n - 1)
|
|
507
511
|
return S
|
|
508
512
|
|
|
509
|
-
def toFwelford(self, name
|
|
510
|
-
'''Return
|
|
513
|
+
def toFwelford(self, **name):
|
|
514
|
+
'''Return a L{Fwelford} equivalent.
|
|
515
|
+
|
|
516
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
511
517
|
'''
|
|
512
|
-
f = Fwelford(name=
|
|
518
|
+
f = Fwelford(name=self._name__(name))
|
|
513
519
|
f._Ms = self._M1.copy(), self._M2.copy() # deep=False
|
|
514
520
|
f._n = self._n
|
|
515
521
|
return f
|
|
@@ -521,12 +527,12 @@ class Fwelford(_FstatsBase):
|
|
|
521
527
|
|
|
522
528
|
@see: U{Cook<https://www.JohnDCook.com/blog/standard_deviation/>} and L{Fcook}.
|
|
523
529
|
'''
|
|
524
|
-
def __init__(self, xs=None, name
|
|
530
|
+
def __init__(self, xs=None, **name):
|
|
525
531
|
'''New L{Fwelford} stats accumulator.
|
|
526
532
|
|
|
527
533
|
@arg xs: Iterable of initial values (each C{scalar} or an
|
|
528
534
|
L{Fsum} or L{Fsum2Tuple} instance).
|
|
529
|
-
@kwarg name: Optional name (C{str}).
|
|
535
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
530
536
|
|
|
531
537
|
@see: Method L{Fwelford.fadd}.
|
|
532
538
|
'''
|
|
@@ -552,7 +558,7 @@ class Fwelford(_FstatsBase):
|
|
|
552
558
|
@see: Method L{Fwelford.fadd} and U{Parallel algorithm<https//
|
|
553
559
|
WikiPedia.org/wiki/Algorithms_for_calculating_variance>}.
|
|
554
560
|
'''
|
|
555
|
-
if
|
|
561
|
+
if isinstance(other, Fwelford):
|
|
556
562
|
nb = len(other)
|
|
557
563
|
if nb > 0:
|
|
558
564
|
na = len(self)
|
|
@@ -579,7 +585,7 @@ class Fwelford(_FstatsBase):
|
|
|
579
585
|
else:
|
|
580
586
|
self._copy(self, other)
|
|
581
587
|
|
|
582
|
-
elif
|
|
588
|
+
elif isinstance(other, Fcook):
|
|
583
589
|
self += other.toFwelford()
|
|
584
590
|
else:
|
|
585
591
|
self._iadd_other(other)
|
|
@@ -620,7 +626,7 @@ class Flinear(_FstatsNamed):
|
|
|
620
626
|
C{RunningRegression} computing the running slope, intercept
|
|
621
627
|
and correlation of a linear regression.
|
|
622
628
|
'''
|
|
623
|
-
def __init__(self, xs=None, ys=None, Fstats=Fwelford, name
|
|
629
|
+
def __init__(self, xs=None, ys=None, Fstats=Fwelford, **name):
|
|
624
630
|
'''New L{Flinear} regression accumulator.
|
|
625
631
|
|
|
626
632
|
@kwarg xs: Iterable of initial C{x} values (each C{scalar} or
|
|
@@ -629,7 +635,7 @@ class Flinear(_FstatsNamed):
|
|
|
629
635
|
an L{Fsum} or L{Fsum2Tuple} instance).
|
|
630
636
|
@kwarg Fstats: Class for C{xs} and C{ys} values (L{Fcook} or
|
|
631
637
|
L{Fwelford}).
|
|
632
|
-
@kwarg name: Optional name (C{str}).
|
|
638
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}).
|
|
633
639
|
|
|
634
640
|
@raise TypeError: B{C{Fstats}} not L{Fcook} or L{Fwelford}.
|
|
635
641
|
|
|
@@ -661,7 +667,7 @@ class Flinear(_FstatsNamed):
|
|
|
661
667
|
|
|
662
668
|
@see: Method L{Flinear.fadd_}.
|
|
663
669
|
'''
|
|
664
|
-
if
|
|
670
|
+
if isinstance(other, Flinear):
|
|
665
671
|
if len(other) > 0:
|
|
666
672
|
if len(self) > 0:
|
|
667
673
|
n = other._n
|
|
@@ -676,11 +682,11 @@ class Flinear(_FstatsNamed):
|
|
|
676
682
|
self._copy(self, other)
|
|
677
683
|
else:
|
|
678
684
|
try:
|
|
679
|
-
_xiterable(other)
|
|
680
|
-
|
|
681
|
-
except Exception as
|
|
685
|
+
if _xiterable(other):
|
|
686
|
+
self.fadd_(*other)
|
|
687
|
+
except Exception as X:
|
|
682
688
|
op = _SPACE_(self, _iadd_op_, repr(other))
|
|
683
|
-
raise _xError(
|
|
689
|
+
raise _xError(X, op)
|
|
684
690
|
return self
|
|
685
691
|
|
|
686
692
|
def _copy(self, d, s):
|
|
@@ -752,7 +758,7 @@ class Flinear(_FstatsNamed):
|
|
|
752
758
|
@kwarg sample: Use C{B{sample}=True} for the I{sample} correlation
|
|
753
759
|
instead of the I{population} correlation (C{bool}).
|
|
754
760
|
'''
|
|
755
|
-
return
|
|
761
|
+
return float(self._Correlation(**sample))
|
|
756
762
|
|
|
757
763
|
def fintercept(self, **sample):
|
|
758
764
|
'''Return the current, running (sample) intercept (C{float}).
|
|
@@ -760,7 +766,7 @@ class Flinear(_FstatsNamed):
|
|
|
760
766
|
@kwarg sample: Use C{B{sample}=True} for the I{sample} intercept
|
|
761
767
|
instead of the I{population} intercept (C{bool}).
|
|
762
768
|
'''
|
|
763
|
-
return
|
|
769
|
+
return float(self._Intercept(**sample))
|
|
764
770
|
|
|
765
771
|
def fslope(self, **sample):
|
|
766
772
|
'''Return the current, running (sample) slope (C{float}).
|
|
@@ -768,7 +774,7 @@ class Flinear(_FstatsNamed):
|
|
|
768
774
|
@kwarg sample: Use C{B{sample}=True} for the I{sample} slope
|
|
769
775
|
instead of the I{population} slope (C{bool}).
|
|
770
776
|
'''
|
|
771
|
-
return
|
|
777
|
+
return float(self._Slope(**sample))
|
|
772
778
|
|
|
773
779
|
def _Intercept(self, **sample):
|
|
774
780
|
'''(INTERNAL) Return the current (sample) intercept as L{Fsum}.
|