`reproject_and_coadd` is picky with WCS
- Dominant language
- Python
- Stars
- 127
- Forks
- 74
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 2
Description
I'm trying to make a mosaic using `reproject_and_coadd`. I have fits files in Lum with proper wcs's, and want to use these for the rest of the filters as well, since they are all aligned, however I get the following error which confuses me:
```
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in
8 for filt in filters:
9 hdulist_list = [fits.open(combined_images[obj][filt]) for obj in objects] #list of images to combine in one filter
---> 10 data, footprint = reproject_and_coadd(hdulist_list, wcs, shape_out=shape, reproject_function=reproject_interp)
11 display_image(data, 5, 99, scale='squared', figsize=(16, 12), title=f"Mosaic {filt}")
12 write_to_fits(procdir, data, f"Mosaic_{filt}.fits", header=header)
/Software/users/modules/7/software/anaconda3/2020.07/lib/python3.8/site-packages/reproject/mosaicking/coadd.py in reproject_and_coadd(input_data, output_projection, shape_out, input_weights, hdu_in, reproject_function, hdu_weights, combine_function, match_background, background_reference, **kwargs)
122 xc = np.array([-0.5, nx - 0.5, nx - 0.5, -0.5])
123 yc = np.array([-0.5, -0.5, ny - 0.5, ny - 0.5])
--> 124 xc_out, yc_out = wcs_out.world_to_pixel(wcs_in.pixel_to_world(xc, yc))
125
126 # Determine the cutout parameters
/Software/users/modules/7/software/anaconda3/2020.07/lib/python3.8/site-packages/astropy/wcs/wcsapi/high_level_api.py in world_to_pixel(self, *world_objects)
183 w = world_objects[ikey]
184 if not isinstance(w, klass):
--> 185 raise ValueError("Expected the following order of world "
186 "arguments: {}".format(', '.join([k.__name__ for (k, _, _) in classes.values()])))
187
ValueError: Expected the following order of world arguments: SkyCoord
```
I'm don't know where `SkyCoord` comes from or what I need to do with it, it is not in my fits files, and a list of one element doesn't have an ordering.
Also, `reproject_function` is not a keyword argument of `reproject_and_coadd`, but is required, I assume this is temporary.
Edit: It does work when I use the same files for the generating mosaic as for the wcs.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the reproject_and_coadd call in the issue and inspect mosaicking/coadd.py at the failing world_to_pixel conversion on line 124. Reproduce the case with WCS files differing from the input images, then compare the input and output WCS dimensionality and argument handling; done when the documented call works for aligned files and the reported SkyCoord error is resolved or clearly diagnosed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100