sweep_design.defaults.methods
This is where default methods are defined.
Module Contents
Functions
|
Math operations. |
|
Integration. |
|
Integration. |
|
Differentiation. |
|
Interpolation and extrapolation |
|
Specifies the overall x-axis. |
|
Correlation. |
|
Convolution. |
|
|
|
Forward Fourier Transform. |
|
Inverse Fourier Transform. |
|
Integration function y(x). |
Attributes
Array axis of x. |
|
Array axis of frequency. |
|
Array axis of time. |
- sweep_design.defaults.methods.integration
- sweep_design.defaults.methods.XAxis
Array axis of x.
- sweep_design.defaults.methods.FrequencyAxis
Array axis of frequency.
- sweep_design.defaults.methods.TimeAxis
Array axis of time.
- sweep_design.defaults.methods.math_operation(y1: numpy.ndarray, y2: Union[numpy.ndarray, sweep_design.help_types.Number], name_operation: sweep_design.core.MathOperation) sweep_design.help_types.Y[source]
Math operations.
Using numpy math operations.
- Parameters
y1 (np.ndarray) – first sequence y.
y2 (Union[np.ndarray, Number]) – second sequence y or other number name_operation (MathOperation): which mathematical operation (+, -, *, / and etc.)
- Raises
TypeFuncError – if operation can not be executed.
- Returns
result of math operation.
- Return type
Y
- sweep_design.defaults.methods.one_integrate(relation: sweep_design.relation.Relation) float[source]
Integration.
Taking the integral on a segment. Return of the area under the graph. using scipy trapezoid integration.
- Parameters
relation (Relation) – from will be calculated integral.
- Returns
result of integration.
- Return type
float
- sweep_design.defaults.methods.integrate(relation: sweep_design.relation.Relation) Tuple[XAxis, sweep_design.help_types.Y][source]
Integration.
Integration across the entire function. Get the expected integrated array function. Using the scipy.integrate.cumtrapz function.
- Parameters
relation (Relation) – integrated function.
- Returns
result of integration of function.
- Return type
Tuple[XAxis, Y]
- sweep_design.defaults.methods.differentiate(relation: sweep_design.relation.Relation) Tuple[XAxis, sweep_design.help_types.Y][source]
Differentiation.
The method by which differentiation is performed. Using the numpy.diff function.
- Parameters
relation (Relation) – function which will be differentiated.
- Returns
result of differentiation.
- Return type
Tuple[XAxis, Y]
- sweep_design.defaults.methods.interpolate_extrapolate(x: sweep_design.help_types.X, y: sweep_design.help_types.Y, bounds_error=False, fill_value=0.0) Callable[[XAxis], sweep_design.help_types.Y][source]
Interpolation and extrapolation
Using the scipy.interpolate.interp1d function. Returning function of interpolation.
- Parameters
x (X) – numbers array of axis. Samples can be not equal.
y (Y) – Representation interpolated extrapolated functions as array.
bounds_error (bool, optional) – if False then do not raise error if new array behind of bound old array. Defaults to False.
fill_value (float, optional) – default fill value if other not expected. Defaults to 0.0.
- Returns
- Callable that get first new array of x and return
interpolate-extrapolate result.
- Return type
Callable[[X], Y]
- sweep_design.defaults.methods.get_common_x(x1: XAxis, x2: XAxis) XAxis[source]
Specifies the overall x-axis.
Finds the general sample rate and beginning and end of sequence. A method by which to find the common sequence of numbers along the x-axis, obtained from two other sequences along the x-axis.
- Parameters
x1 (XAxis) – first axis.
x2 (XAxis) – second axis.
- Returns
return common axis.
- Return type
XAxis
- sweep_design.defaults.methods.correlate(cls: Type[sweep_design.relation.Relation], r1: sweep_design.relation.Relation, r2: sweep_design.relation.Relation) Tuple[XAxis, numpy.ndarray][source]
Correlation.
The method by which the correlation is performed. Using the numpy.correlate function.
- sweep_design.defaults.methods.convolve(cls: Type[sweep_design.relation.Relation], r1: sweep_design.relation.Relation, r2: sweep_design.relation.Relation) Tuple[XAxis, numpy.ndarray][source]
Convolution.
The method by which the convolution is performed. Using the numpy.convolve function.
- sweep_design.defaults.methods._calculate_spectrum(time: TimeAxis, amplitude: numpy.ndarray, frequency: Optional[Union[int, sweep_design.axis.ArrayAxis]] = None) Tuple[FrequencyAxis, numpy.ndarray][source]
- sweep_design.defaults.methods.signal2spectrum(relation: sweep_design.relation.Relation, frequency: Optional[Union[sweep_design.axis.ArrayAxis, int]] = None, is_start_zero=False) Tuple[FrequencyAxis, numpy.ndarray][source]
Forward Fourier Transform.
Method for converting a signal into a spectrum. Using the numpy.fft.rfft function.
- Parameters
- Returns
- result transformation signal to
spectrum.
- Return type
Tuple[FrequencyAxis, np.ndarray]
- sweep_design.defaults.methods.spectrum2signal(relation: sweep_design.relation.Relation, time: Optional[Union[sweep_design.axis.ArrayAxis, int]] = None, time_start: float = None) Tuple[TimeAxis, numpy.ndarray][source]
Inverse Fourier Transform.
Method for converting a spectrum into a signal. Using numpy.ifft function.
- Parameters
- Returns
result transformation spectrogram to signal.
- Return type
Tuple[TimeAxis, np.ndarray]
- sweep_design.defaults.methods.integrate_function(function: Callable[[numpy.ndarray], numpy.ndarray], x: sweep_design.axis.ArrayAxis) Tuple[sweep_design.axis.ArrayAxis, numpy.ndarray][source]
Integration function y(x).
The method by which the integration function is performed. Integration across the entire function. Get the expected integrated array function. Integration of function, using scipy.integrate.quad function.
- Parameters
function (Callable[[x], y]) – function is describing changes frequency from time.
x (np.ndarray) – time array.
- Returns
result of integration function.
- Return type