Skip to content

Commit 866b7ca

Browse files
committed
plot: Add start/end options
1 parent fd624d6 commit 866b7ca

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ dovi_tool <SUBCOMMAND> --help
152152

153153
**Flags**:
154154
- `-t`, `--title` The title to set at the top of the plot
155+
- `-s`, `--start` Set frame range start
156+
- `-e`, `--end` Set frame range end (inclusive)
155157

156158
**Example**:
157159
```console

src/commands/plot.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,10 @@ pub struct PlotArgs {
3333

3434
#[arg(long, short = 't', help = "Title to use at the top")]
3535
pub title: Option<String>,
36+
37+
#[arg(long, short = 's', help = "Set frame range start")]
38+
pub start: Option<usize>,
39+
40+
#[arg(long, short = 'e', help = "Set frame range end (inclusive)")]
41+
pub end: Option<usize>,
3642
}

src/dovi/plotter.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ impl Plotter {
5454
input_pos,
5555
output,
5656
title,
57+
start: start_arg,
58+
end: end_arg,
5759
} = args;
5860

5961
let output = output.unwrap_or(PathBuf::from("L1_plot.png"));
@@ -63,7 +65,12 @@ impl Plotter {
6365
let plotter = Plotter { input };
6466

6567
println!("Parsing RPU file...");
66-
let rpus = parse_rpu_file(plotter.input)?;
68+
let orig_rpus = parse_rpu_file(plotter.input)?;
69+
70+
// inclusive range, end must be last RPU index
71+
let start = start_arg.unwrap_or(0);
72+
let end = end_arg.unwrap_or(orig_rpus.len() - 1);
73+
let rpus = &orig_rpus[start..=end];
6774

6875
let x_spec = 0..rpus.len();
6976

@@ -74,7 +81,7 @@ impl Plotter {
7481
.titled(&title, ("sans-serif", 40))?;
7582

7683
println!("Plotting...");
77-
let summary = RpusListSummary::new(&rpus)?;
84+
let summary = RpusListSummary::new(rpus)?;
7885

7986
let mut chart = ChartBuilder::on(&root)
8087
.x_label_area_size(60)

0 commit comments

Comments
 (0)