Tools (

The package with different tools serving as helpers in other modules.

alias of

Color Manipulation Functions (

The collection of color conversion helpers.


Bases: object

Different approaches for rendering the genome’s color.

static modular(genome, divider)

Convert genome bit value to RGB color using modular division.

This algorithm simply divides the genome value by some modulo, normalize it and use as a hue with maximum saturation/value.

As a result, you could check by eye how genomes behave inside each group, since similar genomes most likely will have distinctive colors.

  • genome – Genome as integer (bit) sequence.
  • divider – Divider for the modular division.

tuple (red, green, blue)

static positional(genome, num_genes)

Convert genome bit value to RGB color using ones’ positions.

This algorithm treats positions of ‘1’ in binary genome representation as a hue with maximum saturation/value (as in HSV model), then blends them together to produce the final RGB color. Genome length (second argument) is essential to calculate genes’ positions in [0, 1] range.

As a result, two genomes will look similar visually if they have a little difference in genes. That could help in the quick detection of genome groups by eye.

  • genome – Genome as integer (bit) sequence.
  • num_genes – Genome length in bits.

tuple (red, green, blue), saturation, value)

Convert HSV color to RGB format.

  • hue – Hue value [0, 1]
  • saturation – Saturation value [0, 1]
  • value – Brightness value [0, 1]

tuple (red, green, blue)

Genetics Functions (

The collection of functions for genetics manipulations., num_genes, *genomes, max_genes=None, mutation_prob=0, rng_name='rng')

Crossover given genomes in stochastic way.

  • state – A container holding model’s properties.
  • num_genes – Genome length, assuming all genomes has the same number of genes.
  • genomes – A list of genomes (integers) to crossover
  • max_genes – Upper limit for ‘1’ genes in the resulting genome.
  • mutation_prob – Probability of a single gene’s mutation.
  • rng_name – Name of RandomProperty.

Single integer, a resulting genome.

CA Rules Functions (

The module with different helpers for CA rules.


Bases: object

Life-like rules helpers.

static golly2int(golly_str)

Convert a string in the Golly format to inner rule representation.

Parameters:golly_str – Rule in the Golly format (e.g. B3/S23)
Returns:Integer representation of the rule for inner use.
static int2golly(rule)

Convert inner rule representation to string in the Golly format.

Parameters:rule – Integer representation of the rule.
Returns:Golly-formatted rule (e.g. B3/S23).

Math Functions (

The module with bindings to CUDA math functions.


Bases: object

Static class holding all math functions.

static exp(val)

Calculate exponent.

static float(val)

Cast a value to float.

static int(val)

Cast a value to int.

static max(*args)

Calculate the maximum over list of args.

static min(*args)

Calculate the minimum over list of args.

static popc(val)

Count the number of bits that are set to ‘1’ in a 32 bit integer.