Skip to content
This repository has been archived by the owner on Oct 11, 2021. It is now read-only.

Name of FitParameter should not be mutable #441

Closed
redeboer opened this issue Jan 12, 2021 · 1 comment
Closed

Name of FitParameter should not be mutable #441

redeboer opened this issue Jan 12, 2021 · 1 comment
Assignees
Labels
Bug Something isn't working

Comments

@redeboer
Copy link
Member

Bug description

The FitParameters class uses the names of all FitParameter instances it contains as keys. However, it's still possible to change the FitParameter.name after it has been added.

How to reproduce?

import expertsystem as es

result = es.generate_transitions(
    initial_state=[("J/psi(1S)", [-1, 1])],
    final_state=["gamma", "pi0", "pi0"],
    allowed_intermediate_particles=["f(0)(980)", "f(0)(1500)"],
    allowed_interaction_types=["strong", "em"],
)
model = es.generate_amplitudes(result)
for particle in result.get_intermediate_particles():
    model.dynamics.set_breit_wigner(particle.name)

model.parameters["Width_f(0)(980)"].name = "trolling you"
assert "trolling you" in model.parameters  # <-- fails

Expected behavior

It should not be possible to change the name of a FitParameter.

@redeboer redeboer added the Bug Something isn't working label Jan 12, 2021
@redeboer redeboer self-assigned this Jan 12, 2021
@redeboer redeboer changed the title Name of FitParameter is mutable Name of FitParameter should not be mutable Jan 12, 2021
redeboer added a commit that referenced this issue Jan 12, 2021
@redeboer
Copy link
Member Author

Irrelevant since #454, even though it should be noted that sympy.Symbol shows the same behaviour.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant