2022-09-22 19:02:41 +00:00
|
|
|
#include "lasp_siggen.h"
|
2022-10-21 21:12:47 +00:00
|
|
|
#include "arma_npy.h"
|
2022-09-22 19:02:41 +00:00
|
|
|
#include "lasp_siggen_impl.h"
|
|
|
|
#include <iostream>
|
|
|
|
#include <pybind11/pybind11.h>
|
|
|
|
|
|
|
|
using std::cerr;
|
|
|
|
namespace py = pybind11;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \ingroup pybind
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initialize Siggen wrappers
|
|
|
|
*
|
|
|
|
* @param m The Python module to add classes and methods to
|
|
|
|
*/
|
|
|
|
void init_siggen(py::module &m) {
|
|
|
|
|
2022-10-21 21:12:47 +00:00
|
|
|
/// Siggen
|
2022-09-22 19:02:41 +00:00
|
|
|
py::class_<Siggen, std::shared_ptr<Siggen>> siggen(m, "Siggen");
|
|
|
|
siggen.def("setLevel", &Siggen::setLevel,
|
|
|
|
"Set the level of the signal generator");
|
|
|
|
siggen.def("setDCOffset", &Siggen::setDCOffset);
|
|
|
|
siggen.def("setMute", &Siggen::setMute);
|
|
|
|
siggen.def("setLevel", &Siggen::setLevel);
|
2022-10-21 21:12:47 +00:00
|
|
|
siggen.def("setLevel", &Siggen::setLevel, py::arg("newLevel"),
|
|
|
|
py::arg("dB") = true);
|
|
|
|
siggen.def("reset", &Siggen::reset);
|
2023-08-29 13:46:51 +00:00
|
|
|
siggen.def("setInterruptPeriod", &Siggen::setInterruptPeriod);
|
2022-10-12 19:32:24 +00:00
|
|
|
|
2022-10-05 19:51:47 +00:00
|
|
|
siggen.def("setFilter", &Siggen::setFilter);
|
2022-09-22 19:02:41 +00:00
|
|
|
|
2022-10-21 21:12:47 +00:00
|
|
|
py::class_<Noise, std::shared_ptr<Noise>> noise(m, "Noise", siggen);
|
2022-09-22 19:02:41 +00:00
|
|
|
noise.def(py::init<>());
|
|
|
|
|
|
|
|
py::class_<Sine, std::shared_ptr<Sine>> sine(m, "Sine", siggen);
|
|
|
|
sine.def(py::init<const d>());
|
|
|
|
sine.def("setFreq", &Sine::setFreq);
|
|
|
|
|
2022-10-21 21:12:47 +00:00
|
|
|
py::class_<Periodic, std::shared_ptr<Periodic>> periodic(m, "Periodic",
|
|
|
|
siggen);
|
|
|
|
periodic.def("getSequence",
|
|
|
|
[](const Sweep &s) { return ColToNpy<d>(s.getSequence()); });
|
2022-09-22 19:02:41 +00:00
|
|
|
|
|
|
|
py::class_<Sweep, std::shared_ptr<Sweep>> sweep(m, "Sweep", periodic);
|
|
|
|
sweep.def(py::init<const d, const d, const d, const d, const us>());
|
|
|
|
sweep.def_readonly_static("ForwardSweep", &Sweep::ForwardSweep);
|
|
|
|
sweep.def_readonly_static("BackwardSweep", &Sweep::BackwardSweep);
|
|
|
|
sweep.def_readonly_static("LinearSweep", &Sweep::LinearSweep);
|
|
|
|
sweep.def_readonly_static("LogSweep", &Sweep::LogSweep);
|
|
|
|
}
|
|
|
|
/** @} */
|