Summary
src/easyreflectometry/model/model_collection.py:16-18:
def DEFAULT_ELEMENTS(interface):
return (Model(interface),)
Model.__init__'s first positional parameter is sample, not interface (model/model.py:66-76). Constructing ModelCollection(interface=<real interface>) with no models therefore builds a Model whose sample is a calculator-interface object.
Notes
- Latent because the only test of the default path uses
interface=None (tests/model/test_model_collection.py::test_default), and Model(None) is harmless.
- Peer collections do it correctly with keywords (
sample/collections/sample.py:21 uses Multilayer(interface=interface)), as does ModelCollection.add_model.
Suggested fix
return (Model(interface=interface),) plus a test constructing the collection with a real calculator.
Found during deep code review (DEEP_ANALYSIS.md §5.1).
Summary
src/easyreflectometry/model/model_collection.py:16-18:Model.__init__'s first positional parameter issample, notinterface(model/model.py:66-76). ConstructingModelCollection(interface=<real interface>)with no models therefore builds a Model whose sample is a calculator-interface object.Notes
interface=None(tests/model/test_model_collection.py::test_default), andModel(None)is harmless.sample/collections/sample.py:21usesMultilayer(interface=interface)), as doesModelCollection.add_model.Suggested fix
return (Model(interface=interface),)plus a test constructing the collection with a real calculator.Found during deep code review (DEEP_ANALYSIS.md §5.1).