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

Feature request: add a North/East arrow to annotated images #151

Open
han-k59 opened this issue Jan 19, 2019 · 27 comments
Open

Feature request: add a North/East arrow to annotated images #151

han-k59 opened this issue Jan 19, 2019 · 27 comments

Comments

@han-k59
Copy link

han-k59 commented Jan 19, 2019

Maybe not the correct place for nova.astrometry.net. If not please delete this issue:

Following a long discussion at the Cloudynights forum, I have to report that there is a vertical swap in the astrometry.net JPG, PNG TIF input.routine. This is not a solver problem but a conversion problem which finally results in wrong reported PA angles for the solved JPG, PNG, TIF images. The produced .NEW file is solved correctly but is upside down compared with the JPG, PNG, TIF input file. Note that for FITS files the convention is that pixel position [1,1] is left bottom. The problem doesn't occur for FITS files as input.

A second vertical swap at the display routine of nova.astrometry.net is hiding the problem for JPG, TIF, PNG input files. This problem occurs in version 0.38 and also the latest version. Using FITS file as input avoids the problem. A sketch for clarification is available at:

https://www.cloudynights.com/topic/638573-astrometrynet-orientation-180-degrees-off/page-2#entry9051312

Here two examples on an image -9.4 degrees rotated E of N uploaded as PNG and FITS file:

PNG image upload:

http://nova.astrometry.net/user_images/2586917#annotated

Image is show with the correct orientation as original. Angle is reported as 351 which is correct. The new-image.fits output is flipped and has orientation -170.6 degrees

FITS image upload:

http://nova.astrometry.net/user_images/2586918#annotated

Image is shown flipped vertical. Angle is reported as +9.4 which is wrong. The new-image.fits output is equivalent as original with orientation -9.4 degrees

Above is strongly related to the convention that for FITS files, the pixel position [1,1] is left bottom. This is the case in programs as DS9 and AstroimageJ.

@han-k59
Copy link
Author

han-k59 commented Jan 19, 2019

@han-k59
Copy link
Author

han-k59 commented Oct 28, 2019

The AVM standard 1.2 rc1 at https://www.virtualastronomy.org/avm_metadata.php has documented the orientation convention. See attached screenshot

AVM WCS convention

@dstndstn
Copy link
Owner

If I recall correctly, FITS says nothing about how images are displayed. (1,1) is the first pixel in the file, but the standard says nothing about how images should be shown to the user. We do the simplest conversion of other image formats to FITS, ie, no flip. It is quite possible that the reported orientation is backwards in some cases; it's not totally trivial to compute.

@dstndstn
Copy link
Owner

PS, near as I can tell, AVM is a dead project.

@davidwhogg
Copy link
Collaborator

AVM was never agreed to by the community. And indeed the FITS standard has no display advice. So let's change the title of this issue.

@han-k59
Copy link
Author

han-k59 commented Oct 29, 2019

No problem, I will try to close the issue.

@han-k59 han-k59 closed this as completed Oct 29, 2019
@han-k59
Copy link
Author

han-k59 commented Nov 1, 2019

I'm sorry but I have to reopen this. The same file uploaded to nova.astrometry.net as PNG or FITS (with 1,1 origin left top) gives same annotated result but with a totally different angle reported! This clearly indicates the original problem. Please have a look to the two screenshots:
png input
fits input

@han-k59 han-k59 reopened this Nov 1, 2019
@dstndstn
Copy link
Owner

dstndstn commented Nov 1, 2019

yeah, like I said, it's just an error in the reporting.

It comes from here
https://github.com/dstndstn/astrometry.net/blob/master/net/templates/user_image/view.html#L182

which calls
https://github.com/dstndstn/astrometry.net/blob/master/net/models.py#L685

which calls
https://github.com/dstndstn/astrometry.net/blob/master/net/models.py#L647

Where, I suppose, we are assuming some display convention for FITS images when we say "up".

Your claim is that we should remove the different handling of PNG vs FITS?

@han-k59
Copy link
Author

han-k59 commented Nov 1, 2019

I think an numerical angle indication will always lead to confusion since as you said ,,displaying is a convention and not a standard". For me the best approach would be to show the orientation with a North-East arrow pointer. East will indicate flipped. Like the small red north-east arrow in this screenshot:
north east arrow

@han-k59
Copy link
Author

han-k59 commented Nov 1, 2019

If you would add a north-east pointer to the annotation routine it would be beneficial for both nova.astrometry.net and the program itself. Something like this:
png input with NE pointer

@davidwhogg
Copy link
Collaborator

I think this should close and re-open as a feature request for a N-E arrow.

@dstndstn dstndstn changed the title Nova.astrometry.net doesn't follow FITS convention, left bottom is pixel [1,1] Feature request: add a North/East arrow to annotated images Nov 2, 2019
@han-k59
Copy link
Author

han-k59 commented Nov 2, 2019

David, it's a BUG issue, not a feature request!

Note that yesterday by the two screen shots it was proven that there is a bug in the orientation reporting of nova.astrometry.net. It reports for the same image with identical annotations different numerical orientations for FITS and PNG/TIFF/JPEG.

A quick fix would be to change the code as Dustin indicated yesterday.

In my humble opinion, after the fix the orientation reporting will still be unclear and undefined. The proposed North/East arrow is just one way to fix both the bug and improve reporting.

p.s. the cause of the bug was indicated by the previous title. There is an inconsistency in handling vertical orientation for two different images types :)

Han

@dstndstn
Copy link
Owner

dstndstn commented Nov 3, 2019

It's a bug report (orientation is ill-defined), with a proposed fix of removing the orientation report --- which people will complain about --- and replacing it with a N/E arrow.

If you want to do something useful you can look at implementing this -- it would get added to the blind/plotannotations.c file, similar to plot_targets. I'm not saying it will be easy.

@han-k59
Copy link
Author

han-k59 commented Nov 3, 2019

I would have no problem to add something, but unfortunately I'm not familiar with C. But attached my code in Object Pascal for a N/E pointer which could give some ideas and shows the math:

N_E pointer.zip

Showing this:
arrow

Han

@davidwhogg
Copy link
Collaborator

Yes I agree it is a bug if we refer to "up" or "left" in our reporting, since there is no "up" in a FITS image.

@mgreter
Copy link

mgreter commented Dec 8, 2019

I'm currently facing this issue (I think) as I'm trying to integrate some pictures of messier objects into a stellarium like web-application. So in order to do this more efficiently I'm using astrometry to create the data to position these correctly. During my tests I found out that I only need to flip the y axis of the texture to get correct results for flipped images (the stars match up very nicely).

I didn't really fully grasp the previous discussions. It looks to me that astrometry can match flipped and non-flipped images (I suspect it tries both renditions?). So for me it would be ideal if astrometry would tell me which one actually matched. For the time being I have to visually check each one to see if I need to apply the y-axis inversion (I will probably end up to just flip the actual images as needed).

I've used M17 and M18 to verify this. AFAICS rotation is not enough to get these two aligned and one actually has to do the flip to match up these two images with background stars.

@han-k59
Copy link
Author

han-k59 commented Dec 8, 2019

mgreter,

There is absolutely no problem with the astrometry.net solution in the FITS file. So the FITS header values cd1_1, cd1_2, cd2_1, cd2_2 values are always correct. There is only an undefined up or down related to the angle reporting in the web interface at nova.astrometry.net. It depends if you upload FITS or PNG, TIFF,JPEG. The behavior is consistent so once you now how to flip your fine.

If the images have a rotation angle other then 0 or 180 degrees, you have to use the cd1_1, cd1_2, cd2_1, cd2_2 values.

Han

@dstndstn
Copy link
Owner

dstndstn commented Dec 8, 2019 via email

@sebagr
Copy link

sebagr commented Sep 14, 2020

I'm joining this thread from https://groups.google.com/g/astrometry/c/glVFictwNV4/m/2qAIP4frAgAJ - thanks Dustin for pointing me in the right direction!

Since the Position Angle is useless without knowing the image parity, I think instead of removing the reported PA (which I agree would cause complaints) a better idea would be to also display the parity on the website.

Of course this doesn't fix the bug that JPG-ish images have a different PA than FITs as shown in han-k59's comment. Just for future reference, I uploaded this annotated image then flipped it vertically and horizontally to see the results, and in all of them the PA seems to be West of North.

http://nova.astrometry.net/user_images/3946751#original
http://nova.astrometry.net/user_images/3946752#original
http://nova.astrometry.net/user_images/3946753#original

@han-k59
Copy link
Author

han-k59 commented Sep 14, 2020

A north east pointer placed as an annotation is in my opinion the best and clearest solution. I already provided an example code in Pascal showing the math. Attached two more screenshots showing the implementation in Aladin and PlateSolve2

aladin
ps2 crop

@sebagr
Copy link

sebagr commented Sep 14, 2020

I agree, adding a North-East annotation would be definitely clearer than the PA + parity alone. Then again, I don't see any value in hiding those numeric values if they are available.

@alexw-im
Copy link

alexw-im commented Jul 28, 2023

I'm struggling right now to figure out how my issue relates to this one, since they certainly seem the same but there are lots of mentions of FITS files which fundamentally I haven't been using.

Take this sample image. It's an export of a star map from Cartes du Ceil with Beta Persei dead center, in equatorial mode so north is perfectly up. For the sake of disambiguation, I've rotated it 14.59* CW, i.e. image-up is 14.59* WEST of north, or 345.41* E of N.

Solved with nova.astrometry.net, these aspects are all reported spot-on. Interestingly, if I download new-image.fits, it's 1) flipped 2) blank 3) indicated north is ~180deg off.

HOWEVER: When solved offline, with astrometry running locally on my machine, I get the following stdout:

Field 1 solved: writing to file ./beta perseus +14.59.solved to indicate this.
Field: beta perseus +14.59.png
Field center: (RA,Dec) = (47.045647, 40.958294) deg.
Field center: (RA H:M:S, Dec D:M:S) = (03:08:10.955, +40:57:29.857).
Field size: 9.15707 x 7.13041 degrees
Field rotation angle: up is -167.126 degrees E of N
Field parity: neg

That is, the true rotation is (180-reported).

If I flip my input image about X or Y before processing, I get the approximately-correct angle, but negated. So it seems not quite as straightforward as "it gets flipped somewhere in the pipeline."

Did something change since 2020, like the nova.astrometry.net presentation code was just changed to say "up is 180-calculated" as I've done?

Edit:
I also should have remembered to upload the actual sample!
beta perseus +14 59

@dstndstn
Copy link
Owner

About the new-image.fits file -- when converting JPEG or PNG to FITS, there is a choice of whether to flip it vertically or not -- because JPEG defines the first pixel to be the top-left pixel, while FITS does not specify a display order, but DS9 and other programs often show the first pixel in the bottom-left. The Astrometry.net code does not do that flip -- first pixel stars first pixel -- so that can introduce a flip in the orientation.

As for it being blank ... what program are you using to display it? It might be scaling the image in a funny way.

And yeah, I think the web version has some special handling to report things correctly for JPEG images vs FITS.

The reason this feature request is to add a North/East arrow to the image is because all this "degrees east of north" business is so fraught.

@alexw-im
Copy link

Ahh yes apologies, I should have specified that - ASTAP to view the FITS file. And in fact you're right, it was just a display issue - Astrometry's output seems to threshold/bin the color outputs into very sharp spikes in the histogram, and ASTAP's min/max weren't inclusive of them before some sliding.

Anyway what's REALLY curious now that I see the image is that:

  • ASTAP's view isn't mirrored or flipped or rotated compared to the input .png and Nova's rendering
  • ASTAP's 'north' arrow is pointed quite correctly
  • ASTAP claims the image is flipped (it certainly doesn't seem to be!)
  • ASTAP's degrees of rotation is off by a negation AND 180deg. Specifically it indicates 167.15 deg E of N. Maybe because it thinks the image is flipped when it's not?

image

Thank you for helping me wrap my head around what's going on! I certainly agree that there's lots of logical room for error with the "degrees east of north" thing but it still feels like the most intuitive way to present that information to a user trying to orient themselves in the celestial sphere. An overlay compass would certainly be a good cross-reference for what that angle MEANS.

@han-k59
Copy link
Author

han-k59 commented Jul 28, 2023

  • ASTAP claims the image is flipped (it certainly doesn't seem to be!)
  • ASTAP's degrees of rotation is off by a negation AND 180deg. Specifically it indicates 167.15 deg E of N. Maybe because it thinks the image is flipped when it's not?

If the F is indicated near the north-east arrow then it is flipped according the convention first pixel left bottom. You most likely have in ASTAP the "view flipped". Look to settings under pull down menu "View". A flipped image combined with flipped view is not flipped.

  • logical room for error with the "degrees east of north"

Just draw a north/east arrow on a piece of transparant paper/folie or glas. Then flip it horizontal or vertical and record the angle.

East is the direction where RA increases. North is the direction where the declination increases. A solid definition for a north-east indicator

Han

@alexw-im
Copy link

Yep, you're right, ASTAP was previously set to display flipped. So the .FITS I downloaded from nova is, in fact, flipped compared to the input.

East is the direction where RA increases. North is the direction where the declination increases. A solid definition for a north-east indicator

This was actually super helpful for me conceptualizing my orientation, thank you! I think that distinction is counterintuitive if you're used to looking down at a map vs looking up at the sky.

@sebagr
Copy link

sebagr commented Jul 28, 2023 via email

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

6 participants