LCOV - code coverage report
Current view: top level - python - counts.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 14 18 77.8 %
Date: 2024-11-24 01:48:31 Functions: 5 5 100.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: BSD-3-Clause
       2             : // Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
       3             : /// @file
       4             : #include "scipp/dataset/counts.h"
       5             : #include "scipp/dataset/dataset.h"
       6             : 
       7             : #include "pybind11.h"
       8             : 
       9             : using namespace scipp;
      10             : using namespace scipp::dataset;
      11             : 
      12             : namespace py = pybind11;
      13             : 
      14           3 : void init_counts(py::module &m) {
      15           3 :   m.def(
      16             :       "counts_to_density",
      17           1 :       [](const Dataset &d, const std::string &dim) {
      18           1 :         return counts::toDensity(d, Dim{dim});
      19             :       },
      20           0 :       py::arg("x"), py::arg("dim"));
      21             : 
      22           3 :   m.def(
      23             :       "counts_to_density",
      24           1 :       [](const DataArray &d, const std::string &dim) {
      25           1 :         return counts::toDensity(d, Dim{dim});
      26             :       },
      27           0 :       py::arg("x"), py::arg("dim"));
      28             : 
      29           3 :   m.def(
      30             :       "density_to_counts",
      31           1 :       [](const Dataset &d, const std::string &dim) {
      32           1 :         return counts::fromDensity(d, Dim{dim});
      33             :       },
      34           0 :       py::arg("x"), py::arg("dim"));
      35             : 
      36           3 :   m.def(
      37             :       "density_to_counts",
      38           1 :       [](const DataArray &d, const std::string &dim) {
      39           1 :         return counts::fromDensity(d, Dim{dim});
      40             :       },
      41           0 :       py::arg("x"), py::arg("dim"));
      42           3 : }

Generated by: LCOV version 1.14