Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions rad/quadrature.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,16 @@ def normalization(self, phi):
phi /= np.sum(phi)

return phi


def calculate_maximum_flux(self, psi):
"""
Calculalaing the maximum flux value

:param phi: Vector of flux values
:return: maximum flux
"""

max_psi = np.max(psi)

return max_psi
12 changes: 12 additions & 0 deletions test/test_quadrature.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ def test_normalization():
# using all close cus these are floats!
assert np.allclose(np.sum(x), 1.0)

def test_maximum():
N = 10

x = np.random.random(10)
quad = rad.quadrature(4)
psi_m = quad.calculate_maximum_flux(x)

max_val = np.sort(x)[-1]

# using all close cus these are floats!
assert np.allclose(psi_m, max_val)


if __name__ == "__main__":
test_normalization()
Expand Down
Loading