This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
5 changed files
with
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ Modules | |
orbit | ||
fov | ||
skygrid | ||
units |
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,21 @@ | ||
Units (`dorado.scheduling.units`) | ||
================================= | ||
.. automodule:: dorado.scheduling.units | ||
|
||
Examples | ||
-------- | ||
|
||
First, some imports: | ||
|
||
>>> from astropy import units as u | ||
>>> from dorado.scheduling import data | ||
>>> from dorado.scheduling import Orbit | ||
>>> from dorado.scheduling.units import equivalencies | ||
>>> from importlib import resources | ||
|
||
Load an example two-line element: | ||
|
||
>>> with resources.path(data, 'dorado-625km-sunsync.tle') as p: | ||
... orbit = Orbit(p) | ||
|
||
>>> u.Quantity('2 orbit').to(u.s, equivalencies=equivalencies.orbital(orbit)) |
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,11 @@ | ||
# | ||
# Copyright © 2020 United States Government as represented by the Administrator | ||
# of the National Aeronautics and Space Administration. No copyright is claimed | ||
# in the United States under Title 17, U.S. Code. All Other Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: NASA-1.3 | ||
# | ||
from .orbital import orbit | ||
from . import equivalencies | ||
|
||
__all__ = ('equivalencies', 'orbit') |
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,17 @@ | ||
# | ||
# Copyright © 2020 United States Government as represented by the Administrator | ||
# of the National Aeronautics and Space Administration. No copyright is claimed | ||
# in the United States under Title 17, U.S. Code. All Other Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: NASA-1.3 | ||
# | ||
from astropy.units.equivalencies import Equivalency | ||
|
||
from .orbital import orbit as _orbit | ||
|
||
|
||
def orbital(orbit): | ||
return Equivalency([(_orbit, orbit.period.unit, | ||
lambda x: x * orbit.period.value, | ||
lambda x: x / orbit.period.value)], | ||
name='orbital') |
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 @@ | ||
# | ||
# Copyright © 2020 United States Government as represented by the Administrator | ||
# of the National Aeronautics and Space Administration. No copyright is claimed | ||
# in the United States under Title 17, U.S. Code. All Other Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: NASA-1.3 | ||
# | ||
from astropy.units import def_unit | ||
|
||
_ns = globals() | ||
|
||
def_unit('orbit', namespace=_ns, | ||
doc='a unit of time equal to one orbital period') | ||
|
||
del _ns, def_unit | ||
|
||
|
||
def _enable(): | ||
import inspect | ||
from astropy.units import add_enabled_units | ||
add_enabled_units(inspect.getmodule(_enable)) | ||
|
||
|
||
_enable() |