-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add property 'children' for creating four children tiles from parent tile #85
Conversation
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 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 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 |
hips/tiles/tests/test_tile.py
Outdated
@pytest.mark.parametrize('pars', HIPS_TILE_TEST_CASES) | ||
def test_children(self, pars): | ||
tile = self._read_tile(pars) | ||
child1_data = tile.children[0].data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I would suggest to put this on a separate line:
child_tiles = tile.children
Then you can on the following lines access meta and data from each child as you like, e.g. you could do:
ipix = [_.meta.ipix for _ in child_tiles]
and then assert on this ipix
list, to establish the current behaviour of the function about the order of child tiles returned.
@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.