trafficgen.types module

Domain specific data types used in trafficgen.

class trafficgen.types.Encounter(*, desiredEncounterType: EncounterType, beta: List[float] | float | None = None, relativeSpeed: float | None = None, vectorTime: float | None = None)[source]

Bases: BaseModel

Data type for an encounter.

class Config[source]

Bases: object

For converting parameters written to file from snake to camel case.

alias_generator() str

Return a camel case formated string from snake case string.

populate_by_name = True
beta: List[float] | float | None
desired_encounter_type: EncounterType
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'beta': FieldInfo(annotation=Union[List[float], float, NoneType], required=False, default=None, alias='beta', alias_priority=1), 'desired_encounter_type': FieldInfo(annotation=EncounterType, required=True, alias='desiredEncounterType', alias_priority=1), 'relative_speed': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, alias='relativeSpeed', alias_priority=1), 'vector_time': FieldInfo(annotation=Union[float, NoneType], required=False, default=None, alias='vectorTime', alias_priority=1)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

relative_speed: float | None
vector_time: float | None
class trafficgen.types.EncounterClassification(*, theta13Criteria: float, theta14Criteria: float, theta15Criteria: float, theta15: List[float])[source]

Bases: BaseModel

Data type for the encounter classification.

class Config[source]

Bases: object

For converting parameters written to file from snake to camel case.

alias_generator() str

Return a camel case formated string from snake case string.

populate_by_name = True
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'theta13_criteria': FieldInfo(annotation=float, required=True, alias='theta13Criteria', alias_priority=1), 'theta14_criteria': FieldInfo(annotation=float, required=True, alias='theta14Criteria', alias_priority=1), 'theta15': FieldInfo(annotation=List[float], required=True, alias='theta15', alias_priority=1), 'theta15_criteria': FieldInfo(annotation=float, required=True, alias='theta15Criteria', alias_priority=1)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

theta13_criteria: float
theta14_criteria: float
theta15: List[float]
theta15_criteria: float
class trafficgen.types.EncounterRelativeSpeed(*, overtakingStandOn: List[float], overtakingGiveWay: List[float], headOn: List[float], crossingGiveWay: List[float], crossingStandOn: List[float])[source]

Bases: BaseModel

Data type for relative speed between two ships in an encounter.

class Config[source]

Bases: object

For converting parameters written to file from snake to camel case.

alias_generator() str

Return a camel case formated string from snake case string.

populate_by_name = True
crossing_give_way: List[float]
crossing_stand_on: List[float]
head_on: List[float]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'crossing_give_way': FieldInfo(annotation=List[float], required=True, alias='crossingGiveWay', alias_priority=1), 'crossing_stand_on': FieldInfo(annotation=List[float], required=True, alias='crossingStandOn', alias_priority=1), 'head_on': FieldInfo(annotation=List[float], required=True, alias='headOn', alias_priority=1), 'overtaking_give_way': FieldInfo(annotation=List[float], required=True, alias='overtakingGiveWay', alias_priority=1), 'overtaking_stand_on': FieldInfo(annotation=List[float], required=True, alias='overtakingStandOn', alias_priority=1)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

overtaking_give_way: List[float]
overtaking_stand_on: List[float]
class trafficgen.types.EncounterSettings(*, classification: EncounterClassification, relativeSpeed: EncounterRelativeSpeed, vectorRange: List[float], commonVector: float, situationLength: float, maxMeetingDistance: float, evolveTime: float, disableLandCheck: bool)[source]

Bases: BaseModel

Data type for encounter settings.

class Config[source]

Bases: object

For converting parameters written to file from snake to camel case.

alias_generator() str

Return a camel case formated string from snake case string.

populate_by_name = True
classification: EncounterClassification
common_vector: float
disable_land_check: bool
evolve_time: float
max_meeting_distance: float
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'classification': FieldInfo(annotation=EncounterClassification, required=True, alias='classification', alias_priority=1), 'common_vector': FieldInfo(annotation=float, required=True, alias='commonVector', alias_priority=1), 'disable_land_check': FieldInfo(annotation=bool, required=True, alias='disableLandCheck', alias_priority=1), 'evolve_time': FieldInfo(annotation=float, required=True, alias='evolveTime', alias_priority=1), 'max_meeting_distance': FieldInfo(annotation=float, required=True, alias='maxMeetingDistance', alias_priority=1), 'relative_speed': FieldInfo(annotation=EncounterRelativeSpeed, required=True, alias='relativeSpeed', alias_priority=1), 'situation_length': FieldInfo(annotation=float, required=True, alias='situationLength', alias_priority=1), 'vector_range': FieldInfo(annotation=List[float], required=True, alias='vectorRange', alias_priority=1)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

relative_speed: EncounterRelativeSpeed
situation_length: float
vector_range: List[float]
class trafficgen.types.EncounterType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enumeration of encounter types.

CROSSING_GIVE_WAY = 'crossing-give-way'
CROSSING_STAND_ON = 'crossing-stand-on'
HEAD_ON = 'head-on'
NO_RISK_COLLISION = 'noRiskCollision'
OVERTAKING_GIVE_WAY = 'overtaking-give-way'
OVERTAKING_STAND_ON = 'overtaking-stand-on'
class trafficgen.types.OwnShipInitial(*, initial: Initial, waypoints: List[Waypoint] | None = None)[source]

Bases: BaseModel

Data type for initial data for the own ship used for generating a situation.

initial: Initial
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'initial': FieldInfo(annotation=Initial, required=True), 'waypoints': FieldInfo(annotation=Union[List[Waypoint], NoneType], required=False, default=None, description='An array of `Waypoint` objects.')}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

waypoints: List[Waypoint] | None
class trafficgen.types.SituationInput(*, title: str, description: str, numSituations: int, ownShip: OwnShipInitial, encounters: List[Encounter])[source]

Bases: BaseModel

Data type for inputs needed for generating a situations.

class Config[source]

Bases: object

For converting parameters written to file from snake to camel case.

alias_generator() str

Return a camel case formated string from snake case string.

populate_by_name = True
description: str
encounters: List[Encounter]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'description': FieldInfo(annotation=str, required=True, alias='description', alias_priority=1), 'encounters': FieldInfo(annotation=List[Encounter], required=True, alias='encounters', alias_priority=1), 'num_situations': FieldInfo(annotation=int, required=True, alias='numSituations', alias_priority=1), 'own_ship': FieldInfo(annotation=OwnShipInitial, required=True, alias='ownShip', alias_priority=1), 'title': FieldInfo(annotation=str, required=True, alias='title', alias_priority=1)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

num_situations: int
own_ship: OwnShipInitial
title: str
trafficgen.types.to_camel(string: str) str[source]

Return a camel case formated string from snake case string.