Commit c1f85119 authored by Thomas Vincent's avatar Thomas Vincent

Add read/write normalization to qspace hdf5 file

parent fdac2eaf
......@@ -29,6 +29,8 @@ __authors__ = ["D. Naudet"]
__license__ = "MIT"
__date__ = "15/09/2016"
import sys
import weakref
from collections import OrderedDict
from contextlib import contextmanager
......@@ -37,6 +39,12 @@ import numpy as _np
from .XsocsH5Base import XsocsH5Base
# Python 2/3 compatibility
if sys.version_info[0] >= 3:
text_type = str
else:
text_type = unicode
class QSpaceH5(XsocsH5Base):
qspace_path = 'Data/qspace'
......@@ -167,6 +175,14 @@ class QSpaceH5(XsocsH5Base):
return [entry.decode() for entry in entries]
return []
@property
def image_normalizer(self):
"""Returns the image normalizer used when converting to q space.
:rtype: Union[str, None]
"""
return self._get_array_data(self.params_path + '/image_normalizer')
@property
def image_binning(self):
"""
......@@ -385,6 +401,15 @@ class QSpaceH5Writer(QSpaceH5):
path = self.entries_path + '/has_shift'
self._set_scalar_data(path, has_shift)
def set_image_normalizer(self, normalizer):
"""Stores the image normalizer used when converting to q space
:param str normalizer:
Name of measurement group dataset to use
"""
path = self.params_path + '/image_normalizer'
self._create_dataset(path, data=text_type(normalizer))
def set_image_binning(self, image_binning):
"""
Stores the image binning used when converting to q space
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment