visualize

Methods that assist in visualizing the CT scans of rock cores.

core_ct.visualize.display_core(core: ~core_ct.core.Core, mm: bool = False) -> (<class 'matplotlib.figure.Figure'>, <class 'matplotlib.axes._axes.Axes'>)[source]

Create an orthogonal view of the core to aid in understanding the core orientation.

Displays three cross-sections of the core object in one figure. Each slice is taken at the center of the collapsed axis for convenience. Option to have axes shown in pixels or millimeters.

Parameters:
  • core (Core) – Core object to visualize

  • mm (bool) – If set to True, will show plot axes in mm - default is pixels

Returns:

  • matplotlib.figure.Figure – Object containing the subplots

  • list[matplotlib.axes.Axes] – Each axis contains display information for each view of the core

core_ct.visualize.display_slice(slice: Slice, mm: bool = False) AxesImage[source]

Display an image of a single slice of a core using matplotlib’s imshow function.

Plots a colorbar alongside the slice showing the range of pixel values in the slice. Option to have axes shown in pixels or millimeters.

Parameters:
  • slice (Slice) – Slice object to display

  • mm (bool) – If set to True, will show plot axes in mm - default is pixels

Returns:

Object returned by imshow

Return type:

matplotlib.image.AxesImage

core_ct.visualize.display_slice_bt_std(slice: ~core_ct.slice.Slice, mm: bool = False) -> (<class 'matplotlib.figure.Figure'>, <class 'matplotlib.axes._axes.Axes'>)[source]

Display a core slice and corresponding brightness trace and standard deviation.

Parameters:
  • slice (Slice) – Slice object to display

  • mm (bool) – If set to True, will show plot axes in mm - default is pixels

Returns:

  • matplotlib.figure.Figure – Object containing the subplots

  • list[matplotlib.axes.Axes] – Each axis contains display information for each view of the core

core_ct.visualize.visualize_trim(slice: Slice, axis: int, loc_start: int, loc_end: int | None = None) AxesImage[source]

Overlay trim lines onto a slice to illustrate where a trim would occur.

Parameters:
  • slice (Slice) – Slice object to visualize

  • axis (int) –

    Integer either 0 or 1 indicating what axis to display the trim on

    0: corresponds to the y axis (row), so a horizontal line will be plotted

    1: corresponds to the x axis (column), so a vertical line will be plotted

  • loc_start (int) – Integer index specifying where the first line will be plotted

  • loc_end (int) – If given, is an integer specifying where the second line will be plotted as a distance from the end of the axis. Therefore the actual index will be len(axis)-loc_end. If not given, loc_end is equal to loc_start so the trim will be symmetric

Returns:

Object returned by imshow

Return type:

matplotlib.image.AxesImage

Raises:
  • ValueError – If axis is a value other than 0 or 1

  • IndexError – If amount trimmed from end causes the ending index to be to the left of the starting index

  • IndexError – If start_loc or end_loc is out of bounds of the axis length