diff --git a/data/expected_example_output/example_01/Ex01_Figure_1.png b/data/expected_example_output/example_01/Ex01_Figure_1.png new file mode 100644 index 000000000..ad24c9bcc Binary files /dev/null and b/data/expected_example_output/example_01/Ex01_Figure_1.png differ diff --git a/data/expected_example_output/example_01/Ex01_Figure_2.png b/data/expected_example_output/example_01/Ex01_Figure_2.png new file mode 100644 index 000000000..49245bfbf Binary files /dev/null and b/data/expected_example_output/example_01/Ex01_Figure_2.png differ diff --git a/data/expected_example_output/example_01/Ex01_Figure_3.png b/data/expected_example_output/example_01/Ex01_Figure_3.png new file mode 100644 index 000000000..be0b2bf77 Binary files /dev/null and b/data/expected_example_output/example_01/Ex01_Figure_3.png differ diff --git a/data/expected_example_output/example_01/Ex01_Figure_4.png b/data/expected_example_output/example_01/Ex01_Figure_4.png new file mode 100644 index 000000000..906ab792f Binary files /dev/null and b/data/expected_example_output/example_01/Ex01_Figure_4.png differ diff --git a/data/expected_example_output/example_01/Ex01_Figure_5.png b/data/expected_example_output/example_01/Ex01_Figure_5.png new file mode 100644 index 000000000..02e518408 Binary files /dev/null and b/data/expected_example_output/example_01/Ex01_Figure_5.png differ diff --git a/data/expected_example_output/example_02/Ex02_Figure_1.png b/data/expected_example_output/example_02/Ex02_Figure_1.png new file mode 100644 index 000000000..9156c4a0a Binary files /dev/null and b/data/expected_example_output/example_02/Ex02_Figure_1.png differ diff --git a/data/expected_example_output/example_02/Ex02_Figure_2.png b/data/expected_example_output/example_02/Ex02_Figure_2.png new file mode 100644 index 000000000..1515ff21b Binary files /dev/null and b/data/expected_example_output/example_02/Ex02_Figure_2.png differ diff --git a/data/expected_example_output/example_03/Ex03_Figure_1.png b/data/expected_example_output/example_03/Ex03_Figure_1.png new file mode 100644 index 000000000..8f062bed8 Binary files /dev/null and b/data/expected_example_output/example_03/Ex03_Figure_1.png differ diff --git a/data/expected_example_output/example_03/Ex03_Figure_2.png b/data/expected_example_output/example_03/Ex03_Figure_2.png new file mode 100644 index 000000000..71d20fccf Binary files /dev/null and b/data/expected_example_output/example_03/Ex03_Figure_2.png differ diff --git a/data/expected_example_output/example_04/rE.tab b/data/expected_example_output/example_04/rE.tab new file mode 100644 index 000000000..a3f634efd --- /dev/null +++ b/data/expected_example_output/example_04/rE.tab @@ -0,0 +1,10 @@ +# Physical Einstein ring radius in AU (Lens plane). +# columns = distance in kpc +# rows = mass in solMass + 1.00 2.00 3.00 4.00 5.00 6.00 7.00 + 10.0 8.44 11.05 12.36 12.76 12.36 11.05 8.44 + 1.0 2.67 3.50 3.91 4.04 3.91 3.50 2.67 + 0.3 1.46 1.91 2.14 2.21 2.14 1.91 1.46 + 0.1 0.84 1.11 1.24 1.28 1.24 1.11 0.84 + 0.01 0.27 0.35 0.39 0.40 0.39 0.35 0.27 + 0.001 0.08 0.11 0.12 0.13 0.12 0.11 0.08 diff --git a/data/expected_example_output/example_04/rEtilde.tab b/data/expected_example_output/example_04/rEtilde.tab new file mode 100644 index 000000000..cde5aa92b --- /dev/null +++ b/data/expected_example_output/example_04/rEtilde.tab @@ -0,0 +1,10 @@ +# Projection of Einstein ring radius in AU (Observer plane). +# columns = distance in kpc +# rows = mass in solMass + 1.00 2.00 3.00 4.00 5.00 6.00 7.00 + 10.0 9.65 14.74 19.77 25.52 32.95 44.21 67.53 + 1.0 3.05 4.66 6.25 8.07 10.42 13.98 21.36 + 0.3 1.67 2.55 3.42 4.42 5.71 7.66 11.70 + 0.1 0.96 1.47 1.98 2.55 3.30 4.42 6.75 + 0.01 0.31 0.47 0.63 0.81 1.04 1.40 2.14 + 0.001 0.10 0.15 0.20 0.26 0.33 0.44 0.68 diff --git a/data/expected_example_output/example_04/tE.tab b/data/expected_example_output/example_04/tE.tab new file mode 100644 index 000000000..4777a2fd6 --- /dev/null +++ b/data/expected_example_output/example_04/tE.tab @@ -0,0 +1,10 @@ +# Einstein timescale in days for mu_rel = 4.0 mas/yr. +# columns = distance in kpc +# rows = mass in solMass + 1.00 2.00 3.00 4.00 5.00 6.00 7.00 + 10.0 770.8 504.6 376.1 291.3 225.7 168.2 110.1 + 1.0 243.8 159.6 118.9 92.1 71.4 53.2 34.8 + 0.3 133.5 87.4 65.1 50.5 39.1 29.1 19.1 + 0.1 77.1 50.5 37.6 29.1 22.6 16.8 11.0 + 0.01 24.4 16.0 11.9 9.2 7.1 5.3 3.5 + 0.001 7.7 5.0 3.8 2.9 2.3 1.7 1.1 diff --git a/data/expected_example_output/example_04/thetaE.tab b/data/expected_example_output/example_04/thetaE.tab new file mode 100644 index 000000000..a8cda58b4 --- /dev/null +++ b/data/expected_example_output/example_04/thetaE.tab @@ -0,0 +1,10 @@ +# Angular Einstein ring radius in milliarcseconds. +# columns = distance in kpc +# rows = mass in solMass + 1.00 2.00 3.00 4.00 5.00 6.00 7.00 + 10.0 8.44 5.53 4.12 3.19 2.47 1.84 1.21 + 1.0 2.67 1.75 1.30 1.01 0.78 0.58 0.38 + 0.3 1.46 0.96 0.71 0.55 0.43 0.32 0.21 + 0.1 0.84 0.55 0.41 0.32 0.25 0.18 0.12 + 0.01 0.27 0.17 0.13 0.10 0.08 0.06 0.04 + 0.001 0.08 0.06 0.04 0.03 0.02 0.02 0.01 diff --git a/data/expected_example_output/example_05/Ex05_Figure_1.png b/data/expected_example_output/example_05/Ex05_Figure_1.png new file mode 100644 index 000000000..919eedb86 Binary files /dev/null and b/data/expected_example_output/example_05/Ex05_Figure_1.png differ diff --git a/data/expected_example_output/example_05/Ex05_Figure_1_zoom.png b/data/expected_example_output/example_05/Ex05_Figure_1_zoom.png new file mode 100644 index 000000000..ad7342b81 Binary files /dev/null and b/data/expected_example_output/example_05/Ex05_Figure_1_zoom.png differ diff --git a/data/expected_example_output/example_05/Ex05_Figure_2.png b/data/expected_example_output/example_05/Ex05_Figure_2.png new file mode 100644 index 000000000..40c5caf24 Binary files /dev/null and b/data/expected_example_output/example_05/Ex05_Figure_2.png differ diff --git a/data/expected_example_output/example_05/Ex05_Figure_3.png b/data/expected_example_output/example_05/Ex05_Figure_3.png new file mode 100644 index 000000000..450af28f4 Binary files /dev/null and b/data/expected_example_output/example_05/Ex05_Figure_3.png differ diff --git a/data/expected_example_output/example_05/Ex05_Figure_3_zoom.png b/data/expected_example_output/example_05/Ex05_Figure_3_zoom.png new file mode 100644 index 000000000..64533d8dd Binary files /dev/null and b/data/expected_example_output/example_05/Ex05_Figure_3_zoom.png differ diff --git a/data/expected_example_output/example_05/Ex05_Figure_4.png b/data/expected_example_output/example_05/Ex05_Figure_4.png new file mode 100644 index 000000000..b4f9921f8 Binary files /dev/null and b/data/expected_example_output/example_05/Ex05_Figure_4.png differ diff --git a/data/expected_example_output/example_05/Ex05_Figure_5.png b/data/expected_example_output/example_05/Ex05_Figure_5.png new file mode 100644 index 000000000..d0e15ce4f Binary files /dev/null and b/data/expected_example_output/example_05/Ex05_Figure_5.png differ diff --git a/data/expected_example_output/example_05/Ex05_Figure_6.png b/data/expected_example_output/example_05/Ex05_Figure_6.png new file mode 100644 index 000000000..7ef6250ca Binary files /dev/null and b/data/expected_example_output/example_05/Ex05_Figure_6.png differ diff --git a/data/expected_example_output/example_06/Ex06_Figure_1.png b/data/expected_example_output/example_06/Ex06_Figure_1.png new file mode 100644 index 000000000..22ba1bdf9 Binary files /dev/null and b/data/expected_example_output/example_06/Ex06_Figure_1.png differ diff --git a/data/expected_example_output/example_06/Ex06_output.txt b/data/expected_example_output/example_06/Ex06_output.txt new file mode 100644 index 000000000..b3fa1ddb5 --- /dev/null +++ b/data/expected_example_output/example_06/Ex06_output.txt @@ -0,0 +1,10 @@ +Fitted parameters: +2453630.39088 0.22670 0.23167 +0.49048 0.02013 0.01869 +93.45656 2.19216 2.15444 +0.27419 0.02800 0.03255 +0.10357 0.00732 0.00715 + +Smallest chi2 model: +2453630.376707949 0.48814776622836326 93.89323919007633 0.2722480223300758 0.10093639484208665 +946.7504141947664 diff --git a/data/expected_example_output/example_09/Ex09_Figure_1.png b/data/expected_example_output/example_09/Ex09_Figure_1.png new file mode 100644 index 000000000..7560b05d5 Binary files /dev/null and b/data/expected_example_output/example_09/Ex09_Figure_1.png differ diff --git a/data/expected_example_output/example_09/Ex09_Figure_2.png b/data/expected_example_output/example_09/Ex09_Figure_2.png new file mode 100644 index 000000000..19f423cd9 Binary files /dev/null and b/data/expected_example_output/example_09/Ex09_Figure_2.png differ diff --git a/data/expected_example_output/example_09/Ex09_output.txt b/data/expected_example_output/example_09/Ex09_output.txt new file mode 100644 index 000000000..7dc91617d --- /dev/null +++ b/data/expected_example_output/example_09/Ex09_output.txt @@ -0,0 +1,19 @@ +Initial Trial + t_0 (HJD) u_0 t_E (d) + 5380.00000 0.100000 18.0000 +Chi2 = 32241.84124710082 + +Best Fit: t_0 = 5379.57091, u_0 = 0.5230, t_E = 17.940 +Chi2 = 427.20 + +scipy.optimize.minimize result: + fun: 427.2038219878052 + jac: array([-0.03365149, -3.52971227, -0.1673083 ]) + message: 'Optimization terminated successfully.' + nfev: 11 + nhev: 0 + nit: 9 + njev: 28 + status: 0 + success: True + x: array([5.37957091e+03, 5.22985608e-01, 1.79398771e+01]) diff --git a/data/expected_example_output/example_10/Ex10_Figure_1.png b/data/expected_example_output/example_10/Ex10_Figure_1.png new file mode 100644 index 000000000..a41b3a6e3 Binary files /dev/null and b/data/expected_example_output/example_10/Ex10_Figure_1.png differ diff --git a/data/expected_example_output/example_10/Ex10_output.txt b/data/expected_example_output/example_10/Ex10_output.txt new file mode 100644 index 000000000..efc23bdc6 --- /dev/null +++ b/data/expected_example_output/example_10/Ex10_output.txt @@ -0,0 +1,24 @@ +Fitted parameters: +t_0 : 2454656.39908 0.00004 0.00003 +u_0 : 0.00311 0.00014 0.00014 +t_E : 10.78598 0.50061 0.45567 +t_star : 0.05311 0.00010 0.00011 +Fluxes (source and blending): +flux_s_1 : 16.2724 0.7504 0.7533 +flux_b_1 : 19.4651 0.7343 0.7324 +flux_s_2 : 1.5269 0.0686 0.0675 +flux_b_2 : 13.8875 0.0471 0.0446 +flux_s_3 : 15.9354 0.7181 0.6964 +flux_b_3 : 30.6087 4.3688 3.9172 + +Smallest chi2 model: + +Smallest chi2 model: +2454656.3990747104 0.003140471938847057 10.687652809215646 0.05310677368499168 +chi2 = 4488.397319300576 + +Now let's plot the best model +~/MulensModel/source/MulensModel/utils.py:149: UserWarning: Flux to magnitude conversion approached negative flux + UserWarning) +~/MulensModel/source/MulensModel/utils.py:150: RuntimeWarning: invalid value encountered in log10 + mag = zeropoint - 2.5 * np.log10(flux) diff --git a/data/expected_example_output/example_11/Ex11_output.txt b/data/expected_example_output/example_11/Ex11_output.txt new file mode 100644 index 000000000..c8bf74ff3 --- /dev/null +++ b/data/expected_example_output/example_11/Ex11_output.txt @@ -0,0 +1,24 @@ +First fit. This can take some time... +Fitted parameters: +t_0_1: 6100.04856 +0.02384 -0.02442 +u_0_1: 0.20176 +0.00752 -0.00703 +t_0_2: 6140.00048 +0.00054 -0.00053 +u_0_2: 0.01000 +0.00028 -0.00026 +t_E: 24.97848 +0.63846 -0.64421 + +Smallest chi2 model: +6100.043548826305 0.2022324038184834 6140.000506813421 0.010020746352062961 24.915197094232358 +chi2 = 1559.6924283831406 + +Second fit. This can take some time... +Fitted parameters: +t_0_1: 6100.04559 +0.02412 -0.02510 +u_0_1: 0.20177 +0.00737 -0.00713 +t_0_2: 6140.00051 +0.00058 -0.00052 +u_0_2: 0.01001 +0.00028 -0.00027 +t_E: 24.95427 +0.66243 -0.63960 +flux_ratio: 0.04960 +0.00073 -0.00075 + +Smallest chi2 model: +6100.045603563694 0.20091734861294366 6140.000535868968 0.0099839566576509 25.026575661688916 0.04969677432173234 +chi2 = 1559.7269272614674 diff --git a/data/expected_example_output/example_12/Ex12_Figure_1.png b/data/expected_example_output/example_12/Ex12_Figure_1.png new file mode 100644 index 000000000..9376b9366 Binary files /dev/null and b/data/expected_example_output/example_12/Ex12_Figure_1.png differ diff --git a/data/expected_example_output/example_12/Ex12_Figure_2.png b/data/expected_example_output/example_12/Ex12_Figure_2.png new file mode 100644 index 000000000..498847b1f Binary files /dev/null and b/data/expected_example_output/example_12/Ex12_Figure_2.png differ diff --git a/data/expected_example_output/example_12/Ex12_output.txt b/data/expected_example_output/example_12/Ex12_output.txt new file mode 100644 index 000000000..7f75b30e2 --- /dev/null +++ b/data/expected_example_output/example_12/Ex12_output.txt @@ -0,0 +1,10 @@ +Fitted parameters: +t_0 : 2456836.16049 0.06449 0.06147 +u_0 : 0.91317 0.08863 0.06308 +t_E : 23.00179 1.08252 1.36160 +pi_E_N : -0.24558 0.02746 0.03641 +pi_E_E : 0.25284 0.01993 0.01458 + +Smallest chi2 model: +2456836.1677156785 0.895675183048813 23.285476727841555 -0.2372979702893409 0.24911302577456898 +4227.374316561218 diff --git a/data/expected_example_output/example_13/Ex13_final_output.txt b/data/expected_example_output/example_13/Ex13_final_output.txt new file mode 100644 index 000000000..35ff5582d --- /dev/null +++ b/data/expected_example_output/example_13/Ex13_final_output.txt @@ -0,0 +1,16 @@ +Fitted parameters: +x_caustic_in 0.23742 +0.52941 -0.08743 +x_caustic_out 0.69196 +0.04097 -0.38811 +t_caustic_in 2452835.23844 +0.02525 -0.02907 +t_caustic_out 2452842.07232 +0.00588 -0.00384 +rho 0.00079 +0.00020 -0.00005 + +Smallest chi2 model: +0.14873474431136965 0.735914628389552 2452835.262249646 2452842.079264407 0.0009667058605395652 +1645.8911643006056 + t_0 = 2452848.01467 + u_0 = 0.13443 + t_E = 61.465 + alpha = 224.40 deg + +chi2: 1654.40998416322 diff --git a/data/expected_example_output/example_14/Ex14_Figure_1.png b/data/expected_example_output/example_14/Ex14_Figure_1.png new file mode 100644 index 000000000..0222b1e48 Binary files /dev/null and b/data/expected_example_output/example_14/Ex14_Figure_1.png differ diff --git a/data/expected_example_output/example_14/Ex14_Figure_2.png b/data/expected_example_output/example_14/Ex14_Figure_2.png new file mode 100644 index 000000000..0eb94db04 Binary files /dev/null and b/data/expected_example_output/example_14/Ex14_Figure_2.png differ diff --git a/data/expected_example_output/example_15/Ex15_mb192_Figure_1.png b/data/expected_example_output/example_15/Ex15_mb192_Figure_1.png new file mode 100644 index 000000000..e0bc2e239 Binary files /dev/null and b/data/expected_example_output/example_15/Ex15_mb192_Figure_1.png differ diff --git a/data/expected_example_output/example_15/Ex15_mb192_Figure_1_zoom.png b/data/expected_example_output/example_15/Ex15_mb192_Figure_1_zoom.png new file mode 100644 index 000000000..b297374cc Binary files /dev/null and b/data/expected_example_output/example_15/Ex15_mb192_Figure_1_zoom.png differ diff --git a/data/expected_example_output/example_15/Ex15_mb192_final_output.txt b/data/expected_example_output/example_15/Ex15_mb192_final_output.txt new file mode 100644 index 000000000..af00e8989 --- /dev/null +++ b/data/expected_example_output/example_15/Ex15_mb192_final_output.txt @@ -0,0 +1,14 @@ +Fitted parameters: +t_0 2454245.43602 +0.01075 -0.02995 +u_0 0.00411 +0.00043 -0.00037 +t_E 69.37776 +6.54139 -5.51903 +t_star 0.06335 +0.00394 -0.00426 +alpha 68.95273 +191.56197 -2.84802 + +Smallest chi2 model: +2454245.4465964306 0.003800549975368232 72.81587150268032 0.060030280907769976 66.75127434511563 +1155.9446938367141 + t_0 (HJD) u_0 t_E (d) t_star (d) s q alpha (deg) +2454245.44660 0.003801 72.8159 0.060030 0.88100 0.00015000 66.75127 +default magnification method: point_source_point_lens +other magnification methods: [2454244.5, 'VBBL', 2454246.0] diff --git a/data/expected_example_output/example_15/Ex15_ob390_Figure_1.png b/data/expected_example_output/example_15/Ex15_ob390_Figure_1.png new file mode 100644 index 000000000..547965960 Binary files /dev/null and b/data/expected_example_output/example_15/Ex15_ob390_Figure_1.png differ diff --git a/data/expected_example_output/example_15/Ex15_ob390_output.txt b/data/expected_example_output/example_15/Ex15_ob390_output.txt new file mode 100644 index 000000000..94ca75c16 --- /dev/null +++ b/data/expected_example_output/example_15/Ex15_ob390_output.txt @@ -0,0 +1,16 @@ +Fitted parameters: +t_0 2453582.72741 +0.01070 -0.00882 +u_0 0.35692 +0.01148 -0.01025 +t_E 11.07477 +0.22976 -0.27324 +rho 0.02535 +0.00242 -0.00223 +q 0.0000817 +0.0000211 -0.0000144 +s 1.60690 +0.01973 -0.01514 +alpha 337.85901 +0.25341 -0.25698 + +Smallest chi2 model: +2453582.7300333385 0.3609002048497102 10.977720551257514 0.02585553956290955 8.480735769711146e-05 1.6136137859944493 337.76376235800285 +562.2741771206458 + t_0 (HJD) u_0 t_E (d) rho s q alpha (deg) +2453582.73003 0.360900 10.9777 0.02586 1.61361 0.00008481 337.76376 +default magnification method: point_source_point_lens +other magnification methods: [2453591.0, 'VBBL', 2453594.0] diff --git a/data/expected_example_output/example_17/Ex17_Figure_1.png b/data/expected_example_output/example_17/Ex17_Figure_1.png new file mode 100644 index 000000000..817f5f0e2 Binary files /dev/null and b/data/expected_example_output/example_17/Ex17_Figure_1.png differ diff --git a/data/expected_example_output/example_17/Ex17_Figure_2.png b/data/expected_example_output/example_17/Ex17_Figure_2.png new file mode 100644 index 000000000..1b8f1fc06 Binary files /dev/null and b/data/expected_example_output/example_17/Ex17_Figure_2.png differ diff --git a/data/expected_example_output/example_17/Ex17_Figure_3.png b/data/expected_example_output/example_17/Ex17_Figure_3.png new file mode 100644 index 000000000..6f62602d0 Binary files /dev/null and b/data/expected_example_output/example_17/Ex17_Figure_3.png differ diff --git a/data/expected_example_output/example_18/Ex18_1_Figure_1.png b/data/expected_example_output/example_18/Ex18_1_Figure_1.png new file mode 100644 index 000000000..977f972d8 Binary files /dev/null and b/data/expected_example_output/example_18/Ex18_1_Figure_1.png differ diff --git a/data/expected_example_output/example_18/Ex18_1_output.txt b/data/expected_example_output/example_18/Ex18_1_output.txt new file mode 100644 index 000000000..d3a871bed --- /dev/null +++ b/data/expected_example_output/example_18/Ex18_1_output.txt @@ -0,0 +1 @@ +chi^2: 95.93 diff --git a/data/expected_example_output/example_18/Ex18_2_Figure_1.png b/data/expected_example_output/example_18/Ex18_2_Figure_1.png new file mode 100644 index 000000000..491eb8a02 Binary files /dev/null and b/data/expected_example_output/example_18/Ex18_2_Figure_1.png differ diff --git a/data/expected_example_output/example_18/Ex18_2_output.txt b/data/expected_example_output/example_18/Ex18_2_output.txt new file mode 100644 index 000000000..05035735b --- /dev/null +++ b/data/expected_example_output/example_18/Ex18_2_output.txt @@ -0,0 +1 @@ +chi^2: 460.67 diff --git a/data/expected_example_output/example_18/example_18_output_1.dat b/data/expected_example_output/example_18/example_18_output_1.dat new file mode 100644 index 000000000..b53f39dff --- /dev/null +++ b/data/expected_example_output/example_18/example_18_output_1.dat @@ -0,0 +1,100 @@ +6604.8739 14.5103 0.0111 +6609.2565 14.4984 0.0109 +6612.8298 14.4596 0.0106 +6614.3795 14.4748 0.0107 +6615.4354 14.4937 0.0109 +6616.5977 14.4869 0.0108 +6621.9146 14.4791 0.0108 +6628.9009 14.4952 0.0110 +6630.3470 14.4817 0.0108 +6631.6395 14.4700 0.0107 +6634.4512 14.4769 0.0108 +6634.8948 14.4837 0.0109 +6637.0558 14.4715 0.0107 +6638.9184 14.5004 0.0110 +6643.7966 14.4881 0.0109 +6652.3866 14.4692 0.0108 +6658.4125 14.4731 0.0109 +6664.9854 14.4727 0.0109 +6668.9712 14.4396 0.0106 +6669.5665 14.4581 0.0108 +6670.1151 14.4481 0.0107 +6683.4791 14.4466 0.0109 +6701.0664 14.4181 0.0109 +6703.8618 14.4062 0.0109 +6707.2986 14.3946 0.0108 +6708.0721 14.3919 0.0108 +6711.8456 14.3917 0.0110 +6713.7080 14.3710 0.0108 +6713.9927 14.3699 0.0108 +6721.6476 14.3280 0.0108 +6721.6557 14.3256 0.0108 +6726.1744 14.3149 0.0109 +6727.6298 14.2907 0.0108 +6728.0728 14.3110 0.0110 +6734.8482 14.2407 0.0108 +6737.5930 14.2313 0.0109 +6738.2742 14.2072 0.0108 +6739.2676 14.2063 0.0109 +6744.0054 14.1677 0.0110 +6744.7414 14.1577 0.0110 +6753.3205 14.0132 0.0108 +6758.2814 13.9135 0.0107 +6773.9133 13.5151 0.0107 +6783.7705 13.2496 0.0108 +6796.3515 13.2900 0.0108 +6797.6821 13.3345 0.0109 +6811.3912 13.7324 0.0109 +6815.8913 13.8331 0.0108 +6817.7499 13.8926 0.0110 +6819.9393 13.9402 0.0110 +6823.6071 14.0055 0.0109 +6823.7032 13.9633 0.0105 +6824.6531 14.0144 0.0108 +6828.1141 14.0611 0.0108 +6833.0262 14.1453 0.0109 +6833.3441 14.1324 0.0108 +6834.4777 14.1331 0.0106 +6835.0121 14.1594 0.0108 +6840.8818 14.2225 0.0108 +6842.8239 14.2367 0.0108 +6856.6756 14.3421 0.0109 +6859.9128 14.3560 0.0109 +6860.5211 14.3600 0.0109 +6860.6752 14.3821 0.0111 +6864.6159 14.3900 0.0110 +6868.4516 14.3901 0.0109 +6869.9431 14.3875 0.0108 +6873.0021 14.4158 0.0110 +6875.1116 14.4107 0.0109 +6879.0080 14.4317 0.0110 +6880.2203 14.4227 0.0109 +6883.7509 14.4296 0.0109 +6886.1755 14.4412 0.0109 +6888.8120 14.4359 0.0108 +6907.4771 14.4645 0.0109 +6910.7321 14.4599 0.0108 +6911.3041 14.4735 0.0109 +6916.3946 14.4706 0.0109 +6917.0442 14.4867 0.0110 +6918.6684 14.4680 0.0108 +6919.5347 14.4911 0.0111 +6919.9728 14.4620 0.0108 +6930.0837 14.4617 0.0107 +6931.7789 14.4763 0.0108 +6933.5876 14.4759 0.0108 +6934.9602 14.4863 0.0109 +6954.0494 14.4777 0.0108 +6955.9583 14.4756 0.0107 +6957.7111 14.4879 0.0109 +6958.8594 14.5007 0.0110 +6961.3582 14.4990 0.0110 +6964.4489 14.4827 0.0108 +6969.2792 14.4921 0.0109 +6971.9760 14.4972 0.0109 +6978.2672 14.4817 0.0108 +6981.4356 14.5059 0.0110 +6983.0354 14.5013 0.0109 +6987.4259 14.4980 0.0109 +6988.0448 14.4918 0.0108 +6999.2706 14.5013 0.0109 diff --git a/data/expected_example_output/example_18/example_18_output_2.dat b/data/expected_example_output/example_18/example_18_output_2.dat new file mode 100644 index 000000000..134f6cf1c --- /dev/null +++ b/data/expected_example_output/example_18/example_18_output_2.dat @@ -0,0 +1,500 @@ +6050.1526 15.0613 0.0319 +6050.4150 15.0497 0.0316 +6050.7213 15.0052 0.0304 +6051.1492 15.0246 0.0309 +6051.1765 15.1050 0.0333 +6052.0033 15.0712 0.0324 +6052.1866 15.1047 0.0334 +6052.2241 15.0772 0.0326 +6052.4327 15.0847 0.0328 +6052.6569 15.0387 0.0315 +6052.7766 15.0681 0.0324 +6053.5361 15.0724 0.0325 +6053.7087 15.0230 0.0311 +6054.2928 15.0599 0.0322 +6054.5190 15.0543 0.0321 +6054.5845 15.1193 0.0341 +6054.5920 15.0372 0.0316 +6054.9390 15.0457 0.0319 +6054.9508 15.1085 0.0338 +6055.9131 15.0602 0.0324 +6055.9245 15.0548 0.0322 +6056.1283 15.0713 0.0328 +6056.1588 15.0582 0.0324 +6056.4928 15.0572 0.0324 +6056.5326 15.0334 0.0317 +6057.2566 15.0405 0.0320 +6057.6185 15.0528 0.0324 +6058.4487 15.0675 0.0329 +6059.6686 15.1008 0.0340 +6059.8812 15.1395 0.0353 +6060.3358 15.0480 0.0325 +6060.7898 15.0143 0.0315 +6060.9459 15.0623 0.0330 +6061.5691 15.0288 0.0321 +6061.9603 15.0487 0.0327 +6062.2533 15.0906 0.0340 +6062.2585 15.0909 0.0340 +6062.3497 15.0649 0.0332 +6062.7563 15.0586 0.0331 +6063.0981 15.0755 0.0336 +6063.4561 15.0234 0.0321 +6063.6647 15.0306 0.0323 +6064.2096 15.0365 0.0326 +6064.6213 15.0899 0.0343 +6065.5472 15.0328 0.0326 +6065.7014 15.0038 0.0318 +6066.9146 15.0045 0.0320 +6067.5425 14.9879 0.0316 +6067.8689 15.0030 0.0320 +6068.0160 15.0582 0.0337 +6068.7628 15.0344 0.0331 +6069.2352 14.9811 0.0316 +6069.5875 15.0536 0.0338 +6069.9323 14.9899 0.0319 +6069.9973 14.9690 0.0313 +6070.3819 15.0544 0.0340 +6071.5696 15.0277 0.0333 +6071.6981 15.0237 0.0332 +6071.8545 14.9663 0.0315 +6072.3451 15.0548 0.0343 +6072.6716 15.0612 0.0345 +6072.6890 14.9820 0.0321 +6072.7625 14.9553 0.0313 +6073.7874 14.9503 0.0313 +6074.1839 15.0127 0.0332 +6074.5797 14.9298 0.0309 +6076.0190 14.9743 0.0324 +6076.2002 15.0115 0.0335 +6076.2147 14.9960 0.0331 +6076.2463 14.9581 0.0319 +6076.3208 14.9815 0.0326 +6076.5819 14.9983 0.0332 +6076.6450 15.0012 0.0333 +6077.2683 15.0078 0.0336 +6077.4230 14.9689 0.0324 +6078.5758 14.9904 0.0333 +6078.9204 14.9932 0.0334 +6079.0223 14.9230 0.0313 +6079.4843 14.9453 0.0321 +6079.5298 14.9354 0.0318 +6080.6467 15.0047 0.0341 +6080.7999 14.9318 0.0319 +6081.4602 14.9879 0.0337 +6082.0699 15.0107 0.0346 +6082.2989 14.8873 0.0309 +6082.3815 14.9462 0.0326 +6082.9750 14.9681 0.0334 +6083.0884 14.9440 0.0327 +6085.6298 14.9497 0.0334 +6086.2913 14.8802 0.0314 +6086.4544 14.8850 0.0316 +6087.0198 14.9435 0.0335 +6087.6631 14.9531 0.0339 +6087.8160 14.9270 0.0331 +6087.8801 14.8718 0.0315 +6089.2429 14.8367 0.0308 +6089.3363 14.8768 0.0319 +6090.3502 14.8895 0.0325 +6091.5518 14.9297 0.0340 +6091.8128 14.9176 0.0337 +6091.9955 14.8752 0.0325 +6092.1672 14.8965 0.0331 +6093.3618 14.8817 0.0330 +6093.3893 14.8536 0.0321 +6094.0789 14.8636 0.0326 +6094.1723 14.9081 0.0340 +6094.9319 14.7835 0.0304 +6095.3245 14.8471 0.0324 +6095.6107 14.8300 0.0319 +6097.9270 14.8697 0.0337 +6098.0451 14.8143 0.0320 +6098.0544 14.8897 0.0344 +6098.0587 14.8351 0.0327 +6098.1548 14.8587 0.0334 +6098.6088 14.8429 0.0330 +6101.4371 14.7978 0.0324 +6102.1569 14.8046 0.0328 +6102.2644 14.7719 0.0319 +6103.1840 14.8248 0.0337 +6103.6482 14.7443 0.0314 +6104.0786 14.7747 0.0325 +6104.0900 14.7978 0.0332 +6104.6135 14.7938 0.0332 +6104.6820 14.7815 0.0329 +6104.7849 14.7459 0.0318 +6104.8517 14.8302 0.0344 +6105.1690 14.8133 0.0340 +6105.5334 14.7672 0.0327 +6106.0326 14.7230 0.0316 +6106.2359 14.7785 0.0334 +6106.4297 14.7295 0.0320 +6107.1513 14.7446 0.0328 +6107.4015 14.7364 0.0327 +6107.8592 14.6618 0.0309 +6107.9517 14.7515 0.0336 +6107.9797 14.7012 0.0321 +6108.0645 14.7693 0.0342 +6109.0072 14.6814 0.0326 +6109.0454 14.7250 0.0340 +6109.3272 14.6989 0.0336 +6109.4935 14.6781 0.0333 +6110.1274 14.5973 0.0323 +6110.1357 14.5774 0.0317 +6111.2566 14.4072 0.0324 +6111.7445 14.1948 0.0325 +6112.1394 13.8682 0.0308 +6112.1879 13.9242 0.0333 +6112.2500 13.8615 0.0324 +6112.3645 13.8441 0.0336 +6112.6129 13.7573 0.0331 +6112.7386 13.7207 0.0323 +6113.7533 14.4362 0.0327 +6114.5571 14.6692 0.0336 +6114.6419 14.6073 0.0315 +6114.6977 14.6442 0.0324 +6114.9168 14.6682 0.0325 +6115.0146 14.6927 0.0331 +6115.9994 14.7672 0.0345 +6116.4063 14.7448 0.0339 +6116.9213 14.7034 0.0328 +6117.3457 14.6498 0.0315 +6117.5983 14.7336 0.0342 +6117.6582 14.7188 0.0338 +6118.2387 14.6431 0.0321 +6118.6219 14.6380 0.0323 +6121.4458 14.5913 0.0327 +6121.8008 14.5713 0.0321 +6121.9909 14.6416 0.0343 +6122.1818 14.5912 0.0327 +6122.4541 14.6196 0.0336 +6122.4590 14.5572 0.0317 +6122.8753 14.5597 0.0318 +6123.9213 14.6105 0.0334 +6124.6784 14.5646 0.0322 +6124.9474 14.5571 0.0321 +6125.1765 14.5668 0.0324 +6125.2884 14.5703 0.0325 +6126.4345 14.5965 0.0337 +6126.9793 14.5393 0.0321 +6127.5659 14.5528 0.0327 +6127.6967 14.5646 0.0331 +6128.2123 14.5504 0.0328 +6128.4570 14.5431 0.0326 +6129.1236 14.5483 0.0330 +6129.2072 14.5073 0.0318 +6129.3643 14.4969 0.0315 +6129.5882 14.5327 0.0326 +6129.7399 14.5351 0.0328 +6129.7802 14.5045 0.0319 +6130.2763 14.5287 0.0327 +6130.8011 14.4682 0.0311 +6131.8836 14.4917 0.0320 +6133.6048 14.4878 0.0323 +6134.8600 14.4590 0.0316 +6134.9147 14.5017 0.0329 +6135.3112 14.4669 0.0320 +6135.7792 14.4743 0.0322 +6136.3331 14.4844 0.0326 +6137.3837 14.4145 0.0307 +6137.3842 14.4639 0.0322 +6137.5713 14.4680 0.0323 +6137.7007 14.3933 0.0302 +6138.5777 14.4846 0.0329 +6138.7385 14.5236 0.0341 +6139.0939 14.5017 0.0335 +6139.2894 14.4889 0.0331 +6139.4035 14.4883 0.0331 +6140.1497 14.5174 0.0340 +6140.2058 14.4792 0.0329 +6140.4046 14.4798 0.0329 +6140.5069 14.4954 0.0334 +6140.8193 14.4251 0.0313 +6141.0700 14.4517 0.0321 +6141.8529 14.4489 0.0320 +6141.8654 14.4611 0.0324 +6142.4955 14.5293 0.0345 +6143.2980 14.5140 0.0340 +6143.3218 14.4732 0.0327 +6143.7607 14.4861 0.0331 +6143.8216 14.4879 0.0332 +6144.2742 14.5326 0.0346 +6144.5497 14.4689 0.0326 +6144.5811 14.4635 0.0324 +6144.6444 14.5075 0.0337 +6145.3536 14.5021 0.0335 +6145.8124 14.4452 0.0318 +6146.7328 14.4409 0.0316 +6146.7957 14.4510 0.0319 +6147.7547 14.4796 0.0326 +6148.0733 14.5010 0.0332 +6148.4480 14.4154 0.0307 +6148.5168 14.5227 0.0339 +6148.5355 14.4883 0.0328 +6148.7105 14.4717 0.0323 +6149.2157 14.4852 0.0326 +6149.5573 14.4729 0.0322 +6149.5701 14.5582 0.0348 +6149.6190 14.4773 0.0323 +6149.8764 14.5288 0.0339 +6149.8950 14.4610 0.0318 +6150.2675 14.4917 0.0327 +6150.4410 14.4611 0.0317 +6150.6013 14.5497 0.0344 +6150.6600 14.5318 0.0338 +6150.9265 14.4951 0.0326 +6151.1289 14.4886 0.0324 +6151.4779 14.4144 0.0302 +6151.5116 14.4768 0.0320 +6152.2895 14.4777 0.0319 +6152.3800 14.4947 0.0324 +6152.4112 14.5058 0.0327 +6153.4118 14.5964 0.0353 +6154.0769 14.4920 0.0319 +6154.2007 14.5532 0.0337 +6154.5323 14.5294 0.0329 +6154.7554 14.5491 0.0335 +6155.4614 14.5229 0.0325 +6155.4980 14.5352 0.0329 +6155.5366 14.4991 0.0318 +6156.1259 14.5414 0.0329 +6156.6873 14.5871 0.0342 +6156.9632 14.5343 0.0325 +6157.3493 14.5272 0.0322 +6157.8943 14.5717 0.0334 +6157.9444 14.5662 0.0332 +6159.1894 14.5270 0.0317 +6160.3293 14.5922 0.0333 +6160.3660 14.5335 0.0315 +6160.4716 14.6075 0.0337 +6161.0840 14.5837 0.0328 +6161.1305 14.6347 0.0344 +6161.7634 14.5781 0.0324 +6162.5061 14.5487 0.0314 +6162.7478 14.6047 0.0329 +6162.8144 14.5839 0.0323 +6162.9550 14.6149 0.0332 +6163.0320 14.6187 0.0333 +6163.9103 14.5710 0.0316 +6164.1460 14.5809 0.0318 +6164.2541 14.5892 0.0320 +6164.4353 14.6392 0.0335 +6164.4443 14.6122 0.0326 +6164.8708 14.6093 0.0324 +6165.6676 14.6725 0.0341 +6166.7582 14.6725 0.0337 +6166.8721 14.6652 0.0335 +6166.8748 14.6308 0.0324 +6166.9144 14.6823 0.0340 +6167.6649 14.6447 0.0326 +6167.8665 14.6185 0.0317 +6168.0240 14.6469 0.0325 +6168.5475 14.6618 0.0328 +6169.5503 14.6563 0.0323 +6169.7089 14.6865 0.0332 +6170.7231 14.7526 0.0349 +6171.5140 14.7311 0.0340 +6172.2519 14.7146 0.0332 +6172.3666 14.6658 0.0317 +6173.3201 14.7507 0.0340 +6173.3210 14.7132 0.0328 +6173.3929 14.7418 0.0337 +6173.9934 14.6997 0.0322 +6174.3010 14.7087 0.0324 +6174.7293 14.7426 0.0333 +6175.1098 14.6913 0.0316 +6175.3322 14.6992 0.0318 +6176.6973 14.8119 0.0348 +6177.0536 14.8106 0.0346 +6177.0834 14.7371 0.0324 +6177.0992 14.7404 0.0325 +6177.4468 14.8052 0.0343 +6177.5335 14.8081 0.0344 +6177.6458 14.7068 0.0313 +6178.2316 14.7561 0.0326 +6178.2490 14.7611 0.0327 +6178.8124 14.7711 0.0329 +6178.8756 14.7989 0.0337 +6179.0268 14.7930 0.0335 +6179.7423 14.7831 0.0329 +6181.1898 14.7519 0.0316 +6181.1962 14.7019 0.0302 +6182.1078 14.7851 0.0323 +6182.6376 14.8209 0.0332 +6183.0181 14.8050 0.0326 +6183.2171 14.8049 0.0326 +6183.4974 14.7614 0.0312 +6184.4051 14.8391 0.0333 +6184.5283 14.7855 0.0317 +6184.7877 14.7621 0.0309 +6184.8701 14.8581 0.0337 +6185.4494 14.8373 0.0329 +6185.6187 14.8246 0.0325 +6185.6407 14.7774 0.0311 +6186.4207 14.8871 0.0342 +6186.7751 14.8216 0.0321 +6186.8634 14.8954 0.0344 +6188.0682 14.7745 0.0304 +6188.3423 14.9112 0.0344 +6189.4753 14.8533 0.0324 +6190.4919 14.8897 0.0332 +6190.8709 14.8775 0.0328 +6190.9876 14.8835 0.0329 +6191.0777 14.8475 0.0318 +6191.6342 14.8565 0.0319 +6191.8065 14.8934 0.0330 +6191.8637 14.8505 0.0317 +6191.9065 14.8831 0.0327 +6191.9675 14.8831 0.0327 +6192.0921 14.8914 0.0329 +6192.5371 14.9148 0.0335 +6192.6498 14.9274 0.0339 +6192.8132 14.8883 0.0326 +6193.4683 14.8585 0.0316 +6193.6487 14.8523 0.0314 +6193.8469 14.9457 0.0341 +6194.0187 14.9845 0.0353 +6194.6184 14.9328 0.0336 +6194.7910 14.8986 0.0325 +6194.8498 14.9380 0.0337 +6195.3170 14.9291 0.0333 +6195.4739 14.8912 0.0321 +6196.5461 14.8958 0.0320 +6196.6868 14.9535 0.0337 +6197.0190 14.9377 0.0332 +6197.1872 14.9276 0.0328 +6197.4451 14.9316 0.0329 +6198.0218 14.9249 0.0326 +6198.1649 14.9102 0.0321 +6198.2200 14.9770 0.0341 +6198.7040 14.9907 0.0345 +6198.7758 14.8775 0.0310 +6198.7916 14.9391 0.0328 +6199.3795 14.9821 0.0340 +6199.7443 14.9520 0.0330 +6199.7726 14.9447 0.0328 +6199.7842 14.9479 0.0329 +6199.9045 14.9038 0.0316 +6200.0702 14.9088 0.0317 +6200.5836 15.0060 0.0345 +6201.2988 14.9420 0.0324 +6201.5933 14.9856 0.0337 +6201.8754 14.9406 0.0323 +6202.6079 14.9301 0.0318 +6203.2213 14.9867 0.0334 +6203.3439 15.0172 0.0343 +6203.6482 14.9030 0.0309 +6203.7043 15.0141 0.0342 +6203.7486 14.9166 0.0312 +6204.9123 14.9467 0.0319 +6204.9743 14.9876 0.0331 +6204.9936 14.9548 0.0321 +6205.0937 14.9611 0.0323 +6205.5386 15.0093 0.0337 +6205.5388 14.9452 0.0318 +6206.2277 14.9816 0.0327 +6206.4781 15.0002 0.0332 +6206.5104 15.0071 0.0335 +6206.6745 14.9558 0.0319 +6206.8366 14.9767 0.0325 +6207.6159 14.9936 0.0329 +6208.0303 14.9669 0.0320 +6209.5164 15.0122 0.0331 +6209.9338 15.0151 0.0331 +6210.1724 15.0037 0.0327 +6210.5102 15.0246 0.0333 +6210.8610 14.9219 0.0303 +6210.9199 15.0111 0.0329 +6211.0684 14.9991 0.0325 +6211.1327 14.9724 0.0317 +6211.3053 14.9796 0.0319 +6211.6069 15.0202 0.0330 +6212.2042 14.9681 0.0314 +6212.4796 15.0067 0.0325 +6212.7738 15.0218 0.0329 +6212.9252 15.0021 0.0323 +6213.0748 14.9721 0.0314 +6213.1615 14.9637 0.0311 +6213.2028 15.0478 0.0336 +6213.2397 15.0202 0.0328 +6213.3367 15.0033 0.0323 +6214.0755 14.9865 0.0317 +6214.8977 15.0002 0.0320 +6215.2579 15.0562 0.0336 +6215.6887 15.0092 0.0321 +6215.8084 15.0103 0.0321 +6217.0984 15.0468 0.0331 +6217.1695 15.0988 0.0347 +6217.3631 15.0745 0.0339 +6217.6745 15.0053 0.0318 +6217.9527 15.0589 0.0333 +6218.4105 15.0292 0.0324 +6218.4478 15.1028 0.0346 +6218.8804 15.0482 0.0329 +6219.7031 15.0081 0.0316 +6220.9334 15.0561 0.0329 +6221.2706 15.0663 0.0331 +6221.5796 15.0159 0.0316 +6221.8951 15.0754 0.0334 +6222.0292 15.0149 0.0315 +6222.7497 15.0259 0.0318 +6222.7982 15.0645 0.0329 +6224.0973 15.1311 0.0348 +6225.3757 15.0634 0.0326 +6226.1879 15.0256 0.0314 +6226.2267 15.0980 0.0336 +6226.9997 15.0917 0.0333 +6227.1534 15.0558 0.0322 +6227.9791 15.0708 0.0326 +6228.4395 15.0490 0.0319 +6229.0678 15.0550 0.0320 +6229.0821 15.0882 0.0330 +6229.5468 15.0315 0.0313 +6229.5676 15.0447 0.0317 +6229.8806 15.0692 0.0323 +6230.3779 15.0596 0.0320 +6230.5530 15.1087 0.0335 +6230.6774 15.1054 0.0334 +6230.9783 15.0851 0.0327 +6231.8442 15.0870 0.0327 +6232.8671 15.1167 0.0335 +6233.7425 15.0986 0.0329 +6233.9696 15.0472 0.0314 +6234.8441 15.0836 0.0324 +6235.3549 15.0864 0.0324 +6236.2810 15.1715 0.0350 +6236.5193 15.0783 0.0321 +6236.7050 15.1255 0.0335 +6237.0430 15.0949 0.0325 +6237.1055 15.1242 0.0334 +6237.1920 15.1322 0.0336 +6238.1430 15.1128 0.0330 +6238.6397 15.1258 0.0333 +6238.7666 15.1467 0.0340 +6238.8453 15.1325 0.0335 +6239.0408 15.0967 0.0324 +6239.9755 15.1363 0.0336 +6240.1660 15.1296 0.0333 +6240.1701 15.1435 0.0338 +6240.5005 15.1321 0.0334 +6241.3849 15.0878 0.0320 +6241.4663 15.0961 0.0322 +6241.4965 15.1067 0.0326 +6241.5269 15.1060 0.0325 +6242.2051 15.1039 0.0324 +6242.2182 15.1195 0.0329 +6242.5266 15.1331 0.0333 +6242.5486 15.1382 0.0334 +6244.2804 15.1188 0.0327 +6244.4331 15.1171 0.0327 +6244.5813 15.1152 0.0326 +6245.5429 15.1209 0.0327 +6245.7369 15.1340 0.0331 +6246.3915 15.0844 0.0316 +6246.5365 15.1442 0.0334 +6246.5610 15.1325 0.0330 +6246.8478 15.1154 0.0325 +6247.3929 15.1141 0.0324 +6248.9879 15.1196 0.0325 +6249.0520 15.1324 0.0329 +6249.1841 15.1428 0.0332 diff --git a/data/expected_example_output/example_19/Ex19_Figure_1.png b/data/expected_example_output/example_19/Ex19_Figure_1.png new file mode 100644 index 000000000..05ad46952 Binary files /dev/null and b/data/expected_example_output/example_19/Ex19_Figure_1.png differ diff --git a/data/expected_example_output/example_19/Ex19_Figure_2.png b/data/expected_example_output/example_19/Ex19_Figure_2.png new file mode 100644 index 000000000..652a1bcf6 Binary files /dev/null and b/data/expected_example_output/example_19/Ex19_Figure_2.png differ diff --git a/data/expected_example_output/example_19/Ex19_Figure_3.png b/data/expected_example_output/example_19/Ex19_Figure_3.png new file mode 100644 index 000000000..dc9028754 Binary files /dev/null and b/data/expected_example_output/example_19/Ex19_Figure_3.png differ diff --git a/data/expected_example_output/example_19/Ex19_output.txt b/data/expected_example_output/example_19/Ex19_output.txt new file mode 100644 index 000000000..3a5a93af6 --- /dev/null +++ b/data/expected_example_output/example_19/Ex19_output.txt @@ -0,0 +1 @@ +chi2 = 29266.181303085774 diff --git a/data/expected_example_output/example_20/Ex20_Figure_1.png b/data/expected_example_output/example_20/Ex20_Figure_1.png new file mode 100644 index 000000000..133cef65a Binary files /dev/null and b/data/expected_example_output/example_20/Ex20_Figure_1.png differ diff --git a/data/expected_example_output/example_20/Ex20_Figure_1_zoom.png b/data/expected_example_output/example_20/Ex20_Figure_1_zoom.png new file mode 100644 index 000000000..8208066ad Binary files /dev/null and b/data/expected_example_output/example_20/Ex20_Figure_1_zoom.png differ diff --git a/data/expected_example_output/example_20/Ex20_Figure_2.png b/data/expected_example_output/example_20/Ex20_Figure_2.png new file mode 100644 index 000000000..8ebbd86a8 Binary files /dev/null and b/data/expected_example_output/example_20/Ex20_Figure_2.png differ diff --git a/data/expected_example_output/example_20/Ex20_Figure_3.png b/data/expected_example_output/example_20/Ex20_Figure_3.png new file mode 100644 index 000000000..c1aa28b01 Binary files /dev/null and b/data/expected_example_output/example_20/Ex20_Figure_3.png differ diff --git a/data/expected_example_output/example_20/Ex20_Figure_4.png b/data/expected_example_output/example_20/Ex20_Figure_4.png new file mode 100644 index 000000000..eff518530 Binary files /dev/null and b/data/expected_example_output/example_20/Ex20_Figure_4.png differ diff --git a/data/expected_example_output/example_20/Ex20_Figure_5.png b/data/expected_example_output/example_20/Ex20_Figure_5.png new file mode 100644 index 000000000..f9cc24c81 Binary files /dev/null and b/data/expected_example_output/example_20/Ex20_Figure_5.png differ diff --git a/data/expected_example_output/example_20/Ex20_Figure_6.png b/data/expected_example_output/example_20/Ex20_Figure_6.png new file mode 100644 index 000000000..9f2002332 Binary files /dev/null and b/data/expected_example_output/example_20/Ex20_Figure_6.png differ diff --git a/data/expected_example_output/example_20/Ex20_Figure_6_zoom.png b/data/expected_example_output/example_20/Ex20_Figure_6_zoom.png new file mode 100644 index 000000000..f199806bb Binary files /dev/null and b/data/expected_example_output/example_20/Ex20_Figure_6_zoom.png differ diff --git a/data/expected_example_output/example_21/Ex21_Figure_1.png b/data/expected_example_output/example_21/Ex21_Figure_1.png new file mode 100644 index 000000000..e5106644b Binary files /dev/null and b/data/expected_example_output/example_21/Ex21_Figure_1.png differ diff --git a/data/expected_example_output/example_22/Ex22_Figure_1.png b/data/expected_example_output/example_22/Ex22_Figure_1.png new file mode 100644 index 000000000..95d451d27 Binary files /dev/null and b/data/expected_example_output/example_22/Ex22_Figure_1.png differ diff --git a/data/expected_example_output/example_23/Ex23_Figure_1.png b/data/expected_example_output/example_23/Ex23_Figure_1.png new file mode 100644 index 000000000..5d2b26013 Binary files /dev/null and b/data/expected_example_output/example_23/Ex23_Figure_1.png differ diff --git a/data/expected_example_output/example_24/Ex24_output.txt b/data/expected_example_output/example_24/Ex24_output.txt new file mode 100644 index 000000000..0ad191ed7 --- /dev/null +++ b/data/expected_example_output/example_24/Ex24_output.txt @@ -0,0 +1,32 @@ +Printing datasets: +Auck_0300089_PLC_001.tbl: n_epochs = 76, n_bad = 0, band = R +Bron_0300089_PLC_002.tbl: n_epochs = 149, n_bad = 0, band = R +CTIO_H_0300089_PLC_004.tbl: n_epochs = 286, n_bad = 0, band = H +CTIO_I_0300089_PLC_005.tbl: n_epochs = 46, n_bad = 0, band = I +Canopus_0300089_PLC_003.tbl: n_epochs = 12, n_bad = 0, band = I +Danish_0300089_PLC_006.tbl: n_epochs = 51, n_bad = 0, band = I +MOA_0300089_PLC_007.tbl: n_epochs = 2862, n_bad = 0, band = R, Errorbar scaling: factor = 1.6 minimum = 0.001 + +Printing model: + t_0 (HJD) u_0 t_E (d) t_star (d) +2454656.39975 0.003000 11.1400 0.054870 +default magnification method: point_source +other magnification methods: [2454656.2900099996, 'finite_source_uniform_Gould94', 2454656.50949] +limb-darkening coeffs (gamma): {'I': 0.4459845087647779, 'V': 0.6246719160104987, 'R': 0.5348542458808618, 'H': 0.2796352583586626} + +Printing event: +model: + t_0 (HJD) u_0 t_E (d) t_star (d) +2454656.39975 0.003000 11.1400 0.054870 +coords: 17:54:14.53 -34:46:40.99 +default magnification method: point_source +other magnification methods: [2454656.2900099996, 'finite_source_uniform_Gould94', 2454656.50949] +limb-darkening coeffs (gamma): {'I': 0.4459845087647779, 'V': 0.6246719160104987, 'R': 0.5348542458808618, 'H': 0.2796352583586626} +datasets: +Auck_0300089_PLC_001.tbl: n_epochs = 76, n_bad = 0, band = R +Bron_0300089_PLC_002.tbl: n_epochs = 149, n_bad = 0, band = R +CTIO_H_0300089_PLC_004.tbl: n_epochs = 286, n_bad = 0, band = H +CTIO_I_0300089_PLC_005.tbl: n_epochs = 46, n_bad = 0, band = I +Canopus_0300089_PLC_003.tbl: n_epochs = 12, n_bad = 0, band = I +Danish_0300089_PLC_006.tbl: n_epochs = 51, n_bad = 0, band = I +MOA_0300089_PLC_007.tbl: n_epochs = 2862, n_bad = 0, band = R, Errorbar scaling: factor = 1.6 minimum = 0.001 *data_ref* \ No newline at end of file diff --git a/developers_board.md b/developers_board.md index e230b5e80..6dd5f8049 100644 --- a/developers_board.md +++ b/developers_board.md @@ -1,5 +1,4 @@ # Next big tasks - think about the order: -1. xallarap 2. full Keplerian motion of the lens (because 2-parameter approximation is unphysical and is already implemented) 3. triple sources 4. triple lenses @@ -8,17 +7,12 @@ 7. terrestial parallax # Next smaller tasks: -1. gradient for parallax model issue 2. ModelParameters - note that t_0_1 etc. are for "binary source" models -2. update VBBL 3. make directory with reference plots from examples 4. remove unused branches 5. UC40 - finish it and implement Event.get\_lc and plot\_lc -6. example 16 7. UC38 - finish it -8. chi2 gradient for rho or t_star - first move code from FitData to Trajectory and PointLens (which means new minor version) 9. faster FFP calculations -10. print Model/ModelParameters: add t\_0\_par somewhere - maybe only when it is != t\_0 11. "import MulensModel as mm" everywhere: use_cases/->30,31,34 examples/run_time_tests/check_system.py examples/checks.py TUTORIALS 12. satellite positions read from a file similar to data challenge files 13. check open issues on github @@ -42,7 +36,7 @@ Changes for planned v3 are here: [documents/MM\_v3.md](documents/MM_v3.md) * more on setup.py: [link](https://github.com/kennethreitz/setup.py) * compile with "pedantic" flags for compilers * Documentation - * magnification\_methods.pdf - add full references there and link this file in the code + * magnification\_methods.pdf - add full references there * Sagan workshop hands-on activity in MM * examples as ipython notebooks * Add \_\_repr\_\_ functions to Lens and Source @@ -61,8 +55,6 @@ Changes for planned v3 are here: [documents/MM\_v3.md](documents/MM_v3.md) * Fit.fit\_fluxes docstring to be updated * which\_parameters() - note that it doesnt work for binary source parameters, but the parameters work properly; just BSPL and rho\_2 etc. are optional * parallax models - * binary source - there should be one Fit less in Event.get\_chi2xxx functions - if there are 2 sources, then calculate magnification and use F\_S = F\_S\_1+F\_S\_2 and get it from self.model.fit; most probably adding some function to Fit would help - * test binary-lens binary-source * different t\_E for each source (correct Model.set\_times) * test binary source with exactly one rho\_X defined * add t\_eff\_1, t\_eff\_2 @@ -83,7 +75,6 @@ Changes for planned v3 are here: [documents/MM\_v3.md](documents/MM_v3.md) * get gamma/u LD coeffs from Claret papers etc. * [Lee+09](https://ui.adsabs.harvard.edu/abs/2009ApJ...695..200L/abstract) - gradient calculations for uniform source, also faster calculations - profile * FSPL for large sources using [Agol 2003](https://ui.adsabs.harvard.edu/abs/2003ApJ...594..449A/abstract) - * Xallarap (see below for references) * Quadratic limb darkening * Multi-lens ray shooting: * mapmaking version which adds new rays as needed (but remember that it runs for fixed (s,q) only!) @@ -132,7 +123,6 @@ Changes for planned v3 are here: [documents/MM\_v3.md](documents/MM_v3.md) * Event should sync information on which of the 3 types of parallax are used, so that if it is specified for event, then there will be exception if one dataset is missing earth\_coords etc. In general there should be some way to make sure which parallax types are used in which calculation of magnification. * Class Event should have not only set\_datasets() methods but also add\_datasets(), i.e. a similar method that appends datasets to self.\_datasets. * reduce calls to Fit.fit\_fluxes() - * add finite source in chi2\_gradient() * chi2\_gradient() should cope NaN values in a way similar to get\_chi2() * **check all functions that should pass** fit\_blending parameter - Event.plot\_model, what else??? Already done: Event.get\_ref\_fluxes() * chi2 with maximum value provided - if the chi2 for point-source gives chi2 larger than specified limit, then finite source calculations are not undertaken (this should significantly speed-up MultiNest) @@ -214,7 +204,7 @@ Changes for planned v3 are here: [documents/MM\_v3.md](documents/MM_v3.md) * when plotting data, make sure that max/min limits on Y axis include errorbars, if the errorbars are shown * export/save given data file in scale of other dataset and model * this line may be wrong for some values of char: kwargs['fmt'] = kwargs['fmt'].replace(char, "") - * for plt.scatter() the color can be set as 'facecolor', 'facecolors', or 'edgecolors' and this should be dealt with in _set_plot_properties() + * for plt.scatter() the color can be set as 'facecolor', 'facecolors', or 'edgecolors' and this should be dealt with in \_set\_plot\_properties() * for plotting X for bad data use large size and/or thinner line * separate colors (or even kwargs) for X-es as an option (to get contrasting colors see https://itsphbytes.wordpress.com/2016/08/29/complementary-colors-python-code/) * PointLens class: @@ -230,7 +220,6 @@ Changes for planned v3 are here: [documents/MM\_v3.md](documents/MM_v3.md) * _warning when too many annual parallax calculations are conducted_ * _\_get\_delta\_satellite() should be using self.times_ * annual parallax caching - if moved to MulensData, then would be faster because hashing of coords and time vector takes time - * maybe Trajectory should be able to plot itself, and Model.plot\_trajectory() should call it - it would be easier for binary sources etc. * colorscale time or magnification (see Fig 2 in [Ranc+19](https://arxiv.org/abs/1810.00014)) * plot in units of theta\_star (or even days) instead of theta\_E * UniformCausticSampling class: @@ -263,7 +252,6 @@ Changes for planned v3 are here: [documents/MM\_v3.md](documents/MM_v3.md) * _Hamiltonian MCMC [link 1](http://arogozhnikov.github.io/2016/12/19/markov_chain_monte_carlo.html) and [link 2](https://theclevermachine.wordpress.com/2012/11/18/mcmc-hamiltonian-monte-carlo-a-k-a-hybrid-monte-carlo/) and [link 3](https://colindcarroll.com/2019/04/11/hamiltonian-monte-carlo-from-scratch/)_ * example with [parallel EMCEE](https://emcee.readthedocs.io/en/stable/tutorials/parallel/) * _plot many models from posterior_ - * **chi2 per dataset** * **scipy.curve\_fit() and print parameter uncertainties** * **corner plots; they require [corner](https://github.com/dfm/corner.py), [pyhdust](https://github.com/danmoser/pyhdust), or [pyGTC](https://pypi.org/project/pyGTC/)** * _F\_s for MOA data for MB08310 differs from Janczak paper - is it caused by FSPL vs. FSBL models?_ @@ -277,8 +265,6 @@ Changes for planned v3 are here: [documents/MM\_v3.md](documents/MM_v3.md) * note in PSPL tutorial about plotting data in MulensData * add example that after calling Event.get\_chi2() use Event.fit to get e.g. magnifications so that the magnification is not calculated twice * **satellite data fitted and plotted - what is missing now?** - * use ast.literal\_eval() for .cfg files to read dict or list, e.g., for MulensData options. - * _high-level fitting example where we dont care how complicated it is, we just want to make it simple and useful for the user_ * some cfg files use "../data/..." - change it to MM.DATA\_PATH somehow * in emcee we should check if all the starting points are in prior * check if MM correctly interacts with scipy.optimize.leastsq and maybe add an example diff --git a/examples/example_05_MB08310.py b/examples/example_05_MB08310.py index 6201e1b4f..73d17c514 100644 --- a/examples/example_05_MB08310.py +++ b/examples/example_05_MB08310.py @@ -63,17 +63,20 @@ datasets_custom = [] color_list = ['black', 'red', 'yellow', 'green', 'cyan', 'blue', 'purple'] for (color, file_) in zip(color_list, sorted(files)): + label = os.path.basename(file_).split('_', maxsplit=2)[0] + if label == 'CTIO': + label += ' ' + os.path.basename(file_).split('_', maxsplit=2)[1] + data = mm.MulensData( file_name=file_, comments=["\\", "|"], plot_properties={ 'color': color, - 'label': os.path.basename(file_).split('_', maxsplit=2)[0]}) + 'label': label}) + datasets_custom.append(data) event_custom = mm.Event(datasets=datasets_custom, model=plens_model) -plt.figure() -ax31 = plt.subplot(gs[0]) t_start = t_0 - 3. t_stop = t_0 + 1. n_star = 2. @@ -82,6 +85,9 @@ times = np.arange(t_start, t_star_start, 0.01) times = np.concatenate((times, np.arange(t_star_start, t_star_stop, 0.0001))) times = np.concatenate((times, np.arange(t_star_stop, t_stop, 0.01))) + +plt.figure() +ax31 = plt.subplot(gs[0]) event_custom.plot_model( times=times, color='black', subtract_2450000=True) event_custom.plot_data(marker='s', markersize=3, subtract_2450000=True) diff --git a/examples/example_16/ob03235_2_full.yaml b/examples/example_16/ob03235_2_full.yaml index 283140f09..b660b92e4 100644 --- a/examples/example_16/ob03235_2_full.yaml +++ b/examples/example_16/ob03235_2_full.yaml @@ -82,13 +82,14 @@ plots: # makes legend in 2 columns loc: lower center second Y scale: - # This adds second Y axis on the right-hand side. Only first line below is required. - magnifications: [2, 3, 4, 5, 6, 7, 8, 9] - # If you don't know what will be the range of magnifications on your plot, then make - # a test run with some very small and very large values and a warning will tell you - # what is exact range on the plot. - labels: [a, b, c, d, e, f, g, h] - # If you remove the line above, then magnification values will be printed. + # This adds second Y axis to the right side. Only magnifications key is required. + magnifications: optimal + # magnifications: [2, 3, 4, 5, 6, 7, 8, 9] + # If you want to provide magnification values but don't know what will be the range + # of magnifications on your plot, then make a test with very small and large numbers + # and a warning will tell you the exact range. + # labels: [a, b, c, d, e, f, g, h] + # The list of labels above can not be given if magnifications = "optimal" label: What is shown on this axis? color: magenta trajectory: diff --git a/examples/example_16/ulens_model_fit.py b/examples/example_16/ulens_model_fit.py index 5ea663177..614f29c2a 100644 --- a/examples/example_16/ulens_model_fit.py +++ b/examples/example_16/ulens_model_fit.py @@ -11,8 +11,8 @@ import numpy as np from scipy.interpolate import interp1d from matplotlib import pyplot as plt -from matplotlib import gridspec, rc, rcParams, rcParamsDefault -from matplotlib.backends.backend_pdf import PdfPages +from matplotlib import gridspec, rcParams, rcParamsDefault +# from matplotlib.backends.backend_pdf import PdfPages import_failed = set() try: @@ -38,7 +38,7 @@ except Exception: raise ImportError('\nYou have to install MulensModel first!\n') -__version__ = '0.33.0' +__version__ = '0.34.2' class UlensModelFit(object): @@ -334,6 +334,8 @@ def _check_MM_version(self): """ Check if MulensModel is new enough """ + # code_version = "{:} and {:}".format(mm.__version__, __version__) + # print('\nMulensModel and script versions:', code_version, end='\n\n') if int(mm.__version__.split('.')[0]) < 2: raise RuntimeError( "ulens_model_fit.py requires MulensModel in version " @@ -717,17 +719,27 @@ def _check_plots_parameters_best_model_Y_scale(self): 'Unknown settings for "second Y scale" in ' '"best model": {:}'.format(unknown)) if not isinstance(settings['magnifications'], list): - raise TypeError( - '"best model" -> "second Y scale" -> "magnifications" has to ' - 'be a list, not ' + str(type(settings['magnifications']))) - for value in settings['magnifications']: - if not isinstance(value, (int, float)): + if settings['magnifications'] != 'optimal': raise TypeError( - 'Wrong value in magnifications: ' + str(value)) + '"best model" -> "second Y scale" -> "magnifications" has ' + 'to be a list or "optimal", not ' + + str(type(settings['magnifications']))) + else: + for value in settings['magnifications']: + if not isinstance(value, (int, float)): + raise TypeError( + 'Wrong value in magnifications: ' + str(value)) if 'labels' not in settings: - settings['labels'] = [ - str(x) for x in settings['magnifications']] + if settings['magnifications'] != 'optimal': + settings['labels'] = [ + str(x) for x in settings['magnifications']] + else: + settings['labels'] = [] else: + if settings['magnifications'] == 'optimal': + raise ValueError( + 'In "best model" -> "second Y scale", labels can not be ' + 'provided if "magnifications" is defined as "optimal"') if not isinstance(settings['labels'], list): raise TypeError( '"best model" -> "second Y scale" -> "labels" has to be ' @@ -1113,11 +1125,11 @@ def _parse_fitting_parameters_EMCEE(self): 'got: ' + name) if path.exists(name): if path.isfile(name): - msg = "Exisiting file " + name + " will be overwritten" + msg = "Existing file " + name + " will be overwritten" warnings.warn(msg) else: raise ValueError("The path provided for posterior (" + - name + ") exsists and is a directory") + name + ") exists and is a directory") self._posterior_file_name = name[:-4] self._posterior_file_fluxes = None @@ -1284,7 +1296,7 @@ def _check_output_files_MultiNest(self): existing.append(file_name) if len(existing) > 0: - message = "\n\n Exisiting files will be overwritten " + message = "\n\n Existing files will be overwritten " message += "(unless you kill this process)!!!\n" warnings.warn(message + str(existing) + "\n") @@ -2309,6 +2321,11 @@ def _parse_results_EMCEE(self): This version works with EMCEE version 2.X and 3.0. """ + if self._yaml_results: + lst = [mm.__version__, __version__] + code_version = "MulensModel and script versions: {:}".format(lst) + print(code_version, **self._yaml_kwargs) + accept_rate = np.mean(self._sampler.acceptance_fraction) out = "Mean acceptance fraction: {0:.3f}".format(accept_rate) print(out) @@ -2323,6 +2340,11 @@ def _parse_results_EMCEE(self): print(out, **self._yaml_kwargs) self._extract_posterior_samples_EMCEE() + if self._yaml_results and isinstance(self._fixed_parameters, dict): + print("Fixed parameters:", **self._yaml_kwargs) + for (key, value) in self._fixed_parameters.items(): + print(" {:} : {:}".format(key, value), **self._yaml_kwargs) + print("Fitted parameters:") self._print_results(self._samples_flat) if self._yaml_results: @@ -2343,6 +2365,10 @@ def _parse_results_EMCEE(self): if self._yaml_results: self._print_yaml_best_model() + if self._shift_t_0 and self._yaml_results: + print("Plots shift_t_0 : {:}".format(self._shift_t_0_val), + **self._yaml_kwargs) + def _extract_posterior_samples_EMCEE(self): """ set self._samples_flat and self._samples for EMCEE @@ -2486,20 +2512,20 @@ def _shift_t_0_in_samples(self): if name in self._fit_parameters: index = self._fit_parameters.index(name) values = self._samples_flat[:, index] - mean = np.mean(values) + self._shift_t_0_val = int(np.mean(values)) try: - self._samples_flat[:, index] -= int(mean) + self._samples_flat[:, index] -= self._shift_t_0_val if 'trace' in self._plots: - self._samples[:, :, index] -= int(mean) + self._samples[:, :, index] -= self._shift_t_0_val except TypeError: fmt = ("Warning: extremely wide range of posterior {:}: " "from {:} to {:}") warnings.warn( fmt.format(name, np.min(values), np.max(values))) - self._samples_flat[:, index] = values - int(mean) + self._samples_flat[:, index] = values - self._shift_t_0_val if 'trace' in self._plots: self._samples[:, :, index] = ( - self._samples[:, :, index] - int(mean)) + self._samples[:, :, index] - self._shift_t_0_val) def _get_fluxes_to_print_EMCEE(self): """ @@ -2823,6 +2849,9 @@ def _save_figure(self, file_name, figure=None, dpi=None): kwargs = dict() if dpi is not None: kwargs = {'dpi': dpi} + if path.isfile(file_name): + msg = "Existing file " + file_name + " will be overwritten" + warnings.warn(msg) caller.savefig(file_name, **kwargs) plt.close() @@ -3071,18 +3100,71 @@ def _mark_second_Y_axis_in_best_plot(self): magnifications = settings['magnifications'] color = settings.get("color", "red") label = settings.get("label", "magnification") - labels = settings['labels'] + labels = settings.get("labels") ylim = plt.ylim() + ax2 = plt.gca().twinx() + (A_min, A_max, sb_fluxes) = self._second_Y_axis_get_fluxes(ylim) + out1, out2 = False, False + if magnifications == "optimal": + (magnifications, labels, out1) = self._second_Y_axis_optimal( + ax2, A_min, A_max) + flux = sb_fluxes[0] * magnifications + sb_fluxes[1] + out2 = self._second_Y_axis_warnings(flux, labels, magnifications, + A_min, A_max) + if out1 or out2: + ax2.get_yaxis().set_visible(False) + return + + ticks = mm.Utils.get_mag_from_flux(flux) + ax2.set_ylabel(label).set_color(color) + ax2.spines['right'].set_color(color) + ax2.set_ylim(ylim[0], ylim[1]) + ax2.tick_params(axis='y', colors=color) + plt.yticks(ticks, labels, color=color) + + def _second_Y_axis_get_fluxes(self, ylim): + """ + Get fluxes and limiting magnification values for the second Y axis + """ flux_min = mm.Utils.get_flux_from_mag(ylim[0]) flux_max = mm.Utils.get_flux_from_mag(ylim[1]) - (source_flux, blend_flux) = self._event.get_ref_fluxes() - if self._model.n_sources == 1: - total_source_flux = source_flux - else: - total_source_flux = sum(source_flux) - flux = total_source_flux * magnifications + blend_flux + + total_source_flux = sum(source_flux) + A_min = (flux_min - blend_flux) / total_source_flux + A_max = (flux_max - blend_flux) / total_source_flux + + return (A_min, A_max, [total_source_flux, blend_flux]) + + def _second_Y_axis_optimal(self, ax2, A_min, A_max): + """ + Get optimal values of magnifications and labels + """ + ax2.set_ylim(A_min, A_max) + A_values = ax2.yaxis.get_ticklocs().round(7) + A_values = A_values[(A_values >= max(1, A_min)) & (A_values < A_max)] + is_integer = [mag.is_integer() for mag in A_values] + if all(is_integer): + labels = [f"{int(x):d}" for x in A_values] + return (A_values, labels, False) + + fnum = np.array([str(x)[::-1].find(".") for x in A_values]) + labels = np.array([f"%0.{max(fnum)}f" % x for x in A_values]) + if max(fnum) >= 4 and len(fnum[fnum < 4]) < 3: + msg = ("The computed magnifications for the second Y scale cover" + " a range too small to be shown: {:}") + warnings.warn(msg.format(A_values)) + return (A_values, labels.tolist(), True) + if max(fnum) >= 4: + labels = np.array([f"{x:0.3f}" for x in A_values]) + + return (A_values[fnum < 4], labels[fnum < 4].tolist(), False) + + def _second_Y_axis_warnings(self, flux, labels, A_values, A_min, A_max): + """ + Issue warnings for negative flux or bad range of magnificaitons + """ if np.any(flux < 0.): mask = (flux > 0.) flux = flux[mask] @@ -3091,28 +3173,18 @@ def _mark_second_Y_axis_in_best_plot(self): "because they correspond to negative flux which cannot " "be translated to magnitudes.") warnings.warn(msg.format(np.sum(np.logical_not(mask)))) - A_min = (flux_min - blend_flux) / total_source_flux - A_max = (flux_max - blend_flux) / total_source_flux - if (np.min(magnifications) < A_min or np.max(magnifications) > A_max or + if (np.min(A_values) < A_min or np.max(A_values) > A_max or np.any(flux < 0.)): msg = ("Provided magnifications for the second (i.e., right-hand " "side) Y-axis scale are from {:} to {:},\nbut the range " "of plotted magnifications is from {:} to {:}, hence, " "the second scale is not plotted") - args = [min(magnifications), max(magnifications), - A_min[0], A_max[0]] + args = [np.min(A_values), np.max(A_values), A_min, A_max] warnings.warn(msg.format(*args)) - return - - ticks = mm.Utils.get_mag_from_flux(flux) + return True - ax2 = plt.gca().twinx() - ax2.set_ylabel(label).set_color(color) - ax2.spines['right'].set_color(color) - ax2.set_ylim(ylim[0], ylim[1]) - ax2.tick_params(axis='y', colors=color) - plt.yticks(ticks, labels, color=color) + return False def _make_trajectory_plot(self): """ diff --git a/examples/example_19_binary_source_binary_lens.py b/examples/example_19_binary_source_binary_lens.py index b03da80b7..91d1b458f 100644 --- a/examples/example_19_binary_source_binary_lens.py +++ b/examples/example_19_binary_source_binary_lens.py @@ -33,6 +33,7 @@ model_2.set_magnification_methods([t_start, 'VBBL', t_stop]) # Make magnification plots: +plt.figure() plot_kwargs = {'t_start': t_start, 't_stop': t_stop} model.plot_magnification(source_flux_ratio=1., label='flux ratio = 1', @@ -46,16 +47,15 @@ plt.title('Binary-source binary-lens light curves') plt.legend() -plt.show() # Make trajectory plots: +plt.figure() model.plot_trajectory(caustics=True, label='both_sources', **plot_kwargs) model_2.plot_trajectory(label='source 2', ls='--', lw=4, **plot_kwargs) model_1.plot_trajectory(label='source 1', ls='--', lw=4, **plot_kwargs) plt.title('Caustic and trajectories of both sources') plt.legend() -plt.show() # Combine it with a dataset (that doesn't show any caustic crossing), # calculate chi^2, and make a plot of data and model: @@ -64,6 +64,7 @@ data = mm.MulensData(file_name=file_name) event = mm.Event(datasets=data, model=model) print("chi2 = ", event.get_chi2()) +plt.figure() event.plot_data() event.plot_model(c='red', **plot_kwargs) plt.xlim(t_start, t_stop) diff --git a/examples/use_cases/use_case_40_get_lc.py b/examples/use_cases/use_case_40_get_lc.py index 919927b77..d1fbe345c 100644 --- a/examples/use_cases/use_case_40_get_lc.py +++ b/examples/use_cases/use_case_40_get_lc.py @@ -1,5 +1,5 @@ """ -Use case showing API for Event.get_lc() and Event.plot_lc() +Use case showing API for Event.get_scaled_lc() and Event.plot_lc() """ import matplotlib.pyplot as plt import os @@ -8,8 +8,8 @@ raise NotImplementedError( - "Event.get_lc(), Event.plot_lc() and satellite_skycoord keyword in " - "Model.get_lc()/plot_lc() are not implemented yet") + "Event.get_scaled_lc(), Event.plot_lc() and satellite_skycoord keyword in " + "Model.get_scaled_lc()/plot_lc() are not implemented yet") # Import data dir_ = os.path.join(mm.DATA_PATH, "photometry_files", "OB140939") @@ -26,29 +26,29 @@ 'pi_E_N': -0.248, 'pi_E_E': 0.234}) my_event = mm.Event([data_1, data_2], my_model, coords="17:50:00 -29:00:05") -# All get_lc() and plot_lc() calls return data scaled to the first dataset, +# All get_scaled_lc() and plot_lc() calls return data scaled to the first dataset, # unless 'dataset' keyword is used. # Print model light curve: print("Magnitudes:") -print(my_event.get_lc()) +print(my_event.get_scaled_lc()) print("Fluxes from 2456820 to 2456850:") -print(my_event.get_lc(t_range=[2456820., 2456850.], n_epochs=20, +print(my_event.get_scaled_lc(t_range=[2456820., 2456850.], n_epochs=20, phot_fmt="flux")) # The two code lines below require discussion: # what is default value of phot_fmt? -# RP: I think it should "scaled" to be consistent with my_event.get_lc(), +# RP: I think it should "scaled" to be consistent with my_event.get_scaled_lc(), # but on the other hand phot_fmt="flux" could mean fluxes in the scale of # that dataset, or the reference dataset and I see logic behind both of them. # Maybe we should add "scaled_flux" and "scaled_mag" (also include both of them # in FitData.get_residuals() to be consistent; ohh... we should also deprecate # "scaled" in that case). -# Event.get_lc(dataset=1, phot_fmt="scaled") --> returns model magnitudes for +# Event.get_scaled_lc(dataset=1, phot_fmt="scaled") --> returns model magnitudes for # dataset 1 scaled to ref_data. -# Event.get_lc(dataset=data1, phot_fmt="mag") --> returns model magnitudes for +# Event.get_scaled_lc(dataset=data1, phot_fmt="mag") --> returns model magnitudes for # dataset 1 scaled to that # dataset's fs, fb. # The above also take into account bandpass and satellite_skycoord. diff --git a/examples/use_cases/use_case_41_bad_data.py b/examples/use_cases/use_case_41_bad_data.py new file mode 100644 index 000000000..1c9b262ac --- /dev/null +++ b/examples/use_cases/use_case_41_bad_data.py @@ -0,0 +1,25 @@ +""" +Use case for changing the bad data array. +""" +import matplotlib.pyplot as plt +import numpy as np + +import MulensModel as mm + + +raise NotImplementedError( + "We don't know how to enable this functionality.") + +data = mm.MulensData(file_name="my_data.dat") +data.plot(show_bad=True) + +data.bad[12] = True +data.plot(show_bad=True) + +data.bad[np.where(data.mag < 13.)] = True +data.plot(show_bad=True) + +data.good[data.mag < 12.] = True +data.plot(show_bad=True) + +plt.show() diff --git a/source/MulensModel/magnificationcurve.py b/source/MulensModel/magnificationcurve.py index 4b39748c7..8804b7b0d 100644 --- a/source/MulensModel/magnificationcurve.py +++ b/source/MulensModel/magnificationcurve.py @@ -1,14 +1,9 @@ import math import warnings - +from os.path import join import numpy as np -from MulensModel.binarylens import BinaryLens -from MulensModel.binarylenswithshear import BinaryLensWithShear -from MulensModel.modelparameters import ModelParameters -from MulensModel.pointlens import PointLens, get_pspl_magnification -from MulensModel.pointlenswithshear import PointLensWithShear -from MulensModel.trajectory import Trajectory +import MulensModel as mm class MagnificationCurve(object): @@ -54,7 +49,7 @@ def __init__(self, times, parameters, parallax=None, self.times = np.atleast_1d(times) # Check for ModelParameters and set. - if isinstance(parameters, ModelParameters): + if isinstance(parameters, mm.ModelParameters): self.parameters = parameters else: raise TypeError( @@ -62,7 +57,7 @@ def __init__(self, times, parameters, parallax=None, 'ModelParameters object') # Calculate the source trajectory (i.e. u(t)) - self.trajectory = Trajectory( + self.trajectory = mm.Trajectory( self.times, parameters=parameters, parallax=parallax, coords=coords, satellite_skycoord=satellite_skycoord) @@ -156,9 +151,6 @@ def get_magnification(self): Vector of magnifications. """ - if self.parameters.rho is not None: - self._check_for_finite_source_method() - if self.parameters.n_lenses == 1: magnification = self.get_point_lens_magnification() elif self.parameters.n_lenses == 2: @@ -166,6 +158,7 @@ def get_magnification(self): else: raise NotImplementedError( "magnification for more than 2 lenses not handled yet") + self._magnification = magnification return self._magnification @@ -177,7 +170,14 @@ def _check_for_finite_source_method(self): methods = self._methods_names + [self._default_method] set_ = set(['point_source', 'point_source_point_lens', None]) if len(set(methods)-set_) == 0: - warnings.warn('no finite-source method is set', UserWarning) + path = join( + mm.MODULE_PATH, "documents", "magnification_methods.pdf") + msg = ("A finite source parameter (rho or t_star) is set and no " + "finite-source method is set.\n" + "For possible magnification methods see\n" + path + "or\n" + "https://github.com/rpoleski/MulensModel/blob/master/" + "documents/magnification_methods.pdf") + warnings.warn(msg, UserWarning) return def get_point_lens_magnification(self): @@ -249,6 +249,9 @@ def get_point_lens_magnification(self): Vector of magnifications. """ + if self.parameters.is_finite_source(): + self._check_for_finite_source_method() + if self.parameters.n_lenses != 1: raise ValueError( "You're trying to calculate single lens magnification, but " @@ -256,12 +259,12 @@ def get_point_lens_magnification(self): " lenses") if self.parameters.is_external_mass_sheet: - point_lens = PointLensWithShear(self.parameters) + point_lens = mm.PointLensWithShear(self.parameters) magnification = point_lens.get_point_source_magnification( self.trajectory) else: - point_lens = PointLens(self.parameters) - magnification = get_pspl_magnification(self.trajectory) + point_lens = mm.PointLens(self.parameters) + magnification = mm.get_pspl_magnification(self.trajectory) methods = self._methods_for_epochs() if len(set(methods)-set([None, 'point_source'])) == 0: @@ -382,6 +385,9 @@ def get_binary_lens_magnification(self): Vector of magnifications. """ + if self.parameters.is_finite_source(): + self._check_for_finite_source_method() + if self.parameters.n_lenses != 2: raise ValueError( "You're trying to calculate binary lens magnification, but " @@ -389,10 +395,10 @@ def get_binary_lens_magnification(self): " lenses") if not self.parameters.is_external_mass_sheet: - binary_lens_class = BinaryLens + binary_lens_class = mm.BinaryLens kwargs = dict() else: - binary_lens_class = BinaryLensWithShear + binary_lens_class = mm.BinaryLensWithShear K = self.parameters.parameters.get('convergence_K', 0) G = self.parameters.parameters.get('shear_G', complex(0, 0)) kwargs = {'convergence_K': K, 'shear_G': G} @@ -419,6 +425,9 @@ def _get_binary_lens_magnification(self, binary_lens_class, magnification = [] for index in range(len(self.times)): + if methods[index] is None: + raise ValueError("method for calculating binary lens " + "magnification is not specified properly") x = self.trajectory.x[index] y = self.trajectory.y[index] method = methods[index].lower() @@ -457,20 +466,20 @@ def _get_binary_lens_magnification(self, binary_lens_class, m = binary_lens.hexadecapole_magnification( x, y, rho=self.parameters.rho, gamma=self._gamma) elif method == 'vbbl': - if isinstance(binary_lens, BinaryLensWithShear): + if isinstance(binary_lens, mm.BinaryLensWithShear): raise ValueError("Finite source VBBL is not available " "for BinaryLensWithShear") m = binary_lens.vbbl_magnification( x, y, rho=self.parameters.rho, gamma=self._gamma, **kwargs) elif method == 'adaptive_contouring': - if isinstance(binary_lens, BinaryLensWithShear): + if isinstance(binary_lens, mm.BinaryLensWithShear): raise ValueError("Adaptive contouring is not available " "for BinaryLensWithShear") m = binary_lens.adaptive_contouring_magnification( x, y, rho=self.parameters.rho, gamma=self._gamma, **kwargs) elif method == 'point_source_point_lens': u = math.sqrt(x**2 + y**2) - m = get_pspl_magnification(u) + m = mm.get_pspl_magnification(u) else: msg = 'Unknown method specified for binary lens: {:}' raise ValueError(msg.format(method)) diff --git a/source/MulensModel/modelparameters.py b/source/MulensModel/modelparameters.py index 651e8da61..8c2f35530 100644 --- a/source/MulensModel/modelparameters.py +++ b/source/MulensModel/modelparameters.py @@ -975,7 +975,7 @@ def t_E(self): return self.t_star / self.rho elif ('t_eff' in self.parameters.keys() and 'u_0' in self.parameters.keys()): - return self.t_eff / self.u_0 + return self.t_eff / abs(self.u_0) else: raise KeyError("You're trying to access t_E that was not set") diff --git a/source/MulensModel/tests/test_ModelParameters.py b/source/MulensModel/tests/test_ModelParameters.py index 739dcdc5c..8d9e97333 100644 --- a/source/MulensModel/tests/test_ModelParameters.py +++ b/source/MulensModel/tests/test_ModelParameters.py @@ -135,6 +135,19 @@ def test_repr_t_0_kep(): assert (out_1 + out_2) == str(params) +def test_positive_t_E(): + """ + Check if t_E is positive when t_eff is given, even if u_0 is negative. + """ + t_0 = 10205.1 + u_0 = -0.50 + t_eff = 12.5 + params = mm.ModelParameters({'t_0': t_0, 'u_0': u_0, 't_eff': t_eff}) + + assert params.t_E >= 0. + assert params.t_E == params.t_eff / abs(params.u_0) + + def test_rho_t_e_t_star(): """check if conversions between rho, t_E, and t_star work ok""" t_0 = 2450000. diff --git a/source/MulensModel/utils.py b/source/MulensModel/utils.py index a9ccf7955..7e78f8876 100644 --- a/source/MulensModel/utils.py +++ b/source/MulensModel/utils.py @@ -149,6 +149,7 @@ def get_mag_and_err_from_flux(flux, err_flux, zeropoint=None): UserWarning) mag = zeropoint - 2.5 * np.log10(flux) err_mag = (err_flux / flux) * 2.5 / np.log(10.) + return (mag, err_mag) get_mag_and_err_from_flux = staticmethod(get_mag_and_err_from_flux) @@ -365,16 +366,28 @@ def get_y_value_y_err(phot_fmt, flux, flux_err): Values in the requested format uncertainties: *np.ndarray* - Uncertainties in the requested format + Uncertainties in the requested format. Any negative + uncertainties are set to zero. + """ if phot_fmt == 'mag': - return Utils.get_mag_and_err_from_flux(flux, flux_err) + (y_value, y_err) = Utils.get_mag_and_err_from_flux(flux, flux_err) elif phot_fmt == 'flux': - return (flux, flux_err) + (y_value, y_err) = (flux, flux_err) else: raise ValueError( 'Unrecognized photometry format: {:}, '.format(phot_fmt) + 'allowed values are "mag" and "flux"') + + index = (y_err < 0) + if np.sum(index) > 0: + if not isinstance(y_err, np.ndarray): + y_err = np.array(y_err) + + y_err[index] = 0 + + return (y_value, y_err) + get_y_value_y_err = staticmethod(get_y_value_y_err) def find_subtract(subtract_2450000=False, subtract_2460000=False):