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

paulmthompson / WhiskerToolbox / 16121066516

07 Jul 2025 03:19PM UTC coverage: 74.129% (-0.07%) from 74.196%
16121066516

push

github

paulmthompson
delete intervals in datamanager widget

0 of 20 new or added lines in 2 files covered. (0.0%)

139 existing lines in 5 files now uncovered.

13106 of 17680 relevant lines covered (74.13%)

1064.63 hits per line

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

0.0
/src/WhiskerToolbox/DataManager/Tensors/Tensor_Data.cpp
1
#include "Tensor_Data.hpp"
2

3
#include <filesystem>
4

5
// ========== Setters ==========
6

UNCOV
7
void TensorData::addTensorAtTime(TimeFrameIndex time, torch::Tensor const & tensor) {
×
8
    _data[time] = tensor;
×
9
    notifyObservers();
×
10
}
×
11

UNCOV
12
void TensorData::overwriteTensorAtTime(TimeFrameIndex time, torch::Tensor const & tensor) {
×
13
    _data[time] = tensor;
×
14
    notifyObservers();
×
15
}
×
16

17
// ========== Getters ==========
18

19
torch::Tensor TensorData::getTensorAtTime(TimeFrameIndex time) const {
×
20
    if (_data.find(time) != _data.end()) {
×
UNCOV
21
        return _data.at(time);
×
22
    }
UNCOV
23
    return torch::Tensor{};
×
24
}
25

26
std::vector<TimeFrameIndex> TensorData::getTimesWithTensors() const {
×
27
    std::vector<TimeFrameIndex> times;
×
28
    times.reserve(_data.size());
×
29
    for (const auto& [time, tensor] : _data) {
×
UNCOV
30
        times.push_back(time);
×
31
    }
32
    return times;
×
UNCOV
33
}
×
34

UNCOV
35
std::vector<float> TensorData::getChannelSlice(TimeFrameIndex time, int channel) const
×
36
{
37

UNCOV
38
    torch::Tensor const tensor = getTensorAtTime(time);
×
39

40
    //std::cout << "Tensor at time " << time << " with " << tensor.numel() << " elements" << std::endl;
41

42
    auto sub_tensor = tensor.index({
×
43
                                    torch::indexing::Slice(),
×
44
                                    torch::indexing::Slice(),
×
UNCOV
45
                                    channel});
×
46

47
    // Apply sigmoid
UNCOV
48
    sub_tensor = torch::sigmoid(sub_tensor);
×
49

50
    //std::cout << "Sub tensor with" << sub_tensor.numel() << " elements " << std::endl;
51

UNCOV
52
    std::vector<float> vec(sub_tensor.data_ptr<float>(), sub_tensor.data_ptr<float>() + sub_tensor.numel());
×
53

54
    //std::cout << "Tensor data has " << vec.size() << " elements" << std::endl;
55

56
    return vec;
×
UNCOV
57
}
×
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