salvus.flow.collections.event_block
Block wise receiver, source, and event structures.
The main intention of this format is to facilitate working with large amount of sources and receivers in Salvus.
Classes
EventBlock
EventBlockclass EventBlock(builtins.object):
def __init__(
self,
source_blocks: typing.Union[typing.List[SourceBlock], SourceBlock],
receiver_blocks: typing.Union[
typing.List[ReceiverBlock], ReceiverBlock
],
): ...An event made up of source and receiver blocks.
source_blockstyping.Union[typing.List[SourceBlock], SourceBlock] — One or more source blocks.receiver_blockstyping.Union[typing.List[ReceiverBlock], ReceiverBlock] — One or more receiver blocks.
get_event()
get_event()def get_event(self, event_name: str) -> Event: ...Convert an event block to a Salvus event object.
event_namestr — The name of the event. This is set here.
EventBlockCollection
EventBlockCollectionclass EventBlockCollection(
salvus.flow.collections.event_block._BaseEventBlockCollection
):
def __init__(
self, block_events: typing.List[EventBlock], event_ids: npt.ArrayLike
): ...An in-memory event block collection.
Can be written
block_eventstyping.List[EventBlock] — A list of event blocks.event_idsnpt.ArrayLike — The corresponding event ids, on for each block.
get()
get()def get(self, event_id: typing.Union[str, bytes, int]) -> EventBlock: ...Get a single event block.
event_idtyping.Union[str, bytes, int] — The event id.
get_all_coordinates()
get_all_coordinates()def get_all_coordinates(self) -> typing.Dict[str, np.ndarray]: ...Get all source and receiver coordinates
get_event()
get_event()def get_event(self, event_id: typing.Union[str, bytes, int]) -> Event: ...Get a event object.
event_idtyping.Union[str, bytes, int] — The event id.
list()
list()def list(self) -> typing.List[str]: ...Get an array of all available event ids.
plot_coordinates()
plot_coordinates()def plot_coordinates(
self,
plot_sources: bool = True,
plot_receivers: bool = True,
figsize: typing.Tuple[int, int] = (15, 15),
ax: typing.Optional[matplotlib.axes.Axes] = None,
) -> None: ...Plot all coordinates.
plot_sourcesbool — Plot the sources.plot_receiversbool — Plot the receivers.figsizetyping.Tuple[int, int] — Size of the matplotlib figure. Only used ifaxis not passed.axtyping.Optional[matplotlib.axes.Axes] — The axes to plot in. If not given, a new figure will be created.
write()
write()def write(self, filename: typing.Union[str, pathlib.Path]) -> None: ...Write the block event collection to an HDF5 file.
filenametyping.Union[str, pathlib.Path] — The filename to write to.
EventBlockCollectionReader
EventBlockCollectionReaderclass EventBlockCollectionReader(
salvus.flow.collections.event_block._BaseEventBlockCollection
):
def __init__(self, filename: typing.Union[str, pathlib.Path]): ...An event block collection reading from an HDF5 file without reading everything at once.
filenametyping.Union[str, pathlib.Path] — Path to the HDF5 file.
get()
get()def get(self, event_id: typing.Union[str, bytes, int]) -> EventBlock: ...Get a single event block.
event_idtyping.Union[str, bytes, int] — The event id.
get_all_coordinates()
get_all_coordinates()def get_all_coordinates(self) -> typing.Dict[str, np.ndarray]: ...Get all source and receiver coordinates
get_event()
get_event()def get_event(self, event_id: typing.Union[str, bytes, int]) -> Event: ...Get a event object.
event_idtyping.Union[str, bytes, int] — The event id.
list()
list()def list(self) -> typing.List[str]: ...Get an array of all available event ids.
plot_coordinates()
plot_coordinates()def plot_coordinates(
self,
plot_sources: bool = True,
plot_receivers: bool = True,
figsize: typing.Tuple[int, int] = (15, 15),
ax: typing.Optional[matplotlib.axes.Axes] = None,
) -> None: ...Plot all coordinates.
plot_sourcesbool — Plot the sources.plot_receiversbool — Plot the receivers.figsizetyping.Tuple[int, int] — Size of the matplotlib figure. Only used ifaxis not passed.axtyping.Optional[matplotlib.axes.Axes] — The axes to plot in. If not given, a new figure will be created.
ReceiverBlock
ReceiverBlockclass ReceiverBlock(builtins.object):
def __init__(
self,
coordinates: Coordinates | npt.ArrayLike,
receiver_ids: typing.Union[
np.ndarray, typing.Sequence[typing.Union[int, str, bytes]]
],
fields: typing.List[str],
): ...A receiver block combining many points receivers of the same type.
coordinatesCoordinates | npt.ArrayLike — The coordinates.receiver_idstyping.Union[np.ndarray, typing.Sequence[typing.Union[int, str, bytes]]] — The receiver ids.fieldstyping.List[str] — The receiver fields.
get_salvus_receivers()
get_salvus_receivers()def get_salvus_receivers(self) -> list[receiver._Base]: ...Get Salvus receiver objects corresponding to the block.
SourceBlock
SourceBlockclass SourceBlock(builtins.object):
def __init__(
self,
coordinates: Coordinates | npt.ArrayLike,
source_mechanism: source_mechanism._SourceMechanism,
): ...A source block combining many sources of the same type.
coordinatesCoordinates | npt.ArrayLike — The coordinate array.source_mechanismsource_mechanism._SourceMechanism — The source mechanism for the sources.
get_salvus_sources()
get_salvus_sources()def get_salvus_sources(self) -> list[source._Base]: ...Get Salvus source objects corresponding to the block.