TeamCOMPAS / COMPAS

COMPAS rapid binary population synthesis code
http://compas.science
MIT License
65 stars 66 forks source link

Crash of plot_detailed_evolution.py #823

Closed ilyamandel closed 2 years ago

ilyamandel commented 2 years ago

$ python3 plot_detailed_evolution.py Time (Myr), Event, M1 (M_o), type1, M2 (M_o), type2, a (Ro), e 0.000000 Zero-age main-sequence, metallicity Z=0.0142 1.826 1 0.589 0 22621.335 0.000 1426.419090 Star 1: MS\geq0.7M{\odot}->HG 1.826 2 0.589 0 22621.335 0.000 1438.177260 Star 1: HG->FGB 1.826 3 0.589 0 22622.458 0.000 1480.844622 Star 1: FGB->CHeB 1.814 4 0.589 0 22732.670 0.000 1480.844622 Star 1: CHeB->EAGB 1.814 5 0.589 0 22734.566 0.000 1484.762834 Star 1: EAGB->TPAGB 1.786 6 0.589 0 23001.884 0.000 1486.590683 Star 1: TPAGB->COWD 0.639 11 0.589 0 44641.887 0.000 14087.590683 Evolution ended by run duration: COWD+MS<0.7M_{\odot} 0.639 11 0.589 0 44641.887 0.000 Traceback (most recent call last): File "/Users/ilyam/Work/COMPAS/COMPAS/utils/plot_detailed_evolution.py", line 672, in main() File "/Users/ilyam/Work/COMPAS/COMPAS/utils/plot_detailed_evolution.py", line 38, in main makeDetailedPlots(Data, events) File "/Users/ilyam/Work/COMPAS/COMPAS/utils/plot_detailed_evolution.py", line 103, in makeDetailedPlots spaced_out_event_times = space_out(event_times, min_separation=ax.get_xlim()[1]/75) # min_separation of xmax/50 was found to fit the letter sizes well File "/Users/ilyam/Work/COMPAS/COMPAS/utils/plot_detailed_evolution.py", line 358, in space_out while(np.min(np.diff(vals))) < min_separation: File "<__array_function__ internals>", line 5, in amin File "/usr/local/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 2858, in amin return _wrapreduction(a, np.minimum, 'min', axis, None, out, File "/usr/local/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 87, in _wrapreduction return ufunc.reduce(obj, axis, dtype, out, **passkwargs) ValueError: zero-size array to reduction operation minimum which has no identity

Also, previously, the vdH diagram plotting script currently crashes for me with Traceback (most recent call last): File "/Users/ilyam/Work/COMPAS/COMPAS/utils/plot_detailed_evolution.py", line 673, in main() File "/Users/ilyam/Work/COMPAS/COMPAS/utils/plot_detailed_evolution.py", line 39, in main plotVanDenHeuvel(events=events) File "/Users/ilyam/Work/COMPAS/COMPAS/utils/plot_detailed_evolution.py", line 308, in plotVanDenHeuvel pltString = pltString.format(events[ii].time,events[ii].aprev, events[ii].a,events[ii].m1prev,events[ii].m1,events[ii].m2prev,events[ii].m2) KeyError: '\odot'Traceback (most recent call last): File "/Users/ilyam/Work/COMPAS/COMPAS/utils/plot_detailed_evolution.py", line 673, in main() File "/Users/ilyam/Work/COMPAS/COMPAS/utils/plot_detailed_evolution.py", line 39, in main plotVanDenHeuvel(events=events) File "/Users/ilyam/Work/COMPAS/COMPAS/utils/plot_detailed_evolution.py", line 308, in plotVanDenHeuvel pltString = pltString.format(events[ii].time,events[ii].aprev, events[ii].a,events[ii].m1prev,events[ii].m1,events[ii].m2prev,events[ii].m2) KeyError: '\odot'

reinhold-willcox commented 2 years ago

Hi @ilyamandel ,

Thanks for spotting these. The first is a bug when there are no "events", meaning entries in the BSE_RLOF or BSE_Supernovae. The second is due to the names of the Hurley types when we have both a MS < 0.7 and MS > 0.7 star. When there is only one, the names reduce to just "MS" for simplicity, so we haven't seen this error before because we're usually in the high mass regime. I'll add the fixes in a PR.