rizer.io.lte_data_reader_common#

Shared CSV-loading and plotting machinery for the LTE property readers.

Functions#

load_lte_csv(→ numpy.ndarray)

Load an LTE-format data CSV (comma-delimited, 3-line header).

check_monotonic_temperature(→ None)

Raise ValueError unless temperature is strictly increasing.

render_lte_plot(→ tuple[matplotlib.figure.Figure, ...)

Draw a resolved (x, y) LTE-property curve.

Module Contents#

rizer.io.lte_data_reader_common.load_lte_csv(path: pathlib.Path) numpy.ndarray#

Load an LTE-format data CSV (comma-delimited, 3-line header).

Shared by ThermoTransportDataReader.load_data and RadiationDataReader.load_data. Callers wrap the call (together with unpacking the returned columns, so a wrong column count is also caught) in a try/except ValueError to raise a file-specific “invalid format” message.

Parameters:

path (pathlib.Path) – Path to the data file.

Returns:

Raw 2-D array, one row per temperature, as returned by numpy.genfromtxt.

Return type:

numpy.ndarray

rizer.io.lte_data_reader_common.check_monotonic_temperature(temperature: numpy.ndarray, path: pathlib.Path) None#

Raise ValueError unless temperature is strictly increasing.

Parameters:
  • temperature (numpy.ndarray) – Temperature column read from path, in Kelvin.

  • path (pathlib.Path) – Data file temperature was read from, referenced in the error message.

Raises:

ValueError – If temperature is not monotonically increasing.

rizer.io.lte_data_reader_common.render_lte_plot(x_name: str, x_label: str, x_unit: str, x_data: numpy.ndarray, y_name: str, y_label: str, y_unit: str, y_data: numpy.ndarray, ax_title: str, yscale: str, fig_ax: tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] | None, show: bool, plot_options: dict) tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]#

Draw a resolved (x, y) LTE-property curve.

Shared tail of ThermoTransportDataReader.plot and RadiationDataReader.plot, once each has resolved its own x/y keys to a (name, label, data, unit) tuple.

Parameters:
  • x_name (str) – Human-readable names of the plotted quantities, used in the figure title.

  • y_name (str) – Human-readable names of the plotted quantities, used in the figure title.

  • x_label (str) – Math-mode axis labels.

  • y_label (str) – Math-mode axis labels.

  • x_unit (str) – Math-mode axis units.

  • y_unit (str) – Math-mode axis units.

  • x_data (numpy.ndarray) – Data to plot.

  • y_data (numpy.ndarray) – Data to plot.

  • ax_title (str) – Axes title.

  • yscale (str) – Y-axis scale, forwarded to Axes.set_yscale.

  • fig_ax (tuple of matplotlib.figure.Figure, matplotlib.axes.Axes or None) – Figure/axes to plot on; a new figure is created if None.

  • show (bool) – Whether to call matplotlib.pyplot.show.

  • plot_options (dict) – Additional keyword arguments forwarded to Axes.plot.

Returns:

The figure and axes objects of the plot.

Return type:

tuple of matplotlib.figure.Figure, matplotlib.axes.Axes