File: Sphere.py

package info (click to toggle)
bornagain 23.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,936 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (30 lines) | stat: -rwxr-xr-x 644 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3
"""
Plot |F(q)| vs q for sphere.

"""
import bornagain as ba
import numpy as np
from bornagain import ba_plot as bp, deg, nm, C3

if __name__ == '__main__':
    ff = ba.Sphere(1, True)
    qmax = 32

    v = ff.volume()
    n = 11
    x = [qmax*i/(n - 1) for i in range(n)]
    y = [ff.formfactor(C3(q, 0, 0)).real/v for q in x]
    ym = [-f for f in y]

    bp.plt.semilogy(x, y)
    bp.plt.semilogy(x, ym)

    bp.plt.xlim([0, qmax])
    bp.plt.ylim([5e-5, 2])

    label_fontsize = 18
    bp.plt.xlabel("$qR$", fontsize=label_fontsize)
    bp.plt.ylabel("$|F(q)|$", fontsize=label_fontsize)

    bp.plt.tight_layout()