sweep_design.defaults.sweep_methods

Module Contents

Classes

InterpolateArray

Class to interpolate array.

Functions

simple_freq2time(→ Tuple[sweep_design.help_types.Time, ...)

The simple method to extract Frequency modulation from a prior spectrum.

convert_freq2time(→ Tuple[InterpolateArray, ...)

Convert spectrum to function to create sweep.

get_info_from_a_prior_data(→ Tuple[InterpolateArray, ...)

Get the Frequency and amplitude modulation function from a prior data.

get_info_from_ftat(...)

Prepared information for 'UncalculatedSweep' instance.

_extract_x_t(...)

get_spectrogram(→ sweep_design.help_types.Spectrogram)

Function to get spectrogram of the sweep signal.

get_f_t(→ sweep_design.relation.Relation)

Get Time-Frequency function from sweep signal using the Hilbert

get_a_t(→ sweep_design.relation.Relation)

Get envelop from sweep signal using the Hilbert transformation.

Attributes

Ftatr

The Representation of object from which will be extracted frequency

CallFtatMethod

Method is used to extract frequency and amplitude modulation from spectrum.

sweep_design.defaults.sweep_methods.Ftatr

The Representation of object from which will be extracted frequency modulation or amplitude modulation.

sweep_design.defaults.sweep_methods.CallFtatMethod

Method is used to extract frequency and amplitude modulation from spectrum.

sweep_design.defaults.sweep_methods.simple_freq2time(spectrum: simple_freq2time.spectrum) Tuple[sweep_design.help_types.Time, sweep_design.help_types.Frequency, sweep_design.help_types.Envelope][source]

The simple method to extract Frequency modulation from a prior spectrum.

The amplitude modulation is constant.

Parameters

spectrum (Spectrum) – instance signal of ‘Spectrum’

Returns

simple representation Frequency

modulation from a prior spectrum.

Return type

Tuple[Time, Frequency, Envelope]

class sweep_design.defaults.sweep_methods.InterpolateArray(x: Union[sweep_design.relation.Relation, sweep_design.axis.ArrayAxis, sweep_design.help_types.ArrayLike], y: Optional[sweep_design.help_types.ArrayLike] = None)[source]

Class to interpolate array.

Use to stretch data to new axis.

Initialize InterpolateArray.

Parameters
  • x (Union[relation.Relation, ArrayAxis, ArrayLike]) – old array of x or old Relation instance.

  • y (Optional[ArrayLike], optional) – old array of y or None. Defaults to None.

Raises

BadInputError – raise exception if will be not enough data.

__call__(new_x: sweep_design.axis.ArrayAxis) numpy.ndarray[source]

Get new array of y.

Stretch and interpolate old array y to get new array y. :param new_x: new array of x. :type new_x: ArrayAxis

Returns

new array of y.

Return type

np.ndarray

sweep_design.defaults.sweep_methods.convert_freq2time(spectrum: convert_freq2time.spectrum, convert_method: CallFtatMethod) Tuple[InterpolateArray, InterpolateArray][source]

Convert spectrum to function to create sweep.

The method consists in obtaining the functions of Frequency and amplitude modulation.

Parameters
  • spectrum (Spectrum) – spectrum a prior data.

  • convert_method (CallFtatMethod) – method to convert spectrum into frequency-time and amplitude-time arrays.

Returns

tuple of two function. First function describe changes frequency from time. Second function describe changes amplitude from time. This function will be use to create sweep signal.

Return type

TupleInterpolateArray,InterpolateArray]

sweep_design.defaults.sweep_methods.get_info_from_a_prior_data(time: Union[sweep_design.relation.Relation, sweep_design.axis.ArrayAxis, sweep_design.help_types.ArrayLike], a_prior_data: Any, f_a_t_method: CallFtatMethod) Tuple[InterpolateArray, InterpolateArray, sweep_design.signal.Signal][source]

Get the Frequency and amplitude modulation function from a prior data.

Parameters
  • time (Any) – time.

  • a_prior_data (Any) – a prior data.

  • f_a_t_method (CallFtatMethod) – method to convert a prior data for functions that will use to create sweep signal.

Returns (TupleInterpolateArray,InterpolateArray, “Signal”]):

return frequency-time and amplitude-time functions and a prior signal.

sweep_design.defaults.sweep_methods.get_info_from_ftat(t: Union[sweep_design.axis.ArrayAxis, numpy.ndarray, None] = None, f_t: Union[Ftatr, InterpolateArray, None] = None, a_t: Union[Ftatr, InterpolateArray, None] = None) Tuple[Optional[sweep_design.axis.ArrayAxis], Union[Callable[[numpy.ndarray], numpy.ndarray], InterpolateArray], Union[Callable[[numpy.ndarray], numpy.ndarray], InterpolateArray]][source]

Prepared information for ‘UncalculatedSweep’ instance.

Parameters
  • t (Optional[np.ndarray]) – time. Default None.

  • f_t (Optional[Ftatr]) – frequency-time function. Default None.

  • a_t (Optional[Ftatr]) – amplitude-time function. Default None.

Returns

return frequency-time and amplitude-time functions and a prior signal.

Return type

Tuple[Optional[np.ndarray],InterpolateArray,InterpolateArray]

sweep_design.defaults.sweep_methods._extract_x_t(t: Union[sweep_design.axis.ArrayAxis, numpy.ndarray, None] = None, x_t: Union[Ftatr, InterpolateArray] = None) Tuple[Optional[sweep_design.axis.ArrayAxis], Union[Callable[[numpy.ndarray], numpy.ndarray], InterpolateArray]][source]
sweep_design.defaults.sweep_methods.get_spectrogram(sweep: sweep_design.relation.Relation) sweep_design.help_types.Spectrogram[source]

Function to get spectrogram of the sweep signal.

Using the scipy.signal.spectrogram function.

Parameters

sweep (relation.Relation) – instance of sweep signal.

Returns

tuple of np.ndarray. The first element is time.

The second is frequency. The third is matrix M x N of spectrogram.

Return type

Spectrogram

sweep_design.defaults.sweep_methods.get_f_t(sweep: sweep_design.relation.Relation) sweep_design.relation.Relation[source]

Get Time-Frequency function from sweep signal using the Hilbert transformation.

Using the scipy.signal.hilbert function.

Parameters

sweep (Relation) – instance of sweep signal.

Returns

instance Relation

Return type

Relation

sweep_design.defaults.sweep_methods.get_a_t(sweep: sweep_design.relation.Relation) sweep_design.relation.Relation[source]

Get envelop from sweep signal using the Hilbert transformation.

Using the scipy.signal.hilbert function.

Parameters

sweep (Relation) – instance of sweep signal.

Returns

instance Relation

Return type

Relation