boozelib

A Python module containing a couple of functions to calculate the blood alcohol content of people.

It’s at home at GitHub: https://github.com/brutus/boozelib/

Functions

The two main functions are:

boozelib.get_bac(age, weight, height, sex, volume, percent)[source]

Returns the Blood Alcohol Content (raise) for a person (described by the given attributes) after a drink containing volume ml of alcohol with the given percent (vol/vol).

boozelib.get_degradation(age, weight, height, sex, minutes)[source]

Returns the alcohol degradation (per mill) of a person with the given stats in the given number of minutes.

You can browse the full documentation online. Or you can get help with pydoc boozelib, if you already got boozelib installed.

Examples

>>> from boozelib import get_bac, get_degradation
>>> get_bac(32, 96, 186, False, 500, 4.9)
0.28773587455687716
>>> get_bac(32, 48, 162, True, 500, 4.9)
0.5480779730398769
>>> get_degradation(32, 96, 186, False, 60)
0.21139778538872606
>>> get_degradation(32, 48, 162, True, 60)
0.20133476560648536

Thanks and Contributions

  • Big hugs to Mathilda for hanging around and helping me figuring out all that math and biology stuff.

If you find any bugs, issues or anything, please use the issue tracker on GitHub.

Project Versions

Table Of Contents

Next topic

Install

This Page