pipeline.domain.measures.FrequencyRange

class FrequencyRange(frequency1: Frequency | None = None, frequency2: Frequency | None = None)[source]

Bases: object

Methods

contains

Returns true if this range contains given frequency (range).

convert_to

Converts both endpoints of this range to the given units.

getCentreFrequency

Returns the frequency that is midway between the endpoints of this range.

getGapBetween

Returns a new range that represents the region of frequency space between this range and other.

getOverlapWith

Returns a new range that represents the region of overlap between this range and other.

getWidth

Returns the width of this range.

overlaps

Returns whether this frequency range overlaps with other frequency range.

set

Sets the frequencies of this range.

Attributes

low

high

__init__(frequency1: Frequency | None = None, frequency2: Frequency | None = None) None[source]

Creates a new instance with the given endpoints.

This method will set the lower value of its range to the lesser of the two parameter values. If either parameter is null, it will be interpreted as a signal to create a new default frequency. If both parameters are null, a frequency range spanning all positive frequencies will be returned.

Note that this method makes copies of the parameters; it does not maintain a reference to either parameter. This is done in order to maintain the integrity of the relationship between the starting and ending points of this interval.

Parameters:
  • frequency1 -- One endpoint of this range.

  • frequency2 -- The other endpoint of this range.

contains(frequency: Frequency | FrequencyRange = None) bool[source]

Returns true if this range contains given frequency (range).

The frequency argument can be a frequency or a frequency range. If the argument given is a Frequency range, then FrequencyRange A is said to contain range B if A's low frequency is less than or equal to B's low frequency and A's high frequency is greater than or each to B's high frequency. Notice that this means that if A equals B, it also contains B.

Parameters:

frequency -- The frequency or range to test for inclusion in this range.

Returns:

True if this range contains frequency. If frequency is None, the return value will be false.

convert_to(newUnits: dict = {'hz': Decimal('1E+9'), 'name': 'GIGAHERTZ', 'symbol': 'GHz'}) FrequencyRange[source]

Converts both endpoints of this range to the given units.

After this method is complete both endpoints of this range will have units of units, and their values will have been converted accordingly.

Parameters:

newUnits -- The new units for the endpoints of this range. If no units are specified, it will be treated as FrequencyUnits.GIGAHERTZ.

Returns:

this range.

getCentreFrequency() Frequency[source]

Returns the frequency that is midway between the endpoints of this range.

The units for the returned frequency will be the same as those of the high frequency of this range.

Returns:

The center frequency of this range.

getGapBetween(other: FrequencyRange | None = None) FrequencyRange | None[source]

Returns a new range that represents the region of frequency space between this range and other. If the other range is coincident with, or overlaps, this range, None is returned. If the other range is None, None is returned.

Parameters:

other -- Another range that might not overlap this one.

Returns:

FrequencyRange object representing the frequency gap between this range and other, or None if there is no gap.

getOverlapWith(other: FrequencyRange) FrequencyRange | None[source]

Returns a new range that represents the region of overlap between this range and other. If there is no overlap, None is returned.

Parameters:

other -- Another range that may overlap this one.

Returns:

FrequencyRange object representing the overlapping region of this range and other, or None if there is no overlap.

getWidth() Frequency[source]

Returns the width of this range.

The units for the returned frequency will be the same as those of the high frequency of this range.

Returns:

the width of this range.

overlaps(other: FrequencyRange | None = None) bool[source]

Returns whether this frequency range overlaps with other frequency range.

Remember that this range is a closed interval, that is, one that contains both of its endpoints.

Parameters:

other -- another range that may overlap this one.

Returns:

True if this range overlaps with other. If other is not a FrequencyRange, the return value is False.

set(frequency1: Frequency | None = None, frequency2: Frequency | None = None) None[source]

Sets the frequencies of this range.

This method will set the lower value of its range to the lesser of the two parameter values. If either parameter is None, it will be interpreted as a signal to create a new default frequency (0 GHz).

Note that this method makes copies of the parameters; it does not maintain a reference to either parameter. This is done in order to maintain the integrity of the relationship between the starting and ending points of this interval.

Parameters:
  • frequency1 -- One endpoint of this range.

  • frequency2 -- The other endpoint of this range.