Skip to content

basic_event

Represents a fault source (Basic Event) injecting FIT rates.

BasicEvent

Bases: BlockInterface

Represents a source of a fault (Basic Event) that injects a specific FIT rate.

This class handles the mathematical addition of failure rates to the fault dictionaries.

Source code in src/ecc_analyzer/core/basic_event.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
class BasicEvent(BlockInterface):
    """Represents a source of a fault (Basic Event) that injects a specific FIT rate.

    This class handles the mathematical addition of failure rates to the fault dictionaries.
    """

    def __init__(self, fault_type: FaultType, rate: float, is_spfm: bool = True):
        """Initializes the BasicEvent fault source.

        Args:
            fault_type (FaultType): The type of fault (Enum) this event produces.
            rate (float): The FIT rate of this basic event.
            is_spfm (bool, optional): Whether this rate counts towards SPFM (True)
                or LFM (False). Defaults to True.
        """
        self.fault_type = fault_type
        self.lambda_BE = rate
        self.is_spfm = is_spfm

    def compute_fit(self, spfm_rates: dict[FaultType, float], lfm_rates: dict[FaultType, float]) -> tuple[dict[FaultType, float], dict[FaultType, float]]:
        """Transforms the input fault rate dictionaries by injecting the defined FIT rate.

        Args:
            spfm_rates (dict[FaultType, float]): Dictionary containing current SPFM/residual fault rates.
            lfm_rates (dict[FaultType, float]): Dictionary containing current LFM/latent fault rates.

        Returns:
            tuple[dict[FaultType, float], dict[FaultType, float]]: A tuple containing:
                - Updated SPFM rates dictionary.
                - Updated LFM rates dictionary.
        """
        new_spfm = spfm_rates.copy()
        new_lfm = lfm_rates.copy()

        target_dict = new_spfm if self.is_spfm else new_lfm
        target_dict[self.fault_type] = target_dict.get(self.fault_type, 0.0) + self.lambda_BE

        return new_spfm, new_lfm

__init__(fault_type, rate, is_spfm=True)

Initializes the BasicEvent fault source.

Parameters:

Name Type Description Default
fault_type FaultType

The type of fault (Enum) this event produces.

required
rate float

The FIT rate of this basic event.

required
is_spfm bool

Whether this rate counts towards SPFM (True) or LFM (False). Defaults to True.

True
Source code in src/ecc_analyzer/core/basic_event.py
14
15
16
17
18
19
20
21
22
23
24
25
def __init__(self, fault_type: FaultType, rate: float, is_spfm: bool = True):
    """Initializes the BasicEvent fault source.

    Args:
        fault_type (FaultType): The type of fault (Enum) this event produces.
        rate (float): The FIT rate of this basic event.
        is_spfm (bool, optional): Whether this rate counts towards SPFM (True)
            or LFM (False). Defaults to True.
    """
    self.fault_type = fault_type
    self.lambda_BE = rate
    self.is_spfm = is_spfm

compute_fit(spfm_rates, lfm_rates)

Transforms the input fault rate dictionaries by injecting the defined FIT rate.

Parameters:

Name Type Description Default
spfm_rates dict[FaultType, float]

Dictionary containing current SPFM/residual fault rates.

required
lfm_rates dict[FaultType, float]

Dictionary containing current LFM/latent fault rates.

required

Returns:

Type Description
tuple[dict[FaultType, float], dict[FaultType, float]]

tuple[dict[FaultType, float], dict[FaultType, float]]: A tuple containing: - Updated SPFM rates dictionary. - Updated LFM rates dictionary.

Source code in src/ecc_analyzer/core/basic_event.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
def compute_fit(self, spfm_rates: dict[FaultType, float], lfm_rates: dict[FaultType, float]) -> tuple[dict[FaultType, float], dict[FaultType, float]]:
    """Transforms the input fault rate dictionaries by injecting the defined FIT rate.

    Args:
        spfm_rates (dict[FaultType, float]): Dictionary containing current SPFM/residual fault rates.
        lfm_rates (dict[FaultType, float]): Dictionary containing current LFM/latent fault rates.

    Returns:
        tuple[dict[FaultType, float], dict[FaultType, float]]: A tuple containing:
            - Updated SPFM rates dictionary.
            - Updated LFM rates dictionary.
    """
    new_spfm = spfm_rates.copy()
    new_lfm = lfm_rates.copy()

    target_dict = new_spfm if self.is_spfm else new_lfm
    target_dict[self.fault_type] = target_dict.get(self.fault_type, 0.0) + self.lambda_BE

    return new_spfm, new_lfm