bossdata.plot module

Support for plotting BOSS spectscopic data in different formats.

These functions use the optional matplotlib dependency so will raise an ImportError if this is not installed. Functions do not create figures or call matplotlib.pyplot.show() before exiting, to provide the maximum flexibility. To display a single plot, you can use the following wrapper:

plt.figure(figsize=(11,8.5))
# ... call one of the plot functions ...
plt.tight_layout()
plt.show()

See the Examples for details.

bossdata.plot.by_fiber(data, mask=None, subsets={}, percentile_cut=0.0, plot_label=None, data_label=None, default_options={'marker': 'o', 'lw': 0.5, 's': 60})[source]

Plot per-fiber data values in fiber order.

This is a useful plot to show any dependence of the data value on a fiber’s position on the CCD and slithead. Both spectrographs are superimposed on the same plot. The points for each fiber are color-coded according to their associated data value using the same scheme as focal_plane().

Parameters:
  • data (numpy.ndarray) – A 1D array of data values to plot, where the array index matches the fiber number and all fibers are included.
  • mask (numpy.ndarray) – An optional 1D array of boolean values with True values used to mask out values in the data array. Masked values will not be plotted and will not be used to calculate the plot data range.
  • subsets (dict) – A dictionary of fiber subsets that will be separately identified in the plot. Each dictionary must define values for two keys: ‘options’ and ‘fibers’. The options are a dictionary of arguments passed to matplotlib.pyplot.scatter() and used to style the subset. The fibers value is used to index the data array to pick out the subset’s data values.
  • percentile_cut (float) – Data will be clipped to this percentile value on both sides of its distribution. Use a value of zero (the default) for no clipping.
  • plot_label (str) – A label identifying this plot that will be displayed in the top-left corner.
  • data_label (str) – A label identifying the data values that will be used to label the y axis.
  • default_options (dict) – A dictionary of options passed to matplotlib.pyplot.scatter() that is used to draw data points. Options in a subset dictionary override any values here. Fibers not in any subset are drawn using these default options.
bossdata.plot.focal_plane(xfocal, yfocal, data, mask=None, subsets={}, background=None, numbered=None, percentile_cut=0.0, mesh_refinement=0, plot_label=None, data_label=None, show_background_mesh=False, number_color='red', default_options={'marker': 'o', 'lw': 0.5, 's': 60}, rmax=350.0)[source]

Plot per-fiber data values using focal-plane positions.

This is a useful plot to show any dependence of the data value on a fiber’s position in the focal plane. The points for each fiber are color-coded according to their associated data value using the same scheme as by_fiber().

Parameters:
  • xfocal (numpy.ndarray) – A 1D array of x focal-plane positions, where the array index matches the fiber number and all fibers are included.
  • yfocal (numpy.ndarray) – A 1D array of y focal-plane positions, where the array index matches the fiber number and all fibers are included.
  • data (numpy.ndarray) – A 1D array of data values to plot, where the array index matches the fiber number and all fibers are included.
  • mask (numpy.ndarray) – An optional 1D array of boolean values with True values used to mask out values in the data array. Masked values will not be plotted and will not be used to calculate the plot data range.
  • subsets (dict) – A dictionary of fiber subsets that will be separately identified in the plot. Each dictionary must define values for two keys: ‘options’ and ‘fibers’. The options are a dictionary of arguments passed to matplotlib.pyplot.scatter() and used to style the subset. The fibers value is used to index the data array to pick out the subset’s data values.
  • background (numpy.ndarray) – An optional subset of fibers whose data values are used to fill the background using interpolation. The resulting background fill will only cover the convex hull of the subset, where interpolation is possible.
  • numbered (numpy.ndarray) – An optional subset of fibers that will be numbered in the generated plot.
  • percentile_cut (float) – Data will be clipped to this percentile value on both sides of its distribution. Use a value of zero (the default) for no clipping.
  • mesh_refinement (int) – Smoothness of background fill interpolation to use. A value of zero (the default) corresponds to linear interpolation.
  • plot_label (str) – A label identifying this plot that will be displayed in the top-left corner.
  • data_label (str) – A label identifying the data values that will be used to label the y axis.
  • show_background_mesh (bool) – Draw the triangulation used for the background fill when this is True.
  • number_color (str) – Matplotlib color used to draw fiber numbers.
  • default_options (dict) – A dictionary of options passed to matplotlib.pyplot.scatter() that is used to draw data points. Options in a subset dictionary override any values here. Fibers not in any subset are drawn using these default options.