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

Remove bandaid fix for duplicate linelists once upstream fix is available #2444

Open
AlexHls opened this issue Oct 12, 2023 · 0 comments
Open

Comments

@AlexHls
Copy link
Member

AlexHls commented Oct 12, 2023

Describe the bug

#2443 Introduces a bandaid fix for duplicate entries in the atomic database. Since this is a carsus issue we only throw a warning and remove duplicate entries alltogether. Once an upstream fix is available, the warning should be replaces and instead an error should be raised.

tardis/plasma/properties/atomic.py:472

if level_idxs2line_idx.index.duplicated().any():
    logger.warn(
        "Duplicate indices in level_idxs2line_idx. "
        "Dropping duplicates. "
        "This is an issue with the atomic data & carsus. "
        "Once fixed upstream, this warning will be removed. "
        "This will raise an error in the future instead. "
        "See https://github.com/tardis-sn/carsus/issues/384"
    )
    # This is necessary since pd.DataFrame.drop_duplicates()
    # does not remove duplicates if the data is different
    # and only the index is duplicated. See the example given
    # in the pandas documentation:
    # https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.drop_duplicates.html
    level_idxs2line_idx = level_idxs2line_idx[
        ~level_idxs2line_idx.index.duplicated()
    ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants