gyorilab / mira

MIRA modeling framework
BSD 2-Clause "Simplified" License
9 stars 7 forks source link

Duplicated template names after stratification #348

Closed mwdchang closed 2 months ago

mwdchang commented 2 months ago

When running the following code snippet with the attached model

f = open("shawn/sierdh.json")
amr = json.load(f)
mmt = model_from_json(amr)

mmt2 = stratify(mmt,
    key="vax",
    strata=[
        "u",
        "v"
    ],
    concepts_to_stratify = ["S", "E", "I"],
    # params_to_stratify = ["r_{IH}", "r_{IR}"], 
    cartesian_control = True,
    structure = None,
    param_renaming_uses_strata_names = True               
);

It looks like the template names are duplicated in the resulting mmt2, should we expect template names to be unique within a single model?

for t in mmt2.templates:
    print(t.name)

When transforming back into a petrinet amr, the rates (semantics.ode.rates) are likewise duplicated:

testAmr = template_model_to_petrinet_json(mmt2)

for r in testAmr["semantics"]["ode"]["rates"]:
    print(r["target"], " = ", r["expression"])
...snipped
t0_u_v  =  I_v*S_u*β_u_v
t0_v_u  =  I_u*S_v*β_v_u
t0_u_v  =  S_u*p_u_v
t0_v_u  =  S_v*p_v_u
...snipped

sierdh.json