astropy / astropy/specutils

Why is mask not applied to Spectrum1D when present?

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

Description

I am basically re-asking the question in #142 that was closed without explanation. In spacetelescope/synphot_refactor#243 , I feel like it is not `synphot`'s job to apply the mask for `specutils`. I expect `specutils` to mask out unwanted data when accessed if there is a mask. Why is this not the case? Thanks.

Take this as example:
```python
>>> from astropy import units as u
>>> from specutils import Spectrum1D
>>> lamb = [0.001, 0.25, 0.5] * u.Hz
>>> flux = [1.5, 0.5, 99.9] * u.nJy
>>> mask = [True, False, False]
>>> spec = Spectrum1D(spectral_axis=lamb, flux=flux, mask=mask)
>>> spec
, spectral_axis=)>
```

What I see:
```python
>>> spec.flux

```

What I thought I would see:
```python
>>> spec.flux

```

While I understand that Astropy does not yet support masked quantity natively (xref astropy/astropy#1852), perhaps `specutils` can work around that limitation for now?

Contributor guide

Open the contributing guide

Research direction

Start by reading Spectrum1D's mask and flux handling, along with the discussion in #142, synphot_refactor#243, and astropy#1852; the issue names no source file or test. Clarify the intended ownership and behavior, then define tests for the provided masked-spectrum example and its expected flux output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.