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

Port tardis_opacities script from tardisanalysis #1580

Merged
merged 3 commits into from
Jun 29, 2021

Conversation

MarkMageeAstro
Copy link
Contributor

@MarkMageeAstro MarkMageeAstro commented May 20, 2021

Description
This PR is to copy over the existing tardis opacity script from the tardisanalysis repository. The tardis opacity script was originally written by @unoebauer.

The opacity script allows for the easy calculation of the following properties:

  • pure bound-bound opacity per shell
  • pure Thomson opacity per shell
  • Planck-mean opacity per shell
  • Planck-mean optical depth of each shell
  • Planck-mean optical depth, integrated from the ejecta surface

Motivation and context
tardisanalysis will eventually be closed. This is to keep the code current with tardis.

How has this been tested?

  • Testing pipeline.
  • Other.
    Comparisons with older version of the code.

Examples
The following snippet of code can be used to generate the plot shown below.

import tardis
import tardis_opacity as top

config = tardis.yaml_load("tardis_example.yml")
mdl = tardis.run_tardis(config)

# initialise opacity calculator
opacity_diag = top.opacity_calculator(mdl)
# get total opacity on a standard frequency grid for each cell
chi_tot = opacity_diag.kappa_tot
# midpoints of the frequency grid:
nu_grid = 0.5 * (opacity_diag.nu_bins[1:] + opacity_diag.nu_bins[:-1])

plt.loglog(nu_grid, chi_tot[:, 0], label = "cell #0")
plt.loglog(nu_grid, chi_tot[:, -1], label = "cell #19")

tardis_opacity_example

Type of change

  • Bug fix.
  • New feature.
  • Breaking change.
  • None of the above.

Checklist

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
    • (optional) I have built the documentation on my fork following the instructions.
  • I have assigned and requested two reviewers for this pull request.

Ported over opacities script from old tardis analysis
@codecov
Copy link

codecov bot commented May 20, 2021

Codecov Report

Merging #1580 (d98a303) into master (d361a22) will decrease coverage by 5.27%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1580      +/-   ##
==========================================
- Coverage   67.20%   61.93%   -5.28%     
==========================================
  Files          73       62      -11     
  Lines        6147     5729     -418     
==========================================
- Hits         4131     3548     -583     
- Misses       2016     2181     +165     
Impacted Files Coverage Δ
tardis/tardis/util/base.py 75.78% <0.00%> (-1.99%) ⬇️
tardis/tardis/montecarlo/montecarlo_numba/base.py 28.73% <0.00%> (-0.90%) ⬇️
tardis/tardis/simulation/base.py 85.16% <0.00%> (-0.47%) ⬇️
...dis/montecarlo/montecarlo_numba/numba_interface.py 49.62% <0.00%> (-0.38%) ⬇️
tardis/tardis/scripts/cmfgen2tardis.py 0.00% <0.00%> (ø)
tardis/tardis/plasma/properties/atomic.py 61.76% <0.00%> (ø)
...ntecarlo_numba/tests/test_numba_formal_integral.py
.../montecarlo/montecarlo_numba/tests/test_vpacket.py
...rdis/montecarlo/montecarlo_numba/tests/conftest.py
...s/montecarlo/montecarlo_numba/tests/test_packet.py
... and 16 more

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 d361a22...d98a303. Read the comment docs.

@wkerzendorf
Copy link
Member

@unoebauer this is the one I was talking about

@jaladh-singhal jaladh-singhal marked this pull request as draft June 17, 2021 19:06
@MarkMageeAstro MarkMageeAstro marked this pull request as ready for review June 22, 2021 13:16
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 think this is a great job @MarkMageeAstro - great to get this code updated and moved across to the main TARDIS repo. Happy for this to be merged, once a second reviewer signs off! Keep up the good work!

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.

I think it's fine to merge it, we can just add @unoebauer as co-author by adding Co-authored by: [email protected] at the end of squash commit message.

(I found this mail from git history - it's linked to his GitHub account)

@andrewfullard andrewfullard merged commit 5941658 into tardis-sn:master Jun 29, 2021
andrewfullard added a commit that referenced this pull request Jun 29, 2021
jaladh-singhal pushed a commit that referenced this pull request Jul 1, 2021
atharva-2001 pushed a commit to atharva-2001/tardis that referenced this pull request Oct 1, 2021
* Create opacities.py

Ported over opacities script from old tardis analysis

* Black formatting

* Remove header information
atharva-2001 pushed a commit to atharva-2001/tardis that referenced this pull request Oct 1, 2021
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.

6 participants