Advertisement
SVXX

SunPy Coords Fail

Oct 17th, 2014
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 28.09 KB | None | 0 0
  1. test_api.py .F
  2. test_frames.py .....F........FFFF
  3.  
  4. =============================================================================== FAILURES ===============================================================================
  5. __________________________________________________________________________ test_highlevel_api __________________________________________________________________________
  6.  
  7.     def test_highlevel_api():
  8.         from astropy.coordinates import SkyCoord
  9.         from ..frames import HelioGraphicStonyhurst, HelioCentric
  10.    
  11.         # This method tests the high-level API as is done in Astropy.
  12.         # SkyCoord should be SunPy-ready by the time the coordinates
  13.         # API is in the codebase.
  14.    
  15.         sc = SkyCoord(SphericalRepresentation(lon=10*u.deg, lat=10*u.deg,
  16.                                               distance=1*u.kpc),
  17.                       frame="heliographicstonyhurst",dateobs="2011/01/01T00:00:45")
  18.    
  19.         # Heliocentric coordinates are in kilometres.
  20.         sc = SkyCoord(hlon=10*u.deg, hlat=10*u.deg, frame="heliographicstonyhurst")
  21.         sc = SkyCoord(x=10*u.km, y=10*u.km, z=10*u.km, frame="heliocentric")
  22.    
  23.         # One can initialize using low-level objects.
  24.         sc = SkyCoord(HelioGraphicStonyhurst(hlon=8*u.deg, hlat=10*u.deg, dateobs=
  25.         "2011/01/01T00:00:45"))
  26.    
  27.         # An error is induced as a high-level object needs position data.
  28.         # Frames can be initialized without this data, SkyCoord cannot.
  29.         with pytest.raises(ValueError):
  30.             sc = SkyCoord(frame="heliocentric")
  31.    
  32.         # The underlying frame object of the high-level object, when
  33.         # accessed in a call to `repr`, is printed in the following
  34.         # way - '<HelioGraphicStonyhurst Coordinate: lon=10*u.deg, lat=10*u.deg>'
  35.         string = repr(sc.frame)
  36. >       assert '<HelioGraphicStonyhurst Coordinate: B0=' in string
  37. E       assert '<HelioGraphicStonyhurst Coordinate: B0=' in '<HelioGraphicStonyhurst Coordinate: dateobs=2011-01-01 00:00:45, L0=0.0 deg, B0=0.0 deg, hlon=8.0 deg, hlat=10.0 deg, rad=695508.0 km>'
  38.  
  39. test_api.py:89: AssertionError
  40. ___________________________________________________________________________ test_frame_repr ____________________________________________________________________________
  41.  
  42.     def test_frame_repr():
  43.         # Tests the repr() of a frame.
  44.    
  45.         hgc = HelioGraphicCarrington()
  46. >       assert repr(hgc).startswith('<HelioGraphicCarrington Frame: B0=')
  47. E       assert <built-in method startswith of str object at 0x7feb77f59490>('<HelioGraphicCarrington Frame: B0=')
  48. E        +  where <built-in method startswith of str object at 0x7feb77f59490> = '<HelioGraphicCarrington Frame: dateobs=None, L0=0.0 deg, B0=0.0 deg>'.startswith
  49. E        +    where '<HelioGraphicCarrington Frame: dateobs=None, L0=0.0 deg, B0=0.0 deg>' = repr(<HelioGraphicCarrington Frame: dateobs=None, L0=0.0 deg, B0=0.0 deg>)
  50.  
  51. test_frames.py:152: AssertionError
  52. _______________________________________________________ test_wcs_numbers[input0-expected0-extras0-heliocentric] ________________________________________________________
  53.  
  54. input = <Quantity [ 40., 32.] arcsec>, expected = <Quantity [ 28748691., 22998953.] m>, extras = {'dateobs': '2011/01/01T00:00:45', 'frame': 'helioprojective'}
  55. to = 'heliocentric'
  56.  
  57.     @pytest.mark.parametrize("input, expected, extras, to",
  58.                              [([40.0, 32.0] * u.arcsec, [28748691, 22998953] * u.m,
  59.                                {'frame': 'helioprojective'}, 'heliocentric'),
  60.                               ([40.0, 32.0] * u.arcsec, [28748691, 22998953] * u.m,
  61.                                {'distance': 0.5 * u.au, 'frame': 'helioprojective'},
  62.                                 'heliocentric'),
  63.                               ([28748691, 22998953, 0] * u.m, [40.0, 32.0] * u.arcsec,
  64.                                {'frame': 'heliocentric'}, 'helioprojective'),
  65.                               ([13.0, 58.0, 0] * u.m, [1.0791282e-06*u.deg, -7.0640732*u.deg,
  66.                                RSun],
  67.                                {'frame': 'heliocentric'}, 'heliographicstonyhurst')])
  68.     def test_wcs_numbers(input, expected, extras, to):
  69.         dateobs = '2011/01/01T00:00:45'
  70.         extras['dateobs'] = dateobs
  71.         rtol = 1e-10
  72.         sc = SkyCoord(*input, **extras)
  73.    
  74.         sc_trans = sc.transform_to(to)
  75.    
  76.         if sc_trans.representation is SphericalWrap180Representation:
  77.             npt.assert_allclose(sc_trans.spherical.lon, expected[0].to(u.deg))
  78.             npt.assert_allclose(sc_trans.spherical.lat, expected[1].to(u.deg))
  79.             if expected[2] is not None:
  80.                 npt.assert_allclose(sc_trans.spherical.distance, expected[2].to(u.km))
  81.         elif sc_trans.representation is CartesianRepresentation:
  82. >           npt.assert_allclose(sc_trans.cartesian.x, expected[0].to(u.km))
  83.  
  84. test_frames.py:342:
  85. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  86. /home/pritishc/.virtualenvs/sunpy/local/lib/python2.7/site-packages/numpy/testing/utils.py:1297: in assert_allclose
  87.     verbose=verbose, header=header)
  88. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  89.  
  90. comparison = <function compare at 0x7feb777edd70>, x = <Quantity 28876.152176423377 km>, y = <Quantity 28748.691 km>, err_msg = '', verbose = True
  91. header = 'Not equal to tolerance rtol=1e-07, atol=0', precision = 6
  92.  
  93.     def assert_array_compare(comparison, x, y, err_msg='', verbose=True,
  94.                              header='', precision=6):
  95.         from numpy.core import array, isnan, isinf, any, all, inf
  96.         x = array(x, copy=False, subok=True)
  97.         y = array(y, copy=False, subok=True)
  98.    
  99.         def isnumber(x):
  100.             return x.dtype.char in '?bhilqpBHILQPefdgFDG'
  101.    
  102.         def chk_same_position(x_id, y_id, hasval='nan'):
  103.             """Handling nan/inf: check that x and y have the nan/inf at the same
  104.            locations."""
  105.             try:
  106.                 assert_array_equal(x_id, y_id)
  107.             except AssertionError:
  108.                 msg = build_err_msg([x, y],
  109.                                     err_msg + '\nx and y %s location mismatch:' \
  110.                                     % (hasval), verbose=verbose, header=header,
  111.                                     names=('x', 'y'), precision=precision)
  112.                 raise AssertionError(msg)
  113.    
  114.         try:
  115.             cond = (x.shape==() or y.shape==()) or x.shape == y.shape
  116.             if not cond:
  117.                 msg = build_err_msg([x, y],
  118.                                     err_msg
  119.                                     + '\n(shapes %s, %s mismatch)' % (x.shape,
  120.                                                                       y.shape),
  121.                                     verbose=verbose, header=header,
  122.                                     names=('x', 'y'), precision=precision)
  123.                 if not cond :
  124.                     raise AssertionError(msg)
  125.    
  126.             if isnumber(x) and isnumber(y):
  127.                 x_isnan, y_isnan = isnan(x), isnan(y)
  128.                 x_isinf, y_isinf = isinf(x), isinf(y)
  129.    
  130.                 # Validate that the special values are in the same place
  131.                 if any(x_isnan) or any(y_isnan):
  132.                     chk_same_position(x_isnan, y_isnan, hasval='nan')
  133.                 if any(x_isinf) or any(y_isinf):
  134.                     # Check +inf and -inf separately, since they are different
  135.                     chk_same_position(x == +inf, y == +inf, hasval='+inf')
  136.                     chk_same_position(x == -inf, y == -inf, hasval='-inf')
  137.    
  138.                 # Combine all the special values
  139.                 x_id, y_id = x_isnan, y_isnan
  140.                 x_id |= x_isinf
  141.                 y_id |= y_isinf
  142.    
  143.                 # Only do the comparison if actual values are left
  144.                 if all(x_id):
  145.                     return
  146.    
  147.                 if any(x_id):
  148.                     val = comparison(x[~x_id], y[~y_id])
  149.                 else:
  150.                     val = comparison(x, y)
  151.             else:
  152.                 val = comparison(x, y)
  153.    
  154.             if isinstance(val, bool):
  155.                 cond = val
  156.                 reduced = [0]
  157.             else:
  158.                 reduced = val.ravel()
  159.                 cond = reduced.all()
  160.                 reduced = reduced.tolist()
  161.             if not cond:
  162.                 match = 100-100.0*reduced.count(1)/len(reduced)
  163.                 msg = build_err_msg([x, y],
  164.                                     err_msg
  165.                                     + '\n(mismatch %s%%)' % (match,),
  166.                                     verbose=verbose, header=header,
  167.                                     names=('x', 'y'), precision=precision)
  168.                 if not cond :
  169. >                   raise AssertionError(msg)
  170. E                   AssertionError:
  171. E                   Not equal to tolerance rtol=1e-07, atol=0
  172. E                  
  173. E                   (mismatch 100.0%)
  174. E                    x: Quantity(<Quantity 28876.152176423377 km>)
  175. E                    y: Quantity(<Quantity 28748.691 km>)
  176.  
  177. /home/pritishc/.virtualenvs/sunpy/local/lib/python2.7/site-packages/numpy/testing/utils.py:665: AssertionError
  178. _______________________________________________________ test_wcs_numbers[input1-expected1-extras1-heliocentric] ________________________________________________________
  179.  
  180. input = <Quantity [ 40., 32.] arcsec>, expected = <Quantity [ 28748691., 22998953.] m>
  181. extras = {'dateobs': '2011/01/01T00:00:45', 'distance': <Quantity 0.5 AU>, 'frame': 'helioprojective'}, to = 'heliocentric'
  182.  
  183.     @pytest.mark.parametrize("input, expected, extras, to",
  184.                              [([40.0, 32.0] * u.arcsec, [28748691, 22998953] * u.m,
  185.                                {'frame': 'helioprojective'}, 'heliocentric'),
  186.                               ([40.0, 32.0] * u.arcsec, [28748691, 22998953] * u.m,
  187.                                {'distance': 0.5 * u.au, 'frame': 'helioprojective'},
  188.                                 'heliocentric'),
  189.                               ([28748691, 22998953, 0] * u.m, [40.0, 32.0] * u.arcsec,
  190.                                {'frame': 'heliocentric'}, 'helioprojective'),
  191.                               ([13.0, 58.0, 0] * u.m, [1.0791282e-06*u.deg, -7.0640732*u.deg,
  192.                                RSun],
  193.                                {'frame': 'heliocentric'}, 'heliographicstonyhurst')])
  194.     def test_wcs_numbers(input, expected, extras, to):
  195.         dateobs = '2011/01/01T00:00:45'
  196.         extras['dateobs'] = dateobs
  197.         rtol = 1e-10
  198.         sc = SkyCoord(*input, **extras)
  199.    
  200.         sc_trans = sc.transform_to(to)
  201.    
  202.         if sc_trans.representation is SphericalWrap180Representation:
  203.             npt.assert_allclose(sc_trans.spherical.lon, expected[0].to(u.deg))
  204.             npt.assert_allclose(sc_trans.spherical.lat, expected[1].to(u.deg))
  205.             if expected[2] is not None:
  206.                 npt.assert_allclose(sc_trans.spherical.distance, expected[2].to(u.km))
  207.         elif sc_trans.representation is CartesianRepresentation:
  208. >           npt.assert_allclose(sc_trans.cartesian.x, expected[0].to(u.km))
  209.  
  210. test_frames.py:342:
  211. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  212. /home/pritishc/.virtualenvs/sunpy/local/lib/python2.7/site-packages/numpy/testing/utils.py:1297: in assert_allclose
  213.     verbose=verbose, header=header)
  214. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  215.  
  216. comparison = <function compare at 0x7feb77f61488>, x = <Quantity 14505.418610563212 km>, y = <Quantity 28748.691 km>, err_msg = '', verbose = True
  217. header = 'Not equal to tolerance rtol=1e-07, atol=0', precision = 6
  218.  
  219.     def assert_array_compare(comparison, x, y, err_msg='', verbose=True,
  220.                              header='', precision=6):
  221.         from numpy.core import array, isnan, isinf, any, all, inf
  222.         x = array(x, copy=False, subok=True)
  223.         y = array(y, copy=False, subok=True)
  224.    
  225.         def isnumber(x):
  226.             return x.dtype.char in '?bhilqpBHILQPefdgFDG'
  227.    
  228.         def chk_same_position(x_id, y_id, hasval='nan'):
  229.             """Handling nan/inf: check that x and y have the nan/inf at the same
  230.            locations."""
  231.             try:
  232.                 assert_array_equal(x_id, y_id)
  233.             except AssertionError:
  234.                 msg = build_err_msg([x, y],
  235.                                     err_msg + '\nx and y %s location mismatch:' \
  236.                                     % (hasval), verbose=verbose, header=header,
  237.                                     names=('x', 'y'), precision=precision)
  238.                 raise AssertionError(msg)
  239.    
  240.         try:
  241.             cond = (x.shape==() or y.shape==()) or x.shape == y.shape
  242.             if not cond:
  243.                 msg = build_err_msg([x, y],
  244.                                     err_msg
  245.                                     + '\n(shapes %s, %s mismatch)' % (x.shape,
  246.                                                                       y.shape),
  247.                                     verbose=verbose, header=header,
  248.                                     names=('x', 'y'), precision=precision)
  249.                 if not cond :
  250.                     raise AssertionError(msg)
  251.    
  252.             if isnumber(x) and isnumber(y):
  253.                 x_isnan, y_isnan = isnan(x), isnan(y)
  254.                 x_isinf, y_isinf = isinf(x), isinf(y)
  255.    
  256.                 # Validate that the special values are in the same place
  257.                 if any(x_isnan) or any(y_isnan):
  258.                     chk_same_position(x_isnan, y_isnan, hasval='nan')
  259.                 if any(x_isinf) or any(y_isinf):
  260.                     # Check +inf and -inf separately, since they are different
  261.                     chk_same_position(x == +inf, y == +inf, hasval='+inf')
  262.                     chk_same_position(x == -inf, y == -inf, hasval='-inf')
  263.    
  264.                 # Combine all the special values
  265.                 x_id, y_id = x_isnan, y_isnan
  266.                 x_id |= x_isinf
  267.                 y_id |= y_isinf
  268.    
  269.                 # Only do the comparison if actual values are left
  270.                 if all(x_id):
  271.                     return
  272.    
  273.                 if any(x_id):
  274.                     val = comparison(x[~x_id], y[~y_id])
  275.                 else:
  276.                     val = comparison(x, y)
  277.             else:
  278.                 val = comparison(x, y)
  279.    
  280.             if isinstance(val, bool):
  281.                 cond = val
  282.                 reduced = [0]
  283.             else:
  284.                 reduced = val.ravel()
  285.                 cond = reduced.all()
  286.                 reduced = reduced.tolist()
  287.             if not cond:
  288.                 match = 100-100.0*reduced.count(1)/len(reduced)
  289.                 msg = build_err_msg([x, y],
  290.                                     err_msg
  291.                                     + '\n(mismatch %s%%)' % (match,),
  292.                                     verbose=verbose, header=header,
  293.                                     names=('x', 'y'), precision=precision)
  294.                 if not cond :
  295. >                   raise AssertionError(msg)
  296. E                   AssertionError:
  297. E                   Not equal to tolerance rtol=1e-07, atol=0
  298. E                  
  299. E                   (mismatch 100.0%)
  300. E                    x: Quantity(<Quantity 14505.418610563212 km>)
  301. E                    y: Quantity(<Quantity 28748.691 km>)
  302.  
  303. /home/pritishc/.virtualenvs/sunpy/local/lib/python2.7/site-packages/numpy/testing/utils.py:665: AssertionError
  304. ______________________________________________________ test_wcs_numbers[input2-expected2-extras2-helioprojective] ______________________________________________________
  305.  
  306. input = <Quantity [ 28748691., 22998953.,        0.] m>, expected = <Quantity [ 40., 32.] arcsec>, extras = {'dateobs': '2011/01/01T00:00:45', 'frame': 'heliocentric'}
  307. to = 'helioprojective'
  308.  
  309.     @pytest.mark.parametrize("input, expected, extras, to",
  310.                              [([40.0, 32.0] * u.arcsec, [28748691, 22998953] * u.m,
  311.                                {'frame': 'helioprojective'}, 'heliocentric'),
  312.                               ([40.0, 32.0] * u.arcsec, [28748691, 22998953] * u.m,
  313.                                {'distance': 0.5 * u.au, 'frame': 'helioprojective'},
  314.                                 'heliocentric'),
  315.                               ([28748691, 22998953, 0] * u.m, [40.0, 32.0] * u.arcsec,
  316.                                {'frame': 'heliocentric'}, 'helioprojective'),
  317.                               ([13.0, 58.0, 0] * u.m, [1.0791282e-06*u.deg, -7.0640732*u.deg,
  318.                                RSun],
  319.                                {'frame': 'heliocentric'}, 'heliographicstonyhurst')])
  320.     def test_wcs_numbers(input, expected, extras, to):
  321.         dateobs = '2011/01/01T00:00:45'
  322.         extras['dateobs'] = dateobs
  323.         rtol = 1e-10
  324.         sc = SkyCoord(*input, **extras)
  325.    
  326.         sc_trans = sc.transform_to(to)
  327.    
  328.         if sc_trans.representation is SphericalWrap180Representation:
  329. >           npt.assert_allclose(sc_trans.spherical.lon, expected[0].to(u.deg))
  330.  
  331. test_frames.py:337:
  332. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  333. /home/pritishc/.virtualenvs/sunpy/local/lib/python2.7/site-packages/numpy/testing/utils.py:1297: in assert_allclose
  334.     verbose=verbose, header=header)
  335. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  336.  
  337. comparison = <function compare at 0x7feb777ed2a8>, x = <Longitude 0.01101070912868738 deg>, y = <Quantity 0.011111111111111112 deg>, err_msg = '', verbose = True
  338. header = 'Not equal to tolerance rtol=1e-07, atol=0', precision = 6
  339.  
  340.     def assert_array_compare(comparison, x, y, err_msg='', verbose=True,
  341.                              header='', precision=6):
  342.         from numpy.core import array, isnan, isinf, any, all, inf
  343.         x = array(x, copy=False, subok=True)
  344.         y = array(y, copy=False, subok=True)
  345.    
  346.         def isnumber(x):
  347.             return x.dtype.char in '?bhilqpBHILQPefdgFDG'
  348.    
  349.         def chk_same_position(x_id, y_id, hasval='nan'):
  350.             """Handling nan/inf: check that x and y have the nan/inf at the same
  351.            locations."""
  352.             try:
  353.                 assert_array_equal(x_id, y_id)
  354.             except AssertionError:
  355.                 msg = build_err_msg([x, y],
  356.                                     err_msg + '\nx and y %s location mismatch:' \
  357.                                     % (hasval), verbose=verbose, header=header,
  358.                                     names=('x', 'y'), precision=precision)
  359.                 raise AssertionError(msg)
  360.    
  361.         try:
  362.             cond = (x.shape==() or y.shape==()) or x.shape == y.shape
  363.             if not cond:
  364.                 msg = build_err_msg([x, y],
  365.                                     err_msg
  366.                                     + '\n(shapes %s, %s mismatch)' % (x.shape,
  367.                                                                       y.shape),
  368.                                     verbose=verbose, header=header,
  369.                                     names=('x', 'y'), precision=precision)
  370.                 if not cond :
  371.                     raise AssertionError(msg)
  372.    
  373.             if isnumber(x) and isnumber(y):
  374.                 x_isnan, y_isnan = isnan(x), isnan(y)
  375.                 x_isinf, y_isinf = isinf(x), isinf(y)
  376.    
  377.                 # Validate that the special values are in the same place
  378.                 if any(x_isnan) or any(y_isnan):
  379.                     chk_same_position(x_isnan, y_isnan, hasval='nan')
  380.                 if any(x_isinf) or any(y_isinf):
  381.                     # Check +inf and -inf separately, since they are different
  382.                     chk_same_position(x == +inf, y == +inf, hasval='+inf')
  383.                     chk_same_position(x == -inf, y == -inf, hasval='-inf')
  384.    
  385.                 # Combine all the special values
  386.                 x_id, y_id = x_isnan, y_isnan
  387.                 x_id |= x_isinf
  388.                 y_id |= y_isinf
  389.    
  390.                 # Only do the comparison if actual values are left
  391.                 if all(x_id):
  392.                     return
  393.    
  394.                 if any(x_id):
  395.                     val = comparison(x[~x_id], y[~y_id])
  396.                 else:
  397.                     val = comparison(x, y)
  398.             else:
  399.                 val = comparison(x, y)
  400.    
  401.             if isinstance(val, bool):
  402.                 cond = val
  403.                 reduced = [0]
  404.             else:
  405.                 reduced = val.ravel()
  406.                 cond = reduced.all()
  407.                 reduced = reduced.tolist()
  408.             if not cond:
  409.                 match = 100-100.0*reduced.count(1)/len(reduced)
  410.                 msg = build_err_msg([x, y],
  411.                                     err_msg
  412.                                     + '\n(mismatch %s%%)' % (match,),
  413.                                     verbose=verbose, header=header,
  414.                                     names=('x', 'y'), precision=precision)
  415.                 if not cond :
  416. >                   raise AssertionError(msg)
  417. E                   AssertionError:
  418. E                   Not equal to tolerance rtol=1e-07, atol=0
  419. E                  
  420. E                   (mismatch 100.0%)
  421. E                    x: Longitude(<Longitude 0.01101070912868738 deg>)
  422. E                    y: Quantity(<Quantity 0.011111111111111112 deg>)
  423.  
  424. /home/pritishc/.virtualenvs/sunpy/local/lib/python2.7/site-packages/numpy/testing/utils.py:665: AssertionError
  425. __________________________________________________ test_wcs_numbers[input3-expected3-extras3-heliographicstonyhurst] ___________________________________________________
  426.  
  427. input = <Quantity [ 13., 58.,  0.] m>, expected = [<Quantity 1.0791282e-06 deg>, <Quantity -7.0640732 deg>, <Quantity 695508.0 km>]
  428. extras = {'dateobs': '2011/01/01T00:00:45', 'frame': 'heliocentric'}, to = 'heliographicstonyhurst'
  429.  
  430.     @pytest.mark.parametrize("input, expected, extras, to",
  431.                              [([40.0, 32.0] * u.arcsec, [28748691, 22998953] * u.m,
  432.                                {'frame': 'helioprojective'}, 'heliocentric'),
  433.                               ([40.0, 32.0] * u.arcsec, [28748691, 22998953] * u.m,
  434.                                {'distance': 0.5 * u.au, 'frame': 'helioprojective'},
  435.                                 'heliocentric'),
  436.                               ([28748691, 22998953, 0] * u.m, [40.0, 32.0] * u.arcsec,
  437.                                {'frame': 'heliocentric'}, 'helioprojective'),
  438.                               ([13.0, 58.0, 0] * u.m, [1.0791282e-06*u.deg, -7.0640732*u.deg,
  439.                                RSun],
  440.                                {'frame': 'heliocentric'}, 'heliographicstonyhurst')])
  441.     def test_wcs_numbers(input, expected, extras, to):
  442.         dateobs = '2011/01/01T00:00:45'
  443.         extras['dateobs'] = dateobs
  444.         rtol = 1e-10
  445.         sc = SkyCoord(*input, **extras)
  446.    
  447.         sc_trans = sc.transform_to(to)
  448.    
  449.         if sc_trans.representation is SphericalWrap180Representation:
  450. >           npt.assert_allclose(sc_trans.spherical.lon, expected[0].to(u.deg))
  451.  
  452. test_frames.py:337:
  453. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  454. /home/pritishc/.virtualenvs/sunpy/local/lib/python2.7/site-packages/numpy/testing/utils.py:1297: in assert_allclose
  455.     verbose=verbose, header=header)
  456. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  457.  
  458. comparison = <function compare at 0x7feb77d64230>, x = <Longitude 90.0 deg>, y = <Quantity 1.0791282e-06 deg>, err_msg = '', verbose = True
  459. header = 'Not equal to tolerance rtol=1e-07, atol=0', precision = 6
  460.  
  461.     def assert_array_compare(comparison, x, y, err_msg='', verbose=True,
  462.                              header='', precision=6):
  463.         from numpy.core import array, isnan, isinf, any, all, inf
  464.         x = array(x, copy=False, subok=True)
  465.         y = array(y, copy=False, subok=True)
  466.    
  467.         def isnumber(x):
  468.             return x.dtype.char in '?bhilqpBHILQPefdgFDG'
  469.    
  470.         def chk_same_position(x_id, y_id, hasval='nan'):
  471.             """Handling nan/inf: check that x and y have the nan/inf at the same
  472.            locations."""
  473.             try:
  474.                 assert_array_equal(x_id, y_id)
  475.             except AssertionError:
  476.                 msg = build_err_msg([x, y],
  477.                                     err_msg + '\nx and y %s location mismatch:' \
  478.                                     % (hasval), verbose=verbose, header=header,
  479.                                     names=('x', 'y'), precision=precision)
  480.                 raise AssertionError(msg)
  481.    
  482.         try:
  483.             cond = (x.shape==() or y.shape==()) or x.shape == y.shape
  484.             if not cond:
  485.                 msg = build_err_msg([x, y],
  486.                                     err_msg
  487.                                     + '\n(shapes %s, %s mismatch)' % (x.shape,
  488.                                                                       y.shape),
  489.                                     verbose=verbose, header=header,
  490.                                     names=('x', 'y'), precision=precision)
  491.                 if not cond :
  492.                     raise AssertionError(msg)
  493.    
  494.             if isnumber(x) and isnumber(y):
  495.                 x_isnan, y_isnan = isnan(x), isnan(y)
  496.                 x_isinf, y_isinf = isinf(x), isinf(y)
  497.    
  498.                 # Validate that the special values are in the same place
  499.                 if any(x_isnan) or any(y_isnan):
  500.                     chk_same_position(x_isnan, y_isnan, hasval='nan')
  501.                 if any(x_isinf) or any(y_isinf):
  502.                     # Check +inf and -inf separately, since they are different
  503.                     chk_same_position(x == +inf, y == +inf, hasval='+inf')
  504.                     chk_same_position(x == -inf, y == -inf, hasval='-inf')
  505.    
  506.                 # Combine all the special values
  507.                 x_id, y_id = x_isnan, y_isnan
  508.                 x_id |= x_isinf
  509.                 y_id |= y_isinf
  510.    
  511.                 # Only do the comparison if actual values are left
  512.                 if all(x_id):
  513.                     return
  514.    
  515.                 if any(x_id):
  516.                     val = comparison(x[~x_id], y[~y_id])
  517.                 else:
  518.                     val = comparison(x, y)
  519.             else:
  520.                 val = comparison(x, y)
  521.    
  522.             if isinstance(val, bool):
  523.                 cond = val
  524.                 reduced = [0]
  525.             else:
  526.                 reduced = val.ravel()
  527.                 cond = reduced.all()
  528.                 reduced = reduced.tolist()
  529.             if not cond:
  530.                 match = 100-100.0*reduced.count(1)/len(reduced)
  531.                 msg = build_err_msg([x, y],
  532.                                     err_msg
  533.                                     + '\n(mismatch %s%%)' % (match,),
  534.                                     verbose=verbose, header=header,
  535.                                     names=('x', 'y'), precision=precision)
  536.                 if not cond :
  537. >                   raise AssertionError(msg)
  538. E                   AssertionError:
  539. E                   Not equal to tolerance rtol=1e-07, atol=0
  540. E                  
  541. E                   (mismatch 100.0%)
  542. E                    x: Longitude(<Longitude 90.0 deg>)
  543. E                    y: Quantity(<Quantity 1.0791282e-06 deg>)
  544.  
  545. /home/pritishc/.virtualenvs/sunpy/local/lib/python2.7/site-packages/numpy/testing/utils.py:665: AssertionError
  546. ================================================================= 6 failed, 14 passed in 7.52 seconds ==================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement