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

Fix Virtual Packet Logging Bug #1846

Merged
merged 2 commits into from
Jan 6, 2022
Merged

Conversation

atharva-2001
Copy link
Member

Resolves #1764

Description

The montecarlo_configuration.VPACKET_LOGGING in the montecarlo_main_loop function was being cached.
This prevented variables related to virtual packets from populating and raised an error. Passing virtual_packet_logging in the montecarlo_main_loop function fixes this.

if montecarlo_configuration.VPACKET_LOGGING:
for vpacket_collection in vpacket_collections:
vpackets_nu = vpacket_collection.nus[: vpacket_collection.idx]
vpackets_energy = vpacket_collection.energies[
: vpacket_collection.idx
]
vpackets_initial_mu = vpacket_collection.initial_mus[
: vpacket_collection.idx
]
vpackets_initial_r = vpacket_collection.initial_rs[
: vpacket_collection.idx
]
virt_packet_nus.append(np.ascontiguousarray(vpackets_nu))
virt_packet_energies.append(np.ascontiguousarray(vpackets_energy))
virt_packet_initial_mus.append(
np.ascontiguousarray(vpackets_initial_mu)
)
virt_packet_initial_rs.append(
np.ascontiguousarray(vpackets_initial_r)
)
virt_packet_last_interaction_in_nu.append(
np.ascontiguousarray(
vpacket_collection.last_interaction_in_nu[
: vpacket_collection.idx
]
)
)
virt_packet_last_interaction_type.append(
np.ascontiguousarray(
vpacket_collection.last_interaction_type[
: vpacket_collection.idx
]
)
)
virt_packet_last_line_interaction_in_id.append(
np.ascontiguousarray(
vpacket_collection.last_interaction_in_id[
: vpacket_collection.idx
]
)
)
virt_packet_last_line_interaction_out_id.append(
np.ascontiguousarray(
vpacket_collection.last_interaction_out_id[
: vpacket_collection.idx
]
)
)

Motivation and context

Resolves #1764 and partially solves failing SDEC tests problem #1752

How has this been tested?

  • Testing pipeline.
  • Other.

Examples

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.

@codecov
Copy link

codecov bot commented Dec 19, 2021

Codecov Report

Merging #1846 (5a730d9) into master (c34beca) will decrease coverage by 0.38%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1846      +/-   ##
==========================================
- Coverage   58.04%   57.65%   -0.39%     
==========================================
  Files          66       66              
  Lines        6747     6809      +62     
==========================================
+ Hits         3916     3926      +10     
- Misses       2831     2883      +52     
Impacted Files Coverage Δ
...dis/montecarlo/montecarlo_numba/numba_interface.py 35.46% <0.00%> (-10.69%) ⬇️
tardis/tardis/montecarlo/montecarlo_numba/base.py 25.00% <0.00%> (-1.22%) ⬇️
tardis/tardis/analysis.py 30.16% <0.00%> (ø)
tardis/tardis/visualization/tools/sdec_plot.py 9.52% <0.00%> (ø)
...rdis/tardis/montecarlo/montecarlo_configuration.py 100.00% <0.00%> (ø)
tardis/tardis/montecarlo/base.py 88.94% <0.00%> (+0.17%) ⬆️
.../montecarlo/montecarlo_numba/single_packet_loop.py 29.78% <0.00%> (+2.66%) ⬆️

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 c34beca...5a730d9. Read the comment docs.

@tardis-bot
Copy link
Contributor

Before a pull request is accepted, it must meet the following criteria:

  • Is the necessary information provided?
  • Is this a duplicate PR?
    • If a new PR is clearly a duplicate, ask how this PR is different from the original PR?
    • If this PR is about to be merged, close the original PR with a link to this new PR that solved the issue.
  • Does it pass existing tests and are new tests provided if required?
    • The test coverage should not decrease, and for new features should be close to 100%.
  • Is the code tidy?
    • No unnecessary print lines or code comments.

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.

Please update the docstring for montecarlo_main_loop. You don't need to document all the other inputs, just the one you've added.

@andrewfullard andrewfullard merged commit cafbed8 into tardis-sn:master Jan 6, 2022
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.

Enabling virtual_packet_logging causes error
4 participants