resistics.plot module#

Module to help plotting various data

resistics.plot.lttb_downsample(x: ndarray, y: ndarray, max_pts: int = 5000) Tuple[ndarray, 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: ndarray, max_pts: int | None) Tuple[ndarray, ndarray][source]#

A helper function for applying lttb downsampling if max_pts is not None

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: DataFrame, y_col: str, title: str = 'Timeline', ref_time: Timestamp | None = None) 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() 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]) 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]) 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]) Figure[source]#

Get figure for plotting spectra sections

Parameters:

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

Returns:

Plotly figure

Return type:

go.Figure