Mondaic

salvus.mesh.algorithms.mask_generators

salvus.mesh.algorithms.mask_generators salvus mesh algorithms mask_generators

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

Classes

RayMaskGenerator

class RayMaskGenerator(builtins.object):
    def __init__(
        self,
        events: Event | EventCollection,
        number_of_points_per_ray: int,
        distance_in_km: float,
        euler_angles: npt.NDArray | None = None,
        absorbing_boundaries: dict | None = None,
        phases: typing.Sequence[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 Event | 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 npt.NDArray | None — If the mask needs to be applied to a rotated mesh, these are the rotation angles.
  • absorbing_boundaries dict | None — Absorbing boundary parameters in a dictionary containing the keys “number_of_wavelengths”, “reference_velocity” and “reference_frequency”.
  • phases typing.Sequence[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: UnstructuredMesh, side_sets: str | list[str] | None = None
) -> UnstructuredMesh: ...

Apply the mask to an unstructured mesh.

Parameters
  • m UnstructuredMesh — the unstructured mesh
  • side_sets str | list[str] | None — surface side sets used to avoid cavities
Returns UnstructuredMesh
get_point_cloud()
def get_point_cloud(
    self, number_of_points_per_ray: int | None = None
) -> npt.NDArray: ...

Compute the point cloud for the final mask.

Parameters
  • number_of_points_per_ray int | None — The number of points per ray. A good number depends on the number element size and length of each ray.
Returns npt.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: Event | EventCollection | np.ndarray,
        number_of_points: int,
        distance_in_km: float,
        euler_angles: np.ndarray | None = None,
        absorbing_boundaries: dict | None = 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 Event | EventCollection | np.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 np.ndarray | None — If the mask needs to be applied to a rotated mesh, these are the rotation angles.
  • absorbing_boundaries dict | None — 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: UnstructuredMesh, side_sets: str | list[str] | None = None
) -> UnstructuredMesh: ...

Apply the mask to an unstructured mesh.

Parameters
  • m UnstructuredMesh — the unstructured mesh
  • side_sets str | list[str] | None — surface side sets used to avoid cavities
Returns UnstructuredMesh
get_point_cloud()
def get_point_cloud(
    self, number_of_points: int | None = None
) -> npt.NDArray: ...

Generate the point cloud for the final mask.

Parameters
  • number_of_points int | None — number of points in the point cloud
Returns npt.NDArray

Used in tutorials