1
0

bridgeEvolution.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. """Plot the evolution of the amount of matter in the bridge as
  2. a function of time for varying companion masses
  3. """
  4. import matplotlib.pyplot as plt
  5. import numpy as np
  6. from analysis import utils
  7. from analysis.segmentation import segmentEncounter
  8. # Masses are given relative to 100, with respect to the main mass
  9. masses = [20, 50, 100, 200]
  10. labels = ['1:0.25', '1:0.5', '1:1', '1:2', '1:4'] # main:companion
  11. f, ax = plt.subplots(1, 1, sharey=True)
  12. for j, style in zip(range(len(masses)), [':', '-.','-','--']):
  13. ts = np.linspace(4000, 10000, 61) # time range
  14. fractions = [] # fractional mass in bridge
  15. for t in ts:
  16. data = utils.loadData('{}mass'.format(masses[j]), int(t))
  17. masks, _, _ = segmentEncounter(data, mode='bridge')
  18. fractions.append(np.sum(masks[0])/len(data['r_vec']))
  19. ax.plot(ts, fractions, label=labels[j], c='black', linestyle=style)
  20. ax.legend(title='main:companion', fontsize=14)
  21. utils.setAxes(ax, x='Time', y='Fractional mass in bridge',
  22. xcoords=(.9,-0.08), ycoords=(-0.08,.6))
  23. utils.setSize(ax, x=(5000,10000), y=(0,0.1))
  24. utils.stylizePlot([ax])
  25. plt.show()