|
5 | 5 | import numpy as np
|
6 | 6 | import astropy.units as u
|
7 | 7 | from astropy.time import Time
|
8 |
| -from astropy.coordinates import Galactic, SkyCoord, get_sun, get_body |
| 8 | +from astropy.coordinates import Galactic, SkyCoord, EarthLocation, get_sun, get_body |
9 | 9 | from astropy.utils import minversion
|
10 | 10 | import pytest
|
11 | 11 |
|
|
20 | 20 | TimeConstraint, LocalTimeConstraint, months_observable,
|
21 | 21 | max_best_rescale, min_best_rescale, PhaseConstraint,
|
22 | 22 | PrimaryEclipseConstraint, SecondaryEclipseConstraint,
|
23 |
| - is_event_observable) |
| 23 | + is_event_observable, NearMeridianConstraint) |
24 | 24 | from ..periodic import EclipsingSystem
|
25 | 25 | from ..exceptions import MissingConstraintWarning
|
26 | 26 |
|
@@ -200,6 +200,18 @@ def test_sun_separation():
|
200 | 200 | assert np.all(is_constraint_met == [False, True, True])
|
201 | 201 |
|
202 | 202 |
|
| 203 | +def test_near_meridian(): |
| 204 | + time_range = Time(["2024-10-08 20:28", "2024-10-08 22:30"]) |
| 205 | + target = FixedTarget(coord=SkyCoord(ra=19.75*u.hour, dec=-22.05*u.deg), name="name") |
| 206 | + |
| 207 | + # Pico dos Dias Observatory (Brazil) |
| 208 | + opd = Observer(location=EarthLocation(lat=-22.53, lon=-45.58, height=1864)) |
| 209 | + constraint = NearMeridianConstraint(min=3*u.deg) |
| 210 | + |
| 211 | + results = constraint(opd, target, times=time_grid_from_range(time_range)) |
| 212 | + assert np.all(results == [True, True, False, True, True]) |
| 213 | + |
| 214 | + |
203 | 215 | def test_moon_separation():
|
204 | 216 | time = Time('2003-04-05 06:07:08')
|
205 | 217 | apo = Observer.at_site("APO")
|
@@ -419,6 +431,7 @@ def test_rescale_minmax():
|
419 | 431 | AtNightConstraint(),
|
420 | 432 | SunSeparationConstraint(min=90*u.deg),
|
421 | 433 | MoonSeparationConstraint(min=20*u.deg),
|
| 434 | + NearMeridianConstraint(min=3*u.deg), |
422 | 435 | LocalTimeConstraint(min=dt.time(23, 50), max=dt.time(4, 8)),
|
423 | 436 | TimeConstraint(*Time(["2015-08-28 03:30", "2015-09-05 10:30"]))
|
424 | 437 | ]
|
|
0 commit comments