Commit 04055bba authored by Pierre Paleo's avatar Pierre Paleo
Browse files

Use DataUrl for first argument

parent c38ea44a
......@@ -213,7 +213,7 @@ class FlatFieldLoader:
def __init__(
self, h5_file, h5_path, image_keys, image_type,
self, data_url, image_keys, image_type,
reduction_method="mean", lookup_files=None, logger=None
......@@ -221,10 +221,8 @@ class FlatFieldLoader:
h5_file: str
File name of the HDF5 file.
h5_path: str
HDF5 path to the data volume.
A DataUrl object containing the URL to the volume data.
image_keys: list of int
List of keys corresponding to each image of the data volume.
See Nexus Format specification, NXtomo, "image_key".
......@@ -238,8 +236,7 @@ class FlatFieldLoader:
logger: Logger object, optional
Logging object
self.h5_file = h5_file
self.h5_path = h5_path
self.data_url = data_url
self.image_keys = image_keys
......@@ -275,7 +272,7 @@ class FlatFieldLoader:
Attempt at loading already computed "final" darks and flats from existing files.
basedir = os.path.dirname(self.h5_file)
basedir = os.path.dirname(self.data_url.file_path())
existing_data = None
for fpath in self.lookup_files:
existing_data = self.load_existing_flatfield(fpath)
......@@ -348,8 +345,8 @@ class FlatFieldLoader:
Get a data chunk from the data volume whose path was specified at class instantiation.
with HDF5File(self.h5_file, "r", swmr=True) as f:
data_raw = f[self.h5_path][data_slice]
with HDF5File(self.data_url.file_path(), "r", swmr=True) as f:
data_raw = f[self.data_url.data_path()][data_slice]
return data_raw
......@@ -384,7 +381,7 @@ class FlatFieldLoader:
return existing_imgs
img_slices = self.get_data_slices(self.image_keys, val_to_nxkey[self.image_type])
if img_slices == []:
self.logger.error("No %s found in %s" % (self.image_type, self.h5_file))
self.logger.error("No %s found in %s" % (self.image_type, self.data_url.file_path()))
return None
res = {}
for data_slice in img_slices:
Supports Markdown
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