Plotting#

pylick.plot.spectrum_simple(wave, flux, ferr=None, mask=None, ax=None, settings={})#

Plots spetrum and associated errors (if given). A large error (9e9) is assigned to masked pixels, making them appear as vertical lines. Additional settings may be passed as a dictionary using settings.

Parameters:
  • wave (np.ndarray) – wavelength sampling of the spectrum

  • flux (np.ndarray) – spectral fluxes corresponding to spec_wave

  • ferr (np.ndarray, optional) – spectral fluxes’ uncertainties. Defaults to None.

  • mask (np.ndarray, optional) – boolean array flagging bad pixels to interpolate over. Defaults to None.

  • ax (Axes, optional) – overplot onto the provided ax object, otherwise create new figure. Defaults to None.

  • settings (dict, optional) – further instructions for the plot code. Defaults to {}.

Returns:

Figure

Return type:

Figure

pylick.plot.spectrum_with_indices(wave, flux, index_regions, index_names, index_units, z=None, ferr=None, mask=None, ax=None, index_done=None, settings={})#

Plots spectrum_simple() with indices overlayed.

Parameters:
  • wave (np.ndarray) – wavelength sampling of the spectrum

  • flux (np.ndarray) – spectral fluxes corresponding to spec_wave

  • ferr (np.ndarray, optional) – spectral fluxes’ uncertainties. Defaults to None.

  • mask (np.ndarray, optional) – boolean array flagging bad pixels to interpolate over. Defaults to None.

  • ax (Axes, optional) – overplot onto the provided ax object, otherwise create new figure. Defaults to None.

  • settings (dict, optional) – further instructions for the plot code. Defaults to {}.

Returns:

Figure

Return type:

Figure

Additional settings#

Here below you will find the default settings dictionary which can be adapted for your needs. Other modifications can be made by accessing the figure object that is returned, e.g., fig = plot.spectrum_simple(…); fig.gca().set_xlim().

settings = {'figsize': (8,4.8),
            'xlab': r'Restframe wavelength [$\AA$]',
            'ylab': r'Flux [unitless]',
            # Colors of: flux, ferr, indices
            'spec_colors': ['#000080', '#8E8EC2', (.4,.4,.4,1)],
            # Style of the index patches (1: vband, 2: box)
            'ind_style': 1,
            # Fontsizes of: title, labels, indices
            'spec_fontsizes': [14, 14, 13],
            'format': '.pdf',
            # Debug
            'inspect': False,
            # Filename.ext of the plot to be saved
            'filename': None,
           }