Appendix A: Interactive Graph - HeloiseS/FUSS GitHub Wiki

The FUSS.interactive_graph sub-module allows for selection of data or data ranges by interaction with plots. It is used by the FUSS.isp_emission sub-module.

class DataRange

It is used to store 2D data and contains a method to find the centre of the range and it's average value.

Initialisation: DataRange(name, xdata, ydata, *args)

Parameters

  • xadata (1D Array) : Values of x
  • ydata (1D Array) : Values of y
  • ydata_err (optional, 1D Array) : Error values for y. If none are provided, default is None.

Attributes:

  • x
  • y
  • yr: Δy
  • start: min(x)
  • end: max(x)

Methods

average()

Defines 2 new attributes:

  • middle: The median of x
  • avg: The average of y over x. If yr is not None, then the weighted average will be calculated.

Parameters

  • self

Returns

  • None

def_ranges():

Used to interactively define ranges from a graph and retrieve the data within those ranges. Makes uses the class DataRange and the function onclick(). The latter is defined in FUSS.interactive_graph but not described in detail here because it is no use on its own.

Parameter

  • fig (matplotlib.figure.Figure): A matplotlib figure.
  • flux (2-3D Array): Contains flux information, flux[0] = wavelength, flux[1] = flux values. If err=True, flux[2] = error on flux[1]. Could be any 2-3 D data set.
  • err (optional, boolean): Set to True if errors are given.

Returns

  • Array of DataRange instances.