-
Notifications
You must be signed in to change notification settings - Fork 106
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
Drawing error for ChromaticConvolution with pixel response #1302
Comments
Just to elaborate slightly on the goal here: Suggestions are welcome: is this code misuse or a bug in GalSim? |
After some discussion I went back to confirm that the achromatic version of this process works - below I've made the PSF achromatic and did not multiply the star or galaxy by an SED, so they'd be achromatic as well, and the code runs without complaint:
|
I was getting around this issue with the following code:
Basically, the trick is to apply the SED to the pixel response function, rather than the galaxy or star... Obviously the SED belongs to the pixel, not the galaxy, Duh |
Similarly, if you want to make a chromatic galaxy image, you have to do the convolution twice, and apply the SED at the second convolution:
Note that gal can be any kind of galaxy profile. If you need to do bulge+disk with different SEDs, do it per component:
|
I believe I fixed this in #1306. |
Thanks for looking into this Mike! I'm glad to see the solution was simple. |
Great - thank you so much for digging into this, Mike! @FedericoBerlfein have you been able to confirm that your code now works on this branch, and the results make sense? |
Yes I just checked and everything was working well. One thing that is worth noting is that the previous workaround mentioned by @ztq1996 for drawing the PSF is not equivalent to using this change. Meaning that convolving the Pixel response times the SED with the PSF is not equivalent to convolving the PSF with the pixel response and then convolving with the
|
I'm confused. I think all three of those are identical. (On branch '#1302' that is.)
prints
What am I missing? |
Ah yes you are right! Ignore my previous comment. When I was comparing on my notebook I was using a variable called |
Noticed that Galsim throws an error when trying to draw a convolution between a chromatic PSF and the pixel response function. Here is a code snippet showing the issue:
The vega SED here is simply used as an example SED, but running this will throw the same error for the bottom two lines:
AttributeError: 'Pixel' object has no attribute '_fiducial_profile'
.Curiously there is a practical workaround for to avoid this error if you replace the PSF as a sum of the PSF at discrete wavelengths:
which does not result in an error. However, I don't think this implementation is correct.
Any comments or suggestions are greatly appreciated!
The text was updated successfully, but these errors were encountered: