def getaverageenergy(energyhistory):
    """
    Gets the average local energy on the current energyhistory

    :param energyhistory: the list of collected amplitudes
    :return: the average local energy
    """
    avg = 0
    for amp in energyhistory:
        avg += amp
    return avg/len(energyhistory)