Created
May 19, 2021 13:27
-
-
Save joezuntz/01980835d6eb51fcc7b5cd34a9f07a68 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 sqlite3 | |
import numpy as np | |
import astropy.table | |
# open DB file | |
con = sqlite3.connect('baseline_nexp2_v1.7_10yrs.db') | |
# count rows so we can make numpy arrays | |
n = list(con.execute("select count(*) from SummaryAllProps"))[0][0] | |
ra = np.zeros(n) | |
dec = np.zeros(n) | |
# loop through data filling in | |
for i, row in enumerate(con.execute('select fieldRA, fieldDec from SummaryAllProps')): | |
ra[i], dec[i] = row | |
# Write to a FITS table | |
t = astropy.table.Table(names=["ra", "dec"], data=[ra, dec]) | |
t.write("out.fits") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment