get_sleep_cycles
Analyze and summarize sleep cycles from raw sleep data by processing sleep stages within a specified time range. Identify gaps and generate sleep cycle timestamps, ensuring results align with the user's local time zone.
Instructions
Return sleep cycles summarized from sleep stages.
Processes raw sleep data samples into sleep cycles by finding gaps in the sleep sample data within a specified time interval. Result timestamps will include time zones. Always translate timestamps to the user's local time zone when this is known.
Args: start_time: The starting timestamp (inclusive), as an ISO 8601 string or datetime object. end_time: The ending timestamp (exclusive), as an ISO 8601 string or datetime object. cycle_gap: Optional. Minimum time interval separating distinct cycles (e.g., "PT2H" for 2 hours). Defaults to server-side default if not provided. stages: Optional. Sleep stages to include. Defaults to all stages if not provided. gap_stages: Optional. Sleep stages to consider as gaps in sleep cycles. Defaults to server-side default if not provided. clip_to_range: Optional. Whether to clip the data to the requested date range. Defaults to True. Returns: A JSON string representing a pandas DataFrame containing the sleep cycle data.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
clip_to_range | No | ||
cycle_gap | No | ||
end_time | Yes | ||
gap_stages | No | ||
stages | No | ||
start_time | Yes |