From 51fd97c548295a0f84e2c475c8efd91cdfe54f5e Mon Sep 17 00:00:00 2001 From: Ardt Klapwijk <59741981+ArdtK@users.noreply.github.com> Date: Thu, 21 Mar 2024 14:22:04 +0100 Subject: [PATCH 1/2] chore: remove unused import --- ra2ce/analysis/analysis_factory.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ra2ce/analysis/analysis_factory.py b/ra2ce/analysis/analysis_factory.py index 840466bd8..6dd18d946 100644 --- a/ra2ce/analysis/analysis_factory.py +++ b/ra2ce/analysis/analysis_factory.py @@ -55,7 +55,6 @@ ) from ra2ce.analysis.indirect.single_link_losses import SingleLinkLosses from ra2ce.analysis.indirect.single_link_redundancy import SingleLinkRedundancy -from ra2ce.network.hazard.hazard_names import HazardNames class AnalysisFactory: From 16c882a5c998ef50b0a9d933ed5736eba2599171 Mon Sep 17 00:00:00 2001 From: Ardt Klapwijk <59741981+ArdtK@users.noreply.github.com> Date: Thu, 21 Mar 2024 14:23:28 +0100 Subject: [PATCH 2/2] fix: correct damage_curve field initialization --- .../analysis_config_data/analysis_config_data.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ra2ce/analysis/analysis_config_data/analysis_config_data.py b/ra2ce/analysis/analysis_config_data/analysis_config_data.py index 156cba6b3..f4c9db075 100644 --- a/ra2ce/analysis/analysis_config_data/analysis_config_data.py +++ b/ra2ce/analysis/analysis_config_data/analysis_config_data.py @@ -26,13 +26,13 @@ from pathlib import Path from typing import Optional -from ra2ce.analysis.analysis_config_data.enums import damage_curve_enum from ra2ce.analysis.analysis_config_data.enums.analysis_direct_enum import ( AnalysisDirectEnum, ) from ra2ce.analysis.analysis_config_data.enums.analysis_indirect_enum import ( AnalysisIndirectEnum, ) +from ra2ce.analysis.analysis_config_data.enums.damage_curve_enum import DamageCurveEnum from ra2ce.analysis.analysis_config_data.enums.event_type_enum import EventTypeEnum from ra2ce.analysis.analysis_config_data.enums.loss_type_enum import LossTypeEnum from ra2ce.analysis.analysis_config_data.enums.risk_calculation_mode_enum import ( @@ -91,14 +91,18 @@ class AnalysisSectionIndirect(AnalysisSectionBase): disruption_per_category: str = "" traffic_cols: list[str] = field(default_factory=list) # losses - duration_event: float = math.nan # TODO remove the deprecated attribute that have been replaced by csv + duration_event: float = ( + math.nan + ) # TODO remove the deprecated attribute that have been replaced by csv duration_disruption: float = math.nan fraction_detour: float = math.nan fraction_drivethrough: float = 0.0 rest_capacity: float = math.nan maximum_jam: float = math.nan part_of_day: PartOfDayEnum = field(default_factory=lambda: PartOfDayEnum.DAY) - performance: str = "diff_time" # "diff_time" or "diff_length" relates to the used criticality metric + performance: str = ( + "diff_time" # "diff_time" or "diff_length" relates to the used criticality metric + ) resilience_curve_file: Optional[Path] = None traffic_intensities_file: Optional[Path] = None values_of_time_file: Optional[Path] = None @@ -134,8 +138,8 @@ class AnalysisSectionDirect(AnalysisSectionBase): climate_period: float = math.nan # road damage event_type: EventTypeEnum = field(default_factory=lambda: EventTypeEnum.INVALID) - damage_curve: damage_curve_enum.DamageCurveEnum = field( - default_factory=lambda: EventTypeEnum.INVALID + damage_curve: DamageCurveEnum = field( + default_factory=lambda: DamageCurveEnum.INVALID ) risk_calculation_mode: RiskCalculationModeEnum = field( default_factory=lambda: RiskCalculationModeEnum.NONE