Skip to content

Commit

Permalink
Fix extraction when only one of region/spectrum are in a reversed spe…
Browse files Browse the repository at this point in the history
…ctral axis unit
  • Loading branch information
rosteen committed Oct 15, 2024
1 parent a859dd6 commit f70b33a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion specutils/manipulation/extract_spectral_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ def _subregion_to_edge_pixels(subregion, spectrum):

right_index = _edge_value_to_pixel(right_reg_in_spec_unit, spectrum, order, "right")

return left_index, right_index
# If the spectrum is in wavelength and region is in Hz (for example), these still might be reversed
if left_index < right_index:
return left_index, right_index
else:
return right_index, left_index


def extract_region(spectrum, region, return_single_spectrum=False):
Expand Down

0 comments on commit f70b33a

Please sign in to comment.