def get_source_pars(src):
    """Extract the parameters associated with a pyLikelihood Source object.

    """

    fnmap = src.getSrcFuncs()

    keys = fnmap.keys()

    if 'Position' in keys:
        ppars = get_function_pars(src.getSrcFuncs()[str('Position')])
    elif 'SpatialDist' in keys:
        ppars = get_function_pars(src.getSrcFuncs()[str('SpatialDist')])
    else:
        raise Exception('Failed to extract spatial parameters.')

    fn = src.getSrcFuncs()[str('Spectrum')]
    spars = get_function_pars(fn)

    for i, p in enumerate(ppars):
        ppars[i]['is_norm'] = False

    for i, p in enumerate(spars):

        if fn.normPar().getName() == p['name']:
            spars[i]['is_norm'] = True
        else:
            spars[i]['is_norm'] = False

    return spars, ppars
def get_source_pars ( src ) : fnmap = src . getSrcFuncs ( ) keys = fnmap . keys ( ) if 'Position' in keys : ppars = get_function_pars ( src . getSrcFuncs ( ) [ str ( 'Position' ) ] ) elif 'SpatialDist' in keys : ppars = get_function_pars ( src . getSrcFuncs ( ) [ str ( 'SpatialDist' ) ] ) else : raise Exception ( 'Failed to extract spatial parameters.' ) fn = src . getSrcFuncs ( ) [ str ( 'Spectrum' ) ] spars = get_function_pars ( fn ) for i , p in enumerate ( ppars ) : ppars [ i ] [ 'is_norm' ] = False for i , p in enumerate ( spars ) : if fn . normPar ( ) . getName ( ) == p [ 'name' ] : spars [ i ] [ 'is_norm' ] = True else : spars [ i ] [ 'is_norm' ] = False return spars , ppars
Extract the parameters associated with a pyLikelihood Source object.