Skip to content

Commit

Permalink
Adding a test specifically for UMBC
Browse files Browse the repository at this point in the history
Signed-off-by: Cédric Foellmi <cedric@onekiloparsec.dev>
  • Loading branch information
onekiloparsec committed Oct 14, 2023
1 parent 371710b commit afb65ce
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions tests/transits.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { constants, juliandays, transits } from '../src/'
import { constants, juliandays, transits, Venus } from '../src'
import * as utils from '../src/utils.ts'

describe('transits of exoplanets', () => {
it('get transit for H = 0', () => {
Expand Down Expand Up @@ -38,12 +39,27 @@ test('approximate Venus on 1988 March 20 at Boston', () => {
expect(results.transit.julianDay < results.set.julianDay).toBeTruthy()
})

expect(results.transit.isCircumpolar).toBeFalsy()
expect(results.transit.isAboveHorizon).toBeTruthy()
expect(results.transit.isAboveAltitude).toBeTruthy()
expect(results.rise.utc).toBeCloseTo(12.43608, 0.000001)
expect(results.transit.utc).toBeCloseTo(19.6716, 0.000001)
expect(results.set.utc).toBeCloseTo(2.90712, 0.000001)
expect(results.rise.julianDay < results.transit.julianDay).toBeTruthy()
expect(results.transit.julianDay < results.set.julianDay).toBeTruthy()

// See AA p 103
test('approximate Venus on 2023 October 14 at UMBC', () => {
// We should normally use the Topocentric coordinates of Venus, not the Geocentric ones.
// Yet the topocentric corrections are usually small (< 30").
// Note, months are 0-based, hence 9 = october.
const jd = juliandays.getJulianDay(new Date(Date.UTC(2023, 9, 14, 0, 0)))
const umbc = { longitude: -76.70978311382578, latitude: 39.25443537644697 }
const coords = Venus.getApparentEquatorialCoordinates(jd)
const results = transits.getRiseSetTransitTimes(
jd,
coords.rightAscension,
coords.declination,
umbc.longitude,
umbc.latitude
)
// See https://www.arcsecond.io/observingsites/cac8b50e-5602-467d-a98f-59358ab29077
const offsetUTC = -18000 // seconds
const offsetDST = 3600 // seconds
const offsetHours = (offsetUTC + offsetDST) / 3600
expect(utils.fmod(results.rise.utc + offsetHours, 24)).toBeCloseTo(3.5, 1) // FAIL???
expect(utils.fmod(results.transit.utc + offsetHours, 24)).toBeCloseTo(10.0, 1) // FAIL???
expect(utils.fmod(results.set.utc + offsetHours, 24)).toBeCloseTo(16.30, 1) // FAIL???
})

0 comments on commit afb65ce

Please sign in to comment.