Last active
January 13, 2019 02:11
-
-
Save jehiah/6b8203e85c29865071a5c5869b6b69cd to your computer and use it in GitHub Desktop.
Calculate the ratio of ingredients needed for the perfect quantity of pizza dough
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Calculate the ratio of ingredients needed for the perfect quantity of pizza dough | |
# | |
# $ pizza.py --target-oz=49 | |
# target: 49.00oz 1389gram | |
# flour: 800 grams (400 x 2) | |
# water: 520 grams | |
# salt: 16 grams | |
# sugar: 12 grams | |
# oil: 40 grams | |
# yeast: 12 grams | |
import tornado.options | |
from decimal import Decimal | |
if __name__ == "__main__": | |
tornado.options.define("target_gram", type=Decimal, default=None) | |
tornado.options.define("target_oz", type=Decimal, default=None) | |
tornado.options.define("hydration", type=Decimal, default=Decimal(".65")) | |
tornado.options.options.parse_command_line() | |
o = tornado.options.options | |
gram_per_oz = Decimal("28.349523125") | |
if o.target_gram: | |
target = o.target_gram | |
target_oz = o.target_gram / gram_per_oz | |
else: | |
target = o.target_oz * gram_per_oz | |
target_oz = o.target_oz | |
print "target: %0.2foz %dgram" % (target_oz, target) | |
salt = Decimal(".02") | |
sugar = Decimal(".015") | |
flour = Decimal("1") | |
yeast = Decimal(".015") | |
oil = Decimal(".05") | |
water = tornado.options.options.hydration | |
base = flour + water + oil + salt + sugar | |
scale = target / base | |
cup_of_flour=Decimal("120") | |
print "flour: %d grams (%dg x 2) (%0.1f cups)" % (flour * scale, flour * scale * Decimal(".5"), (flour * scale) / cup_of_flour) | |
print "water: %d grams (%0.1f%% hydration)" % (water * scale, water * 100) | |
print "salt: %d grams" % (salt * scale) | |
print "sugar: %d grams" % (sugar * scale) | |
print "oil: %d grams" % (oil * scale) | |
print "yeast: %d grams" % (yeast * scale) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment