Skip to content

Allow chromatic profiles with zero-flux components. - #1379

Open
rmjarvis wants to merge 6 commits into
releases/2.8from
chromatic_zero_flux
Open

rmjarvis wants to merge 6 commits into
releases/2.8from
chromatic_zero_flux

Conversation

@rmjarvis

Copy link
Copy Markdown
Member

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.

  1. The first was easy to fix. An InterpolatedImage (used for intermediate images during chromatic drawing) cannot determine stepk and maxk automatically when the total flux is zero, so you need to supply them with _force_stepk and _force_maxk. I was doing that, but it still failed because of an erroneous check. I fixed it so InterpolatedImage only checks for zero flux if these values are not present and the calculate directives are not set to False.
  2. A more serious problem is determining the fiducial profile to set up the image. It looks for a wavelength at which the profile doesn't vanish. It had been doing that using the flux evaluated at various wavelengths. But for these profiles, the flux is always 0 at every wavelength (but the images are not zero). To fix this I separate our SED into two components: ref_sed and ref_flux (ref for reference). The full SED is the reference SED times the reference flux. But keeping this separate allows these profiles to have ref_flux=0, but let _fiducial_profile look 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.
  3. Those two were enough for my use case, since my kernels are separable (monochromatic * sed) but if a zero-flux component is inseparable and part of a convolution, then we have to calculate stepk and maxk from the monochromatic profiles at the wavelengths used in the integral for the InterpolatedImage in _get_effective_prof.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant