LCOV - code coverage report
Current view: top level - dataset - bins_util.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 12 12 100.0 %
Date: 2024-11-24 01:48:31 Functions: 1 1 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             : /// @author Simon Heybrock
       5             : #pragma once
       6             : 
       7             : #include "scipp/dataset/bins.h"
       8             : #include "scipp/variable/shape.h"
       9             : #include "scipp/variable/util.h"
      10             : 
      11             : namespace scipp::dataset {
      12             : 
      13             : template <class Masks>
      14        2438 : Variable hide_masked(const Variable &data, const Masks &masks,
      15             :                      const scipp::span<const Dim> dims) {
      16        2438 :   const auto empty_range = makeVariable<scipp::index_pair>(
      17        2438 :       Values{std::pair<scipp::index, scipp::index>(0, 0)});
      18        2438 :   const auto &[begin_end, buffer_dim, buffer] = data.constituents<DataArray>();
      19        2438 :   auto indices = begin_end;
      20        8498 :   for (const auto dim : dims) {
      21        6060 :     auto mask = irreducible_mask(masks, dim);
      22        6060 :     if (mask.is_valid()) {
      23          26 :       mask = transpose(mask, intersection(data.dims(), mask.dims()).labels());
      24          26 :       indices = where(mask, empty_range, indices);
      25             :     }
      26             :   }
      27        4876 :   return make_bins_no_validate(indices, buffer_dim, buffer);
      28        2438 : }
      29             : 
      30             : } // namespace scipp::dataset

Generated by: LCOV version 1.14