f311.explorer.vis package

Submodules

f311.explorer.vis.basic module

class f311.explorer.vis.basic.Vis

Bases: object

Base class for visualizations.

Those who open multiple figures must call plt.show(), otherwise not.

action = ''
input_classes = ()
use(obj, parent_form=None)

Note: if title is None, will be replaced with obj.filename

class f311.explorer.vis.basic.VisList

Bases: Vis

Vis subclass that can handle a list of objects to visualize simultaneously

input_classes

alias of list

item_input_classes = ()
use(objs, parent_form=None)

Note: if title is None, will be replaced with obj.filename

f311.explorer.vis.plotsp module

API in functional form for plotting spectra

Routines also used by plot-spectra.py

class f311.explorer.vis.plotsp.PlotSpectrumSetup(fmt_xlabel='{.xunit}', fmt_ylabel='{.yunit}', fmt_title='{.title}', ymin=None, flag_legend=True, flag_xlabel=True, flag_ylabel=True, flag_ignore_units=True, stylespecs={})

Bases: object

Parameters:
  • fmt_xlabel – format string for x-label

  • fmt_ylabel – format string for y-label

  • fmt_title – format string for title

  • ymin – (optional) force mininum y-value

  • flag_legend – Whether to show legend in plot

  • flag_xlabel

  • flag_ylabel

  • flag_ignore_units – if True, mismatching units [between spectra] will be ignored

  • stylespecs – dictionary with optional keys “c<i>”, “lw<i>”, “s<i>” (color, line width and line style), where <i> is the 0-based spectrum index

f311.explorer.vis.plotsp.calc_max_min(ss)

“Calculates (x, y) (max, min) for a list of Spectrum objects.

Returns (xmin, xmax, ymin, ymax, xspan, yspan)

f311.explorer.vis.plotsp.draw_spectra_overlapped(ss, title=None, setup=PlotSpectrumSetup('{.xunit}', '{.yunit}', '{.title}', None, True))
f311.explorer.vis.plotsp.draw_spectra_stacked(ss, title=None, num_rows=None, setup=PlotSpectrumSetup('{.xunit}', '{.yunit}', '{.title}', None, True))

Same as plot_spectra_stacked(), but does not call plt.show(); returns figure

f311.explorer.vis.plotsp.plot_spectra_overlapped(ss, title=None, setup=PlotSpectrumSetup('{.xunit}', '{.yunit}', '{.title}', None, True))

Plots one or more spectra in the same plot.

Parameters:
  • ss – list of Spectrum objects

  • title=None – window title

  • setup – PlotSpectrumSetup object

f311.explorer.vis.plotsp.plot_spectra_pages_pdf(ss, pdf_filename='pages.pdf', setup=PlotSpectrumSetup('{.xunit}', '{.yunit}', '{.title}', None, True))

Plots spectra into a PDF file, one spectrum per page.

Splits into several pieces of width

Parameters:
  • ss – list of Spectrum objects

  • pdf_filename – name of output file

f311.explorer.vis.plotsp.plot_spectra_pieces_pdf(ss, aint=10, pdf_filename='pieces.pdf', setup=PlotSpectrumSetup('{.xunit}', '{.yunit}', '{.title}', None, True))

Plots spectra, overlapped, in small wavelength intervals into a PDF file, one interval per page of the PDF file.

Parameters:
  • ss – list of Spectrum objects

  • aint – wavelength interval for each plot

  • pdf_filename – name of output file

  • setup – PlotSpectrumSetup object

Note overrides setup.fmt_xlabel; leaves y-labell and title blank

f311.explorer.vis.plotsp.plot_spectra_stacked(ss, title=None, num_rows=None, setup=PlotSpectrumSetup('{.xunit}', '{.yunit}', '{.title}', None, True))

Plots one or more stacked in subplots sharing same x-axis.

Parameters:
  • ss – list of Spectrum objects

  • title=None – window title

  • num_rows=None – (optional) number of rows for subplot grid. If not passed, num_rows will be the number of plots, and the number of columns will be 1. If passed, number of columns is calculated automatically.

  • setup – PlotSpectrumSetup object

f311.explorer.vis.visprint module

class f311.explorer.vis.visprint.VisPrint

Bases: Vis

Prints object to screen.

action = 'Print to console'
input_classes = (<class 'object'>,)

f311.explorer.vis.visspectrum module

class f311.explorer.vis.visspectrum.VisPrint

Bases: Vis

Prints object to screen.

action = 'Print to console'
input_classes = (<class 'object'>,)
class f311.explorer.vis.visspectrum.VisSpectrum

Bases: Vis

Plots single spectrum.

action = 'Plot spectrum'
input_classes = (<class 'f311.filetypes.filespectrum.FileSpectrum'>,)

Module contents

Visualization (including plotting)

This package contains Vis* classes and functional API to draw figures