pmrf.functions.conversions

Functions

a2s(a[, z0])

Convert ABCD parameters to S-parameters.

fix_z0_shape(z0, nfreqs, nports)

Broadcast the characteristic impedance z0 to shape (nfreqs, nports).

renormalize_s(s, z_old, z_new[, s_def_old, ...])

Renormalize S-parameters from one impedance/definition to another.

s2a(s[, z0])

Convert S-parameters to ABCD parameters.

s2s(s, z0, s_def_new, s_def_old)

Convert S-parameters between different definitions (e.g., Power waves vs Traveling waves).

s2z(s[, z0, s_def])

Convert S-parameters to Impedance (Z) parameters.

y2s(y[, z0, s_def])

Convert Admittance (Y) parameters to S-parameters.

z2s(z[, z0, s_def])

Convert Impedance (Z) parameters to S-parameters.

pmrf.functions.conversions.s2s(s, z0, s_def_new, s_def_old)[source]

Convert S-parameters between different definitions (e.g., Power waves vs Traveling waves).

This function handles the conversion logic defined by s_def_old to s_def_new. It supports complex characteristic impedances.

Parameters:
  • s (jnp.ndarray) – The S-parameter matrix with shape (nfreqs, nports, nports).

  • z0 (NumberLike) – The characteristic impedance. Can be a scalar, or an array broadcastable to (nfreqs, nports).

  • s_def_new (str) – The target S-parameter definition. Options: ‘power’, ‘traveling’.

  • s_def_old (str) – The source S-parameter definition. Options: ‘power’, ‘traveling’.

Returns:

The converted S-parameter matrix with shape (nfreqs, nports, nports).

Return type:

jnp.ndarray

pmrf.functions.conversions.a2s(a, z0=50)[source]

Convert ABCD parameters to S-parameters.

Parameters:
  • a (jnp.ndarray) – The ABCD parameter matrix with shape (nfreqs, 2, 2).

  • z0 (NumberLike, optional, default=50) – The characteristic impedance.

Returns:

The S-parameter matrix with shape (nfreqs, 2, 2).

Return type:

jnp.ndarray

Raises:

IndexError – If the input is not a 2-port network.

pmrf.functions.conversions.s2a(s, z0=50)[source]

Convert S-parameters to ABCD parameters.

Parameters:
  • s (jnp.ndarray) – The S-parameter matrix with shape (nfreqs, 2, 2).

  • z0 (NumberLike, optional, default=50) – The characteristic impedance.

Returns:

The ABCD parameter matrix with shape (nfreqs, 2, 2).

Return type:

jnp.ndarray

Raises:

IndexError – If the input is not a 2-port network.

pmrf.functions.conversions.y2s(y, z0=50, s_def='power')[source]

Convert Admittance (Y) parameters to S-parameters.

Parameters:
  • y (jnp.ndarray) – The Admittance matrix with shape (nfreqs, nports, nports).

  • z0 (NumberLike, optional, default=50) – The characteristic impedance.

  • s_def (str, optional, default='power') – The S-parameter definition (‘power’ or ‘traveling’).

Returns:

The S-parameter matrix with shape (nfreqs, nports, nports).

Return type:

jnp.ndarray

pmrf.functions.conversions.s2z(s, z0=50, s_def='power')[source]

Convert S-parameters to Impedance (Z) parameters.

Parameters:
  • s (jnp.ndarray) – The S-parameter matrix with shape (nfreqs, nports, nports).

  • z0 (NumberLike, optional, default=50) – The characteristic impedance.

  • s_def (str, optional, default='power') – The S-parameter definition (‘power’ or ‘traveling’).

Returns:

The Impedance matrix with shape (nfreqs, nports, nports).

Return type:

jnp.ndarray

pmrf.functions.conversions.z2s(z, z0=50, s_def='power')[source]

Convert Impedance (Z) parameters to S-parameters.

Parameters:
  • z (jnp.ndarray) – The Impedance matrix with shape (nfreqs, nports, nports).

  • z0 (NumberLike, optional, default=50) – The characteristic impedance.

  • s_def (str, optional, default='power') – The S-parameter definition (‘power’ or ‘traveling’).

Returns:

The S-parameter matrix with shape (nfreqs, nports, nports).

Return type:

jnp.ndarray

pmrf.functions.conversions.renormalize_s(s, z_old, z_new, s_def_old='power', s_def_new='power')[source]

Renormalize S-parameters from one impedance/definition to another.

This function chains s2z and z2s to perform the transformation.

Parameters:
  • s (jnp.ndarray) – The input S-parameter matrix.

  • z_old (NumberLike) – The original characteristic impedance.

  • z_new (NumberLike) – The new characteristic impedance.

  • s_def_old (str, optional, default='power') – The original S-parameter definition.

  • s_def_new (str, optional, default='power') – The new S-parameter definition.

Returns:

The renormalized S-parameter matrix.

Return type:

jnp.ndarray

pmrf.functions.conversions.fix_z0_shape(z0, nfreqs, nports)[source]

Broadcast the characteristic impedance z0 to shape (nfreqs, nports).

Parameters:
  • z0 (NumberLike) – Input impedance. Can be a scalar, a 1D array of length nports, a 1D array of length nfreqs, or a 2D array of shape (nfreqs, nports).

  • nfreqs (int) – The number of frequency points.

  • nports (int) – The number of ports.

Returns:

The broadcasted impedance array with shape (nfreqs, nports).

Return type:

jnp.ndarray

Raises:

IndexError – If z0 has an incompatible shape.