fix(LamNI,flomni): FZP diameter/zone-width wrongly blanked to N/A
fzp_diameter_um/fzp_zone_width_nm were read inside the same try block as the focal-distance calculation, which also needs energy_kev. When the photon energy read fails (as it does in at least one simulated session -- confirmed live: dev.ccm_energy unavailable), the exception wiped out the diameter/zone-width display too, even though those come from config (loptx/foptx userParameter) and were read just fine. Split into two independent try blocks: diameter/zone-width no longer depend on a working energy read, only the focal distance itself does.
This commit is contained in:
@@ -2168,19 +2168,23 @@ class LamNI(TomoQueueMixin, LamNIAlignmentMixin, LamNIOpticsMixin, LamniGuiTools
|
||||
except Exception:
|
||||
energy_kev = None
|
||||
energy_str = "N/A"
|
||||
# FZP focal distance: same formula as lfzp_info(), from the
|
||||
# diameter/outermost-zone-width userParameter on loptx (see device
|
||||
# config) and the current photon energy above.
|
||||
# FZP diameter/outermost-zone-width: userParameter on loptx (see
|
||||
# device config) -- independent of the energy read above, so a
|
||||
# failed energy read shouldn't blank these out too.
|
||||
try:
|
||||
fzp_diameter_um = self._get_user_param_safe("loptx", "fzp_diameter")
|
||||
fzp_zone_width_nm = self._get_user_param_safe("loptx", "fzp_outermost_zone_width")
|
||||
except Exception:
|
||||
fzp_diameter_um = fzp_zone_width_nm = "N/A"
|
||||
# FZP focal distance: same formula as lfzp_info(), from the values
|
||||
# above and the current photon energy -- only this needs energy_kev.
|
||||
try:
|
||||
wavelength_m = 1.2398e-9 / energy_kev
|
||||
focal_distance_mm = (
|
||||
fzp_diameter_um * 1e-6 * fzp_zone_width_nm * 1e-9 / wavelength_m * 1000
|
||||
)
|
||||
focal_distance_str = f"{focal_distance_mm:.2f}"
|
||||
except Exception:
|
||||
fzp_diameter_um = fzp_zone_width_nm = "N/A"
|
||||
focal_distance_str = "N/A"
|
||||
# FZP focus-to-sample distance: same live z-stage-based calculation
|
||||
# lfzp_info() already uses -- not a stored value.
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 50 KiB |
@@ -3799,19 +3799,23 @@ class Flomni(
|
||||
except Exception:
|
||||
energy_kev = None
|
||||
energy_str = "N/A"
|
||||
# FZP focal distance: same formula as ffzp_info(), from the
|
||||
# diameter/outermost-zone-width userParameter on foptx (see device
|
||||
# config) and the current photon energy above.
|
||||
# FZP diameter/outermost-zone-width: userParameter on foptx (see
|
||||
# device config) -- independent of the energy read above, so a
|
||||
# failed energy read shouldn't blank these out too.
|
||||
try:
|
||||
fzp_diameter_um = self._get_user_param_safe("foptx", "fzp_diameter")
|
||||
fzp_zone_width_nm = self._get_user_param_safe("foptx", "fzp_outermost_zone_width")
|
||||
except Exception:
|
||||
fzp_diameter_um = fzp_zone_width_nm = "N/A"
|
||||
# FZP focal distance: same formula as ffzp_info(), from the values
|
||||
# above and the current photon energy -- only this needs energy_kev.
|
||||
try:
|
||||
wavelength_m = 1.2398e-9 / energy_kev
|
||||
focal_distance_mm = (
|
||||
fzp_diameter_um * 1e-6 * fzp_zone_width_nm * 1e-9 / wavelength_m * 1000
|
||||
)
|
||||
focal_distance_str = f"{focal_distance_mm:.2f}"
|
||||
except Exception:
|
||||
fzp_diameter_um = fzp_zone_width_nm = "N/A"
|
||||
focal_distance_str = "N/A"
|
||||
# FZP focus-to-sample distance: same live z-stage-based calculation
|
||||
# ffzp_info() already uses -- not a stored value.
|
||||
|
||||
Reference in New Issue
Block a user