<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Apsidal Motion
Setup
Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
Step1:  As always, let's do imports and initialize a logger and a new Bundle.  See Building a System for more details.
Step2:  In order for apsidal motion to be apparent, we need an eccentric system that is precessing.
Step3:  Let's set a very noticeable rate of precession.
Step4:  We'll add lc and orb datasets to see how the apsidal motion affects each.  We'll need to sample over several orbits of the binary (which has a period of 3 days, by default).
Step5:  Influence on Orbits (positions)
Let's plot the orbit from above and highlight the positions of each star at each cycle (times that are multiples of the period).
Step6:  Influence on Light Curves (fluxes)
Now looking at the light curve, we can see that this is resulting in the eclipses moving in phase-space.
<ASSISTANT_TASK:>
Python Code:
!pip install -I "phoebe>=2.2,<2.3"
Explanation: Apsidal Motion
Setup
Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
%matplotlib inline
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt
logger = phoebe.logger()
b = phoebe.default_binary()
Explanation: As always, let's do imports and initialize a logger and a new Bundle.  See Building a System for more details.
End of explanation
b['ecc'] = 0.2
Explanation: In order for apsidal motion to be apparent, we need an eccentric system that is precessing.
End of explanation
b['dperdt'] = 2.0 * u.deg/u.d
Explanation: Let's set a very noticeable rate of precession.
End of explanation
b.add_dataset('lc', times=np.linspace(0,1,101), dataset='lc01')
b.add_dataset('lc', times=np.linspace(4,5,101), dataset='lc02')
b.add_dataset('orb', compute_times=np.linspace(0,5,401), dataset='orb01')
b.run_compute(irrad_method='none')
Explanation: We'll add lc and orb datasets to see how the apsidal motion affects each.  We'll need to sample over several orbits of the binary (which has a period of 3 days, by default).
End of explanation
afig, mplfig = b['orb01@model'].plot(y='ws', time=[0,1,2,3,4,5], show=True)
Explanation: Influence on Orbits (positions)
Let's plot the orbit from above and highlight the positions of each star at each cycle (times that are multiples of the period).
End of explanation
afig, mplfig = b['lc01@model'].plot()
afig, mplfig = b['lc02@model'].plot(time=[0,1,4,5], show=True) 
afig, mplfig = b['lc01@model'].plot(x='phases')
afig, mplfig = b['lc02@model'].plot(x='phases', show=True)
Explanation: Influence on Light Curves (fluxes)
Now looking at the light curve, we can see that this is resulting in the eclipses moving in phase-space.
End of explanation
<END_TASK>