Skip to content

Commit

Permalink
fix: SeriesFolder did not pass on holo_kw when loading hologram data
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jul 22, 2019
1 parent c8be272 commit 40efa35
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0.10.2
- fix: SeriesFolder did not pass on holo_kw when loading hologram data
0.10.1
- fix: SeriesHdf5Qpimage did not correctly load meta data "time"
0.10.0
Expand Down
3 changes: 3 additions & 0 deletions qpformat/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def load_data(path, fmt=None, bg_data=None, bg_fmt=None,
is be guessed.
meta_data: dict
Meta data (see `qpimage.meta.DATA_KEYS`)
holo_kw: dict
Keyword arguments for hologram data; See
:func:`qpimage.holo.get_field` for valid keyword arguments.
as_type: str
Defines the data type that the input data is casted to.
The default is "float32" which saves memory. If high
Expand Down
3 changes: 2 additions & 1 deletion qpformat/file_formats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def _get_dataset(self, idx):
format_class = formats_dict[self._formats[idx]]
self._dataset[idx] = format_class(path=self._files[idx],
meta_data=self.meta_data,
as_type=self.as_type)
as_type=self.as_type,
holo_kw=self.holo_kw)
if len(self._dataset[idx]) != 1:
msg = "Multiple images per file are not supported in the " \
+ "SeriesFolder file format! Besides the fact that it " \
Expand Down
14 changes: 14 additions & 0 deletions tests/test_series_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ def test_multiple_formats_error():
shutil.rmtree(path, ignore_errors=True)


def test_series_format_holo_kw():
"""Siedband kwarg should be passed to subformats"""
# combine a zip file with a regular hologram file
path, _files2 = setup_folder_single_holo()
bad_path = datapath / "series_phasics.zip"
shutil.copy2(bad_path, path)
ds1 = qpformat.load_data(path, holo_kw={"sideband": 1})
ds2 = qpformat.load_data(path, holo_kw={"sideband": -1})
p1 = ds1.get_qpimage(0)
p2 = ds2.get_qpimage(0)
assert np.all(p1.pha + p2.pha == 0)
shutil.rmtree(path, ignore_errors=True)


def test_series_format_ignored():
"""Series file formats are ignored in SeriesFolder"""
# combine a zip file with a regular hologram file
Expand Down

0 comments on commit 40efa35

Please sign in to comment.