@zodiacs/engine 1.0.0 → 1.1.0
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 +1020 -0
- package/LICENSING.md +168 -27
- package/NOTICE +78 -12
- package/README.md +288 -44
- package/dist/{api-WbxJ4Wj-.d.ts → api-ChL1N2Sr.d.ts} +33 -2
- package/dist/{ayanamsa--YQ46fET.d.ts → ayanamsa-ClFzkKmV.d.ts} +2 -1
- package/dist/calc.d.ts +90 -4
- package/dist/calc.js +360 -126
- package/dist/chunk-2PZYJQV5.js +83 -0
- package/dist/{chunk-7TRLIFFI.js → chunk-4XOYTBLS.js} +1 -1
- package/dist/chunk-767FTO7O.js +48 -0
- package/dist/{chunk-YIITY7Q7.js → chunk-7Y2F2IWN.js} +19 -17
- package/dist/{chunk-OG4OYTJJ.js → chunk-B4M2Y7FT.js} +1 -129
- package/dist/{chunk-PFGUCNOK.js → chunk-BMDASNPB.js} +6 -6
- package/dist/chunk-I3L4POY7.js +18 -0
- package/dist/{chunk-CHSYDKBL.js → chunk-LNGURVNH.js} +3 -3
- package/dist/{chunk-DMGHYCDI.js → chunk-NNOSOOWS.js} +1 -1
- package/dist/chunk-OVXQQEXL.js +41 -0
- package/dist/{chunk-SRXBTP5H.js → chunk-QLIEEICB.js} +201 -190
- package/dist/chunk-RMBWKZI2.js +130 -0
- package/dist/{chunk-FTX3JDJA.js → chunk-TZVPZHZM.js} +42 -23
- package/dist/{chunk-WS3TDSP3.js → chunk-WBTWY2OB.js} +7 -3
- package/dist/chunk-Y4E3WJU5.js +87 -0
- package/dist/chunk-YPU3MDNI.js +852 -0
- 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-exTSqBgb.d.ts +60 -0
- package/dist/geo.d.ts +16 -4
- package/dist/geo.js +2 -2
- package/dist/{houses-CFERsAlK.d.ts → houses-Bh7GCnPi.d.ts} +3 -3
- package/dist/houses-extra.d.ts +5 -4
- package/dist/index.d.ts +8 -6
- package/dist/index.js +40 -28
- package/dist/{internal-math-DJJ8BYex.d.ts → internal-math-CxenuGfm.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 +143 -65
- package/dist/{rulers-Dla6h_Sm.d.ts → rulers-CSSWtiWF.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-DpPdtXgO.d.ts +335 -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-BxmDCcTK.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-WBTWY2OB.js";
|
|
16
11
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
searchLongitudeCrossingsWith
|
|
21
|
-
} from "./chunk-TSS2SZWQ.js";
|
|
12
|
+
eclipticRows,
|
|
13
|
+
equatorRows
|
|
14
|
+
} from "./chunk-4XOYTBLS.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-QLIEEICB.js";
|
|
30
|
+
import {
|
|
31
|
+
dateFrom
|
|
32
|
+
} from "./chunk-CPALRSPC.js";
|
|
33
|
+
import {
|
|
34
|
+
ENGINE_VERSION,
|
|
35
|
+
EPHEMERIS
|
|
36
|
+
} from "./chunk-B4M2Y7FT.js";
|
|
37
|
+
import {
|
|
38
|
+
eclipticFrame,
|
|
39
|
+
eclipticOfDate,
|
|
40
|
+
meanEcliptic
|
|
41
|
+
} from "./chunk-2PZYJQV5.js";
|
|
40
42
|
import {
|
|
41
43
|
EPHEMERIS_SPAN,
|
|
42
44
|
REFERENCE_SPAN,
|
|
@@ -44,7 +46,14 @@ 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-767FTO7O.js";
|
|
53
|
+
import "./chunk-YPU3MDNI.js";
|
|
54
|
+
import {
|
|
55
|
+
tilt
|
|
56
|
+
} from "./chunk-Y4E3WJU5.js";
|
|
48
57
|
import {
|
|
49
58
|
computeAngles,
|
|
50
59
|
computeHouses,
|
|
@@ -52,18 +61,27 @@ import {
|
|
|
52
61
|
isPolarUndefinedHouseSystem,
|
|
53
62
|
ramcOf,
|
|
54
63
|
vertexOf
|
|
55
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-NNOSOOWS.js";
|
|
56
65
|
import {
|
|
57
|
-
ENGINE_VERSION,
|
|
58
|
-
EPHEMERIS,
|
|
59
66
|
normalizeLongitude
|
|
60
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-RMBWKZI2.js";
|
|
68
|
+
import "./chunk-BHJXUY67.js";
|
|
69
|
+
import {
|
|
70
|
+
assertDerivedFlags,
|
|
71
|
+
snapshotFlags,
|
|
72
|
+
timeFlags,
|
|
73
|
+
validateBirthSettings
|
|
74
|
+
} from "./chunk-BMDASNPB.js";
|
|
61
75
|
|
|
62
76
|
// src/calc.ts
|
|
63
|
-
import { AstroTime, GeoMoonState } from "astronomy-engine";
|
|
77
|
+
import { AstroTime, GeoMoonState, KM_PER_AU as KM_PER_AU2 } from "astronomy-engine";
|
|
64
78
|
|
|
65
79
|
// src/calc-bounds.ts
|
|
80
|
+
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";
|
|
81
|
+
var SWEPT = ["geocentric/apparent", "geocentric/astrometric", "geocentric/geometric"];
|
|
66
82
|
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";
|
|
83
|
+
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";
|
|
84
|
+
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
85
|
var BARYCENTRIC_APPARENT = {
|
|
68
86
|
"Earth": [3, 14e-6, 0.18],
|
|
69
87
|
"Jupiter": [13, 4e-5, 0.025],
|
|
@@ -76,6 +94,18 @@ var BARYCENTRIC_APPARENT = {
|
|
|
76
94
|
"Uranus": [19, 43e-6, 86e-4],
|
|
77
95
|
"Venus": [7.4, 15e-6, 0.22]
|
|
78
96
|
};
|
|
97
|
+
var GEOCENTRIC_ASTROMETRIC = {
|
|
98
|
+
"Jupiter": [17, 79e-6, 0.11],
|
|
99
|
+
"Mars": [23, 87e-6, 0.74],
|
|
100
|
+
"Mercury": [17, 78e-6, 3.6],
|
|
101
|
+
"Moon": [12, 48e-6, 2.9],
|
|
102
|
+
"Neptune": [22, 47e-6, 0.019],
|
|
103
|
+
"Pluto": [30, 63e-6, 0.018],
|
|
104
|
+
"Saturn": [24, 77e-6, 0.06],
|
|
105
|
+
"Sun": [3.4, 17e-6, 0.24],
|
|
106
|
+
"Uranus": [20, 56e-6, 0.03],
|
|
107
|
+
"Venus": [24, 83e-6, 1.4]
|
|
108
|
+
};
|
|
79
109
|
var HELIOCENTRIC_APPARENT = {
|
|
80
110
|
"Earth": [3, 15e-6, 0.18],
|
|
81
111
|
"Jupiter": [13, 4e-5, 0.025],
|
|
@@ -105,45 +135,23 @@ var MEASURED = {
|
|
|
105
135
|
},
|
|
106
136
|
"geocentric/apparent": {
|
|
107
137
|
"Black Moon Lilith": [23e-4, null, 32e-4],
|
|
108
|
-
"Jupiter": [
|
|
109
|
-
"Mars": [
|
|
138
|
+
"Jupiter": [17, 79e-6, 0.11],
|
|
139
|
+
"Mars": [23, 87e-6, 0.74],
|
|
110
140
|
"Mean Node": [23e-4, null, 81e-5],
|
|
111
141
|
"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]
|
|
142
|
+
"Mercury": [17, 78e-6, 3.6],
|
|
143
|
+
"Moon": [12, 15e-5, 2.9],
|
|
144
|
+
"Neptune": [22, 47e-6, 0.019],
|
|
145
|
+
"North Node": [33, null, null],
|
|
146
|
+
"Pluto": [30, 63e-6, 0.018],
|
|
147
|
+
"Saturn": [24, 77e-6, 0.06],
|
|
148
|
+
"South Node": [33, null, null],
|
|
149
|
+
"Sun": [3.4, 17e-6, 0.24],
|
|
150
|
+
"Uranus": [20, 56e-6, 0.03],
|
|
151
|
+
"Venus": [24, 83e-6, 1.4]
|
|
146
152
|
},
|
|
153
|
+
"geocentric/astrometric": GEOCENTRIC_ASTROMETRIC,
|
|
154
|
+
"geocentric/geometric": GEOCENTRIC_ASTROMETRIC,
|
|
147
155
|
"heliocentric/apparent": HELIOCENTRIC_APPARENT,
|
|
148
156
|
"heliocentric/astrometric": HELIOCENTRIC_APPARENT,
|
|
149
157
|
"heliocentric/geometric": {
|
|
@@ -157,24 +165,28 @@ var MEASURED = {
|
|
|
157
165
|
"Saturn": [18, 65e-6, 0.023],
|
|
158
166
|
"Uranus": [19, 42e-6, 9e-3],
|
|
159
167
|
"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
168
|
}
|
|
176
169
|
};
|
|
177
170
|
|
|
171
|
+
// src/calc-bounds-de440.ts
|
|
172
|
+
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";
|
|
173
|
+
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";
|
|
174
|
+
var DE440_MEASURED = {
|
|
175
|
+
Jupiter: 4e-3,
|
|
176
|
+
Mars: 4e-3,
|
|
177
|
+
Mercury: 4e-3,
|
|
178
|
+
Moon: 0.013,
|
|
179
|
+
Neptune: 4e-3,
|
|
180
|
+
Pluto: 4e-3,
|
|
181
|
+
Saturn: 39e-4,
|
|
182
|
+
Sun: 4e-3,
|
|
183
|
+
Uranus: 4e-3,
|
|
184
|
+
Venus: 4e-3
|
|
185
|
+
};
|
|
186
|
+
var DE440_AT_LIMB = 1.8;
|
|
187
|
+
var DE440_LIMB_BAND = 3;
|
|
188
|
+
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";
|
|
189
|
+
|
|
178
190
|
// src/calc-frames.ts
|
|
179
191
|
var CALC_FRAMES = [
|
|
180
192
|
"ecliptic-true-of-date",
|
|
@@ -328,6 +340,7 @@ function sunMotion(left, time) {
|
|
|
328
340
|
return sub(vec(BaryState(Body.Sun, left)), vec(BaryState(Body.Sun, time)));
|
|
329
341
|
}
|
|
330
342
|
function locate(body, center, correction, time) {
|
|
343
|
+
refuseUnderSource("@zodiacs/engine/calc");
|
|
331
344
|
const found = (v2, dist = length(v2)) => ({ v: v2, dist });
|
|
332
345
|
if (center.kind === "barycentric") {
|
|
333
346
|
const bary = (t) => vec(BaryState(body, t));
|
|
@@ -353,6 +366,7 @@ function locate(body, center, correction, time) {
|
|
|
353
366
|
return found(apparent, length(astrometric));
|
|
354
367
|
}
|
|
355
368
|
function geometricState(body, center, time) {
|
|
369
|
+
refuseUnderSource("@zodiacs/engine/calc");
|
|
356
370
|
if (body === Body.Moon) return null;
|
|
357
371
|
const split = (s) => ({ r: vec(s), v: [s.vx, s.vy, s.vz] });
|
|
358
372
|
if (center.kind === "barycentric") return split(BaryState(body, time));
|
|
@@ -601,18 +615,19 @@ function instant(basis) {
|
|
|
601
615
|
};
|
|
602
616
|
}
|
|
603
617
|
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) {
|
|
618
|
+
function receipt(request, instants, ids, pin, banded = true, ephemeris = EPHEMERIS) {
|
|
605
619
|
return {
|
|
606
620
|
schema: CALC_RECEIPT_SCHEMA,
|
|
607
621
|
request,
|
|
608
622
|
instants,
|
|
609
623
|
conventions: [
|
|
610
624
|
...ids,
|
|
611
|
-
`ephemeris
|
|
625
|
+
`ephemeris:${ephemeris.name}@${ephemeris.version}`,
|
|
612
626
|
pin === void 0 ? "deltat:time-basis" : "deltat:pinned",
|
|
613
|
-
TIME_BASIS_ID
|
|
627
|
+
TIME_BASIS_ID,
|
|
628
|
+
...banded ? ["time-band:first-order"] : []
|
|
614
629
|
],
|
|
615
|
-
engine: { name: "@zodiacs/engine", version: ENGINE_VERSION, ephemeris: {
|
|
630
|
+
engine: { name: "@zodiacs/engine", version: ENGINE_VERSION, ephemeris: { name: ephemeris.name, version: ephemeris.version } }
|
|
616
631
|
};
|
|
617
632
|
}
|
|
618
633
|
var isPoint = (body) => POINTS.includes(body);
|
|
@@ -643,6 +658,44 @@ function pointAt(body, at2) {
|
|
|
643
658
|
const raw = meanNodeLongitude(centuries, nutation);
|
|
644
659
|
return row(raw, normalizeLongitude(body === "Mean Node" ? raw : raw + 180));
|
|
645
660
|
}
|
|
661
|
+
var BARYCENTRES = ["Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"];
|
|
662
|
+
var packGives = (body, kind, correction) => kind === "geocentric" && (isTrueNode(body) || !isPoint(body) && body !== "Earth" && correction === "apparent");
|
|
663
|
+
function packed(from, body, frame, behind) {
|
|
664
|
+
const tidy = (lon) => lon === 360 ? 0 : lon + 0;
|
|
665
|
+
return (at2, basis) => {
|
|
666
|
+
let lon;
|
|
667
|
+
let lat = 0;
|
|
668
|
+
let dist = null;
|
|
669
|
+
if (isTrueNode(body)) {
|
|
670
|
+
const node = from.trueNode(basis.ttDays);
|
|
671
|
+
lon = body === "North Node" ? tidy(node) : normalizeLongitude(node + 180);
|
|
672
|
+
} else {
|
|
673
|
+
const place = from.place(body, basis.ttDays, behind);
|
|
674
|
+
lon = tidy(place.lon);
|
|
675
|
+
lat = place.lat;
|
|
676
|
+
dist = place.dist ?? null;
|
|
677
|
+
}
|
|
678
|
+
const scaled = (v) => dist === null ? null : [v[0] * dist, v[1] * dist, v[2] * dist];
|
|
679
|
+
const along = fromSpherical(lon, lat, 1);
|
|
680
|
+
if (frame === "ecliptic-true-of-date") return { lon, lat, dist, xyz: scaled(along), raw: lon };
|
|
681
|
+
const turned = apply(frameMatrix(frame, at2), apply(transpose(frameMatrix("ecliptic-true-of-date", at2)), along));
|
|
682
|
+
const there = toSpherical(turned);
|
|
683
|
+
return { lon: there.lon, lat: there.lat, dist, xyz: scaled(turned), raw: there.lon };
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
var SUN_RADIUS_KM = 695700;
|
|
687
|
+
function atLimb(from, body, ttDays) {
|
|
688
|
+
if (body === "Sun" || body === "Moon" || isPoint(body) || isTrueNode(body) || body === "Earth") return false;
|
|
689
|
+
const sun = from.place("Sun", ttDays);
|
|
690
|
+
const place = from.place(body, ttDays);
|
|
691
|
+
if (sun.dist === void 0 || place.dist === void 0 || !(place.dist > sun.dist)) return false;
|
|
692
|
+
const a = fromSpherical(sun.lon, sun.lat, 1);
|
|
693
|
+
const b = fromSpherical(place.lon, place.lat, 1);
|
|
694
|
+
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]);
|
|
695
|
+
const apart = Math.atan2(cross, a[0] * b[0] + a[1] * b[1] + a[2] * b[2]) * RAD2 * 3600;
|
|
696
|
+
const radius = Math.asin(SUN_RADIUS_KM / (sun.dist * KM_PER_AU2)) * RAD2 * 3600;
|
|
697
|
+
return Math.abs(apart - radius) <= DE440_LIMB_BAND;
|
|
698
|
+
}
|
|
646
699
|
function evaluator(body, frame, center, correction) {
|
|
647
700
|
if (isPoint(body)) {
|
|
648
701
|
return (at2) => {
|
|
@@ -669,8 +722,8 @@ function turnedBack([x, y, z], angle) {
|
|
|
669
722
|
}
|
|
670
723
|
function siderealOf(evaluate, definition, frame) {
|
|
671
724
|
const trueOfDate = frame === "ecliptic-true-of-date";
|
|
672
|
-
return (at2) => {
|
|
673
|
-
const row = evaluate(at2);
|
|
725
|
+
return (at2, basis) => {
|
|
726
|
+
const row = evaluate(at2, basis);
|
|
674
727
|
const value = ayanamsaAt(definition, at2);
|
|
675
728
|
const subtracted = trueOfDate ? value.true : value.mean;
|
|
676
729
|
return {
|
|
@@ -683,10 +736,15 @@ function siderealOf(evaluate, definition, frame) {
|
|
|
683
736
|
};
|
|
684
737
|
};
|
|
685
738
|
}
|
|
686
|
-
function positionIds(body, frame, kind, correction, zodiac) {
|
|
739
|
+
function positionIds(body, frame, kind, correction, zodiac, onPack = false) {
|
|
687
740
|
const ids = [...zodiac.ids, `frame:${frame}`, `center:${kind}`];
|
|
688
741
|
if (isPoint(body)) {
|
|
689
742
|
ids.push("correction:not-applicable", body.endsWith("Lilith") ? "lilith:mean" : body.startsWith("Mean") ? "node:mean" : "node:true-osculating");
|
|
743
|
+
if (onPack) ids.push(...PACK_PLACE_IDS);
|
|
744
|
+
} else if (onPack) {
|
|
745
|
+
ids.push(`correction:${correction}`, "light-time:iterated", "deflection:sun-outside-disc", "aberration:relativistic-annual");
|
|
746
|
+
if (BARYCENTRES.includes(body)) ids.push("target:system-barycentre");
|
|
747
|
+
ids.push(...PACK_PLACE_IDS);
|
|
690
748
|
} else {
|
|
691
749
|
ids.push(`correction:${correction}`);
|
|
692
750
|
if (body === "Moon" && kind === "geocentric" && correction !== "astrometric") ids.push("moon:series-at-instant");
|
|
@@ -695,6 +753,12 @@ function positionIds(body, frame, kind, correction, zodiac) {
|
|
|
695
753
|
if (correction === "apparent" && kind !== "barycentric") ids.push("aberration:backdated-observer");
|
|
696
754
|
}
|
|
697
755
|
}
|
|
756
|
+
if (onPack) {
|
|
757
|
+
ids.push("precession:iau2006", "obliquity:iau2006");
|
|
758
|
+
if (frame !== "ecliptic-true-of-date") ids.push("frame-turn:from-true-ecliptic-of-date", "nutation:iau2000b");
|
|
759
|
+
if (frame.endsWith("icrs")) ids.push("frame-bias:iau2000");
|
|
760
|
+
return ids;
|
|
761
|
+
}
|
|
698
762
|
if (isPoint(body) || !inertial(frame)) ids.push("precession:iau2006");
|
|
699
763
|
if (frame.includes("true")) ids.push("nutation:iau2000b");
|
|
700
764
|
if (isPoint(body) || frame.startsWith("ecliptic")) ids.push("obliquity:iau2006");
|
|
@@ -703,9 +767,12 @@ function positionIds(body, frame, kind, correction, zodiac) {
|
|
|
703
767
|
if (kind === "topocentric") ids.push("observer:iers2003-ellipsoid;no-polar-motion");
|
|
704
768
|
return ids;
|
|
705
769
|
}
|
|
706
|
-
|
|
707
|
-
|
|
770
|
+
var PACK_PLACE_IDS = ["place:icrf-to-true-ecliptic-of-date", "frame-bias:iau2006-fukushima-williams", "nutation:iau2000b-p03", "time:tdb-three-term"];
|
|
771
|
+
var MEAN_POINTS = ["Mean Node", "Mean South Node", "Black Moon Lilith"];
|
|
772
|
+
function bound(value, unit, estimated, measured) {
|
|
773
|
+
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
774
|
}
|
|
775
|
+
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
776
|
function up2(x) {
|
|
710
777
|
const unit = 10 ** (Math.floor(Math.log10(x)) - 1);
|
|
711
778
|
return Number((Math.ceil(x / unit) * unit).toPrecision(2));
|
|
@@ -716,6 +783,7 @@ function barycentricSun(r, v) {
|
|
|
716
783
|
return [up2(Math.asin(e / r) * RAD2 * 3600), up2(e / (r - e)), rate === null ? null : up2(rate * RAD2 * 3600)];
|
|
717
784
|
}
|
|
718
785
|
function calc(request) {
|
|
786
|
+
refuseUnderSource("@zodiacs/engine/calc");
|
|
719
787
|
const asked = fields(request, "calc request", ["body", "time", "frame", "center", "zodiac", "flags"]);
|
|
720
788
|
const body = oneOf(asked.body, CALC_BODIES, "body");
|
|
721
789
|
const time = readTime(asked.time, "time");
|
|
@@ -747,13 +815,27 @@ function calc(request) {
|
|
|
747
815
|
const correction = flags.correction;
|
|
748
816
|
const definition = zodiac.definition;
|
|
749
817
|
return inSpan(time, (basis) => {
|
|
750
|
-
const
|
|
818
|
+
const chosen = packGives(body, kind, correction) ? ephemerisAt(time.ms, time.scale, time.pin) : null;
|
|
819
|
+
const from = chosen?.from ?? null;
|
|
820
|
+
const tropical = from ? packed(from, body, frame) : evaluator(body, frame, center, correction);
|
|
751
821
|
const evaluate = definition === null ? tropical : siderealOf(tropical, definition, frame);
|
|
752
822
|
const now = onInput(time, time.ms, evaluate);
|
|
753
823
|
const step = isTrueNode(body) ? NODE_STEP_DAYS : STEP_DAYS;
|
|
754
824
|
const analytic = flags.speeds && correction === "geometric" && inertial(frame) && !point && body !== "Moon";
|
|
755
825
|
let speeds = null;
|
|
756
826
|
let velocity = null;
|
|
827
|
+
let samples = null;
|
|
828
|
+
const sampling = () => {
|
|
829
|
+
if (samples) return samples;
|
|
830
|
+
const side = from && !isTrueNode(body) ? from.place(body, basis.ttDays).behindDisc : void 0;
|
|
831
|
+
const tropicalSamples = from && side !== void 0 ? packed(from, body, frame, side) : tropical;
|
|
832
|
+
return samples = definition === null ? tropicalSamples : siderealOf(tropicalSamples, definition, frame);
|
|
833
|
+
};
|
|
834
|
+
const shift = (days) => {
|
|
835
|
+
const ms = time.ms + days * DAY_MS;
|
|
836
|
+
const at2 = sampling();
|
|
837
|
+
return onInput(time, ms, (instant2, sampled) => ({ row: at2(instant2, sampled), basis: sampled }));
|
|
838
|
+
};
|
|
757
839
|
if (analytic) {
|
|
758
840
|
const { state, turn } = onInput(time, time.ms, (at2) => ({
|
|
759
841
|
state: geometricState(body, center, at2),
|
|
@@ -762,10 +844,6 @@ function calc(request) {
|
|
|
762
844
|
velocity = apply(turn, state.v);
|
|
763
845
|
speeds = sphericalRates(apply(turn, state.r), velocity);
|
|
764
846
|
} 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
847
|
const before = shift(-step);
|
|
770
848
|
const after = shift(step);
|
|
771
849
|
const elapsed = elapsedDays(before.basis, after.basis, 2 * step);
|
|
@@ -783,19 +861,63 @@ function calc(request) {
|
|
|
783
861
|
}
|
|
784
862
|
const method = !flags.speeds ? null : analytic ? "analytic" : "central-difference";
|
|
785
863
|
const k = flags.units === "radians" ? DEG2 : 1;
|
|
786
|
-
|
|
864
|
+
const group = `${kind}/${point ? "apparent" : correction}`;
|
|
865
|
+
let row = MEASURED[group]?.[body];
|
|
787
866
|
let estimated = null;
|
|
788
|
-
|
|
867
|
+
const mean = MEAN_POINTS.includes(body);
|
|
868
|
+
const swept = SWEPT.includes(group) ? SWEPT_BASIS : MEASURED_BASIS;
|
|
869
|
+
let measured = mean ? MEAN_POINTS_BASIS : swept;
|
|
870
|
+
if (from) {
|
|
871
|
+
const position = DE440_MEASURED[body];
|
|
872
|
+
row = position === void 0 ? void 0 : [position, null, null];
|
|
873
|
+
measured = DE440_MEASURED_BASIS;
|
|
874
|
+
if (frame !== "ecliptic-true-of-date") estimated = DE440_TURNED_BASIS;
|
|
875
|
+
if (position !== void 0 && atLimb(from, body, basis.ttDays)) {
|
|
876
|
+
row = [DE440_AT_LIMB, null, null];
|
|
877
|
+
estimated = DE440_AT_LIMB_BASIS;
|
|
878
|
+
}
|
|
879
|
+
} else if (!row && kind === "topocentric") {
|
|
789
880
|
row = MEASURED[`geocentric/${correction}`]?.[body];
|
|
790
|
-
estimated = "the geocentric bound for this correction;
|
|
881
|
+
estimated = "the geocentric bound for this correction; the Sun, Moon and Mars, compared topocentric on 32 instants, fall within it";
|
|
791
882
|
} else if (kind === "barycentric" && body === "Sun") {
|
|
792
883
|
row = barycentricSun(now.dist, velocity && length(velocity));
|
|
793
884
|
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
885
|
}
|
|
795
|
-
const ids = positionIds(body, frame, kind, correction, zodiac);
|
|
886
|
+
const ids = positionIds(body, frame, kind, correction, zodiac, from !== null);
|
|
796
887
|
if (method) ids.push(method === "analytic" ? "speed:analytic" : `speed:central-difference-${step}d`);
|
|
888
|
+
const v = center.kind === "topocentric" ? ANGVEL * (EARTH_EQUATORIAL_RADIUS_KM + Math.max(center.site.height, 0) / 1e3) / KM_PER_AU2 : 0;
|
|
889
|
+
const w = v && v / (now.dist * (1 - 1e-3)) * RAD2 * 3600;
|
|
890
|
+
const bands = timeBands(basis);
|
|
891
|
+
const { tt, ut1 } = bands;
|
|
892
|
+
const extrapolated = deltaTExtrapolated(basis, w);
|
|
893
|
+
let widen = [0, 0, 0];
|
|
894
|
+
if (extrapolated) {
|
|
895
|
+
const [after, before] = [shift(step), shift(-step)];
|
|
896
|
+
const [a, b] = [after.row, before.row];
|
|
897
|
+
const h = elapsedDays(before.basis, after.basis, 2 * step) / 2;
|
|
898
|
+
const turn = (x, y) => (x - y + 540) % 360 - 180;
|
|
899
|
+
const cos = Math.cos(now.lat * DEG2);
|
|
900
|
+
const spin = w * ANGVEL * 86400;
|
|
901
|
+
const r = now.dist;
|
|
902
|
+
widen = [
|
|
903
|
+
(Math.hypot(turn(a.raw, b.raw) * cos, a.lat - b.lat) / h / 48 + w) * tt + w * ut1,
|
|
904
|
+
r && (Math.abs(a.dist - b.dist) / h / 172800 + v) / r * tt + v / r * ut1,
|
|
905
|
+
(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
|
|
906
|
+
];
|
|
907
|
+
ids.push("bounds:plus-delta-t-band");
|
|
908
|
+
}
|
|
797
909
|
const sidereal = definition === null ? null : now.ayanamsa;
|
|
798
910
|
const added = sidereal && ayanamsaBound(definition, sidereal.elongation);
|
|
911
|
+
let band = null;
|
|
912
|
+
if (speeds) {
|
|
913
|
+
const across = w / Math.cos(now.lat * DEG2);
|
|
914
|
+
band = {
|
|
915
|
+
time: bands,
|
|
916
|
+
lon: (Math.abs(speeds.lon) / 24 + across) * tt + across * ut1,
|
|
917
|
+
lat: (Math.abs(speeds.lat) / 24 + w) * tt + w * ut1,
|
|
918
|
+
dist: speeds.dist === null ? null : (Math.abs(speeds.dist) / 86400 + v) * tt + v * ut1
|
|
919
|
+
};
|
|
920
|
+
}
|
|
799
921
|
return {
|
|
800
922
|
status: "ok",
|
|
801
923
|
body,
|
|
@@ -807,23 +929,77 @@ function calc(request) {
|
|
|
807
929
|
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
930
|
ayanamsa: sidereal && ayanamsaValue(definition, sidereal, frame === "ecliptic-true-of-date" ? "true" : "mean", k),
|
|
809
931
|
bounds: {
|
|
810
|
-
position:
|
|
811
|
-
|
|
932
|
+
position: stretched(
|
|
933
|
+
withAyanamsa(bound(row?.[0], "arcsec", estimated, measured), added && { value: added.position, basis: added.basis }),
|
|
934
|
+
widen[0]
|
|
935
|
+
),
|
|
936
|
+
distance: point ? null : stretched(bound(row?.[1], "relative", estimated, from ? measured : swept), widen[1]),
|
|
812
937
|
speed: method && {
|
|
813
|
-
...
|
|
938
|
+
...stretched(
|
|
939
|
+
withAyanamsa(
|
|
940
|
+
bound(row?.[2], "arcsec/day", estimated, mean ? MEAN_POINTS_SPEED_BASIS : from ? measured : swept),
|
|
941
|
+
added && { value: added.rate, basis: added.basis }
|
|
942
|
+
),
|
|
943
|
+
widen[2]
|
|
944
|
+
),
|
|
814
945
|
method,
|
|
815
946
|
stepDays: analytic ? null : step
|
|
816
947
|
}
|
|
817
948
|
},
|
|
949
|
+
band,
|
|
950
|
+
// Last, a position the pack gives that astronomy-engine gave instead says why.
|
|
951
|
+
flags: [...extrapolated ? ["delta-t-extrapolated"] : [], ...chosen?.fallback ? [chosen.fallback] : []],
|
|
818
952
|
receipt: receipt(
|
|
819
953
|
{ body, time: time.record, frame, center: centerRecord, zodiac: zodiac.record, flags },
|
|
820
954
|
[instant(basis)],
|
|
821
955
|
ids,
|
|
822
|
-
time.pin
|
|
956
|
+
time.pin,
|
|
957
|
+
band !== null,
|
|
958
|
+
chosen?.ephemeris
|
|
823
959
|
)
|
|
824
960
|
};
|
|
825
961
|
});
|
|
826
962
|
}
|
|
963
|
+
var UT1_SECOND = 1.0027378119113546 / 3600;
|
|
964
|
+
var TT_STEP = 600 / 86400;
|
|
965
|
+
function movedOnTt(at2, place, definition) {
|
|
966
|
+
return [TT_STEP, -TT_STEP].map((days) => {
|
|
967
|
+
const moved = at2.AddDays(days);
|
|
968
|
+
return {
|
|
969
|
+
input: { gastHours: gastHours({ ut: at2.ut, tt: moved.tt }), ...place, obliquity: tilt(moved.tt).tobl },
|
|
970
|
+
less: definition === null ? 0 : ayanamsaAt(definition, moved).true
|
|
971
|
+
};
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
function angleBands(input, system, bands, moved, less = 0) {
|
|
975
|
+
const values = (at2, by = 0) => {
|
|
976
|
+
const angles = computeAngles(at2);
|
|
977
|
+
return [angles.asc, angles.mc, vertexOf(at2, angles), eastPointOf(at2), ...system === "whole" ? [] : computeHouses(system, at2, angles).houses.cusps].map(
|
|
978
|
+
(value) => value - by
|
|
979
|
+
);
|
|
980
|
+
};
|
|
981
|
+
const rates = (before2, after, seconds) => after.map((value, index) => {
|
|
982
|
+
let turn = value - before2[index];
|
|
983
|
+
if (turn > 180) turn -= 360;
|
|
984
|
+
else if (turn <= -180) turn += 360;
|
|
985
|
+
return Math.abs(turn) * 3600 / seconds;
|
|
986
|
+
});
|
|
987
|
+
const before = values({ ...input, gastHours: input.gastHours - UT1_SECOND });
|
|
988
|
+
const onUt1 = rates(before, values({ ...input, gastHours: input.gastHours + UT1_SECOND }), 2);
|
|
989
|
+
let onTt = null;
|
|
990
|
+
if (moved) {
|
|
991
|
+
const [plus, minus] = moved.map((side) => values(side.input, side.less));
|
|
992
|
+
onTt = rates(minus, plus, 2 * TT_STEP * 86400);
|
|
993
|
+
const [up, down] = moved.map((side) => isPolarUndefinedHouseSystem(system) && Math.abs(side.input.latitude) >= 90 - side.input.obliquity);
|
|
994
|
+
if (up || down) {
|
|
995
|
+
const here = values(input, less);
|
|
996
|
+
const one = up ? down ? null : rates(minus, here, TT_STEP * 86400) : rates(here, plus, TT_STEP * 86400);
|
|
997
|
+
for (let index = 4; index < onTt.length; index += 1) onTt[index] = one ? one[index] : 0;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
const [asc, mc, vertex, eastPoint, ...cusps] = onUt1.map((rate, index) => rate * bands.ut1 + (onTt ? onTt[index] * bands.tt : 0));
|
|
1001
|
+
return { asc, mc, vertex, eastPoint, cusps: system === "whole" ? Array(12).fill(0) : cusps };
|
|
1002
|
+
}
|
|
827
1003
|
function houses(request) {
|
|
828
1004
|
const asked = fields(request, "houses request", ["time", "place", "houseSystem", "zodiac"]);
|
|
829
1005
|
const time = readTime(asked.time, "time");
|
|
@@ -834,9 +1010,11 @@ function houses(request) {
|
|
|
834
1010
|
if (refusal) return refusal;
|
|
835
1011
|
const definition = zodiac.definition;
|
|
836
1012
|
return inSpan(time, (used) => {
|
|
837
|
-
const
|
|
1013
|
+
const bands = timeBands(used);
|
|
1014
|
+
const { input, value, moved } = onInput(time, time.ms, (at2) => ({
|
|
838
1015
|
input: { gastHours: gastHours(at2), latitude, longitude, obliquity: tilt(at2.tt).tobl },
|
|
839
|
-
value: definition && ayanamsaAt(definition, at2)
|
|
1016
|
+
value: definition && ayanamsaAt(definition, at2),
|
|
1017
|
+
moved: bands.tt === 0 ? null : movedOnTt(at2, { latitude, longitude }, definition)
|
|
840
1018
|
}));
|
|
841
1019
|
const tropical = computeAngles(input);
|
|
842
1020
|
const { houses: computed, fellBack } = computeHouses(system, input, tropical);
|
|
@@ -846,6 +1024,10 @@ function houses(request) {
|
|
|
846
1024
|
const bounded = definition && value && ayanamsaBound(definition, value.elongation);
|
|
847
1025
|
const added = bounded && { value: bounded.position, basis: bounded.basis };
|
|
848
1026
|
const basis = (what) => `largest difference over the conformance suite's L2 ${what}, whose arbiter is ERFA with each system's definition`;
|
|
1027
|
+
const turned = angleBands(input, computed.system, bands, moved, value === null ? 0 : value.true);
|
|
1028
|
+
const late = deltaTExtrapolated(used, 1);
|
|
1029
|
+
const flags = fellBack ? ["polar-fallback"] : [];
|
|
1030
|
+
if (late) flags.push("delta-t-extrapolated");
|
|
849
1031
|
return {
|
|
850
1032
|
status: "ok",
|
|
851
1033
|
requested: system,
|
|
@@ -857,15 +1039,22 @@ function houses(request) {
|
|
|
857
1039
|
eastPoint: zodiacal(normalizeLongitude(eastPointOf(input))),
|
|
858
1040
|
armc: ramcOf(input),
|
|
859
1041
|
obliquity: input.obliquity,
|
|
860
|
-
flags
|
|
1042
|
+
flags,
|
|
861
1043
|
ayanamsa: value && ayanamsaValue(definition, value, "true", 1),
|
|
862
1044
|
bounds: {
|
|
863
|
-
angles:
|
|
864
|
-
|
|
865
|
-
|
|
1045
|
+
angles: stretched(
|
|
1046
|
+
withAyanamsa(
|
|
1047
|
+
{ value: 0.02, unit: "arcsec", label: "measured", basis: basis("vectors of the ascendant, midheaven, Vertex and East Point") },
|
|
1048
|
+
added
|
|
1049
|
+
),
|
|
1050
|
+
late ? Math.max(turned.asc, turned.mc, turned.vertex, turned.eastPoint) : 0
|
|
866
1051
|
),
|
|
867
|
-
cusps:
|
|
1052
|
+
cusps: stretched(
|
|
1053
|
+
withAyanamsa({ value: 0.08, unit: "arcsec", label: "measured", basis: basis("cusp vectors, thirteen systems") }, added),
|
|
1054
|
+
late ? Math.max(...turned.cusps) : 0
|
|
1055
|
+
)
|
|
868
1056
|
},
|
|
1057
|
+
band: { time: bands, ...turned },
|
|
869
1058
|
receipt: receipt(
|
|
870
1059
|
{ time: time.record, place: { latitude, longitude }, houseSystem: system, zodiac: zodiac.record },
|
|
871
1060
|
[instant(used)],
|
|
@@ -876,7 +1065,8 @@ function houses(request) {
|
|
|
876
1065
|
"angles:gast-and-true-obliquity",
|
|
877
1066
|
"sidereal-time:gast-iau2006-era",
|
|
878
1067
|
"nutation:iau2000b",
|
|
879
|
-
"obliquity:iau2006"
|
|
1068
|
+
"obliquity:iau2006",
|
|
1069
|
+
...late ? ["bounds:plus-delta-t-band"] : []
|
|
880
1070
|
],
|
|
881
1071
|
time.pin
|
|
882
1072
|
)
|
|
@@ -884,6 +1074,7 @@ function houses(request) {
|
|
|
884
1074
|
});
|
|
885
1075
|
}
|
|
886
1076
|
function events(request) {
|
|
1077
|
+
refuseUnderSource("@zodiacs/engine/calc");
|
|
887
1078
|
const asked = fields(request, "events request", ["kind", "body", "longitude", "from", "to", "zodiac", "stepDays", "maxSamples"]);
|
|
888
1079
|
const kind = oneOf(asked.kind, ["longitude-crossing"], "kind");
|
|
889
1080
|
const body = oneOf(asked.body, CALC_BODIES, "body");
|
|
@@ -905,6 +1096,7 @@ function events(request) {
|
|
|
905
1096
|
const end = resolve(to);
|
|
906
1097
|
if (start === null || end === null) return outOfRange();
|
|
907
1098
|
{
|
|
1099
|
+
const chosen = ephemerisAt(Math.round(start.utcMs));
|
|
908
1100
|
const dated = (basis) => new Date(Math.round(basis.utcMs));
|
|
909
1101
|
const found = searchLongitudeCrossingsWith(
|
|
910
1102
|
longitudeAt,
|
|
@@ -918,26 +1110,47 @@ function events(request) {
|
|
|
918
1110
|
const { samples, maxSamples } = found;
|
|
919
1111
|
return { status: "refused", reason: "sample-budget", detail: `The search needs more than ${maxSamples} evaluations.`, samples, maxSamples };
|
|
920
1112
|
}
|
|
1113
|
+
let late = 0;
|
|
1114
|
+
const events2 = found.crossings.map(({ at: at2, retrograde }) => {
|
|
1115
|
+
const basis = timeBasis(at2.getTime(), "utc");
|
|
1116
|
+
const utc = timeBands(basis).tt;
|
|
1117
|
+
if (deltaTExtrapolated(basis)) late = Math.max(late, utc);
|
|
1118
|
+
return {
|
|
1119
|
+
at: at2.toISOString(),
|
|
1120
|
+
jdUt1: J2000_JD + basis.ut1Days,
|
|
1121
|
+
jdTt: J2000_JD + basis.ttDays,
|
|
1122
|
+
retrograde,
|
|
1123
|
+
band: { utc, ut1: basis.deltaT.sigma ?? 0 }
|
|
1124
|
+
};
|
|
1125
|
+
});
|
|
921
1126
|
return {
|
|
922
1127
|
status: "ok",
|
|
923
1128
|
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
|
-
}),
|
|
1129
|
+
events: events2,
|
|
928
1130
|
samples: found.samples,
|
|
1131
|
+
flags: [...late ? ["delta-t-extrapolated"] : [], ...chosen.fallback ? [chosen.fallback] : []],
|
|
929
1132
|
bounds: {
|
|
930
|
-
timing:
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1133
|
+
timing: stretched(
|
|
1134
|
+
{
|
|
1135
|
+
value: stepDays * 86400 / 2 ** 24,
|
|
1136
|
+
unit: "s",
|
|
1137
|
+
label: "estimated",
|
|
1138
|
+
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")
|
|
1139
|
+
},
|
|
1140
|
+
late
|
|
1141
|
+
)
|
|
936
1142
|
},
|
|
937
1143
|
receipt: receipt(
|
|
938
1144
|
{ kind, body, longitude, from: from.record, to: to.record, zodiac: zodiac.record, stepDays, ...limit },
|
|
939
1145
|
[instant(start), instant(end)],
|
|
940
|
-
[
|
|
1146
|
+
[
|
|
1147
|
+
...positionIds(body, "ecliptic-true-of-date", "geocentric", "apparent", zodiac, chosen.from !== null),
|
|
1148
|
+
"search:scan-and-bisect",
|
|
1149
|
+
...late ? ["bounds:plus-delta-t-band"] : []
|
|
1150
|
+
],
|
|
1151
|
+
void 0,
|
|
1152
|
+
true,
|
|
1153
|
+
chosen.ephemeris
|
|
941
1154
|
)
|
|
942
1155
|
};
|
|
943
1156
|
}
|
|
@@ -956,6 +1169,7 @@ function siderealOfChart(computed, definition) {
|
|
|
956
1169
|
};
|
|
957
1170
|
}
|
|
958
1171
|
function chart(request) {
|
|
1172
|
+
refuseUnderSource("@zodiacs/engine/calc");
|
|
959
1173
|
const asked = fields(request, "chart request", ["time", "place", "houseSystem", "timeKnown", "timeFlags", "zodiac"]);
|
|
960
1174
|
const time = readTime(asked.time, "time");
|
|
961
1175
|
const site = asked.place === void 0 ? null : readPlace(asked.place, "place");
|
|
@@ -971,6 +1185,7 @@ function chart(request) {
|
|
|
971
1185
|
const houseSystem = settings.houseSystem ?? "whole";
|
|
972
1186
|
const timeKnown = settings.timeKnown ?? true;
|
|
973
1187
|
const possible = !timeKnown ? ["no-time"] : settings.houseSystem && isPolarUndefinedHouseSystem(houseSystem) && place ? ["polar-fallback"] : [];
|
|
1188
|
+
possible.push("delta-t-extrapolated", "de440-unavailable", "outside-de440-span");
|
|
974
1189
|
assertDerivedFlags(supplied ?? [], possible);
|
|
975
1190
|
const input = {
|
|
976
1191
|
utc,
|
|
@@ -983,11 +1198,26 @@ function chart(request) {
|
|
|
983
1198
|
};
|
|
984
1199
|
const used = instant(basis);
|
|
985
1200
|
const computed = computeChart(input);
|
|
1201
|
+
const onPack = computed.ephemeris !== void 0 && computed.ephemeris.name !== EPHEMERIS.name;
|
|
986
1202
|
assertDerivedFlags(supplied ?? [], computed.flags);
|
|
1203
|
+
const bands = timeBands(basis);
|
|
1204
|
+
const turned = computed.angles && place && (() => {
|
|
1205
|
+
const { input: angleInput, moved } = onInput(whole, whole.ms, (at2) => ({
|
|
1206
|
+
input: { gastHours: gastHours(at2), ...place, obliquity: tilt(at2.tt).tobl },
|
|
1207
|
+
moved: bands.tt === 0 ? null : movedOnTt(at2, place, null)
|
|
1208
|
+
}));
|
|
1209
|
+
return angleBands(angleInput, "whole", bands, moved);
|
|
1210
|
+
})();
|
|
987
1211
|
return {
|
|
988
1212
|
status: "ok",
|
|
989
1213
|
chart: computed,
|
|
990
1214
|
sidereal: zodiac.definition && siderealOfChart(computed, zodiac.definition),
|
|
1215
|
+
band: {
|
|
1216
|
+
time: bands,
|
|
1217
|
+
bodies: computed.bodies.map(({ body, speed }) => ({ body, lon: Math.abs(speed) / 24 * bands.tt })),
|
|
1218
|
+
asc: turned ? turned.asc : null,
|
|
1219
|
+
mc: turned ? turned.mc : null
|
|
1220
|
+
},
|
|
991
1221
|
receipt: receipt(
|
|
992
1222
|
{
|
|
993
1223
|
time: time.record,
|
|
@@ -1003,12 +1233,14 @@ function chart(request) {
|
|
|
1003
1233
|
"frame:ecliptic-true-of-date",
|
|
1004
1234
|
"center:geocentric",
|
|
1005
1235
|
"correction:apparent",
|
|
1006
|
-
"light-time:
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1236
|
+
...onPack ? ["light-time:iterated", "deflection:sun-outside-disc", "aberration:relativistic-annual", "target:system-barycentre", "node:true-osculating", ...PACK_PLACE_IDS, "precession:iau2006"] : [
|
|
1237
|
+
"light-time:newtonian",
|
|
1238
|
+
"deflection:none",
|
|
1239
|
+
"aberration:backdated-observer",
|
|
1240
|
+
"moon:series-at-instant",
|
|
1241
|
+
"node:true-osculating",
|
|
1242
|
+
"precession:iau2006"
|
|
1243
|
+
],
|
|
1012
1244
|
"nutation:iau2000b",
|
|
1013
1245
|
"obliquity:iau2006",
|
|
1014
1246
|
...computed.houses === null ? [] : [
|
|
@@ -1021,7 +1253,9 @@ function chart(request) {
|
|
|
1021
1253
|
`speed:central-difference-${STEP_DAYS}d`,
|
|
1022
1254
|
`speed:central-difference-${NODE_STEP_DAYS}d`
|
|
1023
1255
|
],
|
|
1024
|
-
time.pin
|
|
1256
|
+
time.pin,
|
|
1257
|
+
true,
|
|
1258
|
+
computed.ephemeris
|
|
1025
1259
|
)
|
|
1026
1260
|
};
|
|
1027
1261
|
});
|