Ejemplo n.º 1
0
def displayOrganisms(simple_organisms, n_organisms, n_generations):
    picture = np.zeros((n_generations, n_organisms, 3), 'uint8')

    # Normalise values into the range 0-255
    min_values = np.min(simple_organisms, axis=0)
    max_values = np.max(simple_organisms, axis=0)
    scale = 255 / (max_values - min_values)

    for i in range(len(min_values)):
        simple_organisms[:, i] -= min_values[i]
        simple_organisms[:, i] *= scale[i]

    #Add row of zeros for red colour
    zeros = np.zeros((len(simple_organisms), 1))
    colours = np.hstack((zeros, simple_organisms))

    organism = 0
    for x in range(n_generations):
        for y in range(n_organisms):

            picture[x, y, :] = colours[organism, :]
            organism += 1

    from imageIO import saveSurface
    saveSurface('evolution_pca.png', picture)
Ejemplo n.º 2
0
def displayOrganisms(simple_organisms, n_organisms, n_generations):
    picture = np.zeros((n_generations, n_organisms, 3), 'uint8')

    # Normalise values into the range 0-255
    min_values = np.min(simple_organisms, axis=0)
    max_values = np.max(simple_organisms, axis=0)
    scale = 255 / (max_values - min_values)


    for i in range(len(min_values)):
        simple_organisms[:,i] -= min_values[i]
        simple_organisms[:,i] *= scale[i]

    #Add row of zeros for red colour
    zeros = np.zeros((len(simple_organisms), 1))
    colours = np.hstack((zeros, simple_organisms))

    organism = 0
    for x in range(n_generations):
        for y in range(n_organisms):

            picture[x, y, :] = colours[organism, :]
            organism += 1

    from imageIO import saveSurface
    saveSurface('evolution_pca.png', picture)
Ejemplo n.º 3
0
def createImageOfProteinsPerGeneration(proteins_per_generation, filtered_proteins):

    import numpy as np
    width = len(proteins_per_generation)
    height = len(filtered_proteins)
    picture = np.zeros((width, height), 'uint64')

    for generation in range(len(proteins_per_generation)):
        for y, protein in enumerate(filtered_proteins):
            if protein in proteins_per_generation[generation]:
                picture[generation, y] = 255

    from imageIO import saveSurface
    saveSurface('test.png', picture)
Ejemplo n.º 4
0
def createImageOfProteinsPerGeneration(proteins_per_generation,
                                       filtered_proteins):

    import numpy as np
    width = len(proteins_per_generation)
    height = len(filtered_proteins)
    picture = np.zeros((width, height), 'uint64')

    for generation in range(len(proteins_per_generation)):
        for y, protein in enumerate(filtered_proteins):
            if protein in proteins_per_generation[generation]:
                picture[generation, y] = 255

    from imageIO import saveSurface
    saveSurface('test.png', picture)