pint.utils.divide_times
- pint.utils.divide_times(t, t0, offset=0.5)[source]
Divide input times into years relative to t0
Years are centered around the requested offset value
- Parameters:
t (astropy.time.Time) –
t0 (astropy.time.Time) – Reference time
offset (float, optional) – Offset value for division. A value of 0.5 divides the results into intervals [-0.5,0.5].
- Returns:
Array of indices for division
- Return type:
np.ndarray
Example
Divide into years around each conjunction
>>> elongation = astropy.coordinates.get_sun(Time(t.get_mjds(), format="mjd")).separation(m.get_psr_coords()) >>> t0 = get_conjunction(m.get_psr_coords(), m.PEPOCH.quantity, precision="high")[0] >>> indices = divide_times(Time(t.get_mjds(), format="mjd"), t0) >>> plt.clf() >>> for i in np.unique(indices): plt.plot(t.get_mjds()[indices == i], elongation[indices == i].value, ".")