# Spectrum¶

class ipkiss3.all.Spectrum(x, power, peaks=None, dB=True, peak_method='spline', peak_threshold=None, bandpass=None)

Object representing a transmission spectrum.

Parameters: x: List[float] List of wavelengths or frequencies in the spectrum. power: List[float] List of power levels, one for each wavelength or frequency sample in x. peaks: List[Tuple] (optional) A list of peaks, i.e. (peak_x, peak_power) tuples. dB: bool (optional) Interpret power in decibel (True) or not (False) peak_method: ‘spline’ or ‘cwt’ Peak detection method to be used peak_threshold: float or None Threshold for peak detection bandpass: bool or None Treat spectra as bandpass (True), bandstop (False) or automatic (None)
visualize(show=True, title=None, label=None)

Plot the spectrum.

find_peaks(method='spline', threshold=None, bandpass=None, **kwargs)

Uses i3.find_peaks to return a list of peaks. Can be used to override the peaks associated with this spectrum.

Returns: A list of peaks, i.e. a list of (peak_x, peak_power) tuples.
trim(band=None)

Create a new spectrum that is trimmed over an x-range of interest.

Parameters: band: Tuple[float] (optional) Lower and upper bound for the x values of the spectrum, i.e. (x_min, x_max) A new Spectrum object
min_insertion_losses(bands=None)

Calculate the minimum insertion loss for every given band.

Parameters: bands: List[Tuple[float]] (optional) A list of bands [(x_min, x_max), …] over which to calculate the insertion loss. If None, the whole spectrum is taken into account. The minimum insertion loss per band
max_insertion_losses(bands=None)

Calculate the maximum insertion loss for every given band.

Parameters: bands: List[Tuple[float]] (optional) A list of bands [(x_min, x_max), …] over which to calculate the insertion loss. If None, the whole spectrum is taken into account. The maximum insertion loss per band.
fsr()

Calculate the free spectral range (distance between two peaks).

Returns: A list containing the distances between adjacent peaks.
width_passbands(width)

Calculate x-limited passbands centered around the peaks.

Parameters: width: float Width of one passband, expressed in the same units and scale as x.
cutoff_passbands(cutoff)

Calculate power-limited passbands centered around the peaks.

Parameters: cutoff: float Maximum acceptable power loss with respect to the peak power.