Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormatXTC: add wavelength_fallback parameter #197

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/197.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
XTC support: add wavelength_fallback parameter
8 changes: 7 additions & 1 deletion src/dxtbx/format/FormatXTC.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/dxtbx/format/FormatXTCJungfrau.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading