def use(wcspkg, raise_err=True):
    global coord_types, wcs_configured, WCS, \
           have_kapteyn, kapwcs, \
           have_astlib, astWCS, astCoords, \
           have_starlink, Ast, Atl, \
           have_astropy, pywcs, pyfits, astropy, coordinates, units

    if wcspkg == 'kapteyn':
        try:
            from kapteyn import wcs as kapwcs
            coord_types = ['icrs', 'fk5', 'fk4', 'galactic', 'ecliptic']
            have_kapteyn = True
            wcs_configured = True
            WCS = KapteynWCS
            return True

        except ImportError as e:
            if raise_err:
                raise
        return False

    elif wcspkg == 'starlink':
        try:
            import starlink.Ast as Ast
            import starlink.Atl as Atl
            coord_types = ['icrs', 'fk5', 'fk4', 'galactic', 'ecliptic']
            have_starlink = True
            wcs_configured = True
            WCS = StarlinkWCS
            return True

        except ImportError as e:
            if raise_err:
                raise
        return False

    elif wcspkg == 'astlib':
        try:
            from astLib import astWCS, astCoords
            # astlib requires pyfits (or astropy) in order
            # to create a WCS object from a FITS header.
            try:
                from astropy.io import fits as pyfits
            except ImportError:
                try:
                    import pyfits
                except ImportError:
                    raise ImportError("Need pyfits module to use astLib WCS")

            astWCS.NUMPY_MODE = True
            coord_types = ['j2000', 'b1950', 'galactic']
            have_astlib = True
            wcs_configured = True
            WCS = AstLibWCS
            return True

        except ImportError as e:
            if raise_err:
                raise
        return False

    elif wcspkg == 'astropy2':
        try:
            import astropy

            from distutils.version import LooseVersion
            if LooseVersion(astropy.__version__) <= LooseVersion('1'):
                raise ImportError("astropy2 wrapper requires version 1 of astropy")

            import astropy.coordinates
            import astropy.wcs as pywcs
            from astropy.io import fits as pyfits
            import astropy.units as u
            from astropy.version import version

        except ImportError:
            if raise_err:
                raise
            return False

        have_pywcs = True
        have_astropy = True
        wcs_configured = True
        WCS = AstropyWCS2

        try:
            import sunpy.coordinates
        except ImportError:
            pass

        coord_types = [f.name for f in astropy.coordinates.frame_transform_graph.frame_set]

        return True

    elif wcspkg == 'astropy':
        try:
            import astropy.wcs as pywcs
            from astropy.io import fits as pyfits
            have_pywcs = True
        except ImportError:
            try:
                import pywcs
                have_pywcs = True
            except ImportError as e:
                if raise_err:
                    raise
                return False

        try:
            from astropy import coordinates
            from astropy import units
            have_astropy = True
            wcs_configured = True
            WCS = AstropyWCS

            if hasattr(coordinates, 'SkyCoord'):
                try:
                    import sunpy.coordinates
                except ImportError:
                    pass
                coord_types = [f.name for f in coordinates.frame_transform_graph.frame_set]
            else:
                coord_types = ['icrs', 'fk5', 'fk4', 'galactic']

            return True

        except ImportError as e:
            if raise_err:
                raise
        return False

    elif wcspkg == 'barebones':
        coord_types = ['fk5']
        WCS = BareBonesWCS
        wcs_configured = True
        return True

    return False
Choose WCS package.
dataset/ETHPy150Open ejeschke/ginga/ginga/util/wcsmod.py/use