rs-station / laue-dials

A package for analyzing Laue x-ray crystallography data using the DIALS framework.
https://rs-station.github.io/laue-dials/
MIT License
4 stars 3 forks source link

laue.sequence_to_stills crashes when using slice of data that does not start at image 0 #61

Open toastisme opened 2 months ago

toastisme commented 2 months ago

dials=3.17.0 laue-dials=0.4

Using the hewl dataset from laue_tutorials, if I take the first 100 images and run through the reduction pipeline everything works as expected. However if I take a different slice of the images (e.g. 600-700),

laue.sequence_to_stills monochromatic_HEWL_anom_3049.expt monochromatic_HEWL_anom_3049.refl fails with

Traceback (most recent call last):
  File "/n/home10/dmcdonagh/.conda/envs/manuscript_env/bin/laue.sequence_to_stills", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/n/home10/dmcdonagh/.conda/envs/manuscript_env/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/n/home10/dmcdonagh/.conda/envs/manuscript_env/lib/python3.11/site-packages/laue_dials/command_line/sequence_to_stills.py", line 238, in run
    (new_experiments, new_reflections) = sequence_to_stills(
                                         ^^^^^^^^^^^^^^^^^^^
  File "/n/home10/dmcdonagh/.conda/envs/manuscript_env/lib/python3.11/site-packages/laue_dials/command_line/sequence_to_stills.py", line 140, in sequence_to_stills
    imageset=experiment.imageset.as_imageset()[
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/n/home10/dmcdonagh/.conda/envs/manuscript_env/lib/python3.11/site-packages/dxtbx/imageset.py", line 124, in __getitem__
    return self.partial_set(reader, start, stop)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OverflowError: Please report this error to dials-support@lists.sourceforge.net: can't convert negative value to unsigned int

Looking at the reflection tables in the two different cases, in the case where it fails there are some with bounding boxes where the z coordinate starts at -1, which might explain the error.

Steps to reproduce:

dials.import geometry.scan.oscillation=0,1 \
    geometry.goniometer.axes=-1,0,0 \
    geometry.beam.wavelength=1.05 \
    geometry.detector.panel.pixel=0.08854,0.08854 \
    input.template='PATH_TO_HEWL_DATA/HEWL_NaI_3_2_06##.mccd' \
    output.experiments=imported_HEWL_anom_3049.expt \
    output.log=dials.import_HEWL_anom_3049.log

laue.find_spots imported_HEWL_anom_3049.expt \
    spotfinder.mp.nproc=8 \
    spotfinder.threshold.dispersion.gain=0.15 \
    spotfinder.filter.max_separation=10 \
    output.reflections=strong_HEWL_anom_3049.refl \
    output.log=laue.find_spots_HEWL_anom_3049.log

laue.index imported_HEWL_anom_3049.expt strong_HEWL_anom_3049.refl \
    indexer.indexing.nproc=2 \
    indexer.indexing.known_symmetry.space_group=96 \
    indexer.indexing.refinement_protocol.mode=refine_shells \
    indexer.refinement.parameterisation.auto_reduction.action=fix \
    laue_output.index_only=False \
    laue_output.indexed.experiments=indexed_HEWL_anom_3049.expt \
    laue_output.indexed.reflections=indexed_HEWL_anom_3049.refl \
    laue_output.refined.experiments=refined_HEWL_anom_3049.expt \
    laue_output.refined.reflections=refined_HEWL_anom_3049.refl \
    laue_output.final_output.experiments=monochromatic_HEWL_anom_3049.expt \
    laue_output.final_output.reflections=monochromatic_HEWL_anom_3049.refl \
    laue_output.log=laue.index_HEWL_anom_3049.log

laue.sequence_to_stills monochromatic_HEWL_anom_3049.expt monochromatic_HEWL_anom_3049.refl \
    output.experiments=stills_HEWL_anom_3049.expt \
    output.reflections=stills_HEWL_anom_3049.refl \
    output.log=laue.sequence_to_stills_HEWL_anom_3049.log