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

[BUG]: "Run" in Edit model runs the code on the output model, not on the input model #5184

Open
liunelson opened this issue Oct 17, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@liunelson
Copy link
Member

Describe the bug

Clicking "Run" in the Edit model operator multiple times runs the code on the model sequentially (i.e. on the output model), instead of always running it on the input model of the operator.

If the code adds a transition to a model, clicking "Run" n times adds the same template to the model n times.

For example, I clicked "Run" 3 times and 3 "Death" transitions/templates (H * μ) are added.

concepts_name_map = model.get_concepts_name_map()
subject_concept = concepts_name_map.get("H")

parameter_unit = Unit(expression = 1 / sympy.Symbol("day"))
parameters = {
    "μ": Parameter(name = "μ", value = 1.0, units = parameter_unit, description = "Rate of death due to infection")
}

model = model.add_template(
    template = NaturalDegradation(
        subject = subject_concept,
        rate_law = safe_parse_expr("μ * H", local_dict=_clash),
        name = "Death"
    ),
    parameter_mapping = parameters
)

Image

Expected behavior

Clicking "Run" should always run the code on the original, input model.
This ensures that the code on the left is what's needed to reproduce the model on the right.
It allows the user to make edits incrementally, testing out the code on the model without having to start from scratch.

@liunelson liunelson added the bug Something isn't working label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants