From baced71564b25c5850f2394015820fdd4faa0763 Mon Sep 17 00:00:00 2001 From: Derrick Chambers Date: Mon, 19 Dec 2022 11:55:39 -0700 Subject: [PATCH] fix tdms off by one error (#85) --- dascore/io/tdms/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dascore/io/tdms/utils.py b/dascore/io/tdms/utils.py index 11736f69..96c31541 100644 --- a/dascore/io/tdms/utils.py +++ b/dascore/io/tdms/utils.py @@ -60,7 +60,11 @@ def _get_distance_array(tdms_file=None, attrs=None): zero_offset = attrs["distance_min"] channel_spacing = attrs["d_distance"] * attrs["Fibre Length Multiplier"] max_dist = attrs["distance_max"] - dist = np.arange(zero_offset, max_dist, channel_spacing) + # Note: I found files where the end was slightly less than one channel spacing + # as a result the distance array was one channels short. Adding 10% of the + # channels spacing to distance_max fixes the issue without causing problems + # for files that don't have this rounding error. + dist = np.arange(zero_offset, max_dist + channel_spacing / 10, channel_spacing) return dist