Skip to content

Commit

Permalink
#72 Update object module
Browse files Browse the repository at this point in the history
  • Loading branch information
astropenguin committed Jan 21, 2024
1 parent b99235d commit b8d179b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions azely/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ class Object:
"""Name of the object."""

longitude: str
"""Longitude (e.g. R.A. or l) of the object."""
"""Longitude of the object with units."""

latitude: str
"""Latitude (e.g. Dec. or b) of the object."""
"""Latitude of the object with units."""

frame: str
"""Equatorial coordinates of the object."""
Expand Down Expand Up @@ -126,10 +126,11 @@ def get_object_by_cds(
parse=False,
cache=False,
)
lonlat = response.to_string("hmsdms")

return Object(
name=query,
longitude=str(response.data.lon), # type: ignore
latitude=str(response.data.lat), # type: ignore
longitude=lonlat.split()[0], # type: ignore
latitude=lonlat.split()[1], # type: ignore
frame=frame,
)
2 changes: 1 addition & 1 deletion azely/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from functools import wraps
from inspect import Signature
from pathlib import Path
from typing import Any, Callable, Iterator, Optional, TypeVar, Union
from typing import Any, Callable, Iterator, TypeVar, Union


# dependencies
Expand Down
4 changes: 2 additions & 2 deletions tests/test_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
Object(
name="3C 273",
longitude="12h29m06.69982572s",
latitude="2d03m08.59762998s",
latitude="+02d03m08.59762998s",
frame="icrs",
),
Object(
name="3C 345",
longitude="16h42m58.80997043s",
latitude="39d48m36.9939552s",
latitude="+39d48m36.9939552s",
frame="icrs",
),
]
Expand Down

0 comments on commit b8d179b

Please sign in to comment.