Hw 3- Q3

import xlrd
file_location = "C:/Users/Heena Chotani/Desktop/data.xlsx"
workbook = xlrd.open_workbook(file_location)
sheet = workbook.sheet_by_index(0)
JDdata = () #julian date
Ydata = () #period
TDdata = () #transit duration
PUdata = () #propagation uncertianity
n = () #number of future transits
rows = sheet.nrows
rows = rows - 1
for col in range(sheet.ncols):
if sheet.cell_value(0, col) == 'jd':
for row in range(sheet.nrows):
JDdata = (sheet.cell_value(row, col))
elif sheet.cell_value(0, col) == 'Y':
for row in range(sheet.nrows):
Ydata = (sheet.cell_value(row, col))
elif sheet.cell_value(0, col) == 'TD':
for row in range(sheet.nrows):
TDdata = (sheet.cell_value(row, col))
elif sheet.cell_value(0, col) == 'PU':
for row in range(sheet.nrows):
PUdata = (sheet.cell_value(row, col))
elif sheet.cell_value(0, col) == 'futuretransits':
for row in range(sheet.nrows):
n = (sheet.cell_value(row, col))
Transists = []
in = []
eg = []
ft = JDdata
x = int(n)
td = TDdata
for i in range(x):
Transists.append((ft))
Q = ft+0.5
Z = Q//1
W = ((Z - 1867216.25)/36524.25)//1
B = Z + W - (W/4) + 1525
C = ((B-122.1)/365.25)//1
D = (365.25*C)//1
E = ((B-D)/30.6001)//1
F = (30.6001*E)//1
G = (E/14)//1
Day = B-D-F+(Q-Z)
Month = E-1 - 12*G
Year = C - 4715 - ((7 + Month)/10)//1
time = (Day%1)*24 #hours
print((Day//1), Month, Year, time)
        egress = time - td/2 #hours
        ingress = time + td/2
ft = ft+Ydata
        in.append((ingress))
        eg.append((egress))
     
print(Transists)
print(ingress)
print(egress)



I tested the code with the transit time, Jd, and period of Trappist-1b. I got back similar outputs to those in exoplanet archive.

Comments

Popular posts from this blog

HW5 Q1 (William Matzko)

HW5 Q2, Q3, Q5 (William Matzko)

HW 5 Q6 (William Matzko)