From d5582fca58ab0bfdbe83cc27a380f49b9969599b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Thu, 17 Oct 2024 18:40:09 +0200 Subject: [PATCH 01/12] feat(lib): add option to provide TX and RX visibility --- differt-core/src/rt/graph.rs | 124 ++++++++++++++++++++++++++--------- 1 file changed, 94 insertions(+), 30 deletions(-) diff --git a/differt-core/src/rt/graph.rs b/differt-core/src/rt/graph.rs index ca5086fd..4880d500 100644 --- a/differt-core/src/rt/graph.rs +++ b/differt-core/src/rt/graph.rs @@ -3,8 +3,8 @@ use std::collections::VecDeque; use numpy::{ - IntoPyArray, PyArray1, PyArray2, PyReadonlyArray2, - ndarray::{Array2, ArrayView2, Axis, parallel::prelude::*}, + IntoPyArray, PyArray1, PyArray2, PyReadonlyArray1, PyReadonlyArray2, + ndarray::{Array2, ArrayView1, ArrayView2, Axis, parallel::prelude::*}, }; use pyo3::{prelude::*, types::PyType}; @@ -123,7 +123,8 @@ pub mod complete { #[pyclass] #[derive(Clone, Debug)] pub struct CompleteGraph { - /// Number of nodes. + #[pyo3(get)] + /// The number of nodes. pub(crate) num_nodes: usize, } @@ -589,10 +590,65 @@ pub mod directed { Self { edges_list } } + + #[inline] + pub fn insert_from_and_to_nodes( + &mut self, + direct_path: bool, + from_adjacency: Option<&ArrayView1>, + to_adjacency: Option<&ArrayView1>, + ) -> (NodeId, NodeId) { + let from = self.num_nodes(); + let to = from + 1; + + if let Some(to_adjacency) = to_adjacency { + self.edges_list + .iter_mut() + .zip(to_adjacency.into_iter()) + .for_each(|(edges, &is_adjacent)| { + if is_adjacent { + edges.push(to) + } + }); + } else { + // Every node is connected to `to`. + self.edges_list.iter_mut().for_each(|edges| edges.push(to)); + } + + let mut from_edges: Vec = if let Some(from_adjacency) = from_adjacency { + (0..from) + .into_iter() + .zip(from_adjacency.into_iter()) + .filter_map( + |(node_id, &is_adjacent)| if is_adjacent { Some(node_id) } else { None }, + ) + .collect() + } else { + // `from` is connected to every node except itself + (0..from).collect() + }; + + if direct_path { + from_edges.push(to); + } + + self.edges_list.push(from_edges); + + // `to` is not connected to any node + self.edges_list.push(vec![]); + + (from, to) + } } #[pymethods] impl DiGraph { + /// int: The number of nodes. + #[getter] + fn num_nodes(&self) -> usize { + self.edges_list.len() + } + /// Create an edgeless directed graph with ``num_nodes`` nodes. /// /// This is equivalent to creating a directed graph from @@ -617,7 +673,7 @@ pub mod directed { /// connected to node ``j``. /// /// Args: - /// adjacency_matrix (``Bool[ndarray, "num_nodes num_nodes"]``): + /// adjacency_matrix (:class:`Bool[ndarray, "num_nodes num_nodes"]`): /// The adjacency matrix. /// /// Returns: @@ -652,7 +708,8 @@ pub mod directed { /// Insert two additional nodes in the graph: ``from_`` and ``to``. /// - /// The nodes satisfy the following conditions: + /// Unless specific adjacency information is provided, + /// the nodes satisfy the following conditions: /// /// - ``from_`` is connected to every other node in the graph; /// - and ``to`` is an `endpoint`, where every other node is connected @@ -664,35 +721,42 @@ pub mod directed { /// Args: /// direct_path (bool): Whether to create a direction connection /// between ``from_`` and ``to`` nodes. + /// from_adjacency (:class:`Bool[ndarray, "num_nodes"]`): + /// An optional array indicating nodes that should be + /// connected from ``from_`` node. + /// + /// If not specified, all nodes are connected. + /// to_adjacency (:class:`Bool[ndarray, "num_nodes"]`): + /// An optional array indicating nodes that should be + /// connected to ``to_`` node. + /// + /// If not specified, all nodes are connected. /// /// Returns: /// tuple[int, int]: /// The indices of the two added nodes in the graph. - #[pyo3(signature = (*, direct_path=true))] - #[pyo3(text_signature = "(self, *, direct_path=True)")] - pub fn insert_from_and_to_nodes(&mut self, direct_path: bool) -> (NodeId, NodeId) { - let from = self.edges_list.len(); - let to = from + 1; - - // Every node is connected to `to`. - self.edges_list.iter_mut().for_each(|edges| edges.push(to)); - - // `from` is connected to every node except itself - let mut from_edges: Vec = (0..from).collect(); - - if direct_path { - from_edges.push(to); - } - - self.edges_list.push(from_edges); - - // `to` is not connected to any node - self.edges_list.push(vec![]); - - self.get_adjacent_nodes(from); - self.get_adjacent_nodes(to); - - (from, to) + #[pyo3(signature = (*, direct_path=true, from_adjacency=None, to_adjacency=None))] + #[pyo3(name = "insert_from_and_to_nodes")] + #[pyo3( + text_signature = "(self, *, direct_path=True, from_adjacency=None, to_adjacency=None)" + )] + pub fn py_insert_from_and_to_nodes( + &mut self, + direct_path: bool, + from_adjacency: Option>, + to_adjacency: Option>, + ) -> (NodeId, NodeId) { + self.insert_from_and_to_nodes( + direct_path, + from_adjacency + .as_ref() + .map(|py_arr| py_arr.as_array()) + .as_ref(), + to_adjacency + .as_ref() + .map(|py_arr| py_arr.as_array()) + .as_ref(), + ) } /// Disconnect one or more nodes from the graph. From ef7cdc0104c2c02d11856560177d906fd2425e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Thu, 17 Oct 2024 22:45:55 +0200 Subject: [PATCH 02/12] chore(tests): improve coverage --- Cargo.lock | 10 ++++++++++ differt-core/Cargo.toml | 1 + differt-core/src/rt/graph.rs | 38 ++++++++++++++++++++++++++++++------ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ce56c26..aa184880 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -253,6 +253,7 @@ dependencies = [ "quick-xml", "rstest", "serde", + "testing_logger", ] [[package]] @@ -1156,6 +1157,15 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "testing_logger" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d92b727cb45d33ae956f7f46b966b25f1bc712092aeef9dba5ac798fc89f720" +dependencies = [ + "log", +] + [[package]] name = "tinytemplate" version = "1.2.1" diff --git a/differt-core/Cargo.toml b/differt-core/Cargo.toml index 9f198189..885c7066 100644 --- a/differt-core/Cargo.toml +++ b/differt-core/Cargo.toml @@ -19,6 +19,7 @@ serde = {version = "1.0.197", features = ["derive"]} criterion = "0.5.1" pyo3 = {version = "0.21", features = ["auto-initialize"]} rstest = "0.18.2" +testing_logger = "0.1.1" [features] extension-module = ["pyo3/extension-module"] diff --git a/differt-core/src/rt/graph.rs b/differt-core/src/rt/graph.rs index 4880d500..64ba988a 100644 --- a/differt-core/src/rt/graph.rs +++ b/differt-core/src/rt/graph.rs @@ -128,6 +128,7 @@ pub mod complete { pub(crate) num_nodes: usize, } + #[cfg(not(tarpaulin_include))] #[pymethods] impl CompleteGraph { #[new] @@ -486,6 +487,7 @@ pub mod complete { } } + #[cfg(not(tarpaulin_include))] #[pymethods] impl AllPathsFromCompleteGraphIter { fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { @@ -528,6 +530,7 @@ pub mod complete { impl ExactSizeIterator for AllPathsFromCompleteGraphChunksIter {} + #[cfg(not(tarpaulin_include))] #[pymethods] impl AllPathsFromCompleteGraphChunksIter { fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { @@ -641,6 +644,7 @@ pub mod directed { } } + #[cfg(not(tarpaulin_include))] #[pymethods] impl DiGraph { /// int: The number of nodes. @@ -999,6 +1003,7 @@ pub mod directed { } } + #[cfg(not(tarpaulin_include))] #[pymethods] impl AllPathsFromDiGraphIter { fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { @@ -1030,6 +1035,7 @@ pub mod directed { } } + #[cfg(not(tarpaulin_include))] #[pymethods] impl AllPathsFromDiGraphChunksIter { fn __iter__(slf: PyRef<'_, Self>) -> PyRef<'_, Self> { @@ -1145,6 +1151,7 @@ mod tests { #[case] to: usize, ) { let iter = CompleteGraph::new(num_nodes).all_paths(from, to, depth, false); + assert_eq!(iter.depth().unwrap(), depth); let iter_cloned = iter.clone(); let got = iter.len(); let expected = iter.count(); @@ -1182,12 +1189,31 @@ mod tests { #[case] to: usize, #[case] expected: usize, ) { - let iter = CompleteGraph::new(num_nodes).all_paths(from, to, depth, false); + let iter = CompleteGraph::new(num_nodes).all_paths(from, to, depth, true); + assert_eq!(iter.depth().unwrap(), depth + 2); let got = iter.count(); assert_eq!(got, expected); } + #[test] + fn test_complete_graph_overflow() { + testing_logger::setup(); + CompleteGraph::new(1_000_000_000).all_paths(0, 1, 10, true); + testing_logger::validate(|captured_logs| { + assert_eq!(captured_logs.len(), 1); + assert_eq!( + captured_logs[0].body, + format!( + "OverflowError: overflow occurred when computing the total number of paths, \ + defaulting to maximum value {}.", + usize::MAX + ) + ); + assert_eq!(captured_logs[0].level, log::Level::Warn); + }); + } + #[test] #[should_panic(expected = "adjacency matrix must be square")] fn test_di_graph_from_nonsquare_matrix() { @@ -1236,7 +1262,7 @@ mod tests { #[case] expected: Array2, ) { let mut graph: DiGraph = CompleteGraph::new(num_nodes).into(); - let (from, to) = graph.insert_from_and_to_nodes(true); + let (from, to) = graph.insert_from_and_to_nodes(true, None, None); let got = graph.all_paths(from, to, depth + 2, false).collect_array(); assert_eq!(got, expected); @@ -1247,7 +1273,7 @@ mod tests { #[case(3, 3)] fn test_empty_di_graph_returns_all_paths(#[case] num_nodes: usize, #[case] depth: usize) { let mut graph = DiGraph::empty(num_nodes); - let (from, to) = graph.insert_from_and_to_nodes(false); + let (from, to) = graph.insert_from_and_to_nodes(false, None, None); assert_eq!(graph.all_paths(from, to, depth + 2, true).count(), 0); } @@ -1257,7 +1283,7 @@ mod tests { #[case(3, 3)] fn test_di_graph_returns_sorted_paths(#[case] num_nodes: usize, #[case] depth: usize) { let mut graph: DiGraph = CompleteGraph::new(num_nodes).into(); - let (from, to) = graph.insert_from_and_to_nodes(true); + let (from, to) = graph.insert_from_and_to_nodes(true, None, None); let got: Vec<_> = graph.all_paths(from, to, depth + 2, true).collect(); let mut expected = got.clone(); @@ -1272,7 +1298,7 @@ mod tests { #[case(8, 3)] fn test_di_graph_array_chunks_is_iter(#[case] num_nodes: usize, #[case] depth: usize) { let mut graph: DiGraph = CompleteGraph::new(num_nodes).into(); - let (from, to) = graph.insert_from_and_to_nodes(true); + let (from, to) = graph.insert_from_and_to_nodes(true, None, None); let iter = graph.all_paths(from, to, depth + 2, true); let chunks_iter = graph.all_paths_array_chunks(from, to, depth + 2, true, 1); @@ -1288,7 +1314,7 @@ mod tests { ) { let complete_graph = CompleteGraph::new(num_nodes); let mut di_graph: DiGraph = complete_graph.clone().into(); - let (from, to) = di_graph.insert_from_and_to_nodes(true); + let (from, to) = di_graph.insert_from_and_to_nodes(true, None, None); let complete_iter = complete_graph.all_paths(from, to, depth + 2, true); let di_iter = di_graph.all_paths(from, to, depth + 2, true); From 2de77211f8c1ce416c95a3b9a3d4d29763dfc727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Thu, 17 Oct 2024 22:50:08 +0200 Subject: [PATCH 03/12] chore(docs): update pyi --- differt-core/python/differt_core/_lowlevel/rt/graph.pyi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/differt-core/python/differt_core/_lowlevel/rt/graph.pyi b/differt-core/python/differt_core/_lowlevel/rt/graph.pyi index 61bd966e..4aad3e12 100644 --- a/differt-core/python/differt_core/_lowlevel/rt/graph.pyi +++ b/differt-core/python/differt_core/_lowlevel/rt/graph.pyi @@ -4,6 +4,8 @@ import numpy as np from jaxtyping import Bool, UInt class CompleteGraph: + @property + def num_nodes(self) -> int: ... def __init__(self, num_nodes: int) -> None: ... def all_paths( self, @@ -32,6 +34,8 @@ class CompleteGraph: ) -> AllPathsFromCompleteGraphChunksIter: ... class DiGraph: + @property + def num_nodes(self) -> int: ... @classmethod def from_adjacency_matrix( cls, @@ -43,6 +47,8 @@ class DiGraph: self, *, direct_path: bool = True, + from_adjacency: Bool[np.ndarray, " num_nodes"], + to_adjacency: Bool[np.ndarray, " num_nodes"], ) -> tuple[int, int]: ... def disconnect_nodes(self, *nodes: int, fast_mode: bool = True) -> None: ... def all_paths( From 75c885b9d4bffd6bc309b99cf8b422a9adc1d943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Thu, 17 Oct 2024 23:05:55 +0200 Subject: [PATCH 04/12] fix(docs): tests --- differt-core/src/rt/graph.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differt-core/src/rt/graph.rs b/differt-core/src/rt/graph.rs index 64ba988a..1b9ceb37 100644 --- a/differt-core/src/rt/graph.rs +++ b/differt-core/src/rt/graph.rs @@ -1151,7 +1151,7 @@ mod tests { #[case] to: usize, ) { let iter = CompleteGraph::new(num_nodes).all_paths(from, to, depth, false); - assert_eq!(iter.depth().unwrap(), depth); + assert_eq!(iter.depth().unwrap(), depth - 2); let iter_cloned = iter.clone(); let got = iter.len(); let expected = iter.count(); @@ -1190,7 +1190,7 @@ mod tests { #[case] expected: usize, ) { let iter = CompleteGraph::new(num_nodes).all_paths(from, to, depth, true); - assert_eq!(iter.depth().unwrap(), depth + 2); + assert_eq!(iter.depth().unwrap(), depth); let got = iter.count(); assert_eq!(got, expected); From e0217df15c7990d5edd1d16446ba0a881fef99bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Fri, 18 Oct 2024 09:08:05 +0200 Subject: [PATCH 05/12] fix(tests): update benchmarks --- differt-core/benches/benchmarks/graph_iterators.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differt-core/benches/benchmarks/graph_iterators.rs b/differt-core/benches/benchmarks/graph_iterators.rs index 9187aa39..40158f8e 100644 --- a/differt-core/benches/benchmarks/graph_iterators.rs +++ b/differt-core/benches/benchmarks/graph_iterators.rs @@ -46,7 +46,7 @@ fn di_graph_from_complete_graph_all_paths(c: &mut Criterion) { let mut group = c.benchmark_group("di_graph_from_complete_graph_all_paths"); group.throughput(Throughput::Elements(1)); let mut graph: DiGraph = CompleteGraph::new(NUM_NODES).into(); - let (from, to) = graph.insert_from_and_to_nodes(DIRECT_PATH); + let (from, to) = graph.insert_from_and_to_nodes(DIRECT_PATH, None, None); let mut iter = graph .all_paths(from, to, DEPTH, INCLUDE_FROM_AND_TO) @@ -60,7 +60,7 @@ fn di_graph_from_complete_graph_all_paths(c: &mut Criterion) { fn di_graph_from_complete_graph_all_paths_array_chunks(c: &mut Criterion) { let mut group = c.benchmark_group("di_graph_from_complete_graph_all_paths_array_chunks"); let mut graph: DiGraph = CompleteGraph::new(NUM_NODES).into(); - let (from, to) = graph.insert_from_and_to_nodes(DIRECT_PATH); + let (from, to) = graph.insert_from_and_to_nodes(DIRECT_PATH, None, None); for chunk_size in [1, 10, 100, 1000] { group.throughput(Throughput::Elements(chunk_size as u64)); From 2a96f377cfb0b2b3d6aef5ea553d0d4803f631b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Fri, 18 Oct 2024 10:15:11 +0200 Subject: [PATCH 06/12] chore(tests): improve coverage --- differt-core/src/rt/graph.rs | 136 +++++++++++++++++++++++++++++++++-- 1 file changed, 131 insertions(+), 5 deletions(-) diff --git a/differt-core/src/rt/graph.rs b/differt-core/src/rt/graph.rs index 1b9ceb37..fd505f12 100644 --- a/differt-core/src/rt/graph.rs +++ b/differt-core/src/rt/graph.rs @@ -258,7 +258,7 @@ pub mod complete { include_from_and_to: bool, chunk_size: usize, ) -> AllPathsFromCompleteGraphChunksIter { - assert!(chunk_size > 0, "chunk size must be strictly positive"); + assert!(chunk_size > 0, "'chunk_size' must be strictly positive"); AllPathsFromCompleteGraphChunksIter { iter: AllPathsFromCompleteGraphIter::new( self.clone(), @@ -577,9 +577,10 @@ pub mod directed { #[inline] pub fn from_adjacency_matrix(adjacency_matrix: &ArrayView2) -> Self { + #[cfg(not(tarpaulin_include))] debug_assert!( adjacency_matrix.is_square(), - "adjacency matrix must be square" + "'adjacency_matrix' must be square" ); let edges_list = adjacency_matrix .axis_iter(Axis(0)) @@ -605,6 +606,11 @@ pub mod directed { let to = from + 1; if let Some(to_adjacency) = to_adjacency { + #[cfg(not(tarpaulin_include))] + debug_assert!( + to_adjacency.len() == self.num_nodes(), + "'to_adjacency' must have exactly 'num_node' elements" + ); self.edges_list .iter_mut() .zip(to_adjacency.into_iter()) @@ -619,6 +625,11 @@ pub mod directed { } let mut from_edges: Vec = if let Some(from_adjacency) = from_adjacency { + #[cfg(not(tarpaulin_include))] + debug_assert!( + from_adjacency.len() == self.num_nodes(), + "'from_adjacency' must have exactly 'num_node' elements" + ); (0..from) .into_iter() .zip(from_adjacency.into_iter()) @@ -879,7 +890,7 @@ pub mod directed { include_from_and_to: bool, chunk_size: usize, ) -> AllPathsFromDiGraphChunksIter { - assert!(chunk_size > 0, "chunk size must be strictly positive"); + assert!(chunk_size > 0, "'chunk_size' must be strictly positive"); AllPathsFromDiGraphChunksIter { iter: AllPathsFromDiGraphIter::new( self.clone(), @@ -1115,6 +1126,57 @@ mod tests { assert_eq!(got, expected); } + struct FooPathsIter { + num_paths: usize, + depth: usize, + count: usize, + } + + impl FooPathsIter { + fn new(num_paths: usize, depth: usize) -> Self { + Self { + num_paths, + depth, + count: 0, + } + } + } + + impl Iterator for FooPathsIter { + type Item = Vec; + + fn next(&mut self) -> Option { + if self.count < self.num_paths { + self.count += 1; + return Some(vec![0; self.depth]); + } + None + } + } + + impl PathsIterator for FooPathsIter {} + + #[test] + fn test_default_paths_iter() { + let mut iter = FooPathsIter::new(10, 4); + assert_eq!(iter.depth(), None); + + let array = iter.collect_array(); + assert_eq!(array.shape(), &[10, 4]); + + let mut iter = FooPathsIter::new(0, 4); + + let array = iter.collect_array(); + assert_eq!(array.shape(), &[0, 0]); + + let mut iter = FooPathsIter::new(10, 4).into_array_chunks_iter(3); + assert_eq!(iter.next().unwrap().shape(), &[3, 4]); + assert_eq!(iter.next().unwrap().shape(), &[3, 4]); + assert_eq!(iter.next().unwrap().shape(), &[3, 4]); + assert_eq!(iter.next().unwrap().shape(), &[1, 4]); + assert!(iter.next().is_none()); + } + #[rstest] #[case(0, 2, 0, 1)] // One path of depth 2 [0, 1] #[case(0, 2, 0, 0)] // No path of depth 2 (because can't be [0, 0]) @@ -1182,6 +1244,10 @@ mod tests { #[case(0, 2, 0, 1, 1)] // One path of depth 2 #[case(0, 3, 0, 1, 0)] // No path of depth 3 #[case(0, 4, 0, 1, 0)] // No path of depth 4 + #[case(1, 3, 0, 0, 0)] // No path of depth 3 + #[case(2, 3, 0, 0, 1)] // One path of depth 3 + #[case(2, 3, 0, 2, 1)] // One path of depth 3 + #[case(1, 3, 1, 1, 1)] // One path of depth 3 fn test_complete_graph_edge_cases( #[case] num_nodes: usize, #[case] depth: usize, @@ -1199,7 +1265,8 @@ mod tests { #[test] fn test_complete_graph_overflow() { testing_logger::setup(); - CompleteGraph::new(1_000_000_000).all_paths(0, 1, 10, true); + let iter = CompleteGraph::new(1_000_000_000).all_paths(0, 1, 10, true); + assert_eq!(iter.len(), usize::MAX); testing_logger::validate(|captured_logs| { assert_eq!(captured_logs.len(), 1); assert_eq!( @@ -1215,7 +1282,19 @@ mod tests { } #[test] - #[should_panic(expected = "adjacency matrix must be square")] + #[should_panic(expected = "'chunk_size' must be strictly positive")] + fn test_complete_graph_zero_chunk_size() { + CompleteGraph::new(10).all_paths_array_chunks(0, 1, 2, false, 0); + } + + #[test] + #[should_panic(expected = "'chunk_size' must be strictly positive")] + fn test_di_graph_zero_chunk_size() { + DiGraph::from(CompleteGraph::new(10)).all_paths_array_chunks(0, 1, 2, false, 0); + } + + #[test] + #[should_panic(expected = "'adjacency_matrix' must be square")] fn test_di_graph_from_nonsquare_matrix() { let matrix = Array2::default((10, 9)); let _ = DiGraph::from_adjacency_matrix(&matrix.view()); @@ -1230,6 +1309,53 @@ mod tests { assert!(graph.all_paths(0, 0, 0, true).count() == 0); } + #[test] + fn test_di_graph_insert_with_adjacency() { + let graph = DiGraph::from(CompleteGraph::new(5)); + + let full_counts = { + let mut cloned = graph.clone(); + let (from, to) = cloned.insert_from_and_to_nodes(false, None, None); + cloned.all_paths(from, to, 3, false).count() + }; + + let from_counts = { + let mut cloned = graph.clone(); + let from_adjacency = ndarray::arr1(&[false, false, false, true, true]); + let (from, to) = + cloned.insert_from_and_to_nodes(false, Some(&from_adjacency.view()), None); + cloned.all_paths(from, to, 3, false).count() + }; + + assert_eq!(full_counts * 2, from_counts * 5); + + let to_counts = { + let mut cloned = graph.clone(); + let to_adjacency = ndarray::arr1(&[false, true, false, true, true]); + let (from, to) = + cloned.insert_from_and_to_nodes(false, None, Some(&to_adjacency.view())); + cloned.all_paths(from, to, 3, false).count() + }; + + assert_eq!(full_counts * 3, to_counts * 5); + } + + #[test] + #[should_panic(expected = "'from_adjacency' must have exactly 'num_node' elements")] + fn test_di_graph_insert_with_from_adjacency() { + let mut graph = DiGraph::from(CompleteGraph::new(5)); + let from_adjacency = ndarray::arr1(&[false, false, false, true]); + graph.insert_from_and_to_nodes(false, Some(&from_adjacency.view()), None); + } + + #[test] + #[should_panic(expected = "'to_adjacency' must have exactly 'num_node' elements")] + fn test_di_graph_insert_with_to_adjacency() { + let mut graph = DiGraph::from(CompleteGraph::new(5)); + let to_adjacency = ndarray::arr1(&[false, false, false, true, true, false]); + graph.insert_from_and_to_nodes(false, None, Some(&to_adjacency.view())); + } + #[rstest] #[case(9, 1, array![[0], [1], [2], [3], [4], [5], [6], [7], [8]])] #[case(3, 1, array![[0], [1], [2]])] From 81671951f059eec6b6aabdca2ee61a0be0185e29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Fri, 18 Oct 2024 13:49:03 +0200 Subject: [PATCH 07/12] feat(lib): add `count` methods to iterators --- .../differt_core/_lowlevel/rt/graph.pyi | 4 + differt-core/src/rt/graph.rs | 58 + .../notebooks/advanced_path_tracing.ipynb | 6776 ++++++++++++++++- 3 files changed, 6798 insertions(+), 40 deletions(-) diff --git a/differt-core/python/differt_core/_lowlevel/rt/graph.pyi b/differt-core/python/differt_core/_lowlevel/rt/graph.pyi index 4aad3e12..40446530 100644 --- a/differt-core/python/differt_core/_lowlevel/rt/graph.pyi +++ b/differt-core/python/differt_core/_lowlevel/rt/graph.pyi @@ -81,16 +81,20 @@ class AllPathsFromCompleteGraphIter(Iterator, Sized): def __iter__(self) -> AllPathsFromCompleteGraphIter: ... def __next__(self) -> UInt[np.ndarray, " path_depth"]: ... def __len__(self) -> int: ... + def count(self) -> int: ... class AllPathsFromCompleteGraphChunksIter(Iterator, Sized): def __iter__(self) -> AllPathsFromCompleteGraphChunksIter: ... def __next__(self) -> UInt[np.ndarray, "chunk_size path_depth"]: ... def __len__(self) -> int: ... + def count(self) -> int: ... class AllPathsFromDiGraphIter(Iterator): def __iter__(self) -> AllPathsFromDiGraphIter: ... def __next__(self) -> UInt[np.ndarray, " path_depth"]: ... + def count(self) -> int: ... class AllPathsFromDiGraphChunksIter(Iterator): def __iter__(self) -> AllPathsFromDiGraphChunksIter: ... def __next__(self) -> UInt[np.ndarray, "chunk_size path_depth"]: ... + def count(self) -> int: ... diff --git a/differt-core/src/rt/graph.rs b/differt-core/src/rt/graph.rs index fd505f12..c7b01a53 100644 --- a/differt-core/src/rt/graph.rs +++ b/differt-core/src/rt/graph.rs @@ -504,6 +504,23 @@ pub mod complete { fn __len__(&self) -> usize { self.len() } + + /// Count the number of elements in this iterator by consuming it. + /// + /// This is much faster that counting the number of elements using Python + /// code. + /// + /// Returns: + /// int: The number of elements that this iterator contains. + /// + /// Warning: + /// This iterator provides :meth:`__len__`, which returns the current + /// remaining length of this iterator, without consuming it, and will + /// also be faster as it does not need to perform any iteration. + #[pyo3(name = "count")] + fn py_count(mut slf: PyRefMut<'_, Self>) -> usize { + slf.by_ref().count() + } } /// An iterator over all paths in a complete graph, @@ -547,6 +564,23 @@ pub mod complete { fn __len__(&self) -> usize { self.len() } + + /// Count the number of elements in this iterator by consuming it. + /// + /// This is much faster that counting the number of elements using Python + /// code. + /// + /// Returns: + /// int: The number of elements that this iterator contains. + /// + /// Warning: + /// This iterator provides :meth:`__len__`, which returns the current + /// remaining length of this iterator, without consuming it, and will + /// also be faster as it does not need to perform any iteration. + #[pyo3(name = "count")] + fn py_count(mut slf: PyRefMut<'_, Self>) -> usize { + slf.iter.by_ref().count() + } } } @@ -1027,6 +1061,18 @@ pub mod directed { ) -> Option>> { slf.next().map(|path| PyArray1::from_vec_bound(py, path)) } + + /// Count the number of elements in this iterator by consuming it. + /// + /// This is much faster that counting the number of elements using Python + /// code. + /// + /// Returns: + /// int: The number of elements that this iterator contains. + #[pyo3(name = "count")] + fn py_count(mut slf: PyRefMut<'_, Self>) -> usize { + slf.by_ref().count() + } } /// An iterator over all paths in a directed graph, @@ -1059,6 +1105,18 @@ pub mod directed { ) -> Option>> { slf.iter.next().map(|paths| paths.into_pyarray_bound(py)) } + + /// Count the number of elements in this iterator by consuming it. + /// + /// This is much faster that counting the number of elements using Python + /// code. + /// + /// Returns: + /// int: The number of elements that this iterator contains. + #[pyo3(name = "count")] + fn py_count(mut slf: PyRefMut<'_, Self>) -> usize { + slf.iter.by_ref().count() + } } } diff --git a/docs/source/notebooks/advanced_path_tracing.ipynb b/docs/source/notebooks/advanced_path_tracing.ipynb index 3cbcfbae..d5fa51eb 100644 --- a/docs/source/notebooks/advanced_path_tracing.ipynb +++ b/docs/source/notebooks/advanced_path_tracing.ipynb @@ -52,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "0c260649-d4de-452d-a578-7647c0e57993", "metadata": {}, "outputs": [], @@ -89,7 +89,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "a4ff244d", "metadata": {}, "outputs": [], @@ -113,10 +113,1098 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "2be70ad7-6dae-478f-83bd-b08e516d114d", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "i": [ + 8, + 9, + 12, + 13, + 16, + 17, + 20, + 21, + 24, + 25, + 28, + 29, + 32, + 33, + 36, + 37, + 40, + 41, + 44, + 45, + 48, + 49, + 52, + 53 + ], + "j": [ + 9, + 8, + 13, + 12, + 17, + 16, + 21, + 20, + 25, + 24, + 29, + 28, + 33, + 32, + 37, + 36, + 41, + 40, + 45, + 44, + 49, + 48, + 53, + 52 + ], + "k": [ + 10, + 11, + 14, + 15, + 18, + 19, + 22, + 23, + 26, + 27, + 30, + 31, + 34, + 35, + 38, + 39, + 42, + 43, + 46, + 47, + 50, + 51, + 54, + 55 + ], + "opacity": 0.5, + "type": "mesh3d", + "x": [ + 1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 5, + -5, + -5, + 5, + -4.999998092651367, + 5.000000953674316, + -5.106064796447754, + 5.000001907348633, + 5.000000953674316, + -4.999998092651367, + -5.106064796447754, + 5.000001907348633, + 5.000001907348633, + 5.000000953674316, + 5.000000953674316, + 5.000001907348633, + 5.000000953674316, + -5.106064796447754, + 5.000000953674316, + -5.106064796447754, + -4.999998092651367, + -5.106064796447754, + -5.106064796447754, + -4.999998092651367, + -4.999998092651367, + 5.000001907348633, + -4.999998092651367, + 5.000001907348633, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5, + 5, + -5, + 5, + -5, + -5, + -5, + -5, + -5, + -5, + 5, + -5, + 5 + ], + "y": [ + -1, + -1, + -1, + -1, + 1, + 1, + 1, + 1, + 5, + -5, + 5, + -5, + 25, + 15, + 14.89393424987793, + 25, + 15, + 25, + 14.89393424987793, + 25, + 25, + 15, + 15, + 25, + 15, + 14.89393424987793, + 15, + 14.89393424987793, + 25, + 14.89393424987793, + 14.89393424987793, + 25, + 25, + 25, + 25, + 25, + -5, + 5, + -5, + 5, + 5, + -5, + -5, + 5, + -5, + -5, + -5, + -5, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5 + ], + "z": [ + 1, + -1, + 1, + -1, + 1, + -1, + 1, + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20 + ] + } + ], + "layout": { + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "dplt.set_defaults(\"plotly\") # Let's use the Plotly backend\n", "\n", @@ -135,10 +1223,1119 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "1b575f59-b2ae-4425-aac2-5286f240e4dc", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "i": [ + 8, + 9, + 12, + 13, + 16, + 17, + 20, + 21, + 24, + 25, + 28, + 29, + 32, + 33, + 36, + 37, + 40, + 41, + 44, + 45, + 48, + 49, + 52, + 53 + ], + "j": [ + 9, + 8, + 13, + 12, + 17, + 16, + 21, + 20, + 25, + 24, + 29, + 28, + 33, + 32, + 37, + 36, + 41, + 40, + 45, + 44, + 49, + 48, + 53, + 52 + ], + "k": [ + 10, + 11, + 14, + 15, + 18, + 19, + 22, + 23, + 26, + 27, + 30, + 31, + 34, + 35, + 38, + 39, + 42, + 43, + 46, + 47, + 50, + 51, + 54, + 55 + ], + "opacity": 0.5, + "type": "mesh3d", + "x": [ + 1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 5, + -5, + -5, + 5, + -4.999998092651367, + 5.000000953674316, + -5.106064796447754, + 5.000001907348633, + 5.000000953674316, + -4.999998092651367, + -5.106064796447754, + 5.000001907348633, + 5.000001907348633, + 5.000000953674316, + 5.000000953674316, + 5.000001907348633, + 5.000000953674316, + -5.106064796447754, + 5.000000953674316, + -5.106064796447754, + -4.999998092651367, + -5.106064796447754, + -5.106064796447754, + -4.999998092651367, + -4.999998092651367, + 5.000001907348633, + -4.999998092651367, + 5.000001907348633, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5, + 5, + -5, + 5, + -5, + -5, + -5, + -5, + -5, + -5, + 5, + -5, + 5 + ], + "y": [ + -1, + -1, + -1, + -1, + 1, + 1, + 1, + 1, + 5, + -5, + 5, + -5, + 25, + 15, + 14.89393424987793, + 25, + 15, + 25, + 14.89393424987793, + 25, + 25, + 15, + 15, + 25, + 15, + 14.89393424987793, + 15, + 14.89393424987793, + 25, + 14.89393424987793, + 14.89393424987793, + 25, + 25, + 25, + 25, + 25, + -5, + 5, + -5, + 5, + 5, + -5, + -5, + 5, + -5, + -5, + -5, + -5, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5 + ], + "z": [ + 1, + -1, + 1, + -1, + 1, + -1, + 1, + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20 + ] + }, + { + "mode": "markers+text", + "name": "nodes", + "text": [ + "tx", + "rx" + ], + "type": "scatter3d", + "x": [ + 0, + 0 + ], + "y": [ + 4.935200214385986, + 10.034000396728516 + ], + "z": [ + 22, + 1.5 + ] + } + ], + "layout": { + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "tx = jnp.array([0.0, 4.9352, 22.0])\n", "rx = jnp.array([0.0, 10.034, 1.50])\n", @@ -171,10 +2368,1499 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "471c5059-cc86-4ca6-ad9e-efc8d7cc2f91", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "i": [ + 8, + 9, + 12, + 13, + 16, + 17, + 20, + 21, + 24, + 25, + 28, + 29, + 32, + 33, + 36, + 37, + 40, + 41, + 44, + 45, + 48, + 49, + 52, + 53 + ], + "j": [ + 9, + 8, + 13, + 12, + 17, + 16, + 21, + 20, + 25, + 24, + 29, + 28, + 33, + 32, + 37, + 36, + 41, + 40, + 45, + 44, + 49, + 48, + 53, + 52 + ], + "k": [ + 10, + 11, + 14, + 15, + 18, + 19, + 22, + 23, + 26, + 27, + 30, + 31, + 34, + 35, + 38, + 39, + 42, + 43, + 46, + 47, + 50, + 51, + 54, + 55 + ], + "opacity": 0.5, + "type": "mesh3d", + "x": [ + 1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 5, + -5, + -5, + 5, + -4.999998092651367, + 5.000000953674316, + -5.106064796447754, + 5.000001907348633, + 5.000000953674316, + -4.999998092651367, + -5.106064796447754, + 5.000001907348633, + 5.000001907348633, + 5.000000953674316, + 5.000000953674316, + 5.000001907348633, + 5.000000953674316, + -5.106064796447754, + 5.000000953674316, + -5.106064796447754, + -4.999998092651367, + -5.106064796447754, + -5.106064796447754, + -4.999998092651367, + -4.999998092651367, + 5.000001907348633, + -4.999998092651367, + 5.000001907348633, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5, + 5, + -5, + 5, + -5, + -5, + -5, + -5, + -5, + -5, + 5, + -5, + 5 + ], + "y": [ + -1, + -1, + -1, + -1, + 1, + 1, + 1, + 1, + 5, + -5, + 5, + -5, + 25, + 15, + 14.89393424987793, + 25, + 15, + 25, + 14.89393424987793, + 25, + 25, + 15, + 15, + 25, + 15, + 14.89393424987793, + 15, + 14.89393424987793, + 25, + 14.89393424987793, + 14.89393424987793, + 25, + 25, + 25, + 25, + 25, + -5, + 5, + -5, + 5, + 5, + -5, + -5, + 5, + -5, + -5, + -5, + -5, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5 + ], + "z": [ + 1, + -1, + 1, + -1, + 1, + -1, + 1, + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20 + ] + }, + { + "mode": "markers+text", + "name": "nodes", + "text": [ + "tx", + "rx" + ], + "type": "scatter3d", + "x": [ + 0, + 0 + ], + "y": [ + 4.935200214385986, + 10.034000396728516 + ], + "z": [ + 22, + 1.5 + ] + }, + { + "color": "red", + "i": [ + 24, + 25 + ], + "j": [ + 25, + 24 + ], + "k": [ + 26, + 27 + ], + "type": "mesh3d", + "x": [ + 1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 5, + -5, + -5, + 5, + -4.999998092651367, + 5.000000953674316, + -5.106064796447754, + 5.000001907348633, + 5.000000953674316, + -4.999998092651367, + -5.106064796447754, + 5.000001907348633, + 5.000001907348633, + 5.000000953674316, + 5.000000953674316, + 5.000001907348633, + 5.000000953674316, + -5.106064796447754, + 5.000000953674316, + -5.106064796447754, + -4.999998092651367, + -5.106064796447754, + -5.106064796447754, + -4.999998092651367, + -4.999998092651367, + 5.000001907348633, + -4.999998092651367, + 5.000001907348633, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5, + 5, + -5, + 5, + -5, + -5, + -5, + -5, + -5, + -5, + 5, + -5, + 5 + ], + "y": [ + -1, + -1, + -1, + -1, + 1, + 1, + 1, + 1, + 5, + -5, + 5, + -5, + 25, + 15, + 14.89393424987793, + 25, + 15, + 25, + 14.89393424987793, + 25, + 25, + 15, + 15, + 25, + 15, + 14.89393424987793, + 15, + 14.89393424987793, + 25, + 14.89393424987793, + 14.89393424987793, + 25, + 25, + 25, + 25, + 25, + -5, + 5, + -5, + 5, + 5, + -5, + -5, + 5, + -5, + -5, + -5, + -5, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5 + ], + "z": [ + 1, + -1, + 1, + -1, + 1, + -1, + 1, + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20 + ] + }, + { + "color": "green", + "i": [ + 52, + 53 + ], + "j": [ + 53, + 52 + ], + "k": [ + 54, + 55 + ], + "type": "mesh3d", + "x": [ + 1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 5, + -5, + -5, + 5, + -4.999998092651367, + 5.000000953674316, + -5.106064796447754, + 5.000001907348633, + 5.000000953674316, + -4.999998092651367, + -5.106064796447754, + 5.000001907348633, + 5.000001907348633, + 5.000000953674316, + 5.000000953674316, + 5.000001907348633, + 5.000000953674316, + -5.106064796447754, + 5.000000953674316, + -5.106064796447754, + -4.999998092651367, + -5.106064796447754, + -5.106064796447754, + -4.999998092651367, + -4.999998092651367, + 5.000001907348633, + -4.999998092651367, + 5.000001907348633, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5, + 5, + -5, + 5, + -5, + -5, + -5, + -5, + -5, + -5, + 5, + -5, + 5 + ], + "y": [ + -1, + -1, + -1, + -1, + 1, + 1, + 1, + 1, + 5, + -5, + 5, + -5, + 25, + 15, + 14.89393424987793, + 25, + 15, + 25, + 14.89393424987793, + 25, + 25, + 15, + 15, + 25, + 15, + 14.89393424987793, + 15, + 14.89393424987793, + 25, + 14.89393424987793, + 14.89393424987793, + 25, + 25, + 25, + 25, + 25, + -5, + 5, + -5, + 5, + 5, + -5, + -5, + 5, + -5, + -5, + -5, + -5, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5 + ], + "z": [ + 1, + -1, + 1, + -1, + 1, + -1, + 1, + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20 + ] + } + ], + "layout": { + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "select = [\n", " 8, # Red\n", @@ -205,10 +3891,1580 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "30689d03-ac54-419f-ada3-c14a1a570d65", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "i": [ + 8, + 9, + 12, + 13, + 16, + 17, + 20, + 21, + 24, + 25, + 28, + 29, + 32, + 33, + 36, + 37, + 40, + 41, + 44, + 45, + 48, + 49, + 52, + 53 + ], + "j": [ + 9, + 8, + 13, + 12, + 17, + 16, + 21, + 20, + 25, + 24, + 29, + 28, + 33, + 32, + 37, + 36, + 41, + 40, + 45, + 44, + 49, + 48, + 53, + 52 + ], + "k": [ + 10, + 11, + 14, + 15, + 18, + 19, + 22, + 23, + 26, + 27, + 30, + 31, + 34, + 35, + 38, + 39, + 42, + 43, + 46, + 47, + 50, + 51, + 54, + 55 + ], + "opacity": 0.5, + "type": "mesh3d", + "x": [ + 1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 5, + -5, + -5, + 5, + -4.999998092651367, + 5.000000953674316, + -5.106064796447754, + 5.000001907348633, + 5.000000953674316, + -4.999998092651367, + -5.106064796447754, + 5.000001907348633, + 5.000001907348633, + 5.000000953674316, + 5.000000953674316, + 5.000001907348633, + 5.000000953674316, + -5.106064796447754, + 5.000000953674316, + -5.106064796447754, + -4.999998092651367, + -5.106064796447754, + -5.106064796447754, + -4.999998092651367, + -4.999998092651367, + 5.000001907348633, + -4.999998092651367, + 5.000001907348633, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5, + 5, + -5, + 5, + -5, + -5, + -5, + -5, + -5, + -5, + 5, + -5, + 5 + ], + "y": [ + -1, + -1, + -1, + -1, + 1, + 1, + 1, + 1, + 5, + -5, + 5, + -5, + 25, + 15, + 14.89393424987793, + 25, + 15, + 25, + 14.89393424987793, + 25, + 25, + 15, + 15, + 25, + 15, + 14.89393424987793, + 15, + 14.89393424987793, + 25, + 14.89393424987793, + 14.89393424987793, + 25, + 25, + 25, + 25, + 25, + -5, + 5, + -5, + 5, + 5, + -5, + -5, + 5, + -5, + -5, + -5, + -5, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5 + ], + "z": [ + 1, + -1, + 1, + -1, + 1, + -1, + 1, + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20 + ] + }, + { + "mode": "markers+text", + "name": "nodes", + "text": [ + "tx", + "rx" + ], + "type": "scatter3d", + "x": [ + 0, + 0 + ], + "y": [ + 4.935200214385986, + 10.034000396728516 + ], + "z": [ + 22, + 1.5 + ] + }, + { + "color": "red", + "i": [ + 24, + 25 + ], + "j": [ + 25, + 24 + ], + "k": [ + 26, + 27 + ], + "type": "mesh3d", + "x": [ + 1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 5, + -5, + -5, + 5, + -4.999998092651367, + 5.000000953674316, + -5.106064796447754, + 5.000001907348633, + 5.000000953674316, + -4.999998092651367, + -5.106064796447754, + 5.000001907348633, + 5.000001907348633, + 5.000000953674316, + 5.000000953674316, + 5.000001907348633, + 5.000000953674316, + -5.106064796447754, + 5.000000953674316, + -5.106064796447754, + -4.999998092651367, + -5.106064796447754, + -5.106064796447754, + -4.999998092651367, + -4.999998092651367, + 5.000001907348633, + -4.999998092651367, + 5.000001907348633, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5, + 5, + -5, + 5, + -5, + -5, + -5, + -5, + -5, + -5, + 5, + -5, + 5 + ], + "y": [ + -1, + -1, + -1, + -1, + 1, + 1, + 1, + 1, + 5, + -5, + 5, + -5, + 25, + 15, + 14.89393424987793, + 25, + 15, + 25, + 14.89393424987793, + 25, + 25, + 15, + 15, + 25, + 15, + 14.89393424987793, + 15, + 14.89393424987793, + 25, + 14.89393424987793, + 14.89393424987793, + 25, + 25, + 25, + 25, + 25, + -5, + 5, + -5, + 5, + 5, + -5, + -5, + 5, + -5, + -5, + -5, + -5, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5 + ], + "z": [ + 1, + -1, + 1, + -1, + 1, + -1, + 1, + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20 + ] + }, + { + "color": "green", + "i": [ + 52, + 53 + ], + "j": [ + 53, + 52 + ], + "k": [ + 54, + 55 + ], + "type": "mesh3d", + "x": [ + 1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 5, + -5, + -5, + 5, + -4.999998092651367, + 5.000000953674316, + -5.106064796447754, + 5.000001907348633, + 5.000000953674316, + -4.999998092651367, + -5.106064796447754, + 5.000001907348633, + 5.000001907348633, + 5.000000953674316, + 5.000000953674316, + 5.000001907348633, + 5.000000953674316, + -5.106064796447754, + 5.000000953674316, + -5.106064796447754, + -4.999998092651367, + -5.106064796447754, + -5.106064796447754, + -4.999998092651367, + -4.999998092651367, + 5.000001907348633, + -4.999998092651367, + 5.000001907348633, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5, + 5, + -5, + 5, + -5, + -5, + -5, + -5, + -5, + -5, + 5, + -5, + 5 + ], + "y": [ + -1, + -1, + -1, + -1, + 1, + 1, + 1, + 1, + 5, + -5, + 5, + -5, + 25, + 15, + 14.89393424987793, + 25, + 15, + 25, + 14.89393424987793, + 25, + 25, + 15, + 15, + 25, + 15, + 14.89393424987793, + 15, + 14.89393424987793, + 25, + 14.89393424987793, + 14.89393424987793, + 25, + 25, + 25, + 25, + 25, + -5, + 5, + -5, + 5, + 5, + -5, + -5, + 5, + -5, + -5, + -5, + -5, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5 + ], + "z": [ + 1, + -1, + 1, + -1, + 1, + -1, + 1, + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20 + ] + }, + { + "line": { + "color": "black", + "width": 3 + }, + "marker": { + "color": "black", + "size": 0 + }, + "name": "Order 0", + "type": "scatter3d", + "x": [ + 0, + 0 + ], + "y": [ + 4.935200214385986, + 10.034000396728516 + ], + "z": [ + 22, + 1.5 + ] + }, + { + "line": { + "color": "green", + "width": 3 + }, + "marker": { + "color": "black", + "size": 0 + }, + "name": "Order 1", + "type": "scatter3d", + "x": [ + 0, + -0.06917739659547806, + 0 + ], + "y": [ + 4.935200214385986, + 14.94679832458496, + 10.034000396728516 + ], + "z": [ + 22, + 8.24851131439209, + 1.5 + ] + }, + { + "line": { + "color": "orange", + "width": 3 + }, + "marker": { + "color": "black", + "size": 0 + }, + "name": "Order 2", + "type": "scatter3d", + "x": [ + 0, + -0.125960111618042, + -0.04232808202505112, + 0 + ], + "y": [ + 4.935200214385986, + 14.946202278137209, + 5, + 10.034000396728516 + ], + "z": [ + 22, + 13.787875175476074, + 5.629261016845703, + 1.5 + ] + } + ], + "layout": { + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# A list of color to easily differentiate paths\n", "color = [\"black\", \"green\", \"orange\", \"yellow\", \"blue\"]\n", @@ -291,10 +5547,1269 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "32f1468a-bf02-4c33-8a1d-0dca89d09c20", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "i": [ + 8, + 9, + 12, + 13, + 16, + 17, + 20, + 21, + 24, + 25, + 28, + 29, + 32, + 33, + 36, + 37, + 40, + 41, + 44, + 45, + 48, + 49, + 52, + 53 + ], + "j": [ + 9, + 8, + 13, + 12, + 17, + 16, + 21, + 20, + 25, + 24, + 29, + 28, + 33, + 32, + 37, + 36, + 41, + 40, + 45, + 44, + 49, + 48, + 53, + 52 + ], + "k": [ + 10, + 11, + 14, + 15, + 18, + 19, + 22, + 23, + 26, + 27, + 30, + 31, + 34, + 35, + 38, + 39, + 42, + 43, + 46, + 47, + 50, + 51, + 54, + 55 + ], + "opacity": 0.5, + "type": "mesh3d", + "x": [ + 1, + 1, + -1, + -1, + 1, + 1, + -1, + -1, + 5, + -5, + -5, + 5, + -4.999998092651367, + 5.000000953674316, + -5.106064796447754, + 5.000001907348633, + 5.000000953674316, + -4.999998092651367, + -5.106064796447754, + 5.000001907348633, + 5.000001907348633, + 5.000000953674316, + 5.000000953674316, + 5.000001907348633, + 5.000000953674316, + -5.106064796447754, + 5.000000953674316, + -5.106064796447754, + -4.999998092651367, + -5.106064796447754, + -5.106064796447754, + -4.999998092651367, + -4.999998092651367, + 5.000001907348633, + -4.999998092651367, + 5.000001907348633, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5, + 5, + -5, + 5, + -5, + -5, + -5, + -5, + -5, + -5, + 5, + -5, + 5 + ], + "y": [ + -1, + -1, + -1, + -1, + 1, + 1, + 1, + 1, + 5, + -5, + 5, + -5, + 25, + 15, + 14.89393424987793, + 25, + 15, + 25, + 14.89393424987793, + 25, + 25, + 15, + 15, + 25, + 15, + 14.89393424987793, + 15, + 14.89393424987793, + 25, + 14.89393424987793, + 14.89393424987793, + 25, + 25, + 25, + 25, + 25, + -5, + 5, + -5, + 5, + 5, + -5, + -5, + 5, + -5, + -5, + -5, + -5, + 5, + -5, + -5, + 5, + 5, + 5, + 5, + 5 + ], + "z": [ + 1, + -1, + 1, + -1, + 1, + -1, + 1, + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20, + 20, + 20, + 20, + 20, + 0, + 20, + 0, + 20, + 20, + 0, + 0, + 20, + 20, + 0, + 20, + 0, + 20, + 0, + 0, + 20 + ] + }, + { + "mode": "markers+text", + "name": "nodes", + "text": [ + "tx", + "rx" + ], + "type": "scatter3d", + "x": [ + 0, + 0 + ], + "y": [ + 4.935200214385986, + 10.034000396728516 + ], + "z": [ + 22, + 1.5 + ] + }, + { + "line": { + "color": "black", + "width": 3 + }, + "marker": { + "color": "black", + "size": 0 + }, + "name": "Order 0", + "type": "scatter3d", + "x": [ + 0, + 0 + ], + "y": [ + 4.935200214385986, + 10.034000396728516 + ], + "z": [ + 22, + 1.5 + ] + }, + { + "line": { + "color": "green", + "width": 3 + }, + "marker": { + "color": "black", + "size": 0 + }, + "name": "Order 1", + "type": "scatter3d", + "x": [ + 0, + -0.06917739659547806, + 0 + ], + "y": [ + 4.935200214385986, + 14.94679832458496, + 10.034000396728516 + ], + "z": [ + 22, + 8.24851131439209, + 1.5 + ] + }, + { + "line": { + "color": "orange", + "width": 3 + }, + "marker": { + "color": "black", + "size": 0 + }, + "name": "Order 2", + "type": "scatter3d", + "x": [ + 0, + -0.125960111618042, + -0.04232808202505112, + 0 + ], + "y": [ + 4.935200214385986, + 14.946202278137209, + 5, + 10.034000396728516 + ], + "z": [ + 22, + 13.787875175476074, + 5.629261016845703, + 1.5 + ] + }, + { + "line": { + "color": "yellow", + "width": 3 + }, + "marker": { + "color": "black", + "size": 0 + }, + "name": "Order 3", + "type": "scatter3d", + "x": [ + 0, + -0.17936798930168152, + -0.14879928529262543, + -0.11822860687971117, + 0 + ], + "y": [ + 4.935200214385986, + 14.945640563964844, + 5, + 14.946282386779783, + 10.034000396728516 + ], + "z": [ + 22, + 16.10511016845703, + 10.24928855895996, + 4.393090724945068, + 1.5 + ] + }, + { + "line": { + "color": "blue", + "width": 3 + }, + "marker": { + "color": "black", + "size": 0 + }, + "name": "Order 4", + "type": "scatter3d", + "x": [ + 0, + -0.233406662940979, + -0.25651583075523376, + -0.2796238660812378, + -0.09397591650485992, + 0 + ], + "y": [ + 4.935200214385986, + 14.945074081420898, + 5, + 14.944588661193848, + 5, + 10.034000396728516 + ], + "z": [ + 22, + 17.426870346069336, + 12.884565353393556, + 8.342482566833496, + 3.799619674682617, + 1.5 + ] + } + ], + "layout": { + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "fig.data = fig.data[:2] # Keep only first 2 traces: geometry and TX/RX\n", "\n", @@ -439,10 +6954,43 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "435cf5c1-c0dd-47a1-9c1f-49c2d1d89b3d", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "f5f5f9a26e40490c8c9a5ebad182be84", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "RFBOutputContext()" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0ffe5915909346309804bb7ab47add18", + "version_major": 2, + "version_minor": 0 + }, + "text/html": [ + "
snapshot
" + ], + "text/plain": [ + "CanvasBackend(css_height='600px', css_width='800px')" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# TODO: load larger scene\n", "# TODO: show example with multiple receivers\n", @@ -463,48 +7011,155 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "6ef52f5e-5620-4e6d-a731-8c7bad893641", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "14206" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "mesh.num_triangles" + "mesh.num_objects # This is the number of triangles" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "fea3cba1-938f-49b2-ab21-ae88396e5b55", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'2.018e+08'" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "from differt_core.rt.graph import CompleteGraph\n", "\n", - "graph = CompleteGraph(mesh.num_triangles)\n", + "graph = CompleteGraph(mesh.num_objects)\n", "\n", - "from_ = mesh.num_triangles\n", + "from_ = graph.num_nodes # Index of TX in the graph\n", + "to = from_ + 1 # Index of RX in the graph\n", + "order = 2 # Number of interactions\n", + "depth = order + 2 # + 2 because we add TX and RX notes\n", + "\n", + "f\"{len(graph.all_paths(from_, to, depth)):.3e}\"" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "0b3456fe", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "7103" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "mesh = mesh.set_assume_quads(True)\n", + "mesh.num_objects # This is now the number of quadrilaterals, exactly half the number of triangles" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "8080e60c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'5.045e+07'" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "graph = CompleteGraph(mesh.num_objects)\n", + "\n", + "from_ = graph.num_nodes\n", "to = from_ + 1\n", - "order = 3\n", + "order = 2\n", "\n", - "len(graph.all_paths(from_, to, order + 2))" + "f\"{len(graph.all_paths(from_, to, depth)):.3e}\" # Rougly a quarter of the preview length" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "08ab9f72-5d52-488c-bc09-7a635b7ab7a8", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "ade58006967e49e6bdf19ee1433bba09", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "RFBOutputContext()" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "46144ede403047188c7c714d98141e69", + "version_major": 2, + "version_minor": 0 + }, + "text/html": [ + "
snapshot
" + ], + "text/plain": [ + "CanvasBackend(css_height='600px', css_width='800px')" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "default_color = jnp.array([[0.2, 0.2, 0.2]])\n", "visible_color = jnp.array([[1.0, 0.2, 0.2]])\n", - "indices = triangles_visible_from_vertices(\n", + "visible_triangles = triangles_visible_from_vertices(\n", " tx,\n", " mesh.triangle_vertices,\n", - " # num_rays=1000_0,\n", ")\n", + "\n", "mesh = mesh.set_face_colors(default_color)\n", - "mesh = mesh.set_face_colors(mesh.face_colors.at[indices].set(visible_color))\n", + "mesh = mesh.set_face_colors(\n", + " mesh.face_colors.at[visible_triangles].set(visible_color)\n", + ")\n", "\n", "with dplt.reuse(\"vispy\") as canvas:\n", " dplt.draw_markers(\n", @@ -517,39 +7172,80 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "4bd97917-c5d3-4b7e-b29a-c071b7a579cc", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "Array(0.33851892, dtype=float32)" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "indices.sum() / mesh.num_triangles" + "visible_triangles.sum() / mesh.num_triangles" ] }, { "cell_type": "code", - "execution_count": null, - "id": "77cec174-c627-4fec-a15b-d2b067cebdaf", + "execution_count": 16, + "id": "bf54e4da", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "Array(0.4400957, dtype=float32)" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "%load_ext line_profiler" + "visible_quads = visible_triangles.reshape(mesh.num_quads, 2).any(axis=-1)\n", + "visible_quads.sum() / mesh.num_quads # ~ 44% of quadrilaterals are seen from TX" ] }, { "cell_type": "code", - "execution_count": null, - "id": "1bf0f929-f48a-41c9-8c77-e615b66fdbd9", + "execution_count": 17, + "id": "ca360b86", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "'2.220e+07'" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "%lprun -f triangles_visible_from_vertices.__wrapped__ triangles_visible_from_vertices(tx,mesh.triangle_vertices, num_rays=100_00)" + "from differt_core.rt.graph import CompleteGraph, DiGraph\n", + "\n", + "graph = DiGraph.from_complete_graph(CompleteGraph(mesh.num_quads))\n", + "from_, to = graph.insert_from_and_to_nodes(\n", + " from_adjacency=np.asarray(visible_quads)\n", + ")\n", + "\n", + "f\"{graph.all_paths(from_, to, order + 2).count():.3e}\" # ~ 44% of the previous length" ] } ], "metadata": { "celltoolbar": "Edit Metadata", "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": ".venv", "language": "python", "name": "python3" }, From 015432e8a81b3d72e548439e031deb18e4e971c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Fri, 18 Oct 2024 13:49:42 +0200 Subject: [PATCH 08/12] fix(docs): typo --- docs/source/notebooks/advanced_path_tracing.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/notebooks/advanced_path_tracing.ipynb b/docs/source/notebooks/advanced_path_tracing.ipynb index d5fa51eb..b1ccf4f5 100644 --- a/docs/source/notebooks/advanced_path_tracing.ipynb +++ b/docs/source/notebooks/advanced_path_tracing.ipynb @@ -7106,7 +7106,7 @@ "to = from_ + 1\n", "order = 2\n", "\n", - "f\"{len(graph.all_paths(from_, to, depth)):.3e}\" # Rougly a quarter of the preview length" + "f\"{len(graph.all_paths(from_, to, depth)):.3e}\" # Roughly a quarter of the preview length" ] }, { From ff69216483d37125bea1153688a92be3cd16cbe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Fri, 18 Oct 2024 14:59:12 +0200 Subject: [PATCH 09/12] fix(docs): rename link to builtins' `len` --- differt-core/src/rt/graph.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differt-core/src/rt/graph.rs b/differt-core/src/rt/graph.rs index c7b01a53..df1e4aeb 100644 --- a/differt-core/src/rt/graph.rs +++ b/differt-core/src/rt/graph.rs @@ -514,7 +514,7 @@ pub mod complete { /// int: The number of elements that this iterator contains. /// /// Warning: - /// This iterator provides :meth:`__len__`, which returns the current + /// This iterator provides :func:`len`, which returns the current /// remaining length of this iterator, without consuming it, and will /// also be faster as it does not need to perform any iteration. #[pyo3(name = "count")] @@ -574,7 +574,7 @@ pub mod complete { /// int: The number of elements that this iterator contains. /// /// Warning: - /// This iterator provides :meth:`__len__`, which returns the current + /// This iterator provides :func:`len`, which returns the current /// remaining length of this iterator, without consuming it, and will /// also be faster as it does not need to perform any iteration. #[pyo3(name = "count")] From 5f68247a01c42b4fb70b61e2e79726359d0d394a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Fri, 18 Oct 2024 15:02:11 +0200 Subject: [PATCH 10/12] chore(docs): remove stuff about max length --- differt-core/src/rt/graph.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/differt-core/src/rt/graph.rs b/differt-core/src/rt/graph.rs index df1e4aeb..e7347f2c 100644 --- a/differt-core/src/rt/graph.rs +++ b/differt-core/src/rt/graph.rs @@ -277,9 +277,8 @@ pub mod complete { /// Note: /// Even though this iterator is generally sized, this is not true /// when its length is so large that overflow occurred when computing - /// its theoretical length. - /// For lengths close or above ``usize::MAX``, do not rely - /// on the provided size hint nor the length. + /// its theoretical length. A warning will be emitted in such cases, + /// and the lenght will be set to the maximal representable value. #[pyclass] #[derive(Clone, Debug)] pub struct AllPathsFromCompleteGraphIter { From c2ce992d8af296858407ce1961830739d89108d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Fri, 18 Oct 2024 17:38:08 +0200 Subject: [PATCH 11/12] chore(docs): update tutorial --- differt-core/src/rt/graph.rs | 5 +- .../notebooks/advanced_path_tracing.ipynb | 6877 +---------------- 2 files changed, 181 insertions(+), 6701 deletions(-) diff --git a/differt-core/src/rt/graph.rs b/differt-core/src/rt/graph.rs index e7347f2c..a5188321 100644 --- a/differt-core/src/rt/graph.rs +++ b/differt-core/src/rt/graph.rs @@ -278,7 +278,7 @@ pub mod complete { /// Even though this iterator is generally sized, this is not true /// when its length is so large that overflow occurred when computing /// its theoretical length. A warning will be emitted in such cases, - /// and the lenght will be set to the maximal representable value. + /// and the length will be set to the maximal representable value. #[pyclass] #[derive(Clone, Debug)] pub struct AllPathsFromCompleteGraphIter { @@ -664,8 +664,7 @@ pub mod directed { "'from_adjacency' must have exactly 'num_node' elements" ); (0..from) - .into_iter() - .zip(from_adjacency.into_iter()) + .zip(from_adjacency) .filter_map( |(node_id, &is_adjacent)| if is_adjacent { Some(node_id) } else { None }, ) diff --git a/docs/source/notebooks/advanced_path_tracing.ipynb b/docs/source/notebooks/advanced_path_tracing.ipynb index b1ccf4f5..89e4400a 100644 --- a/docs/source/notebooks/advanced_path_tracing.ipynb +++ b/docs/source/notebooks/advanced_path_tracing.ipynb @@ -113,1098 +113,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "2be70ad7-6dae-478f-83bd-b08e516d114d", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.plotly.v1+json": { - "config": { - "plotlyServerURL": "https://plot.ly" - }, - "data": [ - { - "i": [ - 8, - 9, - 12, - 13, - 16, - 17, - 20, - 21, - 24, - 25, - 28, - 29, - 32, - 33, - 36, - 37, - 40, - 41, - 44, - 45, - 48, - 49, - 52, - 53 - ], - "j": [ - 9, - 8, - 13, - 12, - 17, - 16, - 21, - 20, - 25, - 24, - 29, - 28, - 33, - 32, - 37, - 36, - 41, - 40, - 45, - 44, - 49, - 48, - 53, - 52 - ], - "k": [ - 10, - 11, - 14, - 15, - 18, - 19, - 22, - 23, - 26, - 27, - 30, - 31, - 34, - 35, - 38, - 39, - 42, - 43, - 46, - 47, - 50, - 51, - 54, - 55 - ], - "opacity": 0.5, - "type": "mesh3d", - "x": [ - 1, - 1, - -1, - -1, - 1, - 1, - -1, - -1, - 5, - -5, - -5, - 5, - -4.999998092651367, - 5.000000953674316, - -5.106064796447754, - 5.000001907348633, - 5.000000953674316, - -4.999998092651367, - -5.106064796447754, - 5.000001907348633, - 5.000001907348633, - 5.000000953674316, - 5.000000953674316, - 5.000001907348633, - 5.000000953674316, - -5.106064796447754, - 5.000000953674316, - -5.106064796447754, - -4.999998092651367, - -5.106064796447754, - -5.106064796447754, - -4.999998092651367, - -4.999998092651367, - 5.000001907348633, - -4.999998092651367, - 5.000001907348633, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5, - 5, - -5, - 5, - -5, - -5, - -5, - -5, - -5, - -5, - 5, - -5, - 5 - ], - "y": [ - -1, - -1, - -1, - -1, - 1, - 1, - 1, - 1, - 5, - -5, - 5, - -5, - 25, - 15, - 14.89393424987793, - 25, - 15, - 25, - 14.89393424987793, - 25, - 25, - 15, - 15, - 25, - 15, - 14.89393424987793, - 15, - 14.89393424987793, - 25, - 14.89393424987793, - 14.89393424987793, - 25, - 25, - 25, - 25, - 25, - -5, - 5, - -5, - 5, - 5, - -5, - -5, - 5, - -5, - -5, - -5, - -5, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5 - ], - "z": [ - 1, - -1, - 1, - -1, - 1, - -1, - 1, - -1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20 - ] - } - ], - "layout": { - "template": { - "data": { - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "histogram": [ - { - "marker": { - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "histogram" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter": [ - { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - }, - "type": "scatter" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", - "showlakes": true, - "showland": true, - "subunitcolor": "white" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", - "polar": { - "angularaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "radialaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "baxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "caxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - } - } - } - } - } - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "dplt.set_defaults(\"plotly\") # Let's use the Plotly backend\n", "\n", @@ -1223,1119 +135,10 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "1b575f59-b2ae-4425-aac2-5286f240e4dc", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.plotly.v1+json": { - "config": { - "plotlyServerURL": "https://plot.ly" - }, - "data": [ - { - "i": [ - 8, - 9, - 12, - 13, - 16, - 17, - 20, - 21, - 24, - 25, - 28, - 29, - 32, - 33, - 36, - 37, - 40, - 41, - 44, - 45, - 48, - 49, - 52, - 53 - ], - "j": [ - 9, - 8, - 13, - 12, - 17, - 16, - 21, - 20, - 25, - 24, - 29, - 28, - 33, - 32, - 37, - 36, - 41, - 40, - 45, - 44, - 49, - 48, - 53, - 52 - ], - "k": [ - 10, - 11, - 14, - 15, - 18, - 19, - 22, - 23, - 26, - 27, - 30, - 31, - 34, - 35, - 38, - 39, - 42, - 43, - 46, - 47, - 50, - 51, - 54, - 55 - ], - "opacity": 0.5, - "type": "mesh3d", - "x": [ - 1, - 1, - -1, - -1, - 1, - 1, - -1, - -1, - 5, - -5, - -5, - 5, - -4.999998092651367, - 5.000000953674316, - -5.106064796447754, - 5.000001907348633, - 5.000000953674316, - -4.999998092651367, - -5.106064796447754, - 5.000001907348633, - 5.000001907348633, - 5.000000953674316, - 5.000000953674316, - 5.000001907348633, - 5.000000953674316, - -5.106064796447754, - 5.000000953674316, - -5.106064796447754, - -4.999998092651367, - -5.106064796447754, - -5.106064796447754, - -4.999998092651367, - -4.999998092651367, - 5.000001907348633, - -4.999998092651367, - 5.000001907348633, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5, - 5, - -5, - 5, - -5, - -5, - -5, - -5, - -5, - -5, - 5, - -5, - 5 - ], - "y": [ - -1, - -1, - -1, - -1, - 1, - 1, - 1, - 1, - 5, - -5, - 5, - -5, - 25, - 15, - 14.89393424987793, - 25, - 15, - 25, - 14.89393424987793, - 25, - 25, - 15, - 15, - 25, - 15, - 14.89393424987793, - 15, - 14.89393424987793, - 25, - 14.89393424987793, - 14.89393424987793, - 25, - 25, - 25, - 25, - 25, - -5, - 5, - -5, - 5, - 5, - -5, - -5, - 5, - -5, - -5, - -5, - -5, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5 - ], - "z": [ - 1, - -1, - 1, - -1, - 1, - -1, - 1, - -1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20 - ] - }, - { - "mode": "markers+text", - "name": "nodes", - "text": [ - "tx", - "rx" - ], - "type": "scatter3d", - "x": [ - 0, - 0 - ], - "y": [ - 4.935200214385986, - 10.034000396728516 - ], - "z": [ - 22, - 1.5 - ] - } - ], - "layout": { - "template": { - "data": { - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "histogram": [ - { - "marker": { - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "histogram" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter": [ - { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - }, - "type": "scatter" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", - "showlakes": true, - "showland": true, - "subunitcolor": "white" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", - "polar": { - "angularaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "radialaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "baxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "caxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - } - } - } - } - } - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "tx = jnp.array([0.0, 4.9352, 22.0])\n", "rx = jnp.array([0.0, 10.034, 1.50])\n", @@ -2368,1499 +171,10 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "471c5059-cc86-4ca6-ad9e-efc8d7cc2f91", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.plotly.v1+json": { - "config": { - "plotlyServerURL": "https://plot.ly" - }, - "data": [ - { - "i": [ - 8, - 9, - 12, - 13, - 16, - 17, - 20, - 21, - 24, - 25, - 28, - 29, - 32, - 33, - 36, - 37, - 40, - 41, - 44, - 45, - 48, - 49, - 52, - 53 - ], - "j": [ - 9, - 8, - 13, - 12, - 17, - 16, - 21, - 20, - 25, - 24, - 29, - 28, - 33, - 32, - 37, - 36, - 41, - 40, - 45, - 44, - 49, - 48, - 53, - 52 - ], - "k": [ - 10, - 11, - 14, - 15, - 18, - 19, - 22, - 23, - 26, - 27, - 30, - 31, - 34, - 35, - 38, - 39, - 42, - 43, - 46, - 47, - 50, - 51, - 54, - 55 - ], - "opacity": 0.5, - "type": "mesh3d", - "x": [ - 1, - 1, - -1, - -1, - 1, - 1, - -1, - -1, - 5, - -5, - -5, - 5, - -4.999998092651367, - 5.000000953674316, - -5.106064796447754, - 5.000001907348633, - 5.000000953674316, - -4.999998092651367, - -5.106064796447754, - 5.000001907348633, - 5.000001907348633, - 5.000000953674316, - 5.000000953674316, - 5.000001907348633, - 5.000000953674316, - -5.106064796447754, - 5.000000953674316, - -5.106064796447754, - -4.999998092651367, - -5.106064796447754, - -5.106064796447754, - -4.999998092651367, - -4.999998092651367, - 5.000001907348633, - -4.999998092651367, - 5.000001907348633, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5, - 5, - -5, - 5, - -5, - -5, - -5, - -5, - -5, - -5, - 5, - -5, - 5 - ], - "y": [ - -1, - -1, - -1, - -1, - 1, - 1, - 1, - 1, - 5, - -5, - 5, - -5, - 25, - 15, - 14.89393424987793, - 25, - 15, - 25, - 14.89393424987793, - 25, - 25, - 15, - 15, - 25, - 15, - 14.89393424987793, - 15, - 14.89393424987793, - 25, - 14.89393424987793, - 14.89393424987793, - 25, - 25, - 25, - 25, - 25, - -5, - 5, - -5, - 5, - 5, - -5, - -5, - 5, - -5, - -5, - -5, - -5, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5 - ], - "z": [ - 1, - -1, - 1, - -1, - 1, - -1, - 1, - -1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20 - ] - }, - { - "mode": "markers+text", - "name": "nodes", - "text": [ - "tx", - "rx" - ], - "type": "scatter3d", - "x": [ - 0, - 0 - ], - "y": [ - 4.935200214385986, - 10.034000396728516 - ], - "z": [ - 22, - 1.5 - ] - }, - { - "color": "red", - "i": [ - 24, - 25 - ], - "j": [ - 25, - 24 - ], - "k": [ - 26, - 27 - ], - "type": "mesh3d", - "x": [ - 1, - 1, - -1, - -1, - 1, - 1, - -1, - -1, - 5, - -5, - -5, - 5, - -4.999998092651367, - 5.000000953674316, - -5.106064796447754, - 5.000001907348633, - 5.000000953674316, - -4.999998092651367, - -5.106064796447754, - 5.000001907348633, - 5.000001907348633, - 5.000000953674316, - 5.000000953674316, - 5.000001907348633, - 5.000000953674316, - -5.106064796447754, - 5.000000953674316, - -5.106064796447754, - -4.999998092651367, - -5.106064796447754, - -5.106064796447754, - -4.999998092651367, - -4.999998092651367, - 5.000001907348633, - -4.999998092651367, - 5.000001907348633, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5, - 5, - -5, - 5, - -5, - -5, - -5, - -5, - -5, - -5, - 5, - -5, - 5 - ], - "y": [ - -1, - -1, - -1, - -1, - 1, - 1, - 1, - 1, - 5, - -5, - 5, - -5, - 25, - 15, - 14.89393424987793, - 25, - 15, - 25, - 14.89393424987793, - 25, - 25, - 15, - 15, - 25, - 15, - 14.89393424987793, - 15, - 14.89393424987793, - 25, - 14.89393424987793, - 14.89393424987793, - 25, - 25, - 25, - 25, - 25, - -5, - 5, - -5, - 5, - 5, - -5, - -5, - 5, - -5, - -5, - -5, - -5, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5 - ], - "z": [ - 1, - -1, - 1, - -1, - 1, - -1, - 1, - -1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20 - ] - }, - { - "color": "green", - "i": [ - 52, - 53 - ], - "j": [ - 53, - 52 - ], - "k": [ - 54, - 55 - ], - "type": "mesh3d", - "x": [ - 1, - 1, - -1, - -1, - 1, - 1, - -1, - -1, - 5, - -5, - -5, - 5, - -4.999998092651367, - 5.000000953674316, - -5.106064796447754, - 5.000001907348633, - 5.000000953674316, - -4.999998092651367, - -5.106064796447754, - 5.000001907348633, - 5.000001907348633, - 5.000000953674316, - 5.000000953674316, - 5.000001907348633, - 5.000000953674316, - -5.106064796447754, - 5.000000953674316, - -5.106064796447754, - -4.999998092651367, - -5.106064796447754, - -5.106064796447754, - -4.999998092651367, - -4.999998092651367, - 5.000001907348633, - -4.999998092651367, - 5.000001907348633, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5, - 5, - -5, - 5, - -5, - -5, - -5, - -5, - -5, - -5, - 5, - -5, - 5 - ], - "y": [ - -1, - -1, - -1, - -1, - 1, - 1, - 1, - 1, - 5, - -5, - 5, - -5, - 25, - 15, - 14.89393424987793, - 25, - 15, - 25, - 14.89393424987793, - 25, - 25, - 15, - 15, - 25, - 15, - 14.89393424987793, - 15, - 14.89393424987793, - 25, - 14.89393424987793, - 14.89393424987793, - 25, - 25, - 25, - 25, - 25, - -5, - 5, - -5, - 5, - 5, - -5, - -5, - 5, - -5, - -5, - -5, - -5, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5 - ], - "z": [ - 1, - -1, - 1, - -1, - 1, - -1, - 1, - -1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20 - ] - } - ], - "layout": { - "template": { - "data": { - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "histogram": [ - { - "marker": { - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "histogram" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter": [ - { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - }, - "type": "scatter" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", - "showlakes": true, - "showland": true, - "subunitcolor": "white" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", - "polar": { - "angularaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "radialaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "baxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "caxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - } - } - } - } - } - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "select = [\n", " 8, # Red\n", @@ -3891,1580 +205,10 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "30689d03-ac54-419f-ada3-c14a1a570d65", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.plotly.v1+json": { - "config": { - "plotlyServerURL": "https://plot.ly" - }, - "data": [ - { - "i": [ - 8, - 9, - 12, - 13, - 16, - 17, - 20, - 21, - 24, - 25, - 28, - 29, - 32, - 33, - 36, - 37, - 40, - 41, - 44, - 45, - 48, - 49, - 52, - 53 - ], - "j": [ - 9, - 8, - 13, - 12, - 17, - 16, - 21, - 20, - 25, - 24, - 29, - 28, - 33, - 32, - 37, - 36, - 41, - 40, - 45, - 44, - 49, - 48, - 53, - 52 - ], - "k": [ - 10, - 11, - 14, - 15, - 18, - 19, - 22, - 23, - 26, - 27, - 30, - 31, - 34, - 35, - 38, - 39, - 42, - 43, - 46, - 47, - 50, - 51, - 54, - 55 - ], - "opacity": 0.5, - "type": "mesh3d", - "x": [ - 1, - 1, - -1, - -1, - 1, - 1, - -1, - -1, - 5, - -5, - -5, - 5, - -4.999998092651367, - 5.000000953674316, - -5.106064796447754, - 5.000001907348633, - 5.000000953674316, - -4.999998092651367, - -5.106064796447754, - 5.000001907348633, - 5.000001907348633, - 5.000000953674316, - 5.000000953674316, - 5.000001907348633, - 5.000000953674316, - -5.106064796447754, - 5.000000953674316, - -5.106064796447754, - -4.999998092651367, - -5.106064796447754, - -5.106064796447754, - -4.999998092651367, - -4.999998092651367, - 5.000001907348633, - -4.999998092651367, - 5.000001907348633, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5, - 5, - -5, - 5, - -5, - -5, - -5, - -5, - -5, - -5, - 5, - -5, - 5 - ], - "y": [ - -1, - -1, - -1, - -1, - 1, - 1, - 1, - 1, - 5, - -5, - 5, - -5, - 25, - 15, - 14.89393424987793, - 25, - 15, - 25, - 14.89393424987793, - 25, - 25, - 15, - 15, - 25, - 15, - 14.89393424987793, - 15, - 14.89393424987793, - 25, - 14.89393424987793, - 14.89393424987793, - 25, - 25, - 25, - 25, - 25, - -5, - 5, - -5, - 5, - 5, - -5, - -5, - 5, - -5, - -5, - -5, - -5, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5 - ], - "z": [ - 1, - -1, - 1, - -1, - 1, - -1, - 1, - -1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20 - ] - }, - { - "mode": "markers+text", - "name": "nodes", - "text": [ - "tx", - "rx" - ], - "type": "scatter3d", - "x": [ - 0, - 0 - ], - "y": [ - 4.935200214385986, - 10.034000396728516 - ], - "z": [ - 22, - 1.5 - ] - }, - { - "color": "red", - "i": [ - 24, - 25 - ], - "j": [ - 25, - 24 - ], - "k": [ - 26, - 27 - ], - "type": "mesh3d", - "x": [ - 1, - 1, - -1, - -1, - 1, - 1, - -1, - -1, - 5, - -5, - -5, - 5, - -4.999998092651367, - 5.000000953674316, - -5.106064796447754, - 5.000001907348633, - 5.000000953674316, - -4.999998092651367, - -5.106064796447754, - 5.000001907348633, - 5.000001907348633, - 5.000000953674316, - 5.000000953674316, - 5.000001907348633, - 5.000000953674316, - -5.106064796447754, - 5.000000953674316, - -5.106064796447754, - -4.999998092651367, - -5.106064796447754, - -5.106064796447754, - -4.999998092651367, - -4.999998092651367, - 5.000001907348633, - -4.999998092651367, - 5.000001907348633, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5, - 5, - -5, - 5, - -5, - -5, - -5, - -5, - -5, - -5, - 5, - -5, - 5 - ], - "y": [ - -1, - -1, - -1, - -1, - 1, - 1, - 1, - 1, - 5, - -5, - 5, - -5, - 25, - 15, - 14.89393424987793, - 25, - 15, - 25, - 14.89393424987793, - 25, - 25, - 15, - 15, - 25, - 15, - 14.89393424987793, - 15, - 14.89393424987793, - 25, - 14.89393424987793, - 14.89393424987793, - 25, - 25, - 25, - 25, - 25, - -5, - 5, - -5, - 5, - 5, - -5, - -5, - 5, - -5, - -5, - -5, - -5, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5 - ], - "z": [ - 1, - -1, - 1, - -1, - 1, - -1, - 1, - -1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20 - ] - }, - { - "color": "green", - "i": [ - 52, - 53 - ], - "j": [ - 53, - 52 - ], - "k": [ - 54, - 55 - ], - "type": "mesh3d", - "x": [ - 1, - 1, - -1, - -1, - 1, - 1, - -1, - -1, - 5, - -5, - -5, - 5, - -4.999998092651367, - 5.000000953674316, - -5.106064796447754, - 5.000001907348633, - 5.000000953674316, - -4.999998092651367, - -5.106064796447754, - 5.000001907348633, - 5.000001907348633, - 5.000000953674316, - 5.000000953674316, - 5.000001907348633, - 5.000000953674316, - -5.106064796447754, - 5.000000953674316, - -5.106064796447754, - -4.999998092651367, - -5.106064796447754, - -5.106064796447754, - -4.999998092651367, - -4.999998092651367, - 5.000001907348633, - -4.999998092651367, - 5.000001907348633, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5, - 5, - -5, - 5, - -5, - -5, - -5, - -5, - -5, - -5, - 5, - -5, - 5 - ], - "y": [ - -1, - -1, - -1, - -1, - 1, - 1, - 1, - 1, - 5, - -5, - 5, - -5, - 25, - 15, - 14.89393424987793, - 25, - 15, - 25, - 14.89393424987793, - 25, - 25, - 15, - 15, - 25, - 15, - 14.89393424987793, - 15, - 14.89393424987793, - 25, - 14.89393424987793, - 14.89393424987793, - 25, - 25, - 25, - 25, - 25, - -5, - 5, - -5, - 5, - 5, - -5, - -5, - 5, - -5, - -5, - -5, - -5, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5 - ], - "z": [ - 1, - -1, - 1, - -1, - 1, - -1, - 1, - -1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20 - ] - }, - { - "line": { - "color": "black", - "width": 3 - }, - "marker": { - "color": "black", - "size": 0 - }, - "name": "Order 0", - "type": "scatter3d", - "x": [ - 0, - 0 - ], - "y": [ - 4.935200214385986, - 10.034000396728516 - ], - "z": [ - 22, - 1.5 - ] - }, - { - "line": { - "color": "green", - "width": 3 - }, - "marker": { - "color": "black", - "size": 0 - }, - "name": "Order 1", - "type": "scatter3d", - "x": [ - 0, - -0.06917739659547806, - 0 - ], - "y": [ - 4.935200214385986, - 14.94679832458496, - 10.034000396728516 - ], - "z": [ - 22, - 8.24851131439209, - 1.5 - ] - }, - { - "line": { - "color": "orange", - "width": 3 - }, - "marker": { - "color": "black", - "size": 0 - }, - "name": "Order 2", - "type": "scatter3d", - "x": [ - 0, - -0.125960111618042, - -0.04232808202505112, - 0 - ], - "y": [ - 4.935200214385986, - 14.946202278137209, - 5, - 10.034000396728516 - ], - "z": [ - 22, - 13.787875175476074, - 5.629261016845703, - 1.5 - ] - } - ], - "layout": { - "template": { - "data": { - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "histogram": [ - { - "marker": { - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "histogram" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter": [ - { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - }, - "type": "scatter" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", - "showlakes": true, - "showland": true, - "subunitcolor": "white" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", - "polar": { - "angularaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "radialaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "baxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "caxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - } - } - } - } - } - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# A list of color to easily differentiate paths\n", "color = [\"black\", \"green\", \"orange\", \"yellow\", \"blue\"]\n", @@ -5547,1269 +291,10 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "32f1468a-bf02-4c33-8a1d-0dca89d09c20", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.plotly.v1+json": { - "config": { - "plotlyServerURL": "https://plot.ly" - }, - "data": [ - { - "i": [ - 8, - 9, - 12, - 13, - 16, - 17, - 20, - 21, - 24, - 25, - 28, - 29, - 32, - 33, - 36, - 37, - 40, - 41, - 44, - 45, - 48, - 49, - 52, - 53 - ], - "j": [ - 9, - 8, - 13, - 12, - 17, - 16, - 21, - 20, - 25, - 24, - 29, - 28, - 33, - 32, - 37, - 36, - 41, - 40, - 45, - 44, - 49, - 48, - 53, - 52 - ], - "k": [ - 10, - 11, - 14, - 15, - 18, - 19, - 22, - 23, - 26, - 27, - 30, - 31, - 34, - 35, - 38, - 39, - 42, - 43, - 46, - 47, - 50, - 51, - 54, - 55 - ], - "opacity": 0.5, - "type": "mesh3d", - "x": [ - 1, - 1, - -1, - -1, - 1, - 1, - -1, - -1, - 5, - -5, - -5, - 5, - -4.999998092651367, - 5.000000953674316, - -5.106064796447754, - 5.000001907348633, - 5.000000953674316, - -4.999998092651367, - -5.106064796447754, - 5.000001907348633, - 5.000001907348633, - 5.000000953674316, - 5.000000953674316, - 5.000001907348633, - 5.000000953674316, - -5.106064796447754, - 5.000000953674316, - -5.106064796447754, - -4.999998092651367, - -5.106064796447754, - -5.106064796447754, - -4.999998092651367, - -4.999998092651367, - 5.000001907348633, - -4.999998092651367, - 5.000001907348633, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5, - 5, - -5, - 5, - -5, - -5, - -5, - -5, - -5, - -5, - 5, - -5, - 5 - ], - "y": [ - -1, - -1, - -1, - -1, - 1, - 1, - 1, - 1, - 5, - -5, - 5, - -5, - 25, - 15, - 14.89393424987793, - 25, - 15, - 25, - 14.89393424987793, - 25, - 25, - 15, - 15, - 25, - 15, - 14.89393424987793, - 15, - 14.89393424987793, - 25, - 14.89393424987793, - 14.89393424987793, - 25, - 25, - 25, - 25, - 25, - -5, - 5, - -5, - 5, - 5, - -5, - -5, - 5, - -5, - -5, - -5, - -5, - 5, - -5, - -5, - 5, - 5, - 5, - 5, - 5 - ], - "z": [ - 1, - -1, - 1, - -1, - 1, - -1, - 1, - -1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20, - 20, - 20, - 20, - 20, - 0, - 20, - 0, - 20, - 20, - 0, - 0, - 20, - 20, - 0, - 20, - 0, - 20, - 0, - 0, - 20 - ] - }, - { - "mode": "markers+text", - "name": "nodes", - "text": [ - "tx", - "rx" - ], - "type": "scatter3d", - "x": [ - 0, - 0 - ], - "y": [ - 4.935200214385986, - 10.034000396728516 - ], - "z": [ - 22, - 1.5 - ] - }, - { - "line": { - "color": "black", - "width": 3 - }, - "marker": { - "color": "black", - "size": 0 - }, - "name": "Order 0", - "type": "scatter3d", - "x": [ - 0, - 0 - ], - "y": [ - 4.935200214385986, - 10.034000396728516 - ], - "z": [ - 22, - 1.5 - ] - }, - { - "line": { - "color": "green", - "width": 3 - }, - "marker": { - "color": "black", - "size": 0 - }, - "name": "Order 1", - "type": "scatter3d", - "x": [ - 0, - -0.06917739659547806, - 0 - ], - "y": [ - 4.935200214385986, - 14.94679832458496, - 10.034000396728516 - ], - "z": [ - 22, - 8.24851131439209, - 1.5 - ] - }, - { - "line": { - "color": "orange", - "width": 3 - }, - "marker": { - "color": "black", - "size": 0 - }, - "name": "Order 2", - "type": "scatter3d", - "x": [ - 0, - -0.125960111618042, - -0.04232808202505112, - 0 - ], - "y": [ - 4.935200214385986, - 14.946202278137209, - 5, - 10.034000396728516 - ], - "z": [ - 22, - 13.787875175476074, - 5.629261016845703, - 1.5 - ] - }, - { - "line": { - "color": "yellow", - "width": 3 - }, - "marker": { - "color": "black", - "size": 0 - }, - "name": "Order 3", - "type": "scatter3d", - "x": [ - 0, - -0.17936798930168152, - -0.14879928529262543, - -0.11822860687971117, - 0 - ], - "y": [ - 4.935200214385986, - 14.945640563964844, - 5, - 14.946282386779783, - 10.034000396728516 - ], - "z": [ - 22, - 16.10511016845703, - 10.24928855895996, - 4.393090724945068, - 1.5 - ] - }, - { - "line": { - "color": "blue", - "width": 3 - }, - "marker": { - "color": "black", - "size": 0 - }, - "name": "Order 4", - "type": "scatter3d", - "x": [ - 0, - -0.233406662940979, - -0.25651583075523376, - -0.2796238660812378, - -0.09397591650485992, - 0 - ], - "y": [ - 4.935200214385986, - 14.945074081420898, - 5, - 14.944588661193848, - 5, - 10.034000396728516 - ], - "z": [ - 22, - 17.426870346069336, - 12.884565353393556, - 8.342482566833496, - 3.799619674682617, - 1.5 - ] - } - ], - "layout": { - "template": { - "data": { - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "histogram": [ - { - "marker": { - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "histogram" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter": [ - { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - }, - "type": "scatter" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", - "showlakes": true, - "showland": true, - "subunitcolor": "white" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", - "polar": { - "angularaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "radialaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "baxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "caxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - } - } - } - } - } - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "fig.data = fig.data[:2] # Keep only first 2 traces: geometry and TX/RX\n", "\n", @@ -6945,60 +430,28 @@ "While this offers a solution to the memory allocation issue, this does not reduce the number of path candidates. To reduce this number, you somehow need to prune a subset of the path candidates before you actually generate them.\n", "\n", "Recalling the graph analogy we mentioned above, we can implement this behavior by disconnecting some primitives (i.e., triangles) in the graph.\n", - "There is no unique solution to this challenge, but we still provide a small utility to estimate the visibility matrix of a given scene: .\n", + "There is no unique solution to this challenge, but we still provide a small utility to estimate the visibility matrix of a given scene: {func}`triangles_visible_from_vertices`.\n", + "\n", + "Then, from this visibility matrix, which is actually just an adjacency matrix of the nodes in the graph,\n", + "we can instantiate a {class}`DiGraph` from the {mod}`differt_core.rt.graph` module.\n", "\n", - "Then, from this visibility matrix, which is actually just an adjacency matrix, we can instantiate a {class}`DiGraph` from the {mod}`differt_core.rt.graph` module.\n", + "[^1]: The first node to be visited can be any of the `num_triangles` nodes. For the next nodes, we will have to choose between `num_triangles - 1` nodes, because we do not allow for loops (i.e., cycles) in our graph.\n", "\n", - "[^1]: The first node to be visited can be any of the `num_triangles` nodes. For the next nodes, we will have to choose between `num_triangles - 1` nodes, because we do not allow for loops (i.e., cycles) in our graph." + "### Numbers getting crazy\n", + "\n", + "To illustrate what we said above, we will load a much large scene that contains quite a few objects, i.e., triangles.\n", + "\n", + "A transmitter (TX) and a receiver (RX) are placed in the scene as examples." ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "435cf5c1-c0dd-47a1-9c1f-49c2d1d89b3d", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "f5f5f9a26e40490c8c9a5ebad182be84", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "RFBOutputContext()" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "0ffe5915909346309804bb7ab47add18", - "version_major": 2, - "version_minor": 0 - }, - "text/html": [ - "
snapshot
" - ], - "text/plain": [ - "CanvasBackend(css_height='600px', css_width='800px')" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "# TODO: load larger scene\n", - "# TODO: show example with multiple receivers\n", - "# TODO: show how to generate visibility matrix and actually use it.\n", - "# TODO: add utilities to insert to and from nodes, but with an optional \"connectivity\" argument?\n", - "# TODO: create an \"AlmostCompleteGraph\" that specializes to the exception of \"from\" and \"to\" not being connected?\n", - "\n", - "from differt.rt.utils import triangles_visible_from_vertices\n", + "from differt.scene.triangle_scene import TriangleScene\n", "\n", "mesh_file = \"bruxelles.obj\"\n", "mesh = TriangleMesh.load_obj(mesh_file)\n", @@ -7006,47 +459,38 @@ "tx = jnp.array([-40.0, 75, 30.0])\n", "rx = jnp.array([+20.0, 108.034, 1.50])\n", "\n", - "mesh.plot(backend=\"vispy\")" + "scene = TriangleScene(transmitters=tx, receivers=rx, mesh=mesh)\n", + "scene.plot(backend=\"vispy\")" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "6ef52f5e-5620-4e6d-a731-8c7bad893641", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "14206" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "mesh.num_objects # This is the number of triangles" ] }, + { + "cell_type": "markdown", + "id": "51243bb9", + "metadata": {}, + "source": [ + "This number isn't actually that big, and can easily reach above a million on large cities.\n", + "However, it is large enough to present serious challenges when it comes to performing exhaustive Ray Tracing (RT).\n", + "\n", + "Using this library, we can compute the exact number of path candidates one would have to try for a given\n", + "number of interactions." + ] + }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "fea3cba1-938f-49b2-ab21-ae88396e5b55", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'2.018e+08'" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from differt_core.rt.graph import CompleteGraph\n", "\n", @@ -7060,45 +504,57 @@ "f\"{len(graph.all_paths(from_, to, depth)):.3e}\"" ] }, + { + "cell_type": "markdown", + "id": "917fbcc6", + "metadata": {}, + "source": [ + "That means that there are over 200 million second order reflection paths to test... We need to reduce that number!" + ] + }, + { + "cell_type": "markdown", + "id": "4974a586", + "metadata": {}, + "source": [ + "### Assuming quadrilaterals\n", + "\n", + "In many cases, a scene is simply a collection of quadrilaterals, that are each split into\n", + "two triangles. This is not alwarys true, and probably not the case for our scene, but we\n", + "will assume it is.\n", + "\n", + "Using {func}`set_assume_quads`.\n", + "As computing such matrix can be extremily expensive, it is recommended to perform that\n", + "as a pre-precessing step and save the resulting matrix in a file.\n", + "\n", + "The code below shows how to estimate[^2] the objects (i.e., triangles) seen by TX.\n", + "For this example, visible triangles are colored in red.\n", + "\n", + "[^2]: It is an estimate because a fixed number of rays (see {func}`triangles_visible_from_vertices`) is launched from TX, and increasing (resp. decreasing) this number will increase (resp. decrease) the accuracy of the method." + ] + }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "08ab9f72-5d52-488c-bc09-7a635b7ab7a8", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "ade58006967e49e6bdf19ee1433bba09", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "RFBOutputContext()" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "46144ede403047188c7c714d98141e69", - "version_major": 2, - "version_minor": 0 - }, - "text/html": [ - "
snapshot
" - ], - "text/plain": [ - "CanvasBackend(css_height='600px', css_width='800px')" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ + "from differt.rt.utils import triangles_visible_from_vertices\n", + "\n", + "tx = jnp.array([-40.0, 75, 30.0])\n", + "\n", "default_color = jnp.array([[0.2, 0.2, 0.2]])\n", "visible_color = jnp.array([[1.0, 0.2, 0.2]])\n", "visible_triangles = triangles_visible_from_vertices(\n", @@ -7170,66 +626,70 @@ "canvas" ] }, + { + "cell_type": "markdown", + "id": "f1104575", + "metadata": {}, + "source": [ + "A visibility vector is simply an array of boolean, each entry indicating if a corresponding\n", + "object (here, a triangle) can be seen from TX.\n", + "\n", + "The number of visible triangles is then the sum of all true entries in the array." + ] + }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "4bd97917-c5d3-4b7e-b29a-c071b7a579cc", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Array(0.33851892, dtype=float32)" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], + "source": [ + "visible_triangles.sum() / mesh.num_triangles # ~ 34% of triangles are seen from TX" + ] + }, + { + "cell_type": "markdown", + "id": "7c0354a8", + "metadata": {}, "source": [ - "visible_triangles.sum() / mesh.num_triangles" + "It is also possible get the number of visible quadrilaterals by\n", + "counting visible triangles by pairs. If any of the two triangles\n", + "forming a quadrilateral is visible, then this quadrilateral **is considered visible**." ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "bf54e4da", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Array(0.4400957, dtype=float32)" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "visible_quads = visible_triangles.reshape(mesh.num_quads, 2).any(axis=-1)\n", "visible_quads.sum() / mesh.num_quads # ~ 44% of quadrilaterals are seen from TX" ] }, + { + "cell_type": "markdown", + "id": "e6566874", + "metadata": {}, + "source": [ + "We can then use this information to inform the graph about the limited number of faces\n", + "visible from TX.\n", + "\n", + "As expected, the number of path candidates get reduced to about 44% of the previous value.\n", + "\n", + "However, 44% visibility is probably to high to switch from a\n", + "{class}`CompleteGraph`\n", + "to a {class}`DiGraph`,\n", + "as iterating through the later is quite slower (because the former is optimized)." + ] + }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "ca360b86", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'2.220e+07'" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from differt_core.rt.graph import CompleteGraph, DiGraph\n", "\n", @@ -7240,6 +700,27 @@ "\n", "f\"{graph.all_paths(from_, to, order + 2).count():.3e}\" # ~ 44% of the previous length" ] + }, + { + "cell_type": "markdown", + "id": "3c3229ef", + "metadata": {}, + "source": [ + "### What about Ray Launching\n", + "\n", + "Eventually, all the above solutions reach a glass ceiling at one point or another,\n", + "where the number of path candidates takes over any possible optimization.\n", + "\n", + "In those cases, Ray Launching (RL) can be used as an alternative to exhaustive RT,\n", + "as the number of path candidates is usually fixed, a bit like when estimating the\n", + "visibility from TX.\n", + "This is fact what tools like Sionna use for coverage map.\n", + "\n", + "Currently, DiffeRT does not provide any convenient RL routine, but it is on the roadmap,\n", + "so stay tuned!\n", + "\n", + "If you want to contribute to extending DiffeRT, please feel free to reach out on GitHub!" + ] } ], "metadata": { From 12b8698e2994b877e43659cccabeb99beaa211e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Fri, 18 Oct 2024 17:42:00 +0200 Subject: [PATCH 12/12] fixes --- differt-core/src/rt/graph.rs | 2 +- docs/source/notebooks/advanced_path_tracing.ipynb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/differt-core/src/rt/graph.rs b/differt-core/src/rt/graph.rs index a5188321..908f2943 100644 --- a/differt-core/src/rt/graph.rs +++ b/differt-core/src/rt/graph.rs @@ -646,7 +646,7 @@ pub mod directed { ); self.edges_list .iter_mut() - .zip(to_adjacency.into_iter()) + .zip(to_adjacency) .for_each(|(edges, &is_adjacent)| { if is_adjacent { edges.push(to) diff --git a/docs/source/notebooks/advanced_path_tracing.ipynb b/docs/source/notebooks/advanced_path_tracing.ipynb index 89e4400a..766af6ec 100644 --- a/docs/source/notebooks/advanced_path_tracing.ipynb +++ b/docs/source/notebooks/advanced_path_tracing.ipynb @@ -439,7 +439,7 @@ "\n", "### Numbers getting crazy\n", "\n", - "To illustrate what we said above, we will load a much large scene that contains quite a few objects, i.e., triangles.\n", + "To illustrate what we said above, we will load a much larger scene that contains quite a few objects, i.e., triangles.\n", "\n", "A transmitter (TX) and a receiver (RX) are placed in the scene as examples." ] @@ -652,7 +652,7 @@ "id": "7c0354a8", "metadata": {}, "source": [ - "It is also possible get the number of visible quadrilaterals by\n", + "It is also possible to get the number of visible quadrilaterals by\n", "counting visible triangles by pairs. If any of the two triangles\n", "forming a quadrilateral is visible, then this quadrilateral **is considered visible**." ] @@ -678,10 +678,10 @@ "\n", "As expected, the number of path candidates get reduced to about 44% of the previous value.\n", "\n", - "However, 44% visibility is probably to high to switch from a\n", + "However, 44% visibility is probably too high to switch from a\n", "{class}`CompleteGraph`\n", "to a {class}`DiGraph`,\n", - "as iterating through the later is quite slower (because the former is optimized)." + "as iterating through the latter is quite slower (because the former is optimized)." ] }, {