Skip to content

Fix inconsistent densities as a result of repeated changes of electron fractions in prob3 #925

Open
thehrh wants to merge 2 commits intomasterfrom
fix/repeatedly_set_electron_fractions
Open

Fix inconsistent densities as a result of repeated changes of electron fractions in prob3 #925
thehrh wants to merge 2 commits intomasterfrom
fix/repeatedly_set_electron_fractions

Conversation

@thehrh
Copy link
Copy Markdown
Collaborator

@thehrh thehrh commented Apr 10, 2026

Bugs were present in both Layers.weight_density_to_YeFrac() and Layers.weight_density_to_YnFrac(), where the attribute self.rhos_unweighted—never self.rhos—should have been rescaled. A test function demonstrates the reproducibility of the densities of the Layers object.

The code snippet in #868 now yields consistent event counts:

modell = DistributionMaker("IceCube_3y_neutrinos.cfg")
print(modell.params.YeM.value) # 0.4957 dimensionless
verteilung = modell.get_outputs(return_sum=True)[0]
count = verteilung.num_entries
print(count) # 39180.40671817049
modell.params.YeM.value = 0.5 * ureg.dimensionless
print(modell.params.YeM.value) # 0.5 dimensionless
count = modell.get_outputs(return_sum=True)[0].num_entries
print(count) # 39179.68692132214
modell.params.reset_all()
print(modell.params.YeM.value) # 0.4957 dimensionless (initial value)
count = modell.get_outputs(return_sum=True)[0].num_entries
print(count) # 39180.40671817049 (initial value)
count = modell.get_outputs(return_sum=True)[0].num_entries
print(count) # 39180.40671817049 (initial value)

Fixes #868

@thehrh thehrh added this to the 4.3 milestone Apr 10, 2026
@thehrh thehrh added the bug label Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repeatedly setting electron fractions in prob3 yields inconsistent results

1 participant