In [16]:
# Import numpy
import numpy as np
from glob import glob
from astropy.io import fits, ascii
# Importing plotting stuff
import matplotlib.pyplot as plt
%matplotlib inline
from scipy import stats
# Use seaborn plotting style defaults
#import seaborn as sns; sns.set()
# Import Astropy things we need
from astropy.io import ascii
import astropy.coordinates as coord
import astropy.units as u
from astropy.table import Table
from scipy.ndimage import median_filter
from sklearn.neighbors import NearestNeighbors
In [15]:
# Loop through fits files to get times, DEC, RA. for HAT-P-53b.
# 0 NUMBER Running object number
# 1 FLUX_ISO Isophotal flux [count]
# 2 FLUXERR_ISO RMS error for isophotal flux [count]
# 3 MAG_ISO Isophotal magnitude [mag]
# 4 MAGERR_ISO RMS error for isophotal magnitude [mag]
# 5 XWIN_IMAGE Windowed position estimate along x [pixel]
# 6 YWIN_IMAGE Windowed position estimate along y [pixel]
# 7 ALPHAWIN_J2000 Windowed right ascension (J2000) [deg]
# 8 DELTAWIN_J2000 windowed declination (J2000) [deg]
# Coordinates of Star, beginning
#RA = 3.90615
#DEC = -11.93665
# For Reference Star 1:
#RA_ref1 = 3.93338
#DEC_ref1= -11.9410
# For Reference Star 2:
#RA_ref2 = 21.923235
#DEC_ref2= 38.991684
times = []
newTime = [] # Getting the UTC time.
newMag = []
newMag_err = []
magRef1 = []
magRef1_err = []
magRef2 = []
magRef2_err = []
mag = []
mag_err = []
# Number of catalogue.
listNum = np.arange(478,597,1)
for i in listNum:
data = fits.open('wasp44b_end_i_24.0' + str(i) + ".fits")
times.append(data[0].header['DATE-OBS'])
for i in np.arange(0, len(listNum)-1, 1):
tempTime = times[i][11:]
newTime.append(tempTime)
# Now we want to read the fluxes from the catalogue.
# Choosing stars by Magnitude.
for i in listNum:
data = np.loadtxt(str(i) + ".cat")
stars = np.sort(np.array(data[1]).flatten())
magRef2.append(stars[2])
magRef1.append(stars[1])
mag.append(stars[0])
print(stars[0])
In [41]:
#ascii.read('479.cat')
target_RA = 3.903
target_DEC = -11.938
ref_lc = []
def findTarget(arr, RA, DEC):
index1 = np.where(np.min(np.abs(arr['ALPHAWIN_J2000'] - RA)))
print(index1)
index2 = np.where(np.min(np.abs(arr['DELTAWIN_J2000'] - DEC)))
print(index2)
for i in index1:
if i in index2:
return i
return -1
data = ascii.read(str(479) + ".cat")
index = findTarget(data, target_RA, target_DEC)
for i in listNum:
data = ascii.read(str(i) + ".cat")
data.sort('MAG_ISO')
#ref_lc.append(np.mean(data('FLUX_ISO')[0:10]))
#data
In [ ]: