skrf.circuit.Circuit.update_networks
- Circuit.update_networks(networks, name=None, *, inplace=False, auto_reduce=False, **kwargs)[source]
Update the circuit connections with a new set of networks.
- Parameters:
networks (tuple[Network]) – A tuple of Networks to be updated in the circuit.
name (string, optional) – Name assigned to the circuit (Network). Default is None.
inplace (bool, optional) – If True, the circuit connections will be updated inplace. Default is False.
auto_reduce (bool, optional) – If True, the circuit will be automatically reduced using
reduce_circuit()
. This will change the circuit connections description, affecting inner current and voltage distributions. Suitable for cases where only the S-parameters of the final circuit ports are of interest. Default is False. If check_duplication, split_ground or max_nports are provided as kwargs, auto_reduce will be automatically set to True, as this indicates an intent to use the reduce_circuit method.**kwargs –
keyword arguments passed to reduce_circuit method.
check_duplication kwarg controls whether to check the connections have duplicate names. Default is True.
split_ground kwarg controls whether to split the global ground connection to independant. Default is False.
max_nports kwarg controls the maximum number of ports of a Network that can be reduced in circuit. If a Network in the circuit has a number of ports (nports), using the Network.connect() method to reduce the circuit’s dimensions becomes less efficient compared to directly calculating it with Circuit.s_external. This value depends on the performance of the computer and the scale of the circuit. Default is 20.
dynamic_networks kwarg is a sequence of Networks to be skipped during the reduction process. Default is an empty tuple.
- Returns:
The updated Circuit with the specified networks.
- Return type:
Circuit or None if inplace=True
See also
Circuit.__init__
Circuit construtor method.
Examples
>>> import skrf as rf >>> import numpy as np >>> >>> # Create a series of networks and build a circuit >>> connections = [ ... ... ... [(ntwk1, 0), (ntwk2, 0)], ... [(ntwk2, 1), (ntwk3, 0)], ... ... ... ] >>> circuit = rf.Circuit(connections, dynamic_networks=[ntwk2]) >>> >>> # Update the networks' S-parameters >>> ntwk2.s = ntwk2.s @ ntwk2.s >>> >>> # Update the circuit in traditional way (ntwk2 has been updated) >>> connections_updated = [ ... ... ... [(ntwk1, 0), (ntwk2, 0)], ... [(ntwk2, 1), (ntwk3, 0)], ... ... ... ] >>> >>> circuit_updated_a = rf.Circuit(connections_updated) >>> >>> # Update the circuit by dynamic networks >>> circuit_updated_b = circuit.update_networks(networks=[ntwk2]) >>> >>> np.allclose(circuit_updated_b.s_external, circuit_updated_b.s_external) True