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

Gamma sampling documentation #2859

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

CePowers
Copy link
Contributor

📝 Description

Type: 📝 documentation

I created a new file for the gamma ray documentation about packet sampling. I also added a new citation to the tardis.bib file that is used in the packet sampling file.

📌 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.

@tardis-bot
Copy link
Contributor

tardis-bot commented Oct 15, 2024

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

11	W191	[ ] Indentation contains tabs
3	E999	[ ] SyntaxError: Expected a statement
1	W292	[*] No newline at end of file

Complete output(might be large):

docs/physics/tardisgamma/index.rst:1:1: E999 SyntaxError: Expected an expression
docs/physics/tardisgamma/packetsampling.rst:1:8: E999 SyntaxError: Simple statements must be separated by newlines or semicolons
docs/tardis.bib:1:1: E999 SyntaxError: Expected a statement
docs/tardis.bib:308:1: W191 Indentation contains tabs
docs/tardis.bib:309:1: W191 Indentation contains tabs
docs/tardis.bib:310:1: W191 Indentation contains tabs
docs/tardis.bib:311:1: W191 Indentation contains tabs
docs/tardis.bib:312:1: W191 Indentation contains tabs
docs/tardis.bib:313:1: W191 Indentation contains tabs
docs/tardis.bib:314:1: W191 Indentation contains tabs
docs/tardis.bib:315:1: W191 Indentation contains tabs
docs/tardis.bib:316:1: W191 Indentation contains tabs
docs/tardis.bib:317:1: W191 Indentation contains tabs
docs/tardis.bib:318:1: W191 Indentation contains tabs
docs/tardis.bib:367:2: W292 [*] No newline at end of file
Found 15 errors.
[*] 1 fixable with the `--fix` option.

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.60%. Comparing base (5f11626) to head (6c73d4d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2859      +/-   ##
==========================================
- Coverage   69.95%   69.60%   -0.36%     
==========================================
  Files         216      216              
  Lines       16077    16077              
==========================================
- Hits        11247    11190      -57     
- Misses       4830     4887      +57     

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

@tardis-bot
Copy link
Contributor

*beep* *bop*

Hi, human.

The docs workflow has succeeded ✔️

Click here to see your results.

@tardis-bot
Copy link
Contributor

tardis-bot commented Oct 15, 2024

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (81ec6e8) and the latest commit (644cf55).
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 [6ae9446d] <master>   | After [644cf55f]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 2.96±0.3μs                   | 3.65±0.2μs          | ~1.23   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 2.94±0.4μs                   | 3.50±0.2μs          | ~1.19   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 470±200ns                    | 551±100ns           | ~1.17   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 492±200ns                    | 561±200ns           | ~1.14   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 24.2±6μs                     | 22.0±5μs            | ~0.91   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
|          | 2.24±0.9μs                   | 1.92±1μs            | ~0.86   | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |
|          | 4.12±0.3ms                   | 3.51±0ms            | ~0.85   | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 561±100ns                    | 612±200ns           | 1.09    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |
|          | 40.9±20μs                    | 43.8±20μs           | 1.07    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |
|          | 754±0.6ns                    | 796±1ns             | 1.06    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 206±0.05ns                   | 215±0.5ns           | 1.04    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 7.17±1μs                     | 7.36±2μs            | 1.03    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |
|          | 1.21±0μs                     | 1.24±0μs            | 1.02    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 1.33±0.4μs                   | 1.35±0.4μs          | 1.02    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |
|          | 5.95±1μs                     | 6.06±0.7μs          | 1.02    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |
|          | 39.5±0.02s                   | 39.8±0.03s          | 1.01    | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                       |
|          | 66.1±0.2ms                   | 66.9±0.3ms          | 1.01    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 1.06±0m                      | 1.07±0m             | 1.00    | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                      |
|          | 2.07±0m                      | 2.07±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 1.69±0.01ms                  | 1.70±0.01ms         | 1.00    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |
|          | 2.42±0.4ms                   | 2.43±0.4ms          | 1.00    | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |
|          | 53.0±20μs                    | 51.5±20μs           | 0.97    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |
|          | 31.6±0.04μs                  | 30.8±0.02μs         | 0.97    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 2.70±0.01ms                  | 2.59±0.01ms         | 0.96    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |

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



We use the `radioactivedecay <https://radioactivedecay.github.io>` python package to calculate the number of decays in each channel for each shell and at every timestep for each isotope.
The composition is also updated after each timestep following :cite:`2024arXiv240308769G`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this citation is working correctly in the built docs.

===============


In the simulation, we use spherical symmetry where the ejecta is divided into multiple spherical shells. To find the mass of each shell we multiply the mass fractions of each of the elements and isotopes with the density. We can set the timespace for the simulation
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth mentioning spherical symmetry? I don't think spherical symmetry is specific to the gamma-ray part of the code. Perhaps just add a hyperlink to https://tardis-sn.github.io/tardis/physics/setup/model.html#Shell-Structure if you want to mention it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought it was relevant to mention at least how the ejecta is broken down into shells because it goes into how we find the mass of each shell. I added the hyperlink but if it still doesn't make sense to mention it, I can remove that part.



In the simulation, we use spherical symmetry where the ejecta is divided into multiple spherical shells. To find the mass of each shell we multiply the mass fractions of each of the elements and isotopes with the density. We can set the timespace for the simulation
to be between t\ :sub:`start`\ and t\ :sub:`end`\ using either a linear or a logarithmic scale.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this warrants more description. At least a short description of why you'd want to use one or the other timescales.

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.

4 participants