Created
September 8, 2017 12:37
-
-
Save ryanjdillon/4b34b4bf4c6f89b1fa084c76dffa2a00 to your computer and use it in GitHub Desktop.
Percent body compositions from percent lipids
This file contains hidden or 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
def perc_bc_from_lipid(perc_lipid, perc_water=None): | |
'''Calculate body composition component percentages based on % lipid | |
Calculation of percent protein and percent ash are based on those presented | |
in Reilly and Fedak (1990). | |
Args | |
---- | |
perc_lipid: ndarray | |
1D array of percent lipid values from which to calculate body composition | |
perc_water: ndarray | |
1D array of percent water values from which to calculate body | |
composition (Default `None`). If no values are passed, calculations are | |
performed with values from Biuw et al. (2003). | |
Returns | |
------- | |
perc_water: ndarray | |
1D array of percent water values | |
perc_protein: ndarray | |
1D array of percent protein values | |
perc_ash: ndarray | |
1D array of percent ash values | |
References | |
---------- | |
Biuw, M., 2003. Blubber and buoyancy: monitoring the body condition of | |
free-ranging seals using simple dive characteristics. Journal of | |
Experimental Biology 206, 3405–3423. doi:10.1242/jeb.00583 | |
Reilly, J.J., Fedak, M.A., 1990. Measurement of the body composition of | |
living gray seals by hydrogen isotope dilution. Journal of Applied | |
Physiology 69, 885–891. | |
''' | |
import numpy | |
# Cast iterables to numpy arrays | |
if numpy.iterable(perc_lipid): | |
perc_lipid = numpy.asarray(perc_lipid) | |
if numpy.iterable(perc_water): | |
perc_water = numpy.asarray(perc_water) | |
if not perc_water: | |
# TODO check where `perc_water` values come from | |
perc_water = 71.4966 - (0.6802721 * perc_lipid) | |
perc_protein = (0.42 * perc_water) - 4.75 | |
perc_ash = 100 - (perc_lipid + perc_water + perc_protein) | |
return perc_water, perc_protein, perc_ash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment