Version:

salvus.project.components.visualization.visualization_component

salvus.project.components.visualization.visualization_component salvus project components visualization visualization_component
The visualization component of SalvusProject.

Classes

VisualizationComponent

Project subclass dealing with all things related to visualizations.
SIGNATURE
class VisualizationComponent(builtins.object):
    def __init__(self, project: salvus.project.Project): ...
ARGUMENTS
Required
project
Type:salvus.project.Project
Description:
The project to attach the visualization component to.

Methods

VisualizationComponent.custom_gather()
Plot a, potentially interleaved, custom gather.
SIGNATURE
def custom_gather(
    self,
    data: str | list[str],
    event: str | Event,
    receiver_field: str,
    component: str,
    sort_by: typing.Callable | None = None,
    filter_by: typing.Callable[[_Base], bool] | None = None,
    select_by: (
        typing.Callable[
            [list[tuple[_Base, obspy.Stream]], EventData],
            list[tuple[_Base, obspy.Stream]],
        ]
        | None
    ) = None,
    interleave: bool = False,
    colors: list[typing.Any] | None = None,
    alpha: float | None = None,
    plot_using: PlotProperties | matplotlib.axes.Axes = PlotProperties(
        width=11.5, height=6.33, dpi=100
    ),
    data_selection_configuration: str | None = None,
    fast_unsafe: bool = False,
) -> matplotlib.axes.Axes: ...
ARGUMENTS
Required
data
Type:str | list[str]
Description:
Data name or list of data names to plot.
Required
event
Type:str | Event
Description:
The event to use.
Required
receiver_field
Type:str
Description:
The receiver field to plot.
Required
component
Type:str
Description:
The component to plot.
Optional
sort_by
Type:typing.Callable | None
Default value:None
Description:
Callback function called with the receiver objects to determine the sorting. Works like the key callback for the standard Python sorted() method.
Optional
filter_by
Type:typing.Callable[[_Base], bool] | None
Default value:None
Description:
Callback function called with the receiver objects in internal Salvus format to determine the filtering. Works like the callback for the standard Python filter() method. For complex filter operations requiring all receivers, defer to the select_by method.
Optional
select_by
Type:typing.Callable[[list[tuple[_Base, obspy.Stream]], EventData], list[tuple[_Base, obspy.Stream]]] | None
Default value:None
Description:
Callback function called with a list of tuples in the receiver objects in both internal Salvus and ObsPy Stream format, as well as the EventData objects.
Optional
interleave
Type:bool
Default value:False
Description:
Whether or not to alternatingly plot data. If false, traces from all data will be plotted on top of each other.
Optional
colors
Type:list[typing.Any] | None
Default value:None
Description:
The colors for the individual traces. Must be exactly as many colors as data items. If not given, it will attempt to choose suitable colors.
Optional
alpha
Type:float | None
Default value:None
Description:
The opacity of all data, as used in Matplotlib. useful when setting interleave to false.
Optional
plot_using
Type:PlotProperties | matplotlib.axes.Axes
Default value:PlotProperties(width=11.5, height=6.33, dpi=100)
Description:
The configuration of the axis to create or reuse. Will default to the standard size as defined in the PlotProperties dataclass.
Optional
data_selection_configuration
Type:str | None
Default value:None
Description:
The data selection configuration to use.
Optional
fast_unsafe
Type:bool
Default value:False
Description:
Collect data on the largest instead of smallest time step. Will potentially alias data if largest time step of the data is larger than the highest relevant frequencies across the data, but does speed up plotting in cases where time axes are restrictive, e.g. simulations with relatively many time steps, which would normally lead to massive interpolation expense.
VisualizationComponent.interval_window_statistics()
Styled table to get an overview of all picked windows for a given data selection configuration.
SIGNATURE
def interval_window_statistics(
    self, data_selection_configuration: str
) -> pandas.io.formats.style.Styler: ...
ARGUMENTS
Required
data_selection_configuration
Type:str
Description:
The data selection configuration whose windows to plot.
VisualizationComponent.misfit_histogram()
Compute histograms of misfits.
SIGNATURE
def misfit_histogram(
    self,
    simulation_configuration_a: str,
    simulation_configuration_b: str | None = None,
    misfit_configuration: str,
    events: str | Event | list[str | Event],
    bins: int = 10,
    merge_all_components: bool = False,
    show: bool = True,
) -> matplotlib.figure.Figure | None: ...
ARGUMENTS
Required
simulation_configuration_a
Type:str
Description:
Name of the simulation configuration whose misfits to plot.
Optional
simulation_configuration_b
Type:str | None
Default value:None
Description:
Optionally plot misfits of a second configuration to be able to compare two configurations.
Required
misfit_configuration
Type:str
Description:
The misfit configuration to use for the comparison.
Required
events
Type:str | Event | list[str | Event]
Description:
The events to use. It will produce a cumulative histogram over the given events.
Optional
bins
Type:int
Default value:10
Description:
How many bins to use.
Optional
merge_all_components
Type:bool
Default value:False
Description:
If False, a separate histogram will be computed for each component, otherwise a single histogram will be computed by merging all misfit measurements.
Optional
show
Type:bool
Default value:True
Description:
If True the figure will be shown immediately. Otherwise the matplotlib figure object will be returned.
VisualizationComponent.shotgather()
Plot a, potentially interleaved, shotgather.
SIGNATURE
def shotgather(
    self,
    data: str | list[str],
    event: str | Event,
    receiver_field: str,
    component: str,
    colors: list[typing.Any] | None = None,
    sort_by: typing.Callable | None = None,
    filter_by: typing.Callable[[_Base], bool] | None = None,
    select_by: (
        typing.Callable[
            [list[tuple[_Base, obspy.Stream]], EventData],
            list[tuple[_Base, obspy.Stream]],
        ]
        | None
    ) = None,
    plot_using: PlotProperties | matplotlib.axes.Axes = PlotProperties(
        width=11.5, height=6.33, dpi=100
    ),
    data_selection_configuration: str | None = None,
    fast_unsafe: bool = False,
) -> matplotlib.axes.Axes: ...
ARGUMENTS
Required
data
Type:str | list[str]
Description:
Data name or list of data names to plot.
Required
event
Type:str | Event
Description:
The event to use.
Required
receiver_field
Type:str
Description:
The receiver field to plot.
Required
component
Type:str
Description:
The component to plot.
Optional
colors
Type:list[typing.Any] | None
Default value:None
Description:
The colors for the individual traces. Must be exactly as many colors as data items. If not given, it will attempt to choose suitable colors.
Optional
sort_by
Type:typing.Callable | None
Default value:None
Description:
Callback function called with the receiver objects to determine the sorting. Works like the key callback for the standard Python sorted() method.
Optional
filter_by
Type:typing.Callable[[_Base], bool] | None
Default value:None
Description:
Callback function called with the receiver objects in internal Salvus format to determine the filtering. Works like the callback for the standard Python filter() method. For complex filter operations requiring all receivers, defer to the select_by method.
Optional
select_by
Type:typing.Callable[[list[tuple[_Base, obspy.Stream]], EventData], list[tuple[_Base, obspy.Stream]]] | None
Default value:None
Description:
Callback function called with a list of tuples in the receiver objects in both internal Salvus and ObsPy Stream format, as well as the EventData objects.
Optional
plot_using
Type:PlotProperties | matplotlib.axes.Axes
Default value:PlotProperties(width=11.5, height=6.33, dpi=100)
Description:
The configuration of the axis to create or reuse. Will default to the standard size as defined in the PlotProperties dataclass.
Optional
data_selection_configuration
Type:str | None
Default value:None
Description:
The data selection configuration to use.
Optional
fast_unsafe
Type:bool
Default value:False
Description:
Collect data on the largest instead of smallest time step. Will potentially alias data if largest time step of the data is larger than the highest relevant frequencies across the data, but does speed up plotting in cases where time axes are restrictive, e.g. simulations with relatively many time steps, which would normally lead to massive interpolation expense.
VisualizationComponent.waveforms()
Single receiver but potentially multi-component wiggle plot.
Returns a list of error messages if one or more components of the data could not be retrieved.
SIGNATURE
def waveforms(
    self,
    data: str | list[str],
    event: str | Event,
    receiver_name: str,
    receiver_field: str,
    data_selection_configuration: str | None = None,
    apply_data_selection_configuration: bool = False,
    _cache: dict | None = None,
) -> list[str]: ...
ARGUMENTS
Required
data
Type:str | list[str]
Description:
One or more waveform names to plot.
Required
event
Type:str | Event
Description:
Event for which to plot waveforms.
Required
receiver_name
Type:str
Description:
Receiver name for which to plot waveforms.
Required
receiver_field
Type:str
Description:
The receiver field to plot.
Optional
data_selection_configuration
Type:str | None
Default value:None
Description:
Data selection configuration to apply.
Optional
apply_data_selection_configuration
Type:bool
Default value:False
Description:
If True, a potentially given data selection configuration will be applied, otherwise interval windows within the data selection configuration will just be plotted in the background.
Optional
_cache
Type:dict | None
Default value:None
Description:
A dictionary that will optionally be used to cache output. The caller is responsible for evicting/clearing the cache.
PAGE CONTENTS