1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
# coding: utf-8
"""
Module to convert from (Bliss) .h5 to (Nexus Tomo-compliant) .nx format.
"""
class Tomo:
class H5:
"""HDF5 settings for tomography"""
VALID_CAMERA_NAMES: tuple[str, ...] = tuple()
# Camera names are now deduced using the `get_nx_detectors` and
# `guess_nx_detector` functions. Alternatively, a list of detector
# names can be provided (supports Unix shell-style wildcards), such as:
# ("pcolinux*", "basler", "frelon*", ...)
ROT_ANGLE_KEYS = (
"rotm",
"mhsrot",
"hsrot",
"mrsrot",
"hrsrot",
"srot",
"srot_eh2",
"diffrz",
"hrrz_trig",
"rot",
)
"""Keys used to find rotation angles."""
TRANSLATION_Y_KEYS = ("yrot", "diffty", "hry")
"""Keys used to find the Y translation below the center of rotation."""
TRANSLATION_Z_KEYS = ("sz", "difftz", "hrz", "pz", "ntz", "samtz", "mrsz")
"""Keys used to find the Z translation below or above the center of rotation."""
SAMPLE_X_KEYS = ("samx", "psx", "sax", "fake_sx")
"""Keys used to find the X translation above the center of rotation (direction is independent of the rotation angle)."""
SAMPLE_Y_KEYS = ("samy", "psv", "say", "fake_sy")
"""Keys used to find the Y translation above the center of rotation (direction is independent of the rotation angle)."""
SAMPLE_U_KEYS = ("sau", "sx", "px", "ntx", "shtx", "hrx", "fake_su")
"""Keys used to find the U translation above the center of rotation (direction is dependent of the rotation angle)."""
SAMPLE_V_KEYS = ("sav", "sy", "py", "nty", "shty", "hry2", "fake_sv")
"""Keys used to find the V translation above the center of rotation (direction is dependent of the rotation angle)."""
DIODE_KEYS = ("fpico3",)
"""Keys used to store diode dataset."""
ACQ_EXPO_TIME_KEYS = ("acq_expo_time",)
"""Keys used to store acquisition exposure time."""
INIT_TITLES = (
"tomo:basic",
"tomo:fullturn",
"tomo:fulltomo",
"sequence_of_scans",
"tomo:halfturn",
"tomo:multiturn",
"tomo:helical",
"tomo:holotomo",
"holotomo_distance",
)
"""Initialization scan titles. Either the value of 'technique/scan_category' if exists else the value of 'title'"""
ZSERIE_INIT_TITLES = ("tomo:zseries",)
"""Specific titles for z-series scans."""
MULTITOMO_INIT_TITLES = (
"tomo:pcotomo",
"pcotomo",
"tomo:multitomo",
"multitomo",
"multitomo:basic",
"tomo:multiturn",
"multiturn",
)
"""Specific titles for multi-tomo scans (also known as PCO scans). Either the value of 'technique/scan_category' if exists else the value of 'title'"""
PCOTOMO_INIT_TITLES = MULTITOMO_INIT_TITLES
"""Deprecated. Replaced by 'MULTITOMO_INIT_TITLES'"""
BACK_AND_FORTH_INIT_TITLES = (
"tomo:backandforth",
"backandforthtomo:basic",
"backandforth",
"tomo:back_and_forth",
"back_and_forth",
)
"""Specific titles for back and forth scans. Either the value of 'technique/scan_category' if exists else the value of 'title'"""
DARK_TITLES = ("dark images", "dark")
"""Titles to determine dark field scans if 'technique/image_key' doesn't exists."""
FLAT_TITLES = ("flat", "reference images", "ref", "refend")
"""Titles to determine flat field scans if 'technique/image_key' doesn't exists."""
PROJ_TITLES = ("projections", "ascan rot 0", "ascan diffrz 0 180 1600 0.1")
"""Titles to determine projection scans if 'technique/image_key' doesn't exists."""
ALIGNMENT_TITLES = ("static images", "ascan diffrz 180 0 4 0.1")
"""Titles to determine alignment scans if 'technique/image_key' doesn't exists."""
SAMPLE_X_PIXEL_SIZE_KEYS = ("technique/optic/sample_pixel_size",)
"""Possible paths to the pixel size along the x-axis."""
SAMPLE_Y_PIXEL_SIZE_KEYS = ("technique/optic/sample_pixel_size",)
"""Possible paths to the pixel size along the y-axis."""
DETECTOR_X_PIXEL_SIZE_KEYS = (
"technique/optic/optics_pixel_size",
"technique/scan/detector_pixel_size",
"technique/detector/{detector_name}/pixel_size",
"technique/detector/pixel_size",
)
DETECTOR_Y_PIXEL_SIZE_KEYS = (
"technique/optic/optics_pixel_size",
"technique/scan/detector_pixel_size",
"technique/detector/{detector_name}/pixel_size",
"technique/detector/pixel_size",
)
SAMPLE_DETECTOR_DISTANCE_KEYS = ("technique/scan/sample_detector_distance",)
"""Keys used to store the sample to detector distance."""
SOURCE_SAMPLE_DISTANCE_KEYS = ("technique/scan/source_sample_distance",)
"""Keys used to store the source to sample distance."""
MACHINE_CURRENT_KEYS = ("current",)
"""Keys used to store machine current values."""
class EDF:
"""EDF settings for tomography"""
MOTOR_POS = ("motor_pos",)
"""Keys for motor positions."""
MOTOR_MNE = ("motor_mne",)
"""Keys for motor names (mnemonics)."""
ROT_ANGLE = ("srot", "somega")
"""Keys used to find the rotation angle."""
X_TRANS = ("sx",)
"""Keys used to find x translation in EDF format."""
Y_TRANS = ("sy",)
"""Keys used to find y translation in EDF format."""
Z_TRANS = ("sz",)
"""Keys used to find z translation in EDF format."""
MACHINE_CURRENT = ("srcur", "srcurrent")
"""Keys used to store machine current values."""
TO_IGNORE = ("_slice_",)
"""Fields to ignore when processing EDF files."""
DARK_NAMES = ("darkend", "dark")
"""Names identifying dark images in EDF files."""
REFS_NAMES = ("ref", "refHST")
"""Names identifying reference images in EDF files."""
|