diff --git a/newsfragments/XXX.misc b/newsfragments/XXX.misc new file mode 100644 index 000000000..675881082 --- /dev/null +++ b/newsfragments/XXX.misc @@ -0,0 +1 @@ +XTC support: add wavelength_fallback parameter diff --git a/src/dxtbx/format/FormatXTC.py b/src/dxtbx/format/FormatXTC.py index e405c6baf..80337b68e 100644 --- a/src/dxtbx/format/FormatXTC.py +++ b/src/dxtbx/format/FormatXTC.py @@ -68,6 +68,10 @@ for any events with a dropped spectrum. If the spectrum is \ present and calibration constants are provided, \ wavelength_offset is ignored. + wavelength_fallback = None + .type = float + .help = If the wavelength cannot be found from the XTC stream, fall \ + back to using this value instead spectrum_address = FEE-SPEC0 .type = str .help = Address for incident beam spectrometer @@ -391,7 +395,7 @@ def get_psana_timestamp(self, index): sec = time[0] nsec = time[1] - return serialtbx.util.timestamp((sec, nsec / 1e6)) + return serialtbx.util.time.timestamp((sec, nsec / 1e6)) def get_num_images(self): return self.n_images @@ -416,6 +420,8 @@ def _beam(self, index=None): wavelength = serialtbx.detector.xtc.evt_wavelength( evt, delta_k=self.params.wavelength_delta_k ) + if wavelength is None or wavelength <= 0: + wavelength = self.params.wavelength_fallback if self.params.wavelength_offset is not None: wavelength += self.params.wavelength_offset if wavelength is None: diff --git a/src/dxtbx/format/FormatXTCJungfrau.py b/src/dxtbx/format/FormatXTCJungfrau.py index 02dee7e24..ec8f7fff6 100644 --- a/src/dxtbx/format/FormatXTCJungfrau.py +++ b/src/dxtbx/format/FormatXTCJungfrau.py @@ -64,7 +64,7 @@ def understand(image_file): return any(["jungfrau" in src.lower() for src in params.detector_address]) def get_raw_data(self, index=None): - from serialtbx.detector.util import jungfrau + from serialtbx.detector import jungfrau if index is None: index = 0