Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeamCXPEC interface class is missing the donor_metastable attribute used in BeamCXLine #411

Open
vsnever opened this issue Apr 12, 2023 · 0 comments
Assignees
Labels

Comments

@vsnever
Copy link
Member

vsnever commented Apr 12, 2023

The BeamCXLine model uses the donor_metastable attribute of the BeamCXPEC.

self._excited_beam_data = []
for rate in rates:
if rate.donor_metastable == 1:

However, the interface class of the BeamCXPEC does not have this attribute.
cdef class BeamCXPEC:
cpdef double evaluate(self, double energy, double temperature, double density, double z_effective, double b_field) except? -1e999

The attribute is added only in the openadas implementation of the BeamCXPEC.
cdef class BeamCXPEC(CoreBeamCXPEC):
cdef readonly:
dict raw_data
double wavelength
int donor_metastable
Function1D _eb, _ti, _ni, _zeff, _b

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?

@vsnever vsnever added the bug label Apr 12, 2023
@vsnever vsnever self-assigned this Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant