FXC-4570 feat(rf): Added pseudo_symmetric option for s_param_def
#3109
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greptile Summary
This PR adds a new
symmetric_pseudooption fors_param_definTerminalComponentModeler, which provides an alternative S-parameter formulation equivalent to the "traveling wave" definition in scikit-rf. The implementation applies a different scaling factor (F = sqrt(1/(2*Z))) that ensures the resulting S-matrix is symmetric when port impedances differ.Key changes:
SParamDeftype to includesymmetric_pseudoas a valid literal valuecompute_F()to handle the new symmetric_pseudo scaling with proper mathematical documentationterminal_construct_smatrix()to routesymmetric_pseudorequests to pseudo wave matrices (reusing existing infrastructure)s_to_z()conversion logic to properly handle symmetric_pseudo (treating it like pseudo for conjugate handling)Issues found:
print()statements that should be removedConfidence Score: 4/5
Important Files Changed
compute_F()with proper documentation and error handlingterminal_construct_smatrix()with proper error handlingSequence Diagram
sequenceDiagram participant User participant ModelerData as TerminalComponentModelerData participant Constructor as terminal_construct_smatrix participant Utils as utils.compute_F participant S2Z as utils.s_to_z User->>ModelerData: smatrix(s_param_def="symmetric_pseudo") ModelerData->>Constructor: terminal_construct_smatrix(s_param_def="symmetric_pseudo") alt symmetric_pseudo Constructor->>ModelerData: get port_pseudo_wave_matrices Note over Constructor: Reuses pseudo wave matrices<br/>with different scaling else power Constructor->>ModelerData: get port_power_wave_matrices else pseudo Constructor->>ModelerData: get port_pseudo_wave_matrices end ModelerData-->>Constructor: a_matrix, b_matrix Constructor->>Constructor: compute S = b @ inv(a) Constructor-->>ModelerData: S-matrix ModelerData-->>User: MicrowaveSMatrixData opt Convert to Z-matrix User->>ModelerData: s_to_z(s_param_def="symmetric_pseudo") ModelerData->>S2Z: s_to_z(S, reference, s_param_def) S2Z->>Utils: compute_F(Z, "symmetric_pseudo") Utils-->>S2Z: F = sqrt(1/(2*Z)) Note over S2Z: Uses non-conjugate Zport<br/>(same as pseudo) S2Z->>S2Z: Z = solve(I - F^-1*S*F, ...) S2Z-->>ModelerData: Z-matrix ModelerData-->>User: Impedance matrix endContext used:
dashboard- Remove temporary debugging code (print() calls), commented-out code, and other workarounds before fi... (source)