First, models should not use any attributes/methods that are not in the interface classes of atomic rates.
Second, because NullBeamCXPEC does not have a donor_metastable attribute, running code with missing CX PECs for some species will raise an AttributeError if atomic data is configured with missing_rates_return_null = True.
There are two possible solutions. The first is to add the donor_metastable attribute to the BeamCXPEC interface class, and the second is to update the AtomicData.beam_cx_pec() method to return a list of (donor_metastable, rate) pairs instead of a list of rates. I think the first solution is less invasive and will have less impact on user code.
@jacklovell, @Mateasek, which solution do you like better?
The
BeamCXLine
model uses thedonor_metastable
attribute of theBeamCXPEC
. https://github.com/cherab/core/blob/9ae5a3e5493632c0d4cc8deef3aa838bb0085275/cherab/core/model/beam/charge_exchange.pyx#L309-L312 However, the interface class of theBeamCXPEC
does not have this attribute. https://github.com/cherab/core/blob/9ae5a3e5493632c0d4cc8deef3aa838bb0085275/cherab/core/atomic/rates.pxd#L53-L55 The attribute is added only in theopenadas
implementation of theBeamCXPEC
. https://github.com/cherab/core/blob/9ae5a3e5493632c0d4cc8deef3aa838bb0085275/cherab/openadas/rates/cx.pxd#L23-L29First, models should not use any attributes/methods that are not in the interface classes of atomic rates.
Second, because
NullBeamCXPEC
does not have adonor_metastable
attribute, running code with missing CX PECs for some species will raise anAttributeError
if atomic data is configured withmissing_rates_return_null = True
.There are two possible solutions. The first is to add the
donor_metastable
attribute to theBeamCXPEC
interface class, and the second is to update theAtomicData.beam_cx_pec()
method to return a list of(donor_metastable, rate)
pairs instead of a list of rates. I think the first solution is less invasive and will have less impact on user code.@jacklovell, @Mateasek, which solution do you like better?