Closed cdeil closed 7 years ago
I am working towards correct HEALPix <-> HiPS tile pixel mapping, so that we can also generate HiPS, not just read and draw it. What I found is that the up-down flip between FITS relative to {PNG/JPEG} is there both for tiles and all-sky images: https://github.com/cdeil/hipsperiments/tree/master/tile_orientation
One can see that all_sky.tile(ipix)
doesn't return the same tile for FITS and JPEG, i.e. it's currently broken for one of the two, and I'm not even sure which one.
I will implement a function that implements HEALPIX ipix to Hips tile (x, y) pixel coordinate mapping next, and that is yet another case where the up / down flip needs to be taken into account.
My current thinking is to move the up / down flip from
https://github.com/hipspy/hips/blob/fc5a870bf4d8215a8818d3068749ea97e7029932/hips/draw/simple.py#L175
to a central location where it will be applied correctly for all cases where it needs to be applied.
Maybe it could be part of HipsTile.data
(and the corresponding reverse from_numpy
) that at that point we call numpy.flipup
on the data array?
Which tile orientation should we make the "standard" one in our package? I.e. should we always convert to the FITS orientation or the JPEG orientation?
@adl1995 @tboch - Please comment if you have any thoughts on this.
If I don't hear back, I'll just go ahead and implement a solution I like in this PR and we can then still discuss and change if needed in the coming days / weeks. I'm leaning towards always converting to the FITS orientation internally, and to always do it at the point where we to to and from numpy array with the data.
@cdeil I would also prefer if we convert to FITS orientation by default.
I've made the change to flipping JPG and PNG tiles and all-sky images to the FITS convention in to_numpy
and from_numpy
in 26b98de in this PR.
I was really struggling with the orientation of tiles and the whole image for the all-sky images. I think with acd58c882d538d4255239c3405356602dc1906d6 now results are correct.
I'm merging this now and will continue with HEALPIX ipix
<-> tile (x_idx, y_idx)
mapping in a separate future PR.
This PR improves the all-sky image implementation and tests to also work with FITS images.