Skip to content

Commit

Permalink
io/read_zygo_datx: fix binary string decoding issues
Browse files Browse the repository at this point in the history
  • Loading branch information
brandondube committed Apr 18, 2021
1 parent 2fa490e commit 00e3b64
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions prysm/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,10 +613,9 @@ def read_zygo_datx(file):
# get a little metadata
no_data = phase_obj.attrs['No Data'][0]
wvl = phase_obj.attrs['Wavelength'][0] * 1e9 # Zygo stores wavelength in meters, we want output in nanometers
punit = str(phase_obj.attrs['Unit'][0])[2:-1] # this for some reason is "b'Fringes'", need to slice off b' and '
punit = phase_obj.attrs['Unit'][0].decode('UTF-8') # this for some reason is "b'Fringes'", need to slice off b' and '
scale_factor = phase_obj.attrs['Interferometric Scale Factor']
obliquity = phase_obj.attrs['Obliquity Factor']

# get the phase and process it as required
phase = np.flipud(f['Data']['Surface'][phase_key][()])
# step 1, flip (above)
Expand Down Expand Up @@ -654,7 +653,7 @@ def read_zygo_datx(file):
elif key in ['Property Bag List', 'Group Number', 'TextCount']:
continue # h5py particulars
if value.dtype == 'object':
value = str(value[0]) # object dtype is a string
value = value[0].decode('UTF-8') # object dtype is a string
elif value.dtype in ['uint8', 'int32']:
value = int(value[0])
elif value.dtype in ['float64']:
Expand Down

0 comments on commit 00e3b64

Please sign in to comment.