SpectrumAnalyzer
- class ipkiss3.all.SpectrumAnalyzer
Tool to analyze the transmission spectra of an S-matrix.
Finds and stores passband (or stopband) information and provides measurement methods.
- Parameters:
- smatrix: SMatrix1DSweep
The smatrix sweep object
- input_port_mode: str
The input port or port-mode. e.g. “in1”, “out1:0”
- output_port_modes: List[str]
The output ports or port-modes e.g. [“out0”, “out1”, “out2”]
- dB: bool
Whether to analyze the smatrix power in decibel (True) or linear scale (False)
- peak_method: ‘spline’ or ‘cwt’
Peak detection method to be used. Please check
i3.find_peaks
for a detailed description of the available methods.- 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, figure=None)
Visualize the transmission spectra.
- peaks()
Return the peaks per channel.
the peak data is stored as numpy record arrays. This allows you to use strings to access the values:
analyzer.peaks()['out1']['power']
Will give you only the power values of the peaks. Using ‘wavelength’ gives you the frequencies where the peaks are located.
analyzer.peaks()[‘out1’][‘wavelength’]
- Returns:
- dict
A mapping from the output ports to their corresponding spectral peaks:
{'out1': [(peak1_x, peak1_power), (peak2_x, peak2_power)]}
Notes
The first index of the record array takes its value from the sweep_parameter_name of the smatrix-sweep. In most cases this will be ‘wavelength’ as used in the example above.
- find_peaks(method='spline', threshold=None, bandpass=None, store=True, smoothing=0)
Uses
i3.find_peaks
to calculate a new list of peaks for every channel.- Parameters:
- method: ‘spline’ or ‘cwt’
Peak finding method
- threshold: float or None
Threshold power for peak finding. (autodetect if None)
- bandpass: True or None
Interprete spectra as bandpass (True), bandstop (False) or autodetect (None)
- store: bool
True: store the found peaks on the spectra. False: don’t store
- Returns:
- dict
A mapping from the output ports to their corresponding spectral peaks:
{'out1': [(peak1_x, peak1_power), (peak2_x, peak2_power)]}
- trim(band=None)
Trim the channels over a wavelength range of interest.
- Parameters:
- band
Lower and upper bound of x for the channels, i.e. (x_min, x_max). If no band is given, the whole spectrum is taken into account.
- Returns:
- SpectrumAnalyzer
New instance of SpectrumAnalyzer with trimmed channels
- min_insertion_losses(bands=None)
Calculate the minimum insertion losses for every channel.
- Parameters:
- bands
Lower and upper bounds of x for the channels. If not specified, the whole spectrum will be used. Can be specified manually or calculated by means of
cutoff_passbands
orwidth_passbands
.Example where channel ‘out1’ has two passbands and ‘out2’ one passband over which we want to calculate the insertion loss:
{'out1': [(x_min1, x_max1), (x_min2, x_max2)], 'out2': [(x_min3, x_max3)]}
- Returns:
- dict
A mapping from the output ports to their corresponding insertion losses (one per band):
{'out1': [-3.134, -3.132], 'out2': [-3.024]}
- max_insertion_losses(bands=None)
Calculate the maximum insertion losses for every channel.
- Parameters:
- bands
Lower and upper bounds of x for the channels. If not specified, the whole spectrum will be used. Can be specified manually or calculated by means of
cutoff_passbands
orwidth_passbands
.Example where channel ‘out1’ has two passbands and ‘out2’ one passband over which we want to calculate the insertion loss:
{'out1': [(x_min1, x_max1), (x_min2, x_max2)], 'out2': [(x_min3, x_max3)]}
- Returns:
- dict
A mapping from the output ports to their corresponding insertion losses (one per band):
{'out1': [-3.134, -3.132], 'out2': [-3.024]}
- fsr()
Calculate the free spectral range for every channel.
- Returns:
- dict
A mapping from the output ports to their corresponding FSR:
{'out1': 0.020, 'out2': 0.021}
- width_passbands(width)
Calculate x-limited passbands centered around the peaks for every channel.
- Parameters:
- width: float
Width of one passband, expressed in the same units and scale as x.
- Returns:
- dict
A mapping from the output ports to their corresponding passbands:
{'out1': [(x1, x2), (x3, x4)], 'out2': [(x5, x6)]}
- cutoff_passbands(cutoff)
Calculate power-limited passbands centered around the peaks for every channel.
- Parameters:
- cutoff: float
Maximum acceptable power loss with respect to the peak power.
- Returns:
- dict
A mapping from the output ports to their corresponding passbands:
{'out1': [(x1, x2), (x3, x4)], 'out2': [(x5, x6)]}
- far_crosstalk(bands)
Calculate the maximum crosstalk for every channel, ignoring nearest neighbours.
- Parameters:
- bands
Lower and upper bounds of x for the channels. Can be specified manually or calculated by means of
cutoff_passbands
orwidth_passbands
. Example where channel ‘out1’ has two passbands and ‘out2’ one passband over which we want to calculate the insertion loss:{'out1': [(x_min1, x_max1), (x_min2, x_max2)], 'out2': [(x_min3, x_max3)]}
- Returns:
- dict
A mapping from the output ports to their corresponding maximum crosstalks, ignoring nearest neighbours:
{'out1': -80.3, 'out2': -79.1}
- near_crosstalk(bands)
Calculate the maximum crosstalk for every channel, taking only nearest neighbours into account.
- Parameters:
- bands
Lower and upper bounds of x for the channels. Can be specified manually or calculated by means of
cutoff_passbands
orwidth_passbands
.Example where channel ‘out1’ has two passbands and ‘out2’ one passband over which we want to calculate the insertion loss:
{'out1': [(x_min1, x_max1), (x_min2, x_max2)], 'out2': [(x_min3, x_max3)]}
- Returns:
- dict
A mapping from the output ports to their corresponding maximum crosstalks, taking only nearest neighbours into account:
{'out1': -80.3, 'out2': -79.1}
- far_crosstalk_matrix(bands)
Calculate the crosstalk for every passband in every channel, ignoring nearest neighbours.
- Parameters:
- bands
Lower and upper bounds of x for the channels. Can be specified manually or calculated by means of
cutoff_passbands
orwidth_passbands
.Example where channel ‘out1’ has two passbands and ‘out2’ one passband over which we want to calculate the insertion loss:
{'out1': [(x_min1, x_max1), (x_min2, x_max2)], 'out2': [(x_min3, x_max3)]}
- Returns:
- dict
A matrix in the form of a dictionary that maps two output ports to their corresponding crosstalk. crosstalk_matrix[‘out1’][‘out3’] is the crosstalk in ‘out1’ caused by ‘out3’. Because ‘out1’ has two passbands, the crosstalk also has two values. For example:
{'out1': {'out3': array([-83.03362741, -83.59168257]), 'out4': array([-87.7717227 , -89.87154196]), 'out5': array([-90.2991268 , -91.66997018]), 'out6': array([-87.09402634, -87.20215863]), 'out7': array([-83.25175028, -83.27741616])}, ...}
- near_crosstalk_matrix(bands)
Calculate the crosstalk for every passband in every channel, taking only nearest neighbours into account.
- Parameters:
- bands
Lower and upper bounds of x for the channels. Can be specified manually or calculated by means of
SpectrumAnalyzer.cutoff_passbands()
orSpectrumAnalyzer.width_passbands()
.Example where channel ‘out1’ has two passbands and ‘out2’ one passband over which we want to calculate the insertion loss:
{'out1': [(x_min1, x_max1), (x_min2, x_max2)], 'out2': [(x_min3, x_max3)]}
- Returns:
- dict
A matrix in the form of a dictionary that maps two output ports to their corresponding crosstalk. crosstalk_matrix[‘out1’][‘out2’] is the crosstalk in ‘out1’ caused by ‘out2’. Because ‘out1’ has two passbands, the crosstalk also has two values. For example:
{'out1': {'out2': array([-70.78072315, -74.29802755]), 'out8': array([-72.40049707, -75.09575688])}, ...}
- crosstalk_matrix(bands)
Calculate the crosstalk for every passband in every channel.
- Parameters:
- bands
Lower and upper bounds of x for the channels. Can be specified manually or calculated by means of
SpectrumAnalyzer.cutoff_passbands()
orSpectrumAnalyzer.width_passbands()
.Example where channel ‘out1’ has two passbands and ‘out2’ one passband over which we want to calculate the insertion loss:
{'out1': [(x_min1, x_max1), (x_min2, x_max2)], 'out2': [(x_min3, x_max3)]}
- Returns:
- dict
A matrix in the form of a dictionary that maps two output ports to their corresponding crosstalk.
crosstalk_matrix[‘out1’][‘out3’] is the crosstalk in ‘out1’ caused by ‘out3’.
crosstalk_matrix[‘out1’][‘out1’] is the insertion loss variation (ripple) within the passbands of ‘out1’.
Because ‘out1’ has two passbands, the crosstalk also has two values (one for every passband). For example:
{'out1': {'out1': array([-1.7659547 , -2.14301945]), 'out2': array([-70.78072315, -74.29802755]), 'out3': array([-83.03362741, -83.59168257]), 'out4': array([-87.7717227 , -89.87154196]), 'out5': array([-90.2991268 , -91.66997018]), 'out6': array([-87.09402634, -87.20215863]), 'out7': array([-83.25175028, -83.27741616]), 'out8': array([-72.40049707, -75.09575688])}, ...}