astropy / astropy/specutils

Add a warning if continuum-normalized analysis functions get non-dimensionless spectra

Open
#547 3 comments 1 reaction 0 assignees View on GitHub
analysis enhancement
Dominant language
Python
Stars
204
Forks
134
Avg merge
12h 55m
Merged PRs (30d)
1

Description

In #538 a continuum-subtraction checker was added to catch the case where a user runs an analysis function that expects a zero-baseline spectrum on a spectrum where continuum has not been subtracted.

In #535 we discussed doing something similar for functions requiring continuum normalization (right now I think that's just `equivalent_width`), but it occurs to me there's an easier heuristic for continuum-normalization: the unit has to be dimensionless because the continuum and spectrum should have the same units so dividing them out gives dimensionless. So perhaps we should just check the unit and raise a warning if it's not dimensionless? That has essentially zero performance penalty (unlike the continuum-checker...)

cc @camipacifici (since it was your use case that originally led to this idea)

Contributor guide

Open the contributing guide

Research direction

Start at the equivalent_width analysis function, the only continuum-normalization consumer identified in the issue, and inspect how its spectrum unit is accessed. The work is done when a warning is raised for a non-dimensionless spectrum while dimensionless input remains unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.