mpdaf icon indicating copy to clipboard operation
mpdaf copied to clipboard

Coord() with unit=None still returns Ra, Dec

Open andresgur opened this issue 2 years ago • 0 comments

cube = Cube("whatever_cube.fits"); cube.wcs.coord(unit=None)

array([[-66.49549886, -66.49549888, -66.4954989 , ..., -66.49549887, -66.49549886, -66.49549884], [-66.4954433 , -66.49544332, -66.49544334, ..., -66.49544332, -66.4954433 , -66.49544328], [-66.49538775, -66.49538777, -66.49538779, ..., -66.49538776, -66.49538774, -66.49538773], [-66.47805442, -66.47805443, -66.47805445, ..., -66.47805443, -66.47805441, -66.47805439], ....

The issue I believe is line 765 of coords.py which reads coord = self.pix2sky(pixcrd.reshape(2, -1).T).T and converts pixel indexes (pixcrd) to RA, DEC regardless of the unit keyword input. There should be another elif unit is not None to avoid running self.pix2sky in the case the user wants pixels as outputs. Or the first condition should be e.g. if spaxel or unit is None? The code runs correctly if the spaxel keyword is set to True, is this the desired behaviour? The functionality of this keyword is not in the documentation...

andresgur avatar Apr 04 '23 10:04 andresgur