Porting from Ipkiss 3.7.1 to Ipkiss 3.8

Porting filter analysis functions

AWG Designer has functions for filter analysis. These are now deprecated and replaced by the new i3.SpectrumAnalyzer.

AWG Designer function i3.SpectrumAnalyzer function
get_peaks i3.SpectrumAnalyzer.peaks
get_insertion_loss i3.SpectrumAnalyzer.min_insertion_losses
get_crosstalk i3.SpectrumAnalyzer.far_crosstalk
get_nearest_neighbor_crosstalk i3.SpectrumAnalyzer.near_crosstalk

Be sure to check out the additional functionality provided by i3.SpectrumAnalyzer for measuring free spectral range, channel bandwidths, insertion losses and more insight in crosstalk!

Example

Using the deprecated AWG Designer functions:

channel_freq = np.array([
    229000.0, 229800.0, 230600.0, 231400.0, 232200.0, 233000.0, 233800.0, 234600.0, 235400.0
])
channel_wavelengths = awg.frequency_to_wavelength(channel_freq)
simulation_wavelengths = np.linspace(channel_wavelengths[0] - 0.010,
                                     channel_wavelengths[-1] + 0.010,
                                     500)
output_ports = ["out{}".format(p+1) for p in range(len(channel_wav))]

awg_S = awg_circuitmodel.get_smatrix(wavelengths=simulation_wavelengths)
input_pm = "in1:0"
output_pms=["{}:0".format(p) for p in output_ports],

peaks = awg.get_peaks(awg_S,
    input_pm=input_pm,
    output_pms=output_pms,
    channel_wavelengths=channel_wavelengths,
)

insertion_loss = awg.get_insertion_loss(
    awg_S,
    input_pm=input_pm,
    output_pms=output_pms,
    channel_wavelengths=channel_wavelengths,
)

cross_talk = awg.get_crosstalk(
    awg_S,
    input_pm=input_pm,
    output_pms=output_pms,
    channel_wavelengths=channel_wavelengths,
)

cross_talk_nn = awg.get_nearest_neighbor_crosstalk(
    awg_S
    input_pm=input_pm,
    output_pms=output_pms,
    channel_wavelengths=channel_wavelengths,
)

With the new functionality this becomes:

channel_freq = np.array([
   229000.0, 229800.0, 230600.0, 231400.0, 232200.0, 233000.0, 233800.0, 234600.0, 235400.0
])
channel_wavelengths = awg.frequency_to_wavelength(channel_freq)
simulation_wavelengths = np.linspace(channel_wavelengths[0] - 0.010,
                                     channel_wavelengths[-1] + 0.010,
                                     500)
output_ports = ["out{}".format(p+1) for p in range(len(channel_wav))]

awg_S = awg_circuitmodel.get_smatrix(wavelengths=simulation_wavelengths)
analyzer = i3.SpectrumAnalyzer(
    smatrix=awg_S,
    input_port_mode='in1',
    output_port_modes=output_ports,
)
peaks = analyzer.peaks
# use -3dB passbands (other options include fixed wavelength passbands)
passbands = analyzer.cutoff_passbands(cutoff=-3)
insertion_loss = analyzer.min_insertion_loss(bands=passbands)
cross_talk = analyzer.far_crosstalk(bands=passbands)
cross_talk_nn = analyzer.near_crosstalk(bands=passbands)