Conversation
|
The commit 9a0f746 propose a new implementation of the Roman PSF Builder. (It can be found at the top of the To reproduce the current behavior with this modification, the config file would look like this: psf:
type: RomanPSF
interpolator:
type: RomanPSFInterpolator
input:
RomanPSFInterpolator:
kind: corners
n_waves: 5On top of allowing for new interpolator I think this implementation also open the door to more parametrization of the interpolation. Now you can also use any PSF already existing in GalSim and also making fast simulation by not providing an psf:
type: RomanPSF
wavelength: 1048Technical note:
This is very technical and I am not sure my explanation is very clear here. I'll be happy to discuss it more. Please ask any questions about this and I would be very interested in any feedbacks. Final note: Validation: This implementation has been tested against an images generated using the config from this repo before modifications. |
|
Some quick questions before I dig into the details - from the PR title, it appears that you're fixing a bug. But it's not necessarily a bug that you're fixing but you're extending it to support a new feature of having multiple SCAs in one file, right? Also, one SCA per file makes sense to me. This is also how |
The direct interest I have in doing that is because of the way my simulation works. I simulate a small field with multiple observations from multiple SCAs and keep them in memory. This is how it looks in python: # Read config
config = ReadYaml(config_path)[0]
# Import the required modules
galsim.config.ImportModules(config)
# Process the InputType (such as the PSF or SkyCatalog)
galsim.config.ProcessInput(config)
# Make the images
image = galsim.config.BuildImages(3, config)This is consider as "1 file". To do this with the current implementation I would have to change the config file everytime I need to change the SCA. But I want to emphasize on the fact that, in my opinion, the current implementation could lead to some issues. There is nothing that says that one should process only one SCA per file and per run. Even changing the # We're just doing one SCA here.
# If you wanted to do all of them in each of three filters (given below), you could use:
#
# SCA:
# type: Sequence
# first: 1
# last: 18
# repeat: 3 # repeat each SCA num 3 times before moving on, for the 3 filters.that would not work. You would only get the PSF from the first SCA and it would be very difficult to figure it out in the output. There are other things in the implementation that could cause issues, such as querying the WCS. This is fine given how the simulation is used right now but with my simulation the WCS need the image size, which is only determined when the image is built, which happen after the inputs are set. From a pure implementation perspective I think it is a bit dangerous to have methods that do more than what they are supose to, such as the getKwargs in the |
In the current implementation there is an assumption that only one image will be made per file. If one wants to simulate multiple SCAs and save them into a single file the PSF will only be initialized with the settings of the first image (SCA, WCS, bandpass). This is because the `__init__` of the class in the `InputLoader` is only called at the start of a new file in GalSim. This hasn't been a problem so far because the simulation was always run with one image per file. With this update we can now safely make multiple images of different SCA within a file and the PSF will be updated accordingly by doing the initialization in the `BuildImage` function using the method `setupImage`. Extra note: the `__init__` of `RomanPSF` could almost be removed but I prefer to keep it because I have in mind features that would require it.
More details in the PR and top of `psf.py`
f6b575f to
94fa2b1
Compare
94fa2b1 to
49b58fa
Compare
In the current implementation there is an assumption that only one image will be made per file. If one wants to simulate multiple SCAs and save them into a single file the PSF will only be initialized with the settings of the first image (SCA, WCS, bandpass). This is because the
__init__of the class in theInputLoaderis only called at the start of a new file in GalSim. This hasn't been a problem so far because the simulation was always run with one image per file. With this update we can now safely make multiple images of different SCA within a file and the PSF will be updated accordingly by doing the initialization in theBuildImagefunction using the methodsetupImage(see where this happen here).The update also include a small change regarding how the initialization is done. Now that we do it from the image builder we have access to some image characteristic which include its size. Instead of hard coding the image size to
roman.n_pixfor the corners, we now use the actual image size. This gives more flexibility to the code and allow to use images with a different sizes and have a more "appropriate" PSF interpolation.Extra note: the
__init__ofRomanPSFcould almost be removed but I prefer to keep it because I have in mind features that would require it.Validation: This implementation has been tested against an images generated using the config from this repo before modifications.