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

Gammaray opacity documentation #2876

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

CePowers
Copy link
Contributor

📝 Description

Type: 📝 documentation `

I started a new documentation file for the sources of opacity for gamma rays. I added information for Compton Scattering with plans to add other sources of opacity.

📌 Resources

Examples, notebooks, and links to useful references.

🚦 Testing

How did you test these changes?

  • Testing pipeline
  • Other method (describe)
  • My changes can't be tested (explain why)

☑️ Checklist

  • I requested two reviewers for this pull request
  • I updated the documentation according to my changes
  • I built the documentation by applying the build_docs label

Note: If you are not allowed to perform any of these actions, ping (@) a contributor.

@CePowers CePowers marked this pull request as draft November 12, 2024 14:16
@tardis-bot
Copy link
Contributor

tardis-bot commented Nov 12, 2024

*beep* *bop*
Hi human,
I ran ruff on the latest commit (e4ddc1e).
Here are the outputs produced.
Results can also be downloaded as artifacts here.
Summarised output:

5	E902	[ ] stream did not contain valid UTF-8
1	I001	[*] Import block is un-sorted or un-formatted
1	E999	[ ] SyntaxError: Expected an expression
1	W291	[*] Trailing whitespace

Complete output(might be large):

docs/physics/tardisgamma/images/all_coeffs.png:1:1: E902 stream did not contain valid UTF-8
docs/physics/tardisgamma/images/coeff_fractions.png:1:1: E902 stream did not contain valid UTF-8
docs/physics/tardisgamma/images/compton_scattering_coefficient.png:1:1: E902 stream did not contain valid UTF-8
docs/physics/tardisgamma/images/pair_production_coefficient.png:1:1: E902 stream did not contain valid UTF-8
docs/physics/tardisgamma/images/photoabsorption_coefficient.png:1:1: E902 stream did not contain valid UTF-8
docs/physics/tardisgamma/index.rst:1:1: E999 SyntaxError: Expected an expression
docs/physics/tardisgamma/opacities.ipynb:cell 6:1:1: I001 [*] Import block is un-sorted or un-formatted
docs/physics/tardisgamma/opacities.ipynb:cell 8:10:31: W291 [*] Trailing whitespace
Found 8 errors.
[*] 2 fixable with the `--fix` option.

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.17%. Comparing base (13c9a31) to head (e4ddc1e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2876      +/-   ##
==========================================
- Coverage   69.52%   69.17%   -0.35%     
==========================================
  Files         228      228              
  Lines       16429    16429              
==========================================
- Hits        11422    11365      -57     
- Misses       5007     5064      +57     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tardis-bot
Copy link
Contributor

tardis-bot commented Nov 12, 2024

*beep* *bop*

Hi, human.

The docs workflow has succeeded ✔️

Click here to see your results.

@tardis-bot
Copy link
Contributor

tardis-bot commented Nov 12, 2024

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (13c9a31) and the latest commit (e4ddc1e).
Here are the logs produced by ASV.
Results can also be downloaded as artifacts here.

Significantly changed benchmarks:

All benchmarks:

Benchmarks that have stayed the same:

| Change   | Before [13c9a314] <master>   | After [e4ddc1ef]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 3.56±0.01ms                  | 5.01±0.6ms          | ~1.41   | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 47.3±40μs                    | 62.8±30μs           | ~1.33   | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |
|          | 511±200ns                    | 611±100ns           | ~1.20   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 24.1±6μs                     | 27.1±8μs            | ~1.12   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
|          | 641±100ns                    | 571±200ns           | ~0.89   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 1.93±0.7μs                   | 1.71±0.2μs          | ~0.89   | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |
|          | 4.12±1μs                     | 3.23±0.6μs          | ~0.78   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 40.6±20μs                    | 44.1±20μs           | 1.09    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |
|          | 37.3±0.05μs                  | 39.6±0.06μs         | 1.06    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 203±0.1ns                    | 209±0.01ns          | 1.03    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 7.15±2μs                     | 7.40±2μs            | 1.03    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |
|          | 541±100ns                    | 551±200ns           | 1.02    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |
|          | 2.59±0.01ms                  | 2.64±0ms            | 1.02    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |
|          | 2.98±0.7μs                   | 3.03±0.3μs          | 1.02    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 2.52±0.4ms                   | 2.56±0.5ms          | 1.01    | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |
|          | 38.3±0s                      | 38.3±0.07s          | 1.00    | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                       |
|          | 1.04±0m                      | 1.04±0m             | 1.00    | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                      |
|          | 2.08±0m                      | 2.08±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 1.19±0μs                     | 1.19±0μs            | 1.00    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 63.0±0.09ms                  | 63.1±0.2ms          | 1.00    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 1.68±0ms                     | 1.66±0ms            | 0.99    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |
|          | 760±0.6ns                    | 739±0.5ns           | 0.97    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 6.22±0.6μs                   | 5.88±0.8μs          | 0.95    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |
|          | 2.12±1μs                     | 1.97±2μs            | 0.93    | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |

If you want to see the graph of the results, you can check it here

@CePowers CePowers marked this pull request as ready for review November 19, 2024 13:56
@CePowers CePowers marked this pull request as draft November 25, 2024 03:46
@CePowers CePowers marked this pull request as ready for review November 26, 2024 15:08
Copy link
Contributor

@andrewfullard andrewfullard left a comment

Choose a reason for hiding this comment

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

Would like to see units on the y-axis of each plot

docs/physics/tardisgamma/opacities.rst Outdated Show resolved Hide resolved
Photoabsorption
===============
This occurs when the photon is completely absorbed by a material. We assume that the :math:`\gamma`-ray deposits all of its energy when this occurs
The coefficient is:
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing a period before this line.

@jvshields
Copy link
Contributor

I think that this would be a lot more informative if all the different opacities were plotted together so you could more easily compare which opacity matters in which range. The text is fine and looks good, but I would definitely like to see the plots merged.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@@ -0,0 +1,363 @@
{
Copy link
Contributor

@jvshields jvshields Feb 3, 2025

Choose a reason for hiding this comment

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

Line #13.    plt.ylabel("Opacity (cm^-1)")

To make this look right, you want to do plt.ylabel(f"Opacity (cm$^{-1}$))


Reply via ReviewNB

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.

5 participants