Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: amend spelling mistake in aberration module across @observerly/astrometry #410

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
},
"./abberation": {
"import": "./dist/abberation.js",
"require": "./dist/abberation.cjs",
"types": "./dist/abberation.d.ts"
"./aberration": {
"import": "./dist/aberration.js",
"require": "./dist/aberration.cjs",
"types": "./dist/aberration.d.ts"
},
"./astrometry": {
"import": "./dist/astrometry.js",
Expand Down
24 changes: 12 additions & 12 deletions src/abberation.ts → src/aberration.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************************************************/

// @author Michael Roberts <michael@observerly.com>
// @package @observerly/astrometry/abberation
// @package @observerly/astrometry/aberration
// @license Copyright © 2021-2025 observerly

/*****************************************************************************************************************/
Expand Down Expand Up @@ -29,17 +29,17 @@ import { convertRadiansToDegrees as degrees, convertDegreesToRadians as radians

/**
*
* getCorrectionToEquatorialForAnnualAbberation()
* getCorrectionToEquatorialForAnnualAberration()
*
* Corrects the equatorial coordinate of a target for abberation in
* Corrects the equatorial coordinate of a target for aberration in
* longitude and obliquity due to the apparent motion of the Earth.
*
* @param date - The date to correct the equatorial coordinate for.
* @param target - The equatorial J2000 coordinate of the target.
* @returns The corrected equatorial coordinate of the target.
*
*/
export const getCorrectionToEquatorialForAnnualAbberation = (
export const getCorrectionToEquatorialForAnnualAberration = (
datetime: Date,
target: EquatorialCoordinate
): EquatorialCoordinate => {
Expand Down Expand Up @@ -72,7 +72,7 @@ export const getCorrectionToEquatorialForAnnualAbberation = (
// Get the true obliquity of the ecliptic (in degrees):
const ε = radians(getObliquityOfTheEcliptic(datetime) + Δε / 3600)

// Get the constant of abberation (in degrees):
// Get the constant of aberration (in degrees):
const κ = radians(20.49552 / 3600)

// Get the eccentricity of the Earth's orbit (dimensionless):
Expand All @@ -84,14 +84,14 @@ export const getCorrectionToEquatorialForAnnualAbberation = (
// Get the true geometric longitude of the sun (in degrees):
const S = radians(getSolarTrueGeometricLongitude(datetime))

// Calculate the abberation correction in right ascension (in radians):
// Calculate the aberration correction in right ascension (in radians):
const Δra =
-κ * (Math.cos(ra) * Math.cos(S) * Math.cos(ε) + (Math.sin(ra) * Math.sin(S)) / Math.cos(dec)) +
e *
κ *
(Math.cos(ra) * Math.cos(ϖ) * Math.cos(ε) + (Math.sin(ra) * Math.sin(ϖ)) / Math.cos(dec))

// Calculate the abberation correction in declination (in radians):
// Calculate the aberration correction in declination (in radians):
const Δdec =
-κ *
(Math.cos(S) * Math.cos(ε) * (Math.tan(ε) * Math.cos(dec) - Math.sin(ra) * Math.sin(dec)) +
Expand All @@ -111,17 +111,17 @@ export const getCorrectionToEquatorialForAnnualAbberation = (

/**
*
* getCorrectionToEquatorialForDiurnalAbberation()
* getCorrectionToEquatorialForDiurnalAberration()
*
* Corrects the equatorial coordinate of a target for abberation in
* Corrects the equatorial coordinate of a target for aberration in
* longitude and obliquity due to the apparent motion of the Earth.
*
* @param date - The date to correct the equatorial coordinate for.
* @param target - The equatorial J2000 coordinate of the target.
* @returns The corrected equatorial coordinate of the target.
*
*/
export const getCorrectionToEquatorialForDiurnalAbberation = (
export const getCorrectionToEquatorialForDiurnalAberration = (
datetime: Date,
observer: GeographicCoordinate,
target: EquatorialCoordinate
Expand All @@ -139,10 +139,10 @@ export const getCorrectionToEquatorialForDiurnalAbberation = (
// Calculate the observer's tangential velocity due to Earth's rotation (in m/s):
const v = Ω * EARTH_RADIUS * Math.cos(phi)

// Calculate the abberation correction in right ascension (in radians):
// Calculate the aberration correction in right ascension (in radians):
const Δra = ((v / c) * (Math.cos(phi) * Math.sin(ha))) / Math.cos(dec)

// Calculate the abberation correction in declination (in radians):
// Calculate the aberration correction in declination (in radians):
const Δdec =
(v / c) * (Math.sin(phi) * Math.cos(dec) - Math.cos(phi) * Math.sin(dec) * Math.cos(ha))

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/*****************************************************************************************************************/

export * from './abberation'
export * from './aberration'
export * from './astrometry'
export * from './common'
export * from './conjunction'
Expand Down
8 changes: 4 additions & 4 deletions src/observation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/*****************************************************************************************************************/

import { getCorrectionToEquatorialForAnnualAbberation } from './abberation'
import { getCorrectionToEquatorialForAnnualAberration } from './aberration'

import { getHourAngle } from './astrometry'

Expand Down Expand Up @@ -141,15 +141,15 @@ export class Observation extends Object {
}

private setEquatorialCoordinates(target: EquatorialCoordinate) {
const abberation = getCorrectionToEquatorialForAnnualAbberation(this.datetime, target)
const aberration = getCorrectionToEquatorialForAnnualAberration(this.datetime, target)

const nutation = getCorrectionToEquatorialForNutation(this.datetime, target)

const precession = getCorrectionToEquatorialForPrecessionOfEquinoxes(this.datetime, target)

const α = target.ra + abberation.ra + nutation.ra + precession.ra
const α = target.ra + aberration.ra + nutation.ra + precession.ra

const δ = target.dec + abberation.dec + nutation.dec + precession.dec
const δ = target.dec + aberration.dec + nutation.dec + precession.dec

// Ensure the Right Ascension is normalized to the range [0, 360):
this.ra = getNormalizedAzimuthalDegree(α)
Expand Down
10 changes: 5 additions & 5 deletions src/q.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/*****************************************************************************************************************/

import { getCorrectionToEquatorialForAnnualAbberation } from './abberation'
import { getCorrectionToEquatorialForAnnualAberration } from './aberration'

import { getAngularSeparation } from './astrometry'

Expand Down Expand Up @@ -135,18 +135,18 @@ export function getQIndex(
// Correct the target's equatorial coordinates for the precession of the equinoxes:
const precession = getCorrectionToEquatorialForPrecessionOfEquinoxes(datetime, target)

// Get the correction to the target's equatorial coordinates for abberation:
const abberation = getCorrectionToEquatorialForAnnualAbberation(datetime, target)
// Get the correction to the target's equatorial coordinates for aberration:
const aberration = getCorrectionToEquatorialForAnnualAberration(datetime, target)

// Get the correction to the target's equatorial coordinates for nutation:
const nutation = getCorrectionToEquatorialForNutation(datetime, target)

// Get the normalized azimuthal of the target:
const ra = getNormalizedAzimuthalDegree(target.ra + precession.ra + abberation.ra + nutation.ra)
const ra = getNormalizedAzimuthalDegree(target.ra + precession.ra + aberration.ra + nutation.ra)

// Get the normalized declination of the target:
const dec = getNormalizedInclinationDegree(
target.dec + precession.dec + abberation.dec + nutation.dec
target.dec + precession.dec + aberration.dec + nutation.dec
)

// Convert the target's equatorial coordinates to horizontal coordinates:
Expand Down
26 changes: 13 additions & 13 deletions tests/abberation.spec.ts → tests/aberration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { describe, expect, it } from 'vitest'

/*****************************************************************************************************************/

import { type EquatorialCoordinate, getCorrectionToEquatorialForAnnualAbberation, getCorrectionToEquatorialForDiurnalAbberation } from '../src'
import { type EquatorialCoordinate, getCorrectionToEquatorialForAnnualAberration, getCorrectionToEquatorialForDiurnalAberration } from '../src'

/*****************************************************************************************************************/

Expand All @@ -29,36 +29,36 @@ const betelgeuse: EquatorialCoordinate = { ra: 88.7929583, dec: 7.4070639 }

/*****************************************************************************************************************/

describe('getCorrectionToEquatorialForAnnualAbberation', () => {
describe('getCorrectionToEquatorialForAnnualAberration', () => {
it('should be defined', () => {
expect(getCorrectionToEquatorialForAnnualAbberation).toBeDefined()
expect(getCorrectionToEquatorialForAnnualAberration).toBeDefined()
})

it('should return the correct abberation correction for the J2000 default epoch', () => {
const { ra, dec } = getCorrectionToEquatorialForAnnualAbberation(
it('should return the correct aberration correction for the J2000 default epoch', () => {
const { ra, dec } = getCorrectionToEquatorialForAnnualAberration(
new Date('2000-01-01T00:00:00+00:00'),
betelgeuse
)
expect(ra + betelgeuse.ra).toBe(88.79868732900589)
expect(dec + betelgeuse.dec).toBe(7.4068039145745)
})

it('should return the correct abberation correction for the designated epoch', () => {
const { ra, dec } = getCorrectionToEquatorialForAnnualAbberation(datetime, betelgeuse)
it('should return the correct aberration correction for the designated epoch', () => {
const { ra, dec } = getCorrectionToEquatorialForAnnualAberration(datetime, betelgeuse)
expect(ra + betelgeuse.ra).toBe(88.78837512114575)
expect(dec + betelgeuse.dec).toBe(7.406109156062398)
})
})

/*****************************************************************************************************************/

describe('getCorrectionToEquatorialForDiurnalAbberation', () => {
describe('getCorrectionToEquatorialForDiurnalAberration', () => {
it('should be defined', () => {
expect(getCorrectionToEquatorialForDiurnalAbberation).toBeDefined()
expect(getCorrectionToEquatorialForDiurnalAberration).toBeDefined()
})

it('should return the correct abberation correction for the J2000 default epoch', () => {
const { ra, dec } = getCorrectionToEquatorialForDiurnalAbberation(
it('should return the correct aberration correction for the J2000 default epoch', () => {
const { ra, dec } = getCorrectionToEquatorialForDiurnalAberration(
new Date('2000-01-01T00:00:00+00:00'),
{
latitude,
Expand All @@ -70,8 +70,8 @@ describe('getCorrectionToEquatorialForDiurnalAbberation', () => {
expect(dec + betelgeuse.dec).toBe(7.407096948283444)
})

it('should return the correct abberation correction for the designated epoch', () => {
const { ra, dec } = getCorrectionToEquatorialForDiurnalAbberation(datetime, {
it('should return the correct aberration correction for the designated epoch', () => {
const { ra, dec } = getCorrectionToEquatorialForDiurnalAberration(datetime, {
latitude,
longitude
}, betelgeuse)
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { resolve } from 'path'
/*****************************************************************************************************************/

const modules = [
'abberation',
'aberration',
'astrometry',
'common',
'conjunction',
Expand Down
Loading