Repository navigation
Allow chromatic profiles with zero-flux components. - #1379
Conversation
…effective profile rather than resampling.
…verride cases cleaner.
1dde8a0 to
27ecf93
Compare
jmeyers314
left a comment
There was a problem hiding this comment.
Looks good to me.
I left a couple typos/questions for you.
| im_r_ref = obj.drawImage(bandpass, scale=scale) | ||
| # Use iimult=2 for better accuracy on this "exact" version. | ||
| im_r_ref = obj.drawImage(bandpass, scale=scale, iimult=2) | ||
| im_r_ref.write(os.path.join(refdir, 'r_exact.fits')) |
There was a problem hiding this comment.
Since it's fast now, should we just always keep in memory? Or do you think it's useful as a regression test as well?
There was a problem hiding this comment.
Maybe. It's still faster to read it rather than remake it. But mostly it didn't seem worth keeping in the repo download space just to shave a couple seconds off the first time you run the test suite.
| self._buildRealImage(pad_factor, pad_image, noise_pad_size, noise_pad, rng, use_cache) | ||
| self._image_flux = np.sum(self._image.array, dtype=np.float64) | ||
|
|
||
| # If forcing stepk/maxk, we don't calculate them. |
There was a problem hiding this comment.
Do we need a similar zero-flux guard in the re-thresholding bits of withGSParams()?
There was a problem hiding this comment.
Yeah, good catch. These probably need some thought:
if ret._gsparams.folding_threshold != self._gsparams.folding_threshold:
ret._stepk = ret._getStepK(self._calculate_stepk, 0.)
if ret._gsparams.maxk_threshold != self._gsparams.maxk_threshold:
ret._maxk = ret._getMaxK(self._calculate_maxk, 0.)
I think you're right that these should include a check that flux != 0.
Co-authored-by: Josh Meyers <jmeyers314@gmail.com>
In Piff, one of my recent changes (rmjarvis/Piff#213) involves drawing an analytic derivative of a profile to get the gradient for the fit. This works fine when it's achromatic, but fails when I do this in a chromatic drawing context. It turns out there were two separate problems.
_fiducial_profilelook at ref_sed to find a good wavelength. This also fixed some places where normalization would involve division by zero when the flux is zero._get_effective_prof.