salvus.mesh.layered_meshing.layered_model.filters
Built-in partitioning filters.
Functions
enclosing_elements()
enclosing_elements()def enclosing_elements(
um: UnstructuredMesh, p: np.ndarray
) -> npt.NDArray[np.bool_]: ...Get the unique elements in um that enclose the points p.
No points outside the mesh will be considered, and are removed from the
results of salvus_mesh_utils.get_enclosing_elements. Duplicates are
also removed from the element list.
Kwargs is a list of keyword arguments to pass to `get_enclosing_elements.
umUnstructuredMesh — The unstructured mesh.pnp.ndarray — The points.
first_and_last()
first_and_last()def first_and_last(i: Interface) -> Interface: ...Create a new interface containing only the first and last DEM values.
iInterface — The interface.
force_monotonic_top_down()
force_monotonic_top_down()def force_monotonic_top_down(transform: ModelPredicate) -> ModelPredicate: ...Ensure that a transformed model is monotonic in the negative vertical direction.
This is useful when the partitioning field is known a-priori to be primarily monotonically increasing in the negative vertical direction, especially when slight variations in the model lead to local deviations from monotonicity. Without applying this transform a naive partitioning may behave unexpectedly as variations in monotonicity can cause holes in simple predicates (i.e., those based on threshold velocity values) which will in turn prevent the partitioning algorithms from forming a clean partition.
Note: This function assumes that a material has been realized, that is expanded across all dimensions in a domain and sorted by dimension name.
transformModelPredicate — A function transforming a material to axarray.DataArray, to be used as a partitioning predicate.
transform applied to a material and subsequently made monotonic along the vertical direction by performing a rolling minimum reduction along the positive vertical axis.generate_vp_vs_ratio_filter()
generate_vp_vs_ratio_filter()def generate_vp_vs_ratio_filter(
alpha: float,
reduction_method: (
typing.Literal["remove-components", "force"] | None
) = "remove-components",
compute_vp_via: (
typing.Callable[[Material], _pd.GenericParameterType] | None
) = None,
) -> OracleFilter: ...Generate a filter to compute the Vp/Vs ratio from the Vp and Vs oracles.
alphafloat — Interpolation factor between Vp and Vs oracles. When alpha is 0, return Vp, and when alpha is 1, return Vs. Value between 0 and 1 return a linear blend between the two oracle values, with the endpoints 0 only resolving Vs and 1 fully resolving Vs.reduction_methodtyping.Literal['remove-components', 'force'] | None — A method to reduce anisotropic P-wave velocities to their hexagonal (TTI) values. Only used if compute_vp_via is None.compute_vp_viatyping.Callable[[Material], _pd.GenericParameterType] | None — A function that computes Vp, or a proxy for Vp, from a material.
no_filter()
no_filter()def no_filter(
p: _pd.GenericParameterType, material: Material | None = None
) -> _pd.GenericParameterType: ...Identity function returning the oracle as-is.
p_pd.GenericParameterType — The oracle.materialMaterial | None — The material. Ignored in this case.
remove_consecutive_duplicates()
remove_consecutive_duplicates()def remove_consecutive_duplicates(i: Interface) -> Interface: ...Remove consecutive duplicate DEM values from an interface.
iInterface — The interface.
Classes
OracleFilter
OracleFilterclass OracleFilter(typing.Protocol):
def __init__(self):
...A protocol which wavelength oracle filter callbacks must respect.