Borealis-BioModeling / pysb-units

PySB add-on providing utilities to add units to models and perform dimensional analysis.
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Set global units for a model #3

Closed blakeaw closed 1 week ago

blakeaw commented 1 week ago

Some type of class or function that allows users to set key units (at least concentration and time) for a model and then have automatic conversion of related parameters automatically.

Maybe something like:

units.ModelUnits(concentration='uM', time='s') --> maybe units.SimulationUnits(...) might make more sense as a name. and then when you define parameters with units:

Parameter('R_0', 10.)
Unit(R_0, 'nM')

the Unit would register that R_0 has a concentration unit and automatically convert from nM to uM, the global concentration unit for that model.

blakeaw commented 1 week ago

Or another approach might be to have units.SimulationUnits(...) be applied outside of the model definition as in:

from mymodel import model
import pysb.units as units
units.SimulationUnits(model, concentration='uM', time='s')

Although, then we'd have to update parameters and expression units.

blakeaw commented 1 week ago

I will close this one as PR https://github.com/Borealis-BioModeling/pysb-units/pull/4 addresses this with the new SimulationUnits object that can be included in the model definition.