Skip to content

Instantly share code, notes, and snippets.

@ryanjdillon
Last active June 22, 2017 17:42
Show Gist options
  • Save ryanjdillon/4e04ade04bc9e410d0813de611028676 to your computer and use it in GitHub Desktop.
Save ryanjdillon/4e04ade04bc9e410d0813de611028676 to your computer and use it in GitHub Desktop.
Seal lipid to body density calculation
def lip2dens(p_lipid, lipid_dens=0.9007, prot_dens=1.34, water_dens=0.994, a_dens=2.3):
'''Derive tissue density from lipids
Translated to python from R code written by Martin Biuw
'''
p_comps = perc_bc_from_lipid(p_lipid)
p_comps['density'] = (lipid_dens * (0.01 * p_comps['perc_lipid'])) + \
(prot_dens * (0.01 * p_comps['perc_protien'])) + \
(water_dens * (0.01 * p_comps['perc_water'])) + \
(a_dens * (0.01 * p_comps['perc_ash']))
return p_comps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment