Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Erik Tollerud <erik.tollerud@gmail.com>
  • Loading branch information
kecnry and eteq authored Jun 10, 2022
1 parent ab64290 commit 8790151
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions specutils/analysis/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ def _centroid_single_region(spectrum, region=None):
num_term_uncerts = flux*dispersion * np.sqrt((flux_uncert/flux)**2 +
(disp_uncert/dispersion)**2)
# uncertainty for the numerator sum, added in quadrature
num_uncert = np.sqrt(np.sum(num_term_uncerts**2, axis=-1))
num_uncertsq = np.sum(num_term_uncerts**2, axis=-1)
# uncertainty for the denom sum, added in quadrature
denom_uncert = np.sqrt(np.sum(flux_uncert**2, axis=-1))
denom_uncertsq = np.sum(flux_uncert**2, axis=-1)

# centroid uncertainty, fractional added in quadrature of numerator and denom
centroid.uncertainty = numerator/denom * np.sqrt((num_uncert/numerator)**2 +
(denom_uncert/denom)**2)
centroid.uncertainty = numerator/denom * np.sqrt(num_uncertsq * numerator**-2 +
(denom_uncertsq * denom)**-2)
else:
centroid.uncertainty = None

Expand Down

0 comments on commit 8790151

Please # to comment.