Skip to content

Commit

Permalink
Add convenience nav_shape method to QdAcquisitionHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
sk1p committed Jul 24, 2024
1 parent 6bfe1fb commit 3759fe0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libertem_qd_mpx/src/base_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,13 @@ impl QdAcquisitionHeader {
fn frames_per_trigger(&self) -> usize {
self.frames_per_trigger
}

fn nav_shape(&self) -> Option<(usize, usize)> {
if let (Some(scan_x), Some(scan_y)) = (self.scan_x, self.scan_y) {
return Some((scan_y, scan_x));
}
None
}
}

fn get_key_and_parse<T: FromStr>(
Expand Down Expand Up @@ -894,6 +901,8 @@ End
assert_eq!(header.num_frames(), 580);
assert_eq!(header.get_scan_x(), Some(28));
assert_eq!(header.get_scan_y(), Some(20));

assert_eq!(header.nav_shape(), Some((20, 28)));
}

#[test]
Expand Down

0 comments on commit 3759fe0

Please sign in to comment.