Skip to content

Commit

Permalink
Merge pull request #88 from observerly/feature/models/body
Browse files Browse the repository at this point in the history
feat: Added { ..., μra, μdec } (proper motion) fields to Body model.
  • Loading branch information
michealroberts committed Feb 4, 2023
2 parents 04b4536 + df99468 commit 11bcdc9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""feat: Added Body model (e.g., Star, Galaxy, Nebulae etc.)
Revision ID: f3b35e23e6d7
Revision ID: 60bc843ba6b5
Revises:
Create Date: 2023-02-03 13:12:46.606928
Create Date: 2023-02-04 14:19:48.678978
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'f3b35e23e6d7'
revision = '60bc843ba6b5'
down_revision = None
branch_labels = None
depends_on = None
Expand All @@ -23,7 +23,9 @@ def upgrade():
sa.Column('name', sa.String(length=180), nullable=True, comment='Common or IAU Name'),
sa.Column('iau', sa.String(length=180), nullable=True, comment='IAU Name'),
sa.Column('ra', sa.Float(precision=10, asdecimal=True, decimal_return_scale=10), nullable=True, comment='Right Ascension of the central point of the Body'),
sa.Column('μra', sa.Float(precision=10, asdecimal=True, decimal_return_scale=10), nullable=True, comment='Proper Motion in Right Ascension (mas/yr)'),
sa.Column('dec', sa.Float(precision=10, asdecimal=True, decimal_return_scale=10), nullable=True, comment='Declination of the central point of the Body'),
sa.Column('μdec', sa.Float(precision=10, asdecimal=True, decimal_return_scale=10), nullable=True, comment='Proper Motion in Declination (mas/yr)'),
sa.Column('constellation', sa.String(length=180), nullable=True, comment='IAU Constellation (Contained Within)'),
sa.Column('type', sa.String(length=180), nullable=True, comment='Celestial Body Type e.g., Star, Spiral Galaxy etc'),
sa.Column('apparent_magnitude', sa.Float(precision=5, asdecimal=True, decimal_return_scale=10), nullable=True, comment='Apparent Magnitude (m)'),
Expand Down
24 changes: 24 additions & 0 deletions app/models/body.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ class Body(Base):
comment="Right Ascension of the central point of the Body",
)

# Proper Motion in Right Ascension (mas/yr)
μra = Column(
Float(
precision=10,
asdecimal=True,
decimal_return_scale=10,
),
index=False,
name="μra",
comment="Proper Motion in Right Ascension (mas/yr)",
)

# Declination (abbreviated dec; symbol δ) is one of the two angles that
# locate a point on the celestial sphere in the equatorial coordinate system,
# the other being hour angle. Declination's angle is measured north or south
Expand All @@ -81,6 +93,18 @@ class Body(Base):
comment="Declination of the central point of the Body",
)

# Proper Motion in Declination (mas/yr)
μdec = Column(
Float(
precision=10,
asdecimal=True,
decimal_return_scale=10,
),
index=False,
name="μdec",
comment="Proper Motion in Declination (mas/yr)",
)

# Constellation (Contained Within)
constellation = Column(
String(
Expand Down
14 changes: 14 additions & 0 deletions app/schemas/body.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,26 @@ class BodyBase(BaseModel):
title="Right Ascension",
description="The right ascension, α, of the astronomical object in degrees",
)
# Proper Motion in Right Ascension
μra: Optional[float] = Field(
None,
title="Proper Motion in Right Ascension",
description="The proper motion in right ascension of the astronomical \
object in milliarcseconds per year",
)
# Declination
dec: Optional[float] = Field(
None,
title="Declination",
description="The declination, δ, of the astronomical object in degrees",
)
# Proper Motion in Declination
μdec: Optional[float] = Field(
None,
title="Proper Motion in Declination",
description="The proper motion in declination of the astronomical \
object in milliarcseconds per year",
)
# Constellation
constellation: str = Field(
"",
Expand Down

0 comments on commit 11bcdc9

Please sign in to comment.