astropy / astropy/astropy

Add a .raw_data attribute to FITS HDUs

Open
#4,113 6 comments 0 reactions 0 assignees View on GitHub
Effort-medium Feature Request io.fits
Dominant language
Python
Stars
5.3k
Forks
2.2k
Avg merge
1d 18h
Merged PRs (30d)
74

Description

As @leejjoon suggested way back in #993, it might be nice to have a convenient way to get at the raw, unscaled data of FITS arrays that have scale factors.

I always intended that to be a feature in some kind of FITS data class (that would also be used for columns of tables, so that individual columns can be accessed as scaled or raw).

But in the meantime I think it would be fairly straightforward to add a `.raw_data` attribute to all HDU classes. I think for the most part this could be implemented simply by wrapping the same code used by `.data`, but with `self._do_not_scale_image_data = True` set temporarily. I just set "Effort-medium" because there may be some subtleties I haven't thought of yet, and there may also need to be some refactoring to avoid code duplication.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing `.data` implementation across the FITS HDU classes and how `_do_not_scale_image_data` controls scaling. Determine how a `.raw_data` attribute can share that behavior without changing `.data`, including the HDU classes covered. Done means every HDU class exposes unscaled array data while existing scaled-data behavior remains intact.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.