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

refactor!: amend to getCorrectionToEquatorialForAnnualAbberation usage in abberation module in @observerly/astrometry #407

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
16 changes: 8 additions & 8 deletions src/abberation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ import { getEccentricityOfOrbit } from './earth'
import { getJulianDate } from './epoch'

import {
getLunarMeanEclipticLongitudeOfTheAscendingNode,
getLunarMeanGeometricLongitude
getLunarMeanEclipticLongitudeOfTheAscendingNode,
getLunarMeanGeometricLongitude
} from './moon'

import { getSolarMeanGeometricLongitude, getSolarTrueGeometricLongitude } from './sun'

import { convertDegreesToRadians as radians } from './utilities'
import { convertRadiansToDegrees as degrees, convertDegreesToRadians as radians } from './utilities'

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

/**
*
* getCorrectionToEquatorialForAbberation()
* getCorrectionToEquatorialForAnnualAbberation()
*
* Corrects the equatorial coordinate of a target for abberation in
* longitude and obliquity due to the apparent motion of the Earth.
Expand All @@ -37,7 +37,7 @@ import { convertDegreesToRadians as radians } from './utilities'
* @returns The corrected equatorial coordinate of the target.
*
*/
export const getCorrectionToEquatorialForAbberation = (
export const getCorrectionToEquatorialForAnnualAbberation = (
datetime: Date,
target: EquatorialCoordinate
): EquatorialCoordinate => {
Expand Down Expand Up @@ -71,7 +71,7 @@ export const getCorrectionToEquatorialForAbberation = (
const ε = radians(getObliquityOfTheEcliptic(datetime) + Δε / 3600)

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

// Get the eccentricity of the Earth's orbit (dimensionless):
const e = getEccentricityOfOrbit(datetime)
Expand Down Expand Up @@ -100,8 +100,8 @@ export const getCorrectionToEquatorialForAbberation = (
Math.cos(ra) * Math.sin(dec) * Math.sin(ϖ))

return {
ra: Δra / 3600,
dec: Δdec / 3600
ra: degrees(Δra),
dec: degrees(Δdec)
}
}

Expand Down
9 changes: 6 additions & 3 deletions src/observation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

import { getCorrectionToEquatorialForAbberation } from './abberation'
import { getCorrectionToEquatorialForAnnualAbberation } from './abberation'

import { getHourAngle } from './astrometry'

Expand Down Expand Up @@ -58,7 +58,10 @@ export class Observation extends Object {

public latitude = Number.NEGATIVE_INFINITY

constructor({ ra = Number.NEGATIVE_INFINITY, dec = Number.NEGATIVE_INFINITY }: EquatorialCoordinate, observer?: Observer) {
constructor(
{ ra = Number.NEGATIVE_INFINITY, dec = Number.NEGATIVE_INFINITY }: EquatorialCoordinate,
observer?: Observer
) {
super()

const { datetime, longitude, latitude } = observer || {
Expand Down Expand Up @@ -138,7 +141,7 @@ export class Observation extends Object {
}

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

const nutation = getCorrectionToEquatorialForNutation(this.datetime, target)

Expand Down
4 changes: 2 additions & 2 deletions src/q.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

import { getCorrectionToEquatorialForAbberation } from './abberation'
import { getCorrectionToEquatorialForAnnualAbberation } from './abberation'

import { getAngularSeparation } from './astrometry'

Expand Down Expand Up @@ -136,7 +136,7 @@ export function getQIndex(
const precession = getCorrectionToEquatorialForPrecessionOfEquinoxes(datetime, target)

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

// Get the correction to the target's equatorial coordinates for nutation:
const nutation = getCorrectionToEquatorialForNutation(datetime, target)
Expand Down
10 changes: 5 additions & 5 deletions tests/abberation.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, getCorrectionToEquatorialForAbberation } from '../src'
import { type EquatorialCoordinate, getCorrectionToEquatorialForAnnualAbberation } from '../src'

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

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

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

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

it('should return the correct abberation correction for the J2000 default epoch', () => {
const { ra, dec } = getCorrectionToEquatorialForAbberation(
const { ra, dec } = getCorrectionToEquatorialForAnnualAbberation(
new Date('2000-01-01T00:00:00+00:00'),
betelgeuse
)
Expand All @@ -44,7 +44,7 @@ describe('getCorrectionToEquatorialForAbberation', () => {
})

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