Skip to content

Documentation / @interstellar-tools/types

@interstellar-tools/types ​

Shared TypeScript types (3D tuples, branded radians, unit-carrying values, celestial body interfaces) used across the monorepo to keep APIs predictable and safe.

Documentation ​

The full documentation lives at phun-ky.net/interstellar-tools:

Installation ​

  • Node.js version 22.12.0 or higher
  • ES modules; require() needs Node 22.12 or later
npm
shell
npm i --save @interstellar-tools/types

Interfaces ​

InterfaceDescription
ForceResultInterfaceResult of a Newtonian gravitational force computation between two point masses.
OdeSolutionInterfaceThe output of a numerical integration: the times, and the state at each.

Type Aliases ​

Type AliasDescription
Matrix3x3TypeImmutable 3×3 matrix of numbers.
OdeRightHandSideTypeThe right-hand side of a system of first-order ODEs, y˙=f(t,y).
Vector3DTupleTypeA read-only 3D vector tuple [x, y, z].

Atmosphere ​

InterfaceDescription
AtmosphereInterfaceThe state of the atmosphere at a place and a moment: its density, temperature and make-up.
SpaceWeatherInterfaceThe space weather an atmosphere model needs: how strongly the Sun heats the upper atmosphere, and how stirred up Earth's magnetic field is. Above about 200 km they change the air density tenfold.

Cartography ​

InterfaceDescription
EllipsoidInterfaceA body's reference ellipsoid: the smooth surface that latitudes, longitudes and heights are measured on.
GeodeticCoordinatesInterfaceA point's geodetic coordinates on an oblate body: latitude, longitude and height above the reference ellipsoid, in SI units and radians.
IlluminationAnglesInterfaceThe illumination angles at a point on a surface: where the light comes from and where it's seen from, relative to the surface and each other.
MoonPositionInterfaceThe Moon's position seen from Earth's centre at a moment: its direction on the sky and its distance.
SunPositionInterfaceThe Sun's position seen from Earth's centre at a moment: its direction on the sky and its distance.

Celestial Bodies ​

NameDescription
AsteroidBeltInterfaceRepresents an asteroid belt within the solar system simulation.
AsteroidInterfaceCanonical shape for an asteroid record: identity, dynamics, and optional visualization aides.
BlackHoleInterfaceRepresents a black hole at the center of a galaxy.
CartesianCoordinatesInterfaceRepresents 2D coordinates, for example a point on a drawn orbit.
CometInterfaceRepresents a comet in the solar system simulation.
DisplayAstrosphereInterfaceHow to draw a star's astrosphere, its boundaries from the star's observations.astrosphere.
DisplayAtmosphereInterfaceHow to draw the glow of an atmosphere at the limb.
DisplayBandsInterfaceHow to draw a giant planet's belts and zones.
DisplayBlackHoleInterfaceHow to draw a black hole.
DisplayCloudsInterfaceHow to draw a cloud layer over a solid surface.
DisplayComaInterfaceHow to draw a comet's coma and tails.
DisplayCoronaInterfaceHow to draw a star's corona.
DisplayDerivationInterfaceWhy a drawing value is what it is: taken from images, worked out from an observation, or assumed.
DisplayEmissionInterfaceLight the body gives off itself, such as a hot Jupiter's thermal glow.
DisplayGalaxyInterfaceHow to draw a galaxy.
DisplayIceCapsInterfacePolar ice caps on a solid surface.
DisplayInterfaceHow a body is drawn: everything about rendering, kept apart from its physical data, its orbit and its observations.
DisplayLavaInterfaceGlowing lava cracks on a molten surface.
DisplayOceanInterfaceOceans on a solid surface.
DisplayPhotosphereInterfaceHow to draw a star's disc.
DisplayRingsInterfaceHow to draw a ring system. Its radii, rings and gaps are the measured ones, in the body's observations.rings.
DisplayStormInterfaceAn oval storm on a giant planet.
DisplaySurfaceInterfaceHow to draw a solid surface.
DisplayTailInterfaceOne comet tail to draw.
GalaxyDiskInterfaceHow a galaxy's disk is turned, as seen from the Sun.
GalaxyInterfaceRepresents a galaxy in the universe simulation.
IauPeriodicTermInterfaceA periodic term in an IAU rotation model: an amplitude times the sine or cosine of an angle that grows with time.
IauRotationModelInterfaceA body's IAU rotation model: which way its spin axis points, and how far it has turned, at any moment (Archinal et al. 2018).
InterstellarObjectInterfaceAn interstellar object: a body from another star's system, passing through the Solar System once, on an open orbit around the Sun. The IAU's Minor Planet Center designates them with an I: 1I/ʻOumuamua, 2I/Borisov, 3I/ATLAS.
MoonInterfaceRepresents a moon (natural satellite) orbiting a planet, a dwarf planet or an asteroid.
PlanetInterfaceRepresents a planet or planetoid.
RotationInterfaceHow a star, planet, moon, asteroid or comet spins: its sidereal rotation period, one turn against the stars.
StarInterfaceRepresents a star.
SystemInterfaceRepresents a system: the barycenter (centre of mass) that its members orbit.
AsteroidBeltsTypeType alias for a collection of asteroid belts.
AsteroidCategoryMore specific group/category for dynamical families or special bodies.
AsteroidSpectralTypeSpectral (taxonomic) class based on reflectance spectra & albedo.
AsteroidsTypeConvenience alias for a list of asteroids.
AsteroidTypeHigh-level orbital class of an asteroid (by dynamical region).
BlackHolesTypeType alias for a collection of black holes.
CelestialBodiesTypeA list of celestial bodies of any kind: stars, planets, moons, comets and asteroids, mixed. Interstellar objects aren't included: their open orbits have their own type, InterstellarObjectInterface.
CelestialBodyTypeType alias representing a single celestial body.
CometsTypeType alias for an array of comets.
DisplayModelTypeWhich procedural model draws a body.
DisplayPaletteTypeThree colours a procedural model blends between: lowland, midland and highland on a solid surface; belt, zone and accent on a giant planet.
GalaxiesTypeType alias for a collection of galaxies.
InterstellarObjectsTypeType alias for an array of interstellar objects.
MoonsTypeType alias for a collection of moons.
PlanetsTypeType alias for a collection of planets.
RingDisplayTypeHow to draw a planet's rings, and why the values are what they are. A part of DisplayInterface.
StarsTypeType alias for a collection of stars.
SystemKindTypeKind of system a barycenter holds together.
SystemsTypeType alias for a collection of systems.

Distance ​

NameDescription
DistanceInterfaceRepresents a distance measurement with an associated unit.
DistanceUnitAliasTypeHuman-friendly distance unit aliases accepted at input time.
DistanceUnitTypeCanonical distance unit symbols for astronomy/space visualization.

Numeric ​

NameDescription
ValueInterfaceRepresents a numerical value.
DegreesTypeAngle in degrees (branded nominal type).
RadiansAngle in radians (branded nominal type).

Observations ​

NameDescription
AsteroidObservationsInterfaceWhat is measured about an asteroid.
AsteroidTaxonomyInterfaceSpectral taxonomy finer than AsteroidSpectralType.
AstrometryInterfaceWhere a body outside the Solar System is on the sky, and how it moves.
AstrosphereBoundaryInterfaceA boundary of an astrosphere, by how far it lies from the star in three directions. The bubble is blunt on the side the interstellar wind blows from and drawn out behind, so one radius doesn't describe it.
AstrosphereCrossingInterfaceA probe crossing an astrosphere's boundary, as the Voyagers crossed the Sun's.
AstrosphereInterfaceA star's astrosphere, the bubble its wind blows into the interstellar medium: the Sun's is the heliosphere.
AtmosphericFeatureInterfaceA lasting feature of an atmosphere, such as a storm.
BlackHoleObservationsInterfaceWhat is measured about a black hole. Its own mass (M☉) and ringDiameter stay the values the equations use.
CloudLayerInterfaceAn observed cloud or haze layer.
CometActivityInterfaceA comet's activity: its coma, tails and outgassing.
CometNucleusInterfaceA comet's nucleus.
CometObservationsInterfaceWhat is measured about a comet.
CometProductionRateInterfaceHow fast a comet gives off one species.
CometTailInterfaceOne observed comet tail.
DiscoveryInterfaceHow and when a body was discovered.
EpochInterfaceA moment as a Julian date on a named time scale, as catalogues give osculating epochs and transit times.
ExoplanetObservationsInterfaceWhat is measured about a planet outside the Solar System.
GalaxyMorphologyInterfaceGalaxyInterface.type split into its parts.
GalaxyObservationsInterfaceWhat is measured about a galaxy.
IdentifiersInterfaceCatalogue identifiers, besides the body's own id and name.
ImpactExperimentInterfaceWhat a kinetic impact did to a moon, as DART's did to Dimorphos.
ImpactRiskInterfaceAn impact risk assessment of a near-Earth object.
InterstellarObjectObservationsInterfaceWhat is measured about an interstellar object.
LimbDarkeningInterfaceA fitted limb-darkening law, in one band.
MagnetosphereInterfaceA body's magnetic field.
MagnitudeLawInterfaceA comet's magnitude law: m=M+5log10⁡Δ+Klog10⁡r.
MassPropertiesInterfaceMeasured mass and gravity. The body's own mu stays the value the equations use.
MissionVisitInterfaceA spacecraft's visit to a small body.
MoonObservationsInterfaceWhat is measured about a moon.
NonGravitationalInterfaceThe non-gravitational parameters of Marsden's model.
ObservationMetaInterfaceWhat can travel with any measured value.
ObservationSourceInterfaceWhere a value came from.
ObservedProperMotionInterfaceA proper motion with an uncertainty for each component, in mas/yr.
ObservedRangeInterfaceA quantity given as a range, such as a surface's day and night temperatures.
OrbitSolutionInterfaceThe orbit determination behind orbit: how well its elements are known.
PlanetaryAtmosphereInterfaceA body's atmosphere, as observed. Not AtmosphereInterface, which is Earth's upper atmosphere from a model.
PlanetObservationsInterfaceWhat is measured about a planet or planetoid.
ReflectanceInterfaceHow bright a body is, and how it reflects light.
RingGapInterfaceA named gap in a ring system, such as the Cassini Division.
RingInterfaceOne ring of a planet.
RingSystemInterfaceA planet's ring system, in its equator's plane.
RotationObservationsInterfaceLight-curve results that RotationInterface has no room for.
SizeObservationsInterfaceMeasured size and shape, with uncertainties. The body's radius and ellipsoid stay the values the equations use.
SolidBodyObservationsInterfaceWhat every solid or planetary body can have measured: planets, moons and small bodies.
SpeciesAbundanceInterfaceA chemical species, and how much of it there is.
SpectralClassificationInterfaceStarInterface.type split into its parts. A class given as a range, such as Spica's 'B1III-IV' or Betelgeuse's 'M1-M2Ia-Iab', takes both ends.
StarObservationsInterfaceWhat is measured about a star. Its own mass (M☉) and radius stay the values the equations use; these carry uncertainties and methods.
StellarActivityInterfaceA star's magnetic activity.
SurfaceObservationsInterfaceWhat a solid surface is made of, and looks like.
ThermalObservationsInterfaceMeasured temperatures and heat.
TransitObservationsInterfaceTransit measurements of an exoplanet.
UncertaintyInterfaceAn uncertainty, in the value's own unit. Equal plus and minus is a symmetric ±σ.
VariabilityInterfaceHow a star's brightness varies.
ActiveNucleusTypeThe class of an active galactic nucleus.
AstrosphereBoundaryTypeThe boundaries of an astrosphere:
BlackHoleMassMethodTypeHow a black hole's mass was measured.
ByBodyIdTypeObservations and drawing groups apart from the bodies, keyed by body id, as @interstellar-tools/constants exports them: STAR_PARAMETERS, PLANET_RINGS and the like.
DistanceMethodTypeHow a galaxy's distance was measured.
ExoplanetDetectionMethodTypeHow an exoplanet was found.
LuminosityClassTypeThe MK luminosity classes.
MagnitudesByBandTypeMagnitudes by photometric band.
ObservationCatalogTypeThe catalogues the datasets in @interstellar-tools/constants draw on. Any other name is accepted too.
ObservedTypeAny unit-carrying value with measurement metadata. A plain value of the same kind fits too.
PhotometricBandTypePhotometric bands: Johnson–Cousins, 2MASS, Gaia, SDSS, WISE and GALEX. Any other band is accepted too.
ProvenanceTypeHow a value was obtained.
StarAstrometryTypeWhere a star is on the sky and which catalogues list it: its identifiers, position, motion and apparent magnitudes, and its letter within its system. A part of StarObservationsInterface.
StarParametersTypeWhat a star's light tells about it: its spectral class, temperature, luminosity, surface gravity and metallicity. A part of StarObservationsInterface.
StellarEvolutionaryStageTypeWhere a star is in its life.

Orbits ​

NameDescription
CelestialDirectionInterfaceA direction on the sky, in the ICRF (the J2000 equator and equinox), in degrees as catalogues give it: the pole of a reference plane, for example.
ClassicalElementsInterfaceThe six classical orbital elements of a two-body orbit, in SI units and radians.
EclipticDirectionInterfaceA direction in ecliptic coordinates, against the J2000 ecliptic and equinox, in degrees: how a small body's spin pole or the interstellar wind's direction is often given.
FullOrbitInterfaceAn OrbitInterface with every orientation element given: i, w, om and q. Comets and asteroids carry these.
OpenOrbitInterfaceAn open orbit: a hyperbola, e>1, that passes its parent once and never comes back, as an interstellar object's does around the Sun.
OrbitFrameInterfaceThe frame of an orbit's orientation elements: the plane i, om and w are measured from, and that plane's pole where it isn't a standard one.
OrbitInterfaceKepler orbital elements of one body around its parent.
StateVectorInterfaceA body's state vector: its position and velocity in an inertial frame centred on the body it orbits.
CwStateClohessy–Wiltshire / Hill relative-motion state vector in the LVLH frame.
CwStateDerivativeTime derivative of CwState for CW/Hill dynamics.
OrbitReferencePlaneTypeThe reference plane an orbit's i, om and w are measured from.
PeriApoRadiiTypePeri/apoapsis radii pair.

Positions ​

NameDescription
GalacticDirectionInterfaceA direction in galactic coordinates, from the Sun, in degrees as catalogues give it.
ObservedMotionInterfaceThe motion of something as seen from the Sun, as it's measured: its velocity along the line of sight, and where measured, its proper motion across the sky.
PositionInterfaceA position in 3D, in a named frame: what a conversion such as galactocentricPosition in @interstellar-tools/equations returns, from a direction and distance measured from the Sun.
ProperMotionInterfaceA proper motion: how fast something moves across the sky, in milliarcseconds per year, as catalogues give it.
SupergalacticDirectionInterfaceA direction in supergalactic coordinates, from the Sun, in degrees.
VelocityInterfaceA velocity in 3D, in a named frame, in km/s: the Sun's motion around the Milky Way's centre, for example, or a galaxy's, from its ObservedMotionInterface.
PositionFrameTypeThe frame of a PositionInterface.

Quantities ​

NameDescription
AccelerationInterfaceAn acceleration with its unit.
AngleInterfaceA measured angle with its unit.
DensityInterfaceA mass density with its unit.
DexInterfaceA logarithmic quantity, in dex: a metallicity [Fe/H], log g, log R′HK, 12 + log(O/H).
DimensionlessInterfaceA pure number: an albedo, an axis ratio, a Sérsic index, a redshift. It has no unit.
EnergyInterfaceAn energy with its unit.
EventRateInterfaceHow often something happens, with its unit.
FluxDensityInterfaceA spectral flux density with its unit.
FractionInterfaceA share of a whole with its unit.
GravitationalParameterInterfaceA standard gravitational parameter μ=GM with its unit.
InverseDistanceInterfaceAn inverse distance, such as a long-period comet's original 1/a.
IrradianceInterfaceAn energy flux through a surface: insolation, or heat flowing out of a body.
LuminosityInterfaceA luminosity with its unit.
MagneticFieldInterfaceA magnetic flux density with its unit.
MagneticMomentInterfaceA magnetic dipole moment, in A m².
MagnitudeInterfaceAn astronomical magnitude: apparent, absolute, or a colour index.
MassInterfaceA mass with its unit.
MassRateInterfaceA mass flow rate with its unit.
PeriodChangeInterfaceA change in a period, dP/dt, with its unit: positive when the period lengthens. Turning it into a SpinAccelerationInterface needs the period itself, dω/dt=−2πP˙/P2.
PressureInterfaceA pressure with its unit.
ProductionRateInterfaceA comet's molecular production rate, in molecules a second.
SpeedInterfaceA scalar speed with its unit: an escape speed, a radial-velocity semi-amplitude, a galaxy's rotation speed. For a velocity in 3D, see VelocityInterface.
SpinAccelerationInterfaceA spin acceleration, dω/dt, with its unit: positive when the body spins up.
TemperatureInterfaceA temperature, in kelvin.
ThermalInertiaInterfaceThermal inertia, in thermal inertia units: 1 TIU = 1 J m⁻² K⁻¹ s⁻½.
AccelerationUnitTypeCanonical acceleration unit symbols: SI m/s2, cgs cm/s2, and au/d2, the unit JPL gives comets' and asteroids' non-gravitational parameters in.
AngleUnitTypeCanonical angle unit symbols for measured angles, including the small ones on the sky: parallaxes, angular diameters, the sizes of galaxies.
DensityUnitTypeCanonical density unit symbols: SI kg/m3, or g/cm3, as planetary fact sheets give bulk density. 1 g/cm³ = 1000 kg/m³.
EnergyUnitTypeCanonical energy unit symbols, for example for flare energies.
EventRateUnitTypeCanonical event rate unit symbols, for example for flare rates.
FluxDensityUnitTypeCanonical flux density unit symbols, for radio astronomy.
FractionUnitTypeCanonical fraction unit symbols, for abundances, coverages and transit depths.
GravitationalParameterUnitTypeCanonical gravitational parameter unit symbols. The bodies' own mu is in m3/s2; JPL gives GM in km3/s2.
IrradianceUnitTypeCanonical irradiance unit symbols: SI W/m2, or S_earth, the light Earth gets from the Sun, as exoplanet insolation is given: the IAU's 2015 nominal total solar irradiance, 1361 W/m².
LuminosityUnitTypeCanonical luminosity unit symbols: W, erg/s, and L_sun, the IAU's 2015 nominal solar luminosity, 3.828 × 10²⁶ W.
MagneticFieldUnitTypeCanonical magnetic field unit symbols: T, nT, and gauss, G, 10⁻⁴ T.
MassRateUnitTypeCanonical mass rate unit symbols: dust from comets, mass lost by stars, stars formed in galaxies.
MassUnitTypeCanonical mass unit symbols.
PeriodChangeUnitTypeCanonical period change unit symbols: how fast a period lengthens.
PressureUnitTypeCanonical pressure unit symbols, from Venus's 92 bar down to Pluto's 10 μbar. 1 bar = 10⁵ Pa.
SpeedUnitTypeCanonical speed unit symbols.
SpinAccelerationUnitTypeCanonical spin acceleration unit symbols: how fast a spin speeds up, as the YORP effect is given.

Temporal ​

NameDescription
LeapSecondInterfaceOne step in the leap second table: the offset TAI − UTC from a given UTC day on.
TemporalInterfaceTyped container for a scalar duration, combining a numeric value (from ValueInterface) with a canonical TemporalUnitType unit.
TimeStepInterfaceRepresents a time step measurement in simulation, restricted to days.
TemporalUnitAliasTypeHuman-friendly temporal unit aliases accepted at input time.
TemporalUnitTypeCanonical temporal unit symbols for spacetime/physics durations.
TimeScaleTypeA time scale: the clock a moment is read on.

Three-body ​

NameDescription
Cr3bpUnitsInterfaceThe units of the normalised CR3BP frame for a pair of bodies, in SI.
LagrangePointsInterfaceThe five Lagrange points of two bodies circling each other: where a third, small body can stay put relative to them.
Cr3bpStateA state in the circular restricted three-body problem (CR3BP), in the rotating, normalised frame.
Cr3bpStateDerivativeThe time derivative of a Cr3bpState: velocities, then accelerations.

Tracking ​

NameDescription
EphemerisInterfaceAn ephemeris: a table of a spacecraft's position and velocity over time, as JPL Horizons and the CCSDS Orbit Ephemeris Message (OEM) publish them. It's how deep-space probes, which have no TLEs, are tracked.
EphemerisSampleInterfaceOne sample of an ephemeris: a spacecraft's position and velocity at a moment.
GlobePointInterfaceA point on an orthographic globe view: where it falls on the disc, and whether it's on the side facing the viewer.
LookAnglesInterfaceWhere a satellite is in an observer's sky: the direction to point an antenna or a camera, how far away it is and how fast that distance changes.
MeanElementsInterfaceA satellite's mean elements, as published in a two-line element set (TLE) or an Orbit Mean-elements Message (OMM): the orbit SGP4 was fitted to at an epoch, with the drag terms it needs.
OmmRecordInterfaceOne Orbit Mean-elements Message (OMM) record in JSON, as CelesTrak publishes it: a satellite's mean elements, with the keywords of the CCSDS standard.
ProbeRecordInterfaceA probe in the PROBES dataset of @interstellar-tools/tracking: a deep-space spacecraft, with what it is, where it's headed and a dated ephemeris.
SatellitePassInterfaceOne pass of a satellite over an observer: when it rises above the horizon, when it's highest, and when it sets.
SatelliteRecordInterfaceA satellite in the SATELLITES dataset of @interstellar-tools/tracking: a stable id, a common name, its orbit regime and a dated OMM record.
OrbitRegimeTypeThe orbit regime a satellite flies in.
ProbeStatusTypeWhether a space probe is still at work: 'active' while its mission operates it, 'ended' once contact is lost or the mission is over. An ended probe keeps flying: Pioneer 10 still coasts out of the Solar System.
ShadowTypeWhere a satellite is relative to Earth's shadow.