sky

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func NewEllipse(major, minor, angle measure.Angle) (*Ellipse, error)

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.

func (Ellipse) Outline

func (ellipse Ellipse) Outline(points int) ([]Offset, error)

Outline returns evenly spaced points around the ellipse as east and north offsets, beginning at the major-axis end selected by the position angle. Fewer than three points returns an error.

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

func Calendar(year, month, day, hour, minute int, second float64,
	scale Scale) (*Instant, error)

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

func FromGPS(seconds float64) (*Instant, error)

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

func FromJulian(whole, fraction float64, scale Scale) (*Instant, error)

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

func (moment Instant) Calendar() (year, month, day, hour, minute int,
	second float64)

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

func (moment Instant) GPSSeconds() (*float64, error)

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

func (moment Instant) Julian() (whole, fraction float64)

Julian returns two parts: the Julian date at the start of the day and the fraction elapsed since then.

func (Instant) MeanSidereal

func (moment Instant) MeanSidereal() (*measure.Angle, error)

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.

func (Instant) On

func (moment Instant) On(scale Scale) (*Instant, error)

On expresses the same instant on another supported scale. Unknown scales and UTC dates outside the leap-second table’s coverage return an error. UT1 conversions require Earth-rotation data; use UT1 with a measured DUT1 instead.

func (Instant) Scale

func (moment Instant) Scale() Scale

Scale returns the instant’s time scale.

func (Instant) UT1

func (moment Instant) UT1(dut1 measure.Duration) (*Instant, error)

UT1 converts a UTC instant using the day’s measured DUT1 = UT1 − UTC in seconds. It requires UTC input and a finite offset within the IERS limit of 0.9 seconds.

type Offset

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

Offset stores east and north coordinates on a tangent plane.

func NewOffset

func NewOffset(east, north measure.Angle) Offset

NewOffset constructs east and north tangent-plane coordinates.

func (Offset) East

func (offset Offset) East() measure.Angle

East is how far east of the centre the offset is.

func (Offset) North

func (offset Offset) North() measure.Angle

North is how far north of the centre the offset is.

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

func OnEarth(latitude, longitude measure.Angle,
	height measure.Length) (*Place, error)

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) Height

func (there Place) Height() measure.Length

Height returns elevation above sea level.

func (Place) Latitude

func (there Place) Latitude() measure.Angle

Latitude returns angular distance north of the equator.

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.

func (Place) Longitude

func (there Place) Longitude() measure.Angle

Longitude returns angular distance east of Greenwich.

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.

func TAI

func TAI() Scale

TAI is international atomic time.

func TDB

func TDB() Scale

TDB is barycentric dynamical time, differing periodically from TT by less than about two milliseconds.

func TT

func TT() Scale

TT is terrestrial time: TAI plus exactly 32.184 seconds.

func UT1

func UT1() Scale

UT1 is time based on Earth’s rotation.

func UTC

func UTC() Scale

UTC is coordinated universal time, the civil clock, with leap seconds.

func (Scale) String

func (scale Scale) String() string

String is the scale's name, or "no scale" for the zero Scale.

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.

func (Tangent) Onto

func (plane Tangent) Onto(at Equatorial) (*Offset, error)

Onto projects a direction onto the tangent plane. Directions a quarter-turn or more from the centre have no finite projection and return an error, allowing for floating-point rounding at the boundary.

Jump to

Keyboard shortcuts

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