Derive tissue density from lipids

    The equation calculating animal density is from Biuw et al. (2003), and
    default values for component densities are from human studies collected in
    the book by Moore et al. (1963).

    Args
    ----
    perc_lipid: float or ndarray
        Percent lipid of body composition
    dens_lipid: float
        Density of lipid in animal (Default 0.9007 g/cm^3)
    dens_prot: float
        Density of protein in animal (Default 1.34 g/cm^3)
    dens_water: float
        Density of water in animal (Default 0.994 g/cm^3)
    dens_ash: float
        Density of ash in animal (Default 2.3 g/cm^3)

    Returns
    -------
    dens_gcm3: float or ndarray
        Density of seal calculated from percent compositions and densities of
        components from Moore et al. (1963)

    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

    Moore FD, Oleson KH, McMurrery JD, Parker HV, Ball MR, Boyden CM. The Body
    Cell Mass and Its Supporting Environment - The Composition in Health and
    Disease. Philadelphia: W.B. Saunders Company; 1963. 535 p.
    ISBN:0-7216-6480-6

def lip2dens(perc_lipid, dens_lipid=0.9007, dens_prot=1.34, dens_water=0.994,
        dens_ash=2.3):
    '''Derive tissue density from lipids

    The equation calculating animal density is from Biuw et al. (2003), and
    default values for component densities are from human studies collected in
    the book by Moore et al. (1963).

    Args
    ----
    perc_lipid: float or ndarray
        Percent lipid of body composition
    dens_lipid: float
        Density of lipid in animal (Default 0.9007 g/cm^3)
    dens_prot: float
        Density of protein in animal (Default 1.34 g/cm^3)
    dens_water: float
        Density of water in animal (Default 0.994 g/cm^3)
    dens_ash: float
        Density of ash in animal (Default 2.3 g/cm^3)

    Returns
    -------
    dens_gcm3: float or ndarray
        Density of seal calculated from percent compositions and densities of
        components from Moore et al. (1963)

    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

    Moore FD, Oleson KH, McMurrery JD, Parker HV, Ball MR, Boyden CM. The Body
    Cell Mass and Its Supporting Environment - The Composition in Health and
    Disease. Philadelphia: W.B. Saunders Company; 1963. 535 p.
    ISBN:0-7216-6480-6
    '''
    import numpy

    # Cast iterables to numpy array
    if numpy.iterable(perc_lipid):
        perc_lipid = numpy.asarray(perc_lipid)

    perc_water, perc_protein, perc_ash = perc_bc_from_lipid(perc_lipid)

    dens_gcm3 = (dens_lipid * (0.01 * perc_lipid)) + \
                (dens_prot  * (0.01 * perc_protein)) + \
                (dens_water * (0.01 * perc_water)) + \
                (dens_ash   * (0.01 * perc_ash))

    return dens_gcm3