-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5da6793
commit 73eba0c
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from copy import copy | ||
from typing import Any, Union, Dict | ||
|
||
from astropy.coordinates import SkyCoord | ||
|
||
from pyobs.images import Image | ||
from pyobs.images.meta import SkyOffsets | ||
from pyobs.images.processors.offsets import Offsets | ||
from pyobs.object import get_object | ||
|
||
|
||
class DummySkyOffsets(Offsets): | ||
def __init__(self, coord0: Union[SkyCoord, Dict[str, Any]], coord1: Union[SkyCoord, Dict[str, Any]], **kwargs: Any) -> None: | ||
super().__init__(**kwargs) | ||
sky_coord0 = get_object(coord0, SkyCoord) | ||
sky_coord1 = get_object(coord1, SkyCoord) | ||
self._offset = SkyOffsets(sky_coord0, sky_coord1) | ||
|
||
async def __call__(self, image: Image) -> Image: | ||
image.set_meta(copy(self._offset)) | ||
return image | ||
|
||
|
||
__all__ = ["DummySkyOffsets"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import pytest | ||
from astropy.coordinates import SkyCoord | ||
|
||
from pyobs.images import Image | ||
from pyobs.images.meta import SkyOffsets | ||
from pyobs.images.processors.offsets import DummySkyOffsets | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_call(): | ||
coord0 = SkyCoord(alt=90.0, az=0.0, unit="degree", frame="altaz") | ||
coord1 = SkyCoord(alt=80.0, az=0.0, unit="degree", frame="altaz") | ||
|
||
offsets = DummySkyOffsets(coord0, coord1) | ||
image = Image() | ||
|
||
result_image = await offsets(image) | ||
|
||
result_offset = result_image.get_meta(SkyOffsets) | ||
|
||
assert result_offset.coord0.alt.deg == 90.0 | ||
assert result_offset.coord0.az.deg == 0.0 | ||
|
||
assert result_offset.coord1.alt.deg == 80.0 | ||
assert result_offset.coord1.az.deg == 0.0 |