diff --git a/astroplan/constraints.py b/astroplan/constraints.py index 8ae78379..edbf375b 100644 --- a/astroplan/constraints.py +++ b/astroplan/constraints.py @@ -423,7 +423,7 @@ def _get_solar_altitudes(self, times, observer, targets): if not hasattr(observer, '_altaz_cache'): observer._altaz_cache = {} - aakey = _make_cache_key(times, 'sun') + aakey = _make_cache_key(times, "sun") if aakey not in observer._altaz_cache: try: @@ -432,7 +432,7 @@ def _get_solar_altitudes(self, times, observer, targets): observer.pressure = 0 # find solar altitude at these times - altaz = observer.altaz(times, observer.get_body('sun', times)) + altaz = observer.altaz(times, observer.get_body("sun", times)) altitude = altaz.alt # cache the altitude observer._altaz_cache[aakey] = dict(times=times, @@ -510,7 +510,7 @@ def compute_constraint(self, times, observer, targets): # centred frame, so the separation is as-seen # by the observer. # 'get_sun' returns ICRS coords. - sun = observer.get_body('sun', times) + sun = observer.get_body("sun", times) targets = get_skycoord(targets) solar_separation = sun.separation(targets) diff --git a/astroplan/observer.py b/astroplan/observer.py index d742b43b..d6dc49e3 100644 --- a/astroplan/observer.py +++ b/astroplan/observer.py @@ -607,7 +607,7 @@ def get_body(self, body, time, ephemeris=None): >>> from astropy.coordinates import SkyCoord >>> apo = Observer.at_site("APO") >>> time = Time('2001-02-03 04:05:06') - >>> target = apo.get_body('sun', time) + >>> target = apo.get_body("sun", time) """ if not isinstance(time, Time): time = Time(time) @@ -687,7 +687,7 @@ def altaz(self, time, target=None, obswl=None, grid_times_targets=False): if target is MoonFlag: target = self.get_body("moon", time) elif target is SunFlag: - target = self.get_body('sun', time) + target = self.get_body("sun", time) time, target = self._preprocess_inputs(time, target, grid_times_targets) @@ -1440,7 +1440,7 @@ def sun_rise_time(self, time, which='nearest', horizon=0*u.degree, n_grid_points >>> print("ISO: {0.iso}, JD: {0.jd}".format(sun_rise)) # doctest: +SKIP ISO: 2001-02-02 14:02:50.554, JD: 2451943.08531 """ - return self.target_rise_time(time, self.get_body('sun', time), which, horizon, + return self.target_rise_time(time, self.get_body("sun", time), which, horizon, n_grid_points=n_grid_points) @u.quantity_input(horizon=u.deg) @@ -1491,7 +1491,7 @@ def sun_set_time(self, time, which='nearest', horizon=0*u.degree, n_grid_points= >>> print("ISO: {0.iso}, JD: {0.jd}".format(sun_set)) # doctest: +SKIP ISO: 2001-02-04 00:35:42.102, JD: 2451944.52479 """ - return self.target_set_time(time, self.get_body('sun', time), which, horizon, + return self.target_set_time(time, self.get_body("sun", time), which, horizon, n_grid_points=n_grid_points) def noon(self, time, which='nearest', n_grid_points=150): @@ -1520,7 +1520,7 @@ def noon(self, time, which='nearest', n_grid_points=150): `~astropy.time.Time` Time at solar noon """ - return self.target_meridian_transit_time(time, self.get_body('sun', time), which, + return self.target_meridian_transit_time(time, self.get_body("sun", time), which, n_grid_points=n_grid_points) def midnight(self, time, which='nearest', n_grid_points=150): @@ -1549,7 +1549,7 @@ def midnight(self, time, which='nearest', n_grid_points=150): `~astropy.time.Time` Time at solar midnight """ - return self.target_meridian_antitransit_time(time, self.get_body('sun', time), which, + return self.target_meridian_antitransit_time(time, self.get_body("sun", time), which, n_grid_points=n_grid_points) # Twilight convenience functions @@ -1935,7 +1935,7 @@ def sun_altaz(self, time): if not isinstance(time, Time): time = Time(time) - sun = self.get_body('sun', time) + sun = self.get_body("sun", time) return self.altaz(time, sun) @u.quantity_input(horizon=u.deg) @@ -2045,7 +2045,7 @@ def is_night(self, time, horizon=0*u.deg, obswl=None): if not isinstance(time, Time): time = Time(time) - solar_altitude = self.altaz(time, target=self.get_body('sun', time), obswl=obswl).alt + solar_altitude = self.altaz(time, target=self.get_body("sun", time), obswl=obswl).alt if solar_altitude.isscalar: return bool(solar_altitude < horizon)