While the "raw" kernel is already available through PSF.kernel (only after .get_kernel() is called, which happens during .apply_to(), but that's fine), this is not necessarily the kernel that's actually used in the PSF convolution. Specifically, rotational blur and rounded edges are conditionally applied to the kernel before convolution, but the result is not written back into PSF.kernel. The primary use case is PSF photometry of the simulated image, which would benefit from having easy access to the kernel that was actually applied to the image, even if those two additional effects are used.
Why this is not as simple as just writing the modified kernel back to PSF.kernel? For multiple .observe() calls on the same optical train, the PSF kernel is "cached" in the effect (see PSF.get_kernel(), which is overridden in the various subclasses, e.g. FieldConstantPSF). Parameters controlling e.g. rotational blur might change in between. A possible solution would be to save the final kernel in a separate attribute (e.g. final_kernel or convolution_kernel or used_kernel), or alternatively to rename .kernel to .raw_kernel and use the .kernel attribute for the final one.
While the "raw" kernel is already available through
PSF.kernel(only after.get_kernel()is called, which happens during.apply_to(), but that's fine), this is not necessarily the kernel that's actually used in the PSF convolution. Specifically, rotational blur and rounded edges are conditionally applied to the kernel before convolution, but the result is not written back intoPSF.kernel. The primary use case is PSF photometry of the simulated image, which would benefit from having easy access to the kernel that was actually applied to the image, even if those two additional effects are used.Why this is not as simple as just writing the modified kernel back to
PSF.kernel? For multiple.observe()calls on the same optical train, the PSF kernel is "cached" in the effect (seePSF.get_kernel(), which is overridden in the various subclasses, e.g.FieldConstantPSF). Parameters controlling e.g. rotational blur might change in between. A possible solution would be to save the final kernel in a separate attribute (e.g.final_kernelorconvolution_kernelorused_kernel), or alternatively to rename.kernelto.raw_kerneland use the.kernelattribute for the final one.