feat: 新增月掩与日月食地理绘图并提升观测计算精度
- 新增月掩恒星和行星:支持搜索、掩甚点、全球掩带及固定地点轨迹计算 - 支持恒星星表坐标转换、有限盘面行星接触事件和月掩 SVG 输出 - 新增日月食及月掩全球投影图、时间标记和 GeoJSON 地理数据接口 - 扩展日食中心线、南北界及偏食足迹采样,支持极区投影 - 修正站心时角、月出月落、月球视半径、折射和恒星自行计算 - 优化内外行星事件搜索、边界选择、极端输入处理和计算稳定性
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"math"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
type venusEventBaselineSample struct {
|
||||
@@ -47,7 +48,13 @@ func TestVenusEventBaselineRegression(t *testing.T) {
|
||||
t.Fatalf("%s missing baseline event %s", sample.InputUTC, event.name)
|
||||
}
|
||||
want := math.Float64frombits(wantBits)
|
||||
if math.IsNaN(want) || math.IsInf(want, 0) {
|
||||
t.Fatalf("%s %s baseline is non-finite %v", sample.InputUTC, event.name, want)
|
||||
}
|
||||
got := event.fn(jd)
|
||||
if math.IsNaN(got) || math.IsInf(got, 0) {
|
||||
t.Fatalf("%s %s returned non-finite result %v", sample.InputUTC, event.name, got)
|
||||
}
|
||||
diff := math.Abs(got - want)
|
||||
if diff > event.tolerance {
|
||||
t.Fatalf("%s %s diff %.12f > tolerance %.12f", sample.InputUTC, event.name, diff, event.tolerance)
|
||||
@@ -55,3 +62,16 @@ func TestVenusEventBaselineRegression(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestVenusConjunctionExtremeInputIsBounded(t *testing.T) {
|
||||
started := time.Now()
|
||||
for _, next := range []uint8{0, 1} {
|
||||
got := venusConjunction(1e8, next)
|
||||
if math.IsInf(got, 0) {
|
||||
t.Fatalf("venusConjunction(1e8, %d) returned infinite result %v", next, got)
|
||||
}
|
||||
}
|
||||
if elapsed := time.Since(started); elapsed > 2*time.Second {
|
||||
t.Fatalf("venusConjunction extreme input took %s, want <= 2s", elapsed)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user