salvus.project.components.visualization.visualization_component
The visualization component of SalvusProject.
Classes
VisualizationComponent
VisualizationComponentclass VisualizationComponent(builtins.object):
def __init__(self, project: salvus.project.Project): ...Project subclass dealing with all things related to visualizations.
Parameters
projectsalvus.project.Project — The project to attach the visualization component to.
Methods
custom_gather()
custom_gather()def custom_gather(
self,
data: Union[str, List[str]],
event: Union[str, salvus.flow.collections.event.Event],
receiver_field: str,
component: str,
sort_by: Optional[Callable] = None,
filter_by: Optional[
Callable[[salvus.flow.simple_config.receiver._Base], bool]
] = None,
select_by: Optional[
Callable[
[
List[
Tuple[
salvus.flow.simple_config.receiver._Base,
obspy.core.stream.Stream,
]
],
salvus.flow.collections.event_data.EventData,
],
List[
Tuple[
salvus.flow.simple_config.receiver._Base,
obspy.core.stream.Stream,
]
],
]
] = None,
interleave: bool = False,
colors: Optional[List[Any]] = None,
alpha: Optional[float] = None,
plot_using: Union[
salvus.flow.collections.event_data.PlotProperties,
matplotlib.axes._axes.Axes,
] = PlotProperties(width=11.5, height=6.33, dpi=100),
data_selection_configuration: Optional[str] = None,
fast_unsafe: bool = False,
) -> matplotlib.axes._axes.Axes: ...Plot a, potentially interleaved, custom gather.
Parameters
dataUnion[str, List[str]] — Data name or list of data names to plot.eventUnion[str, salvus.flow.collections.event.Event] — The event to use.receiver_fieldstr — The receiver field to plot.componentstr — The component to plot.sort_byOptional[Callable] — Callback function called with the receiver objects to determine the sorting. Works like thekeycallback for the standard Pythonsorted()method.filter_byOptional[Callable[[salvus.flow.simple_config.receiver._Base], bool]] — Callback function called with the receiver objects in internal Salvus format to determine the filtering. Works like the callback for the standard Pythonfilter()method. For complex filter operations requiring all receivers, defer to theselect_bymethod.select_byOptional[Callable[[List[Tuple[salvus.flow.simple_config.receiver._Base, obspy.core.stream.Stream]], salvus.flow.collections.event_data.EventData], List[Tuple[salvus.flow.simple_config.receiver._Base, obspy.core.stream.Stream]]]] — 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.interleavebool — Whether or not to alternatingly plot data. If false, traces from all data will be plotted on top of each other.colorsOptional[List[Any]] — 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.alphaOptional[float] — The opacity of all data, as used in Matplotlib. useful when setting interleave to false.plot_usingUnion[salvus.flow.collections.event_data.PlotProperties, matplotlib.axes._axes.Axes] — The configuration of the axis to create or reuse. Will default to the standard size as defined in the PlotProperties dataclass.data_selection_configurationOptional[str] — The data selection configuration to use.fast_unsafebool — 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.
Returns matplotlib.axes._axes.Axes
interval_window_statistics()
interval_window_statistics()def interval_window_statistics(
self, data_selection_configuration: str
) -> pandas.io.formats.style.Styler: ...Styled table to get an overview of all picked windows for a given data selection configuration.
Parameters
data_selection_configurationstr — The data selection configuration whose windows to plot.
Returns pandas.io.formats.style.Styler
misfit_histogram()
misfit_histogram()def misfit_histogram(
self,
simulation_configuration_a: str,
simulation_configuration_b: Optional[str] = None,
misfit_configuration: str,
events: Union[
str,
salvus.flow.collections.event.Event,
List[Union[str, salvus.flow.collections.event.Event]],
],
bins: int = 10,
merge_all_components: bool = False,
show: bool = True,
) -> Optional[matplotlib.figure.Figure]: ...Compute histograms of misfits.
Parameters
simulation_configuration_astr — Name of the simulation configuration whose misfits to plot.simulation_configuration_bOptional[str] — Optionally plot misfits of a second configuration to be able to compare two configurations.misfit_configurationstr — The misfit configuration to use for the comparison.eventsUnion[str, salvus.flow.collections.event.Event, List[Union[str, salvus.flow.collections.event.Event]]] — The events to use. It will produce a cumulative histogram over the given events.binsint — How many bins to use.merge_all_componentsbool — If False, a separate histogram will be computed for each component, otherwise a single histogram will be computed by merging all misfit measurements.showbool — IfTruethe figure will be shown immediately. Otherwise the matplotlib figure object will be returned.
Returns Optional[matplotlib.figure.Figure]
shotgather()
shotgather()def shotgather(
self,
data: Union[str, List[str]],
event: Union[str, salvus.flow.collections.event.Event],
receiver_field: str,
component: str,
colors: Optional[List[Any]] = None,
sort_by: Optional[Callable] = None,
filter_by: Optional[
Callable[[salvus.flow.simple_config.receiver._Base], bool]
] = None,
select_by: Optional[
Callable[
[
List[
Tuple[
salvus.flow.simple_config.receiver._Base,
obspy.core.stream.Stream,
]
],
salvus.flow.collections.event_data.EventData,
],
List[
Tuple[
salvus.flow.simple_config.receiver._Base,
obspy.core.stream.Stream,
]
],
]
] = None,
plot_using: Union[
salvus.flow.collections.event_data.PlotProperties,
matplotlib.axes._axes.Axes,
] = PlotProperties(width=11.5, height=6.33, dpi=100),
data_selection_configuration: Optional[str] = None,
fast_unsafe: bool = False,
) -> matplotlib.axes._axes.Axes: ...Plot a, potentially interleaved, shotgather.
Parameters
dataUnion[str, List[str]] — Data name or list of data names to plot.eventUnion[str, salvus.flow.collections.event.Event] — The event to use.receiver_fieldstr — The receiver field to plot.componentstr — The component to plot.colorsOptional[List[Any]] — 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.sort_byOptional[Callable] — Callback function called with the receiver objects to determine the sorting. Works like thekeycallback for the standard Pythonsorted()method.filter_byOptional[Callable[[salvus.flow.simple_config.receiver._Base], bool]] — Callback function called with the receiver objects in internal Salvus format to determine the filtering. Works like the callback for the standard Pythonfilter()method. For complex filter operations requiring all receivers, defer to theselect_bymethod.select_byOptional[Callable[[List[Tuple[salvus.flow.simple_config.receiver._Base, obspy.core.stream.Stream]], salvus.flow.collections.event_data.EventData], List[Tuple[salvus.flow.simple_config.receiver._Base, obspy.core.stream.Stream]]]] — 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.plot_usingUnion[salvus.flow.collections.event_data.PlotProperties, matplotlib.axes._axes.Axes] — The configuration of the axis to create or reuse. Will default to the standard size as defined in the PlotProperties dataclass.data_selection_configurationOptional[str] — The data selection configuration to use.fast_unsafebool — 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.
Returns matplotlib.axes._axes.Axes
waveforms()
waveforms()def waveforms(
self,
data: Union[str, List[str]],
event: Union[str, salvus.flow.collections.event.Event],
receiver_name: str,
receiver_field: str,
data_selection_configuration: Optional[str] = None,
apply_data_selection_configuration: bool = False,
) -> List[str]: ...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.
Parameters
dataUnion[str, List[str]] — One or more waveform names to plot.eventUnion[str, salvus.flow.collections.event.Event] — Event for which to plot waveforms.receiver_namestr — Receiver name for which to plot waveforms.receiver_fieldstr — The receiver field to plot.data_selection_configurationOptional[str] — Data selection configuration to apply.apply_data_selection_configurationbool — 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.
Returns List[str]