dynamics-of-stellar-systems / dynamite

dynamics, age and metallicity indicators tracing evolution
MIT License
10 stars 1 forks source link

Fix for kinmapchi2 bug #343

Closed maindlt closed 7 months ago

maindlt commented 8 months ago

Fix for kinmapchi2 bug:

Now the kinmapchi2 values are in very good agreement between the different weight solvers, see test data below.

Open question: in calculating kinmapchi2, we so far have ignored the GH kinematics systematic errors. Perhaps it would be more consistent with the weight solving to include those (kinematics_data = kin_data.get_data(self.settings, apply_systematic_error=True) in WeightSolver.chi2_kinmap(...), lines 121-122)?

Closes #336

Test results:

FCC047 test runs, LegacyWeightSolver

number_GH=3:
       m-bh         a-bh c-dh   f-dh  q-stars p-stars u-stars  ml        chi2            kinchi2           kinmapchi2
------------------ ----- ---- ------- ------- ------- ------- --- ----------------- ------------------ -----------------------
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 5.5 416425.2884538298 60359.941437665395 115153.38302447945
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 4.5 418670.8642388978  59810.58616600247  88574.86547229892
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 6.5 421946.4129168541  66917.66017005831 165940.24584393486

number_GH=4:
       m-bh         a-bh c-dh   f-dh  q-stars p-stars u-stars  ml        chi2             kinchi2          kinmapchi2
------------------ ----- ---- ------- ------- ------- ------- --- ------------------ ----------------- ------------------
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 5.5 424493.15420013765 65666.78023535715 113735.67888008912
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 4.5  429197.1525016983 67539.82992857283  87613.20983329182
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 6.5  429339.9158990041 71949.22739494297 164348.79223217713

number_GH=5:
       m-bh         a-bh c-dh   f-dh  q-stars p-stars u-stars  ml        chi2             kinchi2          kinmapchi2
------------------ ----- ---- ------- ------- ------- ------- --- ------------------ ----------------- ------------------
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 5.5  424501.6272540993 65672.14007516083 113730.16386600249
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 4.5 429210.03923869145 67547.53606716642  87602.64374101332
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 6.5 429346.53733657196 71953.90520141821 164345.39048523517

FCC047 test runs, Python NNLS

number_GH=3:
       m-bh         a-bh c-dh   f-dh  q-stars p-stars u-stars  ml        chi2             kinchi2          kinmapchi2
------------------ ----- ---- ------- ------- ------- ------- --- ------------------ ----------------- ------------------
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 5.5  416425.2884538317 60359.94143765696 115153.38311356283
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 4.5 418670.86423890106 59810.58616606319  88574.86509793051
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 6.5 421946.41291685525  66917.6601700391 165940.24559728603

number_GH=4:
       m-bh         a-bh c-dh   f-dh  q-stars p-stars u-stars  ml        chi2             kinchi2          kinmapchi2
------------------ ----- ---- ------- ------- ------- ------- --- ------------------ ----------------- ------------------
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 5.5 424493.15420013946 65666.78023530384 113735.67911982398
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 4.5  429197.1525017018 67539.82992860806  87613.20968621966
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 6.5 429339.91589900514 71949.22739492588 164348.79271744133

number_GH=5:
       m-bh         a-bh c-dh   f-dh  q-stars p-stars u-stars  ml        chi2             kinchi2          kinmapchi2
------------------ ----- ---- ------- ------- ------- ------- --- ------------------ ----------------- ------------------
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 5.5  424501.6272541011 65672.14007511585 113730.16423063162
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 4.5 429210.03923869494 67547.53606718627  87602.64352996505
3162277.6601683795 0.001 10.0 1.25893     0.2     0.7  0.9999 6.5   429346.537336573 71953.90520141224 164345.39016516917
prashjet commented 7 months ago

All looks sensible, thanks Thomas. Tested with ./test_notebooks.sh and all passed - happy to merge :)