Documentation
¶
Overview ¶
Package sky provides time scales, calendars, observing sites, and sky coordinates. It builds on measure; doc/sky.md describes the wider design.
An Instant stores a modified Julian day and its fraction separately to preserve resolution. It supports UTC, TAI, TT, TDB, UT1, and GPS, with UTC leap seconds from the IERS table.
For a small field, Tangent gives a gnomonic projection with east and north Offsets. Ellipse describes positional uncertainty on that plane.
Index ¶
- type Ellipse
- type Equatorial
- type Horizontal
- type Instant
- func (moment Instant) Calendar() (year, month, day, hour, minute int, second float64)
- func (moment Instant) GPSSeconds() (*float64, error)
- func (moment Instant) Julian() (whole, fraction float64)
- func (moment Instant) MeanSidereal() (*measure.Angle, error)
- func (moment Instant) On(scale Scale) (*Instant, error)
- func (moment Instant) Scale() Scale
- func (moment Instant) UT1(dut1 measure.Duration) (*Instant, error)
- type Offset
- type Place
- type Projector
- type Scale
- type Tangent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ellipse ¶
type Ellipse struct {
// contains filtered or unexported fields
}
Ellipse stores a positional error ellipse: major and minor semi-axes and the major axis’s position angle east of north.
func NewEllipse ¶
NewEllipse constructs an error ellipse. It rejects a negative minor axis, a minor axis longer than the major, a major axis over half a turn, or a position angle outside one turn in either direction. A zero minor axis is allowed for a catalogue’s degenerate line ellipse.
type Equatorial ¶
type Equatorial struct {
// contains filtered or unexported fields
}
Equatorial stores right ascension east along the celestial equator and declination north of it.
func NewEquatorial ¶
func NewEquatorial(ascension, declination measure.Angle) (*Equatorial, error)
NewEquatorial constructs a direction from right ascension and declination. It rejects ascension outside one turn in either direction and declination beyond a pole.
func (Equatorial) Ascension ¶
func (seen Equatorial) Ascension() measure.Angle
Ascension returns right ascension, positive east along the equator.
func (Equatorial) Declination ¶
func (seen Equatorial) Declination() measure.Angle
Declination returns declination, positive north of the equator.
func (Equatorial) String ¶
func (seen Equatorial) String() string
String formats the direction in degrees for diagnostics.
type Horizontal ¶
type Horizontal struct {
// contains filtered or unexported fields
}
Horizontal stores local azimuth from north toward east and altitude above the horizon.
func (Horizontal) Altitude ¶
func (seen Horizontal) Altitude() measure.Angle
Altitude returns angular height above the horizon.
func (Horizontal) Azimuth ¶
func (seen Horizontal) Azimuth() measure.Angle
Azimuth returns the angle from north toward east.
type Instant ¶
type Instant struct {
// contains filtered or unexported fields
}
Instant stores a time scale, whole modified Julian day, and fraction of that day. A UTC leap-second day has 86401 seconds; its fraction is measured against that longer day.
func Calendar ¶
Calendar is the instant at a date and a time of day on a scale.
Dates from 1582 October 15 are Gregorian, and dates before it are julian. Years are counted as astronomers count them: year zero is the year before year one.
A UTC day that ends in a leap second has a 60th second in its last minute, and no other day does. Returns an error for:
- a scale sky does not know
- a date neither calendar has, or one of the ten days of 1582 october the reform skipped
- a time of day the day does not have
func FromGPS ¶
FromGPS converts seconds since 1980-01-06 00:00 UTC to an instant on the GPS scale used by LIGO, Virgo, and the open science centre. It rejects nonfinite values and dates whose whole days float64 cannot count exactly.
func FromJulian ¶
FromJulian constructs an instant from two parts whose sum is a Julian date. Either part may hold the whole date. It rejects unknown scales and parts outside float64’s exact whole-day counting range.
func (Instant) Calendar ¶
Calendar is the date and time of the instant on its own scale, by Meeus, astronomical algorithms, chapter 7: Gregorian from 1582 October 15 and Julian before.
func (Instant) GPSSeconds ¶
GPSSeconds returns seconds since the GPS epoch, reversing FromGPS. It reports conversion errors from On, including UT1 input and UTC dates outside the leap table’s coverage.
func (Instant) Julian ¶
Julian returns two parts: the Julian date at the start of the day and the fraction elapsed since then.
func (Instant) MeanSidereal ¶
MeanSidereal returns Greenwich mean sidereal time from a UT1 instant, using the IAU 1982 expression. An instant on another scale returns an error rather than being treated as UT1.
type Offset ¶
type Offset struct {
// contains filtered or unexported fields
}
Offset stores east and north coordinates on a tangent plane.
type Place ¶
type Place struct {
// contains filtered or unexported fields
}
Place describes a site on Earth. Latitude is positive north and longitude positive east, following the IAU convention; height is measured above sea level.
func OnEarth ¶
OnEarth constructs a site from latitude, longitude, and height. It rejects coordinates beyond the poles or date line, heights below the centre of Earth, and heights above the chosen 1976-atmosphere limit.
func (Place) Local ¶
func (there Place) Local(at Equatorial, sidereal measure.Angle) Horizontal
Local converts an equatorial direction to a site’s horizontal frame using the supplied Greenwich sidereal angle. Use apparent sidereal time for apparent directions. The transform follows Meeus, Astronomical Algorithms, equations 13.5–13.6, with azimuth from north.
type Projector ¶
type Projector interface {
Onto(at Equatorial) (*Offset, error)
Back(offset Offset) Equatorial
}
Projector maps sky directions onto a field around a centre and back. Tangent implements it; callers can substitute generated mocks when testing catalogue fitting or plotting independently of projection.
type Scale ¶
type Scale struct {
// contains filtered or unexported fields
}
Scale identifies UTC, TAI, TT, TDB, UT1, or GPS time. The zero value is invalid and is rejected when constructing or converting instants.
func GPS ¶
func GPS() Scale
GPS is the continuous satellite time scale, TAI minus 19 seconds, also used for LIGO, Virgo, and the open science centre event timestamps.
type Tangent ¶
type Tangent struct {
// contains filtered or unexported fields
}
Tangent is the gnomonic plane touching the sky sphere at a chosen centre. Projection follows the line from the sphere’s centre, as used to fit catalogue positions in a small field.
East and north are standard coordinates xi and eta. They are stored as Angle values, but are tangents rather than angular separations; the distinction matters away from the centre.
The small-angle shortcut uses ΔRA*cos(dec) and Δdec. At declination 60 degrees it misses the exact plane by 0.015 arcseconds for a point one arcminute east, and by 54 arcseconds at one degree. Tests retain both comparisons.
func NewTangent ¶
func NewTangent(centre Equatorial) Tangent
NewTangent constructs the plane at a validated equatorial centre. Every Equatorial, including its zero value, is a valid direction.
func (Tangent) Back ¶
func (plane Tangent) Back(offset Offset) Equatorial
Back reverses Onto. Every finite point on the plane corresponds to a sky direction.