Commit 2ba295da authored by Henri Payno's avatar Henri Payno
Browse files

PEP8

parent d247c4fb
Pipeline #65834 passed with stages
in 3 minutes and 6 seconds
...@@ -471,8 +471,8 @@ class _DxFileToNxConverter(BaseConverter): ...@@ -471,8 +471,8 @@ class _DxFileToNxConverter(BaseConverter):
self._path_nxtomo_attrs(root_grp) self._path_nxtomo_attrs(root_grp)
def _path_nxtomo_attrs(self, root_grp): def _path_nxtomo_attrs(self, root_grp):
root_grp.attrs["NX_class"] = u"NXentry" root_grp.attrs["NX_class"] = "NXentry"
root_grp.attrs["definition"] = u"NXtomo" root_grp.attrs["definition"] = "NXtomo"
root_grp.attrs["version"] = converter_version() root_grp.attrs["version"] = converter_version()
root_grp.attrs["default"] = "instrument/detector" root_grp.attrs["default"] = "instrument/detector"
instrument_grp = root_grp.require_group("instrument") instrument_grp = root_grp.require_group("instrument")
...@@ -486,7 +486,7 @@ class _DxFileToNxConverter(BaseConverter): ...@@ -486,7 +486,7 @@ class _DxFileToNxConverter(BaseConverter):
if "data" in detector_grp: if "data" in detector_grp:
detector_grp["data"].attrs["interpretation"] = "image" detector_grp["data"].attrs["interpretation"] = "image"
sample_node = root_grp.require_group("sample") sample_node = root_grp.require_group("sample")
sample_node.attrs["NX_class"] = u"NXsample" sample_node.attrs["NX_class"] = "NXsample"
def _convert_frames_without_duplication(self): def _convert_frames_without_duplication(self):
image_key = [] image_key = []
......
...@@ -273,7 +273,7 @@ def edf_to_nx( ...@@ -273,7 +273,7 @@ def edf_to_nx(
) )
if distance is not None: if distance is not None:
h5d["/entry/instrument/detector/distance"] = distance h5d["/entry/instrument/detector/distance"] = distance
h5d["/entry/instrument/detector/distance"].attrs["unit"] = u"m" h5d["/entry/instrument/detector/distance"].attrs["unit"] = "m"
pixel_size = scan.retrieve_information( pixel_size = scan.retrieve_information(
scan=os.path.abspath(scan.path), scan=os.path.abspath(scan.path),
...@@ -285,11 +285,11 @@ def edf_to_nx( ...@@ -285,11 +285,11 @@ def edf_to_nx(
h5d["/entry/instrument/detector/x_pixel_size"] = ( h5d["/entry/instrument/detector/x_pixel_size"] = (
pixel_size * metricsystem.millimeter.value pixel_size * metricsystem.millimeter.value
) )
h5d["/entry/instrument/detector/x_pixel_size"].attrs["unit"] = u"m" h5d["/entry/instrument/detector/x_pixel_size"].attrs["unit"] = "m"
h5d["/entry/instrument/detector/y_pixel_size"] = ( h5d["/entry/instrument/detector/y_pixel_size"] = (
pixel_size * metricsystem.millimeter.value pixel_size * metricsystem.millimeter.value
) )
h5d["/entry/instrument/detector/y_pixel_size"].attrs["unit"] = u"m" h5d["/entry/instrument/detector/y_pixel_size"].attrs["unit"] = "m"
energy = scan.retrieve_information( energy = scan.retrieve_information(
scan=os.path.abspath(scan.path), scan=os.path.abspath(scan.path),
...@@ -300,7 +300,7 @@ def edf_to_nx( ...@@ -300,7 +300,7 @@ def edf_to_nx(
) )
if energy is not None: if energy is not None:
h5d["/entry/instrument/beam/incident_energy"] = energy h5d["/entry/instrument/beam/incident_energy"] = energy
h5d["/entry/instrument/beam/incident_energy"].attrs["unit"] = u"keV" h5d["/entry/instrument/beam/incident_energy"].attrs["unit"] = "keV"
# rotations values # rotations values
rotation_dataset = h5d.create_dataset( rotation_dataset = h5d.create_dataset(
...@@ -590,13 +590,13 @@ def edf_to_nx( ...@@ -590,13 +590,13 @@ def edf_to_nx(
) )
# we can add some more NeXus look and feel # we can add some more NeXus look and feel
h5d["/entry"].attrs["NX_class"] = u"NXentry" h5d["/entry"].attrs["NX_class"] = "NXentry"
h5d["/entry"].attrs["definition"] = u"NXtomo" h5d["/entry"].attrs["definition"] = "NXtomo"
h5d["/entry"].attrs["version"] = converter_version() h5d["/entry"].attrs["version"] = converter_version()
h5d["/entry/instrument"].attrs["NX_class"] = u"NXinstrument" h5d["/entry/instrument"].attrs["NX_class"] = "NXinstrument"
h5d["/entry/instrument/detector"].attrs["NX_class"] = u"NXdetector" h5d["/entry/instrument/detector"].attrs["NX_class"] = "NXdetector"
h5d["/entry/instrument/detector/data"].attrs["interpretation"] = u"image" h5d["/entry/instrument/detector/data"].attrs["interpretation"] = "image"
h5d["/entry/sample"].attrs["NX_class"] = u"NXsample" h5d["/entry/sample"].attrs["NX_class"] = "NXsample"
h5d["/entry/definition"] = "NXtomo" h5d["/entry/definition"] = "NXtomo"
source_grp = h5d["/entry/instrument"].get("source", None) source_grp = h5d["/entry/instrument"].get("source", None)
if source_grp is not None and "NX_class" not in source_grp.attrs: if source_grp is not None and "NX_class" not in source_grp.attrs:
......
...@@ -196,7 +196,7 @@ class _BlissSample: ...@@ -196,7 +196,7 @@ class _BlissSample:
# add sequence init information # add sequence init information
with h5py.File(self.sample_file, mode="a") as h5f: with h5py.File(self.sample_file, mode="a") as h5f:
seq_node = h5f.require_group(str(seq_ini_index) + ".1") seq_node = h5f.require_group(str(seq_ini_index) + ".1")
seq_node.attrs["NX_class"] = u"NXentry" seq_node.attrs["NX_class"] = "NXentry"
seq_node["title"] = self.get_main_entry_title() seq_node["title"] = self.get_main_entry_title()
seq_node.require_group("instrument/positioners") seq_node.require_group("instrument/positioners")
# write energy # write energy
...@@ -267,7 +267,7 @@ class _BlissSample: ...@@ -267,7 +267,7 @@ class _BlissSample:
acq_grp["acq_expo_time"] = 4 acq_grp["acq_expo_time"] = 4
det_path_2 = "/".join(("technique", "scan", self._detector_name)) det_path_2 = "/".join(("technique", "scan", self._detector_name))
seq_node[det_path_2] = data seq_node[det_path_2] = data
seq_node.attrs["NX_class"] = u"NXentry" seq_node.attrs["NX_class"] = "NXentry"
# write rotation angle value and translations # write rotation angle value and translations
hrsrot_pos = seq_node.require_group("/".join(("instrument", "positioners"))) hrsrot_pos = seq_node.require_group("/".join(("instrument", "positioners")))
hrsrot_pos["hrsrot"] = numpy.random.randint( hrsrot_pos["hrsrot"] = numpy.random.randint(
...@@ -451,7 +451,7 @@ class _BlissXRD_CT(_BlissSample): ...@@ -451,7 +451,7 @@ class _BlissXRD_CT(_BlissSample):
with h5py.File(self.sample_file, mode="a") as h5f: with h5py.File(self.sample_file, mode="a") as h5f:
scan_node = h5f.require_group(scan_name) scan_node = h5f.require_group(scan_name)
scan_node.attrs["NX_class"] = u"NXentry" scan_node.attrs["NX_class"] = "NXentry"
measrurement_node = h5f.require_group("/".join((scan_name, "measurement"))) measrurement_node = h5f.require_group("/".join((scan_name, "measurement")))
data = numpy.random.random(self._n_frame_per_scan) * 256.2 data = numpy.random.random(self._n_frame_per_scan) * 256.2
......
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