trafficgen.read_files

Functions to read the files needed to build one or more traffic situations.

Functions

camel_to_snake(string)

Convert a camel case string to snake case.

convert_encounters(encounters)

Convert encounter data which is given in maritime units to SI units.

convert_keys_to_snake_case(data)

Convert keys in a nested dictionary from camel case to snake case.

convert_own_ship_initial_data(initial)

Convert own ship initial data which is given in maritime units to SI units.

convert_own_ship_waypoints(waypoints)

Convert own ship waypoint data which is given in maritime units to SI units.

convert_settings_data_from_maritime_to_si_units(...)

Convert situation data which is given in maritime units to SI units.

convert_ship_data_from_maritime_to_si_units(ship)

Convert ship static data which is given in maritime units to SI units.

convert_situation_data_from_maritime_to_si_units(...)

Convert situation data which is given in maritime units to SI units.

read_encounter_settings_file(settings_file)

Read encounter settings file.

read_generated_situation_files(situation_folder)

Read the generated traffic situation files.

read_own_ship_static_file(own_ship_static_file)

Read own ship static data from file.

read_situation_files(situation_folder)

Read traffic situation files.

read_target_ship_static_files(target_ship_folder)

Read target ship static data files.

trafficgen.read_files.camel_to_snake(string: str) str

Convert a camel case string to snake case.

trafficgen.read_files.convert_encounters(encounters: list[Encounter]) list[Encounter]

Convert encounter data which is given in maritime units to SI units.

Parameters:

encounters (list[Encounter]) – Encounter data to be converted

Returns:

encounters – Converted encounter data

Return type:

list[Encounter]

trafficgen.read_files.convert_keys_to_snake_case(data: dict[str, Any]) dict[str, Any]

Convert keys in a nested dictionary from camel case to snake case.

trafficgen.read_files.convert_own_ship_initial_data(initial: Initial) Initial

Convert own ship initial data which is given in maritime units to SI units.

Parameters:

initial (Initial) – Own ship initial data to be converted

Returns:

initial – Converted own ship initial data

Return type:

Initial

trafficgen.read_files.convert_own_ship_waypoints(waypoints: list[Waypoint]) list[Waypoint]

Convert own ship waypoint data which is given in maritime units to SI units.

Parameters:

waypoints (list[Waypoint]) – Waypoint data to be converted

Returns:

waypoints – Converted waypoint data

Return type:

list[Waypoint]

trafficgen.read_files.convert_settings_data_from_maritime_to_si_units(encounter_settings: EncounterSettings) EncounterSettings

Convert situation data which is given in maritime units to SI units.

Parameters:

encounter_settings (EncounterSettings) – Encounter settings data to be converted

Returns:

encounter_settings – Converted encounter settings data

Return type:

EncounterSettings

trafficgen.read_files.convert_ship_data_from_maritime_to_si_units(ship: ShipStatic) ShipStatic

Convert ship static data which is given in maritime units to SI units.

Parameters:

ship (ShipStatic) – Ship data to be converted

Returns:

ship – Converted ship data

Return type:

ShipStatic

trafficgen.read_files.convert_situation_data_from_maritime_to_si_units(situation: SituationInput) SituationInput

Convert situation data which is given in maritime units to SI units.

Parameters:

situation (SituationInput) – Situation data to be converted

Returns:

situation – Converted situation data

Return type:

SituationInput

trafficgen.read_files.read_encounter_settings_file(settings_file: Path) EncounterSettings

Read encounter settings file.

Parameters:

settings_file (Path) – Path to the encounter setting file

Returns:

encounter_settings – Settings for the encounter

Return type:

EncounterSettings

trafficgen.read_files.read_generated_situation_files(situation_folder: Path) list[TrafficSituation]

Read the generated traffic situation files. Used for testing the trafficgen algorithm.

Parameters:

situation_folder (Path) – Path to the folder where situation files are found

Returns:

situations – List of desired traffic situations

Return type:

list[TrafficSituation]

trafficgen.read_files.read_own_ship_static_file(own_ship_static_file: Path) ShipStatic

Read own ship static data from file.

Parameters:

own_ship_file (Path) – Path to the own_ship_static_file file

Returns:

own_ship – Own_ship static information

Return type:

ShipStatic

trafficgen.read_files.read_situation_files(situation_folder: Path) list[SituationInput]

Read traffic situation files.

Parameters:

situation_folder (Path) – Path to the folder where situation files are found

Returns:

situations – List of desired traffic situations

Return type:

list[SituationInput]

trafficgen.read_files.read_target_ship_static_files(target_ship_folder: Path) list[ShipStatic]

Read target ship static data files.

Parameters:

target_ship_folder (Path) – Path to the folder where target ships are found

Returns:

target_ships_static – List of different target ships with static information

Return type:

list[ShipStatic]