• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

paulmthompson / WhiskerToolbox / 16036090729

02 Jul 2025 09:22PM UTC coverage: 72.408% (-0.06%) from 72.467%
16036090729

push

github

paulmthompson
remove obselete digitalintervalseries functions

7 of 15 new or added lines in 5 files covered. (46.67%)

74 existing lines in 8 files now uncovered.

11788 of 16280 relevant lines covered (72.41%)

1100.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/WhiskerToolbox/DataManager/DigitalTimeSeries/IO/JSON/Digital_Interval_Series_JSON.cpp
1

2
#include "Digital_Interval_Series_JSON.hpp"
3

4
#include "loaders/CSV_Loaders.hpp"
5
#include "loaders/binary_loaders.hpp"
6
#include "utils/json_helpers.hpp"
7
#include "DigitalTimeSeries/Digital_Interval_Series.hpp"
8

9

10

11
IntervalDataType stringToIntervalDataType(std::string const & data_type_str) {
×
12
    if (data_type_str == "uint16") return IntervalDataType::uint16;
×
13
    if (data_type_str == "csv") return IntervalDataType::csv;
×
14
    return IntervalDataType::Unknown;
×
15
}
16

17

18
std::shared_ptr<DigitalIntervalSeries> load_into_DigitalIntervalSeries(std::string const & file_path,
×
19
                                                                       nlohmann::basic_json<> const & item) {
20
    auto digital_interval_series = std::make_shared<DigitalIntervalSeries>();
×
21

22
    if (!requiredFieldsExist(
×
23
                item,
24
                {"format"},
25
                "Error: Missing required fields in DigitalIntervalSeries")) {
26
        return digital_interval_series;
×
27
    }
28
    std::string const data_type_str = item["format"];
×
29
    IntervalDataType const data_type = stringToIntervalDataType(data_type_str);
×
30

31
    switch (data_type) {
×
32
        case IntervalDataType::uint16: {
×
33

34
            if (!requiredFieldsExist(
×
35
                        item,
36
                        {"channel", "transition"},
37
                        "Error: Missing required fields in uint16 DigitalIntervalSeries")) {
38
                return digital_interval_series;
×
39
            }
40

41
            int const channel = item["channel"];
×
42
            std::string const transition = item["transition"];
×
43

44
            int const header_size = item.value("header_size", 0);
×
45
            int const num_channels = item.value("channel_count", 1);
×
46

47
            auto opts = Loader::BinaryAnalogOptions{
×
48
                                                    .file_path = file_path,
49
                                                    .header_size_bytes = static_cast<size_t>(header_size),
×
50
                                                    .num_channels = static_cast<size_t>(num_channels)};
×
51
            auto data = readBinaryFile<uint16_t>(opts);
×
52

53
            auto digital_data = Loader::extractDigitalData(data, channel);
×
54

55
            auto intervals = Loader::extractIntervals(digital_data, transition);
×
56
            std::cout << "Loaded " << intervals.size() << " intervals " << std::endl;
×
57

NEW
58
            return std::make_shared<DigitalIntervalSeries>(intervals);
×
59
        }
×
60
        case IntervalDataType::csv: {
×
61

62
            auto opts = Loader::CSVPairColumnOptions{.filename = file_path};
×
63

64
            auto intervals = Loader::loadPairColumnCSV(opts);
×
65
            std::cout << "Loaded " << intervals.size() << " intervals " << std::endl;
×
NEW
66
            return std::make_shared<DigitalIntervalSeries>(intervals);
×
67
        }
×
68
        default: {
×
69
            std::cout << "Format " << data_type_str << " not found " << std::endl;
×
70
        }
71
    }
72

NEW
73
    return std::make_shared<DigitalIntervalSeries>();
×
74
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc