Skip to content

Commit

Permalink
Merge pull request #167 from nyx-space/164-python-documentation-noteb…
Browse files Browse the repository at this point in the history
…ook-for-orbit-and-keplerian-elements-and-aer-computations

Add python notebooks for orbit and keplerian elements and aer computations
  • Loading branch information
ChristopherRabotin committed Jan 15, 2024
2 parents c1129bf + 610bd77 commit 489cd4e
Show file tree
Hide file tree
Showing 23 changed files with 1,826 additions and 151 deletions.
1 change: 0 additions & 1 deletion anise-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ description = "A command line interface for ANISE"
anise = { workspace = true }
clap = { version = "4", features = ["derive"] }
pretty_env_logger = { workspace = true }
tabled = { workspace = true }
bytes = { workspace = true }
memmap2 = { workspace = true }
snafu = { workspace = true }
Expand Down
24 changes: 0 additions & 24 deletions anise-cli/src/inspect.rs

This file was deleted.

61 changes: 3 additions & 58 deletions anise-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ use std::io;
use clap::Parser;
use log::info;
use snafu::prelude::*;
use tabled::{settings::Style, Table};
use zerocopy::FromBytes;

use anise::file2heap;
use anise::naif::daf::{
file_record::FileRecordError, DAFError, FileRecord, NAIFRecord, NAIFSummaryRecord,
};
use anise::naif::daf::{file_record::FileRecordError, DAFError, FileRecord, NAIFRecord};
use anise::naif::kpl::parser::{convert_fk, convert_tpc};
use anise::prelude::*;
use anise::structure::dataset::{DataSetError, DataSetType};
Expand All @@ -21,9 +18,6 @@ use anise::structure::{EulerParameterDataSet, PlanetaryDataSet, SpacecraftDataSe
mod args;
use args::{Actions, Args};

mod inspect;
use inspect::{BpcRow, SpkRow};

const LOG_VAR: &str = "ANISE_LOG";

#[derive(Debug, Snafu)]
Expand Down Expand Up @@ -139,31 +133,7 @@ fn main() -> Result<(), CliErrors> {
} else {
println!("(File has no comments)");
}
// Build the rows of the table
let mut rows = Vec::new();

for (sno, summary) in pck.data_summaries().unwrap().iter().enumerate() {
let name_rcrd = pck.name_record().unwrap();
let name =
name_rcrd.nth_name(sno, pck.file_record().unwrap().summary_size());
if summary.is_empty() {
continue;
}
rows.push(BpcRow {
name: name.to_string(),
start_epoch: format!("{:E}", summary.start_epoch()),
end_epoch: format!("{:E}", summary.end_epoch()),
duration: summary.end_epoch() - summary.start_epoch(),
interpolation_kind: summary.data_type().unwrap().to_string(),
frame: format!("{}", summary.frame_id),
inertial_frame: format!("{}", summary.inertial_frame_id),
});
}

let mut tbl = Table::new(rows);
tbl.with(Style::modern());
println!("{tbl}");

println!("{}", pck.describe());
Ok(())
}
"SPK" => {
Expand All @@ -176,32 +146,7 @@ fn main() -> Result<(), CliErrors> {
} else {
println!("(File has no comments)");
}
// Build the rows of the table
let mut rows = Vec::new();

for (sno, summary) in spk.data_summaries().unwrap().iter().enumerate() {
let name_rcrd = spk.name_record().unwrap();
let name =
name_rcrd.nth_name(sno, spk.file_record().unwrap().summary_size());
if summary.is_empty() {
continue;
}

rows.push(SpkRow {
name: name.to_string(),
center: summary.center_frame_uid().to_string(),
start_epoch: format!("{:E}", summary.start_epoch()),
end_epoch: format!("{:E}", summary.end_epoch()),
duration: summary.end_epoch() - summary.start_epoch(),
interpolation_kind: summary.data_type().unwrap().to_string(),
target: summary.target_frame_uid().to_string(),
});
}

let mut tbl = Table::new(rows);
tbl.with(Style::modern());
println!("{tbl}");

println!("{}", spk.describe());
Ok(())
}
fileid => Err(CliErrors::ArgumentError {
Expand Down
4 changes: 2 additions & 2 deletions anise-gui/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,14 @@ impl eframe::App for UiApp {
row.col(|ui| {
ui.label(match opt_name {
Some(name) => format!("{name}"),
None => format!("Unset"),
None => "Unset".to_string(),
});
});

row.col(|ui| {
ui.label(match opt_id {
Some(id) => format!("{id}"),
None => format!("Unset"),
None => "Unset".to_string(),
});
});

Expand Down
8 changes: 6 additions & 2 deletions anise-py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ ANISE stands validated against the traditional SPICE toolkit, ensuring accuracy

## Tutorials

- [01 - Querying SPK files](./notebooks/01%20-%20Tutorial%20on%20querying%20SPK%20files.ipynb)
- [02 - Loading remote and local files (MetaAlmanac)](./notebooks/02%20-%20Tutorial%20on%20loading%20remote%20SPICE%20and%20ANISE%20files%20(meta%20almanac).ipynb)
- [01 - Querying SPK files](./notebooks/Tutorial%2001%20-%20Querying%20SPK%20files.ipynb)
- [02 - Loading remote and local files (MetaAlmanac)](./notebooks/Tutorial%2002%20-%20Loading%20remote%20SPICE%20and%20ANISE%20files%20(meta%20almanac).ipynb)
- [03 - Defining and working with the orbit structure](./notebooks/Tutorial%2003%20-%20Defining%20and%20working%20with%20the%20Orbit%20structure.ipynb)
- [04 - Computing azimuth, elevation, and range data (AER)](./notebooks/Tutorial%2004%20-%20Computing%20Azimuth%20Elevation%20and%20Range%20data.ipynb)

Note: The tutorials can be viewed in read-only form on [the Github repo](https://github.com/nyx-space/anise/tree/master/anise-py/notebooks).

## Usage

Expand Down
Loading

0 comments on commit 489cd4e

Please sign in to comment.