py4py.plot

Functions designed for plotting output files

plot_spec(→ matplotlib.figure.Figure)

Plots an array of python spectra imported as Tables.

plot_dat(table, grid_x, grid_z, title, label[, volume])

Plots a given py_wind .dat file for a wind property.

plot_dat_many(tables, grids_x, grids_z, x_lims, ...[, ...])

Plots multiple py_wind .dat files of a wind property for multiple models.

Module Contents

py4py.plot.plot_spec(col: str, spectra: List[astropy.table.Table], names: List[str], log_x: bool = False, log_y: bool = False, scale_to: float | None = None, lim_x: Tuple[float, float] | None = None) matplotlib.figure.Figure

Plots an array of python spectra imported as Tables.

Example

To plot the 40* viewing angle of two spectra:

plot_spec('A40P0.50', [spec_r01, spec_r10], ['1x', '10x'])
Parameters:
  • col (str) – The column in the Astropy Table containing the spectra to plot.

  • spectra (List[astropy.table.Table]) – The list of Astropy Tables containing spectra to plot.

  • names (List[str]) – The list of names of the spectra for the key.

  • log_x (bool) – Whether the x-axis should be logarithmic or not.

  • log_y (bool) – Whether the y-axis should be logarithmic or not.

  • scale_to (Optional[float]) – Whether to rescale the plot to normalise to a wavelength.

  • lim_x (Optional[Tuple[float, float]]) – If provided, the lower and upper bounds for the x-axis.

Returns:

The generated figure.

Return type:

matplotlib.figure.Figure

py4py.plot.plot_dat(table: astropy.table.Table, grid_x: numpy.typing.NDArray[numpy.floating], grid_z: numpy.typing.NDArray[numpy.floating], title: str, label: str, volume: bool = True)

Plots a given py_wind .dat file for a wind property.

Example

To plot the H-I fraction of a model:

plot_dat(
    table_h1_r01, x_r01, z_r01,
    'H-I, radius 1x', 'Log ion fraction', volume=False
)
Parameters:
  • table (astropy.table.Table) – The Astropy Table containing the output of py_wind for a property.

  • grid_x (numpy.typing.NDArray[numpy.floating]) – The bounds of the X grid for the model.

  • grid_z (numpy.typing.NDArray[numpy.floating]) – The bounds of the Z grid for the model.

  • title (str) – The title of the plot.

  • label (str) – The colour bar label.

  • volume (bool) – Whether to correct the value to be per-volume considering the model grid.

Returns:

The generated figure.

py4py.plot.plot_dat_many(tables: List[astropy.table.Table], grids_x: List[numpy.typing.NDArray[numpy.floating]], grids_z: List[numpy.typing.NDArray[numpy.floating]], x_lims: List[Tuple[float, float]], z_lims: List[Tuple[float, float]], titles: List[str], title: str, label: str, shared_y: bool = False, shared_cbar: bool = False, volume: bool = True, log: bool = True)

Plots multiple py_wind .dat files of a wind property for multiple models.

Example:

To plot the H-I fraction of multiple models::

    plot_dat_many(
        [table_h1_r01, table_h1_r10, table_h1_r30],
        [x_r01, x_r10, x_r30], [z_r01, z_r10, z_r30],
        x_lims=[(14.5, 17.5), (15.5, 17.5), (16, 17.5)],
        z_lims=[(13, 17), (13, 17), (13, 17)],
        titles=['1x Radius', '10x Radius', '30x Radius'],
        title='H-I ion fraction', label='Log ion fraction',
        shared_y=True, volume=False, shared_cbar=True
    )
Parameters:
  • tables (List[astropy.table.Table]) – The Astropy Tables containing the outputs of py_wind for a property.

  • grids_x (List[numpy.typing.NDArray[numpy.floating]]) – The bounds of the X grid for each model.

  • grids_z (List[numpy.typing.NDArray[numpy.floating]]) – The bounds of the Z grid for each model.

  • x_lims (List[Tuple[float, float]]) – The lower and upper ranges of the x-axis for each subplot.

  • z_lims (List[Tuple[float, float]]) – The lower and upper ranges of the z-axis for each subplot.

  • titles (List[str]) – The titles of the subplots.

  • title (str) – The title of the plot.

  • label (str) – The colour bar label.

  • shared_y (bool) – Whether the plots should share Y-axes.

  • shared_cbar (bool) – Whether the plots should share the colour bar.

  • volume (bool) – Whether to correct the value to be per-volume considering the model grid.

  • log (bool) – Whether the colour scale should be logarithmic or not.

Returns:

The generated figure.