#NEWLINE# def radectopix( self , ra_deg , dec_deg , coords = 'data' , naxispath = None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( ra_rad , dec_rad ) = ( math . radians ( ra_deg ) , math . radians ( dec_deg ) ) #NEWLINE# args = [ ra_rad , dec_rad ] #NEWLINE# if naxispath : #NEWLINE# #INDENT# args += ( [ 0 ] * len ( naxispath ) ) #NEWLINE# #UNINDENT# arrs = [ [ args [ i ] ] for i in range ( len ( args ) ) ] #NEWLINE# res = self . wcs . tran ( arrs , 0 ) #NEWLINE# ( x , y ) = ( res [ 0 ] [ 0 ] , res [ 1 ] [ 0 ] ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# self . logger . error ( ( 'Error calculating radectopix: %s' % str ( e ) ) ) #NEWLINE# raise WCSError ( e ) #NEWLINE# #UNINDENT# if ( coords == 'data' ) : #NEWLINE# #INDENT# ( x , y ) = ( ( x - 1 ) , ( y - 1 ) ) #NEWLINE# #UNINDENT# return ( x , y )