Skip to content

Commit

Permalink
DIALS 3.21.1
Browse files Browse the repository at this point in the history
Bugfixes
--------

- Stop ``dxtbx.image_average`` shuffling panel positions for segmented detectors.
  • Loading branch information
Jenkins committed Aug 23, 2024
2 parents d297cf3 + c5f5da0 commit c7607fb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.21.0
current_version = 3.21.1
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<release>[a-z]+)?(?P<patch>\d+)?
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
DIALS 3.21.1 (2024-08-23)
=========================

Bugfixes
--------

- Stop ``dxtbx.image_average`` shuffling panel positions for segmented detectors. (`#752 <https://github.com/cctbx/dxtbx/issues/752>`_)


dxtbx 3.21.0 (2024-08-20)
=========================

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Static version number which is updated by bump2version
# Do not change this manually - use 'bump2version <major/minor/patch/release>'
__version_tag__ = "3.21.0"
__version_tag__ = "3.21.1"

setup_kwargs = {
"name": "dxtbx",
Expand Down
15 changes: 12 additions & 3 deletions src/dxtbx/format/cbf_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def level_string(key):
detector_axes_names = [] # save these for later
panelkeys = []
panelnames = []
panelindices = []

def recursive_setup_basis_dict(key, parent_name="", panel_id=0):
# Set up CBF axis names, including equipment components and depends_on chains
Expand All @@ -230,6 +231,8 @@ def recursive_setup_basis_dict(key, parent_name="", panel_id=0):
panelname = "PANEL_%d" % panel_id
panelkeys.append(key)
panelnames.append(panelname)
dxtbx_panel_index = list(detector).index(node)
panelindices.append(dxtbx_panel_index)
panel_id += 1

if len(key) == 1:
Expand All @@ -253,6 +256,11 @@ def recursive_setup_basis_dict(key, parent_name="", panel_id=0):
return panel_id

recursive_setup_basis_dict((0,))
# The order `recursive_setup_basis_dict` visits panels does not necessarily match
# the order returned by dxtbx's `get_detector` and `get_raw_data`.
# See https://github.com/cctbx/dxtbx/issues/745.
self.panelindices = panelindices # needed in add_data_to_cbf
sorted_panels = [detector[i] for i in panelindices]

if index is None:
cbf_root = self.imageset.paths()[0]
Expand Down Expand Up @@ -327,7 +335,7 @@ def recursive_setup_basis_dict(key, parent_name="", panel_id=0):
# defined as [min-trusted-value, max-trusted-value]. The CBF definition
# of 'overload' is in fact saturation - i.e. the max-trusted-value, while
# the undefined_value is below the min-trusted-value.
trusted_ranges = [panel.get_trusted_range() for panel in detector]
trusted_ranges = [panel.get_trusted_range() for panel in sorted_panels]
try:
add_frame_specific_cbf_tables(
cbf,
Expand All @@ -336,7 +344,7 @@ def recursive_setup_basis_dict(key, parent_name="", panel_id=0):
trusted_ranges,
diffrn_id,
False,
gain=[panel.get_gain() for panel in detector],
gain=[panel.get_gain() for panel in sorted_panels],
flux=beam.get_flux(),
)
except TypeError:
Expand All @@ -348,7 +356,7 @@ def recursive_setup_basis_dict(key, parent_name="", panel_id=0):
trusted_ranges,
diffrn_id,
False,
gain=[panel.get_gain() for panel in detector],
gain=[panel.get_gain() for panel in sorted_panels],
)

"""Data items in the AXIS category record the information required
Expand Down Expand Up @@ -596,6 +604,7 @@ def add_data_to_cbf(self, cbf, index=None, data=None, verbose=False):
data = self.imageset.get_raw_data(index)
if not isinstance(data, tuple):
data = (data,)
data = tuple([data[i] for i in self.panelindices])

array_names = []
cbf.find_category(b"diffrn_data_frame")
Expand Down

0 comments on commit c7607fb

Please sign in to comment.