param( [Parameter(Mandatory = $true)][string]$ExportRoot, [Parameter(Mandatory = $true)][string]$Output, [Parameter(Mandatory = $true)][double]$HeadingOffsetDeg, [Parameter(Mandatory = $true)][double[]]$AntennaLever, [int]$MinStations = 30, [int]$ExpectedStations = 0, [double]$HeadingStdLimitDeg = [double]::PositiveInfinity, [switch]$Overwrite ) $ErrorActionPreference = "Stop" if ($AntennaLever.Count -ne 3) { throw "AntennaLever must contain X,Y,Z in body coordinates" } $Repo = Split-Path -Parent $PSScriptRoot $Args = @((Join-Path $Repo "tools\prepare_station_dataset.py"), "--export-root", $ExportRoot, "--output", $Output, "--heading-offset-deg", "$HeadingOffsetDeg", "--antenna-lever") + @($AntennaLever | ForEach-Object { "$_" }) + @("--min-stations", "$MinStations", "--expected-stations", "$ExpectedStations", "--heading-std-limit-deg", "$HeadingStdLimitDeg") if ($Overwrite) { $Args += "--overwrite" } & python @Args if ($LASTEXITCODE -ne 0) { throw "Legacy dataset preparation failed" }