Closed adl1995 closed 7 years ago
@adl1995 - Please make a first draft of this function, i.e. actually write inputs, code and return something, and write the docstring and test.
There's some info here:
https://github.com/hipspy/hips/blob/master/notes/API-proposal.md#make-a-wcs-image
and we also discussed it a few weeks ago here:
https://docs.google.com/document/d/1D3bEJuSH4d99u9dH_hGur3jbbPNapRI2hduYHCH9NKk/edit#heading=h.paw124lueu5w
(the make_sky_image(geometry, hips_survey)
).
By now, we've introduced the WCSGeometry
class, that should be the "geometry" input mentioned.
If you want, you could also start to add classes for the missing functionality here. I mean just put the classes with a docstring and the methods you need and put "raise NotImplementedError" in the methods.
So what we do here in this PR is to actually write down the API we want as actual Python functions / classes, they just aren't implemented yet. Then we'll merge, and you'll implement the missing pieces in small PRs one at a time next week and I think by the end of next week, we'll have something we can call v0.1 and release. :-)
I see you've renamed hips/draw/simple.py → hips/draw/tile.py
here.
I'd suggest you don't introduce hips/draw/tile.py
and keep as-is.
All of our drawing / functionality will be tile-related.
The idea with simple.py
was that this is where you implement https://hips.readthedocs.io/en/latest/drawing_algo.html#naive-algorithm and then https://hips.readthedocs.io/en/latest/drawing_algo.html#precise-algorithm will go into some other file, like precise.py
.
We might also need a high_level.py
or something like that with a uniform interface into the different drawing methods. I'd be OK if you add high_level.py
now if you like, and only have the simple tile drawing stuff in simple.py
.
@cdeil - I just made a commit adding the missing code. I made an assert on [0, 0]
. Although it is passing, I don't think the result is okay. I tried displaying the resulting image through matplotlib
and all the image is black except for a small portion at the top. This leads me to think that the tiles were outside the sky image. Could you please take a look?
Also, the resulting image of test_draw_sky_image
was all zeros, so I marked it with pytest.mark.xfail
.
@cdeil - I moved the _draw_sky_image_one_tile
function to DrawSkyImageOneTile
class. Also, I verified the output through matplotlib
and the result looks okay.
@cdeil - I just made some commits. Please check this (https://github.com/hipspy/hips/pull/30/files#diff-166822ec0a0c3100c6f9ffdd92c4b76eR19) line. I don't think the mypy
notation Generator[HipsTile, Any, Any]
is correct in this case, but I could not find another solution at the moment.
At the end of the tests there's these warnings: https://travis-ci.org/hipspy/hips/jobs/248660210#L2173
/private/var/folders/my/m6ynh3bn6tq06h7xr3js0z7r0000gn/T/hips-test-0qyifajc/lib.macosx-10.9-x86_64-3.6/hips/draw/tests/test_simple.py:24: ResourceWarning: unclosed file <_io.FileIO name='/Users/travis/hips-extra/datasets/samples/DSS2Red/Norder3/Dir0/Npix451.fits' mode='rb' closefd=True>
The reason is that your fits.open
calls leave open file handles. Please change the FITS reading in HipsTile.read
to this pattern, that should (I hope) resolve the issue, i.e. close the file handles at the end of the with block, before exiting the read method call:
with fits.open(str(path) as hdu_list:
data = hdu_list[0].data
header = hdu_list[0].header
return cls(meta, data, header)
Please make sure all tests are passing (or ask me for help if you don't know how to resolve some fails). See https://travis-ci.org/hipspy/hips/jobs/248660210#L2135
Do you know what's up with this warning? https://travis-ci.org/hipspy/hips/jobs/248660210#L2161
/Users/travis/miniconda/envs/test/lib/python3.6/site-packages/astropy/io/fits/file.py:336: AstropyUserWarning: File may have been truncated: actual file length (527168) is smaller than the expected size (529920)
self.size, pos), AstropyUserWarning)
Can you produce a few lines with a standalone test case that results in the same issue so that we can understand / debug / fix the issue?
@cdeil I made another series of commits. Currently waiting to Travis CI build to complete.
@cdeil I'm not sure why this example is failing to execute (https://travis-ci.org/hipspy/hips/jobs/248711430#L1182). I have defined hips_survey
in the above line, but it still raises a NameError
.
Travis-ci is all green now: https://travis-ci.org/hipspy/hips/builds/248735077?utm_source=github_status&utm_medium=notification
@adl1995 - Merge now? Or do you want to continue today and try to fix the computation of the list of tiles needed here to take into account the Hips and sky image coordinate frame correctly?
After some more debugging and pair-coding with @adl1995 we have a working make_sky_image
, see the attached screenshot of the image resulting from the high-level docs example.
Well, it's kinda working, you can see that the summing of the tiles creates bright line artefacts at the edges, and that tiles are missing because they query_disk doesn't work properly.
Let's discuss those and other things in separate follow-up issues. I'm merging this now.
@adl1995 - Good job! And have a nice weekend!
Well done, that's a valuable progress!
Added a function
make_sky_image
and passed it by adding the@pytest.mark.xfail
decorator. The high level functionality for this is yet to be discussed.