Closed adl1995 closed 7 years ago
The splitting isn't correct. For a tile of shape (512, 512), all the children should have shape (256, 256). You need to fix the implementation.
For the tests: please make a separate test_children
method, don't mix the tests for the children
property in with test_read
.
Finally, even if the output shape of the children is correct, I guess it'll still not be clear whether their orientation is correct, or whether they are flipped in x or y or rotated. You could make a notebook drawing once the parent tile, and then the children, and show that the resulting sky image is (almost, apart from small distortiion correction) the same. I leave it up to you if you want to do this check now, or in the next PR where you use these children for drawing.
@cdeil I have updated the implementation. Please check if it's correct now. For the Jupyter notebook, I would prefer to create it along with the next pull request.
The implementation now splits into 4 parts with the correct shapes. But I still don't know if it's correct. You are putting the child with data[0: w, 0: w]
to correspond to meta.ipix * 4 + 0
, but that is just a guess, right? The correspondence which data sub-part goes with which HEALPIX ipix for the child is unclear and non-obvious (and thus probably incorrect).
My preference would be that you debug this here, because the next pull request will be even more complex, with changes to the painter, so debugging this utils function there in addition could take very long. Whereas this here is a very small pull request, and you will manage to understand, debug, fix and then document via a comment in the code the child tile order and orientation.
It's not so hard, it should be ~ 20 lines of code and take an hour: you just make a notebook where you draw a single tile, and then draw the four sub-tiles. Either the output images are correct, or you'll see that the children are in the wrong place or flipped and then adjust your code until it's correct.
--
For the test: remove all changes to the test_read()
method. And change test_children
to assert something about each of the four child tiles that establishes the current behaviour. Concretely I would assert on the ipix
of each child, and the pixel value at pixel index (0, 255)
.
@cdeil I just tried displaying the found children tiles and compared it with the father tile, the result looks good to me. Link to notebook: https://github.com/adl1995/HIPS-to-Py/blob/master/examples/Tile%20distortion%20issue%20-%20Fix.ipynb
Now project these tiles onto the sky image, and see if they land in the right place / with the right orientation. If it's not clear to you what to do here, let's chat on Slack.
@cdeil I updated the code according to your suggestions. The drawing code isn't updated yet, I will do that in the next PR.
Mui bien!
As outlined in #83, I have added a property named
children
inHipsTile
class, this splits the parent tile into four children tiles. I also added a some test cases for the first child.