Mondaic
This API reference is not for the latest stable Salvus version.

salvus.mesh.mask_generators

Classes for generation of point clouds to be used in mesh masking.

Classes

RayMaskGenerator

class RayMaskGenerator(builtins.object):
    def __init__(
        self,
        events: Union[
            salvus.flow.collections.event.Event,
            salvus.flow.collections.event_collection.EventCollection,
        ],
        number_of_points_per_ray: int,
        distance_in_km: float,
        euler_angles: Optional[numpy.ndarray] = None,
        absorbing_boundaries: Optional[dict] = None,
        phases: List[str] = ["P"],
        taupy_model: str = "Prem",
    ):
        ...

Generates point clouds along the rays from a set of sources and receivers.

initialize rays from an Event or an EventCollection. A point cloud within points on the rays is generated to simplify computation of which element is inside based on the distance to the closest point.

Parameters
  • events Union[salvus.flow.collections.event.Event, salvus.flow.collections.event_collection.EventCollection] — Event collection defining sources and receivers to be used in the simulation.
  • number_of_points_per_ray int — Number of points used in the point cloud per ray. If the boundary of the resulting mesh looks chunky, increase this number.
  • distance_in_km float — Elements with larger distance from the point cloud are removed.
  • euler_angles Optional[numpy.ndarray] — If the mask needs to be applied to a rotated mesh, these are the rotation angles.
  • absorbing_boundaries Optional[dict] — Absorbing boundary parameters in a dictionary containing the keys “number_of_wavelengths”, “reference_velocity” and “reference_frequency”
  • phases List[str] — seismic phase names to be used for the calculation of the rays
  • taupy_model str — 1D model to use for calculation of the rays
Methods
apply_mask()
def apply_mask(
    self,
    m: salvus.mesh.unstructured_mesh.UnstructuredMesh,
    side_sets: Optional[List[str], str] = None,
) -> salvus.mesh.unstructured_mesh.UnstructuredMesh:
    ...

apply the mask to an unstructured mesh

Parameters
  • m salvus.mesh.unstructured_mesh.UnstructuredMesh — the unstructured mesh
  • side_sets Optional[List[str], str] — surface side sets used to avoid cavities
Returns salvus.mesh.unstructured_mesh.UnstructuredMesh
get_point_cloud()
def get_point_cloud(
    self, number_of_points_per_ray: Optional[int] = None
) -> numpy.ndarray:
    ...

get the point cloud

Parameters
  • number_of_points_per_ray Optional[int] — number of points in the point cloud per ray
Returns numpy.ndarray
write_vtk()
def write_vtk(self, filename: str) -> None:
    ...

write rays used in the mask to a vtk file for visualisation using the legacy vtk ascii polydata format

Parameters
  • filename str — filename of the vtk file
Returns None

SurfaceMaskGenerator

class SurfaceMaskGenerator(builtins.object):
    def __init__(
        self,
        events: Union[
            salvus.flow.collections.event.Event,
            salvus.flow.collections.event_collection.EventCollection,
            numpy.ndarray,
        ],
        number_of_points: int,
        distance_in_km: float,
        euler_angles: Optional[numpy.ndarray] = None,
        absorbing_boundaries: Optional[dict] = None,
    ):
        ...

Generates point clouds on the surface of a sphere within the convex hull of a set of sources and receivers.

initialize hull triangulation from an Event or an EventCollection. A point cloud within the domain is generated to simplify computation of which element is inside based on the distance to the closest point.

Parameters
  • events Union[salvus.flow.collections.event.Event, salvus.flow.collections.event_collection.EventCollection, numpy.ndarray] — Event collection defining sources and receivers to be used in the simulation. Alternatively to events, provide surface locations directly in an array of latitudes and longitudes with shape (n, 2), or surface points in cartesian coordinates with shape (n, 3).
  • number_of_points int — Number of points used in the point cloud. If the boundary of the resulting mesh looks chunky, increase this number.
  • distance_in_km float — Elements with larger distance from the point cloud are removed.
  • euler_angles Optional[numpy.ndarray] — If the mask needs to be applied to a rotated mesh, these are the rotation angles.
  • absorbing_boundaries Optional[dict] — Absorbing boundary parameters in a dictionary containing the keys “number_of_wavelengths”, “reference_velocity” and “reference_frequency”
Methods
apply_mask()
def apply_mask(
    self,
    m: salvus.mesh.unstructured_mesh.UnstructuredMesh,
    side_sets: Optional[List[str], str] = None,
) -> salvus.mesh.unstructured_mesh.UnstructuredMesh:
    ...

apply the mask to an unstructured mesh

Parameters
  • m salvus.mesh.unstructured_mesh.UnstructuredMesh — the unstructured mesh
  • side_sets Optional[List[str], str] — surface side sets used to avoid cavities
Returns salvus.mesh.unstructured_mesh.UnstructuredMesh
get_point_cloud()
def get_point_cloud(
    self, number_of_points: Optional[int] = None
) -> numpy.ndarray:
    ...

get the point cloud

Parameters
  • number_of_points Optional[int] — number of points in the point cloud
Returns numpy.ndarray