Skip to content
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

MultipleImageHelper #653

Closed
jmeyers314 opened this issue Mar 19, 2015 · 2 comments
Closed

MultipleImageHelper #653

jmeyers314 opened this issue Mar 19, 2015 · 2 comments
Labels
cleanup Non-functional changes to make the code better
Milestone

Comments

@jmeyers314
Copy link
Member

I came across the MultipleImageHelper code while looking through the InterpolatedImage files to see what might be required to add InterpolatedKImage (ala #642), and also while thinking of profiles that are built up as series expansions (ala #628). I can't actually figure out how to use it though.

This much seems to work:

import galsim
aimg = galsim.Gaussian(fwhm=0.5).drawImage()
mih = galsim._galsim.MultipleImageHelper(image=aimg.image, pad_factor=4.0)

but then I can't figure out how to pass this to SBInterpolatedImage:

# This fails.
obj = galsim._galsim.SBInterpolatedImage(multi=mih, weights=[1.0],
                                         xInterp=galsim.InterpolantXY(galsim.Quintic(tol=1e-4)),
                                         kInterp=galsim.InterpolantXY(galsim.Quintic(tol=1e-4)))

Similarly, I can't figure out how to create a MultipleImageHelper that actually handles multiple images:

# This fails.
bimg = galsim.Gaussian(sigma=0.6).drawImage()
mih = galsim._galsim.MultipleImageHelper(images=[aimg.image, bimg.image], pad_factor=4.0)

In both cases, I suspect it has something to do with me providing a python list where the c++ is expecting a std::vector, which apparently isn't compatible. My boost-fu ends about there though.

I tried grepping around for all the instances of _galsim.SBInterpolatedImage, and as far as I can tell the multi image machinery is never used or tested in any .py files. Did this get abandoned?

@rmjarvis
Copy link
Member

No, it never really got used. I think Gary's idea about this was that you might want to have an object modeled as a weighted sum of several different images, and then reweight them on the fly, say to derive best fit parameters of a decomposition for instance. @gbernstein please correct me if I'm wrong here.

But we never really used it that way, and honestly, I think that kind of functionality (e.g. #628) is better implemented in the python layer by making sums of profiles (not all of which need to be InterpolatedImages). Our code for rendering sums with arbitrary scalings is I think just as efficient as what you would get by using the MultiplImageHelper, and more flexible as well.

So my inclination would be to just remove the MultipleImageHelper class and only have SBInterpolatedImage be constructible from a single image.

Then for the InterpolatedKImage, I was thinking we could add a boolean argument is_k_image that would basically swap the roles of XTable and KTable in the constructor. I'm sure there are some other tweaks that would be required as well, but that was my thought for the starting point.

@jmeyers314
Copy link
Member Author

you might want to have an object modeled as a weighted sum of several different images, and then reweight them on the fly

That's the exact application I had in mind.

Our code for rendering sums with arbitrary scalings is I think just as efficient

Ok. I was hoping for some magic performance enhancement. I'll try out galsim.Sum instead though.

Then for the InterpolatedKImage, I was thinking we could add a boolean argument is_k_image that would basically swap the roles of XTable and KTable in the constructor.

I guess you'd need to be able to pass in both the real and imaginary kimages at the very least (and maybe assert that this makes a Hermitian complex kimage). That's a comment for a different branch though. Closing this.

@rmjarvis rmjarvis added the cleanup Non-functional changes to make the code better label Oct 14, 2015
@rmjarvis rmjarvis modified the milestone: Will not fix Feb 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Non-functional changes to make the code better
Projects
None yet
Development

No branches or pull requests

2 participants