signal_design.signal

Module Contents

Classes

Signal

Class describing some kind of signal.

Functions

input2signal_operation(→ Callable[[S, SSPRN], S])

_input2signal_operation(→ SRN)

input2signal(→ Callable[[Type[S], SSPR, SSPR], Signal])

_input2signal(→ Signal)

Attributes

S

Instance of Signal.

SSPR

Instance of Signal or Spectrum or signal_design.relation.Relation.

SRN

Instance of Signal or signal_design.relation.Relation or Number.

SSPRN

Instance of Signal or Spectrum or signal_design.relation.Relation or Number.

signal_design.signal.S

Instance of Signal.

signal_design.signal.SSPR

Instance of Signal or Spectrum or signal_design.relation.Relation.

signal_design.signal.SRN

Instance of Signal or signal_design.relation.Relation or Number.

signal_design.signal.SSPRN

Instance of Signal or Spectrum or signal_design.relation.Relation or Number.

signal_design.signal.input2signal_operation(func: Callable[[S, SRN], S]) Callable[[S, SSPRN], S][source]
signal_design.signal._input2signal_operation(input: SSPRN) SRN[source]
signal_design.signal.input2signal(func: Callable[[Type[S], Signal, Signal], S]) Callable[[Type[S], SSPR, SSPR], Signal][source]
signal_design.signal._input2signal(input: SSPR) Signal[source]
class signal_design.signal.Signal(time: Union[signal_design.core.RelationProtocol, signal_design.axis.Axis, signal_design.help_types.ArrayLike], amplitude: Optional[signal_design.help_types.ArrayLike] = None, spectrum: Optional[Signal.__init__.spectrum] = None)[source]

Bases: signal_design.relation.Relation

Class describing some kind of signal.

The Signal class inherits the signal_design.relation.Relation class.

Each signal can be converted into a signal_design.spectrum.Spectrum using method get_spectrum. To convert the signal into a spectrum, the method defined in the default_functions module is used (default_functions.signal2spectrum). Current method can be overridden by own.

When performing arithmetic operations on instances of the spectrum.Spectrum class, an instance of the Signal class will be extracted from the signal_design.spectrum.Spectrum instance, and arithmetic operations will be performed on this instance. An instance of signal_design.relation.Relation class will be converted into the instance of Signal class.

Initialization of instance of Signal.

Parameters:
  • time (Union[RelationProtocol, Axis, ArrayLike]) – An instance of Relation class or inherited from it, or ArrayLike, or array_like object containing numbers real.

  • amplitude (ArrayLike, optional) – None or array_like object containing numbers (real or complex). Defaults to None.

property time: signal_design.axis.Axis

Time array axis.

Equal to property x.

Returns:

time array axis.

Return type:

Axis

property amplitude: numpy.ndarray

Amplitude array.

Equal to property ‘y’

Returns:

amplitude array.

Return type:

np.ndarray

get_spectrum(frequency: Optional[Union[signal_design.axis.Axis, int]] = None, is_start_zero=False, is_real_value_transform=True) signal_design.spectrum.Spectrum[source]

Get spectrum from signal.

Parameters:
  • frequency (Axis, int, optional) – Define frequency to calculate

  • None. (spectrum. Defaults to) –

  • is_start_zero (bool, optional) – If True then the signal will be shifted to zero. Defaults to False.

Returns:

instance of signal_design.spectrum.Spectrum described this Signal.

Return type:

spectrum.Spectrum

get_amplitude_spectrum(frequency: Optional[Union[signal_design.axis.Axis, int]] = None, is_start_zero=False) signal_design.relation.Relation[source]

Extract amplitude spectrum from signal_design.spectrum.Spectrum.

Method get_spectrum is used to get instance of signal_design.spectrum.Spectrum. The amplitude spectrum is calculated from it using get_amp_spectrum method.

Parameters:
  • frequency (Axis, int, optional) – Define frequency to calculate spectrum. Defaults to None.

  • is_start_zero (bool, optional) – If True then the signal will be shifted to zero. Defaults to False.

Returns:

amplitude spectrum expected Relation instance.

Return type:

Relation

get_phase_spectrum(frequency: Optional[Union[signal_design.axis.Axis, int]] = None, is_start_zero=False) signal_design.relation.Relation[source]

Extract amplitude spectrum from signal_design.spectrum.Spectrum.

Method get_spectrum is used to get instance of signal_design.spectrum.Spectrum. The amplitude spectrum is calculated from it using get_amp_spectrum method.

Parameters:
  • frequency (Axis, int, optional) – Define frequency to calculate

  • None. (spectrum. Defaults to) –

  • is_start_zero (bool, optional) – If True then the signal will be shifted to zero. Defaults to False.

Returns:

amplitude spectrum expected Relation instance.

Return type:

Relation

shift(x_shift: signal_design.help_types.RealNumber = 0) S[source]

Shifting of signal.

Shift signal using Fourier transform.

Parameters:

x_shift – shift distance.

Returns:

shifted signal.

Return type:

Signal

get_reverse_signal(percent: Union[float, int] = 5.0, subtract_phase: bool = True, frequency_start: Optional[float] = None, frequency_end: Optional[float] = None) S[source]

Calculate reversed signal.

Parameters:
  • self (S) – instance of Signal.

  • percent (Union[float, int], optional) – level of added white noise in percent. Defaults to 5.0.

  • subtract_phase (bool, optional) – If True performs phase subtraction, If False succeeds, add the phase. Defaults to True.

  • frequency_start (float, optional) – The start frequency. Defaults to None.

  • frequency_end (float, optional) – The end frequency. Defaults to None.

Returns:

instance of Signal.

Return type:

S

add_phase(other: SSPR) S[source]

Add phase to signal.

Parameters:
Returns:

new instance of Signal.

Return type:

S

sub_phase(other: SSPR) S[source]

Subtract phase from signal.

Parameters:
  • self (S) – instance of Signal

  • other (SSPR) – Extracting the spectrum from the object and subtract the phase spectrum from the signal.

Returns:

new instance of Signal.

Return type:

S

static get_time_from_frequency(frequency: signal_design.axis.Axis, size: Optional[int] = None, time_start: Optional[float] = None) signal_design.axis.Axis[source]

Get time axis from frequency axis and desired size of time axis.

Method for getting a time axis using frequency axis and desired size. Also setting with desired time start.

Parameters:
  • frequency (Axis) – frequency axis.

  • size (int, optional) – desired size of time axis. Defaults to None.

  • time_start (float, optional) – default fft convert to 0. time. Maybe you want another start of time. Defaults to None.

Returns:

time axis.

Return type:

Axis

classmethod convolve(s1: S, s2: S) S[source]

Convolution of two instances of signal_design.relation.Relation and return new instance of Signal. Instances of signal_design.spectrum.Spectrum will be converted to Signal

Parameters:
Returns:

new instance of Signal.

Return type:

S

classmethod correlate(r1: S, r2: S) S[source]

Correlation of two instances of signal_design.relation.Relation and return new instance of Signal. Instance of signal_design.spectrum.Spectrum will be converted to Signal

Parameters:
Returns:

new instance of Signal.

Return type:

S

__add__(a: SRN) S[source]
__sub__(a: SRN) S[source]
__mul__(a: SRN) S[source]
__truediv__(a: SRN) S[source]
__pow__(a: SRN) S[source]