resistics.plot module

Module to help plotting various data

resistics.plot.lttb_downsample(x: numpy.ndarray, y: numpy.ndarray, max_pts: int = 5000) Tuple[numpy.ndarray, numpy.ndarray][source]

Downsample x, y for visualisation

Parameters
  • x (np.ndarray) – x array

  • y (np.ndarray) – y array

  • max_pts (int, optional) – Maximum number of points after downsampling, by default 5000

Returns

(new_x, new_y), the downsampled x and y arrays

Return type

Tuple[np.ndarray, np.ndarray]

Raises

ValueError – If the size of x does not match the size of y

resistics.plot.apply_lttb(data: numpy.ndarray, max_pts: Optional[int]) Tuple[numpy.ndarray, numpy.ndarray][source]

Apply lttb downsampling if max_pts is not None

There is a helper function

Parameters
  • data (np.ndarray) – The data to downsample

  • max_pts (Union[int, None]) – The maximum number of points or None. If None, no downsamping is performed

Returns

Indices and data selected for plotting

Return type

Tuple[np.ndarray, np.ndarray]

resistics.plot.plot_timeline(df: pandas.core.frame.DataFrame, y_col: str, title: str = 'Timeline', ref_time: Optional[pandas._libs.tslibs.timestamps.Timestamp] = None) plotly.graph_objs._figure.Figure[source]

Plot a timeline

Parameters
  • df (pd.DataFrame) – DataFrame with the first and last times of the horizontal bars

  • y_col (str) – The column to use for the y axis

  • title (str, optional) – The title for the plot, by default “Timeline”

  • ref_time (Optional[pd.Timestamp], optional) – The reference time, by default None

Returns

Plotly figure

Return type

go.Figure

resistics.plot.get_calibration_fig() plotly.graph_objs._figure.Figure[source]

Get a figure for plotting calibration data

Returns

Plotly figure

Return type

go.Figure

resistics.plot.get_time_fig(chans: List[str], y_axis_label: Dict[str, str]) plotly.graph_objs._figure.Figure[source]

Get a figure for plotting time data

Parameters
  • chans (List[str]) – The channels to plot

  • y_axis_label (Dict[str, str]) – The labels to use for the y axis

Returns

Plotly figure

Return type

go.Figure

resistics.plot.get_spectra_stack_fig(chans: List[str], y_axis_label: Dict[str, str]) plotly.graph_objs._figure.Figure[source]

Get a figure for plotting spectra stack data

Parameters
  • chans (List[str]) – The channels to plot

  • y_axis_label (Dict[str, str]) – The y axis labels

Returns

Plotly figure

Return type

go.Figure

resistics.plot.get_spectra_section_fig(chans: List[str]) plotly.graph_objs._figure.Figure[source]

Get figure for plotting spectra sections

Parameters

chans (List[str]) – The channels to plot

Returns

Plotly figure

Return type

go.Figure