ostk.physics.time.Interval

class Interval(
self,
start_instant: ostk.physics.time.Instant,
end_instant: ostk.physics.time.Instant,
type: ostk.mathematics.object.RealInterval.Type,
)

Bases: object

Time interval.

Constructor.

Parameters:

Attributes

centered

clip

closed

contains_instant

Check if the interval contains an instant.

contains_interval

Check if the interval contains another interval.

generate_grid

Generate a grid of instants with a given time step.

get_center

Get the center instant.

get_duration

Get the duration.

get_end

Get the end instant.

get_gaps

get_intersection_with

Get the intersection with another interval.

get_lower_bound

Get the lower bound.

get_start

Get the start instant.

get_type

Get the type of the interval.

get_union_with

Get the union with another interval.

get_upper_bound

Get the upper bound.

half_open_left

half_open_right

intersects

Check if the interval intersects another interval.

is_degenerate

Check if interval is degenerate, i.e. its lower and upper bounds are the equal.

logical_and

logical_or

merge

open

parse

sort

to_datetime_span

Get the datetime span.

to_string

Convert the interval to a string.

class Type(
value,
names=None,
*,
module=None,
qualname=None,
type=None,
start=1,
boundary=None,
)

Bases: Enum

centered = <nanobind.nb_func object>
clip = <nanobind.nb_func object>
closed = <nanobind.nb_func object>
contains_instant

Check if the interval contains an instant.

Parameters:

instant (Instant) -- An instant.

Returns:

True if the interval contains the instant.

Return type:

bool

contains_interval

Check if the interval contains another interval.

Parameters:

interval (Interval) -- Another interval.

Returns:

True if the interval contains the other interval.

Return type:

bool

generate_grid

Generate a grid of instants with a given time step.

Parameters:

(Duration) -- Time step.

Returns:

Grid of instants.

Return type:

list[Instant]

get_center

Get the center instant.

Returns:

Center instant.

Return type:

Instant

get_duration

Get the duration.

Returns:

Duration.

Return type:

Duration

get_end

Get the end instant.

Returns:

End instant.

Return type:

Instant

get_gaps = <nanobind.nb_func object>
get_intersection_with

Get the intersection with another interval.

Parameters:

(Interval) -- Another interval.

Returns:

Intersection interval, or None if there is no intersection.

Return type:

Interval | None

get_lower_bound

Get the lower bound.

Returns:

Lower bound.

Return type:

Instant

get_start

Get the start instant.

Returns:

Start instant.

Return type:

Instant

get_type

Get the type of the interval.

Returns:

The type of the interval.

Return type:

Interval.Type

get_union_with

Get the union with another interval.

Parameters:

(Interval) -- Another interval.

Returns:

Union interval, or None if there is no single-interval union.

Return type:

Interval | None

get_upper_bound

Get the upper bound.

Returns:

Upper bound.

Return type:

Instant

half_open_left = <nanobind.nb_func object>
half_open_right = <nanobind.nb_func object>
intersects

Check if the interval intersects another interval.

Parameters:

interval (Interval) -- Another interval.

Returns:

True if the interval intersects another interval.

Return type:

bool

is_degenerate

Check if interval is degenerate, i.e. its lower and upper bounds are the equal.

Returns:

True if degenerate.

Return type:

bool

logical_and = <nanobind.nb_func object>
logical_or = <nanobind.nb_func object>
merge = <nanobind.nb_func object>
open = <nanobind.nb_func object>
parse = <nanobind.nb_func object>
sort = <nanobind.nb_func object>
to_datetime_span

Get the datetime span.

Parameters:

scale (Scale) -- Time scale. Defaults to UTC.

Returns:

Datetime span.

Return type:

tuple[datetime, datetime]

to_string

Convert the interval to a string.

Parameters:

time_scale (Scale) -- Time scale.

Returns:

String representation of the interval.

Return type:

str