HelioState functions support user-defined stars.

This commit is contained in:
Don Cross
2022-11-23 09:21:56 -05:00
parent 7b7a306baf
commit 79f6eac8eb
14 changed files with 83 additions and 11 deletions

View File

@@ -1758,7 +1758,7 @@ of reference, consider using [`BaryState`](#BaryState) instead.
| Type | Parameter | Description |
| --- | --- | --- |
| [`Body`](#Body) | `body` | The celestial body whose heliocentric state vector is to be calculated. Supported values are `Body.Sun`, `Body.SSB`, `Body.Moon`, `Body.EMB`, and all planets: `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. |
| [`Body`](#Body) | `body` | The celestial body whose heliocentric state vector is to be calculated. Supported values are `Body.Sun`, `Body.SSB`, `Body.Moon`, `Body.EMB`, and all planets: `Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, `Body.Jupiter`, `Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`. Also allowed to be a user-defined star created by [`DefineStar`](#DefineStar). |
| [`Time`](#Time) | `time` | The date and time for which to calculate position and velocity. |
**Returns**: [`StateVector`](#StateVector)
@@ -1781,7 +1781,7 @@ If given an invalid value for `body`, this function raises an exception.
| Type | Parameter | Description |
| --- | --- | --- |
| [`Body`](#Body) | `body` | The celestial body whose heliocentric position is to be calculated: The Sun, Moon, EMB, SSB, or any of the planets. |
| [`Body`](#Body) | `body` | The celestial body whose heliocentric position is to be calculated: The Sun, Moon, EMB, SSB, or any of the planets. Also allowed to be a user-defined star created by [`DefineStar`](#DefineStar). |
| [`Time`](#Time) | `time` | The time at which to calculate the heliocentric position. |
**Returns**: [`Vector`](#Vector)

View File

@@ -4503,6 +4503,7 @@ def HelioVector(body, time):
body : Body
The celestial body whose heliocentric position is to be calculated:
The Sun, Moon, EMB, SSB, or any of the planets.
Also allowed to be a user-defined star created by #DefineStar.
time : Time
The time at which to calculate the heliocentric position.
@@ -4910,6 +4911,7 @@ def HelioState(body, time):
Supported values are `Body.Sun`, `Body.SSB`, `Body.Moon`, `Body.EMB`, and all planets:
`Body.Mercury`, `Body.Venus`, `Body.Earth`, `Body.Mars`, `Body.Jupiter`,
`Body.Saturn`, `Body.Uranus`, `Body.Neptune`, `Body.Pluto`.
Also allowed to be a user-defined star created by #DefineStar.
time : Time
The date and time for which to calculate position and velocity.
@@ -4956,6 +4958,10 @@ def HelioState(body, time):
time
)
if _IsUserDefinedStar(body):
vec = HelioVector(body, time)
return StateVector(vec.x, vec.y, vec.z, 0.0, 0.0, 0.0, time)
raise InvalidBodyError(body)