Skip to content

Add band-dependent Double-sersic/Catalog-Source color gradients - #438

Open
FerroYx wants to merge 6 commits into
LSST-strong-lensing:mainfrom
FerroYx:color-gradient
Open

Add band-dependent Double-sersic/Catalog-Source color gradients#438
FerroYx wants to merge 6 commits into
LSST-strong-lensing:mainfrom
FerroYx:color-gradient

Conversation

@FerroYx

@FerroYx FerroYx commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Intro

Based on MegaMorph we know that galaxy structural parameters and flux distribution can vary smoothly with wavelength.

And On the shear estimation bias induced by the spatial variation of
colour across galaxy profiles
displays that Spatial color gradients cause differences in the effective morphology across different bands and affect chromatic PSF and shear measurements.

So far, Slsim's color gradient is a simple model fixed for any band. And it's similar for Catalog Source (HST), which only offer single band images.

To achieve color gradients that more closely reflect reality, I will update the Double Sersic and Catalog Source modules to provide band-dependent color gradients.

Model

For a reference-band component weight w0, the first-component weight in band
b is defined as

[
w_0(b) =
\mathrm{sigmoid}\left[
\mathrm{logit}(w_0) +
s \left(p(b) - p(b_{\rm ref})\right)
\right],
]

where p(b) is the normalized position of the band in wavelength space and
s is color_gradient["strength"]. The second-component weight is
w1(b) = 1 - w0(b).

This form was chosen as a phenomenological parameterization because it:

  • recovers the original w0 and w1 in the reference band;
  • keeps both component weights positive and normalized;
  • preserves the total flux in every simulated band;
  • provides a single signed parameter controlling whether component 0 is
    relatively redder (strength > 0) or bluer (strength < 0);
  • orders LSST, Euclid, and Roman bands consistently through approximate
    central wavelengths.

This is not intended to be a physical component-SED model or a direct fit to
a particular observed colour-gradient relation. It provides a controlled
first-order model for multi-band simulation and sensitivity tests.

@FerroYx

FerroYx commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Still in progress; currently revising the HST section and adding a fallback option to Double Service in case there is no match in the HST source.

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.03846% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.69%. Comparing base (50ec899) to head (4f4eca3).

Files with missing lines Patch % Lines
slsim/Deflectors/DeflectorTypes/epl_sersic.py 97.61% 1 Missing ⚠️
slsim/Util/color_gradient.py 98.93% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main     #438    +/-   ##
========================================
  Coverage   98.69%   98.69%            
========================================
  Files         108      109     +1     
  Lines        8627     8831   +204     
========================================
+ Hits         8514     8716   +202     
- Misses        113      115     +2     
Files with missing lines Coverage Δ
...eflectors/DeflectorPopulation/all_lens_galaxies.py 100.00% <100.00%> (ø)
...rs/DeflectorPopulation/elliptical_lens_galaxies.py 100.00% <100.00%> (ø)
slsim/ImageSimulation/image_quality_lenstronomy.py 100.00% <100.00%> (ø)
slsim/Sources/SourceTypes/catalog_source.py 100.00% <100.00%> (ø)
slsim/Sources/SourceTypes/double_sersic.py 100.00% <100.00%> (ø)
slsim/Deflectors/DeflectorTypes/epl_sersic.py 98.38% <97.61%> (-1.62%) ⬇️
slsim/Util/color_gradient.py 98.93% <98.93%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sibirrer

sibirrer commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@FerroYx I am in the process of refactoring the Deflector() class to have access to all the Source() class features. So might not all be needed here for the deflectors.
It's just a bit of work and I hope I have it done by tomorrow

@FerroYx

FerroYx commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@sibirrer No problem, I'll wait till you update that part and make necessary modification.

@FerroYx I am in the process of refactoring the Deflector() class to have access to all the Source() class features. So might not all be needed here for the deflectors. It's just a bit of work and I hope I have it done by tomorrow

@sibirrer

Copy link
Copy Markdown
Contributor

@FerroYx we have merged a major PR for deflector re-factoring. So now, you only need the Source() classes to be updated to have this enabled. Let me know in case there are any issues with the merge conflict

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.

2 participants