nifty.cl.plot module#

class Plot[source]#

Bases: object

__init__()[source]#
add(f, **kwargs)[source]#

Add a figure to the current list of plots.

Notes

After doing one or more calls add(), one needs to call output() to show or save the plot.

Parameters:
  • f (nifty.cl.field.Field or list of nifty.cl.field.Field or None) – If f is a single Field, it must be defined on a single RGSpace, PowerSpace, HPSpace, GLSpace. If it is a list, all list members must be Fields defined over the same one-dimensional RGSpace or PowerSpace. If f is None, an empty panel will be displayed.

  • Parameters (Optional)

  • -------------------

  • title (string) – Title of the plot.

  • xlabel (string) – Label for the x axis.

  • ylabel (string) – Label for the y axis.

  • [xyz]min (float) – Limits for the values to plot.

  • [xyz]max (float) – Limits for the values to plot.

  • cmap (string) – Color map to use for the plot (if it is a 2D plot).

  • linewidth (float or list of floats) – Line width.

  • label (string of list of strings) – Annotation string.

  • alpha (float or list of floats) – Transparency value.

  • freq_space_idx (int) – for multi-frequency plotting: index of frequency space in domain

  • color_mapping_kwargs (dict) –

    for multi-frequency plotting: configures the false-colour projection. Keys are named exactly as the arguments of SpectrumToRGBProjector and its set_luminance_range():

    • spectral_axis_type, visible_bin_width, flux_convention — each defaults with a warning if omitted.

    • Y_saturation, Y_black, dynamic_range, highlights — the displayed luminance range. Without Y_saturation (or quantiles) each image is normalised to its own maximum and images are not comparable; giving Y_black, dynamic_range or highlights in that case raises, since they would otherwise be silently discarded.

    • quantiles — pair of quantiles the luminance range is derived from, using the data being plotted. Mutually exclusive with Y_saturation.

    • log_compression — bool, logarithmic luminance compression.

    Unknown keys raise.

output(**kwargs)[source]#

Plot the accumulated list of figures.

Parameters:
  • title (string) – Title of the full plot.

  • nx (int) – Number of subplots to use in x- and y-direction. Default: square root of the numer of plots, rounded up.

  • ny (int) – Number of subplots to use in x- and y-direction. Default: square root of the numer of plots, rounded up.

  • xsize (float) – Dimensions of the full plot in inches. Default: 6.

  • ysize (float) – Dimensions of the full plot in inches. Default: 6.

  • name (string) – If left empty, the plot will be shown on the screen, otherwise it will be written to a file with the given name. Supported extensions: .png and .pdf. Default: None.

  • block (bool) – Override the blocking behavior of the non-interactive plotting mode. The plot will not be closed in this case but is left open!

prepare(**kwargs)[source]#

Prepare the Plot the accumulated list of figures.

This function returns a figure object and may be used for custom plot saving routines.

Parameters:
  • title (string) – Title of the full plot.

  • nx (int) – Number of subplots to use in x- and y-direction. Default: square root of the numer of plots, rounded up.

  • ny (int) – Number of subplots to use in x- and y-direction. Default: square root of the numer of plots, rounded up.

  • xsize (float) – Dimensions of the full plot in inches. Default: 6.

  • ysize (float) – Dimensions of the full plot in inches. Default: 6.

Note

It is the responsibility of the user to call plt.close() after they are done with processing the figure.

plottable1D(f)[source]#
plottable2D(fld, f_space=1)[source]#