CARTAvis / carta-backend

Source code repository for the backend component of CARTA, a new visualization tool designed for the ALMA, the VLA and the SKA pathfinders.
https://cartavis.github.io/
GNU General Public License v3.0
22 stars 11 forks source link

[Regression] Region total NumPixels is not consistent in the Ubuntu for the wide field matched images #1380

Open acdo2002 opened 4 months ago

acdo2002 commented 4 months ago

Describe the bug This is the regression bug (only happened started from the commit de4da528). In the Ubuntu 22.04 system (not happened in the MacOS 11 and MacOS 13), if you open the two matched images, and set the region close to the edge, the total NumPixels are different. If the region is slight offset from the edge, the difference disappears, only happened in the region close to the edge.

To Reproduce Steps to reproduce the behavior:

  1. Open two same images: casa_wideField.fits and casa_wideField.image (download link)
  2. Spatially matched two images
  3. Set a rectangle region (region # 1): Image coordinate, x centre is 300 px; y centre is 200 px; x size is 400 px; y size is 400 px
  4. Click the "Statistics Widget" on the top and select Region # 1, and click the Image (switch casa_wideField.fits and casa_wideField.image ) and check the NumPixels

Expected behavior NumPixels should be the same between two matched (the same, only format is different) images The related ICD-RxJS is in the branch mylin/#Add-part2 (not merged yet), src/test/MATCH_STATS_WIDE_BORDERLINE.test.ts (link)

Platform info (please complete the following information):

Additional context Add any other context about the problem here.

acdo2002 commented 4 months ago

Additional context Here is the screenshot to show how to reproduce this behavior. Screenshot from 2024-05-30 13-33-38 You can see if open the same image and spatially matched, set a specific region x centre in 300px; y centre in 200px; x size is 400px; y size is 400px The total NumPixels is different, one is 160801 another is 160401. abs(160801 - 160401)/160801(macOS provide this value)*100 = 0.25% uncertainty However is you shift 1px in y centre like to following screenshot Screenshot from 2024-05-30 13-42-12 Then the total NumPixels becomes the same.

Updated:

  1. The total NumPixels inconsistent only happened in the rectangle region. Other RegionTypes (ellipse and polygon) does not have this problem.
  2. This behavior is also happened for the small region, e.g. Image coordinate, x centre is 3 px; y centre is 1 px; x size is 4 px; y size is 2 px The total NumPixels inconsistent is still there, one is 15px another is 11px (macOS are always show 15px) abs(15-11)/15*100 = 26% uncertainty Screenshot from 2024-05-30 13-59-51

Kuo-Song mentions it is the expected sampling problem for the wide field images. I leave the behavior I found here.