pychopmarg.com
Functions
- pychopmarg.com.all_combs(xss: list[list[T]]) list[list[T]][source]
Generate all combinations of input.
- Parameters:
xss ([[T]]) – The lists of candidates for each position in the final output.
- Returns:
All possible combinations of input lists.
- pychopmarg.com.calc_Hffe(tap_weights: list[float], n_post: int) ndarray[Any, dtype[Comp]][source]
Calculate the voltage transfer function, H(f), for the Tx FFE, according to (93A-21).
- Parameters:
tap_weights – The vector of filter tap weights, excluding the cursor tap.
n_post – The number of post-cursor taps.
- Returns:
The complex voltage transfer function, H(f), for the Tx FFE.
- Raises:
RuntimeError – If the global variables above haven’t been initialized.
ValueError – If the length of the given tap weight vector is incorrect.
Notes
- This function has been (awkwardly) pulled outside of the
COM class and made to use global variables, strictly for performance reasons. (Note that @cached_property decorated instance functions of HasTraits subclasses are not actually memoized, like @cache decorated ordinary functions are.) (It is used in the innermost layer of the nested loop structure used to find the optimal EQ solution. And its input argument is repeated often.) (See the opt_eq() method of the COM class.)
Currently, a single post-cursor tap is assumed.
Classes
- class pychopmarg.com.COM[source]
Encoding of the IEEE 802.3-22 Annex 93A “Channel Operating Margin” (COM) specification, as a Python class making use of the Enthought Traits/UI machinery, for both calculation efficiency and easy GUI display.
- FB = 25781250000.0
- H(s2p: Network, tap_weights: ndarray[Any, dtype[Real]], gDC: float | None = None, gDC2: float | None = None) ndarray[Any, dtype[Comp]][source]
Return the voltage transfer function, H(f), of a complete COM signal path, according to (93A-19).
- Parameters:
s2p – Two port network of interest.
tap_weights – Tx FFE tap weights.
- Keyword Arguments:
gDC – CTLE first stage d.c. gain.
gDC2 – CTLE second stage d.c. gain.
- Returns:
Complex voltage transfer function of complete path.
- Raises:
ValueError – If given network is not two port, or length of tap_weights is incorrect.
Notes
Assumes self.gDC and self.gDC2 have been set correctly.
It is in this processing step that linear EQ is first applied.
- H21(s2p: Network) ndarray[Any, dtype[Comp]][source]
Return the voltage transfer function, H21(f), of a terminated two port network, according to (93A-18).
- Parameters:
s2p – Two port network of interest.
- Returns:
Complex voltage transfer function at given frequencies.
- Raises:
ValueError – If given network is not two port.
Notes
- It is at this point in the analysis that the “raw” Touchstone data
gets interpolated to our system frequency vector.
- After this step, the package and R0/Rd mismatch have been accounted for,
but not the EQ.
- N_DFE = 14
- about_str = '\n <H2><em>PyChOpMarg</em> - A Python implementation of COM, as per IEEE 802.3-22 Annex 93A.</H2>\n\n <strong>By:</strong> David Banas <capn.freako@gmail.com><p>\n\n <strong>On:</strong> August 12, 2024<p>\n\n <strong>At:</strong> v1.1.3\n\n <H3>Useful Links</H3>\n\n (You\'ll probably need to: right click, select <em>Copy link address</em>, and paste into your browser.)\n <UL>\n\n <LI><a href="https://github.com/capn-freako/PyChOpMarg"><em>GitHub</em> Home</a>\n <LI><a href="https://pypi.org/project/PyChOpMarg/"><em>PyPi</em> Home</a>\n <LI><a href="https://readthedocs.org/projects/pychopmarg/"><em>Read the Docs</em> Home</a>\n </UL>\n '
- add_pkg(ntwk: tuple[Network, str]) tuple[Network, str][source]
Add package response to raw channel.
- add_pkgs(ntwks: list[tuple[Network, str]]) list[tuple[Network, str]][source]
Add package response to raw channels and generate pulse responses.
- calc_Hctf(gDC: float | None = None, gDC2: float | None = None) ndarray[Any, dtype[Comp]][source]
Return the voltage transfer function, H(f), of the Rx CTLE, according to (93A-22).
- Keyword Arguments:
gDC – CTLE first stage d.c. gain (dB). Default: None
gDC2 – CTLE second stage d.c. gain (dB). Default: None
Notes
- The instance’s current value(s) for gDC and gDC2 are used if not provided.
(Necessary, to accommodate sweeping when optimizing EQ.)
- calc_fom(tx_taps: ndarray[Any, dtype[Real]], gDC: float | None = None, gDC2: float | None = None) float[source]
Calculate the figure of merit (FOM), given the existing linear EQ settings.
- Parameters:
tx_taps – The Tx FFE tap weights, excepting the cursor. (The cursor takes whatever is left.)
- Keyword Arguments:
gDC – CTLE first stage d.c. gain.
gDC2 – CTLE second stage d.c. gain.
- Returns:
The resultant figure of merit.
- Raises:
None –
Notes
See: IEEE 802.3-2022 93A.1.6.
- calc_hJ(pulse_resp: ndarray[Any, dtype[Real]], As: float, cursor_ix: int, rel_thresh: float = 0.001) ndarray[Any, dtype[Real]][source]
Calculate the set of slopes for valid pulse response samples.
- Parameters:
pulse_resp – The pulse response of interest.
As – Signal amplitude, as per 93A.1.6.c.
cursor_ix – Cursor index.
- Keyword Arguments:
rel_thresh – Filtration threshold (As). Default: 0.001 (i.e. - 0.1%, as per Note 2 of 93A.1.7.1)
- Returns:
The calculated slopes around the valid samples.
- calc_noise() tuple[float, float, int][source]
Calculate the interference and noise for COM.
- Returns:
signal amplitude
noise + interference amplitude (V)
cursor location within victim pulse response vector
Notes
- Assumes the following instance variables have been set:
gDC
gDC2
tx_taps
Warns if 2*As/npts rises above 10 uV, against standard’s recommendation.
- calc_sZp(NEXT: bool = False) Network[source]
Return the 2-port network corresponding to a package transmission line, according to (93A-9:14).
- Keyword Arguments:
NEXT – Use first package T-line length option when True. Default: False
- Returns:
2-port network equivalent to package transmission line.
- filt_pr_samps(pr_samps: ndarray[Any, dtype[Real]], As: float, rel_thresh: float = 0.001) ndarray[Any, dtype[Real]][source]
Filter a list of pulse response samples for minimum magnitude.
- Parameters:
pr_samps – The pulse response samples to filter.
As – Signal amplitude, as per 93A.1.6.c.
- Keyword Arguments:
rel_thresh – Filtration threshold (As). Default: 0.001 (i.e. - 0.1%, as per Note 2 of 93A.1.7.1)
- Returns:
The subset of pr_samps passing filtration.
- gen_pulse_resps(ntwks: list[tuple[Network, str]], tx_taps: ndarray[Any, dtype[Real]], gDC: float | None = None, gDC2: float | None = None, apply_eq: bool = True) list[ndarray[Any, dtype[Real]]][source]
Generate pulse responses for all networks.
- Parameters:
ntwks – The list of networks to generate pulse responses for.
tx_taps – Desired Tx tap weights.
- Keyword Arguments:
apply_eq – Include linear EQ when True; otherwise, exclude it. Default: True
- Returns:
List of pulse responses.
- Raises:
None –
Notes
Assumes self.gDC and self.gDC2 have been set correctly, if not provided.
- get_chnls_s32p_wPkg() list[tuple[Network, str]][source]
Augment imported s32p channels, w/ package response.
- get_chnls_s4p_wPkg() list[tuple[Network, str]][source]
Augment imported s4p channels, w/ package response.
- classmethod init(params: dict, chnl_fnames: list[str], vic_id: int, zp_sel: int = 1, num_ui: int = 500, gui: bool = False)[source]
Legacy initializer supports my VITA notebook, which was created before PyChOpMarg was altered to support a GUI.
- loc_curs(pulse_resp: ndarray[Any, dtype[Real]], max_range: int = 4) int[source]
Locate the cursor position for the given pulse response, according to (93A-25) and (93A-26).
- Parameters:
pulse_resp – The pulse response of interest.
- Keyword Arguments:
max_range – The search radius, from the peak.
- Returns:
The index in the given pulse response vector of the cursor.
Notes
- As per v3.70 of the COM MATLAB code, we only minimize the
residual of (93A-25); we don’t try to solve it exactly.
- nTxTaps = 6
- opt_eq(do_opt_eq: bool = True, tx_taps: ndarray[Any, dtype[Real]] = None) bool[source]
Find the optimum values for the linear equalization parameters: c(-2), c(-1), c(1), gDC, and gDC2, as per IEEE 802.3-22 93A.1.6.
- Keyword Arguments:
do_opt_eq – Perform optimization of linear EQ when True. Default: True
tx_taps – Used when do_opt_eq = False. Default: None
- Returns:
True if no errors encountered; False otherwise.
- pulse_resp(H: ndarray[Any, dtype[Comp]]) ndarray[Any, dtype[Real]][source]
Return the unit pulse response, p(t), corresponding to the given voltage transfer function, H(f), according to (93A-24).
- Parameters:
H – The voltage transfer function, H(f). Note: Possitive frequency components only, including fN.
- Returns:
The pulse response corresponding to the given voltage transfer function.
- Raises:
ValueError – If the length of the given voltage transfer function differs from that of the system frequency vector.
Notes
- It is at this point in the signal processing chain that we change
time domains.