question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WCS test fails if sunpy is installed

See original GitHub issue

It looks like simply having SunPy installed is causing the following test to fail:

______________________________________________________________________________________ test_celestial_frame_to_wcs _______________________________________________________________________________________

    def test_celestial_frame_to_wcs():
    
        # Import astropy.coordinates here to avoid circular imports
        from astropy.coordinates import ICRS, ITRS, FK5, FK4, FK4NoETerms, Galactic, BaseCoordinateFrame
    
        class FakeFrame(BaseCoordinateFrame):
            pass
    
        frame = FakeFrame()
        with pytest.raises(ValueError) as exc:
>           celestial_frame_to_wcs(frame)

astropy/wcs/tests/test_utils.py:367: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
astropy/wcs/utils.py:277: in celestial_frame_to_wcs
    wcs = func(frame, projection=projection)
/Users/tom/python/dev/lib/python3.7/site-packages/sunpy/coordinates/wcs_utils.py:65: in solar_frame_to_wcs_mapping
    wcs.wcs.dateobs = frame.obstime.utc.isot
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <FakeFrame Frame>, attr = 'obstime'

    def __getattr__(self, attr):
        """
        Allow access to attributes on the representation and differential as
        found via ``self.get_representation_component_names``.
    
        TODO: We should handle dynamic representation transforms here (e.g.,
        `.cylindrical`) instead of defining properties as below.
        """
    
        # attr == '_representation' is likely from the hasattr() test in the
        # representation property which is used for
        # self.representation_component_names.
        #
        # Prevent infinite recursion here.
        if attr.startswith('_'):
            return self.__getattribute__(attr)  # Raise AttributeError.
    
        repr_names = self.representation_component_names
        if attr in repr_names:
            if self._data is None:
                self.data  # this raises the "no data" error by design - doing it
                # this way means we don't have to replicate the error message here
    
            rep = self.represent_as(self.representation_type,
                                    in_frame_units=True)
            val = getattr(rep, repr_names[attr])
            return val
    
        diff_names = self.get_representation_component_names('s')
        if attr in diff_names:
            if self._data is None:
                self.data  # see above.
            # TODO: this doesn't work for the case when there is only
            # unitspherical information. The differential_type gets set to the
            # default_differential, which expects full information, so the
            # units don't work out
            rep = self.represent_as(in_frame_units=True,
                                    **self.get_representation_cls(None))
            val = getattr(rep.differentials['s'], diff_names[attr])
            return val
    
>       return self.__getattribute__(attr)  # Raise AttributeError.
E       AttributeError: 'FakeFrame' object has no attribute 'obstime'

astropy/coordinates/baseframe.py:1556: AttributeError

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Cadaircommented, Aug 21, 2019

This is now fixed in SunPy master.

1reaction
Cadaircommented, Aug 6, 2019

All the SunPy frames have obstime but not all the astropy ones. The issue here is that astropy frames are being passed to the sunpy function, which is maybe erroneously assuming it’s only getting passed SunPy frames.

I think this is actually a sunpy issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · astropy/astropy · GitHub
Most reactions. ❤️. Issues list. WCS test fails if sunpy is installed Bug testing wcs. #9094 opened on Aug 3, 2019 by astrofrog....
Read more >
Troubleshooting and Bugs — SunPy 4.1.0 documentation
This is the critical step. If you can't post a piece of code that we can run and reproduce your error, the chances...
Read more >
SunPy Documentation - Read the Docs
Finally, to install or upgrade the local version of SunPy you can run: python setup.py install --upgrade. 1.5 Testing your installation.
Read more >
sunpy/sunpy - Gitter
Cadair very well! what brings you to improving sunpy's test coverage? ... DanRyan37 I do that because of the error the ImageAnimator raises...
Read more >
pfsspy Documentation
This will install pfsspy and all of its dependencies. ... 1.2.5 Tests. Comparisons of the ... Create a sunpy Map object using output...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found