ensemble.tools package¶
Submodules¶
ensemble.tools.checkers module¶
Check module¶
This module contains functions to check
- ensemble.tools.checkers.check_library_path(library_path: str, simulation_platform: str)[source]¶
Returns true if platform is available
ensemble.tools.connector_configurator module¶
This module contains a base configurator to support methods and properties for the connector particularly tied to the ENSEMBLE project.
ensemble.tools.constants module¶
Constants module¶
This module contains a constants and default parameters. These parameters can be accessed at any time by whatever of the modules.
Some of the values here will be used to parametrize simulations to multiple platforms and some for specific ones. Specific zones within the source code have been marked to place the corresponding constant values. Please, use uppercase letters for defining new constant values.
- Example:
To use the
Constantsimport the module as:>>> import ensemble.tools.constants as ct >>> ct.BUFFER_STRING # access the buffer size
Variable
Description
BUFFER_STRINGBuffer size
DEFAULT_PATH_SYMUFLOWDefault Path Towards SymuVia
DEFAULT_LIB_OSXDefault OS X library path (SymuVia)
DEFAULT_LIB_LINUXDefault Linux library path (SymuVia)
DEFAULT_LIB_WINDOWSDefault Windows library path (Vissim)
DCT_SIMULATORSSimulator according to SO
DCT_DEFAULT_PATHSAvailable combinations SO/simulator
DCT_RUNTIME_PARAMRuntime default parameters
DCT_VEH_PARAMVehicle default parameters
DCT_VEH_DATAVehicle data default parameters
DCT_PLT_DATAPlatoon parameters
DCT_LIB_CACCDefault CACC library path
FIELD_DATAVehicle trajectory data
FIELD_FORMATTrajectory data types
HOUR_FORMATTime format
FIELD_FORMATAGGFormat aggretations
DCT_SIMULATION_INFO`XML Simulation information
DCT_EXPORT_INFOXML Export information
DCT_TRAFIC_INFOXML Traffic information
DCT_NETWORK_INFOXML Network information
DCT_SCENARIO_INFOXML Scenario information
TP_VEHTYPESVehicle type information
TP_ACCELVehicle acceleration boundaries
ensemble.tools.decorators module¶
Decorator utilities¶
This module contains a series of decorators in order to add logging functionalities to some of the class methods. The decorators are regularly purposed for logging, printing, neutering funcitons. etc.
- ensemble.tools.decorators.conditional(cond: bool, warning: str = '') Callable[source]¶
Disables the execution of the decorated method/function
- Parameters
cond (bool) – Flag to execute
warning (str, optional) – Warning to login. Defaults to “”.
- Returns
Wrapped method
- Return type
Callable
- ensemble.tools.decorators.logger_func(orig_func: Callable)[source]¶
Logs execution of a function/method and arguments into a file called with the function name
- Parameters
orig_func (Callable) – A function/method to be logged
- Returns
Wrapped method after log
- Return type
(Callable)
- ensemble.tools.decorators.printer_time(orig_func: Callable) Callable[source]¶
Prints in terminal the current time step of a simulation.
- Parameters
orig_func (Callable) – Connector class containing the simulationstep status via an attribute. Decorated method is run_step
- Returns
Wrapped step execution
- Return type
Callable
ensemble.tools.exceptions module¶
A module containing basic exception handlers for better error detection
- exception ensemble.tools.exceptions.EnsembleAPIError(error_message: str, target_dir: str = '')[source]¶
Bases:
Exception- property get_messsage: str¶
- property target_dir: str¶
- exception ensemble.tools.exceptions.EnsembleAPILoadFileError(error_message: str, target_dir: str = '')[source]¶
ensemble.tools.geometry module¶
Auxiliary geometry¶
ensemble.tools.screen module¶
Module to log on screen¶
- ensemble.tools.screen.log_error(message, *args, **kwargs) None[source]¶
Logs an error message in red
- ensemble.tools.screen.log_in_terminal(message: str, *args, **kwargs) None[source]¶
This function logs in the terminal a message with a specific color
- Parameters
message (str) – Message to log on the console
foreground (str) – Foreground color see click.style for options
- ensemble.tools.screen.log_success(message, *args, **kwargs) None[source]¶
Logs a success message in green