plesty.lib.monitor.common.spectrum ================================== .. py:module:: plesty.lib.monitor.common.spectrum .. autoapi-nested-parse:: The newest spectrum, and every spectrum so far stacked into a map. Classes ------- .. autoapisummary:: plesty.lib.monitor.common.spectrum.Spectrum plesty.lib.monitor.common.spectrum.SpectrumMap Module Contents --------------- .. py:class:: Spectrum(y: str = 'counts', x: str = 'wavelength', *, title: str = '', name: str = '', weight: Optional[float] = None, area: str = '', color: str = 'cyan', x_label: str = 'Wavelength (nm)', y_label: str = 'Counts') Bases: :py:obj:`plesty.lib.monitor.plots.Plot` The newest spectrum a run has committed. :ivar x: Field holding the axis — the wavelengths, or whatever it is measured against. :ivar y: Field holding the values. Draw the newest *y* against *x*. :param y: Field holding the values. :param x: Field holding the axis. :param title: What the view is called. :param name: Layout key. :param weight: Relative size. :param area: Which side of the window it starts on. :param color: Palette token for the curve. :param x_label: Axis label including the unit. :param y_label: Axis label including the unit. .. py:attribute:: title :value: 'Spectrum' .. py:attribute:: x :value: 'wavelength' .. py:attribute:: y :value: 'counts' .. py:attribute:: color :value: 'cyan' .. py:attribute:: x_label :value: 'Wavelength (nm)' .. py:attribute:: y_label :value: 'Counts' .. py:method:: draw(data: Any) -> plesty.lib.monitor.plots.Drawing Draw the newest row carrying the values. The *newest row carrying them*, not simply the newest row: a plan's steps are not all alike, and a sweep that ends in an analysis would otherwise blank this view the moment it finished. :param data: The run's data. :returns: One curve, or nothing before the first spectrum. .. py:class:: SpectrumMap(values: str = 'counts', row: str = '', *, x: str = 'wavelength', title: str = '', name: str = '', weight: Optional[float] = None, area: str = '', color: str = 'violet', scale: str = 'sqrt', x_label: str = 'Wavelength (nm)', y_label: str = '') Bases: :py:obj:`plesty.lib.monitor.plots.Plot` Every spectrum so far, stacked against whatever was swept. Drawn on a square-root colour scale by default: emission lines differ in brightness by more than ten times, and on a linear scale the weak ones share the background's colour. The colour bar stays labelled in the image's own values either way. Stack *values* across rows, against *row*. :param values: Field holding each row's array. :param row: Field holding the swept coordinate, for the axis; empty numbers the rows instead. :param x: Field holding the sample axis, shared by every row — so the map is drawn in the same units as the spectrum above it. ``""``, or a field no row carries, numbers the samples. :param title: What the view is called. :param name: Layout key. :param weight: Relative size. :param area: Which side of the window it starts on. :param color: Palette token the colour map is built from. :param scale: ``"sqrt"`` or ``"linear"``. :param x_label: Axis label of the sample axis. :param y_label: Axis label of the swept axis. .. py:attribute:: title :value: 'Spectral map' .. py:attribute:: values :value: 'counts' .. py:attribute:: row :value: '' .. py:attribute:: x :value: 'wavelength' .. py:attribute:: color :value: 'violet' .. py:attribute:: scale :value: 'sqrt' .. py:attribute:: x_label :value: 'Wavelength (nm)' .. py:attribute:: y_label :value: 'Row' .. py:method:: block(data: Any) -> numpy.ndarray Return the stack to draw, without its coordinate. Overridden by an experiment that wants the same map of something it has cleaned up first — the usual reason to subclass this rather than write a plot of one's own. :param data: The run's data. :returns: Shape ``(rows, samples)``. .. py:method:: draw(data: Any) -> plesty.lib.monitor.plots.Drawing Draw the stack, or nothing before there is one. :param data: The run's data. :returns: One image, or nothing.