Turns a FITS binary table of Gaia DR3 stars with tetra3
-style database of stars with
Last active
October 5, 2023 23:46
-
-
Save cgobat/1aaa0d5724dcc3e6013012663450dbf2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
from astropy.io import fits | |
fits_file_path = "gaiadr3_gmag8.fits.gz" | |
with fits.open(fits_file_path) as f: | |
hdr = f[1].header | |
tbl = f[1].data | |
GminusV = lambda BP, RP: -0.01760 - 0.006860*(BP-RP) - 0.1732*(BP-RP)**2 # https://gea.esac.esa.int/archive/documentation/GDR2/Data_processing/chap_cu5pho/sec_cu5pho_calibr/ssec_cu5pho_PhotTransf.html | |
Vmag = tbl.Gmag - GminusV(tbl.BPmag, tbl.RPmag) # V = G - (G - V) | |
ra, dec = np.deg2rad(tbl.RA_ICRS), np.deg2rad(tbl.DE_ICRS) # ICRS coords are at epoch 2016.0 | |
star_table = np.column_stack((ra, dec, np.cos(ra)*np.cos(dec), np.sin(ra)*np.cos(dec), np.sin(dec), Vmag)) | |
star_catalog_IDs = pd.Series(tbl.DR3Name).str.replace("Gaia DR3 ", "").to_numpy(dtype=np.uint64) | |
props_packed = np.array(("gaiadr3"), dtype=[("star_catalog", "U64")]) | |
to_save = dict(star_catalog_IDs = star_catalog_IDs[Vmag<=7.0], | |
star_table = star_table[Vmag<=7.0, :], | |
props_packed = props_packed) | |
np.savez_compressed("gaiadr3_mag7_stars.npz", **to_save) |
View raw
(Sorry about that, but we can’t show files that are this big right now.)
View raw
(Sorry about that, but we can’t show files that are this big right now.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment