gaia

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package gaia is the library behind the gaia command line: the HTTP client, request shaping, and the typed data models for ESA Gaia DR3.

The Client here is the spine every command shares. It sets a real User-Agent, paces requests so a busy session stays polite, and retries the transient failures (429 and 5xx) that any public service throws under load.

Index

Constants

View Source
const BaseURL = "https://" + Host

BaseURL is the root every request is built from.

View Source
const DefaultUserAgent = "gaia-cli/dev (+https://github.com/tamnd/gaia-cli)"

DefaultUserAgent identifies the client to the ESA TAP service.

View Source
const Host = "gea.esac.esa.int"

Host is the ESA Gaia TAP server hostname.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTP      *http.Client
	UserAgent string
	// Rate is the minimum gap between requests. Zero means no pacing.
	Rate    time.Duration
	Retries int
	// contains filtered or unexported fields
}

Client talks to the ESA Gaia TAP service over HTTP.

func NewClient

func NewClient() *Client

NewClient returns a Client with sensible defaults: 60s timeout (TAP can be slow), 500ms minimum gap between requests, and three retries on transient errors.

func (*Client) BrightStars

func (c *Client) BrightStars(ctx context.Context, maxMag float64, limit int) ([]*Star, error)

BrightStars returns stars brighter than maxMag in the G band, sorted by ascending magnitude (brightest first).

func (*Client) Get

func (c *Client) Get(ctx context.Context, reqURL string) ([]byte, error)

Get fetches a URL and returns the response body. It paces and retries according to the client's settings.

func (*Client) NearbyStars

func (c *Client) NearbyStars(ctx context.Context, ra, dec, radiusDeg float64, limit int) ([]*Star, error)

NearbyStars returns stars within radiusDeg degrees of the given ICRS coordinates.

func (*Client) NearestStars

func (c *Client) NearestStars(ctx context.Context, limit int) ([]*Star, error)

NearestStars returns the stars with the largest parallax (closest to Earth), filtered to parallax > 100 mas (within ~10 parsecs).

func (*Client) QueryTAP

func (c *Client) QueryTAP(ctx context.Context, adql string, limit int) ([]map[string]interface{}, error)

QueryTAP executes an ADQL query against the ESA Gaia TAP service and returns the rows as a slice of maps keyed by column name.

type Domain

type Domain struct{}

Domain is the gaia driver. It carries no state; the per-run client is built by the factory Register hands kit.

func (Domain) Classify

func (Domain) Classify(input string) (uriType, id string, err error)

Classify turns any accepted input into the canonical (type, id). For Gaia, any non-empty string is treated as a star source_id.

func (Domain) Info

func (Domain) Info() kit.DomainInfo

Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.

func (Domain) Locate

func (Domain) Locate(uriType, id string) (string, error)

Locate returns the TAP query URL for a star by source_id.

func (Domain) Register

func (Domain) Register(app *kit.App)

Register installs the client factory and every operation onto app.

type Star

type Star struct {
	ID           string  `json:"id"                       kit:"id"`
	RA           float64 `json:"ra"`
	Dec          float64 `json:"dec"`
	Parallax     float64 `json:"parallax_mas,omitempty"`
	ParallaxErr  float64 `json:"parallax_error,omitempty"`
	MagG         float64 `json:"mag_g,omitempty"`
	MagBP        float64 `json:"mag_bp,omitempty"`
	MagRP        float64 `json:"mag_rp,omitempty"`
	ProperMotRA  float64 `json:"pmra,omitempty"`
	ProperMotDec float64 `json:"pmdec,omitempty"`
	RadialVel    float64 `json:"radial_velocity_km_s,omitempty"`
}

Star is a single record from gaiadr3.gaia_source.

Jump to

Keyboard shortcuts

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