npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@skyscout/core

v1.1.0

Published

Shared astronomical utilities, time conversions, coordinates, and photometry math for SkyScout

Readme

@skyscout/core

npm version License CI

Telescope-agnostic astronomical mathematics, celestial coordinate conversions, time transformations, and photometry calculations for SkyScout.

Features

  • ⏱ Astronomical Time Conversions:
    • Modified Julian Date (MJD) $\leftrightarrow$ JavaScript Date $\leftrightarrow$ Julian Date (JD).
    • High-precision handling of astronomical epochs including J2000.0 and Unix epoch.
  • 📐 Coordinates & Spherical Geometry:
    • Right Ascension (RA) and Declination (Dec) formatting.
    • Decimal degrees $\leftrightarrow$ Sexagesimal conversions (HMS for RA, DMS for Dec).
    • Great-circle angular separation via the numerically stable spherical Vincenty formula in degrees and arcseconds.
    • Robust handling of edge cases (negative zero declination $-0^\circ$, degree rollover, clamping).
  • 💡 Photometry, Distance & Stellar Math:
    • Point Spread Function (PSF) flux in nanoJanskys (nJy) $\leftrightarrow$ standard AB magnitude.
    • First-order error propagation between linear flux uncertainty ($\sigma_f$) and magnitude uncertainty ($\sigma_m$).
    • Signal-to-noise ratio (SNR) calculation.
    • Stellar parallax ($\varpi$ in mas) $\leftrightarrow$ distance in parsecs and light-years, plus distance modulus ($\mu = m - M$).
    • Absolute magnitude calculation ($M_G = G + 5 + 5 \log_{10}(\varpi / 1000) - A_G$) with optional extinction.
    • Stellar luminosity ($\log_{10} L/L_\odot$ and $L/L_\odot$), Gaia $(G_{\text{BP}} - G_{\text{RP}})$ color index, effective temperature ($T_{\text{eff}}$), and MK spectral class (O–M).
  • 📦 Modern Multi-Format Distribution: Dual ESM and CommonJS bundle with TypeScript type definitions generated via tsup.
  • ⚡ Hermetic & Fast: Pure mathematical algorithms and celestial transforms.

Installation

npm install @skyscout/core

Quick Start

Astronomical Time

import { mjdToDate, dateToMjd, julianDateToMjd, mjdToJulianDate } from '@skyscout/core';

// Convert MJD to Date
const date = mjdToDate(60456.28);
console.log(date.toISOString());

// Convert Date to MJD
const mjd = dateToMjd(new Date());

// JD <-> MJD
const jd = mjdToJulianDate(60000); // 2460000.5

Coordinates and Angular Separation

import {
  degreesToHms,
  degreesToDms,
  formatCoordinates,
  angularSeparationArcsec,
} from '@skyscout/core';

// Format RA / Dec
const coords = formatCoordinates(52.82384, -29.69162, 4);
console.log(`${coords.raStr}, ${coords.decStr}`); // "52.8238, -29.6916"

// Great-circle separation in arcseconds (e.g. for cross-matching)
const sepArcsec = angularSeparationArcsec(52.8238, -29.6916, 52.8241, -29.6914);
console.log(`Separation: ${sepArcsec.toFixed(2)} arcsec`);

// Sexagesimal conversions
const hms = degreesToHms(180); // { hours: 12, minutes: 0, seconds: 0 }
const dms = degreesToDms(-0.5); // { sign: '-', degrees: 0, minutes: 30, seconds: 0 }

Photometry & Error Propagation

import { fluxToAbMag, abMagToFlux, fluxErrorToMagError } from '@skyscout/core';

// Convert Rubin PSF flux (nanoJanskys) to AB magnitude
const mag = fluxToAbMag(10_000); // ~21.40 mag

// Propagate 10% flux error to magnitude error
const magErr = fluxErrorToMagError(10_000, 1_000); // ~0.1086 mag

License

BSD-3-Clause