@zodiacs/engine 1.0.0 → 2.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1244 -0
- package/LICENSING.md +172 -27
- package/NOTICE +78 -12
- package/README.md +344 -59
- package/dist/{api-WbxJ4Wj-.d.ts → api-C_SVd9BJ.d.ts} +39 -3
- package/dist/{ayanamsa--YQ46fET.d.ts → ayanamsa-Clgkekhh.d.ts} +2 -1
- package/dist/calc.d.ts +91 -4
- package/dist/calc.js +368 -126
- package/dist/chunk-CV53HA7R.js +87 -0
- package/dist/chunk-EEW7746S.js +83 -0
- package/dist/{chunk-WS3TDSP3.js → chunk-FVGA776A.js} +7 -3
- package/dist/chunk-HNVGWN3S.js +852 -0
- package/dist/chunk-I3L4POY7.js +18 -0
- package/dist/{chunk-FTX3JDJA.js → chunk-IXFUYEUF.js} +65 -29
- package/dist/{chunk-7TRLIFFI.js → chunk-LWZS7HI3.js} +1 -1
- package/dist/{chunk-CHSYDKBL.js → chunk-N4UQLCBN.js} +3 -3
- package/dist/{chunk-YIITY7Q7.js → chunk-NX4PHQBL.js} +34 -22
- package/dist/chunk-OVXQQEXL.js +41 -0
- package/dist/{chunk-SRXBTP5H.js → chunk-PNXIA7MI.js} +217 -192
- package/dist/chunk-RMBWKZI2.js +130 -0
- package/dist/{chunk-DMGHYCDI.js → chunk-SCRO6HWB.js} +5 -3
- package/dist/{chunk-OG4OYTJJ.js → chunk-T6F4FYYS.js} +1 -129
- package/dist/chunk-UXY4RU57.js +48 -0
- package/dist/{chunk-PFGUCNOK.js → chunk-WONTOC5W.js} +7 -6
- package/dist/conventions.d.ts +70 -0
- package/dist/conventions.js +26 -0
- package/dist/crossings.d.ts +15 -4
- package/dist/de440-pack.d.ts +43 -0
- package/dist/de440-pack.js +16 -0
- package/dist/de440.d.ts +113 -0
- package/dist/de440.js +19 -0
- package/dist/ephemeris-D1lM832F.d.ts +64 -0
- package/dist/geo.d.ts +28 -7
- package/dist/geo.js +2 -2
- package/dist/houses-extra.d.ts +5 -4
- package/dist/{houses-CFERsAlK.d.ts → houses-icK01yXi.d.ts} +3 -3
- package/dist/index.d.ts +8 -6
- package/dist/index.js +40 -28
- package/dist/{internal-math-DJJ8BYex.d.ts → internal-math-BGX23p4h.d.ts} +2 -2
- package/dist/internal-math.d.ts +4 -3
- package/dist/internal-math.js +14 -12
- package/dist/internal.d.ts +16 -7
- package/dist/internal.js +25 -4
- package/dist/lite-composite.js +114 -0
- package/dist/lite-declinations.js +253 -0
- package/dist/lite-dignities.js +333 -0
- package/dist/lite-sect.js +72 -0
- package/dist/lite.d.ts +82 -0
- package/dist/lite.js +4 -0
- package/dist/receipt.d.ts +3 -2
- package/dist/receipt.js +156 -67
- package/dist/{rulers-Dla6h_Sm.d.ts → rulers-CpS9qkvu.d.ts} +1 -1
- package/dist/sky.d.ts +4 -3
- package/dist/sky.js +17 -10
- package/dist/techniques.d.ts +102 -6
- package/dist/techniques.js +131 -56
- package/dist/time-bands-CZA9AlLg.d.ts +36 -0
- package/dist/time-scale-DIFNa0gz.d.ts +47 -0
- package/dist/time.d.ts +81 -0
- package/dist/time.js +74 -0
- package/dist/timing.d.ts +6 -5
- package/dist/timing.js +24 -17
- package/dist/types-BCnyWBQZ.d.ts +352 -0
- package/dist/vedic.d.ts +112 -4
- package/dist/vedic.js +369 -14
- package/dist/window.d.ts +22 -2
- package/dist/window.js +86 -28
- package/dist/{zone-history-ghdyO0Sc.d.ts → zone-history-0XzMGx9V.d.ts} +32 -10
- package/package.json +24 -3
- package/dist/types-B-yb_tGL.d.ts +0 -240
package/dist/calc.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
eclipticRows,
|
|
3
|
-
equatorRows
|
|
4
|
-
} from "./chunk-7TRLIFFI.js";
|
|
5
1
|
import {
|
|
6
2
|
AYANAMSAS,
|
|
7
3
|
ayanamsaAt,
|
|
@@ -11,32 +7,38 @@ import {
|
|
|
11
7
|
userAyanamsa,
|
|
12
8
|
wholeSignCusps,
|
|
13
9
|
wrap360
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-47ERTK5X.js";
|
|
10
|
+
} from "./chunk-FVGA776A.js";
|
|
16
11
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
searchLongitudeCrossingsWith
|
|
21
|
-
} from "./chunk-TSS2SZWQ.js";
|
|
12
|
+
eclipticRows,
|
|
13
|
+
equatorRows
|
|
14
|
+
} from "./chunk-LWZS7HI3.js";
|
|
22
15
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
validateBirthSettings
|
|
27
|
-
} from "./chunk-PFGUCNOK.js";
|
|
16
|
+
timeBands
|
|
17
|
+
} from "./chunk-I3L4POY7.js";
|
|
18
|
+
import "./chunk-47ERTK5X.js";
|
|
28
19
|
import {
|
|
29
20
|
bodyLongitude,
|
|
30
21
|
computeChart,
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
deltaTExtrapolated,
|
|
23
|
+
ephemerisAt,
|
|
33
24
|
gastHours,
|
|
34
25
|
meanApogee,
|
|
35
|
-
meanEcliptic,
|
|
36
26
|
meanNodeLongitude,
|
|
37
27
|
onChartClock,
|
|
38
|
-
|
|
39
|
-
} from "./chunk-
|
|
28
|
+
refuseUnderSource
|
|
29
|
+
} from "./chunk-PNXIA7MI.js";
|
|
30
|
+
import {
|
|
31
|
+
dateFrom
|
|
32
|
+
} from "./chunk-CPALRSPC.js";
|
|
33
|
+
import {
|
|
34
|
+
ENGINE_VERSION,
|
|
35
|
+
EPHEMERIS
|
|
36
|
+
} from "./chunk-T6F4FYYS.js";
|
|
37
|
+
import {
|
|
38
|
+
eclipticFrame,
|
|
39
|
+
eclipticOfDate,
|
|
40
|
+
meanEcliptic
|
|
41
|
+
} from "./chunk-EEW7746S.js";
|
|
40
42
|
import {
|
|
41
43
|
EPHEMERIS_SPAN,
|
|
42
44
|
REFERENCE_SPAN,
|
|
@@ -44,26 +46,43 @@ import {
|
|
|
44
46
|
elapsedDays,
|
|
45
47
|
timeBasis
|
|
46
48
|
} from "./chunk-B5LKF437.js";
|
|
47
|
-
import
|
|
49
|
+
import {
|
|
50
|
+
searchLongitudeCrossingsWith
|
|
51
|
+
} from "./chunk-TSS2SZWQ.js";
|
|
52
|
+
import "./chunk-UXY4RU57.js";
|
|
53
|
+
import "./chunk-HNVGWN3S.js";
|
|
54
|
+
import {
|
|
55
|
+
tilt
|
|
56
|
+
} from "./chunk-CV53HA7R.js";
|
|
48
57
|
import {
|
|
49
58
|
computeAngles,
|
|
50
59
|
computeHouses,
|
|
51
60
|
eastPointOf,
|
|
61
|
+
insidePolarCircle,
|
|
52
62
|
isPolarUndefinedHouseSystem,
|
|
53
63
|
ramcOf,
|
|
54
64
|
vertexOf
|
|
55
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-SCRO6HWB.js";
|
|
56
66
|
import {
|
|
57
|
-
ENGINE_VERSION,
|
|
58
|
-
EPHEMERIS,
|
|
59
67
|
normalizeLongitude
|
|
60
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-RMBWKZI2.js";
|
|
69
|
+
import "./chunk-BHJXUY67.js";
|
|
70
|
+
import {
|
|
71
|
+
assertDerivedFlags,
|
|
72
|
+
snapshotFlags,
|
|
73
|
+
timeFlags,
|
|
74
|
+
validateBirthSettings
|
|
75
|
+
} from "./chunk-WONTOC5W.js";
|
|
61
76
|
|
|
62
77
|
// src/calc.ts
|
|
63
|
-
import { AstroTime, GeoMoonState } from "astronomy-engine";
|
|
78
|
+
import { AstroTime, GeoMoonState, KM_PER_AU as KM_PER_AU2 } from "astronomy-engine";
|
|
64
79
|
|
|
65
80
|
// src/calc-bounds.ts
|
|
81
|
+
var SWEPT_BASIS = "largest difference from JPL's DE440 found at noon TT on each of 146,097 days, JD 2378497.0 to 2524593.0 (TT), in all eight frames; docs/evidence/de440-sweep-20261111";
|
|
82
|
+
var SWEPT = ["geocentric/apparent", "geocentric/astrometric", "geocentric/geometric"];
|
|
66
83
|
var MEASURED_BASIS = "largest difference from JPL Horizons (DE441) over 32 instants from JD 2379457.498125 to 2520522.646618 (TT), in all eight frames; docs/evidence/calc-api/rc16";
|
|
84
|
+
var MEAN_POINTS_BASIS = "largest difference from the same definition evaluated with ERFA's fundamental arguments (faom03, faf03, fal03) and nut06a's nutation in longitude, over 32 instants from JD 2379457.498125 to 2520522.646618 (TT), in all eight frames: a check of the implementation, not of an ephemeris; docs/evidence/calc-api/rc16";
|
|
85
|
+
var MEAN_POINTS_SPEED_BASIS = "largest difference from the rate of the same definition evaluated with ERFA's fundamental arguments (faom03, faf03, fal03) and nut06a's nutation in longitude, taken over 0.0001 day either side, over 32 instants from JD 2379457.498125 to 2520522.646618 (TT), in the true ecliptic of date only: a check of the implementation, not of an ephemeris; docs/evidence/calc-api/rc16";
|
|
67
86
|
var BARYCENTRIC_APPARENT = {
|
|
68
87
|
"Earth": [3, 14e-6, 0.18],
|
|
69
88
|
"Jupiter": [13, 4e-5, 0.025],
|
|
@@ -76,6 +95,18 @@ var BARYCENTRIC_APPARENT = {
|
|
|
76
95
|
"Uranus": [19, 43e-6, 86e-4],
|
|
77
96
|
"Venus": [7.4, 15e-6, 0.22]
|
|
78
97
|
};
|
|
98
|
+
var GEOCENTRIC_ASTROMETRIC = {
|
|
99
|
+
"Jupiter": [17, 79e-6, 0.11],
|
|
100
|
+
"Mars": [23, 87e-6, 0.74],
|
|
101
|
+
"Mercury": [17, 78e-6, 3.6],
|
|
102
|
+
"Moon": [12, 48e-6, 2.9],
|
|
103
|
+
"Neptune": [22, 47e-6, 0.019],
|
|
104
|
+
"Pluto": [30, 63e-6, 0.018],
|
|
105
|
+
"Saturn": [24, 77e-6, 0.06],
|
|
106
|
+
"Sun": [3.4, 17e-6, 0.24],
|
|
107
|
+
"Uranus": [20, 56e-6, 0.03],
|
|
108
|
+
"Venus": [24, 83e-6, 1.4]
|
|
109
|
+
};
|
|
79
110
|
var HELIOCENTRIC_APPARENT = {
|
|
80
111
|
"Earth": [3, 15e-6, 0.18],
|
|
81
112
|
"Jupiter": [13, 4e-5, 0.025],
|
|
@@ -105,45 +136,23 @@ var MEASURED = {
|
|
|
105
136
|
},
|
|
106
137
|
"geocentric/apparent": {
|
|
107
138
|
"Black Moon Lilith": [23e-4, null, 32e-4],
|
|
108
|
-
"Jupiter": [
|
|
109
|
-
"Mars": [
|
|
139
|
+
"Jupiter": [17, 79e-6, 0.11],
|
|
140
|
+
"Mars": [23, 87e-6, 0.74],
|
|
110
141
|
"Mean Node": [23e-4, null, 81e-5],
|
|
111
142
|
"Mean South Node": [23e-4, null, 81e-5],
|
|
112
|
-
"Mercury": [
|
|
113
|
-
"Moon": [
|
|
114
|
-
"Neptune": [
|
|
115
|
-
"North Node": [
|
|
116
|
-
"Pluto": [
|
|
117
|
-
"Saturn": [
|
|
118
|
-
"South Node": [
|
|
119
|
-
"Sun": [3,
|
|
120
|
-
"Uranus": [20,
|
|
121
|
-
"Venus": [
|
|
122
|
-
},
|
|
123
|
-
"geocentric/astrometric": {
|
|
124
|
-
"Jupiter": [13, 47e-6, 0.061],
|
|
125
|
-
"Mars": [6.6, 58e-6, 0.45],
|
|
126
|
-
"Mercury": [9.3, 36e-6, 2.2],
|
|
127
|
-
"Moon": [7.6, 36e-6, 1.1],
|
|
128
|
-
"Neptune": [21, 42e-6, 0.013],
|
|
129
|
-
"Pluto": [25, 63e-6, 0.014],
|
|
130
|
-
"Saturn": [18, 68e-6, 0.03],
|
|
131
|
-
"Sun": [3, 15e-6, 0.18],
|
|
132
|
-
"Uranus": [20, 42e-6, 0.02],
|
|
133
|
-
"Venus": [11, 32e-6, 0.64]
|
|
134
|
-
},
|
|
135
|
-
"geocentric/geometric": {
|
|
136
|
-
"Jupiter": [13, 47e-6, 0.061],
|
|
137
|
-
"Mars": [6.6, 58e-6, 0.45],
|
|
138
|
-
"Mercury": [9.3, 36e-6, 2.2],
|
|
139
|
-
"Moon": [7.6, 36e-6, 0.97],
|
|
140
|
-
"Neptune": [21, 42e-6, 0.013],
|
|
141
|
-
"Pluto": [25, 63e-6, 0.014],
|
|
142
|
-
"Saturn": [18, 68e-6, 0.03],
|
|
143
|
-
"Sun": [3, 15e-6, 0.18],
|
|
144
|
-
"Uranus": [20, 42e-6, 0.02],
|
|
145
|
-
"Venus": [11, 32e-6, 0.64]
|
|
143
|
+
"Mercury": [17, 78e-6, 3.6],
|
|
144
|
+
"Moon": [12, 15e-5, 2.9],
|
|
145
|
+
"Neptune": [22, 47e-6, 0.019],
|
|
146
|
+
"North Node": [33, null, null],
|
|
147
|
+
"Pluto": [30, 63e-6, 0.018],
|
|
148
|
+
"Saturn": [24, 77e-6, 0.06],
|
|
149
|
+
"South Node": [33, null, null],
|
|
150
|
+
"Sun": [3.4, 17e-6, 0.24],
|
|
151
|
+
"Uranus": [20, 56e-6, 0.03],
|
|
152
|
+
"Venus": [24, 83e-6, 1.4]
|
|
146
153
|
},
|
|
154
|
+
"geocentric/astrometric": GEOCENTRIC_ASTROMETRIC,
|
|
155
|
+
"geocentric/geometric": GEOCENTRIC_ASTROMETRIC,
|
|
147
156
|
"heliocentric/apparent": HELIOCENTRIC_APPARENT,
|
|
148
157
|
"heliocentric/astrometric": HELIOCENTRIC_APPARENT,
|
|
149
158
|
"heliocentric/geometric": {
|
|
@@ -157,24 +166,28 @@ var MEASURED = {
|
|
|
157
166
|
"Saturn": [18, 65e-6, 0.023],
|
|
158
167
|
"Uranus": [19, 42e-6, 9e-3],
|
|
159
168
|
"Venus": [6.6, 12e-6, 0.21]
|
|
160
|
-
},
|
|
161
|
-
"topocentric/apparent": {
|
|
162
|
-
"Mars": [6.6, 58e-6, 0.46],
|
|
163
|
-
"Moon": [7.8, 36e-6, 1.4],
|
|
164
|
-
"Sun": [3, 15e-6, 0.19]
|
|
165
|
-
},
|
|
166
|
-
"topocentric/astrometric": {
|
|
167
|
-
"Mars": [6.6, 58e-6, 0.45],
|
|
168
|
-
"Moon": [7.8, 36e-6, 1.4],
|
|
169
|
-
"Sun": [3, 15e-6, 0.18]
|
|
170
|
-
},
|
|
171
|
-
"topocentric/geometric": {
|
|
172
|
-
"Mars": [6.6, 58e-6, 0.45],
|
|
173
|
-
"Moon": [7.8, 36e-6, 1.5],
|
|
174
|
-
"Sun": [3, 15e-6, 0.18]
|
|
175
169
|
}
|
|
176
170
|
};
|
|
177
171
|
|
|
172
|
+
// src/calc-bounds-de440.ts
|
|
173
|
+
var DE440_MEASURED_BASIS = "largest angle from JPL Horizons's apparent geocentric place (DE441) at the conformance suite's L1 vectors, 24 TT instants a body from 1851 to 2148, in the true ecliptic of date, and from NAIF's de440.bsp at noon TT every day from 1800 to 2199 in all eight frames, the larger, on the shipped DE440 pack; src/calc-bounds-de440.ts";
|
|
174
|
+
var DE440_TURNED_BASIS = "the bound measured in the true ecliptic of date (JPL Horizons, DE441, the conformance suite's L1 vectors; NAIF's de440.bsp every day from 1800 to 2199, which also covers this frame), on the shipped DE440 pack, reached in this frame with the engine's own nutation and precession; Horizons not compared in this frame; src/calc-bounds-de440.ts";
|
|
175
|
+
var DE440_MEASURED = {
|
|
176
|
+
Jupiter: 4e-3,
|
|
177
|
+
Mars: 4e-3,
|
|
178
|
+
Mercury: 4e-3,
|
|
179
|
+
Moon: 0.013,
|
|
180
|
+
Neptune: 4e-3,
|
|
181
|
+
Pluto: 4e-3,
|
|
182
|
+
Saturn: 39e-4,
|
|
183
|
+
Sun: 4e-3,
|
|
184
|
+
Uranus: 4e-3,
|
|
185
|
+
Venus: 4e-3
|
|
186
|
+
};
|
|
187
|
+
var DE440_AT_LIMB = 1.8;
|
|
188
|
+
var DE440_LIMB_BAND = 3;
|
|
189
|
+
var DE440_AT_LIMB_BASIS = "within 3 arcseconds of the Sun's limb, where JPL Horizons and this engine may put the planet on different sides of it and so apply the light deflection there (at most 4GM/c^2R = 1.7512 arcseconds) in one and not the other: the step and the body's own bound, an estimate; src/calc-bounds-de440.ts";
|
|
190
|
+
|
|
178
191
|
// src/calc-frames.ts
|
|
179
192
|
var CALC_FRAMES = [
|
|
180
193
|
"ecliptic-true-of-date",
|
|
@@ -328,6 +341,7 @@ function sunMotion(left, time) {
|
|
|
328
341
|
return sub(vec(BaryState(Body.Sun, left)), vec(BaryState(Body.Sun, time)));
|
|
329
342
|
}
|
|
330
343
|
function locate(body, center, correction, time) {
|
|
344
|
+
refuseUnderSource("@zodiacs/engine/calc");
|
|
331
345
|
const found = (v2, dist = length(v2)) => ({ v: v2, dist });
|
|
332
346
|
if (center.kind === "barycentric") {
|
|
333
347
|
const bary = (t) => vec(BaryState(body, t));
|
|
@@ -353,6 +367,7 @@ function locate(body, center, correction, time) {
|
|
|
353
367
|
return found(apparent, length(astrometric));
|
|
354
368
|
}
|
|
355
369
|
function geometricState(body, center, time) {
|
|
370
|
+
refuseUnderSource("@zodiacs/engine/calc");
|
|
356
371
|
if (body === Body.Moon) return null;
|
|
357
372
|
const split = (s) => ({ r: vec(s), v: [s.vx, s.vy, s.vz] });
|
|
358
373
|
if (center.kind === "barycentric") return split(BaryState(body, time));
|
|
@@ -601,18 +616,19 @@ function instant(basis) {
|
|
|
601
616
|
};
|
|
602
617
|
}
|
|
603
618
|
var TIME_BASIS_ID = "time:tt-from-leap-seconds-and-ut1-from-iers-1972-to-table-end;delta-t-model-otherwise";
|
|
604
|
-
function receipt(request, instants, ids, pin) {
|
|
619
|
+
function receipt(request, instants, ids, pin, banded = true, ephemeris = EPHEMERIS) {
|
|
605
620
|
return {
|
|
606
621
|
schema: CALC_RECEIPT_SCHEMA,
|
|
607
622
|
request,
|
|
608
623
|
instants,
|
|
609
624
|
conventions: [
|
|
610
625
|
...ids,
|
|
611
|
-
`ephemeris
|
|
626
|
+
`ephemeris:${ephemeris.name}@${ephemeris.version}`,
|
|
612
627
|
pin === void 0 ? "deltat:time-basis" : "deltat:pinned",
|
|
613
|
-
TIME_BASIS_ID
|
|
628
|
+
TIME_BASIS_ID,
|
|
629
|
+
...banded ? ["time-band:first-order"] : []
|
|
614
630
|
],
|
|
615
|
-
engine: { name: "@zodiacs/engine", version: ENGINE_VERSION, ephemeris: {
|
|
631
|
+
engine: { name: "@zodiacs/engine", version: ENGINE_VERSION, ephemeris: { name: ephemeris.name, version: ephemeris.version } }
|
|
616
632
|
};
|
|
617
633
|
}
|
|
618
634
|
var isPoint = (body) => POINTS.includes(body);
|
|
@@ -643,6 +659,44 @@ function pointAt(body, at2) {
|
|
|
643
659
|
const raw = meanNodeLongitude(centuries, nutation);
|
|
644
660
|
return row(raw, normalizeLongitude(body === "Mean Node" ? raw : raw + 180));
|
|
645
661
|
}
|
|
662
|
+
var BARYCENTRES = ["Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"];
|
|
663
|
+
var packGives = (body, kind, correction) => kind === "geocentric" && (isTrueNode(body) || !isPoint(body) && body !== "Earth" && correction === "apparent");
|
|
664
|
+
function packed(from, body, frame, behind) {
|
|
665
|
+
const tidy = (lon) => lon === 360 ? 0 : lon + 0;
|
|
666
|
+
return (at2, basis) => {
|
|
667
|
+
let lon;
|
|
668
|
+
let lat = 0;
|
|
669
|
+
let dist = null;
|
|
670
|
+
if (isTrueNode(body)) {
|
|
671
|
+
const node = from.trueNode(basis.ttDays);
|
|
672
|
+
lon = body === "North Node" ? tidy(node) : normalizeLongitude(node + 180);
|
|
673
|
+
} else {
|
|
674
|
+
const place = from.place(body, basis.ttDays, behind);
|
|
675
|
+
lon = tidy(place.lon);
|
|
676
|
+
lat = place.lat;
|
|
677
|
+
dist = place.dist ?? null;
|
|
678
|
+
}
|
|
679
|
+
const scaled = (v) => dist === null ? null : [v[0] * dist, v[1] * dist, v[2] * dist];
|
|
680
|
+
const along = fromSpherical(lon, lat, 1);
|
|
681
|
+
if (frame === "ecliptic-true-of-date") return { lon, lat, dist, xyz: scaled(along), raw: lon };
|
|
682
|
+
const turned = apply(frameMatrix(frame, at2), apply(transpose(frameMatrix("ecliptic-true-of-date", at2)), along));
|
|
683
|
+
const there = toSpherical(turned);
|
|
684
|
+
return { lon: there.lon, lat: there.lat, dist, xyz: scaled(turned), raw: there.lon };
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
var SUN_RADIUS_KM = 695700;
|
|
688
|
+
function atLimb(from, body, ttDays) {
|
|
689
|
+
if (body === "Sun" || body === "Moon" || isPoint(body) || isTrueNode(body) || body === "Earth") return false;
|
|
690
|
+
const sun = from.place("Sun", ttDays);
|
|
691
|
+
const place = from.place(body, ttDays);
|
|
692
|
+
if (sun.dist === void 0 || place.dist === void 0 || !(place.dist > sun.dist)) return false;
|
|
693
|
+
const a = fromSpherical(sun.lon, sun.lat, 1);
|
|
694
|
+
const b = fromSpherical(place.lon, place.lat, 1);
|
|
695
|
+
const cross = Math.hypot(a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]);
|
|
696
|
+
const apart = Math.atan2(cross, a[0] * b[0] + a[1] * b[1] + a[2] * b[2]) * RAD2 * 3600;
|
|
697
|
+
const radius = Math.asin(SUN_RADIUS_KM / (sun.dist * KM_PER_AU2)) * RAD2 * 3600;
|
|
698
|
+
return Math.abs(apart - radius) <= DE440_LIMB_BAND;
|
|
699
|
+
}
|
|
646
700
|
function evaluator(body, frame, center, correction) {
|
|
647
701
|
if (isPoint(body)) {
|
|
648
702
|
return (at2) => {
|
|
@@ -669,8 +723,8 @@ function turnedBack([x, y, z], angle) {
|
|
|
669
723
|
}
|
|
670
724
|
function siderealOf(evaluate, definition, frame) {
|
|
671
725
|
const trueOfDate = frame === "ecliptic-true-of-date";
|
|
672
|
-
return (at2) => {
|
|
673
|
-
const row = evaluate(at2);
|
|
726
|
+
return (at2, basis) => {
|
|
727
|
+
const row = evaluate(at2, basis);
|
|
674
728
|
const value = ayanamsaAt(definition, at2);
|
|
675
729
|
const subtracted = trueOfDate ? value.true : value.mean;
|
|
676
730
|
return {
|
|
@@ -683,10 +737,15 @@ function siderealOf(evaluate, definition, frame) {
|
|
|
683
737
|
};
|
|
684
738
|
};
|
|
685
739
|
}
|
|
686
|
-
function positionIds(body, frame, kind, correction, zodiac) {
|
|
740
|
+
function positionIds(body, frame, kind, correction, zodiac, onPack = false) {
|
|
687
741
|
const ids = [...zodiac.ids, `frame:${frame}`, `center:${kind}`];
|
|
688
742
|
if (isPoint(body)) {
|
|
689
743
|
ids.push("correction:not-applicable", body.endsWith("Lilith") ? "lilith:mean" : body.startsWith("Mean") ? "node:mean" : "node:true-osculating");
|
|
744
|
+
if (onPack) ids.push(...PACK_PLACE_IDS);
|
|
745
|
+
} else if (onPack) {
|
|
746
|
+
ids.push(`correction:${correction}`, "light-time:iterated", "deflection:sun-outside-disc", "aberration:relativistic-annual");
|
|
747
|
+
if (BARYCENTRES.includes(body)) ids.push("target:system-barycentre");
|
|
748
|
+
ids.push(...PACK_PLACE_IDS);
|
|
690
749
|
} else {
|
|
691
750
|
ids.push(`correction:${correction}`);
|
|
692
751
|
if (body === "Moon" && kind === "geocentric" && correction !== "astrometric") ids.push("moon:series-at-instant");
|
|
@@ -695,6 +754,12 @@ function positionIds(body, frame, kind, correction, zodiac) {
|
|
|
695
754
|
if (correction === "apparent" && kind !== "barycentric") ids.push("aberration:backdated-observer");
|
|
696
755
|
}
|
|
697
756
|
}
|
|
757
|
+
if (onPack) {
|
|
758
|
+
ids.push("precession:iau2006", "obliquity:iau2006");
|
|
759
|
+
if (frame !== "ecliptic-true-of-date") ids.push("frame-turn:from-true-ecliptic-of-date", "nutation:iau2000b");
|
|
760
|
+
if (frame.endsWith("icrs")) ids.push("frame-bias:iau2000");
|
|
761
|
+
return ids;
|
|
762
|
+
}
|
|
698
763
|
if (isPoint(body) || !inertial(frame)) ids.push("precession:iau2006");
|
|
699
764
|
if (frame.includes("true")) ids.push("nutation:iau2000b");
|
|
700
765
|
if (isPoint(body) || frame.startsWith("ecliptic")) ids.push("obliquity:iau2006");
|
|
@@ -703,9 +768,12 @@ function positionIds(body, frame, kind, correction, zodiac) {
|
|
|
703
768
|
if (kind === "topocentric") ids.push("observer:iers2003-ellipsoid;no-polar-motion");
|
|
704
769
|
return ids;
|
|
705
770
|
}
|
|
706
|
-
|
|
707
|
-
|
|
771
|
+
var PACK_PLACE_IDS = ["place:icrf-to-true-ecliptic-of-date", "frame-bias:iau2006-fukushima-williams", "nutation:iau2000b-p03", "time:tdb-three-term"];
|
|
772
|
+
var MEAN_POINTS = ["Mean Node", "Mean South Node", "Black Moon Lilith"];
|
|
773
|
+
function bound(value, unit, estimated, measured) {
|
|
774
|
+
return value === void 0 || value === null ? { value: null, unit, label: "estimated", basis: "not compared with an independent ephemeris" } : { value, unit, label: estimated === null ? "measured" : "estimated", basis: estimated ?? measured };
|
|
708
775
|
}
|
|
776
|
+
var stretched = (b, extra) => !extra || b.value === null ? b : { ...b, value: addBounds(b.value, extra), label: "estimated", basis: `${b.basis}; plus ${+extra.toPrecision(3)} ${b.unit}, \u0394T extrapolated (docs/calc.md, "Bounds")` };
|
|
709
777
|
function up2(x) {
|
|
710
778
|
const unit = 10 ** (Math.floor(Math.log10(x)) - 1);
|
|
711
779
|
return Number((Math.ceil(x / unit) * unit).toPrecision(2));
|
|
@@ -716,6 +784,7 @@ function barycentricSun(r, v) {
|
|
|
716
784
|
return [up2(Math.asin(e / r) * RAD2 * 3600), up2(e / (r - e)), rate === null ? null : up2(rate * RAD2 * 3600)];
|
|
717
785
|
}
|
|
718
786
|
function calc(request) {
|
|
787
|
+
refuseUnderSource("@zodiacs/engine/calc");
|
|
719
788
|
const asked = fields(request, "calc request", ["body", "time", "frame", "center", "zodiac", "flags"]);
|
|
720
789
|
const body = oneOf(asked.body, CALC_BODIES, "body");
|
|
721
790
|
const time = readTime(asked.time, "time");
|
|
@@ -747,13 +816,27 @@ function calc(request) {
|
|
|
747
816
|
const correction = flags.correction;
|
|
748
817
|
const definition = zodiac.definition;
|
|
749
818
|
return inSpan(time, (basis) => {
|
|
750
|
-
const
|
|
819
|
+
const chosen = packGives(body, kind, correction) ? ephemerisAt(time.ms, time.scale, time.pin) : null;
|
|
820
|
+
const from = chosen?.from ?? null;
|
|
821
|
+
const tropical = from ? packed(from, body, frame) : evaluator(body, frame, center, correction);
|
|
751
822
|
const evaluate = definition === null ? tropical : siderealOf(tropical, definition, frame);
|
|
752
823
|
const now = onInput(time, time.ms, evaluate);
|
|
753
824
|
const step = isTrueNode(body) ? NODE_STEP_DAYS : STEP_DAYS;
|
|
754
825
|
const analytic = flags.speeds && correction === "geometric" && inertial(frame) && !point && body !== "Moon";
|
|
755
826
|
let speeds = null;
|
|
756
827
|
let velocity = null;
|
|
828
|
+
let samples = null;
|
|
829
|
+
const sampling = () => {
|
|
830
|
+
if (samples) return samples;
|
|
831
|
+
const side = from && !isTrueNode(body) ? from.place(body, basis.ttDays).behindDisc : void 0;
|
|
832
|
+
const tropicalSamples = from && side !== void 0 ? packed(from, body, frame, side) : tropical;
|
|
833
|
+
return samples = definition === null ? tropicalSamples : siderealOf(tropicalSamples, definition, frame);
|
|
834
|
+
};
|
|
835
|
+
const shift = (days) => {
|
|
836
|
+
const ms = time.ms + days * DAY_MS;
|
|
837
|
+
const at2 = sampling();
|
|
838
|
+
return onInput(time, ms, (instant2, sampled) => ({ row: at2(instant2, sampled), basis: sampled }));
|
|
839
|
+
};
|
|
757
840
|
if (analytic) {
|
|
758
841
|
const { state, turn } = onInput(time, time.ms, (at2) => ({
|
|
759
842
|
state: geometricState(body, center, at2),
|
|
@@ -762,10 +845,6 @@ function calc(request) {
|
|
|
762
845
|
velocity = apply(turn, state.v);
|
|
763
846
|
speeds = sphericalRates(apply(turn, state.r), velocity);
|
|
764
847
|
} else if (flags.speeds) {
|
|
765
|
-
const shift = (days) => {
|
|
766
|
-
const ms = time.ms + days * DAY_MS;
|
|
767
|
-
return onInput(time, ms, (at2, sampled) => ({ row: evaluate(at2), basis: sampled }));
|
|
768
|
-
};
|
|
769
848
|
const before = shift(-step);
|
|
770
849
|
const after = shift(step);
|
|
771
850
|
const elapsed = elapsedDays(before.basis, after.basis, 2 * step);
|
|
@@ -783,19 +862,63 @@ function calc(request) {
|
|
|
783
862
|
}
|
|
784
863
|
const method = !flags.speeds ? null : analytic ? "analytic" : "central-difference";
|
|
785
864
|
const k = flags.units === "radians" ? DEG2 : 1;
|
|
786
|
-
|
|
865
|
+
const group = `${kind}/${point ? "apparent" : correction}`;
|
|
866
|
+
let row = MEASURED[group]?.[body];
|
|
787
867
|
let estimated = null;
|
|
788
|
-
|
|
868
|
+
const mean = MEAN_POINTS.includes(body);
|
|
869
|
+
const swept = SWEPT.includes(group) ? SWEPT_BASIS : MEASURED_BASIS;
|
|
870
|
+
let measured = mean ? MEAN_POINTS_BASIS : swept;
|
|
871
|
+
if (from) {
|
|
872
|
+
const position = DE440_MEASURED[body];
|
|
873
|
+
row = position === void 0 ? void 0 : [position, null, null];
|
|
874
|
+
measured = DE440_MEASURED_BASIS;
|
|
875
|
+
if (frame !== "ecliptic-true-of-date") estimated = DE440_TURNED_BASIS;
|
|
876
|
+
if (position !== void 0 && atLimb(from, body, basis.ttDays)) {
|
|
877
|
+
row = [DE440_AT_LIMB, null, null];
|
|
878
|
+
estimated = DE440_AT_LIMB_BASIS;
|
|
879
|
+
}
|
|
880
|
+
} else if (!row && kind === "topocentric") {
|
|
789
881
|
row = MEASURED[`geocentric/${correction}`]?.[body];
|
|
790
|
-
estimated = "the geocentric bound for this correction;
|
|
882
|
+
estimated = "the geocentric bound for this correction; the Sun, Moon and Mars, compared topocentric on 32 instants, fall within it";
|
|
791
883
|
} else if (kind === "barycentric" && body === "Sun") {
|
|
792
884
|
row = barycentricSun(now.dist, velocity && length(velocity));
|
|
793
885
|
estimated = `the largest angle, relative distance and rate of direction that the error of astronomy-engine's barycentre, ${BARYCENTRE_ERROR.au.toExponential()} au and ${BARYCENTRE_ERROR.auPerDay.toExponential()} au/day from 1800 to 2200, allows at this distance and speed; docs/evidence/calc-api`;
|
|
794
886
|
}
|
|
795
|
-
const ids = positionIds(body, frame, kind, correction, zodiac);
|
|
887
|
+
const ids = positionIds(body, frame, kind, correction, zodiac, from !== null);
|
|
796
888
|
if (method) ids.push(method === "analytic" ? "speed:analytic" : `speed:central-difference-${step}d`);
|
|
889
|
+
const v = center.kind === "topocentric" ? ANGVEL * (EARTH_EQUATORIAL_RADIUS_KM + Math.max(center.site.height, 0) / 1e3) / KM_PER_AU2 : 0;
|
|
890
|
+
const w = v && v / (now.dist * (1 - 1e-3)) * RAD2 * 3600;
|
|
891
|
+
const bands = timeBands(basis);
|
|
892
|
+
const { tt, ut1 } = bands;
|
|
893
|
+
const extrapolated = deltaTExtrapolated(basis, w);
|
|
894
|
+
let widen = [0, 0, 0];
|
|
895
|
+
if (extrapolated) {
|
|
896
|
+
const [after, before] = [shift(step), shift(-step)];
|
|
897
|
+
const [a, b] = [after.row, before.row];
|
|
898
|
+
const h = elapsedDays(before.basis, after.basis, 2 * step) / 2;
|
|
899
|
+
const turn = (x, y) => (x - y + 540) % 360 - 180;
|
|
900
|
+
const cos = Math.cos(now.lat * DEG2);
|
|
901
|
+
const spin = w * ANGVEL * 86400;
|
|
902
|
+
const r = now.dist;
|
|
903
|
+
widen = [
|
|
904
|
+
(Math.hypot(turn(a.raw, b.raw) * cos, a.lat - b.lat) / h / 48 + w) * tt + w * ut1,
|
|
905
|
+
r && (Math.abs(a.dist - b.dist) / h / 172800 + v) / r * tt + v / r * ut1,
|
|
906
|
+
(Math.hypot((turn(a.raw, now.raw) - turn(now.raw, b.raw)) * cos, a.lat - 2 * now.lat + b.lat) / h / h / 24 + spin) * tt + spin * ut1
|
|
907
|
+
];
|
|
908
|
+
ids.push("bounds:plus-delta-t-band");
|
|
909
|
+
}
|
|
797
910
|
const sidereal = definition === null ? null : now.ayanamsa;
|
|
798
911
|
const added = sidereal && ayanamsaBound(definition, sidereal.elongation);
|
|
912
|
+
let band = null;
|
|
913
|
+
if (speeds) {
|
|
914
|
+
const across = w / Math.cos(now.lat * DEG2);
|
|
915
|
+
band = {
|
|
916
|
+
time: bands,
|
|
917
|
+
lon: (Math.abs(speeds.lon) / 24 + across) * tt + across * ut1,
|
|
918
|
+
lat: (Math.abs(speeds.lat) / 24 + w) * tt + w * ut1,
|
|
919
|
+
dist: speeds.dist === null ? null : (Math.abs(speeds.dist) / 86400 + v) * tt + v * ut1
|
|
920
|
+
};
|
|
921
|
+
}
|
|
799
922
|
return {
|
|
800
923
|
status: "ok",
|
|
801
924
|
body,
|
|
@@ -807,23 +930,77 @@ function calc(request) {
|
|
|
807
930
|
cartesian: flags.cartesian && now.xyz ? { x: now.xyz[0], y: now.xyz[1], z: now.xyz[2], vx: velocity?.[0] ?? null, vy: velocity?.[1] ?? null, vz: velocity?.[2] ?? null } : null,
|
|
808
931
|
ayanamsa: sidereal && ayanamsaValue(definition, sidereal, frame === "ecliptic-true-of-date" ? "true" : "mean", k),
|
|
809
932
|
bounds: {
|
|
810
|
-
position:
|
|
811
|
-
|
|
933
|
+
position: stretched(
|
|
934
|
+
withAyanamsa(bound(row?.[0], "arcsec", estimated, measured), added && { value: added.position, basis: added.basis }),
|
|
935
|
+
widen[0]
|
|
936
|
+
),
|
|
937
|
+
distance: point ? null : stretched(bound(row?.[1], "relative", estimated, from ? measured : swept), widen[1]),
|
|
812
938
|
speed: method && {
|
|
813
|
-
...
|
|
939
|
+
...stretched(
|
|
940
|
+
withAyanamsa(
|
|
941
|
+
bound(row?.[2], "arcsec/day", estimated, mean ? MEAN_POINTS_SPEED_BASIS : from ? measured : swept),
|
|
942
|
+
added && { value: added.rate, basis: added.basis }
|
|
943
|
+
),
|
|
944
|
+
widen[2]
|
|
945
|
+
),
|
|
814
946
|
method,
|
|
815
947
|
stepDays: analytic ? null : step
|
|
816
948
|
}
|
|
817
949
|
},
|
|
950
|
+
band,
|
|
951
|
+
// Last, a position the pack gives that astronomy-engine gave instead says why.
|
|
952
|
+
flags: [...extrapolated ? ["delta-t-extrapolated"] : [], ...chosen?.fallback ? [chosen.fallback] : []],
|
|
818
953
|
receipt: receipt(
|
|
819
954
|
{ body, time: time.record, frame, center: centerRecord, zodiac: zodiac.record, flags },
|
|
820
955
|
[instant(basis)],
|
|
821
956
|
ids,
|
|
822
|
-
time.pin
|
|
957
|
+
time.pin,
|
|
958
|
+
band !== null,
|
|
959
|
+
chosen?.ephemeris
|
|
823
960
|
)
|
|
824
961
|
};
|
|
825
962
|
});
|
|
826
963
|
}
|
|
964
|
+
var UT1_SECOND = 1.0027378119113546 / 3600;
|
|
965
|
+
var TT_STEP = 600 / 86400;
|
|
966
|
+
function movedOnTt(at2, place, definition) {
|
|
967
|
+
return [TT_STEP, -TT_STEP].map((days) => {
|
|
968
|
+
const moved = at2.AddDays(days);
|
|
969
|
+
return {
|
|
970
|
+
input: { gastHours: gastHours({ ut: at2.ut, tt: moved.tt }), ...place, obliquity: tilt(moved.tt).tobl },
|
|
971
|
+
less: definition === null ? 0 : ayanamsaAt(definition, moved).true
|
|
972
|
+
};
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
function angleBands(input, system, bands, moved, less = 0) {
|
|
976
|
+
const values = (at2, by = 0) => {
|
|
977
|
+
const angles = computeAngles(at2);
|
|
978
|
+
return [angles.asc, angles.mc, vertexOf(at2, angles), eastPointOf(at2), ...system === "whole" ? [] : computeHouses(system, at2, angles).houses.cusps].map(
|
|
979
|
+
(value) => value - by
|
|
980
|
+
);
|
|
981
|
+
};
|
|
982
|
+
const rates = (before2, after, seconds) => after.map((value, index) => {
|
|
983
|
+
let turn = value - before2[index];
|
|
984
|
+
if (turn > 180) turn -= 360;
|
|
985
|
+
else if (turn <= -180) turn += 360;
|
|
986
|
+
return Math.abs(turn) * 3600 / seconds;
|
|
987
|
+
});
|
|
988
|
+
const before = values({ ...input, gastHours: input.gastHours - UT1_SECOND });
|
|
989
|
+
const onUt1 = rates(before, values({ ...input, gastHours: input.gastHours + UT1_SECOND }), 2);
|
|
990
|
+
let onTt = null;
|
|
991
|
+
if (moved) {
|
|
992
|
+
const [plus, minus] = moved.map((side) => values(side.input, side.less));
|
|
993
|
+
onTt = rates(minus, plus, 2 * TT_STEP * 86400);
|
|
994
|
+
const [up, down] = moved.map((side) => isPolarUndefinedHouseSystem(system) && Math.abs(side.input.latitude) >= 90 - side.input.obliquity);
|
|
995
|
+
if (up || down) {
|
|
996
|
+
const here = values(input, less);
|
|
997
|
+
const one = up ? down ? null : rates(minus, here, TT_STEP * 86400) : rates(here, plus, TT_STEP * 86400);
|
|
998
|
+
for (let index = 4; index < onTt.length; index += 1) onTt[index] = one ? one[index] : 0;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
const [asc, mc, vertex, eastPoint, ...cusps] = onUt1.map((rate, index) => rate * bands.ut1 + (onTt ? onTt[index] * bands.tt : 0));
|
|
1002
|
+
return { asc, mc, vertex, eastPoint, cusps: system === "whole" ? Array(12).fill(0) : cusps };
|
|
1003
|
+
}
|
|
827
1004
|
function houses(request) {
|
|
828
1005
|
const asked = fields(request, "houses request", ["time", "place", "houseSystem", "zodiac"]);
|
|
829
1006
|
const time = readTime(asked.time, "time");
|
|
@@ -834,9 +1011,11 @@ function houses(request) {
|
|
|
834
1011
|
if (refusal) return refusal;
|
|
835
1012
|
const definition = zodiac.definition;
|
|
836
1013
|
return inSpan(time, (used) => {
|
|
837
|
-
const
|
|
1014
|
+
const bands = timeBands(used);
|
|
1015
|
+
const { input, value, moved } = onInput(time, time.ms, (at2) => ({
|
|
838
1016
|
input: { gastHours: gastHours(at2), latitude, longitude, obliquity: tilt(at2.tt).tobl },
|
|
839
|
-
value: definition && ayanamsaAt(definition, at2)
|
|
1017
|
+
value: definition && ayanamsaAt(definition, at2),
|
|
1018
|
+
moved: bands.tt === 0 ? null : movedOnTt(at2, { latitude, longitude }, definition)
|
|
840
1019
|
}));
|
|
841
1020
|
const tropical = computeAngles(input);
|
|
842
1021
|
const { houses: computed, fellBack } = computeHouses(system, input, tropical);
|
|
@@ -846,6 +1025,11 @@ function houses(request) {
|
|
|
846
1025
|
const bounded = definition && value && ayanamsaBound(definition, value.elongation);
|
|
847
1026
|
const added = bounded && { value: bounded.position, basis: bounded.basis };
|
|
848
1027
|
const basis = (what) => `largest difference over the conformance suite's L2 ${what}, whose arbiter is ERFA with each system's definition`;
|
|
1028
|
+
const turned = angleBands(input, computed.system, bands, moved, value === null ? 0 : value.true);
|
|
1029
|
+
const late = deltaTExtrapolated(used, 1);
|
|
1030
|
+
const flags = fellBack ? ["polar-fallback"] : [];
|
|
1031
|
+
if (insidePolarCircle(input)) flags.push("polar-angles");
|
|
1032
|
+
if (late) flags.push("delta-t-extrapolated");
|
|
849
1033
|
return {
|
|
850
1034
|
status: "ok",
|
|
851
1035
|
requested: system,
|
|
@@ -857,15 +1041,22 @@ function houses(request) {
|
|
|
857
1041
|
eastPoint: zodiacal(normalizeLongitude(eastPointOf(input))),
|
|
858
1042
|
armc: ramcOf(input),
|
|
859
1043
|
obliquity: input.obliquity,
|
|
860
|
-
flags
|
|
1044
|
+
flags,
|
|
861
1045
|
ayanamsa: value && ayanamsaValue(definition, value, "true", 1),
|
|
862
1046
|
bounds: {
|
|
863
|
-
angles:
|
|
864
|
-
|
|
865
|
-
|
|
1047
|
+
angles: stretched(
|
|
1048
|
+
withAyanamsa(
|
|
1049
|
+
{ value: 0.02, unit: "arcsec", label: "measured", basis: basis("vectors of the ascendant, midheaven, Vertex and East Point") },
|
|
1050
|
+
added
|
|
1051
|
+
),
|
|
1052
|
+
late ? Math.max(turned.asc, turned.mc, turned.vertex, turned.eastPoint) : 0
|
|
866
1053
|
),
|
|
867
|
-
cusps:
|
|
1054
|
+
cusps: stretched(
|
|
1055
|
+
withAyanamsa({ value: 0.08, unit: "arcsec", label: "measured", basis: basis("cusp vectors, thirteen systems") }, added),
|
|
1056
|
+
late ? Math.max(...turned.cusps) : 0
|
|
1057
|
+
)
|
|
868
1058
|
},
|
|
1059
|
+
band: { time: bands, ...turned },
|
|
869
1060
|
receipt: receipt(
|
|
870
1061
|
{ time: time.record, place: { latitude, longitude }, houseSystem: system, zodiac: zodiac.record },
|
|
871
1062
|
[instant(used)],
|
|
@@ -876,7 +1067,8 @@ function houses(request) {
|
|
|
876
1067
|
"angles:gast-and-true-obliquity",
|
|
877
1068
|
"sidereal-time:gast-iau2006-era",
|
|
878
1069
|
"nutation:iau2000b",
|
|
879
|
-
"obliquity:iau2006"
|
|
1070
|
+
"obliquity:iau2006",
|
|
1071
|
+
...late ? ["bounds:plus-delta-t-band"] : []
|
|
880
1072
|
],
|
|
881
1073
|
time.pin
|
|
882
1074
|
)
|
|
@@ -884,6 +1076,7 @@ function houses(request) {
|
|
|
884
1076
|
});
|
|
885
1077
|
}
|
|
886
1078
|
function events(request) {
|
|
1079
|
+
refuseUnderSource("@zodiacs/engine/calc");
|
|
887
1080
|
const asked = fields(request, "events request", ["kind", "body", "longitude", "from", "to", "zodiac", "stepDays", "maxSamples"]);
|
|
888
1081
|
const kind = oneOf(asked.kind, ["longitude-crossing"], "kind");
|
|
889
1082
|
const body = oneOf(asked.body, CALC_BODIES, "body");
|
|
@@ -905,6 +1098,7 @@ function events(request) {
|
|
|
905
1098
|
const end = resolve(to);
|
|
906
1099
|
if (start === null || end === null) return outOfRange();
|
|
907
1100
|
{
|
|
1101
|
+
const chosen = ephemerisAt(Math.round(start.utcMs));
|
|
908
1102
|
const dated = (basis) => new Date(Math.round(basis.utcMs));
|
|
909
1103
|
const found = searchLongitudeCrossingsWith(
|
|
910
1104
|
longitudeAt,
|
|
@@ -918,26 +1112,47 @@ function events(request) {
|
|
|
918
1112
|
const { samples, maxSamples } = found;
|
|
919
1113
|
return { status: "refused", reason: "sample-budget", detail: `The search needs more than ${maxSamples} evaluations.`, samples, maxSamples };
|
|
920
1114
|
}
|
|
1115
|
+
let late = 0;
|
|
1116
|
+
const events2 = found.crossings.map(({ at: at2, retrograde }) => {
|
|
1117
|
+
const basis = timeBasis(at2.getTime(), "utc");
|
|
1118
|
+
const utc = timeBands(basis).tt;
|
|
1119
|
+
if (deltaTExtrapolated(basis)) late = Math.max(late, utc);
|
|
1120
|
+
return {
|
|
1121
|
+
at: at2.toISOString(),
|
|
1122
|
+
jdUt1: J2000_JD + basis.ut1Days,
|
|
1123
|
+
jdTt: J2000_JD + basis.ttDays,
|
|
1124
|
+
retrograde,
|
|
1125
|
+
band: { utc, ut1: basis.deltaT.sigma ?? 0 }
|
|
1126
|
+
};
|
|
1127
|
+
});
|
|
921
1128
|
return {
|
|
922
1129
|
status: "ok",
|
|
923
1130
|
kind,
|
|
924
|
-
events:
|
|
925
|
-
const { ut1Days, ttDays } = timeBasis(at2.getTime(), "utc");
|
|
926
|
-
return { at: at2.toISOString(), jdUt1: J2000_JD + ut1Days, jdTt: J2000_JD + ttDays, retrograde };
|
|
927
|
-
}),
|
|
1131
|
+
events: events2,
|
|
928
1132
|
samples: found.samples,
|
|
1133
|
+
flags: [...late ? ["delta-t-extrapolated"] : [], ...chosen.fallback ? [chosen.fallback] : []],
|
|
929
1134
|
bounds: {
|
|
930
|
-
timing:
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1135
|
+
timing: stretched(
|
|
1136
|
+
{
|
|
1137
|
+
value: stepDays * 86400 / 2 ** 24,
|
|
1138
|
+
unit: "s",
|
|
1139
|
+
label: "estimated",
|
|
1140
|
+
basis: "the bisection bracket, step / 2^24, on the engine's own longitudes; the ephemeris's error over the body's speed adds to it" + (definition === null ? "" : ", and in the sidereal zodiac the ayanamsa's")
|
|
1141
|
+
},
|
|
1142
|
+
late
|
|
1143
|
+
)
|
|
936
1144
|
},
|
|
937
1145
|
receipt: receipt(
|
|
938
1146
|
{ kind, body, longitude, from: from.record, to: to.record, zodiac: zodiac.record, stepDays, ...limit },
|
|
939
1147
|
[instant(start), instant(end)],
|
|
940
|
-
[
|
|
1148
|
+
[
|
|
1149
|
+
...positionIds(body, "ecliptic-true-of-date", "geocentric", "apparent", zodiac, chosen.from !== null),
|
|
1150
|
+
"search:scan-and-bisect",
|
|
1151
|
+
...late ? ["bounds:plus-delta-t-band"] : []
|
|
1152
|
+
],
|
|
1153
|
+
void 0,
|
|
1154
|
+
true,
|
|
1155
|
+
chosen.ephemeris
|
|
941
1156
|
)
|
|
942
1157
|
};
|
|
943
1158
|
}
|
|
@@ -956,6 +1171,7 @@ function siderealOfChart(computed, definition) {
|
|
|
956
1171
|
};
|
|
957
1172
|
}
|
|
958
1173
|
function chart(request) {
|
|
1174
|
+
refuseUnderSource("@zodiacs/engine/calc");
|
|
959
1175
|
const asked = fields(request, "chart request", ["time", "place", "houseSystem", "timeKnown", "timeFlags", "zodiac"]);
|
|
960
1176
|
const time = readTime(asked.time, "time");
|
|
961
1177
|
const site = asked.place === void 0 ? null : readPlace(asked.place, "place");
|
|
@@ -971,7 +1187,14 @@ function chart(request) {
|
|
|
971
1187
|
const houseSystem = settings.houseSystem ?? "whole";
|
|
972
1188
|
const timeKnown = settings.timeKnown ?? true;
|
|
973
1189
|
const possible = !timeKnown ? ["no-time"] : settings.houseSystem && isPolarUndefinedHouseSystem(houseSystem) && place ? ["polar-fallback"] : [];
|
|
1190
|
+
possible.push("delta-t-extrapolated", "de440-unavailable", "outside-de440-span");
|
|
1191
|
+
if (timeKnown && place) possible.push("polar-angles");
|
|
974
1192
|
assertDerivedFlags(supplied ?? [], possible);
|
|
1193
|
+
if ("iso" in time.record && !time.record.iso.includes("T") && settings.timeKnown !== false) {
|
|
1194
|
+
throw new RangeError(
|
|
1195
|
+
"time is a calendar date with no time. Give the birth instant with its UTC offset, such as 1990-05-03T08:30:00+02:00, or set timeKnown: false if the birth time is not known."
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
975
1198
|
const input = {
|
|
976
1199
|
utc,
|
|
977
1200
|
houseSystem,
|
|
@@ -983,11 +1206,26 @@ function chart(request) {
|
|
|
983
1206
|
};
|
|
984
1207
|
const used = instant(basis);
|
|
985
1208
|
const computed = computeChart(input);
|
|
1209
|
+
const onPack = computed.ephemeris !== void 0 && computed.ephemeris.name !== EPHEMERIS.name;
|
|
986
1210
|
assertDerivedFlags(supplied ?? [], computed.flags);
|
|
1211
|
+
const bands = timeBands(basis);
|
|
1212
|
+
const turned = computed.angles && place && (() => {
|
|
1213
|
+
const { input: angleInput, moved } = onInput(whole, whole.ms, (at2) => ({
|
|
1214
|
+
input: { gastHours: gastHours(at2), ...place, obliquity: tilt(at2.tt).tobl },
|
|
1215
|
+
moved: bands.tt === 0 ? null : movedOnTt(at2, place, null)
|
|
1216
|
+
}));
|
|
1217
|
+
return angleBands(angleInput, "whole", bands, moved);
|
|
1218
|
+
})();
|
|
987
1219
|
return {
|
|
988
1220
|
status: "ok",
|
|
989
1221
|
chart: computed,
|
|
990
1222
|
sidereal: zodiac.definition && siderealOfChart(computed, zodiac.definition),
|
|
1223
|
+
band: {
|
|
1224
|
+
time: bands,
|
|
1225
|
+
bodies: computed.bodies.map(({ body, speed }) => ({ body, lon: Math.abs(speed) / 24 * bands.tt })),
|
|
1226
|
+
asc: turned ? turned.asc : null,
|
|
1227
|
+
mc: turned ? turned.mc : null
|
|
1228
|
+
},
|
|
991
1229
|
receipt: receipt(
|
|
992
1230
|
{
|
|
993
1231
|
time: time.record,
|
|
@@ -1003,12 +1241,14 @@ function chart(request) {
|
|
|
1003
1241
|
"frame:ecliptic-true-of-date",
|
|
1004
1242
|
"center:geocentric",
|
|
1005
1243
|
"correction:apparent",
|
|
1006
|
-
"light-time:
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1244
|
+
...onPack ? ["light-time:iterated", "deflection:sun-outside-disc", "aberration:relativistic-annual", "target:system-barycentre", "node:true-osculating", ...PACK_PLACE_IDS, "precession:iau2006"] : [
|
|
1245
|
+
"light-time:newtonian",
|
|
1246
|
+
"deflection:none",
|
|
1247
|
+
"aberration:backdated-observer",
|
|
1248
|
+
"moon:series-at-instant",
|
|
1249
|
+
"node:true-osculating",
|
|
1250
|
+
"precession:iau2006"
|
|
1251
|
+
],
|
|
1012
1252
|
"nutation:iau2000b",
|
|
1013
1253
|
"obliquity:iau2006",
|
|
1014
1254
|
...computed.houses === null ? [] : [
|
|
@@ -1021,7 +1261,9 @@ function chart(request) {
|
|
|
1021
1261
|
`speed:central-difference-${STEP_DAYS}d`,
|
|
1022
1262
|
`speed:central-difference-${NODE_STEP_DAYS}d`
|
|
1023
1263
|
],
|
|
1024
|
-
time.pin
|
|
1264
|
+
time.pin,
|
|
1265
|
+
true,
|
|
1266
|
+
computed.ephemeris
|
|
1025
1267
|
)
|
|
1026
1268
|
};
|
|
1027
1269
|
});
|