LCOV - code coverage report
Current view: top level - dataset - mean.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 8 8 100.0 %
Date: 2024-11-24 01:48:31 Functions: 7 7 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             : #include "scipp/dataset/mean.h"
       6             : #include "scipp/dataset/astype.h"
       7             : #include "scipp/dataset/math.h" // needed by operations_common.h
       8             : #include "scipp/dataset/special_values.h"
       9             : #include "scipp/dataset/sum.h"
      10             : 
      11             : #include "../variable/operations_common.h"
      12             : #include "dataset_operations_common.h"
      13             : 
      14             : namespace scipp::dataset {
      15             : 
      16          49 : DataArray mean(const DataArray &a, const Dim dim) {
      17             :   return apply_to_data_and_drop_dim(
      18          98 :       a, [](auto &&..._) { return mean(_...); }, dim, a.masks());
      19             : }
      20             : 
      21          26 : DataArray mean(const DataArray &a) {
      22          52 :   return variable::normalize_impl(sum(a), sum(isfinite(a)));
      23             : }
      24             : 
      25          31 : Dataset mean(const Dataset &d, const Dim dim) {
      26          62 :   return apply_to_items(d, [](auto &&..._) { return mean(_...); }, dim);
      27             : }
      28             : 
      29           6 : Dataset mean(const Dataset &d) {
      30          12 :   return apply_to_items(d, [](auto &&..._) { return mean(_...); });
      31             : }
      32             : 
      33             : } // namespace scipp::dataset

Generated by: LCOV version 1.14