How to plot Gaia astrometry data to TESS images using Python?

前端 未结 2 1813
刺人心
刺人心 2020-12-29 09:52

Long story short: I want to plot Gaia astrometry data to TESS imagery in Python. How is it possible? See below for elaborated version.


I have 64x64 pixel TESS

2条回答
  •  情歌与酒
    2020-12-29 10:08

    First I have to say, great question! Very detailed and reproducible. I went through your question and tried to redo the exercise starting from your git repo and downloading the catalogue from the GAIA archive.

    EDIT

    Programmatically your code is fine (see OLD PART below for a slightly different approach). The problem with the missing points is that one only gets 500 data points when downloading the csv file from the GAIA archive. Therefore it looks as if all points from the query are crammed into a weird shape. However if you restrict the radius of the search to a smaller value you can see that there are points that lie within the TESS image:

    please compare to the version shown below in the OLD PART. The code is the same as below only the downloaded csv file is for a smaller radius. Therefore it seems that you just downloaded a part of all available data from the GAIA archive when exporting to csv. The way to circumvent this is to do the search as you did. Then, on the result page click on Show query in ADQL form on the bottom and in the query you get displayed in SQL format change:

    Select Top 500
    

    to

    Select
    

    at the beginning of the query.

    OLD PART (code is ok and working but my conclusion is wrong):

    For plotting I used aplpy - uses matplotlib in the background - and ended up with the following code:

    from astropy.io import fits
    from astropy.wcs import WCS
    import aplpy
    import matplotlib.pyplot as plt
    import pandas as pd
    from astropy.coordinates import SkyCoord
    import astropy.units as u
    from astropy.io import fits 
    
    
    fits_file = fits.open("4687500098271761792_med.fits")
    central_coordinate = SkyCoord(fits_file[0].header["CRVAL1"],
                                  fits_file[0].header["CRVAL2"], unit="deg")
    
    figure = plt.figure(figsize=(10, 10))
    fig = aplpy.FITSFigure("4687500098271761792_med.fits", figure=figure)
    cmap = "gist_heat"
    stretch = "log"
    
    fig.show_colorscale(cmap=cmap, stretch=stretch)
    fig.show_colorbar()
    
    df = pd.read_csv("4687500098271761792_within_1000arcsec.csv")    
    
    # the epoch found in the dataset is J2015.5
    df['coord'] = SkyCoord(df["ra"], df["dec"], unit="deg", frame="icrs",
                           equinox="J2015.5")
    coords = df["coord"].tolist()
    coords_degrees = [[coord.ra.degree, coord.dec.value] for coord in df["coord"]]
    ra_values = [coord[0] for coord in coords_degrees]
    dec_values = [coord[1] for coord in coords_degrees]
    
    width = (40*u.arcmin).to(u.degree).value
    height = (40*u.arcmin).to(u.degree).value
    fig.recenter(x=central_coordinate.ra.degree, y=central_coordinate.dec.degree, 
                 width=width, height=height)
    fig.show_markers(central_coordinate.ra.degree,central_coordinate.dec.degree, 
                     marker="o", c="white", s=15, lw=1)
    fig.show_markers(ra_values, dec_values, marker="o", c="blue", s=15, lw=1)
    fig.show_circles(central_coordinate.ra.degree,central_coordinate.dec.degree, 
                     radius=(1000*u.arcsec).to(u.degree).value, edgecolor="black")
    fig.save("GAIA_TESS_test.png")
    

    However this results in a plot similar to yours:

    To check my suspicion that the coordinates from the GAIA archive are correctly displayed I draw a circle of 1000 arcsec from the center of the TESS image. As you can see it aligns roughly with the circular shape of the outer (seen from the center of the image) side of the data point cloud of the GAIA positions. I simply think that these are all points in the GAIA DR2 archive that fall within the region you searched. The data cloud even seems to have a squarish boundary on the inside, which might come from something as a square field of view.

提交回复
热议问题