[PIPE2D-787] Invalid points can crash the DetectorMap code Created: 18/Mar/21  Updated: 18/Mar/21  Resolved: 18/Mar/21

Status: Done
Project: DRP 2-D Pipeline
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Story Priority: Normal
Reporter: rhl Assignee: price
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Sprint: 2DDRP-2021 A3
Reviewers: hassan

 Description   

With

/projects/HSC/PFS/Subaru/CALIB-SuNSS/DETECTORMAP/pfsDetectorMap-046270-b1.fits
detMap.findFiberId(geom.PointD(6000, -20000)) 

crashes python in our C++:

python3.7: src/ModelBasedDetectorMap.cc:177: virtual int pfs::drp::stella::ModelBasedDetectorMap::findFiberId(const PointD&) const: Assertion `xNew > xLow && xNew < xHigh' failed.
Caught signal 6, backtrace follows:
/tigress/HSC/PFS/stack/current/stack/current/Linux64/utils/18.1.0/lib/libutils.so(+0x14a74) [0x2ba2eee49a74]
/lib64/libc.so.6(+0x36450) [0x2ba2dcf53450]
/lib64/libc.so.6(gsignal+0x37) [0x2ba2dcf533d7]
/lib64/libc.so.6(abort+0x148) [0x2ba2dcf54ac8]
/lib64/libc.so.6(+0x2f1a6) [0x2ba2dcf4c1a6]
/lib64/libc.so.6(+0x2f252) [0x2ba2dcf4c252]
/home/rhl/PFS/drp/stella/lib/libdrp_stella.so(pfs::drp::stella::ModelBasedDetectorMap::findFiberId(lsst::geom::Point<double, 2> const&) const+0x25f) [0x2ba33ba7bb0f]


 Comments   
Comment by price [ 18/Mar/21 ]
#0  0x00002aaaaaf213d7 in raise () from /lib64/libc.so.6
#1  0x00002aaaaaf22ac8 in abort () from /lib64/libc.so.6
#2  0x00002aaaaaf1a1a6 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00002aaaaaf1a252 in __assert_fail () from /lib64/libc.so.6
#4  0x00002aaafbe58807 in pfs::drp::stella::ModelBasedDetectorMap::findFiberId
    (point=..., this=0x555557c78a30) at include/pfs/drp/stella/DetectorMap.h:33
#5  pfs::drp::stella::ModelBasedDetectorMap::findFiberId (this=0x555557c78a30, 
    point=...) at src/ModelBasedDetectorMap.cc:156
#6  0x00002aab0d559be3 in pybind11::cpp_function::cpp_function<int, pfs::drp::stella::DifferentialDetectorMap, lsst::geom::Point<double, 2> const&, pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::arg>(int (pfs::drp::stella::DifferentialDetectorMap::*)(lsst::geom::Point<double, 2> const&) const, pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&, pybind11::arg const&)::{lambda(pfs::drp::stella::DifferentialDetectorMap const*, lsst::geom::Point<double, 2> const&)#1}::operator()(pfs::drp::stella::DifferentialDetectorMap const*, lsst::geom::Point<double, 2> const&) const (
    this=<optimized out>, this=<optimized out>, args#0=..., c=<optimized out>)
    at /projects/HSC/PFS/stack/20190925/stack/miniconda3-4.5.12-1172c30/Linux64/pybind11/2.2.4.lsst1+2/include/pybind11/cast.h:491
Comment by price [ 18/Mar/21 ]

Fixed:

(lsst-scipipe) pprice@tiger2-sumire:~ $ python -c 'from pfs.drp.stella import DetectorMap; from lsst.geom import Point2D; detMap = DetectorMap.readFits("/projects/HSC/PFS/Subaru/CALIB-SuNSS/DETECTORMAP/pfsDetectorMap-046270-b1.fits"); detMap.findFiberId(Point2D(6000, -20000))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
lsst.pex.exceptions.wrappers.OutOfRangeError: 
  File "src/ModelBasedDetectorMap.cc", line 159, in virtual int pfs::drp::stella::ModelBasedDetectorMap::findFiberId(const PointD&) const
    Point is not on the image {0}
lsst::pex::exceptions::OutOfRangeError: 'Point is not on the image'
Comment by hassan [ 18/Mar/21 ]

Review approved. Changes look fine.

Comment by price [ 18/Mar/21 ]

Merged.

Generated at Sat Feb 10 15:58:04 JST 2024 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.