Commit 7e501249 authored by payno's avatar payno
Browse files

[settings] rename settings. Remove prefix 'H5_' and 'EDF_' since they are now part of a namespace

parent 4ae7d411
Pipeline #45903 passed with stages
in 5 minutes and 1 second
......@@ -41,15 +41,15 @@ from nxtomomill.utils import Progress
from nxtomomill.settings import Tomo
from tomoscan.esrf.edfscan import EDFTomoScan
EDF_MOTOR_POS = Tomo.EDF.EDF_MOTOR_POS
EDF_MOTOR_MNE = Tomo.EDF.EDF_MOTOR_MNE
EDF_REFS_NAMES = Tomo.EDF.EDF_REFS_NAMES
EDF_TO_IGNORE = Tomo.EDF.EDF_TO_IGNORE
EDF_ROT_ANGLE = Tomo.EDF.EDF_ROT_ANGLE
EDF_DARK_NAMES = Tomo.EDF.EDF_DARK_NAMES
EDF_X_TRANS = Tomo.EDF.EDF_X_TRANS
EDF_Y_TRANS = Tomo.EDF.EDF_Y_TRANS
EDF_Z_TRANS = Tomo.EDF.EDF_Z_TRANS
EDF_MOTOR_POS = Tomo.EDF.MOTOR_POS
EDF_MOTOR_MNE = Tomo.EDF.MOTOR_MNE
EDF_REFS_NAMES = Tomo.EDF.REFS_NAMES
EDF_TO_IGNORE = Tomo.EDF.TO_IGNORE
EDF_ROT_ANGLE = Tomo.EDF.ROT_ANGLE
EDF_DARK_NAMES = Tomo.EDF.DARK_NAMES
EDF_X_TRANS = Tomo.EDF.X_TRANS
EDF_Y_TRANS = Tomo.EDF.Y_TRANS
EDF_Z_TRANS = Tomo.EDF.Z_TRANS
logging.basicConfig(level=logging.INFO)
_logger = logging.getLogger(__name__)
......
......@@ -46,15 +46,15 @@ import fabio
import numpy
import os
EDF_MOTOR_POS = Tomo.EDF.EDF_MOTOR_POS
EDF_MOTOR_MNE = Tomo.EDF.EDF_MOTOR_MNE
EDF_REFS_NAMES = Tomo.EDF.EDF_REFS_NAMES
EDF_TO_IGNORE = Tomo.EDF.EDF_TO_IGNORE
EDF_ROT_ANGLE = Tomo.EDF.EDF_ROT_ANGLE
EDF_DARK_NAMES = Tomo.EDF.EDF_DARK_NAMES
EDF_X_TRANS = Tomo.EDF.EDF_X_TRANS
EDF_Y_TRANS = Tomo.EDF.EDF_Y_TRANS
EDF_Z_TRANS = Tomo.EDF.EDF_Z_TRANS
EDF_MOTOR_POS = Tomo.EDF.MOTOR_POS
EDF_MOTOR_MNE = Tomo.EDF.MOTOR_MNE
EDF_REFS_NAMES = Tomo.EDF.REFS_NAMES
EDF_TO_IGNORE = Tomo.EDF.TO_IGNORE
EDF_ROT_ANGLE = Tomo.EDF.ROT_ANGLE
EDF_DARK_NAMES = Tomo.EDF.DARK_NAMES
EDF_X_TRANS = Tomo.EDF.X_TRANS
EDF_Y_TRANS = Tomo.EDF.Y_TRANS
EDF_Z_TRANS = Tomo.EDF.Z_TRANS
import logging
......
......@@ -69,22 +69,22 @@ from nxtomomill.converter.hdf5.utils import H5ScanTitles
from nxtomomill.settings import Tomo
H5_ROT_ANGLE_KEYS = Tomo.H5.H5_ROT_ANGLE_KEYS
H5_VALID_CAMERA_NAMES = Tomo.H5.H5_VALID_CAMERA_NAMES
H5_X_TRANS_KEYS = Tomo.H5.H5_X_TRANS_KEYS
H5_Y_TRANS_KEYS = Tomo.H5.H5_Y_TRANS_KEYS
H5_Z_TRANS_KEYS = Tomo.H5.H5_Z_TRANS_KEYS
H5_ALIGNMENT_TITLES = Tomo.H5.H5_ALIGNMENT_TITLES
H5_ACQ_EXPO_TIME_KEYS = Tomo.H5.H5_ACQ_EXPO_TIME_KEYS
H5_X_PIXEL_SIZE = Tomo.H5.H5_X_PIXEL_SIZE
H5_Y_PIXEL_SIZE = Tomo.H5.H5_Y_PIXEL_SIZE
H5_DARK_TITLES = Tomo.H5.H5_DARK_TITLES
H5_INIT_TITLES = Tomo.H5.H5_INIT_TITLES
H5_ZSERIE_INIT_TITLES = Tomo.H5.H5_ZSERIE_INIT_TITLES
H5_PROJ_TITLES = Tomo.H5.H5_PROJ_TITLES
H5_REF_TITLES = Tomo.H5.H5_REF_TITLES
H5_Y_ROT_KEY = Tomo.H5.H5_Y_ROT_KEY
H5_DIODE_KEYS = Tomo.H5.H5_DIODE_KEYS
H5_ROT_ANGLE_KEYS = Tomo.H5.ROT_ANGLE_KEYS
H5_VALID_CAMERA_NAMES = Tomo.H5.VALID_CAMERA_NAMES
H5_X_TRANS_KEYS = Tomo.H5.X_TRANS_KEYS
H5_Y_TRANS_KEYS = Tomo.H5.Y_TRANS_KEYS
H5_Z_TRANS_KEYS = Tomo.H5.Z_TRANS_KEYS
H5_ALIGNMENT_TITLES = Tomo.H5.ALIGNMENT_TITLES
H5_ACQ_EXPO_TIME_KEYS = Tomo.H5.ACQ_EXPO_TIME_KEYS
H5_X_PIXEL_SIZE = Tomo.H5.X_PIXEL_SIZE
H5_Y_PIXEL_SIZE = Tomo.H5.Y_PIXEL_SIZE
H5_DARK_TITLES = Tomo.H5.DARK_TITLES
H5_INIT_TITLES = Tomo.H5.INIT_TITLES
H5_ZSERIE_INIT_TITLES = Tomo.H5.ZSERIE_INIT_TITLES
H5_PROJ_TITLES = Tomo.H5.PROJ_TITLES
H5_REF_TITLES = Tomo.H5.REF_TITLES
H5_Y_ROT_KEY = Tomo.H5.Y_ROT_KEY
H5_DIODE_KEYS = Tomo.H5.DIODE_KEYS
DEFAULT_SCAN_TITLES = H5ScanTitles(
H5_INIT_TITLES,
......
......@@ -291,27 +291,27 @@ class TomoHDF5Config:
self._field_of_view = None
# information regarding keys and paths
self._valid_camera_names = settings.Tomo.H5.H5_VALID_CAMERA_NAMES
self._rot_angle_keys = settings.Tomo.H5.H5_ROT_ANGLE_KEYS
self._x_trans_keys = settings.Tomo.H5.H5_X_TRANS_KEYS
self._y_trans_keys = settings.Tomo.H5.H5_Y_TRANS_KEYS
self._z_trans_keys = settings.Tomo.H5.H5_Z_TRANS_KEYS
self._y_rot_key = settings.Tomo.H5.H5_Y_ROT_KEY
self._diode_keys = settings.Tomo.H5.H5_DIODE_KEYS
self._expo_time_keys = settings.Tomo.H5.H5_ACQ_EXPO_TIME_KEYS
self._sample_detector_distance_keys = settings.Tomo.H5.H5_DISTANCE_KEYS
self._valid_camera_names = settings.Tomo.H5.VALID_CAMERA_NAMES
self._rot_angle_keys = settings.Tomo.H5.ROT_ANGLE_KEYS
self._x_trans_keys = settings.Tomo.H5.X_TRANS_KEYS
self._y_trans_keys = settings.Tomo.H5.Y_TRANS_KEYS
self._z_trans_keys = settings.Tomo.H5.Z_TRANS_KEYS
self._y_rot_key = settings.Tomo.H5.Y_ROT_KEY
self._diode_keys = settings.Tomo.H5.DIODE_KEYS
self._expo_time_keys = settings.Tomo.H5.ACQ_EXPO_TIME_KEYS
self._sample_detector_distance_keys = settings.Tomo.H5.DISTANCE_KEYS
# information regarding titles
self._entries = None
self._sub_entries_to_ignore = None
self._init_titles = settings.Tomo.H5.H5_INIT_TITLES
self._zserie_init_titles = settings.Tomo.H5.H5_ZSERIE_INIT_TITLES
self._dark_titles = settings.Tomo.H5.H5_DARK_TITLES
self._flat_titles = settings.Tomo.H5.H5_REF_TITLES
self._projection_titles = settings.Tomo.H5.H5_PROJ_TITLES
self._alignment_titles = settings.Tomo.H5.H5_ALIGNMENT_TITLES
self._x_pixel_size_paths = settings.Tomo.H5.H5_X_PIXEL_SIZE
self._y_pixel_size_paths = settings.Tomo.H5.H5_Y_PIXEL_SIZE
self._init_titles = settings.Tomo.H5.INIT_TITLES
self._zserie_init_titles = settings.Tomo.H5.ZSERIE_INIT_TITLES
self._dark_titles = settings.Tomo.H5.DARK_TITLES
self._flat_titles = settings.Tomo.H5.REF_TITLES
self._projection_titles = settings.Tomo.H5.PROJ_TITLES
self._alignment_titles = settings.Tomo.H5.ALIGNMENT_TITLES
self._x_pixel_size_paths = settings.Tomo.H5.X_PIXEL_SIZE
self._y_pixel_size_paths = settings.Tomo.H5.Y_PIXEL_SIZE
# information regarding frames types definition
self._data_grps_urls = tuple()
......
......@@ -60,65 +60,65 @@ class TestH5Config(unittest.TestCase):
# check titles values
titles_dict = output[TomoHDF5Config.ENTRIES_AND_TITLES_SECTION_DK]
self.assertEqual(
titles_dict[TomoHDF5Config.INIT_TITLES_DK], settings.Tomo.H5.H5_INIT_TITLES
titles_dict[TomoHDF5Config.INIT_TITLES_DK], settings.Tomo.H5.INIT_TITLES
)
self.assertEqual(
titles_dict[TomoHDF5Config.ZSERIE_INIT_TITLES_DK],
settings.Tomo.H5.H5_ZSERIE_INIT_TITLES,
settings.Tomo.H5.ZSERIE_INIT_TITLES,
)
self.assertEqual(
titles_dict[TomoHDF5Config.PROJ_TITLES_DK], settings.Tomo.H5.H5_PROJ_TITLES
titles_dict[TomoHDF5Config.PROJ_TITLES_DK], settings.Tomo.H5.PROJ_TITLES
)
self.assertEqual(
titles_dict[TomoHDF5Config.REF_TITLES_DK], settings.Tomo.H5.H5_REF_TITLES
titles_dict[TomoHDF5Config.REF_TITLES_DK], settings.Tomo.H5.REF_TITLES
)
self.assertEqual(
titles_dict[TomoHDF5Config.DARK_TITLES_DK], settings.Tomo.H5.H5_DARK_TITLES
titles_dict[TomoHDF5Config.DARK_TITLES_DK], settings.Tomo.H5.DARK_TITLES
)
self.assertEqual(
titles_dict[TomoHDF5Config.ALIGNMENT_TITLES_DK],
settings.Tomo.H5.H5_ALIGNMENT_TITLES,
settings.Tomo.H5.ALIGNMENT_TITLES,
)
# check pixel size
keys_dict = output[TomoHDF5Config.KEYS_SECTION_DK]
self.assertEqual(
keys_dict[TomoHDF5Config.X_PIXEL_SIZE_KEYS_DK],
settings.Tomo.H5.H5_X_PIXEL_SIZE,
settings.Tomo.H5.X_PIXEL_SIZE,
)
self.assertEqual(
keys_dict[TomoHDF5Config.Y_PIXEL_SIZE_KEYS_DK],
settings.Tomo.H5.H5_Y_PIXEL_SIZE,
settings.Tomo.H5.Y_PIXEL_SIZE,
)
# check translation
self.assertEqual(
keys_dict[TomoHDF5Config.X_TRANS_KEYS_DK], settings.Tomo.H5.H5_X_TRANS_KEYS
keys_dict[TomoHDF5Config.X_TRANS_KEYS_DK], settings.Tomo.H5.X_TRANS_KEYS
)
self.assertEqual(
keys_dict[TomoHDF5Config.Y_TRANS_KEYS_DK], settings.Tomo.H5.H5_Y_TRANS_KEYS
keys_dict[TomoHDF5Config.Y_TRANS_KEYS_DK], settings.Tomo.H5.Y_TRANS_KEYS
)
self.assertEqual(
keys_dict[TomoHDF5Config.Z_TRANS_KEYS_DK], settings.Tomo.H5.H5_Z_TRANS_KEYS
keys_dict[TomoHDF5Config.Z_TRANS_KEYS_DK], settings.Tomo.H5.Z_TRANS_KEYS
)
# others
if settings.Tomo.H5.H5_VALID_CAMERA_NAMES is None:
if settings.Tomo.H5.VALID_CAMERA_NAMES is None:
self.assertEqual(keys_dict[TomoHDF5Config.VALID_CAMERA_DK], "")
else:
self.assertEqual(
keys_dict[TomoHDF5Config.VALID_CAMERA_DK],
settings.Tomo.H5.H5_VALID_CAMERA_NAMES,
settings.Tomo.H5.VALID_CAMERA_NAMES,
)
self.assertEqual(
keys_dict[TomoHDF5Config.ROT_ANGLE_DK], settings.Tomo.H5.H5_ROT_ANGLE_KEYS
keys_dict[TomoHDF5Config.ROT_ANGLE_DK], settings.Tomo.H5.ROT_ANGLE_KEYS
)
self.assertEqual(
keys_dict[TomoHDF5Config.DIODE_KEYS_DK], settings.Tomo.H5.H5_DIODE_KEYS
keys_dict[TomoHDF5Config.DIODE_KEYS_DK], settings.Tomo.H5.DIODE_KEYS
)
self.assertEqual(
keys_dict[TomoHDF5Config.Y_ROT_KEYS_DK], settings.Tomo.H5.H5_Y_ROT_KEY
keys_dict[TomoHDF5Config.Y_ROT_KEYS_DK], settings.Tomo.H5.Y_ROT_KEY
)
self.assertEqual(
keys_dict[TomoHDF5Config.ACQUISITION_EXPO_TIME_KEYS_DK],
settings.Tomo.H5.H5_ACQ_EXPO_TIME_KEYS,
settings.Tomo.H5.ACQ_EXPO_TIME_KEYS,
)
# check input and output file
......
......@@ -36,13 +36,13 @@ class Tomo:
class H5:
"""HDF5 settings for tomography"""
H5_VALID_CAMERA_NAMES = None
VALID_CAMERA_NAMES = None
# now camera names are deduce using converter `get_nx_detectors`
# and `guess_nx_detector` functions. But you can provide A LIST of
# detector name (unix shell-style wildcards are managed) like
# ("pcolinux*", "basler", "frelon*", ...)
H5_ROT_ANGLE_KEYS = (
ROT_ANGLE_KEYS = (
"rotm",
"mhsrot",
"hsrot",
......@@ -54,25 +54,25 @@ class Tomo:
"rot",
)
H5_X_TRANS_KEYS = ("sx", "d3tx", "tfx", "px")
X_TRANS_KEYS = ("sx", "d3tx", "tfx", "px")
"""Keys used to find the x translation"""
H5_Y_TRANS_KEYS = ("sy", "d3ty", "hry", "py")
Y_TRANS_KEYS = ("sy", "d3ty", "hry", "py")
"""Keys used by bliss to store y translation"""
H5_Z_TRANS_KEYS = ("sz", "d3tz", "hrz", "pz")
Z_TRANS_KEYS = ("sz", "d3tz", "hrz", "pz")
"""Keys used by bliss to store translation"""
H5_Y_ROT_KEY = "instrument/positioners/yrot"
Y_ROT_KEY = "instrument/positioners/yrot"
"""Key used by bliss to store the estimated center of rotation for half
acquisition"""
H5_DIODE_KEYS = ("fpico3",)
DIODE_KEYS = ("fpico3",)
"""keys used by bliss to store diode dataset"""
H5_ACQ_EXPO_TIME_KEYS = ("acq_expo_time",)
ACQ_EXPO_TIME_KEYS = ("acq_expo_time",)
H5_INIT_TITLES = (
INIT_TITLES = (
"pcotomo:basic",
"tomo:basic",
"tomo:fullturn",
......@@ -83,23 +83,23 @@ class Tomo:
"""if a scan starts by one of those string then is considered as
initialization scan"""
H5_ZSERIE_INIT_TITLES = ("tomo:zseries",)
ZSERIE_INIT_TITLES = ("tomo:zseries",)
"""specific titles for zserie. Will extend H5_INIT_TITLES"""
H5_DARK_TITLES = ("dark images", "dark")
DARK_TITLES = ("dark images", "dark")
"""if a scan starts by one of those string then is considered as
dark scan"""
H5_REF_TITLES = ("reference images", "ref", "refend")
REF_TITLES = ("reference images", "ref", "refend")
"""if a scan starts by one of those string then is considered as
reference scan"""
H5_PROJ_TITLES = ("projections", "ascan rot 0 ", "ascan diffrz 0 180 1600 0.1")
PROJ_TITLES = ("projections", "ascan rot 0 ", "ascan diffrz 0 180 1600 0.1")
"""if a scan starts by one of those string then is considered as
projection scan"""
H5_ALIGNMENT_TITLES = ("static images", "ascan diffrz 180 0 4 0.1")
ALIGNMENT_TITLES = ("static images", "ascan diffrz 180 0 4 0.1")
"""if a scan starts by one of those string then is considered as
alignment scan"""
H5_X_PIXEL_SIZE = (
X_PIXEL_SIZE = (
"technique/optic/sample_pixel_size ",
"technique/optic/sample_pixel_size",
"technique/detector/pixel_size",
......@@ -108,37 +108,37 @@ class Tomo:
"""Possible path to th pixel size."""
# warning: we can have two cases: one with an empty space at the end or not
H5_Y_PIXEL_SIZE = (
Y_PIXEL_SIZE = (
"technique/optic/sample_pixel_size ",
"technique/optic/sample_pixel_size",
"technique/detector/pixel_size",
"hry_step_size",
)
H5_DISTANCE_KEYS = ("technique/scan/sample_detector_distance",)
DISTANCE_KEYS = ("technique/scan/sample_detector_distance",)
"""keys used by bliss to store the sample to detector distance"""
class EDF:
"""EDF settings for tomography"""
EDF_MOTOR_POS = "motor_pos"
MOTOR_POS = "motor_pos"
EDF_MOTOR_MNE = "motor_mne"
MOTOR_MNE = "motor_mne"
EDF_ROT_ANGLE = "srot"
ROT_ANGLE = "srot"
EDF_X_TRANS = "sx"
X_TRANS = "sx"
EDF_Y_TRANS = "sy"
Y_TRANS = "sy"
EDF_Z_TRANS = "sz"
Z_TRANS = "sz"
# EDF_TO_IGNORE = ['HST', '_slice_']
EDF_TO_IGNORE = ("_slice_",)
TO_IGNORE = ("_slice_",)
EDF_DARK_NAMES = ("darkend", "dark")
DARK_NAMES = ("darkend", "dark")
EDF_REFS_NAMES = ("ref", "refHST")
REFS_NAMES = ("ref", "refHST")
class XRD3D(Tomo):
......
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