astropy / astropy/reproject

Convenience tool for up/downsampled spatial WCS

Open
#260 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
127
Forks
74
Avg merge
1d 11h
Merged PRs (30d)
2

Description

One use case for reproject is to resample data onto a new grid to enable direct comparison between images. For objects on different parts of the sky, this comparison can be done by keeping the WCS centers the same (or specifying a WCS center) and changing the pixel size - which is different from, but somewhat related to, what `find_optimal_celestial_wcs` does.

Suggested feature is a tool to make a WCS with a spec like:
```python
def resampled_wcs(original_wcs=None, pixel_scale=None, center=None, rotation=None, frame=None, shape=None):
"""
Return a WCS with properties inherited from the original WCS unless they are overridden.
"""
new_wcs = original_wcs.copy() # if original_wcs is not None - or load the WCS from the header, preserve size
.... etc ...
```

where for resampling you would do something like:

```python
data = fits.open(filename)
target_hdr = resampled_wcs(data[0].header, pixel_scale=0.5*u.arcsec)
reproj, _ = reproject_interp(data, target_hdr)
result = fits.PrimaryHDU(data=reproj, header=target_hdr)
```

cc @privong

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing find_optimal_celestial_wcs and reproject_interp entry points, then trace how WCS objects and FITS headers are handled. Define the resampled_wcs behavior from the proposed signature, including inherited and overridden properties, and verify the example workflow produces a usable target header and reprojection result.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.