celestialdata

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 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.

README

celestial-data

data files that celestial's tests and examples read: FITS, HDF5, and the catalogues they come from, and the fetchers that bring them from the archives that hold them.

every file has an entry below, written when it is added:

  • the path, and what the file is
  • where it came from, as a url, and the date it was fetched
  • the licence its publisher states, in their words
  • its size in bytes and its sha256

fetching

$ celestial-data archives
$ celestial-data find --ra 266.4168371 --dec -29.0078106 --radius 0.1
$ celestial-data fetch --archive nustar,ppmap --ra 266.4168371 \
    --dec -29.0078106 --radius 0.1 --into ~/sky --dry-run

find names what each archive holds for the circle and fetches nothing. fetch brings it home, one folder an archive under --into. it never replaces a file: one already there is kept and said so, and one that did not come whole is not kept. --match keeps to the names that hold it. --archive names one or more archives, separated by commas; with none, every archive is asked.

sets

a set is a name for a list of what to fetch and which subfolder of one folder it goes into.

$ celestial-data fetch-set grissom --into ~/grissom-data --dry-run
$ GRISSOM_DATA=~/grissom-data celestial-data fetch-set grissom

--into names the folder. without it the folder is the variable named for the set, in upper case and _DATA: GRISSOM_DATA for grissom. with neither, it refuses and says so. a file already there is kept and said so, never fetched again; one line a file. a file a set names that its archive does not list is an error that names it. one failure does not stop the others. --dry-run fetches nothing; it asks an archive only for the files a set does not name.

the sets are in cmd/celestial-data/sets.go. the numbers a set picks are in cmd/celestial-data/numbers.yaml.

grissom : what the grissom viewer reads. round Sgr A* (0.1 degrees): the two GLIMPSE mosaics GLM_00000+0000_mosaic_I1.fits and ..._I4.fits into sgra/glimpse/, the MeerKAT 1284 MHz Stokes I mosaic into sgra/meerkat/, and l000_cdens.fits into sgra/ppmap/. all of bluemarble, usgs and naturalearth into earth/. four whole-sky maps from SkyView into sky/. every colourway the chroma archive lists into colourways/.

the archives

each has an adapter in its own package.

chandra : Chandra's primary products, from HEASARC's chanmaster table and the Chandra Data Archive's folders. the longest observations come first; --most says how many.

nustar : NuSTAR's cleaned event files, both focal plane modules, from HEASARC's numaster table and its FTP tree.

glimpse : Spitzer GLIMPSE II mosaics at IRSA, in IRAC's four bands. each tile's preview is named for its centre and size, so the tiles a circle reaches are read from the folder's listing.

galcen_psc : IRSA's Galactic Center IRAC catalog, Ramirez et al. 2008: the rows in the circle, as CSV, from IRSA's TAP service.

hpsgc : the HST/NICMOS Paschen-alpha survey of the Galactic Centre at MAST. its field is read from the mosaic's own header cards.

meerkat : SARAO's MeerKAT Galactic Centre mosaic at 1.28 GHz, with its spectral index. asked through its DOI. under CC BY-NC 4.0; the page asks that work using it cite arXiv:2201.10541.

ppmap : Cardiff's Hi-GAL PPMAP maps of dust column density and temperature. each tile is taken to be the l000 tile's size, centred on its name with a degree of slack, so a circle near a tile's edge finds its neighbour too.

hips : a hips2fits cutout of any HiPS survey, at Strasbourg or a mirror: --hips-host, --hips and --pixels.

chroma : the colourways in janearc/chroma on GitHub: the .css files of colourways/sources on main, listed through GitHub's contents API when asked, so a colourway added there comes with no change here. asked only by name, as the earth archives are. GitHub allows sixty unsigned questions an hour from one address.

gaia : ESA's Gaia archive: the stars of Gaia DR3's gaia_source with a radial velocity, their astrometry with its errors and correlations, and their brightness and colour, as FITS. a circle of radius 180 is the whole sky, about 33.8 million stars. asked only by name.

the archive runs it as a job, under the session of whoever signed in, so it knows whose work it is. a signed-in user's job runs for up to two hours; fetch asks after it every 30 seconds.

$ export GAIA_SESSION=~/gaia/session
$ celestial-data gaia-login --op op://Personal/gaia
$ celestial-data fetch --archive gaia --ra 0 --dec 0 --radius 180 \
    --into ~/sky

gaia-login reads the login's username and password with op, which asks the person at the keyboard to allow it, so a person runs it. the session it keeps is readable by its owner alone, and fetch sends it when GAIA_SESSION names it.

how it is held

everything reaches the network through web.Web, one interface with a generated mock. the tests hold each adapter to the exact addresses it asks for, against replies the archives really gave, recorded under each package's testdata. the circle they asked about is in internal/replay/asked.yaml.

each adapter also has a live check that asks the real archive and asks each file it names for its length, never for the file:

$ go test -tags live ./...

numbers that were measured, such as where a mosaic lies, are kept with the header card they were read from, in each package's numbers.yaml. numbers that were picked say who picked them and why.

building

$ game build
$ game check

Documentation

Overview

Package celestialdata finds and fetches the files astronomy archives hold for a patch of sky. Each archive has its own adapter package. The adapter knows how its archive is laid out and what it holds near a position.

This package holds the parts the adapters share. Fetch brings a product home.

Index

Constants

View Source
const Unsized = 0

Unsized is a product's size when the archive does not say it ahead. It's defined: NewProduct takes none as not known.

Variables

This section is empty.

Functions

func EndsIn

func EndsIn(suffix string) func(link string) bool

EndsIn keeps the links that end in a suffix, as a file's type: EndsIn ".fits" for Files keeps a folder's FITS files.

func Fetch

func Fetch(get web.Web, product *Product, into string) (string, error)

Fetch brings a product's file into the folder into and returns its path. It makes the folder when it is missing.

It never replaces a file. It refuses when a file is already there under the name. It refuses a .part already there too, since that may be another fetch's.

The bytes go to a .part file of its own first. That file takes the name only once its length is what the server and the product said. For a gzip file the stream must also read to its end. Its own .part is removed when anything fails.

func Refuse

func Refuse(format string, args ...any) error

Refuse is a refusal that says why, as fmt.Errorf writes it. It wraps Refused, so the adapters' refusals are found as this package's are.

func Refused

func Refused() error

Refused is wrapped by each of the refusals here. NewProduct and Fetch refuse a name that is not one plain file name. Fetch refuses when a file or a .part is already there under the name.

func Span

func Span(value, pixel, step, length float64) (centre, half float64)

Span is where an image's axis is centred and how far it reaches either side. It is read from the axis's header cards. value is the coordinate at the reference pixel. pixel is that pixel. step is the coordinate's change from one pixel to the next. length is the count of pixels.

Types

type Adapter

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

Adapter is the base every archive's adapter is built on: its name, as the command line takes it, the web it asks through, and, for a survey of one part of the sky, its footprint. An adapter holds one, so its products, refusals and errors carry its name without its typing it.

func Named

func Named(name string) (*Adapter, error)

Named is an adapter by a name with no web of its own, for one that asks through a host it is given or asks nothing. It refuses a name that is not one word.

func NewAdapter

func NewAdapter(name string, get web.Web) (*Adapter, error)

NewAdapter is an adapter by a name, asking through get. It refuses a name that is not one word and a missing web.

func NewField

func NewField(name string, get web.Web, patch *Patch) (*Adapter, error)

NewField is an adapter by a name, asking through get, for a survey that covers one part of the sky, patch. A circle that does not reach it is asked nothing. It refuses what NewAdapter does, and a missing patch.

func (*Adapter) Fail

func (adapter *Adapter) Fail(format string, args ...any) error

Fail is an error that begins with the adapter's name and says what went wrong, as fmt.Errorf writes it, %w and all.

func (*Adapter) Files

func (adapter *Adapter) Files(folder string, keep func(link string) bool,
	id, about string) ([]*Product, error)

Files is the files a folder's page lists that keep holds, each as a product of one id and one about. A link that is not one plain file name leads out of the folder; it is not the folder's, and is passed over.

func (*Adapter) Footprint

func (adapter *Adapter) Footprint() *Patch

Footprint is the part of the sky a field covers, or nil for an adapter that is not a field.

func (adapter *Adapter) Links(folder string) ([]string, error)

Links is the links on a folder's page, in the order written, their entities read; an error begins with the adapter's name.

func (*Adapter) Name

func (adapter *Adapter) Name() string

Name is the adapter's name as the command line takes it.

func (*Adapter) Product

func (adapter *Adapter) Product(id, file, url string, size int64,
	about string) (*Product, error)

Product is one file the archive holds, with the adapter's name for the archive and a few words on what it is, none when about is empty.

id is the archive's own name for what the file belongs to; file is its name, one plain file name; url is where it is kept; size is its length in bytes, Unsized when the archive does not say.

It refuses an empty address, a name that is not one plain file name, and a size below none.

func (*Adapter) Reaches

func (adapter *Adapter) Reaches(near *Near) bool

Reaches is whether a circle reaches a field's footprint. An adapter that is not a field reaches every circle.

func (*Adapter) Refuse

func (adapter *Adapter) Refuse(format string, args ...any) error

Refuse is a refusal that begins with the adapter's name and says why, as fmt.Errorf writes it. It wraps Refused, as Refuse does.

func (*Adapter) Web

func (adapter *Adapter) Web() web.Web

Web is what the adapter asks through, or nil for one Named.

func (*Adapter) Wrap

func (adapter *Adapter) Wrap(err error) error

Wrap is an error that begins with the adapter's name, or none for none.

type Archive

type Archive interface {
	// Name is the adapter's name as the command line takes it: one word.
	Name() string
	// Find is what the archive holds near a position.
	Find(near *Near) ([]*Product, error)
}

Archive is one archive's adapter.

type ByName

type ByName interface {
	Archive
	ByNameOnly() bool
}

ByName is an archive that is asked only when it is named, never with every archive. Fixed is one.

type File

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

File is one file a fixed archive holds, described ahead. NewFile makes one; NewFixed makes it a product.

func NewFile

func NewFile(id, name, url string, size int64, about string) File

NewFile describes a file ahead, as Adapter.Product takes one: what it belongs to, its name, where it is kept, its length in bytes (Unsized when not known) and a few words on what it is. Nothing is refused here; NewFixed refuses what Product would.

type Fixed

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

Fixed is an archive whose files are known ahead, wherever on the sky or the earth they are asked for: a whole-earth image, a library, a map. It is asked only by name, never with every archive, since what it holds does not depend on the circle.

func NewFixed

func NewFixed(name string, files ...File) (*Fixed, error)

NewFixed is an archive by a name whose files are described ahead. Each is made a product as Adapter.Product makes one, so an adapter has no refusal of its own to handle. It refuses a name that is not one word, no files, and a file Product refuses.

func (*Fixed) ByNameOnly

func (*Fixed) ByNameOnly() bool

ByNameOnly says the archive is asked only when it is named.

func (*Fixed) Find

func (fixed *Fixed) Find(*Near) ([]*Product, error)

Find is the archive's files, whatever the circle.

func (*Fixed) Name

func (fixed *Fixed) Name() string

Name is the archive's name as the command line takes it.

type Frame

type Frame string

Frame is the coordinates a patch of sky is laid out in.

const (
	// InICRS is right ascension and declination.
	InICRS Frame = "icrs"
	// InGalactic is galactic longitude and latitude.
	InGalactic Frame = "galactic"
)

The frames a patch may be laid out in.

type Galactic

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

Galactic is a place on the sky in galactic longitude and latitude, in degrees.

func (Galactic) Latitude

func (place Galactic) Latitude() float64

Latitude is the galactic latitude in degrees, from -90 to 90.

func (Galactic) Longitude

func (place Galactic) Longitude() float64

Longitude is the galactic longitude in degrees, from 0 to under 360.

type Measured

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

Measured is a numbers file an adapter keeps beside its code, read. Its numbers are read from the archive's own files, such as the header cards that say where an image lies.

func NewMeasured

func NewMeasured(file string, raw []byte) *Measured

NewMeasured reads a numbers file's bytes. When the file will not read, why is kept and each Get gives it.

func (*Measured) Circle

func (kept *Measured) Circle(ra, dec, radius string) (*Near, error)

Circle is the circle three of the numbers name. They are a right ascension, a declination and a radius in degrees. Numbers that are missing are an error. So is a circle that is not one.

func (*Measured) Footprint

func (kept *Measured) Footprint(frame Frame, image string) (*Patch,
	error)

Footprint is the patch an image covers in a frame. It is read from the image's header cards. They are kept as numbers named for the image and the card, such as palpha-naxis1.

The first axis is longitude and the second latitude. In ICRS a step along the first axis is a step on the sky. So the reach in right ascension is wider by one over the cosine of the declination.

func (*Measured) Get

func (kept *Measured) Get(name string) (float64, error)

Get is the number of a name, or why there is none.

func (*Measured) Value

func (kept *Measured) Value(name string) float64

Value is the number of a name. The numbers file is built into the adapter beside it, so a name it does not hold, or a file that will not read, is a mistake in the adapter's own code, which its tests find: asking panics, and says which, as celestial's research.Value does.

type Near

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

Near is a circle on the sky: a centre and a radius in degrees.

func NewNear

func NewNear(centre *Position, radius float64) (*Near, error)

NewNear is the circle of a radius round a centre. It refuses a missing centre, and a radius that is not a size a circle on the sky can have.

func (Near) Centre

func (circle Near) Centre() Position

Centre is the circle's centre.

func (Near) Radius

func (circle Near) Radius() float64

Radius is the circle's radius, in degrees.

func (Near) Reaches

func (circle Near) Reaches(patch *Patch) bool

Reaches is whether some of the circle may fall in the patch. It errs only by saying yes.

Each degree of longitude is shorter by the cosine of the latitude. So the circle's reach in longitude is taken where the circle comes nearest a pole. Circles round a pole reach every longitude.

type Patch

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

Patch is a box of sky in a frame. It has a centre and how far it reaches either side of it along each axis. The reach is in that frame's degrees.

func NewPatch

func NewPatch(frame Frame, lon, lat, halfLon, halfLat float64) (*Patch,
	error)

NewPatch is the box round a centre in a frame. It refuses a frame it does not know, a centre off the sky and a reach that is below nothing or not a number.

func (*Patch) Moved

func (patch *Patch) Moved(lon, more float64) *Patch

Moved is the same box centred on another longitude, its reach in longitude grown by more. Surveys whose tiles are all one size give each tile's box from one tile's this way.

More below nothing grows it by nothing. Longitudes that are not a number leave a box only circles round a pole reach, as they reach every longitude.

type Position

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

Position is a place on the sky, in ICRS degrees.

func NewPosition

func NewPosition(ra, dec float64) (*Position, error)

NewPosition is the place at a right ascension and declination. It refuses numbers that are not on the sky.

func (Position) Dec

func (place Position) Dec() float64

Dec is the declination, in degrees.

func (Position) Galactic

func (place Position) Galactic() Galactic

Galactic is the place in galactic coordinates.

func (Position) RA

func (place Position) RA() float64

RA is the right ascension, in degrees.

type Product

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

Product is one file an archive holds.

func Found

func Found(product *Product, err error) ([]*Product, error)

Found is a find of one product, or of none and why. It takes what an adapter's Product gives. So an adapter that names one file hands a refusal on with no branch of its own.

func (Product) About

func (product Product) About() string

About says what the file is, in a few words.

func (Product) Archive

func (product Product) Archive() string

Archive is the name of the adapter that found the product.

func (Product) ID

func (product Product) ID() string

ID is the archive's own name for what the file belongs to.

func (Product) Name

func (product Product) Name() string

Name is the file's name.

func (Product) URL

func (product Product) URL() string

URL is where the archive holds the file.

Directories

Path Synopsis
Package bluemarble fetches NASA's Blue Marble Next Generation, the whole earth's land and sea in true colour, a composite of a month of MODIS images, laid on a plain grid of longitude and latitude.
Package bluemarble fetches NASA's Blue Marble Next Generation, the whole earth's land and sea in true colour, a composite of a month of MODIS images, laid on a plain grid of longitude and latitude.
Package cardiff finds the Hi-GAL PPMAP results kept at Cardiff.
Package cardiff finds the Hi-GAL PPMAP results kept at Cardiff.
Package cds names cutouts from the hips2fits service at the Centre de Données astronomiques de Strasbourg.
Package cds names cutouts from the hips2fits service at the Centre de Données astronomiques de Strasbourg.
Package chandra finds Chandra's primary data products near a place on the sky.
Package chandra finds Chandra's primary data products near a place on the sky.
Package chroma finds the colourways in jane's chroma repository on GitHub: the .css files of its colourways/sources folder, on its main branch.
Package chroma finds the colourways in jane's chroma repository on GitHub: the .css files of its colourways/sources folder, on its main branch.
cmd
celestial-data command
Command celestial-data finds and fetches what astronomy archives hold near a place on the sky.
Command celestial-data finds and fetches what astronomy archives hold near a place on the sky.
Package gaia is the adapter for ESA's Gaia archive: rows of Gaia DR3's gaia_source, as FITS, asked as a job of the archive's TAP service.
Package gaia is the adapter for ESA's Gaia archive: rows of Gaia DR3's gaia_source, as FITS, asked as a job of the archive's TAP service.
internal
replay
Package replay answers an adapter's questions with what an archive really said.
Package replay answers an adapter's questions with what an archive really said.
Package irsa finds what NASA's infrared archive at IPAC holds near a place on the sky.
Package irsa finds what NASA's infrared archive at IPAC holds near a place on the sky.
Package mast finds the files of the HST/NICMOS Paschen-alpha survey of the Galactic Centre.
Package mast finds the files of the HST/NICMOS Paschen-alpha survey of the Galactic Centre.
Package naturalearth fetches and reads Natural Earth's land: the outlines of the land at a scale of 1:50 million, as GeoJSON.
Package naturalearth fetches and reads Natural Earth's land: the outlines of the land at a scale of 1:50 million, as GeoJSON.
Package nustar finds NuSTAR's cleaned event files near a place on the sky.
Package nustar finds NuSTAR's cleaned event files near a place on the sky.
Package sarao finds the files of SARAO's MeerKAT mosaic of the Galactic Centre: its total intensity at 1.28 GHz, its spectral index and that index's error.
Package sarao finds the files of SARAO's MeerKAT mosaic of the Galactic Centre: its total intensity at 1.28 GHz, its spectral index and that index's error.
Package skyview asks NASA's SkyView for whole-sky maps: any of its surveys resampled onto one image of the sky in galactic longitude and latitude, on a plain grid, as FITS.
Package skyview asks NASA's SkyView for whole-sky maps: any of its surveys resampled onto one image of the sky in galactic longitude and latitude, on a plain grid, as FITS.
Package tap asks a Table Access Protocol service one question in ADQL and waits for the answer.
Package tap asks a Table Access Protocol service one question in ADQL and waits for the answer.
Package usgs fetches and reads the USGS Spectral Library Version 7: the measured reflectance of minerals, soils, water, plants and made things, from the ultraviolet into the infrared.
Package usgs fetches and reads the USGS Spectral Library Version 7: the measured reflectance of minerals, soils, water, plants and made things, from the ultraviolet into the infrared.
Package votable reads a VOTable.
Package votable reads a VOTable.
Package web is the one way celestial-data reaches an archive: a GET, a HEAD and a POST.
Package web is the one way celestial-data reaches an archive: a GET, a HEAD and a POST.

Jump to

Keyboard shortcuts

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