adjust_time_to_hour_angle¶
- specsim.transform.adjust_time_to_hour_angle(nominal_time, target_ra, hour_angle, longitude=None, max_error=<Quantity 0.01 arcsec>, max_iterations=3)[source] [edit on github]¶
Adjust a time to a specified target hour angle.
The input nominal time will be adjusted to the closest time where the specified hour angle is achieved, using either a positive or negative adjustment. For example to observe Polaris from KPNO on MJD 55100 at its maximum elevation (hour angle = 0):
>>> where = observatories['KPNO'] >>> night = astropy.time.Time(55100, format='mjd', location=where) >>> polaris = astropy.coordinates.ICRS(ra=37.95 * u.deg, dec=89.25 * u.deg) >>> when = adjust_time_to_hour_angle(night, polaris.ra, 0 * u.deg) >>> print('MJD %.3f' % when.mjd) MJD 55100.401
- Parameters:
- nominal_time
astropy.time.Time Nominal time that will be adjusted. If it does not have an associated location, the longitude parameter must be set.
- target_ra
astropy.units.quantity.Quantity Target right ascension to use for calculating the hour angle.
- hour_angle
astropy.units.quantity.Quantity Desired target hour angle after the adjustment, expressed as an angle.
- longitude
astropy.units.quantity.Quantity The longitude to use for calculating the hour angle. When the value is
None, the location associated withnominal_timeis used.- max_error
astropy.units.quantity.Quantity The desired accuracy of the hour angle after the adjustment, expressed as an angle.
- max_iterationsint
The maximum number of iterations to use in order to achieve the desired accuracy.
- nominal_time
- Returns:
astropy.time.TimeAdjusted time, which will be within
max_erroroftarget_ra, or else a RuntimeError will be raised.
- Raises:
- RuntimeError
The desired accuracy could not be achieved after
max_iterations.