visuals package

Submodules

visuals.visual module

Backend for AGE-ABM Visual Interface @Author Max Hall @Co-Authors Meghan Ireland and Matthew Fleischman

class visuals.visual.VisualEnv(model)[source]

Bases: object

This is a base class which will store all the data relating to an instance of creating new visualisations using the GUI this includes storing a dictionary storing visulisation classes

get_list_visuals()[source]

Gets a list of all visual models added to the model.

Parameters

Returns

Attributelist[str]
Returns a list of visual model names
add_agent_visualisation(vis_name: str, agent_list: list[str], plot_data_type: str, plot_type: str, comp_of_interest: str = None, attr_of_interest: str = None)[source]

Adds agent to visualise to the visuals dictionary.

Parameters

vis_namestr

The name of visualise agent object.

agent_listlist[str]

List of agent names that the user would like to compare, the agent name in position 0 is the agent of focus.

comp_of_intereststr

This is the component of interest for this visualisation

attr_of_intereststr

This is the attribute of interest for this visualisation

plot_data_typestr

Specifies the type of data which the visual will show.

plot_typestr

Specifies the type of plot which will be generated.

Returns

error termint
Returns 0 on success
Returns 1 if plot_id already exist in the VisualEnv
Returns 2 if invalid characters used
Returns 3 if no agent names provided
Returns 4 if the plot data type is not a valid option
Returns 5 if the plot data type is not valid for provided agents
Returns 6 is the plot type is not valid
get_agent_visualisation(vis_name: str)[source]

Gets the VisualiseAgent object of the specified visual agent from the visuals dictionary.

Parameters

vis_namestr

The name of the visual agent object that must be returned.

Returns

error termint
Returns 1 if plot_id doesn’t exist in the VisualEnv yet
Returns 2 if invalid characters used
visuals[vis_name]VisualiseAgent
Returns the VisualiseAgent object on success
remove_agent_visualisation(vis_name: str)[source]

Removes the provided visual agent from the visuals dictionary.

Parameters

vis_namestr

The name of the VisualiseAgent object to be removed.

Returns

error termint
Returns 0 on success
Returns 1 if plot_id doesn’t exist in the VisualEnv yet
Returns 2 if invalid characters used
visualise_model(visual_plot_id: str)[source]

Generates a python file(s) necessary for the model to be visualised.

Parameters

visual_plot_idstr

The visual_plot_id of the plot to be written.

Returns

error termint
Returns 0 on success
Returns 1 if plot_id doesn’t exist in the VisualEnv yet

visuals.visual_classes module

Backend Classes for AGE-ABM Visualising @Author Max Hall @Co-Authors Meghan Ireland and Matthew Fleischman

class visuals.visual_classes.VisualiseAgent(visual_agent_name: str, compare_agent_list: list[str], plot_data_type: str, plot_type: str, comp_of_interest: str, attr_of_interest: str)[source]

Bases: object

This class is for agent visualisation purposes and stores details about an agent to visualise its desired plots

get_visual_agent_name()[source]

Gets the name of the agent to visualise.

Parameters

Returns

visual_agent_namestr
Returns name of the agent to return.
get_compare_agent_list()[source]

Gets the list of agents to be compared to the current visual agent.

Parameters

Returns

compare_agent_listlist[str]
Returns list of agent names to compare to be returned.
get_comp_of_interest()[source]

Gets the str of the comp_of_interest.

Parameters

Returns

comp_of_intereststr
Returns comp_of_interest string to be returned.
get_attr_of_interest()[source]

Gets the str of the attr_of_interest.

Parameters

Returns

attr_of_interest : str

Returns attr_of_interest string to be returned.
get_plot_data_type()[source]

Gets the str of the plot_data_type.

Parameters

Returns

plot_data_typestr
Returns plot_data_type string to be returned.
get_plot_type()[source]

Gets the str of the plot_type.

Parameters

Returns

plot_typestr
Returns plot_type string to be returned.

visuals.visualutils module

Backend Utility functions for Visualising @Author Max Hall @Co-Authors Meghan Ireland and Matthew Fleischman

class visuals.visualutils.WriteVisualFiles(model, visualiser)[source]

Bases: object

This is a base class which will allow us to complete the task of writing to the models visualisation files

create_visualisation_file_section(visual_plot_id: str)[source]

Writes the visualisation into its section.

Parameters

visual_plot_idstr

Specifies the visual plot id to be plotted

Returns

error termint

Returns 0 on success Returns 1 if creation fails, prints error message in terminal

create_visualisation_file(plot_name: str)[source]

Writes the main/runtime into the file.

Parameters

plot_namestr

The name of the plot which is being written and thus its filename

Returns

error termint

Returns 0 on success Returns 1 if write fails, prints error message in terminal

Module contents