diff --git a/csaxs_bec/bec_ipython_client/plugins/cSAXS/filter_transmission.py b/csaxs_bec/bec_ipython_client/plugins/cSAXS/filter_transmission.py index 3ca0f475..29e10193 100644 --- a/csaxs_bec/bec_ipython_client/plugins/cSAXS/filter_transmission.py +++ b/csaxs_bec/bec_ipython_client/plugins/cSAXS/filter_transmission.py @@ -74,19 +74,30 @@ class cSAXSFilterTransmission: # ----------------------------------------- # Exposure-box filter configuration (4 x 6) # - # Current hardware (per your message): - # Unit 1 (filter_array_1_x): out, Si400, Ge300, Ti800, Zr20 - # Unit 2 (filter_array_2_x): out, Si200, Si3200, Ti400, Cu20 - # Unit 3 (filter_array_3_x): out, Si100, Si1600, Ti200, Ti3200, Fe5 - # Unit 4 (filter_array_4_x): out, Si50, Si800, Ti100, Ti1600, Ti20 + # Thicknesses are the values from filter.mac rev 1.19, i.e. effective + # thicknesses measured at 18.58 keV rather than nominal foil thicknesses. + # They are used at every energy, which assumes the tabulated attenuation + # lengths are right and only the thickness was uncertain -- the same + # assumption spec made. The odd Si values are measurements, not typos. + # + # Unit 1 (filter_array_1_x): out, Si345.6, Ge300, Ti800, Zr20 + # Unit 2 (filter_array_2_x): out, Si234.6, Si3303, Ti400, Cu20 + # Unit 3 (filter_array_3_x): out, Si137.5, Si1661.5, Ti200, Ti3200, Fe5 + # Unit 4 (filter_array_4_x): out, Si50, Si833.8, Ti100, Ti1600, Ti20 # # Positions 1..6 = [out, m1, m2, m3, m4, m5] # Each entry: ((mat1, th1_um), (mat2, th2_um), enabled_bool) + # + # 'enabled' means the position exists and its transmission can be computed. + # Keeping the Zr/Cu calibration foils enabled is deliberate: they are real + # filters, so _fil_trans_report must account for them when one is parked in + # the beam for an edge scan. Excluding them from automatic selection is a + # separate concern -- see _EXCLUDE_FROM_SEARCH. # ----------------------------------------- _FILTERS: List[Tuple[Tuple[str, float], Tuple[str, float], bool]] = [ # Unit 1 (("none", 0.0), ("none", 0.0), True), # out - (("si", 400.0), ("none", 0.0), True), # Si400 + (("si", 345.6), ("none", 0.0), True), # Si345.6 (("ge", 300.0), ("none", 0.0), True), # Ge300 (("ti", 800.0), ("none", 0.0), True), # Ti800 (("zr", 20.0), ("none", 0.0), True), # Zr20 @@ -94,16 +105,16 @@ class cSAXSFilterTransmission: # Unit 2 (("none", 0.0), ("none", 0.0), True), # out - (("si", 200.0), ("none", 0.0), True), # Si200 - (("si", 3200.0), ("none", 0.0), True), # Si3200 + (("si", 234.6), ("none", 0.0), True), # Si234.6 + (("si", 3303.0), ("none", 0.0), True), # Si3303 (("ti", 400.0), ("none", 0.0), True), # Ti400 (("cu", 20.0), ("none", 0.0), True), # Cu20 (("none", 0.0), ("none", 0.0), False), # unused # Unit 3 (("none", 0.0), ("none", 0.0), True), # out - (("si", 100.0), ("none", 0.0), True), # Si100 - (("si", 1600.0), ("none", 0.0), True), # Si1600 + (("si", 137.5), ("none", 0.0), True), # Si137.5 + (("si", 1661.5), ("none", 0.0), True), # Si1661.5 (("ti", 200.0), ("none", 0.0), True), # Ti200 (("ti", 3200.0), ("none", 0.0), True), # Ti3200 (("fe", 5.0), ("none", 0.0), False), # Fe5 (disabled unless data file provided) @@ -111,12 +122,20 @@ class cSAXSFilterTransmission: # Unit 4 (("none", 0.0), ("none", 0.0), True), # out (("si", 50.0), ("none", 0.0), True), # Si50 - (("si", 800.0), ("none", 0.0), True), # Si800 + (("si", 833.8), ("none", 0.0), True), # Si833.8 (("ti", 100.0), ("none", 0.0), True), # Ti100 (("ti", 1600.0), ("none", 0.0), True), # Ti1600 (("ti", 20.0), ("none", 0.0), True), # Ti20 ] + # Calibration foils, not attenuators. filter.mac flagged these "disabled" so + # that selection by transmission would not pick them, while leaving them + # directly addressable via fil_comb -- they are exactly what you park in the + # beam for a K-edge scan. Zr in particular has its edge at 18.0 keV, so near + # that energy its transmission moves with any small energy change. + # (unit, position), both 1-based. + _EXCLUDE_FROM_SEARCH = frozenset({(1, 5), (2, 5)}) # Zr20, Cu20 + _UNITS = 4 _PER_UNIT = 6 @@ -520,10 +539,16 @@ class cSAXSFilterTransmission: for u in range(self._UNITS) ] - # Precompute per-position transmissions + # Precompute per-position transmissions. Positions excluded from the + # search are treated exactly like disabled ones here, i.e. skipped. per_pos_T: List[List[Optional[float]]] = [ - [self._position_transmission(pos_entry, energy_kev) for pos_entry in unit] - for unit in units + [ + None + if (u + 1, i + 1) in self._EXCLUDE_FROM_SEARCH + else self._position_transmission(pos_entry, energy_kev) + for i, pos_entry in enumerate(unit) + ] + for u, unit in enumerate(units) ] combos: List[dict] = []