Struct nyx_space::cosmic::Cosm

source ·
pub struct Cosm {
    pub xb: Xb,
    pub frame_root: FrameTree,
    /* private fields */
}

Fields§

§xb: Xb§frame_root: FrameTree

Implementations§

source§

impl Cosm

source

pub fn from_xb(filename: &str) -> Result<Self, NyxError>

Builds a Cosm from the *XB files. Path should not contain file extension. Panics if the files could not be loaded.

source

pub fn try_de438() -> Result<Self, NyxError>

Tries to load a subset of the DE438 XB from the embedded files, bounded between 01 Jan 2000 and 31 Dec 2050 TDB.

source

pub fn de438() -> Arc<Self>

Load a subset of the DE438 XB from the embedded files, bounded between 01 Jan 2000 and 31 Dec 2050 TAI.

source

pub fn de438_raw() -> Self

Load a subset of the DE438 XB from the embedded files, bounded between 01 Jan 2000 and 31 Dec 2050 TAI.

source

pub fn de438_gmat() -> Arc<Self>

Load a subset of the DE438 XB from the embedded files, bounded between 01 Jan 2000 and 31 Dec 2050 TAI.

source

pub fn try_from_xb(xb: Xb) -> Result<Self, NyxError>

Attempts to build a Cosm from the XB files and the embedded IAU frames

source

pub fn use_gmat_gm(&mut self)

Switch the GM values to those from GMAT

source

pub fn load_iau_frames(&mut self) -> Result<(), NyxError>

Load the IAU Frames as defined in Celest Mech Dyn Astr (2018) 130:22 (https://doi.org/10.1007/s10569-017-9805-5)

source

pub fn frame_find_path_for_orientation( &self, name: &str ) -> Result<Vec<usize>, NyxError>

Returns the machine path of the ephemeris whose orientation is requested

source

pub fn append_xb(&mut self)

source

pub fn append_frames(&mut self, toml_content: &str) -> Result<(), NyxError>

Append Cosm with the contents of this TOML (must not be the filename)

source

pub fn try_frame(&self, name: &str) -> Result<Frame, NyxError>

Fetch the frame associated with this ephemeris name This is slow, so avoid using it.

source

pub fn frame_from_ephem_path(&self, ephem_path: &[usize]) -> Frame

Provided an ephemeris path and an optional frame name, returns the Frame of that ephemeris. For example, if [3, 1] is provided (Moon in J2000 in the DE file), return Moon J2000 If no frame name is provided, then the storage frame is returned. Otherwise, the correct frame is returned.

source

pub fn frame_from_frame_path(&self, frame_path: &[usize]) -> Frame

Provided a frame path returns the Frame.

source

pub fn frames_get_names(&self) -> Vec<String>

source

pub fn frames_get(&self) -> Vec<Frame>

Returns all of the frames defined in this Cosm

source

pub fn frame(&self, name: &str) -> Frame

Returns the geoid from the loaded XB, if it is in there, else panics!

source

pub fn frame_mut_gm(&mut self, name: &str, new_gm: f64)

Mutates the GM value for the provided geoid id. Panics if ID not found.

source

pub fn raw_celestial_state( &self, path: &[usize], epoch: Epoch ) -> Result<Orbit, NyxError>

Returns the celestial state as computed from a de4xx.{FXB,XB} file in the original frame

source

pub fn try_celestial_state( &self, target_ephem: &[usize], datetime: Epoch, frame: Frame, correction: LightTimeCalc ) -> Result<Orbit, NyxError>

Attempts to return the state of the celestial object at the provided time

The light time correction is based on SPICE’s implementation: https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkezr_c.html . Aberration computation is a conversion of the stelab function in SPICE, available here https://github.com/ChristopherRabotin/cspice/blob/26c72936fb7ff6f366803a1419b7cc3c61e0b6e5/src/cspice/stelab.c#L255

source

pub fn celestial_state( &self, target_ephem: &[usize], datetime: Epoch, frame: Frame, correction: LightTimeCalc ) -> Orbit

Returns the state of the celestial object (target ephem) as seen in the requested frame at the provided time

source

pub fn try_position_dcm_from_to( &self, from: &Frame, to: &Frame, dt: Epoch ) -> Result<Matrix3<f64>, NyxError>

Return the position DCM (3x3) to go from the from frame to the to frame

source

pub fn try_dcm_from_to( &self, from: &Frame, to: &Frame, dt: Epoch ) -> Result<Matrix6<f64>, NyxError>

Return the position and velocity DCM (6x6) to go from the from frame to the to frame

source

pub fn try_dcm_from_to_in_parts( &self, from: &Frame, to: &Frame, dt: Epoch ) -> Result<(Matrix3<f64>, Matrix3<f64>), NyxError>

Return the position and velocity DCM (two 3x3 matrices) to go from the from frame to the to frame

source

pub fn try_frame_translation( &self, state: &Orbit, new_frame: Frame ) -> Result<Orbit, NyxError>

Attempts to only perform a translation without rotation between two frames. You really shouldn’t be using this unless you know exactly what you’re doing. Typically, you want to use try_frame_chg. WARNING: This will update the Frame of the Orbit to the requested one EVEN IF it doesn’t rotate it.

source

pub fn try_frame_chg( &self, state: &Orbit, new_frame: Frame ) -> Result<Orbit, NyxError>

Attempts to return the provided state in the provided frame.

source

pub fn frame_chg(&self, state: &Orbit, new_frame: Frame) -> Orbit

Return the provided state in the provided frame, or panics

Trait Implementations§

source§

impl Debug for Cosm

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Cosm

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Cosm

§

impl Send for Cosm

§

impl Sync for Cosm

§

impl Unpin for Cosm

§

impl !UnwindSafe for Cosm

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Printing<T> for Twhere T: Display,

§

fn to_str(self) -> String

Method to serialize. Decorates Vecs with square brackets and tuples with round ones. Implementation code is in printing.rs.
§

fn to_plainstr(self) -> String

Method to serialize in minimal form (space separated, no brackets) Implementation code is in printing.rs.
§

fn rd(self) -> String

Printable in red
§

fn gr(self) -> String

Printable in green
§

fn bl(self) -> String

Printable in blue
§

fn yl(self) -> String

Printable in yellow
§

fn mg(self) -> String

Printable in magenta
§

fn cy(self) -> String

Printable in cyan
§

fn wvec(self, f: &mut File) -> Result<(), Error>

Method to write vector(s) to file f (space separated, without brackets). Passes up io errors
§

fn pvec(self)

Method to print vector(s) to stdout (space separated,without brackets).
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V