Skip to content

Commit

Permalink
docs inside class, allow yoda conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh-cpp committed Sep 19, 2024
1 parent cf2982f commit 7a7e6e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
5 changes: 0 additions & 5 deletions glass/shells.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ class RadialWindow(NamedTuple):
zeff: float


RadialWindow.za.__doc__ = "Redshift array; the abscissae of the window function."
RadialWindow.wa.__doc__ = "Weight array; the values (ordinates) of the window function."
RadialWindow.zeff.__doc__ = "Effective redshift of the window."


def tophat_windows(
zbins: ArrayLike1D,
dz: float = 1e-3,
Expand Down
8 changes: 4 additions & 4 deletions tests/test_galaxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ def test_redshifts_from_nz():
# test sampling

redshifts = redshifts_from_nz(10, [0, 1, 2, 3, 4], [1, 0, 0, 0, 0])
assert np.all((redshifts >= 0) & (redshifts <= 1))
assert np.all((0 <= redshifts) & (redshifts <= 1)) # noqa: SIM300

redshifts = redshifts_from_nz(10, [0, 1, 2, 3, 4], [0, 0, 1, 0, 0])
assert np.all((redshifts >= 1) & (redshifts <= 3))
assert np.all((1 <= redshifts) & (redshifts <= 3)) # noqa: SIM300

redshifts = redshifts_from_nz(10, [0, 1, 2, 3, 4], [0, 0, 0, 0, 1])
assert np.all((redshifts >= 3) & (redshifts <= 4))
assert np.all((3 <= redshifts) & (redshifts <= 4)) # noqa: SIM300

redshifts = redshifts_from_nz(10, [0, 1, 2, 3, 4], [0, 0, 1, 1, 1])
assert not np.any(redshifts <= 1)
Expand All @@ -54,7 +54,7 @@ def test_redshifts_from_nz():
redshifts = redshifts_from_nz(count, z, nz)

assert redshifts.shape == (count,)
assert np.all((redshifts >= 0) & (redshifts <= 1))
assert np.all((0 <= redshifts) & (redshifts <= 1)) # noqa: SIM300

# case: extra dimensions from count

Expand Down

0 comments on commit 7a7e6e8

Please sign in to comment.