exacttiming

This module contains the following classes:

  • TimeValue, a numeric type to represent time values with arbitrary precision.
  • TimeInterval, representing a time interval, that is, a pair (begin, end) of time points.

New in version 1.5.0.

class aeneas.exacttiming.TimeInterval(begin, end)[source]

A type representing a time interval, that is, a pair (begin, end) of time points.

This class has some convenience methods for calculating the length of interval, whether a given time point belongs to it, etc.

New in version 1.7.0.

Parameters:
Raises:
  • TypeError – if begin or end are not instances of TimeValue
  • ValueError – if begin is negative or if begin is bigger than end
contains(time_point)[source]

Returns True if this interval contains the given time point.

Parameters:time_point (TimeValue) – the time point to test
Return type:bool
ends_at(time_point)[source]

Returns True if this interval ends at the given time point.

Parameters:time_point (TimeValue) – the time point to test
Raises:TypeError – if time_point is not an instance of TimeValue
Return type:bool
has_zero_length

Returns True if this interval has zero length, that is, if its begin and end values coincide.

Return type:bool
inner_contains(time_point)[source]

Returns True if this interval contains the given time point, excluding its extrema (begin and end).

Parameters:time_point (TimeValue) – the time point to test
Return type:bool
intersection(other)[source]

Return the intersection between this time interval and the given time interval, or None if the two intervals do not overlap.

Return type:TimeInterval or NoneType
is_adjacent_after(other)[source]

Return True if this time interval begins when the given other time interval ends.

Parameters:other (TimeInterval) – the other interval
Raises:TypeError – if other is not an instance of TimeInterval
Return type:bool
is_adjacent_before(other)[source]

Return True if this time interval ends when the given other time interval begins.

Parameters:other (TimeInterval) – the other interval
Raises:TypeError – if other is not an instance of TimeInterval
Return type:bool
is_non_zero_after_non_zero(other)[source]

Return True if this time interval begins when the given other time interval ends, and both have non zero length.

Parameters:other (TimeInterval) – the other interval
Raises:TypeError – if other is not an instance of TimeInterval
Return type:bool
is_non_zero_before_non_zero(other)[source]

Return True if this time interval ends when the given other time interval begins, and both have non zero length.

Parameters:other (TimeInterval) – the other interval
Raises:TypeError – if other is not an instance of TimeInterval
Return type:bool
length

Return the length of this interval, that is, the difference between its end and begin values.

Return type:TimeValue
offset(offset, allow_negative=False, min_begin_value=None, max_end_value=None)[source]

Move this interval by the given shift offset.

The begin and end time points of the translated interval are ensured to be non-negative (i.e., they are maxed with 0.000), unless allow_negative is set to True.

Parameters:
  • offset (TimeValue) – the shift to be applied
  • allow_negative (bool) – if True, allow the translated interval to have negative extrema
  • min_begin_value (TimeValue) – if not None, specify the minimum value for the begin of the translated interval
  • max_begin_value (TimeValue) – if not None, specify the maximum value for the end of the translated interval
Raises:

TypeError – if offset is not an instance of TimeValue

Return type:

TimeInterval

overlaps(other)[source]

Return True if the given time interval overlaps this time interval (possibly only at an extremum).

Parameters:other (TimeInterval) – the other interval
Return type:bool
percent_value(percent)[source]

Returns the time value at percent of this interval.

Parameters:percent (Decimal) – the percent
Raises:TypeError – if time_point is not an instance of TimeValue
Return type:TimeValue
relative_position_of(other)[source]

Return the position of the given other time interval, relative to this time interval, as a RELATIVE_POSITION_* constant.

Parameters:other (TimeInterval) – the other interval
Return type:int
relative_position_wrt(other)[source]

Return the position of this interval, relative to the given other time interval, as a RELATIVE_POSITION_* constant.

Parameters:other (TimeInterval) – the other interval
Return type:int
starts_at(time_point)[source]

Returns True if this interval starts at the given time point.

Parameters:time_point (TimeValue) – the time point to test
Raises:TypeError – if time_point is not an instance of TimeValue
Return type:bool
class aeneas.exacttiming.TimeValue[source]

A numeric type to represent time values with arbitrary precision.

geq_multiple(other)[source]

Return the next multiple of this time value, greater than or equal to other. If other is zero, return this time value.

Return type:TimeValue
is_integer

Return True if this time value represents an integer.

Return type:bool