def pixel_scale(pixscale):
 if pixscale.unit.is_equivalent((si.arcsec / astrophys.pix)):
  pixscale_val = pixscale.to((si.radian / astrophys.pix)).value
 elif pixscale.unit.is_equivalent((astrophys.pix / si.arcsec)):
  pixscale_val = (1 / pixscale).to((si.radian / astrophys.pix)).value
 else:
  raise UnitsError(u'The pixel scale must be in angle/pixel or pixel/angle')
 return [(astrophys.pix, si.radian, (lambda px: (px * pixscale_val)), (lambda rad: (rad / pixscale_val)))]

def pixel_scale ( pixscale ) : if pixscale . unit . is_equivalent ( ( si . arcsec / astrophys . pix ) ) : pixscale_val = pixscale . to ( ( si . radian / astrophys . pix ) ) . value elif pixscale . unit . is_equivalent ( ( astrophys . pix / si . arcsec ) ) : pixscale_val = ( 1 / pixscale ) . to ( ( si . radian / astrophys . pix ) ) . value else : raise UnitsError ( u'The pixel scale must be in angle/pixel or pixel/angle' ) return [ ( astrophys . pix , si . radian , ( lambda px : ( px * pixscale_val ) ) , ( lambda rad : ( rad / pixscale_val ) ) ) ]
convert between pixel distances and angular units .