SMatrix1DSweep
- class ipkiss3.all.circuit_sim.SMatrix1DSweep
A 3D matrix. The first two dimensions are related to the terms, the last dimension is related to a 1D sweep (i.e., wavelength sweep).
- sweep_parameter_name
Name of the parameter that is swept, e.g. ‘frequency’, ‘wavelength’
- sweep_parameter_values
Values that are swept
- sweep_parameter_unit = None
Unit of the parameter swept
- static from_touchstone(filename, term_mode_map=None, unit=None)
Touchstone importer method.
- to_touchstone(filename, reference=50.0, param_format='MA')
Exports an S matrix frequency / wavelength sweep to a touchstone file.
More information on the touchstone file format can be found in
this document.- Parameters:
- smatrix1dsweep: SMatrix1DSweep
stores the SMatrices from a sweep
- filename: str
filename to which to export. The standard TouchStone extension .snp with n the total number of port modes will automatically be appended if not specified by the user. (e.g. s6p if there are 3 ports and each has 2 modes)
- reference: float (default 50.)
Reference in ohms. Used as a system reference for the S matrix data.
- param_format: str
Format of the output MA: magnitude and angle (in degrees) in the counter-clockwise directions RI: real and imaginary part
- n_digits: int (default 17)
Number of significant digits in the output Touchstone file. The default value is chosen such that when IEEE 754 double-precision number is converted to a decimal string and back the original and converted value must match (see https://en.wikipedia.org/wiki/Double-precision_floating-point_format)
- Returns:
- filename: str
The exported full file path including extension
- passivity_check()
Callable to check if the smatrix is passive.
- reciprocity_check()
Callable to check if the smatrix is reciprocal.
- visualize(terms=None, term_pairs=None, figsize=(8, 8), scale='linear', show=True, title=None, xlabel=None, ylabel=None, legend=True, xrange=None, yrange=None, figure=None, save_name=None, dB_min=-120, engine=None)
Visualize the S-matrix sweep.
- Parameters:
- terms: Optional[List[str]]
List of terms for which to plot the S-parameters. Plots every combination between these given terms. If specified together with term_pairs, an error will be raised. If None, will plot the pairs of terms according to the term_pairs argument. If term_pairs is also None, will plot every combination between all available terms.
- term_pairs: Optional[List[Tuple[str, str]]]
List of term pairs for which to plot the S-parameters. The order in the tuple is (“in”, “out”), i.e. to retrieve the transmission from “in” to “out” defined by s_matrix[“out”, “in”], term_pairs should be [(“in”, “out”)]. If specified together with terms, an error will be raised. If None, will plot the combinations according to the terms argument. If terms is also None, will plot every combination between all available terms.
- figsize: Tuple[float, float]
Size of the figure (width, height) in inches. Default is (8, 8)
- scale: Literal[‘linear’, ‘dB’]
Scale of the wavelength/frequency. ‘linear’ or ‘dB’. Default is ‘linear’.
- show: bool
If True, the plot will be shown. Default is True.
- title: Optional[str]
Title of the plot. If None, no title will be displayed.
- xlabel: Optional[str]
The label of the x-axis. If None, it will be set automatically based on the sweep parameter unit.
- ylabel: Optional[str]
The label of the y-axis. If None, the axis will be labelled S-parameters [abs. units] if scale is linear or S-parameters [dB] if scale is dB.
- legend: bool
If True, the legend will be shown. Default is True.
- xrange: Optional[Tuple[float, float]]
The range of x-axis to be plotted.
- yrange: Optional[Tuple[float, float]]
The range of y-axis to be plotted.
- figure: Optional[Figure]
Matplotlib Figure to plot on. If None, a new figure is generated.
- save_name: Optional[str]
If provided, the figure will be saved with the given name. For headless mode, show still need to be put on False.
- dB_min: float
The minimum threshold for dB values. Any values lower than this threshold will be rounded up to this specified minimum value. This parameter is applicable only when the scale is set to ‘dB’. Default is -120.
- Returns:
- None or matplotlib.figure.Figure
None if running from a jupyter notebook or if show is true, the Matplotlib Figure object otherwise
- visualize_map(figsize=(8, 8), scale='linear', sweep_value=None, show=True, title=None, ylabel=None, figure=None, save_name=None, dB_min=-120)
Plot S-parameters as a map.
- Parameters:
- figsize: Tuple[float, float]
Size of the figure, default is (8, 8).
- scale: Literal[‘linear’, ‘dB’]
Scale of the wavelength/frequency, choose between ‘linear’ or ‘dB’. Default is ‘linear’.
- sweep_value: Optional[float]
Evaluated wavelength or frequency. If None, the middle is chosen. If the value is not in the data, the closest value is chosen instead.
- show: bool
If True, the plot will be displayed. Default is True.
- title: Optional[str]
Title of the plot. If None, no title will be displayed.
- ylabel: Optional[str]
The label of the y-axis. If None, the axis will be labelled S-parameters [abs. units] if scale is linear or S-parameters [dB] if scale is dB.
- figure: Optional[Figure]
Matplotlib Figure to plot on. If None, a new figure is generated.
- save_name: Optional[str]
If provided, the figure will be saved with the given name.
- dB_min: Optional[float]
The minimum threshold for dB values. Any values lower than this threshold will be rounded up to this specified minimum value. This parameter is applicable only when the scale is set to ‘dB’. Default is -120.
- Returns:
- None or matplotlib.figure.Figure
None if running from a jupyter notebook or if show is true, the Matplotlib Figure object otherwise