Skip to content

per cube histogram gets calculated when switching to a new Stokes value #1013

@kswang1029

Description

@kswang1029

Describe the bug
The render configuration widget and the contour rendering dialog have a histogram plot showing the per-channel histogram by default. Optionally users may switch to per-cube mode to see a histogram derived using the entire cube.

When a 4D cube with multiple Stokes (eg Stokes IQUV) is loaded in CARTA and we request to see the per-cube histogram of Stokes I, we will see the backend starts to deliver partial per-cube histogram to the frontend. Once it is done, if we use the animator to switch to Stokes Q, for example, we will see the "Histogram" dropdown switches to per-channel (as expected) but the backend starts to calculate the per-cube histogram of Stokes Q and once it is finished, the backend then calculates the per-channel histogram of the Stokes Q in the image viewer.

To Reproduce
Steps to reproduce the behavior:

  1. load a 4D cube with multiple Stokes and enable the JS console
  2. request per-cube histogram
  3. use the animator to switch to Stokes Q and monitor the JS console
  4. we should see per-cube histogram being calculated first, then the per-channel histogram is calculated.

When the per-cube histogram is calculated we will see nothing happens from the GUI. But if we request a per-cube histogram when the backend is busy on calculating the unexpected per-cube histogram, we will see the progress bar shows up repeatedly. Sometimes this results in incorrect clip bounds (I saw 0,1).

Expected behavior
The expected behavior in step 4 should be that only the per-channel histogram is calculated. I guess the root cause is the logic behind SET_IMAGE_CHANNELS (where we can set a Stokes value via stokes parameter) and SET_HISTOGRAM_REQUIREMENTS (where we can request a per-channel or a per-cube histogram via region_id parameter)

Screenshots or videos
This is a screenshot of the JS console. The last REGION_HISTOGRAM_DATA carries the per-channel histogram. All the other REGION_HISTOGRAM_DATA before carry the unnecessary per-cube histogram data.

Screen Shot 2022-01-27 at 12 53 08

Platform info (please complete the following information):

  • OS: only tested with macOS Monterey
  • Browser: chrome
  • Version 97.0.4692.71

Additional context
N/A

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions