State¶
- class sbpy.dynamics.state.State(r: Quantity, v: Quantity, t: Quantity | Time, frame: FrameInputTypes | None = None)[source] [edit on github]¶
Bases:
StateBaseDynamical state.
- Parameters:
- r
Quantity Position (x, y, z), shape = (3,) or (N, 3).
- v
Quantity Velocity (x, y, z), shape = (3,) or (N, 3).
- t
TimeorQuantity Time, a scalar or shape = (N,). Time as a
Quantitymay only be used with theArbitraryFramecoordinate frame.- frame
BaseCoordinateFrameclass orstr, optional Reference frame for
randv. Default:ArbitraryFrame.
- r
Notes
State data is immutable.
Examples
>>> from astropy.time import Time >>> import astropy.units as u >>> from sbpy.dynamics import State >>> r = [1e9, 1e9, 0] * u.km >>> v = [0, 0, 10] * u.km / u.s >>> t = Time("2022-07-24", scale="tdb") >>> state = State(r, v, t)
Or, specify time relative to an arbitrary epoch:
>>> t = 327 * u.day >>> state = State(r, v, t)
Attributes Summary
True if the time attribute is arbitrary.
Position vector.
Position in km, and velocity in km/s.
Time.
Velocity vector.
x component of the velocity vector.
y component of the velocity vector.
z component of the velocity vector.
x component of the position vector.
y component of the position vector.
z component of the position vector.
Methods Summary
from_ephem(eph[, frame])Initialize from an
Ephemobject.from_skycoord(coords)Initialize from astropy
SkyCoord.from_states(states)Initialize from a list of states.
observe(target)Project a target's position onto the sky.
to_ephem([observer, coords])Convert to an sbpy ephemeris object.
Convert to a
SkyCoordobject.transform_to(frame)Transform state into another reference frame.
Attributes Documentation
- arbitrary_time¶
True if the time attribute is arbitrary.
- frame¶
- r¶
Position vector.
- rv¶
Position in km, and velocity in km/s.
- t¶
Time.
- v¶
Velocity vector.
- v_x¶
x component of the velocity vector.
- v_y¶
y component of the velocity vector.
- v_z¶
z component of the velocity vector.
- x¶
x component of the position vector.
- y¶
y component of the position vector.
- z¶
z component of the position vector.
Methods Documentation
- classmethod from_ephem(eph: Ephem, frame: FrameInputTypes | None = None) StateType[source] [edit on github]¶
Initialize from an
Ephemobject.- Parameters:
- eph
Ephem Ephemeris object, must have time, position, and velocity. Position and velocity may be specified using (“x”, “y”, “z”, “vx”, “vy”, and “vz”), or (“ra”, “dec”, “Delta”, “RA*cos(Dec)_rate”, “Dec_rate”, and “deltadot”).
- frame
strorBaseCoordinateFrame, optional The reference frame for the ephemeris.
- eph
- classmethod from_skycoord(coords: SkyCoord) StateType[source] [edit on github]¶
Initialize from astropy
SkyCoord.- Parameters:
- coords: ~astropy.coordinates.SkyCoord
The object state. Must have position and velocity,
obstime, and be convertible to cartesian (3D) coordinates.
- classmethod from_states(states: Iterable[StateType]) StateType[source] [edit on github]¶
Initialize from a list of states.
The resulting reference frame will be that of
states[0].- Parameters:
- states
array
- states
- observe(target: StateType) SkyCoord[source] [edit on github]¶
Project a target’s position onto the sky.
- Parameters:
- target
State The target to observe.
- target
- Returns:
- coords
SkyCoord
- coords
- to_ephem(observer: StateType | None = None, coords: SkyCoord | None = None) Ephem [edit on github]¶
Convert to an sbpy ephemeris object.
- Parameters:
- Returns:
- eph
Ephem
- eph
Notes
Observer state is stored in the
Ephem.metaattribute.coordsis calculated for the given observer.Attribute or quantity
Ephemfield namet, as
Timedate
t, as
Quantityt_relative
\(|r|\)
r
\(|v \cdot \hat{r}|\)
rdot
coords.ra
ra
coords.dec
dec
coords.pm_ra_cosdec
ra*cos(dec)_rate
coords.pm_dec
dec_rate
coords.lon
lon
coords.lat
lat
coords.pm_lon_coslat
lon*cos(lat)_rate
coords.pm_lat
lat_rate
coords.distance
delta
coords.radial_velocity
deltadot
x
x
y
y
z
z
v_x
vx
v_y
vy
v_z
vz
- to_skycoord() SkyCoord [edit on github]¶
Convert to a
SkyCoordobject.
- transform_to(frame: FrameInputTypes) StateBaseType [edit on github]¶
Transform state into another reference frame.
- Parameters:
- frame
strorBaseCoordinateFrame Transform into this reference frame.
- frame
- Returns:
- state
State The transformed state.
- state