ecell / ecell4

An integrated software environment for multi-algorithm, multi-timescale, multi-spatial-representation simulation of various cellular phenomena
https://ecell4.e-cell.org/
GNU General Public License v3.0
17 stars 9 forks source link

Add a method to check units in a model #56

Closed kaizu closed 5 years ago

kaizu commented 5 years ago

pint is required.

from ecell4 import *
from ecell4_base.core import Quantity_Integer, Quantity_Real

with species_attributes():
    A | B | C | {}
    D | {'location': 'M'}
    M | {'dimension': 2, 'structure': True}

with reaction_rules():
    A + B > C | Quantity_Real(0.01, 'um**3/item/s')
    A + M > D | Quantity_Real(1.0, 'um/s')
    A > B | Quantity_Real(1.0, 'item/s') * A / (Quantity_Integer(120, 'item') + A)

m = get_model()

from ecell4.extra.unit_checker import check_units
check_units(m)  # Nothing would occur