salvus.mesh.mask_generators
Classes for generation of point clouds to be used in mesh masking.
Classes
RayMaskGenerator
RayMaskGeneratorclass 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.
eventsUnion[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_rayint — Number of points used in the point cloud per ray. If the boundary of the resulting mesh looks chunky, increase this number.distance_in_kmfloat — Elements with larger distance from the point cloud are removed.euler_anglesOptional[numpy.ndarray] — If the mask needs to be applied to a rotated mesh, these are the rotation angles.absorbing_boundariesOptional[dict] — Absorbing boundary parameters in a dictionary containing the keys “number_of_wavelengths”, “reference_velocity” and “reference_frequency”phasesList[str] — seismic phase names to be used for the calculation of the raystaupy_modelstr — 1D model to use for calculation of the rays
apply_mask()
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
msalvus.mesh.unstructured_mesh.UnstructuredMesh — the unstructured meshside_setsOptional[List[str], str] — surface side sets used to avoid cavities
get_point_cloud()
get_point_cloud()def get_point_cloud(
self, number_of_points_per_ray: Optional[int] = None
) -> numpy.ndarray:
...get the point cloud
number_of_points_per_rayOptional[int] — number of points in the point cloud per ray
write_vtk()
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
filenamestr — filename of the vtk file
SurfaceMaskGenerator
SurfaceMaskGeneratorclass 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.
eventsUnion[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_pointsint — Number of points used in the point cloud. If the boundary of the resulting mesh looks chunky, increase this number.distance_in_kmfloat — Elements with larger distance from the point cloud are removed.euler_anglesOptional[numpy.ndarray] — If the mask needs to be applied to a rotated mesh, these are the rotation angles.absorbing_boundariesOptional[dict] — Absorbing boundary parameters in a dictionary containing the keys “number_of_wavelengths”, “reference_velocity” and “reference_frequency”
apply_mask()
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
msalvus.mesh.unstructured_mesh.UnstructuredMesh — the unstructured meshside_setsOptional[List[str], str] — surface side sets used to avoid cavities
get_point_cloud()
get_point_cloud()def get_point_cloud(
self, number_of_points: Optional[int] = None
) -> numpy.ndarray:
...get the point cloud
number_of_pointsOptional[int] — number of points in the point cloud