WorldWideTelescope / wwt-web-client

The WorldWide Telescope web client lets you explore the universe in your browser.
https://worldwidetelescope.org/webclient/
MIT License
105 stars 35 forks source link

Could not load FITS image #202

Closed keflavich closed 4 years ago

keflavich commented 5 years ago

I tried loading a FITS image in the web client while trying to make a tour, and the web client zoomed me to the right location, but did not show the FITS file. It also did not bring up the "scale" icon that the docs say should exist: https://worldwidetelescope.gitbooks.io/worldwide-telescope-user-manual/content/astronomicalresearch.html#fits-images

My end goal is to include the FITS image (and/or some other images) as part of a tour; is that possible if the files are retrieved locally? Where will they be hosted if so?

astrojonathan commented 5 years ago

Any chance I can get a link to the FITS file to check it out. FITS is an extremely broad and loose standard and we don't support many flavors that have unusual projections or strange storage formats.

If I could see the file I could take a look at what is going on? Is this for Web Client or Windows Client? I assume the Web since its posted here.

keflavich commented 5 years ago

Web client, but it's good you checked. Data here: https://drive.google.com/file/d/0B5kT36QFh9W5R1pwWUI4emkzUjFqNGhQaXY4M0JlWDJXU2hB/view?usp=drivesdk

On Wed, Feb 6, 2019, 19:05 Jonathan Fay <notifications@github.com wrote:

Any chance I can get a link to the FITS file to check it out. FITS is an extremely broad and loose standard and we don't support many flavors that have unusual projections or strange storage formats.

If I could see the file I could take a look at what is going on? Is this for Web Client or Windows Client? I assume the Web since its posted here.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/WorldWideTelescope/wwt-web-client/issues/202#issuecomment-461262804, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIxY0BZh0zgT9PLMFSb-fQTXsmdGNzBks5vK4n3gaJpZM4amVvu .

astrojonathan commented 5 years ago

Looking at the FITS headers this image does not have enough information for a WCS solution. It has scale, reference and position values, but no rotation and not WCS matrix.

WWT needs at least the CD matrix, or a full set of position, scale and rotation to be able to properly display the image in the sky.

In the Windows client, the image will show up, but warns that there is not enough information to show the image, and it shows up without rotation, in the Web Client it silently ignores the partial headers.

If a rotation ("CROTA2") or CD matrix were present it would display properly in the web client.

Where are these images sourced from? Can the headers be added or computed?

astrojonathan commented 5 years ago

image

keflavich commented 5 years ago

This header is produced by astropy.wcs. The CROTA keyword is deprecated and is implicitly zero if unspecified, afaict. What WCS library is WWT using?

Converting from CDELT to a CD matrix is straightforward; I can do that as a workaround, but the vast majority of FITS files I've worked with have CDELTs and no CROTAs, so I'm surprised to see WWT fail on this case.

astrojonathan commented 5 years ago

An Astronomical image with no rotation can only be generated from a synthetic source, our FITS code is currently assuming that if there is no rotation, that the headers are incomplete, not that the rotation is zero. WWT has its own FITS implementation, but it goes back over 10 years, so the assumption that the lack of rotation meant the image could not be projected might be incorrect for synthetic images that are grid aligned with no rotation, but for images taken from a telescope (WWT main history) the rotation needs to be specified, or it won't match the background it is displayed on.

Many fits images back when WWT started did not have sufficient header information for proper projection on the sky.

If we assume missing rotation means zero rotation, then some images that just have incomplete headers won't display correctly. In the Windows Client we warn of the missing data and assume zero, we could make the Web Client do the same thing.

keflavich commented 5 years ago

I think that warning is fine.

These data come from ALMA, an interferometer, so when we construct the pixel grid, we align it with the RA/Dec axes by construction. For pretty much all radio data, even single-dish mapped data, it's easy to choose a grid that's aligned with the celestial axes, so that is the standard.

astrojonathan commented 5 years ago

That makes sense.

keflavich commented 5 years ago

A related question - which is not really part of this issue, but I don't know where else to ask (the forum links were broken yesterday...): if I add this file to a tour on the web client, can others view it?

Also, I'm testing the workaround now, both adding CROTA2 = 0 and changing to CDx_x, and neither has worked so far...

astrojonathan commented 5 years ago

Can you send me a sample of the updated version? with CROTA2? or CD? The FITS file will be bundled with the tour and playable by anyone who can load the tour.

keflavich commented 5 years ago

OK, cool, thanks.

All I've done is swap in these lines for the CDELT lines:

CD1_1   =  -1.111111108568E-06
CD1_2   =  0.0
CD2_1   =  0.0
CD2_2   =   1.111111108568E-06

and

CDELT1  =  -1.111111108568E-06
CDELT2  =   1.111111108568E-06
CROTA2  = 0.0

I'm uploading them locally, not giving a URL, if that matters. Also, uploading them... may freeze the client?

keflavich commented 5 years ago

Updated/updating file: https://www.dropbox.com/s/8akoei1kposf80r/OrionSourceI_NaClv%3D1_18-17_robust0.5.maskedclarkclean10000_medsub_K_peak.fits?dl=0

keflavich commented 5 years ago

That file, with CROTA2, does appear to crash my client

astrojonathan commented 5 years ago

Where is the image located on the sky? The second image link is a different position than the first?

keflavich commented 5 years ago

they have identical CRVALs: they are in the same location

CTYPE1  = 'RA---SIN'
CTYPE2  = 'DEC--SIN'
CRVAL1  =       83.81049354032
CRVAL2  =      -5.375172042341

The object is "Orion Source I"

jsub1 commented 5 years ago

@keflavich I did some digging, and the reason that the FITS file does not appear in the web client is because the web client currently does not load 64-bit float FITS images. Adding support for 64-bit float images is in the issue tracker as issue #220.

Also, were you trying to load the same FITS file twice in a row when the web client crashed on you? If it was something else that caused the crash, any information you have on reproducing that would help us fix that.

@astrojonathan The web client currently treats FITS files missing the CROTA2 keyword as if the value is zero. I don’t think it makes sense to start warning the user if the keyword is missing since it is not required by the standard, and synthetic FITS images from astropy or other sources is and will continue to be a more common use case than it has been historically.

keflavich commented 5 years ago

I don't recall, sorry! I'm not sure when I'll get to try this again.

jsub1 commented 5 years ago

@keflavich Not a problem! Just let us know if/when you're able to try it again.

pkgw commented 4 years ago

I believe this was solved — @jsub1 worked on the issues we identified here. @keflavich please reopen or file a new issue if needed.