Tuesday, 2 April 2019

How to plot a star from TESScut to the right place on the sky using Python (and not with a ~10 degree error)?

I would like to plot TESS measurements of Beta Dor, using data from TESScut. In the Gaia DR2 archive I look up RA and DEC values of Beta Dor, I get:

RA: 83.40630967798376 DEC:  -62.48977125108528 

I go to TESScut, put these two values in, select Sector 1, then Download FFI Cutout. Unzip downloaded file, then in Python I do:

import matplotlib.pyplot as plt
from lightkurve import TessTargetPixelFile
import numpy as np

sector1ffi_cutout='tess-s0001-4-4_83.40630967798376_-62.48977125108528_64x64_astrocut.fits'
tpf_s1 = TessTargetPixelFile(sector1ffi_cutout)

fig = plt.figure(figsize=(5,5))
fig.add_subplot(111, projection=tpf_s1.wcs)
plt.pcolormesh(np.log(tpf_s1.flux[0]))
plt.show()

Giving me:

enter image description here

Which, looking at the coordinates (~ -53°, ~6h30min) is clearly wrong, the star is not in this position according to Gaia (and other sources).

What am I doing wrongly, and how can I plot this star to the place it should be?


For completeness, when I plot the star, I get these warnings:

/home/szabopal/.local/lib/python3.5/site-packages/ipykernel_launcher.py:10: RuntimeWarning: divide by zero encountered in log # Remove the CWD from sys.path while we load stuff. /home/szabopal/.local/lib/python3.5/site-packages/ipykernel_launcher.py:10: RuntimeWarning: invalid value encountered in log # Remove the CWD from sys.path while we load stuff. /home/szabopal/.local/lib/python3.5/site-packages/astropy/visualization/wcsaxes/grid_paths.py:73: RuntimeWarning: invalid value encountered in greater discontinuous = step[1:] > DISCONT_FACTOR * step[:-1] /home/szabopal/.local/lib/python3.5/site-packages/astropy/visualization/wcsaxes/grid_paths.py:73: RuntimeWarning: invalid value encountered in greater discontinuous = step[1:] > DISCONT_FACTOR * step[:-1] /home/szabopal/.local/lib/python3.5/site-packages/astropy/visualization/wcsaxes/grid_paths.py:73: RuntimeWarning: invalid value encountered in greater discontinuous = step[1:] > DISCONT_FACTOR * step[:-1] /home/szabopal/.local/lib/python3.5/site-packages/astropy/visualization/wcsaxes/grid_paths.py:73: RuntimeWarning: invalid value encountered in greater discontinuous = step[1:] > DISCONT_FACTOR * step[:-1]


Further developments

I believe the issue above is caused by the wcs refering to the whole FFI, not the cutout.

print(tpf_s1.wcs)

gives:

WCS Keywords

Number of WCS axes: 2
CTYPE : 'RA---TAN-SIP'  'DEC--TAN-SIP'  
CRVAL : 90.634460449219  -57.666290283203  
CRPIX : 250.0  -984.0  
PC1_1 PC1_2  : 1.0  1.0  
PC2_1 PC2_2  : 1.0  1.0  
CDELT : 0.00571299832697903  0.005705604460241471  
NAXIS : 81986  1282



from How to plot a star from TESScut to the right place on the sky using Python (and not with a ~10 degree error)?

No comments:

Post a Comment