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

Fixed distance parameter not producing accurate SDEC plots #1442

Merged
merged 4 commits into from
Feb 1, 2021

Conversation

jaladh-singhal
Copy link
Member

@jaladh-singhal jaladh-singhal commented Jan 29, 2021

Added lum_to_flux division factor in emission and absorption elements' histogram calculations. And modified distance docstring to use any length unit since calculations automatically convert it to CGS cm.

Motivation and Context

Fixes #1440

How Has This Been Tested?

  • Testing pipeline
  • Reference Data Comparison following these instructions
  • Other (please describe)

Plot looks as expected:
image

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

@codecov
Copy link

codecov bot commented Jan 29, 2021

Codecov Report

Merging #1442 (e27b8e8) into master (4c346f0) will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1442      +/-   ##
==========================================
- Coverage   71.16%   71.13%   -0.03%     
==========================================
  Files          67       67              
  Lines        5521     5523       +2     
==========================================
  Hits         3929     3929              
- Misses       1592     1594       +2     
Impacted Files Coverage Δ
tardis/tardis/widgets/sdec_plot.py 16.28% <0.00%> (-0.15%) ⬇️

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 4c346f0...ea343d5. 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.

Overall, looks good. Do we need a clause at line 501 for distances of 0, or negative values? Also, can we change the unit order for the flux axis to be erg/s/cm2/AA (just to be in line with convention)? Finally, can we make the units inside math mode not italicised?

@marxwillia
Copy link
Contributor

This looks good to me. @jaladh-singhal I believe the reason this happened in the first place is that in my version of the code, I adjusted the weights in the calculation stage, and my code had the plotting and calculation done in the same place. When you separated the two I think the lum_to_flux got lost.

@jaladh-singhal
Copy link
Member Author

jaladh-singhal commented Feb 1, 2021

Do we need a clause at line 501 for distances of 0, or negative values?

@jamesgillanders good point! Added one to raise ValueError

Also, can we change the unit order for the flux axis to be erg/s/cm2/AA (just to be in line with convention)?

Done!

Finally, can we make the units inside math mode not italicised?

In code, I checked that we're doing nothing to make units look italicized - I think this is how matplotlib renders latex in labels by default. Do you have any example in notice where it does not italicize, we can check its code & use that if you want?

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.

see my comments. Otherwise, looks good

tardis/widgets/sdec_plot.py Show resolved Hide resolved
tardis/widgets/sdec_plot.py Show resolved Hide resolved
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.

All issues now resolved - happy to merge

tardis/widgets/sdec_plot.py Show resolved Hide resolved
tardis/widgets/sdec_plot.py Show resolved Hide resolved
@jamesgillanders jamesgillanders merged commit 7f31e2b into tardis-sn:master Feb 1, 2021
atharva-2001 pushed a commit to atharva-2001/tardis that referenced this pull request Oct 1, 2021
…#1442)

* Added lum_to_flux divison in element hist calculations

* Raise error if distance <= 0

* changed unit order for the flux axis to be erg/s/cm2/AA

* Instructed how to use luminosity case in error message
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.

Fix distance parameter's functionality in generate_plot of SDECPlotter
4 participants