Conversation
… shows reasonable profiles and residuals.
…t the center from the project aberration file.
|
By the way, no need to do a careful code review of the two diagnostic scripts in the devel/roman directory. These are scripts that Codex wrote for evaluating the quality of the model solutions for the piff.yaml runs there. |
nihardalal
left a comment
There was a problem hiding this comment.
Looks good to go. I think you caught all the variable renames, and the unit tests seem pretty good to me as well. As I mentioned in the in-line reviews, we should definitely do more testing of five-points vs bilinear (either on other exposures or real data)
There was a problem hiding this comment.
Did a brief scan, looks fine!
|
|
||
| min_snr: 50 # reject very faint stars | ||
| max_snr_weight: 500 # don't over-weight very bright stars | ||
| #max_mask_pixels: 10 # how many pixels in stamp are allowed to be masked. |
There was a problem hiding this comment.
Did you mean for this comment to be removed?
There was a problem hiding this comment.
Yeah, I had tried it a long time ago, and it wasn't helpful. So I commented it out.
I finally decided it wasn't worth keeping here as an advertisement that it was possible. My guess is we won't want it for Roman. I haven't been using it for this test run.
| def clear_cache(self): | ||
| self._corner_cache = {} | ||
|
|
||
| def _get_roman_five_point_data(self, sca): |
| for i, (pt, p) in enumerate(zip(points, sample_params)): | ||
| extra = self._make_extra_aberrations(p) | ||
| if self.nominal_interp == 'five_point' and i == 4: | ||
| extra = extra + self._get_roman_five_point_data(sca)['center_delta'] |
There was a problem hiding this comment.
Looks correct to me - indexing seems fine/taken proper care of
| fx * fy, | ||
| ) | ||
|
|
||
| def _five_point_weights(self, star): |
|
|
||
|
|
||
| @timer | ||
| def test_five_point_weights(): |
There was a problem hiding this comment.
This test looks fine to me!
| ), | ||
| ) | ||
| fitted = model.fit(fit_star) | ||
| prof = model.getProfile(truth_params, star=star) |
There was a problem hiding this comment.
This is a lot more compact and readable, good change
| aberration_prior_sigma=[0.1, 0.2, 0.3], | ||
| ) | ||
| np.testing.assert_allclose(linear_vec.prior_sigma, np.tile([0.1, 0.2, 0.3], 3)) | ||
|
|
There was a problem hiding this comment.
Looks like a comprehensive test set
|
|
||
| @timer | ||
| def test_roman_fit_many(): | ||
| def test_linear_prior_io(): |
|
|
||
| # With direct GalSim truth generation, both nominal interpolation options should converge | ||
| # to reasonable fits, but neither is expected to recover truth_params exactly | ||
| # for the reason mentioned above. (Profile interpolation != aberration interpolation.) |
There was a problem hiding this comment.
We should definitely do some more investigation into this (worse fit but better chi^2) in the near future
There was a problem hiding this comment.
This wasn't the case in the big devel/roman test. There the overall chisq was worse with five_point. Not outrageously so, but enough that I left the canonical value there as bilinear.
|
Thanks Nihar! Merging. |
The PR adds two features to the RomanOptics PSF class.
Piff does this a little bit different from what GalSim does when calculating the PSF at an arbitrary location. GalSim does a bilinear interpolation of the aberrations themselves, and then computes the PSF from that. Piff computes the 4 or 5 PSFs with the project aberration values and then interpolates the whole PSF. I don't really have a good feel for which is more accurate. But the way Piff does it is computationally much more tractable, since constructing the PSF is relatively expensive, so using the interpolated (either bilinear or five_points) PSF is much faster.
In my test exposure, bilinear performed slightly better than five_points, but there wasn't much difference. We'll see how this goes on the real data eventually. I think this will at least be something we'll want to be able to test as to which one gives better results.