Skip to content

Commit

Permalink
fix tdms off by one error (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-chambers authored Dec 19, 2022
1 parent 834f324 commit baced71
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dascore/io/tdms/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit baced71

Please sign in to comment.