VBMicrolensing 5.1.1__cp311-cp311-musllinux_1_2_i686.whl → 5.3.1__cp311-cp311-musllinux_1_2_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.

Potentially problematic release.


This version of VBMicrolensing might be problematic. Click here for more details.

@@ -2,6 +2,7 @@
2
2
  #include <pybind11/stl.h>
3
3
  #include "VBMicrolensingLibrary.h"
4
4
  #include <string>
5
+ #include <filesystem>
5
6
  #include <pybind11/functional.h>
6
7
 
7
8
 
@@ -32,6 +33,10 @@ PYBIND11_MODULE(VBMicrolensing, m) {
32
33
  "Minimum number of annuli to calculate for limb darkening.");
33
34
  vbm.def_readwrite("NPcrit", &VBMicrolensing::NPcrit,
34
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");
35
40
  vbm.def_readwrite("parallaxsystem", &VBMicrolensing::parallaxsystem,
36
41
  "0 for parallel-perpendicular, 1 for North-Eeast.");
37
42
  vbm.def_readwrite("t0_par_fixed", &VBMicrolensing::t0_par_fixed,
@@ -41,6 +46,8 @@ PYBIND11_MODULE(VBMicrolensing, m) {
41
46
  vbm.def_readwrite("satellite", &VBMicrolensing::satellite,
42
47
  "Specifies the satellite number for the next calculation \
43
48
  (0 for observations from the ground);.");
49
+ vbm.def_readwrite("nsat", &VBMicrolensing::nsat,
50
+ "Number of satellite tables found in satellite table directory.");
44
51
  vbm.def_readwrite("astrometry", &VBMicrolensing::astrometry,
45
52
  "Unlock astrometry centroid calculation.");
46
53
  vbm.def_readwrite("astrox1", &VBMicrolensing::astrox1,
@@ -57,6 +64,8 @@ PYBIND11_MODULE(VBMicrolensing, m) {
57
64
  "Flux of secondary source is set to zero.");
58
65
  vbm.def_readwrite("turn_off_secondary_lens", &VBMicrolensing::turn_off_secondary_lens,
59
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");
60
69
  vbm.def_readwrite("corrquad", &VBMicrolensing::corrquad,
61
70
  "Quadrupole test.");
62
71
  vbm.def_readwrite("corrquad2", &VBMicrolensing::corrquad2,
@@ -67,10 +76,16 @@ PYBIND11_MODULE(VBMicrolensing, m) {
67
76
 
68
77
  vbm.def("LoadESPLTable", &VBMicrolensing::LoadESPLTable,
69
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.""");
70
81
  vbm.def("SetESPLtablefile", [](char* s) {
71
82
  VBMicrolensing::SetESPLtablefile(s);
72
83
  },
73
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.""");
74
89
  // Maginfication calculations
75
90
  vbm.def("PSPLMag", &VBMicrolensing::PSPLMag,
76
91
  py::return_value_policy::reference,
@@ -385,7 +400,24 @@ PYBIND11_MODULE(VBMicrolensing, m) {
385
400
  .
386
401
  )mydelimiter");
387
402
 
388
- vbm.def("SetObjectCoordinates", (void (VBMicrolensing::*)(char*)) & VBMicrolensing::SetObjectCoordinates,
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
+ },
389
421
  R"mydelimiter(
390
422
  Sets the astronomical coordinates of the microlensing target.
391
423
 
@@ -395,7 +427,19 @@ PYBIND11_MODULE(VBMicrolensing, m) {
395
427
  Format \"hr:mn:sc +deg:pr:sc\".
396
428
  )mydelimiter");
397
429
 
398
- vbm.def("SetObjectCoordinates", (void (VBMicrolensing::*)(char*, char*)) & VBMicrolensing::SetObjectCoordinates,
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
+ },
399
443
  R"mydelimiter(
400
444
  Sets the astronomical coordinates of the microlensing target and
401
445
  specifies the path where to look for the position tables
@@ -440,12 +484,23 @@ PYBIND11_MODULE(VBMicrolensing, m) {
440
484
  vbm.def("PSPLLightCurveParallax",
441
485
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
442
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
+ }
443
497
  std::vector<double> mags(times.size());
444
498
  std::vector<double> y1s(times.size());
445
499
  std::vector<double> y2s(times.size());
446
500
  self.PSPLLightCurveParallax(params.data(), times.data(), mags.data(),
447
501
  y1s.data(), y2s.data(), times.size());
448
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.");
449
504
  return results;
450
505
  },
451
506
  R"mydelimiter(
@@ -492,15 +547,27 @@ PYBIND11_MODULE(VBMicrolensing, m) {
492
547
  results: list[list[float],list[float],list[float]]
493
548
  [Magnification array, source position y1 array, source position y2 array]
494
549
  )mydelimiter");
550
+
495
551
  vbm.def("ESPLLightCurveParallax",
496
552
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
497
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
+ }
498
564
  std::vector<double> mags(times.size());
499
565
  std::vector<double> y1s(times.size());
500
566
  std::vector<double> y2s(times.size());
501
567
  self.ESPLLightCurveParallax(params.data(), times.data(), mags.data(),
502
568
  y1s.data(), y2s.data(), times.size());
503
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.");
504
571
  return results;
505
572
  },
506
573
  R"mydelimiter(
@@ -576,16 +643,29 @@ PYBIND11_MODULE(VBMicrolensing, m) {
576
643
  results: list[list[float],list[float],list[float]]
577
644
  [Magnification array, source position y1 array, source position y2 array]
578
645
  )mydelimiter");
646
+
579
647
  vbm.def("BinaryLightCurveParallax",
580
648
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
581
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
+ }
582
660
  std::vector<double> mags(times.size());
583
661
  std::vector<double> y1s(times.size());
584
662
  std::vector<double> y2s(times.size());
585
663
  self.BinaryLightCurveParallax(params.data(), times.data(), mags.data(),
586
664
  y1s.data(), y2s.data(), times.size());
587
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.");
588
667
  return results;
668
+
589
669
  },
590
670
  R"mydelimiter(
591
671
  Static binary lens light curve for a given set of parameters including parallax.
@@ -609,6 +689,16 @@ PYBIND11_MODULE(VBMicrolensing, m) {
609
689
  vbm.def("BinaryLightCurveOrbital",
610
690
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
611
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
+ }
612
702
  std::vector<double> mags(times.size());
613
703
  std::vector<double> y1s(times.size());
614
704
  std::vector<double> y2s(times.size());
@@ -616,6 +706,7 @@ PYBIND11_MODULE(VBMicrolensing, m) {
616
706
  self.BinaryLightCurveOrbital(params.data(), times.data(), mags.data(),
617
707
  y1s.data(), y2s.data(), separations.data(), times.size());
618
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.");
619
710
  return results;
620
711
  },
621
712
  R"mydelimiter(
@@ -642,6 +733,16 @@ PYBIND11_MODULE(VBMicrolensing, m) {
642
733
  vbm.def("BinaryLightCurveKepler",
643
734
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
644
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
+ }
645
746
  std::vector<double> mags(times.size());
646
747
  std::vector<double> y1s(times.size());
647
748
  std::vector<double> y2s(times.size());
@@ -649,6 +750,7 @@ PYBIND11_MODULE(VBMicrolensing, m) {
649
750
  self.BinaryLightCurveKepler(params.data(), times.data(), mags.data(),
650
751
  y1s.data(), y2s.data(), separations.data(), times.size());
651
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.");
652
754
  return results;
653
755
  },
654
756
  R"mydelimiter(
@@ -703,12 +805,23 @@ PYBIND11_MODULE(VBMicrolensing, m) {
703
805
  vbm.def("BinSourceLightCurveParallax",
704
806
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
705
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
+ }
706
818
  std::vector<double> mags(times.size());
707
819
  std::vector<double> y1s(times.size());
708
820
  std::vector<double> y2s(times.size());
709
821
  self.BinSourceLightCurveParallax(params.data(), times.data(), mags.data(),
710
822
  y1s.data(), y2s.data(), times.size());
711
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.");
712
825
  return results;
713
826
  },
714
827
  R"mydelimiter(
@@ -792,6 +905,16 @@ PYBIND11_MODULE(VBMicrolensing, m) {
792
905
  vbm.def("BinSourceExtLightCurveXallarap",
793
906
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
794
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
+ }
795
918
  std::vector<double> mags(times.size());
796
919
  std::vector<double> y1s1(times.size());
797
920
  std::vector<double> y2s1(times.size());
@@ -800,6 +923,7 @@ PYBIND11_MODULE(VBMicrolensing, m) {
800
923
  self.BinSourceExtLightCurveXallarap(params.data(), times.data(), mags.data(),
801
924
  y1s1.data(), y2s1.data(), y1s2.data(), y2s2.data(), times.size());
802
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.");
803
927
  return results;
804
928
  },
805
929
  R"mydelimiter(
@@ -823,6 +947,58 @@ PYBIND11_MODULE(VBMicrolensing, m) {
823
947
  source2 position y1 array, source2 position y2 array]
824
948
  )mydelimiter");
825
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
+
826
1002
  vbm.def("BinSourceBinLensXallarap",
827
1003
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
828
1004
  {
@@ -857,6 +1033,16 @@ PYBIND11_MODULE(VBMicrolensing, m) {
857
1033
  vbm.def("BinSourceLightCurveXallarap",
858
1034
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
859
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
+ }
860
1046
  std::vector<double> mags(times.size());
861
1047
  std::vector<double> y1s(times.size());
862
1048
  std::vector<double> y2s(times.size());
@@ -864,6 +1050,7 @@ PYBIND11_MODULE(VBMicrolensing, m) {
864
1050
  self.BinSourceLightCurveXallarap(params.data(), times.data(), mags.data(),
865
1051
  y1s.data(), y2s.data(), separations.data(), times.size());
866
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.");
867
1054
  return results;
868
1055
  },
869
1056
  R"mydelimiter(
@@ -923,12 +1110,23 @@ PYBIND11_MODULE(VBMicrolensing, m) {
923
1110
  vbm.def("TripleLightCurveParallax",
924
1111
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
925
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
+ }
926
1123
  std::vector<double> mags(times.size());
927
1124
  std::vector<double> y1s(times.size());
928
1125
  std::vector<double> y2s(times.size());
929
1126
  self.TripleLightCurveParallax(params.data(), times.data(), mags.data(),
930
1127
  y1s.data(), y2s.data(), times.size());
931
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.");
932
1130
  return results;
933
1131
  },
934
1132
  R"mydelimiter(
@@ -1006,6 +1204,16 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1006
1204
  vbm.def("PSPLAstroLightCurve",
1007
1205
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1008
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
+ }
1009
1217
  std::vector<double> mags(times.size());
1010
1218
  std::vector<double> c1s(times.size());
1011
1219
  std::vector<double> c2s(times.size());
@@ -1017,6 +1225,7 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1017
1225
  self.PSPLAstroLightCurve(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1018
1226
  y1s.data(), y2s.data(), times.size());
1019
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.");
1020
1229
  return results;
1021
1230
  },
1022
1231
  R"mydelimiter(
@@ -1045,6 +1254,16 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1045
1254
  vbm.def("ESPLAstroLightCurve",
1046
1255
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1047
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
+ }
1048
1267
  std::vector<double> mags(times.size());
1049
1268
  std::vector<double> c1s(times.size());
1050
1269
  std::vector<double> c2s(times.size());
@@ -1057,6 +1276,7 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1057
1276
  self.ESPLAstroLightCurve(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1058
1277
  y1s.data(), y2s.data(), times.size());
1059
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.");
1060
1280
  return results;
1061
1281
  },
1062
1282
  R"mydelimiter(
@@ -1087,6 +1307,16 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1087
1307
  vbm.def("BinaryAstroLightCurve",
1088
1308
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1089
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
+ }
1090
1320
  std::vector<double> mags(times.size());
1091
1321
  std::vector<double> c1s(times.size());
1092
1322
  std::vector<double> c2s(times.size());
@@ -1099,6 +1329,7 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1099
1329
  self.BinaryAstroLightCurve(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1100
1330
  y1s.data(), y2s.data(), times.size());
1101
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.");
1102
1333
  return results;
1103
1334
  },
1104
1335
  R"mydelimiter(
@@ -1128,6 +1359,16 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1128
1359
  vbm.def("BinaryAstroLightCurveOrbital",
1129
1360
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1130
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
+ }
1131
1372
  std::vector<double> mags(times.size());
1132
1373
  std::vector<double> c1s(times.size());
1133
1374
  std::vector<double> c2s(times.size());
@@ -1141,6 +1382,7 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1141
1382
  self.BinaryAstroLightCurveOrbital(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1142
1383
  y1s.data(), y2s.data(), seps.data(), times.size());
1143
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.");
1144
1386
  return results;
1145
1387
  },
1146
1388
  R"mydelimiter(
@@ -1171,6 +1413,16 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1171
1413
  vbm.def("BinaryAstroLightCurveKepler",
1172
1414
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1173
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
+ }
1174
1426
  std::vector<double> mags(times.size());
1175
1427
  std::vector<double> c1s(times.size());
1176
1428
  std::vector<double> c2s(times.size());
@@ -1184,6 +1436,7 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1184
1436
  self.BinaryAstroLightCurveKepler(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1185
1437
  y1s.data(), y2s.data(), seps.data(), times.size());
1186
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.");
1187
1440
  return results;
1188
1441
  },
1189
1442
  R"mydelimiter(
@@ -1216,6 +1469,16 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1216
1469
  vbm.def("BinSourceAstroLightCurveXallarap",
1217
1470
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1218
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
+ }
1219
1482
  std::vector<double> mags(times.size());
1220
1483
  std::vector<double> c1s(times.size());
1221
1484
  std::vector<double> c2s(times.size());
@@ -1230,6 +1493,7 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1230
1493
  self.BinSourceAstroLightCurveXallarap(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1231
1494
  y1s1.data(), y2s1.data(), y1s2.data(), y2s2.data(), times.size());
1232
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.");
1233
1497
  return results;
1234
1498
  },
1235
1499
  R"mydelimiter(
@@ -1259,9 +1523,81 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1259
1523
  )mydelimiter");
1260
1524
 
1261
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
+
1262
1588
  vbm.def("TripleAstroLightCurve",
1263
1589
  [](VBMicrolensing& self, std::vector<double> params, std::vector<double> times)
1264
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
+ }
1265
1601
  std::vector<double> mags(times.size());
1266
1602
  std::vector<double> c1s(times.size());
1267
1603
  std::vector<double> c2s(times.size());
@@ -1274,6 +1610,7 @@ PYBIND11_MODULE(VBMicrolensing, m) {
1274
1610
  self.TripleAstroLightCurve(params.data(), times.data(), mags.data(), c1s.data(), c2s.data(), c1l.data(), c2l.data(),
1275
1611
  y1s.data(), y2s.data(), times.size());
1276
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.");
1277
1614
  return results;
1278
1615
  },
1279
1616
  R"mydelimiter(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: VBMicrolensing
3
- Version: 5.1.1
3
+ Version: 5.3.1
4
4
  Summary: VBMicrolensing is a tool for efficient computation in gravitational microlensing events using the advanced contour integration method, supporting single, binary and multiple lenses.
5
5
  Keywords: Microlensing magnification and astrometry
6
6
  Author-Email: Valerio Bozza <valboz@sa.infn.it>, Vito Saggese <vitosaggese.vs@gmail.com>
@@ -27,12 +27,12 @@ In particular, VBMicrolensing is designed for the following calculations:
27
27
 
28
28
  `VBMicrolensing` is written as a C++ library and wrapped as a Python package, the user can call the code from either C++ or Python. This new code encompasses the well-known [VBBinaryLensing](https://github.com/valboz/VBBinaryLensing) code, which is at the basis of several platforms for microlensing modeling. `VBBinaryLensing` will still be available as a legacy software, but will no longer be maintained.
29
29
 
30
- `VBMicrolensing` has been developed by **Valerio Bozza**, University of Salerno, with a substantial contribution by **Vito Saggese**, University of Naples and **Jiyuan Zhang**, Tisnghua University. We also acknowledge a long list of collaborators who contributed to testing and development of particular aspects over the years: Etienne Bachelet, Fran Bartolic, Sebastiano Calchi Novati, Giovanni Covone, Giuseppe D'Ago, Tyler Heintz, Ava Hoag, Markus Hundertmark, Elahe Khalouei, Radek Poleski, Haibin Ren, Paolo Rota, Sedighe Sajadian, Rachel Street, Keto Zhang, Weicheng Zhang, Wei Zhu.
30
+ `VBMicrolensing` has been developed by **Valerio Bozza**, University of Salerno, with a substantial contribution by **Vito Saggese**, University of Naples and **Jiyuan Zhang**, Tisnghua University. We also acknowledge a long list of collaborators who contributed to testing and development of particular aspects over the years: Natasha Abrams, Etienne Bachelet, Fran Bartolic, Dex Bhadra, Sebastiano Calchi Novati, Giovanni Covone, Giuseppe D'Ago, Tyler Heintz, Ava Hoag, Markus Hundertmark, Elahe Khalouei, Jessica Lu, Matthew Penny, Radek Poleski, Haibin Ren, Paolo Rota, Sedighe Sajadian, Rachel Street, Keto Zhang, Weicheng Zhang, Wei Zhu.
31
31
 
32
32
  ## Attribution
33
33
  Any use of this code for scientific publications should be acknowledged by a citation to the works relevant to your study:
34
34
  - [V. Bozza, MNRAS 408 (2010) 2188](https://ui.adsabs.harvard.edu/abs/2010MNRAS.408.2188B/abstract): general algorithm for binary lensing;
35
- - [V. Bozza et al., MNRAS 479 (2018) 5157](https://ui.adsabs.harvard.edu/abs/2018MNRAS.479.5157B/abstract): BinaryMag2 function, Extended-Source-Point-Lens methods;
35
+ - [V. Bozza, E. Bachelet, F. Bartolic, T. Heintz, A. Hoag, M. Hundertmark, MNRAS 479 (2018) 5157](https://ui.adsabs.harvard.edu/abs/2018MNRAS.479.5157B/abstract): BinaryMag2 function, Extended-Source-Point-Lens methods;
36
36
  - [V. Bozza, E. Khalouei and E. Bachelet, MNRAS 505 (2021) 126](https://ui.adsabs.harvard.edu/abs/2021MNRAS.505..126B/abstract): astrometry, generalized limb darkening, Keplerian orbital motion;
37
37
  - [V. Bozza, v. Saggese, G. Covone, P. Rota & J. Zhang, A&A 694 (2025) 219](https://ui.adsabs.harvard.edu/abs/2025A%26A...694A.219B/abstract): multiple lenses.
38
38
 
@@ -59,6 +59,7 @@ If you just want to use the C++ library, clone this repository, all cpp files an
59
59
 
60
60
  The package also contains the following files:
61
61
  - `VBMicrolensing/data/ESPL.tbl` - Pre-calculated table for Extended-source-point-lens
62
+ - `VBMicrolensing/data/SunEphemeris.txt` - Sun ephemeris for parallax calculation
62
63
  - `VBMicrolensing/data/OB151212coords.txt` - Sample file with event coordinates
63
64
  - `VBMicrolensing/data/satellite1.txt` - Sample table for satellite position (Spitzer)
64
65
  - `VBMicrolensing/data/satellite2.txt` - Sample table for satellite position (Kepler)