Skip to content

Commit 60bb7fb

Browse files
committed
Use string comparisons where supported
1 parent b8c7a25 commit 60bb7fb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

specutils/io/parsing_utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,10 @@ def spectrum_from_column_mapping(table, column_mapping, wcs=None):
104104

105105
if not isinstance(cm_unit, u.Unit):
106106
cm_unit = u.Unit(cm_unit)
107-
cm_type = str(cm_unit.physical_type)
108-
if 'length' in cm_type or 'frequency' in cm_type or 'energy' in cm_type:
107+
if cm_unit.physical_type in ('length', 'frequency', 'energy'):
109108
# Spectral axis column information
110109
kwarg_val = kwarg_val.to(cm_unit, equivalencies=u.spectral())
111-
elif 'spectral flux' in cm_type:
110+
elif 'spectral flux' in str(cm_unit.physical_type):
112111
# Flux/error column information
113112
kwarg_val = kwarg_val.to(cm_unit, equivalencies=u.spectral_density(1 * u.AA))
114113
elif tab_unit:

0 commit comments

Comments
 (0)