py21cmfast.plotting

Simple plotting functions for 21cmFAST objects.

Attributes

Functions

coeval_sliceplot(struct[, kind, cbar_label])

Show a slice of a given coeval box.

lightcone_sliceplot(lightcone[, kind, lightcone2, ...])

Create a 2D plot of a slice through a lightcone.

plot_global_history(lightcone[, kind, ylabel, ylog, ...])

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 (_OutputStruct or Coeval instance) – 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:
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 plot

  • kind (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:
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 (LightCone instance) – 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:
py21cmfast.plotting.eor_colour[source]
py21cmfast.plotting.logger[source]