Current Status
Currently LensPop takes strings and dictionaries as inputs at initialization, and uses if-statements "under the hood" to select what objects are initialized for the deflector and source populations. This hard-coding reduces legibility and extensibility, leading contributors to have to modify the LensPop if they modify or add population objects.
Proposed Solution
Follow the dependency injection design pattern and have LensPop take a lens and source population as input, with LensPop expecting certain attributes and methods be available from the provided class instances. This reduces the scope / responsibilities of LensPop while allowing future contributors to create drop-in substitutions, as long as they fullfill the interface expected by LensPop, see Figure in #223.
To-Do List
Current Status
Currently
LensPoptakes strings and dictionaries as inputs at initialization, and usesif-statements "under the hood" to select what objects are initialized for the deflector and source populations. This hard-coding reduces legibility and extensibility, leading contributors to have to modify theLensPopif they modify or add population objects.Proposed Solution
Follow the dependency injection design pattern and have
LensPoptake a lens and source population as input, withLensPopexpecting certain attributes and methods be available from the provided class instances. This reduces the scope / responsibilities ofLensPopwhile allowing future contributors to create drop-in substitutions, as long as they fullfill the interface expected byLensPop, see Figure in #223.To-Do List
SkyPyPipelineout ofLensPop._lens_galaxiesattribute (i.e instances ofDeflectorBasesubclasses) out ofLensPopand instead expect as input toLensPop._sourcesattribute (i.e instances ofSourcePopBase) out ofLensPopand instead expect as input toLensPop.