Line data Source code
1 : // SPDX-License-Identifier: BSD-3-Clause 2 : // Copyright (c) 2023 Scipp contributors (https://github.com/scipp) 3 : /// @file 4 : /// @author Neil Vaytet 5 : #include "pybind11.h" 6 : 7 : #include "scipp/variable/trigonometry.h" 8 : 9 : using namespace scipp; 10 : using namespace scipp::variable; 11 : 12 : namespace py = pybind11; 13 : 14 3 : template <class T> void bind_atan2(py::module &m) { 15 3 : m.def( 16 3 : "atan2", [](const T &y, const T &x) { return atan2(y, x); }, 17 0 : py::kw_only(), py::arg("y"), py::arg("x"), 18 0 : py::call_guard<py::gil_scoped_release>()); 19 3 : m.def( 20 2 : "atan2", [](const T &y, const T &x, T &out) { return atan2(y, x, out); }, 21 0 : py::kw_only(), py::arg("y"), py::arg("x"), py::arg("out"), 22 3 : py::call_guard<py::gil_scoped_release>()); 23 3 : } 24 : 25 3 : void init_trigonometry(py::module &m) { bind_atan2<Variable>(m); }