Debian Codegraph @

docs/source/saxs/images/pr_figures.py

raw
1 import os
2
3 import matplotlib.pyplot as plt
4
5 raw_path = os.path.abspath(os.path.join('.', __file__, '..', '..', '..', '..', '..'))
6 if raw_path not in os.sys.path:
7 os.sys.path.append(raw_path)
8
9 import bioxtasraw.RAWAPI as raw
10
11 settings = raw.load_settings(os.path.join('.', 'figure_data', 'SAXS.cfg'))
12
13 gi_83 = raw.load_ifts([os.path.join('.', 'figure_data', 'gi_83.out')], settings)[0]
14 gi_103 = raw.load_ifts([os.path.join('.', 'figure_data', 'gi_103.out')], settings)[0]
15 gi_123 = raw.load_ifts([os.path.join('.', 'figure_data', 'gi_123.out')], settings)[0]
16
17 plt.figure(figsize=(6,3))
18 ax1 = plt.subplot(1, 2, 1)
19 ax1.plot(gi_83.r, gi_83.p/gi_83.getParameter('i0'), '-', label='$D_{max}=83$ $\AA$',
20 linewidth=2.0)
21 ax1.plot(gi_103.r, gi_103.p/gi_103.getParameter('i0'), '-', label='$D_{max}=103$ $\AA$',
22 zorder=10, linewidth=2.0)
23 ax1.plot(gi_123.r, gi_123.p/gi_123.getParameter('i0'), '-', label='$D_{max}=123$ $\AA$',
24 linewidth=2.0)
25 ax1.axhline(0, color='0', linewidth=1.0, zorder=-1)
26 ax1.legend(fontsize='x-small')
27 ax1.set_ylabel('P(r)/I(0)')
28 ax1.set_xlabel('r [$\AA$]')
29 ax1.yaxis.set_ticks([])
30
31 ax2 = plt.subplot(1, 2, 2)
32 ax2.plot(gi_83.r, gi_83.p/gi_83.getParameter('i0'), '-', label='$D_{max}=83$ $\AA$',
33 linewidth=3.0)
34 ax2.plot(gi_103.r, gi_103.p/gi_103.getParameter('i0'), '-', label='$D_{max}=103$ $\AA$',
35 zorder=10, linewidth=3.0)
36 ax2.plot(gi_123.r, gi_123.p/gi_123.getParameter('i0'), '-', label='$D_{max}=123$ $\AA$',
37 linewidth=3.0)
38 ax2.axhline(0, color='0', linewidth=1.0, zorder=-1)
39 ax2.legend()
40 ax2.set_ylim(-0.00001, 0.0005)
41 ax2.set_xlim(73, 133)
42 ax2.set_ylabel('P(r)/I(0)')
43 ax2.set_xlabel('r [$\AA$]')
44 ax2.yaxis.set_ticks([])
45
46 plt.subplots_adjust(left=0.06, bottom=0.16, right=0.98, wspace=0.19, top=0.98)
47 plt.savefig('pr_dmax_variation.png', dpi=300)
48 plt.show()