Commit 46a98752 authored by payno's avatar payno
Browse files

[tomohdf5scan] fix units conversion from _get_value and return distance in meter now

parent 1efd86cb
Pipeline #28217 passed with stages
in 1 minute and 53 seconds
......@@ -657,11 +657,11 @@ class HDF5TomoScan(TomoScanBase):
value = node[()]
if 'unit' in node.attrs:
unit = node.attrs['unit']
if 'units' in node.attrs:
elif 'units' in node.attrs:
unit = node.attrs['units']
else:
unit = default_unit
return value / metricsystem.MetricSystem.from_value(unit).value
return value * metricsystem.MetricSystem.from_value(unit).value
def _check_hdf5scan_validity(self):
if self.master_file is None:
......
......@@ -190,12 +190,12 @@ class TestHDF5Scan(HDF5TestBaseClass):
pixel_size = self.scan.pixel_size
self.assertTrue(pixel_size is not None)
self.assertTrue(numpy.isclose(self.scan.pixel_size,
0.05 * metricsystem.MetricSystem.MICROMETER.value))
self.assertTrue(numpy.isclose(self.scan.get_pixel_size(unit='micrometer'), 0.05))
0.05 * metricsystem.MetricSystem.MILLIMETER.value))
self.assertTrue(numpy.isclose(self.scan.get_pixel_size(unit='micrometer'), 50))
self.assertTrue(numpy.isclose(self.scan.x_pixel_size,
0.05 * metricsystem.MetricSystem.MICROMETER.value))
0.05 * metricsystem.MetricSystem.MILLIMETER.value))
self.assertTrue(numpy.isclose(self.scan.y_pixel_size,
0.05 * metricsystem.MetricSystem.MICROMETER.value))
0.05 * metricsystem.MetricSystem.MILLIMETER.value))
def testNabuUtil(self):
self.assertTrue(numpy.isclose(self.scan.distance, -19.9735))
......
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