sky

package
v0.0.3 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: 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 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

This section is empty.

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. returns nil and error for:

  • a semi-minor axis below none, or longer than the semi-major
  • a semi-major axis past the far side of the sky, half a turn
  • a position angle more than a turn from north

A semi-minor axis of none is an ellipse squashed to a line, which a catalogue may give.

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. returns nil and error for an ascension more than a turn either way, or a declination past a pole.

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 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 nought 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 nil and 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 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. returns nil and error for a scale sky does not know, or a part with more days than a float64 counts exactly.

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. returns nil and error for 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 above sea level. returns nil and error for:

  • a latitude past a pole, or a longitude past the date line
  • a height below the earth's centre, or above the highest a place on the earth stands, the top of the 1976 standard atmosphere

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 carries directions onto a small field about a centre, and back. Tangent is one. A caller that draws or fits positions takes a Projector, so its own tests can stand the generated mock in; the projection itself is tested here, once.

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 a gnomonic projection: the plane that touches the sky's sphere at a centre, onto which each direction is carried along the line from the sphere's middle.

It is the usual projection for a small field, and the one a catalogue's positions near a source are drawn and fitted on.

East and north on the plane are the standard coordinates, xi and eta. Each is the tangent of an angle, and Tangent keeps them as angles, which they nearly are close to the centre, where the plane is used.

The small-angle shortcut takes east as the difference in ascension times the cosine of the centre's declination, and north as the difference in declination.

At a centre sixty degrees north, the shortcut puts a point an arcminute east 0.015 arcseconds off the plane, and a point a degree east 54 arcseconds off. The tests measure both.

func NewTangent

func NewTangent(centre Equatorial) Tangent

NewTangent is the tangent plane at a centre. It refuses none: every Equatorial is a direction on the sky, since NewEquatorial refuses any that is not, and the zero Equatorial is one too.

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, so it refuses none.

func (Tangent) Onto

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

Onto is where a direction lands on the plane. returns nil and error for a direction a quarter turn or more from the centre, to within rounding, which the line from the sphere's middle never carries to the plane.

Jump to

Keyboard shortcuts

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