precess

package
v3.0.0-...-8217f41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Precession: Chapter 21, Precession.

Functions in this package take Julian epoch argurments rather than Julian days. Use base.JDEToJulianYear() to convert.

Also in package base are some definitions related to the Besselian and Julian Year.

Partial: Precession from FK4 not implemented. Meeus gives no test cases. It's a fair amount of code and data, representing significant chances for errors. And precession from FK4 would seem to be of little interest today.

Proper motion units

Meeus gives some example annual proper motions in units of seconds of right ascension and seconds of declination. To make units clear, functions in this package take proper motions with argument types of unit.HourAngle and unit.Angle respectively. Error-prone conversions can be avoided by using the constructors for these unit types.

For example, given an annual proper motion in right ascension of -0ˢ.03847, rather than

mra := -0.03847 / 13751 // as Meeus suggests on p. 141

or

mra := -0.03847 * (15/3600) * (pi/180) // less magic

use

mra := unit.HourAngleFromSec(-0.03847)

Unless otherwise indicated, functions in this library expect proper motions to be annual proper motions, so the unit denominator is years. (The code, following Meeus's example, technically treats it as Julian years.)

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApproxAnnualPrecession

func ApproxAnnualPrecession(eq *coord.Equatorial, epochFrom, epochTo float64) (Δα unit.HourAngle, Δδ unit.Angle)

ApproxAnnualPrecession returns approximate annual precision in right ascension and declination.

The two epochs should be within a few hundred years. The declinations should not be too close to the poles. 近似计算截至历元相对于起始历元的年度平均岁差,俩历元不能相差太远,且天体不能靠近天极

Example
// Example 21.a, p. 132.
eq := &coord.Equatorial{
	unit.NewRA(10, 8, 22.3),
	unit.NewAngle(' ', 11, 58, 2),
}
epochFrom := 2000.0
epochTo := 1978.0
Δα, Δδ := precess.ApproxAnnualPrecession(eq, epochFrom, epochTo)
fmt.Printf("%+.3d\n", sexa.FmtHourAngle(Δα))
fmt.Printf("%+.2d\n", sexa.FmtAngle(Δδ))
Output:
+3ˢ.207
-17″.71

func ApproxPosition

func ApproxPosition(eqFrom, eqTo *coord.Equatorial, epochFrom, epochTo float64, mα unit.HourAngle, mδ unit.Angle) *coord.Equatorial

ApproxPosition uses ApproxAnnualPrecession to compute a simple and quick precession while still considering proper motion.

Both eqFrom and eqTo must be non-nil, although they may point to the same struct. EqTo is returned for convenience. 两历元之间坐标的换算,考虑岁差和自行运动(mα,mδ)

Example
// Example 21.a, p. 132.
eq := &coord.Equatorial{
	unit.NewRA(10, 8, 22.3),
	unit.NewAngle(' ', 11, 58, 2),
}
epochFrom := 2000.0
epochTo := 1978.0
mα := unit.HourAngleFromSec(-0.0169)
mδ := unit.AngleFromSec(0.006)
precess.ApproxPosition(eq, eq, epochFrom, epochTo, mα, mδ)
fmt.Printf("%0.1d\n", sexa.FmtRA(eq.RA))
fmt.Printf("%+0d\n", sexa.FmtAngle(eq.Dec))
Output:
10ʰ07ᵐ12ˢ.1
+12°04′32″

func EclipticPosition

func EclipticPosition(eclFrom, eclTo *coord.Ecliptic, epochFrom, epochTo float64, mα unit.HourAngle, mδ unit.Angle) *coord.Ecliptic

EclipticPosition precesses ecliptic coordinates from one epoch to another, including proper motions.

While eclFrom is given as ecliptic coordinates, proper motions mα, mδ are still expected to be equatorial. If proper motions are not to be considered or are not applicable, pass 0, 0.

Both eclFrom and eclTo must be non-nil, although they may point to the same struct. EclTo is returned for convenience. 考虑自行运动的黄道坐标的转换, 注意此处的mα,mδ是赤道坐标系中的数值,要先转换为黄道坐标mλ, mβ

Example
package main

import (
	"fmt"

	"github.com/mooncaker816/learnmeeus/v3/base"
	"github.com/mooncaker816/learnmeeus/v3/coord"
	"github.com/mooncaker816/learnmeeus/v3/julian"
	"github.com/mooncaker816/learnmeeus/v3/precess"
	"github.com/soniakeys/unit"
)

func main() {
	// Example 21.c, p. 137.
	eclFrom := &coord.Ecliptic{
		Lat: unit.AngleFromDeg(1.76549),
		Lon: unit.AngleFromDeg(149.48194),
	}
	eclTo := &coord.Ecliptic{}
	epochFrom := 2000.0
	epochTo := base.JDEToJulianYear(julian.CalendarJulianToJD(-214, 6, 30))
	precess.EclipticPosition(eclFrom, eclTo, epochFrom, epochTo, 0, 0)
	fmt.Printf("%.3f\n", eclTo.Lon.Deg())
	fmt.Printf("%+.3f\n", eclTo.Lat.Deg())
}
Output:
118.704
+1.615

func Position

func Position(eqFrom, eqTo *coord.Equatorial, epochFrom, epochTo float64, mα unit.HourAngle, mδ unit.Angle) *coord.Equatorial

Position precesses equatorial coordinates from one epoch to another, including proper motions.

If proper motions are not to be considered or are not applicable, pass 0, 0 for mα, mδ

Both eqFrom and eqTo must be non-nil, although they may point to the same struct. EqTo is returned for convenience. 考虑自行运动的赤道坐标的转换

Example
// Example 21.b, p. 135.
eq := &coord.Equatorial{
	unit.NewRA(2, 44, 11.986),
	unit.NewAngle(' ', 49, 13, 42.48),
}
epochFrom := 2000.0
jdTo := julian.CalendarGregorianToJD(2028, 11, 13.19)
epochTo := base.JDEToJulianYear(jdTo)
precess.Position(eq, eq, epochFrom, epochTo,
	unit.HourAngleFromSec(0.03425),
	unit.AngleFromSec(-0.0895))
fmt.Printf("%0.3d\n", sexa.FmtRA(eq.RA))
fmt.Printf("%+0.2d\n", sexa.FmtAngle(eq.Dec))
Output:
2ʰ46ᵐ11ˢ.331
+49°20′54″.54

func ProperMotion3D

func ProperMotion3D(eqFrom, eqTo *coord.Equatorial, epochFrom, epochTo, r, mr float64, mα unit.HourAngle, mδ unit.Angle) *coord.Equatorial

ProperMotion3D takes the 3D equatorial coordinates of an object at one epoch and computes its coordinates at a new epoch, considering proper motion and radial velocity.

Radial distance (r) must be in parsecs, radial velocitiy (mr) in parsecs per year.

Both eqFrom and eqTo must be non-nil, although they may point to the same struct. EqTo is returned for convenience. 自行运动导致的赤道坐标变化的精确计算(不在当成常量乘以时间间隔)

Example
// Example 21.d, p. 141.
eqFrom := &coord.Equatorial{
	RA:  unit.NewRA(6, 45, 8.871),
	Dec: unit.NewAngle('-', 16, 42, 57.99),
}
mra := unit.HourAngleFromSec(-0.03847)
mdec := unit.AngleFromSec(-1.2053)
r := 2.64           // given in correct unit
mr := -7.6 / 977792 // magic conversion factor
eqTo := &coord.Equatorial{}
fmt.Printf("Δr = %.9f, Δα = %.10f, Δδ = %.10f\n", mr, mra, mdec)
for _, epoch := range []float64{1000, 0, -1000, -2000, -10000} {
	precess.ProperMotion3D(eqFrom, eqTo, 2000, epoch, r, mr, mra, mdec)
	fmt.Printf("%8.1f  %0.2d  %0.1d\n", epoch,
		sexa.FmtRA(eqTo.RA), sexa.FmtAngle(eqTo.Dec))
}
Output:
Δr = -0.000007773, Δα = -0.0000027976, Δδ = -0.0000058435
  1000.0  6ʰ45ᵐ47ˢ.16  -16°22′56″.0
     0.0  6ʰ46ᵐ25ˢ.09  -16°03′00″.8
 -1000.0  6ʰ47ᵐ02ˢ.67  -15°43′12″.3
 -2000.0  6ʰ47ᵐ39ˢ.91  -15°23′30″.6
-10000.0  6ʰ52ᵐ25ˢ.72  -12°50′06″.7

Types

type EclipticPrecessor

type EclipticPrecessor struct {
	// contains filtered or unexported fields
}

EclipticPrecessor represents precession from one epoch to another.

Construct with NewEclipticPrecessor, then call method Precess. After construction, Precess may be called multiple times to precess different coordinates with the same initial and final epochs. 计算黄道坐标精确岁差要用到的变量

func NewEclipticPrecessor

func NewEclipticPrecessor(epochFrom, epochTo float64) *EclipticPrecessor

NewEclipticPrecessor constructs an EclipticPrecessor object and initializes it to precess coordinates from epochFrom to epochTo. 构造黄道坐标岁差计算要素

func (*EclipticPrecessor) Precess

func (p *EclipticPrecessor) Precess(eclFrom, eclTo *coord.Ecliptic) *coord.Ecliptic

EclipticPrecess precesses coordinates eclFrom, leaving result in eclTo.

The same struct may be used for eclFrom and eclTo. EclTo is returned for convenience. 黄道坐标的岁差转换

func (*EclipticPrecessor) ReduceElements

func (p *EclipticPrecessor) ReduceElements(eFrom, eTo *elementequinox.Elements) *elementequinox.Elements

ReduceElements reduces orbital elements of a solar system body from one equinox to another.

This function is described in chapter 24, but is located in this package so it can be a method of EclipticPrecessor.

Example
package main

import (
	"fmt"

	"github.com/mooncaker816/learnmeeus/v3/base"
	"github.com/mooncaker816/learnmeeus/v3/elementequinox"
	"github.com/mooncaker816/learnmeeus/v3/precess"
	"github.com/soniakeys/unit"
)

func main() {
	// Example 24.a, p. 160.
	ele := &elementequinox.Elements{
		Inc:  unit.AngleFromDeg(47.122),
		Peri: unit.AngleFromDeg(151.4486),
		Node: unit.AngleFromDeg(45.7481),
	}
	JFrom := base.JDEToJulianYear(base.BesselianYearToJDE(1744))
	JTo := base.JDEToJulianYear(base.BesselianYearToJDE(1950))
	p := precess.NewEclipticPrecessor(JFrom, JTo)
	p.ReduceElements(ele, ele)
	fmt.Printf("i = %.4f\n", ele.Inc.Deg())
	fmt.Printf("Ω = %.4f\n", ele.Node.Deg())
	fmt.Printf("ω = %.4f\n", ele.Peri.Deg())
}
Output:
i = 47.1380
Ω = 48.6037
ω = 151.4782

type Precessor

type Precessor struct {
	// contains filtered or unexported fields
}

Precessor represents precession from one epoch to another.

Construct with NewPrecessor, then call method Precess. After construction, Precess may be called multiple times to precess different coordinates with the same initial and final epochs. 计算赤道坐标精确岁差要用到的变量

func NewPrecessor

func NewPrecessor(epochFrom, epochTo float64) *Precessor

NewPrecessor constructs a Precessor object and initializes it to precess coordinates from epochFrom to epochTo. 构造赤道坐标岁差计算要素

func (*Precessor) Precess

func (p *Precessor) Precess(eqFrom, eqTo *coord.Equatorial) *coord.Equatorial

Precess precesses coordinates eqFrom, leaving result in eqTo.

The same struct may be used for eqFrom and eqTo. EqTo is returned for convenience. 赤道坐标的岁差转换计算

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL