spotflux = 0.79823888 fname = 'wasp52-spot_n1.dat' # night 2 p0 = 0.16306021 radiustotal = 0.15634212 gamma_0 = 0.94426940 gamma_1 = -0.41811691 inc = 85.604770 phase = -0.014684627 phase = 0 spotlong = 59.382099 spotlat = 48.924085 spotsize = 22.062314 spotflux = 0.94007068 fname = 'wasp52-spot_n2.dat' period = 1.7497798 input = [p0,radiustotal,gamma_0,gamma_1,inc,phase,spotlong,spotlat,spotsize,spotflux] tt = -1.25135820e-04 tt += 56892.04327 data = loadtxt(fname) data_x = (data[:,0]-tt)/period fprism(data_x, input, spot_data=True, type_data='FLUX',plotting=True)
def transit_model(x, hjd, airmass, fix=[], SPOT_DATA=False): spotlong = x[6] spotlat = x[7] spotsize = abs(x[8]) spotflux = abs(x[9]) if spotsize > 20: spotsize = 20 if spotflux > 1.0: spotflux = 1.0 print SPOT_DATA print x p0 = x[0] #p0 = abs(x[0]) #if p0 > 0.25: #p0 = 0.25 gamma = x[10:12] if len(fix) > 0: x = fix #if abs(gamma[0]) > 1.0: #gamma[0] = 2.0*(gamma[0]/abs(gamma[0])) #if abs(gamma[0] + gamma[1]) >= 1.0: #gamma[1] = 1.0 - gamma[0] airmass_2 = x[1] norm_1 = x[2] norm_2 = x[3] t_11 = x[4] t_21 = x[5] poly_p = x[12:] poly_p_1 = x[12:12 + len(poly_p) / 2] poly_p_2 = x[12 + len(poly_p) / 2:] #poly_p_2[1] = poly_p_1[1] #poly_p_2[2] = poly_p_1[2] per = 1.7497798 inc = 85.35 ars = 7.38 # gamma = [0,0] tt = -1.25135820e-04 tt += 2456892.54327 t_10 = 1.0 t_20 = 1.0 #print airmass_2 #print norm_1, norm_2 #print t_1, t_2 print gamma divider = 2456895 poly_m_1 = poly_model(poly_p_1, hjd[hjd < divider] - min(hjd[hjd < divider])) poly_m_2 = poly_model(poly_p_2, hjd[hjd > divider] - min(hjd[hjd > divider])) poly_t_1 = poly_model([t_10, t_11], hjd[hjd < divider] - min(hjd[hjd < divider])) poly_t_2 = poly_model([t_20, t_21], hjd[hjd > divider] - min(hjd[hjd > divider])) t_dep = array(list(poly_t_1) + list(poly_t_2)) extinction = array(list(poly_m_1) + list(poly_m_2)) poly_m = 1.0 + 10.0**(0.4 * (airmass + airmass_2 * airmass**2.0) * extinction) z = transit.t2z(tt, per, inc, hjd, ars) #model = transit.occultquad(z, p0, gamma) # model = transit.occultnonlin(z, p0, gamma) radiustotal = (1.0 + p0) / ars phase_offset = 0 INPUT = [ p0, radiustotal, gamma[0], gamma[1], inc, phase_offset, spotlong, spotlat, spotsize, spotflux ] if SPOT_DATA == True: plotting = False model = fprism((hjd - tt) / (per), INPUT, SPOT_DATA, plotting=plotting) if plotting == True: quit() else: model = transit.occultquad(z, p0, gamma) #plot(hjd,model2,'b-') #plot(hjd,model,'ro') #show() detrended = t_dep * model / poly_m for i in range(0, len(hjd)): if hjd[i] < divider: detrended[i] = detrended[i] * norm_1 else: detrended[i] = detrended[i] * norm_2 # detrended = detrended*sum(model)/sum(detrended) return detrended, z
ars = 7.38 radiustotal = (1.0 + 0.164)/ars u1 = 0.1 u2 = 0.1 inclination = 85.35 midpoint = 2e7 spotlong = 30 spotlat = 50 spotsize = 10 spotflux = 0.8 INPUT = [radiusratio,radiustotal,u1,u2,inclination,midpoint,spotlong,spotlat,spotsize,spotflux] SPOT_DATA = True data_x = linspace(2e7-0.05,2e7+0.05,1000) plotting = True flux_out = fprism(data_x,INPUT,SPOT_DATA,plotting=True)
radiustotal = (1.0 + 0.164) / ars u1 = 0.1 u2 = 0.1 inclination = 85.35 midpoint = 2e7 spotlong = 30 spotlat = 50 spotsize = 10 spotflux = 0.8 INPUT = [ radiusratio, radiustotal, u1, u2, inclination, midpoint, spotlong, spotlat, spotsize, spotflux ] SPOT_DATA = True data_x = linspace(2e7 - 0.05, 2e7 + 0.05, 1000) plotting = True flux_out = fprism(data_x, INPUT, SPOT_DATA, plotting=True)
def transit_model(x,hjd,airmass,fix=[],SPOT_DATA=False): spotlong = x[6] spotlat = x[7] spotsize = abs(x[8]) spotflux = abs(x[9]) if spotsize > 20: spotsize = 20 if spotflux > 1.0: spotflux = 1.0 print SPOT_DATA print x p0 = x[0] #p0 = abs(x[0]) #if p0 > 0.25: #p0 = 0.25 gamma = x[10:12] if len(fix) > 0: x = fix #if abs(gamma[0]) > 1.0: #gamma[0] = 2.0*(gamma[0]/abs(gamma[0])) #if abs(gamma[0] + gamma[1]) >= 1.0: #gamma[1] = 1.0 - gamma[0] airmass_2 = x[1] norm_1 = x[2] norm_2 = x[3] t_11 = x[4] t_21 = x[5] poly_p = x[12:] poly_p_1 = x[12:12+len(poly_p)/2] poly_p_2 = x[12+len(poly_p)/2:] #poly_p_2[1] = poly_p_1[1] #poly_p_2[2] = poly_p_1[2] per = 1.7497798 inc = 85.35 ars = 7.38 # gamma = [0,0] tt = -1.25135820e-04 tt += 2456892.54327 t_10 = 1.0 t_20 = 1.0 #print airmass_2 #print norm_1, norm_2 #print t_1, t_2 print gamma divider = 2456895 poly_m_1 = poly_model(poly_p_1,hjd[hjd < divider] - min(hjd[hjd < divider])) poly_m_2 = poly_model(poly_p_2,hjd[hjd > divider] - min(hjd[hjd > divider])) poly_t_1 = poly_model([t_10,t_11],hjd[hjd < divider] - min(hjd[hjd < divider])) poly_t_2 = poly_model([t_20,t_21],hjd[hjd > divider] - min(hjd[hjd > divider])) t_dep = array(list(poly_t_1) + list(poly_t_2)) extinction = array(list(poly_m_1) + list(poly_m_2)) poly_m = 1.0 + 10.0**(0.4*(airmass + airmass_2*airmass**2.0)*extinction) z = transit.t2z(tt, per, inc, hjd, ars) #model = transit.occultquad(z, p0, gamma) # model = transit.occultnonlin(z, p0, gamma) radiustotal = (1.0 + p0)/ars phase_offset = 0 INPUT = [p0,radiustotal,gamma[0],gamma[1],inc,phase_offset,spotlong,spotlat,spotsize,spotflux] if SPOT_DATA == True: plotting = False model = fprism((hjd-tt)/(per),INPUT,SPOT_DATA,plotting=plotting) if plotting == True: quit() else: model = transit.occultquad(z, p0, gamma) #plot(hjd,model2,'b-') #plot(hjd,model,'ro') #show() detrended = t_dep*model / poly_m for i in range(0,len(hjd)): if hjd[i] < divider: detrended[i] = detrended[i]*norm_1 else: detrended[i] = detrended[i]*norm_2 # detrended = detrended*sum(model)/sum(detrended) return detrended, z