Timespan¶
-
class
lsst.daf.butler.Timespan¶ Bases:
typing.Generic,tupleA generic 2-element named tuple for time intervals.
Parameters: Notes
This class is generic because it is used for both Python literals (with
T == astropy.time.Time) and timestamps in SQLAlchemy expressions (withT == sqlalchemy.sql.ColumnElement), including operations between those.Python’s built-in
collections.namedtupleis not actually a type (just a factory for types), andtyping.NamedTupledoesn’t support generics, so neither can be used here (but also wouldn’t add much even if they could).Attributes Summary
beginMinimum timestamp in the interval (inclusive). endMaximum timestamp in the interval (inclusive). Methods Summary
count($self, value, /)Return number of occurrences of value. index($self, value[, start, stop])Return first index of value. intersection()Return a new Timespanthat is contained by all of the given ones.overlaps(other[, ops])Test whether this timespan overlaps another. Attributes Documentation
Methods Documentation
-
count($self, value, /)¶ Return number of occurrences of value.
-
index($self, value, start=0, stop=sys.maxsize, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
intersection() → Optional[lsst.daf.butler.core.timespan.Timespan]¶ Return a new
Timespanthat is contained by all of the given ones.Parameters: - *args
All positional arguments are
Timespaninstances.
Returns: Notes
Unlike
overlaps, this method does not support SQLAlchemy column expressions as operands.
-
overlaps(other, ops=<module 'operator' from '/opt/lsst/software/stack/python/miniconda3-4.7.12/envs/lsst-scipipe-973126a/lib/python3.7/operator.py'>) → Any¶ Test whether this timespan overlaps another.
Parameters: - other :
Timespan Another timespan whose begin and end values can be compared with those of
selfwith the>=operator, yielding values that can be passed toops.or_and/orops.and_.- ops :
Any, optional Any object with
and_andor_boolean operators. Defaults to the Python built-inoperatormodule, which is appropriate whenTis a Python literal likeastropy.time.Time. When either operand contains SQLAlchemy column expressions, thesqlalchemy.sqlmodule should be used instead.
Returns: - other :
-