diff --git a/jdaviz/configs/specviz/plugins/line_analysis/line_analysis.py b/jdaviz/configs/specviz/plugins/line_analysis/line_analysis.py index a5dbd0c049..d22d8ba2c5 100644 --- a/jdaviz/configs/specviz/plugins/line_analysis/line_analysis.py +++ b/jdaviz/configs/specviz/plugins/line_analysis/line_analysis.py @@ -321,9 +321,9 @@ def _uncertainty(result): return final_unit = flux_unit - temp_result = raw_result.to(final_unit, equivalencies= u.spectral_density(freq_spec.spectral_axis)) + temp_result = np.mean(raw_result.to(final_unit, equivalencies= u.spectral_density(freq_spec.spectral_axis))) if getattr(raw_result, 'uncertainty', None) is not None: - temp_result.uncertainty = raw_result.uncertainty.to(final_unit, equivalencies= u.spectral_density(freq_spec.spectral_axis)) + temp_result.uncertainty = np.mean(raw_result.uncertainty.to(final_unit, equivalencies= u.spectral_density(freq_spec.spectral_axis))) # If the flux unit is instead equivalent to power density # (Jy, but defined in wavelength), enforce integration in wavelength space elif (flux_unit.is_equivalent(u.Unit('W/(m2 m)')) or @@ -350,9 +350,9 @@ def _uncertainty(result): return final_unit = flux_unit - temp_result = raw_result.to(final_unit, equivalencies= u.spectral_density(wave_spec.spectral_axis)) + temp_result = np.mean(raw_result.to(final_unit, equivalencies= u.spectral_density(wave_spec.spectral_axis))) if getattr(raw_result, 'uncertainty', None) is not None: - temp_result.uncertainty = raw_result.uncertainty.to(final_unit, equivalencies= u.spectral_density(wave_spec.spectral_axis)) + temp_result.uncertainty = np.mean(raw_result.uncertainty.to(final_unit, equivalencies= u.spectral_density(wave_spec.spectral_axis))) # Otherwise, just rely on the default specutils line_flux result else: