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

Add catch for missing elements in SDEC plot #1517

Merged
merged 4 commits into from
Apr 5, 2021

Conversation

MarkMageeAstro
Copy link
Contributor

@MarkMageeAstro MarkMageeAstro commented Mar 26, 2021

This fixes #1516.

The elements coloured in the plot are determined via the absorption and emission. It's possible however, that these elements are not the same, e.g. if you specify a limited wavelength range. For example, you could have a small wavelength region where Fe is absorbed, but not emitted. This could give an error if you try to plot an element not in the emission dataframe, for example. This adds a try statement to catch this case.

How Has This Been Tested?

  • Testing pipeline
  • Reference Data Comparison following these instructions
  • Other (please describe)
    I've tried artificially adding new elements to the elements list that are not included in the model. This produces the following:

Screenshot 2021-03-26 at 16 26 49

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • None of the above (please describe)

Checklist:

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have built the documentation on my fork following these instructions
  • I have assigned and requested two reviewers for this pull request

The elements coloured in the plot are determined via the absorption and emission. It's possible however, that these elements are not the same, e.g. if you specify a limited wavelength range. This could give an error if you try to plot an element not in the emission dataframe, for example. This adds a try statement to catch this case
@codecov
Copy link

codecov bot commented Mar 26, 2021

Codecov Report

Merging #1517 (eedae7a) into master (8239d29) will decrease coverage by 0.13%.
The diff coverage is n/a.

❗ Current head eedae7a differs from pull request most recent head 26078cd. Consider uploading reports for the commit 26078cd to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1517      +/-   ##
==========================================
- Coverage   67.70%   67.57%   -0.14%     
==========================================
  Files          68       68              
  Lines        6091     6103      +12     
==========================================
  Hits         4124     4124              
- Misses       1967     1979      +12     
Impacted Files Coverage Δ
tardis/tardis/visualization/tools/sdec_plot.py 14.17% <0.00%> (-0.71%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8239d29...26078cd. Read the comment docs.

Copy link
Member

@jamesgillanders jamesgillanders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran some checks and you were right about the original code throwing an error in the narrow wavelength regime if there were different emission and absorption elements, so good spot! Ran some tests with the proposed fix, and it works perfectly. The output message on the exception is a particularly nice feature. Good job!

Copy link
Member

@jaladh-singhal jaladh-singhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@jaladh-singhal jaladh-singhal merged commit 8d7e44b into tardis-sn:master Apr 5, 2021
atharva-2001 pushed a commit to atharva-2001/tardis that referenced this pull request Oct 1, 2021
* Add catch for missing elements

The elements coloured in the plot are determined via the absorption and emission. It's possible however, that these elements are not the same, e.g. if you specify a limited wavelength range. This could give an error if you try to plot an element not in the emission dataframe, for example. This adds a try statement to catch this case

* Fixed typo

* Black formatting

* Fixed typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Potential issue with elements not in absorbed/emitted regions for SDEC plot
4 participants