Closed adl1995 closed 7 years ago
@cdeil I made some changes. Although, I'm not sure if the make_sky_image
function is required now, as it basically just calls SimpleTilePainter.run()
. Also, I couldn't add tests for png tiles because they are not available in hips-extra
(the ones that fall on the galactic center).
I'll have a look now.
My suggestion would be to keep the "make_sky_image" function, as the very high level, very simple end user interface. Once we have different tile fetching / caching and drawing methods, the code in make_sky_image
would again grow to 10 or 20 lines of configuring / calling the lower-level routines via a uniform and simple to configure interface (e.g. a draw_method="simple"
or draw_method="fancy"
method.
make_sky_image
should also return a result object that offers more info / data members than just the numpy array of pixels we currently return.
Makes sense?
Also, I couldn't add tests for png tiles because they are not available in hips-extra (the ones that fall on the galactic center).
Can you make a PR adding the tiles you need yourself? If yes, please do. If no, please file an issue and I or Thomas will do it.
@cdeil I just made some changes.
Please always run python setup.py build_docs
locally and resolve all warnings / errors:
https://travis-ci.org/hipspy/hips/jobs/253249006#L1158
@adl1995 - I left some more small comments inline. Once those are adressed, and there's green light on travis ci (still the docs build: https://travis-ci.org/hipspy/hips/jobs/253258805#L1158), I'll merge.
@adl1995 - I wanted to start playing around with HiPS tile drawing a bit myself: https://github.com/cdeil/hipsperiments/blob/master/rgb_tile_draw_issue.ipynb
The problem with the current class is that one cannot access the tiles any more after running the algorithm.
Can you please change the implementation for painter.tiles
to return a list of tiles, instead of a being a generator.
Basically I would propose this coding pattern:
class Painter:
def __init__(self):
self._tiles = None
@property
def tiles(self):
if self._tiles is None:
self._tiles = list(self._fetch_tiles()) # the method you have now, just with a leading underscore
return self._tiles
This way, the painter fetches the tiles only once, and puts them in his pocket in case someone (like me) wants to inspect them later.
@adl1995 - is it clear? do you want to implement it or should I just take over here?
@cdeil I made some updates to the code and also added a test case for PNG tiles. The Travis CI is passing now. Please check.
@adl1995 - Thanks!
I'm merging this now.
PS: I'll do some cleanup and coding on hips
in the next ~ 2 hours, to polish a bit for the upcoming v0.1 release.
As discussed in issue #57, I have reformatted the
SimpleTilePainter
class. I'm aware this still needs some changes, but this will provide us with a working ground. For now, I have commented out thetest_draw_sky_image
function as it is not currently usable.@cdeil @tboch Please provide feedback on what needs to be changed.