Skip to contents

This function fits a parallelogram to the ascending segment of melatonin profile data, calculates its corners, and determines whether it meets predefined constraints. If the parallelogram does not satisfy the slope ratio criteria, a warning is issued.

Usage

parallelogram_fit(profile_data)

Arguments

profile_data

A tibble containing melatonin concentration data with datetime values.

Value

A list containing:

  • pll_datetime_0: The leftmost x-coordinate (datetime) of the parallelogram.

  • pll_datetime_1: The rightmost x-coordinate (datetime) of the parallelogram.

  • pll_slope: The optimized slope of the parallelogram.

  • corners: The four corner points of the parallelogram.

  • flag: Logical indicating whether the parallelogram violates constraints.