Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doctest_clustering_prototype does not respect point cloud array type. #313

Open
brettviren opened this issue Jun 21, 2024 · 2 comments
Open
Assignees

Comments

@brettviren
Copy link
Member

Running

$ ./build/img/wcdoctest-img -tc='clustering point tree'

[doctest] doctest version is "2.4.11"
[doctest] run with "--help" for options
===============================================================================
../img/test/doctest_clustering_prototype.cxx:111:
TEST CASE:  clustering point tree

../img/test/doctest_clustering_prototype.cxx:111: ERROR: test case THREW exception: ../util/inc/WireCellUtil/Exceptions.h(58): Throw in function raise<WireCell::ValueError, long unsigned int, long unsigned int>
Dynamic exception type: boost::wrapexcept<WireCell::ValueError>
[tag_stacktrace*] =  0# void WireCell::raise<WireCell::ValueError, unsigned long, unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long) at ../util/inc/WireCellUtil/Exceptions.h:58
 1# void print_dds<std::vector<std::reference_wrapper<WireCell::PointCloud::Dataset>, std::allocator<std::reference_wrapper<WireCell::PointCloud::Dataset> > > >(std::vector<std::reference_wrapper<WireCell::PointCloud::Dataset>, std::allocator<std::reference_wrapper<WireCell::PointCloud::Dataset> > > const&) at ../img/test/doctest_clustering_prototype.cxx:30
 2# DOCTEST_ANON_FUNC_2() at ../img/test/doctest_clustering_prototype.cxx:150
 3# doctest::Context::run() at ../util/inc/WireCellUtil/doctest.h:7008
 4# main at img/wcdoctest-img.cxx:14
 5# __libc_start_call_main at ../sysdeps/nptl/libc_start_call_main.h:74
 6# __libc_start_main at ../csu/libc-start.c:347
 7# _start in ./build/img/wcdoctest-img

[WireCell::tag_errmsg*] = element size mismatch 8 != 4

$ gdb --args ./build/img/wcdoctest-img -tc=clustering point tree
(gdb) catch throw
(gdb) r
(gdb) c
(gdb) where
(gdb) up
(gdb) up
(gdb) up
(gdb) up
(gdb) up
#5  print_dds<std::vector<std::reference_wrapper<WireCell::PointCloud::Dataset>, std::allocator<std::reference_wrapper<WireCell::PointCloud::Dataset> > > > (dds=std::vector of length 2, capacity 2 = {...}) at ../img/test/doctest_clustering_prototype.cxx:31
31	           auto arr = ds.get(key)->elements<fa_float_t>();
(gdb) p key
$1 = "uwire_index"

At the top of doctest_clustering_prototype.cxx is:

void print_dds(const DisjointDataset& dds) {
    for (size_t idx=0; idx<dds.size(); ++idx) {
        const Dataset& ds = dds[idx];
        std::stringstream ss;
        ss << "ds: " << idx << std::endl;
        // const size_t len = ds.size_major();
        for (const auto& key : ds.keys()) {
            auto arr = ds.get(key)->elements<fa_float_t>();

So, the particular point cloud keys span values of at least types int and double. Calling elements<T> with the same type is bound to fail.

@brettviren
Copy link
Member Author

Note, this issue was made prior to me merging in your latest apply-pointcloud work. The problem still exists now that this test has moved to its new sub-package:

$ ./build/clus/wcdoctest-clus -tc='clustering point tree'

@HaiwangYu
Copy link
Member

Hi Brett, thanks for making the issue. I noticed the same thing last night. And temporarily disabled the print_dds in 86de40e. Will think about how to fix it. I think it is probably OK to remove that print_dds since no checks are based on it. The main reason for that was to help me understand the disjoint_rang/dataset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants