def test_sip_hst():
 test_file = get_pkg_data_filename(os.path.join(u'data', u'hst_sip.hdr'))
 hdr = fits.Header.fromtextfile(test_file)
 crpix1 = hdr[u'CRPIX1']
 crpix2 = hdr[u'CRPIX2']
 wobj = wcs.WCS(hdr)
 a_pars = dict(**hdr[u'A_*'])
 b_pars = dict(**hdr[u'B_*'])
 a_order = a_pars.pop(u'A_ORDER')
 b_order = b_pars.pop(u'B_ORDER')
 sip = SIP([crpix1, crpix2], a_order, b_order, a_pars, b_pars)
 coords = [1, 1]
 rel_coords = [(1 - crpix1), (1 - crpix2)]
 astwcs_result = (wobj.sip_pix2foc([coords], 1)[0] - rel_coords)
 assert_allclose(sip(1, 1), astwcs_result)

def test_sip_hst ( ) : test_file = get_pkg_data_filename ( os . path . join ( u'data' , u'hst_sip.hdr' ) ) hdr = fits . Header . fromtextfile ( test_file ) crpix1 = hdr [ u'CRPIX1' ] crpix2 = hdr [ u'CRPIX2' ] wobj = wcs . WCS ( hdr ) a_pars = dict ( ** hdr [ u'A_*' ] ) b_pars = dict ( ** hdr [ u'B_*' ] ) a_order = a_pars . pop ( u'A_ORDER' ) b_order = b_pars . pop ( u'B_ORDER' ) sip = SIP ( [ crpix1 , crpix2 ] , a_order , b_order , a_pars , b_pars ) coords = [ 1 , 1 ] rel_coords = [ ( 1 - crpix1 ) , ( 1 - crpix2 ) ] astwcs_result = ( wobj . sip_pix2foc ( [ coords ] , 1 ) [ 0 ] - rel_coords ) assert_allclose ( sip ( 1 , 1 ) , astwcs_result )
test sip against astropy .