Skip to content

Commit

Permalink
fix hamamatsu tiff reader if x axis not calibrated
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaehne committed Dec 16, 2024
1 parent 4e67875 commit 73d6b54
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions rsciio/tiff/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,11 @@ def _get_hamamatsu_streak_description(tiff, op):
scaling = dict_meta["Scaling"]

# Address in file where the X axis is saved
x_scale_address = int(re.findall(r"\d+", scaling["ScalingXScalingFile"])[0])
# If x axis is "Other" it just loads the axis as pixels
if scaling["ScalingXScalingFile"].startswith("Other"):
x_scale_address = None
else:
x_scale_address = int(re.findall(r"\d+", scaling["ScalingXScalingFile"])[0])
xlen = op["ImageWidth"]

# If focus mode is used there is no Y axis
Expand All @@ -709,8 +713,11 @@ def _get_hamamatsu_streak_description(tiff, op):
# Accessing the file as a binary
fh = tiff.filehandle
# Reading the x axis
fh.seek(x_scale_address, 0)
xax = np.fromfile(fh, dtype="f", count=xlen)
if x_scale_address is None:
xax = np.arange(xlen)
else:
fh.seek(x_scale_address, 0)
xax = np.fromfile(fh, dtype="f", count=xlen)
if y_scale_address is None:
yax = np.arange(ylen)
else:
Expand Down

0 comments on commit 73d6b54

Please sign in to comment.