Network
rfnetwork.network.Network
- class rfnetwork.network.Network(shunt=False, passive=False, state={})
Bases:
ComponentNetwork of multiple components.
Class Attributes
- componentsdict
components of the network can either be declared as class variables, or in a class dictionary named “components”.
- nodeslist
list of tuples, where each tuple is a group of component ports that are connected into a single node. External network ports are defined by placing “P1” in the node, where “1” should be replaced with the network port number.
- cascadeslist
list of tuples, where each tuple is a group of components that are connected end to end, port 2 to port 1. External network ports are defined by placing “P1” at either or both ends of the cascade list, where “1” should be replaced with the network port number.
- probes: dict
dictionary of probe names to the component port they attach to. Probe voltage waves are defined as the wave leaving the component from the specified port. For example, dict(probe1=c1|1), would attach a probe to port 1 of the “c1” component. Probe names will appear in the coords of the “b” dimension of the s-matrix data returned by evaluate.
Parameters
- shuntbool, default: False
If True, port 2 is connected to ground and port 1 is transformed into a 2-port component that can be cascaded with other components.
- passivebool, default: True
if True,
evaluatecallsevaluate_sdatainstead ofevaluate_dataand noise correlation matrix is computed passively.- statedict, optional
dictionary of state variables specific to each component. Keys must be component designators. The state values can be read with the
stateproperty and changed later with set_state(). Attempting to set the state of variables that were not included in the initial dictionary will raise an error.
Examples
>>> import rfnetwork as rfn
>>> class Wilkinson(rfn.Network): ... ... upper = rfn.elements.Line(z0=70.7, length=0.4) ... lower = rfn.elements.Line(z0=70.7, length=0.4) ... ... r1 = rfn.elements.Resistor(100) ... ... nodes = [ ... ("P1", upper|1, lower|1), # port 1 node ... (upper|2, r1|1, "P2"), # port 2 node ... (lower|2, r1|2, "P3") # port 3 noode ... ]
>>> w = Wilkinson()
Methods
Network.evaluate_data(frequency[, noise])Returns s-matrix and noise correlation matrix of the network.
Network.evaluate_sdata(frequency)Returns the s-matrix matrix of the network.
Network.format_state([tabs, verbose])Get a string value of the state variables from all components
Network.plot_probe(*paths[, input_port, ...])Plots s-matrix or noise figure data over frequency
Print the state of all component variables.
Network.set_state(**kwargs)Change the state variables of network components.
Attributes
Attempts to finds a frequency vector that doesn't require extrapolation of component data.
Return state of all component variables.