matthiaskoenig / pkdb

Pharmacokinetics database
https://alpha.pk-db.com
30 stars 7 forks source link

Dimensionality error in pharmacokinetics for doses per bodyweight [mg/kg] #529

Closed matthiaskoenig closed 4 years ago

matthiaskoenig commented 4 years ago

Currently some hard unit checks which have to be adapted for doses per bodyweight.

        try:
            (dose.units/self.Q_("liter")).to(concentration.units)
        except DimensionalityError as err:
            warnings.warn(f"dose.units/liter ({dose.units}/liter) must be convertible "
                          f"to concentration ({concentration.units}). Check that dose "
                          f"units are correct.")
            raise err
matthiaskoenig commented 4 years ago

This seems to be due to a pint bug https://github.com/hgrecco/pint/issues/1058 Trying to find a workaround.

matthiaskoenig commented 4 years ago

Solved with latest commits.