Merge remote-tracking branch 'origin/typehints_rngseed' into development

This commit is contained in:
Martin Diehl 2022-02-02 22:37:54 +01:00
commit 97f849c098
4 changed files with 8 additions and 6 deletions

View File

@ -9,3 +9,4 @@ import numpy as np
FloatSequence = Union[np.ndarray,Sequence[float]]
IntSequence = Union[np.ndarray,Sequence[int]]
FileHandle = Union[TextIO, str, Path]
NumpyRngSeed = Union[int, IntSequence, np.random.SeedSequence, np.random.BitGenerator, np.random.Generator]

View File

@ -1,3 +1,4 @@
"""Functionality for generation of seed points for Voronoi or Laguerre tessellation."""
from typing import Tuple as _Tuple
@ -5,7 +6,7 @@ from typing import Tuple as _Tuple
from scipy import spatial as _spatial
import numpy as _np
from ._typehints import FloatSequence as _FloatSequence, IntSequence as _IntSequence
from ._typehints import FloatSequence as _FloatSequence, IntSequence as _IntSequence, NumpyRngSeed as _NumpyRngSeed
from . import util as _util
from . import grid_filters as _grid_filters
@ -13,7 +14,7 @@ from . import grid_filters as _grid_filters
def from_random(size: _FloatSequence,
N_seeds: int,
cells: _IntSequence = None,
rng_seed=None) -> _np.ndarray:
rng_seed: _NumpyRngSeed = None) -> _np.ndarray:
"""
Place seeds randomly in space.
@ -53,7 +54,7 @@ def from_Poisson_disc(size: _FloatSequence,
N_candidates: int,
distance: float,
periodic: bool = True,
rng_seed=None) -> _np.ndarray:
rng_seed: _NumpyRngSeed = None) -> _np.ndarray:
"""
Place seeds according to a Poisson disc distribution.

View File

@ -16,7 +16,7 @@ import numpy as np
import h5py
from . import version
from ._typehints import IntSequence, FloatSequence
from ._typehints import FloatSequence, NumpyRngSeed
# limit visibility
__all__=[
@ -396,7 +396,7 @@ def execution_stamp(class_name: str,
def hybrid_IA(dist: np.ndarray,
N: int,
rng_seed: Union[int, IntSequence] = None) -> np.ndarray:
rng_seed: NumpyRngSeed = None) -> np.ndarray:
"""
Hybrid integer approximation.

View File

@ -163,7 +163,7 @@ subroutine selfTest
'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL
Dict => YAML_parse_str(trim(YAML_s))
p2 = polynomial(dict%asDict(),'C','T')
if (dNeq(p1%at(x),p2%at(x),1.0e-12_pReal)) error stop 'polynomials: init'
if (dNeq(p1%at(x),p2%at(x),1.0e-10_pReal)) error stop 'polynomials: init'
p1 = polynomial(coef*[0.0_pReal,1.0_pReal,0.0_pReal],x_ref)
if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-10_pReal)) error stop 'polynomials: eval(odd)'