add_strain_maps#

Project.add_strain_maps(project, strain_maps)#

Add strain map files to CCAs in a Sherlock project.

Parameters:
  • project (str) – Name of the Sherlock project to add strain maps to.

  • strain_maps (list) –

    List of strain maps consisting of these properties:

    • strain_map_filestr

      Full path to the CSV file with the strain maps.

    • file_commentstr

      Comment to associate with the file.

    • file_typeStrainMapsFileType

      Strain maps file type. Options are CSV, Excel, and Image.

    • header_row_countint

      Number of rows before the file’s column header.

    • reference_id_columnstr

      Name of the column in the file with reference IDs.

    • strain_columnstr

      Name of the column in the file with strain values.

    • strain_unitsstr

      Strain units. Options are µε and ε.

    • image_fileStrainMapImageFile, optional

      The properties of the strain map file to add.

    • ccaslist, optional

      List of CCA names to assign the file to. When no list is specified, the file is assigned to all CCAs in the project.

Returns:

Status code of the response. 0 for success.

Return type:

int

Examples

>>> from ansys.sherlock.core.launcher import launch_sherlock
>>> from ansys.sherlock.core.types.project_types import (
    BoardBounds,
    ImageBounds,
    ImageFile,
    LegendBounds,
    LegendOrientation,
    StrainMapsFileType,
    StrainMapLegendOrientation,
)
>>> sherlock = launch_sherlock()
>>> sherlock.project.add_strain_maps(
    "Tutorial Project",
        [
            (
                "StrainMap.csv",
                "This is the strain map file for the project",
                StrainMapsFileType.CSV,
                0,
                "refDes",
                "strain",
                "µε",
                ["Main Board"]
            )
        ]
    )
>>> strain_map_image_properties = (
        BoardBounds([
            (1.0, 2.0),
            (3.0, 4.0),
            (1.0, 2.0),
            (1.0, 2.0)
        ]),
        "in",
        ImageBounds(0.0, 0.0, 10.0, 8.0),
        LegendBounds(1.0, 2.0, 4.0, 2.0),
        StrainMapLegendOrientation.VERTICAL,
        20.0,
        50.0,
        "µε"
    )
>>> sherlock.project.add_strain_maps(
    "Tutorial Project",
        [
            (
                "StrainMap.jpg",
                "This is the strain map image for the project",
                StrainMapsFileType.IMAGE,
                strain_map_image_properties,
                ["Main Board"]
            )
        ]
    )