Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "nyx-space"
build = "build.rs"
version = "2.2.0-alpha"
version = "2.2.0"
edition = "2021"
authors = ["Christopher Rabotin <[email protected]>"]
description = "A high-fidelity space mission toolkit, with orbit propagation, estimation and some systems engineering"
Expand Down Expand Up @@ -32,16 +32,16 @@ maintenance = { status = "actively-developed" }
github = { repository = "nyx-space/nyx", branch = "master" }

[dependencies]
nalgebra = "0.33"
nalgebra = "0.34"
log = "0.4"
hifitime = "4.0.0"
anise = "0.6.0"
anise = "0.7.0"
flate2 = { version = "1.0", features = [
"rust_backend",
], default-features = false }
serde = "1.0"
serde_derive = "1.0"
hyperdual = "1.3.0"
hyperdual = "1.4.0"
rand = "0.9"
rand_distr = "0.5"
regex = "1.5"
Expand All @@ -63,7 +63,7 @@ num = "0.4.0"
enum-iterator = "2.0.0"
typed-builder = "0.22.0"
snafu = { version = "0.8.3", features = ["backtrace"] }
serde_dhall = "0.12"
serde_dhall = "0.13"
indexmap = { version = "2.6.0", features = ["serde"] }
statrs = "0.18.0"

Expand All @@ -74,7 +74,6 @@ premium = []

[dev-dependencies]
polars = { version = "0.51.0", features = ["parquet"] }
planus = "=1.1.1" # cf. https://github.com/pola-rs/polars/issues/24208
rstest = "0.26.1"
pretty_env_logger = "0.5"
toml = "0.9.0"
Expand Down
6 changes: 3 additions & 3 deletions examples/01_orbit_prop/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn main() -> Result<(), Box<dyn Error>> {
// This allows the frame to include the gravitational parameters and the shape of the Earth,
// defined as a tri-axial ellipoid. Note that this shape can be changed manually or in the Almanac
// by loading a different set of planetary constants.
let earth_j2000 = almanac.frame_from_uid(EARTH_J2000)?;
let earth_j2000 = almanac.frame_info(EARTH_J2000)?;

let orbit =
Orbit::try_keplerian_altitude(300.0, 0.015, 68.5, 65.2, 75.0, 0.0, epoch, earth_j2000)?;
Expand Down Expand Up @@ -121,7 +121,7 @@ fn main() -> Result<(), Box<dyn Error>> {
// The harmonics must be computed in the body fixed frame.
// We're using the long term prediction of the Earth centered Earth fixed frame, IAU Earth.
let harmonics_21x21 = Harmonics::from_stor(
almanac.frame_from_uid(IAU_EARTH_FRAME)?,
almanac.frame_info(IAU_EARTH_FRAME)?,
HarmonicsMem::from_cof(&jgm3_meta.uri, 21, 21, true).unwrap(),
);

Expand Down Expand Up @@ -199,7 +199,7 @@ fn main() -> Result<(), Box<dyn Error>> {
40.014984, // latitude in degrees
-105.270546, // longitude in degrees
1.6550, // altitude in kilometers
almanac.frame_from_uid(IAU_EARTH_FRAME)?,
almanac.frame_info(IAU_EARTH_FRAME)?,
);

// We iterate over the trajectory, grabbing a state every two minutes.
Expand Down
4 changes: 2 additions & 2 deletions examples/03_geo_analysis/drift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn main() -> Result<(), Box<dyn Error>> {
// This allows the frame to include the gravitational parameters and the shape of the Earth,
// defined as a tri-axial ellipoid. Note that this shape can be changed manually or in the Almanac
// by loading a different set of planetary constants.
let earth_j2000 = almanac.frame_from_uid(EARTH_J2000)?;
let earth_j2000 = almanac.frame_info(EARTH_J2000)?;

// Placing this GEO bird just above Colorado.
// In theory, the eccentricity is zero, but in practice, it's about 1e-5 to 1e-6 at best.
Expand Down Expand Up @@ -88,7 +88,7 @@ fn main() -> Result<(), Box<dyn Error>> {
// The harmonics must be computed in the body fixed frame.
// We're using the long term prediction of the Earth centered Earth fixed frame, IAU Earth.
let harmonics_21x21 = Harmonics::from_stor(
almanac.frame_from_uid(IAU_EARTH_FRAME)?,
almanac.frame_info(IAU_EARTH_FRAME)?,
HarmonicsMem::from_cof(&jgm3_meta.uri, 21, 21, true).unwrap(),
);

Expand Down
4 changes: 2 additions & 2 deletions examples/03_geo_analysis/raise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn main() -> Result<(), Box<dyn Error>> {
// references to many functions.
let almanac = Arc::new(MetaAlmanac::latest().map_err(Box::new)?);
// Fetch the EME2000 frame from the Almabac
let eme2k = almanac.frame_from_uid(EARTH_J2000).unwrap();
let eme2k = almanac.frame_info(EARTH_J2000).unwrap();
// Define the orbit epoch
let epoch = Epoch::from_gregorian_utc_hms(2024, 2, 29, 12, 13, 14);

Expand Down Expand Up @@ -95,7 +95,7 @@ fn main() -> Result<(), Box<dyn Error>> {
// The harmonics must be computed in the body fixed frame.
// We're using the long term prediction of the Earth centered Earth fixed frame, IAU Earth.
let harmonics = Harmonics::from_stor(
almanac.frame_from_uid(IAU_EARTH_FRAME)?,
almanac.frame_info(IAU_EARTH_FRAME)?,
HarmonicsMem::from_cof(&jgm3_meta.uri, 8, 8, true).unwrap(),
);

Expand Down
4 changes: 2 additions & 2 deletions examples/03_geo_analysis/stationkeeping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let epoch = Epoch::from_gregorian_utc_hms(2024, 2, 29, 12, 13, 14);

// Define the GEO orbit, and we're just going to maintain it very tightly.
let earth_j2000 = almanac.frame_from_uid(EARTH_J2000)?;
let earth_j2000 = almanac.frame_info(EARTH_J2000)?;
let orbit = Orbit::try_keplerian(42164.0, 1e-5, 0., 163.0, 75.0, 0.0, epoch, earth_j2000)?;
println!("{orbit:x}");

Expand Down Expand Up @@ -71,7 +71,7 @@ fn main() -> Result<(), Box<dyn Error>> {
jgm3_meta.process(true)?;

let harmonics = Harmonics::from_stor(
almanac.frame_from_uid(IAU_EARTH_FRAME)?,
almanac.frame_info(IAU_EARTH_FRAME)?,
HarmonicsMem::from_cof(&jgm3_meta.uri, 8, 8, true)?,
);
orbital_dyn.accel_models.push(harmonics);
Expand Down
4 changes: 2 additions & 2 deletions examples/04_lro_od/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let meta = data_folder.join("lro-dynamics.dhall");

// Load this ephem in the general Almanac we're using for this analysis.
let mut almanac = MetaAlmanac::new(meta.to_string_lossy().to_string())
let mut almanac = MetaAlmanac::new(meta.to_string_lossy().as_ref())
.map_err(Box::new)?
.process(true)
.map_err(Box::new)?;
Expand Down Expand Up @@ -126,7 +126,7 @@ fn main() -> Result<(), Box<dyn Error>> {
// We're using the long term prediction of the Moon principal axes frame.
let moon_pa_frame = MOON_PA_FRAME.with_orient(31008);
let sph_harmonics = Harmonics::from_stor(
almanac.frame_from_uid(moon_pa_frame)?,
almanac.frame_info(moon_pa_frame)?,
HarmonicsMem::from_shadr(&jggrx_meta.uri, 80, 80, true)?,
);

Expand Down
10 changes: 5 additions & 5 deletions examples/05_cislunar_spacecraft_link_od/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ fn main() -> Result<(), Box<dyn Error>> {
.unwrap(),
);

let eme2k = almanac.frame_from_uid(EARTH_J2000).unwrap();
let moon_iau = almanac.frame_from_uid(IAU_MOON_FRAME).unwrap();
let eme2k = almanac.frame_info(EARTH_J2000).unwrap();
let moon_iau = almanac.frame_info(IAU_MOON_FRAME).unwrap();

let epoch = Epoch::from_gregorian_tai(2021, 5, 29, 19, 51, 16, 852_000);
let nrho = Orbit::cartesian(
Expand Down Expand Up @@ -231,7 +231,7 @@ fn main() -> Result<(), Box<dyn Error>> {

od_sol
.to_parquet(
out.join(format!("05_caps_interlink_od_sol.pq")),
out.join("05_caps_interlink_od_sol.pq"),
ExportCfg::default(),
)
.unwrap();
Expand All @@ -241,7 +241,7 @@ fn main() -> Result<(), Box<dyn Error>> {
od_traj
.ric_diff_to_parquet(
&llo_traj,
out.join(format!("05_caps_interlink_llo_est_error.pq")),
out.join("05_caps_interlink_llo_est_error.pq"),
ExportCfg::default(),
)
.unwrap();
Expand All @@ -266,7 +266,7 @@ fn main() -> Result<(), Box<dyn Error>> {

rvr_sol
.to_parquet(
out.join(format!("05_caps_interlink_resid_v_ref.pq")),
out.join("05_caps_interlink_resid_v_ref.pq"),
ExportCfg::default(),
)
.unwrap();
Expand Down
6 changes: 3 additions & 3 deletions src/cosmic/eclipse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ impl EclipseLocator {
/// Creates a new typical eclipse locator.
/// The light source is the Sun, and the shadow bodies are the Earth and the Moon.
pub fn cislunar(almanac: Arc<Almanac>) -> Self {
let eme2k = almanac.frame_from_uid(EARTH_J2000).unwrap();
let moon_j2k = almanac.frame_from_uid(MOON_J2000).unwrap();
let eme2k = almanac.frame_info(EARTH_J2000).unwrap();
let moon_j2k = almanac.frame_info(MOON_J2000).unwrap();
Self {
light_source: almanac.frame_from_uid(SUN_J2000).unwrap(),
light_source: almanac.frame_info(SUN_J2000).unwrap(),
shadow_bodies: vec![eme2k, moon_j2k],
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cosmic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ where
/// Returns strictly the state vector without any STM, if set.
fn to_state_vector(&self) -> OVector<f64, Self::Size> {
OVector::<f64, Self::Size>::from_iterator(
self.to_vector().iter().copied().take(Self::Size::USIZE),
self.to_vector().iter().copied().take(Self::Size::DIM),
)
}

Expand Down
1 change: 1 addition & 0 deletions src/cosmic/orbitdual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use anise::astro::orbit::ECC_EPSILON;
use anise::astro::PhysicsResult;
use anise::prelude::{Frame, Orbit};
use log::{debug, error, warn};
use snafu::ResultExt;

use super::AstroError;
Expand Down
4 changes: 2 additions & 2 deletions src/dynamics/drag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl Drag {
r0: 700_000.0,
ref_alt_m: 88_667.0,
},
drag_frame: almanac.frame_from_uid(IAU_EARTH_FRAME).context({
drag_frame: almanac.frame_info(IAU_EARTH_FRAME).context({
DynamicsPlanetarySnafu {
action: "planetary data from third body not loaded",
}
Expand All @@ -134,7 +134,7 @@ impl Drag {
density: AtmDensity::StdAtm {
max_alt_m: 1_000_000.0,
},
drag_frame: almanac.frame_from_uid(IAU_EARTH_FRAME).context({
drag_frame: almanac.frame_info(IAU_EARTH_FRAME).context({
DynamicsPlanetarySnafu {
action: "planetary data from third body not loaded",
}
Expand Down
1 change: 1 addition & 0 deletions src/dynamics/guidance/ruggiero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

use anise::prelude::Almanac;
use log::debug;
use serde::{Deserialize, Serialize};
use snafu::ResultExt;

Expand Down
4 changes: 2 additions & 2 deletions src/dynamics/orbital.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ impl AccelModel for PointMasses {
}

let third_body_frame = almanac
.frame_from_uid(osc.frame.with_ephem(third_body))
.frame_info(osc.frame.with_ephem(third_body))
.context(DynamicsPlanetarySnafu {
action: "planetary data from third body not loaded",
})?;
Expand Down Expand Up @@ -257,7 +257,7 @@ impl AccelModel for PointMasses {
}

let third_body_frame = almanac
.frame_from_uid(osc.frame.with_ephem(third_body))
.frame_info(osc.frame.with_ephem(third_body))
.context(DynamicsPlanetarySnafu {
action: "planetary data from third body not loaded",
})?;
Expand Down
4 changes: 2 additions & 2 deletions src/dynamics/solarpressure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ impl SolarPressure {
almanac: Arc<Almanac>,
) -> Result<Self, DynamicsError> {
let e_loc = EclipseLocator {
light_source: almanac.frame_from_uid(SUN_J2000).context({
light_source: almanac.frame_info(SUN_J2000).context({
DynamicsPlanetarySnafu {
action: "planetary data from third body not loaded",
}
})?,
shadow_bodies: shadow_bodies
.iter()
.filter_map(|object| match almanac.frame_from_uid(object) {
.filter_map(|object| match almanac.frame_info(object) {
Ok(loaded_obj) => Some(loaded_obj),
Err(e) => {
warn!("when initializing SRP model for {object}, {e}");
Expand Down
1 change: 1 addition & 0 deletions src/dynamics/spacecraft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

use anise::prelude::Almanac;
use log::{error, warn};
use snafu::ResultExt;

use super::guidance::{ra_dec_from_unit_vector, GuidanceError, GuidanceLaw};
Expand Down
1 change: 1 addition & 0 deletions src/io/gravity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use crate::linalg::DMatrix;
use crate::NyxError;
use flate2::read::GzDecoder;
use log::{info, warn};
use std::fs::File;
use std::io::prelude::*;
use std::str::FromStr;
Expand Down
2 changes: 1 addition & 1 deletion src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
use crate::errors::NyxError;
use crate::md::StateParameter;
use crate::time::Epoch;

use arrow::error::ArrowError;
use log::debug;
use parquet::errors::ParquetError;
use snafu::prelude::*;
pub(crate) mod watermark;
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Refer to [nyxspace.com](https://nyxspace.com) for a user guide, a show case, the
// Allow confusable identifiers, as the code tries to use the literature's notation where possible.
#![allow(confusable_idents)]

#[macro_use]
extern crate log;

/// Provides all the propagators / integrators available in `nyx`.
Expand Down
3 changes: 2 additions & 1 deletion src/mc/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

use log::{info, warn};
use std::collections::HashMap;
use std::error::Error;
use std::fs::File;
Expand Down Expand Up @@ -105,7 +106,7 @@ where
Err(e) => match value_if_run_failed {
Some(val) => report.push(val),
None => {
warn!("run #{}: {}, skipping {} in report", run.index, e, param)
info!("run #{}: {}, skipping {} in report", run.index, e, param)
}
},
}
Expand Down
1 change: 1 addition & 0 deletions src/md/events/details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

use anise::almanac::Almanac;
use log::{debug, warn};

use crate::errors::EventError;
use crate::linalg::allocator::Allocator;
Expand Down
1 change: 1 addition & 0 deletions src/md/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

pub mod details;
use log::warn;
pub mod evaluators;
pub mod search;
use super::StateParameter;
Expand Down
1 change: 1 addition & 0 deletions src/md/events/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use crate::md::prelude::{Interpolatable, Traj};
use crate::md::EventEvaluator;
use crate::time::{Duration, Epoch, TimeSeries, Unit};
use anise::almanac::Almanac;
use log::{debug, error, info, warn};
use rayon::prelude::*;
use snafu::ResultExt;
use std::iter::Iterator;
Expand Down
4 changes: 2 additions & 2 deletions src/md/opti/multipleshooting/altitude_heuristic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

use snafu::ResultExt;

use super::ctrlnodes::Node;
use super::multishoot::MultipleShooting;
pub use super::CostFunction;
Expand All @@ -28,6 +26,8 @@ use super::{
use crate::errors::TargetingError;
use crate::md::{prelude::*, PropSnafu};
use crate::{Orbit, Spacecraft};
use log::error;
use snafu::ResultExt;

impl<'a> MultipleShooting<'a, Node, 3, 3> {
/// Builds a multiple shooting structure assuming that the optimal trajectory is near a linear
Expand Down
1 change: 1 addition & 0 deletions src/md/opti/multipleshooting/equidistant_heuristic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub use super::CostFunction;
use crate::errors::TargetingError;
use crate::md::prelude::*;
use crate::{Orbit, Spacecraft};
use log::error;

impl<'a> MultipleShooting<'a, Node, 3, 3> {
/// Builds a multiple shooting structure assuming that the optimal trajectory is a straight line
Expand Down
1 change: 1 addition & 0 deletions src/md/opti/multipleshooting/multishoot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

use log::info;
use snafu::ResultExt;

pub use super::CostFunction;
Expand Down
1 change: 1 addition & 0 deletions src/md/opti/raphson_finite_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub use crate::md::{Variable, Vary};
use crate::polyfit::CommonPolynomial;
use crate::pseudo_inverse;
use hifitime::TimeUnits;
use log::{debug, error, info};
use rayon::prelude::*;
use snafu::{ensure, ResultExt};
#[cfg(not(target_arch = "wasm32"))]
Expand Down
Loading