예제 #1
0
func ExampleEcliptic_EqToEcl() {
	// Example 13.a, p. 95.
	eq := &coord.Equatorial{
		unit.NewRA(7, 45, 18.946),
		unit.NewAngle(' ', 28, 1, 34.26),
	}
	obl := coord.NewObliquity(unit.AngleFromDeg(23.4392911))
	ecl := new(coord.Ecliptic).EqToEcl(eq, obl)
	fmt.Printf("λ = %.5j\n", sexa.FmtAngle(ecl.Lon))
	fmt.Printf("β = %+.6j\n", sexa.FmtAngle(ecl.Lat))
	// Output:
	// λ = 113°.21563
	// β = +6°.684170
}
예제 #2
0
func ExampleEcliptic_EqToEcl() {
	// Example 13.a, p. 95.
	eq := &coord.Equatorial{
		sexa.NewRA(7, 45, 18.946).Rad(),
		sexa.NewAngle(false, 28, 1, 34.26).Rad(),
	}
	obl := coord.NewObliquity(23.4392911 * math.Pi / 180)
	ecl := new(coord.Ecliptic).EqToEcl(eq, obl)
	λStr := fmt.Sprintf("%.5j", sexa.NewFmtAngle(ecl.Lon))
	βStr := fmt.Sprintf("%+.6j", sexa.NewFmtAngle(ecl.Lat))
	fmt.Println("λ =", λStr)
	fmt.Println("β =", βStr)
	// Output:
	// λ = 113°.21563
	// β = +6°.684170
}
예제 #3
0
파일: coord_test.go 프로젝트: pjh59/meeus
func ExampleEcliptic_EqToEcl() {
	// Example 13.a, p. 95.
	eq := &coord.Equatorial{
		base.NewRA(7, 45, 18.946).Rad(),
		base.NewAngle(false, 28, 1, 34.26).Rad(),
	}
	obl := coord.NewObliquity(23.4392911 * math.Pi / 180)
	ecl := new(coord.Ecliptic).EqToEcl(eq, obl)
	λStr := base.DecSymAdd(fmt.Sprintf("%.5f", ecl.Lon*180/math.Pi), '°')
	βStr := base.DecSymAdd(fmt.Sprintf("%+.6f", ecl.Lat*180/math.Pi), '°')
	fmt.Println("λ =", λStr)
	fmt.Println("β =", βStr)
	// Output:
	// λ = 113°.21563
	// β = +6°.684170
}
예제 #4
0
func TestEquatorial_EclToEq(t *testing.T) {
	// repeat example above
	eq0 := &coord.Equatorial{
		sexa.NewRA(7, 45, 18.946).Rad(),
		sexa.NewAngle(false, 28, 1, 34.26).Rad(),
	}
	obl := coord.NewObliquity(23.4392911 * math.Pi / 180)
	ecl := new(coord.Ecliptic).EqToEcl(eq0, obl)

	// now reverse transform
	eq := new(coord.Equatorial).EclToEq(ecl, obl)
	if math.Abs((eq.RA-eq0.RA)/eq.RA) > 1e-15 {
		t.Fatal("RA:", eq0.RA, eq.RA)
	}
	if math.Abs((eq.Dec-eq0.Dec)/eq.Dec) > 1e-15 {
		t.Fatal("Dec:", eq0.Dec, eq.Dec)
	}
}
예제 #5
0
// Test with proper motion of Regulus, with equatorial motions given
// in Example 21.a, p. 132, and ecliptic motions given in table 21.A,
// p. 138.
func TestEqProperMotionToEcl(t *testing.T) {
	ε := coord.NewObliquity(nutation.MeanObliquity(base.J2000))
	mλ, mβ := eqProperMotionToEcl(
		// eq motions from p. 132.
		unit.NewHourAngle('-', 0, 0, 0.0169),
		unit.NewAngle(' ', 0, 0, 0.006),
		2000.0,
		// eq coordinates from p. 132.
		new(coord.Ecliptic).EqToEcl(&coord.Equatorial{
			RA:  unit.NewRA(10, 8, 22.3),
			Dec: unit.NewAngle(' ', 11, 58, 2),
		}, ε))
	d := math.Abs((mλ - unit.AngleFromSec(-.2348)).Rad() / mλ.Rad())
	if d*169 > 1 { // 169 = significant digits of given lon
		t.Fatal("mλ")
	}
	d = math.Abs((mβ - unit.AngleFromSec(-.0813)).Rad() / mβ.Rad())
	if d*6 > 1 { // 6 = significant digit of given lat
		t.Fatal("mβ")
	}
}
예제 #6
0
// Test with proper motion of Regulus, with equatorial motions given
// in Example 21.a, p. 132, and ecliptic motions given in table 21.A,
// p. 138.
func TestEqProperMotionToEcl(t *testing.T) {
	ε := coord.NewObliquity(nutation.MeanObliquity(base.J2000))
	mλ, mβ := eqProperMotionToEcl(
		// eq motions from p. 132.
		sexa.NewHourAngle(true, 0, 0, 0.0169).Rad(),
		sexa.NewAngle(false, 0, 0, 0.006).Rad(),
		2000.0,
		// eq coordinates from p. 132.
		new(coord.Ecliptic).EqToEcl(&coord.Equatorial{
			RA:  sexa.NewRA(10, 8, 22.3).Rad(),
			Dec: sexa.NewAngle(false, 11, 58, 2).Rad(),
		}, ε))
	d := math.Abs((mλ - sexa.NewAngle(true, 0, 0, .2348).Rad()) / mλ)
	if d*169 > 1 { // 169 = significant digits of given lon
		t.Fatal("mλ")
	}
	d = math.Abs((mβ - sexa.NewAngle(true, 0, 0, 0.0813).Rad()) / mβ)
	if d*6 > 1 { // 6 = significant digit of given lat
		t.Fatal("mβ")
	}
}