diff --git a/pyobs/robotic/scheduler/constraints/airmassconstraint.py b/pyobs/robotic/scheduler/constraints/airmassconstraint.py index 200e12a0..0808a4aa 100644 --- a/pyobs/robotic/scheduler/constraints/airmassconstraint.py +++ b/pyobs/robotic/scheduler/constraints/airmassconstraint.py @@ -22,8 +22,10 @@ def to_astroplan(self) -> astroplan.AirmassConstraint: async def __call__(self, time: Time, task: Task, data: DataProvider) -> bool: if task.target is None: return False - airmass = float(data.observer.altaz(time, task.target).secz) - return 0.0 < airmass <= self.max_airmass + coord = task.target.coordinates(time) + altaz = data.observer.altaz(time, coord) + airmass = float(altaz.secz) + return 0.0 < airmass <= self.max_airmass and altaz.alt.degree > 0.0 __all__ = ["AirmassConstraint"] diff --git a/pyobs/robotic/scheduler/constraints/moonseparationconstraint.py b/pyobs/robotic/scheduler/constraints/moonseparationconstraint.py index ca9f26f2..6af0cb4f 100644 --- a/pyobs/robotic/scheduler/constraints/moonseparationconstraint.py +++ b/pyobs/robotic/scheduler/constraints/moonseparationconstraint.py @@ -22,12 +22,10 @@ def to_astroplan(self) -> astroplan.MoonSeparationConstraint: return astroplan.MoonSeparationConstraint(min=self.min_distance * u.deg) async def __call__(self, time: Time, task: Task, data: DataProvider) -> bool: - target = task.target - if target is None: + if task.target is None: return True - moon_separation = astropy.coordinates.get_body("moon", time).separation( - target.coordinates(time), origin_mismatch="ignore" - ) + coord = task.target.coordinates(time) + moon_separation = astropy.coordinates.get_body("moon", time).separation(coord, origin_mismatch="ignore") return float(moon_separation.degree) >= self.min_distance diff --git a/pyproject.toml b/pyproject.toml index 44cc395a..9bd086e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pyobs-core" -version = "1.45.4" +version = "1.45.5" description = "robotic telescope software" authors = [{ name = "Tim-Oliver Husser", email = "thusser@uni-goettingen.de" }] requires-python = ">=3.11" diff --git a/uv.lock b/uv.lock index e9c1572d..4adeb1fd 100644 --- a/uv.lock +++ b/uv.lock @@ -3120,7 +3120,7 @@ wheels = [ [[package]] name = "pyobs-core" -version = "1.45.4" +version = "1.45.5" source = { editable = "." } dependencies = [ { name = "aiohttp" },