1use std::str::FromStr;
2
3use crate::amplitude::{Amplitude_32, Amplitude_64};
4use pyo3::prelude::*;
5use rustitude::prelude::RustitudeError;
6use rustitude_gluex::sdmes as rust;
7use rustitude_gluex::utils::{Decay, Frame};
8
9#[pyfunction]
10#[pyo3(signature = (name, decay="[0, 1]", frame="helicity"))]
11fn TwoPiSDME(name: &str, decay: &str, frame: &str) -> PyResult<Amplitude_64> {
12 Ok(Amplitude_64::new(
13 name,
14 rust::TwoPiSDME::new(
15 Decay::from_str(decay)
16 .map_err(RustitudeError::from)
17 .map_err(PyErr::from)?,
18 Frame::from_str(frame)
19 .map_err(RustitudeError::from)
20 .map_err(PyErr::from)?,
21 ),
22 ))
23}
24#[pyfunction]
25#[pyo3(signature = (name, decay="[0, 1]", frame="helicity"))]
26fn TwoPiSDME_64(name: &str, decay: &str, frame: &str) -> PyResult<Amplitude_64> {
27 Ok(Amplitude_64::new(
28 name,
29 rust::TwoPiSDME::new(
30 Decay::from_str(decay)
31 .map_err(RustitudeError::from)
32 .map_err(PyErr::from)?,
33 Frame::from_str(frame)
34 .map_err(RustitudeError::from)
35 .map_err(PyErr::from)?,
36 ),
37 ))
38}
39#[pyfunction]
40#[pyo3(signature = (name, decay="[0, 1]", frame="helicity"))]
41fn TwoPiSDME_32(name: &str, decay: &str, frame: &str) -> PyResult<Amplitude_32> {
42 Ok(Amplitude_32::new(
43 name,
44 rust::TwoPiSDME::new(
45 Decay::from_str(decay)
46 .map_err(RustitudeError::from)
47 .map_err(PyErr::from)?,
48 Frame::from_str(frame)
49 .map_err(RustitudeError::from)
50 .map_err(PyErr::from)?,
51 ),
52 ))
53}
54#[pyfunction]
55#[pyo3(signature = (name, decay="[0, 1, 2]", frame="helicity"))]
56fn ThreePiSDME(name: &str, decay: &str, frame: &str) -> PyResult<Amplitude_64> {
57 Ok(Amplitude_64::new(
58 name,
59 rust::ThreePiSDME::new(
60 Decay::from_str(decay)
61 .map_err(RustitudeError::from)
62 .map_err(PyErr::from)?,
63 Frame::from_str(frame)
64 .map_err(RustitudeError::from)
65 .map_err(PyErr::from)?,
66 ),
67 ))
68}
69#[pyfunction]
70#[pyo3(signature = (name, decay="[0, 1, 2]", frame="helicity"))]
71fn ThreePiSDME_64(name: &str, decay: &str, frame: &str) -> PyResult<Amplitude_64> {
72 Ok(Amplitude_64::new(
73 name,
74 rust::ThreePiSDME::new(
75 Decay::from_str(decay)
76 .map_err(RustitudeError::from)
77 .map_err(PyErr::from)?,
78 Frame::from_str(frame)
79 .map_err(RustitudeError::from)
80 .map_err(PyErr::from)?,
81 ),
82 ))
83}
84#[pyfunction]
85#[pyo3(signature = (name, decay="[0, 1, 2]", frame="helicity"))]
86fn ThreePiSDME_32(name: &str, decay: &str, frame: &str) -> PyResult<Amplitude_32> {
87 Ok(Amplitude_32::new(
88 name,
89 rust::ThreePiSDME::new(
90 Decay::from_str(decay)
91 .map_err(RustitudeError::from)
92 .map_err(PyErr::from)?,
93 Frame::from_str(frame)
94 .map_err(RustitudeError::from)
95 .map_err(PyErr::from)?,
96 ),
97 ))
98}
99#[pyfunction]
100#[pyo3(signature = (name, decay="[0, 1]", frame="helicity"))]
101fn VecRadiativeSDME(name: &str, decay: &str, frame: &str) -> PyResult<Amplitude_64> {
102 Ok(Amplitude_64::new(
103 name,
104 rust::VecRadiativeSDME::new(
105 Decay::from_str(decay)
106 .map_err(RustitudeError::from)
107 .map_err(PyErr::from)?,
108 Frame::from_str(frame)
109 .map_err(RustitudeError::from)
110 .map_err(PyErr::from)?,
111 ),
112 ))
113}
114#[pyfunction]
115#[pyo3(signature = (name, decay="[0, 1]", frame="helicity"))]
116fn VecRadiativeSDME_64(name: &str, decay: &str, frame: &str) -> PyResult<Amplitude_64> {
117 Ok(Amplitude_64::new(
118 name,
119 rust::VecRadiativeSDME::new(
120 Decay::from_str(decay)
121 .map_err(RustitudeError::from)
122 .map_err(PyErr::from)?,
123 Frame::from_str(frame)
124 .map_err(RustitudeError::from)
125 .map_err(PyErr::from)?,
126 ),
127 ))
128}
129#[pyfunction]
130#[pyo3(signature = (name, decay="[0, 1]", frame="helicity"))]
131fn VecRadiativeSDME_32(name: &str, decay: &str, frame: &str) -> PyResult<Amplitude_32> {
132 Ok(Amplitude_32::new(
133 name,
134 rust::VecRadiativeSDME::new(
135 Decay::from_str(decay)
136 .map_err(RustitudeError::from)
137 .map_err(PyErr::from)?,
138 Frame::from_str(frame)
139 .map_err(RustitudeError::from)
140 .map_err(PyErr::from)?,
141 ),
142 ))
143}
144
145pub fn pyo3_module(m: &Bound<'_, PyModule>) -> PyResult<()> {
146 m.add_function(wrap_pyfunction!(TwoPiSDME, m)?)?;
147 m.add_function(wrap_pyfunction!(TwoPiSDME_64, m)?)?;
148 m.add_function(wrap_pyfunction!(TwoPiSDME_32, m)?)?;
149 m.add_function(wrap_pyfunction!(ThreePiSDME, m)?)?;
150 m.add_function(wrap_pyfunction!(ThreePiSDME_64, m)?)?;
151 m.add_function(wrap_pyfunction!(ThreePiSDME_32, m)?)?;
152 m.add_function(wrap_pyfunction!(VecRadiativeSDME, m)?)?;
153 m.add_function(wrap_pyfunction!(VecRadiativeSDME_64, m)?)?;
154 m.add_function(wrap_pyfunction!(VecRadiativeSDME_32, m)?)?;
155 Ok(())
156}