Skip to content

Instantly share code, notes, and snippets.

@filyp
Created August 5, 2021 10:16
Show Gist options
  • Save filyp/034f60182a737bdbb5d9609d644724f7 to your computer and use it in GitHub Desktop.
Save filyp/034f60182a737bdbb5d9609d644724f7 to your computer and use it in GitHub Desktop.
Calculate theanine amount to add to tea, for the desired theanine/caffeine ratio.
def theanine_to_add(grams, ratio=1.5, flavor="black"):
caffeine_mg_per_gram = dict(
black=25,
yerba=10, # https://erowid.org/plants/yerba_mate/yerba_mate_chemistry2.shtml
pu_erh=12.5,
)
theanine_mg_per_gram = dict(
black=7.5, # other sources: 2.7, 12.5
yerba=0, # https://www.leaf.tv/articles/what-is-theanine-does-yerba-mate-contain-it/
)
theobromine_mg_per_gram = dict(
yerba=3.4, # https://erowid.org/plants/yerba_mate/yerba_mate_chemistry2.shtml
)
caffeine_content = caffeine_mg_per_gram[flavor] * grams
theanine_content = theanine_mg_per_gram[flavor] * grams
print(f"{caffeine_content=} {theanine_content=}")
target_theanine_content = caffeine_content * ratio
print(f"{target_theanine_content=}")
thanine_mg_to_add = target_theanine_content - theanine_content
theanine_grams_to_add = thanine_mg_to_add / 1000
print(f"\n{theanine_grams_to_add=}")
ml_of_water = 2.5 * theanine_grams_to_add
print(f"\n{ml_of_water=}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment