faninsar.Loop#

class faninsar.Loop(loop: Sequence[datetime])[source]#

Bases: object

Loop class containing multiple pairs/acquisitions.

__init__(loop: Sequence[datetime]) None[source]#

Initialize the Loop class.

loop: Sequence

Sequence object of dates. Each date is a datetime object. For example, (date1, …, date_n).

Methods

__init__(loop)

Initialize the Loop class.

from_name(name[, parse_function, date_args])

Initialize the loop class from a loop name.

Attributes

name

The string format the loop.

pairs

All pairs of the loop.

values

Return the values array of the loop.

from_name(name: str, parse_function: Callable | None = None, date_args: dict | None = None) Loop[source]#

Initialize the loop class from a loop name.

Parameters:
  • name (str) – Loop name.

  • parse_function (Callable, optional) – Function to parse the date strings from the loop name. If None, the loop name will be split by ‘_’ and the last 3 items will be used. Default is None.

  • date_args (dict, optional) – Keyword arguments for pd.to_datetime() to convert the date strings to datetime objects. For example, {‘format’: ‘%Y%m%d’}. Default is None.

Returns:

loop – Loop object.

Return type:

Loop

property name: str#

The string format the loop.

Returns:

name – String of the loop.

Return type:

str

property pairs: Pairs#

All pairs of the loop.

property values: NDArray[np.datetime64]#

Return the values array of the loop.

Returns:

values – dates of the loop with format of np.datetime64[D].

Return type:

np.ndarray