Skip to content

xen0l/go-openngc

Repository files navigation

go-openngc

Go License: MIT Data: CC-BY-SA-4.0

Go port of PyOngc — a library and CLI for querying the OpenNGC deep-sky object catalog. Provides offline lookup, search, filtering, and spatial queries for ~14K NGC/IC/Messier objects with zero external dependencies. CLI output is byte-compatible with PyOngc v1.2.0 against OpenNGC v20260307.

Installation

# Library
go get github.com/xen0l/go-openngc/ongc

# CLI
go install github.com/xen0l/go-openngc/cmd/ongc@latest

Usage

Library

Query the catalog by NGC, IC, or Messier number; common names; or cross-catalog identifiers. Names are normalized automatically—"NGC1", "ngc1", and "ngc 1" all resolve to the same object.

import "github.com/xen0l/go-openngc/ongc"

obj, err := ongc.Get("NGC1")      // NGC, IC, common name, or any identifier
obj, err := ongc.Messier(31)      // Andromeda Galaxy → NGC0224
results  := ongc.Search("Crab")   // substring search across all names

Compose filters to find objects of interest:

galaxies, err := ongc.GetList(
    ongc.WithType("G"),
    ongc.WithConstellation("Vir"),
    ongc.WithUpToVMag(12),
)

Spatial queries:

// Angular separation between two objects (degrees)
sep, err := ongc.GetSeparation("NGC0001", "NGC0002")

// Find objects within 30 arcminutes of M31 (NGC catalog only)
objs, dists, err := ongc.GetNeighbors("M31", 30, "NGC")

// Same, from arbitrary sky coordinates
objs, dists, err := ongc.GetNearby("00:42:44.33", "+41:16:09.4", 30, "NGC")

See the full API reference on pkg.go.dev.

Data

The embedded database comes from the OpenNGC project by Mattia Verga, released under CC-BY-SA-4.0. It contains ~13,969 NGC objects and ~64 addendum entries with coordinates, magnitudes, sizes, Hubble classifications, radial velocities, and cross-identifications (Messier, PGC, UGC, MCG, etc.).

Design & Philosophy

go-openngc is a native-Go port, not a fork or competitor — data corrections belong upstream; Go-side bugs belong here. The project was translated from PyOngc with heavy use of AI coding agents, and quality is defended with byte-exact CLI output-parity tests, property tests against PyOngc fixtures, race-detector runs, and a linter stack that includes govulncheck and REUSE license compliance.

See docs/DESIGN.md for the full design criteria, stability promises, and quality-gates enumeration.

Contributing

Data corrections: Please contribute upstream to the OpenNGC project — that's the authoritative source.

Library bugs or CLI issues: Open an issue in this repository.

Acknowledgments

  • OpenNGC database by Mattia Verga (CC-BY-SA-4.0)
  • PyOngc by Mattia Verga (MIT) — reference implementation
  • Built with assistance from Claude by Anthropic

License

Code is released under the MIT License. Embedded OpenNGC data is released under CC-BY-SA-4.0.

About

Go interface to OpenNGC deep sky object catalog

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages