glucopy.metrics.tir#
- glucopy.metrics.tir(df: DataFrame, interval: list = [0, 70, 180], percentage: bool = True, decimals: int = 2)[source]#
Calculates the Time in Range (TIR) for a given target range of glucose.
\[TIR = \frac{\tau}{T} * 100\]\(\tau\) is the time spent within the target range.
\(T\) is the total time of observation.
- Parameters:
per_day (bool, default False) – If True, returns a
pandas.Series
with the TIR for each day. If False, returns the TIR for the entire dataset.interval (list of int|float, default [0,70,180]) – Interval of glucose concentration to calculate \(\tau\). Can be a list of 1 number, in that case the time will be calculated below and above that number. It will always try to calculate the time below the first number and above the last number.
percentage (bool, default True) – If True, returns the TIR as a percentage. If False, returns the TIR as timedelta (\(TIR=\tau\)).
decimals (int, default 2) – Number of decimal places to round to. Use None for no rounding.
- Returns:
tir – Series of TIR.
- Return type:
Notes
This function is meant to be used by
glucopy.Gframe.tir()