-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_usage.py
More file actions
54 lines (46 loc) · 1.61 KB
/
Copy pathbasic_usage.py
File metadata and controls
54 lines (46 loc) · 1.61 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""Run every structure-factor estimator on a small in-memory point set."""
from __future__ import annotations
import numpy as np
from structure_factor import StructureFactorConfig, compute_structure_factor
def main() -> None:
positions = np.array(
[
[0.5, 0.5],
[0.75, 1.25],
[1.0, 1.5],
[1.5, 1.0],
[2.5, 2.5],
[3.0, 3.5],
[3.5, 3.0],
[5.0, 5.0],
[5.5, 6.0],
[6.0, 5.5],
[7.0, 7.0],
],
dtype=np.float64,
)
box_size = (8.0, 8.0)
configurations = [
("particle", StructureFactorConfig(box_size, method="particle")),
("binary", StructureFactorConfig(box_size, method="binary")),
("density", StructureFactorConfig(box_size, method="density")),
("occupancy", StructureFactorConfig(box_size, method="occupancy")),
(
"kernel/gaussian",
StructureFactorConfig(box_size, method="kernel", kernel="gaussian"),
),
(
"kernel/top-hat",
StructureFactorConfig(box_size, method="kernel", kernel="top-hat"),
),
(
"kernel/disk",
StructureFactorConfig(box_size, method="kernel", kernel="disk"),
),
]
for label, config in configurations:
result = compute_structure_factor(positions, config)
radial_bins = 0 if result.radial_wave_numbers is None else result.radial_wave_numbers.size
print(f"{label:16s} shape={result.spectrum.shape!s:10s} radial_bins={radial_bins}")
if __name__ == "__main__":
main()