diff options
author | Volker Hoffmann <volker@cheleb.net> | 2016-10-04 11:01:40 +0200 |
---|---|---|
committer | Volker Hoffmann <volker@cheleb.net> | 2016-10-04 11:01:40 +0200 |
commit | d3e93c31184d3b8431649d3444051f5859c597a1 (patch) | |
tree | 75956ec67a7d5830eed2c00374317978e83c327f | |
parent | a785f1776ca8145cfe85a3407d51dd898dc15d46 (diff) |
fix: gracefully skip missing outputs
-rw-r--r-- | Plots/Chaos/ae12.py | 243 |
1 files changed, 128 insertions, 115 deletions
diff --git a/Plots/Chaos/ae12.py b/Plots/Chaos/ae12.py index 7319dad..526d2c6 100644 --- a/Plots/Chaos/ae12.py +++ b/Plots/Chaos/ae12.py @@ -82,128 +82,141 @@ for nstep in nsteps: dfo = dfo_all[irun] dfr = dfr_all[irun] - # Pick Step - dfo = dfo[dfo.nstep == nstep] - dfr = dfr[dfr.nstep == nstep] - - # Extract Jupiter Semi-Major Axis - a_j = dfo[dfo.pid == 2000].a.iloc[0] - - # Extract Jupiter Crossing Orbits - Q_cross = a_j - e_cross = np.linspace(0,1,128) - a_cross = Q_cross / ( 1.0 + e_cross ) - - # Remove Giant Planets - dfo = dfo[dfo.mass < 5.0] - - # Scale Line - ms, ns = oh.mkline(5.0/2000.0, 2.0, 2.0, 36.0) - ss = np.asarray(dfo.mass * ms + ns) - - # ############################################# - # ############################################# - # PLANETESIMALS - # ############################################# - # ############################################# - - # Planetesimals - ax.scatter(dfo.a, dfo.e, s=ss**2.0, \ - c='k', edgecolor='none', alpha=0.8, zorder=0) - - # ############################################# - # ############################################# - # RESONANCE LOCATIONS - # ############################################# - # ############################################# - - # Resonances (Secular) - ax.plot([dfr.nu_5.iloc[0], dfr.nu_5.iloc[0]], \ - [0, 1], \ - 'k', lw=0.5, label='nu_5', zorder=-10) - ax.plot([dfr.nu_6.iloc[0], dfr.nu_6.iloc[0]], \ - [0, 1], \ - 'k', lw=0.5, label='nu_6', zorder=-10) - if not np.isnan(dfr.nu_16_01.iloc[0]): - ax.plot([dfr.nu_16_01.iloc[0], dfr.nu_16_01.iloc[0]], \ + # Does Step Exist? + if nstep in dfo.nstep.unique(): + + # Pick Step + dfo = dfo[dfo.nstep == nstep] + dfr = dfr[dfr.nstep == nstep] + + # Extract Jupiter Semi-Major Axis + a_j = dfo[dfo.pid == 2000].a.iloc[0] + + # Extract Jupiter Crossing Orbits + Q_cross = a_j + e_cross = np.linspace(0,1,128) + a_cross = Q_cross / ( 1.0 + e_cross ) + + # Remove Giant Planets + dfo = dfo[dfo.mass < 5.0] + + # Scale Line + ms, ns = oh.mkline(5.0/2000.0, 2.0, 2.0, 36.0) + ss = np.asarray(dfo.mass * ms + ns) + + # ############################################# + # ############################################# + # PLANETESIMALS + # ############################################# + # ############################################# + + # Planetesimals + ax.scatter(dfo.a, dfo.e, s=ss**2.0, \ + c='k', edgecolor='none', alpha=0.8, zorder=0) + + # ############################################# + # ############################################# + # RESONANCE LOCATIONS + # ############################################# + # ############################################# + + # Resonances (Secular) + ax.plot([dfr.nu_5.iloc[0], dfr.nu_5.iloc[0]], \ [0, 1], \ - 'k', lw=0.5, label='nu_16', zorder=-10) - if not np.isnan(dfr.nu_16_02.iloc[0]): - ax.plot([dfr.nu_16_02.iloc[0], dfr.nu_16_02.iloc[0]], \ + 'k', lw=0.5, label='nu_5', zorder=-10) + ax.plot([dfr.nu_6.iloc[0], dfr.nu_6.iloc[0]], \ [0, 1], \ - 'k', lw=0.5, label='nu_16', zorder=-10) - - # Resonances (MMR) - ax.plot([dfr.two_to_one.iloc[0], dfr.two_to_one.iloc[0]], \ - [0, 1], \ - color=(0.6,0.6,0.6), lw=0.5, label='2:1', zorder=-10) - ax.plot([dfr.three_to_one.iloc[0], dfr.three_to_one.iloc[0]], \ - [0, 1], \ - color=(0.6,0.6,0.6), lw=0.5, label='3:1', zorder=-10) - ax.plot([dfr.three_to_two.iloc[0], dfr.three_to_two.iloc[0]], \ - [0, 1], \ - color=(0.6,0.6,0.6), lw=0.5, label='3:2', zorder=-10) - - # ############################################# - # ############################################# - # ANNOTATIONS - # ############################################# - # ############################################# - - # Annotate (Secular) - ax.text(dfr.nu_5.iloc[0], 0.55, \ - r'$\nu_5$', transform=ax.transData, \ - va='center', ha='center', \ - bbox=dict(facecolor='w', lw=0.5), fontsize='small') - - ax.text(dfr.nu_6.iloc[0], 0.55, \ - r'$\nu_6$', transform=ax.transData, \ - va='center', ha='center', \ - bbox=dict(facecolor='w', lw=0.5), fontsize='small') - - if not np.isnan(dfr.nu_16_01.iloc[0]): - ax.text(dfr.nu_16_01.iloc[0], 0.55, \ - r'$\nu_{16}$', transform=ax.transData, \ + 'k', lw=0.5, label='nu_6', zorder=-10) + if not np.isnan(dfr.nu_16_01.iloc[0]): + ax.plot([dfr.nu_16_01.iloc[0], dfr.nu_16_01.iloc[0]], \ + [0, 1], \ + 'k', lw=0.5, label='nu_16', zorder=-10) + if not np.isnan(dfr.nu_16_02.iloc[0]): + ax.plot([dfr.nu_16_02.iloc[0], dfr.nu_16_02.iloc[0]], \ + [0, 1], \ + 'k', lw=0.5, label='nu_16', zorder=-10) + + # Resonances (MMR) + ax.plot([dfr.two_to_one.iloc[0], dfr.two_to_one.iloc[0]], \ + [0, 1], \ + color=(0.6,0.6,0.6), lw=0.5, \ + label='2:1', zorder=-10) + ax.plot([dfr.three_to_one.iloc[0], \ + dfr.three_to_one.iloc[0]], \ + [0, 1], \ + color=(0.6,0.6,0.6), lw=0.5, \ + label='3:1', zorder=-10) + ax.plot([dfr.three_to_two.iloc[0], \ + dfr.three_to_two.iloc[0]], \ + [0, 1], \ + color=(0.6,0.6,0.6), lw=0.5, \ + label='3:2', zorder=-10) + + # ############################################# + # ############################################# + # ANNOTATIONS + # ############################################# + # ############################################# + + # Annotate (Secular) + ax.text(dfr.nu_5.iloc[0], 0.55, \ + r'$\nu_5$', transform=ax.transData, \ va='center', ha='center', \ bbox=dict(facecolor='w', lw=0.5), fontsize='small') - if not np.isnan(dfr.nu_16_02.iloc[0]): - ax.text(dfr.nu_16_02.iloc[0], 0.55, \ - r'$\nu_{16}$', transform=ax.transData, \ + + ax.text(dfr.nu_6.iloc[0], 0.55, \ + r'$\nu_6$', transform=ax.transData, \ va='center', ha='center', \ bbox=dict(facecolor='w', lw=0.5), fontsize='small') - # Annotate (MMR) - ax.text(dfr.two_to_one.iloc[0], 0.475, \ - r'$2:1$', transform=ax.transData, \ - va='center', ha='center', \ - bbox=dict(facecolor='w', lw=0.5), fontsize='x-small') - - ax.text(dfr.three_to_one.iloc[0], 0.475, \ - r'$3:1$', transform=ax.transData, \ - va='center', ha='center', \ - bbox=dict(facecolor='w', lw=0.5), fontsize='x-small') - - ax.text(dfr.three_to_two.iloc[0], 0.475, \ - r'$3:2$', transform=ax.transData, \ - va='center', ha='center', \ - bbox=dict(facecolor='w', lw=0.5), fontsize='x-small') - - # ############################################# - # ############################################# - # CUTOFF, JUPITER CROSSING - # ############################################# - # ############################################# - - # Jupiter Crossing - # ax.plot(a_cross, e_cross, 'k--') - ax.fill_between(a_cross, e_cross, 0.6, \ - lw=0, facecolor='r', \ - alpha=0.1, zorder=-20) - - # Inner Cutoff - ax.fill_between([0.0, 0.1], 0.0, 0.6, \ - lw=0, facecolor='r', \ - alpha=0.1, zorder=20) + if not np.isnan(dfr.nu_16_01.iloc[0]): + ax.text(dfr.nu_16_01.iloc[0], 0.55, \ + r'$\nu_{16}$', transform=ax.transData, \ + va='center', ha='center', \ + bbox=dict(facecolor='w', lw=0.5), \ + fontsize='small') + if not np.isnan(dfr.nu_16_02.iloc[0]): + ax.text(dfr.nu_16_02.iloc[0], 0.55, \ + r'$\nu_{16}$', transform=ax.transData, \ + va='center', ha='center', \ + bbox=dict(facecolor='w', lw=0.5), \ + fontsize='small') + + # Annotate (MMR) + ax.text(dfr.two_to_one.iloc[0], 0.475, \ + r'$2:1$', transform=ax.transData, \ + va='center', ha='center', \ + bbox=dict(facecolor='w', lw=0.5), \ + fontsize='x-small') + + ax.text(dfr.three_to_one.iloc[0], 0.475, \ + r'$3:1$', transform=ax.transData, \ + va='center', ha='center', \ + bbox=dict(facecolor='w', lw=0.5), \ + fontsize='x-small') + + ax.text(dfr.three_to_two.iloc[0], 0.475, \ + r'$3:2$', transform=ax.transData, \ + va='center', ha='center', \ + bbox=dict(facecolor='w', lw=0.5), \ + fontsize='x-small') + + # ############################################# + # ############################################# + # CUTOFF, JUPITER CROSSING + # ############################################# + # ############################################# + + # Jupiter Crossing + # ax.plot(a_cross, e_cross, 'k--') + ax.fill_between(a_cross, e_cross, 0.6, \ + lw=0, facecolor='r', \ + alpha=0.1, zorder=-20) + + # Inner Cutoff + ax.fill_between([0.0, 0.1], 0.0, 0.6, \ + lw=0, facecolor='r', \ + alpha=0.1, zorder=20) # ############################################# # ############################################# |