Guest User

Untitled

a guest
Dec 12th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. import abel.tools.transform_pairs
  5.  
  6. n = 100
  7.  
  8.  
  9. def plot(profile):
  10. profile = 'profile' + str(profile)
  11.  
  12. fig, axs = plt.subplots(1, 2, figsize=(6, 2.5))
  13.  
  14. # fig.suptitle(profile, weight='bold')
  15.  
  16. eps = 1e-8 # (some profiles do not like exact 0 and 1)
  17. r = np.linspace(0 + eps, 1 - eps, n)
  18. f, a = getattr(abel.tools.transform_pairs, profile)(r)
  19.  
  20. for i, p in enumerate([f, a]):
  21. ax = axs[i]
  22. ax.set_title(('source', 'projection')[i])
  23.  
  24. ax.spines['top'].set_visible(False)
  25. ax.spines['right'].set_visible(False)
  26. ax.set_xlabel(('$r$', '$x$')[i])
  27.  
  28. ax.plot(r, p, color='red')
  29.  
  30. ax.set_xlim((0, 1.01))
  31. ax.set_ylim(bottom=0)
  32.  
  33. plt.tight_layout()
  34.  
  35. #plt.show()
  36. #plt.savefig(format(profile) + '.svg')
Add Comment
Please, Sign In to add comment