VBMicrolensing 5.3.5__cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.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.
@@ -0,0 +1,2061 @@
1
+ #include <pybind11/pybind11.h>
2
+ #include <pybind11/stl.h>
3
+ #include "VBMicrolensingLibrary.h"
4
+ #include <string>
5
+ #include <filesystem>
6
+ #include <pybind11/functional.h>
7
+
8
+
9
+
10
+
11
+ namespace py = pybind11;
12
+
13
+ // Declaration of an instance to VBMicrolensing class.
14
+ VBMicrolensing VBM;
15
+
16
+ PYBIND11_MODULE(VBMicrolensing, m) {
17
+ py::options options;
18
+ options.disable_function_signatures();
19
+
20
+ py::class_<VBMicrolensing> vbm(m, "VBMicrolensing");
21
+ vbm.def(py::init());
22
+ // Settings
23
+
24
+ vbm.def_readwrite("Tol", &VBMicrolensing::Tol,
25
+ "Absolute accuracy goal.");
26
+ vbm.def_readwrite("RelTol", &VBMicrolensing::RelTol,
27
+ "Relative precision goal.");
28
+ vbm.def_readwrite("a1", &VBMicrolensing::a1,
29
+ "Linear limb darkening coefficient. I(r)=I(0)(1-a1(1-\\sqrt{1-r^2/\\rho^2}))");
30
+ vbm.def_readwrite("a2", &VBMicrolensing::a2,
31
+ "Second limb darkening coefficient.");
32
+ vbm.def_readwrite("minannuli", &VBMicrolensing::minannuli,
33
+ "Minimum number of annuli to calculate for limb darkening.");
34
+ vbm.def_readwrite("NPcrit", &VBMicrolensing::NPcrit,
35
+ "Number of points in critical curves.");
36
+ vbm.def_readwrite("parallaxephemeris", &VBMicrolensing::parallaxephemeris,
37
+ "True for parallax calculation with ephemeris, False for parallax calculation with Kepler equation");
38
+ vbm.def_readwrite("parallaxextrapolation", &VBMicrolensing::parallaxextrapolation,
39
+ "If non-zero, extrapolation has been used because the input time is outside the lookup tables");
40
+ vbm.def_readwrite("parallaxsystem", &VBMicrolensing::parallaxsystem,
41
+ "0 for parallel-perpendicular, 1 for North-Eeast.");
42
+ vbm.def_readwrite("t0_par_fixed", &VBMicrolensing::t0_par_fixed,
43
+ "Set to 1 if you want to specify a constant t_{0,par}.");
44
+ vbm.def_readwrite("t0_par", &VBMicrolensing::t0_par,
45
+ "Reference time for parallax t_{0,par}. Only used if t0_par_fixed=1.");
46
+ vbm.def_readwrite("satellite", &VBMicrolensing::satellite,
47
+ "Specifies the satellite number for the next calculation \
48
+ (0 for observations from the ground);.");
49
+ vbm.def_readwrite("nsat", &VBMicrolensing::nsat,
50
+ "Number of satellite tables found in satellite table directory.");
51
+ vbm.def_readwrite("astrometry", &VBMicrolensing::astrometry,
52
+ "Unlock astrometry centroid calculation.");
53
+ vbm.def_readwrite("astrox1", &VBMicrolensing::astrox1,
54
+ "The x component of the light centroid.");
55
+ vbm.def_readwrite("astrox2", &VBMicrolensing::astrox2,
56
+ "The y component of the light centroid.");
57
+ vbm.def_readwrite("mass_luminosity_exponent", &VBMicrolensing::mass_luminosity_exponent,
58
+ "Exponent for the mass-luminosity relation: L = M^q; default value is q=4.0");
59
+ vbm.def_readwrite("mass_radius_exponent", &VBMicrolensing::mass_radius_exponent,
60
+ "Exponent for the mass-radius relation: R = M^q; default value is q=0.89");
61
+ vbm.def_readwrite("lens_mass_luminosity_exponent", &VBMicrolensing::lens_mass_luminosity_exponent,
62
+ "Exponent for the mass-luminosity relation for the lens: L = M^q; default value is q=4.0");
63
+ vbm.def_readwrite("turn_off_secondary_source", &VBMicrolensing::turn_off_secondary_source,
64
+ "Flux of secondary source is set to zero.");
65
+ vbm.def_readwrite("turn_off_secondary_lens", &VBMicrolensing::turn_off_secondary_lens,
66
+ "Flux of secondary lens is set to zero.");
67
+ vbm.def_readwrite("t_in_HJD", &VBMicrolensing::t_in_HJD,
68
+ "Set if t is given in HJD");
69
+ vbm.def_readwrite("corrquad", &VBMicrolensing::corrquad,
70
+ "Quadrupole test.");
71
+ vbm.def_readwrite("corrquad2", &VBMicrolensing::corrquad2,
72
+ "Ghost image test.");
73
+ vbm.def_readwrite("safedist", &VBMicrolensing::corrquad,
74
+ "Distance from planetary caustic.");
75
+
76
+
77
+ vbm.def("LoadESPLTable", &VBMicrolensing::LoadESPLTable,
78
+ """Loads a pre calculated binary table for extended source calculation.""");
79
+ vbm.def("LoadSunTable", &VBMicrolensing::LoadSunTable,
80
+ """Loads a Sun ephemeris table for parallax calculation.""");
81
+ vbm.def("SetESPLtablefile", [](char* s) {
82
+ VBMicrolensing::SetESPLtablefile(s);
83
+ },
84
+ """Sets the path to a pre calculated binary table for extended source calculation.""");
85
+ vbm.def("SetSuntablefile", [](char* s) {
86
+ VBMicrolensing::SetSuntablefile(s);
87
+ },
88
+ """Sets the path to a pre calculated Sun ephemeris table to be used in parallax calculations.""");
89
+ // Maginfication calculations
90
+ vbm.def("PSPLMag", &VBMicrolensing::PSPLMag,
91
+ py::return_value_policy::reference,
92
+ R"mydelimiter(
93
+ Point Source Point Lens magnification calculation.
94
+
95
+ Magnification of a point source by a single lens.
96
+
97
+ Parameters
98
+ ----------
99
+ u : float
100
+ Distance of source from the center of the lens.
101
+
102
+ Returns
103
+ -------
104
+ float
105
+ Magnification.
106
+ )mydelimiter");
107
+ vbm.def("ESPLMag", &VBMicrolensing::ESPLMag,
108
+ py::return_value_policy::reference,
109
+ R"mydelimiter(
110
+ Extended Source Point Lens magnification calculation.
111
+
112
+ Magnification of a uniform brightness-source by a single lens.
113
+ This uses the pre-calculated table which has to be loaded before
114
+ calling this function.
115
+
116
+ Parameters
117
+ ----------
118
+ u : float
119
+ Distance of source from the center of the lens.
120
+ rho : float
121
+ Source radius in units of the Einstein radius of the lens.
122
+
123
+ Returns
124
+ -------
125
+ float
126
+ Magnification.
127
+ )mydelimiter");
128
+ vbm.def("ESPLMag2", &VBMicrolensing::ESPLMag2,
129
+ R"mydelimiter(
130
+ Extended Source Point Lens magnification calculation v2.0.
131
+
132
+ ESPLMag2 works the same way as BinaryMag2. It checks whether we are
133
+ far enough to use the point-source approximation and if necessary,
134
+ it goes for the full computation by calling ESPLMagDark
135
+
136
+ Parameters
137
+ ----------
138
+ u : float
139
+ Distance of source from the center of the lens.
140
+ rho : float
141
+ Source radius in units of the Einstein radius of the lens.
142
+
143
+ Returns
144
+ -------
145
+ float
146
+ Magnification.
147
+ )mydelimiter");
148
+ vbm.def("ESPLMagDark", &VBMicrolensing::ESPLMagDark,
149
+ py::return_value_policy::reference,
150
+ R"mydelimiter(
151
+ Extended Source Point Lens magnification calculation v2.0.
152
+ including limb darkening.
153
+
154
+ Parameters
155
+ ----------
156
+ u : float
157
+ Distance of source from the center of the lens.
158
+ rho : float
159
+ Source radius in units of the Einstein radius of the lens.
160
+ a1 : float
161
+ Linear limb darkening coefficient.
162
+
163
+ Returns
164
+ -------
165
+ float
166
+ Magnification.
167
+ )mydelimiter");
168
+ vbm.def("BinaryMag0",
169
+ (double (VBMicrolensing::*)(double, double, double, double))
170
+ & VBMicrolensing::BinaryMag0,
171
+ py::return_value_policy::reference,
172
+ R"mydelimiter(
173
+ Magnification of a point-source by a binary lens.
174
+
175
+ Parameters
176
+ ----------
177
+ s : float
178
+ The projected separation of the binary lens in units of the
179
+ Einstein radius corresponding to the total mass.
180
+ q : float
181
+ Binary lens mass fraction q = m1/m2 s.t. m1<m2
182
+ y1 : float
183
+ x-position of the source in the source plane.
184
+ y2 : float
185
+ y-position of the source in the source plane.
186
+
187
+ Returns
188
+ -------
189
+ float
190
+ Magnification.
191
+ )mydelimiter");
192
+
193
+ vbm.def("BinaryMag",
194
+ (double (VBMicrolensing::*)(double, double, double, double, double, double))
195
+ & VBMicrolensing::BinaryMag,
196
+ py::return_value_policy::reference,
197
+ R"mydelimiter(
198
+ Magnification of a uniform brightness finite source
199
+ by a binary lens.
200
+
201
+ Parameters
202
+ ----------
203
+ s : float
204
+ The projected separation of the binary lens in units of the
205
+ Einstein radius corresponding to the total mass.
206
+ q : float
207
+ Binary lens mass fraction q = m1/m2 s.t. m1<m2
208
+ y1 : float
209
+ x-position of the source in the source plane.
210
+ y2 : float
211
+ y-position of the source in the source plane.
212
+ rho : float
213
+ Source angular radius in units of the Einstein radius
214
+ corresponding to the total mass.
215
+ accuracy : float
216
+ Absolute accuracy goal for the magnification calculation.
217
+
218
+ Returns
219
+ -------
220
+ float
221
+ Magnification.
222
+ )mydelimiter");
223
+ vbm.def("BinaryMagDark",
224
+ &VBMicrolensing::BinaryMagDark,
225
+ py::return_value_policy::reference,
226
+ R"mydelimiter(
227
+ Magnification of a limb-darkened finite source
228
+ by a binary lens.
229
+
230
+ Parameters
231
+ ----------
232
+ s : float
233
+ The projected separation of the binary lens in units of the
234
+ Einstein radius corresponding to the total mass.
235
+ q : float
236
+ Binary lens mass fraction q = m1/m2 s.t. m1<m2
237
+ y1 : float
238
+ x-position of the source in the source plane.
239
+ y2 : float
240
+ y-position of the source in the source plane.
241
+ rho : float
242
+ Source angular radius in units of the Einstein radius
243
+ corresponding to the total mass.
244
+ a1 : float
245
+ Source angular radius in units of the Einstein radius
246
+ corresponding to the total mass.
247
+
248
+ accuracy : float
249
+ Absolute accuracy goal for the magnification calculation.
250
+
251
+ Returns
252
+ -------
253
+ float
254
+ Magnification.
255
+ )mydelimiter");
256
+ vbm.def("BinaryMagMultiDark",
257
+ (void (VBMicrolensing::*)(double, double, double, double, double, std::vector<double> a1_list, int, std::vector<double> mag_list, double))
258
+ & VBMicrolensing::BinaryMagMultiDark,
259
+ py::return_value_policy::reference,
260
+ R"mydelimiter(
261
+ Magnification of a limb-darkened source by a binary lens in \
262
+ different filters with different limb darkening coefficients.
263
+
264
+ Parameters
265
+ ----------
266
+ s : float
267
+ The projected separation of the binary lens in units of the
268
+ Einstein radius corresponding to the total mass.
269
+ q : float
270
+ Binary lens mass fraction q = m1/m2 s.t. m1<m2
271
+ y1 : float
272
+ x-position of the source in the source plane.
273
+ y2 : float
274
+ y-position of the source in the source plane.
275
+ rho : float
276
+ Source angular radius in units of the Einstein radius
277
+ corresponding to the total mass.
278
+ a1_list : ndarray
279
+ Array of linear limb darkening coefficients.
280
+ n_filters : int
281
+ Number of filters.
282
+ mag_list : ndarray
283
+ Array of magnifications to be calculated by the function.
284
+ accuracy : float
285
+ Absolute accuracy goal for the magnification calculation.
286
+
287
+ Returns
288
+ -------
289
+ void
290
+ )mydelimiter");
291
+
292
+ vbm.def("BinaryMag2", &VBMicrolensing::BinaryMag2,
293
+ py::return_value_policy::reference,
294
+ R"mydelimiter(
295
+ Magnification of a uniform brightness finite source
296
+ by a binary lens. New in v2.0, implements test described
297
+ in VBMicrolensing 2.0 paper.
298
+
299
+ Parameters
300
+ ----------
301
+ s : float
302
+ The projected separation of the binary lens in units of the
303
+ Einstein radius corresponding to the total mass.
304
+ q : float
305
+ Binary lens mass fraction q = m1/m2 s.t. m1<m2
306
+ y1 : float
307
+ x-position of the source in the source plane.
308
+ y2 : float
309
+ y-position of the source in the source plane.
310
+ rho : float
311
+ Source angular radius in units of the Einstein radius
312
+ corresponding to the total mass.
313
+ accuracy : float
314
+ Absolute accuracy goal for the magnification calculation.
315
+
316
+ Returns
317
+ -------
318
+ float
319
+ Magnification.
320
+ )mydelimiter");
321
+
322
+ vbm.def("ImageContours",
323
+ [](VBMicrolensing& self, double s, double q, double y1, double y2, double rho)
324
+ {
325
+ _sols_for_skiplist_curve* cimages;
326
+ std::vector<std::vector<std::vector<double> > > images;
327
+ self.BinaryMag(s, q, y1, y2, rho, self.Tol, &cimages);
328
+
329
+ for (_skiplist_curve* scurve = cimages->first; scurve; scurve = scurve->next) {
330
+ std::vector<std::vector<double> > newimage(2);
331
+ for (_point* scan = scurve->first; scan; scan = scan->next) {
332
+ newimage[0].push_back(scan->x1);
333
+ newimage[1].push_back(scan->x2);
334
+ }
335
+ images.push_back(newimage);
336
+ }
337
+
338
+ return images;
339
+ },
340
+ R"mydelimiter(
341
+ Image contours by a binary lens.
342
+
343
+ Parameters
344
+ ----------
345
+ s : float
346
+ The projected separation of the binary lens in units of the
347
+ Einstein radius corresponding to the total mass.
348
+ q : float
349
+ Binary lens mass fraction q = m1/m2 s.t. m1<m2
350
+ y1 : float
351
+ x-position of the source in the source plane.
352
+ y2 : float
353
+ y-position of the source in the source plane.
354
+ rho : float
355
+ Source angular radius in units of the Einstein radius
356
+ corresponding to the total mass.
357
+
358
+ Returns
359
+ -------
360
+ listofimages: list[list[list[float], list[float]]]
361
+ [images[list_of_x1,list_of_x2]]
362
+ .
363
+ )mydelimiter");
364
+
365
+ vbm.def("MultiImageContours",
366
+ [](VBMicrolensing& self, double y1, double y2, double rho)
367
+ {
368
+ _sols_for_skiplist_curve* cimages;
369
+ std::vector<std::vector<std::vector<double> > > images;
370
+ self.MultiMag(y1, y2, rho, self.Tol, &cimages);
371
+
372
+ for (_skiplist_curve* scurve = cimages->first; scurve; scurve = scurve->next) {
373
+ std::vector<std::vector<double> > newimage(2);
374
+ for (_point* scan = scurve->first; scan; scan = scan->next) {
375
+ newimage[0].push_back(scan->x1);
376
+ newimage[1].push_back(scan->x2);
377
+ }
378
+ images.push_back(newimage);
379
+ }
380
+
381
+ return images;
382
+ },
383
+ R"mydelimiter(
384
+ Image contours by a multiple lens. Remember to set the configuration by SetLensGeometry
385
+
386
+ Parameters
387
+ ----------
388
+ y1 : float
389
+ x-position of the source in the source plane.
390
+ y2 : float
391
+ y-position of the source in the source plane.
392
+ rho : float
393
+ Source angular radius in units of the Einstein radius
394
+ corresponding to the total mass.
395
+
396
+ Returns
397
+ -------
398
+ listofimages: list[list[list[float], list[float]]]
399
+ [images[list_of_x1,list_of_x2]]
400
+ .
401
+ )mydelimiter");
402
+
403
+ //vbm.def("SetObjectCoordinates", (void (VBMicrolensing::*)(char*)) & VBMicrolensing::SetObjectCoordinates,
404
+ // R"mydelimiter(
405
+ // Sets the astronomical coordinates of the microlensing target.
406
+ //
407
+ // Parameters
408
+ // ----------
409
+ // CoordinateString : string
410
+ // Format \"hr:mn:sc +deg:pr:sc\".
411
+ // )mydelimiter");
412
+
413
+ vbm.def("SetObjectCoordinates",
414
+ [](VBMicrolensing& self, char* coordinatestring)
415
+ {
416
+ self.SetObjectCoordinates(coordinatestring);
417
+ if (!self.AreCoordinatesSet()) {
418
+ py::print("! Invalid coordinates format !");
419
+ }
420
+ },
421
+ R"mydelimiter(
422
+ Sets the astronomical coordinates of the microlensing target.
423
+
424
+ Parameters
425
+ ----------
426
+ CoordinateString : string
427
+ Format \"hr:mn:sc +deg:pr:sc\".
428
+ )mydelimiter");
429
+
430
+ vbm.def("SetObjectCoordinates",
431
+ [](VBMicrolensing& self, char* coordinatefile, char* sattabledir)
432
+ {
433
+ if (std::filesystem::exists(sattabledir)) {
434
+ self.SetObjectCoordinates(coordinatefile, sattabledir);
435
+ if (!self.AreCoordinatesSet()) {
436
+ py::print("! Invalid coordinates format !");
437
+ }
438
+ }
439
+ else {
440
+ py::print("! Invalid satellite table directory !");
441
+ }
442
+ },
443
+ R"mydelimiter(
444
+ Sets the astronomical coordinates of the microlensing target and
445
+ specifies the path where to look for the position tables
446
+ of the satellites (if any).
447
+
448
+ Parameters
449
+ ----------
450
+ coordinatefile : string
451
+ filename with astronomical coordinates.
452
+ sattabledir : string
453
+ Name of the directory containing the position tables of the satellites.
454
+ )mydelimiter");
455
+
456
+ // Light curve calculations
457
+ vbm.def("PSPLLightCurve",
458
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
459
+ {
460
+ std::vector<double> mags(times.size());
461
+ std::vector<double> y1s(times.size());
462
+ std::vector<double> y2s(times.size());
463
+ self.PSPLLightCurve(params.data(), times.data(), mags.data(),
464
+ y1s.data(), y2s.data(), times.size());
465
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
466
+ return results;
467
+ },
468
+ R"mydelimiter(
469
+ PSPL light curve for a full array of observations.
470
+
471
+ Parameters
472
+ ----------
473
+ params : list[float]
474
+ List of parameters [log_u0, log_tE, t0].
475
+ times : list[float]
476
+ Array of times at which the magnification is calculated.
477
+
478
+ Returns
479
+ -------
480
+ results: list[list[float],list[float],list[float]]
481
+ [Magnification array, source position y1 array, source position y2 array]
482
+ )mydelimiter");
483
+
484
+ vbm.def("PSPLLightCurveParallax",
485
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
486
+ {
487
+ if (!self.AreCoordinatesSet()) {
488
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
489
+ std::vector< std::vector<double> > results{ };
490
+ return results;
491
+ }
492
+ if (self.satellite > self.nsat) {
493
+ py::print("! Ephemerides table not available for this satellite!");
494
+ std::vector< std::vector<double> > results{ };
495
+ return results;
496
+ }
497
+ std::vector<double> mags(times.size());
498
+ std::vector<double> y1s(times.size());
499
+ std::vector<double> y2s(times.size());
500
+ self.PSPLLightCurveParallax(params.data(), times.data(), mags.data(),
501
+ y1s.data(), y2s.data(), times.size());
502
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
503
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
504
+ return results;
505
+ },
506
+ R"mydelimiter(
507
+ PSPL light curve for a full array of observations including parallax.
508
+
509
+ Parameters
510
+ ----------
511
+ params : list[float]
512
+ List of parameters [u0, log_tE, t0, pai1, pai2] where pai1 and
513
+ pai2 are the components of parallax parallel and orthogonal
514
+ to the Earth's acceleration.
515
+ times : list[float]
516
+ Array of times at which the magnification is calculated.
517
+
518
+ Returns
519
+ -------
520
+ results: list[list[float],list[float],list[float]]
521
+ [Magnification array, source position y1 array, source position y2 array]
522
+ )mydelimiter");
523
+
524
+ vbm.def("ESPLLightCurve",
525
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
526
+ {
527
+ std::vector<double> mags(times.size());
528
+ std::vector<double> y1s(times.size());
529
+ std::vector<double> y2s(times.size());
530
+ self.ESPLLightCurve(params.data(), times.data(), mags.data(),
531
+ y1s.data(), y2s.data(), times.size());
532
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
533
+ return results;
534
+ },
535
+ R"mydelimiter(
536
+ ESPL light curve for a full array of observations.
537
+
538
+ Parameters
539
+ ----------
540
+ params : list[float]
541
+ List of parameters [log_u0, log_tE, t0, log_rho]
542
+ times : list[float]
543
+ Array of times at which the magnification is calculated.
544
+
545
+ Returns
546
+ -------
547
+ results: list[list[float],list[float],list[float]]
548
+ [Magnification array, source position y1 array, source position y2 array]
549
+ )mydelimiter");
550
+
551
+ vbm.def("ESPLLightCurveParallax",
552
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
553
+ {
554
+ if (!self.AreCoordinatesSet()) {
555
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
556
+ std::vector< std::vector<double> > results{ };
557
+ return results;
558
+ }
559
+ if (self.satellite > self.nsat) {
560
+ py::print("! Ephemerides table not available for this satellite!");
561
+ std::vector< std::vector<double> > results{ };
562
+ return results;
563
+ }
564
+ std::vector<double> mags(times.size());
565
+ std::vector<double> y1s(times.size());
566
+ std::vector<double> y2s(times.size());
567
+ self.ESPLLightCurveParallax(params.data(), times.data(), mags.data(),
568
+ y1s.data(), y2s.data(), times.size());
569
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
570
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
571
+ return results;
572
+ },
573
+ R"mydelimiter(
574
+ ESPL light curve for a full array of observations including parallax.
575
+
576
+ Parameters
577
+ ----------
578
+ params : list[float]
579
+ List of parameters [u0, log_tE, t0, log_rho, pai1, pai2] where pai1 and pai2
580
+ are the two components of the parallax.
581
+ times : list[float]
582
+ Array of times at which the magnification is calculated.
583
+
584
+ Returns
585
+ -------
586
+ results: list[list[float],list[float],list[float]]
587
+ [Magnification array, source position y1 array, source position y2 array]
588
+ )mydelimiter");
589
+ vbm.def("BinaryLightCurve",
590
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
591
+ {
592
+ std::vector<double> mags(times.size());
593
+ std::vector<double> y1s(times.size());
594
+ std::vector<double> y2s(times.size());
595
+ self.BinaryLightCurve(params.data(), times.data(), mags.data(),
596
+ y1s.data(), y2s.data(), times.size());
597
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
598
+ return results;
599
+ },
600
+ R"mydelimiter(
601
+ Static binary lens light curve for a given set of parameters.
602
+ Uses the BinaryMag2 function.
603
+
604
+ Parameters
605
+ ----------
606
+ params : list[float]
607
+ List of parameters [log_s, log_q, u0, alpha, log_rho, log_tE, t0]
608
+ times : list[float]
609
+ Array of times at which the magnification is calculated.
610
+
611
+ Returns
612
+ -------
613
+ results: list[list[float],list[float],list[float]]
614
+ [Magnification array, source position y1 array, source position y2 array]
615
+ )mydelimiter");
616
+
617
+ vbm.def("BinaryLightCurveW",
618
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
619
+ {
620
+ std::vector<double> mags(times.size());
621
+ std::vector<double> y1s(times.size());
622
+ std::vector<double> y2s(times.size());
623
+ self.BinaryLightCurveW(params.data(), times.data(), mags.data(),
624
+ y1s.data(), y2s.data(), times.size());
625
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
626
+ return results;
627
+ },
628
+ R"mydelimiter(
629
+ Static binary lens light curve for a given set of parameters
630
+ using the center of the caustic of the lens on the right as
631
+ a reference point for the trajectory.
632
+
633
+ Parameters
634
+ ----------
635
+ params : list[float]
636
+ List of parameters [log_s, log_q, u0_c, alpha, log_rho, log_tE, t0_c]
637
+ where u0_c and t0_c are defined with respect to the center of the caustic.
638
+ times : list[float]
639
+ Array of times at which the magnification is calculated.
640
+
641
+ Returns
642
+ -------
643
+ results: list[list[float],list[float],list[float]]
644
+ [Magnification array, source position y1 array, source position y2 array]
645
+ )mydelimiter");
646
+
647
+ vbm.def("BinaryLightCurveParallax",
648
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
649
+ {
650
+ if (!self.AreCoordinatesSet()) {
651
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
652
+ std::vector< std::vector<double> > results{ };
653
+ return results;
654
+ }
655
+ if (self.satellite > self.nsat) {
656
+ py::print("! Ephemerides table not available for this satellite!");
657
+ std::vector< std::vector<double> > results{ };
658
+ return results;
659
+ }
660
+ std::vector<double> mags(times.size());
661
+ std::vector<double> y1s(times.size());
662
+ std::vector<double> y2s(times.size());
663
+ self.BinaryLightCurveParallax(params.data(), times.data(), mags.data(),
664
+ y1s.data(), y2s.data(), times.size());
665
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
666
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
667
+ return results;
668
+
669
+ },
670
+ R"mydelimiter(
671
+ Static binary lens light curve for a given set of parameters including parallax.
672
+ Uses the BinaryMag2 function.
673
+
674
+ Parameters
675
+ ----------
676
+ params : list[float]
677
+ List of parameters [log_s, log_q, u0, alpha, log_rho, log_tE, t0, pai1, pai2]
678
+ where pai1 and pai2 are the components of parallax parallel and orthogonal to the
679
+ Earth's acceleration.
680
+ times : list[float]
681
+ Array of times at which the magnification is calculated.
682
+
683
+ Returns
684
+ -------
685
+ results: list[list[float],list[float],list[float]]
686
+ [Magnification array, source position y1 array, source position y2 array]
687
+ )mydelimiter");
688
+
689
+ vbm.def("BinaryLightCurveOrbital",
690
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
691
+ {
692
+ if (!self.AreCoordinatesSet()) {
693
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
694
+ std::vector< std::vector<double> > results{ };
695
+ return results;
696
+ }
697
+ if (self.satellite > self.nsat) {
698
+ py::print("! Ephemerides table not available for this satellite!");
699
+ std::vector< std::vector<double> > results{ };
700
+ return results;
701
+ }
702
+ std::vector<double> mags(times.size());
703
+ std::vector<double> y1s(times.size());
704
+ std::vector<double> y2s(times.size());
705
+ std::vector<double> separations(times.size());
706
+ self.BinaryLightCurveOrbital(params.data(), times.data(), mags.data(),
707
+ y1s.data(), y2s.data(), separations.data(), times.size());
708
+ std::vector< std::vector<double> > results{ mags,y1s,y2s, separations };
709
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
710
+ return results;
711
+ },
712
+ R"mydelimiter(
713
+ Static binary lens light curve for a given set of parameters including parallax.
714
+ Uses the BinaryMag2 function.
715
+
716
+ Parameters
717
+ ----------
718
+ params : list[float]
719
+ List of parameters [log_s, log_q, u0, alpha_0, log_rho, log_tE,
720
+ t0, pai1, pai2, w1, w2, w3] where pai1 and pai2 are the
721
+ components of parallax parallel and orthogonal to the Earth's
722
+ acceleration. w1, w2 and w3 are the orbital parameters (assuming
723
+ circular motion), defined as w1=(ds/dt)/s, w2=dalpha/dt, w3=(dsz/dt)/s.
724
+ times : list[float]
725
+ Array of times at which the magnification is calculated.
726
+
727
+ Returns
728
+ -------
729
+ results: list[list[float],list[float],list[float]]
730
+ [Magnification array, source position y1 array, source position y2 array, separation-between-lenses array]
731
+ )mydelimiter");
732
+
733
+ vbm.def("BinaryLightCurveKepler",
734
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
735
+ {
736
+ if (!self.AreCoordinatesSet()) {
737
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
738
+ std::vector< std::vector<double> > results{ };
739
+ return results;
740
+ }
741
+ if (self.satellite > self.nsat) {
742
+ py::print("! Ephemerides table not available for this satellite!");
743
+ std::vector< std::vector<double> > results{ };
744
+ return results;
745
+ }
746
+ std::vector<double> mags(times.size());
747
+ std::vector<double> y1s(times.size());
748
+ std::vector<double> y2s(times.size());
749
+ std::vector<double> separations(times.size());
750
+ self.BinaryLightCurveKepler(params.data(), times.data(), mags.data(),
751
+ y1s.data(), y2s.data(), separations.data(), times.size());
752
+ std::vector< std::vector<double> > results{ mags,y1s,y2s, separations };
753
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
754
+ return results;
755
+ },
756
+ R"mydelimiter(
757
+ binary lens light curve for a given set of parameters including keplerian orbital motion.
758
+ Uses the BinaryMag2 function.
759
+
760
+ Parameters
761
+ ----------
762
+ params : list[float]
763
+ List of parameters [log_s, log_q, u0, alpha_0, log_rho, log_tE,
764
+ t0, pai1, pai2, w1, w2, w3] where pai1 and pai2 are the
765
+ components of parallax parallel and orthogonal to the Earth's
766
+ acceleration. w1, w2 and w3 are the orbital parameters (assuming
767
+ circular motion), defined as w1=(ds/dt)/s, w2=dalpha/dt, w3=(dsz/dt)/s.
768
+ times : list[float]
769
+ Array of times at which the magnification is calculated.
770
+
771
+ Returns
772
+ -------
773
+ results: list[list[float],list[float],list[float]]
774
+ [Magnification array, source position y1 array, source position y2 array, separation-between-lenses array]
775
+ )mydelimiter");
776
+
777
+ vbm.def("BinSourceLightCurve",
778
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
779
+ {
780
+ std::vector<double> mags(times.size());
781
+ std::vector<double> y1s(times.size());
782
+ std::vector<double> y2s(times.size());
783
+ self.BinSourceLightCurve(params.data(), times.data(), mags.data(),
784
+ y1s.data(), y2s.data(), times.size());
785
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
786
+ return results;
787
+ },
788
+ R"mydelimiter(
789
+ Light curve for a single lens and a binary source. Sources are
790
+ treated as point-like.
791
+
792
+ Parameters
793
+ ----------
794
+ params : list[float]
795
+ List of parameters [log_tE, log_fluxratio, u0_1, u0_2, t0_1, t0_2]
796
+ times : list[float]
797
+ Array of times at which the magnification is calculated.
798
+
799
+ Returns
800
+ -------
801
+ results: list[list[float],list[float],list[float]]
802
+ [Magnification array, source position y1 array, source position y2 array]
803
+ )mydelimiter");
804
+
805
+ vbm.def("BinSourceLightCurveParallax",
806
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
807
+ {
808
+ if (!self.AreCoordinatesSet()) {
809
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
810
+ std::vector< std::vector<double> > results{ };
811
+ return results;
812
+ }
813
+ if (self.satellite > self.nsat) {
814
+ py::print("! Ephemerides table not available for this satellite!");
815
+ std::vector< std::vector<double> > results{ };
816
+ return results;
817
+ }
818
+ std::vector<double> mags(times.size());
819
+ std::vector<double> y1s(times.size());
820
+ std::vector<double> y2s(times.size());
821
+ self.BinSourceLightCurveParallax(params.data(), times.data(), mags.data(),
822
+ y1s.data(), y2s.data(), times.size());
823
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
824
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
825
+ return results;
826
+ },
827
+ R"mydelimiter(
828
+ Light curve for a single lens and a binary source including parallax.
829
+
830
+ Parameters
831
+ ----------
832
+ params : list[float]
833
+ List of parameters [log_tE, log_fluxratio, u0_1, u0_2, t0_1, t0_2, pai1, pai2}
834
+ where pai1 and pai2 are the components of parallax parallel and orthogonal to the
835
+ Earth's acceleration.
836
+ times : list[float]
837
+ Array of times at which the magnification is calculated.
838
+
839
+ Returns
840
+ -------
841
+ results: list[list[float],list[float],list[float]]
842
+ [Magnification array, source position y1 array, source position y2 array]
843
+ )mydelimiter");
844
+
845
+ vbm.def("BinSourceSingleLensXallarap",
846
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
847
+ {
848
+ std::vector<double> mags(times.size());
849
+ std::vector<double> y1s1(times.size());
850
+ std::vector<double> y2s1(times.size());
851
+ std::vector<double> y1s2(times.size());
852
+ std::vector<double> y2s2(times.size());
853
+ self.BinSourceSingleLensXallarap(params.data(), times.data(), mags.data(),
854
+ y1s1.data(), y2s1.data(), y1s2.data(), y2s2.data(), times.size());
855
+ std::vector< std::vector<double> > results{ mags,y1s1,y2s1,y1s2,y2s2 };
856
+ return results;
857
+ },
858
+ R"mydelimiter(
859
+ Binary source Single Lens Xallarap light curve.
860
+
861
+ Parameters
862
+ ----------
863
+ params : list[float]
864
+ List of parameters [log_tE, log_qs, u0, t0, xi1, xi2,
865
+ rho, omega, inc, phi, w2, w3] where xi1 and xi2 are the
866
+ components of xallarap parallel and orthogonal to the
867
+ seperation between the sources.
868
+ times : list[float]
869
+ Array of times at which the magnification is calculated.
870
+
871
+ Returns
872
+ -------
873
+ results: list[list[float],list[float],list[float],list[float],list[float]]
874
+ [Magnification array, source 1 position y1 array, source 1 position y2 array, source 2 position y1 array, source 2 position y2 array]
875
+ )mydelimiter");
876
+
877
+ vbm.def("BinSourceExtLightCurve",
878
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
879
+ {
880
+ std::vector<double> mags(times.size());
881
+ std::vector<double> y1s(times.size());
882
+ std::vector<double> y2s(times.size());
883
+ self.BinSourceExtLightCurve(params.data(), times.data(), mags.data(),
884
+ y1s.data(), y2s.data(), times.size());
885
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
886
+ return results;
887
+ },
888
+ R"mydelimiter(
889
+ Light curve for a single lens and a binary source. Sources are
890
+ treated as point-like.
891
+
892
+ Parameters
893
+ ----------
894
+ params : list[float]
895
+ List of parameters [log_tE, log_fluxratio, u0_1, u0_2, t0_1, t0_2, rho]
896
+ times : list[float]
897
+ Array of times at which the magnification is calculated.
898
+
899
+ Returns
900
+ -------
901
+ results: list[list[float],list[float],list[float]]
902
+ [Magnification array, source position y1 array, source position y2 array]
903
+ )mydelimiter");
904
+
905
+ vbm.def("BinSourceExtLightCurveXallarap",
906
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
907
+ {
908
+ if (!self.AreCoordinatesSet()) {
909
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
910
+ std::vector< std::vector<double> > results{ };
911
+ return results;
912
+ }
913
+ if (self.satellite > self.nsat) {
914
+ py::print("! Ephemerides table not available for this satellite!");
915
+ std::vector< std::vector<double> > results{ };
916
+ return results;
917
+ }
918
+ std::vector<double> mags(times.size());
919
+ std::vector<double> y1s1(times.size());
920
+ std::vector<double> y2s1(times.size());
921
+ std::vector<double> y1s2(times.size());
922
+ std::vector<double> y2s2(times.size());
923
+ self.BinSourceExtLightCurveXallarap(params.data(), times.data(), mags.data(),
924
+ y1s1.data(), y2s1.data(), y1s2.data(), y2s2.data(), times.size());
925
+ std::vector< std::vector<double> > results{ mags,y1s1,y2s1,y1s2,y2s2 };
926
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
927
+ return results;
928
+ },
929
+ R"mydelimiter(
930
+ Binary source light curve including xallarap for a full array of observations.
931
+
932
+ Parameters
933
+ ----------
934
+ params : list[float]
935
+ List of parameters [log_tE, log_FR, u01, u02, t01, t02, log_rho1,
936
+ paiN, paiE, # components of the parallax vector
937
+ w1, w2, w3, # relative angular orbital velocity components (Einstein angle/day)
938
+ ]
939
+ times : list[float]
940
+ Array of times at which the magnification is calculated.
941
+
942
+ Returns
943
+ -------
944
+ results: list[list[float],list[float],list[float],list[float],list[float]]
945
+ [Magnification array,
946
+ source1 position y1 array, source1 position y2 array,
947
+ source2 position y1 array, source2 position y2 array]
948
+ )mydelimiter");
949
+
950
+
951
+ vbm.def("BinSourceBinLensLightCurve",
952
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
953
+ {
954
+ if (!self.AreCoordinatesSet()) {
955
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
956
+ std::vector< std::vector<double> > results{ };
957
+ return results;
958
+ }
959
+ if (self.satellite > self.nsat) {
960
+ py::print("! Ephemerides table not available for this satellite!");
961
+ std::vector< std::vector<double> > results{ };
962
+ return results;
963
+ }
964
+ std::vector<double> mags(times.size());
965
+ std::vector<double> y1s1(times.size());
966
+ std::vector<double> y2s1(times.size());
967
+ std::vector<double> y1s2(times.size());
968
+ std::vector<double> y2s2(times.size());
969
+ std::vector<double> seps(times.size());
970
+ self.astrometry = true;
971
+ self.parallaxsystem = 1;
972
+ self.BinSourceBinLensLightCurve(params.data(), times.data(), mags.data(),
973
+ y1s1.data(), y2s1.data(), y1s2.data(), y2s2.data(), seps.data(), times.size());
974
+ std::vector< std::vector<double> > results{ mags, y1s1,y2s1,y1s2,y2s2,seps };
975
+ return results;
976
+ },
977
+ R"mydelimiter(
978
+ Binary source - Binary lens light curve including xallarap and orbital motion for a full array of observations.
979
+
980
+ Parameters
981
+ ----------
982
+ params : list[float]
983
+ List of parameters [log_s, log_q, u0, alpha, log_rho, log_tE, t0,
984
+ paiN, paiE, # components of the parallax vector
985
+ w1, w2, w3, # relative angular orbital velocity components (Einstein angle/day)
986
+ u02, t02, # impact parameter, time of closest approach of the seconf source
987
+ log_FR, # log of flux ratio of the two sources
988
+ ws1, ws2, ws3, # relative angular orbital velocity components of the sources (Einstein angle/day)
989
+ ]
990
+ times : list[float]
991
+ Array of times at which the magnification is calculated.
992
+
993
+ Returns
994
+ -------
995
+ results: list[list[float],list[float],list[float],list[float],list[float],list[float]]
996
+ [Magnification array,
997
+ source1 position y1 array, source1 position y2 array,
998
+ source2 position y1 array, source2 position y2 array,
999
+ projected separations of the two lenses]
1000
+ )mydelimiter");
1001
+
1002
+ vbm.def("BinSourceBinLensXallarap",
1003
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1004
+ {
1005
+ std::vector<double> mags(times.size());
1006
+ std::vector<double> y1s(times.size());
1007
+ std::vector<double> y2s(times.size());
1008
+ self.BinSourceBinLensXallarap(params.data(), times.data(), mags.data(),
1009
+ y1s.data(), y2s.data(), times.size());
1010
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
1011
+ return results;
1012
+ },
1013
+ R"mydelimiter(
1014
+ Binary source Single Lens Xallarap light curve.
1015
+
1016
+ Parameters
1017
+ ----------
1018
+ params : list[float]
1019
+ List of parameters [log_s, log_q, u0, alpha, log_rho, log_tE, t0, xi1, xi2,
1020
+ omega, inc, phi, log_qs] where xi1 and xi2 are the
1021
+ components of xallarap parallel and orthogonal to the
1022
+ separation between the sources.
1023
+ times : list[float]
1024
+ Array of times at which the magnification is calculated.
1025
+
1026
+ Returns
1027
+ -------
1028
+ results: list[list[float],list[float],list[float]]
1029
+ [Magnification array, y1 array, y2 array]
1030
+ )mydelimiter");
1031
+
1032
+
1033
+ vbm.def("BinSourceLightCurveXallarap",
1034
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1035
+ {
1036
+ if (!self.AreCoordinatesSet()) {
1037
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
1038
+ std::vector< std::vector<double> > results{ };
1039
+ return results;
1040
+ }
1041
+ if (self.satellite > self.nsat) {
1042
+ py::print("! Ephemerides table not available for this satellite!");
1043
+ std::vector< std::vector<double> > results{ };
1044
+ return results;
1045
+ }
1046
+ std::vector<double> mags(times.size());
1047
+ std::vector<double> y1s(times.size());
1048
+ std::vector<double> y2s(times.size());
1049
+ std::vector<double> separations(times.size());
1050
+ self.BinSourceLightCurveXallarap(params.data(), times.data(), mags.data(),
1051
+ y1s.data(), y2s.data(), separations.data(), times.size());
1052
+ std::vector< std::vector<double> > results{ mags,y1s,y2s, separations };
1053
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
1054
+ return results;
1055
+ },
1056
+ R"mydelimiter(
1057
+ Binary source light curve.
1058
+
1059
+ Note that the mass ratio q between the two sources is required
1060
+ to calculate orbital motion. Orbital motion is assumed without
1061
+ eccentricity (see before). The parameters u0_1, u0_2, t0_1,
1062
+ t0_2 specify the configuration at time t0 calculated as the
1063
+ closest approach of the center of mass.
1064
+
1065
+ Parameters
1066
+ ----------
1067
+ params : list[float]
1068
+ List of parameters [log_tE, log_fluxratio, u0_1, u0_2, t0_1, t0_2,
1069
+ pai1, pai2, q, w1, w2, w3] where pai1 and pai2 are the
1070
+ components of parallax parallel and orthogonal to the Earth's
1071
+ acceleration. w1, w2 and w3 are the orbital parameters (assuming
1072
+ circular motion), defined as w1=(ds/dt)/s, w2=dalpha/dt, w3=(dsz/dt)/s.
1073
+ times : list[float]
1074
+ Array of times at which the magnification is calculated.
1075
+
1076
+ Returns
1077
+ -------
1078
+ results: list[list[float],list[float],list[float],list[float]]
1079
+ [Magnification array, y1 array, y2 array, separation-between-lenses array]
1080
+ )mydelimiter");
1081
+
1082
+ vbm.def("TripleLightCurve",
1083
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1084
+ {
1085
+ std::vector<double> mags(times.size());
1086
+ std::vector<double> y1s(times.size());
1087
+ std::vector<double> y2s(times.size());
1088
+ self.TripleLightCurve(params.data(), times.data(), mags.data(),
1089
+ y1s.data(), y2s.data(), times.size());
1090
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
1091
+ return results;
1092
+ },
1093
+ R"mydelimiter(
1094
+ Static binary lens light curve for a given set of parameters.
1095
+ Uses the BinaryMag2 function.
1096
+
1097
+ Parameters
1098
+ ----------
1099
+ params : list[float]
1100
+ List of parameters [log(s12), log(q2), u0, alpha, log(rho), log(tE), t0, log(s13), log(q3), psi]
1101
+ times : list[float]
1102
+ Array of times at which the magnification is calculated.
1103
+
1104
+ Returns
1105
+ -------
1106
+ results: list[list[float],list[float],list[float]]
1107
+ [Magnification array, source position y1 array, source position y2 array]
1108
+ )mydelimiter");
1109
+
1110
+ vbm.def("TripleLightCurveParallax",
1111
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1112
+ {
1113
+ if (!self.AreCoordinatesSet()) {
1114
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
1115
+ std::vector< std::vector<double> > results{ };
1116
+ return results;
1117
+ }
1118
+ if (self.satellite > self.nsat) {
1119
+ py::print("! Ephemerides table not available for this satellite!");
1120
+ std::vector< std::vector<double> > results{ };
1121
+ return results;
1122
+ }
1123
+ std::vector<double> mags(times.size());
1124
+ std::vector<double> y1s(times.size());
1125
+ std::vector<double> y2s(times.size());
1126
+ self.TripleLightCurveParallax(params.data(), times.data(), mags.data(),
1127
+ y1s.data(), y2s.data(), times.size());
1128
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
1129
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
1130
+ return results;
1131
+ },
1132
+ R"mydelimiter(
1133
+ Static binary lens light curve for a given set of parameters.
1134
+ Uses the BinaryMag2 function.
1135
+
1136
+ Parameters
1137
+ ----------
1138
+ params : list[float]
1139
+ List of parameters [log(s12), log(q2), u0, alpha, log(rho), log(tE), t0, log(s13), log(q3), psi,px1,px2]
1140
+ times : list[float]
1141
+ Array of times at which the magnification is calculated.
1142
+
1143
+ Returns
1144
+ -------
1145
+ results: list[list[float],list[float],list[float]]
1146
+ [Magnification array, source position y1 array, source position y2 array]
1147
+ )mydelimiter");
1148
+
1149
+ vbm.def("LightCurve",
1150
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1151
+ {
1152
+ std::vector<double> mags(times.size());
1153
+ std::vector<double> y1s(times.size());
1154
+ std::vector<double> y2s(times.size());
1155
+ self.LightCurve(params.data(), times.data(), mags.data(),
1156
+ y1s.data(), y2s.data(), times.size(), (params.size() - 4) / 3 + 1);
1157
+ std::vector< std::vector<double> > results{ mags,y1s,y2s };
1158
+ return results;
1159
+ },
1160
+ R"mydelimiter(
1161
+ Static binary lens light curve for a given set of parameters.
1162
+ Uses the BinaryMag2 function.
1163
+
1164
+ Parameters
1165
+ ----------
1166
+ params : list[float]
1167
+ List of parameters [t0, log_tE, log_rho, s1_im, s2_real,....,s2_im,...., q2,...,qn]
1168
+ times : list[float]
1169
+ Array of times at which the magnification is calculated.
1170
+
1171
+ Returns
1172
+ -------
1173
+ results: list[list[float],list[float],list[float]]
1174
+ [Magnification array, source position y1 array, source position y2 array]
1175
+ )mydelimiter");
1176
+
1177
+ // Astrometric functions
1178
+
1179
+ vbm.def("CombineCentroids",
1180
+ [](VBMicrolensing& self, std::vector< std::vector<double> > results, double blending)
1181
+ {
1182
+ std::vector<double> c1tot(results[0].size());
1183
+ std::vector<double> c2tot(results[0].size());
1184
+ self.CombineCentroids(results[0].data(), results[1].data(), results[2].data(), results[3].data(), results[4].data(), c1tot.data(), c2tot.data(), blending, results[0].size());
1185
+ std::vector< std::vector<double> > centroids{ c1tot, c2tot };
1186
+ return centroids;
1187
+ },
1188
+ R"mydelimiter(
1189
+ Combine source and lens centroids from astrometric functions taking into account blending and magnification.
1190
+
1191
+ Parameters
1192
+ ----------
1193
+ results : list[list[float],list[float],list[float],list[float],list[float],list[float],list[float]]
1194
+ Results returned from an astrometric functions.
1195
+ blending : float
1196
+ flux ratio lens/source.
1197
+
1198
+ Returns
1199
+ -------
1200
+ centroids: list[list[float],list[float]]
1201
+ [combined centroid of images Dec array, combined centroid of images R.A. array]
1202
+ )mydelimiter");
1203
+
1204
+ vbm.def("PSPLAstroLightCurve",
1205
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1206
+ {
1207
+ if (!self.AreCoordinatesSet()) {
1208
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
1209
+ std::vector< std::vector<double> > results{ };
1210
+ return results;
1211
+ }
1212
+ if (self.satellite > self.nsat) {
1213
+ py::print("! Ephemerides table not available for this satellite!");
1214
+ std::vector< std::vector<double> > results{ };
1215
+ return results;
1216
+ }
1217
+ std::vector<double> mags(times.size());
1218
+ std::vector<double> c1s(times.size());
1219
+ std::vector<double> c2s(times.size());
1220
+ std::vector<double> c1l(times.size());
1221
+ std::vector<double> c2l(times.size());
1222
+ std::vector<double> y1s(times.size());
1223
+ std::vector<double> y2s(times.size());
1224
+ self.astrometry = true;
1225
+ self.PSPLAstroLightCurve(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1226
+ y1s.data(), y2s.data(), times.size());
1227
+ std::vector< std::vector<double> > results{ mags, c1s, c2s, c1l, c2l,y1s,y2s };
1228
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
1229
+ return results;
1230
+ },
1231
+ R"mydelimiter(
1232
+ PSPL light curve and astrometry for a full array of observations.
1233
+
1234
+ Parameters
1235
+ ----------
1236
+ params : list[float]
1237
+ List of parameters [u0, log_tE, t0,
1238
+ paiN, paiE, #components of the parallax vector
1239
+ muS_N, muS_E, # proper motion components of the source (mas/yr)
1240
+ pai_S, # parallax of the source (mas)
1241
+ thetaE # Einstein angle (mas)
1242
+ times : list[float]
1243
+ Array of times at which the magnification is calculated.
1244
+
1245
+ Returns
1246
+ -------
1247
+ results: list[list[float],list[float],list[float],list[float],list[float],list[float],list[float]]
1248
+ [Magnification array,
1249
+ centroid of images N array, centroid of images E array,
1250
+ centroid of lens N array, centroid of lens E array,
1251
+ source position y1 array, source position y2 array]
1252
+ )mydelimiter");
1253
+
1254
+ vbm.def("ESPLAstroLightCurve",
1255
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1256
+ {
1257
+ if (!self.AreCoordinatesSet()) {
1258
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
1259
+ std::vector< std::vector<double> > results{ };
1260
+ return results;
1261
+ }
1262
+ if (self.satellite > self.nsat) {
1263
+ py::print("! Ephemerides table not available for this satellite!");
1264
+ std::vector< std::vector<double> > results{ };
1265
+ return results;
1266
+ }
1267
+ std::vector<double> mags(times.size());
1268
+ std::vector<double> c1s(times.size());
1269
+ std::vector<double> c2s(times.size());
1270
+ std::vector<double> c1l(times.size());
1271
+ std::vector<double> c2l(times.size());
1272
+ std::vector<double> y1s(times.size());
1273
+ std::vector<double> y2s(times.size());
1274
+ self.astrometry = true;
1275
+ self.parallaxsystem = 1;
1276
+ self.ESPLAstroLightCurve(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1277
+ y1s.data(), y2s.data(), times.size());
1278
+ std::vector< std::vector<double> > results{ mags, c1s, c2s, c1l, c2l,y1s,y2s };
1279
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
1280
+ return results;
1281
+ },
1282
+ R"mydelimiter(
1283
+ ESPL light curve and astrometry for a full array of observations.
1284
+
1285
+ Parameters
1286
+ ----------
1287
+ params : list[float]
1288
+ List of parameters [u0, log_tE, t0, log_rho,
1289
+ paiN, paiE, #components of the parallax vector
1290
+ muS_N, muS_E, # proper motion components of the source (mas/yr)
1291
+ pai_S, # parallax of the source (mas)
1292
+ thetaE # Einstein angle (mas)
1293
+ ]
1294
+ times : list[float]
1295
+ Array of times at which the magnification is calculated.
1296
+
1297
+ Returns
1298
+ -------
1299
+ results: list[list[float],list[float],list[float],list[float],list[float],list[float],list[float]]
1300
+ [Magnification array,
1301
+ centroid of images N array, centroid of images E array,
1302
+ centroid of lens N array, centroid of lens E array,
1303
+ source position y1 array, source position y2 array]
1304
+ )mydelimiter");
1305
+
1306
+
1307
+ vbm.def("BinaryAstroLightCurve",
1308
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1309
+ {
1310
+ if (!self.AreCoordinatesSet()) {
1311
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
1312
+ std::vector< std::vector<double> > results{ };
1313
+ return results;
1314
+ }
1315
+ if (self.satellite > self.nsat) {
1316
+ py::print("! Ephemerides table not available for this satellite!");
1317
+ std::vector< std::vector<double> > results{ };
1318
+ return results;
1319
+ }
1320
+ std::vector<double> mags(times.size());
1321
+ std::vector<double> c1s(times.size());
1322
+ std::vector<double> c2s(times.size());
1323
+ std::vector<double> c1l(times.size());
1324
+ std::vector<double> c2l(times.size());
1325
+ std::vector<double> y1s(times.size());
1326
+ std::vector<double> y2s(times.size());
1327
+ self.astrometry = true;
1328
+ self.parallaxsystem = 1;
1329
+ self.BinaryAstroLightCurve(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1330
+ y1s.data(), y2s.data(), times.size());
1331
+ std::vector< std::vector<double> > results{ mags, c1s, c2s, c1l, c2l,y1s,y2s };
1332
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
1333
+ return results;
1334
+ },
1335
+ R"mydelimiter(
1336
+ Binary light curve and astrometry for a full array of observations.
1337
+
1338
+ Parameters
1339
+ ----------
1340
+ params : list[float]
1341
+ List of parameters [log_s, log_q, u0, alpha, log_rho, log_tE, t0,
1342
+ paiN, paiE, #components of the parallax vector
1343
+ muS_N, muS_E, # proper motion components of the source (mas/yr)
1344
+ pai_S, # parallax of the source (mas)
1345
+ thetaE # Einstein angle (mas)
1346
+ ]
1347
+ times : list[float]
1348
+ Array of times at which the magnification is calculated.
1349
+
1350
+ Returns
1351
+ -------
1352
+ results: list[list[float],list[float],list[float],list[float],list[float],list[float],list[float]]
1353
+ [Magnification array,
1354
+ centroid of images N array, centroid of images E array,
1355
+ centroid of lens N array, centroid of lens E array,
1356
+ source position y1 array, source position y2 array]
1357
+ )mydelimiter");
1358
+
1359
+ vbm.def("BinaryAstroLightCurveOrbital",
1360
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1361
+ {
1362
+ if (!self.AreCoordinatesSet()) {
1363
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
1364
+ std::vector< std::vector<double> > results{ };
1365
+ return results;
1366
+ }
1367
+ if (self.satellite > self.nsat) {
1368
+ py::print("! Ephemerides table not available for this satellite!");
1369
+ std::vector< std::vector<double> > results{ };
1370
+ return results;
1371
+ }
1372
+ std::vector<double> mags(times.size());
1373
+ std::vector<double> c1s(times.size());
1374
+ std::vector<double> c2s(times.size());
1375
+ std::vector<double> c1l(times.size());
1376
+ std::vector<double> c2l(times.size());
1377
+ std::vector<double> y1s(times.size());
1378
+ std::vector<double> y2s(times.size());
1379
+ std::vector<double> seps(times.size());
1380
+ self.astrometry = true;
1381
+ self.parallaxsystem = 1;
1382
+ self.BinaryAstroLightCurveOrbital(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1383
+ y1s.data(), y2s.data(), seps.data(), times.size());
1384
+ std::vector< std::vector<double> > results{ mags, c1s, c2s, c1l, c2l,y1s,y2s, seps };
1385
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
1386
+ return results;
1387
+ },
1388
+ R"mydelimiter(
1389
+ Binary light curve and astrometry including circular orbital motion for a full array of observations.
1390
+
1391
+ Parameters
1392
+ ----------
1393
+ params : list[float]
1394
+ List of parameters [log_s, log_q, u0, alpha, log_rho, log_tE, t0,
1395
+ paiN, paiE, # components of the parallax vector
1396
+ w1, w2, w3, # relative angular orbital velocity components (Einstein angle/day)
1397
+ muS_N, muS_E, # proper motion components of the source (mas/yr)
1398
+ pai_S, # parallax of the source (mas)
1399
+ thetaE # Einstein angle (mas)
1400
+ ]
1401
+ times : list[float]
1402
+ Array of times at which the magnification is calculated.
1403
+
1404
+ Returns
1405
+ -------
1406
+ results: list[list[float],list[float],list[float],list[float],list[float],list[float],list[float],list[float]]
1407
+ [Magnification array,
1408
+ centroid of images N array, centroid of images E array,
1409
+ centroid of lens N array, centroid of lens E array,
1410
+ source position y1 array, source position y2 array, separations between the lenses array]
1411
+ )mydelimiter");
1412
+
1413
+ vbm.def("BinaryAstroLightCurveKepler",
1414
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1415
+ {
1416
+ if (!self.AreCoordinatesSet()) {
1417
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
1418
+ std::vector< std::vector<double> > results{ };
1419
+ return results;
1420
+ }
1421
+ if (self.satellite > self.nsat) {
1422
+ py::print("! Ephemerides table not available for this satellite!");
1423
+ std::vector< std::vector<double> > results{ };
1424
+ return results;
1425
+ }
1426
+ std::vector<double> mags(times.size());
1427
+ std::vector<double> c1s(times.size());
1428
+ std::vector<double> c2s(times.size());
1429
+ std::vector<double> c1l(times.size());
1430
+ std::vector<double> c2l(times.size());
1431
+ std::vector<double> y1s(times.size());
1432
+ std::vector<double> y2s(times.size());
1433
+ std::vector<double> seps(times.size());
1434
+ self.astrometry = true;
1435
+ self.parallaxsystem = 1;
1436
+ self.BinaryAstroLightCurveKepler(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1437
+ y1s.data(), y2s.data(), seps.data(), times.size());
1438
+ std::vector< std::vector<double> > results{ mags, c1s, c2s, c1l, c2l,y1s,y2s, seps };
1439
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
1440
+ return results;
1441
+ },
1442
+ R"mydelimiter(
1443
+ Binary light curve and astrometry including eccentric orbital motion for a full array of observations.
1444
+
1445
+ Parameters
1446
+ ----------
1447
+ params : list[float]
1448
+ List of parameters [log_s, log_q, u0, alpha, log_rho, log_tE, t0,
1449
+ paiN, paiE, # components of the parallax vector
1450
+ w1, w2, w3, # relative angular orbital velocity components (Einstein angle/day)
1451
+ sz_s, # Ratio of separation along the line of sight and the transverse separation at t0
1452
+ a_stot, # Semimajor axis over the 3D separation at time t0
1453
+ muS_N, muS_E, # proper motion components of the source (mas/yr)
1454
+ pai_S, # parallax of the source (mas)
1455
+ thetaE # Einstein angle (mas)
1456
+ ]
1457
+ times : list[float]
1458
+ Array of times at which the magnification is calculated.
1459
+
1460
+ Returns
1461
+ -------
1462
+ results: list[list[float],list[float],list[float],list[float],list[float],list[float],list[float],list[float]]
1463
+ [Magnification array,
1464
+ centroid of images N array, centroid of images E array,
1465
+ centroid of lens N array, centroid of lens E array,
1466
+ source position y1 array, source position y2 array, separations between the lenses array]
1467
+ )mydelimiter");
1468
+
1469
+ vbm.def("BinSourceAstroLightCurveXallarap",
1470
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1471
+ {
1472
+ if (!self.AreCoordinatesSet()) {
1473
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
1474
+ std::vector< std::vector<double> > results{ };
1475
+ return results;
1476
+ }
1477
+ if (self.satellite > self.nsat) {
1478
+ py::print("! Ephemerides table not available for this satellite!");
1479
+ std::vector< std::vector<double> > results{ };
1480
+ return results;
1481
+ }
1482
+ std::vector<double> mags(times.size());
1483
+ std::vector<double> c1s(times.size());
1484
+ std::vector<double> c2s(times.size());
1485
+ std::vector<double> c1l(times.size());
1486
+ std::vector<double> c2l(times.size());
1487
+ std::vector<double> y1s1(times.size());
1488
+ std::vector<double> y2s1(times.size());
1489
+ std::vector<double> y1s2(times.size());
1490
+ std::vector<double> y2s2(times.size());
1491
+ self.astrometry = true;
1492
+ self.parallaxsystem = 1;
1493
+ self.BinSourceAstroLightCurveXallarap(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1494
+ y1s1.data(), y2s1.data(), y1s2.data(), y2s2.data(), times.size());
1495
+ std::vector< std::vector<double> > results{ mags, c1s, c2s, c1l, c2l,y1s1,y2s1,y1s2,y2s2 };
1496
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
1497
+ return results;
1498
+ },
1499
+ R"mydelimiter(
1500
+ Binary source light curve and astrometry including xallarap for a full array of observations.
1501
+
1502
+ Parameters
1503
+ ----------
1504
+ params : list[float]
1505
+ List of parameters [log_tE, log_FR, u01, u02, t01, t02, log_rho1,
1506
+ paiN, paiE, # components of the parallax vector
1507
+ w1, w2, w3, # relative angular orbital velocity components (Einstein angle/day)
1508
+ muS_N, muS_E, # proper motion components of the source (mas/yr)
1509
+ pai_S, # parallax of the source (mas)
1510
+ thetaE # Einstein angle (mas)
1511
+ ]
1512
+ times : list[float]
1513
+ Array of times at which the magnification is calculated.
1514
+
1515
+ Returns
1516
+ -------
1517
+ results: list[list[float],list[float],list[float],list[float],list[float],list[float],list[float],list[float],list[float]]
1518
+ [Magnification array,
1519
+ centroid of images N array, centroid of images E array,
1520
+ centroid of lens N array, centroid of lens E array,
1521
+ source1 position y1 array, source1 position y2 array,
1522
+ source2 position y1 array, source2 position y2 array]
1523
+ )mydelimiter");
1524
+
1525
+
1526
+ vbm.def("BinSourceBinLensAstroLightCurve",
1527
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1528
+ {
1529
+ if (!self.AreCoordinatesSet()) {
1530
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
1531
+ std::vector< std::vector<double> > results{ };
1532
+ return results;
1533
+ }
1534
+ if (self.satellite > self.nsat) {
1535
+ py::print("! Ephemerides table not available for this satellite!");
1536
+ std::vector< std::vector<double> > results{ };
1537
+ return results;
1538
+ }
1539
+ std::vector<double> mags(times.size());
1540
+ std::vector<double> c1s(times.size());
1541
+ std::vector<double> c2s(times.size());
1542
+ std::vector<double> c1l(times.size());
1543
+ std::vector<double> c2l(times.size());
1544
+ std::vector<double> y1s1(times.size());
1545
+ std::vector<double> y2s1(times.size());
1546
+ std::vector<double> y1s2(times.size());
1547
+ std::vector<double> y2s2(times.size());
1548
+ std::vector<double> seps(times.size());
1549
+ self.astrometry = true;
1550
+ self.parallaxsystem = 1;
1551
+ self.BinSourceBinLensAstroLightCurve(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1552
+ y1s1.data(), y2s1.data(), y1s2.data(), y2s2.data(), seps.data(), times.size());
1553
+ std::vector< std::vector<double> > results{ mags, c1s, c2s, c1l, c2l,y1s1,y2s1,y1s2,y2s2,seps };
1554
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
1555
+ return results;
1556
+ },
1557
+ R"mydelimiter(
1558
+ Binary source - Binary lens light curve and astrometry including xallarap and orbital motion for a full array of observations.
1559
+
1560
+ Parameters
1561
+ ----------
1562
+ params : list[float]
1563
+ List of parameters [log_s, log_q, u0, alpha, log_rho, log_tE, t0,
1564
+ paiN, paiE, # components of the parallax vector
1565
+ w1, w2, w3, # relative angular orbital velocity components (Einstein angle/day)
1566
+ u02, t02, # impact parameter, time of closest approach of the seconf source
1567
+ log_FR, # log of flux ratio of the two sources
1568
+ ws1, ws2, ws3, # relative angular orbital velocity components of the sources (Einstein angle/day)
1569
+ muS_N, muS_E, # proper motion components of the source (mas/yr)
1570
+ pai_S, # parallax of the source (mas)
1571
+ thetaE # Einstein angle (mas)
1572
+ ]
1573
+ times : list[float]
1574
+ Array of times at which the magnification is calculated.
1575
+
1576
+ Returns
1577
+ -------
1578
+ results: list[list[float],list[float],list[float],list[float],list[float],list[float],list[float],list[float],list[float],list[float]]
1579
+ [Magnification array,
1580
+ centroid of images N array, centroid of images E array,
1581
+ centroid of lens N array, centroid of lens E array,
1582
+ source1 position y1 array, source1 position y2 array,
1583
+ source2 position y1 array, source2 position y2 array,
1584
+ projected separations of the two lenses]
1585
+ )mydelimiter");
1586
+
1587
+
1588
+ vbm.def("TripleAstroLightCurve",
1589
+ [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1590
+ {
1591
+ if (!self.AreCoordinatesSet()) {
1592
+ py::print("Use SetObjectCoordinates before any parallax calculation!");
1593
+ std::vector< std::vector<double> > results{ };
1594
+ return results;
1595
+ }
1596
+ if (self.satellite > self.nsat) {
1597
+ py::print("! Ephemerides table not available for this satellite!");
1598
+ std::vector< std::vector<double> > results{ };
1599
+ return results;
1600
+ }
1601
+ std::vector<double> mags(times.size());
1602
+ std::vector<double> c1s(times.size());
1603
+ std::vector<double> c2s(times.size());
1604
+ std::vector<double> c1l(times.size());
1605
+ std::vector<double> c2l(times.size());
1606
+ std::vector<double> y1s(times.size());
1607
+ std::vector<double> y2s(times.size());
1608
+ self.astrometry = true;
1609
+ self.parallaxsystem = 1;
1610
+ self.TripleAstroLightCurve(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1611
+ y1s.data(), y2s.data(), times.size());
1612
+ std::vector< std::vector<double> > results{ mags, c1s, c2s, c1l, c2l,y1s,y2s };
1613
+ if (self.parallaxextrapolation > 0) py::print("Input time is outside range of lookup tables: extrapolation is used.");
1614
+ return results;
1615
+ },
1616
+ R"mydelimiter(
1617
+ Triple light curve and astrometry for a full array of observations.
1618
+
1619
+ Parameters
1620
+ ----------
1621
+ params : list[float]
1622
+ List of parameters [log_s, log_q, u0, alpha, log_rho, log_tE, t0,
1623
+ log(s13), log(q3), psi
1624
+ paiN, paiE, #components of the parallax vector
1625
+ muS_N, muS_E, # proper motion components of the source (mas/yr)
1626
+ pai_S, # parallax of the source (mas)
1627
+ thetaE # Einstein angle (mas)
1628
+ ]
1629
+ times : list[float]
1630
+ Array of times at which the magnification is calculated.
1631
+
1632
+ Returns
1633
+ -------
1634
+ results: list[list[float],list[float],list[float],list[float],list[float],list[float],list[float]]
1635
+ [Magnification array,
1636
+ centroid of images N array, centroid of images E array,
1637
+ centroid of lens N array, centroid of lens E array,
1638
+ source position y1 array, source position y2 array]
1639
+ )mydelimiter");
1640
+ // Other functions
1641
+
1642
+
1643
+ vbm.def("Multicaustics",
1644
+ [](VBMicrolensing& self)
1645
+ {
1646
+ _sols* critcau;
1647
+
1648
+ critcau = self.PlotCrit();
1649
+ int ncaus = critcau->length / 2;
1650
+ std::list <std::vector<std::vector<double>>> caustics{};
1651
+ _curve* c = critcau->first;
1652
+ for (int i = 0; i < ncaus; i++) c = c->next;
1653
+ for (int i = 0; i < ncaus; i++) {
1654
+ std::vector<double> y(c->length);
1655
+ std::vector<std::vector<double>> cau(2, y);
1656
+ _point* p = c->first;
1657
+ for (int j = 0; j < c->length; j++) {
1658
+ cau[0][j] = p->x1;
1659
+ cau[1][j] = p->x2;
1660
+ p = p->next;
1661
+ }
1662
+ caustics.push_back(cau);
1663
+ c = c->next;
1664
+ }
1665
+ delete critcau;
1666
+ return caustics;
1667
+ },
1668
+ R"mydelimiter(
1669
+ Caustics for given separation and mass ratio.
1670
+
1671
+ Parameters
1672
+ ----------
1673
+ s : float
1674
+ The projected separation of the binary lens in units of the
1675
+ Einstein radius corresponding to the total mass.
1676
+ q : float
1677
+ Binary lens mass fraction q = m1/m2 such that m1<m2
1678
+
1679
+ Returns
1680
+ -------
1681
+ solutions : _sols
1682
+ List of caustics.
1683
+ )mydelimiter");
1684
+
1685
+ vbm.def("Multicriticalcurves",
1686
+ [](VBMicrolensing& self)
1687
+ {
1688
+ _sols* critcau;
1689
+
1690
+ critcau = self.PlotCrit();
1691
+ int ncrits = critcau->length / 2;
1692
+ std::list <std::vector<std::vector<double>>> criticalcurves{};
1693
+ _curve* c = critcau->first;
1694
+ for (int i = 0; i < ncrits; i++) {
1695
+ std::vector<double> y(c->length);
1696
+ std::vector<std::vector<double>> crit(2, y);
1697
+ _point* p = c->first;
1698
+ for (int j = 0; j < c->length; j++) {
1699
+ crit[0][j] = p->x1;
1700
+ crit[1][j] = p->x2;
1701
+ p = p->next;
1702
+ }
1703
+ criticalcurves.push_back(crit);
1704
+ c = c->next;
1705
+ }
1706
+ delete critcau;
1707
+ return criticalcurves;
1708
+ },
1709
+ R"mydelimiter(
1710
+ Critical curves for given separation and mass ratio.
1711
+
1712
+ Parameters
1713
+ ----------
1714
+ s : float
1715
+ The projected separation of the binary lens in units of the
1716
+ Einstein radius corresponding to the total mass.
1717
+ q : float
1718
+ Binary lens mass fraction q = m1/m2 such that m1<m2
1719
+
1720
+ Returns
1721
+ -------
1722
+ solutions : _sols
1723
+ List of critical curves.
1724
+ )mydelimiter");
1725
+ vbm.def("Caustics",
1726
+ [](VBMicrolensing& self, double s, double q)
1727
+ {
1728
+ _sols* critcau;
1729
+
1730
+ critcau = self.PlotCrit(s, q);
1731
+ int ncaus = critcau->length / 2;
1732
+ std::list <std::vector<std::vector<double>>> caustics{};
1733
+ _curve* c = critcau->first;
1734
+ for (int i = 0; i < ncaus; i++) c = c->next;
1735
+ for (int i = 0; i < ncaus; i++) {
1736
+ std::vector<double> y(c->length);
1737
+ std::vector<std::vector<double>> cau(2, y);
1738
+ _point* p = c->first;
1739
+ for (int j = 0; j < c->length; j++) {
1740
+ cau[0][j] = p->x1;
1741
+ cau[1][j] = p->x2;
1742
+ p = p->next;
1743
+ }
1744
+ caustics.push_back(cau);
1745
+ c = c->next;
1746
+ }
1747
+ delete critcau;
1748
+ return caustics;
1749
+ },
1750
+ R"mydelimiter(
1751
+ Caustics for given separation and mass ratio.
1752
+
1753
+ Parameters
1754
+ ----------
1755
+ s : float
1756
+ The projected separation of the binary lens in units of the
1757
+ Einstein radius corresponding to the total mass.
1758
+ q : float
1759
+ Binary lens mass fraction q = m1/m2 such that m1<m2
1760
+
1761
+ Returns
1762
+ -------
1763
+ solutions : _sols
1764
+ List of caustics.
1765
+ )mydelimiter");
1766
+
1767
+ vbm.def("Criticalcurves",
1768
+ [](VBMicrolensing& self, double s, double q)
1769
+ {
1770
+ _sols* critcau;
1771
+
1772
+ critcau = self.PlotCrit(s, q);
1773
+ int ncrits = critcau->length / 2;
1774
+ std::list <std::vector<std::vector<double>>> criticalcurves{};
1775
+ _curve* c = critcau->first;
1776
+ for (int i = 0; i < ncrits; i++) {
1777
+ std::vector<double> y(c->length);
1778
+ std::vector<std::vector<double>> crit(2, y);
1779
+ _point* p = c->first;
1780
+ for (int j = 0; j < c->length; j++) {
1781
+ crit[0][j] = p->x1;
1782
+ crit[1][j] = p->x2;
1783
+ p = p->next;
1784
+ }
1785
+ criticalcurves.push_back(crit);
1786
+ c = c->next;
1787
+ }
1788
+ delete critcau;
1789
+ return criticalcurves;
1790
+ },
1791
+ R"mydelimiter(
1792
+ Critical curves for given separation and mass ratio.
1793
+
1794
+ Parameters
1795
+ ----------
1796
+ s : float
1797
+ The projected separation of the binary lens in units of the
1798
+ Einstein radius corresponding to the total mass.
1799
+ q : float
1800
+ Binary lens mass fraction q = m1/m2 such that m1<m2
1801
+
1802
+ Returns
1803
+ -------
1804
+ solutions : _sols
1805
+ List of critical curves.
1806
+ )mydelimiter");
1807
+
1808
+ // Limb darkening
1809
+ /*vbm.def("SetLDprofile", (void (VBMicrolensing::*)(double(*)(double), int))
1810
+ &VBMicrolensing::SetLDprofile,
1811
+ "Set LD profile using a user-defined function");*/
1812
+
1813
+ vbm.def("SetLDprofile", (void (VBMicrolensing::*)(VBMicrolensing::LDprofiles))
1814
+ & VBMicrolensing::SetLDprofile,
1815
+ "Set LD profile using a predefined profile");
1816
+
1817
+ vbm.def("SetLensGeometry",
1818
+ [](VBMicrolensing& self, std::vector<double> pr) {
1819
+ self.SetLensGeometry(pr.size() / 3, pr.data());
1820
+ },
1821
+ py::return_value_policy::reference,
1822
+ R"mydelimiter(
1823
+ Set the geometry of the system
1824
+
1825
+ Parameters
1826
+ ----------
1827
+ pr : list[float]
1828
+ List of parameters [z1_re, z1_im, q1, z2_re, z2_im, q2,....,zn_re,zn_im,qn]
1829
+
1830
+ )mydelimiter");
1831
+
1832
+
1833
+ vbm.def("MultiMag0",
1834
+ [](VBMicrolensing& self, double y1, double y2) -> double {
1835
+ return self.MultiMag0(y1, y2);
1836
+ },
1837
+ py::return_value_policy::reference,
1838
+ R"mydelimiter(
1839
+ Magnification of a point-source by a multiple lens.
1840
+
1841
+ Parameters
1842
+ ----------
1843
+ source : tuple of floats
1844
+ A tuple (y1, y2) where y1 is the real-position and y2 is the imaginary-position
1845
+ of the source in the source plane.
1846
+
1847
+ Returns
1848
+ -------
1849
+ float
1850
+ Magnification.
1851
+ )mydelimiter");
1852
+
1853
+ vbm.def("MultiMag",
1854
+ [](VBMicrolensing& self, double y1, double y2, double rho) -> double {
1855
+ return self.MultiMag(y1, y2, rho);
1856
+ },
1857
+ py::return_value_policy::reference,
1858
+ R"pbdoc(
1859
+ Compute the magnification of a uniform brightness finite source
1860
+ by a multiple lens.
1861
+
1862
+ Parameters
1863
+ ----------
1864
+ y1 : float
1865
+ x-position of the source in the source plane.
1866
+ y2 : float
1867
+ y-position of the source in the source plane.
1868
+ rho : float
1869
+ The source angular radius in units of the Einstein radius
1870
+ corresponding to the total mass.
1871
+
1872
+
1873
+ Returns
1874
+ -------
1875
+ float
1876
+ The magnification.
1877
+ )pbdoc");
1878
+
1879
+
1880
+ vbm.def("MultiMagDark",
1881
+ [](VBMicrolensing& self, double y1, double y2, double rho, double Tol) -> double {
1882
+ return self.MultiMagDark(y1, y2, rho, Tol);
1883
+ },
1884
+ py::return_value_policy::reference,
1885
+ R"pbdoc(
1886
+ Magnification of a limb-darkened finite source
1887
+ by a multiple lens.
1888
+
1889
+ Parameters
1890
+ ----------
1891
+ y1 : float
1892
+ x-position of the source in the source plane.
1893
+ y2 : float
1894
+ y-position of the source in the source plane.
1895
+ rho : float
1896
+ The source angular radius in units of the Einstein radius
1897
+ corresponding to the total mass.
1898
+ accuracy : float
1899
+ Absolute accuracy goal for the magnification calculation.
1900
+
1901
+ Returns
1902
+ -------
1903
+ float
1904
+ The magnification.
1905
+ )pbdoc");
1906
+
1907
+ vbm.def("MultiMag2",
1908
+ [](VBMicrolensing& self, double y1, double y2, double rho) -> double {
1909
+ return self.MultiMag2(y1, y2, rho);
1910
+ },
1911
+ py::return_value_policy::reference,
1912
+ R"pbdoc(
1913
+ Compute the magnification of a finite source
1914
+ by a multiple lens. In v2.0, implements test described
1915
+ in VBMicrolensing 2.0 paper.
1916
+
1917
+ Parameters
1918
+ ----------
1919
+ y1 : float
1920
+ x-position of the source in the source plane.
1921
+ y2 : float
1922
+ y-position of the source in the source plane.
1923
+ rho : float
1924
+ The source angular radius in units of the Einstein radius
1925
+ corresponding to the total mass.
1926
+
1927
+
1928
+ Returns
1929
+ -------
1930
+ float
1931
+ The magnification.
1932
+ )pbdoc");
1933
+
1934
+ vbm.def("BinaryMag0_shear",
1935
+ (double (VBMicrolensing::*)(double, double, double, double, double, double, double))
1936
+ & VBMicrolensing::BinaryMag0_shear,
1937
+ py::return_value_policy::reference,
1938
+ R"mydelimiter(
1939
+ Magnification of a point-source by a binary lens.
1940
+
1941
+ Parameters
1942
+ ----------
1943
+ s : float
1944
+ The projected separation of the binary lens in units of the
1945
+ Einstein radius corresponding to the total mass.
1946
+ q : float
1947
+ Binary lens mass fraction q = m1/m2 s.t. m1<m2
1948
+ y1 : float
1949
+ x-position of the source in the source plane.
1950
+ y2 : float
1951
+ y-position of the source in the source plane.
1952
+ convergence_K : float
1953
+ External mass sheet convergence.
1954
+ shear_G_re : float
1955
+ External mass sheet shear - real part.
1956
+ shear_G_im : float
1957
+ External mass sheet shear - imaginary part.
1958
+
1959
+ Returns
1960
+ -------
1961
+ float
1962
+ Magnification.
1963
+ )mydelimiter");
1964
+
1965
+ vbm.def("SetMethod",
1966
+ &VBMicrolensing::SetMethod,
1967
+ "User choice of Method");
1968
+
1969
+ // Skowron Gould polnomial solver
1970
+ vbm.def("cmplx_roots_gen",
1971
+ [](VBMicrolensing& self, std::vector<std::vector<double>> coefficients)
1972
+ {
1973
+
1974
+ int n = coefficients.size() - 1;
1975
+ std::vector<std::vector<double>> roots(n, std::vector<double> {0, 0});
1976
+ std::vector<complex> zr(n);
1977
+ std::vector<complex> poly(n + 1);
1978
+ for (int i = 0; i < n + 1; i++) {
1979
+ poly[i] = complex(coefficients[i][0], coefficients[i][1]);
1980
+ }
1981
+ self.cmplx_roots_gen(zr.data(), poly.data(), n, true, true);
1982
+ for (int i = 0; i < n; i++) {
1983
+ roots[i][0] = zr[i].re;
1984
+ roots[i][1] = zr[i].im;
1985
+ }
1986
+ return roots;
1987
+ },
1988
+ R"mydelimiter(
1989
+ Roots of a polynomial with given complex coefficients.
1990
+ Parameters
1991
+ ----------
1992
+ coefficients : list[complex]
1993
+ The polynomial is structured as
1994
+ coefficients[0] x^0 + coefficients[1] x^1 + coefficients[2] x^2 + ...
1995
+
1996
+ Returns
1997
+ -------
1998
+ roots: list[complex]
1999
+ List of roots
2000
+ )mydelimiter");
2001
+
2002
+
2003
+ // Method: Singlepoly, Multipoly, Nopoly
2004
+ py::enum_<VBMicrolensing::Method>(vbm, "Method")
2005
+ .value("Singlepoly", VBMicrolensing::Method::Singlepoly)
2006
+ .value("Multipoly", VBMicrolensing::Method::Multipoly)
2007
+ .value("Nopoly", VBMicrolensing::Method::Nopoly)
2008
+ .export_values();
2009
+
2010
+ //LDlinear, LDquadratic, LDsquareroot, LDlog, LDuser
2011
+ py::enum_<VBMicrolensing::LDprofiles>(vbm, "LDprofiles")
2012
+ .value("LDlinear", VBMicrolensing::LDprofiles::LDlinear)
2013
+ .value("LDquadratic", VBMicrolensing::LDprofiles::LDquadratic)
2014
+ .value("LDsquareroot", VBMicrolensing::LDprofiles::LDsquareroot)
2015
+ .value("LDlog", VBMicrolensing::LDprofiles::LDlog)
2016
+ .value("LDuser", VBMicrolensing::LDprofiles::LDuser)
2017
+ .export_values();
2018
+
2019
+ py::class_<_theta>(m, "_theta")
2020
+ .def(py::init<double>()); //constructor
2021
+
2022
+ py::class_<_point>(m, "_point")
2023
+ .def(py::init<double, double, _theta*>())
2024
+ .def_readwrite("next", &_point::next)
2025
+ .def_readwrite("prev", &_point::prev)
2026
+ .def_readonly("x1", &_point::x1)
2027
+ .def_readonly("x2", &_point::x2);
2028
+
2029
+ py::class_<_curve>(m, "_curve")
2030
+ .def(py::init<_point*>()) //constructor 1
2031
+ .def(py::init()) //constructor 2
2032
+ .def_readwrite("first", &_curve::first)
2033
+ .def_readwrite("last", &_curve::last)
2034
+ .def_readwrite("next", &_curve::next)
2035
+ .def_readwrite("prev", &_curve::prev);
2036
+
2037
+ py::class_<_skiplist_curve>(m, "_skiplist_curve")
2038
+ .def(py::init<_point*, int>()) //constructor 1
2039
+ .def(py::init()) //constructor 2
2040
+ .def_readwrite("first", &_skiplist_curve::first)
2041
+ .def_readwrite("last", &_skiplist_curve::last)
2042
+ .def_readwrite("next", &_skiplist_curve::next)
2043
+ .def_readwrite("prev", &_skiplist_curve::prev);
2044
+
2045
+ py::class_<_sols>(m, "_sols")
2046
+ .def(py::init()) //constructor
2047
+ .def_readwrite("first", &_sols::first)
2048
+ .def_readwrite("last", &_sols::last);
2049
+
2050
+ py::class_<_sols_for_skiplist_curve>(m, "_sols_for_skiplist_curve")
2051
+ .def(py::init()) //constructor
2052
+ .def_readwrite("first", &_sols_for_skiplist_curve::first)
2053
+ .def_readwrite("last", &_sols_for_skiplist_curve::last);
2054
+
2055
+ py::class_<complex>(m, "complex")
2056
+ .def(py::init<double, double>())
2057
+ .def(py::init<double>())
2058
+ .def(py::init<>())
2059
+ .def_readwrite("re", &complex::re)
2060
+ .def_readwrite("im", &complex::im);
2061
+ }