lightcurvelynx.utils.plotting

A collection of functions for plotting and visualization.

Functions

plot_lightcurves(fluxes, times, *[, fluxerrs, ...])

Plot one or more light curves.

plot_bandflux_lightcurves(bandflux[, times, ax, ...])

Plot one or more light curves where each band is observed at each time.

plot_flux_spectrogram(flux_density[, times, ...])

Plot a spectrogram to visualize the fluxes.

plot_moc(moc, *[, fig, ax])

Plot a Multi-Order Coverage (MOC) map of the sky.

Module Contents

plot_lightcurves(fluxes, times, *, fluxerrs=None, filters=None, underlying_model=None, ax=None, figure=None, title=None, colormap=None, plot_magnitudes=False, **kwargs)[source]

Plot one or more light curves.

Parameters:
  • fluxes (numpy.ndarray) – An array of T flux values.

  • times (numpy.ndarray) – A length T matrix of the times, used for setting the x axis. All times in MJD.

  • fluxerrs (numpy.ndarray or None, optional) – A length T matrix of errors on the fluxes for error bars. If not provided no error bars are created. None by default.

  • filters (numpy.ndarray or None, optional) – A length T matrix of filter names. If not provided all points are treated as coming from the same filter. None by default.

  • underlying_model (dict or None, optional) – A dictionary mapping filter names to the noise free light curves for this model. If provided, these curves will be plotted as lines behind the data points. None by default.

  • ax (matplotlib.pyplot.Axes or None, optional) – Axes, None by default.

  • figure (matplotlib.pyplot.Figure or None) – Figure, None by default.

  • title (str or None, optional) – Title of the plot. None by default.

  • colormap (dict, optional) – A dictionary that provides mapping between filters and the colors to be plotted.

  • plot_magnitudes (bool, optional) – Whether to plot magnitudes instead of fluxes. False by default.

  • **kwargs (dict) – Optional parameters to pass to the plotting function

Returns:

ax – The axes containing the plot.

Return type:

matplotlib.pyplot.Axes

plot_bandflux_lightcurves(bandflux, times=None, ax=None, figure=None, title=None)[source]

Plot one or more light curves where each band is observed at each time. This is primarily used for visualizing non-sampled data.

Parameters:
  • bandflux (numpy.ndarray or dict) – Either a single array with the light curve or a dictionary mapping light curve names to the arrays of values.

  • times (numpy.ndarray or None, optional) – A length T matrix of the times, used for setting the x axis. If not provided, uses equal spaced ticks. None by default.

  • ax (matplotlib.pyplot.Axes or None, optional) – Axes, None by default.

  • figure (matplotlib.pyplot.Figure or None) – Figure, None by default.

  • title (str or None, optional) – Title of the plot. None by default.

Returns:

ax – The axes containing the plot.

Return type:

matplotlib.pyplot.Axes

plot_flux_spectrogram(flux_density, times=None, wavelengths=None, ax=None, figure=None, title=None)[source]

Plot a spectrogram to visualize the fluxes.

Parameters:
  • flux_density (numpy.ndarray) – A length T x N matrix of SED values (in nJy), where T is the number of time steps, and N is the number of wavelengths.

  • times (numpy.ndarray or None, optional) – A length T matrix of the times, used for setting the x axis. If not provided, uses equal spaced ticks. None by default.

  • wavelengths (numpy.ndarray or None, optional) – A length N matrix of the times, used for setting the y axis. If not provided, uses equal spaced ticks. None by default.

  • ax (matplotlib.pyplot.Axes or None, optional) – Axes, None by default.

  • figure (matplotlib.pyplot.Figure or None) – Figure, None by default.

  • title (str or None, optional) – Title of the plot. None by default.

Returns:

ax – The axes containing the plot.

Return type:

matplotlib.pyplot.Axes

plot_moc(moc, *, fig=None, ax=None, **kwargs)[source]

Plot a Multi-Order Coverage (MOC) map of the sky.

Parameters:
  • moc (mocpy.MOC) – The MOC object to plot.

  • fig (matplotlib.pyplot.Figure or None, optional) – The figure to use for the plot. If None, a new figure will be created.

  • ax (matplotlib.pyplot.Axes or None, optional) – The axes to use for the plot. If None, new axes will be created on the figure.

  • kwargs (dict) – Additional keyword arguments to pass to the moc.fill() function for customizing the plot.

Returns:

  • fig (matplotlib.figure.Figure) – The figure containing the plot.

  • ax (matplotlib.pyplot.Axes) – The axes containing the plot.