Subtract two Epoch's or a Duration from an Epoch. Valid: Duration = Epoch - Epoch Epoch = Epoch - Duration = INPUT VARIABLES - rhs The Epoch to subtract. = RETURN VALUE - Returns either the duration between to Epoch's or the a n
(self, rhs)
| 142 | return Epoch(t._frame, sec, t._jd) |
| 143 | |
| 144 | def __sub__(self, rhs): |
| 145 | """ |
| 146 | Subtract two Epoch's or a Duration from an Epoch. |
| 147 | |
| 148 | Valid: |
| 149 | Duration = Epoch - Epoch |
| 150 | Epoch = Epoch - Duration |
| 151 | |
| 152 | = INPUT VARIABLES |
| 153 | - rhs The Epoch to subtract. |
| 154 | |
| 155 | = RETURN VALUE |
| 156 | - Returns either the duration between to Epoch's or the a new |
| 157 | Epoch that is the result of subtracting a duration from an epoch. |
| 158 | """ |
| 159 | # Delay-load due to circular dependencies. |
| 160 | import matplotlib.testing.jpl_units as U |
| 161 | |
| 162 | # Handle Epoch - Duration |
| 163 | if isinstance(rhs, U.Duration): |
| 164 | return self + -rhs |
| 165 | |
| 166 | t = self |
| 167 | if self._frame != rhs._frame: |
| 168 | t = self.convert(rhs._frame) |
| 169 | |
| 170 | days = t._jd - rhs._jd |
| 171 | sec = t._seconds - rhs._seconds |
| 172 | |
| 173 | return U.Duration(rhs._frame, days*86400 + sec) |
| 174 | |
| 175 | def __str__(self): |
| 176 | """Print the Epoch.""" |