py21cmfast.plotting¶
Simple plotting functions for 21cmFAST objects.
Attributes¶
Functions¶
|
Show a slice of a given coeval box. |
|
Create a 2D plot of a slice through a lightcone. |
|
Plot the global history of a given quantity from a lightcone. |
Module Contents¶
- py21cmfast.plotting.coeval_sliceplot(struct, kind=None, cbar_label=None, **kwargs)[source]¶
Show a slice of a given coeval box.
- Parameters:
struct (
_OutputStructorCoevalinstance) – The output of a function such as ionize_box (a class containing several quantities), or run_coeval.kind (str or nd-array) –
- If str: The quantity within the structure to be shown. A full list of available options
can be obtained by running
Coeval.get_fields().- If nd-array: A 3D box to be shown. This could be useful for plotting the coeval brightness temperature box
after redshift space distortions have been applied.
cbar_label (str, optional) – A label for the colorbar. Some values of kind will have automatically chosen labels, but these can be turned off by setting
cbar_label=''.
- Returns:
fig, ax – figure and axis objects from matplotlib
- Other Parameters:
All other parameters are passed directly to :func:`_imshow_slice`. These include `slice_axis`
and `slice_index`,
which choose the actual slice to plot, optional `fig` and `ax` keywords which enable
over-plotting previous figures,
and the `imshow_kw` argument, which allows arbitrary styling of the plot.
- Parameters:
struct (py21cmfast.wrapper.outputs._OutputStruct | py21cmfast.drivers.coeval.Coeval)
kind (str | None)
cbar_label (str | None)
- py21cmfast.plotting.lightcone_sliceplot(lightcone, kind='brightness_temp', lightcone2=None, vertical=False, xlabel=None, ylabel=None, cbar_label=None, zticks='redshift', fig=None, ax=None, z_range=None, **kwargs)[source]¶
Create a 2D plot of a slice through a lightcone.
- Parameters:
lightcone (
Lightcone) – The lightcone object to plotkind (str, optional) – The attribute of the lightcone to plot. Must be an array.
lightcone2 (str, optional) – If provided, plot the _difference_ of the selected attribute between the two lightcones.
vertical (bool, optional) – Whether to plot the redshift in the vertical direction.
cbar_label (str, optional) – A label for the colorbar. Some quantities have automatically chosen labels, but these can be removed by setting cbar_label=’’.
zticks (str, optional) – Defines the co-ordinates of the ticks along the redshift axis. Can be “redshift” (default), “frequency”, “distance” (which starts at zero for the lowest redshift) or the name of any function in an astropy cosmology that is purely a function of redshift.
kwargs – Passed through to
imshow().
- Returns:
fig – The matplotlib Figure object
ax – The matplotlib Axis object onto which the plot was drawn.
- Parameters:
lightcone (py21cmfast.drivers.lightcone.LightCone)
kind (str)
lightcone2 (py21cmfast.drivers.lightcone.LightCone)
vertical (bool)
xlabel (str | None)
ylabel (str | None)
cbar_label (str | None)
zticks (str)
fig (matplotlib.pyplot.Figure | None)
ax (matplotlib.pyplot.Axes | None)
- py21cmfast.plotting.plot_global_history(lightcone, kind=None, ylabel=None, ylog=False, ax=None, zmax=None, **kwargs)[source]¶
Plot the global history of a given quantity from a lightcone.
- Parameters:
lightcone (
LightConeinstance) – The lightcone containing the quantity to plot.kind (str, optional) – The quantity to plot. Must be in the global_quantities dict in the lightcone. By default, will choose the first entry in the dict.
ylabel (str, optional) – A y-label for the plot. If None, will use
kind.ax (Axes, optional) – The matplotlib Axes object on which to plot. Otherwise, created.
- Parameters:
lightcone (py21cmfast.drivers.lightcone.LightCone)
kind (str | None)
ylabel (str | None)
ylog (bool)
ax (matplotlib.pyplot.Axes | None)
zmax (float | None)