Spectra

class popurri.spectrum.Spectra(lisfil, inst, dirout='./', obj=None, tag='', deleteindividual=False, ext=0, ordcut=True, saveordnoncut=False, readblaze=True, dirblaze=None, filblaze=None)

Bases: object

Collection of (time series) spectra of the same instrument.

Methods Summary

dopplershift(lisv[, rel, x, xnew])

fig_dataord(y[, filout, sh, sv, figsize])

fig_spectra([filout, sh, sv, figsize])

plot_dataord(y[, ax, ords, lisspec, z, ...])

Plot property y vs orders for orders in ords and spectra in lisspec.

plot_spectra([ax, x, y, ords, lisspec, ...])

Plot spectra flux vs wavelength, orders in ords.

plot_spectra_map([o])

Plot spectra flux matrix, order in o.

Methods Documentation

dopplershift(lisv, rel=True, x='w', xnew='wshift')
fig_dataord(y, filout=None, sh=False, sv=True, figsize=(8, 5), **kwargs)
fig_spectra(filout=None, sh=False, sv=True, figsize=(16, 4), **kwargs)
plot_dataord(y, ax=None, ords=None, lisspec=None, z=None, xlabel='Order', ylabel=None, zlabel=None, title='', zorder=0, s=100, edgecolors='k', linewidths=0.5, ecolor=None, elinewidth=1.5, capsize=3, markeredgewidth=1.5, cmap=None, **kwargs)

Plot property y vs orders for orders in ords and spectra in lisspec. Optional color code by general spectrum property z from self.dataheader.

Expect lisspec and ord to be sorted (increasing).

plot_spectra(ax=None, x='w', y='f', ords=None, lisspec=None, wmin=None, wmax=None, update_ords=True, legendlabel=None, legendwhich='first', legendloc=None, xunit='A', xlabel=None, ylabel='Flux', title='', cprop=None, cprop_all=False, cbar=None, cbarlabel=None, cmap=None, lw=1, linestyle0='-', linestyle1='-', alpha0=1, alpha1=0.7, zorder=1)

Plot spectra flux vs wavelength, orders in ords.

Plot different observations with different colors, and optionally alternating alpha for different orders.

Parameters:
xstr

w, wshift

ystr

f

ordslist-like, optional

List of orders to plot. If None (default), all orders are plotted.

wmin, wmax: floats, optional

Override ords

update_ordsbool

Update the orders to be plotted based on the values in wmin and wmax

lisspeclist-like, optional

List of observations (the number) to plot. Default is None, which plots all spectra in lisspec.

cproparray, optional

Color based on property of the spectrum (e.g. S/N, airmass, BJD…). Uses cmap to define the color map. If cmap is None, use colormap viridis.

cprop_allbool, optional

If True, get the colorbar limits from all spectra (even the ones not plotted). If False, adapt the colorbar limits to the plotted spectra.

cbar

Add color bar. Defaults to True if cprop is not None, else defaults to False.

wmin, wmax: floats, optional

Wavelength range to plot. Must be in the same units as w (and xunit).

linestyel0, linestyle1str, optional

For alternating orders

alpha0, alpha1float, optional

For alternating orders

legendwhich‘first’ or ‘all’, optional

To label (with legendlabel) only the first spectrum in the list, or all spectra in the list. Default is ‘first’.

legendlabelstr, optional, default None

Label for the legend. Can label the first order of a single spectrum in the list, or the first order of all spectra in the list. If only the first spectrum is labelled (with legendwhich=’first’), the label should be somethign like ‘Observations’ or ‘Spectra’. If all spectra are labelled, the label will be the name of each spectra.

plot_spectra_map(o=0)

Plot spectra flux matrix, order in o. TODO