# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3 (ipykernel)
#     language: python
#     name: python3
# ---

import os
import sys
module_path = os.path.abspath(os.path.join('..'))
if module_path not in sys.path:
    sys.path.append(module_path)

# +
from astropy.coordinates import SkyCoord
from astropy.table import Table
from astroquery.vizier import Vizier
from astropy import units as u

import swasputils
# -

folded_lightcurves = swasputils.FoldedLightcurves()

superwasp_coords = folded_lightcurves.df['SWASP ID'].replace(r'^1SWASP', '', regex=True).unique()
parsed_coords = SkyCoord(superwasp_coords, unit=(u.hour, u.deg))

source_table = Table(
    data=[
        superwasp_coords,
        parsed_coords.ra,
        parsed_coords.dec,
    ],
    names=[
        'SuperWASP Coords',
        '_RAJ2000',
        '_DEJ2000',
    ],
    dtype=[
        'str',
        'float64',
        'float64',
    ],
    units={
        '_RAJ2000': u.deg,
        '_DEJ2000': u.deg
    }
)
source_table

source_table.write(os.path.join(swasputils.CACHE_LOCATION, 'source_coords.fits'), overwrite=True)



StarcoderdataJupyterScriptsDedupFiltered