Spectrum

class radiospectra.spectrum.Spectrum(data, freq_axis)[source]

Bases: numpy.ndarray

Class representing a 1 dimensional spectrum.

Examples

>>> from radiospectra.spectrum import Spectrum
>>> import numpy as np
>>> data = np.linspace(1, 100, 100)
>>> freq_axis = np.linspace(0, 10, 100)
>>> spec = Spectrum(data, freq_axis)
>>> spec.peek()   

Attributes

freq_axis (ndarray) one-dimensional array with the frequency values.
“data” (ndarray) One-dimensional array which the intensity at a particular frequency at every data-point.

Methods Summary

peek(**matplot_args) Plot spectrum onto a new figure.
plot([axes]) Plot spectrum onto current axes.

Methods Documentation

peek(**matplot_args)[source]

Plot spectrum onto a new figure. An example is shown below.

(Source code, png, hires.png, pdf)

../_images/radiospectra-spectrum-Spectrum-1.png
Parameters:

**matplot_args : dict

Any additional plot arguments that should be used when plotting.

Returns:

fig : Figure

A plot figure.

plot(axes=None, **matplot_args)[source]

Plot spectrum onto current axes.

Parameters:

axes : Axes or None

If provided the spectrum will be plotted on the given axes. Else the current matplotlib axes will be used.

**matplot_args : dict

Any additional plot arguments that should be used when plotting.

Returns:

newaxes : Axes

The plot axes.