Skip to content

Commit

Permalink
~= Change to mixed Rust/Python layout.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinohs committed Mar 13, 2024
1 parent ee03c19 commit 4ceba42
Show file tree
Hide file tree
Showing 14 changed files with 1,473 additions and 755 deletions.
272 changes: 142 additions & 130 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
name = "constellation-networkx"
name = "cstl_ntwkx"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "constellation_networkx"
name = "cstl_ntwkx"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.19.0", features = ["chrono"] }
pyo3 = { version = "0.20.3", features = ["chrono"] }
nyx-space = "1.1.2"
once_cell = "1.19.0"
rayon = "1.8.1"
Expand Down
619 changes: 619 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Hello
25 changes: 23 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,36 @@ requires = ["maturin>=1.4,<2.0"]
build-backend = "maturin"

[project]
name = "constellation-networkx"
dependencies = ["networkx==3.2.1"]
name = "cstl_ntwkx"
description = "Encode Walker constellations into networkx graphs suitable for Reinforcement Learning."
readme = "README.rst"
requires-python = ">=3.8"
license = { file = "LICENSE" }
keywords = [
"walker-star",
"walker-delta",
"walker constellations",
"constellations",
"reinforcement learning",
"constellation to networkx",
"cstl to networkx",
"encode constellations",
]
authors = [{ name = "Robin Ohs", email = "[email protected]" }]
maintainers = [{ name = "Robin Ohs", email = "[email protected]" }]
classifiers = [
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = ["networkx==3.2.1"]
dynamic = ["version"]

[project.urls]
homepage = "https://depend.cs.uni-saarland.de/"
documentation = "https://github.com/robinohs/constellation_networkx"
repository = "https://github.com/robinohs/constellation_networkx"

[tool.maturin]
features = ["pyo3/extension-module"]
python-source = "python"
5 changes: 5 additions & 0 deletions python/cstl_ntwkx/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .cstl_ntwkx import *

__doc__ = cstl_ntwkx.__doc__
if hasattr(cstl_ntwkx, "__all__"):
__all__ = cstl_ntwkx.__all__
File renamed without changes.
2 changes: 2 additions & 0 deletions python/cstl_ntwkx/plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test():
print("TEST bestanden")
2 changes: 2 additions & 0 deletions python/cstl_ntwkx/plot.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test() -> any:
pass
Empty file added python/cstl_ntwkx/py.typed
Empty file.
12 changes: 6 additions & 6 deletions src/groundstation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ impl Groundstation {
pub fn is_visible(&self, sat: &Satellite) -> bool {
let (elevation, _, _) = self.groundstation.elevation_of(&sat.get_orbit());
let elevation: Angle = Angle::new::<degree>(elevation);
println!(
"Elevation between GS({}) and Sat({}) is {}",
self.get_id(),
sat.get_id(),
elevation.get::<degree>()
);
// println!(
// "Elevation between GS({}) and Sat({}) is {}",
// self.get_id(),
// sat.get_id(),
// elevation.get::<degree>()
// );
elevation >= self.min_elevation
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn project_3d_positions<'a>(

/// A Python module implemented in Rust.
#[pymodule]
fn constellation_networkx(_py: Python, m: &PyModule) -> PyResult<()> {
fn cstl_ntwkx(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_class::<ConstellationType>()?;
m.add_class::<Constellation>()?;
m.add_function(wrap_pyfunction!(create_constellation, m)?)?;
Expand Down
3 changes: 1 addition & 2 deletions src/satellite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ impl Node for Satellite {
}

fn get_lat(&self) -> Angle {
let lat = self.orbit.geodetic_latitude();
Angle::new::<degree>(lat)
Angle::new::<degree>(self.orbit.geodetic_latitude())
}

fn get_lon(&self) -> Angle {
Expand Down
Loading

0 comments on commit 4ceba42

Please sign in to comment.