Problem with reproject

Apologies for my obvious incompetence, but I have updated to the latest versions of satrapy, ancillary packages, and reproject - the latter of which I want to run a FITS ARC → SIN projection. Running the example from the reproject pages, I am unable to import reproject_interp, for example

(base) xyz255@RKBYODMLGW1-2 python % python3
Traceback (most recent call last):
File “”, line 4, in
from reproject import reproject_interp
File “/Users/xyz255/astrodata/W3_DATA//python/”, line 4, in
from reproject import reproject_interp

ImportError: cannot import name ‘reproject_interp’ from ‘reproject’ (/Users/xyz255/astrodata/W3_DATA/python/

This came up running the image reproduction example from: Image reprojection (resampling) — reproject v0.7.1

The code is run under python3.7 like this:

from import fits
from astropy.wcs import WCS
from import get_pkg_data_filename
import matplotlib.pyplot as plt
hdu1 =‘galactic_center/gc_2mass_k.fits’))[0]
hdu2 =‘galactic_center/gc_msx_e.fits’))[0]
ax1 = plt.subplot(1,2,1, projection=WCS(hdu1.header))
ax1.imshow(, origin=‘lower’, vmin=-100., vmax=2000.)
ax1.coords[‘ra’].set_axislabel(‘Right Ascension’)
ax1.set_title(‘2MASS K-band’)
ax2 = plt.subplot(1,2,2, projection=WCS(hdu2.header))
ax2.imshow(, origin=‘lower’, vmin=-2.e-4, vmax=5.e-4)
ax2.coords[‘glon’].set_axislabel(‘Galactic Longitude’)
ax2.coords[‘glat’].set_axislabel(‘Galactic Latitude’)
ax2.set_title(‘MSX band E’)

from reproject import reproject_interp
array, footprint = reproject_interp(hdu2, hdu1.header)
fits.writeto(‘msx_on_2mass_header.fits’, array, hdu1.header, overwrite=True)

And works up to the import command from reproject towards the end.

The run platform is macOS Monterey 12.1, and I have lots of other python libraries working perfectly well.

Can anyone please help on what seems to be a config issue at my end?

Many thanks

1 Like

Apologies - I solved it myself, my test script was called, and when making the import call, python looked in my test script rather than going to the reproject library. So, everything is hunky dory, thanks for reading - I would have deleted the original post but couldn’t see how to and the system would not let me edit it - in retrospect this was seen in the error message, but I never thought that python would act like this - we live and learn !

1 Like