sky

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 9 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 is where things are, seen from places, at instants, in frames: the sun over a hillside, a star through the sun's lens, a merger's waves at two detectors. doc/sky.md is its design.

A small field around a source is a Tangent plane, the gnomonic projection, with positions on it as east and north Offsets; a position's error is an Ellipse whose outline lies on that plane.

Package sky is built on measure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrBehind

func ErrBehind() error

ErrBehind is a direction a quarter turn or more from a tangent plane's centre, which the line from the sphere's middle never takes to the plane.

func ErrDate

func ErrDate() error

ErrDate is a date or a julian date that is no moment: no such day in the calendar, a time past the day's end, or a number that is none.

func ErrEllipse

func ErrEllipse() error

ErrEllipse is axes that make no ellipse, or an outline of too few points to draw one.

func ErrPlace

func ErrPlace() error

ErrPlace is a place or a direction that is not one: past a pole, past the date line, or not a number.

func ErrScale

func ErrScale() error

ErrScale is an instant that cannot be told on the scale asked for: no scale, ut1 without iers's earth orientation, or utc where its leap seconds are not known.

Types

type Ellipse

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

Ellipse is an error ellipse on the sky, as catalogues give a position's: its semi-major and semi-minor axes, and the position angle of the major axis, east of north.

func NewEllipse

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

NewEllipse is the ellipse of two semi-axes and the position angle of the major one, east of north. It refuses an axis below nothing or not finite, a minor axis longer than the major, and an angle not finite, and then gives no ellipse.

func (Ellipse) Outline

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

Outline is so many points evenly round the ellipse, as offsets east and north of its centre, starting at the end of the major axis the position angle points to. It refuses fewer than three points, and then gives none.

type Equatorial

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

Equatorial is a direction on the sky's own frame: right ascension east along the equator, and declination north of it.

func NewEquatorial

func NewEquatorial(ascension, declination measure.Angle) (*Equatorial,
	error)

NewEquatorial is the direction at a right ascension and declination. It refuses an ascension that is not a finite number and a declination past a pole, and then gives no direction.

func (Equatorial) Ascension

func (seen Equatorial) Ascension() measure.Angle

Ascension is the direction's right ascension, east along the equator.

func (Equatorial) Declination

func (seen Equatorial) Declination() measure.Angle

Declination is the direction's declination, north of the equator.

func (Equatorial) String

func (seen Equatorial) String() string

String is the direction in degrees, for a person reading an error.

type Horizontal

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

Horizontal is a direction in the local sky: azimuth from north round toward east, and altitude above the horizon.

func (Horizontal) Altitude

func (seen Horizontal) Altitude() measure.Angle

Altitude is how far above the horizon.

func (Horizontal) Azimuth

func (seen Horizontal) Azimuth() measure.Angle

Azimuth is how far round from north, toward east.

type Instant

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

Instant is a moment on a scale, held in two parts so none of its resolution is lost: a whole modified julian day, and how far through that day it is, from nought up to one. On a utc day ending in a leap second the day is 86401 s, and the fraction is of that.

func Calendar

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

Calendar is the instant at a date and time on a scale. From 1582 october 15 the date is gregorian, and before it julian; years are counted as astronomers do, with year nought before year one.

A utc day that ended in a leap second has a second of 60 in its last minute; no other day does. Calendar refuses no scale, no such date and no such time, and then gives no instant.

func FromGPS

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

FromGPS is the instant a gps time names: seconds of gps time since the gps epoch, 1980 january 6 0h utc. The LIGO and Virgo detectors, and the open science centre that publishes their data, give their times this way.

FromGPS refuses a time that is not a finite number, or so far off its days cannot be counted exactly, and then gives no instant.

func FromJulian

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

FromJulian is the instant at a julian date given in two parts whose sum is the date; one part may carry it all and the other nought. It refuses no scale, a date that is no finite number, and one so far off its days cannot be counted exactly, and then gives no instant.

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 is the instant as seconds of gps time since the gps epoch, FromGPS undone. It refuses what On refuses: an instant on ut1, or on utc where its leap seconds are not known.

func (Instant) Julian

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

Julian is the instant's julian date in two parts: the julian date of the start of its day, and the fraction of the day since.

func (Instant) MeanSidereal

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

MeanSidereal is greenwich mean sidereal time at an instant on ut1: how far the earth has turned against the stars, by the iau's expression of 1982. It refuses an instant on another scale, and then gives no angle.

func (Instant) On

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

On is the same instant on another scale. ut1 needs iers's measurements of the earth's turning, which sky does not hold yet, so it is refused by name. On refuses no scale, and then gives no instant.

func (Instant) Scale

func (moment Instant) Scale() Scale

Scale is the clock the instant is on.

func (Instant) UT1

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

UT1 is a utc instant on ut1, the earth's own turning, given iers's dut1 for the day: ut1 less utc. It refuses an instant not on utc and a dut1 past 0.9 s, which iers never lets it reach, and then gives no instant.

type Offset

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

Offset is a place on a tangent plane: how far east and north of the centre it is.

func NewOffset

func NewOffset(east, north measure.Angle) Offset

NewOffset is the place so far east and north of a tangent plane's centre.

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 is a place on the earth: its latitude, north above nought; its longitude, east above nought, as the iau counts it; and its height.

func OnEarth

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

OnEarth is the place at a latitude, a longitude and a height. It refuses a latitude past a pole, a longitude past the date line, and a height that is not a finite number, and then gives no place.

func (Place) Height

func (there Place) Height() measure.Length

Height is how high the place stands.

func (Place) Latitude

func (there Place) Latitude() measure.Angle

Latitude is how far north the place is.

func (Place) Local

func (there Place) Local(at Equatorial,
	sidereal measure.Angle) Horizontal

Local is a direction on the sky's frame as it stands in the place's sky, when greenwich has turned so far: its sidereal time. apparent directions take apparent sidereal time. by meeus, astronomical algorithms, equations 13.5 and 13.6, with azimuth from north.

func (Place) Longitude

func (there Place) Longitude() measure.Angle

Longitude is how far east the place is.

type Projector

type Projector interface {
	Onto(at Equatorial) (*Offset, error)
	Back(offset Offset) Equatorial
}

Projector takes directions onto a small field about a centre, and back: a Tangent is one. A caller that draws or fits positions takes a Projector, so its tests stand a mock in (celestial/mocks) and expect its calls; the projection is tested once, here.

type Scale

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

Scale is the clock an instant is on: utc, tai, tt, tdb, ut1 or gps. doc/sky.md says what each is. The zero Scale is none of them, and every instant refuses it.

func GPS

func GPS() Scale

GPS is the global positioning system's time, tai less 19 s, the clock LIGO, Virgo and the open science centre give their times on.

func TAI

func TAI() Scale

TAI is international atomic time.

func TDB

func TDB() Scale

TDB is barycentric dynamical time, tt and a wobble of under two thousandths of a second.

func TT

func TT() Scale

TT is terrestrial time, tai and 32.184 s.

func UT1

func UT1() Scale

UT1 is the earth's own turning.

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 plane that touches the sky's sphere at a centre, and the gnomonic projection onto it: each direction goes along the line from the sphere's middle to where that line meets the plane.

It is the standard projection for small fields, and the one a catalogue's positions near a source are drawn and fit on.

East and north on the plane are the standard coordinates, xi and eta, each the tangent of an angle; here they are kept as angles, which is what they are near the centre, where the projection is used.

The small-angle shortcut, east as the ascension apart times the cosine of the centre's declination and north as the declination apart, misses the plane by 0.015 arcseconds an arcminute east of a centre at sixty degrees north, and by 54 a degree east; the tests measure both.

func NewTangent

func NewTangent(centre Equatorial) Tangent

NewTangent is the tangent plane at a centre.

func (Tangent) Back

func (plane Tangent) Back(offset Offset) Equatorial

Back is the direction a place on the plane stands for: Onto, undone. Every place on the plane is some direction.

func (Tangent) Onto

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

Onto is where a direction lands on the plane. It refuses a direction a quarter turn or more from the centre, to within rounding, and then gives no offset.

Jump to

Keyboard shortcuts

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