Skip to content

Commit

Permalink
fix: wavelength could not be extracted for some phasics files
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Apr 11, 2021
1 parent e9c3f7d commit a1a42e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.10.8
- fix: wavelength could not be extracted for some phasics files
(section name "analyse data" vs "analyse data v1")
0.10.7
- ci: migrate to GHA
- docs: fix sphinx build
Expand Down
13 changes: 7 additions & 6 deletions qpformat/file_formats/single_tif_phasics.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def __init__(self, path, meta_data={}, *args, **kwargs):
def _get_meta_data(path, section, name):
with SingleTifPhasics._get_tif(path) as tf:
meta = tf.pages[0].tags[61238].value

meta = meta.strip("'b")
meta = meta.replace("\\n", "\n")
meta = meta.replace("\\r", "")
Expand Down Expand Up @@ -88,11 +87,13 @@ def _get_tif(path):
return tifffile.TiffFile(path)

def _get_wavelength(self, path):
wl_str = SingleTifPhasics._get_meta_data(path=path,
section="analyse data",
name="lambda(nm)")
if wl_str:
wavelength = float(wl_str) * 1e-9
for section in ["analyse data", "analyse data v1"]:
wl_str = SingleTifPhasics._get_meta_data(path=path,
section=section,
name="lambda(nm)")
if wl_str:
wavelength = float(wl_str) * 1e-9
break
else:
wavelength = np.nan
return wavelength
Expand Down

0 comments on commit a1a42e9

Please sign in to comment.