some attributes don't default to NoneType anymore

Target.description defaults to "" (empty str)
Substrate.thickness defaults to "" (empty str)
Substrate.thickness_unit is now hardcoded to "μm"
did you know? apparently h5py does NOT like null values
This commit is contained in:
2026-02-16 15:35:22 +01:00
parent dfd3c07d2f
commit 1b1834d4e6

View File

@@ -175,7 +175,8 @@ class Substrate(Material):
self.miscut_angle_unit = self.extra["Miscut Angle"]["unit"] self.miscut_angle_unit = self.extra["Miscut Angle"]["unit"]
self.miscut_direction = self.extra["Miscut Direction"]["value"] self.miscut_direction = self.extra["Miscut Direction"]["value"]
# Not present (yet) on eLabFTW for Substrates: # Not present (yet) on eLabFTW for Substrates:
self.thickness = None #self.extra["Thickness"]["value"] self.thickness = "" #self.extra["Thickness"]["value"]
self.thickness_unit = "μm" #self.extra["Thickness"]["unit"]
self.surface_treatment = self.extra["Surface treatment"]["value"] self.surface_treatment = self.extra["Surface treatment"]["value"]
self.manufacturer = self.extra["Supplier"]["value"] self.manufacturer = self.extra["Supplier"]["value"]
self.batch_id = self.extra["Batch ID"]["value"] self.batch_id = self.extra["Batch ID"]["value"]
@@ -194,7 +195,7 @@ class Target(Material):
except KeyError as k: except KeyError as k:
raise KeyError(f"The provided dictionary lacks a \"{k}\" key - which is specific for PLD targets. Check the {self.name} target entry on eLabFTW and make sure you used the correct Resource template.") raise KeyError(f"The provided dictionary lacks a \"{k}\" key - which is specific for PLD targets. Check the {self.name} target entry on eLabFTW and make sure you used the correct Resource template.")
# Non-required attributes: # Non-required attributes:
self.description = material_data.get("body") or None self.description = material_data.get("body") or ""