backup

crowd_to_dict

Contains functions to represent the crowd data in dictionary format.

configuration.backup.crowd_to_dict.get_light_agents_params(current_crowd)[source]

Retrieve the physical and geometric parameters of all agents in a structured format.

Parameters:

current_crowd (Crowd) -- The current crowd object containing agent data.

Returns:

A dictionary containing agent data for all agents in the crowd.

Return type:

StaticCrowdDataType

configuration.backup.crowd_to_dict.get_static_params(current_crowd)[source]

Retrieve the physical and geometric parameters of all agents in a structured format.

Parameters:

current_crowd (Crowd) -- The current crowd object containing agent data.

Returns:

Static parameters of all agents in the crowd.

Return type:

StaticCrowdDataType

configuration.backup.crowd_to_dict.get_dynamic_params(current_crowd)[source]

Retrieve the physical and geometric parameters of all agents in a structured format.

Parameters:

current_crowd (Crowd) -- The current crowd object containing agent data.

Returns:

Dynamical parameters for all agents in the crowd.

Return type:

DynamicCrowdDataType

configuration.backup.crowd_to_dict.get_geometry_params(current_crowd)[source]

Retrieve the parameters of the boundaries.

Parameters:

current_crowd (Crowd) -- The current crowd object containing agent data.

Returns:

A dictionary containing the geometric parameters of the boundaries, including dimensions (Lx and Ly) and wall corner data.

Return type:

GeometryDataType

configuration.backup.crowd_to_dict.get_interactions_params(current_crowd)[source]

Retrieve the parameters for agent interactions.

Parameters:

current_crowd (Crowd) -- The current crowd object containing agent data.

Returns:

A dictionary containing the parameters for agent interactions.

Return type:

InteractionsDataType

configuration.backup.crowd_to_dict.get_materials_params()[source]

Retrieve the parameters of the materials.

Returns:

A dictionary containing the parameters of the materials.

Return type:

MaterialsDataType

dict_to_xml_and_reverse

Contains functions to go from a dictionary representation of the crowd parameters to a XML representation and the reverse.

configuration.backup.dict_to_xml_and_reverse.save_light_agents_params_dict_to_xml(crowd_data_dict)[source]

Generate a pretty-printed XML string of agent parameters from a dictionary.

Parameters:

crowd_data_dict (StaticCrowdDataType) -- A dictionary containing static agent data for all agents in the crowd.

Returns:

A string representation of the dictionary.

Return type:

str

configuration.backup.dict_to_xml_and_reverse.static_dict_to_xml(crowd_dict)[source]

Convert a static crowd dictionary to a prettified XML representation.

Parameters:

crowd_dict (StaticCrowdDataType) -- Dictionary with agent data.

Returns:

UTF-8 encoded, pretty-printed XML representation of all agents' static parameters.

Return type:

bytes

configuration.backup.dict_to_xml_and_reverse.dynamic_dict_to_xml(dynamical_parameters_crowd)[source]

Convert a dictionary of agents' dynamic parameters to a prettified XML representation.

Parameters:

dynamical_parameters_crowd (DynamicCrowdDataType) -- Dictionary with agent data.

Returns:

UTF-8 encoded, pretty-printed XML representation of all agents' dynamic parameters.

Return type:

bytes

configuration.backup.dict_to_xml_and_reverse.geometry_dict_to_xml(boundaries_dict)[source]

Convert a dictionary of geometry data to a prettified XML representation.

Parameters:

boundaries_dict (GeometryDataType) -- Dictionary with boundary data.

Returns:

UTF-8 encoded, pretty-printed XML representation of the boundaries.

Return type:

bytes

configuration.backup.dict_to_xml_and_reverse.materials_dict_to_xml(material_dict)[source]

Convert a dictionary of material properties to a prettified XML representation.

Parameters:

material_dict (MaterialsDataType) -- Dictionary with material data.

Returns:

UTF-8 encoded, pretty-printed XML representation of the materials.

Return type:

bytes

configuration.backup.dict_to_xml_and_reverse.interactions_dict_to_xml(data)[source]

Convert a dictionary of interactions data to a prettified XML representation.

Parameters:

data (InteractionsDataType) -- Dictionary with interactions data.

Returns:

UTF-8 encoded, pretty-printed XML representation of all agents and their interactions.

Return type:

bytes

configuration.backup.dict_to_xml_and_reverse.static_xml_to_dict(xml_file)[source]

Convert an XML string representing agents' static data into a dictionary.

Parameters:

xml_file (str) -- XML data as a string.

Returns:

A dictionary representation of the XML data.

Return type:

StaticCrowdDataType

Raises:

ValueError -- If the XML structure or attribute types are incorrect.

configuration.backup.dict_to_xml_and_reverse.dynamic_xml_to_dict(xml_data)[source]

Convert an XML string representing agents' dynamic parameters into a dictionary.

Parameters:

xml_data (str) -- A string containing XML data.

Returns:

A dictionary representation of the XML data.

Return type:

DynamicCrowdDataType

Raises:

ValueError -- If the XML structure or attribute types are incorrect.

configuration.backup.dict_to_xml_and_reverse.geometry_xml_to_dict(xml_data)[source]

Convert an XML string representing geometric data into a dictionary.

Parameters:

xml_data (str) -- A string containing XML data.

Returns:

A dictionary representation of the XML data.

Return type:

GeometryDataType

Raises:

ValueError -- If the XML structure or attribute types are incorrect.

configuration.backup.dict_to_xml_and_reverse.materials_xml_to_dict(xml_data)[source]

Convert an XML string representing material properties into a dictionary.

Parameters:

xml_data (str) -- A string containing XML data.

Returns:

A dictionary representation of the XML data.

Return type:

MaterialsDataType

Raises:

ValueError -- If the XML structure or attribute types are incorrect.

configuration.backup.dict_to_xml_and_reverse.interactions_xml_to_dict(xml_data)[source]

Convert an XML string describing interactions between agents and with boundaries into a dictionary.

Parameters:

xml_data (str) -- A string containing XML data.

Returns:

A dictionary representation of the XML data.

Return type:

InteractionsDataType

Raises:

ValueError -- If the XML structure or attribute types are incorrect.

crowd_to_zip_and_reverse

Contains functions to export crowd data to a ZIP file and save it.

configuration.backup.crowd_to_zip_and_reverse.write_crowd_data_to_zip(current_crowd)[source]

Generate an in-memory ZIP file containing XML representations of the nested dictionaries that summarize the crowd parameters.

Parameters:

current_crowd (Crowd) -- The current crowd object containing the parameters to be saved.

Returns:

An in-memory ZIP file containing the XML representations of crowd parameters.

Return type:

io.BytesIO

configuration.backup.crowd_to_zip_and_reverse.save_crowd_data_to_zip(current_crowd, output_zip_path)[source]

Save crowd data as a ZIP file containing multiple XML files.

Parameters:
  • current_crowd (Crowd) -- The current crowd object containing the parameters to be saved.

  • output_zip_path (Path) -- The path where the ZIP file will be saved.

Raises:
  • TypeError -- If output_zip_path is not a Path object.

  • ValueError -- If output_zip_path does not have a .zip extension.

Return type:

None