lcapy.superposition.Superposition
- class lcapy.superposition.Superposition(*args, **kwargs)
Bases:
SuperpositionDomain,ExprDictThis class represents a superposition of different signal types, DC, AC, transient, and noise.
The time-domain representation is returned with the time method, V.time(), or with the notation V(t). This does not include the noise component.
The Laplace representation is returned with the laplace method, V.laplace() or with the notation V(s). This does not include the noise component.
Noise components with different noise identifiers are stored separately, keyed by the noise identifier. They are ignored by the laplace() and time() methods.
The total noise can be accessed with the .n attribute. This sums each of the noise components in quadrature since they are independent.
For example, consider V = Voltage(‘cos(3 * t) + exp(-4 * t) + 5’)
str(V(t)) gives ‘cos(3*t) + 5 + exp(-4*t)’
str(V(s)) gives ‘s/(9*(s**2/9 + 1)) + 1/(4*(s/4 + 1)) + 5/s’
V.dc gives 5
V.ac gives {3: 1}
V.s gives 1/(s + 4)
Methods
__init__(*args, **kwargs)ac_keys()Return list of keys for all ac components.
add(value)Add a value into the superposition.
angular_fourier(**assumptions)Convert to angular Fourier domain.
asd()canonical()Decompose into a new representation in the transform domains.
decompose_to_domain(expr, kind)Determine value at t = oo.
force_time()fourier(**assumptions)Convert to Fourier domain.
frequency_response([fvector])Convert to frequency domain and evaluate response if frequency vector specified.
has(subexpr)Test whether the sub-expression is contained.
has_symbol(sym)Test if have symbol.
Determine value at t = 0.
kinds([transform])Return the source signal kinds for circuit analysis.
laplace(**assumptions)Convert to s-domain.
latex(**kwargs)Latex
limit(var, value[, dir])Determine limit of expression(var) at var = value.
netval(kind)Return list of keys for all noise components.
oneport()Create oneport component.
phasor(**kwargs)Return phasor if have a single AC component otherwise raise error.
Determine value at t = 0+.
pprint()Pretty print
Determine value at t = 0-.
psd()rms()select(kind[, transform])Select a component of the signal representation by kind where:
simplify()Simplify each element but not the keys.
subs(*args, **kwargs)Substitute values into all components of the superposition.
time(**assumptions)Convert to time domain.
transform(arg, **assumptions)Transform into a different domain.
transient_response([tvector])Evaluate transient (impulse) response.
Attributes
Return the magnitude if phasor.
Return the AC components.
Return the DC component.
True if there is an AC component.
True if there is a DC component.
True if there is a noise component.
True if have transient component defined in the s-domain.
True if have transient component defined in the time-domain.
True if have transient component.
True if only has AC components.
is_causalTrue if only has a DC component.
True if only has noise components.
True if has single AC component.
True if only has s-domain transient component.
is_superpositionTrue if only has t-domain transient component.
True if only has transient component(s).
Return the magnitude if phasor.
nReturn the total noise.
Return angular frequency if phasor.
Return the phase if phasor.
Return the s-domain representation of the transient component.
Return dictionary of symbols in the expression keyed by name.
Return the transient component in the time-domain.
Return the transient component in the laplace-domain.
Return the units of the expression.
- property abs
Return the magnitude if phasor.
- property ac
Return the AC components.
- ac_keys()
Return list of keys for all ac components.
- add(value)
Add a value into the superposition.
- angular_fourier(**assumptions)
Convert to angular Fourier domain.
- property dc
Return the DC component.
- decompose()
Decompose into a new representation in the transform domains.
- final_value()
Determine value at t = oo.
- fourier(**assumptions)
Convert to Fourier domain.
- frequency_response(fvector=None)
Convert to frequency domain and evaluate response if frequency vector specified.
- has(subexpr)
Test whether the sub-expression is contained. For example, V.has(exp(t)) V.has(t)
- property has_ac
True if there is an AC component.
- property has_dc
True if there is a DC component.
- property has_noisy
True if there is a noise component.
- property has_s_transient
True if have transient component defined in the s-domain.
- has_symbol(sym)
Test if have symbol. For example, V.has_symbol(‘a’) V.has_symbol(t)
- property has_t_transient
True if have transient component defined in the time-domain.
- property has_transient
True if have transient component.
- initial_value()
Determine value at t = 0. See also pre_initial_value and post_initial_value
- property is_ac
True if only has AC components.
- property is_dc
True if only has a DC component.
- property is_noisy
True if only has noise components.
- property is_phasor_domain
True if has single AC component.
- property is_s_transient
True if only has s-domain transient component.
- property is_t_transient
True if only has t-domain transient component.
- property is_transient
True if only has transient component(s). Note, should not have both t and s components.
- kinds(transform=False)
Return the source signal kinds for circuit analysis. If transform is True, return the transform groups (dc, ac, noise, transient).
- laplace(**assumptions)
Convert to s-domain.
- latex(**kwargs)
Latex
- limit(var, value, dir='+')
Determine limit of expression(var) at var = value. If dir == ‘+’ search from right else if dir == ‘-’ search from left.
- property magnitude
Return the magnitude if phasor.
- property noise
Return the total noise.
- noise_keys()
Return list of keys for all noise components.
- property omega
Return angular frequency if phasor.
- oneport()
Create oneport component.
- property phase
Return the phase if phasor.
- phasor(**kwargs)
Return phasor if have a single AC component otherwise raise error.
- post_initial_value()
Determine value at t = 0+. See also pre_initial_value and initial_value
- pprint()
Pretty print
- pre_initial_value()
Determine value at t = 0-. See also initial_value and post_initial_value
- property s
Return the s-domain representation of the transient component. This is not the full s-domain representation as returned by the laplace method V.laplace() or V(s).
This attribute may be deprecated due to possible confusion.
- select(kind, transform=False)
Select a component of the signal representation by kind where:
'super': the entire superposition'time': the time domain representation (equivalent to self.time())'laplace': the laplace domain representation (equivalent to self.laplace())'ivp': the s-domain representation (equivalent to self.laplace())'dc': the DC component'omega': the AC component with angular frequency omega's': the transient component in the s-domain'n': the noise component't': the time-domain transient component (this may or may not include the DC and AC components).
- simplify()
Simplify each element but not the keys.
- subs(*args, **kwargs)
Substitute values into all components of the superposition.
- property symbols
Return dictionary of symbols in the expression keyed by name.
- time(**assumptions)
Convert to time domain.
- transform(arg, **assumptions)
Transform into a different domain.
- property transient
Return the transient component in the time-domain.
- property transient_laplace
Return the transient component in the laplace-domain.
- transient_response(tvector=None)
Evaluate transient (impulse) response.
- property units
Return the units of the expression. However, since this is a superposition, units are not defined. Instead, it is necessary to transform to a specific domain. For example, using V(s).