sprit.sprit_plot module¶
- sprit.sprit_plot.parse_plot_string(plot_string)[source]¶
Function to parse a plot string into a list readable by plotting functions
- Parameters:
- plot_stringstr
Plot string used by sprit.plot_hvsr to define results plot
- Returns:
- list
A list readable by various sprit plotting functions to show what to include in the results plot.
- sprit.sprit_plot.plot_cross_section(hvsr_data, title=None, fig=None, ax=None, use_elevation=True, show_feet=False, primary_unit='m', show_curves=True, annotate_curves=False, curve_alignment='peak', grid_size='auto', orientation='WE', interpolation_type='cloughtocher', interpolate_log_values=True, surface_elevations=None, show_peak_points=True, smooth_bedrock_surface=False, depth_limit=150, minimum_elevation=None, show_bedrock_surface=True, return_data_batch=True, show_cross_section=True, verbose=False, **kwargs)[source]¶
Functio to plot a cross section given an HVSRBatch or similar object
- Parameters:
- hvsr_dataHVSRBatch, list, or similar
HVSRBatch (intended usage) object with HVSRData objects to show in profile/cross section view
- titlestr, optional
Title to use for plot, by default None
- figmatplotlib.Figure, optional
Figure to use for plot, by default None
- axmatplotlib.Axis, optional
Axis to use for plot, by default None
- use_elevationbool, optional
Whether to use elevation (if True) or depth (if False), by default True
- show_feetbool, optional
Whether to show feet (if True) or meters (if False), by default False
- primary_unitstr, optional
Primary unit to use (‘m’ or ‘ft’), by default ‘m’
- show_curvesbool, optional
Whether to also show curves on plot, by default True
- annotate_curvesbool, optional
Whether to annotate curves by plotting site names next to them, by default False
- curve_alignmentstr, optional
How to horizontally align the curve. If “peak” the curve will be aligned so that the peak is at the correct latitude or longitude. If “max” will align the maximum point of the curve to the correct location. If any other value, will align at the surface (i.e., highest frequency). By default ‘peak’.
- grid_sizelist, optional
Two item list with height and width of grid for interpolation. If “auto” this will be calculated based on the data, by default ‘auto’.
- orientationstr, optional
The orientation of the cross section. Should be either “WE”, “EW”, “NS”, or “SN”, by default ‘WE’.
- interpolation_typestr, optional
Interpolation type to use. Uses scipy.interpolation. Options include: ‘cloughtocher’, ‘nearest neighbor’, ‘linear’, or ‘radial basis function’, by default ‘cloughtocher’.
- interpolate_log_valuesbool, optional
Whether to use log values of the H/V curve for interpolation (can be useful for better normalizing data)
- surface_elevationsshapely.LineString, optional
A shapely.LineString object containing surface elevation coordinates along cross section path. If None, uses elevation data in HVSRBatch specified by hvsr_data, by default None.
- show_peak_pointsbool, optional
Whether to plot small triangles where peaks were picked, by default True
- smooth_bedrock_surfacebool, optional
Whether to smooth the bedrock surface when plotting, by default False
- depth_limitint, optional
Depth limit for the plot, by default 150
- minimum_elevation_type_, optional
Minimum elevation of the plot, by default None
- show_bedrock_surfacebool, optional
Whether to show the bedrock surface, by default True
- return_data_batchbool, optional
Whether to return the HVSRBatch object, by default True
- show_cross_sectionbool, optional
Whether to show the cross section plot, by default True
- verbosebool, optional
Whether to print information about the process to terminal, by default False
- Returns:
- figure
Currently only matplotlib figure supported
- sprit.sprit_plot.plot_depth_curve(hvsr_results, use_elevation=True, show_feet=False, normalize_curve=True, depth_limit=250, max_elev=None, min_elev=None, annotate=True, depth_plot_export_path=None, fig=None, ax=None, show_depth_curve=True)[source]¶
- sprit.sprit_plot.plot_input_stream(hv_data, stream=None, input_fig=None, plot_engine='plotly', spectrogram_component='Z', decimate=True, show_plot=True, return_fig=False, **kwargs)[source]¶
Function to plot input stream using plotly.
- Parameters:
- hv_dataHVSRData
- streamobspy.stream.Stream
Can explictly specify stream instead of using hv_data object.
- input_figplotly.Figure
Plotly figure to plot input stream on. If None, creates new one. Default is None.
- spectrogram_componentstr, default=’Z’
Which component to use for the spectrogram
- show_plotbool, default=True
Whether to show plot or just generate it.
- return_figbool, default=False
Whether to return figure
- Returns:
- plotly figure
Only returned if return_fig is True
- sprit.sprit_plot.plot_outlier_curves(hvsr_data, plot_engine='plotly', plotly_module='go', remove_outliers_during_plot=False, rmse_thresh=0.98, use_percentile=True, use_hv_curve=False, from_roc=False, show_plot=True, verbose=False, discarded_curves=None)[source]¶
Functio to plot outlier curves, including which have been excluded
- Parameters:
- hvsr_dataHVSRData
Input data object
- plot_enginestr = {‘plotly’, ‘matplotlib’}
Which plotting library to use, by default ‘plotly’
- plotly_modulestr = {‘go’, ‘px’}
Which plotly module to use if applicable, by default ‘go’
- remove_outliers_during_plotbool, optional
Whether curves should also be removed when plotted. During sprit.run(), removal happens separately, so this is False.
- rmse_threshfloat, optional
RMSE threshold (for removing outliers), by default 0.98
- use_percentilebool, optional
Whether to use percentile or raw value, by default True
- use_hv_curvebool, optional
Whether to perform analysis on HV curves (if True) or PSD curves (if False), by default False
- from_rocbool, optional
Helper parameter to determine if this is being called from sprit.remove_outlier_curves function, by default False
- show_plotbool, optional
Whether to show plot, by default True
- verbosebool, optional
Whether to print information to terminal, by default False
- Returns:
- plotly figure
Figure type depends on plotly_module
- sprit.sprit_plot.plot_results(hv_data, plot_string='HVSR p ann C+ p SPEC ann', azimuth='HV', results_fig=None, results_graph_widget=None, use_figure_widget=False, return_fig=False, show_results_plot=False, html_plot=False, verbose=False)[source]¶
Function to plot results using plotly
- Parameters:
- hv_datasprit.HVSRData
Data object to use for plotting
- plot_stringstr, optional
String for designating what to include in plot(s), by default ‘HVSR p ann C+ p SPEC ann’
- results_figpyplot figure, optional
Which pyplot figure to plot data onto. If None, makes new figure, by default None.
- results_graph_widgetplotly graph object widget, optional
Which pyplot figure to plot data onto. If None, makes new widget, if applicable, by default None.
- use_figure_widgetbool, optional
Whether to use figure widget, by default False
- return_figbool, optional
Whether to return figure, by default False
- show_results_plotbool, optional
Wheather to show plot, by default False
- html_plotbool, optional
Whether to create an HTML version of the plot, by default False
- verbosebool, optional
Whether to print information to terminal, by default False
- Returns:
- plotly figure
Only if return_fig is True.