utils package
Submodules
utils.helper_methods module
Helper Methods used in the AGE-ABM Visual Interface Backend @Author Matthew Fleischman @Co-Authors Meghan Ireland and Max Hall
- utils.helper_methods.get_data_types(agent)[source]
This function takes a agent as a parameter and gets its valid_plot_types.
Parameters
- agentAgentOfInterest
agent to be checked.
Returns
- valid_plot_data_typeslist[str]
- Returns the valid_plot_data_types for the given agent.
- utils.helper_methods.valid_plot_data_type(plot_data_type: str)[source]
This function takes a plot_data_type as a parameter and ensures that it is a valid plot_data_type.
Parameters
- plot_data_typestr
plot_data_type to be checked.
Returns
- plot_data_typestr
- Returns the plot_data_type if valid.Returns 1 if not valid
- utils.helper_methods.valid_plot_type(plot_type: str)[source]
This function takes a plot_type as a parameter and ensures that it is a valid plot_type.
Parameters
- plot_typestr
plot_type to be checked.
Returns
- plot_typestr
- Returns valid plot type on successReturns 1 if plot type invalid
- utils.helper_methods.adding_name_checker(name: str, list_to_go_in: list, is_attribute: bool = False)[source]
This function takes a name as a parameter and ensures that it is a valid python class name as well as is not an existing name already.
Parameters
- namestr
name to be checked.
- list_to_go_inlist[str]
list it will be put into
Returns
- error termstr
- Returns formatted name on successReturns 1 if name already in useReturns 2 if name uses invalid characters
- utils.helper_methods.getting_name_checker(name: str, list_to_come_from: list, is_attribute: bool = False)[source]
This function takes a name as a parameter and ensures that it is a valid python class name as well as is not an existing name already.
Parameters
- namestr
name to be checked.
- list_to_come_fromlist[str]
list it will be taken from
Returns
- error termstr
- Returns formatted name on successReturns 1 if name isn’t already in listReturns 2 if name uses invalid characters
- utils.helper_methods.name_validator(name: str)[source]
This function takes a name as a parameter and ensures that it is a valid python class name.
Parameters
- namestr
name to be checked.
Returns
- error termint
- Returns 0 on successReturns 1 if invalid chars used
- utils.helper_methods.plotting_string(indent: str, agent: str, attr: str, interest: str, plot_type: str, title: str, xlabel: str, ylabel: str, compare_agents: list[str])[source]
Method to help write plots to the visualisation ouptut file.
Parameters
- indentstr
Indentation for the plotting code.
- agentstr
Name of the agent whos data is being plotted.
- attrstr
Attribute data being plotted.
- intereststr
Data interests for the attribute being plotted.
- plot_typestr
Type of plot (line graph, scatter plot, bar graph).
- titlestr
Title of the plot.
- xlabelstr
Label of x-axis.
- ylabelstr
Label of y-axis.
- compare_agentslist[str]
List of agents to compare to the current agent whos data is being plotted.
Returns
- plotterstr
- Returns the compiled string to be written to the visualisation output file.