Skip to content

fatpy

FatPy - A Python package for fatigue life evaluation of materials.

core

Core fatigue analysis methods and functionality.

damage_cumulation

Damage cumulation module.

This module contains the classes and functions for damage cumulation methods.

decompositions

Decompositions module.

This module contains the classes and functions for decomposition methods.

energy_life

Energy-based fatigue life analysis methods.

This package provides implementations of energy-based approaches for fatigue life prediction and analysis.

base_methods

Base methods for the energy-life.

correction_methods

Correction methods for the energy-life.

decompositions

Decomposition methods for the energy-life.

demage_parameters

Damage parameters calculation methods for the energy-life.

plane_based_methods

Plane-based methods module.

This module contains the classes and functions for plane-based methods.

strain_life

Strain-based fatigue life analysis methods.

This package provides implementations of strain-based approaches for fatigue life prediction and analysis.

base_methods

Base methods for the strain-life.

correction_methods

Correction methods for the strain-life.

demage_parameters

Damage parameters calculation methods for the strain-life.

stress_life

Stress-based fatigue life analysis methods.

This package provides implementations of stress-based approaches for fatigue life prediction and analysis.

base_methods

Base methods for the stress-life.

correction_methods

Correction methods for the stress-life.

demage_parameters

Damage parameters calculation methods for the stress-life.

data_parsing

Data parsing utilities for the fatigue analysis package.

fe_model

Finite element model parsing module.

loads

Load data parsing module.

material

Material properties parsing module.

user_input

User input data parsing module.

examples

This module contains an example function with a detailed docstring.

docstring_example_tmp

This module contains an example function with a detailed docstring.

ExampleClass

An example class to demonstrate docstring formatting.

Source code in src/fatpy/examples/docstring_example_tmp.py
class ExampleClass:
    """An example class to demonstrate docstring formatting."""

    def __init__(self, value: int):
        """Initialize the ExampleClass with a value.

        Args:
            value (int): The initial value for the class instance.
        """
        self.value = value

    def increment(self, amount: int) -> int:
        """Increment the stored value by a specified amount.

        Args:
            amount (int): The amount to increment the value by.

        Returns:
            int: The new value after incrementing.
        """
        self.value += amount
        return self.value

    def example_method_with_docstring(self, a: int, b: int) -> int:
        # ruff: noqa: E501
        """Docstring with a cross-reference to the example function.

        This method demonstrates how to reference another function's docstring.
        It calls `example_function_with_docstring` with sample arguments.

        Cross-reference:
            1. [fatpy.examples.docstring_example_tmp.example_function_with_docstring][]
            2. [`Reference with title`][fatpy.examples.docstring_example_tmp.example_function_with_docstring]

        Args:
            a (int): The first integer value.
            b (int): The second integer value.

        Returns:
            int: The result of the example function.
        """
        return example_function_with_docstring(a, b)
__init__(value)

Initialize the ExampleClass with a value.

Parameters:

Name Type Description Default
value int

The initial value for the class instance.

required
Source code in src/fatpy/examples/docstring_example_tmp.py
def __init__(self, value: int):
    """Initialize the ExampleClass with a value.

    Args:
        value (int): The initial value for the class instance.
    """
    self.value = value
increment(amount)

Increment the stored value by a specified amount.

Parameters:

Name Type Description Default
amount int

The amount to increment the value by.

required

Returns:

Name Type Description
int int

The new value after incrementing.

Source code in src/fatpy/examples/docstring_example_tmp.py
def increment(self, amount: int) -> int:
    """Increment the stored value by a specified amount.

    Args:
        amount (int): The amount to increment the value by.

    Returns:
        int: The new value after incrementing.
    """
    self.value += amount
    return self.value
example_method_with_docstring(a, b)

Docstring with a cross-reference to the example function.

This method demonstrates how to reference another function's docstring. It calls example_function_with_docstring with sample arguments.

Cross-reference
  1. fatpy.examples.docstring_example_tmp.example_function_with_docstring
  2. Reference with title

Parameters:

Name Type Description Default
a int

The first integer value.

required
b int

The second integer value.

required

Returns:

Name Type Description
int int

The result of the example function.

Source code in src/fatpy/examples/docstring_example_tmp.py
def example_method_with_docstring(self, a: int, b: int) -> int:
    # ruff: noqa: E501
    """Docstring with a cross-reference to the example function.

    This method demonstrates how to reference another function's docstring.
    It calls `example_function_with_docstring` with sample arguments.

    Cross-reference:
        1. [fatpy.examples.docstring_example_tmp.example_function_with_docstring][]
        2. [`Reference with title`][fatpy.examples.docstring_example_tmp.example_function_with_docstring]

    Args:
        a (int): The first integer value.
        b (int): The second integer value.

    Returns:
        int: The result of the example function.
    """
    return example_function_with_docstring(a, b)

example_function_with_docstring(a, b)

This docstring highlights Mermaid diagrams, math expressions, and code examples.

This function takes two integers and returns their sum. It demonstrates various mkdocs-material features:

Information

This is an informational admonition block.

Important Note

Make sure both parameters are integers.

Mermaid Diagram
graph TD
    A[Start] --> B{Is it a number?}
    B -- Yes --> C[Process the number]
    B -- No --> D[Throw an error]
    C --> E[End]
    D --> E
Mathematical Expression
\[ \varphi = \frac{1 + \sqrt{5}}{2} \]

Inline math: \(E = mc^2\)

Code Examples
def add(a: int, b: int) -> int:
    return a + b
function add(a, b) {
    return a + b;
}
Expandable Example

This is a collapsible content section that shows more detailed usage:

result = example_function_with_docstring(5, 3)
print(f"Result: {result}")  # Output: Result: 8
Table Example
Input A Input B Result
1 2 3
5 7 12
0 0 0
Args:
  • a (int): The first integer.
  • b (int): The second integer.
Returns:
  • int: The sum of the two integers.
Raises:
  • TypeError: If inputs are not integers.
Examples:
>>> example_function_with_docstring(2, 3)
5
>>> example_function_with_docstring(0, 0)
0
Source code in src/fatpy/examples/docstring_example_tmp.py
def example_function_with_docstring(a: int, b: int) -> int:
    r"""This docstring highlights Mermaid diagrams, math expressions, and code examples.

    This function takes two integers and returns their sum.
    It demonstrates various mkdocs-material features:

    !!! info "Information"
        This is an informational admonition block.

    !!! warning "Important Note"
        Make sure both parameters are integers.

    ### Mermaid Diagram
    ```mermaid
    graph TD
        A[Start] --> B{Is it a number?}
        B -- Yes --> C[Process the number]
        B -- No --> D[Throw an error]
        C --> E[End]
        D --> E
    ```

    ### Mathematical Expression
    $$ \varphi = \frac{1 + \sqrt{5}}{2} $$

    Inline math: $E = mc^2$

    ### Code Examples
    === "Python"
        ```python
        def add(a: int, b: int) -> int:
            return a + b
        ```

    === "JavaScript"
        ```javascript
        function add(a, b) {
            return a + b;
        }
        ```

    ??? example "Expandable Example"
        This is a collapsible content section that shows more detailed usage:

        ```python
        result = example_function_with_docstring(5, 3)
        print(f"Result: {result}")  # Output: Result: 8
        ```

    ### Table Example
    | Input A | Input B | Result |
    |---------|---------|--------|
    | 1       | 2       | 3      |
    | 5       | 7       | 12     |
    | 0       | 0       | 0      |

    #### Args:
    - `a` (*int*): The first integer.
    - `b` (*int*): The second integer.

    #### Returns:
    - *int*: The sum of the two integers.

    #### Raises:
    - `TypeError`: If inputs are not integers.

    #### Examples:
    ```python
    >>> example_function_with_docstring(2, 3)
    5
    >>> example_function_with_docstring(0, 0)
    0
    ```
    """
    return a + b

material_laws

Material laws module.

Contains the classes and functions for defining and working with material laws.

structural_mechanics

Structural mechanics module.

This module contains the classes and functions for structural mechanics analysis.

eq_stresses

Contains the function to calculate equivalent stresses.

transformations

Contains the functions for tensor and other transformations.

utils

Utility functions for the fatigue analysis package.

mesh

Mesh processing utilities module.

This module provides various functions and classes for mesh processing tasks.

post_processing

Utilities for post-processing fatigue analysis results.

pre_processing

Utilities for pre-processing fatigue analysis results.

signal

Signal processing utilities module.

This module provides various functions and classes for signal processing tasks.