[tests] refactor tests
This commit is contained in:
parent
267d161769
commit
8cdcd08ba0
25 changed files with 649 additions and 616 deletions
22
meanas/test/_test_builders.py
Normal file
22
meanas/test/_test_builders.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import numpy
|
||||
|
||||
|
||||
def real_ramp(shape: tuple[int, ...], *, scale: float = 1.0, offset: float = 0.0) -> numpy.ndarray:
|
||||
return numpy.arange(numpy.prod(shape), dtype=float).reshape(shape, order='C') * scale + offset
|
||||
|
||||
|
||||
def complex_ramp(
|
||||
shape: tuple[int, ...],
|
||||
*,
|
||||
scale: float = 1.0,
|
||||
offset: float = 0.0,
|
||||
imag_scale: float = 0.0,
|
||||
imag_offset: float = 0.0,
|
||||
) -> numpy.ndarray:
|
||||
real = real_ramp(shape, scale=scale, offset=offset)
|
||||
imag = real_ramp(shape, scale=imag_scale, offset=imag_offset)
|
||||
return (real + 1j * imag).astype(complex)
|
||||
|
||||
|
||||
def unit_dxes(shape: tuple[int, ...]) -> tuple[tuple[numpy.ndarray, ...], tuple[numpy.ndarray, ...]]:
|
||||
return tuple(tuple(numpy.ones(length) for length in shape) for _ in range(2)) # type: ignore[return-value]
|
||||
Loading…
Add table
Add a link
Reference in a new issue