def makeModel(self, tt, period, incl, t, dor, ror, ldm_coeff1, ldm_coeff2): """ -t2z I have modified this function so that the midpoint of every transit is 0 find lmdk from the star """ # use t2z to make z z = t2z(tt, period, incl, t, dor) return occultquad(z, ror, [ldm_coeff1, ldm_coeff2])
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
def transit_model(x,hjd,airmass,fix=[]): p0 = abs(x[0]) gamma = x[5:7] if len(fix) > 0: x = fix tt = x[1] per = x[2] inc = x[3] ars = x[4] airmass_2 = x[7] norm_1 = x[8] norm_2 = x[9] t_10 = x[10] t_11 = x[11] t_20 = x[12] t_21 = x[13] poly_p = x[14:] poly_p_1 = x[14:14+len(poly_p)/2] poly_p_2 = x[14+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 gamma[0] = abs(gamma[0]) gamma[1] = abs(gamma[1]) if gamma[1] > gamma[0]: gamma[1] = gamma[0] #print airmass_2 #print norm_1, norm_2 #print t_1, t_2 z = transit.t2z(tt, per, inc, hjd, ars) 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) print x model = transit.occultquad(z, p0, gamma) 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
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