Visualizations Component

Every plotting action done by LASIF goes through the Visualizations component. Map plots are made using Cartopy.

Contents:

class lasif.components.visualizations.VisualizationsComponent(communicator, component_name)[source]

Component offering project visualization. Has to be initialized fairly late as it requires a lot of data to be present.

Parameters
  • communicator – The communicator instance.

  • component_name – The name of this component for the communicator.

plot_all_rays(save_plot: bool = True, iteration: Optional[str] = None, plot_stations: bool = True, intersection_override: Optional[bool] = None, inner_boundary: bool = False)[source]

Plot all the rays that are in the project or in a specific iteration. This is typically slower than the plot_raydensity function as this one is non-parallel

Parameters
  • save_plot (bool, optional) – Should plot be saved, defaults to True

  • iteration (str, optional) – Only events from an iteration, defaults to None

  • plot_stations (bool, optional) – Whether stations are plotted on top, defaults to True

  • intersection_override (bool, optional) – boolean to require to have the same stations recording all events, i.e. the intersection of receiver sets. The intersection will consider two stations equal i.f.f. the station codes AND coordinates (LAT, LON, Z) are equal. If None is passed, the value use_only_intersection from the projects’ configuration file is used, defaults to None

plot_data_and_synthetics(event: str, iteration: str, channel_id: str, ax=None, show: bool = True)[source]

Plots the data and corresponding synthetics for a given event, iteration, and channel.

Parameters
  • event (str) – The event.

  • iteration (str) – The iteration.

  • channel_id (str) – The channel id.

  • ax (matplotlib.axes.Axes, optional) – If given, it will be plotted to this ax. Defaults to None

  • show (bool, optional) – If true, plt.show() will be called before returning. defaults to True

Returns

The potentially created axes object.

plot_domain(inner_boundary: bool = False)[source]

Plots the simulation domain and the actual physical domain.

Parameters

inner_boundary (bool, optional) – binary whether the inner boundary should be drawn Only works well for convex domains, defaults to False

plot_event(event_name: str, weight_set: Optional[str] = None, intersection_override: Optional[bool] = None, inner_boundary: bool = False)[source]

Plots information about one event on the map.

Parameters
  • event_name (str) – Name of event

  • weight_set (str, optional) – Name of station weights set, defaults to None

  • intersection_override (bool, optional) – boolean to require to have the same stations recording all events, i.e. the intersection of receiver sets. The intersection will consider two stations equal i.f.f. the station codes AND coordinates (LAT, LON, Z) are equal. If None is passed, the value use_only_intersection from the projects’ configuration file is used, defaults to None

  • inner_boundary (bool, optional) – binary whether the inner boundary should be drawn Only works well for convex domains, defaults to False

plot_events(plot_type: str = 'map', iteration: Optional[str] = None, inner_boundary: bool = False)[source]

Plots the domain and beachballs for all events on the map.

Parameters
  • plot_type (str, optional) – Determines the type of plot created. * map (default) - a map view of the events * depth - a depth distribution histogram * time - a time distribution histogram

  • iteration (str, optional) – Name of iteration, if given only events from that iteration will be plotted, defaults to None

  • inner_boundary (bool, optional) – Should we plot inner boundary of domain? defaults to False

plot_raydensity(save_plot: bool = True, plot_stations: bool = False, iteration: Optional[str] = None, intersection_override: Optional[bool] = None)[source]

Plots the raydensity. The plot will have number of ray crossings indicated with a brighter colour.

Parameters
  • save_plot (bool, optional) – Whether plot should be saved or displayed, defaults to True (saved)

  • plot_stations (bool, optional) – Do you want to plot stations on top of rays? defaults to False

  • iteration (str, optional) – Name of iteration that you only want events from, defaults to None

  • intersection_override (bool, optional) – boolean to require to have the same stations recording all events, i.e. the intersection of receiver sets. The intersection will consider two stations equal i.f.f. the station codes AND coordinates (LAT, LON, Z) are equal. If None is passed, the value use_only_intersection from the projects’ configuration file is used, defaults to None

plot_section(event_name: str, data_type: str = 'processed', component: str = 'Z', num_bins: int = 1, traces_per_bin: int = 500)[source]

Create a section plot of an event and store the plot in Output. Useful for quickly inspecting if an event is good for usage.

Parameters
  • event_name (str) – Name of the event

  • data_type (str, optional) – The type of data, one of: raw, processed (default)

  • component (str, optional) – Component of the data Z(default), N, E

  • num_bins (int, optional) – number of offset bins, defaults to 1

  • traces_per_bin (int, optional) – number of traces per bin, defaults to 500

plot_station_misfits(event_name: str, iteration: str, intersection_override=None)[source]

Plot a map of the stations where misfit was computed for a specific event. The stations are colour coded by misfit.

Parameters
  • event_name (str) – Name of event

  • iteration (str) – Name of iteration

  • intersection_override (bool, optional) – boolean to require to have the same stations recording all events, i.e. the intersection of receiver sets. The intersection will consider two stations equal i.f.f. the station codes AND coordinates (LAT, LON, Z) are equal. If None is passed, the value use_only_intersection from the projects’ configuration file is used, defaults to None

plot_window_statistics(window_set_name: str, events: List[str], ax=None, show=True)[source]

Plots the statistics of windows for one iteration.

Parameters
  • window_set_name (str) – Name of window set

  • events (List[str]) – list of events

  • ax (matplotlib.axes.Axes, optional) – If given, it will be plotted to this ax. Defaults to None

  • show (bool, optional) – If true, plt.show() will be called before returning. defaults to True

Returns

The potentially created axes object.

plot_windows(event: str, window_set_name: str, distance_bins: int = 500, ax=None, show: bool = True)[source]

Plot all selected windows on a epicentral distance vs duration plot with the color encoding the selected channels. This gives a quick overview of how well selected the windows for a certain event and iteration are.

Parameters
  • event (str) – The name of the event.

  • window_set_name (str) – The window set.

  • distance_bins (int, optional) – The number of bins on the epicentral distance axis. Defaults to 500

  • ax (matplotlib.axes.Axes, optional) – If given, it will be plotted to this ax. Defaults to None

  • show (bool, optional) – If true, plt.show() will be called before returning. defaults to True

Returns

The potentially created axes object.