#NEWLINE# def pixtoradec( self , idxs , coords = 'data' ) : #NEWLINE# #INDENT# "Convert a (x, y) pixel coordinate on the image to a (ra, dec)\n        coordinate in space.\n\n        Parameter (coords):\n        - if 'data' then x, y coordinates are interpreted as 0-based\n        - otherwise coordinates are interpreted as 1-based (traditional FITS)\n        " #NEWLINE# ( x , y ) = idxs [ : 2 ] #NEWLINE# if ( coords == 'data' ) : #NEWLINE# #INDENT# ( x , y ) = ( ( x + 1 ) , ( y + 1 ) ) #NEWLINE# #UNINDENT# ( crpix1 , crpix2 ) = self . get_reference_pixel ( ) #NEWLINE# ( crval1 , crval2 ) = self . get_physical_reference_pixel ( ) #NEWLINE# ( cd11 , cd12 , cd21 , cd22 ) = self . get_pixel_coordinates ( ) #NEWLINE# ra_deg = ( ( ( ( cd11 * ( x - crpix1 ) ) + ( cd12 * ( y - crpix2 ) ) ) / math . cos ( math . radians ( crval2 ) ) ) + crval1 ) #NEWLINE# dec_deg = ( ( ( cd21 * ( x - crpix1 ) ) + ( cd22 * ( y - crpix2 ) ) ) + crpix2 ) #NEWLINE# return ( ra_deg , dec_deg )