Skip to content

Commit

Permalink
Re-shaped the mod_chi2's return to match the input shape (#760)
Browse files Browse the repository at this point in the history
I'm merging this anyway//
  • Loading branch information
JKrishnamoorthi authored Jan 20, 2024
1 parent ec9d410 commit d1959e7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pisa/utils/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ def mod_chi2(actual_values, expected_values):
the inputs
"""

in_array_shape = np.shape(actual_values)
actual_values = unp.nominal_values(actual_values).ravel()
sigma = unp.std_devs(expected_values).ravel()
expected_values = unp.nominal_values(expected_values).ravel()
Expand All @@ -587,7 +587,8 @@ def mod_chi2(actual_values, expected_values):
m_chi2 = (
(actual_values - expected_values)**2 / (sigma**2 + expected_values)
)


m_chi2 = m_chi2.reshape(in_array_shape)
return m_chi2

def correct_chi2(actual_values, expected_values):
Expand Down

0 comments on commit d1959e7

Please sign in to comment.