This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/ruby | |
# frozen_string_literal: true | |
# Original script: Bee from beeminder --> https://forum.beeminder.com/t/oura-integration/9592 | |
# A script to fetch my bedtime from Oura and update my beeminder goal | |
# If run with no arguments it fetches the last 5 days from Oura. Does not update existing datapoints. | |
require 'httparty' | |
OURA_TOKEN = 'YOUR_OURA_PERSONAL_ACCESS_TOKEN' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def calibrate_stryd(stryd_distance: float, real_distance: float, | |
current_calibration_factor: float = 100., | |
max_deviation: float = 2., max_weight: float = 0.4444, verbose: bool = True): | |
"""Calculates the new Stryd calibration factor given a distance measured by Stryd vs in reality (in m). | |
All calibration factors and the deviation are given with baseline 100 (as in Garmin watches). | |
`max_weight` is in [0., 1.] and determines the maximum weight of the new data. | |
Rules: |