radiation

package
v0.0.3 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: 8 Imported by: 3 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 radiation speaks of radiation by its wavelength in nanometres, from gamma rays to radio. It moves between wavelength, energy, frequency and length in metres.

It names the ranges of radiation under iso 21348's names, and the fermi mission's. The iso ranges were never read against the standard, which is not open; they are as libtheme-css typed them, and some overlap, as each range's doc says.

A Profile maps one range of wavelengths onto another, which is what a false color profile is made of.

What the radiation looks like is not here. That is a colour, and colour is libtheme's.

Index

Constants

View Source
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
)

the units radiation is spoken in. each has one name, and its multiples come from the si's prefixes: a keV is si.Kilo(Electronvolt), the hydrogen line is 1420.405751 * si.Mega(Hertz).

an eV is an energy, not a wavelength, but most papers on gamma radiation speak in eV, so FromEnergy and Energy move between the two. wavelengths are in nanometres, and lengths in metres go through MetresToNm.

Variables

This section is empty.

Functions

func Energy

func Energy(nm float64) float64

Energy is the energy, in electronvolts, of a photon of a wavelength in nanometres: FromEnergy, undone.

func ErrRange

func ErrRange() error

ErrRange is two wavelengths that make no range: a short end not above nothing, a long end not above the short, or either not a number.

func ErrWavelength added in v0.0.3

func ErrWavelength() error

ErrWavelength returns the error for a value that gives no wavelength: one whose wavelength is not finite and above zero. zero, negative, NaN and infinite values all give it.

func FromEnergy

func FromEnergy(ev float64) float64

FromEnergy is the wavelength, in nanometres, of a photon carrying an energy in electronvolts.

func GHzToNm added in v0.0.3

func GHzToNm(ghz float64) (*float64, error)

GHzToNm returns the wavelength of light of the given frequency in GHz. returns nil and error for a frequency that gives no wavelength.

func GeVToNm added in v0.0.3

func GeVToNm(gev float64) (*float64, error)

GeVToNm returns the wavelength of a photon of the given energy in GeV. returns nil and error for an energy that gives no wavelength.

func HertzToNm

func HertzToNm(hz float64) float64

HertzToNm is the wavelength, in nanometres, of light of a frequency in hertz.

func JanskyToSI

func JanskyToSI(jy float64) float64

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

func KeVToNm(kev float64) (*float64, error)

KeVToNm returns the wavelength of a photon of the given energy in keV. returns nil and error for an energy that gives no wavelength.

func MHzToNm added in v0.0.3

func MHzToNm(mhz float64) (*float64, error)

MHzToNm returns the wavelength of light of the given frequency in MHz. returns nil and error for a frequency that gives no wavelength.

func MeVToNm added in v0.0.3

func MeVToNm(mev float64) (*float64, error)

MeVToNm returns the wavelength of a photon of the given energy in MeV. returns nil and error for an energy that gives no wavelength.

func MetresToNm

func MetresToNm(metres float64) float64

MetresToNm is a length in metres as nanometres, the unit every range here is in: MetresToNm(3.4 * si.Micro(length.Metre)) is WISE's first band, 3400 nm.

func MicronsToNm added in v0.0.3

func MicronsToNm(um float64) (*float64, error)

MicronsToNm returns a wavelength in microns in nanometres. returns nil and error for a length that is no wavelength.

func NmToHertz

func NmToHertz(nm float64) float64

NmToHertz is the frequency, in hertz, of light of a wavelength in nanometres: HertzToNm, undone.

func NmToMetres

func NmToMetres(nm float64) float64

NmToMetres is nanometres as metres: MetresToNm, undone.

func Planck added in v0.0.2

func Planck(nm, kelvin float64) float64

Planck returns the spectral radiance of a black body at a wavelength in nanometres and a temperature in kelvin, by planck's law, in W m^-2 sr^-1 nm^-1: 2hc^2 / lambda^5 / (exp(hc / lambda k T) - 1).

returns zero at or below zero kelvin: a body that cold gives no light. like the other conversions here, it trusts nm to be a wavelength.

func TeVToNm added in v0.0.3

func TeVToNm(tev float64) (*float64, error)

TeVToNm returns the wavelength of a photon of the given energy in TeV. returns nil and error for an energy that gives no wavelength.

Types

type Profile

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

Profile maps one range of wavelengths onto another, evenly in the logarithm of wavelength. A false colour profile is made of one: it takes radiation the eye cannot see onto light it can.

What colour that is belongs to libtheme; here the profile only says where a wavelength lands.

func NewProfile

func NewProfile(name string, source, render Range) (*Profile, error)

NewProfile is the profile of a name that maps a source range onto a render range. It refuses either range when it is no range, and then gives no profile.

func (Profile) Back

func (profile Profile) Back(nm float64) (source float64, ok bool)

Back is the reciprocal of Onto: where a wavelength in the render came from in the source. ok is false, and the wavelength is not mapped, when it is outside the render (its long end is outside, as the source's is) or the profile's ranges are none.

func (Profile) Holds

func (profile Profile) Holds(nm float64) bool

Holds is whether a wavelength is inside the profile's source, from its short end up to but not including its long end. The zero Profile, whose ranges are none, holds nothing.

func (Profile) Onto

func (profile Profile) Onto(nm float64) (mapped float64, ok bool)

Onto is where a wavelength in the source lands in the render, evenly in the logarithm of wavelength. ok is false, and the wavelength is not mapped, when the profile does not hold it: the answer would be a number, but not one the profile means.

Onto's answer is always inside the render, short end in and long end out, so Back takes back whatever Onto gives. A wavelength a rounding below the source's long end can work out to the render's long end exactly; Onto gives the float just below it instead.

func (Profile) String

func (profile Profile) String() string

String is the profile, for humans with eyeballs.

type Range

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

Range is a band of radiation, by wavelength in nanometres: from its short end up to but not including its long end.

func ExtremeUltraviolet

func ExtremeUltraviolet() Range

ExtremeUltraviolet is the extreme ultraviolet, under iso 21348's name, as its draft gives it: see iso. It overlaps Ultraviolet.

func Fermi

func Fermi() Range

Fermi is the fermi mission's range, a little different from iso's: work on gamma ray emitting objects sometimes needs it, depending on where an observation was collected.

nasa's heasarc gives it in energies, 10 keV to 300 GeV (read on 2026-10-31); as a range of wavelengths the higher energy is the short end.

func Gamma

func Gamma() Range

Gamma is gamma rays, under iso 21348's name: see iso.

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

func NewRange(short, long float64) (*Range, error)

NewRange is the range from a short wavelength to a long one, in nanometres. It refuses a short end not above nothing and a long end not above the short or endless, and then gives no range.

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.

func (Range) Edges

func (span Range) Edges() (short, long float64)

Edges is the range's short and long ends, in nanometres, for a caller that draws the band or lays one range beside another.

func (Range) Holds

func (span Range) Holds(nm float64) bool

Holds is whether a wavelength in nanometres is inside the range, from its short end up to but not including its long end. What is no range, the zero Range among them, holds nothing.

func (Range) String

func (span Range) String() string

String is the range in nanometres, for a person reading it.

Jump to

Keyboard shortcuts

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