ostk.physics.time.Interval¶
- class Interval(
- self: ostk.physics.time.Interval,
- start_instant: ostk::physics::time::Instant,
- end_instant: ostk::physics::time::Instant,
- type: ostk.mathematics.object.RealInterval.Type,
- start_instant: ostk::physics::time::Instant,
Bases:
pybind11_object
Time interval.
Constructor.
- Parameters:
start_instant (Instant) -- Start instant.
end_instant (Instant) -- End instant.
type (Interval.Type) -- Interval type.
Methods
Create a centered interval.
Creates a clipped list of intervals.
Create a closed interval.
Check if the interval contains an instant.
Check if the interval contains another interval.
Generate a grid of instants with a given time step.
Get the center instant.
Get the duration.
Get the end instant.
Creates a list of intervals gaps.
Get the intersection with another interval.
Get the lower bound.
Get the start instant.
Get the union with another interval.
Get the upper bound.
Create a half-open left interval.
Create a half-open right interval.
Check if the interval intersects another interval.
Check if the interval is defined.
Check if interval is degenerate, i.e. its lower and upper bounds are the equal.
Creates a list of intervals by a logical-and conjunction.
Creates a list of intervals by a logical-or conjunction.
Creates a merged list of intervals.
Create a open interval.
Parse an interval from a string representation.
Creates a sorted list of intervals.
Get the datetime span.
Convert the interval to a string.
Create an undefined interval.
- class Type(self: ostk.physics.time.Interval.Type, value: int)¶
Bases:
pybind11_object
Members:
- Undefined :
Undefined interval type.
- Closed :
Closed interval type.
- Open :
Open interval type.
- HalfOpenLeft :
Half-open left interval type.
- HalfOpenRight :
Half-open right interval type.
- property name¶
- static centered(
- instant: ostk::physics::time::Instant,
- duration: ostk.physics.time.Duration,
- type: ostk.mathematics.object.RealInterval.Type,
- duration: ostk.physics.time.Duration,
Create a centered interval.
- Parameters:
instant (Instant) -- Central instant.
duration (Duration) -- Duration.
type (Interval.Type) -- Interval type.
- Returns:
Centered interval.
- Return type:
- static clip(
- intervals: list[ostk.physics.time.Interval],
- interval: ostk.physics.time.Interval,
Creates a clipped list of intervals.
` intervals = [[1, 3], [5, 7], [9, 11]] interval = [4, 10] output = [[5, 7], [9, 10]] `
- static closed(
- start_instant: ostk::physics::time::Instant,
- end_instant: ostk::physics::time::Instant,
Create a closed interval.
- contains_instant(
- self: ostk.physics.time.Interval,
- instant: ostk::physics::time::Instant,
Check if the interval contains an instant.
- contains_interval(
- self: ostk.physics.time.Interval,
- interval: ostk.physics.time.Interval,
Check if the interval contains another interval.
- generate_grid(
- self: ostk.physics.time.Interval,
- arg0: ostk.physics.time.Duration,
Generate a grid of instants with a given time step.
- get_center(self: ostk.physics.time.Interval) ostk::physics::time::Instant ¶
Get the center instant.
- Returns:
Center instant.
- Return type:
- get_duration(self: ostk.physics.time.Interval) ostk.physics.time.Duration ¶
Get the duration.
- Returns:
Duration.
- Return type:
- get_end(self: ostk.physics.time.Interval) ostk::physics::time::Instant ¶
Get the end instant.
- Returns:
End instant.
- Return type:
- static get_gaps(intervals: list[ostk.physics.time.Interval], interval: ostk.physics.time.Interval = Interval::Undefined()) list[ostk.physics.time.Interval] ¶
Creates a list of intervals gaps.
` intervals = [[1, 3], [5, 7], [9, 11]] interval = [0, 12] output = [[0, 1], [3, 5], [7, 9], [11, 12]] `
- get_intersection_with(
- self: ostk.physics.time.Interval,
- arg0: ostk.physics.time.Interval,
Get the intersection with another interval.
- get_lower_bound(
- self: ostk.physics.time.Interval,
Get the lower bound.
- Returns:
Lower bound.
- Return type:
- get_start(self: ostk.physics.time.Interval) ostk::physics::time::Instant ¶
Get the start instant.
- Returns:
Start instant.
- Return type:
- get_union_with(
- self: ostk.physics.time.Interval,
- arg0: ostk.physics.time.Interval,
Get the union with another interval.
- get_upper_bound(
- self: ostk.physics.time.Interval,
Get the upper bound.
- Returns:
Upper bound.
- Return type:
- static half_open_left(
- start_instant: ostk::physics::time::Instant,
- end_instant: ostk::physics::time::Instant,
Create a half-open left interval.
- static half_open_right(
- start_instant: ostk::physics::time::Instant,
- end_instant: ostk::physics::time::Instant,
Create a half-open right interval.
- intersects(
- self: ostk.physics.time.Interval,
- interval: ostk.physics.time.Interval,
Check if the interval intersects another interval.
- is_defined(self: ostk.physics.time.Interval) bool ¶
Check if the interval is defined.
- Returns:
True if defined.
- Return type:
- is_degenerate(self: ostk.physics.time.Interval) bool ¶
Check if interval is degenerate, i.e. its lower and upper bounds are the equal.
- Returns:
True if degenerate.
- Return type:
- static logical_and(
- intervals_1: list[ostk.physics.time.Interval],
- intervals_2: list[ostk.physics.time.Interval],
Creates a list of intervals by a logical-and conjunction.
` intervals_1 = [[-1, 1], [2, 4]] intervals_2 = [[0.5, 1.5], [3, 5], [7, 8]] output = [[0.5, 1], [3, 4]] `
- static logical_or(
- intervals_1: list[ostk.physics.time.Interval],
- intervals_2: list[ostk.physics.time.Interval],
Creates a list of intervals by a logical-or conjunction.
` intervals_1 = [[-1, 1], [2, 4]] intervals_2 = [[0.5, 1.5], [3, 5], [7, 8]] output = [[-1, 1.5], [2, 5], [7, 8]] `
- static merge(
- intervals: list[ostk.physics.time.Interval],
Creates a merged list of intervals.
` intervals = [[1, 3], [2, 4], [5, 7]] output = [[1, 4], [5, 7]] `
- static open(
- start_instant: ostk::physics::time::Instant,
- end_instant: ostk::physics::time::Instant,
Create a open interval.
- static parse(arg0: ostk.core.type.String) ostk.physics.time.Interval ¶
Parse an interval from a string representation.
- static sort(
- intervals: list[ostk.physics.time.Interval],
- by_lower_bound: bool = True,
- ascending: bool = True,
- by_lower_bound: bool = True,
Creates a sorted list of intervals.
- to_datetime_span(
- self: ostk.physics.time.Interval,
- scale: ostk.physics.time.Scale = <Scale.UTC: 1>,
Get the datetime span.
- Parameters:
scale (Scale) -- Time scale. Defaults to UTC.
- Returns:
Datetime span.
- Return type:
Tuple[datetime, datetime]
- to_string(
- self: ostk.physics.time.Interval,
- time_scale: ostk.physics.time.Scale = <Scale.UTC: 1>,
Convert the interval to a string.
- static undefined() ostk.physics.time.Interval ¶
Create an undefined interval.
- Returns:
Undefined interval.
- Return type: