Visual Suite Module

The Visuals Class

class src.biosim.visualization.Visuals(island, num_years_sim, ymax_animals=None, cmax_animals=None, img_base=None, img_fmt='png')[source]

Class handling the visual presentation, as well as storing of images

Parameters:
  • island (object) – Instance of Island
  • num_years_sim (int) – Number of years to simulate, used for line graph
  • ymax_animals (int or float) – Y-limit for line graph
  • cmax_animals (dict) – Density for heat maps with ‘Herbivore’ or ‘Carnivore’ as key
  • img_base (path) – Where to store pictures and make movie from
  • img_fmt (filetype) – Default: ‘png’
cell_colors

cell type to color name

Type:dict
density_heatmap

animal type to int value

Type:dict
draw_animals_over_time(island)[source]

Draw line graph for herbivores and carnivores over time.

Parameters:island (object) – Instance of Island
draw_geography()[source]

Draws pixels for geography with right colors

draw_geography_exp()[source]

Creates legend for geography map

draw_heat_map_carnivore(heat_map)[source]

Draws heat map

Parameters:heat_map (list) – Nested list with int
draw_heat_map_herbivore(heat_map)[source]

Draws heat map

Parameters:heat_map (list) – Nested list with int
empty_nested_list()[source]

Creates an empty list indexed by y and x (row, columns) :returns: empty_nested_list – Nested list :rtype: list

get_data_heat_map(island, data_type)[source]

Could have also used pandas DF to get data.

Parameters:
  • island (class instance of Island) –
  • data_type (str) – num_animals, num_herbivores or num_carnivores
make_color_pixels(island)[source]

Creates a list indexed by [y][x] that represents an color by type of cell. The color is collected from a class variable called color_params

For example: pixel_colors[0][0] = the color code for cyan in rgba
(since all cell at the edges shall be ocean)
Parameters:island (instance of a map) –
Returns:pixel_colors – Nested with triplets of rgb-values
Return type:list
save_fig()[source]

Saves the figure at desired destination

setup_graphics(island)[source]

Sets up graphics and places figures in the right place.

Parameters:island (object) – Instance of Island
update_animals_over_time(island)[source]

Collect data from island instance to plot graph

Parameters:island (object) – Instance of Island
update_fig(island)[source]

Updates the figure

update_heat_maps(island)[source]

Gets new data for heat map from island

Parameters:island (object) – Instance of Island
update_year(island)[source]

Updates title of map to current year