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

pggray() issue #7

Open
karlglazebrook opened this issue Oct 21, 2018 · 3 comments
Open

pggray() issue #7

karlglazebrook opened this issue Oct 21, 2018 · 3 comments

Comments

@karlglazebrook
Copy link

Note the implementation of pggray() has the black and white reversed, and produces incorrect results if they are in the correct order.

Note the definition:

 SUBROUTINE PGGRAY (A, IDIM, JDIM, I1, I2, J1, J2,FG, BG, TR)

" The shade is a number in the
range 0 to 1 obtained by linear interpolation between the background
level (BG) and the foreground level (FG)"

This means that FG is the white colour, and BG the black. If I load in a FITS image and want stars to be white on /xwin (with real pgplot) - i.e. a 'positive' image, then I have FG > BG. And similarly the same ordering gives a negative image on a /PS output. These are both flipped if FG<BG.

giza has the ordering backward and only produces a postive image. Obviously this is somewhat of a matter of convention, but it would be best if the default convention was the same as pgplot.

More seriously, if FG<BG then you do not get an inverted image, you just get a black frame. This is why test4.p in perl-pgplot does not work (it should show the galaxy M51) and you can not produce a negative image by swapping FG and BG which is undesirable behaviour.

@haavee
Copy link
Contributor

haavee commented Nov 9, 2018

Hi Karl,

giza has the ordering backward and only produces a postive image. Obviously this is somewhat of a matter of convention, but it would be best if the default convention was the same as pgplot.

This is readily fixed because there seems to be a difference of opinion between the order of values passed to cpggray() and its implementation forwarding those to the actual rendering function.

As far as I can tell the case FG < BG is not handled by the code so that would require a bit more thought and I'm not yet up to speed with colouring/rendering of the pixels

@karlglazebrook
Copy link
Author

karlglazebrook commented Nov 15, 2018 via email

@karlglazebrook
Copy link
Author

One could fix this by reversing FG/BG in the code after the call. Then my test would produce the same result.

It might be more work to reproduce the other PGPLOT behaviour where if FG<BG the image is inverted.

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