VBMicrolensing 5.1.1__cp311-cp311-macosx_11_0_arm64.whl → 5.3__cp311-cp311-macosx_11_0_arm64.whl
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.
Potentially problematic release.
This version of VBMicrolensing might be problematic. Click here for more details.
- VBMicrolensing/VBMicrolensing.so +0 -0
- VBMicrolensing/__init__.py +1 -0
- VBMicrolensing/data/SunEphemeris.txt +22130 -0
- VBMicrolensing/lib/VBMicrolensingLibrary.cpp +578 -190
- VBMicrolensing/lib/VBMicrolensingLibrary.h +21 -8
- VBMicrolensing/lib/python_bindings.cpp +318 -2
- {vbmicrolensing-5.1.1.dist-info → vbmicrolensing-5.3.dist-info}/METADATA +4 -3
- vbmicrolensing-5.3.dist-info/RECORD +14 -0
- {vbmicrolensing-5.1.1.dist-info → vbmicrolensing-5.3.dist-info}/WHEEL +1 -1
- vbmicrolensing-5.1.1.dist-info/RECORD +0 -13
- {vbmicrolensing-5.1.1.dist-info → vbmicrolensing-5.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// VBMicrolensing v5.
|
|
1
|
+
// VBMicrolensing v5.3 (2025)
|
|
2
2
|
//
|
|
3
3
|
// This code has been developed by Valerio Bozza (University of Salerno) and collaborators.
|
|
4
4
|
// Check the repository at https://github.com/valboz/VBMicrolensing
|
|
@@ -252,7 +252,8 @@ public:
|
|
|
252
252
|
|
|
253
253
|
#pragma endregion
|
|
254
254
|
|
|
255
|
-
char VBMicrolensing::ESPLtablefile[1024] = "
|
|
255
|
+
char VBMicrolensing::ESPLtablefile[1024] = "placeholder";
|
|
256
|
+
char VBMicrolensing::Suntablefile[1024] = "placeholder";
|
|
256
257
|
|
|
257
258
|
#pragma region Constructor/destructor
|
|
258
259
|
|
|
@@ -277,13 +278,17 @@ VBMicrolensing::VBMicrolensing() {
|
|
|
277
278
|
t0old = 0.;
|
|
278
279
|
Tol = 1.e-2;
|
|
279
280
|
RelTol = 0;
|
|
280
|
-
|
|
281
|
+
suntable = false;
|
|
282
|
+
parallaxephemeris = true;
|
|
281
283
|
possat = 0;
|
|
282
284
|
nsat = 0;
|
|
283
285
|
ndatasat = 0;
|
|
286
|
+
startsat = 0;
|
|
287
|
+
stepsat = 0;
|
|
284
288
|
satellite = 0;
|
|
285
289
|
parallaxsystem = 1;
|
|
286
|
-
t0_par_fixed =
|
|
290
|
+
t0_par_fixed = 0;
|
|
291
|
+
coordinates_set = false;
|
|
287
292
|
t0_par = 7000;
|
|
288
293
|
minannuli = 1;
|
|
289
294
|
maxannuli = 100;
|
|
@@ -328,6 +333,7 @@ VBMicrolensing::VBMicrolensing() {
|
|
|
328
333
|
CumulativeFunction = &VBDefaultCumulativeFunction;
|
|
329
334
|
SelectedMethod = Method::Nopoly;
|
|
330
335
|
turn_off_secondary_source = turn_off_secondary_lens = false;
|
|
336
|
+
t_in_HJD = true;
|
|
331
337
|
// testnewcoefs = true;
|
|
332
338
|
}
|
|
333
339
|
|
|
@@ -335,12 +341,16 @@ VBMicrolensing::~VBMicrolensing() {
|
|
|
335
341
|
if (nsat) {
|
|
336
342
|
for (int i = 0; i < nsat; i++) {
|
|
337
343
|
for (int j = 0; j < ndatasat[i]; j++) free(possat[i][j]);
|
|
338
|
-
free(tsat[i]);
|
|
339
344
|
free(possat[i]);
|
|
340
345
|
}
|
|
341
|
-
free(tsat);
|
|
342
346
|
free(possat);
|
|
343
347
|
free(ndatasat);
|
|
348
|
+
free(startsat);
|
|
349
|
+
free(stepsat);
|
|
350
|
+
}
|
|
351
|
+
if (suntable) {
|
|
352
|
+
for (int j = 0; j < ndataEar; j++) free(posEar[j]);
|
|
353
|
+
free(posEar);
|
|
344
354
|
}
|
|
345
355
|
|
|
346
356
|
if (m) {
|
|
@@ -460,7 +470,7 @@ VBMicrolensing::~VBMicrolensing() {
|
|
|
460
470
|
#pragma region single-source-mag
|
|
461
471
|
|
|
462
472
|
|
|
463
|
-
void VBMicrolensing::LoadESPLTable(char* filename) {
|
|
473
|
+
void VBMicrolensing::LoadESPLTable(const char* filename) {
|
|
464
474
|
FILE* f;
|
|
465
475
|
|
|
466
476
|
if ((f = fopen(filename, "rb")) != 0) {
|
|
@@ -4845,8 +4855,8 @@ void VBMicrolensing::ComputeCentroids(double* pr, double t, double* c1s, double*
|
|
|
4845
4855
|
c1 = c1prov; // Now centroid coordinates are in North-East system, but still relative to lens
|
|
4846
4856
|
|
|
4847
4857
|
// Lens centroid in the sky
|
|
4848
|
-
c1l[0] = muL1 * (t - t0_par) + paiL * (Ehel[0] - Et0[0]); // Note that Ehel is in South-West system
|
|
4849
|
-
c2l[0] = muL2 * (t - t0_par) + paiL * (Ehel[1] - Et0[1]);
|
|
4858
|
+
c1l[0] = muL1 * (t +lighttravel - t0_par - lighttravel0) + paiL * (Ehel[0] - Et0[0]); // Note that Ehel is in South-West system
|
|
4859
|
+
c2l[0] = muL2 * (t +lighttravel - t0_par - lighttravel0) + paiL * (Ehel[1] - Et0[1]);
|
|
4850
4860
|
// Image centroid is finally composed with lens centroid
|
|
4851
4861
|
c1s[0] = c1 + c1l[0];
|
|
4852
4862
|
c2s[0] = c2 + c2l[0];
|
|
@@ -4875,7 +4885,7 @@ void VBMicrolensing::PSPLAstroLightCurve(double* pr, double* ts, double* mags, d
|
|
|
4875
4885
|
|
|
4876
4886
|
for (int i = 0; i < np; i++) {
|
|
4877
4887
|
ComputeParallax(ts[i], t0);
|
|
4878
|
-
tn = (ts[i] - t0) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
4888
|
+
tn = (ts[i] + lighttravel - t0) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
4879
4889
|
u1 = u0 + pai1 * Et[1] - pai2 * Et[0];
|
|
4880
4890
|
u = sqrt(tn * tn + u1 * u1);
|
|
4881
4891
|
|
|
@@ -4906,7 +4916,7 @@ void VBMicrolensing::ESPLAstroLightCurve(double* pr, double* ts, double* mags, d
|
|
|
4906
4916
|
|
|
4907
4917
|
for (int i = 0; i < np; i++) {
|
|
4908
4918
|
ComputeParallax(ts[i], t0);
|
|
4909
|
-
tn = (ts[i] - t0) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
4919
|
+
tn = (ts[i] +lighttravel - t0) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
4910
4920
|
u1 = u0 + pai1 * Et[1] - pai2 * Et[0];
|
|
4911
4921
|
u = sqrt(tn * tn + u1 * u1);
|
|
4912
4922
|
|
|
@@ -4937,7 +4947,7 @@ void VBMicrolensing::BinaryAstroLightCurve(double* pr, double* ts, double* mags,
|
|
|
4937
4947
|
|
|
4938
4948
|
for (int i = 0; i < np; i++) {
|
|
4939
4949
|
ComputeParallax(ts[i], t0);
|
|
4940
|
-
tn = (ts[i] -
|
|
4950
|
+
tn = (ts[i] + lighttravel - t0_par) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
4941
4951
|
u = u0 + pai1 * Et[1] - pai2 * Et[0];
|
|
4942
4952
|
|
|
4943
4953
|
y1s[i] = u * salpha - tn * calpha;
|
|
@@ -4997,14 +5007,14 @@ void VBMicrolensing::BinaryAstroLightCurveOrbital(double* pr, double* ts, double
|
|
|
4997
5007
|
for (int i = 0; i < np; i++) {
|
|
4998
5008
|
ComputeParallax(ts[i], t0);
|
|
4999
5009
|
|
|
5000
|
-
phi = (ts[i] - t0_par) * w + phi0;
|
|
5010
|
+
phi = (ts[i] + lighttravel - t0_par - lighttravel0) * w + phi0;
|
|
5001
5011
|
Cphi = cos(phi);
|
|
5002
5012
|
Sphi = sin(phi);
|
|
5003
5013
|
den = sqrt(Cphi * Cphi + Cinc * Cinc * Sphi * Sphi);
|
|
5004
5014
|
seps[i] = s_true * den; // projected separation at time ts[i]
|
|
5005
5015
|
|
|
5006
5016
|
u = u0 + pai1 * Et[1] - pai2 * Et[0];
|
|
5007
|
-
tn = (ts[i] - t0) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
5017
|
+
tn = (ts[i] + lighttravel - t0) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
5008
5018
|
y1s[i] = (Cphi * (u * SOm - tn * COm) + Cinc * Sphi * (u * COm + tn * SOm)) / den;
|
|
5009
5019
|
y2s[i] = (-Cphi * (u * COm + tn * SOm) - Cinc * Sphi * (tn * COm - u * SOm)) / den;
|
|
5010
5020
|
mags[i] = BinaryMag2(seps[i], q, y1s[i], y2s[i], rho);
|
|
@@ -5081,7 +5091,7 @@ void VBMicrolensing::BinaryAstroLightCurveKepler(double* pr, double* ts, double*
|
|
|
5081
5091
|
|
|
5082
5092
|
for (int i = 0; i < np; i++) {
|
|
5083
5093
|
ComputeParallax(ts[i], t0);
|
|
5084
|
-
M = n * (ts[i] - tperi);
|
|
5094
|
+
M = n * (ts[i] + lighttravel - tperi - lighttravel0);
|
|
5085
5095
|
while (M > M_PI) M -= 2 * M_PI;
|
|
5086
5096
|
while (M < -M_PI) M += 2 * M_PI;
|
|
5087
5097
|
EE = M + e * sin(M);
|
|
@@ -5102,7 +5112,7 @@ void VBMicrolensing::BinaryAstroLightCurveKepler(double* pr, double* ts, double*
|
|
|
5102
5112
|
St = sqrt(x[0] * x[0] + x[1] * x[1]);
|
|
5103
5113
|
psi = atan2(x[1], x[0]);// +((ar > 1) ? 0 : M_PI);
|
|
5104
5114
|
u = u0 + pai1 * Et[1] - pai2 * Et[0];
|
|
5105
|
-
tn = (ts[i] - t0) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
5115
|
+
tn = (ts[i] + lighttravel - t0) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
5106
5116
|
y1s[i] = -tn * cos(alpha + psi) + u * sin(alpha + psi);
|
|
5107
5117
|
y2s[i] = -u * cos(alpha + psi) - tn * sin(alpha + psi);
|
|
5108
5118
|
seps[i] = St;
|
|
@@ -5200,11 +5210,11 @@ void VBMicrolensing::BinSourceAstroLightCurveXallarap(double* pr, double* ts, do
|
|
|
5200
5210
|
paiuB = pai1 * Et[1] - pai2 * Et[0]; // Parallax correction referred to tB
|
|
5201
5211
|
|
|
5202
5212
|
// Position of barycenter
|
|
5203
|
-
tnB = (ts[i] - t0) * vt0B - t0B + paitB * cos(alpha) - paiuB * sin(alpha);
|
|
5204
|
-
uB = u0B + vuB * (ts[i] - t0) + paitB * sin(alpha) + paiuB * cos(alpha);
|
|
5213
|
+
tnB = (ts[i] + lighttravel - t0) * vt0B - t0B + paitB * cos(alpha) - paiuB * sin(alpha);
|
|
5214
|
+
uB = u0B + vuB * (ts[i]+ lighttravel - t0) + paitB * sin(alpha) + paiuB * cos(alpha);
|
|
5205
5215
|
|
|
5206
5216
|
// Position of relative particle
|
|
5207
|
-
phi = wtot * (ts[i] - t0) + phi0;
|
|
5217
|
+
phi = wtot * (ts[i] + lighttravel - t0) + phi0;
|
|
5208
5218
|
xt = (Om[0] * cos(phi) + Y[0] * sin(phi));
|
|
5209
5219
|
xu = (Om[1] * cos(phi) + Y[1] * sin(phi));
|
|
5210
5220
|
|
|
@@ -5247,6 +5257,182 @@ void VBMicrolensing::BinSourceAstroLightCurveXallarap(double* pr, double* ts, do
|
|
|
5247
5257
|
}
|
|
5248
5258
|
|
|
5249
5259
|
}
|
|
5260
|
+
|
|
5261
|
+
|
|
5262
|
+
void VBMicrolensing::BinSourceBinLensAstroLightCurve(double* pr, double* ts, double* mags, double* c1s, double* c2s, double* c1l, double* c2l, double* y1s, double* y2s, double* y1s2, double* y2s2, double *seps, int np) {
|
|
5263
|
+
double tn, u, FRl, s = exp(pr[0]), q = exp(pr[1]), w1 = pr[9], w2 = pr[10], w3 = pr[11];
|
|
5264
|
+
tE_inv = exp(-pr[5]);
|
|
5265
|
+
|
|
5266
|
+
double ws[3] = { pr[15] + 1.01e-15, pr[16] + 1.01e-15, pr[17] + 1.01e-15 };
|
|
5267
|
+
double t01 = pr[6], t02 = pr[13] + ws[0] * (pr[13] - pr[6]) / tE_inv, u1 = pr[2], u2 = pr[12] + ws[1] * (pr[6] - pr[13]), FR = exp(pr[14]), rho2, xt, xu;
|
|
5268
|
+
double ss[3] = { (t01 - t02) * tE_inv,u2 - u1,0 };
|
|
5269
|
+
double L[3], Om[3], Y[3], norm, normOm, s3D, wstot, qs,phis0;
|
|
5270
|
+
double u0B, t0B, vuB, vt0B, s1, s2, uB, tnB, paitB, paiuB, alphas;
|
|
5271
|
+
|
|
5272
|
+
// Binary lens calculations
|
|
5273
|
+
u0 = pr[2];
|
|
5274
|
+
t0 = pr[6];
|
|
5275
|
+
rho = exp(pr[4]);
|
|
5276
|
+
pai1 = pr[7];
|
|
5277
|
+
pai2 = pr[8];
|
|
5278
|
+
alpha = pr[3];
|
|
5279
|
+
iastro = 18;
|
|
5280
|
+
double salpha = sin(pr[3]), calpha = cos(pr[3]);
|
|
5281
|
+
double w, phi0, inc, phi, Cinc, Sinc, Cphi, Sphi, Cphi0, Sphi0, pphi0, COm, SOm, s_true;
|
|
5282
|
+
double w13, w123, den, den0;
|
|
5283
|
+
t0old = 1.e200;
|
|
5284
|
+
|
|
5285
|
+
w13 = w1 * w1 + w3 * w3;
|
|
5286
|
+
w123 = sqrt(w13 + w2 * w2);
|
|
5287
|
+
w13 = sqrt(w13);
|
|
5288
|
+
if (w13 > 1.e-8) {
|
|
5289
|
+
w3 = (w3 > 1.e-8) ? w3 : 1.e-8;
|
|
5290
|
+
w = w3 * w123 / w13;
|
|
5291
|
+
inc = acos(w2 * w3 / w13 / w123);
|
|
5292
|
+
phi0 = atan2(-w1 * w123, w3 * w13);
|
|
5293
|
+
}
|
|
5294
|
+
else {
|
|
5295
|
+
w = w2;
|
|
5296
|
+
inc = 0.;
|
|
5297
|
+
phi0 = 0.;
|
|
5298
|
+
}
|
|
5299
|
+
Cphi0 = cos(phi0);
|
|
5300
|
+
Sphi0 = sin(phi0);
|
|
5301
|
+
Cinc = cos(inc);
|
|
5302
|
+
Sinc = sin(inc);
|
|
5303
|
+
den0 = sqrt(Cphi0 * Cphi0 + Cinc * Cinc * Sphi0 * Sphi0);
|
|
5304
|
+
s_true = s / den0; // orbital radius
|
|
5305
|
+
COm = (Cphi0 * calpha + Cinc * salpha * Sphi0) / den0;
|
|
5306
|
+
SOm = (Cphi0 * salpha - Cinc * calpha * Sphi0) / den0;
|
|
5307
|
+
pphi0 = atan2(Cinc * Sphi0, Cphi0);
|
|
5308
|
+
|
|
5309
|
+
// Binary source calculations
|
|
5310
|
+
|
|
5311
|
+
ss[2] = -(ss[0] * ws[0] + ss[1] * ws[1]) / ws[2]; // Impose velocity orthogonal to position
|
|
5312
|
+
s3D = sqrt(ss[0] * ss[0] + ss[1] * ss[1] + ss[2] * ss[2]);
|
|
5313
|
+
wstot = sqrt(ws[0] * ws[0] + ws[1] * ws[1] + ws[2] * ws[2]) / s3D; // Angular velocity
|
|
5314
|
+
|
|
5315
|
+
// Angular momentum
|
|
5316
|
+
L[0] = ss[1] * ws[2] - ss[2] * ws[1];
|
|
5317
|
+
L[1] = ss[2] * ws[0] - ss[0] * ws[2];
|
|
5318
|
+
L[2] = ss[0] * ws[1] - ss[1] * ws[0];
|
|
5319
|
+
normOm = L[0] * L[0] + L[1] * L[1];
|
|
5320
|
+
norm = sqrt(normOm + L[2] * L[2]);
|
|
5321
|
+
normOm = sqrt(normOm);
|
|
5322
|
+
// Node line
|
|
5323
|
+
if (normOm > 0) {
|
|
5324
|
+
Om[0] = -L[1] / normOm;
|
|
5325
|
+
Om[1] = L[0] / normOm;
|
|
5326
|
+
Om[2] = 0;
|
|
5327
|
+
for (int i = 0; i < 3; i++) L[i] /= norm;
|
|
5328
|
+
}
|
|
5329
|
+
else {
|
|
5330
|
+
Om[0] = 1;
|
|
5331
|
+
Om[1] = 0 / normOm;
|
|
5332
|
+
Om[2] = 0;
|
|
5333
|
+
L[0] = 0;
|
|
5334
|
+
L[1] = -1;
|
|
5335
|
+
L[2] = 0;
|
|
5336
|
+
}
|
|
5337
|
+
|
|
5338
|
+
|
|
5339
|
+
// Orthogonal axis
|
|
5340
|
+
Y[0] = -L[2] * Om[1];
|
|
5341
|
+
Y[1] = L[2] * Om[0];
|
|
5342
|
+
Y[2] = L[0] * Om[1] - L[1] * Om[0];
|
|
5343
|
+
|
|
5344
|
+
// Phase at time t0
|
|
5345
|
+
norm = (ss[0] * Om[0] + ss[1] * Om[1]) / s3D;
|
|
5346
|
+
if (norm >= 1) norm = 0.99999999999999;
|
|
5347
|
+
if (norm <= -1) norm = -0.99999999999999;
|
|
5348
|
+
phis0 = acos(norm);
|
|
5349
|
+
if (ss[2] < 0) phis0 = -phis0;
|
|
5350
|
+
|
|
5351
|
+
// Mass ratio
|
|
5352
|
+
qs = exp(pr[14] / mass_luminosity_exponent);
|
|
5353
|
+
// Position of barycenter at t0
|
|
5354
|
+
t0B = (t01 + t02 * qs) / (1 + qs);
|
|
5355
|
+
u0B = (u1 + u2 * qs) / (1 + qs);
|
|
5356
|
+
t0B = (t0B - t0) * tE_inv;
|
|
5357
|
+
// Velocity of barycenter
|
|
5358
|
+
vt0B = ws[0] * qs / (1 + qs) + tE_inv;
|
|
5359
|
+
vuB = ws[1] * qs / (1 + qs);
|
|
5360
|
+
alphas = atan2(vuB, vt0B);
|
|
5361
|
+
alpha += alphas;
|
|
5362
|
+
tE_inv = sqrt(vuB * vuB + vt0B * vt0B);
|
|
5363
|
+
// Relative distances from barycenter
|
|
5364
|
+
s2 = s3D / (1 + qs);
|
|
5365
|
+
s1 = s2 * qs;
|
|
5366
|
+
|
|
5367
|
+
|
|
5368
|
+
for (int i = 0; i < np; i++) {
|
|
5369
|
+
ComputeParallax(ts[i], t0);
|
|
5370
|
+
|
|
5371
|
+
// Binary lens calculation
|
|
5372
|
+
phi = (ts[i] + lighttravel - t0) * w + phi0;
|
|
5373
|
+
Cphi = cos(phi);
|
|
5374
|
+
Sphi = sin(phi);
|
|
5375
|
+
den = sqrt(Cphi * Cphi + Cinc * Cinc * Sphi * Sphi);
|
|
5376
|
+
seps[i] = s_true * den; // projected separation at time ts[i]
|
|
5377
|
+
|
|
5378
|
+
// Binary source calculations
|
|
5379
|
+
paitB = pai1 * Et[0] + pai2 * Et[1]; // Parallax correction referred to tB
|
|
5380
|
+
paiuB = pai1 * Et[1] - pai2 * Et[0]; // Parallax correction referred to tB
|
|
5381
|
+
|
|
5382
|
+
// Position of barycenter
|
|
5383
|
+
tnB = (ts[i] + lighttravel - t0) * vt0B - t0B + paitB * cos(alphas) - paiuB * sin(alphas);
|
|
5384
|
+
uB = u0B + vuB * (ts[i] + lighttravel - t0) + paitB * sin(alphas) + paiuB * cos(alphas);
|
|
5385
|
+
|
|
5386
|
+
// Position of relative particle
|
|
5387
|
+
phi = wstot * (ts[i]+lighttravel - t0) + phis0;
|
|
5388
|
+
xt = (Om[0] * cos(phi) + Y[0] * sin(phi));
|
|
5389
|
+
xu = (Om[1] * cos(phi) + Y[1] * sin(phi));
|
|
5390
|
+
|
|
5391
|
+
// Position of source 1
|
|
5392
|
+
tn = tnB - xt * s1;
|
|
5393
|
+
u = uB - xu * s1;
|
|
5394
|
+
//y1s[i] = -tn;
|
|
5395
|
+
//y2s[i] = -u;
|
|
5396
|
+
y1s[i] = (Cphi * (u * SOm - tn * COm) + Cinc * Sphi * (u * COm + tn * SOm)) / den;
|
|
5397
|
+
y2s[i] = (-Cphi * (u * COm + tn * SOm) - Cinc * Sphi * (tn * COm - u * SOm)) / den;
|
|
5398
|
+
|
|
5399
|
+
mags[i] = BinaryMag2(seps[i], q, y1s[i], y2s[i], rho);
|
|
5400
|
+
if (astrometry) {
|
|
5401
|
+
c1s[i] = astrox1;
|
|
5402
|
+
c2s[i] = astrox2;
|
|
5403
|
+
}
|
|
5404
|
+
|
|
5405
|
+
// Position of source 2
|
|
5406
|
+
tn = tnB + xt * s2;
|
|
5407
|
+
u = uB + xu * s2;
|
|
5408
|
+
//y1s2[i] = -tn;
|
|
5409
|
+
//y2s2[i] = -u;
|
|
5410
|
+
y1s2[i] = (Cphi * (u * SOm - tn * COm) + Cinc * Sphi * (u * COm + tn * SOm)) / den;
|
|
5411
|
+
y2s2[i] = (-Cphi * (u * COm + tn * SOm) - Cinc * Sphi * (tn * COm - u * SOm)) / den;
|
|
5412
|
+
|
|
5413
|
+
if (!turn_off_secondary_source) {
|
|
5414
|
+
rho2 = rho * exp(pr[1] * mass_radius_exponent / mass_luminosity_exponent);
|
|
5415
|
+
// Combine magnifications
|
|
5416
|
+
mags[i] += FR * BinaryMag2(seps[i], q, y1s2[i], y2s2[i], rho2);
|
|
5417
|
+
mags[i] /= (1 + FR);
|
|
5418
|
+
}
|
|
5419
|
+
if (astrometry) {
|
|
5420
|
+
if (!turn_off_secondary_source) {
|
|
5421
|
+
c1s[i] += FR * astrox1;
|
|
5422
|
+
c2s[i] += FR * astrox2;
|
|
5423
|
+
c1s[i] /= (1 + FR);
|
|
5424
|
+
c2s[i] /= (1 + FR);
|
|
5425
|
+
}
|
|
5426
|
+
dPosAng = -atan2(Cinc * Sphi, Cphi) + pphi0;
|
|
5427
|
+
ComputeCentroids(pr, ts[i], &c1s[i], &c2s[i], &c1l[i], &c2l[i]);
|
|
5428
|
+
FRl = (turn_off_secondary_lens) ? 0 : pow(q, lens_mass_luminosity_exponent); // Flux ratio between the two lenses
|
|
5429
|
+
c1l[i] += (-q + FRl) * s * thetaE / (1 + q) * cos(PosAng) / (1 + FRl); // Flux center of the two lenses from barycenter
|
|
5430
|
+
c2l[i] += (-q + FRl) * s * thetaE / (1 + q) * sin(PosAng) / (1 + FRl);
|
|
5431
|
+
}
|
|
5432
|
+
}
|
|
5433
|
+
}
|
|
5434
|
+
|
|
5435
|
+
|
|
5250
5436
|
void VBMicrolensing::TripleAstroLightCurve(double* pr, double* ts, double* mags, double* c1s, double* c2s, double* c1l, double* c2l, double* y1s, double* y2s, int np) {
|
|
5251
5437
|
double rho = exp(pr[4]), tn, tE_inv = exp(-pr[5]), di, mindi, u, u0 = pr[2], t0 = pr[6], pai1 = pr[10], pai2 = pr[11];
|
|
5252
5438
|
double q[3] = { 1, exp(pr[1]),exp(pr[8]) };
|
|
@@ -5274,7 +5460,7 @@ void VBMicrolensing::TripleAstroLightCurve(double* pr, double* ts, double* mags,
|
|
|
5274
5460
|
|
|
5275
5461
|
for (int i = 0; i < np; i++) {
|
|
5276
5462
|
ComputeParallax(ts[i], t0);
|
|
5277
|
-
tn = (ts[i] - t0) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
5463
|
+
tn = (ts[i] +lighttravel - t0) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
5278
5464
|
u = u0 + pai1 * Et[1] - pai2 * Et[0];
|
|
5279
5465
|
y1s[i] = u * salpha - tn * calpha;
|
|
5280
5466
|
y2s[i] = -u * calpha - tn * salpha;
|
|
@@ -5440,7 +5626,7 @@ void VBMicrolensing::BinSourceLightCurveParallax(double* pr, double* ts, double*
|
|
|
5440
5626
|
for (int i = 0; i < np; i++) {
|
|
5441
5627
|
ComputeParallax(ts[i], t0);
|
|
5442
5628
|
|
|
5443
|
-
tn = (ts[i] - t01) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
5629
|
+
tn = (ts[i] + lighttravel - t01) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
5444
5630
|
u0 = u1 + pai1 * Et[1] - pai2 * Et[0];
|
|
5445
5631
|
u = tn * tn + u0 * u0;
|
|
5446
5632
|
|
|
@@ -5448,7 +5634,7 @@ void VBMicrolensing::BinSourceLightCurveParallax(double* pr, double* ts, double*
|
|
|
5448
5634
|
y2s[i] = -u0;
|
|
5449
5635
|
mags[i] = (u + 2) / sqrt(u * (u + 4));
|
|
5450
5636
|
|
|
5451
|
-
tn = (ts[i] - t02) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
5637
|
+
tn = (ts[i] + lighttravel - t02) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
5452
5638
|
u0 = u2 + pai1 * Et[1] - pai2 * Et[0];
|
|
5453
5639
|
u = tn * tn + u0 * u0;
|
|
5454
5640
|
|
|
@@ -5502,7 +5688,7 @@ void VBMicrolensing::BinSourceLightCurveXallarap(double* pr, double* ts, double*
|
|
|
5502
5688
|
for (int i = 0; i < np; i++) {
|
|
5503
5689
|
ComputeParallax(ts[i], t0);
|
|
5504
5690
|
|
|
5505
|
-
phi = (ts[i] - t0_par) * w + phi0;
|
|
5691
|
+
phi = (ts[i] + lighttravel - t0_par-lighttravel0) * w + phi0;
|
|
5506
5692
|
Cphi = cos(phi);
|
|
5507
5693
|
Sphi = sin(phi);
|
|
5508
5694
|
den = sqrt(Cphi * Cphi + Cinc * Cinc * Sphi * Sphi);
|
|
@@ -5511,7 +5697,7 @@ void VBMicrolensing::BinSourceLightCurveXallarap(double* pr, double* ts, double*
|
|
|
5511
5697
|
dt0 = s_true * (COm * Cphi - Cinc * SOm * Sphi) / (1 + q) * q; //Position of the primary component with respect to center of mass
|
|
5512
5698
|
du0 = s_true * (SOm * Cphi + Cinc * COm * Sphi) / (1 + q) * q;
|
|
5513
5699
|
|
|
5514
|
-
tn = -((ts[i] - t0_par) * tE_inv + dt0 + pai1 * Et[0] + pai2 * Et[1]);
|
|
5700
|
+
tn = -((ts[i] + lighttravel - t0_par- lighttravel0) * tE_inv + dt0 + pai1 * Et[0] + pai2 * Et[1]);
|
|
5515
5701
|
u = -(u0 + du0 + pai1 * Et[1] - pai2 * Et[0]);
|
|
5516
5702
|
y1s[i] = tn;
|
|
5517
5703
|
y2s[i] = u;
|
|
@@ -5519,7 +5705,7 @@ void VBMicrolensing::BinSourceLightCurveXallarap(double* pr, double* ts, double*
|
|
|
5519
5705
|
|
|
5520
5706
|
mags[i] = (u + 2) / sqrt(u * (u + 4));
|
|
5521
5707
|
|
|
5522
|
-
tn = -((ts[i] - t0_par) * tE_inv - dt0 / q + pai1 * Et[0] + pai2 * Et[1]); // Position of the secondary component
|
|
5708
|
+
tn = -((ts[i] + lighttravel - t0_par- lighttravel0) * tE_inv - dt0 / q + pai1 * Et[0] + pai2 * Et[1]); // Position of the secondary component
|
|
5523
5709
|
u = -(u0 - du0 / q + pai1 * Et[1] - pai2 * Et[0]);
|
|
5524
5710
|
u = tn * tn + u * u;
|
|
5525
5711
|
|
|
@@ -5652,6 +5838,11 @@ void VBMicrolensing::BinSourceSingleLensXallarap(double* pr, double* ts, double*
|
|
|
5652
5838
|
}
|
|
5653
5839
|
|
|
5654
5840
|
|
|
5841
|
+
void VBMicrolensing::BinSourceBinLensLightCurve(double* pr, double* ts, double* mags, double* y1s, double* y2s, double* y1s2, double* y2s2, double *seps, int np) {
|
|
5842
|
+
astrometry = false;
|
|
5843
|
+
BinSourceBinLensAstroLightCurve(pr, ts, mags, NULL, NULL, NULL, NULL, y1s, y2s, y1s2, y2s2, seps, np);
|
|
5844
|
+
}
|
|
5845
|
+
|
|
5655
5846
|
|
|
5656
5847
|
|
|
5657
5848
|
void VBMicrolensing::TripleLightCurve(double* pr, double* ts, double* mags, double* y1s, double* y2s, int np) {
|
|
@@ -5842,91 +6033,14 @@ double VBMicrolensing::BinSourceSingleLensXallarap(double* pr, double t) {
|
|
|
5842
6033
|
return mag;
|
|
5843
6034
|
}
|
|
5844
6035
|
|
|
5845
|
-
|
|
5846
|
-
double
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
double salpha = sin(pr[3]), calpha = cos(pr[3]);
|
|
5850
|
-
double tn, w, phi0, phil, incl, Cinc, Sinc, Cphi, Sphi, Cphi0, Sphi0, COm, SOm, s_true;
|
|
5851
|
-
double w13, w123, den, den0, u;
|
|
5852
|
-
|
|
5853
|
-
double xi1 = pr[12], xi2 = pr[13], omega = pr[14], inc = pr[15], phi = pr[16], qs = exp(pr[17]);
|
|
5854
|
-
double Xal[2], phit, disp[2], Xal2[2], disp2[2];
|
|
5855
|
-
double Mag, Mag2, u01, u02, rho2, tn1, tn2, mags, qs4;
|
|
5856
|
-
|
|
5857
|
-
w13 = w1 * w1 + w3 * w3;
|
|
5858
|
-
w123 = sqrt(w13 + w2 * w2);
|
|
5859
|
-
w13 = sqrt(w13);
|
|
5860
|
-
if (w13 > 1.e-8) {
|
|
5861
|
-
w3 = (w3 > 1.e-8) ? w3 : 1.e-8;
|
|
5862
|
-
w = w3 * w123 / w13;
|
|
5863
|
-
incl = acos(w2 * w3 / w13 / w123);
|
|
5864
|
-
phi0 = atan2(-w1 * w123, w3 * w13);
|
|
5865
|
-
}
|
|
5866
|
-
else {
|
|
5867
|
-
w = w2;
|
|
5868
|
-
incl = 0.;
|
|
5869
|
-
phi0 = 0.;
|
|
5870
|
-
}
|
|
5871
|
-
|
|
5872
|
-
Cphi0 = cos(phi0);
|
|
5873
|
-
Sphi0 = sin(phi0);
|
|
5874
|
-
Cinc = cos(incl);
|
|
5875
|
-
Sinc = sin(incl);
|
|
5876
|
-
den0 = sqrt(Cphi0 * Cphi0 + Cinc * Cinc * Sphi0 * Sphi0);
|
|
5877
|
-
s_true = s / den0;
|
|
5878
|
-
COm = (Cphi0 * calpha + Cinc * salpha * Sphi0) / den0;
|
|
5879
|
-
SOm = (Cphi0 * salpha - Cinc * calpha * Sphi0) / den0;
|
|
5880
|
-
|
|
5881
|
-
ComputeParallax(t, t0);
|
|
5882
|
-
|
|
5883
|
-
phil = (t - t0_par) * w + phi0;
|
|
5884
|
-
Cphi = cos(phil);
|
|
5885
|
-
Sphi = sin(phil);
|
|
5886
|
-
den = sqrt(Cphi * Cphi + Cinc * Cinc * Sphi * Sphi);
|
|
5887
|
-
av = s_true * den;
|
|
5888
|
-
u = u0 + pai1 * Et[1] - pai2 * Et[0];
|
|
5889
|
-
tn = (t - t0) * tE_inv + pai1 * Et[0] + pai2 * Et[1];
|
|
5890
|
-
|
|
5891
|
-
phit = omega * (t - t0_par);
|
|
5892
|
-
|
|
5893
|
-
disp[0] = sin(inc) * (-cos(phi) + cos(phi + phit) + phit * sin(phi));
|
|
5894
|
-
disp[1] = -phit * cos(phi) - sin(phi) + sin(phi + phit);
|
|
5895
|
-
disp2[0] = -sin(inc) * (cos(phi) + cos(phi + phit) / qs - phit * sin(phi));
|
|
5896
|
-
disp2[1] = phit * cos(phi) + sin(phi) + sin(phi + phit) / qs;
|
|
5897
|
-
|
|
5898
|
-
Xal[0] = xi1 * disp[0] + xi2 * disp[1];
|
|
5899
|
-
Xal[1] = xi2 * disp[0] - xi1 * disp[1];
|
|
5900
|
-
Xal2[0] = xi1 * disp2[0] - xi2 * disp2[1];
|
|
5901
|
-
Xal2[1] = xi2 * disp2[0] + xi1 * disp2[1];
|
|
5902
|
-
|
|
5903
|
-
tn1 = tn + Xal[0];
|
|
5904
|
-
u01 = u + Xal[1];
|
|
5905
|
-
tn2 = tn + Xal2[0];
|
|
5906
|
-
u02 = u + Xal2[1];
|
|
5907
|
-
rho2 = rho * pow(qs, mass_radius_exponent);
|
|
5908
|
-
qs4 = pow(qs, mass_luminosity_exponent);
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
/* y1s = u01 * salpha - tn1 * calpha;
|
|
5912
|
-
y2s = -u01 * calpha - tn1 * salpha;
|
|
5913
|
-
y1s2 = u02 * salpha - tn2 * calpha;
|
|
5914
|
-
y2s2 = -u02 * calpha - tn2 * salpha;*/
|
|
5915
|
-
|
|
5916
|
-
y_1 = (Cphi * (u02 * SOm - tn2 * COm) + Cinc * Sphi * (u02 * COm + tn2 * SOm)) / den;
|
|
5917
|
-
y_2 = (-Cphi * (u02 * COm + tn2 * SOm) - Cinc * Sphi * (tn2 * COm - u02 * SOm)) / den;
|
|
5918
|
-
Mag2 = BinaryMag2(av, q, y_1, y_2, rho2);
|
|
5919
|
-
|
|
5920
|
-
y_1 = (Cphi * (u01 * SOm - tn1 * COm) + Cinc * Sphi * (u01 * COm + tn1 * SOm)) / den;
|
|
5921
|
-
y_2 = (-Cphi * (u01 * COm + tn1 * SOm) - Cinc * Sphi * (tn1 * COm - u01 * SOm)) / den;
|
|
5922
|
-
Mag = BinaryMag2(av, q, y_1, y_2, rho);
|
|
5923
|
-
|
|
5924
|
-
mags = (Mag + qs4 * Mag2) / (1 + qs4);
|
|
5925
|
-
|
|
5926
|
-
return mags;
|
|
6036
|
+
double VBMicrolensing::BinSourceBinLensLightCurve(double* pr, double t) {
|
|
6037
|
+
double mag, y1, y2, y21, y22, sep;
|
|
6038
|
+
BinSourceBinLensLightCurve(pr, &t, &mag, &y1, &y2, &y21, &y22, &sep, 1);
|
|
6039
|
+
return mag;
|
|
5927
6040
|
}
|
|
5928
6041
|
|
|
5929
6042
|
|
|
6043
|
+
|
|
5930
6044
|
double VBMicrolensing::TripleLightCurve(double* pr, double t) {
|
|
5931
6045
|
double mag, y1, y2;
|
|
5932
6046
|
TripleLightCurve(pr, &t, &mag, &y1, &y2, 1);
|
|
@@ -6154,6 +6268,113 @@ void VBMicrolensing::SetLDprofile(LDprofiles LDval) {
|
|
|
6154
6268
|
//////////////////////////////
|
|
6155
6269
|
//////////////////////////////
|
|
6156
6270
|
|
|
6271
|
+
void VBMicrolensing::LoadSunTable(char* filename) {
|
|
6272
|
+
FILE* f;
|
|
6273
|
+
double RA, Dec, dis, phiprec;
|
|
6274
|
+
|
|
6275
|
+
if ((f = fopen(filename, "r")) != 0) {
|
|
6276
|
+
if (suntable) {
|
|
6277
|
+
// Removing existing table if any
|
|
6278
|
+
for (int j = 0; j < ndataEar; j++) free(posEar[j]);
|
|
6279
|
+
free(posEar);
|
|
6280
|
+
suntable = false;
|
|
6281
|
+
}
|
|
6282
|
+
// Reading Sun table files
|
|
6283
|
+
int flag2 = 0;
|
|
6284
|
+
// long startpos = 0;
|
|
6285
|
+
char teststring[1000];
|
|
6286
|
+
ndataEar = 1;
|
|
6287
|
+
|
|
6288
|
+
// Finding start of data
|
|
6289
|
+
while (!feof(f)) {
|
|
6290
|
+
fscanf(f, "%s", teststring);
|
|
6291
|
+
if (!feof(f)) {
|
|
6292
|
+
fgetc(f); //fseek(f, 1, SEEK_CUR);
|
|
6293
|
+
teststring[5] = 0;
|
|
6294
|
+
if (strcmp(teststring, "$$SOE") == 0) {
|
|
6295
|
+
flag2 = 1;
|
|
6296
|
+
break;
|
|
6297
|
+
}
|
|
6298
|
+
}
|
|
6299
|
+
}
|
|
6300
|
+
// Finding end of data
|
|
6301
|
+
if (flag2) {
|
|
6302
|
+
flag2 = 0;
|
|
6303
|
+
// startpos = ftell(f);
|
|
6304
|
+
while (!feof(f)) {
|
|
6305
|
+
fscanf(f, "%[^\n]s", teststring);
|
|
6306
|
+
if (!feof(f)) {
|
|
6307
|
+
//fseek(f, 1, SEEK_CUR);
|
|
6308
|
+
fgetc(f);
|
|
6309
|
+
teststring[5] = 0;
|
|
6310
|
+
if (strcmp(teststring, "$$EOE") == 0) {
|
|
6311
|
+
flag2 = 1;
|
|
6312
|
+
break;
|
|
6313
|
+
}
|
|
6314
|
+
else {
|
|
6315
|
+
ndataEar++;
|
|
6316
|
+
}
|
|
6317
|
+
}
|
|
6318
|
+
}
|
|
6319
|
+
}
|
|
6320
|
+
|
|
6321
|
+
// Allocating memory according to the length of the table
|
|
6322
|
+
posEar = (double**)malloc(sizeof(double*) * ndataEar);
|
|
6323
|
+
|
|
6324
|
+
for (int j = 0; j < ndataEar; j++) {
|
|
6325
|
+
posEar[j] = (double*)malloc(sizeof(double) * 3);
|
|
6326
|
+
}
|
|
6327
|
+
ndataEar--;
|
|
6328
|
+
fclose(f);
|
|
6329
|
+
|
|
6330
|
+
// Reading data
|
|
6331
|
+
f = fopen(filename, "r");
|
|
6332
|
+
double tcur;
|
|
6333
|
+
startEar = stepEar = -1;
|
|
6334
|
+
// fseek(f, startpos, SEEK_SET);
|
|
6335
|
+
|
|
6336
|
+
// Finding start of data
|
|
6337
|
+
while (!feof(f)) {
|
|
6338
|
+
fscanf(f, "%s", teststring);
|
|
6339
|
+
if (!feof(f)) {
|
|
6340
|
+
fgetc(f); //fseek(f, 1, SEEK_CUR);
|
|
6341
|
+
teststring[5] = 0;
|
|
6342
|
+
if (strcmp(teststring, "$$SOE") == 0) {
|
|
6343
|
+
flag2 = 1;
|
|
6344
|
+
break;
|
|
6345
|
+
}
|
|
6346
|
+
}
|
|
6347
|
+
}
|
|
6348
|
+
for (int id = 0; id < ndataEar; id++) {
|
|
6349
|
+
if (fscanf(f, "%lf %lf %lf %lf %lf", &tcur, &RA, &Dec, &dis, &phiprec) == 5) {
|
|
6350
|
+
if (stepEar < 0) {
|
|
6351
|
+
if (startEar < 0) {
|
|
6352
|
+
startEar = tcur;
|
|
6353
|
+
}
|
|
6354
|
+
else {
|
|
6355
|
+
stepEar = tcur - startEar;
|
|
6356
|
+
startEar -= 2450000.0;
|
|
6357
|
+
}
|
|
6358
|
+
}
|
|
6359
|
+
RA *= M_PI / 180;
|
|
6360
|
+
Dec *= M_PI / 180;
|
|
6361
|
+
for (int i = 0; i < 3; i++) {
|
|
6362
|
+
posEar[id][i] = -dis * (cos(RA) * cos(Dec) * Eq2000[i] + sin(RA) * cos(Dec) * Quad2000[i] + sin(Dec) * North2000[i]);
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6365
|
+
else {
|
|
6366
|
+
ndataEar = id;
|
|
6367
|
+
break;
|
|
6368
|
+
}
|
|
6369
|
+
}
|
|
6370
|
+
fclose(f);
|
|
6371
|
+
suntable = true;
|
|
6372
|
+
}
|
|
6373
|
+
else {
|
|
6374
|
+
printf("\nSun ephemeris table not found !");
|
|
6375
|
+
suntable = false;
|
|
6376
|
+
}
|
|
6377
|
+
}
|
|
6157
6378
|
|
|
6158
6379
|
void VBMicrolensing::SetObjectCoordinates(char* modelfile, char* sateltabledir) {
|
|
6159
6380
|
double RA, Dec, dis, phiprec;
|
|
@@ -6167,7 +6388,18 @@ void VBMicrolensing::SetObjectCoordinates(char* modelfile, char* sateltabledir)
|
|
|
6167
6388
|
fscanf(f, "%[^\n]s", CoordinateString);
|
|
6168
6389
|
fclose(f);
|
|
6169
6390
|
SetObjectCoordinates(CoordinateString);
|
|
6170
|
-
|
|
6391
|
+
|
|
6392
|
+
// Removing any preiovusly loaded satellite table files
|
|
6393
|
+
if (nsat) {
|
|
6394
|
+
for (int i = 0; i < nsat; i++) {
|
|
6395
|
+
for (int j = 0; j < ndatasat[i]; j++) free(possat[i][j]);
|
|
6396
|
+
free(possat[i]);
|
|
6397
|
+
}
|
|
6398
|
+
free(possat);
|
|
6399
|
+
free(ndatasat);
|
|
6400
|
+
free(startsat);
|
|
6401
|
+
free(stepsat);
|
|
6402
|
+
}
|
|
6171
6403
|
// Looking for satellite table files in the specified directory
|
|
6172
6404
|
sprintf(filename, "%s%csatellite*.txt", sateltabledir, systemslash);
|
|
6173
6405
|
nsat = 0;
|
|
@@ -6181,9 +6413,10 @@ void VBMicrolensing::SetObjectCoordinates(char* modelfile, char* sateltabledir)
|
|
|
6181
6413
|
}
|
|
6182
6414
|
|
|
6183
6415
|
|
|
6184
|
-
tsat = (double**)malloc(sizeof(double*) * nsat);
|
|
6185
6416
|
possat = (double***)malloc(sizeof(double**) * nsat);
|
|
6186
6417
|
ndatasat = (int*)malloc(sizeof(int) * nsat);
|
|
6418
|
+
startsat = (double*)malloc(sizeof(double) * nsat);
|
|
6419
|
+
stepsat = (double*)malloc(sizeof(double) * nsat);
|
|
6187
6420
|
|
|
6188
6421
|
// Reading satellite table files
|
|
6189
6422
|
ic = 0;
|
|
@@ -6192,7 +6425,6 @@ void VBMicrolensing::SetObjectCoordinates(char* modelfile, char* sateltabledir)
|
|
|
6192
6425
|
f = fopen(filename, "r");
|
|
6193
6426
|
if (f != 0) {
|
|
6194
6427
|
int flag2 = 0;
|
|
6195
|
-
long startpos = 0;
|
|
6196
6428
|
char teststring[1000];
|
|
6197
6429
|
ndatasat[ic] = 1;
|
|
6198
6430
|
|
|
@@ -6211,7 +6443,6 @@ void VBMicrolensing::SetObjectCoordinates(char* modelfile, char* sateltabledir)
|
|
|
6211
6443
|
// Finding end of data
|
|
6212
6444
|
if (flag2) {
|
|
6213
6445
|
flag2 = 0;
|
|
6214
|
-
startpos = ftell(f);
|
|
6215
6446
|
while (!feof(f)) {
|
|
6216
6447
|
fscanf(f, "%[^\n]s", teststring);
|
|
6217
6448
|
if (!feof(f)) {
|
|
@@ -6228,22 +6459,46 @@ void VBMicrolensing::SetObjectCoordinates(char* modelfile, char* sateltabledir)
|
|
|
6228
6459
|
}
|
|
6229
6460
|
}
|
|
6230
6461
|
}
|
|
6462
|
+
fclose(f);
|
|
6231
6463
|
|
|
6232
6464
|
// Allocating memory according to the length of the table
|
|
6233
|
-
tsat[ic] = (double*)malloc(sizeof(double) * ndatasat[ic]);
|
|
6234
6465
|
possat[ic] = (double**)malloc(sizeof(double*) * ndatasat[ic]);
|
|
6466
|
+
|
|
6235
6467
|
for (int j = 0; j < ndatasat[ic]; j++) {
|
|
6236
6468
|
possat[ic][j] = (double*)malloc(sizeof(double) * 3);
|
|
6237
6469
|
}
|
|
6238
6470
|
ndatasat[ic]--;
|
|
6239
6471
|
|
|
6472
|
+
f = fopen(filename, "r");
|
|
6473
|
+
// Finding start of data
|
|
6474
|
+
while (!feof(f)) {
|
|
6475
|
+
fscanf(f, "%s", teststring);
|
|
6476
|
+
if (!feof(f)) {
|
|
6477
|
+
fgetc(f); //fseek(f, 1, SEEK_CUR);
|
|
6478
|
+
teststring[5] = 0;
|
|
6479
|
+
if (strcmp(teststring, "$$SOE") == 0) {
|
|
6480
|
+
flag2 = 1;
|
|
6481
|
+
break;
|
|
6482
|
+
}
|
|
6483
|
+
}
|
|
6484
|
+
}
|
|
6485
|
+
|
|
6240
6486
|
// Reading data
|
|
6241
6487
|
if (f) {
|
|
6242
|
-
|
|
6488
|
+
double tcur;
|
|
6489
|
+
startsat[ic] = stepsat[ic]= - 1;
|
|
6243
6490
|
for (int id = 0; id < ndatasat[ic]; id++) {
|
|
6244
6491
|
|
|
6245
|
-
if (fscanf(f, "%lf %lf %lf %lf %lf", &
|
|
6246
|
-
|
|
6492
|
+
if (fscanf(f, "%lf %lf %lf %lf %lf", &tcur, &RA, &Dec, &dis, &phiprec) == 5) {
|
|
6493
|
+
if (stepsat[ic] < 0) {
|
|
6494
|
+
if (startsat[ic] < 0) {
|
|
6495
|
+
startsat[ic] = tcur;
|
|
6496
|
+
}
|
|
6497
|
+
else {
|
|
6498
|
+
stepsat[ic] = tcur - startsat[ic];
|
|
6499
|
+
startsat[ic] -= 2450000.0;
|
|
6500
|
+
}
|
|
6501
|
+
}
|
|
6247
6502
|
RA *= M_PI / 180;
|
|
6248
6503
|
Dec *= M_PI / 180;
|
|
6249
6504
|
for (int i = 0; i < 3; i++) {
|
|
@@ -6268,34 +6523,44 @@ void VBMicrolensing::SetObjectCoordinates(char* modelfile, char* sateltabledir)
|
|
|
6268
6523
|
}
|
|
6269
6524
|
|
|
6270
6525
|
void VBMicrolensing::SetObjectCoordinates(char* CoordinateString) {
|
|
6271
|
-
double RA, Dec, hr, mn, sc, deg, pr, ssc;
|
|
6526
|
+
double RA, Dec, hr, mn, sc, deg, pr, ssc, sp, r;
|
|
6272
6527
|
|
|
6273
|
-
|
|
6274
|
-
for (int i = 0; i < nsat; i++) {
|
|
6275
|
-
for (int j = 0; j < ndatasat[i]; j++) free(possat[i][j]);
|
|
6276
|
-
free(tsat[i]);
|
|
6277
|
-
free(possat[i]);
|
|
6278
|
-
}
|
|
6279
|
-
free(tsat);
|
|
6280
|
-
free(possat);
|
|
6281
|
-
free(ndatasat);
|
|
6282
|
-
}
|
|
6528
|
+
hr = mn = sc = deg = pr = ssc = -1.e100;
|
|
6283
6529
|
sscanf(CoordinateString, "%lf:%lf:%lf %lf:%lf:%lf", &hr, &mn, &sc, °, &pr, &ssc);
|
|
6284
|
-
|
|
6530
|
+
if (hr >= 0 && hr < 24 && mn >= 0 && mn < 60 && sc >= 0 && sc < 60 && deg >= -90 && deg <= 90 && pr >= 0 && pr < 60 && ssc >= 0 && ssc < 60) {
|
|
6531
|
+
RA = (hr + mn / 60 + sc / 3600) * M_PI / 12;
|
|
6285
6532
|
Dec = (fabs(deg) + pr / 60 + ssc / 3600) * M_PI / 180;
|
|
6286
|
-
|
|
6533
|
+
if (deg < 0) Dec = -Dec;
|
|
6287
6534
|
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6535
|
+
for (int i = 0; i < 3; i++) {
|
|
6536
|
+
Obj[i] = (cos(RA) * cos(Dec) * Eq2000[i] + sin(RA) * cos(Dec) * Quad2000[i] + sin(Dec) * North2000[i]);
|
|
6537
|
+
//rad[i] = Eq2000[i];
|
|
6538
|
+
//tang[i] = North2000[i];
|
|
6539
|
+
}
|
|
6540
|
+
sp = 0;
|
|
6541
|
+
for (int i = 0; i < 3; i++) sp += North2000[i] * Obj[i];
|
|
6542
|
+
for (int i = 0; i < 3; i++) rad[i] = -North2000[i] + sp * Obj[i];
|
|
6543
|
+
|
|
6544
|
+
r = sqrt(rad[0] * rad[0] + rad[1] * rad[1] + rad[2] * rad[2]); // Celestial South projected orthogonal to LOS
|
|
6545
|
+
rad[0] /= r;
|
|
6546
|
+
rad[1] /= r;
|
|
6547
|
+
rad[2] /= r;
|
|
6548
|
+
tang[0] = rad[1] * Obj[2] - rad[2] * Obj[1]; // Celestial West projected orthogonal to LOS
|
|
6549
|
+
tang[1] = rad[2] * Obj[0] - rad[0] * Obj[2];
|
|
6550
|
+
tang[2] = rad[0] * Obj[1] - rad[1] * Obj[0];
|
|
6293
6551
|
|
|
6294
|
-
|
|
6552
|
+
coordinates_set = true;
|
|
6553
|
+
}
|
|
6554
|
+
else coordinates_set = false;
|
|
6555
|
+
}
|
|
6295
6556
|
|
|
6557
|
+
bool VBMicrolensing::AreCoordinatesSet() {
|
|
6558
|
+
return coordinates_set;
|
|
6296
6559
|
}
|
|
6297
6560
|
|
|
6298
6561
|
void VBMicrolensing::ComputeParallax(double t, double t0) {
|
|
6562
|
+
static double dtflight = 0.0000993512; // = angle covered by Earth as light covers 1 au.
|
|
6563
|
+
static double au_c = 0.005775518331436995; // au/c in days.
|
|
6299
6564
|
static double a0 = 1.00000261, adot = 0.00000562; // Ephemeris from JPL website
|
|
6300
6565
|
static double e0 = 0.01671123, edot = -0.00004392;
|
|
6301
6566
|
static double inc0 = -0.00001531, incdot = -0.01294668;
|
|
@@ -6304,15 +6569,116 @@ void VBMicrolensing::ComputeParallax(double t, double t0) {
|
|
|
6304
6569
|
static double deg = M_PI / 180;
|
|
6305
6570
|
static double a, e, inc, L, om, M, EE, dE, dM;
|
|
6306
6571
|
static double x1, y1, vx, vy, Ear[3], vEar[3];
|
|
6307
|
-
static double r, sp, ty, Spit;
|
|
6572
|
+
static double r, sp, ty, Spit, dLtof;
|
|
6308
6573
|
int c = 0, ic;
|
|
6309
6574
|
|
|
6310
|
-
if (
|
|
6311
|
-
if (t0_par_fixed == -1) {
|
|
6575
|
+
if (!coordinates_set) {
|
|
6312
6576
|
printf("\nUse SetObjectCoordinates to input target coordinates");
|
|
6577
|
+
return;
|
|
6313
6578
|
}
|
|
6314
|
-
|
|
6579
|
+
if (satellite > nsat) {
|
|
6580
|
+
printf("\nSatellite %d not available", satellite);
|
|
6581
|
+
return;
|
|
6582
|
+
}
|
|
6583
|
+
|
|
6584
|
+
if (t0_par_fixed == 0) t0_par = t0;
|
|
6585
|
+
|
|
6586
|
+
if (parallaxephemeris) {
|
|
6587
|
+
// Calculation with lookup ephemeris table
|
|
6588
|
+
if (!suntable) {
|
|
6589
|
+
LoadSunTable(Suntablefile);
|
|
6590
|
+
}
|
|
6591
|
+
if (t0_par != t0old) {
|
|
6592
|
+
t0old = t0_par;
|
|
6593
|
+
ty = (t0_par - startEar) / stepEar;
|
|
6594
|
+
ic = (int)floor(ty);
|
|
6595
|
+
ty -= ic;
|
|
6596
|
+
for (int i = 0; i < 3; i++) Ear[i] = posEar[ic][i] * (1 - ty) + posEar[ic + 1][i] * ty;
|
|
6597
|
+
if (t_in_HJD) {
|
|
6598
|
+
double told = t, tnew;
|
|
6599
|
+
lighttravel0 = 0;
|
|
6600
|
+
for (int i = 0; i < 3; i++) lighttravel0 += Ear[i] * Obj[i];
|
|
6601
|
+
lighttravel0 *= au_c;
|
|
6602
|
+
tnew = t0_par - lighttravel0;
|
|
6603
|
+
while (fabs(told - tnew) > 1.e-8) {
|
|
6604
|
+
told = tnew;
|
|
6605
|
+
ty = (told - startEar) / stepEar;
|
|
6606
|
+
ic = (int)floor(ty);
|
|
6607
|
+
ty -= ic;
|
|
6608
|
+
for (int i = 0; i < 3; i++) Ear[i] = posEar[ic][i] * (1 - ty) + posEar[ic + 1][i] * ty;
|
|
6609
|
+
lighttravel0 = 0;
|
|
6610
|
+
for (int i = 0; i < 3; i++) lighttravel0 += Ear[i] * Obj[i];
|
|
6611
|
+
lighttravel0 *= au_c;
|
|
6612
|
+
tnew = t0_par - lighttravel0;
|
|
6613
|
+
}
|
|
6614
|
+
}
|
|
6615
|
+
for (int i = 0; i < 3; i++) {
|
|
6616
|
+
if (ty > 0.5) {
|
|
6617
|
+
vEar[i] = ((posEar[ic+2][i]- posEar[ic+1][i]) * (ty-0.5) + (posEar[ic+1][i] - posEar[ic][i]) * (1.5-ty)) / stepEar;
|
|
6618
|
+
}
|
|
6619
|
+
else {
|
|
6620
|
+
vEar[i] = ((posEar[ic][i] - posEar[ic-1][i]) * (0.5 - ty) + (posEar[ic+1][i] - posEar[ic][i]) * (ty+0.5)) / stepEar;
|
|
6621
|
+
}
|
|
6622
|
+
}
|
|
6623
|
+
if (parallaxsystem != 1) {
|
|
6624
|
+
sp = 0;
|
|
6625
|
+
for (int i = 0; i < 3; i++) sp += Ear[i] * Obj[i];
|
|
6626
|
+
for (int i = 0; i < 3; i++) rad[i] = Ear[i] - sp * Obj[i];
|
|
6627
|
+
r = sqrt(rad[0] * rad[0] + rad[1] * rad[1] + rad[2] * rad[2]); // Celestial South projected orthogonal to LOS
|
|
6628
|
+
rad[0] /= r;
|
|
6629
|
+
rad[1] /= r;
|
|
6630
|
+
rad[2] /= r;
|
|
6631
|
+
tang[0] = rad[1] * Obj[2] - rad[2] * Obj[1]; // Celestial West projected orthogonal to LOS
|
|
6632
|
+
tang[1] = rad[2] * Obj[0] - rad[0] * Obj[2];
|
|
6633
|
+
tang[2] = rad[0] * Obj[1] - rad[1] * Obj[0];
|
|
6634
|
+
}
|
|
6635
|
+
|
|
6636
|
+
|
|
6637
|
+
Et0[0] = Et0[1] = vt0[0] = vt0[1] = 0;
|
|
6638
|
+
lighttravel0 = 0;
|
|
6639
|
+
for (int i = 0; i < 3; i++) {
|
|
6640
|
+
Et0[0] += Ear[i] * rad[i]; // Earth position projected along South at time t0_par
|
|
6641
|
+
Et0[1] += Ear[i] * tang[i]; // Earth position projected along West at time t0_par
|
|
6642
|
+
lighttravel0 += Ear[i] * Obj[i];
|
|
6643
|
+
vt0[0] += vEar[i] * rad[i]; // Earth velocity projected along South at time t0_par
|
|
6644
|
+
vt0[1] += vEar[i] * tang[i]; // Earth velocity projected along West at time t0_par
|
|
6645
|
+
}
|
|
6646
|
+
lighttravel0 *= (t_in_HJD) ? 0 : au_c; // Light travel time from Earth projection to Sun: HJD = JD + lighttravel.
|
|
6647
|
+
}
|
|
6648
|
+
ty = (t - startEar) / stepEar;
|
|
6649
|
+
ic = (int)floor(ty);
|
|
6650
|
+
ty -= ic;
|
|
6651
|
+
for (int i = 0; i < 3; i++) Ear[i] = posEar[ic][i] * (1 - ty) + posEar[ic + 1][i] * ty;
|
|
6652
|
+
lighttravel = 0;
|
|
6653
|
+
for (int i = 0; i < 3; i++) lighttravel += Ear[i] * Obj[i];
|
|
6654
|
+
lighttravel *= au_c;
|
|
6655
|
+
if (t_in_HJD) {
|
|
6656
|
+
double told = t, tnew;
|
|
6657
|
+
tnew = t - lighttravel;
|
|
6658
|
+
while (fabs(told - tnew) > 1.e-8) {
|
|
6659
|
+
told = tnew;
|
|
6660
|
+
ty = (told - startEar) / stepEar;
|
|
6661
|
+
ic = (int)floor(ty);
|
|
6662
|
+
ty -= ic;
|
|
6663
|
+
for (int i = 0; i < 3; i++) Ear[i] = posEar[ic][i] * (1 - ty) + posEar[ic + 1][i] * ty;
|
|
6664
|
+
lighttravel = 0;
|
|
6665
|
+
for (int i = 0; i < 3; i++) lighttravel += Ear[i] * Obj[i];
|
|
6666
|
+
lighttravel *= au_c;
|
|
6667
|
+
tnew = t - lighttravel;
|
|
6668
|
+
}
|
|
6669
|
+
lighttravel = 0;
|
|
6670
|
+
}
|
|
6671
|
+
Ehel[0] = Ehel[1] = 0;
|
|
6672
|
+
for (int i = 0; i < 3; i++) {
|
|
6673
|
+
Ehel[0] += Ear[i] * rad[i]; // Ehel is the heliocentric position of Earth along South and West at time t
|
|
6674
|
+
Ehel[1] += Ear[i] * tang[i];
|
|
6675
|
+
}
|
|
6676
|
+
Et[0] = Ehel[0] - Et0[0] - vt0[0] * (t+lighttravel - t0_par-lighttravel0); // Earth shift along South wrt extrapolation from t0_par
|
|
6677
|
+
Et[1] = Ehel[1] - Et0[1] - vt0[1] * (t+lighttravel - t0_par-lighttravel0); // Earth shift along West wrt extrapolation from t0_par
|
|
6315
6678
|
|
|
6679
|
+
}
|
|
6680
|
+
else {
|
|
6681
|
+
// Calculation with Kepler equation
|
|
6316
6682
|
if (t0_par != t0old) {
|
|
6317
6683
|
t0old = t0_par;
|
|
6318
6684
|
ty = (t0_par - 1545) / 36525.0;
|
|
@@ -6328,8 +6694,20 @@ void VBMicrolensing::ComputeParallax(double t, double t0) {
|
|
|
6328
6694
|
|
|
6329
6695
|
EE = M + e * sin(M);
|
|
6330
6696
|
dE = 1;
|
|
6697
|
+
dLtof = 0;
|
|
6331
6698
|
while (fabs(dE) > 1.e-8) {
|
|
6332
|
-
|
|
6699
|
+
if (t_in_HJD) {
|
|
6700
|
+
// Correction to calculate Earth position at JD not HJD
|
|
6701
|
+
x1 = a * (cos(EE) - e);
|
|
6702
|
+
y1 = a * sqrt(1 - e * e) * sin(EE);
|
|
6703
|
+
Ear[0] = x1 * cos(om) - y1 * sin(om);
|
|
6704
|
+
Ear[1] = x1 * sin(om) * cos(inc) + y1 * cos(om) * cos(inc);
|
|
6705
|
+
Ear[2] = x1 * sin(om) * sin(inc) + y1 * cos(om) * sin(inc);
|
|
6706
|
+
dLtof = 0;
|
|
6707
|
+
for (int i = 0; i < 3; i++) dLtof -= Ear[i] * Obj[i];
|
|
6708
|
+
dLtof *= dtflight;
|
|
6709
|
+
}
|
|
6710
|
+
dM = M + dLtof - (EE - e * sin(EE));
|
|
6333
6711
|
dE = dM / (1 - e * cos(EE));
|
|
6334
6712
|
EE += dE;
|
|
6335
6713
|
}
|
|
@@ -6348,33 +6726,30 @@ void VBMicrolensing::ComputeParallax(double t, double t0) {
|
|
|
6348
6726
|
// Ear is the Earth position in AU in ecliptic coordinates at time t0_par
|
|
6349
6727
|
// vEar is the Earth velocity vector in AU/day in ecliptic coordinates at time t0_par
|
|
6350
6728
|
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
case 1:
|
|
6354
|
-
for (int i = 0; i < 3; i++) sp += North2000[i] * Obj[i];
|
|
6355
|
-
for (int i = 0; i < 3; i++) rad[i] = -North2000[i] + sp * Obj[i];
|
|
6356
|
-
break;
|
|
6357
|
-
default:
|
|
6729
|
+
if (parallaxsystem != 1) {
|
|
6730
|
+
sp = 0;
|
|
6358
6731
|
for (int i = 0; i < 3; i++) sp += Ear[i] * Obj[i];
|
|
6359
6732
|
for (int i = 0; i < 3; i++) rad[i] = Ear[i] - sp * Obj[i];
|
|
6360
|
-
|
|
6733
|
+
r = sqrt(rad[0] * rad[0] + rad[1] * rad[1] + rad[2] * rad[2]); // Celestial South projected orthogonal to LOS
|
|
6734
|
+
rad[0] /= r;
|
|
6735
|
+
rad[1] /= r;
|
|
6736
|
+
rad[2] /= r;
|
|
6737
|
+
tang[0] = rad[1] * Obj[2] - rad[2] * Obj[1]; // Celestial West projected orthogonal to LOS
|
|
6738
|
+
tang[1] = rad[2] * Obj[0] - rad[0] * Obj[2];
|
|
6739
|
+
tang[2] = rad[0] * Obj[1] - rad[1] * Obj[0];
|
|
6361
6740
|
}
|
|
6362
6741
|
|
|
6363
|
-
r = sqrt(rad[0] * rad[0] + rad[1] * rad[1] + rad[2] * rad[2]); // Celestial South projected orthogonal to LOS
|
|
6364
|
-
rad[0] /= r;
|
|
6365
|
-
rad[1] /= r;
|
|
6366
|
-
rad[2] /= r;
|
|
6367
|
-
tang[0] = rad[1] * Obj[2] - rad[2] * Obj[1]; // Celestial West projected orthogonal to LOS
|
|
6368
|
-
tang[1] = rad[2] * Obj[0] - rad[0] * Obj[2];
|
|
6369
|
-
tang[2] = rad[0] * Obj[1] - rad[1] * Obj[0];
|
|
6370
6742
|
|
|
6371
6743
|
Et0[0] = Et0[1] = vt0[0] = vt0[1] = 0;
|
|
6744
|
+
lighttravel0 = 0;
|
|
6372
6745
|
for (int i = 0; i < 3; i++) {
|
|
6373
6746
|
Et0[0] += Ear[i] * rad[i]; // Earth position projected along South at time t0_par
|
|
6374
6747
|
Et0[1] += Ear[i] * tang[i]; // Earth position projected along West at time t0_par
|
|
6748
|
+
lighttravel0 += Ear[i] * Obj[i];
|
|
6375
6749
|
vt0[0] += vEar[i] * rad[i]; // Earth velocity projected along South at time t0_par
|
|
6376
6750
|
vt0[1] += vEar[i] * tang[i]; // Earth velocity projected along West at time t0_par
|
|
6377
6751
|
}
|
|
6752
|
+
lighttravel0 *= (t_in_HJD) ? 0 : au_c; // Light travel time from Earth projection to Sun: HJD = JD + lighttravel.
|
|
6378
6753
|
}
|
|
6379
6754
|
|
|
6380
6755
|
ty = (t - 1545) / 36525.0;
|
|
@@ -6390,8 +6765,21 @@ void VBMicrolensing::ComputeParallax(double t, double t0) {
|
|
|
6390
6765
|
|
|
6391
6766
|
EE = M + e * sin(M);
|
|
6392
6767
|
dE = 1;
|
|
6393
|
-
|
|
6394
|
-
|
|
6768
|
+
dLtof = 0;
|
|
6769
|
+
while (fabs(dE) > 1.e-8) {
|
|
6770
|
+
if (t_in_HJD) {
|
|
6771
|
+
// Correction to calculate Earth position at JD not HJD
|
|
6772
|
+
x1 = a * (cos(EE) - e);
|
|
6773
|
+
y1 = a * sqrt(1 - e * e) * sin(EE);
|
|
6774
|
+
Ear[0] = x1 * cos(om) - y1 * sin(om);
|
|
6775
|
+
Ear[1] = x1 * sin(om) * cos(inc) + y1 * cos(om) * cos(inc);
|
|
6776
|
+
Ear[2] = x1 * sin(om) * sin(inc) + y1 * cos(om) * sin(inc);
|
|
6777
|
+
dLtof = 0;
|
|
6778
|
+
for (int i = 0; i < 3; i++) dLtof -= Ear[i] * Obj[i];
|
|
6779
|
+
dLtof *= dtflight;
|
|
6780
|
+
}
|
|
6781
|
+
|
|
6782
|
+
dM = M + dLtof - (EE - e * sin(EE));
|
|
6395
6783
|
dE = dM / (1 - e * cos(EE));
|
|
6396
6784
|
EE += dE;
|
|
6397
6785
|
}
|
|
@@ -6406,45 +6794,45 @@ void VBMicrolensing::ComputeParallax(double t, double t0) {
|
|
|
6406
6794
|
Ear[2] = x1 * sin(om) * sin(inc) + y1 * cos(om) * sin(inc);
|
|
6407
6795
|
// Ear is the Earth position in AU in ecliptic coordinates at time t
|
|
6408
6796
|
|
|
6409
|
-
Ehel[0] = Ehel[1] = 0;
|
|
6797
|
+
Ehel[0] = Ehel[1] = lighttravel = 0;
|
|
6410
6798
|
for (int i = 0; i < 3; i++) {
|
|
6411
6799
|
Ehel[0] += Ear[i] * rad[i]; // Ehel is the heliocentric position of Earth along South and West at time t
|
|
6412
6800
|
Ehel[1] += Ear[i] * tang[i];
|
|
6801
|
+
lighttravel += Ear[i] * Obj[i];
|
|
6413
6802
|
}
|
|
6414
|
-
|
|
6415
|
-
Et[
|
|
6803
|
+
lighttravel *= (t_in_HJD) ? 0 : au_c; // Light travel time from Earth projection to Sun: HJD = JD + lighttravel.
|
|
6804
|
+
Et[0] = Ehel[0] - Et0[0] - vt0[0] * (t + lighttravel - t0_par - lighttravel0); // Earth shift along South wrt extrapolation from t0_par
|
|
6805
|
+
Et[1] = Ehel[1] - Et0[1] - vt0[1] * (t + lighttravel - t0_par - lighttravel0); // Earth shift along West wrt extrapolation from t0_par
|
|
6416
6806
|
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
Et[1] += Spit * tang[i];
|
|
6447
|
-
}
|
|
6807
|
+
}
|
|
6808
|
+
|
|
6809
|
+
|
|
6810
|
+
//// For debugging: writes Sun coordinates from Earth to file for comparison with exact ephemerides.
|
|
6811
|
+
//{
|
|
6812
|
+
// FILE* f = fopen("C:\\Users\\valboz\\Personali\\MicroModels\\test-dev\\ephemeris_test\\outapp.txt", "a");
|
|
6813
|
+
// double RA, Dec, ran,x,y,z;
|
|
6814
|
+
// ran = a * (1 - e * cos(EE));
|
|
6815
|
+
// z = x = y = 0;
|
|
6816
|
+
// for (int i = 0; i < 3; i++) z += Ear[i] * North2000[i];
|
|
6817
|
+
// for (int i = 0; i < 3; i++) x += Ear[i] * Eq2000[i];
|
|
6818
|
+
// for (int i = 0; i < 3; i++) y += Ear[i] * Quad2000[i];
|
|
6819
|
+
// Dec = -asin(z / ran)/deg;
|
|
6820
|
+
// RA = 180 + atan2(y, x)/deg;
|
|
6821
|
+
// if (RA < 0) RA += 360;
|
|
6822
|
+
// fprintf(f,"%lf %lf %lf %lf\n", t, RA, Dec, ran);
|
|
6823
|
+
// fclose(f);
|
|
6824
|
+
//}
|
|
6825
|
+
|
|
6826
|
+
|
|
6827
|
+
if (satellite > 0 && satellite <= nsat) {
|
|
6828
|
+
if (ndatasat[satellite - 1] > 2) {
|
|
6829
|
+
ty = (t - startsat[satellite - 1]) / stepsat[satellite - 1];
|
|
6830
|
+
ic = (int) floor(ty);
|
|
6831
|
+
ty -= ic;
|
|
6832
|
+
for (int i = 0; i < 3; i++) {
|
|
6833
|
+
Spit = possat[satellite - 1][ic][i] * (1 - ty) + possat[satellite - 1][ic + 1][i] * ty;
|
|
6834
|
+
Et[0] += Spit * rad[i];
|
|
6835
|
+
Et[1] += Spit * tang[i];
|
|
6448
6836
|
}
|
|
6449
6837
|
}
|
|
6450
6838
|
}
|