def get_label(parameter, ptype, flavor=None, mpl=None):
    """Return the label of a given SIP parameter

    Parameters
    ----------
    parameter: string
        type of parameter, e.g. rmag|rpha|cre|cim
    ptype: string
        material|meas. Either return the material property (e.g. resistivity)
        or the measurement parameter (e.g., impedance)
    flavor: string, optional
        if set, must be one of latex|mathml. Return a label for latex
        processing, or for mathml processing
    mpl: matplotlib, optional
        if set, infer flavor from mpl.rcParams. Will not be used if flavor is
        set

    Returns
    -------
    label: string
        the requested label
    """
    # determine flavor
    if flavor is not None:
        if flavor not in ('latex', 'mathml'):
            raise Exception('flavor not recognized: {}'.format(flavor))
    else:
        if mpl is None:
            raise Exception('either the flavor or mpl must be provided')
        rendering = mpl.rcParams['text.usetex']
        if rendering:
            flavor = 'latex'
        else:
            flavor = 'mathml'

    # check if the requested label is present
    if parameter not in labels:
        raise Exception('parameter not known')
    if ptype not in labels[parameter]:
        raise Exception('ptype not known')
    if flavor not in labels[parameter][ptype]:
        raise Exception('flavor not known')

    return labels[parameter][ptype][flavor]
def get_label ( parameter , ptype , flavor = None , mpl = None ) : if flavor is not None : if flavor not in ( 'latex' , 'mathml' ) : raise Exception ( 'flavor not recognized: {}' . format ( flavor ) ) else : if mpl is None : raise Exception ( 'either the flavor or mpl must be provided' ) rendering = mpl . rcParams [ 'text.usetex' ] if rendering : flavor = 'latex' else : flavor = 'mathml' if parameter not in labels : raise Exception ( 'parameter not known' ) if ptype not in labels [ parameter ] : raise Exception ( 'ptype not known' ) if flavor not in labels [ parameter ] [ ptype ] : raise Exception ( 'flavor not known' ) return labels [ parameter ] [ ptype ] [ flavor ]
Return the label of a given SIP parameter

    Parameters
    ----------
    parameter: string
        type of parameter, e.g. rmag|rpha|cre|cim
    ptype: string
        material|meas. Either return the material property (e.g. resistivity)
        or the measurement parameter (e.g., impedance)
    flavor: string, optional
        if set, must be one of latex|mathml. Return a label for latex
        processing, or for mathml processing
    mpl: matplotlib, optional
        if set, infer flavor from mpl.rcParams. Will not be used if flavor is
        set

    Returns
    -------
    label: string
        the requested label