lstpressure.lstindex

class lstpressure.lstindex.LSTIndex

A wrapper around the IntervalTree class for simplified interval operations.

This class provides convenience methods to insert and query intervals. It internally uses the IntervalTree for interval management and query operations.

Attributes

idxIntervalTree

The internal interval tree used for managing intervals.

treeIntervalTree

Alias for the idx attribute.

Methods

get_entries() -> set

Retrieve all intervals stored in the interval tree.

set

A set of (Interval, data) pairs.

insert(*args)

Insert an interval into the interval tree.

This method supports multiple calling patterns: - With a single Interval argument. - With two arguments specifying the start and end of the interval. - With three arguments specifying the start, end, and data associated with the interval.

*args

Variable length argument list.

ValueError

If the arguments don’t match any of the accepted input patterns.

envelop(*args) -> set

Retrieve intervals that are enveloped by the given interval.

*args

Variable length argument list.

set

A set of (Interval, data) pairs.

overlap(*args) -> set

Retrieve intervals that overlap with the given interval.

*args

Variable length argument list.

set

A set of (Interval, data) pairs.

envelop(*args) set

Retrieve intervals that are enveloped by the given interval.

Parameters

*args

Variable length argument list.

Returns

set

A set of (Interval, data) pairs.

get_entries() set

Retrieve all intervals stored in the interval tree.

Returns

set

A set of (Interval, data) pairs.

insert(*args)

Insert an interval into the interval tree.

This method supports multiple calling patterns: - With a single Interval argument. - With two arguments specifying the start and end of the interval. - With three arguments specifying the start, end, and data associated with the interval.

Parameters

*args

Variable length argument list.

Raises

ValueError

If the arguments don’t match any of the accepted input patterns.

overlap(*args) set

Retrieve intervals that overlap with the given interval.

Parameters

*args

Variable length argument list.

Returns

set

A set of (Interval, data) pairs.

class lstpressure.lstindex.LSTInterval(start: float, end: float, start_utc: ~datetime.datetime | float, end_utc: ~datetime.datetime | float, parent: <module 'lstpressure.lstcalendar.LSTCalendarDate' from '/home/zach/code/sarao/lst-pressure/lstpressure/lstcalendar/LSTCalendarDate.py'> | <module 'lstpressure.observation.Observation' from '/home/zach/code/sarao/lst-pressure/lstpressure/observation/Observation.py'> | None = None, dt: ~datetime.datetime | None = None, type: ~lstpressure.lstindex.LSTIntervalType.LSTIntervalType | None = None, sun: ~lstpressure.sun.Sun.Sun | None = None, tomorrow_sun: ~lstpressure.sun.Sun.Sun | None = None)

A wrapper around the intervaltree Interval class for easier access in the context of lst-pressure.

Attributes

parentLSTCalendarDate | Observation, optional

The parent object associated with the interval.

intervalInterval

The underlying interval object.

startfloat

The start time of the interval (in hours).

start_utcdatetime | float

The start time of the interval in UTC.

endfloat

The end time of the interval (in hours).

end_utcdatetime | float

The end time of the interval in UTC.

typeLSTIntervalType, optional

The type of the interval.

dtdatetime, optional

The datetime associated with the interval.

sunSun, optional

The Sun object associated with the interval.

tomorrow_sunSun, optional

The Sun object associated with the next day.

Methods

None

property dt: datetime | None

The datetime associated with the interval.

Returns

Optional[datetime]

The datetime, or None if not specified.

property end: float

The end time of the interval (in hours).

Returns

float

The end time.

property end_utc: datetime | float

The end time of the interval in UTC.

Returns

datetime | float

The end time in UTC.

property interval: Interval

The underlying interval object.

Returns

Interval

The interval object.

property parent: <module 'lstpressure.lstcalendar.LSTCalendarDate' from '/home/zach/code/sarao/lst-pressure/lstpressure/lstcalendar/LSTCalendarDate.py'> | <module 'lstpressure.observation.Observation' from '/home/zach/code/sarao/lst-pressure/lstpressure/observation/Observation.py'>

The parent object associated with the interval.

Returns

LSTCalendarDate | Observation

The parent object.

property start: float

The start time of the interval (in hours).

Returns

float

The start time.

property start_utc: datetime | float

The start time of the interval in UTC.

Returns

datetime | float

The start time in UTC.

property sun: Sun | None

The Sun object associated with the interval.

Returns

Optional[Sun]

The Sun object, or None if not specified.

property tomorrow_sun: Sun | None

The Sun object associated with the next day.

Returns

Optional[Sun]

The Sun object for the next day, or None if not specified.

property type: LSTIntervalType | None

The type of the interval.

Returns

Optional[LSTIntervalType]

The type of the interval, or None if not specified.

class lstpressure.lstindex.LSTIntervalType(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Enumeration of LST (Local Sidereal Time) interval types.

Defines various types of LST intervals that can be associated with observations or calendar events.

Attributes

ALL_DAYLSTIntervalType

An interval type representing a full day, spanning from 0 to 24 hours.

NIGHTLSTIntervalType

An interval type representing the nighttime period.

OBSERVATION_WINDOWLSTIntervalType

An interval type representing an observation window.

SUNRISE_SUNSETLSTIntervalType

An interval type representing the period from sunrise to sunset.

SUNSET_SUNRISELSTIntervalType

An interval type representing the period from sunset to sunrise.