Skip to content

Commit 0c815b9

Browse files
Merge pull request #407 from observerly/refactor/abberation/getCorrectionToEquatorialForAnnualAbberation
refactor!: amend to getCorrectionToEquatorialForAnnualAbberation usage in abberation module in @observerly/astrometry
2 parents d8d590c + 2cfef16 commit 0c815b9

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

src/abberation.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ import { getEccentricityOfOrbit } from './earth'
1515
import { getJulianDate } from './epoch'
1616

1717
import {
18-
getLunarMeanEclipticLongitudeOfTheAscendingNode,
19-
getLunarMeanGeometricLongitude
18+
getLunarMeanEclipticLongitudeOfTheAscendingNode,
19+
getLunarMeanGeometricLongitude
2020
} from './moon'
2121

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

24-
import { convertDegreesToRadians as radians } from './utilities'
24+
import { convertRadiansToDegrees as degrees, convertDegreesToRadians as radians } from './utilities'
2525

2626
/*****************************************************************************************************************/
2727

2828
/**
2929
*
30-
* getCorrectionToEquatorialForAbberation()
30+
* getCorrectionToEquatorialForAnnualAbberation()
3131
*
3232
* Corrects the equatorial coordinate of a target for abberation in
3333
* longitude and obliquity due to the apparent motion of the Earth.
@@ -37,7 +37,7 @@ import { convertDegreesToRadians as radians } from './utilities'
3737
* @returns The corrected equatorial coordinate of the target.
3838
*
3939
*/
40-
export const getCorrectionToEquatorialForAbberation = (
40+
export const getCorrectionToEquatorialForAnnualAbberation = (
4141
datetime: Date,
4242
target: EquatorialCoordinate
4343
): EquatorialCoordinate => {
@@ -71,7 +71,7 @@ export const getCorrectionToEquatorialForAbberation = (
7171
const ε = radians(getObliquityOfTheEcliptic(datetime) + Δε / 3600)
7272

7373
// Get the constant of abberation (in degrees):
74-
const κ = 20.49552
74+
const κ = radians(20.49552 / 3600)
7575

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

102102
return {
103-
ra: Δra / 3600,
104-
dec: Δdec / 3600
103+
ra: degrees(Δra),
104+
dec: degrees(Δdec)
105105
}
106106
}
107107

src/observation.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/*****************************************************************************************************************/
88

9-
import { getCorrectionToEquatorialForAbberation } from './abberation'
9+
import { getCorrectionToEquatorialForAnnualAbberation } from './abberation'
1010

1111
import { getHourAngle } from './astrometry'
1212

@@ -58,7 +58,10 @@ export class Observation extends Object {
5858

5959
public latitude = Number.NEGATIVE_INFINITY
6060

61-
constructor({ ra = Number.NEGATIVE_INFINITY, dec = Number.NEGATIVE_INFINITY }: EquatorialCoordinate, observer?: Observer) {
61+
constructor(
62+
{ ra = Number.NEGATIVE_INFINITY, dec = Number.NEGATIVE_INFINITY }: EquatorialCoordinate,
63+
observer?: Observer
64+
) {
6265
super()
6366

6467
const { datetime, longitude, latitude } = observer || {
@@ -138,7 +141,7 @@ export class Observation extends Object {
138141
}
139142

140143
private setEquatorialCoordinates(target: EquatorialCoordinate) {
141-
const abberation = getCorrectionToEquatorialForAbberation(this.datetime, target)
144+
const abberation = getCorrectionToEquatorialForAnnualAbberation(this.datetime, target)
142145

143146
const nutation = getCorrectionToEquatorialForNutation(this.datetime, target)
144147

src/q.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/*****************************************************************************************************************/
88

9-
import { getCorrectionToEquatorialForAbberation } from './abberation'
9+
import { getCorrectionToEquatorialForAnnualAbberation } from './abberation'
1010

1111
import { getAngularSeparation } from './astrometry'
1212

@@ -136,7 +136,7 @@ export function getQIndex(
136136
const precession = getCorrectionToEquatorialForPrecessionOfEquinoxes(datetime, target)
137137

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

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

tests/abberation.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { describe, expect, it } from 'vitest'
1010

1111
/*****************************************************************************************************************/
1212

13-
import { type EquatorialCoordinate, getCorrectionToEquatorialForAbberation } from '../src'
13+
import { type EquatorialCoordinate, getCorrectionToEquatorialForAnnualAbberation } from '../src'
1414

1515
/*****************************************************************************************************************/
1616

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

3030
/*****************************************************************************************************************/
3131

32-
describe('getCorrectionToEquatorialForAbberation', () => {
32+
describe('getCorrectionToEquatorialForAnnualAbberation', () => {
3333
it('should be defined', () => {
34-
expect(getCorrectionToEquatorialForAbberation).toBeDefined()
34+
expect(getCorrectionToEquatorialForAnnualAbberation).toBeDefined()
3535
})
3636

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

4646
it('should return the correct abberation correction for the designated epoch', () => {
47-
const { ra, dec } = getCorrectionToEquatorialForAbberation(datetime, betelgeuse)
47+
const { ra, dec } = getCorrectionToEquatorialForAnnualAbberation(datetime, betelgeuse)
4848
expect(ra + betelgeuse.ra).toBe(88.78837512114575)
4949
expect(dec + betelgeuse.dec).toBe(7.406109156062398)
5050
})

0 commit comments

Comments
 (0)