stars

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: 0 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 stars is stars as data: a mass and an age go in, and out comes what the star is now, with its temperature, brightness and size.

Nothing here is a number picked by hand in code. measure holds nature's constants and the units; celestial's research data what stars takes on trust besides, each with its source; mainsequence.txt a table.

A star's life is a run of stages, each a state that lasts a while and hands on to the next. Two are built: burning, and ended. What an ended star leaves comes with the published tables that say which and how.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stage

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

Stage is a step in a star's life.

func Burning

func Burning() Stage

Burning is a star on the main sequence, burning hydrogen.

func Ended

func Ended() Stage

Ended is a star whose burning is over. Until the remnants come, it gives no light here.

func (Stage) String

func (stage Stage) String() string

String is the stage's name.

type Star

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

Star is a star at an age: what it is, and what it gives off.

func NewStar

func NewStar(mass measure.Mass, age measure.Duration) (*Star, error)

NewStar is a star of a mass at birth, at an age. It refuses a mass the published main sequence does not reach, either way, and an age below nought or older than the universe, and then gives no star.

Each check says what must hold, so a NaN, which fails every comparison, is refused too.

func (Star) Luminosity

func (star Star) Luminosity() measure.Power

Luminosity is how bright the star is, at every wavelength, not only those an eye sees.

func (Star) Radius

func (star Star) Radius() measure.Length

Radius is the star's radius; an ended star's is nought here.

func (Star) Stage

func (star Star) Stage() Stage

Stage is what the star is at its age.

func (Star) Temperature

func (star Star) Temperature() measure.Temperature

Temperature is the star's surface temperature; an ended star's is nought here.

Jump to

Keyboard shortcuts

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