Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Mar 18, 2022
1 parent 1f03cb3 commit 5d28f5f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions qpformat/file_formats/fmts_raw_oah/series_hdf5_hyperspy.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,5 @@ def verify(path):
h5.attrs["file_format"].lower() == "hyperspy" and
"Experiments" in h5):
valid = True
h5.close()
return valid
3 changes: 2 additions & 1 deletion qpformat/file_formats/fmts_raw_oah/series_hdf5_raw_oah.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import functools

import h5py
import numpy as np
import qpimage

from ..dataset import SeriesData
Expand All @@ -24,7 +25,7 @@ def get_time(self, idx):
"""Time for each dataset"""
with h5py.File(self.path) as h5:
ds = h5[str(idx)]
thetime = ds.attrs.get("time", 0)
thetime = ds.attrs.get("time", np.nan)
return thetime

def get_qpimage_raw(self, idx):
Expand Down
5 changes: 3 additions & 2 deletions qpformat/file_formats/fmts_raw_oah/single_hdf5_raw_oah.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import copy
import h5py

import h5py
import numpy as np
import qpimage

from ..dataset import SingleData
Expand All @@ -25,7 +26,7 @@ def get_time(self, idx=0):
"""Time for each dataset"""
with h5py.File(self.path) as h5:
ds = h5["0"]
thetime = ds.attrs.get("time", 0)
thetime = ds.attrs.get("time", np.nan)
return thetime

def get_qpimage_raw(self, idx=0):
Expand Down
2 changes: 2 additions & 0 deletions qpformat/file_formats/fmts_raw_oah/single_tif_holo.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@ def verify(path):
else:
if len(tf.pages) == 1:
valid = True
if not hasattr(path, "seek"):
tf.close()
return valid
1 change: 1 addition & 0 deletions qpformat/file_formats/fmts_ready/series_hdf5_qpimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,5 @@ def verify(path):
"bg_data" in qpi0["phase"] and
"bg_data" in qpi0["amplitude"]):
valid = True
h5.close()
return valid
1 change: 1 addition & 0 deletions qpformat/file_formats/fmts_ready/single_tif_phasics.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,5 @@ def verify(path):
(tf.pages[0].tags[61242].value !=
tf.pages[1].tags[61242].value)):
valid = True
tf.close()
return valid

0 comments on commit 5d28f5f

Please sign in to comment.