-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
WIP: Added initial image reprojection functionality #2731
Conversation
This includes the changes from #2730 which should be removed if this is ever merged. |
@mdboom - at some point, could you send me information about how to get the core drizzle c code? As you can see here I've already started working on the steps to compute the pixel values to pass to drizzle, but I'm not sure exactly what inputs are required? |
I am trying to give this a go to reproject from HPLN/HPLT-TAN to HPLN/HPLT-CAR using this code: https://gist.github.com/Cadair/f92481222021d5d258b1 It doesn't seem to actually be reprojecting anything, as the output is still circular :p |
The core drizzle C code is exposed to the outside world in a way that is very specific to how drizzlepac wants to use it at the moment. It will take some time to pick things apart. But if you want to see it: |
@mdboom - no problem, this was just an idea following a conversation with @perrygreenfield, but it is not urgent. Also, the function here could be modified to better deal with what the drizzle code expects, what is here currently was just based on my understanding of what was needed. |
@keflavich @cdeil - want to try this out? :) |
@ellisowen and I have cube data ... I think this handles only 2D, but @keflavich's FITS_tools.regrid_cube seems to work nicely for us. In general I'm a huge fan of starting In my experience pull requests for Astropy take very much discussion, because we want to "get it right" before users try them out. Maybe using one of the existing repos ( |
This only handles image data for now, but indeed we can add 3D. Regarding the scope, there isn't one defined yet, this was just a bit of fun at the scipy sprint. What I really wanted here was reprojection tools, and since The plan was that once something works here, I would post a message to the list to propose the idea, and we can then try and work from there, but I thought it would be nice to have some functionality examples to start discussing since previous discussions on the topic of image analysis did not lead far in the past. |
Actually the more I think about it the more I think |
So if we do that, the scope is the following: 2- and 3-d data reprojection with:
@cdeil - would you be more comfortable with that scope? |
It would be nice if reprojection worked for n-d data (i.e. it operates on the two spatial axes, but there can be any number of other axes that are treated as independent planes that are reprojected one by one). And I think the downsample and upsample functions from Personally I'd much prefer to throw this together in the separate |
I also like pushing this into |
@cdeil @keflavich - I guess my thinking was that if you just consider the problem of reprojection, it's a pretty straightforward problem API wise at the core level. You have an array, and two WCSs, and maybe a couple of options. So there's no so much the issue of trying to try out different APIs, etc. But point taken, we can develop faster in Does that sound reasonable? |
Yes. |
👍 to doing this in the We could decide on a case-by-case basis what is in scope and whether this would become |
Ok, sounds good. I have a student looking for fun projects, so I'm going to talk to him about working on python-reprojection later this week. I'll update that package to the latest package-template and will move the stuff here into there. |
I've started looking at this in the context of fitting drizzle into it. I think there's one important API change we need. The resampling routine should return both the resampled image and a weighted mask showing the amount of contribution to each pixel (it's basically an alpha mask) -- it will end up being 1 most places in the image, and 0 outside, but some value in between along the edges. We probably don't want to do mosaicing in the first pass, but if we ever want to, you need that information in order to subsequently combine multiple images together later, and we'll kick ourselves by not outputting that information from all of the projections at this point. @cdeil: Where is the |
@mdboom - https://github.com/astrofrog/reproject/ |
@keflavich: I'm not sure I follow. Any reprojection routine, regardless of method, is going to have a mask. Unless the reprojection fills the output image exactly, in which case the mask could be a scalar value of 1 -- but I would argue it should still return that so that images can be combined in a uniform way. |
@mdboom - point taken, I think you're right. |
@mdboom - I agree, that sounds like a good idea! |
Closing this since it is being developed in https://github.com/astrofrog/reproject/ - we will open a new PR once it is ready to put in the core package (if everyone agrees it belongs there). |
This was discussed during SciPy as a possible feature to add to astropy. This routine would act as a high-level wrapper for interpolating reprojection, but also a wrapper to the drizzle algorithm for flux-conserving reprojection, and even a Montage-like algorithm. This is of course work in progress, but feedback about this idea is already welcome (will post to the list once it's a little more functional).