Skip to content

Commit 131836f

Browse files
avhzavhz
authored andcommitted
ci: remove plotters and polars deps
1 parent 0c984a7 commit 131836f

File tree

10 files changed

+190
-188
lines changed

10 files changed

+190
-188
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ nalgebra = "0.33.0" # https://docs.rs/nalgebra/latest/nalgebra/
9393
ndrustfft = "0.5.0" # https://docs.rs/ndrustfft/latest/ndrustfft/
9494
ndarray-rand = "0.15.0" # https://docs.rs/ndarray-rand/latest/ndarray_rand/
9595
plotly = "0.10.0" # https://docs.rs/plotly/latest/plotly/
96-
plotters = "0.3.5" # https://docs.rs/plotters/latest/plotters/
96+
# plotters = "0.3.5" # https://docs.rs/plotters/latest/plotters/
9797
rand = "0.8.5" # https://docs.rs/rand/latest/rand/
9898
rand_distr = "0.4.3" # https://docs.rs/rand_distr/latest/rand_distr/
9999
rayon = "1.9.0" # https://docs.rs/rayon/latest/rayon/

crates/RustQuant_data/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ RustQuant_time = { workspace = true }
2323
RustQuant_instruments = { workspace = true }
2424
rand = { workspace = true }
2525
RustQuant_math = { workspace = true }
26-
polars = { workspace = true }
2726
yahoo_finance_api = { workspace = true }
2827
time = { workspace = true }
2928
RustQuant_error = { workspace = true }

crates/RustQuant_error/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ workspace = true
1717
[dependencies]
1818
thiserror = { workspace = true }
1919
rand_distr = { workspace = true }
20-
polars = { workspace = true }
2120
yahoo_finance_api = { workspace = true }
2221

2322
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

crates/RustQuant_error/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ pub enum RustQuantError {
4747
#[error("Yahoo! Finance error: {0}")]
4848
YahooError(#[from] yahoo_finance_api::YahooError),
4949

50-
/// Error variant arising from Polars.
51-
#[error("Polars error: {0}")]
52-
PolarsError(#[from] polars::error::PolarsError),
53-
5450
/// Error variant arising from [`std::io`].
5551
#[error("IO error: {0}")]
5652
IoError(#[from] std::io::Error),

crates/RustQuant_math/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ rust_decimal = { workspace = true }
2929
rand = { workspace = true }
3030
rand_distr = { workspace = true }
3131
statrs = { workspace = true }
32-
polars = { workspace = true }
3332

3433
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3534
## RUSTDOC CONFIGURATION

crates/RustQuant_utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ metadata.workspace = true
1515
workspace = true
1616

1717
[dependencies]
18-
plotters = { workspace = true }
18+
# plotters = { workspace = true }
1919

2020
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2121
## RUSTDOC CONFIGURATION

crates/RustQuant_utils/src/lib.rs

Lines changed: 159 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -36,119 +36,119 @@ macro_rules! assert_approx_equal {
3636
};
3737
}
3838

39-
/// Plot a vector of values.
40-
#[macro_export]
41-
macro_rules! plot_vector {
42-
($v:expr, $file:expr) => {{
43-
// Macros are hygienic, so we need to import the libraries we want to use.
44-
use plotters::prelude::*;
45-
46-
let mut min = $v[0];
47-
let mut max = $v[0];
48-
let mut vec2d = Vec::new();
49-
50-
for (i, &val) in $v.iter().enumerate() {
51-
vec2d.push((i as f64, val));
52-
if val > max {
53-
max = val;
54-
} else if val < min {
55-
min = val;
56-
}
57-
}
58-
59-
let root = BitMapBackend::new($file, (640, 480)).into_drawing_area();
60-
root.fill(&full_palette::WHITE).unwrap();
61-
62-
let mut chart = plotters::prelude::ChartBuilder::on(&root)
63-
.caption($file, ("sans-serif", 30).into_font())
64-
.margin(5)
65-
.x_label_area_size(30)
66-
.y_label_area_size(30)
67-
.build_cartesian_2d(
68-
0f64..vec2d.len() as f64,
69-
(min * 0.95)..(max * 1.05), // 5% padding on y-axis
70-
)
71-
.unwrap();
72-
73-
chart.configure_mesh().draw().unwrap();
74-
chart
75-
.draw_series(LineSeries::new(vec2d, RED))
76-
.unwrap()
77-
.label($file);
78-
chart
79-
.configure_series_labels()
80-
.background_style(WHITE.mix(0.8))
81-
.border_style(BLACK)
82-
.draw()
83-
.unwrap();
84-
}};
85-
($($v:expr),+ => $file:expr) => {{
86-
use plotters::prelude::*;
87-
88-
let series: Vec<_> = vec![$($v),+];
89-
90-
let mut global_min = std::f64::MAX;
91-
let mut global_max = std::f64::MIN;
92-
let mut global_x_max: usize = 0;
93-
for s in series.iter() {
94-
for &val in s.iter() {
95-
if val < global_min {
96-
global_min = val;
97-
}
98-
if val > global_max {
99-
global_max = val;
100-
}
101-
}
102-
if s.len() > global_x_max {
103-
global_x_max = s.len();
104-
}
105-
}
106-
107-
let root = BitMapBackend::new($file, (640, 480)).into_drawing_area();
108-
root.fill(&WHITE).unwrap();
109-
110-
let mut chart = ChartBuilder::on(&root)
111-
.caption($file, ("sans-serif", 30).into_font())
112-
.margin(5)
113-
.x_label_area_size(30)
114-
.y_label_area_size(30)
115-
.build_cartesian_2d(
116-
0f64..(global_x_max as f64),
117-
(global_min * 0.95)..(global_max * 1.05) // 5% padding on y-axis
118-
)
119-
.unwrap();
120-
121-
chart.configure_mesh().draw().unwrap();
122-
123-
let colors = [RED, BLUE, GREEN, CYAN, MAGENTA, YELLOW, BLACK];
124-
125-
for (i, s) in series.iter().enumerate() {
126-
let points: Vec<(f64, f64)> = s
127-
.iter()
128-
.enumerate()
129-
.map(|(idx, &val)| (idx as f64, val))
130-
.collect();
131-
132-
chart
133-
.draw_series(LineSeries::new(points, colors[i % colors.len()]))
134-
.unwrap()
135-
.label(format!("Series {}", i))
136-
.legend(move |(x, y)| {
137-
PathElement::new(
138-
vec![(x, y), (x + 20, y)],
139-
colors[i % colors.len()].clone(),
140-
)
141-
});
142-
}
143-
144-
chart
145-
.configure_series_labels()
146-
.background_style(WHITE.mix(0.8))
147-
.border_style(&BLACK)
148-
.draw()
149-
.unwrap();
150-
}};
151-
}
39+
// /// Plot a vector of values.
40+
// #[macro_export]
41+
// macro_rules! plot_vector {
42+
// ($v:expr, $file:expr) => {{
43+
// // Macros are hygienic, so we need to import the libraries we want to use.
44+
// use plotters::prelude::*;
45+
46+
// let mut min = $v[0];
47+
// let mut max = $v[0];
48+
// let mut vec2d = Vec::new();
49+
50+
// for (i, &val) in $v.iter().enumerate() {
51+
// vec2d.push((i as f64, val));
52+
// if val > max {
53+
// max = val;
54+
// } else if val < min {
55+
// min = val;
56+
// }
57+
// }
58+
59+
// let root = BitMapBackend::new($file, (640, 480)).into_drawing_area();
60+
// root.fill(&full_palette::WHITE).unwrap();
61+
62+
// let mut chart = plotters::prelude::ChartBuilder::on(&root)
63+
// .caption($file, ("sans-serif", 30).into_font())
64+
// .margin(5)
65+
// .x_label_area_size(30)
66+
// .y_label_area_size(30)
67+
// .build_cartesian_2d(
68+
// 0f64..vec2d.len() as f64,
69+
// (min * 0.95)..(max * 1.05), // 5% padding on y-axis
70+
// )
71+
// .unwrap();
72+
73+
// chart.configure_mesh().draw().unwrap();
74+
// chart
75+
// .draw_series(LineSeries::new(vec2d, RED))
76+
// .unwrap()
77+
// .label($file);
78+
// chart
79+
// .configure_series_labels()
80+
// .background_style(WHITE.mix(0.8))
81+
// .border_style(BLACK)
82+
// .draw()
83+
// .unwrap();
84+
// }};
85+
// ($($v:expr),+ => $file:expr) => {{
86+
// use plotters::prelude::*;
87+
88+
// let series: Vec<_> = vec![$($v),+];
89+
90+
// let mut global_min = std::f64::MAX;
91+
// let mut global_max = std::f64::MIN;
92+
// let mut global_x_max: usize = 0;
93+
// for s in series.iter() {
94+
// for &val in s.iter() {
95+
// if val < global_min {
96+
// global_min = val;
97+
// }
98+
// if val > global_max {
99+
// global_max = val;
100+
// }
101+
// }
102+
// if s.len() > global_x_max {
103+
// global_x_max = s.len();
104+
// }
105+
// }
106+
107+
// let root = BitMapBackend::new($file, (640, 480)).into_drawing_area();
108+
// root.fill(&WHITE).unwrap();
109+
110+
// let mut chart = ChartBuilder::on(&root)
111+
// .caption($file, ("sans-serif", 30).into_font())
112+
// .margin(5)
113+
// .x_label_area_size(30)
114+
// .y_label_area_size(30)
115+
// .build_cartesian_2d(
116+
// 0f64..(global_x_max as f64),
117+
// (global_min * 0.95)..(global_max * 1.05) // 5% padding on y-axis
118+
// )
119+
// .unwrap();
120+
121+
// chart.configure_mesh().draw().unwrap();
122+
123+
// let colors = [RED, BLUE, GREEN, CYAN, MAGENTA, YELLOW, BLACK];
124+
125+
// for (i, s) in series.iter().enumerate() {
126+
// let points: Vec<(f64, f64)> = s
127+
// .iter()
128+
// .enumerate()
129+
// .map(|(idx, &val)| (idx as f64, val))
130+
// .collect();
131+
132+
// chart
133+
// .draw_series(LineSeries::new(points, colors[i % colors.len()]))
134+
// .unwrap()
135+
// .label(format!("Series {}", i))
136+
// .legend(move |(x, y)| {
137+
// PathElement::new(
138+
// vec![(x, y), (x + 20, y)],
139+
// colors[i % colors.len()].clone(),
140+
// )
141+
// });
142+
// }
143+
144+
// chart
145+
// .configure_series_labels()
146+
// .background_style(WHITE.mix(0.8))
147+
// .border_style(&BLACK)
148+
// .draw()
149+
// .unwrap();
150+
// }};
151+
// }
152152

153153
#[cfg(test)]
154154
mod tests_plotters {
@@ -172,50 +172,50 @@ mod tests_plotters {
172172
assert_approx_equal!(1_f64.acosh(), 0.0, EPS);
173173
}
174174

175-
#[test]
176-
fn test_plot_vector_macro() {
177-
let v = [1.0, 2.0, 3.0, 4.0, 5.0, 4.0, 6.0, 3.0, 7.0, 2.0, 8.0, 1.0];
178-
let file = "plot_macro.png";
179-
180-
// THIS WORKS.
181-
plot_vector!(v, file);
182-
183-
// Check if the file exists
184-
if std::fs::metadata(file).is_ok() {
185-
println!("File exists. Attempting to remove...");
186-
187-
// Remove the file
188-
if let Err(e) = std::fs::remove_file(file) {
189-
println!("Failed to remove file: {}", e);
190-
} else {
191-
println!("Successfully removed file.");
192-
}
193-
} else {
194-
println!("File does not exist.");
195-
}
196-
}
197-
198-
#[test]
199-
fn test_plot_vector_macro_multi() {
200-
let v1 = [1.0, 2.0, 3.0, 4.0, 5.0, 4.0, 6.0, 3.0, 7.0, 2.0, 8.0, 1.0];
201-
let v2 = [2.0, 3.0, 4.0, 5.0, 4.0, 6.0, 3.0, 7.0, 2.0, 8.0, 1.0, 8.0];
202-
let file = "./plot_macro2.png";
203-
204-
// THIS WORKS.
205-
plot_vector!(v1, v2 => &file);
206-
207-
// Check if the file exists
208-
if std::path::PathBuf::from(file).exists() {
209-
println!("File exists. Attempting to remove...");
210-
211-
// Remove the file
212-
if let Err(_) = std::fs::remove_file(file) {
213-
println!("Failed to remove file");
214-
} else {
215-
println!("Successfully removed file.");
216-
}
217-
} else {
218-
println!("File does not exist");
219-
}
220-
}
175+
// #[test]
176+
// fn test_plot_vector_macro() {
177+
// let v = [1.0, 2.0, 3.0, 4.0, 5.0, 4.0, 6.0, 3.0, 7.0, 2.0, 8.0, 1.0];
178+
// let file = "plot_macro.png";
179+
180+
// // THIS WORKS.
181+
// plot_vector!(v, file);
182+
183+
// // Check if the file exists
184+
// if std::fs::metadata(file).is_ok() {
185+
// println!("File exists. Attempting to remove...");
186+
187+
// // Remove the file
188+
// if let Err(e) = std::fs::remove_file(file) {
189+
// println!("Failed to remove file: {}", e);
190+
// } else {
191+
// println!("Successfully removed file.");
192+
// }
193+
// } else {
194+
// println!("File does not exist.");
195+
// }
196+
// }
197+
198+
// #[test]
199+
// fn test_plot_vector_macro_multi() {
200+
// let v1 = [1.0, 2.0, 3.0, 4.0, 5.0, 4.0, 6.0, 3.0, 7.0, 2.0, 8.0, 1.0];
201+
// let v2 = [2.0, 3.0, 4.0, 5.0, 4.0, 6.0, 3.0, 7.0, 2.0, 8.0, 1.0, 8.0];
202+
// let file = "./plot_macro2.png";
203+
204+
// // THIS WORKS.
205+
// plot_vector!(v1, v2 => &file);
206+
207+
// // Check if the file exists
208+
// if std::path::PathBuf::from(file).exists() {
209+
// println!("File exists. Attempting to remove...");
210+
211+
// // Remove the file
212+
// if let Err(_) = std::fs::remove_file(file) {
213+
// println!("Failed to remove file");
214+
// } else {
215+
// println!("Successfully removed file.");
216+
// }
217+
// } else {
218+
// println!("File does not exist");
219+
// }
220+
// }
221221
}

examples/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ rand = { workspace = true }
2121
nalgebra = { workspace = true }
2222
rand_distr = { workspace = true }
2323
statrs = { workspace = true }
24-
polars = { workspace = true }
2524
finitediff = { workspace = true }
26-
plotters = { workspace = true }
25+
# polars = { workspace = true }
26+
# plotters = { workspace = true }

0 commit comments

Comments
 (0)