(genome, **arguments)
return int(mutations)
An allele-based mutator based on G1DListMutatorRealGaussian.

    Accepts the parameter *gauss_mu* and the *gauss_sigma* which
    respectively represents the mean and the std. dev. of the random
    distribution.
An allele-based mutator based on G1DListMutatorRealGaussian.
An allele - based mutator based on G1DListMutatorRealGaussian .
def G1DListMutatorAlleleGaussian(genome, **arguments):
    """An allele-based mutator based on G1DListMutatorRealGaussian.

    Accepts the parameter *gauss_mu* and the *gauss_sigma* which
    respectively represents the mean and the std. dev. of the random
    distribution.
    """
    if arguments["pmut"] <= 0.0:
        return 0
    listSize = len(genome)
    mutations = arguments["pmut"] * listSize

    mu = genome.getParam("gauss_mu")
    sigma = genome.getParam("gauss_sigma")
    if mu is None:
        mu = Consts.CDefG1DListMutRealMU
    if sigma is None:
        sigma = Consts.CDefG1DListMutRealSIGMA

    allele = genome.getParam("allele", None)
    if allele is None:
        Util.raiseException("to use this mutator, you must specify the 'allele' parameter", TypeError)

    if mutations < 1.0:
        mutations = 0
        for it in xrange(listSize):
            if Util.randomFlipCoin(arguments["pmut"]):
                final_value = genome[it] + rand_gauss(mu, sigma)
                assert len(allele[it].beginEnd) == 1, "only single ranges are supported"
                rangemin, rangemax = allele[it].beginEnd[0]
                final_value = min(final_value, rangemax)
                final_value = max(final_value, rangemin)
                genome[it] = final_value
                mutations += 1
    else:
        for it in xrange(int(round(mutations))):
            which_gene = rand_randint(0, listSize - 1)
            final_value = genome[which_gene] + rand_gauss(mu, sigma)
            assert len(allele[which_gene].beginEnd) == 1, "only single ranges are supported"
            rangemin, rangemax = allele[which_gene].beginEnd[0]
            final_value = min(final_value, rangemax)
            final_value = max(final_value, rangemin)
            genome[which_gene] = final_value
    return int(mutations)
def G1DListMutatorAlleleGaussian ( genome , * * arguments ) : if arguments [ "pmut" ] <= 0.0 : return 0 listSize = len ( genome ) mutations = arguments [ "pmut" ] * listSize mu = genome . getParam ( "gauss_mu" ) sigma = genome . getParam ( "gauss_sigma" ) if mu is None : mu = Consts . CDefG1DListMutRealMU if sigma is None : sigma = Consts . CDefG1DListMutRealSIGMA allele = genome . getParam ( "allele" , None ) if allele is None : Util . raiseException ( "to use this mutator, you must specify the 'allele' parameter" , TypeError ) if mutations < 1.0 : mutations = 0 for it in xrange ( listSize ) : if Util . randomFlipCoin ( arguments [ "pmut" ] ) : final_value = genome [ it ] + rand_gauss ( mu , sigma ) assert len ( allele [ it ] . beginEnd ) == 1 , "only single ranges are supported" rangemin , rangemax = allele [ it ] . beginEnd [ 0 ] final_value = min ( final_value , rangemax ) final_value = max ( final_value , rangemin ) genome [ it ] = final_value mutations += 1 else : for it in xrange ( int ( round ( mutations ) ) ) : which_gene = rand_randint ( 0 , listSize - 1 ) final_value = genome [ which_gene ] + rand_gauss ( mu , sigma ) assert len ( allele [ which_gene ] . beginEnd ) == 1 , "only single ranges are supported" rangemin , rangemax = allele [ which_gene ] . beginEnd [ 0 ] final_value = min ( final_value , rangemax ) final_value = max ( final_value , rangemin ) genome [ which_gene ] = final_value return int ( mutations )