def cald(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har): global excpl, exz, errpl, errz b = bdeg * par.degtorad l = ldeg * par.degtorad zkpc = dkpc * math.sin(b) if zkpc < 0.0: zkpcm = -zkpc else: zkpcm = zkpc adrc = aplmod(dkpc, b, l) * math.cos(b) #s^-1 errReid = err_Reid14(bdeg, sigb, ldeg, sigl, dkpc, sigd) #s^-1 azbchfh = fhigh(zkpc) * math.sin(b) * 1.08100761142e-19 #s^-1 azbchfl = flow(zkpc) * math.sin(b) * 1.08100761142e-19 #s^-1 errhi = errHFhi(bdeg, sigb, dkpc, sigd) #s^-1 errlo = errHFlo(bdeg, sigb, dkpc, sigd) #s^-1 if Har == 1: if zkpcm <= 1.5: print("Excess_parallel_Reid2014, Excess_z_HF04fit = ", adrc, ", ", azbchfl) print("Vp/Vs= ", Vprat(Rpkpcfunc(dkpc, b, l, par.Rskpc))) excpl = adrc exz = azbchfl else: print("Excess_parallel_Reid2014, Excess_z_HF04fit = ", adrc, ", ", azbchfh) print("Vp/Vs= ", Vprat(Rpkpcfunc(dkpc, b, l, par.Rskpc))) excpl = adrc exz = azbchfh else: if zkpcm <= 1.5: print("Excess_parallel_Reid2014, Excess_z_HF04fit = ", adrc, "+/-", errReid, ", ", azbchfl, "+/-", errlo) print("Vp/Vs= ", Vprat(Rpkpcfunc(dkpc, b, l, par.Rskpc))) excpl = adrc exz = azbchfl errpl = errReid errz = errlo else: print("Excess_parallel_Reid2014, Excess_z_HF04fit = ", adrc, "+/-", errReid, ", ", azbchfh, "+/-", errhi) print("Vp/Vs= ", Vprat(Rpkpcfunc(dkpc, b, l, par.Rskpc))) excpl = adrc exz = azbchfh errpl = errReid errz = errhi return None
def MWBHRfo(bdeg, ldeg, dkpc): b = bdeg * par.degtorad l = ldeg * par.degtorad Rskpc = par.Rskpc Vs = par.Vs conversion = par.conversion Rpkpc = Rpkpcfunc(dkpc, b, l, Rskpc) zkpc = dkpc * math.sin(b) be = (dkpc / Rskpc) * math.cos(b) - math.cos(l) coslam = be * (Rskpc / Rpkpc) MWPotential2014.append( KeplerPotential(amp=4 * 10**6. / bovy_conversion.mass_in_msol(Vs, Rskpc))) rforce1 = evaluateRforces(MWPotential2014, Rpkpc / Rskpc, zkpc / Rskpc) * bovy_conversion.force_in_kmsMyr( Vs, Rskpc) rfsun = evaluateRforces(MWPotential2014, Rskpc / Rskpc, 0.0 / Rskpc) * bovy_conversion.force_in_kmsMyr( Vs, Rskpc) #rf = (rforce1-rfsun)*conversion*math.cos(b) # s-1 rf0 = rforce1 * coslam + rfsun * math.cos(l) rf = rf0 * conversion * math.cos(b) # s-1 return rf
def MWpl(bdeg, ldeg, dkpc): b = bdeg * par.degtorad l = ldeg * par.degtorad c = par.c Rskpc = par.Rskpc kpctom = par.kpctom Vs = par.Vs Rpkpc = Rpkpcfunc(dkpc, b, l, Rskpc) Vprat = VpratioMW(Rpkpc) Vp = Vprat * Vs zkpc = dkpc * math.sin(b) Vsms = 1000.0 * Vs #m/s Rs = Rskpc * kpctom be = (dkpc / Rskpc) * math.cos(b) - math.cos(l) t0 = math.sin(l) * math.sin(l) + be * be t2 = (-1.0) * (math.cos(l) + Vprat * Vprat * (be / t0)) #dimensionless t3 = (Vsms * Vsms) / (Rs) #in SI adr = t2 * t3 * math.cos(b) #m sec^-2 (divide by c to get in s^-1) Excpl = adr / c #sec^-1 return Excpl
def MWBHZfo(bdeg, ldeg, dkpc): b = bdeg * par.degtorad l = ldeg * par.degtorad Rskpc = par.Rskpc Vs = par.Vs conversion = par.conversion Rpkpc = Rpkpcfunc(dkpc, b, l, Rskpc) zkpc = dkpc * math.sin(b) ''' bp= PowerSphericalPotentialwCutoff(alpha=1.8,rc=1.9/8.,normalize=0.05) mp= MiyamotoNagaiPotential(a=3./8.,b=0.28/8.,normalize=.6) np= NFWPotential(a=16./8.,normalize=.35) kp = KeplerPotential(amp=4*10**6./bovy_conversion.mass_in_msol(par.Vs,par.Rskpc)) MWBH = [bp,mp,np,kp] zf1 = evaluatezforces(MWBH, Rpkpc/Rskpc,zkpc/Rskpc)*bovy_conversion.force_in_kmsMyr(Vs,Rskpc) ''' MWPotential2014wBH = [ MWPotential2014, KeplerPotential(amp=4 * 10**6. / bovy_conversion.mass_in_msol(par.Vs, par.Rskpc)) ] zf1 = evaluatezforces(MWPotential2014wBH, Rpkpc / Rskpc, zkpc / Rskpc) * bovy_conversion.force_in_kmsMyr(Vs, Rskpc) Excz = zf1 * conversion * math.sin(b) #s-1 return Excz
def errRp(bdeg, sigb, ldeg, sigl, dkpc, sigd): sigRs = par.sigRs c = par.c Rskpc = par.Rskpc Rs = Rskpc * par.kpctom b = bdeg * par.degtorad l = ldeg * par.degtorad Rpkpc = Rpkpcfunc(dkpc, b, l, Rskpc) beta = (dkpc * math.cos(b) / Rskpc) - math.cos(l) t0 = math.sin(l) * math.sin(l) + beta * beta t1 = pow(t0, 0.5) def betabyd(): a = math.cos(b) / Rskpc return a def betabyb(): a = -dkpc * math.sin(b) / Rskpc return a def betabyl(): a = math.sin(l) return a def betabyRs(): a = -dkpc * math.cos(b) / (Rskpc * Rskpc) return a def Rpbyd(): a = (Rskpc * beta * betabyd()) / pow(t0, 0.5) return a def Rpbyb(): a = (Rskpc * beta * betabyb()) / pow(t0, 0.5) return a def Rpbyl(): a = (Rskpc * (math.sin(l) * math.cos(l) + beta * betabyl())) / pow(t0, 0.5) return a def RpbyRs(): a = pow(t0, 0.5) + (Rskpc * beta * betabyRs()) / pow(t0, 0.5) return a err_Rpsq = pow(Rpbyb(), 2.0) * pow(sigb, 2.0) + pow(Rpbyl(), 2.0) * pow( sigl, 2.0) + pow(Rpbyd(), 2.0) * pow(sigd, 2.0) + pow( RpbyRs(), 2.0) * pow(sigRs, 2.0) err_Rp = pow(err_Rpsq, 0.5) return err_Rp
def MWZfo(bdeg, ldeg, dkpc): b = bdeg * par.degtorad l = ldeg * par.degtorad Rskpc = par.Rskpc Vs = par.Vs conversion = par.conversion Rpkpc = Rpkpcfunc(dkpc, b, l, Rskpc) zkpc = dkpc * math.sin(b) zf1 = evaluatezforces(MWPotential2014, Rpkpc / Rskpc, zkpc / Rskpc) * bovy_conversion.force_in_kmsMyr(Vs, Rskpc) Excz = zf1 * conversion * math.sin(b) #s-1 return Excz
def calc(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har): b = bdeg*par.degtorad l = ldeg*par.degtorad zkpc = dkpc*math.sin(b) adrc = aplmod(dkpc,b,l)*math.cos(b) #s^-1 errReid = err_Reid14(bdeg, sigb, ldeg, sigl, dkpc, sigd) #s^-1 azbcnt = g(zkpc)*math.sin(b) #s^-1 errnt = errNT(bdeg, sigb, dkpc, sigd) #s^-1 be = (dkpc/par.Rskpc)*math.cos(b) - math.cos(l)#remove afterwards Vp = par.Vs*Vprat(Rpkpcfunc(dkpc,b,l,par.Rskpc))#km/s Vpms = 1000.0*Vp Vsms = 1000.0*par.Vs Rs = par.kpctom*par.Rskpc #m Rp = par.kpctom*Rpkpcfunc(dkpc,b,l,par.Rskpc) #m coslam = be*(par.Rskpc/Rpkpcfunc(dkpc,b,l,par.Rskpc)) Vp2byRp = (Vpms*Vpms)/Rp #m/ss Vs2byRs = (Vsms*Vsms)/Rs #m/ss if Har==1: print ("Excess_parallel_Reid2014, Excess_z_NT95 = ", adrc,", ", azbcnt) else: print ("Excess_parallel_Reid2014, Excess_z_NT95 = ", adrc,"+/-",errReid, ", ", azbcnt,"+/-",errnt) return None;
def MWBHZfo(bdeg, ldeg, dkpc): b = bdeg * par.degtorad l = ldeg * par.degtorad Rskpc = par.Rskpc Vs = par.Vs conversion = par.conversion Rpkpc = Rpkpcfunc(dkpc, b, l, Rskpc) zkpc = dkpc * math.sin(b) MWPotential2014.append( KeplerPotential(amp=4 * 10**6. / bovy_conversion.mass_in_msol(Vs, Rskpc))) zf1 = evaluatezforces(MWPotential2014, Rpkpc / Rskpc, zkpc / Rskpc) * bovy_conversion.force_in_kmsMyr(Vs, Rskpc) Excz = zf1 * conversion * math.sin(b) #s-1 return Excz
def MWBHRfo(bdeg, ldeg, dkpc): b = bdeg * par.degtorad l = ldeg * par.degtorad Rskpc = par.Rskpc Vs = par.Vs conversion = par.conversion Rpkpc = Rpkpcfunc(dkpc, b, l, Rskpc) zkpc = dkpc * math.sin(b) be = (dkpc / Rskpc) * math.cos(b) - math.cos(l) coslam = be * (Rskpc / Rpkpc) ''' bp= PowerSphericalPotentialwCutoff(alpha=1.8,rc=1.9/8.,normalize=0.05) mp= MiyamotoNagaiPotential(a=3./8.,b=0.28/8.,normalize=.6) np= NFWPotential(a=16./8.,normalize=.35) kp = KeplerPotential(amp=4*10**6./bovy_conversion.mass_in_msol(par.Vs,par.Rskpc)) MWBH = [bp,mp,np,kp] rforce1 = evaluateRforces(MWBH, Rpkpc/Rskpc,zkpc/Rskpc)*bovy_conversion.force_in_kmsMyr(Vs,Rskpc) rfsun = evaluateRforces(MWBH, Rskpc/Rskpc,0.0/Rskpc)*bovy_conversion.force_in_kmsMyr(Vs,Rskpc) ''' MWPotential2014wBH = [ MWPotential2014, KeplerPotential(amp=4 * 10**6. / bovy_conversion.mass_in_msol(par.Vs, par.Rskpc)) ] rforce1 = evaluateRforces(MWPotential2014wBH, Rpkpc / Rskpc, zkpc / Rskpc) * bovy_conversion.force_in_kmsMyr( Vs, Rskpc) rfsun = evaluateRforces(MWPotential2014wBH, Rskpc / Rskpc, 0.0 / Rskpc) * bovy_conversion.force_in_kmsMyr( Vs, Rskpc) #rf = (rforce1-rfsun)*conversion*math.cos(b) # s-1 rf0 = rforce1 * coslam + rfsun * math.cos(l) rf = rf0 * conversion * math.cos(b) # s-1 return rf
def err_Reid14(bdeg, sigb, ldeg, sigl, dkpc, sigd): sigVs = par.sigVs*1000.0#SI sigRs = par.sigRs*par.kpctom #SI sigb0r = par.sigb0r*1000.0/par.kpctom #SI b0reid14=par.b0reid14*1000.0/par.kpctom #SI c=par.c Rskpc=par.Rskpc Rs = Rskpc*par.kpctom #SI Vs= par.Vs Vsms = 1000.0*Vs #SI b = bdeg*par.degtorad l = ldeg*par.degtorad Rpkpc = Rpkpcfunc(dkpc,b,l,Rskpc) Vp=Vs+par.b0reid14*(Rpkpc - Rskpc) # in km s^-1 Vpms = 1000.0*Vp #SI Rp = Rpkpc*par.kpctom #SI d = dkpc*par.kpctom #SI beta = (dkpc*math.cos(b)/Rskpc) - math.cos(l) t0 = math.sin(l)*math.sin(l) + beta*beta def betabyd(): a = math.cos(b)/Rs return a; def betabyb(): a = -d*math.sin(b)/Rs return a; def betabyl(): a = math.sin(l) return a; def betabyRs(): a = -d*math.cos(b)/(Rs*Rs) return a; def Rpbyd(): a = (Rs*beta*betabyd())/pow(t0,0.5) return a; def Rpbyb(): a = (Rs*beta*betabyb())/pow(t0,0.5) return a; def Rpbyl(): a = (Rs*(math.sin(l)*math.cos(l) + beta*betabyl()))/pow(t0,0.5) return a; def RpbyRs(): a = pow(t0,0.5) + (Rs*beta*betabyRs())/pow(t0,0.5) return a; def Vpbyd(): a = b0reid14*Rpbyd() return a; def Vpbyb(): a = b0reid14*Rpbyb() return a; def Vpbyl(): a = b0reid14*Rpbyl() return a; def VpbyRs(): a = b0reid14*(RpbyRs() - 1.0) return a; def VpbyVs(): a = 1.0 return a; def Vpbyb0reid(): a = Rp-Rs return a; def diffbyb(): term1 = math.cos(l)*math.sin(b)*Vsms*Vsms/(c*Rs) term2 = math.sin(b)*beta*Vpms*Vpms/(c*Rs*t0) term3 = -math.cos(b)*Vpms*Vpms*betabyb()/(c*Rs*t0) term4 = 2.0*math.cos(b)*beta*beta*Vpms*Vpms*betabyb()/(c*Rs*t0*t0) term5 = -2.0*math.cos(b)*beta*Vpms*Vpbyb()/(c*Rs*t0) a = term1+term2+term3+term4+term5 return a; def diffbyl(): term1 = math.sin(l)*math.cos(b)*Vsms*Vsms/(c*Rs) term2 = -math.cos(b)*Vpms*Vpms*betabyl()/(c*Rs*t0) term3 = -2.0*math.cos(b)*beta*Vpms*Vpbyl()/(c*Rs*t0) t4a = math.sin(l)*math.cos(l) t4b = beta*betabyl() term4 = 2.0*math.cos(b)*beta*Vpms*Vpms*(t4a + t4b)/(c*Rs*t0*t0) a = term1 +term2 + term3 + term4 return a; def diffbyd(): term1 = -math.cos(b)*Vpms*Vpms*betabyd()/(c*Rs*t0) term2 = -2.0*math.cos(b)*beta*Vpms*Vpbyd()/(c*Rs*t0) term3 = 2.0*math.cos(b)*beta*beta*Vpms*Vpms*betabyd()/(c*Rs*t0*t0) a = term1 + term2 + term3 return a; def diffbyRs(): term1 = math.cos(l)*math.cos(b)*Vsms*Vsms/(c*Rs*Rs) term2 = math.cos(b)*beta*Vpms*Vpms/(c*Rs*Rs*t0) term3 = -math.cos(b)*Vpms*Vpms*betabyRs()/(c*Rs*t0) term4 = 2.0*math.cos(b)*beta*beta*Vpms*Vpms*betabyRs()/(c*Rs*t0*t0) term5 = -2.0*math.cos(b)*beta*Vpms*VpbyRs()/(c*Rs*t0) a = term1 + term2 + term3 + term4 + term5 return a; def diffbyVs(): term1 = -2.0*math.cos(b)*math.cos(l)*Vsms/(c*Rs) term2 = -2.0*math.cos(b)*beta*Vpms*VpbyVs()/(c*Rs*t0) a = term1+term2 return a; def diffbyb0reid(): a = -2.0*math.cos(b)*beta*Vpms*Vpbyb0reid()/(c*Rs*t0) return a; err_plsq = pow(diffbyb(),2.0)*pow(sigb,2.0) + pow(diffbyl(),2.0)*pow(sigl,2.0) + pow(diffbyd(),2.0)*pow(sigd,2.0) + pow(diffbyVs(),2.0)*pow(sigVs,2.0) + pow(diffbyRs(),2.0)*pow(sigRs,2.0) + pow(diffbyb0reid(),2.0)*pow(sigb0r,2.0) err_pl = pow(err_plsq,0.5) return err_pl;
def err_DT91(bdeg, sigb, ldeg, sigl, dkpc, sigd): sigVs = par.sigVs * 1000.0 #SI sigRs = par.sigRs * par.kpctom #SI sigb0dt = par.sigb0dt #Dimensionless b0dt91 = par.b0dt91 #Dimensionless c = par.c Rskpc = par.Rskpc Rs = Rskpc * par.kpctom #SI Vs = par.Vs Vsms = 1000.0 * Vs #SI b = bdeg * par.degtorad l = ldeg * par.degtorad Rpkpc = Rpkpcfunc(dkpc, b, l, Rskpc) Vp = Vs * (1.0 - b0dt91 * (Rpkpc - Rskpc) / Rskpc) # in km s^-1 Vpms = 1000.0 * Vp #SI Rp = Rpkpc * par.kpctom #SI d = dkpc * par.kpctom #SI beta = (dkpc * math.cos(b) / Rskpc) - math.cos(l) t0 = math.sin(l) * math.sin(l) + beta * beta def betabyd(): a = math.cos(b) / Rs return a def betabyb(): a = -d * math.sin(b) / Rs return a def betabyl(): a = math.sin(l) return a def betabyRs(): a = -d * math.cos(b) / (Rs * Rs) return a def Rpbyd(): a = (Rs * beta * betabyd()) / pow(t0, 0.5) return a def Rpbyb(): a = (Rs * beta * betabyb()) / pow(t0, 0.5) return a def Rpbyl(): a = (Rs * (math.sin(l) * math.cos(l) + beta * betabyl())) / pow(t0, 0.5) return a def RpbyRs(): a = pow(t0, 0.5) + (Rs * beta * betabyRs()) / pow(t0, 0.5) return a def Vpbyb(): a = -(Vsms / Rs) * b0dt91 * Rpbyb() return a def Vpbyl(): a = -(Vsms / Rs) * b0dt91 * Rpbyl() return a def Vpbyd(): a = -(Vsms / Rs) * b0dt91 * Rpbyd() return a def VpbyRs(): a = (Vsms * b0dt91 * Rp / (Rs * Rs)) - ((Vsms / Rs) * b0dt91 * RpbyRs()) return a def VpbyVs(): a = 1.0 - b0dt91 * (Rp - Rs) / Rs return a def Vpbyb0dt(): a = -Vsms * (Rp - Rs) / Rs return a def diffbyb(): term1 = math.cos(l) * math.sin(b) * Vsms * Vsms / (c * Rs) term2 = math.sin(b) * beta * Vpms * Vpms / (c * Rs * t0) term3 = -math.cos(b) * Vpms * Vpms * betabyb() / (c * Rs * t0) term4 = 2.0 * math.cos(b) * beta * beta * Vpms * Vpms * betabyb() / ( c * Rs * t0 * t0) term5 = -2.0 * math.cos(b) * beta * Vpms * Vpbyb() / (c * Rs * t0) a = term1 + term2 + term3 + term4 + term5 return a def diffbyl(): term1 = math.sin(l) * math.cos(b) * Vsms * Vsms / (c * Rs) term2 = -math.cos(b) * Vpms * Vpms * betabyl() / (c * Rs * t0) term3 = -2.0 * math.cos(b) * beta * Vpms * Vpbyl() / (c * Rs * t0) t4a = math.sin(l) * math.cos(l) t4b = beta * betabyl() term4 = 2.0 * math.cos(b) * beta * Vpms * Vpms * (t4a + t4b) / ( c * Rs * t0 * t0) a = term1 + term2 + term3 + term4 return a def diffbyd(): term1 = -math.cos(b) * Vpms * Vpms * betabyd() / (c * Rs * t0) term2 = -2.0 * math.cos(b) * beta * Vpms * Vpbyd() / (c * Rs * t0) term3 = 2.0 * math.cos(b) * beta * beta * Vpms * Vpms * betabyd() / ( c * Rs * t0 * t0) a = term1 + term2 + term3 return a def diffbyRs(): term1 = math.cos(l) * math.cos(b) * Vsms * Vsms / (c * Rs * Rs) term2 = math.cos(b) * beta * Vpms * Vpms / (c * Rs * Rs * t0) term3 = -math.cos(b) * Vpms * Vpms * betabyRs() / (c * Rs * t0) term4 = 2.0 * math.cos(b) * beta * beta * Vpms * Vpms * betabyRs() / ( c * Rs * t0 * t0) term5 = -2.0 * math.cos(b) * beta * Vpms * VpbyRs() / (c * Rs * t0) a = term1 + term2 + term3 + term4 + term5 return a def diffbyVs(): term1 = -2.0 * math.cos(b) * math.cos(l) * Vsms / (c * Rs) term2 = -2.0 * math.cos(b) * beta * Vpms * VpbyVs() / (c * Rs * t0) a = term1 + term2 return a def diffbyb0dt(): a = -2.0 * math.cos(b) * beta * Vpms * Vpbyb0dt() / (c * Rs * t0) return a err_plsq = pow(diffbyb(), 2.0) * pow(sigb, 2.0) + pow(diffbyl( ), 2.0) * pow(sigl, 2.0) + pow(diffbyd(), 2.0) * pow(sigd, 2.0) + pow( diffbyVs(), 2.0) * pow(sigVs, 2.0) + pow(diffbyRs(), 2.0) * pow( sigRs, 2.0) + pow(diffbyb0dt(), 2.0) * pow(sigb0dt, 2.0) err_pl = pow(err_plsq, 0.5) return err_pl
def allcal(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har): flag = 1 inp = input( "Choose Your Option A/B/C/D/Ea/Eb/Fa/Fb/Ga/Gb/Ha/Hb/Ia/Ib/Ja/Jb/Ka/Kb/La/Lb (Check README for details): " ) if inp == 'A' or inp == 'a': cala(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Expla() Ex_z = Exza() if Har == 0: errpl = Errpla() errper = Errza() flag2 = 1 elif inp == 'B' or inp == 'b': calb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explb() Ex_z = Exzb() if Har == 0: errpl = Errplb() errper = Errzb() flag2 = 1 elif inp == 'C' or inp == 'c': calc(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explc() Ex_z = Exzc() if Har == 0: errpl = Errplc() errper = Errzc() flag2 = 1 elif inp == 'D' or inp == 'd': cald(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Expld() Ex_z = Exzd() if Har == 0: errpl = Errpld() errper = Errzd() flag2 = 1 elif inp == 'Ea' or inp == 'ea': calea(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explea() Ex_z = Exzea() flag2 = 0 elif inp == 'Eb' or inp == 'eb': caleb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Expleb() Ex_z = Exzeb() flag2 = 0 elif inp == 'Fa' or inp == 'fa': calfa(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explfa() Ex_z = Exzfa() flag2 = 0 elif inp == 'Fb' or inp == 'fb': calfb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explfb() Ex_z = Exzfb() flag2 = 0 elif inp == 'Ga' or inp == 'ga': calga(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explga() Ex_z = Exzga() flag2 = 0 elif inp == 'Gb' or inp == 'gb': calgb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explgb() Ex_z = Exzgb() flag2 = 0 elif inp == 'Ha' or inp == 'ha': calha(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explha() Ex_z = Exzha() flag2 = 0 elif inp == 'Hb' or inp == 'hb': calhb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explhb() Ex_z = Exzhb() flag2 = 0 elif inp == 'Ia' or inp == 'ia': calia(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explia() Ex_z = Exzia() flag2 = 0 elif inp == 'Ib' or inp == 'ib': calib(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explib() Ex_z = Exzib() flag2 = 0 elif inp == 'Ja' or inp == 'ja': calja(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explja() Ex_z = Exzja() flag2 = 0 elif inp == 'Jb' or inp == 'jb': caljb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Expljb() Ex_z = Exzjb() flag2 = 0 elif inp == 'Ka' or inp == 'ka': calka(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explka() Ex_z = Exzka() flag2 = 0 elif inp == 'Kb' or inp == 'kb': calkb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explkb() Ex_z = Exzkb() flag2 = 0 elif inp == 'La' or inp == 'la': calla(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Explla() Ex_z = Exzla() flag2 = 0 elif inp == 'Lb' or inp == 'lb': callb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) Ex_pl = Expllb() Ex_z = Exzlb() flag2 = 0 else: flag = 0 print("Invalid Input") if flag == 1: b = bdeg * par.degtorad l = ldeg * par.degtorad zkpc = dkpc * math.sin(b) errzkpc = errz(bdeg, sigb, dkpc, sigd) Rskpc = par.Rskpc Rpkpc = Rpkpcfunc(dkpc, b, l, Rskpc) errRpkpc = errRp(bdeg, sigb, ldeg, sigl, dkpc, sigd) if Har == 1: print("Z value in kpc = ", zkpc) print("Rp in kpc = ", Rpkpc) print( "We are not reporting errors as Harris catalogue does not contain any error. If you want error, enter inputs (l, b, d) with errors after choosing 'n' in the first step." ) else: print("Z value in kpc = ", zkpc, "+/-", errzkpc) print("Rp in kpc = ", Rpkpc, "+/-", errRpkpc) inp2 = input("Do you want the Shklovskii term too?(Y/N): ") if inp2 == 'Y' or inp2 == 'y': shk(dkpc, sigd) Ex_shk = Exshk() errshk = errShk() elif inp2 == 'N' or inp2 == 'n': print("Ok") Ex_shk = 0.0 errshk = 0.0 else: print("Invalid Input") inp3 = input("Do you want the intrinsic period derivative?(Y/N): ") if inp3 == "Y" or inp3 == "y": if flag2 == 1 and Har == 0: Pdotintcalerr(Ex_pl, Ex_z, Ex_shk, errpl, errper, errshk) else: Pdotintcal(Ex_pl, Ex_z, Ex_shk, flag2) elif inp3 == "N" or inp3 == "n": print("Ok") else: print("Invalid Input") print("\n Please round off the outputs appropriately \n") return None
def allcal(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har): flag = 1 inp = raw_input( "Choose Your Option A/B/C/D/Ea/Eb/Fa/Fb/Ga/Gb/Ha/Hb/Ia/Ib/Ja/Jb/Ka/Kb/La/Lb (Check README for details): " ) if inp == 'A' or inp == 'a': cala(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'B' or inp == 'b': calb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'C' or inp == 'c': calc(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'D' or inp == 'd': cald(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Ea' or inp == 'ea': calea(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Eb' or inp == 'eb': caleb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Fa' or inp == 'fa': calfa(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Fb' or inp == 'fb': calfb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Ga' or inp == 'ga': calga(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Gb' or inp == 'gb': calgb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Ha' or inp == 'ha': calha(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Hb' or inp == 'hb': calhb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Ia' or inp == 'ia': calia(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Ib' or inp == 'ib': calib(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Ja' or inp == 'ja': calja(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Jb' or inp == 'jb': caljb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Ka' or inp == 'ka': calka(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Kb' or inp == 'kb': calkb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'La' or inp == 'la': calla(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) elif inp == 'Lb' or inp == 'lb': callb(bdeg, sigb, ldeg, sigl, dkpc, sigd, Har) else: flag = 0 print("Invalid Input") if flag == 1: b = bdeg * par.degtorad l = ldeg * par.degtorad zkpc = dkpc * math.sin(b) errzkpc = errz(bdeg, sigb, dkpc, sigd) Rskpc = par.Rskpc Rpkpc = Rpkpcfunc(dkpc, b, l, Rskpc) errRpkpc = errRp(bdeg, sigb, ldeg, sigl, dkpc, sigd) if Har == 1: print("Z value in kpc = ", zkpc) print("Rp in kpc = ", Rpkpc) print( "We are not reporting errors as Harris catalogue does not contain any error. If you want error, enter inputs (l, b, d) with errors after choosing 'n' in the first step." ) else: print("Z value in kpc = ", zkpc, "+/-", errzkpc) print("Rp in kpc = ", Rpkpc, "+/-", errRpkpc) inp2 = raw_input("Do you want the Shklovskii term too?(Y/N): ") if inp2 == 'Y' or inp2 == 'y': shk(dkpc, sigd) elif inp2 == 'N' or inp2 == 'n': print("Ok") else: print("Invalid Input") return None