get default hr and power zones from config file
This commit is contained in:
@@ -27,6 +27,14 @@ class ClassifierConfig:
|
||||
enabled: bool = False # off by default; opt-in
|
||||
|
||||
|
||||
@dataclass
|
||||
class AthleteConfig:
|
||||
max_hr: int | None = None
|
||||
ftp_w: int | None = None
|
||||
hr_zones: list[list[int]] | None = None # [[lo, hi], ...]
|
||||
power_zones: list[list[int]] | None = None
|
||||
|
||||
|
||||
@dataclass
|
||||
class ExtractConfig:
|
||||
input_dirs: list[Path]
|
||||
@@ -39,6 +47,7 @@ class ExtractConfig:
|
||||
incremental: bool = True
|
||||
owner_handle: str = "me"
|
||||
owner_display_name: str = "Me"
|
||||
athlete: AthleteConfig | None = None
|
||||
|
||||
|
||||
def load_config(path: Path) -> ExtractConfig:
|
||||
@@ -70,6 +79,14 @@ def load_config(path: Path) -> ExtractConfig:
|
||||
cls_raw = raw.get("classifier", {})
|
||||
classifier = ClassifierConfig(enabled=cls_raw.get("enabled", False))
|
||||
|
||||
ath_raw = raw.get("athlete", {})
|
||||
athlete = AthleteConfig(
|
||||
max_hr=ath_raw.get("max_hr"),
|
||||
ftp_w=ath_raw.get("ftp_w"),
|
||||
hr_zones=ath_raw.get("hr_zones"),
|
||||
power_zones=ath_raw.get("power_zones"),
|
||||
) if ath_raw else None
|
||||
|
||||
return ExtractConfig(
|
||||
input_dirs=dirs,
|
||||
output_dir=out,
|
||||
@@ -81,6 +98,7 @@ def load_config(path: Path) -> ExtractConfig:
|
||||
incremental=raw.get("incremental", True),
|
||||
owner_handle=owner.get("handle", "me"),
|
||||
owner_display_name=owner.get("display_name", "Me"),
|
||||
athlete=athlete,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user