Skip to content

Firefly-1806: add MOC auto display mode#1817

Merged
robyww merged 1 commit intodevfrom
FIREFLY-1806-MOC-AUTO-MODE
Aug 1, 2025
Merged

Firefly-1806: add MOC auto display mode#1817
robyww merged 1 commit intodevfrom
FIREFLY-1806-MOC-AUTO-MODE

Conversation

@robyww
Copy link
Contributor

@robyww robyww commented Jul 31, 2025

Firefly-1806: add MOC auto display mode

  • Auto will show MOC filled with a transparency based on FOV
  • Auto will show MOC as outline when the user zooms in
  • PR also include some standard http status message updates.

Testing

@robyww robyww added this to the 2025.4 milestone Jul 31, 2025
@robyww robyww requested a review from lrebull July 31, 2025 16:53
@robyww robyww self-assigned this Jul 31, 2025
@robyww robyww requested a review from jaladh-singhal July 31, 2025 16:53
@lrebull
Copy link
Contributor

lrebull commented Jul 31, 2025

ooh! cool!
ok, my $0.02:

  • the first thing i tried was the 2MASS LGA because it's the first on the list, and the little footprints are so faint that i can't distinguish them from the generalized hips background (the background texture in the wise hips map is comparable to the color/size of some of the footprints; see screenshot for a different example). at least for this one, they need to start out a little bit more opaque, otherwise i can't even see that they are there at all. (i was waiting and waiting and waiting for the MOC to load, wondering why it was taking so darn long, when i finally realized that no, actually, it had loaded some unknown time ago.) attempting to generalize this, we could try to come up with some logic like 'if the footprints are smaller than xx square arcmin [or xx arcmin on a side?], make them opaque'..?
Screenshot 2025-07-31 at 10 00 51 AM

argh ok getting pulled off to TWO different other things. let me save this now and i'll come back to it as soon as i can.

@lrebull
Copy link
Contributor

lrebull commented Jul 31, 2025

  • i can't see them at all whatsoever on the BRAVA search page, or HerMES, or HOP. H-ATLAS, however, is perfect. HERITAGE and LocalGroup are pretty great too. MAGCLOUDSCPLUS is back to not being able to tell what is footprint and what is noise in the background image. I haven't systematically tested each and every data set, but I think you get the idea here...
  • SPHEREx works great!
  • Euclid does too!

Copy link
Member

@jaladh-singhal jaladh-singhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I agree with Luisa's comment about DCE stuff.

I noticed a bug: the fill color suddenly becomes opaque (instead of continuously becoming transparent) when you keep zooming in and are between 30 and 26 degrees FOV. I identified the reason for it in the logic (see my comment below).

if (!fov) return {style:Style.FILL, color:toRGBAString([r,g,b,1])};
if (fov<26) return {style:Style.DESTINATION_OUTLINE, color:toRGBAString([r,g,b,1])};

let alpha= .7;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if fov >= 26 and fov <=30, alpha becomes .7 which breaks the transparency increasing when zoomming in behavior. Perhaps this should be .18.

Or L461 can be if (fov<30) to prevent this 26-30 gap

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I will fix it.

Comment on lines +461 to +469
if (fov<26) return {style:Style.DESTINATION_OUTLINE, color:toRGBAString([r,g,b,1])};

let alpha= .7;
if (fov>170) alpha= .7;
else if (fov>150) alpha= .68;
else if (fov>130) alpha= .65;
else if (fov>110) alpha= .58;
else if (fov>90) alpha= .55;
else if (fov>70) alpha= .45;
else if (fov>50) alpha= .35;
else if (fov>40) alpha= .25;
else if (fov>30) alpha= .20;
return {style:Style.FILL, color: toRGBAString([r,g,b,alpha])};
}
Copy link
Member

@jaladh-singhal jaladh-singhal Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually...I was wondering if there's some formula to map fov to our alpha range (0.2-0.7) and asked ChatGPT:

  // Linearly interpolate alpha between these breakpoints:
  const MIN_FOV   = 26;
  const MAX_FOV   = 170;
  const MIN_ALPHA = 0.2;
  const MAX_ALPHA = 0.7;

  // Tiny FOV → outline
  if (fov < MIN_FOV) {
    return {
      style: Style.DESTINATION_OUTLINE,
      color: toRGBAString([...baseRGBA, 1])
    };
  }

  // Fill with interpolated alpha 
  const t = Math.min(Math.max((fov - MIN_FOV) / (MAX_FOV - MIN_FOV), 0), 1); // normalized fov in [0,1]
  const alpha = MIN_ALPHA + t * (MAX_ALPHA - MIN_ALPHA);

  return {
    style: Style.FILL,
    color: toRGBAString([...baseRGBA, alpha])
  };

And then it's easier to play with the alpha values. I think MIN_ALPHA = 0.1 will actually be better to show transparently filled to outline transition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered do something like this but it got forgotten after the proof-of-concept started working. I will try it.

Copy link
Member

@jaladh-singhal jaladh-singhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. looks good and the bug is gone.

const [r,g,b]= toRGBA(color);
const fov= getFoV(plot);
if (!fov) return {style:Style.FILL, color:toRGBAString([r,g,b,1])};
if (autoUsesOnlyOutline || fov<30) return {style:Style.DESTINATION_OUTLINE, color:toRGBAString([r,g,b,1])};
Copy link
Member

@jaladh-singhal jaladh-singhal Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This number should come from the constant so that it doesn't break if someone changes that in getAlpha (you probably need to move the constants out of the functions):

Suggested change
if (autoUsesOnlyOutline || fov<30) return {style:Style.DESTINATION_OUTLINE, color:toRGBAString([r,g,b,1])};
if (autoUsesOnlyOutline || fov<MIN_FOV) return {style:Style.DESTINATION_OUTLINE, color:toRGBAString([r,g,b,1])};

Copy link
Member

@jaladh-singhal jaladh-singhal Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robyww Before you merge: I noticed your last commit changed minFov in getAlpha to 25, but not in L466, they must be the same. That's why I suggested defining them as MIN_FOV constant and using it at these both places to prevent getting them out of sync.

    minFov = 25;
    if (autoUsesOnlyOutline || fov<minFov) return {style:Style.DESTINATION_OUTLINE, color:toRGBAString([r,g,b,1])};
    const alpha= getAlpha(fov, {minFov});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't have to be the same. if FOV < 30 then the getAlpha() never gets called. By making minFov less then 30 then it approaches the "fill disappear effect" that you suggested. However, it will never actually gets there, it switches over first. We don't want to get to the "fill disappear" because there will be a FOV that seems buggy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could accomplish a similar effect by making minFov 30 and minAlpha 5. I might plan with it more at another time.

Comment on lines +472 to +475
const MIN_FOV = 30;
const MAX_FOV = 170;
const MIN_ALPHA = 0.2;
const MAX_ALPHA = 0.7;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something worth trying, I have a hunch this will give the cleanest transition from transparently filled to only outlined:

Suggested change
const MIN_FOV = 30;
const MAX_FOV = 170;
const MIN_ALPHA = 0.2;
const MAX_ALPHA = 0.7;
const MIN_FOV = 25;
const MAX_FOV = 170;
const MIN_ALPHA = 0.01;
const MAX_ALPHA = 0.7;

@lrebull
Copy link
Contributor

lrebull commented Jul 31, 2025

wow, this is SUPER COOL. works GREAT! tried all three and it is nice!!

@robyww robyww force-pushed the FIREFLY-1806-MOC-AUTO-MODE branch from 37bf4f1 to 9a4d0a1 Compare August 1, 2025 18:00
  - Auto will show MOC filled with a transparency based on FOV
  - Auto will show MOC as outline when the user zooms in
  - includes response to feedback
  - includes some peliminary DCE updates

clean up and bug fixing
@robyww robyww force-pushed the FIREFLY-1806-MOC-AUTO-MODE branch from 9a4d0a1 to 65f1d49 Compare August 1, 2025 18:00
@robyww robyww merged commit 4285e09 into dev Aug 1, 2025
@robyww robyww deleted the FIREFLY-1806-MOC-AUTO-MODE branch August 1, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants