Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1.  
  2.  
  3. def plot_consistent_Av(interpolation_kind = "linear"):
  4. filename = os.path.dirname(os.path.abspath(__file__))\
  5. + "/Data/" + "taurus.dat"
  6. taurus = np.genfromtxt(filename, skip_header=1,
  7. usecols=(3,7,8,9,10,11,12,1), dtype=None)
  8. SpT_taurus = [x[0].decode("utf-8") for x in taurus]
  9. photometry = {"V": [x[1] for x in taurus],
  10. "Rc": [x[2] for x in taurus],
  11. "Ic": [x[3] for x in taurus],
  12. "J":[x[4]+x[5]+x[6] for x in taurus],
  13. "H": [x[5]+x[6] for x in taurus],
  14. "Ks": [x[6] for x in taurus]}
  15. star_names = [x[7] for x in taurus]
  16.  
  17. #Instantiate a photometric system.
  18. ps = PhotometricSystem()
  19. k = list(it.combinations(photometry.keys(), 2))
  20. #print (sorted(k, key=ps))
  21.  
  22. # Create Whitney-Mathis extinction law interpolator:
  23. Whitney = WhitneyInterpolator(interpolation_kind=interpolation_kind)
  24. Mathis = MathisInterpolator(interpolation_kind=interpolation_kind)
  25. WhitneyMathis = MergedFallbackInterpolator([Whitney, Mathis])
  26.  
  27. # Create Pecaut & Mamajek pre-MS with extended dwarf color interpolator:
  28. PM = {}
  29. C_Av = {}
  30.  
  31. #Assumed color in V-Ic is YSO and Extended Dwarf:
  32. PMY_V_Ic =\
  33. PecautMamajekYoungInterpolator("SpT", "V-Ic",
  34. interpolation_kind=interpolation_kind)
  35. PMED_V_Ic =\
  36. PecautMamajekExtendedDwarfInterpolator("SpT", "V-Ic",
  37. interpolation_kind=\
  38. interpolation_kind)
  39. PM["V-Ic"] =\
  40. MergedFallbackInterpolator([PMY_V_Ic,
  41. PMED_V_Ic])
  42.  
  43. C_Av["V-Ic"] =\
  44. ColorAvCalculator("V-Ic", PhotometricSystem=ps, ColorInterpolators=[
  45. PecautMamajekYoungInterpolator,
  46. PecautMamajekDwarfInterpolator,
  47. PecautMamajekExtendedDwarfInterpolator
  48. ],
  49. ExtinctionInterpolator=WhitneyMathis,
  50. MergingInterpolator=MergedFallbackInterpolator,
  51. interpolation_kind="linear")
  52.  
  53. Av = {}
  54. Av_C = {}
  55. for color in PM:
  56. Av[color] = calc_Av(PM[color](SpT_taurus),
  57. np.array(photometry[color.split("-")[0]]) -\
  58. np.array(photometry[color.split("-")[1]]),
  59. WhitneyMathis(ps[color.split("-")[0]]) -\
  60. WhitneyMathis(ps[color.split("-")[1]]))
  61.  
  62. Av_C[color] = C_Av[color].evaluate(\
  63. np.array(photometry[color.split("-")[0]]) -\
  64. np.array(photometry[color.split("-")[1]]),
  65. SpT_taurus)
  66.  
  67. plt.plot(Av[color], Av_C[color])
  68. #plt.plot(0., np.max([np.max(Av[color]) for color in PM]))
  69.  
  70. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement