Open JelleAalbers opened 1 year ago
I experimented with a wrapper to convert Sources to lens light classes here: https://github.com/JelleAalbers/paltas/commit/9d1cee2102e73edbb156e7d3f5a4dd2d9c411583 (+ a few bugfixes in later commits). Let me know if you'd like something like that here (or in a future PR), I'm on the fence as to whether it actually made things clearer or not.
Hi Jelle, what is the status of this pull request? Are you waiting for another review on the changes?
This introduces two changes:
SourceBase
,LOSBase
, etc.) subclasses of a newBaseComponent
class. This base class takes care of the common init, update, and parameter checking that was previously duplicated across components.ConfigModel.get_lenstronomy_models_kwargs
to remove the mostly-duplicated code for initializing and drawing from the different models. In particular, paltas classes now have adraw
method that calls methods likeadd_lenses
oradd_sources
from a commonLenstronomyInputs
object that is passed around. Besides cleaning things up, this will allow us to add features like painting galaxies onto subhalos.I put the new base class in a top-level
core.py
. If you like that, maybe we can move theConfigHandler
stuff there too. We could also squirrel away the base class in an obscure utils file.One remaining eyesore is the lens light handling. Perhaps we could implement lens light by adding a source model at the lens redshift, instead of collecting separate buckets of lenstronomy arguments? This would require more changes in the test suite though.
The tests will fail until https://github.com/swagnercarena/paltas/pull/38 (or at least https://github.com/swagnercarena/paltas/commit/94bfd3d83c8d3bf650dc53ffbcf093224edbcdd2) is merged and we rebase.