SignalSum#
- class SignalSum(*signals, name=None)[source]#
Bases:
SignalCollection,SignalRepresents a sum of signals.
I.e. a sum of
Signalobjects:\[s_1(t) + \dots + s_k(t)\]For basic evaluation, this class behaves in the same manner as
Signal:__call__evaluates the sum.complex_valueevaluates the sum of the complex values of the individual summands.
Attributes
carrier_freqandphasehere correspond to anArrayof frequencies/phases for each term in the sum, and theenvelopemethod returns anArrayof the envelopes for each summand.Internally, the signals are stored as a list in the
componentsattribute, which can be accessed via direct subscripting of the object.Initialize with a list of Signal objects through
args.- Parameters:
signals –
Signalsubclass objects.name (
Optional[str]) – Name of the sum.
- Raises:
QiskitError – If
signalsare not subclasses ofSignal.
Methods
- complex_value(t)[source]#
Return the sum of the complex values of each component.
- Return type:
Union[complex,array,Array]
- conjugate()#
Return the conjugation of this collection.
- Return type:
SignalCollection
- draw(t0, tf, n, function='signal', axis=None, title=None)#
Plot the signal over an interval.
The
functionarg specifies which function to plot:function == 'signal'plots the full signal.function == 'envelope'plots the complex envelope.function == 'complex_value'plots thecomplex_value.
- Parameters:
t0 (
float) – Initial time.tf (
float) – Final time.n (
int) – Number of points to sample in interval.function (
Optional[str]) – Which function to plot.axis (
Optional[axis]) – The axis to use for plotting.title (
Optional[str]) – Title of plot.
- envelope(t)#
Vectorized evaluation of the envelope at time t.
- Return type:
Union[complex,array,Array]
- flatten()[source]#
Merge into a single
Signal. The output frequency is given by the average.- Return type:
Attributes
- carrier_freq#
The carrier frequency of the signal.
- components#
The list of components.
- is_constant#
Whether or not the signal is constant.
- name#
Return the name of the signal.
- phase#
The phase of the signal.