You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It might be interesting to see if the global units of a model set with SimulationUnits could be defined inside the units context manager. This would help simplify the model code.
However, it's unclear if this would work with the current units context setup. The pysb Model object would likely need to be defined before entering the units context, allowing the context manager to accept unit arguments and assign a SimulationUnits object to the model. So, it would look something like:
Then, as part of the units context initialization, it would define SimulationUnits(time="h", concentration="nM", volume="L") for the model.
This might also help facilitate dynamic changes to the model units by calling the units context outside the model definition. Something like:
frommy_modelimportmodelfrompsyb.unitsimportunitswithunits(time="s", concentration="uM", volume="pL"):
# do something with model, now with base units of s, uM, and pL...
However, some mechanism to iterate over the model components and update all units would be necessary in this case. Maybe the units context could check for an existing SimulationUnits object and then override and update component units.
The text was updated successfully, but these errors were encountered:
It might be interesting to see if the global units of a model set with
SimulationUnits
could be defined inside theunits
context manager. This would help simplify the model code.However, it's unclear if this would work with the current
units
context setup. The pysbModel
object would likely need to be defined before entering theunits
context, allowing the context manager to accept unit arguments and assign aSimulationUnits
object to the model. So, it would look something like:Then, as part of the
units
context initialization, it would defineSimulationUnits(time="h", concentration="nM", volume="L")
for the model.This might also help facilitate dynamic changes to the model units by calling the
units
context outside the model definition. Something like:However, some mechanism to iterate over the model components and update all units would be necessary in this case. Maybe the
units
context could check for an existingSimulationUnits
object and then override and update component units.The text was updated successfully, but these errors were encountered: