Documentation
¶
Overview ¶
Package radiation describes light by wavelength, from gamma rays to radio, and converts between nanometres, metres, frequency, and photon energy.
Named ranges follow ISO 21348:2007 and the Fermi mission’s coverage, as celestial’s research ledger holds them. The standard is sold, so its ends are read in its published first pages to clause 6.5 and in its proof past that; the ledger says where each was read, and range comments, overlaps.
Profile maps wavelength intervals for false-colour use. The resulting colour still belongs to libtheme; this package determines where each wavelength goes, not how it looks on a screen.
Index ¶
- Constants
- func Energy(nm float64) float64
- func FromEnergy(ev float64) float64
- func GHzToNm(ghz float64) (*float64, error)
- func GeVToNm(gev float64) (*float64, error)
- func HertzToNm(hz float64) float64
- func JanskyToSI(jy float64) float64
- func KeVToNm(kev float64) (*float64, error)
- func MHzToNm(mhz float64) (*float64, error)
- func MeVToNm(mev float64) (*float64, error)
- func MetresToNm(metres float64) float64
- func MicronsToNm(um float64) (*float64, error)
- func NmToHertz(nm float64) float64
- func NmToMetres(nm float64) float64
- func Planck(nm, kelvin float64) float64
- func TeVToNm(tev float64) (*float64, error)
- type Profile
- type Range
Constants ¶
const ( // Electronvolt is one electronvolt, the unit energies here are in. // Defined: the unit itself. Electronvolt = 1.0 // Hertz is one hertz, the unit frequencies here are in. Defined: the // unit itself. Hertz = 1.0 )
Base units have one name; multiples use SI prefixes. A keV is si.Kilo(Electronvolt), and the hydrogen line is 1420.405751 * si.Mega(Hertz). Energy and frequency convert through photon relations; metres use MetresToNm.
Variables ¶
This section is empty.
Functions ¶
func Energy ¶
Energy returns photon energy in electronvolts from wavelength in nanometres, reversing FromEnergy.
func FromEnergy ¶
FromEnergy returns photon wavelength in nanometres from energy in electronvolts.
func GHzToNm ¶ added in v0.0.3
GHzToNm converts frequency in GHz to wavelength in nanometres. It returns an error if the resulting wavelength is not positive and finite.
func GeVToNm ¶ added in v0.0.3
GeVToNm converts photon energy in GeV to wavelength in nanometres. It returns an error if the resulting wavelength is not positive and finite.
func JanskyToSI ¶
JanskyToSI is a spectral flux density in janskys as watts a square metre a hertz, the unit every exported flux density here is in. The jansky is outside the SI: radio and infrared catalogues, WISE's among them, still state flux densities in it.
It lives in radiation, not SI, because SI holds the defining constants and the prefixes, and a jansky is a unit of radiation: a power per area per frequency.
func KeVToNm ¶ added in v0.0.3
KeVToNm converts photon energy in keV to wavelength in nanometres. It returns an error if the resulting wavelength is not positive and finite.
func MHzToNm ¶ added in v0.0.3
MHzToNm converts frequency in MHz to wavelength in nanometres. It returns an error if the resulting wavelength is not positive and finite.
func MeVToNm ¶ added in v0.0.3
MeVToNm converts photon energy in MeV to wavelength in nanometres. It returns an error if the resulting wavelength is not positive and finite.
func MetresToNm ¶
MetresToNm converts metres to nanometres. For example, MetresToNm(3.4 * si.Micro(length.Metre)) gives WISE W1’s 3400 nm.
func MicronsToNm ¶ added in v0.0.3
MicronsToNm converts micrometres to nanometres, rejecting a result that is not positive and finite.
func NmToMetres ¶
NmToMetres converts nanometres to metres, reversing MetresToNm.
Types ¶
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile maps one wavelength interval to another linearly in log wavelength. A false-colour profile can use it to place invisible radiation in the visible range; libtheme determines the displayed colour.
func NewProfile ¶
NewProfile constructs a named mapping from source to render range. An invalid range returns an error and no profile.
func (Profile) Back ¶
Back reverses Onto, returning ok=false outside the half-open render range or when either profile range is invalid.
func (Profile) Holds ¶
Holds checks the half-open source range. The zero Profile contains no wavelengths.
func (Profile) Onto ¶
Onto maps a source wavelength into the render interval in log space. Wavelengths outside the source return ok=false rather than an extrapolated answer.
Results remain inside the half-open render range so Back can reverse them. If rounding reaches the exclusive long endpoint, Onto uses the preceding float instead.
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
Range is a half-open interval of wavelengths in nanometres: the short endpoint is included and the long endpoint excluded.
func ExtremeUltraviolet ¶
func ExtremeUltraviolet() Range
ExtremeUltraviolet is the extreme ultraviolet, under ISO 21348's name, as published: see iso. It overlaps Ultraviolet.
func Fermi ¶
func Fermi() Range
Fermi returns the mission’s energy coverage as wavelengths. The higher energy becomes the shorter wavelength; this differs from the ISO range.
NASA’s High Energy Astrophysics Science Archive Research Center gives 10 keV to 300 GeV, read on 2026-10-31. Use this interval when matching observations collected by the mission.
func Infrared ¶
func Infrared() Range
Infrared is the infrared, under ISO 21348's name: see iso. Radio begins inside it.
func Microwave ¶
func Microwave() Range
Microwave is microwaves, under ISO 21348's name: see iso. Radio begins inside it.
func NewRange ¶
NewRange constructs a wavelength interval in nanometres. Both ends must be finite, with 0 < short < long; invalid endpoints return an error.
func Radio ¶
func Radio() Range
Radio is radio waves, under ISO 21348's name: see iso. It begins inside Infrared and Microwave.
func Ultraviolet ¶
func Ultraviolet() Range
Ultraviolet is the ultraviolet, under ISO 21348's name: see iso. It overlaps ExtremeUltraviolet.
func XRay ¶
func XRay() Range
XRay is x-rays, hard and soft together, under ISO 21348's name: see iso.